vueless 0.0.823 → 0.0.824
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/ui.data-table/UTable.vue
CHANGED
|
@@ -418,8 +418,8 @@ function clearSelectedItems() {
|
|
|
418
418
|
selectedRows.value = [];
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
function onToggleRowVisibility(row:
|
|
422
|
-
const nestedRows = flatTableRows.value.filter((flatRow) => flatRow.
|
|
421
|
+
function onToggleRowVisibility(row: Row) {
|
|
422
|
+
const nestedRows = flatTableRows.value.filter((flatRow) => flatRow.parentRowId === row.id);
|
|
423
423
|
|
|
424
424
|
if (row.nestedData && row.nestedData.hasOwnProperty("isShown")) {
|
|
425
425
|
row.nestedData.isShown = !row.nestedData.isShown;
|
|
@@ -729,7 +729,7 @@ const {
|
|
|
729
729
|
@dblclick="onDoubleClickRow"
|
|
730
730
|
@click-cell="onClickCell"
|
|
731
731
|
@toggle-expand="onToggleExpand"
|
|
732
|
-
@toggle-row-visibility="onToggleRowVisibility"
|
|
732
|
+
@toggle-row-visibility="onToggleRowVisibility(row)"
|
|
733
733
|
@toggle-checkbox="onToggleRowCheckbox"
|
|
734
734
|
>
|
|
735
735
|
<template
|
|
@@ -202,8 +202,8 @@ function setElementTitle(element: HTMLElement) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
function onClickToggleIcon(
|
|
206
|
-
emit("toggleRowVisibility"
|
|
205
|
+
function onClickToggleIcon() {
|
|
206
|
+
emit("toggleRowVisibility");
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
function onClickCell(cell: unknown | string | number, row: Row, key: string | number) {
|
|
@@ -307,7 +307,7 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
307
307
|
>
|
|
308
308
|
<div
|
|
309
309
|
:data-row-toggle-icon="row.id"
|
|
310
|
-
@click.stop="() => (onClickToggleIcon(
|
|
310
|
+
@click.stop="() => (onClickToggleIcon(), onToggleExpand(row))"
|
|
311
311
|
>
|
|
312
312
|
<slot name="expand" :row="row" :expanded="isExpanded(row)">
|
|
313
313
|
<div
|
package/ui.data-table/types.ts
CHANGED
|
@@ -46,21 +46,23 @@ export function addRowId(row: Row) {
|
|
|
46
46
|
return row;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export function toggleRowVisibility(row: Row, targetRowId: string | number) {
|
|
49
|
+
export function toggleRowVisibility(row: Row, targetRowId: string | number): Row {
|
|
50
50
|
if (row.id === targetRowId) {
|
|
51
51
|
if (row.hasOwnProperty("isShown")) {
|
|
52
52
|
row.isShown = !row.isShown;
|
|
53
|
+
|
|
54
|
+
if (!row.isShown) {
|
|
55
|
+
setNestedRowsHidden(row);
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
return row;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
if (row.row && !Array.isArray(row.row)) {
|
|
59
|
-
toggleRowVisibility(row.row, targetRowId);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
62
|
if (row.row && Array.isArray(row.row)) {
|
|
63
63
|
row.row.forEach((nestedRow) => toggleRowVisibility(nestedRow, targetRowId));
|
|
64
|
+
} else if (row.row && !Array.isArray(row.row)) {
|
|
65
|
+
toggleRowVisibility(row.row, targetRowId);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
if (row.nestedData) {
|
|
@@ -70,6 +72,24 @@ export function toggleRowVisibility(row: Row, targetRowId: string | number) {
|
|
|
70
72
|
return row;
|
|
71
73
|
}
|
|
72
74
|
|
|
75
|
+
function setNestedRowsHidden(row: Row) {
|
|
76
|
+
if (row.hasOwnProperty("isShown")) {
|
|
77
|
+
row.isShown = false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (row.row) {
|
|
81
|
+
if (Array.isArray(row.row)) {
|
|
82
|
+
row.row.forEach(setNestedRowsHidden);
|
|
83
|
+
} else {
|
|
84
|
+
setNestedRowsHidden(row.row);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (row.nestedData) {
|
|
89
|
+
setNestedRowsHidden(row.nestedData);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
73
93
|
export function switchRowCheck(row: Row, isChecked: boolean) {
|
|
74
94
|
row.isChecked = isChecked;
|
|
75
95
|
|
|
@@ -87,9 +107,9 @@ export function switchRowCheck(row: Row, isChecked: boolean) {
|
|
|
87
107
|
export function getFlatRows(tableRows: Row[]) {
|
|
88
108
|
const rows: FlatRow[] = [];
|
|
89
109
|
|
|
90
|
-
function addRow(row: Row, nestedLevel: number,
|
|
91
|
-
if (
|
|
92
|
-
row.
|
|
110
|
+
function addRow(row: Row, nestedLevel: number, parentRowId?: string | number) {
|
|
111
|
+
if (parentRowId) {
|
|
112
|
+
row.parentRowId = parentRowId;
|
|
93
113
|
}
|
|
94
114
|
|
|
95
115
|
row.nestedLevel = nestedLevel;
|