@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
|
@@ -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,
|
|
@@ -55,8 +55,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
};
|
|
56
56
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
57
57
|
"update:modelValue": (value: string | Date) => any;
|
|
58
|
-
change: (value: string | Date) => any;
|
|
59
58
|
blur: (event: FocusEvent) => any;
|
|
59
|
+
change: (value: string | Date) => any;
|
|
60
60
|
"update:isOpen": (value: boolean) => any;
|
|
61
61
|
"update:maskedModel": (value: string) => any;
|
|
62
62
|
"update:calendarShow": (value: boolean) => any;
|
|
@@ -117,8 +117,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
117
117
|
};
|
|
118
118
|
}>> & Readonly<{
|
|
119
119
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
120
|
-
onChange?: ((value: string | Date) => any) | undefined;
|
|
121
120
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
121
|
+
onChange?: ((value: string | Date) => any) | undefined;
|
|
122
122
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
123
123
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
124
124
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
@@ -130,7 +130,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
130
130
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
131
131
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
132
132
|
day: string | Date;
|
|
133
|
-
validation: "
|
|
133
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
134
134
|
validationText: string;
|
|
135
135
|
placeholder: string;
|
|
136
136
|
teleportTo: string;
|
|
@@ -55,8 +55,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
};
|
|
56
56
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
57
57
|
"update:modelValue": (value: string | Date) => any;
|
|
58
|
-
change: (value: string | Date) => any;
|
|
59
58
|
blur: (event: FocusEvent) => any;
|
|
59
|
+
change: (value: string | Date) => any;
|
|
60
60
|
"update:isOpen": (value: boolean) => any;
|
|
61
61
|
"update:maskedModel": (value: string) => any;
|
|
62
62
|
"update:calendarShow": (value: boolean) => any;
|
|
@@ -117,8 +117,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
117
117
|
};
|
|
118
118
|
}>> & Readonly<{
|
|
119
119
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
120
|
-
onChange?: ((value: string | Date) => any) | undefined;
|
|
121
120
|
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
121
|
+
onChange?: ((value: string | Date) => any) | undefined;
|
|
122
122
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
123
123
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
124
124
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
@@ -130,7 +130,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
130
130
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
131
131
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
132
132
|
day: string | Date;
|
|
133
|
-
validation: "
|
|
133
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
134
134
|
validationText: string;
|
|
135
135
|
placeholder: string;
|
|
136
136
|
teleportTo: string;
|
|
@@ -132,7 +132,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
132
132
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
133
133
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
134
134
|
day: string | Date;
|
|
135
|
-
validation: "
|
|
135
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
136
136
|
validationText: string;
|
|
137
137
|
placeholder: string;
|
|
138
138
|
teleportTo: string;
|
|
@@ -132,7 +132,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
132
132
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
133
133
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
134
134
|
day: string | Date;
|
|
135
|
-
validation: "
|
|
135
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
136
136
|
validationText: string;
|
|
137
137
|
placeholder: string;
|
|
138
138
|
teleportTo: string;
|
|
@@ -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,
|
|
@@ -110,7 +110,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
label: string;
|
|
112
112
|
disabled: boolean;
|
|
113
|
-
validation: "
|
|
113
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
114
114
|
validationText: string;
|
|
115
115
|
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
@@ -110,7 +110,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
label: string;
|
|
112
112
|
disabled: boolean;
|
|
113
|
-
validation: "
|
|
113
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
114
114
|
validationText: string;
|
|
115
115
|
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
@@ -66,7 +66,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
modelValue: string;
|
|
68
68
|
label: string;
|
|
69
|
-
validation: "
|
|
69
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
70
70
|
validationText: string;
|
|
71
71
|
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
@@ -66,7 +66,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
modelValue: string;
|
|
68
68
|
label: string;
|
|
69
|
-
validation: "
|
|
69
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
70
70
|
validationText: string;
|
|
71
71
|
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
@@ -51,7 +51,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
51
51
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
52
52
|
}>, {
|
|
53
53
|
disabled: boolean;
|
|
54
|
-
validation: "
|
|
54
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
55
55
|
validationText: string;
|
|
56
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
57
|
declare const _default: typeof __VLS_export;
|
|
@@ -51,7 +51,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
51
51
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
52
52
|
}>, {
|
|
53
53
|
disabled: boolean;
|
|
54
|
-
validation: "
|
|
54
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
55
55
|
validationText: string;
|
|
56
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
57
57
|
declare const _default: typeof __VLS_export;
|
|
@@ -57,7 +57,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
57
57
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
58
58
|
}>, {
|
|
59
59
|
label: string;
|
|
60
|
-
validation: "
|
|
60
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
61
61
|
validationText: string;
|
|
62
62
|
placeholder: string;
|
|
63
63
|
rows: number;
|
|
@@ -57,7 +57,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
57
57
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
58
58
|
}>, {
|
|
59
59
|
label: string;
|
|
60
|
-
validation: "
|
|
60
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
61
61
|
validationText: string;
|
|
62
62
|
placeholder: string;
|
|
63
63
|
rows: number;
|
|
@@ -67,9 +67,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
67
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
68
68
|
}>, {
|
|
69
69
|
modelValue: string;
|
|
70
|
-
type: "number" | "
|
|
70
|
+
type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
label: string;
|
|
72
|
-
validation: "
|
|
72
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
73
73
|
validationText: string;
|
|
74
74
|
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
@@ -67,9 +67,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
67
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
68
68
|
}>, {
|
|
69
69
|
modelValue: string;
|
|
70
|
-
type: "number" | "
|
|
70
|
+
type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
label: string;
|
|
72
|
-
validation: "
|
|
72
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
73
73
|
validationText: string;
|
|
74
74
|
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
@@ -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;
|
|
@@ -235,7 +235,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
235
235
|
label: string;
|
|
236
236
|
disabled: boolean;
|
|
237
237
|
loading: boolean;
|
|
238
|
-
validation: "
|
|
238
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
239
239
|
validationText: string;
|
|
240
240
|
idKey: string;
|
|
241
241
|
searchbox: boolean;
|
|
@@ -235,7 +235,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
235
235
|
label: string;
|
|
236
236
|
disabled: boolean;
|
|
237
237
|
loading: boolean;
|
|
238
|
-
validation: "
|
|
238
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
239
239
|
validationText: string;
|
|
240
240
|
idKey: string;
|
|
241
241
|
searchbox: 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;
|
|
@@ -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,
|