@katlux/toolkit 0.1.1-alpha.111 → 0.1.1-alpha.113

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.
Files changed (149) hide show
  1. package/dist/compiled/composables/locales.mjs +195 -27
  2. package/dist/compiled/composables/useDataProvider.mjs +121 -90
  3. package/dist/compiled/composables/useDataProvider.spec.mjs +20 -1
  4. package/dist/compiled/composables/useKatluxContext.mjs +21 -0
  5. package/dist/compiled/composables/useKatluxContext.spec.mjs +63 -0
  6. package/dist/compiled/composables/useKatluxI18n.mjs +20 -9
  7. package/dist/compiled/composables/usePresetComponent.mjs +12 -3
  8. package/dist/compiled/utils/PresetResolver.mjs +21 -7
  9. package/dist/compiled/utils/TemplateResolver.mjs +11 -5
  10. package/dist/module.cjs +3 -31
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +4 -32
  13. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +1 -1
  14. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  15. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  16. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
  17. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
  18. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +4 -4
  19. package/dist/runtime/components/KCombobox/KCombobox.global.vue +6 -0
  20. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +4 -4
  21. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +3 -0
  22. package/dist/runtime/components/KCombobox/KCombobox.logic.js +192 -14
  23. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +11 -11
  24. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +11 -11
  25. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +1 -1
  26. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +1 -1
  27. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +1 -1
  28. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
  29. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
  30. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +23 -16
  31. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +1 -1
  32. package/dist/runtime/components/KDatatable/KDatatable.logic.js +36 -27
  33. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +9 -9
  34. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +2 -2
  35. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +9 -9
  36. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +4 -4
  37. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +2 -2
  38. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +8 -8
  39. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +2 -2
  40. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +8 -8
  41. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +4 -4
  42. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -2
  43. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
  44. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
  45. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  46. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  47. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
  48. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
  49. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
  50. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
  51. package/dist/runtime/components/KModal/KModal.global.d.vue.ts +15 -2
  52. package/dist/runtime/components/KModal/KModal.global.vue +6 -1
  53. package/dist/runtime/components/KModal/KModal.global.vue.d.ts +15 -2
  54. package/dist/runtime/components/KModal/KModal.logic.d.ts +8 -2
  55. package/dist/runtime/components/KModal/KModal.logic.js +21 -3
  56. package/dist/runtime/components/KPagination/KPagination.global.vue +2 -0
  57. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
  58. package/dist/runtime/components/KPagination/KPagination.logic.js +1 -0
  59. package/dist/runtime/components/KTabs/KTabItem.logic.js +20 -5
  60. package/dist/runtime/components/KTabs/KTabs.logic.js +18 -2
  61. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  62. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  63. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
  64. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
  65. package/dist/runtime/components/KToast/KToast.global.d.vue.ts +1 -1
  66. package/dist/runtime/components/KToast/KToast.global.vue.d.ts +1 -1
  67. package/dist/runtime/components/KToast/KToast.logic.d.ts +1 -0
  68. package/dist/runtime/components/KToast/KToast.logic.js +19 -5
  69. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +12 -3
  70. package/dist/runtime/components/KTree/KTree.global.vue +1 -0
  71. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +12 -3
  72. package/dist/runtime/components/KTree/KTree.logic.d.ts +9 -4
  73. package/dist/runtime/components/KTree/KTree.logic.js +9 -6
  74. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +6 -6
  75. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +6 -6
  76. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -0
  77. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +31 -7
  78. package/dist/runtime/components/KTreeView/KTreeView.global.vue +15 -1
  79. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +31 -7
  80. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +18 -4
  81. package/dist/runtime/components/KTreeView/KTreeView.logic.js +26 -7
  82. package/dist/runtime/composables/locales.js +195 -27
  83. package/dist/runtime/composables/useDataProvider.d.ts +1 -1
  84. package/dist/runtime/composables/useDataProvider.js +121 -90
  85. package/dist/runtime/composables/useDebounce.d.ts +1 -1
  86. package/dist/runtime/composables/useKatluxContext.d.ts +13 -0
  87. package/dist/runtime/composables/useKatluxContext.js +21 -0
  88. package/dist/runtime/composables/useKatluxI18n.js +20 -9
  89. package/dist/runtime/composables/usePresetComponent.js +12 -3
  90. package/dist/runtime/directives/clickOutside.d.ts +3 -2
  91. package/dist/runtime/directives/clickOutside.js +9 -2
  92. package/dist/runtime/hydration/NuxtHydrationAdapter.d.ts +10 -0
  93. package/dist/runtime/hydration/NuxtHydrationAdapter.js +88 -0
  94. package/dist/runtime/plugins/PresetPlugin.js +9 -1
  95. package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -3
  96. package/dist/runtime/plugins/nuxtCompatPlugin.js +6 -1
  97. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +1 -1
  98. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +1 -1
  99. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +1 -1
  100. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +1 -1
  101. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
  102. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +1 -1
  103. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +1 -1
  104. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +1 -1
  105. package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +1 -1
  106. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +24 -2
  107. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
  108. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +19 -6
  109. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
  110. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +4 -1
  111. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +36 -8
  112. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +4 -1
  113. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +1 -1
  114. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +1 -1
  115. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +1 -1
  116. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +1 -0
  117. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +3 -3
  118. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +4 -4
  119. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +3 -3
  120. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +3 -3
  121. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +4 -4
  122. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +3 -3
  123. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +1 -20
  124. package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +2 -2
  125. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +6 -2
  126. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -1
  127. package/dist/runtime/presets/default/components/KModal/KModal.vue +16 -4
  128. package/dist/runtime/presets/default/components/KPagination/KPagination.d.vue.ts +1 -0
  129. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +5 -4
  130. package/dist/runtime/presets/default/components/KPagination/KPagination.vue.d.ts +1 -0
  131. package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +3 -1
  132. package/dist/runtime/presets/default/components/KSlider/KSlider.vue +2 -1
  133. package/dist/runtime/presets/default/components/KTabs/KTabs.vue +2 -1
  134. package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +1 -1
  135. package/dist/runtime/presets/default/components/KToast/KToast.vue +1 -1
  136. package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +1 -1
  137. package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue +2 -0
  138. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +20 -10
  139. package/dist/runtime/presets/default/components/KTree/KTree.vue +34 -24
  140. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +20 -10
  141. package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +2 -1
  142. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +8 -2
  143. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +10 -1
  144. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +8 -2
  145. package/dist/runtime/server/middleware/session.d.ts +2 -0
  146. package/dist/runtime/server/middleware/session.js +36 -0
  147. package/dist/runtime/utils/PresetResolver.js +21 -7
  148. package/dist/runtime/utils/TemplateResolver.js +11 -5
  149. 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: {
@@ -101,8 +101,10 @@ export function useKComboboxLogic(props, emit) {
101
101
  } = useDataProvider(props.dataProvider);
102
102
  const selectedItems = ref(null);
103
103
  const isOptionsOpen = ref(false);
104
+ const highlightedIndex = ref(-1);
104
105
  const searchtext = ref("");
105
106
  const loadedOptions = ref([]);
107
+ const filteredOptions = computed(() => loadedOptions.value);
106
108
  const lastAppendedPage = ref(1);
107
109
  const hasMorePages = ref(true);
108
110
  function getItemKey(item, index) {
@@ -141,8 +143,7 @@ export function useKComboboxLogic(props, emit) {
141
143
  () => dpPageData.value,
142
144
  () => {
143
145
  syncLoadedOptions();
144
- },
145
- { deep: true }
146
+ }
146
147
  );
147
148
  watch(
148
149
  () => dpCurrentPage.value,
@@ -212,22 +213,199 @@ export function useKComboboxLogic(props, emit) {
212
213
  function closeDropdown() {
213
214
  isOptionsOpen.value = false;
214
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
+ }
215
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
+ });
216
328
  watch(
217
329
  () => searchtext.value,
218
330
  (newText) => {
219
331
  if (!props.dataProvider) return;
220
- const filter = {
221
- operator: EDataFilterOperator.In,
222
- field: { [props.labelField]: newText.trim().toLowerCase() },
223
- active: newText.trim().toLowerCase() !== ""
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;
224
342
  };
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
+ }
225
403
  if (typeof props.dataProvider.setFilter === "function") {
226
- props.dataProvider.setFilter(filter);
227
- } else if (props.dataProvider.filter && typeof props.dataProvider.filter === "object" && "value" in props.dataProvider.filter) {
228
- props.dataProvider.filter.value = filter;
404
+ props.dataProvider.setFilter(nextFilter);
405
+ } else if (isRef(props.dataProvider.filter)) {
406
+ props.dataProvider.filter.value = nextFilter;
229
407
  } else {
230
- props.dataProvider.filter = filter;
408
+ props.dataProvider.filter = nextFilter;
231
409
  }
232
410
  }
233
411
  );
@@ -254,9 +432,6 @@ export function useKComboboxLogic(props, emit) {
254
432
  dpSetCurrentPage(nextPage);
255
433
  }
256
434
  }
257
- const filteredOptions = computed(() => {
258
- return loadedOptions.value;
259
- });
260
435
  function resolveSelectedFromValue() {
261
436
  if (!props.modelValue) {
262
437
  selectedItems.value = null;
@@ -295,6 +470,9 @@ export function useKComboboxLogic(props, emit) {
295
470
  return {
296
471
  selectedItems,
297
472
  isOptionsOpen,
473
+ highlightedIndex,
474
+ onKeyDown,
475
+ setHighlightedIndex,
298
476
  searchtext,
299
477
  selectItem,
300
478
  isSelected,
@@ -90,9 +90,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
90
90
  default: boolean;
91
91
  };
92
92
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
93
+ "update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
93
94
  "update:selectionValue": (value: any) => any;
94
95
  "update:inputValue": (value: any) => any;
95
- "update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
96
96
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
97
97
  label: {
98
98
  type: StringConstructor;
@@ -184,27 +184,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
184
184
  default: boolean;
185
185
  };
186
186
  }>> & Readonly<{
187
+ "onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
187
188
  "onUpdate:selectionValue"?: ((value: any) => any) | undefined;
188
189
  "onUpdate:inputValue"?: ((value: any) => any) | undefined;
189
- "onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
190
190
  }>, {
191
191
  type: import("./KCompositeInput.logic.js").CompositeInputType;
192
192
  label: string;
193
- inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
194
193
  validation: "error" | "success" | "warning" | null | undefined;
195
- selectionValue: string | number | Record<string, any> | unknown[];
196
- inputValue: string | number | Record<string, any> | unknown[];
194
+ validationText: string;
197
195
  modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
198
- selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
199
- mask: string;
196
+ searchbox: boolean;
200
197
  labelField: string;
201
- valueField: string;
202
198
  placeholder: string;
199
+ teleportTo: string;
200
+ mask: string;
201
+ valueField: string;
202
+ inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
203
+ selectionValue: string | number | Record<string, any> | unknown[];
204
+ inputValue: string | number | Record<string, any> | unknown[];
205
+ selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
203
206
  inputPlaceholder: string;
204
- searchbox: boolean;
205
207
  showClear: boolean;
206
- teleportTo: string;
207
- validationText: string;
208
208
  inputConfigField: string;
209
209
  validateAll: boolean;
210
210
  inputFormat: string;
@@ -90,9 +90,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
90
90
  default: boolean;
91
91
  };
92
92
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
93
+ "update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
93
94
  "update:selectionValue": (value: any) => any;
94
95
  "update:inputValue": (value: any) => any;
95
- "update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
96
96
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
97
97
  label: {
98
98
  type: StringConstructor;
@@ -184,27 +184,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
184
184
  default: boolean;
185
185
  };
186
186
  }>> & Readonly<{
187
+ "onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
187
188
  "onUpdate:selectionValue"?: ((value: any) => any) | undefined;
188
189
  "onUpdate:inputValue"?: ((value: any) => any) | undefined;
189
- "onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
190
190
  }>, {
191
191
  type: import("./KCompositeInput.logic.js").CompositeInputType;
192
192
  label: string;
193
- inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
194
193
  validation: "error" | "success" | "warning" | null | undefined;
195
- selectionValue: string | number | Record<string, any> | unknown[];
196
- inputValue: string | number | Record<string, any> | unknown[];
194
+ validationText: string;
197
195
  modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
198
- selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
199
- mask: string;
196
+ searchbox: boolean;
200
197
  labelField: string;
201
- valueField: string;
202
198
  placeholder: string;
199
+ teleportTo: string;
200
+ mask: string;
201
+ valueField: string;
202
+ inputType: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
203
+ selectionValue: string | number | Record<string, any> | unknown[];
204
+ inputValue: string | number | Record<string, any> | unknown[];
205
+ selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
203
206
  inputPlaceholder: string;
204
- searchbox: boolean;
205
207
  showClear: boolean;
206
- teleportTo: string;
207
- validationText: string;
208
208
  inputConfigField: string;
209
209
  validateAll: boolean;
210
210
  inputFormat: 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;
@@ -46,8 +46,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
46
46
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
47
47
  }>, {
48
48
  isOpen: boolean;
49
- x: number;
50
49
  teleportTo: string;
50
+ x: number;
51
51
  y: number;
52
52
  target: string | HTMLElement;
53
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -46,8 +46,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
46
46
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
47
47
  }>, {
48
48
  isOpen: boolean;
49
- x: number;
50
49
  teleportTo: string;
50
+ x: number;
51
51
  y: number;
52
52
  target: string | HTMLElement;
53
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -12,8 +12,8 @@ interface Props {
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
14
  search: string;
15
- loading: boolean;
16
15
  bulkActions: IKDatatableAction[];
16
+ loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
19
19
  itemsPerPage: number;
@@ -12,8 +12,8 @@ interface Props {
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
14
  search: string;
15
- loading: boolean;
16
15
  bulkActions: IKDatatableAction[];
16
+ loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
19
19
  itemsPerPage: number;
@@ -1,4 +1,4 @@
1
- import { watch, isRef } 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,
@@ -14,16 +14,23 @@ export function useKDataIteratorLogic(props) {
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 getPageRows = () => {
18
- const dpData = props.dataProvider?.pageData;
19
- if (isRef(dpData)) return dpData.value || [];
20
- if (Array.isArray(dpData)) return dpData;
17
+ const pageRows = computed(() => {
18
+ if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
19
+ return props.dataProvider.pageData.value || [];
20
+ }
21
21
  return pageData.value || [];
22
- };
22
+ });
23
23
  const syncToProvider = () => {
24
24
  if (props.dataProvider) {
25
25
  isInternalUpdating = true;
26
- try {
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
+ }
27
34
  if (typeof props.dataProvider.setSelectedRows === "function") {
28
35
  props.dataProvider.setSelectedRows(selectedRows.value);
29
36
  } else if (isRef(props.dataProvider.selectedRows)) {
@@ -31,12 +38,12 @@ export function useKDataIteratorLogic(props) {
31
38
  } else {
32
39
  props.dataProvider.selectedRows = selectedRows.value;
33
40
  }
34
- if (typeof props.dataProvider.setSelectAll === "function") {
35
- props.dataProvider.setSelectAll(selectAll.value);
36
- } else if (isRef(props.dataProvider.selectAll)) {
37
- props.dataProvider.selectAll.value = selectAll.value;
41
+ };
42
+ try {
43
+ if (typeof props.dataProvider.batchUpdates === "function") {
44
+ props.dataProvider.batchUpdates(update);
38
45
  } else {
39
- props.dataProvider.selectAll = selectAll.value;
46
+ update();
40
47
  }
41
48
  } finally {
42
49
  isInternalUpdating = false;
@@ -45,7 +52,7 @@ export function useKDataIteratorLogic(props) {
45
52
  };
46
53
  watch(() => selectAll.value, (newVal) => {
47
54
  if (isInternalUpdating) return;
48
- const currentRows = getPageRows();
55
+ const currentRows = pageRows.value;
49
56
  if (newVal === false) {
50
57
  const pageIds = new Set(currentRows.map(getRowId));
51
58
  selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
@@ -56,8 +63,8 @@ export function useKDataIteratorLogic(props) {
56
63
  }
57
64
  syncToProvider();
58
65
  });
59
- watch([getPageRows, () => selectedRows.value], () => {
60
- const currentRows = getPageRows();
66
+ watch([pageRows, () => selectedRows.value], () => {
67
+ const currentRows = pageRows.value;
61
68
  if (currentRows.length === 0) {
62
69
  if (selectAll.value) {
63
70
  isInternalUpdating = true;
@@ -75,7 +82,7 @@ export function useKDataIteratorLogic(props) {
75
82
  isInternalUpdating = false;
76
83
  }
77
84
  syncToProvider();
78
- }, { deep: true });
85
+ });
79
86
  watch(() => props.search, (newVal) => {
80
87
  if (newVal !== void 0) {
81
88
  }
@@ -15,5 +15,5 @@ export declare function useKDatatableLogic(props: KDatatableProps): {
15
15
  selectedRows: Ref<any[], any[]>;
16
16
  selectAll: Ref<boolean, boolean>;
17
17
  getRowKey: (row: any, index: number) => string | number;
18
- pageData: Ref<import("@katlux/providers").TDataRow[], import("@katlux/providers").TDataRow[]>;
18
+ pageData: import("vue").ComputedRef<any[]>;
19
19
  };
@@ -1,4 +1,4 @@
1
- import { watch, isRef } 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,
@@ -12,12 +12,12 @@ export function useKDatatableLogic(props) {
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 getPageRows = () => {
16
- const dpData = props.dataProvider?.pageData;
17
- if (isRef(dpData)) return dpData.value || [];
18
- if (Array.isArray(dpData)) return dpData;
15
+ const pageRows = computed(() => {
16
+ if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
17
+ return props.dataProvider.pageData.value || [];
18
+ }
19
19
  return pageData.value || [];
20
- };
20
+ });
21
21
  const getRowKey = (row, index) => {
22
22
  if (row && row[idKey] !== void 0 && row[idKey] !== null) {
23
23
  return row[idKey];
@@ -32,25 +32,37 @@ export function useKDatatableLogic(props) {
32
32
  };
33
33
  const syncToProvider = () => {
34
34
  if (props.dataProvider) {
35
- if (typeof props.dataProvider.setSelectedRows === "function") {
36
- props.dataProvider.setSelectedRows(selectedRows.value);
37
- } else if (isRef(props.dataProvider.selectedRows)) {
38
- props.dataProvider.selectedRows.value = selectedRows.value;
39
- } else {
40
- props.dataProvider.selectedRows = selectedRows.value;
41
- }
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;
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;
48
60
  }
49
61
  }
50
62
  };
51
63
  watch(() => selectAll.value, (newVal) => {
52
64
  if (isInternalUpdating) return;
53
- const currentRows = getPageRows();
65
+ const currentRows = pageRows.value;
54
66
  if (newVal === false) {
55
67
  const pageIds = new Set(currentRows.map(getRowId));
56
68
  selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
@@ -61,8 +73,8 @@ export function useKDatatableLogic(props) {
61
73
  }
62
74
  syncToProvider();
63
75
  });
64
- watch([getPageRows, () => selectedRows.value], () => {
65
- const currentRows = getPageRows();
76
+ watch([pageRows, () => selectedRows.value], () => {
77
+ const currentRows = pageRows.value;
66
78
  if (currentRows.length === 0) {
67
79
  if (selectAll.value) {
68
80
  isInternalUpdating = true;
@@ -80,14 +92,11 @@ export function useKDatatableLogic(props) {
80
92
  isInternalUpdating = false;
81
93
  }
82
94
  syncToProvider();
83
- }, { immediate: true });
84
- watch(() => selectedRows.value, () => {
85
- syncToProvider();
86
- }, { deep: true });
95
+ }, { immediate: true, deep: true });
87
96
  return {
88
97
  selectedRows,
89
98
  selectAll,
90
99
  getRowKey,
91
- pageData
100
+ pageData: pageRows
92
101
  };
93
102
  }
@@ -24,11 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
24
24
  type: BooleanConstructor;
25
25
  default: boolean;
26
26
  };
27
- calendarDefinedDays: {
27
+ definedDays: {
28
28
  type: import("vue").PropType<import("../KCalendar/types.js").IDefinedDay[]>;
29
29
  default: () => never[];
30
30
  };
31
- calendarMarkedDays: {
31
+ markedDays: {
32
32
  type: import("vue").PropType<import("../KCalendar/types.js").IMarkedDay[]>;
33
33
  default: () => never[];
34
34
  };
@@ -84,11 +84,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
84
84
  type: BooleanConstructor;
85
85
  default: boolean;
86
86
  };
87
- calendarDefinedDays: {
87
+ definedDays: {
88
88
  type: import("vue").PropType<import("../KCalendar/types.js").IDefinedDay[]>;
89
89
  default: () => never[];
90
90
  };
91
- calendarMarkedDays: {
91
+ markedDays: {
92
92
  type: import("vue").PropType<import("../KCalendar/types.js").IMarkedDay[]>;
93
93
  default: () => never[];
94
94
  };
@@ -122,17 +122,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
122
122
  }>, {
123
123
  isOpen: boolean;
124
124
  label: string;
125
+ definedDays: import("../KCalendar/types.js").IDefinedDay[];
126
+ markedDays: import("../KCalendar/types.js").IMarkedDay[];
125
127
  day: string | Date;
126
128
  validation: "error" | "success" | "warning" | null | undefined;
129
+ validationText: string;
127
130
  modelValue: string | Date;
128
131
  placeholder: string;
129
- showClear: boolean;
130
132
  teleportTo: string;
131
- validationText: string;
132
- format: string;
133
- calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
134
- calendarMarkedDays: import("../KCalendar/types.js").IMarkedDay[];
133
+ showClear: boolean;
135
134
  align: "left" | "right" | undefined;
135
+ format: string;
136
136
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
137
137
  declare const _default: typeof __VLS_export;
138
138
  export default _default;
@@ -22,8 +22,8 @@ const templateProps = computed(() => ({
22
22
  calendarDay: calendarDay.value,
23
23
  format: props.format,
24
24
  showClear: props.showClear,
25
- calendarDefinedDays: props.calendarDefinedDays,
26
- calendarMarkedDays: props.calendarMarkedDays,
25
+ definedDays: props.definedDays,
26
+ markedDays: props.markedDays,
27
27
  textboxClicked,
28
28
  onClear: handleClear,
29
29
  dateSelected: handleDateSelected,