@katlux/toolkit 0.1.1-alpha.110 → 0.1.1-alpha.112
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/locales.mjs +195 -27
- package/dist/compiled/composables/useDataProvider.mjs +129 -82
- package/dist/compiled/composables/useDataProvider.spec.mjs +20 -1
- package/dist/compiled/composables/useKatluxContext.mjs +21 -0
- package/dist/compiled/composables/useKatluxContext.spec.mjs +63 -0
- package/dist/compiled/composables/useKatluxI18n.mjs +20 -9
- package/dist/compiled/composables/usePresetComponent.mjs +12 -3
- package/dist/compiled/composables/useRequestQueue.mjs +35 -0
- package/dist/compiled/utils/PresetResolver.mjs +21 -7
- package/dist/compiled/utils/TemplateResolver.mjs +11 -5
- package/dist/module.cjs +3 -31
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -32
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +29 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +18 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +29 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +25 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +298 -15
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +3 -3
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +3 -3
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +6 -5
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +48 -19
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -3
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +42 -18
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +5 -5
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +5 -5
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +5 -5
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +5 -5
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
- 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/KModal/KModal.global.d.vue.ts +15 -2
- package/dist/runtime/components/KModal/KModal.global.vue +6 -1
- package/dist/runtime/components/KModal/KModal.global.vue.d.ts +15 -2
- package/dist/runtime/components/KModal/KModal.logic.d.ts +8 -2
- package/dist/runtime/components/KModal/KModal.logic.js +21 -3
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -0
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +10 -5
- package/dist/runtime/components/KTabs/KTabItem.logic.js +20 -5
- package/dist/runtime/components/KTabs/KTabs.logic.js +18 -2
- 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 +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
- 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/KToast/KToast.logic.d.ts +1 -0
- package/dist/runtime/components/KToast/KToast.logic.js +19 -5
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +11 -2
- package/dist/runtime/components/KTree/KTree.global.vue +1 -0
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +11 -2
- package/dist/runtime/components/KTree/KTree.logic.d.ts +9 -4
- package/dist/runtime/components/KTree/KTree.logic.js +14 -8
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +10 -0
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +15 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +18 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +28 -6
- package/dist/runtime/composables/locales.js +195 -27
- package/dist/runtime/composables/useDataProvider.d.ts +1 -1
- package/dist/runtime/composables/useDataProvider.js +129 -82
- package/dist/runtime/composables/useDebounce.d.ts +1 -1
- package/dist/runtime/composables/useKatluxContext.d.ts +13 -0
- package/dist/runtime/composables/useKatluxContext.js +21 -0
- package/dist/runtime/composables/useKatluxI18n.js +20 -9
- package/dist/runtime/composables/usePresetComponent.js +12 -3
- package/dist/runtime/composables/useRequestQueue.d.ts +25 -0
- package/dist/runtime/composables/useRequestQueue.js +35 -0
- package/dist/runtime/directives/clickOutside.d.ts +3 -2
- package/dist/runtime/directives/clickOutside.js +9 -2
- package/dist/runtime/hydration/NuxtHydrationAdapter.d.ts +10 -0
- package/dist/runtime/hydration/NuxtHydrationAdapter.js +88 -0
- package/dist/runtime/plugins/PresetPlugin.js +9 -1
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -3
- package/dist/runtime/plugins/nuxtCompatPlugin.js +6 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +24 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +19 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +42 -8
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +19 -2
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +19 -2
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +203 -12
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +19 -2
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +1 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +1 -20
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +2 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +6 -2
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -1
- package/dist/runtime/presets/default/components/KModal/KModal.vue +16 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +5 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +3 -1
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +2 -1
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +2 -1
- package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue +2 -0
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +20 -10
- package/dist/runtime/presets/default/components/KTree/KTree.vue +34 -24
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +20 -10
- package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +2 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +8 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +10 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +8 -2
- package/dist/runtime/server/middleware/session.d.ts +2 -0
- package/dist/runtime/server/middleware/session.js +36 -0
- package/dist/runtime/utils/PresetResolver.js +21 -7
- package/dist/runtime/utils/TemplateResolver.js +11 -5
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EDataFilterOperator
|
|
3
3
|
} from "@katlux/providers";
|
|
4
|
-
import { ref, watch, computed, unref } from "vue";
|
|
4
|
+
import { ref, watch, computed, unref, isRef } from "vue";
|
|
5
5
|
import { useDataProvider } from "../../composables/useDataProvider.js";
|
|
6
6
|
export const KComboboxDefaultProps = {
|
|
7
7
|
label: {
|
|
@@ -76,13 +76,83 @@ export const KComboboxDefaultProps = {
|
|
|
76
76
|
fullWidth: {
|
|
77
77
|
type: Boolean,
|
|
78
78
|
default: true
|
|
79
|
+
},
|
|
80
|
+
virtualScroll: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
84
|
+
itemHeight: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: 40
|
|
87
|
+
},
|
|
88
|
+
buffer: {
|
|
89
|
+
type: Number,
|
|
90
|
+
default: 5
|
|
79
91
|
}
|
|
80
92
|
};
|
|
81
93
|
export function useKComboboxLogic(props, emit) {
|
|
82
|
-
const {
|
|
94
|
+
const {
|
|
95
|
+
pageData: dpPageData,
|
|
96
|
+
loading: dpLoading,
|
|
97
|
+
currentPage: dpCurrentPage,
|
|
98
|
+
pageSize: dpPageSize,
|
|
99
|
+
rowCount: dpRowCount,
|
|
100
|
+
setCurrentPage: dpSetCurrentPage
|
|
101
|
+
} = useDataProvider(props.dataProvider);
|
|
83
102
|
const selectedItems = ref(null);
|
|
84
103
|
const isOptionsOpen = ref(false);
|
|
104
|
+
const highlightedIndex = ref(-1);
|
|
85
105
|
const searchtext = ref("");
|
|
106
|
+
const loadedOptions = ref([]);
|
|
107
|
+
const filteredOptions = computed(() => loadedOptions.value);
|
|
108
|
+
const lastAppendedPage = ref(1);
|
|
109
|
+
const hasMorePages = ref(true);
|
|
110
|
+
function getItemKey(item, index) {
|
|
111
|
+
if (!item) return index;
|
|
112
|
+
if (props.valueField && item[props.valueField] !== void 0) return item[props.valueField];
|
|
113
|
+
const idKey = props.dataProvider?.idKey || "id";
|
|
114
|
+
if (item[idKey] !== void 0) return item[idKey];
|
|
115
|
+
if (props.labelField && item[props.labelField] !== void 0) return item[props.labelField];
|
|
116
|
+
return index;
|
|
117
|
+
}
|
|
118
|
+
function syncLoadedOptions() {
|
|
119
|
+
const currentData = dpPageData.value || [];
|
|
120
|
+
const currentPageNum = dpCurrentPage.value ?? 1;
|
|
121
|
+
const currentSize = dpPageSize.value ?? 10;
|
|
122
|
+
if (currentSize <= 0) {
|
|
123
|
+
loadedOptions.value = [...currentData];
|
|
124
|
+
hasMorePages.value = false;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (currentPageNum === 1) {
|
|
128
|
+
loadedOptions.value = [...currentData];
|
|
129
|
+
lastAppendedPage.value = 1;
|
|
130
|
+
hasMorePages.value = currentData.length >= currentSize;
|
|
131
|
+
} else {
|
|
132
|
+
const existingKeys = new Set(loadedOptions.value.map((item, idx) => getItemKey(item, idx)));
|
|
133
|
+
const newItems = currentData.filter((item, idx) => !existingKeys.has(getItemKey(item, idx)));
|
|
134
|
+
if (newItems.length > 0) {
|
|
135
|
+
loadedOptions.value = [...loadedOptions.value, ...newItems];
|
|
136
|
+
lastAppendedPage.value = currentPageNum;
|
|
137
|
+
}
|
|
138
|
+
hasMorePages.value = currentData.length >= currentSize;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
syncLoadedOptions();
|
|
142
|
+
watch(
|
|
143
|
+
() => dpPageData.value,
|
|
144
|
+
() => {
|
|
145
|
+
syncLoadedOptions();
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
watch(
|
|
149
|
+
() => dpCurrentPage.value,
|
|
150
|
+
(newPage) => {
|
|
151
|
+
if (newPage === 1) {
|
|
152
|
+
syncLoadedOptions();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
);
|
|
86
156
|
watch(() => props.isOptionsOpen, (newVal) => {
|
|
87
157
|
if (newVal !== void 0 && newVal !== isOptionsOpen.value) {
|
|
88
158
|
isOptionsOpen.value = newVal;
|
|
@@ -143,22 +213,225 @@ export function useKComboboxLogic(props, emit) {
|
|
|
143
213
|
function closeDropdown() {
|
|
144
214
|
isOptionsOpen.value = false;
|
|
145
215
|
searchtext.value = "";
|
|
216
|
+
highlightedIndex.value = -1;
|
|
217
|
+
}
|
|
218
|
+
function setHighlightedIndex(index) {
|
|
219
|
+
highlightedIndex.value = index;
|
|
220
|
+
}
|
|
221
|
+
function onKeyDown(e) {
|
|
222
|
+
if (props.disabled) return;
|
|
223
|
+
const total = filteredOptions.value.length;
|
|
224
|
+
switch (e.key) {
|
|
225
|
+
case "ArrowDown": {
|
|
226
|
+
e.preventDefault();
|
|
227
|
+
if (!isOptionsOpen.value) {
|
|
228
|
+
isOptionsOpen.value = true;
|
|
229
|
+
const selectedIdx = filteredOptions.value.findIndex((opt) => isSelected(opt));
|
|
230
|
+
highlightedIndex.value = selectedIdx >= 0 ? selectedIdx : 0;
|
|
231
|
+
} else if (total > 0) {
|
|
232
|
+
highlightedIndex.value = highlightedIndex.value < total - 1 ? highlightedIndex.value + 1 : 0;
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
case "ArrowUp": {
|
|
237
|
+
e.preventDefault();
|
|
238
|
+
if (!isOptionsOpen.value) {
|
|
239
|
+
isOptionsOpen.value = true;
|
|
240
|
+
highlightedIndex.value = total > 0 ? total - 1 : 0;
|
|
241
|
+
} else if (total > 0) {
|
|
242
|
+
highlightedIndex.value = highlightedIndex.value > 0 ? highlightedIndex.value - 1 : total - 1;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
case "Home": {
|
|
247
|
+
if (isOptionsOpen.value && total > 0) {
|
|
248
|
+
e.preventDefault();
|
|
249
|
+
highlightedIndex.value = 0;
|
|
250
|
+
}
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
case "End": {
|
|
254
|
+
if (isOptionsOpen.value && total > 0) {
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
highlightedIndex.value = total - 1;
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case "Enter": {
|
|
261
|
+
if (isOptionsOpen.value) {
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
if (highlightedIndex.value >= 0 && highlightedIndex.value < total) {
|
|
264
|
+
selectItem(filteredOptions.value[highlightedIndex.value]);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
isOptionsOpen.value = true;
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
case "Escape": {
|
|
273
|
+
if (isOptionsOpen.value) {
|
|
274
|
+
e.preventDefault();
|
|
275
|
+
closeDropdown();
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
case "Tab": {
|
|
280
|
+
if (isOptionsOpen.value) {
|
|
281
|
+
closeDropdown();
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
default: {
|
|
286
|
+
if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
287
|
+
const target = e.target;
|
|
288
|
+
if (props.searchbox) {
|
|
289
|
+
if (!isOptionsOpen.value) {
|
|
290
|
+
isOptionsOpen.value = true;
|
|
291
|
+
}
|
|
292
|
+
if (target && target.tagName !== "INPUT") {
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
searchtext.value = e.key;
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
const char = e.key.toLowerCase();
|
|
298
|
+
const matchIdx = filteredOptions.value.findIndex((opt) => {
|
|
299
|
+
const label = String(opt[props.labelField] || "").toLowerCase();
|
|
300
|
+
return label.startsWith(char);
|
|
301
|
+
});
|
|
302
|
+
if (matchIdx >= 0) {
|
|
303
|
+
highlightedIndex.value = matchIdx;
|
|
304
|
+
if (!isOptionsOpen.value) {
|
|
305
|
+
isOptionsOpen.value = true;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
146
313
|
}
|
|
314
|
+
watch(isOptionsOpen, (open) => {
|
|
315
|
+
emit("update:isOptionsOpen", open);
|
|
316
|
+
if (!open) {
|
|
317
|
+
highlightedIndex.value = -1;
|
|
318
|
+
} else if (filteredOptions.value.length > 0 && highlightedIndex.value === -1) {
|
|
319
|
+
const selectedIdx = filteredOptions.value.findIndex((opt) => isSelected(opt));
|
|
320
|
+
highlightedIndex.value = selectedIdx >= 0 ? selectedIdx : 0;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
watch(() => filteredOptions.value.length, (newLen) => {
|
|
324
|
+
if (highlightedIndex.value >= newLen) {
|
|
325
|
+
highlightedIndex.value = newLen - 1;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
147
328
|
watch(
|
|
148
329
|
() => searchtext.value,
|
|
149
330
|
(newText) => {
|
|
150
|
-
if (!props.dataProvider
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
331
|
+
if (!props.dataProvider) return;
|
|
332
|
+
const trimmed = newText.trim().toLowerCase();
|
|
333
|
+
const rawCurrentFilter = isRef(props.dataProvider.filter) ? props.dataProvider.filter.value : props.dataProvider.filter ?? null;
|
|
334
|
+
let nextFilter = null;
|
|
335
|
+
const isComboboxFilter = (f) => {
|
|
336
|
+
if (!f || typeof f !== "object") return false;
|
|
337
|
+
if (f.__source === "kcombobox") return true;
|
|
338
|
+
if (f.field && typeof f.field === "object" && !Array.isArray(f.field) && props.labelField in f.field) {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
return false;
|
|
155
342
|
};
|
|
156
|
-
|
|
343
|
+
if (rawCurrentFilter && typeof rawCurrentFilter === "object") {
|
|
344
|
+
const currentFilterCopy = JSON.parse(JSON.stringify(rawCurrentFilter));
|
|
345
|
+
if (currentFilterCopy.field && typeof currentFilterCopy.field === "object" && !Array.isArray(currentFilterCopy.field)) {
|
|
346
|
+
const currentFields = currentFilterCopy.field;
|
|
347
|
+
const updatedFields = { ...currentFields };
|
|
348
|
+
if (trimmed !== "") {
|
|
349
|
+
updatedFields[props.labelField] = trimmed;
|
|
350
|
+
nextFilter = {
|
|
351
|
+
...currentFilterCopy,
|
|
352
|
+
operator: currentFilterCopy.operator || EDataFilterOperator.In,
|
|
353
|
+
field: updatedFields,
|
|
354
|
+
active: true
|
|
355
|
+
};
|
|
356
|
+
} else {
|
|
357
|
+
delete updatedFields[props.labelField];
|
|
358
|
+
const hasRemaining = Object.keys(updatedFields).length > 0;
|
|
359
|
+
nextFilter = hasRemaining ? {
|
|
360
|
+
...currentFilterCopy,
|
|
361
|
+
field: updatedFields,
|
|
362
|
+
active: currentFilterCopy.active,
|
|
363
|
+
operator: currentFilterCopy.operator || EDataFilterOperator.In
|
|
364
|
+
} : null;
|
|
365
|
+
}
|
|
366
|
+
} else if (Array.isArray(currentFilterCopy.field)) {
|
|
367
|
+
const otherSubFilters = currentFilterCopy.field.filter((f) => !isComboboxFilter(f));
|
|
368
|
+
if (trimmed !== "") {
|
|
369
|
+
const comboSub = {
|
|
370
|
+
operator: EDataFilterOperator.In,
|
|
371
|
+
field: { [props.labelField]: trimmed },
|
|
372
|
+
active: true,
|
|
373
|
+
__source: "kcombobox"
|
|
374
|
+
};
|
|
375
|
+
nextFilter = {
|
|
376
|
+
...currentFilterCopy,
|
|
377
|
+
field: [...otherSubFilters, comboSub],
|
|
378
|
+
active: true,
|
|
379
|
+
operator: currentFilterCopy.operator || EDataFilterOperator.In
|
|
380
|
+
};
|
|
381
|
+
} else {
|
|
382
|
+
if (otherSubFilters.length === 0) {
|
|
383
|
+
nextFilter = null;
|
|
384
|
+
} else if (otherSubFilters.length === 1) {
|
|
385
|
+
nextFilter = otherSubFilters[0];
|
|
386
|
+
} else {
|
|
387
|
+
nextFilter = {
|
|
388
|
+
...currentFilterCopy,
|
|
389
|
+
field: otherSubFilters,
|
|
390
|
+
active: currentFilterCopy.active,
|
|
391
|
+
operator: currentFilterCopy.operator || EDataFilterOperator.In
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
} else if (trimmed !== "") {
|
|
397
|
+
nextFilter = {
|
|
398
|
+
operator: EDataFilterOperator.In,
|
|
399
|
+
field: { [props.labelField]: trimmed },
|
|
400
|
+
active: true
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
if (typeof props.dataProvider.setFilter === "function") {
|
|
404
|
+
props.dataProvider.setFilter(nextFilter);
|
|
405
|
+
} else if (isRef(props.dataProvider.filter)) {
|
|
406
|
+
props.dataProvider.filter.value = nextFilter;
|
|
407
|
+
} else {
|
|
408
|
+
props.dataProvider.filter = nextFilter;
|
|
409
|
+
}
|
|
157
410
|
}
|
|
158
411
|
);
|
|
159
|
-
const
|
|
160
|
-
|
|
412
|
+
const canLoadMore = computed(() => {
|
|
413
|
+
if (dpLoading.value) return false;
|
|
414
|
+
const currentSize = dpPageSize.value ?? 10;
|
|
415
|
+
if (currentSize <= 0) return false;
|
|
416
|
+
const totalCount = dpRowCount.value ?? 0;
|
|
417
|
+
if (totalCount > 0) {
|
|
418
|
+
return loadedOptions.value.length < totalCount;
|
|
419
|
+
}
|
|
420
|
+
return hasMorePages.value && (dpPageData.value?.length || 0) >= currentSize;
|
|
421
|
+
});
|
|
422
|
+
const loadingMore = computed(() => {
|
|
423
|
+
return dpLoading.value && loadedOptions.value.length > 0;
|
|
424
|
+
});
|
|
425
|
+
const initialLoading = computed(() => {
|
|
426
|
+
return dpLoading.value && loadedOptions.value.length === 0;
|
|
161
427
|
});
|
|
428
|
+
function loadMore() {
|
|
429
|
+
if (!canLoadMore.value || dpLoading.value) return;
|
|
430
|
+
const nextPage = (dpCurrentPage.value ?? 1) + 1;
|
|
431
|
+
if (typeof dpSetCurrentPage === "function") {
|
|
432
|
+
dpSetCurrentPage(nextPage);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
162
435
|
function resolveSelectedFromValue() {
|
|
163
436
|
if (!props.modelValue) {
|
|
164
437
|
selectedItems.value = null;
|
|
@@ -169,7 +442,7 @@ export function useKComboboxLogic(props, emit) {
|
|
|
169
442
|
return;
|
|
170
443
|
}
|
|
171
444
|
const provider = props.dataProvider;
|
|
172
|
-
const data = unref(provider?.allData) || dpPageData.value || [];
|
|
445
|
+
const data = unref(provider?.allData) || loadedOptions.value || dpPageData.value || [];
|
|
173
446
|
if (data.length === 0) return;
|
|
174
447
|
const values = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
175
448
|
const matchedItems = data.filter((item) => values.includes(item[props.valueField]));
|
|
@@ -187,9 +460,9 @@ export function useKComboboxLogic(props, emit) {
|
|
|
187
460
|
}
|
|
188
461
|
);
|
|
189
462
|
watch(
|
|
190
|
-
() => unref(props.dataProvider?.allData)
|
|
191
|
-
(
|
|
192
|
-
if (
|
|
463
|
+
() => [unref(props.dataProvider?.allData), unref(props.dataProvider?.pageData), loadedOptions.value.length],
|
|
464
|
+
() => {
|
|
465
|
+
if (props.modelValue && (!selectedItems.value || selectedItems.value.length === 0 || !selectedItems.value[0]?.[props.labelField])) {
|
|
193
466
|
resolveSelectedFromValue();
|
|
194
467
|
}
|
|
195
468
|
}
|
|
@@ -197,6 +470,9 @@ export function useKComboboxLogic(props, emit) {
|
|
|
197
470
|
return {
|
|
198
471
|
selectedItems,
|
|
199
472
|
isOptionsOpen,
|
|
473
|
+
highlightedIndex,
|
|
474
|
+
onKeyDown,
|
|
475
|
+
setHighlightedIndex,
|
|
200
476
|
searchtext,
|
|
201
477
|
selectItem,
|
|
202
478
|
isSelected,
|
|
@@ -204,6 +480,13 @@ export function useKComboboxLogic(props, emit) {
|
|
|
204
480
|
toggleDropdown,
|
|
205
481
|
closeDropdown,
|
|
206
482
|
filteredOptions,
|
|
207
|
-
loading: dpLoading
|
|
483
|
+
loading: dpLoading,
|
|
484
|
+
loadingMore,
|
|
485
|
+
initialLoading,
|
|
486
|
+
canLoadMore,
|
|
487
|
+
loadMore,
|
|
488
|
+
virtualScroll: props.virtualScroll ?? true,
|
|
489
|
+
itemHeight: props.itemHeight ?? 40,
|
|
490
|
+
buffer: props.buffer ?? 5
|
|
208
491
|
};
|
|
209
492
|
}
|
|
@@ -191,18 +191,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
192
192
|
label: string;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
-
validationText: string;
|
|
195
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
196
194
|
searchbox: boolean;
|
|
197
195
|
labelField: string;
|
|
198
196
|
placeholder: string;
|
|
199
197
|
teleportTo: string;
|
|
198
|
+
validationText: string;
|
|
199
|
+
mask: string;
|
|
200
200
|
valueField: string;
|
|
201
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
202
|
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
202
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
204
205
|
selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
|
|
205
|
-
mask: string;
|
|
206
206
|
inputPlaceholder: string;
|
|
207
207
|
showClear: boolean;
|
|
208
208
|
inputConfigField: string;
|
|
@@ -191,18 +191,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
192
192
|
label: string;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
-
validationText: string;
|
|
195
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
196
194
|
searchbox: boolean;
|
|
197
195
|
labelField: string;
|
|
198
196
|
placeholder: string;
|
|
199
197
|
teleportTo: string;
|
|
198
|
+
validationText: string;
|
|
199
|
+
mask: string;
|
|
200
200
|
valueField: string;
|
|
201
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
202
|
inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
|
|
202
203
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
204
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
204
205
|
selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
|
|
205
|
-
mask: string;
|
|
206
206
|
inputPlaceholder: string;
|
|
207
207
|
showClear: boolean;
|
|
208
208
|
inputConfigField: string;
|
|
@@ -164,7 +164,7 @@ export declare function useKCompositeInputLogic(props: KCompositeInputProps, emi
|
|
|
164
164
|
selectionProps: import("vue").ComputedRef<{
|
|
165
165
|
modelValue: any;
|
|
166
166
|
'onUpdate:modelValue': (val: any) => any;
|
|
167
|
-
dataProvider: ADataProvider
|
|
167
|
+
dataProvider: ADataProvider<import("@katlux/providers").TDataRow>;
|
|
168
168
|
labelField: string | undefined;
|
|
169
169
|
valueField: string | undefined;
|
|
170
170
|
placeholder: string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
1
2
|
import { ADataProvider } from '@katlux/providers';
|
|
2
3
|
export interface KDataIteratorProps {
|
|
3
4
|
dataProvider: ADataProvider;
|
|
@@ -15,9 +16,9 @@ export declare const KDataIteratorDefaultProps: {
|
|
|
15
16
|
page: number;
|
|
16
17
|
};
|
|
17
18
|
export declare function useKDataIteratorLogic(props: KDataIteratorProps): {
|
|
18
|
-
selectedRows:
|
|
19
|
-
selectAll:
|
|
20
|
-
pageData:
|
|
21
|
-
loading:
|
|
22
|
-
initialLoad:
|
|
19
|
+
selectedRows: Ref<any[], any[]>;
|
|
20
|
+
selectAll: Ref<boolean, boolean>;
|
|
21
|
+
pageData: Ref<import("@katlux/providers").TDataRow[], import("@katlux/providers").TDataRow[]>;
|
|
22
|
+
loading: Ref<boolean, boolean>;
|
|
23
|
+
initialLoad: Ref<boolean, boolean>;
|
|
23
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watch } from "vue";
|
|
1
|
+
import { watch, computed, isRef } from "vue";
|
|
2
2
|
import { useDataProvider } from "../../composables/useDataProvider.js";
|
|
3
3
|
export const KDataIteratorDefaultProps = {
|
|
4
4
|
visibleFields: null,
|
|
@@ -9,23 +9,50 @@ export const KDataIteratorDefaultProps = {
|
|
|
9
9
|
};
|
|
10
10
|
export function useKDataIteratorLogic(props) {
|
|
11
11
|
const { pageData, selectedRows: dpSelectedRows, selectAll: dpSelectAll, loading: dpLoading, initialLoad: dpInitialLoad } = useDataProvider(props.dataProvider);
|
|
12
|
-
const selectedRows = props.dataProvider?.selectedRows
|
|
13
|
-
const selectAll = props.dataProvider?.selectAll
|
|
12
|
+
const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : dpSelectedRows;
|
|
13
|
+
const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : dpSelectAll;
|
|
14
14
|
const idKey = props.dataProvider?.idKey || "id";
|
|
15
15
|
const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
|
|
16
16
|
let isInternalUpdating = false;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
props.dataProvider.selectedRows.value = selectedRows.value;
|
|
17
|
+
const pageRows = computed(() => {
|
|
18
|
+
if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
|
|
19
|
+
return props.dataProvider.pageData.value || [];
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return pageData.value || [];
|
|
22
|
+
});
|
|
23
|
+
const syncToProvider = () => {
|
|
24
|
+
if (props.dataProvider) {
|
|
25
|
+
isInternalUpdating = true;
|
|
26
|
+
const update = () => {
|
|
27
|
+
if (typeof props.dataProvider.setSelectAll === "function") {
|
|
28
|
+
props.dataProvider.setSelectAll(selectAll.value);
|
|
29
|
+
} else if (isRef(props.dataProvider.selectAll)) {
|
|
30
|
+
props.dataProvider.selectAll.value = selectAll.value;
|
|
31
|
+
} else {
|
|
32
|
+
props.dataProvider.selectAll = selectAll.value;
|
|
33
|
+
}
|
|
34
|
+
if (typeof props.dataProvider.setSelectedRows === "function") {
|
|
35
|
+
props.dataProvider.setSelectedRows(selectedRows.value);
|
|
36
|
+
} else if (isRef(props.dataProvider.selectedRows)) {
|
|
37
|
+
props.dataProvider.selectedRows.value = selectedRows.value;
|
|
38
|
+
} else {
|
|
39
|
+
props.dataProvider.selectedRows = selectedRows.value;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
if (typeof props.dataProvider.batchUpdates === "function") {
|
|
44
|
+
props.dataProvider.batchUpdates(update);
|
|
45
|
+
} else {
|
|
46
|
+
update();
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
isInternalUpdating = false;
|
|
50
|
+
}
|
|
24
51
|
}
|
|
25
52
|
};
|
|
26
53
|
watch(() => selectAll.value, (newVal) => {
|
|
27
54
|
if (isInternalUpdating) return;
|
|
28
|
-
const currentRows =
|
|
55
|
+
const currentRows = pageRows.value;
|
|
29
56
|
if (newVal === false) {
|
|
30
57
|
const pageIds = new Set(currentRows.map(getRowId));
|
|
31
58
|
selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
|
|
@@ -36,8 +63,8 @@ export function useKDataIteratorLogic(props) {
|
|
|
36
63
|
}
|
|
37
64
|
syncToProvider();
|
|
38
65
|
});
|
|
39
|
-
watch([
|
|
40
|
-
const currentRows =
|
|
66
|
+
watch([pageRows, () => selectedRows.value], () => {
|
|
67
|
+
const currentRows = pageRows.value;
|
|
41
68
|
if (currentRows.length === 0) {
|
|
42
69
|
if (selectAll.value) {
|
|
43
70
|
isInternalUpdating = true;
|
|
@@ -55,26 +82,28 @@ export function useKDataIteratorLogic(props) {
|
|
|
55
82
|
isInternalUpdating = false;
|
|
56
83
|
}
|
|
57
84
|
syncToProvider();
|
|
58
|
-
}
|
|
85
|
+
});
|
|
59
86
|
watch(() => props.search, (newVal) => {
|
|
60
87
|
if (newVal !== void 0) {
|
|
61
88
|
}
|
|
62
89
|
});
|
|
63
90
|
watch(() => props.itemsPerPage, (newVal) => {
|
|
64
|
-
|
|
91
|
+
const currentSize = props.dataProvider?.pageSize?.value ?? props.dataProvider?.pageSize;
|
|
92
|
+
if (newVal !== void 0 && newVal !== currentSize) {
|
|
65
93
|
if (typeof props.dataProvider?.setPageSize === "function") {
|
|
66
94
|
props.dataProvider.setPageSize(newVal);
|
|
67
|
-
} else if (props.dataProvider
|
|
68
|
-
props.dataProvider.pageSize
|
|
95
|
+
} else if (props.dataProvider) {
|
|
96
|
+
props.dataProvider.pageSize = newVal;
|
|
69
97
|
}
|
|
70
98
|
}
|
|
71
99
|
});
|
|
72
100
|
watch(() => props.page, (newVal) => {
|
|
73
|
-
|
|
101
|
+
const currentPage = props.dataProvider?.currentPage?.value ?? props.dataProvider?.currentPage;
|
|
102
|
+
if (newVal !== void 0 && newVal !== currentPage) {
|
|
74
103
|
if (typeof props.dataProvider?.setCurrentPage === "function") {
|
|
75
104
|
props.dataProvider.setCurrentPage(newVal);
|
|
76
|
-
} else if (props.dataProvider
|
|
77
|
-
props.dataProvider.currentPage
|
|
105
|
+
} else if (props.dataProvider) {
|
|
106
|
+
props.dataProvider.currentPage = newVal;
|
|
78
107
|
}
|
|
79
108
|
}
|
|
80
109
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
1
2
|
import { ADataProvider } from '@katlux/providers';
|
|
2
3
|
export interface KDatatableProps {
|
|
3
4
|
dataProvider: ADataProvider;
|
|
@@ -11,8 +12,8 @@ export declare const KDatatableDefaultProps: {
|
|
|
11
12
|
emptyFilterStateText: string;
|
|
12
13
|
};
|
|
13
14
|
export declare function useKDatatableLogic(props: KDatatableProps): {
|
|
14
|
-
selectedRows:
|
|
15
|
-
selectAll:
|
|
15
|
+
selectedRows: Ref<any[], any[]>;
|
|
16
|
+
selectAll: Ref<boolean, boolean>;
|
|
16
17
|
getRowKey: (row: any, index: number) => string | number;
|
|
17
|
-
pageData: import("vue").
|
|
18
|
+
pageData: import("vue").ComputedRef<any[]>;
|
|
18
19
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watch } from "vue";
|
|
1
|
+
import { computed, watch, isRef } from "vue";
|
|
2
2
|
import { useDataProvider } from "../../composables/useDataProvider.js";
|
|
3
3
|
export const KDatatableDefaultProps = {
|
|
4
4
|
visibleFields: null,
|
|
@@ -6,13 +6,18 @@ export const KDatatableDefaultProps = {
|
|
|
6
6
|
emptyFilterStateText: "no result found for filter"
|
|
7
7
|
};
|
|
8
8
|
export function useKDatatableLogic(props) {
|
|
9
|
-
const { pageData, selectedRows: dpSelectedRows, selectAll: dpSelectAll } = useDataProvider(props.dataProvider);
|
|
10
|
-
const selectedRows = props.dataProvider?.selectedRows
|
|
11
|
-
const selectAll = props.dataProvider?.selectAll
|
|
9
|
+
const { pageData, selectedRows: dpSelectedRows, selectAll: dpSelectAll, loading: dpLoading, initialLoad: dpInitialLoad } = useDataProvider(props.dataProvider);
|
|
10
|
+
const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : dpSelectedRows;
|
|
11
|
+
const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : dpSelectAll;
|
|
12
12
|
const idKey = props.dataProvider?.idKey || "id";
|
|
13
13
|
const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
|
|
14
14
|
let isInternalUpdating = false;
|
|
15
|
-
const
|
|
15
|
+
const pageRows = computed(() => {
|
|
16
|
+
if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
|
|
17
|
+
return props.dataProvider.pageData.value || [];
|
|
18
|
+
}
|
|
19
|
+
return pageData.value || [];
|
|
20
|
+
});
|
|
16
21
|
const getRowKey = (row, index) => {
|
|
17
22
|
if (row && row[idKey] !== void 0 && row[idKey] !== null) {
|
|
18
23
|
return row[idKey];
|
|
@@ -26,16 +31,38 @@ export function useKDatatableLogic(props) {
|
|
|
26
31
|
return index;
|
|
27
32
|
};
|
|
28
33
|
const syncToProvider = () => {
|
|
29
|
-
if (props.dataProvider
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
if (props.dataProvider) {
|
|
35
|
+
isInternalUpdating = true;
|
|
36
|
+
const update = () => {
|
|
37
|
+
if (typeof props.dataProvider.setSelectAll === "function") {
|
|
38
|
+
props.dataProvider.setSelectAll(selectAll.value);
|
|
39
|
+
} else if (isRef(props.dataProvider.selectAll)) {
|
|
40
|
+
props.dataProvider.selectAll.value = selectAll.value;
|
|
41
|
+
} else {
|
|
42
|
+
props.dataProvider.selectAll = selectAll.value;
|
|
43
|
+
}
|
|
44
|
+
if (typeof props.dataProvider.setSelectedRows === "function") {
|
|
45
|
+
props.dataProvider.setSelectedRows(selectedRows.value);
|
|
46
|
+
} else if (isRef(props.dataProvider.selectedRows)) {
|
|
47
|
+
props.dataProvider.selectedRows.value = selectedRows.value;
|
|
48
|
+
} else {
|
|
49
|
+
props.dataProvider.selectedRows = selectedRows.value;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
if (typeof props.dataProvider.batchUpdates === "function") {
|
|
54
|
+
props.dataProvider.batchUpdates(update);
|
|
55
|
+
} else {
|
|
56
|
+
update();
|
|
57
|
+
}
|
|
58
|
+
} finally {
|
|
59
|
+
isInternalUpdating = false;
|
|
60
|
+
}
|
|
34
61
|
}
|
|
35
62
|
};
|
|
36
63
|
watch(() => selectAll.value, (newVal) => {
|
|
37
64
|
if (isInternalUpdating) return;
|
|
38
|
-
const currentRows =
|
|
65
|
+
const currentRows = pageRows.value;
|
|
39
66
|
if (newVal === false) {
|
|
40
67
|
const pageIds = new Set(currentRows.map(getRowId));
|
|
41
68
|
selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
|
|
@@ -46,8 +73,8 @@ export function useKDatatableLogic(props) {
|
|
|
46
73
|
}
|
|
47
74
|
syncToProvider();
|
|
48
75
|
});
|
|
49
|
-
watch([
|
|
50
|
-
const currentRows =
|
|
76
|
+
watch([pageRows, () => selectedRows.value], () => {
|
|
77
|
+
const currentRows = pageRows.value;
|
|
51
78
|
if (currentRows.length === 0) {
|
|
52
79
|
if (selectAll.value) {
|
|
53
80
|
isInternalUpdating = true;
|
|
@@ -65,14 +92,11 @@ export function useKDatatableLogic(props) {
|
|
|
65
92
|
isInternalUpdating = false;
|
|
66
93
|
}
|
|
67
94
|
syncToProvider();
|
|
68
|
-
}, { immediate: true });
|
|
69
|
-
watch(() => selectedRows.value, () => {
|
|
70
|
-
syncToProvider();
|
|
71
|
-
}, { deep: true });
|
|
95
|
+
}, { immediate: true, deep: true });
|
|
72
96
|
return {
|
|
73
97
|
selectedRows,
|
|
74
98
|
selectAll,
|
|
75
99
|
getRowKey,
|
|
76
|
-
pageData
|
|
100
|
+
pageData: pageRows
|
|
77
101
|
};
|
|
78
102
|
}
|