@katlux/toolkit 0.1.1-alpha.144 → 0.1.1-alpha.146

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 (207) hide show
  1. package/bin/ai-init.mjs +517 -0
  2. package/bin/ai-tokens.mjs +1043 -0
  3. package/bin/cli.mjs +80 -43
  4. package/bin/create-preset.mjs +1 -0
  5. package/bin/preset-contracts.json +2941 -0
  6. package/dist/compiled/composables/locales.mjs +204 -25
  7. package/dist/compiled/composables/useDataProvider.mjs +36 -25
  8. package/dist/compiled/composables/useFilterLogic.mjs +10 -2
  9. package/dist/compiled/composables/useKatluxForm.mjs +6 -4
  10. package/dist/compiled/composables/useVirtualDataset.mjs +689 -0
  11. package/dist/compiled/composables/useVirtualScroll.mjs +29 -9
  12. package/dist/module.cjs +63 -77
  13. package/dist/module.d.cts +5 -0
  14. package/dist/module.d.mts +4 -1
  15. package/dist/module.json +1 -1
  16. package/dist/module.mjs +60 -78
  17. package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +2 -2
  18. package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +2 -2
  19. package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +1 -1
  20. package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +1 -1
  21. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
  22. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
  23. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
  24. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +4 -2
  25. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +70 -37
  26. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +2 -2
  27. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +2 -2
  28. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  29. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
  30. package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
  31. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
  32. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
  33. package/dist/runtime/components/KCalendar/KCalendar.logic.js +60 -11
  34. package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
  35. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +11 -1
  36. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
  37. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +19 -3
  38. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +115 -1
  39. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
  40. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
  41. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +9 -9
  42. package/dist/runtime/components/KCombobox/KCombobox.global.vue +1 -1
  43. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +9 -9
  44. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +7 -1
  45. package/dist/runtime/components/KCombobox/KCombobox.logic.js +1 -1
  46. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +14 -14
  47. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +14 -14
  48. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
  49. package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +5 -0
  50. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +22 -18
  51. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +23 -16
  52. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +22 -18
  53. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +13 -10
  54. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +25 -20
  55. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -13
  56. package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
  57. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -13
  58. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
  59. package/dist/runtime/components/KDatatable/KDatatable.logic.js +26 -19
  60. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +31 -15
  61. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +38 -13
  62. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +31 -15
  63. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +28 -6
  64. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +197 -53
  65. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +3 -3
  66. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +3 -3
  67. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
  68. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
  69. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
  70. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -6
  71. package/dist/runtime/components/KGantt/KGantt.global.vue +12 -3
  72. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -6
  73. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
  74. package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
  75. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
  76. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
  77. package/dist/runtime/components/KHourSelect/KHourSelect.global.d.vue.ts +1 -1
  78. package/dist/runtime/components/KHourSelect/KHourSelect.global.vue.d.ts +1 -1
  79. package/dist/runtime/components/KLoader/KLoader.global.vue +2 -0
  80. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
  81. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
  82. package/dist/runtime/components/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
  83. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +22 -0
  84. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
  85. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +4 -2
  86. package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
  87. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +4 -2
  88. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -0
  89. package/dist/runtime/components/KPagination/KPagination.logic.js +57 -5
  90. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
  91. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
  92. package/dist/runtime/components/KRangeSlider/KRangeSlider.global.d.vue.ts +1 -1
  93. package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue.d.ts +1 -1
  94. package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
  95. package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
  96. package/dist/runtime/components/KTabs/KTabs.global.d.vue.ts +2 -2
  97. package/dist/runtime/components/KTabs/KTabs.global.vue.d.ts +2 -2
  98. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
  99. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
  100. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +3 -3
  101. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +3 -3
  102. package/dist/runtime/components/KToast/KToast.global.d.vue.ts +3 -3
  103. package/dist/runtime/components/KToast/KToast.global.vue.d.ts +3 -3
  104. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  105. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  106. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +7 -7
  107. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +7 -7
  108. package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
  109. package/dist/runtime/components/KTree/KTree.logic.js +16 -12
  110. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +7 -9
  111. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +1 -5
  112. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +7 -9
  113. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +39 -5
  114. package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
  115. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +39 -5
  116. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +23 -3
  117. package/dist/runtime/components/KTreeView/KTreeView.logic.js +76 -6
  118. package/dist/runtime/composables/locales.js +204 -25
  119. package/dist/runtime/composables/useDataProvider.d.ts +5 -3
  120. package/dist/runtime/composables/useDataProvider.js +36 -25
  121. package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
  122. package/dist/runtime/composables/useFilterLogic.js +10 -2
  123. package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
  124. package/dist/runtime/composables/useKatluxForm.js +6 -4
  125. package/dist/runtime/composables/useSortLogic.d.ts +1 -1
  126. package/dist/runtime/composables/useVirtualDataset.d.ts +121 -0
  127. package/dist/runtime/composables/useVirtualDataset.js +689 -0
  128. package/dist/runtime/composables/useVirtualScroll.d.ts +8 -4
  129. package/dist/runtime/composables/useVirtualScroll.js +29 -9
  130. package/dist/runtime/plugins/nuxtCompatPlugin.js +9 -1
  131. package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
  132. package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
  133. package/dist/runtime/presets/default/assets/scss/index.css +3 -0
  134. package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
  135. package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
  136. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
  137. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
  138. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
  139. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  140. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
  141. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  142. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +5 -0
  143. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +33 -2
  144. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +5 -0
  145. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +2 -2
  146. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +2 -2
  147. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +7 -1
  148. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +30 -8
  149. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +80 -164
  150. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +30 -8
  151. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +16 -9
  152. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +99 -394
  153. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +16 -9
  154. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
  155. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
  156. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
  157. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -12
  158. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +77 -14
  159. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -12
  160. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +1 -0
  161. package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +2 -2
  162. package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +2 -2
  163. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +4 -4
  164. package/dist/runtime/presets/default/components/KTree/KTree.vue +48 -14
  165. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +4 -4
  166. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
  167. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
  168. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
  169. package/dist/skills/KATLUX_INDEX.md +9 -6
  170. package/dist/skills/katlux-components/SKILL.md +2 -0
  171. package/dist/skills/katlux-components/components/KBulkActions.md +25 -1
  172. package/dist/skills/katlux-components/components/KCombobox.md +2 -2
  173. package/dist/skills/katlux-components/components/KDataIterator.md +12 -4
  174. package/dist/skills/katlux-components/components/KDatatable.md +38 -0
  175. package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
  176. package/dist/skills/katlux-components/components/KGantt.md +9 -0
  177. package/dist/skills/katlux-components/components/KIcon.md +1 -1
  178. package/dist/skills/katlux-components/components/KLineChart.md +3 -0
  179. package/dist/skills/katlux-components/components/KProductList.md +0 -1
  180. package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
  181. package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
  182. package/dist/skills/katlux-components/components/KTreeView.md +12 -0
  183. package/dist/skills/katlux-config/SKILL.md +19 -8
  184. package/dist/skills/katlux-presets/SKILL.md +121 -1
  185. package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
  186. package/dist/skills/katlux-providers/SKILL.md +7 -5
  187. package/dist/skills/katlux-providers/providers/ADataProvider.md +16 -9
  188. package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
  189. package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
  190. package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
  191. package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
  192. package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
  193. package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
  194. package/dist/skills/katlux-providers/providers/encryption-field-level.md +63 -19
  195. package/dist/skills/katlux-providers/providers/encryption-key-management.md +20 -2
  196. package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
  197. package/dist/skills/katlux-providers/providers/encryption-searchable.md +218 -0
  198. package/dist/skills/katlux-providers/providers/encryption-symmetric.md +25 -1
  199. package/dist/skills/katlux-providers/providers/encryption-threat-model.md +63 -0
  200. package/dist/skills/katlux-providers/providers/encryption.md +26 -1
  201. package/dist/skills/katlux-providers/providers/types.md +3 -1
  202. package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
  203. package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
  204. package/dist/skills/katlux-tokens/SKILL.md +2 -1
  205. package/dist/types.d.mts +1 -1
  206. package/package.json +9 -3
  207. package/bin/add-ai-reference.mjs +0 -259
@@ -23,12 +23,16 @@ export const KCalendarDefaultProps = {
23
23
  required: false
24
24
  },
25
25
  selectedDay: {
26
- type: [Date, String],
26
+ type: [Date, String, Array],
27
27
  default: null
28
28
  },
29
29
  modelValue: {
30
- type: [Date, String],
30
+ type: [Date, String, Array],
31
31
  default: void 0
32
+ },
33
+ range: {
34
+ type: Boolean,
35
+ default: false
32
36
  }
33
37
  };
34
38
  export function useKCalendarLogic(props, emit) {
@@ -41,7 +45,9 @@ export function useKCalendarLogic(props, emit) {
41
45
  const activeDate = ref(/* @__PURE__ */ new Date());
42
46
  function initViewFromDate(dateInput) {
43
47
  if (!dateInput) return false;
44
- const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
48
+ const target = Array.isArray(dateInput) ? dateInput[0] : dateInput;
49
+ if (!target) return false;
50
+ const date = typeof target === "string" ? new Date(target) : target;
45
51
  if (!isNaN(date.getTime())) {
46
52
  actualMonth.value = date.getMonth() + 1;
47
53
  actualYear.value = date.getFullYear();
@@ -50,20 +56,35 @@ export function useKCalendarLogic(props, emit) {
50
56
  }
51
57
  return false;
52
58
  }
59
+ const hoverDate = ref(null);
60
+ const onDayHover = (date) => {
61
+ hoverDate.value = date;
62
+ };
53
63
  watch(
54
64
  () => props.day,
55
65
  (newVal) => {
56
66
  if (!newVal) return;
57
- initViewFromDate(newVal);
67
+ if (Array.isArray(newVal)) {
68
+ if (newVal[0]) initViewFromDate(newVal[0]);
69
+ } else {
70
+ initViewFromDate(newVal);
71
+ }
58
72
  },
59
73
  { immediate: true }
60
74
  );
61
75
  watch(
62
76
  () => props.modelValue !== void 0 ? props.modelValue : props.selectedDay,
63
77
  (newValue) => {
64
- monthSelectedDay.value = newValue ?? "";
65
- if (!props.day && actualYear.value === void 0) {
66
- initViewFromDate(newValue);
78
+ if (props.range && Array.isArray(newValue)) {
79
+ monthSelectedDay.value = newValue;
80
+ if (newValue[0] && !props.day && actualYear.value === void 0) {
81
+ initViewFromDate(newValue[0]);
82
+ }
83
+ } else {
84
+ monthSelectedDay.value = newValue ?? "";
85
+ if (!props.day && actualYear.value === void 0 && newValue) {
86
+ initViewFromDate(newValue);
87
+ }
67
88
  }
68
89
  },
69
90
  { immediate: true }
@@ -79,7 +100,12 @@ export function useKCalendarLogic(props, emit) {
79
100
  { flush: "sync" }
80
101
  );
81
102
  onMounted(() => {
82
- monthSelectedDay.value = (props.modelValue !== void 0 ? props.modelValue : props.selectedDay) || "";
103
+ const initVal = props.modelValue !== void 0 ? props.modelValue : props.selectedDay;
104
+ if (props.range && Array.isArray(initVal)) {
105
+ monthSelectedDay.value = initVal;
106
+ } else {
107
+ monthSelectedDay.value = initVal || "";
108
+ }
83
109
  if (actualYear.value === void 0) {
84
110
  const now = /* @__PURE__ */ new Date();
85
111
  actualMonth.value = now.getMonth() + 1;
@@ -163,8 +189,29 @@ export function useKCalendarLogic(props, emit) {
163
189
  });
164
190
  }
165
191
  function dayClicked(date) {
166
- monthSelectedDay.value = date;
167
- emit("dayClicked", date, getDayMark(date));
192
+ if (props.range) {
193
+ const current = Array.isArray(monthSelectedDay.value) ? monthSelectedDay.value : [];
194
+ if (current.length === 0 || current.length === 2 && current[0] && current[1]) {
195
+ monthSelectedDay.value = [date, null];
196
+ emit("dayClicked", date, getDayMark(date));
197
+ } else {
198
+ let start = current[0];
199
+ let end = date;
200
+ if (end.getTime() < start.getTime()) {
201
+ const tmp = start;
202
+ start = end;
203
+ end = tmp;
204
+ }
205
+ const finalRange = [start, end];
206
+ monthSelectedDay.value = finalRange;
207
+ emit("update:selectedDay", finalRange);
208
+ emit("update:modelValue", finalRange);
209
+ emit("dayClicked", date, getDayMark(date));
210
+ }
211
+ } else {
212
+ monthSelectedDay.value = date;
213
+ emit("dayClicked", date, getDayMark(date));
214
+ }
168
215
  }
169
216
  function goToPrev() {
170
217
  if (props.view === "week") {
@@ -219,6 +266,8 @@ export function useKCalendarLogic(props, emit) {
219
266
  showingYear,
220
267
  getExpandedDefinedDays,
221
268
  getExpandedMarkedDays,
222
- dayClicked
269
+ dayClicked,
270
+ hoverDate,
271
+ onDayHover
223
272
  };
224
273
  }
@@ -25,12 +25,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
25
25
  default: () => never[];
26
26
  };
27
27
  selectedDay: {
28
- type: import("vue").PropType<Date | string>;
28
+ type: import("vue").PropType<Date | string | (Date | string | null)[]>;
29
+ default: null;
30
+ };
31
+ range: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ hoverDate: {
36
+ type: import("vue").PropType<Date | null>;
29
37
  default: null;
30
38
  };
31
39
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
32
- "update:selectedDay": (value: string | Date) => any;
40
+ "update:selectedDay": (value: string | Date | (string | Date | null)[]) => any;
33
41
  dayClicked: (value: string | Date) => any;
42
+ dayHover: (value: Date | null) => any;
34
43
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
35
44
  month: {
36
45
  type: NumberConstructor;
@@ -58,16 +67,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
58
67
  default: () => never[];
59
68
  };
60
69
  selectedDay: {
61
- type: import("vue").PropType<Date | string>;
70
+ type: import("vue").PropType<Date | string | (Date | string | null)[]>;
71
+ default: null;
72
+ };
73
+ range: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ hoverDate: {
78
+ type: import("vue").PropType<Date | null>;
62
79
  default: null;
63
80
  };
64
81
  }>> & Readonly<{
65
- "onUpdate:selectedDay"?: ((value: string | Date) => any) | undefined;
82
+ "onUpdate:selectedDay"?: ((value: string | Date | (string | Date | null)[]) => any) | undefined;
66
83
  onDayClicked?: ((value: string | Date) => any) | undefined;
84
+ onDayHover?: ((value: Date | null) => any) | undefined;
67
85
  }>, {
86
+ range: boolean;
87
+ hoverDate: Date | null;
68
88
  definedDays: import("./types.js").IDefinedDay[];
69
89
  markedDays: import("./types.js").IMarkedDay[];
70
- selectedDay: string | Date;
90
+ selectedDay: string | Date | (string | Date | null)[];
71
91
  startingWeekday: string;
72
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
73
93
  declare const _default: typeof __VLS_export;
@@ -4,12 +4,17 @@ import { usePresetComponent } from "../../composables/usePresetComponent";
4
4
  import { computed } from "vue";
5
5
  import KCalendarMonthDefault from "../../presets/default/components/KCalendar/KCalendarMonth.vue";
6
6
  const props = defineProps(KCalendarMonthDefaultProps);
7
- const emit = defineEmits(["update:selectedDay", "dayClicked"]);
7
+ const emit = defineEmits(["update:selectedDay", "dayClicked", "dayHover"]);
8
8
  const {
9
9
  weekdays,
10
10
  calendarDays,
11
11
  isMarked,
12
12
  isSelectedDay,
13
+ isRangeStart,
14
+ isRangeEnd,
15
+ isInRange,
16
+ onDayHover,
17
+ onDayKeyDown,
13
18
  getMarkedDayClass,
14
19
  selectDay,
15
20
  getCalendarDaysData
@@ -22,6 +27,11 @@ const templateProps = computed(() => ({
22
27
  calendarDays: calendarDays.value,
23
28
  isMarked,
24
29
  isSelectedDay,
30
+ isRangeStart,
31
+ isRangeEnd,
32
+ isInRange,
33
+ onDayHover,
34
+ onDayKeyDown,
25
35
  getMarkedDayClass,
26
36
  selectDay,
27
37
  getCalendarDaysData
@@ -25,12 +25,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
25
25
  default: () => never[];
26
26
  };
27
27
  selectedDay: {
28
- type: import("vue").PropType<Date | string>;
28
+ type: import("vue").PropType<Date | string | (Date | string | null)[]>;
29
+ default: null;
30
+ };
31
+ range: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ hoverDate: {
36
+ type: import("vue").PropType<Date | null>;
29
37
  default: null;
30
38
  };
31
39
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
32
- "update:selectedDay": (value: string | Date) => any;
40
+ "update:selectedDay": (value: string | Date | (string | Date | null)[]) => any;
33
41
  dayClicked: (value: string | Date) => any;
42
+ dayHover: (value: Date | null) => any;
34
43
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
35
44
  month: {
36
45
  type: NumberConstructor;
@@ -58,16 +67,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
58
67
  default: () => never[];
59
68
  };
60
69
  selectedDay: {
61
- type: import("vue").PropType<Date | string>;
70
+ type: import("vue").PropType<Date | string | (Date | string | null)[]>;
71
+ default: null;
72
+ };
73
+ range: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ hoverDate: {
78
+ type: import("vue").PropType<Date | null>;
62
79
  default: null;
63
80
  };
64
81
  }>> & Readonly<{
65
- "onUpdate:selectedDay"?: ((value: string | Date) => any) | undefined;
82
+ "onUpdate:selectedDay"?: ((value: string | Date | (string | Date | null)[]) => any) | undefined;
66
83
  onDayClicked?: ((value: string | Date) => any) | undefined;
84
+ onDayHover?: ((value: Date | null) => any) | undefined;
67
85
  }>, {
86
+ range: boolean;
87
+ hoverDate: Date | null;
68
88
  definedDays: import("./types.js").IDefinedDay[];
69
89
  markedDays: import("./types.js").IMarkedDay[];
70
- selectedDay: string | Date;
90
+ selectedDay: string | Date | (string | Date | null)[];
71
91
  startingWeekday: string;
72
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
73
93
  declare const _default: typeof __VLS_export;
@@ -7,11 +7,14 @@ export interface KCalendarMonthProps {
7
7
  startingWeekday?: string;
8
8
  definedDays?: IDefinedDay[];
9
9
  markedDays?: IMarkedDay[];
10
- selectedDay?: Date | string;
10
+ selectedDay?: Date | string | (Date | string | null)[];
11
+ range?: boolean;
12
+ hoverDate?: Date | null;
11
13
  }
12
14
  export interface KCalendarMonthEmits {
13
- (e: 'update:selectedDay', value: Date | string): void;
15
+ (e: 'update:selectedDay', value: Date | string | (Date | string | null)[]): void;
14
16
  (e: 'dayClicked', value: Date | string): void;
17
+ (e: 'dayHover', value: Date | null): void;
15
18
  }
16
19
  export declare const KCalendarMonthDefaultProps: {
17
20
  month: {
@@ -40,7 +43,15 @@ export declare const KCalendarMonthDefaultProps: {
40
43
  default: () => never[];
41
44
  };
42
45
  selectedDay: {
43
- type: PropType<Date | string>;
46
+ type: PropType<Date | string | (Date | string | null)[]>;
47
+ default: null;
48
+ };
49
+ range: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ hoverDate: {
54
+ type: PropType<Date | null>;
44
55
  default: null;
45
56
  };
46
57
  };
@@ -49,6 +60,11 @@ export declare function useKCalendarMonthLogic(props: KCalendarMonthProps, emit:
49
60
  calendarDays: import("vue").ComputedRef<(string | number)[]>;
50
61
  isMarked: (day: number | string) => boolean;
51
62
  isSelectedDay: (day: number) => boolean;
63
+ isRangeStart: (day: number) => boolean;
64
+ isRangeEnd: (day: number) => boolean;
65
+ isInRange: (day: number) => boolean;
66
+ onDayHover: (day: number | string) => void;
67
+ onDayKeyDown: (e: KeyboardEvent, day: number) => void;
52
68
  getMarkedDayClass: (day: number) => string;
53
69
  selectDay: (day: number | string) => void;
54
70
  getCalendarDaysData: (day: number) => IMarkedDay[];
@@ -28,7 +28,15 @@ export const KCalendarMonthDefaultProps = {
28
28
  default: () => []
29
29
  },
30
30
  selectedDay: {
31
- type: [Date, String],
31
+ type: [Date, String, Array],
32
+ default: null
33
+ },
34
+ range: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ hoverDate: {
39
+ type: [Date, Object],
32
40
  default: null
33
41
  }
34
42
  };
@@ -86,11 +94,112 @@ export function useKCalendarMonthLogic(props, emit) {
86
94
  return date.getDate() === day && date.getMonth() + 1 === props.month && date.getFullYear() === props.year;
87
95
  });
88
96
  }
97
+ function isSameDay(a, b) {
98
+ const da = a instanceof Date ? a : new Date(a);
99
+ const db = b instanceof Date ? b : new Date(b);
100
+ if (isNaN(da.getTime()) || isNaN(db.getTime())) return false;
101
+ return da.getFullYear() === db.getFullYear() && da.getMonth() === db.getMonth() && da.getDate() === db.getDate();
102
+ }
89
103
  function isSelectedDay(day) {
90
104
  if (!props.selectedDay || !day) return false;
105
+ if (Array.isArray(props.selectedDay)) {
106
+ const [d1, d2] = props.selectedDay;
107
+ const cur = new Date(props.year, props.month - 1, day);
108
+ const isD1 = d1 ? isSameDay(cur, d1) : false;
109
+ const isD2 = d2 ? isSameDay(cur, d2) : false;
110
+ return isD1 || isD2;
111
+ }
91
112
  const selected = typeof props.selectedDay === "string" ? new Date(props.selectedDay) : props.selectedDay;
92
113
  return selected.getDate() === day && selected.getMonth() + 1 === props.month && selected.getFullYear() === props.year;
93
114
  }
115
+ function isRangeStart(day) {
116
+ if (!props.range || !props.selectedDay || !day) return false;
117
+ if (Array.isArray(props.selectedDay)) {
118
+ const [d1, d2] = props.selectedDay;
119
+ if (!d1) return false;
120
+ const cur = new Date(props.year, props.month - 1, day);
121
+ if (d1 && d2) {
122
+ const start = new Date(d1).getTime() <= new Date(d2).getTime() ? d1 : d2;
123
+ return isSameDay(cur, start);
124
+ }
125
+ return isSameDay(cur, d1);
126
+ }
127
+ return false;
128
+ }
129
+ function isRangeEnd(day) {
130
+ if (!props.range || !props.selectedDay || !day) return false;
131
+ if (Array.isArray(props.selectedDay)) {
132
+ const [d1, d2] = props.selectedDay;
133
+ const cur = new Date(props.year, props.month - 1, day);
134
+ if (d1 && d2) {
135
+ const end = new Date(d1).getTime() <= new Date(d2).getTime() ? d2 : d1;
136
+ return isSameDay(cur, end);
137
+ }
138
+ if (d1 && !d2 && props.hoverDate) {
139
+ if (new Date(props.hoverDate).getTime() >= new Date(d1).getTime()) {
140
+ return isSameDay(cur, props.hoverDate);
141
+ }
142
+ }
143
+ }
144
+ return false;
145
+ }
146
+ function isInRange(day) {
147
+ if (!props.range || !props.selectedDay || !day) return false;
148
+ if (Array.isArray(props.selectedDay)) {
149
+ const [d1, d2] = props.selectedDay;
150
+ let start = d1 ? d1 instanceof Date ? d1 : new Date(d1) : null;
151
+ let end = d2 ? d2 instanceof Date ? d2 : new Date(d2) : null;
152
+ if (start && !end && props.hoverDate) {
153
+ end = props.hoverDate instanceof Date ? props.hoverDate : new Date(props.hoverDate);
154
+ }
155
+ if (!start || !end) return false;
156
+ let minTime = new Date(start.getFullYear(), start.getMonth(), start.getDate()).getTime();
157
+ let maxTime = new Date(end.getFullYear(), end.getMonth(), end.getDate()).getTime();
158
+ if (minTime > maxTime) {
159
+ const tmp = minTime;
160
+ minTime = maxTime;
161
+ maxTime = tmp;
162
+ }
163
+ const curTime = new Date(props.year, props.month - 1, day).getTime();
164
+ return curTime > minTime && curTime < maxTime;
165
+ }
166
+ return false;
167
+ }
168
+ function onDayHover(day) {
169
+ if (!props.range) return;
170
+ if (!day) {
171
+ emit("dayHover", null);
172
+ return;
173
+ }
174
+ const dayNum = typeof day === "number" ? day : parseInt(day, 10);
175
+ if (isNaN(dayNum) || dayNum <= 0) {
176
+ emit("dayHover", null);
177
+ return;
178
+ }
179
+ const date = new Date(props.year, props.month - 1, dayNum);
180
+ emit("dayHover", date);
181
+ }
182
+ function onDayKeyDown(e, day) {
183
+ if (e.key === "Enter" || e.key === " ") {
184
+ e.preventDefault();
185
+ selectDay(day);
186
+ return;
187
+ }
188
+ let targetDay = null;
189
+ if (e.key === "ArrowLeft") targetDay = day - 1;
190
+ else if (e.key === "ArrowRight") targetDay = day + 1;
191
+ else if (e.key === "ArrowUp") targetDay = day - 7;
192
+ else if (e.key === "ArrowDown") targetDay = day + 7;
193
+ if (targetDay !== null) {
194
+ e.preventDefault();
195
+ const daysInMonth = new Date(props.year, props.month, 0).getDate();
196
+ if (targetDay >= 1 && targetDay <= daysInMonth) {
197
+ const container = e.currentTarget?.parentElement;
198
+ const el = container?.querySelector(`[data-day="${targetDay}"]`);
199
+ el?.focus();
200
+ }
201
+ }
202
+ }
94
203
  function getMarkedDayClass(day) {
95
204
  const markedDays = getCalendarDaysData(day);
96
205
  if (!markedDays.length) return "";
@@ -118,6 +227,11 @@ export function useKCalendarMonthLogic(props, emit) {
118
227
  calendarDays,
119
228
  isMarked,
120
229
  isSelectedDay,
230
+ isRangeStart,
231
+ isRangeEnd,
232
+ isInRange,
233
+ onDayHover,
234
+ onDayKeyDown,
121
235
  getMarkedDayClass,
122
236
  selectDay,
123
237
  getCalendarDaysData
@@ -71,13 +71,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
71
71
  type: import("vue").PropType<any>;
72
72
  };
73
73
  }>> & Readonly<{
74
- onBlur?: ((event: FocusEvent) => any) | undefined;
75
74
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
75
+ onBlur?: ((event: FocusEvent) => any) | undefined;
76
76
  "onUpdate:indeterminate"?: ((value: boolean) => any) | undefined;
77
77
  }>, {
78
78
  label: string;
79
79
  disabled: boolean;
80
- validation: "success" | "warning" | "error" | null | undefined;
80
+ validation: "error" | "success" | "warning" | null | undefined;
81
81
  validationText: string;
82
82
  idKey: string;
83
83
  indeterminate: boolean;
@@ -71,13 +71,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
71
71
  type: import("vue").PropType<any>;
72
72
  };
73
73
  }>> & Readonly<{
74
- onBlur?: ((event: FocusEvent) => any) | undefined;
75
74
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
75
+ onBlur?: ((event: FocusEvent) => any) | undefined;
76
76
  "onUpdate:indeterminate"?: ((value: boolean) => any) | undefined;
77
77
  }>, {
78
78
  label: string;
79
79
  disabled: boolean;
80
- validation: "success" | "warning" | "error" | null | undefined;
80
+ validation: "error" | "success" | "warning" | null | undefined;
81
81
  validationText: string;
82
82
  idKey: string;
83
83
  indeterminate: boolean;
@@ -106,11 +106,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
106
106
  toggleDropdown: () => void;
107
107
  closeDropdown: () => void;
108
108
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
109
- blur: (event: FocusEvent) => any;
110
109
  "update:modelValue": (value: any) => any;
110
+ blur: (event: FocusEvent) => any;
111
111
  "update:isOptionsOpen": (value: boolean) => any;
112
112
  "update:searchtext": (value: string) => any;
113
- "scroll-state-change": (state: {
113
+ "update:scrollState": (state: {
114
114
  loadedCount: number;
115
115
  hasMore: boolean;
116
116
  lastAppendedPage: number;
@@ -211,38 +211,38 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
211
211
  default: undefined;
212
212
  };
213
213
  }>> & Readonly<{
214
- onBlur?: ((event: FocusEvent) => any) | undefined;
215
214
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
215
+ onBlur?: ((event: FocusEvent) => any) | undefined;
216
216
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
217
217
  "onUpdate:searchtext"?: ((value: string) => any) | undefined;
218
- "onScroll-state-change"?: ((state: {
218
+ "onUpdate:scrollState"?: ((state: {
219
219
  loadedCount: number;
220
220
  hasMore: boolean;
221
221
  lastAppendedPage: number;
222
222
  totalCount: number;
223
223
  }) => any) | undefined;
224
224
  }>, {
225
- label: string;
226
225
  modelValue: any;
226
+ label: string;
227
227
  disabled: boolean;
228
- validation: "success" | "warning" | "error" | null | undefined;
228
+ validation: "error" | "success" | "warning" | null | undefined;
229
229
  validationText: string;
230
- valueField: string;
231
- placeholder: string;
232
230
  searchbox: boolean;
233
- teleportTo: string;
234
231
  searchtext: string;
235
232
  searchPlaceholder: string;
236
233
  virtualScroll: boolean;
237
234
  itemHeight: number;
238
235
  buffer: number;
239
236
  isOptionsOpen: boolean;
237
+ placeholder: string;
238
+ teleportTo: string;
240
239
  fullWidth: boolean;
241
240
  maxHeight: number;
242
241
  closeOnSelect: boolean;
243
242
  multiSelect: boolean;
244
243
  maxSelectedDisplay: string | number | boolean;
245
244
  visibleFields: String[];
245
+ valueField: string;
246
246
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
247
247
  declare const _default: typeof __VLS_export;
248
248
  export default _default;
@@ -4,7 +4,7 @@ import { usePresetComponent } from "../../composables/usePresetComponent";
4
4
  import { computed, watch } from "vue";
5
5
  import KComboboxDefault from "../../presets/default/components/KCombobox/KCombobox.vue";
6
6
  const props = defineProps(KComboboxDefaultProps);
7
- const emit = defineEmits(["update:modelValue", "update:isOptionsOpen", "update:searchtext", "scroll-state-change", "blur"]);
7
+ const emit = defineEmits(["update:modelValue", "update:isOptionsOpen", "update:searchtext", "update:scrollState", "blur"]);
8
8
  const {
9
9
  selectedItems,
10
10
  isOptionsOpen,
@@ -106,11 +106,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
106
106
  toggleDropdown: () => void;
107
107
  closeDropdown: () => void;
108
108
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
109
- blur: (event: FocusEvent) => any;
110
109
  "update:modelValue": (value: any) => any;
110
+ blur: (event: FocusEvent) => any;
111
111
  "update:isOptionsOpen": (value: boolean) => any;
112
112
  "update:searchtext": (value: string) => any;
113
- "scroll-state-change": (state: {
113
+ "update:scrollState": (state: {
114
114
  loadedCount: number;
115
115
  hasMore: boolean;
116
116
  lastAppendedPage: number;
@@ -211,38 +211,38 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
211
211
  default: undefined;
212
212
  };
213
213
  }>> & Readonly<{
214
- onBlur?: ((event: FocusEvent) => any) | undefined;
215
214
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
215
+ onBlur?: ((event: FocusEvent) => any) | undefined;
216
216
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
217
217
  "onUpdate:searchtext"?: ((value: string) => any) | undefined;
218
- "onScroll-state-change"?: ((state: {
218
+ "onUpdate:scrollState"?: ((state: {
219
219
  loadedCount: number;
220
220
  hasMore: boolean;
221
221
  lastAppendedPage: number;
222
222
  totalCount: number;
223
223
  }) => any) | undefined;
224
224
  }>, {
225
- label: string;
226
225
  modelValue: any;
226
+ label: string;
227
227
  disabled: boolean;
228
- validation: "success" | "warning" | "error" | null | undefined;
228
+ validation: "error" | "success" | "warning" | null | undefined;
229
229
  validationText: string;
230
- valueField: string;
231
- placeholder: string;
232
230
  searchbox: boolean;
233
- teleportTo: string;
234
231
  searchtext: string;
235
232
  searchPlaceholder: string;
236
233
  virtualScroll: boolean;
237
234
  itemHeight: number;
238
235
  buffer: number;
239
236
  isOptionsOpen: boolean;
237
+ placeholder: string;
238
+ teleportTo: string;
240
239
  fullWidth: boolean;
241
240
  maxHeight: number;
242
241
  closeOnSelect: boolean;
243
242
  multiSelect: boolean;
244
243
  maxSelectedDisplay: string | number | boolean;
245
244
  visibleFields: String[];
245
+ valueField: string;
246
246
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
247
247
  declare const _default: typeof __VLS_export;
248
248
  export default _default;
@@ -26,12 +26,18 @@ export interface KComboboxProps {
26
26
  itemHeight?: number;
27
27
  buffer?: number;
28
28
  maxHeight?: number;
29
+ scrollState?: {
30
+ loadedCount: number;
31
+ hasMore: boolean;
32
+ lastAppendedPage: number;
33
+ totalCount: number;
34
+ };
29
35
  }
30
36
  export interface KComboboxEmits {
31
37
  (e: 'update:modelValue', value: any): void;
32
38
  (e: 'update:isOptionsOpen', value: boolean): void;
33
39
  (e: 'update:searchtext', value: string): void;
34
- (e: 'scroll-state-change', state: {
40
+ (e: 'update:scrollState', state: {
35
41
  loadedCount: number;
36
42
  hasMore: boolean;
37
43
  lastAppendedPage: number;
@@ -130,7 +130,7 @@ export function useKComboboxLogic(props, emit) {
130
130
  totalCount: dpRowCount.value ?? 0
131
131
  }));
132
132
  watch(virtualScrollState, (state) => {
133
- emit("scroll-state-change", state);
133
+ emit("update:scrollState", state);
134
134
  }, { deep: true });
135
135
  function getItemKey(item, index) {
136
136
  if (!item) return index;