@katlux/toolkit 0.1.1-alpha.119 → 0.1.1-alpha.121

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 (84) hide show
  1. package/bin/add-ai-reference.mjs +152 -39
  2. package/bin/cli.mjs +20 -1
  3. package/dist/compiled/composables/useDataProvider.mjs +20 -0
  4. package/dist/compiled/composables/useKatluxForm.mjs +55 -12
  5. package/dist/compiled/composables/useVirtualScroll.mjs +78 -8
  6. package/dist/module.json +1 -1
  7. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +26 -17
  8. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +12 -0
  9. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -2
  10. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +12 -0
  11. package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +5 -0
  12. package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +4 -0
  13. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -0
  14. package/dist/runtime/components/KCombobox/KCombobox.global.vue +2 -2
  15. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -0
  16. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +1 -0
  17. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +5 -33
  18. package/dist/runtime/components/KDatatable/KDatatable.logic.js +30 -31
  19. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +4 -2
  20. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +2 -1
  21. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +4 -2
  22. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
  23. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
  24. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
  25. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
  26. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +36 -0
  27. package/dist/runtime/components/KGantt/KGantt.global.vue +5 -1
  28. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +36 -0
  29. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +20 -0
  30. package/dist/runtime/components/KGantt/KGantt.logic.js +17 -6
  31. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +2 -0
  32. package/dist/runtime/components/KPagination/KPagination.global.vue +1 -1
  33. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +2 -0
  34. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -0
  35. package/dist/runtime/components/KPagination/KPagination.logic.js +6 -1
  36. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  37. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  38. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
  39. package/dist/runtime/components/KTree/KTree.global.vue +0 -1
  40. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
  41. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +1 -1
  42. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
  43. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +1 -1
  44. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +1 -1
  45. package/dist/runtime/composables/useDataProvider.d.ts +1 -0
  46. package/dist/runtime/composables/useDataProvider.js +20 -0
  47. package/dist/runtime/composables/useFilterLogic.d.ts +1 -0
  48. package/dist/runtime/composables/useKatluxForm.d.ts +2 -0
  49. package/dist/runtime/composables/useKatluxForm.js +55 -12
  50. package/dist/runtime/composables/useVirtualScroll.d.ts +1 -1
  51. package/dist/runtime/composables/useVirtualScroll.js +78 -8
  52. package/dist/runtime/presets/default/assets/scss/css-variables.css +1 -0
  53. package/dist/runtime/presets/default/assets/scss/css-variables.scss +1 -0
  54. package/dist/runtime/presets/default/assets/scss/index.css +1 -0
  55. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +4 -4
  56. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +3 -0
  57. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +7 -0
  58. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +3 -0
  59. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +2 -0
  60. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +3 -1
  61. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +2 -0
  62. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +2 -0
  63. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +20 -6
  64. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +2 -0
  65. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +85 -15
  66. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +3 -1
  67. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +3 -1
  68. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +3 -1
  69. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +4 -0
  70. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +16 -2
  71. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +4 -0
  72. package/dist/runtime/presets/default/components/KGrid/KGrid.vue +1 -0
  73. package/dist/runtime/presets/default/components/KLayout/KLayout.d.vue.ts +6 -1
  74. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +53 -5
  75. package/dist/runtime/presets/default/components/KLayout/KLayout.vue.d.ts +6 -1
  76. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +29 -7
  77. package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +1 -0
  78. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +1 -1
  79. package/dist/runtime/presets/default/components/KToast/KToast.vue +0 -1
  80. package/dist/runtime/presets/default/components/KToastContainer/KToastContainer.vue +0 -1
  81. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +2 -3
  82. package/dist/runtime/presets/default/components/KTree/KTree.vue +7 -5
  83. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +2 -3
  84. package/package.json +2 -2
@@ -67,6 +67,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
67
67
  type: ObjectConstructor;
68
68
  default: () => {};
69
69
  };
70
+ virtualScroll: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
74
+ itemHeight: {
75
+ type: NumberConstructor;
76
+ default: number;
77
+ };
78
+ viewportHeight: {
79
+ type: NumberConstructor;
80
+ default: number;
81
+ };
82
+ buffer: {
83
+ type: NumberConstructor;
84
+ default: number;
85
+ };
70
86
  }>, {
71
87
  moveTime: (amount: number) => void;
72
88
  zoom: (factor: number) => void;
@@ -145,6 +161,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
145
161
  type: ObjectConstructor;
146
162
  default: () => {};
147
163
  };
164
+ virtualScroll: {
165
+ type: BooleanConstructor;
166
+ default: boolean;
167
+ };
168
+ itemHeight: {
169
+ type: NumberConstructor;
170
+ default: number;
171
+ };
172
+ viewportHeight: {
173
+ type: NumberConstructor;
174
+ default: number;
175
+ };
176
+ buffer: {
177
+ type: NumberConstructor;
178
+ default: number;
179
+ };
148
180
  }>> & Readonly<{
149
181
  "onUpdate:selectedRows"?: ((...args: any[]) => any) | undefined;
150
182
  "onUpdate:selectAll"?: ((...args: any[]) => any) | undefined;
@@ -153,7 +185,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
153
185
  "onUpdate:endingPoint"?: ((...args: any[]) => any) | undefined;
154
186
  }>, {
155
187
  bulkActions: unknown[];
188
+ virtualScroll: boolean;
189
+ itemHeight: number;
190
+ buffer: number;
156
191
  rowActions: unknown[];
192
+ viewportHeight: number;
157
193
  cellSlots: Record<string, any>;
158
194
  headerSlots: Record<string, any>;
159
195
  startDate: string | number | Date;
@@ -58,6 +58,10 @@ export interface KGanttProps {
58
58
  taskTypeField?: string;
59
59
  /** 'date' (Standard calendar) or 'numeric' (Plain numbers) */
60
60
  mode?: 'date' | 'numeric';
61
+ virtualScroll?: boolean;
62
+ itemHeight?: number;
63
+ viewportHeight?: number;
64
+ buffer?: number;
61
65
  }
62
66
  export declare const KGanttDefaultProps: {
63
67
  dataProvider: {
@@ -128,6 +132,22 @@ export declare const KGanttDefaultProps: {
128
132
  type: ObjectConstructor;
129
133
  default: () => {};
130
134
  };
135
+ virtualScroll: {
136
+ type: BooleanConstructor;
137
+ default: boolean;
138
+ };
139
+ itemHeight: {
140
+ type: NumberConstructor;
141
+ default: number;
142
+ };
143
+ viewportHeight: {
144
+ type: NumberConstructor;
145
+ default: number;
146
+ };
147
+ buffer: {
148
+ type: NumberConstructor;
149
+ default: number;
150
+ };
131
151
  };
132
152
  export declare function useKGanttLogic(props: KGanttProps): {
133
153
  globalDateRange: import("vue").ComputedRef<{
@@ -78,15 +78,26 @@ export const KGanttDefaultProps = {
78
78
  headerSlots: {
79
79
  type: Object,
80
80
  default: () => ({})
81
+ },
82
+ virtualScroll: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ itemHeight: {
87
+ type: Number,
88
+ default: 40
89
+ },
90
+ viewportHeight: {
91
+ type: Number,
92
+ default: 500
93
+ },
94
+ buffer: {
95
+ type: Number,
96
+ default: 5
81
97
  }
82
98
  };
83
99
  export function useKGanttLogic(props) {
84
- let baseNow = Date.now();
85
- try {
86
- const nuxtState = globalThis.useState?.("gantt-base-now", () => Date.now());
87
- if (nuxtState?.value) baseNow = nuxtState.value;
88
- } catch {
89
- }
100
+ const baseNow = Date.now();
90
101
  const globalDateRange = computed(() => {
91
102
  const now = baseNow;
92
103
  const msInDay = 24 * 60 * 60 * 1e3;
@@ -12,11 +12,13 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
12
12
  change: (value: number) => any;
13
13
  "update:currentPage": (value: number) => any;
14
14
  "update:pageSize": (value: number) => any;
15
+ "page-click": (value: number) => any;
15
16
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
16
17
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
17
18
  onChange?: ((value: number) => any) | undefined;
18
19
  "onUpdate:currentPage"?: ((value: number) => any) | undefined;
19
20
  "onUpdate:pageSize"?: ((value: number) => any) | undefined;
21
+ "onPage-click"?: ((value: number) => any) | undefined;
20
22
  }>, {
21
23
  modelValue: number;
22
24
  currentPage: number;
@@ -12,7 +12,7 @@ const props = defineProps({
12
12
  totalItems: { type: Number, required: false, default: void 0 },
13
13
  maxVisiblePages: { type: Number, required: false, default: 10 }
14
14
  });
15
- const emit = defineEmits(["update:modelValue", "update:currentPage", "update:pageSize", "change"]);
15
+ const emit = defineEmits(["update:modelValue", "update:currentPage", "update:pageSize", "change", "page-click"]);
16
16
  const {
17
17
  dp,
18
18
  totalPages,
@@ -12,11 +12,13 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
12
12
  change: (value: number) => any;
13
13
  "update:currentPage": (value: number) => any;
14
14
  "update:pageSize": (value: number) => any;
15
+ "page-click": (value: number) => any;
15
16
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
16
17
  "onUpdate:modelValue"?: ((value: number) => any) | undefined;
17
18
  onChange?: ((value: number) => any) | undefined;
18
19
  "onUpdate:currentPage"?: ((value: number) => any) | undefined;
19
20
  "onUpdate:pageSize"?: ((value: number) => any) | undefined;
21
+ "onPage-click"?: ((value: number) => any) | undefined;
20
22
  }>, {
21
23
  modelValue: number;
22
24
  currentPage: number;
@@ -12,6 +12,7 @@ export type KPaginationEmits = {
12
12
  (e: 'update:currentPage', page: number): void;
13
13
  (e: 'update:pageSize', size: number): void;
14
14
  (e: 'change', page: number): void;
15
+ (e: 'page-click', page: number): void;
15
16
  };
16
17
  export declare const KPaginationDefaultProps: {
17
18
  maxVisiblePages: number;
@@ -92,7 +92,11 @@ export function useKPaginationLogic(props, emit) {
92
92
  () => (visiblePages.value[visiblePages.value.length - 1] || 0) < totalPages.value - 1
93
93
  );
94
94
  const pageClicked = (item) => {
95
- if (item < 1 || item > totalPages.value || item === currentPage.value) return;
95
+ if (item < 1 || item > totalPages.value) return;
96
+ if (item === currentPage.value) {
97
+ emit?.("page-click", item);
98
+ return;
99
+ }
96
100
  localCurrentPage.value = item;
97
101
  if (typeof dp?.setCurrentPage === "function") {
98
102
  dp.setCurrentPage(item);
@@ -109,6 +113,7 @@ export function useKPaginationLogic(props, emit) {
109
113
  emit?.("update:modelValue", item);
110
114
  emit?.("update:currentPage", item);
111
115
  emit?.("change", item);
116
+ emit?.("page-click", item);
112
117
  };
113
118
  const goToPrev = () => {
114
119
  if (currentPage.value > 1) {
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  disabled: boolean;
29
29
  text: string;
30
- position: "left" | "right" | "top" | "bottom";
30
+ position: "top" | "left" | "right" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  export default _default;
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  disabled: boolean;
29
29
  text: string;
30
- position: "left" | "right" | "top" | "bottom";
30
+ position: "top" | "left" | "right" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  export default _default;
@@ -152,6 +152,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
152
152
  }>, {
153
153
  modelValue: any;
154
154
  disabled: boolean;
155
+ idKey: string;
155
156
  searchtext: string;
156
157
  virtualScroll: boolean;
157
158
  itemHeight: number;
@@ -161,7 +162,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
161
162
  viewportHeight: number;
162
163
  expandedNodes: (string | number)[] | Set<string | number>;
163
164
  iconField: string;
164
- idKey: string;
165
165
  isNodeSelected: (node: any) => boolean;
166
166
  selectable: boolean;
167
167
  selectedNode: any;
@@ -44,7 +44,6 @@ component(
44
44
  :is="presetComponent"
45
45
  v-bind="templateProps"
46
46
  @select="selectNode"
47
- @node-click="selectNode"
48
47
  )
49
48
  // Passes slots from parent to template (for custom node content)
50
49
  template(v-for="(_, slot) in $slots" v-slot:[slot]="scope")
@@ -152,6 +152,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
152
152
  }>, {
153
153
  modelValue: any;
154
154
  disabled: boolean;
155
+ idKey: string;
155
156
  searchtext: string;
156
157
  virtualScroll: boolean;
157
158
  itemHeight: number;
@@ -161,7 +162,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
161
162
  viewportHeight: number;
162
163
  expandedNodes: (string | number)[] | Set<string | number>;
163
164
  iconField: string;
164
- idKey: string;
165
165
  isNodeSelected: (node: any) => boolean;
166
166
  selectable: boolean;
167
167
  selectedNode: any;
@@ -237,6 +237,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
237
237
  loading: boolean;
238
238
  validation: "error" | "success" | "warning" | null | undefined;
239
239
  validationText: string;
240
+ idKey: string;
240
241
  searchbox: boolean;
241
242
  searchtext: string;
242
243
  searchPlaceholder: string;
@@ -253,7 +254,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
253
254
  expandedNodes: any;
254
255
  parentKey: string;
255
256
  iconField: string;
256
- idKey: string;
257
257
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
258
258
  declare const _default: typeof __VLS_export;
259
259
  export default _default;
@@ -237,6 +237,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
237
237
  loading: boolean;
238
238
  validation: "error" | "success" | "warning" | null | undefined;
239
239
  validationText: string;
240
+ idKey: string;
240
241
  searchbox: boolean;
241
242
  searchtext: string;
242
243
  searchPlaceholder: string;
@@ -253,7 +254,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
253
254
  expandedNodes: any;
254
255
  parentKey: string;
255
256
  iconField: string;
256
- idKey: string;
257
257
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
258
258
  declare const _default: typeof __VLS_export;
259
259
  export default _default;
@@ -142,6 +142,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
142
142
  bulkActions: import("@katlux/providers").IKDatatableAction[];
143
143
  selectedRows: any[];
144
144
  selectAll: boolean;
145
+ idKey: string;
145
146
  virtualScroll: boolean;
146
147
  itemHeight: number;
147
148
  buffer: number;
@@ -152,7 +153,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
152
153
  parentKey: string;
153
154
  expandedByDefault: boolean;
154
155
  treeColumnIndex: number;
155
- idKey: string;
156
156
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
157
157
  declare const _default: typeof __VLS_export;
158
158
  export default _default;
@@ -142,6 +142,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
142
142
  bulkActions: import("@katlux/providers").IKDatatableAction[];
143
143
  selectedRows: any[];
144
144
  selectAll: boolean;
145
+ idKey: string;
145
146
  virtualScroll: boolean;
146
147
  itemHeight: number;
147
148
  buffer: number;
@@ -152,7 +153,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
152
153
  parentKey: string;
153
154
  expandedByDefault: boolean;
154
155
  treeColumnIndex: number;
155
- idKey: string;
156
156
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
157
157
  declare const _default: typeof __VLS_export;
158
158
  export default _default;
@@ -11,6 +11,7 @@ export interface IUseDataProviderOptions<TRow = any> {
11
11
  export interface IUseDataProviderReturn<T = TDataRow> {
12
12
  rawProvider: any;
13
13
  pageData: Ref<T[]>;
14
+ virtualRows: Ref<T[]>;
14
15
  rowCount: Ref<number>;
15
16
  currentPage: Ref<number>;
16
17
  pageSize: Ref<number>;
@@ -15,6 +15,22 @@ export function useDataProvider(provider, options) {
15
15
  const pageData = shallowRef(
16
16
  activeProvider ? activeProvider.pageData?.value !== void 0 ? activeProvider.pageData.value : Array.isArray(activeProvider.pageData) ? activeProvider.pageData : extractVal(activeProvider.pageData, []) : []
17
17
  );
18
+ const getFullData = () => {
19
+ if (!activeProvider) return [];
20
+ if (Array.isArray(activeProvider.allVisibleRows) && activeProvider.allVisibleRows.length > 0) return activeProvider.allVisibleRows;
21
+ if (Array.isArray(activeProvider.allVisibleRows?.value) && activeProvider.allVisibleRows.value.length > 0) return activeProvider.allVisibleRows.value;
22
+ if (Array.isArray(activeProvider.rowMap) && activeProvider.rowMap.length > 0) return activeProvider.rowMap;
23
+ if (Array.isArray(activeProvider.rowMap?.value) && activeProvider.rowMap.value.length > 0) return activeProvider.rowMap.value;
24
+ if (Array.isArray(activeProvider.allVisibleNodes) && activeProvider.allVisibleNodes.length > 0) return activeProvider.allVisibleNodes;
25
+ if (Array.isArray(activeProvider.allVisibleNodes?.value) && activeProvider.allVisibleNodes.value.length > 0) return activeProvider.allVisibleNodes.value;
26
+ if (Array.isArray(activeProvider.allData) && activeProvider.allData.length > 0) return activeProvider.allData;
27
+ if (Array.isArray(activeProvider.allData?.value) && activeProvider.allData.value.length > 0) return activeProvider.allData.value;
28
+ if (Array.isArray(activeProvider.data) && activeProvider.data.length > 0) return activeProvider.data;
29
+ if (Array.isArray(activeProvider.rowMap)) return activeProvider.rowMap;
30
+ if (Array.isArray(activeProvider.allVisibleRows)) return activeProvider.allVisibleRows;
31
+ return pageData.value;
32
+ };
33
+ const virtualRows = shallowRef(activeProvider ? getFullData() : []);
18
34
  const rowCount = ref(activeProvider ? extractVal(activeProvider.rowCount, 0) : 0);
19
35
  const currentPage = options?.currentPage || ref(activeProvider ? extractVal(activeProvider.currentPage, 1) : 1);
20
36
  const pageSize = options?.pageSize || ref(activeProvider ? extractVal(activeProvider.pageSize, 10) : 10);
@@ -30,6 +46,7 @@ export function useDataProvider(provider, options) {
30
46
  const syncFromProvider = () => {
31
47
  if (!activeProvider) {
32
48
  pageData.value = [];
49
+ virtualRows.value = [];
33
50
  rowCount.value = 0;
34
51
  currentPage.value = 1;
35
52
  pageSize.value = 10;
@@ -46,6 +63,7 @@ export function useDataProvider(provider, options) {
46
63
  try {
47
64
  pageData.value = activeProvider.pageData?.value !== void 0 ? activeProvider.pageData.value : Array.isArray(activeProvider.pageData) ? activeProvider.pageData : extractVal(activeProvider.pageData, []);
48
65
  rowCount.value = extractVal(activeProvider.rowCount, 0);
66
+ virtualRows.value = getFullData();
49
67
  const newPage = extractVal(activeProvider.currentPage, 1);
50
68
  if (currentPage.value !== newPage) {
51
69
  currentPage.value = newPage;
@@ -93,6 +111,7 @@ export function useDataProvider(provider, options) {
93
111
  }
94
112
  };
95
113
  attachListener();
114
+ syncFromProvider();
96
115
  try {
97
116
  onScopeDispose(() => {
98
117
  if (unsubscribe) {
@@ -320,6 +339,7 @@ export function useDataProvider(provider, options) {
320
339
  return activeProvider;
321
340
  },
322
341
  pageData,
342
+ virtualRows,
323
343
  rowCount,
324
344
  currentPage,
325
345
  pageSize,
@@ -13,6 +13,7 @@ export declare const useFilterLogic: () => {
13
13
  idKey: string;
14
14
  parentKey: string;
15
15
  };
16
+ rowEvaluator?: (row: any) => boolean;
16
17
  }) => {
17
18
  results: any[];
18
19
  expandedNodes?: Set<string | number>;
@@ -112,6 +112,8 @@ export interface FieldBinding<T = any> {
112
112
  validation: 'error' | 'warning' | 'success' | null;
113
113
  validationText: string;
114
114
  onBlur: () => void;
115
+ 'aria-invalid'?: boolean;
116
+ 'aria-describedby'?: string;
115
117
  }
116
118
  /**
117
119
  * Schema-based Form Validation Composable
@@ -45,15 +45,28 @@ export function useKatluxForm(options = {}) {
45
45
  const submitCount = ref(0);
46
46
  const isDirty = computed(() => Object.values(dirtyFields.value).some(Boolean));
47
47
  const isValid = computed(() => Object.keys(errors.value).length === 0);
48
+ function registerErrorPaths(errorMap, pathStr, message) {
49
+ if (!pathStr) {
50
+ errorMap[""] = message;
51
+ return;
52
+ }
53
+ errorMap[pathStr] = message;
54
+ const bracketPath = pathStr.replace(/\.(\d+)(?=\.|$)/g, "[$1]");
55
+ if (bracketPath !== pathStr && !errorMap[bracketPath]) {
56
+ errorMap[bracketPath] = message;
57
+ }
58
+ const dotPath = pathStr.replace(/\[(\d+)\]/g, ".$1");
59
+ if (dotPath !== pathStr && !errorMap[dotPath]) {
60
+ errorMap[dotPath] = message;
61
+ }
62
+ }
48
63
  function parseValidationResult(rawResult, schemaType, dataToValidate) {
49
64
  if (schemaType === "standard") {
50
65
  if (rawResult.issues && rawResult.issues.length > 0) {
51
66
  const errorMap = {};
52
67
  for (const issue of rawResult.issues) {
53
68
  const pathStr = issue.path && issue.path.length > 0 ? issue.path.map((seg) => typeof seg === "object" && seg !== null && "key" in seg ? seg.key : seg).join(".") : "";
54
- if (!errorMap[pathStr]) {
55
- errorMap[pathStr] = issue.message;
56
- }
69
+ registerErrorPaths(errorMap, pathStr, issue.message);
57
70
  }
58
71
  return { valid: false, output: dataToValidate, errors: errorMap };
59
72
  }
@@ -64,16 +77,18 @@ export function useKatluxForm(options = {}) {
64
77
  const errorMap = {};
65
78
  for (const issue of rawResult.error.issues) {
66
79
  const pathStr = issue.path ? issue.path.join(".") : "";
67
- if (!errorMap[pathStr]) {
68
- errorMap[pathStr] = issue.message;
69
- }
80
+ registerErrorPaths(errorMap, pathStr, issue.message);
70
81
  }
71
82
  return { valid: false, output: dataToValidate, errors: errorMap };
72
83
  }
73
84
  return { valid: true, output: rawResult.data ?? dataToValidate, errors: {} };
74
85
  }
75
86
  if (schemaType === "custom") {
76
- const errorMap = rawResult || {};
87
+ const errorMap = {};
88
+ const rawErrors = rawResult || {};
89
+ for (const [key, msg] of Object.entries(rawErrors)) {
90
+ registerErrorPaths(errorMap, key, String(msg));
91
+ }
77
92
  const valid = Object.keys(errorMap).length === 0;
78
93
  return { valid, output: dataToValidate, errors: errorMap };
79
94
  }
@@ -109,12 +124,17 @@ export function useKatluxForm(options = {}) {
109
124
  }
110
125
  function applyErrors(targetPath, newErrors) {
111
126
  if (targetPath) {
112
- if (newErrors[targetPath]) {
113
- errors.value = { ...errors.value, [targetPath]: newErrors[targetPath] };
127
+ const bracketPath = targetPath.replace(/\.(\d+)(?=\.|$)/g, "[$1]");
128
+ const dotPath = targetPath.replace(/\[(\d+)\]/g, ".$1");
129
+ const err = newErrors[targetPath] || newErrors[bracketPath] || newErrors[dotPath];
130
+ if (err) {
131
+ errors.value = { ...errors.value, [targetPath]: err };
114
132
  return false;
115
133
  } else {
116
134
  const nextErrors = { ...errors.value };
117
135
  delete nextErrors[targetPath];
136
+ delete nextErrors[bracketPath];
137
+ delete nextErrors[dotPath];
118
138
  errors.value = nextErrors;
119
139
  return true;
120
140
  }
@@ -123,10 +143,17 @@ export function useKatluxForm(options = {}) {
123
143
  return Object.keys(newErrors).length === 0;
124
144
  }
125
145
  }
146
+ let validationSeq = 0;
126
147
  function validate(targetPath) {
148
+ const seq = ++validationSeq;
127
149
  const result = runValidation(values);
128
150
  if (result && typeof result.then === "function") {
129
- return result.then(({ errors: newErrors }) => applyErrors(targetPath, newErrors));
151
+ return result.then(({ errors: newErrors }) => {
152
+ if (seq !== validationSeq) {
153
+ return Object.keys(errors.value).length === 0;
154
+ }
155
+ return applyErrors(targetPath, newErrors);
156
+ });
130
157
  }
131
158
  return applyErrors(targetPath, result.errors);
132
159
  }
@@ -176,9 +203,18 @@ export function useKatluxForm(options = {}) {
176
203
  return getByPath(values, path);
177
204
  },
178
205
  "onUpdate:modelValue": (newVal) => {
179
- const transformed = regOptions.transform ? regOptions.transform(newVal) : newVal;
206
+ let transformed = newVal;
207
+ if (regOptions.transform) {
208
+ if (regOptions.transform === Number) {
209
+ transformed = newVal === "" || newVal === null || newVal === void 0 ? "" : Number(newVal);
210
+ } else {
211
+ transformed = regOptions.transform(newVal);
212
+ }
213
+ }
180
214
  setByPath(values, path, transformed);
181
- dirtyFields.value = { ...dirtyFields.value, [path]: true };
215
+ const initialVal = getByPath(initialValues, path);
216
+ const isFieldDirty = JSON.stringify(transformed) !== JSON.stringify(initialVal);
217
+ dirtyFields.value = { ...dirtyFields.value, [path]: isFieldDirty };
182
218
  const hasActiveError = !!errors.value[path];
183
219
  if (mode === "onChange" || hasActiveError && reValidateMode === "onChange") {
184
220
  validate(path);
@@ -196,6 +232,12 @@ export function useKatluxForm(options = {}) {
196
232
  }
197
233
  return errors.value[path] || "";
198
234
  },
235
+ get "aria-invalid"() {
236
+ return !!errors.value[path];
237
+ },
238
+ get "aria-describedby"() {
239
+ return errors.value[path] ? `${path}-error` : void 0;
240
+ },
199
241
  onBlur: () => {
200
242
  touched.value = { ...touched.value, [path]: true };
201
243
  const hasActiveError = !!errors.value[path];
@@ -221,6 +263,7 @@ export function useKatluxForm(options = {}) {
221
263
  }
222
264
  function handleSubmit(onValid, onInvalid) {
223
265
  return async (event) => {
266
+ if (isSubmitting.value) return;
224
267
  if (event && typeof event.preventDefault === "function") {
225
268
  event.preventDefault();
226
269
  }
@@ -28,7 +28,7 @@ export interface IUseVirtualScrollReturn<T> {
28
28
  viewportHeight: Ref<number>;
29
29
  containerRef: Ref<HTMLElement | null>;
30
30
  onScroll: (e: Event | UIEvent) => void;
31
- scrollToIndex: (index: number, behavior?: ScrollBehavior) => void;
31
+ scrollToIndex: (index: number, behavior?: ScrollBehavior, offset?: number) => void;
32
32
  containerCssVars: ComputedRef<Record<string, string>>;
33
33
  }
34
34
  export declare function useVirtualScroll<T = any>(options: IUseVirtualScrollOptions<T>): IUseVirtualScrollReturn<T>;