@katlux/toolkit 0.1.1-alpha.124 → 0.1.1-alpha.125
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/compiled/composables/useDataProvider.mjs +1 -53
- package/dist/module.json +1 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +3 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +2 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +3 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +2 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +22 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +3 -41
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -1
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +17 -1
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +6 -0
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +58 -54
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGantt/KGantt.logic.js +2 -4
- package/dist/runtime/components/KToast/KToast.global.d.vue.ts +1 -1
- package/dist/runtime/components/KToast/KToast.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +1 -1
- package/dist/runtime/composables/useDataProvider.d.ts +0 -4
- package/dist/runtime/composables/useDataProvider.js +1 -53
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +2 -1
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +8 -0
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +96 -34
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +8 -0
- package/package.json +2 -2
|
@@ -39,8 +39,6 @@ export function useDataProvider(provider, options) {
|
|
|
39
39
|
const error = ref(activeProvider ? extractVal(activeProvider.error, null) : null);
|
|
40
40
|
const filter = options?.filter || ref(activeProvider ? extractVal(activeProvider.filter, null) : null);
|
|
41
41
|
const sortList = options?.sortList || ref(activeProvider ? extractVal(activeProvider.sortList, []) : []);
|
|
42
|
-
const selectedRows = options?.selectedRows || ref(activeProvider ? extractVal(activeProvider.selectedRows, []) : []);
|
|
43
|
-
const selectAll = options?.selectAll || ref(activeProvider ? extractVal(activeProvider.selectAll, false) : false);
|
|
44
42
|
let isSyncingFromProvider = false;
|
|
45
43
|
let isSyncingToProvider = false;
|
|
46
44
|
const syncFromProvider = () => {
|
|
@@ -55,8 +53,6 @@ export function useDataProvider(provider, options) {
|
|
|
55
53
|
error.value = null;
|
|
56
54
|
filter.value = null;
|
|
57
55
|
sortList.value = [];
|
|
58
|
-
selectedRows.value = [];
|
|
59
|
-
selectAll.value = false;
|
|
60
56
|
return;
|
|
61
57
|
}
|
|
62
58
|
isSyncingFromProvider = true;
|
|
@@ -83,14 +79,6 @@ export function useDataProvider(provider, options) {
|
|
|
83
79
|
if (JSON.stringify(sortList.value) !== JSON.stringify(newSort)) {
|
|
84
80
|
sortList.value = newSort;
|
|
85
81
|
}
|
|
86
|
-
const newSelected = extractVal(activeProvider.selectedRows, []);
|
|
87
|
-
if (selectedRows.value !== newSelected) {
|
|
88
|
-
selectedRows.value = newSelected;
|
|
89
|
-
}
|
|
90
|
-
const newSelectAll = extractVal(activeProvider.selectAll, false);
|
|
91
|
-
if (selectAll.value !== newSelectAll) {
|
|
92
|
-
selectAll.value = newSelectAll;
|
|
93
|
-
}
|
|
94
82
|
} finally {
|
|
95
83
|
isSyncingFromProvider = false;
|
|
96
84
|
}
|
|
@@ -254,40 +242,6 @@ export function useDataProvider(provider, options) {
|
|
|
254
242
|
}
|
|
255
243
|
}, { deep: true });
|
|
256
244
|
}
|
|
257
|
-
if (options?.selectedRows) {
|
|
258
|
-
watch(options.selectedRows, (newVal) => {
|
|
259
|
-
if (isSyncingFromProvider || isSyncingToProvider) return;
|
|
260
|
-
if (activeProvider) {
|
|
261
|
-
isSyncingToProvider = true;
|
|
262
|
-
try {
|
|
263
|
-
if (typeof activeProvider.setSelectedRows === "function") {
|
|
264
|
-
activeProvider.setSelectedRows(newVal);
|
|
265
|
-
} else {
|
|
266
|
-
activeProvider.selectedRows = newVal;
|
|
267
|
-
}
|
|
268
|
-
} finally {
|
|
269
|
-
isSyncingToProvider = false;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, { deep: true });
|
|
273
|
-
}
|
|
274
|
-
if (options?.selectAll) {
|
|
275
|
-
watch(options.selectAll, (newVal) => {
|
|
276
|
-
if (isSyncingFromProvider || isSyncingToProvider) return;
|
|
277
|
-
if (activeProvider && extractVal(activeProvider.selectAll, false) !== newVal) {
|
|
278
|
-
isSyncingToProvider = true;
|
|
279
|
-
try {
|
|
280
|
-
if (typeof activeProvider.setSelectAll === "function") {
|
|
281
|
-
activeProvider.setSelectAll(newVal);
|
|
282
|
-
} else {
|
|
283
|
-
activeProvider.selectAll = newVal;
|
|
284
|
-
}
|
|
285
|
-
} finally {
|
|
286
|
-
isSyncingToProvider = false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
245
|
const refresh = async (hardRefresh = false) => {
|
|
292
246
|
if (!activeProvider) return;
|
|
293
247
|
if (typeof activeProvider.refresh === "function") {
|
|
@@ -317,9 +271,7 @@ export function useDataProvider(provider, options) {
|
|
|
317
271
|
initialLoad: initialLoad.value,
|
|
318
272
|
error: error.value,
|
|
319
273
|
filter: filter.value,
|
|
320
|
-
sortList: sortList.value
|
|
321
|
-
selectedRows: selectedRows.value,
|
|
322
|
-
selectAll: selectAll.value
|
|
274
|
+
sortList: sortList.value
|
|
323
275
|
};
|
|
324
276
|
};
|
|
325
277
|
const setState = (partial) => {
|
|
@@ -330,8 +282,6 @@ export function useDataProvider(provider, options) {
|
|
|
330
282
|
if (partial.pageSize !== void 0) setPageSize(partial.pageSize);
|
|
331
283
|
if (partial.filter !== void 0) setFilter(partial.filter);
|
|
332
284
|
if (partial.sortList !== void 0) setSortList(partial.sortList);
|
|
333
|
-
if (partial.selectedRows !== void 0) selectedRows.value = partial.selectedRows;
|
|
334
|
-
if (partial.selectAll !== void 0) selectAll.value = partial.selectAll;
|
|
335
285
|
}
|
|
336
286
|
};
|
|
337
287
|
return {
|
|
@@ -348,8 +298,6 @@ export function useDataProvider(provider, options) {
|
|
|
348
298
|
error,
|
|
349
299
|
filter,
|
|
350
300
|
sortList,
|
|
351
|
-
selectedRows,
|
|
352
|
-
selectAll,
|
|
353
301
|
setCurrentPage,
|
|
354
302
|
setPageSize,
|
|
355
303
|
setFilter,
|
package/dist/module.json
CHANGED
|
@@ -3,12 +3,14 @@ interface Props {
|
|
|
3
3
|
bulkActions?: IKDatatableAction[];
|
|
4
4
|
selectedRows?: TDataRow[];
|
|
5
5
|
selectAll?: boolean;
|
|
6
|
+
unselectedRows?: TDataRow[];
|
|
6
7
|
filter?: any;
|
|
7
8
|
}
|
|
8
9
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
10
|
filter: any;
|
|
10
|
-
bulkActions: IKDatatableAction[];
|
|
11
11
|
selectedRows: TDataRow[];
|
|
12
|
+
unselectedRows: TDataRow[];
|
|
13
|
+
bulkActions: IKDatatableAction[];
|
|
12
14
|
selectAll: boolean;
|
|
13
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
16
|
declare const _default: typeof __VLS_export;
|
|
@@ -7,6 +7,7 @@ const props = defineProps({
|
|
|
7
7
|
bulkActions: { type: Array, required: false, default: () => [] },
|
|
8
8
|
selectedRows: { type: Array, required: false, default: () => [] },
|
|
9
9
|
selectAll: { type: Boolean, required: false, default: false },
|
|
10
|
+
unselectedRows: { type: Array, required: false, default: () => [] },
|
|
10
11
|
filter: { type: null, required: false, default: void 0 }
|
|
11
12
|
});
|
|
12
13
|
const { selected, dp, doAction, visibleBulkActions } = useKBulkActionsLogic(props);
|
|
@@ -15,6 +16,7 @@ const templateProps = computed(() => ({
|
|
|
15
16
|
bulkActions: visibleBulkActions.value,
|
|
16
17
|
selectedRows: props.selectedRows,
|
|
17
18
|
selectAll: props.selectAll,
|
|
19
|
+
unselectedRows: props.unselectedRows,
|
|
18
20
|
filter: props.filter,
|
|
19
21
|
selected: selected.value,
|
|
20
22
|
dp,
|
|
@@ -3,12 +3,14 @@ interface Props {
|
|
|
3
3
|
bulkActions?: IKDatatableAction[];
|
|
4
4
|
selectedRows?: TDataRow[];
|
|
5
5
|
selectAll?: boolean;
|
|
6
|
+
unselectedRows?: TDataRow[];
|
|
6
7
|
filter?: any;
|
|
7
8
|
}
|
|
8
9
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
10
|
filter: any;
|
|
10
|
-
bulkActions: IKDatatableAction[];
|
|
11
11
|
selectedRows: TDataRow[];
|
|
12
|
+
unselectedRows: TDataRow[];
|
|
13
|
+
bulkActions: IKDatatableAction[];
|
|
12
14
|
selectAll: boolean;
|
|
13
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
16
|
declare const _default: typeof __VLS_export;
|
|
@@ -4,7 +4,9 @@ export interface KBulkActionsProps {
|
|
|
4
4
|
bulkActions: IKDatatableAction[];
|
|
5
5
|
selectedRows: TDataRow[];
|
|
6
6
|
selectAll: boolean;
|
|
7
|
+
unselectedRows?: TDataRow[];
|
|
7
8
|
filter?: any;
|
|
9
|
+
idKey?: string;
|
|
8
10
|
}
|
|
9
11
|
export declare const KBulkActionsDefaultProps: {};
|
|
10
12
|
export declare function getApplicableRows(action: IKDatatableAction, selectedRows: TDataRow[], selectAll: boolean): TDataRow[];
|
|
@@ -79,7 +79,28 @@ export function useKBulkActionsLogic(props) {
|
|
|
79
79
|
const act = action;
|
|
80
80
|
if (act && act.action) {
|
|
81
81
|
const applicableRows = getApplicableRows(act, props.selectedRows, props.selectAll);
|
|
82
|
-
|
|
82
|
+
const idKey = props.idKey || "id";
|
|
83
|
+
const getRowKey = (r) => r?.[idKey] ?? r?.id ?? r?._id ?? r;
|
|
84
|
+
const selectedRowKeys = (props.selectedRows || []).map(getRowKey);
|
|
85
|
+
const unselectedRowKeys = (props.unselectedRows || []).map(getRowKey);
|
|
86
|
+
const context = {
|
|
87
|
+
isAllSelected: Boolean(props.selectAll),
|
|
88
|
+
selectedRows: props.selectedRows || [],
|
|
89
|
+
selectedRowKeys,
|
|
90
|
+
unselectedRows: props.unselectedRows || [],
|
|
91
|
+
unselectedRowKeys,
|
|
92
|
+
filter: props.filter
|
|
93
|
+
};
|
|
94
|
+
const payload = [...applicableRows];
|
|
95
|
+
Object.defineProperties(payload, {
|
|
96
|
+
isAllSelected: { value: Boolean(props.selectAll), enumerable: false, configurable: true, writable: true },
|
|
97
|
+
selectedRows: { value: props.selectedRows || [], enumerable: false, configurable: true, writable: true },
|
|
98
|
+
selectedRowKeys: { value: selectedRowKeys, enumerable: false, configurable: true, writable: true },
|
|
99
|
+
unselectedRows: { value: props.unselectedRows || [], enumerable: false, configurable: true, writable: true },
|
|
100
|
+
unselectedRowKeys: { value: unselectedRowKeys, enumerable: false, configurable: true, writable: true },
|
|
101
|
+
filter: { value: props.filter, enumerable: false, configurable: true, writable: true }
|
|
102
|
+
});
|
|
103
|
+
act.action(payload, props.selectAll, props.filter);
|
|
83
104
|
}
|
|
84
105
|
}
|
|
85
106
|
return {
|
|
@@ -40,8 +40,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
40
40
|
"onSearch-change"?: ((value: string) => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
42
|
search: string;
|
|
43
|
-
bulkActions: IKDatatableAction[];
|
|
44
43
|
selectedRows: any[];
|
|
44
|
+
bulkActions: IKDatatableAction[];
|
|
45
45
|
selectAll: boolean;
|
|
46
46
|
loading: boolean;
|
|
47
47
|
currentPage: number;
|
|
@@ -40,8 +40,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
40
40
|
"onSearch-change"?: ((value: string) => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
42
|
search: string;
|
|
43
|
-
bulkActions: IKDatatableAction[];
|
|
44
43
|
selectedRows: any[];
|
|
44
|
+
bulkActions: IKDatatableAction[];
|
|
45
45
|
selectAll: boolean;
|
|
46
46
|
loading: boolean;
|
|
47
47
|
currentPage: number;
|
|
@@ -14,8 +14,6 @@ export const KDataIteratorDefaultProps = {
|
|
|
14
14
|
export function useKDataIteratorLogic(props, emit) {
|
|
15
15
|
const {
|
|
16
16
|
pageData,
|
|
17
|
-
selectedRows: dpSelectedRows,
|
|
18
|
-
selectAll: dpSelectAll,
|
|
19
17
|
currentPage: dpCurrentPage,
|
|
20
18
|
pageSize: dpPageSize,
|
|
21
19
|
loading: dpLoading,
|
|
@@ -24,47 +22,16 @@ export function useKDataIteratorLogic(props, emit) {
|
|
|
24
22
|
setPageSize,
|
|
25
23
|
setFilter
|
|
26
24
|
} = useDataProvider(props.dataProvider);
|
|
27
|
-
const selectedRows =
|
|
28
|
-
const selectAll =
|
|
25
|
+
const selectedRows = props.selectedRows !== void 0 ? ref(props.selectedRows) : ref([]);
|
|
26
|
+
const selectAll = props.selectAll !== void 0 ? ref(props.selectAll) : ref(false);
|
|
29
27
|
const idKey = props.dataProvider?.idKey || "id";
|
|
30
28
|
const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
|
|
31
|
-
let isInternalUpdating = false;
|
|
32
29
|
const pageRows = computed(() => {
|
|
33
30
|
if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
|
|
34
31
|
return props.dataProvider.pageData.value || [];
|
|
35
32
|
}
|
|
36
33
|
return pageData.value || [];
|
|
37
34
|
});
|
|
38
|
-
const syncToProvider = () => {
|
|
39
|
-
if (props.dataProvider) {
|
|
40
|
-
isInternalUpdating = true;
|
|
41
|
-
const update = () => {
|
|
42
|
-
if (typeof props.dataProvider.setSelectAll === "function") {
|
|
43
|
-
props.dataProvider.setSelectAll(selectAll.value);
|
|
44
|
-
} else if (isRef(props.dataProvider.selectAll)) {
|
|
45
|
-
props.dataProvider.selectAll.value = selectAll.value;
|
|
46
|
-
} else {
|
|
47
|
-
props.dataProvider.selectAll = selectAll.value;
|
|
48
|
-
}
|
|
49
|
-
if (typeof props.dataProvider.setSelectedRows === "function") {
|
|
50
|
-
props.dataProvider.setSelectedRows(selectedRows.value);
|
|
51
|
-
} else if (isRef(props.dataProvider.selectedRows)) {
|
|
52
|
-
props.dataProvider.selectedRows.value = selectedRows.value;
|
|
53
|
-
} else {
|
|
54
|
-
props.dataProvider.selectedRows = selectedRows.value;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
try {
|
|
58
|
-
if (typeof props.dataProvider.batchUpdates === "function") {
|
|
59
|
-
props.dataProvider.batchUpdates(update);
|
|
60
|
-
} else {
|
|
61
|
-
update();
|
|
62
|
-
}
|
|
63
|
-
} finally {
|
|
64
|
-
isInternalUpdating = false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
35
|
watch([() => props.page, () => props.currentPage], ([p, cp]) => {
|
|
69
36
|
const targetPage = p ?? cp;
|
|
70
37
|
if (targetPage !== void 0 && targetPage !== dpCurrentPage.value) {
|
|
@@ -86,13 +53,11 @@ export function useKDataIteratorLogic(props, emit) {
|
|
|
86
53
|
watch(() => props.selectedRows, (val) => {
|
|
87
54
|
if (val !== void 0 && val !== selectedRows.value) {
|
|
88
55
|
selectedRows.value = val;
|
|
89
|
-
syncToProvider();
|
|
90
56
|
}
|
|
91
57
|
}, { deep: true });
|
|
92
58
|
watch(() => props.selectAll, (val) => {
|
|
93
59
|
if (val !== void 0 && val !== selectAll.value) {
|
|
94
60
|
selectAll.value = val;
|
|
95
|
-
syncToProvider();
|
|
96
61
|
}
|
|
97
62
|
});
|
|
98
63
|
watch(dpCurrentPage, (newVal) => {
|
|
@@ -106,17 +71,14 @@ export function useKDataIteratorLogic(props, emit) {
|
|
|
106
71
|
});
|
|
107
72
|
let lastSyncedSelectAll = Boolean(selectAll.value);
|
|
108
73
|
watch(() => selectAll.value, (newVal) => {
|
|
109
|
-
if (
|
|
74
|
+
if (newVal === lastSyncedSelectAll) return;
|
|
110
75
|
lastSyncedSelectAll = newVal;
|
|
111
76
|
selectedRows.value = [];
|
|
112
77
|
emit?.("update:selectedRows", selectedRows.value);
|
|
113
78
|
emit?.("update:selectAll", newVal);
|
|
114
|
-
syncToProvider();
|
|
115
79
|
});
|
|
116
80
|
watch(() => selectedRows.value, (newVal) => {
|
|
117
|
-
if (isInternalUpdating) return;
|
|
118
81
|
emit?.("update:selectedRows", newVal || []);
|
|
119
|
-
syncToProvider();
|
|
120
82
|
}, { deep: true });
|
|
121
83
|
return {
|
|
122
84
|
selectedRows,
|
|
@@ -17,6 +17,8 @@ interface Props {
|
|
|
17
17
|
filter?: IDataFilter | null;
|
|
18
18
|
selectedRows?: any[];
|
|
19
19
|
selectAll?: boolean;
|
|
20
|
+
selectAllScope?: 'page' | 'dataset';
|
|
21
|
+
unselectedRows?: any[];
|
|
20
22
|
virtualScroll?: boolean;
|
|
21
23
|
itemHeight?: number;
|
|
22
24
|
viewportHeight?: number;
|
|
@@ -30,6 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
30
32
|
"page-change": (value: number) => any;
|
|
31
33
|
"update:sortList": (value: IDataSort[]) => any;
|
|
32
34
|
"update:filter": (value: IDataFilter | null) => any;
|
|
35
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
36
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
33
37
|
"sort-change": (value: IDataSort[]) => any;
|
|
34
38
|
"filter-change": (value: IDataFilter | null) => any;
|
|
35
39
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
@@ -40,12 +44,15 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
40
44
|
"onPage-change"?: ((value: number) => any) | undefined;
|
|
41
45
|
"onUpdate:sortList"?: ((value: IDataSort[]) => any) | undefined;
|
|
42
46
|
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
47
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
48
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
43
49
|
"onSort-change"?: ((value: IDataSort[]) => any) | undefined;
|
|
44
50
|
"onFilter-change"?: ((value: IDataFilter | null) => any) | undefined;
|
|
45
51
|
}>, {
|
|
46
52
|
filter: IDataFilter | null;
|
|
47
|
-
bulkActions: Array<IKDatatableAction>;
|
|
48
53
|
selectedRows: any[];
|
|
54
|
+
unselectedRows: any[];
|
|
55
|
+
bulkActions: Array<IKDatatableAction>;
|
|
49
56
|
selectAll: boolean;
|
|
50
57
|
currentPage: number;
|
|
51
58
|
pageSize: number;
|
|
@@ -56,6 +63,7 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
56
63
|
visibleFields: Array<string> | null;
|
|
57
64
|
rowActions: Array<IKDatatableAction>;
|
|
58
65
|
viewportHeight: number;
|
|
66
|
+
selectAllScope: "page" | "dataset";
|
|
59
67
|
cellSlots: Record<string, any>;
|
|
60
68
|
headerSlots: Record<string, any>;
|
|
61
69
|
columnHeaders: Record<string, string>;
|
|
@@ -21,15 +21,19 @@ const props = defineProps({
|
|
|
21
21
|
filter: { type: [Object, null], required: false, default: void 0 },
|
|
22
22
|
selectedRows: { type: Array, required: false, default: void 0 },
|
|
23
23
|
selectAll: { type: Boolean, required: false, default: void 0 },
|
|
24
|
+
selectAllScope: { type: String, required: false, default: void 0 },
|
|
25
|
+
unselectedRows: { type: Array, required: false, default: void 0 },
|
|
24
26
|
virtualScroll: { type: Boolean, required: false, default: false },
|
|
25
27
|
itemHeight: { type: Number, required: false, default: 40 },
|
|
26
28
|
viewportHeight: { type: Number, required: false, default: 500 },
|
|
27
29
|
buffer: { type: Number, required: false, default: 5 }
|
|
28
30
|
});
|
|
29
|
-
const emit = defineEmits(["update:currentPage", "update:pageSize", "update:sortList", "update:filter", "update:selectedRows", "update:selectAll", "page-change", "sort-change", "filter-change"]);
|
|
31
|
+
const emit = defineEmits(["update:currentPage", "update:pageSize", "update:sortList", "update:filter", "update:selectedRows", "update:selectAll", "update:unselectedRows", "update:selectAllScope", "page-change", "sort-change", "filter-change"]);
|
|
30
32
|
const {
|
|
31
33
|
selectedRows,
|
|
32
34
|
selectAll,
|
|
35
|
+
selectAllScope,
|
|
36
|
+
unselectedRows,
|
|
33
37
|
currentPage,
|
|
34
38
|
pageSize,
|
|
35
39
|
sortList,
|
|
@@ -54,6 +58,8 @@ const templateProps = computed(() => ({
|
|
|
54
58
|
bulkActions: props.bulkActions,
|
|
55
59
|
selectedRows: selectedRows.value,
|
|
56
60
|
selectAll: selectAll.value,
|
|
61
|
+
selectAllScope: selectAllScope.value,
|
|
62
|
+
unselectedRows: unselectedRows.value,
|
|
57
63
|
currentPage: currentPage.value,
|
|
58
64
|
pageSize: pageSize.value,
|
|
59
65
|
cellSlots: mergedCellSlots.value,
|
|
@@ -75,6 +81,14 @@ const updateSelectAll = (val) => {
|
|
|
75
81
|
selectAll.value = val;
|
|
76
82
|
emit("update:selectAll", val);
|
|
77
83
|
};
|
|
84
|
+
const updateUnselectedRows = (val) => {
|
|
85
|
+
unselectedRows.value = val;
|
|
86
|
+
emit("update:unselectedRows", val);
|
|
87
|
+
};
|
|
88
|
+
const updateSelectAllScope = (val) => {
|
|
89
|
+
selectAllScope.value = val;
|
|
90
|
+
emit("update:selectAllScope", val);
|
|
91
|
+
};
|
|
78
92
|
const updateCurrentPage = (val) => {
|
|
79
93
|
setCurrentPage(val);
|
|
80
94
|
emit("update:currentPage", val);
|
|
@@ -92,6 +106,8 @@ component(
|
|
|
92
106
|
v-bind="templateProps"
|
|
93
107
|
@update:selectedRows="updateSelectedRows"
|
|
94
108
|
@update:selectAll="updateSelectAll"
|
|
109
|
+
@update:unselectedRows="updateUnselectedRows"
|
|
110
|
+
@update:selectAllScope="updateSelectAllScope"
|
|
95
111
|
@update:currentPage="updateCurrentPage"
|
|
96
112
|
@update:pageSize="updatePageSize"
|
|
97
113
|
)
|
|
@@ -17,6 +17,8 @@ interface Props {
|
|
|
17
17
|
filter?: IDataFilter | null;
|
|
18
18
|
selectedRows?: any[];
|
|
19
19
|
selectAll?: boolean;
|
|
20
|
+
selectAllScope?: 'page' | 'dataset';
|
|
21
|
+
unselectedRows?: any[];
|
|
20
22
|
virtualScroll?: boolean;
|
|
21
23
|
itemHeight?: number;
|
|
22
24
|
viewportHeight?: number;
|
|
@@ -30,6 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
30
32
|
"page-change": (value: number) => any;
|
|
31
33
|
"update:sortList": (value: IDataSort[]) => any;
|
|
32
34
|
"update:filter": (value: IDataFilter | null) => any;
|
|
35
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
36
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
33
37
|
"sort-change": (value: IDataSort[]) => any;
|
|
34
38
|
"filter-change": (value: IDataFilter | null) => any;
|
|
35
39
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
@@ -40,12 +44,15 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
40
44
|
"onPage-change"?: ((value: number) => any) | undefined;
|
|
41
45
|
"onUpdate:sortList"?: ((value: IDataSort[]) => any) | undefined;
|
|
42
46
|
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
47
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
48
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
43
49
|
"onSort-change"?: ((value: IDataSort[]) => any) | undefined;
|
|
44
50
|
"onFilter-change"?: ((value: IDataFilter | null) => any) | undefined;
|
|
45
51
|
}>, {
|
|
46
52
|
filter: IDataFilter | null;
|
|
47
|
-
bulkActions: Array<IKDatatableAction>;
|
|
48
53
|
selectedRows: any[];
|
|
54
|
+
unselectedRows: any[];
|
|
55
|
+
bulkActions: Array<IKDatatableAction>;
|
|
49
56
|
selectAll: boolean;
|
|
50
57
|
currentPage: number;
|
|
51
58
|
pageSize: number;
|
|
@@ -56,6 +63,7 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
56
63
|
visibleFields: Array<string> | null;
|
|
57
64
|
rowActions: Array<IKDatatableAction>;
|
|
58
65
|
viewportHeight: number;
|
|
66
|
+
selectAllScope: "page" | "dataset";
|
|
59
67
|
cellSlots: Record<string, any>;
|
|
60
68
|
headerSlots: Record<string, any>;
|
|
61
69
|
columnHeaders: Record<string, string>;
|
|
@@ -11,6 +11,8 @@ export interface KDatatableProps {
|
|
|
11
11
|
filter?: IDataFilter | null;
|
|
12
12
|
selectedRows?: any[];
|
|
13
13
|
selectAll?: boolean;
|
|
14
|
+
selectAllScope?: 'page' | 'dataset';
|
|
15
|
+
unselectedRows?: any[];
|
|
14
16
|
virtualScroll?: boolean;
|
|
15
17
|
itemHeight?: number;
|
|
16
18
|
viewportHeight?: number;
|
|
@@ -23,6 +25,8 @@ export type KDatatableEmits = {
|
|
|
23
25
|
(e: 'update:filter', filter: IDataFilter | null): void;
|
|
24
26
|
(e: 'update:selectedRows', rows: any[]): void;
|
|
25
27
|
(e: 'update:selectAll', selectAll: boolean): void;
|
|
28
|
+
(e: 'update:unselectedRows', rows: any[]): void;
|
|
29
|
+
(e: 'update:selectAllScope', scope: 'page' | 'dataset'): void;
|
|
26
30
|
(e: 'page-change', page: number): void;
|
|
27
31
|
(e: 'sort-change', sortList: IDataSort[]): void;
|
|
28
32
|
(e: 'filter-change', filter: IDataFilter | null): void;
|
|
@@ -39,6 +43,8 @@ export declare const KDatatableDefaultProps: {
|
|
|
39
43
|
export declare function useKDatatableLogic(props: KDatatableProps, emit?: KDatatableEmits): {
|
|
40
44
|
selectedRows: Ref<any[], any[]>;
|
|
41
45
|
selectAll: Ref<boolean, boolean>;
|
|
46
|
+
selectAllScope: Ref<"page" | "dataset", "page" | "dataset">;
|
|
47
|
+
unselectedRows: Ref<any[], any[]>;
|
|
42
48
|
currentPage: Ref<number, number>;
|
|
43
49
|
pageSize: Ref<number, number>;
|
|
44
50
|
sortList: Ref<IDataSort[], IDataSort[]>;
|
|
@@ -13,8 +13,6 @@ export function useKDatatableLogic(props, emit) {
|
|
|
13
13
|
const {
|
|
14
14
|
pageData,
|
|
15
15
|
virtualRows,
|
|
16
|
-
selectedRows: dpSelectedRows,
|
|
17
|
-
selectAll: dpSelectAll,
|
|
18
16
|
currentPage: dpCurrentPage,
|
|
19
17
|
pageSize: dpPageSize,
|
|
20
18
|
sortList: dpSortList,
|
|
@@ -24,11 +22,19 @@ export function useKDatatableLogic(props, emit) {
|
|
|
24
22
|
setSortList,
|
|
25
23
|
setFilter
|
|
26
24
|
} = useDataProvider(props.dataProvider);
|
|
27
|
-
const selectedRows = isRef(props.
|
|
28
|
-
const selectAll = isRef(props.
|
|
25
|
+
const selectedRows = isRef(props.selectedRows) ? props.selectedRows : ref(props.selectedRows !== void 0 ? props.selectedRows : []);
|
|
26
|
+
const selectAll = isRef(props.selectAll) ? props.selectAll : ref(props.selectAll !== void 0 ? props.selectAll : false);
|
|
27
|
+
const rawScope = isRef(props.selectAllScope) ? props.selectAllScope.value : props.selectAllScope;
|
|
28
|
+
const effectiveInitialScope = props.virtualScroll ? (() => {
|
|
29
|
+
if (rawScope === "page") {
|
|
30
|
+
console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.');
|
|
31
|
+
}
|
|
32
|
+
return "dataset";
|
|
33
|
+
})() : rawScope || "page";
|
|
34
|
+
const selectAllScope = isRef(props.selectAllScope) ? props.selectAllScope : ref(effectiveInitialScope);
|
|
35
|
+
const unselectedRows = isRef(props.unselectedRows) ? props.unselectedRows : ref(props.unselectedRows !== void 0 ? props.unselectedRows : []);
|
|
29
36
|
const idKey = props.dataProvider?.idKey || "id";
|
|
30
37
|
const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
|
|
31
|
-
let isInternalUpdating = false;
|
|
32
38
|
const pageRows = computed(() => {
|
|
33
39
|
if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
|
|
34
40
|
return props.dataProvider.pageData.value || [];
|
|
@@ -47,36 +53,6 @@ export function useKDatatableLogic(props, emit) {
|
|
|
47
53
|
}
|
|
48
54
|
return index;
|
|
49
55
|
};
|
|
50
|
-
const syncToProvider = () => {
|
|
51
|
-
if (props.dataProvider) {
|
|
52
|
-
isInternalUpdating = true;
|
|
53
|
-
const update = () => {
|
|
54
|
-
if (typeof props.dataProvider.setSelectAll === "function") {
|
|
55
|
-
props.dataProvider.setSelectAll(selectAll.value);
|
|
56
|
-
} else if (isRef(props.dataProvider.selectAll)) {
|
|
57
|
-
props.dataProvider.selectAll.value = selectAll.value;
|
|
58
|
-
} else {
|
|
59
|
-
props.dataProvider.selectAll = selectAll.value;
|
|
60
|
-
}
|
|
61
|
-
if (typeof props.dataProvider.setSelectedRows === "function") {
|
|
62
|
-
props.dataProvider.setSelectedRows(selectedRows.value);
|
|
63
|
-
} else if (isRef(props.dataProvider.selectedRows)) {
|
|
64
|
-
props.dataProvider.selectedRows.value = selectedRows.value;
|
|
65
|
-
} else {
|
|
66
|
-
props.dataProvider.selectedRows = selectedRows.value;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
try {
|
|
70
|
-
if (typeof props.dataProvider.batchUpdates === "function") {
|
|
71
|
-
props.dataProvider.batchUpdates(update);
|
|
72
|
-
} else {
|
|
73
|
-
update();
|
|
74
|
-
}
|
|
75
|
-
} finally {
|
|
76
|
-
isInternalUpdating = false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
56
|
watch(() => props.currentPage, (val) => {
|
|
81
57
|
if (val !== void 0 && val !== dpCurrentPage.value) {
|
|
82
58
|
setCurrentPage(val);
|
|
@@ -97,18 +73,39 @@ export function useKDatatableLogic(props, emit) {
|
|
|
97
73
|
setFilter(val);
|
|
98
74
|
}
|
|
99
75
|
}, { deep: true });
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
selectedRows.value
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
76
|
+
if (!isRef(props.selectedRows)) {
|
|
77
|
+
watch(() => props.selectedRows, (val) => {
|
|
78
|
+
if (val !== void 0 && val !== selectedRows.value) {
|
|
79
|
+
selectedRows.value = val;
|
|
80
|
+
}
|
|
81
|
+
}, { deep: true });
|
|
82
|
+
}
|
|
83
|
+
if (!isRef(props.selectAll)) {
|
|
84
|
+
watch(() => props.selectAll, (val) => {
|
|
85
|
+
if (val !== void 0 && val !== selectAll.value) {
|
|
86
|
+
selectAll.value = val;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (!isRef(props.selectAllScope)) {
|
|
91
|
+
watch(() => props.selectAllScope, (val) => {
|
|
92
|
+
if (val !== void 0) {
|
|
93
|
+
if (props.virtualScroll && val === "page") {
|
|
94
|
+
console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.');
|
|
95
|
+
selectAllScope.value = "dataset";
|
|
96
|
+
} else if (val !== selectAllScope.value) {
|
|
97
|
+
selectAllScope.value = val;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (!isRef(props.unselectedRows)) {
|
|
103
|
+
watch(() => props.unselectedRows, (val) => {
|
|
104
|
+
if (val !== void 0 && val !== unselectedRows.value) {
|
|
105
|
+
unselectedRows.value = val;
|
|
106
|
+
}
|
|
107
|
+
}, { deep: true });
|
|
108
|
+
}
|
|
112
109
|
watch(dpCurrentPage, (newVal) => {
|
|
113
110
|
emit?.("update:currentPage", newVal);
|
|
114
111
|
emit?.("page-change", newVal);
|
|
@@ -140,9 +137,12 @@ export function useKDatatableLogic(props, emit) {
|
|
|
140
137
|
return pageRows.value;
|
|
141
138
|
};
|
|
142
139
|
watch(() => selectAll.value, (newVal) => {
|
|
143
|
-
if (
|
|
140
|
+
if (newVal === lastSyncedSelectAll) return;
|
|
144
141
|
lastSyncedSelectAll = newVal;
|
|
145
|
-
if (
|
|
142
|
+
if (selectAllScope.value === "dataset") {
|
|
143
|
+
unselectedRows.value = [];
|
|
144
|
+
selectedRows.value = [];
|
|
145
|
+
} else {
|
|
146
146
|
const currentRows = getTargetRows();
|
|
147
147
|
if (newVal === false) {
|
|
148
148
|
const pageIds = new Set(currentRows.map(getRowId));
|
|
@@ -152,21 +152,25 @@ export function useKDatatableLogic(props, emit) {
|
|
|
152
152
|
const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
|
|
153
153
|
selectedRows.value = [...selectedRows.value, ...newSelections];
|
|
154
154
|
}
|
|
155
|
-
} else {
|
|
156
|
-
selectedRows.value = [];
|
|
157
155
|
}
|
|
158
156
|
emit?.("update:selectedRows", selectedRows.value);
|
|
159
157
|
emit?.("update:selectAll", newVal);
|
|
160
|
-
|
|
158
|
+
emit?.("update:unselectedRows", unselectedRows.value);
|
|
161
159
|
});
|
|
162
160
|
watch(() => selectedRows.value, (newVal) => {
|
|
163
|
-
if (isInternalUpdating) return;
|
|
164
161
|
emit?.("update:selectedRows", newVal || []);
|
|
165
|
-
syncToProvider();
|
|
166
162
|
}, { deep: true });
|
|
163
|
+
watch(() => unselectedRows.value, (newVal) => {
|
|
164
|
+
emit?.("update:unselectedRows", newVal || []);
|
|
165
|
+
}, { deep: true });
|
|
166
|
+
watch(() => selectAllScope.value, (newVal) => {
|
|
167
|
+
emit?.("update:selectAllScope", newVal);
|
|
168
|
+
});
|
|
167
169
|
return {
|
|
168
170
|
selectedRows,
|
|
169
171
|
selectAll,
|
|
172
|
+
selectAllScope,
|
|
173
|
+
unselectedRows,
|
|
170
174
|
currentPage: dpCurrentPage,
|
|
171
175
|
pageSize: dpPageSize,
|
|
172
176
|
sortList: dpSortList,
|
|
@@ -135,8 +135,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
135
135
|
placeholder: string;
|
|
136
136
|
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
|
-
align: "left" | "right" | undefined;
|
|
139
138
|
format: string;
|
|
139
|
+
align: "left" | "right" | undefined;
|
|
140
140
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
141
141
|
declare const _default: typeof __VLS_export;
|
|
142
142
|
export default _default;
|
|
@@ -135,8 +135,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
135
135
|
placeholder: string;
|
|
136
136
|
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
|
-
align: "left" | "right" | undefined;
|
|
139
138
|
format: string;
|
|
139
|
+
align: "left" | "right" | undefined;
|
|
140
140
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
141
141
|
declare const _default: typeof __VLS_export;
|
|
142
142
|
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { computed, isRef, ref } from "vue";
|
|
2
|
-
import { useDataProvider } from "../../composables/useDataProvider.js";
|
|
3
2
|
export const KGanttDefaultProps = {
|
|
4
3
|
dataProvider: {
|
|
5
4
|
type: Object,
|
|
@@ -189,9 +188,8 @@ export function useKGanttLogic(props) {
|
|
|
189
188
|
};
|
|
190
189
|
}
|
|
191
190
|
};
|
|
192
|
-
const
|
|
193
|
-
const
|
|
194
|
-
const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : dpBridge?.selectAll ?? ref(false);
|
|
191
|
+
const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : ref([]);
|
|
192
|
+
const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : ref(false);
|
|
195
193
|
return {
|
|
196
194
|
globalDateRange,
|
|
197
195
|
totalDuration,
|
|
@@ -73,8 +73,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
73
73
|
title: string;
|
|
74
74
|
text: string;
|
|
75
75
|
timeout: number;
|
|
76
|
-
pauseOnHover: boolean;
|
|
77
76
|
teleport: boolean;
|
|
77
|
+
pauseOnHover: boolean;
|
|
78
78
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
79
|
declare const _default: typeof __VLS_export;
|
|
80
80
|
export default _default;
|
|
@@ -73,8 +73,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
73
73
|
title: string;
|
|
74
74
|
text: string;
|
|
75
75
|
timeout: number;
|
|
76
|
-
pauseOnHover: boolean;
|
|
77
76
|
teleport: boolean;
|
|
77
|
+
pauseOnHover: boolean;
|
|
78
78
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
79
|
declare const _default: typeof __VLS_export;
|
|
80
80
|
export default _default;
|
|
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
}>> & Readonly<{}>, {
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
text: string;
|
|
30
|
-
position: "
|
|
30
|
+
position: "top" | "left" | "right" | "bottom";
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
export default _default;
|
|
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
}>> & Readonly<{}>, {
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
text: string;
|
|
30
|
-
position: "
|
|
30
|
+
position: "top" | "left" | "right" | "bottom";
|
|
31
31
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
export default _default;
|
|
@@ -139,8 +139,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
139
139
|
"onUpdate:expandedNodes"?: ((value: any) => any) | undefined;
|
|
140
140
|
"onNode-toggle"?: ((nodeId: string | number) => any) | undefined;
|
|
141
141
|
}>, {
|
|
142
|
-
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
143
142
|
selectedRows: any[];
|
|
143
|
+
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
144
144
|
selectAll: boolean;
|
|
145
145
|
idKey: string;
|
|
146
146
|
virtualScroll: boolean;
|
|
@@ -139,8 +139,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
139
139
|
"onUpdate:expandedNodes"?: ((value: any) => any) | undefined;
|
|
140
140
|
"onNode-toggle"?: ((nodeId: string | number) => any) | undefined;
|
|
141
141
|
}>, {
|
|
142
|
-
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
143
142
|
selectedRows: any[];
|
|
143
|
+
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
144
144
|
selectAll: boolean;
|
|
145
145
|
idKey: string;
|
|
146
146
|
virtualScroll: boolean;
|
|
@@ -5,8 +5,6 @@ export interface IUseDataProviderOptions<TRow = any> {
|
|
|
5
5
|
pageSize?: Ref<number> | WritableComputedRef<number>;
|
|
6
6
|
filter?: Ref<IDataFilter | null> | WritableComputedRef<IDataFilter | null>;
|
|
7
7
|
sortList?: Ref<IDataSort[]> | WritableComputedRef<IDataSort[]>;
|
|
8
|
-
selectedRows?: Ref<TRow[]> | WritableComputedRef<TRow[]>;
|
|
9
|
-
selectAll?: Ref<boolean> | WritableComputedRef<boolean>;
|
|
10
8
|
}
|
|
11
9
|
export interface IUseDataProviderReturn<T = TDataRow> {
|
|
12
10
|
rawProvider: any;
|
|
@@ -20,8 +18,6 @@ export interface IUseDataProviderReturn<T = TDataRow> {
|
|
|
20
18
|
error: Ref<any>;
|
|
21
19
|
filter: Ref<IDataFilter | null>;
|
|
22
20
|
sortList: Ref<IDataSort[]>;
|
|
23
|
-
selectedRows: Ref<any[]>;
|
|
24
|
-
selectAll: Ref<boolean>;
|
|
25
21
|
setCurrentPage: (page: number) => void;
|
|
26
22
|
setPageSize: (size: number) => void;
|
|
27
23
|
setFilter: (filter: IDataFilter | null, immediate?: boolean) => void;
|
|
@@ -39,8 +39,6 @@ export function useDataProvider(provider, options) {
|
|
|
39
39
|
const error = ref(activeProvider ? extractVal(activeProvider.error, null) : null);
|
|
40
40
|
const filter = options?.filter || ref(activeProvider ? extractVal(activeProvider.filter, null) : null);
|
|
41
41
|
const sortList = options?.sortList || ref(activeProvider ? extractVal(activeProvider.sortList, []) : []);
|
|
42
|
-
const selectedRows = options?.selectedRows || ref(activeProvider ? extractVal(activeProvider.selectedRows, []) : []);
|
|
43
|
-
const selectAll = options?.selectAll || ref(activeProvider ? extractVal(activeProvider.selectAll, false) : false);
|
|
44
42
|
let isSyncingFromProvider = false;
|
|
45
43
|
let isSyncingToProvider = false;
|
|
46
44
|
const syncFromProvider = () => {
|
|
@@ -55,8 +53,6 @@ export function useDataProvider(provider, options) {
|
|
|
55
53
|
error.value = null;
|
|
56
54
|
filter.value = null;
|
|
57
55
|
sortList.value = [];
|
|
58
|
-
selectedRows.value = [];
|
|
59
|
-
selectAll.value = false;
|
|
60
56
|
return;
|
|
61
57
|
}
|
|
62
58
|
isSyncingFromProvider = true;
|
|
@@ -83,14 +79,6 @@ export function useDataProvider(provider, options) {
|
|
|
83
79
|
if (JSON.stringify(sortList.value) !== JSON.stringify(newSort)) {
|
|
84
80
|
sortList.value = newSort;
|
|
85
81
|
}
|
|
86
|
-
const newSelected = extractVal(activeProvider.selectedRows, []);
|
|
87
|
-
if (selectedRows.value !== newSelected) {
|
|
88
|
-
selectedRows.value = newSelected;
|
|
89
|
-
}
|
|
90
|
-
const newSelectAll = extractVal(activeProvider.selectAll, false);
|
|
91
|
-
if (selectAll.value !== newSelectAll) {
|
|
92
|
-
selectAll.value = newSelectAll;
|
|
93
|
-
}
|
|
94
82
|
} finally {
|
|
95
83
|
isSyncingFromProvider = false;
|
|
96
84
|
}
|
|
@@ -254,40 +242,6 @@ export function useDataProvider(provider, options) {
|
|
|
254
242
|
}
|
|
255
243
|
}, { deep: true });
|
|
256
244
|
}
|
|
257
|
-
if (options?.selectedRows) {
|
|
258
|
-
watch(options.selectedRows, (newVal) => {
|
|
259
|
-
if (isSyncingFromProvider || isSyncingToProvider) return;
|
|
260
|
-
if (activeProvider) {
|
|
261
|
-
isSyncingToProvider = true;
|
|
262
|
-
try {
|
|
263
|
-
if (typeof activeProvider.setSelectedRows === "function") {
|
|
264
|
-
activeProvider.setSelectedRows(newVal);
|
|
265
|
-
} else {
|
|
266
|
-
activeProvider.selectedRows = newVal;
|
|
267
|
-
}
|
|
268
|
-
} finally {
|
|
269
|
-
isSyncingToProvider = false;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, { deep: true });
|
|
273
|
-
}
|
|
274
|
-
if (options?.selectAll) {
|
|
275
|
-
watch(options.selectAll, (newVal) => {
|
|
276
|
-
if (isSyncingFromProvider || isSyncingToProvider) return;
|
|
277
|
-
if (activeProvider && extractVal(activeProvider.selectAll, false) !== newVal) {
|
|
278
|
-
isSyncingToProvider = true;
|
|
279
|
-
try {
|
|
280
|
-
if (typeof activeProvider.setSelectAll === "function") {
|
|
281
|
-
activeProvider.setSelectAll(newVal);
|
|
282
|
-
} else {
|
|
283
|
-
activeProvider.selectAll = newVal;
|
|
284
|
-
}
|
|
285
|
-
} finally {
|
|
286
|
-
isSyncingToProvider = false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
245
|
const refresh = async (hardRefresh = false) => {
|
|
292
246
|
if (!activeProvider) return;
|
|
293
247
|
if (typeof activeProvider.refresh === "function") {
|
|
@@ -317,9 +271,7 @@ export function useDataProvider(provider, options) {
|
|
|
317
271
|
initialLoad: initialLoad.value,
|
|
318
272
|
error: error.value,
|
|
319
273
|
filter: filter.value,
|
|
320
|
-
sortList: sortList.value
|
|
321
|
-
selectedRows: selectedRows.value,
|
|
322
|
-
selectAll: selectAll.value
|
|
274
|
+
sortList: sortList.value
|
|
323
275
|
};
|
|
324
276
|
};
|
|
325
277
|
const setState = (partial) => {
|
|
@@ -330,8 +282,6 @@ export function useDataProvider(provider, options) {
|
|
|
330
282
|
if (partial.pageSize !== void 0) setPageSize(partial.pageSize);
|
|
331
283
|
if (partial.filter !== void 0) setFilter(partial.filter);
|
|
332
284
|
if (partial.sortList !== void 0) setSortList(partial.sortList);
|
|
333
|
-
if (partial.selectedRows !== void 0) selectedRows.value = partial.selectedRows;
|
|
334
|
-
if (partial.selectAll !== void 0) selectAll.value = partial.selectAll;
|
|
335
285
|
}
|
|
336
286
|
};
|
|
337
287
|
return {
|
|
@@ -348,8 +298,6 @@ export function useDataProvider(provider, options) {
|
|
|
348
298
|
error,
|
|
349
299
|
filter,
|
|
350
300
|
sortList,
|
|
351
|
-
selectedRows,
|
|
352
|
-
selectAll,
|
|
353
301
|
setCurrentPage,
|
|
354
302
|
setPageSize,
|
|
355
303
|
setFilter,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
template(#icon v-if="action.icon")
|
|
20
20
|
KIcon(:iconname="action.icon" :width="16" :height="16")
|
|
21
21
|
template(#default v-if="!action.iconOnly && !action.icon") {{action.label}}
|
|
22
|
-
.info {{ props.selectAll ? (props.filter?.active ? t('All filtered items selected') : t('All items selected')) : t('Selected {count} items').replace('{count}', props.selectedRows.length.toString()) }}
|
|
22
|
+
.info {{ props.selectAll ? (props.unselectedRows && props.unselectedRows.length > 0 ? (props.filter?.active ? t('All filtered items selected ({count} excluded)').replace('{count}', props.unselectedRows.length.toString()) : t('All items selected ({count} excluded)').replace('{count}', props.unselectedRows.length.toString())) : (props.filter?.active ? t('All filtered items selected') : t('All items selected'))) : t('Selected {count} items').replace('{count}', props.selectedRows.length.toString()) }}
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
@@ -34,6 +34,7 @@ const props = defineProps<{
|
|
|
34
34
|
bulkActions: IKDatatableAction[]
|
|
35
35
|
selectedRows: any[]
|
|
36
36
|
selectAll: boolean
|
|
37
|
+
unselectedRows?: any[]
|
|
37
38
|
filter?: any
|
|
38
39
|
selected: any
|
|
39
40
|
dp: CFlatClientDataProvider
|
|
@@ -7,6 +7,8 @@ type __VLS_Props = {
|
|
|
7
7
|
bulkActions: Array<IKDatatableAction>;
|
|
8
8
|
selectedRows: any[];
|
|
9
9
|
selectAll: boolean;
|
|
10
|
+
selectAllScope?: 'page' | 'dataset';
|
|
11
|
+
unselectedRows?: any[];
|
|
10
12
|
currentPage?: number;
|
|
11
13
|
pageSize?: number;
|
|
12
14
|
cellSlots?: Record<string, any>;
|
|
@@ -25,16 +27,22 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
25
27
|
"update:pageSize": (value: number) => any;
|
|
26
28
|
"update:selectedRows": (value: any[]) => any;
|
|
27
29
|
"update:selectAll": (value: boolean) => any;
|
|
30
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
31
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
28
32
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
33
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
30
34
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
31
35
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
32
36
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
37
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
38
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
33
39
|
}>, {
|
|
40
|
+
unselectedRows: any[];
|
|
34
41
|
virtualScroll: boolean;
|
|
35
42
|
itemHeight: number;
|
|
36
43
|
buffer: number;
|
|
37
44
|
viewportHeight: number;
|
|
45
|
+
selectAllScope: "page" | "dataset";
|
|
38
46
|
emptyStateText: string;
|
|
39
47
|
emptyFilterStateText: string;
|
|
40
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
)
|
|
83
83
|
td(:colspan="totalColspan")
|
|
84
84
|
.footer(v-if="!props.virtualScroll")
|
|
85
|
-
KBulkActions.bulk-actions(v-if="props.bulkActions && props.bulkActions.length > 0" :bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :filter="props.dataProvider.filter")
|
|
85
|
+
KBulkActions.bulk-actions(v-if="props.bulkActions && props.bulkActions.length > 0" :bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :unselectedRows="unselectedRows" :filter="props.dataProvider.filter")
|
|
86
86
|
KPagination.pagination(:dataProvider="props.dataProvider" @update:currentPage="emit('update:currentPage', $event)" @update:pageSize="emit('update:pageSize', $event)")
|
|
87
87
|
.footer.virtual-footer(v-else-if="props.bulkActions && props.bulkActions.length > 0")
|
|
88
|
-
KBulkActions.bulk-actions(:bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :filter="props.dataProvider.filter")
|
|
88
|
+
KBulkActions.bulk-actions(:bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :unselectedRows="unselectedRows" :filter="props.dataProvider.filter")
|
|
89
89
|
</template>
|
|
90
90
|
|
|
91
91
|
<script setup lang="ts">
|
|
@@ -105,6 +105,8 @@ const props = withDefaults(defineProps<{
|
|
|
105
105
|
bulkActions: Array<IKDatatableAction>
|
|
106
106
|
selectedRows: any[]
|
|
107
107
|
selectAll: boolean
|
|
108
|
+
selectAllScope?: 'page' | 'dataset'
|
|
109
|
+
unselectedRows?: any[]
|
|
108
110
|
currentPage?: number
|
|
109
111
|
pageSize?: number
|
|
110
112
|
cellSlots?: Record<string, any>
|
|
@@ -118,6 +120,8 @@ const props = withDefaults(defineProps<{
|
|
|
118
120
|
viewportHeight?: number
|
|
119
121
|
buffer?: number
|
|
120
122
|
}>(), {
|
|
123
|
+
selectAllScope: undefined,
|
|
124
|
+
unselectedRows: () => [],
|
|
121
125
|
virtualScroll: false,
|
|
122
126
|
itemHeight: 40,
|
|
123
127
|
viewportHeight: 500,
|
|
@@ -129,6 +133,8 @@ const props = withDefaults(defineProps<{
|
|
|
129
133
|
const emit = defineEmits<{
|
|
130
134
|
(e: 'update:selectedRows', value: any[]): void
|
|
131
135
|
(e: 'update:selectAll', value: boolean): void
|
|
136
|
+
(e: 'update:unselectedRows', value: any[]): void
|
|
137
|
+
(e: 'update:selectAllScope', value: 'page' | 'dataset'): void
|
|
132
138
|
(e: 'update:currentPage', value: number): void
|
|
133
139
|
(e: 'update:pageSize', value: number): void
|
|
134
140
|
}>()
|
|
@@ -144,6 +150,21 @@ const selectAll = computed({
|
|
|
144
150
|
set: (val) => emit('update:selectAll', val)
|
|
145
151
|
})
|
|
146
152
|
|
|
153
|
+
const unselectedRows = computed({
|
|
154
|
+
get: () => props.unselectedRows || [],
|
|
155
|
+
set: (val) => emit('update:unselectedRows', val)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const effectiveSelectAllScope = computed<'page' | 'dataset'>(() => {
|
|
159
|
+
if (props.virtualScroll) {
|
|
160
|
+
if (props.selectAllScope === 'page') {
|
|
161
|
+
console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.')
|
|
162
|
+
}
|
|
163
|
+
return 'dataset'
|
|
164
|
+
}
|
|
165
|
+
return props.selectAllScope || 'page'
|
|
166
|
+
})
|
|
167
|
+
|
|
147
168
|
const rowIdKey = computed(() => (props.dataProvider as any)?.idKey || 'id')
|
|
148
169
|
|
|
149
170
|
const getRowKey = (row: any, index: number): string | number => {
|
|
@@ -171,15 +192,28 @@ const selectedRowIds = computed(() => {
|
|
|
171
192
|
return set
|
|
172
193
|
})
|
|
173
194
|
|
|
195
|
+
const unselectedRowIds = computed(() => {
|
|
196
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
197
|
+
const set = new Set<any>()
|
|
198
|
+
for (const r of unselectedRows.value || []) {
|
|
199
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
200
|
+
set.add(id)
|
|
201
|
+
set.add(r)
|
|
202
|
+
}
|
|
203
|
+
return set
|
|
204
|
+
})
|
|
205
|
+
|
|
174
206
|
const isRowSelected = (row: any) => {
|
|
175
|
-
if (selectAll.value) return true
|
|
176
207
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
177
208
|
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
209
|
+
if (effectiveSelectAllScope.value === 'dataset' && selectAll.value) {
|
|
210
|
+
return !unselectedRowIds.value.has(rowId) && !unselectedRowIds.value.has(row)
|
|
211
|
+
}
|
|
178
212
|
return selectedRowIds.value.has(rowId) || selectedRowIds.value.has(row)
|
|
179
213
|
}
|
|
180
214
|
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
215
|
+
const pageSelectedCount = computed(() => {
|
|
216
|
+
if (!datatableItems.value || datatableItems.value.length === 0) return 0
|
|
183
217
|
let count = 0
|
|
184
218
|
const ids = selectedRowIds.value
|
|
185
219
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
@@ -193,61 +227,89 @@ const selectedCount = computed(() => {
|
|
|
193
227
|
const isAllSelected = computed(() => {
|
|
194
228
|
const total = datatableItems.value.length
|
|
195
229
|
if (total === 0) return false
|
|
196
|
-
if (
|
|
197
|
-
|
|
230
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
231
|
+
return selectAll.value === true && unselectedRows.value.length === 0
|
|
232
|
+
}
|
|
233
|
+
return pageSelectedCount.value === total
|
|
198
234
|
})
|
|
199
235
|
|
|
200
236
|
const isIndeterminate = computed(() => {
|
|
201
237
|
const total = datatableItems.value.length
|
|
202
238
|
if (total === 0) return false
|
|
203
|
-
if (
|
|
204
|
-
|
|
239
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
240
|
+
if (selectAll.value === true) {
|
|
241
|
+
return unselectedRows.value.length > 0
|
|
242
|
+
}
|
|
243
|
+
return (selectedRows.value && selectedRows.value.length > 0)
|
|
244
|
+
}
|
|
245
|
+
return pageSelectedCount.value > 0 && pageSelectedCount.value < total
|
|
205
246
|
})
|
|
206
247
|
|
|
207
248
|
const handleSelectAll = () => {
|
|
208
249
|
const total = datatableItems.value.length
|
|
209
250
|
if (total === 0) return
|
|
210
251
|
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
selectedRows.value = []
|
|
214
|
-
} else {
|
|
215
|
-
const isFiltered = !!((dpFilter as any)?.active || (dpFilter as any)?.value?.active || (props.dataProvider as any)?.filter?.active || (props.dataProvider as any)?.filter?.value?.active)
|
|
216
|
-
if (isFiltered) {
|
|
252
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
253
|
+
if (isAllSelected.value) {
|
|
217
254
|
selectAll.value = false
|
|
218
|
-
|
|
255
|
+
unselectedRows.value = []
|
|
256
|
+
selectedRows.value = []
|
|
219
257
|
} else {
|
|
220
258
|
selectAll.value = true
|
|
221
|
-
|
|
259
|
+
unselectedRows.value = []
|
|
260
|
+
selectedRows.value = []
|
|
222
261
|
}
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// page scope: retain selections from other pages
|
|
266
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
267
|
+
if (isAllSelected.value) {
|
|
268
|
+
const pageIdSet = new Set(datatableItems.value.map((r: any) => r?.[idKey] ?? r?.id ?? r?._id ?? r))
|
|
269
|
+
selectedRows.value = (selectedRows.value || []).filter((r: any) => {
|
|
270
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
271
|
+
return !pageIdSet.has(id) && !pageIdSet.has(r)
|
|
272
|
+
})
|
|
273
|
+
unselectedRows.value = []
|
|
274
|
+
selectAll.value = false
|
|
275
|
+
} else {
|
|
276
|
+
const existingIds = selectedRowIds.value
|
|
277
|
+
const toAdd = datatableItems.value.filter((r: any) => {
|
|
278
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
279
|
+
return !existingIds.has(id) && !existingIds.has(r)
|
|
280
|
+
})
|
|
281
|
+
selectedRows.value = [...(selectedRows.value || []), ...toAdd]
|
|
282
|
+
unselectedRows.value = []
|
|
283
|
+
selectAll.value = false
|
|
223
284
|
}
|
|
224
285
|
}
|
|
225
286
|
|
|
226
287
|
const toggleRow = (row: any) => {
|
|
227
288
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
228
289
|
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return rId !== rowId && r !== row
|
|
235
|
-
})
|
|
236
|
-
} else {
|
|
237
|
-
const isSelected = isRowSelected(row)
|
|
238
|
-
if (isSelected) {
|
|
239
|
-
const next = (selectedRows.value || []).filter((r: any) => {
|
|
290
|
+
|
|
291
|
+
if (effectiveSelectAllScope.value === 'dataset' && selectAll.value) {
|
|
292
|
+
const isCurrentlyExcluded = unselectedRowIds.value.has(rowId) || unselectedRowIds.value.has(row)
|
|
293
|
+
if (isCurrentlyExcluded) {
|
|
294
|
+
unselectedRows.value = (unselectedRows.value || []).filter((r: any) => {
|
|
240
295
|
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
241
296
|
return rId !== rowId && r !== row
|
|
242
297
|
})
|
|
243
|
-
selectedRows.value = next
|
|
244
298
|
} else {
|
|
245
|
-
|
|
246
|
-
selectedRows.value = next
|
|
247
|
-
if (next.length === datatableItems.value.length && datatableItems.value.length > 0) {
|
|
248
|
-
selectAll.value = true
|
|
249
|
-
}
|
|
299
|
+
unselectedRows.value = [...(unselectedRows.value || []), row]
|
|
250
300
|
}
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const isSelected = isRowSelected(row)
|
|
305
|
+
if (isSelected) {
|
|
306
|
+
const next = (selectedRows.value || []).filter((r: any) => {
|
|
307
|
+
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
308
|
+
return rId !== rowId && r !== row
|
|
309
|
+
})
|
|
310
|
+
selectedRows.value = next
|
|
311
|
+
} else {
|
|
312
|
+
selectedRows.value = [...(selectedRows.value || []), row]
|
|
251
313
|
}
|
|
252
314
|
}
|
|
253
315
|
|
|
@@ -7,6 +7,8 @@ type __VLS_Props = {
|
|
|
7
7
|
bulkActions: Array<IKDatatableAction>;
|
|
8
8
|
selectedRows: any[];
|
|
9
9
|
selectAll: boolean;
|
|
10
|
+
selectAllScope?: 'page' | 'dataset';
|
|
11
|
+
unselectedRows?: any[];
|
|
10
12
|
currentPage?: number;
|
|
11
13
|
pageSize?: number;
|
|
12
14
|
cellSlots?: Record<string, any>;
|
|
@@ -25,16 +27,22 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
25
27
|
"update:pageSize": (value: number) => any;
|
|
26
28
|
"update:selectedRows": (value: any[]) => any;
|
|
27
29
|
"update:selectAll": (value: boolean) => any;
|
|
30
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
31
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
28
32
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
33
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
30
34
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
31
35
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
32
36
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
37
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
38
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
33
39
|
}>, {
|
|
40
|
+
unselectedRows: any[];
|
|
34
41
|
virtualScroll: boolean;
|
|
35
42
|
itemHeight: number;
|
|
36
43
|
buffer: number;
|
|
37
44
|
viewportHeight: number;
|
|
45
|
+
selectAllScope: "page" | "dataset";
|
|
38
46
|
emptyStateText: string;
|
|
39
47
|
emptyFilterStateText: string;
|
|
40
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.125",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"**/*.sass"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@katlux/providers": "^0.1.1-alpha.
|
|
57
|
+
"@katlux/providers": "^0.1.1-alpha.113",
|
|
58
58
|
"@nuxt/kit": "^3.12.0",
|
|
59
59
|
"@nuxtjs/i18n": "^10.4.0",
|
|
60
60
|
"pug": "^3.0.0",
|