@katlux/toolkit 0.1.1-alpha.124 → 0.1.1-alpha.126
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/KAccordion/KAccordion.global.d.vue.ts +1 -1
- package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +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/KButton/KButton.logic.d.ts +2 -2
- package/dist/runtime/components/KButton/KButton.logic.js +5 -2
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +6 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +6 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- 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 +3 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +3 -3
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGantt/KGantt.logic.js +2 -4
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
- 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/KTreePicker/KTreePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.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/KButton/KButton.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KButton/KButton.vue +2 -2
- package/dist/runtime/presets/default/components/KButton/KButton.vue.d.ts +1 -1
- 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
|
@@ -27,8 +27,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
28
28
|
onChange?: ((value: any) => any) | undefined;
|
|
29
29
|
}>, {
|
|
30
|
-
multiOpen: boolean;
|
|
31
30
|
modelValue: string | number | string[] | number[];
|
|
31
|
+
multiOpen: boolean;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
34
34
|
export default _default;
|
|
@@ -27,8 +27,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
28
28
|
onChange?: ((value: any) => any) | undefined;
|
|
29
29
|
}>, {
|
|
30
|
-
multiOpen: boolean;
|
|
31
30
|
modelValue: string | number | string[] | number[];
|
|
31
|
+
multiOpen: boolean;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
34
34
|
export default _default;
|
|
@@ -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 {
|
|
@@ -23,11 +23,11 @@ export interface KButtonEmits {
|
|
|
23
23
|
export declare function useKButtonLogic(props: KButtonProps, emit: KButtonEmits): {
|
|
24
24
|
isLink: import("vue").ComputedRef<boolean>;
|
|
25
25
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
26
|
-
buttonClasses: import("vue").ComputedRef<("
|
|
26
|
+
buttonClasses: import("vue").ComputedRef<("default" | "info" | "success" | "warning" | "danger" | "small" | "primary" | "light" | "dark" | "large" | "medium" | {
|
|
27
27
|
disabled: boolean | undefined;
|
|
28
28
|
'icon-only': boolean | undefined;
|
|
29
29
|
})[]>;
|
|
30
|
-
onClick: () => void;
|
|
30
|
+
onClick: (e?: MouseEvent) => void;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Default props for KButton
|
|
@@ -7,8 +7,11 @@ export function useKButtonLogic(props, emit) {
|
|
|
7
7
|
props.size || "medium",
|
|
8
8
|
{ disabled: isDisabled.value, "icon-only": props.iconOnly }
|
|
9
9
|
]);
|
|
10
|
-
const onClick = () => {
|
|
11
|
-
if (isDisabled.value)
|
|
10
|
+
const onClick = (e) => {
|
|
11
|
+
if (isDisabled.value) {
|
|
12
|
+
e?.preventDefault();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
12
15
|
emit("click");
|
|
13
16
|
};
|
|
14
17
|
return {
|
|
@@ -77,7 +77,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
}>, {
|
|
78
78
|
label: string;
|
|
79
79
|
disabled: boolean;
|
|
80
|
-
validation: "
|
|
80
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
81
81
|
validationText: string;
|
|
82
82
|
idKey: string;
|
|
83
83
|
indeterminate: boolean;
|
|
@@ -77,7 +77,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
77
|
}>, {
|
|
78
78
|
label: string;
|
|
79
79
|
disabled: boolean;
|
|
80
|
-
validation: "
|
|
80
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
81
81
|
validationText: string;
|
|
82
82
|
idKey: string;
|
|
83
83
|
indeterminate: boolean;
|
|
@@ -225,7 +225,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
225
225
|
modelValue: any;
|
|
226
226
|
label: string;
|
|
227
227
|
disabled: boolean;
|
|
228
|
-
validation: "
|
|
228
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
229
229
|
validationText: string;
|
|
230
230
|
searchbox: boolean;
|
|
231
231
|
searchtext: string;
|
|
@@ -225,7 +225,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
225
225
|
modelValue: any;
|
|
226
226
|
label: string;
|
|
227
227
|
disabled: boolean;
|
|
228
|
-
validation: "
|
|
228
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
229
229
|
validationText: string;
|
|
230
230
|
searchbox: boolean;
|
|
231
231
|
searchtext: string;
|
|
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
5
5
|
default: string;
|
|
6
6
|
};
|
|
7
7
|
selectionValue: {
|
|
8
|
-
type: (
|
|
8
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
9
9
|
default: null;
|
|
10
10
|
};
|
|
11
11
|
inputValue: {
|
|
12
|
-
type: (
|
|
12
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
15
|
modelValue: {
|
|
@@ -99,11 +99,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
99
99
|
default: string;
|
|
100
100
|
};
|
|
101
101
|
selectionValue: {
|
|
102
|
-
type: (
|
|
102
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
103
103
|
default: null;
|
|
104
104
|
};
|
|
105
105
|
inputValue: {
|
|
106
|
-
type: (
|
|
106
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
107
107
|
default: string;
|
|
108
108
|
};
|
|
109
109
|
modelValue: {
|
|
@@ -191,7 +191,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
label: string;
|
|
194
|
-
validation: "
|
|
194
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
195
195
|
validationText: string;
|
|
196
196
|
searchbox: boolean;
|
|
197
197
|
labelField: string;
|
|
@@ -199,7 +199,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
199
199
|
teleportTo: string;
|
|
200
200
|
mask: string;
|
|
201
201
|
valueField: string;
|
|
202
|
-
inputType: "number" | "
|
|
202
|
+
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
203
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
204
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
205
205
|
selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
|
|
@@ -5,11 +5,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
5
5
|
default: string;
|
|
6
6
|
};
|
|
7
7
|
selectionValue: {
|
|
8
|
-
type: (
|
|
8
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
9
9
|
default: null;
|
|
10
10
|
};
|
|
11
11
|
inputValue: {
|
|
12
|
-
type: (
|
|
12
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
15
|
modelValue: {
|
|
@@ -99,11 +99,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
99
99
|
default: string;
|
|
100
100
|
};
|
|
101
101
|
selectionValue: {
|
|
102
|
-
type: (
|
|
102
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
103
103
|
default: null;
|
|
104
104
|
};
|
|
105
105
|
inputValue: {
|
|
106
|
-
type: (
|
|
106
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
107
107
|
default: string;
|
|
108
108
|
};
|
|
109
109
|
modelValue: {
|
|
@@ -191,7 +191,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
label: string;
|
|
194
|
-
validation: "
|
|
194
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
195
195
|
validationText: string;
|
|
196
196
|
searchbox: boolean;
|
|
197
197
|
labelField: string;
|
|
@@ -199,7 +199,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
199
199
|
teleportTo: string;
|
|
200
200
|
mask: string;
|
|
201
201
|
valueField: string;
|
|
202
|
-
inputType: "number" | "
|
|
202
|
+
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
203
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
204
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
205
205
|
selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
|
|
@@ -73,11 +73,11 @@ export declare const KCompositeInputDefaultProps: {
|
|
|
73
73
|
default: string;
|
|
74
74
|
};
|
|
75
75
|
selectionValue: {
|
|
76
|
-
type: (
|
|
76
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
77
77
|
default: null;
|
|
78
78
|
};
|
|
79
79
|
inputValue: {
|
|
80
|
-
type: (
|
|
80
|
+
type: (ArrayConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
|
|
81
81
|
default: string;
|
|
82
82
|
};
|
|
83
83
|
modelValue: {
|
|
@@ -176,7 +176,7 @@ export declare function useKCompositeInputLogic(props: KCompositeInputProps, emi
|
|
|
176
176
|
modelValue: any;
|
|
177
177
|
'onUpdate:modelValue': (val: any) => any;
|
|
178
178
|
placeholder: string | undefined;
|
|
179
|
-
type: "number" | "
|
|
179
|
+
type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
180
180
|
mask: string | undefined;
|
|
181
181
|
showClear: boolean | undefined;
|
|
182
182
|
}>;
|
|
@@ -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
|
)
|