sprintify-ui 0.8.6 → 0.8.8
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/dist/sprintify-ui.es.js +3380 -3362
- package/dist/types/components/BaseDataIteratorSectionColumns.vue.d.ts +32 -32
- package/dist/types/components/BaseDataTable.vue.d.ts +17 -0
- package/dist/types/components/BaseDataTableTemplate.vue.d.ts +9 -9
- package/package.json +1 -1
- package/src/components/BaseDataTable.stories.js +2 -1
- package/src/components/BaseDataTable.vue +10 -0
- package/src/components/BaseDataTableTemplate.vue +45 -21
|
@@ -19,9 +19,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
19
|
checkedRows: import("@/index.js").Row[];
|
|
20
20
|
isRowCheckable: Function;
|
|
21
21
|
maxHeight: number;
|
|
22
|
+
rowKey: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
22
23
|
data: import("@/index.js").Row[];
|
|
23
24
|
visibleColumns: string[];
|
|
24
|
-
detailTransition: string;
|
|
25
25
|
}> & Omit<{
|
|
26
26
|
readonly size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
27
27
|
readonly loading: boolean;
|
|
@@ -33,11 +33,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
33
33
|
readonly checkedRows: import("@/index.js").Row[];
|
|
34
34
|
readonly isRowCheckable: Function;
|
|
35
35
|
readonly data: import("@/index.js").Row[];
|
|
36
|
-
readonly detailTransition: string;
|
|
37
36
|
readonly rowTo?: ((row: import("@/index.js").CollectionItem) => import("vue-router").RouteLocationRaw) | undefined;
|
|
38
37
|
readonly rowHref?: ((row: import("@/index.js").CollectionItem) => string) | undefined;
|
|
39
38
|
readonly onRowClick?: ((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined;
|
|
40
39
|
readonly maxHeight?: number | undefined;
|
|
40
|
+
readonly rowKey?: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
41
41
|
readonly visibleColumns?: string[] | undefined;
|
|
42
42
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
43
43
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -89,10 +89,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
89
89
|
type: FunctionConstructor;
|
|
90
90
|
default: () => boolean;
|
|
91
91
|
};
|
|
92
|
-
detailTransition: {
|
|
93
|
-
type: StringConstructor;
|
|
94
|
-
default: string;
|
|
95
|
-
};
|
|
96
92
|
maxHeight: {
|
|
97
93
|
default: undefined;
|
|
98
94
|
type: NumberConstructor;
|
|
@@ -113,6 +109,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
113
109
|
default: undefined;
|
|
114
110
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
115
111
|
};
|
|
112
|
+
rowKey: {
|
|
113
|
+
default: undefined;
|
|
114
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
115
|
+
};
|
|
116
116
|
}>> & {
|
|
117
117
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
118
118
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -123,7 +123,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
123
123
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
124
124
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
125
125
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
126
|
-
}, "size" | "loading" | "sortField" | "sortDirection" | "rowTo" | "rowHref" | "onRowClick" | "detailed" | "hasDetailedVisible" | "checkable" | "checkedRows" | "isRowCheckable" | "maxHeight" | "
|
|
126
|
+
}, "size" | "loading" | "sortField" | "sortDirection" | "rowTo" | "rowHref" | "onRowClick" | "detailed" | "hasDetailedVisible" | "checkable" | "checkedRows" | "isRowCheckable" | "maxHeight" | "rowKey" | "data" | "visibleColumns">;
|
|
127
127
|
$attrs: {
|
|
128
128
|
[x: string]: unknown;
|
|
129
129
|
};
|
|
@@ -178,10 +178,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
178
178
|
type: FunctionConstructor;
|
|
179
179
|
default: () => boolean;
|
|
180
180
|
};
|
|
181
|
-
detailTransition: {
|
|
182
|
-
type: StringConstructor;
|
|
183
|
-
default: string;
|
|
184
|
-
};
|
|
185
181
|
maxHeight: {
|
|
186
182
|
default: undefined;
|
|
187
183
|
type: NumberConstructor;
|
|
@@ -202,6 +198,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
202
198
|
default: undefined;
|
|
203
199
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
204
200
|
};
|
|
201
|
+
rowKey: {
|
|
202
|
+
default: undefined;
|
|
203
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
204
|
+
};
|
|
205
205
|
}>> & {
|
|
206
206
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
207
207
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -262,9 +262,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
262
262
|
checkedRows: import("@/index.js").Row[];
|
|
263
263
|
isRowCheckable: Function;
|
|
264
264
|
maxHeight: number;
|
|
265
|
+
rowKey: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
265
266
|
data: import("@/index.js").Row[];
|
|
266
267
|
visibleColumns: string[];
|
|
267
|
-
detailTransition: string;
|
|
268
268
|
}, {}, string, {}> & {
|
|
269
269
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
270
270
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -326,10 +326,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
326
326
|
type: FunctionConstructor;
|
|
327
327
|
default: () => boolean;
|
|
328
328
|
};
|
|
329
|
-
detailTransition: {
|
|
330
|
-
type: StringConstructor;
|
|
331
|
-
default: string;
|
|
332
|
-
};
|
|
333
329
|
maxHeight: {
|
|
334
330
|
default: undefined;
|
|
335
331
|
type: NumberConstructor;
|
|
@@ -350,6 +346,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
350
346
|
default: undefined;
|
|
351
347
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
352
348
|
};
|
|
349
|
+
rowKey: {
|
|
350
|
+
default: undefined;
|
|
351
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
352
|
+
};
|
|
353
353
|
}>> & {
|
|
354
354
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
355
355
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -423,9 +423,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
423
423
|
checkedRows: import("@/index.js").Row[];
|
|
424
424
|
isRowCheckable: Function;
|
|
425
425
|
maxHeight: number;
|
|
426
|
+
rowKey: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
426
427
|
data: import("@/index.js").Row[];
|
|
427
428
|
visibleColumns: string[];
|
|
428
|
-
detailTransition: string;
|
|
429
429
|
}> & Omit<{
|
|
430
430
|
readonly size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
431
431
|
readonly loading: boolean;
|
|
@@ -437,11 +437,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
437
437
|
readonly checkedRows: import("@/index.js").Row[];
|
|
438
438
|
readonly isRowCheckable: Function;
|
|
439
439
|
readonly data: import("@/index.js").Row[];
|
|
440
|
-
readonly detailTransition: string;
|
|
441
440
|
readonly rowTo?: ((row: import("@/index.js").CollectionItem) => import("vue-router").RouteLocationRaw) | undefined;
|
|
442
441
|
readonly rowHref?: ((row: import("@/index.js").CollectionItem) => string) | undefined;
|
|
443
442
|
readonly onRowClick?: ((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined;
|
|
444
443
|
readonly maxHeight?: number | undefined;
|
|
444
|
+
readonly rowKey?: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
445
445
|
readonly visibleColumns?: string[] | undefined;
|
|
446
446
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
447
447
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -493,10 +493,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
493
493
|
type: FunctionConstructor;
|
|
494
494
|
default: () => boolean;
|
|
495
495
|
};
|
|
496
|
-
detailTransition: {
|
|
497
|
-
type: StringConstructor;
|
|
498
|
-
default: string;
|
|
499
|
-
};
|
|
500
496
|
maxHeight: {
|
|
501
497
|
default: undefined;
|
|
502
498
|
type: NumberConstructor;
|
|
@@ -517,6 +513,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
517
513
|
default: undefined;
|
|
518
514
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
519
515
|
};
|
|
516
|
+
rowKey: {
|
|
517
|
+
default: undefined;
|
|
518
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
519
|
+
};
|
|
520
520
|
}>> & {
|
|
521
521
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
522
522
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -527,7 +527,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
527
527
|
"onUpdate:openedDetailed"?: ((...args: any[]) => any) | undefined;
|
|
528
528
|
"onCell-click"?: ((...args: any[]) => any) | undefined;
|
|
529
529
|
"onRow-click"?: ((...args: any[]) => any) | undefined;
|
|
530
|
-
}, "size" | "loading" | "sortField" | "sortDirection" | "rowTo" | "rowHref" | "onRowClick" | "detailed" | "hasDetailedVisible" | "checkable" | "checkedRows" | "isRowCheckable" | "maxHeight" | "
|
|
530
|
+
}, "size" | "loading" | "sortField" | "sortDirection" | "rowTo" | "rowHref" | "onRowClick" | "detailed" | "hasDetailedVisible" | "checkable" | "checkedRows" | "isRowCheckable" | "maxHeight" | "rowKey" | "data" | "visibleColumns">;
|
|
531
531
|
$attrs: {
|
|
532
532
|
[x: string]: unknown;
|
|
533
533
|
};
|
|
@@ -582,10 +582,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
582
582
|
type: FunctionConstructor;
|
|
583
583
|
default: () => boolean;
|
|
584
584
|
};
|
|
585
|
-
detailTransition: {
|
|
586
|
-
type: StringConstructor;
|
|
587
|
-
default: string;
|
|
588
|
-
};
|
|
589
585
|
maxHeight: {
|
|
590
586
|
default: undefined;
|
|
591
587
|
type: NumberConstructor;
|
|
@@ -606,6 +602,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
606
602
|
default: undefined;
|
|
607
603
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
608
604
|
};
|
|
605
|
+
rowKey: {
|
|
606
|
+
default: undefined;
|
|
607
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
608
|
+
};
|
|
609
609
|
}>> & {
|
|
610
610
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
611
611
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -666,9 +666,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
666
666
|
checkedRows: import("@/index.js").Row[];
|
|
667
667
|
isRowCheckable: Function;
|
|
668
668
|
maxHeight: number;
|
|
669
|
+
rowKey: ((row: import("@/index.js").CollectionItem) => string | number) | undefined;
|
|
669
670
|
data: import("@/index.js").Row[];
|
|
670
671
|
visibleColumns: string[];
|
|
671
|
-
detailTransition: string;
|
|
672
672
|
}, {}, string, {}> & {
|
|
673
673
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
674
674
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -730,10 +730,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
730
730
|
type: FunctionConstructor;
|
|
731
731
|
default: () => boolean;
|
|
732
732
|
};
|
|
733
|
-
detailTransition: {
|
|
734
|
-
type: StringConstructor;
|
|
735
|
-
default: string;
|
|
736
|
-
};
|
|
737
733
|
maxHeight: {
|
|
738
734
|
default: undefined;
|
|
739
735
|
type: NumberConstructor;
|
|
@@ -754,6 +750,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
754
750
|
default: undefined;
|
|
755
751
|
type: PropType<((row: import("@/index.js").CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
756
752
|
};
|
|
753
|
+
rowKey: {
|
|
754
|
+
default: undefined;
|
|
755
|
+
type: PropType<((row: import("@/index.js").CollectionItem) => string | number) | undefined>;
|
|
756
|
+
};
|
|
757
757
|
}>> & {
|
|
758
758
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
759
759
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -228,6 +228,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
228
228
|
default: string;
|
|
229
229
|
type: PropType<"section" | "top">;
|
|
230
230
|
};
|
|
231
|
+
/**
|
|
232
|
+
* Row key. Used to identify rows for faster rendering.
|
|
233
|
+
* If not provided, it will use the id, key or uuid, or create a hash from the row object.
|
|
234
|
+
*/
|
|
235
|
+
rowKey: {
|
|
236
|
+
default: undefined;
|
|
237
|
+
type: PropType<(row: CollectionItem) => string | number>;
|
|
238
|
+
};
|
|
231
239
|
}, {
|
|
232
240
|
fetch: typeof fetch;
|
|
233
241
|
fetchWithoutLoading: typeof fetchWithoutLoading;
|
|
@@ -460,6 +468,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
460
468
|
default: string;
|
|
461
469
|
type: PropType<"section" | "top">;
|
|
462
470
|
};
|
|
471
|
+
/**
|
|
472
|
+
* Row key. Used to identify rows for faster rendering.
|
|
473
|
+
* If not provided, it will use the id, key or uuid, or create a hash from the row object.
|
|
474
|
+
*/
|
|
475
|
+
rowKey: {
|
|
476
|
+
default: undefined;
|
|
477
|
+
type: PropType<(row: CollectionItem) => string | number>;
|
|
478
|
+
};
|
|
463
479
|
}>> & {
|
|
464
480
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
465
481
|
"onUpdate:checked-rows"?: ((...args: any[]) => any) | undefined;
|
|
@@ -498,6 +514,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
498
514
|
maxHeight: number;
|
|
499
515
|
rowActions: RowAction[];
|
|
500
516
|
numberOfVisibleRowActions: number;
|
|
517
|
+
rowKey: (row: CollectionItem) => string | number;
|
|
501
518
|
}, {}>, Partial<Record<string, (_: {}) => any>> & {
|
|
502
519
|
default?(_: {}): any;
|
|
503
520
|
detail?(_: {
|
|
@@ -58,10 +58,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
58
58
|
type: FunctionConstructor;
|
|
59
59
|
default: () => boolean;
|
|
60
60
|
};
|
|
61
|
-
detailTransition: {
|
|
62
|
-
type: StringConstructor;
|
|
63
|
-
default: string;
|
|
64
|
-
};
|
|
65
61
|
maxHeight: {
|
|
66
62
|
default: undefined;
|
|
67
63
|
type: NumberConstructor;
|
|
@@ -82,6 +78,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
82
78
|
default: undefined;
|
|
83
79
|
type: PropType<((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
84
80
|
};
|
|
81
|
+
rowKey: {
|
|
82
|
+
default: undefined;
|
|
83
|
+
type: PropType<((row: CollectionItem) => string | number) | undefined>;
|
|
84
|
+
};
|
|
85
85
|
}, {
|
|
86
86
|
newColumns: import("vue").ComputedRef<{
|
|
87
87
|
id: string;
|
|
@@ -171,10 +171,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
171
171
|
type: FunctionConstructor;
|
|
172
172
|
default: () => boolean;
|
|
173
173
|
};
|
|
174
|
-
detailTransition: {
|
|
175
|
-
type: StringConstructor;
|
|
176
|
-
default: string;
|
|
177
|
-
};
|
|
178
174
|
maxHeight: {
|
|
179
175
|
default: undefined;
|
|
180
176
|
type: NumberConstructor;
|
|
@@ -195,6 +191,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
195
191
|
default: undefined;
|
|
196
192
|
type: PropType<((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined>;
|
|
197
193
|
};
|
|
194
|
+
rowKey: {
|
|
195
|
+
default: undefined;
|
|
196
|
+
type: PropType<((row: CollectionItem) => string | number) | undefined>;
|
|
197
|
+
};
|
|
198
198
|
}>> & {
|
|
199
199
|
onCheck?: ((...args: any[]) => any) | undefined;
|
|
200
200
|
onSort?: ((...args: any[]) => any) | undefined;
|
|
@@ -219,9 +219,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
219
219
|
checkedRows: Row[];
|
|
220
220
|
isRowCheckable: Function;
|
|
221
221
|
maxHeight: number;
|
|
222
|
+
rowKey: ((row: CollectionItem) => string | number) | undefined;
|
|
222
223
|
data: Row[];
|
|
223
224
|
visibleColumns: string[];
|
|
224
|
-
detailTransition: string;
|
|
225
225
|
}, {}>, {
|
|
226
226
|
default?(_: {}): any;
|
|
227
227
|
detail?(_: {
|
package/package.json
CHANGED
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
:size="sizeInternal.size.value"
|
|
83
83
|
:row-to="rowToInternal"
|
|
84
84
|
:row-href="rowHref"
|
|
85
|
+
:row-key="rowKey"
|
|
85
86
|
@update:checked-rows="onCheckedRowsUpdate"
|
|
86
87
|
@sort="dataIteratorProps.onSortChange"
|
|
87
88
|
@row-click="onRowClick"
|
|
@@ -532,6 +533,15 @@ const props = defineProps({
|
|
|
532
533
|
default: 'section',
|
|
533
534
|
type: String as PropType<'top' | 'section'>,
|
|
534
535
|
},
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Row key. Used to identify rows for faster rendering.
|
|
539
|
+
* If not provided, it will use the id, key or uuid, or create a hash from the row object.
|
|
540
|
+
*/
|
|
541
|
+
rowKey: {
|
|
542
|
+
default: undefined,
|
|
543
|
+
type: Function as PropType<(row: CollectionItem) => string | number>,
|
|
544
|
+
},
|
|
535
545
|
});
|
|
536
546
|
|
|
537
547
|
const sizeInternal = useInputSize(props.size);
|
|
@@ -166,22 +166,20 @@
|
|
|
166
166
|
</BaseTableCell>
|
|
167
167
|
</BaseTableRow>
|
|
168
168
|
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
<BaseTableRow
|
|
170
|
+
v-if="isActiveDetailRow(row)"
|
|
171
|
+
:key="getRowKey(row) + 'detail'"
|
|
172
|
+
>
|
|
173
|
+
<BaseTableCell
|
|
174
|
+
:colspan="columnCount"
|
|
173
175
|
>
|
|
174
|
-
<
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
/>
|
|
182
|
-
</BaseTableCell>
|
|
183
|
-
</BaseTableRow>
|
|
184
|
-
</transition>
|
|
176
|
+
<slot
|
|
177
|
+
name="detail"
|
|
178
|
+
:row="row"
|
|
179
|
+
:index="index"
|
|
180
|
+
/>
|
|
181
|
+
</BaseTableCell>
|
|
182
|
+
</BaseTableRow>
|
|
185
183
|
</template>
|
|
186
184
|
|
|
187
185
|
<BaseTableRow v-if="data.length == 0">
|
|
@@ -272,11 +270,6 @@ const props = defineProps({
|
|
|
272
270
|
type: Function,
|
|
273
271
|
default: () => true,
|
|
274
272
|
},
|
|
275
|
-
/* Transition name to use when toggling row details. */
|
|
276
|
-
detailTransition: {
|
|
277
|
-
type: String,
|
|
278
|
-
default: '',
|
|
279
|
-
},
|
|
280
273
|
/* Max height (in px) */
|
|
281
274
|
maxHeight: {
|
|
282
275
|
default: undefined,
|
|
@@ -298,6 +291,10 @@ const props = defineProps({
|
|
|
298
291
|
default: undefined,
|
|
299
292
|
type: Function as PropType<((row: CollectionItem, index: number, event: MouseEvent) => void) | undefined>,
|
|
300
293
|
},
|
|
294
|
+
rowKey: {
|
|
295
|
+
default: undefined,
|
|
296
|
+
type: Function as PropType<((row: CollectionItem) => string | number) | undefined>,
|
|
297
|
+
},
|
|
301
298
|
});
|
|
302
299
|
|
|
303
300
|
const emit = defineEmits([
|
|
@@ -689,17 +686,44 @@ function nextSequence() {
|
|
|
689
686
|
return sequence.value++;
|
|
690
687
|
}
|
|
691
688
|
|
|
689
|
+
let warningNoRowKeyFoundShown = false;
|
|
690
|
+
|
|
692
691
|
function getRowKey(row: Row): string {
|
|
692
|
+
|
|
693
|
+
if (props.rowKey) {
|
|
694
|
+
return props.rowKey(row) + '';
|
|
695
|
+
}
|
|
696
|
+
|
|
693
697
|
if (row.id) {
|
|
694
698
|
return row.id;
|
|
695
699
|
}
|
|
700
|
+
|
|
696
701
|
if (row.key) {
|
|
697
702
|
return row.key;
|
|
698
703
|
}
|
|
704
|
+
|
|
699
705
|
if (row.uuid) {
|
|
700
706
|
return row.uuid;
|
|
701
707
|
}
|
|
702
|
-
|
|
708
|
+
|
|
709
|
+
if (!warningNoRowKeyFoundShown) {
|
|
710
|
+
console.warn('%cNo unique key found for items provided to BaseDataTable.%cPlease provide a unique key for each row (id, key or uuid) or use the row-key props to specify a unique key.', 'font-weight: bold', 'font-weight: normal');
|
|
711
|
+
warningNoRowKeyFoundShown = true;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// if no key is found, hash a simplified version of the row object
|
|
715
|
+
// We use a simplified version to avoid hashing functions, objects, etc. for performance reasons
|
|
716
|
+
|
|
717
|
+
const simpleRow = {} as Record<string, string | number | boolean>;
|
|
718
|
+
|
|
719
|
+
for (const key in row) {
|
|
720
|
+
const value = row[key];
|
|
721
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
722
|
+
simpleRow[key] = value;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
return objectHash(simpleRow);
|
|
703
727
|
}
|
|
704
728
|
|
|
705
729
|
provide('addColumn', addColumn);
|