vueless 0.0.436 → 0.0.438
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 +1 -1
- package/ui.data-table/UTable.vue +0 -14
- package/ui.data-table/UTableRow.vue +52 -6
- package/web-types.json +1 -1
package/package.json
CHANGED
package/ui.data-table/UTable.vue
CHANGED
|
@@ -181,8 +181,6 @@
|
|
|
181
181
|
:columns="columns"
|
|
182
182
|
:config="config"
|
|
183
183
|
:attrs="keysAttrs"
|
|
184
|
-
v-bind="getRowAttrs(row.id)"
|
|
185
|
-
:class="cx([getRowAttrs(row.id).class, getRowClasses(row)])"
|
|
186
184
|
@click="onClickRow"
|
|
187
185
|
@click-cell="onClickCell"
|
|
188
186
|
@toggle-row-visibility="onToggleRowVisibility"
|
|
@@ -526,8 +524,6 @@ const {
|
|
|
526
524
|
bodyRowAfterCellAttrs,
|
|
527
525
|
bodyRowBeforeAttrs,
|
|
528
526
|
bodyRowBeforeCellAttrs,
|
|
529
|
-
bodyRowAttrs,
|
|
530
|
-
bodyRowCheckedAttrs,
|
|
531
527
|
footerAttrs,
|
|
532
528
|
bodyRowDateDividerAttrs,
|
|
533
529
|
headerCellBaseAttrs,
|
|
@@ -614,16 +610,6 @@ function getDateDividerLabel(rowDate) {
|
|
|
614
610
|
: rowDate;
|
|
615
611
|
}
|
|
616
612
|
|
|
617
|
-
function getRowAttrs(rowId) {
|
|
618
|
-
return selectedRows.value.includes(rowId) ? bodyRowCheckedAttrs.value : bodyRowAttrs.value;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
function getRowClasses(row) {
|
|
622
|
-
const rowClasses = row?.class || "";
|
|
623
|
-
|
|
624
|
-
return typeof rowClasses === "function" ? rowClasses(row) : rowClasses;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
613
|
function setFooterCellWidth(width) {
|
|
628
614
|
const ZERO_WIDTH = 0;
|
|
629
615
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<tr
|
|
2
|
+
<tr
|
|
3
|
+
v-bind="{ ...$attrs, ...getRowAttrs(row.id) }"
|
|
4
|
+
:class="cx([getRowAttrs(row.id).class, getRowClasses(row)])"
|
|
5
|
+
@click="onClick(props.row)"
|
|
6
|
+
>
|
|
3
7
|
<td
|
|
4
8
|
v-if="selectable"
|
|
5
9
|
:style="getNestedCheckboxShift()"
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
v-bind="bodyCellNestedAttrs"
|
|
29
33
|
>
|
|
30
34
|
<UIcon
|
|
31
|
-
v-if="
|
|
35
|
+
v-if="isShownToggleIcon"
|
|
32
36
|
size="xs"
|
|
33
37
|
internal
|
|
34
38
|
interactive
|
|
@@ -79,8 +83,12 @@
|
|
|
79
83
|
|
|
80
84
|
<UTableRow
|
|
81
85
|
v-if="isSingleNestedRow && row.row && !row.row.isHidden && !row.nestedData"
|
|
82
|
-
v-bind="
|
|
86
|
+
v-bind="{
|
|
87
|
+
...$attrs,
|
|
88
|
+
...getRowAttrs(row.row.id),
|
|
89
|
+
}"
|
|
83
90
|
v-model:selected-rows="selectedRows"
|
|
91
|
+
:class="cx([getRowAttrs(row.row.id).class, getRowClasses(row.row)])"
|
|
84
92
|
:attrs="attrs"
|
|
85
93
|
:columns="columns"
|
|
86
94
|
:row="row.row"
|
|
@@ -104,8 +112,12 @@
|
|
|
104
112
|
<template v-for="nestedRow in row.row" :key="nestedRow.id">
|
|
105
113
|
<UTableRow
|
|
106
114
|
v-if="!nestedRow.isHidden"
|
|
107
|
-
v-bind="
|
|
115
|
+
v-bind="{
|
|
116
|
+
...$attrs,
|
|
117
|
+
...getRowAttrs(nestedRow.id),
|
|
118
|
+
}"
|
|
108
119
|
v-model:selected-rows="selectedRows"
|
|
120
|
+
:class="cx([getRowAttrs(nestedRow.id).class, getRowClasses(nestedRow)])"
|
|
109
121
|
:attrs="attrs"
|
|
110
122
|
:columns="columns"
|
|
111
123
|
:row="nestedRow"
|
|
@@ -135,7 +147,7 @@
|
|
|
135
147
|
</template>
|
|
136
148
|
|
|
137
149
|
<script setup>
|
|
138
|
-
import { computed, onMounted, ref } from "vue";
|
|
150
|
+
import { computed, onMounted, ref, useSlots } from "vue";
|
|
139
151
|
import { cx } from "../utils/utilUI.js";
|
|
140
152
|
import useUI from "../composables/useUI.js";
|
|
141
153
|
|
|
@@ -196,6 +208,7 @@ const emit = defineEmits(["toggleRowVisibility", "click", "click-cell"]);
|
|
|
196
208
|
const selectedRows = defineModel("selectedRows", { type: Array, default: () => [] });
|
|
197
209
|
|
|
198
210
|
const cellRef = ref([]);
|
|
211
|
+
const slots = useSlots();
|
|
199
212
|
|
|
200
213
|
useMutationObserver(cellRef, setCellTitle, { childList: true });
|
|
201
214
|
|
|
@@ -210,13 +223,34 @@ const {
|
|
|
210
223
|
} = props.attrs;
|
|
211
224
|
|
|
212
225
|
const toggleIconConfig = computed(() =>
|
|
213
|
-
props.row?.row?.isHidden
|
|
226
|
+
props.row?.row?.isHidden
|
|
227
|
+
? bodyCellNestedExpandIconAttrs.value
|
|
228
|
+
: bodyCellNestedCollapseIconAttrs.value,
|
|
214
229
|
);
|
|
215
230
|
|
|
216
231
|
const shift = computed(() => (props.row.row ? 1.5 : 2));
|
|
217
232
|
|
|
218
233
|
const isSingleNestedRow = computed(() => !Array.isArray(props.row.row));
|
|
219
234
|
|
|
235
|
+
const isNestedRowEmpty = computed(() => {
|
|
236
|
+
if (!props.row.row) return true;
|
|
237
|
+
|
|
238
|
+
if (Array.isArray(props.row.row)) {
|
|
239
|
+
return props.row.row.some(
|
|
240
|
+
(nestedRow) => !Object.keys(getFilteredRow(nestedRow, props.columns)).length,
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return !Object.keys(getFilteredRow(props.row.row, props.columns)).length;
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
const isShownToggleIcon = computed(() => {
|
|
248
|
+
return (
|
|
249
|
+
(props.row.row && !isNestedRowEmpty.value) ||
|
|
250
|
+
(props.row.nestedData && hasSlotContent(slots["nested-content"]))
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
|
|
220
254
|
const getToggleIconName = computed(() => (row) => {
|
|
221
255
|
const isHiddenNestedRow = Array.isArray(row.row)
|
|
222
256
|
? row.row.some((nestedRow) => nestedRow.isHidden)
|
|
@@ -304,4 +338,16 @@ function onClickToggleIcon() {
|
|
|
304
338
|
function onClickCell(cell, row) {
|
|
305
339
|
emit("click-cell", cell, row);
|
|
306
340
|
}
|
|
341
|
+
|
|
342
|
+
function getRowClasses(row) {
|
|
343
|
+
const rowClasses = row?.class || "";
|
|
344
|
+
|
|
345
|
+
return typeof rowClasses === "function" ? rowClasses(row) : rowClasses;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function getRowAttrs(rowId) {
|
|
349
|
+
return selectedRows.value.includes(rowId)
|
|
350
|
+
? props.attrs.bodyRowCheckedAttrs.value
|
|
351
|
+
: props.attrs.bodyRowAttrs.value;
|
|
352
|
+
}
|
|
307
353
|
</script>
|