@@ -17,18 +16,16 @@ const sectionHeight = computed(() => `${100 / props.colors.length}%`);
:key="index"
:style="{
backgroundColor: color,
- height: sectionHeight,
- width: '100%',
- flexShrink: 0,
+ height: '10px',
}"
- />
+ >
+
+
diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue
index cd04aa4af..d739191ca 100644
--- a/src/components/VnTable/VnTable.vue
+++ b/src/components/VnTable/VnTable.vue
@@ -327,7 +327,6 @@ const editingRow = ref(null);
const editingField = ref(null);
const handleClick = (event) => {
- console.log('event: ', event);
const clickedElement = event.target.closest('td');
if (!clickedElement) return;
@@ -341,7 +340,6 @@ const handleClick = (event) => {
};
const vnEditableCell = ref(null);
const startEditing = async (rowId, field) => {
- console.log('entrando a startEditing');
const col = $props.columns.find((col) => col.name === field);
if (col?.isEditable === false) return;
editingRow.value = rowId;
@@ -359,48 +357,23 @@ const stopEditing = (rowIndex, field) => {
editingField.value = null;
};
-const findNextEditableColumnIndex = (columns, startIndex) => {
- let index = startIndex;
- console.log('columns: ', columns);
- console.log('index: ', index);
- console.log(
- 'columns[index]?.isVisible === false || columns[index]?.isEditable === false: ',
- columns[index]?.isVisible === false || columns[index]?.isEditable === false
- );
- while (columns[index]?.isVisible === false && columns[index]?.isEditable === false) {
- index++;
- if (index >= columns.length) {
- index = 0;
- }
- if (index === startIndex) {
- return -1;
- }
- }
- console.log('index: ', index);
- return index;
-};
-
const handleTab = async (rowIndex, colName) => {
- console.log('colName: ', colName);
- console.log('rowIndex: ', rowIndex);
const columns = $props.columns;
- console.log('columns: ', columns);
-
- if (!Array.isArray(columns) || columns.length === 0) return;
let currentColumnIndex = columns.findIndex((col) => col.name === colName);
- if (currentColumnIndex === -1) return;
-
- currentColumnIndex++;
- if (currentColumnIndex >= columns.length) {
- currentColumnIndex = 0;
- rowIndex++;
+ let newColumnIndex = currentColumnIndex + 1;
+ while (
+ columns[newColumnIndex]?.visible === false ||
+ columns[newColumnIndex]?.isEditable === false ||
+ !columns[newColumnIndex]?.component
+ ) {
+ newColumnIndex++;
+ if (newColumnIndex >= columns.length) newColumnIndex = 0;
}
- currentColumnIndex = findNextEditableColumnIndex(columns, currentColumnIndex);
- if (currentColumnIndex === -1) return;
+ if (currentColumnIndex >= newColumnIndex) rowIndex++;
- await startEditing(rowIndex, columns[currentColumnIndex].name);
+ await startEditing(rowIndex, columns[newColumnIndex].name);
};
const handleShiftTab = async (rowIndex, colName) => {
@@ -438,19 +411,25 @@ const handleShiftTab = async (rowIndex, colName) => {
await startEditing(prevRowIndex, columns[prevColumnIndex]?.name);
console.log('finishHandleShiftTab');
};
+
const handleTabKey = async (event, rowIndex, colName) => {
- console.log('colName: ', colName);
- console.log('rowIndex: ', rowIndex);
- console.log('event: ', event);
if (event.shiftKey) await handleShiftTab(rowIndex, colName);
else await handleTab(rowIndex, colName);
};
function getCheckboxIcon(value) {
- switch (value) {
- case true:
- return 'check';
- case false:
- return 'close';
+ switch (typeof value) {
+ case 'boolean':
+ return value ? 'check' : 'close';
+ case 'string':
+ return value.toLowerCase() === 'partial'
+ ? 'indeterminate_check_box'
+ : 'unknown_med';
+ case 'number':
+ return value > 0 ? 'check' : 'close';
+ case 'object':
+ return value === null ? 'help_outline' : 'unknown_med';
+ case 'undefined':
+ return 'help_outline';
default:
return 'unknown_med';
}
@@ -458,7 +437,7 @@ function getCheckboxIcon(value) {
function shouldDisplayReadonly(col, rowIndex) {
return (
- col?.isEditable === false ||
+ !col?.component ||
editingRow.value !== rowIndex ||
editingField.value !== col?.name
);
@@ -549,7 +528,11 @@ function shouldDisplayReadonly(col, rowIndex) {