vueless 0.0.812 → 0.0.813
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 +97 -119
- package/ui.data-table/UTableRow.vue +78 -19
- package/ui.data-table/types.ts +9 -0
- package/ui.data-table/utilTable.ts +4 -0
package/package.json
CHANGED
package/ui.data-table/UTable.vue
CHANGED
|
@@ -13,13 +13,12 @@ import {
|
|
|
13
13
|
import { merge, isEqual } from "lodash-es";
|
|
14
14
|
|
|
15
15
|
import UEmpty from "../ui.text-empty/UEmpty.vue";
|
|
16
|
-
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
17
16
|
import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
18
17
|
import ULoaderProgress from "../ui.loader-progress/ULoaderProgress.vue";
|
|
19
18
|
import UTableRow from "./UTableRow.vue";
|
|
20
19
|
|
|
21
20
|
import useUI from "../composables/useUI.ts";
|
|
22
|
-
import { getDefaults, cx
|
|
21
|
+
import { getDefaults, cx } from "../utils/ui.ts";
|
|
23
22
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
24
23
|
import { useLocale } from "../composables/useLocale.ts";
|
|
25
24
|
import { PX_IN_REM } from "../constants.js";
|
|
@@ -38,7 +37,6 @@ import {
|
|
|
38
37
|
import { COMPONENT_NAME } from "./constants.ts";
|
|
39
38
|
|
|
40
39
|
import type { Ref, ComputedRef } from "vue";
|
|
41
|
-
import type { Config as UDividerConfig } from "../ui.container-divider/types.ts";
|
|
42
40
|
import type {
|
|
43
41
|
Cell,
|
|
44
42
|
Row,
|
|
@@ -103,7 +101,6 @@ const selectAll = ref(false);
|
|
|
103
101
|
const canSelectAll = ref(true);
|
|
104
102
|
const selectedRows: Ref<RowId[]> = ref([]);
|
|
105
103
|
const tableRows: Ref<Row[]> = ref([]);
|
|
106
|
-
const firstRow = ref(0);
|
|
107
104
|
const tableWidth = ref(0);
|
|
108
105
|
const tableHeight = ref(0);
|
|
109
106
|
const pagePositionY = ref(0);
|
|
@@ -166,10 +163,6 @@ const colsCount = computed(() => {
|
|
|
166
163
|
return normalizedColumns.value.length + 1;
|
|
167
164
|
});
|
|
168
165
|
|
|
169
|
-
const lastRow = computed(() => {
|
|
170
|
-
return props.rows.length - 1;
|
|
171
|
-
});
|
|
172
|
-
|
|
173
166
|
const isShownActionsHeader = computed(
|
|
174
167
|
() => hasSlotContent(slots["header-actions"]) && Boolean(selectedRows.value.length),
|
|
175
168
|
);
|
|
@@ -195,7 +188,7 @@ const isCheckedMoreOneTableItems = computed(() => {
|
|
|
195
188
|
|
|
196
189
|
const tableRowWidthStyle = computed(() => ({ width: `${tableWidth.value / PX_IN_REM}rem` }));
|
|
197
190
|
|
|
198
|
-
const flatTableRows = computed(() => getFlatRows(
|
|
191
|
+
const flatTableRows = computed(() => getFlatRows(props.rows));
|
|
199
192
|
|
|
200
193
|
const isSelectedAllRows = computed(() => {
|
|
201
194
|
return selectedRows.value.length === flatTableRows.value.length;
|
|
@@ -212,6 +205,11 @@ const tableRowAttrs = computed(() => ({
|
|
|
212
205
|
bodyCellNestedExpandIconWrapperAttrs,
|
|
213
206
|
bodyRowCheckedAttrs,
|
|
214
207
|
bodyRowAttrs,
|
|
208
|
+
bodyDateDividerAttrs,
|
|
209
|
+
bodySelectedDateDividerAttrs,
|
|
210
|
+
bodyCellDateDividerAttrs,
|
|
211
|
+
bodyRowDateDividerAttrs,
|
|
212
|
+
bodyRowCheckedDateDividerAttrs,
|
|
215
213
|
}));
|
|
216
214
|
|
|
217
215
|
watch(selectAll, onChangeSelectAll, { deep: true });
|
|
@@ -265,7 +263,14 @@ function onWindowResize() {
|
|
|
265
263
|
setFooterCellWidth();
|
|
266
264
|
}
|
|
267
265
|
|
|
268
|
-
function getDateDividerData(rowDate: string | Date) {
|
|
266
|
+
function getDateDividerData(rowDate: string | Date | undefined) {
|
|
267
|
+
if (!rowDate) {
|
|
268
|
+
return {
|
|
269
|
+
label: "",
|
|
270
|
+
config: {},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
269
274
|
let dividerItem = {} as DateDivider;
|
|
270
275
|
|
|
271
276
|
if (Array.isArray(props.dateDivider)) {
|
|
@@ -333,7 +338,9 @@ function synchronizeTableItemsWithProps() {
|
|
|
333
338
|
}
|
|
334
339
|
|
|
335
340
|
function updateSelectedRows() {
|
|
336
|
-
const newSelectedRows = tableRows.value
|
|
341
|
+
const newSelectedRows = getFlatRows(tableRows.value)
|
|
342
|
+
.filter((row) => row.isChecked)
|
|
343
|
+
.map((row) => row.id);
|
|
337
344
|
const isNewRowsSelected = newSelectedRows.every((newRow) => selectedRows.value.includes(newRow));
|
|
338
345
|
const isSelectedSameRows = selectedRows.value.every((selectedRow) =>
|
|
339
346
|
newSelectedRows.includes(selectedRow),
|
|
@@ -363,7 +370,7 @@ function isShownDateDivider(rowIndex: number) {
|
|
|
363
370
|
|
|
364
371
|
const isPrevSameDate = prevItem?.rowDate === currentItem?.rowDate;
|
|
365
372
|
|
|
366
|
-
return !isPrevSameDate && props.dateDivider;
|
|
373
|
+
return Boolean(!isPrevSameDate && props.dateDivider);
|
|
367
374
|
}
|
|
368
375
|
|
|
369
376
|
function onClickRow(row: Row) {
|
|
@@ -422,16 +429,19 @@ function onToggleExpand(row: Row, expanded: boolean) {
|
|
|
422
429
|
|
|
423
430
|
function isRowSelectedWithin(rowIndex: number) {
|
|
424
431
|
const prevRow = sortedRows.value[rowIndex - 1];
|
|
425
|
-
const
|
|
426
|
-
const isRowsSelected = selectedRows.value.find(
|
|
427
|
-
(rowId) => rowId === sortedRows.value[rowIndex].id,
|
|
428
|
-
);
|
|
432
|
+
const targetRow = sortedRows.value[rowIndex];
|
|
429
433
|
|
|
430
434
|
if (prevRow) {
|
|
431
|
-
return
|
|
435
|
+
return Boolean(prevRow.isChecked && targetRow.isChecked);
|
|
432
436
|
}
|
|
433
437
|
|
|
434
|
-
return
|
|
438
|
+
return Boolean(targetRow.isChecked);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function onToggleRowCheckbox(rowId: RowId) {
|
|
442
|
+
const targetIndex = selectedRows.value.findIndex((selectedId) => selectedId === rowId);
|
|
443
|
+
|
|
444
|
+
~targetIndex ? selectedRows.value.splice(targetIndex, 1) : selectedRows.value.push(rowId);
|
|
435
445
|
}
|
|
436
446
|
|
|
437
447
|
defineExpose({
|
|
@@ -468,6 +478,9 @@ const {
|
|
|
468
478
|
footerAttrs,
|
|
469
479
|
bodyRowDateDividerAttrs,
|
|
470
480
|
bodyRowCheckedDateDividerAttrs,
|
|
481
|
+
bodyDateDividerAttrs,
|
|
482
|
+
bodySelectedDateDividerAttrs,
|
|
483
|
+
bodyCellDateDividerAttrs,
|
|
471
484
|
headerCellBaseAttrs,
|
|
472
485
|
headerCellCheckboxAttrs,
|
|
473
486
|
headerActionsCheckboxAttrs,
|
|
@@ -476,9 +489,6 @@ const {
|
|
|
476
489
|
headerCounterAttrs,
|
|
477
490
|
bodyEmptyStateAttrs,
|
|
478
491
|
bodyEmptyStateCellAttrs,
|
|
479
|
-
bodyDateDividerAttrs,
|
|
480
|
-
bodySelectedDateDividerAttrs,
|
|
481
|
-
bodyCellDateDividerAttrs,
|
|
482
492
|
headerActionsCounterAttrs,
|
|
483
493
|
stickyHeaderCounterAttrs,
|
|
484
494
|
stickyHeaderLoaderAttrs,
|
|
@@ -671,125 +681,93 @@ const {
|
|
|
671
681
|
<ULoaderProgress :loading="loading" v-bind="headerLoaderAttrs" />
|
|
672
682
|
</thead>
|
|
673
683
|
|
|
674
|
-
<tbody v-if="
|
|
675
|
-
<
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
>
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
</tr>
|
|
685
|
-
|
|
686
|
-
<tr
|
|
687
|
-
v-if="isShownDateDivider(rowIndex) && !isRowSelectedWithin(rowIndex) && row.rowDate"
|
|
688
|
-
v-bind="bodyRowDateDividerAttrs"
|
|
689
|
-
>
|
|
690
|
-
<td v-bind="bodyCellDateDividerAttrs" :colspan="colsCount">
|
|
691
|
-
<UDivider
|
|
692
|
-
size="xs"
|
|
693
|
-
:label="getDateDividerData(row.rowDate).label"
|
|
694
|
-
v-bind="bodyDateDividerAttrs"
|
|
695
|
-
:config="
|
|
696
|
-
getMergedConfig({
|
|
697
|
-
defaultConfig: bodyDateDividerAttrs.config,
|
|
698
|
-
globalConfig: getDateDividerData(row.rowDate).config,
|
|
699
|
-
}) as UDividerConfig
|
|
700
|
-
"
|
|
701
|
-
/>
|
|
702
|
-
</td>
|
|
703
|
-
</tr>
|
|
684
|
+
<tbody v-if="sortedRows.length" v-bind="bodyAttrs">
|
|
685
|
+
<tr
|
|
686
|
+
v-if="hasSlotContent($slots['before-first-row'])"
|
|
687
|
+
v-bind="sortedRows[0]?.isChecked ? bodyRowBeforeCheckedAttrs : bodyRowBeforeAttrs"
|
|
688
|
+
>
|
|
689
|
+
<td :colspan="colsCount" v-bind="bodyRowBeforeCellAttrs">
|
|
690
|
+
<!-- @slot Use it to add something before first row. -->
|
|
691
|
+
<slot name="before-first-row" />
|
|
692
|
+
</td>
|
|
693
|
+
</tr>
|
|
704
694
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
:
|
|
731
|
-
|
|
732
|
-
:empty-cell-label="emptyCellLabel"
|
|
733
|
-
:data-test="getDataTest('row')"
|
|
734
|
-
@click="onClickRow"
|
|
735
|
-
@dblclick="onDoubleClickRow"
|
|
736
|
-
@click-cell="onClickCell"
|
|
737
|
-
@toggle-expand="onToggleExpand"
|
|
738
|
-
@toggle-row-visibility="onToggleRowVisibility"
|
|
695
|
+
<UTableRow
|
|
696
|
+
v-for="(row, rowIndex) in sortedRows"
|
|
697
|
+
:key="row.id"
|
|
698
|
+
v-memo="[selectedRows.includes(row.id), isRowSelectedWithin(rowIndex)]"
|
|
699
|
+
:selectable="selectable"
|
|
700
|
+
:row="row"
|
|
701
|
+
:is-date-divider="isShownDateDivider(rowIndex)"
|
|
702
|
+
:columns="normalizedColumns"
|
|
703
|
+
:config="config"
|
|
704
|
+
:selected-within="isRowSelectedWithin(rowIndex)"
|
|
705
|
+
:date-divider-data="getDateDividerData(row.rowDate)"
|
|
706
|
+
:attrs="tableRowAttrs as unknown as UTableRowAttrs"
|
|
707
|
+
:cols-count="colsCount"
|
|
708
|
+
:nested-level="0"
|
|
709
|
+
:empty-cell-label="emptyCellLabel"
|
|
710
|
+
:data-test="getDataTest('row')"
|
|
711
|
+
@click="onClickRow"
|
|
712
|
+
@dblclick="onDoubleClickRow"
|
|
713
|
+
@click-cell="onClickCell"
|
|
714
|
+
@toggle-expand="onToggleExpand"
|
|
715
|
+
@toggle-row-visibility="onToggleRowVisibility"
|
|
716
|
+
@toggle-checkbox="onToggleRowCheckbox"
|
|
717
|
+
>
|
|
718
|
+
<template
|
|
719
|
+
v-for="(value, key, index) in mapRowColumns(row, normalizedColumns)"
|
|
720
|
+
:key="index"
|
|
721
|
+
#[`cell-${key}`]="slotValues"
|
|
739
722
|
>
|
|
740
|
-
|
|
741
|
-
v-for="(value, key, index) in mapRowColumns(row, normalizedColumns)"
|
|
742
|
-
:key="index"
|
|
743
|
-
#[`cell-${key}`]="slotValues"
|
|
744
|
-
>
|
|
745
|
-
<!--
|
|
723
|
+
<!--
|
|
746
724
|
@slot Use it to customize needed table cell.
|
|
747
725
|
@binding {string} value
|
|
748
726
|
@binding {object} row
|
|
749
727
|
@binding {number} index
|
|
728
|
+
@binding {number} cellIndex
|
|
750
729
|
-->
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
730
|
+
<slot
|
|
731
|
+
:name="`cell-${key}`"
|
|
732
|
+
:value="slotValues.value"
|
|
733
|
+
:row="slotValues.row"
|
|
734
|
+
:index="rowIndex"
|
|
735
|
+
:cell-index="index"
|
|
736
|
+
/>
|
|
737
|
+
</template>
|
|
758
738
|
|
|
759
|
-
|
|
760
|
-
|
|
739
|
+
<template #expand="{ row: expandedRow, expanded }">
|
|
740
|
+
<!--
|
|
761
741
|
@slot Use it to customize row expand icon.
|
|
762
742
|
@binding {object} row
|
|
763
743
|
@binding {boolean} expanded
|
|
744
|
+
@binding {number} index
|
|
764
745
|
-->
|
|
765
|
-
|
|
766
|
-
|
|
746
|
+
<slot name="expand" :index="rowIndex" :row="expandedRow" :expanded="expanded" />
|
|
747
|
+
</template>
|
|
767
748
|
|
|
768
|
-
|
|
769
|
-
|
|
749
|
+
<template #nested-content>
|
|
750
|
+
<!--
|
|
770
751
|
@slot Use it to add nested content inside a row.
|
|
771
752
|
@binding {object} row
|
|
753
|
+
@binding {number} index
|
|
772
754
|
-->
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
755
|
+
<slot v-if="row" name="nested-content" :index="rowIndex" :row="row" />
|
|
756
|
+
</template>
|
|
757
|
+
</UTableRow>
|
|
776
758
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
v-bind="bodyRowAfterAttrs"
|
|
780
|
-
>
|
|
781
|
-
<!--
|
|
759
|
+
<tr v-if="hasSlotContent($slots['after-last-row'])" v-bind="bodyRowAfterAttrs">
|
|
760
|
+
<!--
|
|
782
761
|
@slot Use it to add something after last row.
|
|
783
762
|
@binding {number} cols-count
|
|
784
763
|
@classes {string} classes
|
|
785
764
|
-->
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
</template>
|
|
765
|
+
<slot
|
|
766
|
+
name="after-last-row"
|
|
767
|
+
:cols-count="colsCount"
|
|
768
|
+
:classes="bodyCellBaseAttrs.class"
|
|
769
|
+
/>
|
|
770
|
+
</tr>
|
|
793
771
|
</tbody>
|
|
794
772
|
|
|
795
773
|
<tbody v-else>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, onMounted, useSlots, useTemplateRef } from "vue";
|
|
3
|
-
import { cx } from "../utils/ui.ts";
|
|
3
|
+
import { cx, getMergedConfig } from "../utils/ui.ts";
|
|
4
4
|
import { hasSlotContent } from "../utils/helper.ts";
|
|
5
5
|
|
|
6
6
|
import { PX_IN_REM } from "../constants.js";
|
|
@@ -11,10 +11,13 @@ import useUI from "../composables/useUI.ts";
|
|
|
11
11
|
|
|
12
12
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
13
13
|
import UCheckbox from "../ui.form-checkbox/UCheckbox.vue";
|
|
14
|
+
import UDivider from "../ui.container-divider/UDivider.vue";
|
|
14
15
|
|
|
15
16
|
import defaultConfig from "./config.ts";
|
|
17
|
+
import type { Config as UDividerConfig } from "../ui.container-divider/types.ts";
|
|
16
18
|
|
|
17
19
|
import type {
|
|
20
|
+
RowId,
|
|
18
21
|
Cell,
|
|
19
22
|
CellObject,
|
|
20
23
|
Row,
|
|
@@ -31,9 +34,14 @@ defineOptions({ internal: true });
|
|
|
31
34
|
|
|
32
35
|
const props = defineProps<UTableRowProps>();
|
|
33
36
|
|
|
34
|
-
const emit = defineEmits([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const emit = defineEmits([
|
|
38
|
+
"click",
|
|
39
|
+
"dblclick",
|
|
40
|
+
"clickCell",
|
|
41
|
+
"toggleExpand",
|
|
42
|
+
"toggleCheckbox",
|
|
43
|
+
"toggleRowVisibility",
|
|
44
|
+
]);
|
|
37
45
|
|
|
38
46
|
const cellRef = useTemplateRef<HTMLDivElement[]>("cell");
|
|
39
47
|
const toggleWrapperRef = useTemplateRef<HTMLDivElement[]>("toggle-wrapper");
|
|
@@ -85,7 +93,10 @@ const isNestedRowEmpty = computed(() => {
|
|
|
85
93
|
const isNestedDataEmpty = computed(() => {
|
|
86
94
|
if (!props.row.nestedData) return true;
|
|
87
95
|
|
|
88
|
-
return
|
|
96
|
+
return (
|
|
97
|
+
!props.row.nestedData.rows ||
|
|
98
|
+
(Array.isArray(props.row.nestedData.rows) && !props.row.nestedData.rows.length)
|
|
99
|
+
);
|
|
89
100
|
});
|
|
90
101
|
|
|
91
102
|
const isShownToggleIcon = computed(() => {
|
|
@@ -239,23 +250,63 @@ function getRowClasses(row: Row) {
|
|
|
239
250
|
return typeof rowClasses === "function" ? rowClasses(row) : rowClasses;
|
|
240
251
|
}
|
|
241
252
|
|
|
242
|
-
function getRowAttrs(
|
|
243
|
-
return
|
|
244
|
-
? props.attrs.bodyRowCheckedAttrs.value
|
|
245
|
-
: props.attrs.bodyRowAttrs.value;
|
|
253
|
+
function getRowAttrs(row: Row) {
|
|
254
|
+
return row.isChecked ? props.attrs.bodyRowCheckedAttrs.value : props.attrs.bodyRowAttrs.value;
|
|
246
255
|
}
|
|
247
256
|
|
|
248
257
|
function onToggleExpand(row: Row, expanded?: boolean) {
|
|
249
258
|
emit("toggleExpand", row, expanded || isExpanded(row));
|
|
250
259
|
}
|
|
251
260
|
|
|
261
|
+
function onInputCheckbox(rowId: RowId) {
|
|
262
|
+
emit("toggleCheckbox", rowId);
|
|
263
|
+
}
|
|
264
|
+
|
|
252
265
|
const { getDataTest } = useUI<Config>(defaultConfig);
|
|
253
266
|
</script>
|
|
254
267
|
|
|
255
268
|
<template>
|
|
256
269
|
<tr
|
|
257
|
-
v-
|
|
258
|
-
|
|
270
|
+
v-if="isDateDivider && !selectedWithin && row.rowDate"
|
|
271
|
+
v-bind="attrs.bodyRowDateDividerAttrs.value"
|
|
272
|
+
>
|
|
273
|
+
<td v-bind="attrs.bodyCellDateDividerAttrs.value" :colspan="colsCount">
|
|
274
|
+
<UDivider
|
|
275
|
+
size="xs"
|
|
276
|
+
:label="dateDividerData.label"
|
|
277
|
+
v-bind="attrs.bodyDateDividerAttrs.value"
|
|
278
|
+
:config="
|
|
279
|
+
getMergedConfig({
|
|
280
|
+
defaultConfig: attrs.bodyDateDividerAttrs.value.config,
|
|
281
|
+
globalConfig: dateDividerData.config,
|
|
282
|
+
}) as UDividerConfig
|
|
283
|
+
"
|
|
284
|
+
/>
|
|
285
|
+
</td>
|
|
286
|
+
</tr>
|
|
287
|
+
|
|
288
|
+
<tr
|
|
289
|
+
v-if="isDateDivider && selectedWithin && row.rowDate"
|
|
290
|
+
v-bind="attrs.bodyRowCheckedDateDividerAttrs.value"
|
|
291
|
+
>
|
|
292
|
+
<td v-bind="attrs.bodyCellDateDividerAttrs.value" :colspan="colsCount">
|
|
293
|
+
<UDivider
|
|
294
|
+
size="xs"
|
|
295
|
+
:label="dateDividerData.label"
|
|
296
|
+
v-bind="attrs.bodySelectedDateDividerAttrs.value"
|
|
297
|
+
:config="
|
|
298
|
+
getMergedConfig({
|
|
299
|
+
defaultConfig: attrs.bodyDateDividerAttrs.value.config,
|
|
300
|
+
globalConfig: dateDividerData.config,
|
|
301
|
+
}) as UDividerConfig
|
|
302
|
+
"
|
|
303
|
+
/>
|
|
304
|
+
</td>
|
|
305
|
+
</tr>
|
|
306
|
+
|
|
307
|
+
<tr
|
|
308
|
+
v-bind="{ ...$attrs, ...getRowAttrs(row) }"
|
|
309
|
+
:class="cx([getRowAttrs(row).class, getRowClasses(row)])"
|
|
259
310
|
@click="onClick(props.row)"
|
|
260
311
|
@dblclick="onDoubleClick(props.row)"
|
|
261
312
|
>
|
|
@@ -266,12 +317,12 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
266
317
|
@click.stop
|
|
267
318
|
>
|
|
268
319
|
<UCheckbox
|
|
269
|
-
|
|
320
|
+
:model-value="row.isChecked"
|
|
270
321
|
size="md"
|
|
271
|
-
:value="row.id"
|
|
272
322
|
v-bind="attrs.bodyCheckboxAttrs.value"
|
|
273
323
|
:data-id="row.id"
|
|
274
324
|
:data-test="getDataTest('body-checkbox')"
|
|
325
|
+
@input="onInputCheckbox(row.id)"
|
|
275
326
|
/>
|
|
276
327
|
</td>
|
|
277
328
|
|
|
@@ -357,10 +408,13 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
357
408
|
v-if="isSingleNestedRow && singleNestedRow && singleNestedRow.isShown && !row.nestedData"
|
|
358
409
|
v-bind="{
|
|
359
410
|
...$attrs,
|
|
360
|
-
...getRowAttrs(singleNestedRow
|
|
411
|
+
...getRowAttrs(singleNestedRow),
|
|
361
412
|
}"
|
|
362
|
-
|
|
363
|
-
:
|
|
413
|
+
:is-date-divider="isDateDivider"
|
|
414
|
+
:selected-within="selectedWithin"
|
|
415
|
+
:date-divider-data="dateDividerData"
|
|
416
|
+
:cols-count="colsCount"
|
|
417
|
+
:class="cx([getRowAttrs(singleNestedRow).class, getRowClasses(singleNestedRow)])"
|
|
364
418
|
:attrs="attrs"
|
|
365
419
|
:columns="columns"
|
|
366
420
|
:row="row.row as Row"
|
|
@@ -369,6 +423,7 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
369
423
|
:config="config"
|
|
370
424
|
:selectable="selectable"
|
|
371
425
|
:empty-cell-label="emptyCellLabel"
|
|
426
|
+
@toggle-checkbox="onInputCheckbox"
|
|
372
427
|
@toggle-expand="onToggleExpand"
|
|
373
428
|
@toggle-row-visibility="onClickToggleRowChild"
|
|
374
429
|
@click="onClick"
|
|
@@ -393,11 +448,14 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
393
448
|
v-if="nestedRow.isShown"
|
|
394
449
|
v-bind="{
|
|
395
450
|
...$attrs,
|
|
396
|
-
...getRowAttrs(nestedRow
|
|
451
|
+
...getRowAttrs(nestedRow),
|
|
397
452
|
}"
|
|
398
|
-
|
|
399
|
-
:class="cx([getRowAttrs(nestedRow.id).class, getRowClasses(nestedRow)])"
|
|
453
|
+
:class="cx([getRowAttrs(nestedRow).class, getRowClasses(nestedRow)])"
|
|
400
454
|
:attrs="attrs"
|
|
455
|
+
:is-date-divider="isDateDivider"
|
|
456
|
+
:selected-within="selectedWithin"
|
|
457
|
+
:date-divider-data="dateDividerData"
|
|
458
|
+
:cols-count="colsCount"
|
|
401
459
|
:columns="columns"
|
|
402
460
|
:row="nestedRow"
|
|
403
461
|
:data-test="getDataTest()"
|
|
@@ -410,6 +468,7 @@ const { getDataTest } = useUI<Config>(defaultConfig);
|
|
|
410
468
|
@click="onClick"
|
|
411
469
|
@dblclick="onDoubleClick"
|
|
412
470
|
@click-cell="onClickCell"
|
|
471
|
+
@toggle-checkbox="onInputCheckbox"
|
|
413
472
|
>
|
|
414
473
|
<template
|
|
415
474
|
v-for="(value, key, index) in mapRowColumns(nestedRow, columns)"
|
package/ui.data-table/types.ts
CHANGED
|
@@ -127,6 +127,11 @@ export interface UTableRowAttrs {
|
|
|
127
127
|
bodyCellNestedExpandIconWrapperAttrs: Ref<UnknownObject>;
|
|
128
128
|
bodyRowCheckedAttrs: Ref<UnknownObject>;
|
|
129
129
|
bodyRowAttrs: Ref<UnknownObject>;
|
|
130
|
+
bodyDateDividerAttrs: Ref<UnknownObject>;
|
|
131
|
+
bodySelectedDateDividerAttrs: Ref<UnknownObject>;
|
|
132
|
+
bodyCellDateDividerAttrs: Ref<UnknownObject>;
|
|
133
|
+
bodyRowDateDividerAttrs: Ref<UnknownObject>;
|
|
134
|
+
bodyRowCheckedDateDividerAttrs: Ref<UnknownObject>;
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
export interface UTableRowProps {
|
|
@@ -137,5 +142,9 @@ export interface UTableRowProps {
|
|
|
137
142
|
nestedLevel: number;
|
|
138
143
|
dataTest: string | null;
|
|
139
144
|
attrs: UTableRowAttrs;
|
|
145
|
+
isDateDivider: boolean;
|
|
146
|
+
selectedWithin: boolean;
|
|
147
|
+
dateDividerData: DateDivider;
|
|
148
|
+
colsCount: number;
|
|
140
149
|
config: Config;
|
|
141
150
|
}
|
|
@@ -23,6 +23,10 @@ export function syncRowCheck(row: Row, selectedRows: RowId[]) {
|
|
|
23
23
|
row.row = syncRowCheck(row.row, selectedRows);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
if (row.row && Array.isArray(row.row)) {
|
|
27
|
+
row.row = row.row.map((nestedRow) => syncRowCheck(nestedRow, selectedRows));
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
return row;
|
|
27
31
|
}
|
|
28
32
|
|