@katlux/toolkit 0.1.1-alpha.100 → 0.1.1-alpha.107

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 (118) hide show
  1. package/README.md +1 -1
  2. package/dist/compiled/composables/useDataProvider.mjs +140 -0
  3. package/dist/compiled/composables/useDataProvider.spec.mjs +86 -0
  4. package/dist/compiled/composables/useDebounce.mjs +3 -11
  5. package/dist/compiled/composables/useFilterLogic.mjs +23 -169
  6. package/dist/compiled/composables/usePresetComponent.mjs +62 -38
  7. package/dist/compiled/composables/usePresetComponent.spec.mjs +106 -0
  8. package/dist/compiled/composables/useRequestProvider.mjs +9 -0
  9. package/dist/compiled/composables/useSortLogic.mjs +3 -55
  10. package/dist/compiled/composables/useTemplate.spec.mjs +30 -0
  11. package/dist/compiled/composables/useUnregisterProvider.mjs +4 -0
  12. package/dist/compiled/utils/PresetResolver.mjs +1 -1
  13. package/dist/compiled/utils/TemplateResolver.mjs +32 -0
  14. package/dist/module.cjs +1 -0
  15. package/dist/module.json +1 -1
  16. package/dist/module.mjs +1 -0
  17. package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +2 -0
  18. package/dist/runtime/components/KAlert/KAlert.global.vue +3 -1
  19. package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +2 -0
  20. package/dist/runtime/components/KAlert/KAlert.logic.d.ts +4 -2
  21. package/dist/runtime/components/KAlert/KAlert.logic.js +12 -6
  22. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
  23. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
  24. package/dist/runtime/components/KCalendar/KCalendar.logic.js +13 -6
  25. package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +13 -13
  26. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +13 -13
  27. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +6 -5
  28. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +4 -1
  29. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
  30. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
  31. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
  32. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
  33. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +2 -2
  34. package/dist/runtime/components/KCombobox/KCombobox.logic.js +6 -9
  35. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +1 -1
  36. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +0 -1
  37. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +1 -1
  38. package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +1 -1
  39. package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +1 -1
  40. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
  41. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
  42. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +2 -2
  43. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +1 -1
  44. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -2
  45. package/dist/runtime/components/KDatatable/KDatatable.logic.js +45 -6
  46. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -6
  47. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -6
  48. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -2
  49. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +6 -6
  50. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +6 -6
  51. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +2 -2
  52. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
  53. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
  54. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +8 -8
  55. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +8 -8
  56. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +4 -4
  57. package/dist/runtime/components/KGantt/KGantt.logic.js +21 -25
  58. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  59. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  60. package/dist/runtime/components/KGrid/KGrid.logic.d.ts +1 -0
  61. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
  62. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
  63. package/dist/runtime/components/KIcon/KIcon.logic.d.ts +14 -0
  64. package/dist/runtime/components/KIcon/KIcon.logic.js +74 -17
  65. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
  66. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
  67. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
  68. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
  69. package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
  70. package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
  71. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  72. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  73. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
  74. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
  75. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +4 -4
  76. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +4 -4
  77. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +1 -1
  78. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
  79. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
  80. package/dist/runtime/components/MultiTabs/MultiTabs.logic.d.ts +1 -1
  81. package/dist/runtime/components/MultiTabs/MultiTabs.logic.js +25 -14
  82. package/dist/runtime/composables/useDataProvider.d.ts +37 -0
  83. package/dist/runtime/composables/useDataProvider.js +140 -0
  84. package/dist/runtime/composables/useDebounce.d.ts +2 -6
  85. package/dist/runtime/composables/useDebounce.js +3 -11
  86. package/dist/runtime/composables/useFilterLogic.d.ts +5 -4
  87. package/dist/runtime/composables/useFilterLogic.js +23 -169
  88. package/dist/runtime/composables/usePresetComponent.d.ts +14 -3
  89. package/dist/runtime/composables/usePresetComponent.js +62 -38
  90. package/dist/runtime/composables/useRequestProvider.d.ts +23 -0
  91. package/dist/runtime/composables/useRequestProvider.js +9 -0
  92. package/dist/runtime/composables/useSortLogic.d.ts +3 -2
  93. package/dist/runtime/composables/useSortLogic.js +3 -55
  94. package/dist/runtime/composables/useTemplate.d.ts +1 -1
  95. package/dist/runtime/composables/useTemplate.js +1 -1
  96. package/dist/runtime/composables/useUnregisterProvider.d.ts +25 -0
  97. package/dist/runtime/composables/useUnregisterProvider.js +4 -0
  98. package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +9 -0
  99. package/dist/runtime/plugins/nuxtCompatPlugin.js +11 -0
  100. package/dist/runtime/presets/default/assets/scss/css-variables.css +2 -0
  101. package/dist/runtime/presets/default/assets/scss/css-variables.scss +2 -0
  102. package/dist/runtime/presets/default/assets/scss/index.css +2 -0
  103. package/dist/runtime/presets/default/components/KAlert/KAlert.d.vue.ts +1 -1
  104. package/dist/runtime/presets/default/components/KAlert/KAlert.vue +16 -9
  105. package/dist/runtime/presets/default/components/KAlert/KAlert.vue.d.ts +1 -1
  106. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
  107. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +45 -3
  108. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +22 -4
  109. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +28 -2
  110. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +11 -2
  111. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +1 -1
  112. package/dist/runtime/utils/PresetResolver.js +1 -1
  113. package/dist/runtime/utils/TemplateResolver.d.ts +14 -0
  114. package/dist/runtime/utils/TemplateResolver.js +32 -0
  115. package/package.json +1 -1
  116. package/dist/runtime/components/KThree/KThree.global.d.vue.ts +0 -3
  117. package/dist/runtime/components/KThree/KThree.global.vue +0 -7
  118. package/dist/runtime/components/KThree/KThree.global.vue.d.ts +0 -3
@@ -22,6 +22,20 @@ export declare const KIconDefaultProps: {
22
22
  default: number;
23
23
  };
24
24
  };
25
+ /**
26
+ * Register a custom SVG icon or dynamic loader.
27
+ * Allows tenant themes, packages, or apps to register custom iconography.
28
+ */
29
+ export declare function registerSvgIcon(name: string, svgOrLoader: string | (() => Promise<string>)): void;
30
+ /**
31
+ * Get an SVG string directly from the in-memory cache if available.
32
+ */
33
+ export declare function getCachedSvgIcon(name: string): string | undefined;
34
+ /**
35
+ * Clear the SVG cache (primarily for test environments).
36
+ */
37
+ export declare function clearSvgCache(): void;
38
+ export declare function formatIconSize(val: number | string | undefined): string | undefined;
25
39
  export declare function useKIconLogic(props: KIconProps): {
26
40
  widthPx: import("vue").ComputedRef<string | undefined>;
27
41
  heightPx: import("vue").ComputedRef<string>;
@@ -1,4 +1,4 @@
1
- import { computed } from "vue";
1
+ import { computed, watch, shallowRef } from "vue";
2
2
  export const KIconDefaultProps = {
3
3
  iconname: {
4
4
  type: String,
@@ -17,27 +17,84 @@ export const KIconDefaultProps = {
17
17
  default: 0
18
18
  }
19
19
  };
20
- export function useKIconLogic(props) {
21
- const modules = import.meta.glob("../../presets/default/assets/svg/*.svg", { eager: true, as: "raw" });
22
- const iconMap = {};
23
- for (const path in modules) {
20
+ const _svgCache = /* @__PURE__ */ new Map();
21
+ const _asyncSvgLoaders = /* @__PURE__ */ new Map();
22
+ const _defaultSvgModules = import.meta.glob("../../presets/default/assets/svg/*.svg", {
23
+ eager: true,
24
+ query: "?raw",
25
+ import: "default"
26
+ });
27
+ for (const path in _defaultSvgModules) {
28
+ const match = path.match(/([^/]+)\.svg$/);
29
+ if (match) {
30
+ _svgCache.set(match[1], _defaultSvgModules[path]);
31
+ }
32
+ }
33
+ export function registerSvgIcon(name, svgOrLoader) {
34
+ if (typeof svgOrLoader === "string") {
35
+ _svgCache.set(name, svgOrLoader);
36
+ } else {
37
+ _asyncSvgLoaders.set(name, svgOrLoader);
38
+ }
39
+ }
40
+ export function getCachedSvgIcon(name) {
41
+ return _svgCache.get(name);
42
+ }
43
+ export function clearSvgCache() {
44
+ _svgCache.clear();
45
+ _asyncSvgLoaders.clear();
46
+ for (const path in _defaultSvgModules) {
24
47
  const match = path.match(/([^/]+)\.svg$/);
25
48
  if (match) {
26
- iconMap[match[1]] = modules[path];
49
+ _svgCache.set(match[1], _defaultSvgModules[path]);
27
50
  }
28
51
  }
29
- const formatSize = (val) => {
30
- if (val === void 0 || val === null || val === "") return void 0;
31
- if (typeof val === "number") return `${val}px`;
32
- if (typeof val === "string") {
33
- if (/^\d+$/.test(val)) return `${val}px`;
34
- return val;
35
- }
52
+ }
53
+ export function formatIconSize(val) {
54
+ if (val === void 0 || val === null || val === "") return void 0;
55
+ if (typeof val === "number") return `${val}px`;
56
+ if (typeof val === "string") {
57
+ if (/^\d+$/.test(val)) return `${val}px`;
36
58
  return val;
37
- };
38
- const widthPx = computed(() => formatSize(props.width));
39
- const heightPx = computed(() => formatSize(props.height) || "12px");
40
- const iconComponent = computed(() => iconMap[props.iconname] || null);
59
+ }
60
+ return String(val);
61
+ }
62
+ export function useKIconLogic(props) {
63
+ const widthPx = computed(() => formatIconSize(props.width));
64
+ const heightPx = computed(() => formatIconSize(props.height) || "12px");
65
+ const asyncLoadedSvg = shallowRef(null);
66
+ watch(
67
+ () => props.iconname,
68
+ (name) => {
69
+ if (!name || name.startsWith("<svg") || _svgCache.has(name)) {
70
+ asyncLoadedSvg.value = null;
71
+ return;
72
+ }
73
+ const loader = _asyncSvgLoaders.get(name);
74
+ if (loader) {
75
+ loader().then((raw) => {
76
+ _svgCache.set(name, raw);
77
+ if (props.iconname === name) {
78
+ asyncLoadedSvg.value = raw;
79
+ }
80
+ }).catch((err) => {
81
+ console.warn(`[KIcon] Failed to load icon: ${name}`, err);
82
+ asyncLoadedSvg.value = null;
83
+ });
84
+ } else {
85
+ asyncLoadedSvg.value = null;
86
+ }
87
+ },
88
+ { immediate: true }
89
+ );
90
+ const iconComponent = computed(() => {
91
+ const name = props.iconname;
92
+ if (!name) return null;
93
+ if (name.startsWith("<svg")) return name;
94
+ const cached = _svgCache.get(name);
95
+ if (cached) return cached;
96
+ return asyncLoadedSvg.value;
97
+ });
41
98
  return {
42
99
  widthPx,
43
100
  heightPx,
@@ -65,7 +65,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
65
65
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
66
66
  }>, {
67
67
  label: string;
68
- validation: "success" | "warning" | "error" | null | undefined;
68
+ validation: "error" | "success" | "warning" | null | undefined;
69
69
  validationText: string;
70
70
  modelValue: string;
71
71
  placeholder: string;
@@ -65,7 +65,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
65
65
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
66
66
  }>, {
67
67
  label: string;
68
- validation: "success" | "warning" | "error" | null | undefined;
68
+ validation: "error" | "success" | "warning" | null | undefined;
69
69
  validationText: string;
70
70
  modelValue: string;
71
71
  placeholder: string;
@@ -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: "success" | "warning" | "error" | null | undefined;
54
+ validation: "error" | "success" | "warning" | 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: "success" | "warning" | "error" | null | undefined;
54
+ validation: "error" | "success" | "warning" | null | undefined;
55
55
  validationText: string;
56
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
57
57
  declare const _default: typeof __VLS_export;
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
53
53
  }>> & Readonly<{
54
54
  "onUpdate:value"?: ((value: any) => any) | undefined;
55
55
  }>, {
56
+ value: number;
56
57
  label: string;
57
58
  disabled: boolean;
58
- value: number;
59
59
  step: number;
60
60
  min: number;
61
61
  max: number;
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
53
53
  }>> & Readonly<{
54
54
  "onUpdate:value"?: ((value: any) => any) | undefined;
55
55
  }>, {
56
+ value: number;
56
57
  label: string;
57
58
  disabled: boolean;
58
- value: number;
59
59
  step: number;
60
60
  min: number;
61
61
  max: number;
@@ -57,10 +57,10 @@ 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: "success" | "warning" | "error" | null | undefined;
60
+ rows: number;
61
+ validation: "error" | "success" | "warning" | null | undefined;
61
62
  validationText: string;
62
63
  placeholder: string;
63
- rows: number;
64
64
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
65
65
  declare const _default: typeof __VLS_export;
66
66
  export default _default;
@@ -57,10 +57,10 @@ 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: "success" | "warning" | "error" | null | undefined;
60
+ rows: number;
61
+ validation: "error" | "success" | "warning" | null | undefined;
61
62
  validationText: string;
62
63
  placeholder: string;
63
- rows: number;
64
64
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
65
65
  declare const _default: typeof __VLS_export;
66
66
  export default _default;
@@ -68,7 +68,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
68
68
  }>, {
69
69
  type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
70
70
  label: string;
71
- validation: "success" | "warning" | "error" | null | undefined;
71
+ validation: "error" | "success" | "warning" | null | undefined;
72
72
  validationText: string;
73
73
  modelValue: string;
74
74
  placeholder: string;
@@ -68,7 +68,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
68
68
  }>, {
69
69
  type: "number" | "url" | "search" | "text" | "password" | "email" | "tel" | undefined;
70
70
  label: string;
71
- validation: "success" | "warning" | "error" | null | undefined;
71
+ validation: "error" | "success" | "warning" | null | undefined;
72
72
  validationText: string;
73
73
  modelValue: string;
74
74
  placeholder: string;
@@ -164,10 +164,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
164
164
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
165
165
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
166
166
  }>, {
167
+ parentKey: string;
168
+ loading: boolean;
169
+ idKey: string;
167
170
  label: string;
168
171
  disabled: boolean;
169
- loading: boolean;
170
- validation: "success" | "warning" | "error" | null | undefined;
172
+ validation: "error" | "success" | "warning" | null | undefined;
171
173
  validationText: string;
172
174
  modelValue: any;
173
175
  searchbox: boolean;
@@ -179,8 +181,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
179
181
  multiSelect: boolean;
180
182
  valueField: string;
181
183
  iconField: string;
182
- idKey: string;
183
- parentKey: string;
184
184
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
185
185
  declare const _default: typeof __VLS_export;
186
186
  export default _default;
@@ -164,10 +164,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
164
164
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
165
165
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
166
166
  }>, {
167
+ parentKey: string;
168
+ loading: boolean;
169
+ idKey: string;
167
170
  label: string;
168
171
  disabled: boolean;
169
- loading: boolean;
170
- validation: "success" | "warning" | "error" | null | undefined;
172
+ validation: "error" | "success" | "warning" | null | undefined;
171
173
  validationText: string;
172
174
  modelValue: any;
173
175
  searchbox: boolean;
@@ -179,8 +181,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
179
181
  multiSelect: boolean;
180
182
  valueField: string;
181
183
  iconField: string;
182
- idKey: string;
183
- parentKey: string;
184
184
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
185
185
  declare const _default: typeof __VLS_export;
186
186
  export default _default;
@@ -110,5 +110,5 @@ export declare function useKTreePickerLogic(props: KTreePickerProps, emit: any):
110
110
  toggleDropdown: () => void;
111
111
  closeDropdown: () => void;
112
112
  filteredOptions: import("vue").ComputedRef<import("@katlux/providers").TDataRow[]>;
113
- loading: import("vue").ComputedRef<Boolean>;
113
+ loading: import("vue").Ref<boolean, boolean>;
114
114
  };
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
+ parentKey: string;
85
+ idKey: string;
86
+ expandedByDefault: boolean;
84
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
85
88
  rowActions: import("@katlux/providers").IKDatatableAction[];
86
89
  cellSlots: Record<string, any>;
87
90
  headerSlots: Record<string, any>;
88
91
  treeColumnIndex: number;
89
- idKey: string;
90
- parentKey: string;
91
- expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
+ parentKey: string;
85
+ idKey: string;
86
+ expandedByDefault: boolean;
84
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
85
88
  rowActions: import("@katlux/providers").IKDatatableAction[];
86
89
  cellSlots: Record<string, any>;
87
90
  headerSlots: Record<string, any>;
88
91
  treeColumnIndex: number;
89
- idKey: string;
90
- parentKey: string;
91
- expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -18,7 +18,7 @@ export declare const MultiTabsDefaultProps: {
18
18
  };
19
19
  };
20
20
  export declare function useMultiTabsLogic(props: any, emit: any): {
21
- groups: import("vue").WritableComputedRef<any, any>;
21
+ groups: import("vue").WritableComputedRef<MultiTabsGroup[], MultiTabsGroup[]>;
22
22
  addTab: (tab: MultiTabsTab, groupId?: string) => void;
23
23
  splitScreen: (initialTab?: MultiTabsTab) => string;
24
24
  closeSplit: (groupId: string) => void;
@@ -17,31 +17,42 @@ export function useMultiTabsLogic(props, emit) {
17
17
  }
18
18
  });
19
19
  const addTab = (tab, groupId) => {
20
- const gs = [...groups.value];
21
- const targetGroupId = groupId || gs[0]?.id;
22
- const group = gs.find((g) => g.id === targetGroupId);
23
- if (group) {
24
- group.tabs.forEach((t) => t.isOpen = false);
20
+ const targetGroupId = groupId || groups.value[0]?.id;
21
+ const newGroups = groups.value.map((group) => {
22
+ if (group.id !== targetGroupId) return group;
25
23
  const existingTabIndex = group.tabs.findIndex((t) => t.id === tab.id);
24
+ let newTabs;
26
25
  if (existingTabIndex >= 0) {
27
- group.tabs[existingTabIndex].isOpen = true;
26
+ newTabs = group.tabs.map((t, idx) => ({
27
+ ...t,
28
+ isOpen: idx === existingTabIndex
29
+ }));
28
30
  } else {
29
- group.tabs.push({ ...tab, isOpen: true });
31
+ newTabs = [
32
+ ...group.tabs.map((t) => ({ ...t, isOpen: false })),
33
+ { ...tab, isOpen: true }
34
+ ];
30
35
  }
31
- groups.value = gs;
32
- }
36
+ return {
37
+ ...group,
38
+ tabs: newTabs
39
+ };
40
+ });
41
+ groups.value = newGroups;
33
42
  };
34
43
  const splitScreen = (initialTab) => {
35
- const gs = [...groups.value];
36
44
  const newId = `group-${Date.now()}`;
37
45
  const tabs = initialTab ? [{ ...initialTab, isOpen: true }] : [];
38
- gs.push({ id: newId, tabs });
39
- groups.value = gs;
46
+ const newGroups = [
47
+ ...groups.value.map((g) => ({ ...g, tabs: [...g.tabs] })),
48
+ { id: newId, tabs }
49
+ ];
50
+ groups.value = newGroups;
40
51
  return newId;
41
52
  };
42
53
  const closeSplit = (groupId) => {
43
- const gs = groups.value.filter((g) => g.id !== groupId);
44
- groups.value = gs.length > 0 ? gs : [{ id: "default", tabs: [] }];
54
+ const filtered = groups.value.filter((g) => g.id !== groupId).map((g) => ({ ...g, tabs: [...g.tabs] }));
55
+ groups.value = filtered.length > 0 ? filtered : [{ id: "default", tabs: [] }];
45
56
  };
46
57
  return {
47
58
  groups,
@@ -0,0 +1,37 @@
1
+ import { type Ref } from 'vue';
2
+ import type { IDataFilter, IDataSort, TDataRow } from '@katlux/providers';
3
+ export interface IUseDataProviderReturn<T = TDataRow> {
4
+ rawProvider: any;
5
+ pageData: Ref<T[]>;
6
+ rowCount: Ref<number>;
7
+ currentPage: Ref<number>;
8
+ pageSize: Ref<number>;
9
+ loading: Ref<boolean>;
10
+ initialLoad: Ref<boolean>;
11
+ error: Ref<any>;
12
+ filter: Ref<IDataFilter | null>;
13
+ sortList: Ref<IDataSort[]>;
14
+ selectedRows: Ref<any[]>;
15
+ selectAll: Ref<boolean>;
16
+ setCurrentPage: (page: number) => void;
17
+ setPageSize: (size: number) => void;
18
+ setFilter: (filter: IDataFilter | null) => void;
19
+ setSortList: (sortList: IDataSort[]) => void;
20
+ refresh: (hardRefresh?: boolean) => Promise<void>;
21
+ loadPageData: (options?: {
22
+ disableCache?: boolean;
23
+ }) => Promise<void> | void;
24
+ }
25
+ /**
26
+ * useDataProvider
27
+ *
28
+ * Idiomatic Vue 3 composable bridge for Katlux DataProviders.
29
+ * Connects any standalone framework-agnostic ADataProvider (or legacy provider)
30
+ * to Vue 3's reactivity system.
31
+ *
32
+ * Features:
33
+ * - Subscribes to provider updates and syncs reactive refs automatically.
34
+ * - Cleans up listeners automatically with onScopeDispose (zero SSR memory leaks).
35
+ * - Bi-directional syncing for currentPage, pageSize, and filter.
36
+ */
37
+ export declare function useDataProvider<T = TDataRow>(provider: any): IUseDataProviderReturn<T>;
@@ -0,0 +1,140 @@
1
+ import { ref, shallowRef, onScopeDispose, isRef } from "vue";
2
+ export function useDataProvider(provider) {
3
+ if (!provider) {
4
+ const emptyArray = shallowRef([]);
5
+ return {
6
+ rawProvider: null,
7
+ pageData: emptyArray,
8
+ rowCount: ref(0),
9
+ currentPage: ref(1),
10
+ pageSize: ref(10),
11
+ loading: ref(false),
12
+ initialLoad: ref(false),
13
+ error: ref(null),
14
+ filter: ref(null),
15
+ sortList: ref([]),
16
+ selectedRows: ref([]),
17
+ selectAll: ref(false),
18
+ setCurrentPage: () => {
19
+ },
20
+ setPageSize: () => {
21
+ },
22
+ setFilter: () => {
23
+ },
24
+ setSortList: () => {
25
+ },
26
+ refresh: async () => {
27
+ },
28
+ loadPageData: () => {
29
+ }
30
+ };
31
+ }
32
+ const extractVal = (prop, fallback) => {
33
+ if (prop === void 0 || prop === null) return fallback;
34
+ if (isRef(prop) || typeof prop === "object" && "value" in prop) {
35
+ return prop.value !== void 0 ? prop.value : fallback;
36
+ }
37
+ return prop;
38
+ };
39
+ const pageData = shallowRef(
40
+ Array.isArray(provider.pageData) ? [...provider.pageData] : extractVal(provider.pageData, [])
41
+ );
42
+ const rowCount = ref(extractVal(provider.rowCount, 0));
43
+ const currentPage = ref(extractVal(provider.currentPage, 1));
44
+ const pageSize = ref(extractVal(provider.pageSize, 10));
45
+ const loading = ref(extractVal(provider.loading, false));
46
+ const initialLoad = ref(extractVal(provider.initialLoad, false));
47
+ const error = ref(extractVal(provider.error, null));
48
+ const filter = ref(extractVal(provider.filter, null));
49
+ const sortList = ref(extractVal(provider.sortList, []));
50
+ const selectedRows = ref(extractVal(provider.selectedRows, []));
51
+ const selectAll = ref(extractVal(provider.selectAll, false));
52
+ const syncFromProvider = () => {
53
+ pageData.value = Array.isArray(provider.pageData) ? [...provider.pageData] : extractVal(provider.pageData, []);
54
+ rowCount.value = extractVal(provider.rowCount, 0);
55
+ currentPage.value = extractVal(provider.currentPage, 1);
56
+ pageSize.value = extractVal(provider.pageSize, 10);
57
+ loading.value = extractVal(provider.loading, false);
58
+ initialLoad.value = extractVal(provider.initialLoad, false);
59
+ error.value = extractVal(provider.error, null);
60
+ filter.value = extractVal(provider.filter, null);
61
+ sortList.value = extractVal(provider.sortList, []);
62
+ selectedRows.value = extractVal(provider.selectedRows, []);
63
+ selectAll.value = extractVal(provider.selectAll, false);
64
+ };
65
+ if (typeof provider.subscribe === "function") {
66
+ const unsubscribe = provider.subscribe(() => {
67
+ syncFromProvider();
68
+ });
69
+ try {
70
+ onScopeDispose(unsubscribe);
71
+ } catch {
72
+ }
73
+ }
74
+ const setCurrentPage = (page) => {
75
+ if (typeof provider.setCurrentPage === "function") {
76
+ provider.setCurrentPage(page);
77
+ } else if (provider.currentPage) {
78
+ provider.currentPage.value = page;
79
+ }
80
+ currentPage.value = page;
81
+ };
82
+ const setPageSize = (size) => {
83
+ if (typeof provider.setPageSize === "function") {
84
+ provider.setPageSize(size);
85
+ } else if (provider.pageSize) {
86
+ provider.pageSize.value = size;
87
+ }
88
+ pageSize.value = size;
89
+ };
90
+ const setFilter = (f) => {
91
+ if (typeof provider.setFilter === "function") {
92
+ provider.setFilter(f);
93
+ } else if (provider.filter) {
94
+ provider.filter.value = f;
95
+ }
96
+ filter.value = f;
97
+ };
98
+ const setSortList = (s) => {
99
+ if (typeof provider.setSortList === "function") {
100
+ provider.setSortList(s);
101
+ } else if (provider.sortList) {
102
+ provider.sortList.value = s;
103
+ }
104
+ sortList.value = s;
105
+ };
106
+ const refresh = async (hardRefresh = false) => {
107
+ if (typeof provider.refresh === "function") {
108
+ await provider.refresh(hardRefresh);
109
+ } else if (typeof provider.loadPageData === "function") {
110
+ await provider.loadPageData({ disableCache: hardRefresh });
111
+ }
112
+ syncFromProvider();
113
+ };
114
+ const loadPageData = (options) => {
115
+ if (typeof provider.loadPageData === "function") {
116
+ provider.loadPageData(options);
117
+ }
118
+ syncFromProvider();
119
+ };
120
+ return {
121
+ rawProvider: provider,
122
+ pageData,
123
+ rowCount,
124
+ currentPage,
125
+ pageSize,
126
+ loading,
127
+ initialLoad,
128
+ error,
129
+ filter,
130
+ sortList,
131
+ selectedRows,
132
+ selectAll,
133
+ setCurrentPage,
134
+ setPageSize,
135
+ setFilter,
136
+ setSortList,
137
+ refresh,
138
+ loadPageData
139
+ };
140
+ }
@@ -1,7 +1,3 @@
1
- /**
2
- * Creates a debounced version of a function.
3
- * @param callback The function to debounce.
4
- * @param delay The delay in milliseconds.
5
- * @returns A debounced function that calls the original callback after the delay.
6
- */
1
+ import { debounce } from '@katlux/providers';
7
2
  export declare const useDebounce: <T extends (...args: any[]) => any>(callback: T, delay: number) => ((...args: Parameters<T>) => void);
3
+ export { debounce };
@@ -1,11 +1,3 @@
1
- export const useDebounce = (callback, delay) => {
2
- let timeoutId = null;
3
- return function(...args) {
4
- if (timeoutId !== null) {
5
- clearTimeout(timeoutId);
6
- }
7
- timeoutId = setTimeout(() => {
8
- callback.apply(this, args);
9
- }, delay);
10
- };
11
- };
1
+ import { useDebounce as providersUseDebounce, debounce } from "@katlux/providers";
2
+ export const useDebounce = providersUseDebounce;
3
+ export { debounce };
@@ -1,14 +1,14 @@
1
- import type { TDataRow, IDataFilter } from '@katlux/providers';
1
+ import { evaluateFilter, filterTreeData, filterData, applyOperator, compareAnd, compareOr, compareIn, compareEqual, compareValues } from '@katlux/providers';
2
2
  export declare const useFilterLogic: () => {
3
- evaluateFilter: (filter: IDataFilter, row: TDataRow) => boolean;
4
- filterTreeData: (nodes: any[], filter: IDataFilter, options: {
3
+ evaluateFilter: (filter: import("@katlux/providers").IDataFilter, row: import("@katlux/providers").TDataRow) => boolean;
4
+ filterTreeData: (nodes: any[], filter: import("@katlux/providers").IDataFilter, options: {
5
5
  idKey: string;
6
6
  parentKey: string;
7
7
  }) => {
8
8
  visibleNodes: any[];
9
9
  expandedNodes: Set<string | number>;
10
10
  };
11
- filterData: (data: any[], filter: IDataFilter, options?: {
11
+ filterData: (data: any[], filter: import("@katlux/providers").IDataFilter, options?: {
12
12
  treeOptions?: {
13
13
  idKey: string;
14
14
  parentKey: string;
@@ -18,3 +18,4 @@ export declare const useFilterLogic: () => {
18
18
  expandedNodes?: Set<string | number>;
19
19
  };
20
20
  };
21
+ export { evaluateFilter, filterTreeData, filterData, applyOperator, compareAnd, compareOr, compareIn, compareEqual, compareValues };