@katlux/toolkit 0.1.1-alpha.145 → 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 (183) hide show
  1. package/bin/ai-init.mjs +517 -0
  2. package/bin/ai-tokens.mjs +212 -54
  3. package/bin/cli.mjs +76 -47
  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.mjs +60 -78
  16. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
  17. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
  18. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
  19. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +4 -2
  20. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +70 -37
  21. package/dist/runtime/components/KButton/KButton.global.d.vue.ts +2 -2
  22. package/dist/runtime/components/KButton/KButton.global.vue.d.ts +2 -2
  23. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  24. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
  25. package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
  26. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
  27. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
  28. package/dist/runtime/components/KCalendar/KCalendar.logic.js +60 -11
  29. package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
  30. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +11 -1
  31. package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
  32. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +19 -3
  33. package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +115 -1
  34. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
  35. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
  36. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
  37. package/dist/runtime/components/KCombobox/KCombobox.global.vue +1 -1
  38. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
  39. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +7 -1
  40. package/dist/runtime/components/KCombobox/KCombobox.logic.js +1 -1
  41. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +2 -2
  42. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +2 -2
  43. package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +5 -0
  44. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +21 -17
  45. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +23 -16
  46. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +21 -17
  47. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +13 -10
  48. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +25 -20
  49. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -13
  50. package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
  51. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -13
  52. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
  53. package/dist/runtime/components/KDatatable/KDatatable.logic.js +26 -19
  54. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +30 -14
  55. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +38 -13
  56. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +30 -14
  57. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +28 -6
  58. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +197 -53
  59. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
  60. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
  61. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
  62. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -6
  63. package/dist/runtime/components/KGantt/KGantt.global.vue +12 -3
  64. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -6
  65. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
  66. package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
  67. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
  68. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
  69. package/dist/runtime/components/KLoader/KLoader.global.vue +2 -0
  70. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
  71. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
  72. package/dist/runtime/components/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
  73. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +22 -0
  74. package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
  75. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
  76. package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
  77. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
  78. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -0
  79. package/dist/runtime/components/KPagination/KPagination.logic.js +57 -5
  80. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
  81. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
  82. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
  83. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
  84. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  85. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  86. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +4 -4
  87. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
  88. package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
  89. package/dist/runtime/components/KTree/KTree.logic.js +16 -12
  90. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +5 -7
  91. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +1 -5
  92. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +5 -7
  93. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +39 -5
  94. package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
  95. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +39 -5
  96. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +23 -3
  97. package/dist/runtime/components/KTreeView/KTreeView.logic.js +76 -6
  98. package/dist/runtime/composables/locales.js +204 -25
  99. package/dist/runtime/composables/useDataProvider.d.ts +5 -3
  100. package/dist/runtime/composables/useDataProvider.js +36 -25
  101. package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
  102. package/dist/runtime/composables/useFilterLogic.js +10 -2
  103. package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
  104. package/dist/runtime/composables/useKatluxForm.js +6 -4
  105. package/dist/runtime/composables/useSortLogic.d.ts +1 -1
  106. package/dist/runtime/composables/useVirtualDataset.d.ts +121 -0
  107. package/dist/runtime/composables/useVirtualDataset.js +689 -0
  108. package/dist/runtime/composables/useVirtualScroll.d.ts +8 -4
  109. package/dist/runtime/composables/useVirtualScroll.js +29 -9
  110. package/dist/runtime/plugins/nuxtCompatPlugin.js +9 -1
  111. package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
  112. package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
  113. package/dist/runtime/presets/default/assets/scss/index.css +3 -0
  114. package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
  115. package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
  116. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
  117. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
  118. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
  119. package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
  120. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
  121. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
  122. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +5 -0
  123. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +33 -2
  124. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +5 -0
  125. package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +7 -1
  126. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +30 -8
  127. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +80 -164
  128. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +30 -8
  129. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +16 -9
  130. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +99 -394
  131. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +16 -9
  132. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
  133. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
  134. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
  135. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -12
  136. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +77 -14
  137. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -12
  138. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +1 -0
  139. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
  140. package/dist/runtime/presets/default/components/KTree/KTree.vue +48 -14
  141. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
  142. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
  143. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
  144. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
  145. package/dist/skills/KATLUX_INDEX.md +9 -6
  146. package/dist/skills/katlux-components/SKILL.md +2 -0
  147. package/dist/skills/katlux-components/components/KBulkActions.md +25 -1
  148. package/dist/skills/katlux-components/components/KCombobox.md +2 -2
  149. package/dist/skills/katlux-components/components/KDataIterator.md +12 -4
  150. package/dist/skills/katlux-components/components/KDatatable.md +38 -0
  151. package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
  152. package/dist/skills/katlux-components/components/KGantt.md +9 -0
  153. package/dist/skills/katlux-components/components/KIcon.md +1 -1
  154. package/dist/skills/katlux-components/components/KLineChart.md +3 -0
  155. package/dist/skills/katlux-components/components/KProductList.md +0 -1
  156. package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
  157. package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
  158. package/dist/skills/katlux-components/components/KTreeView.md +12 -0
  159. package/dist/skills/katlux-config/SKILL.md +19 -8
  160. package/dist/skills/katlux-presets/SKILL.md +121 -1
  161. package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
  162. package/dist/skills/katlux-providers/SKILL.md +7 -5
  163. package/dist/skills/katlux-providers/providers/ADataProvider.md +16 -9
  164. package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
  165. package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
  166. package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
  167. package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
  168. package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
  169. package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
  170. package/dist/skills/katlux-providers/providers/encryption-field-level.md +63 -19
  171. package/dist/skills/katlux-providers/providers/encryption-key-management.md +20 -2
  172. package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
  173. package/dist/skills/katlux-providers/providers/encryption-searchable.md +218 -0
  174. package/dist/skills/katlux-providers/providers/encryption-symmetric.md +25 -1
  175. package/dist/skills/katlux-providers/providers/encryption-threat-model.md +63 -0
  176. package/dist/skills/katlux-providers/providers/encryption.md +26 -1
  177. package/dist/skills/katlux-providers/providers/types.md +3 -1
  178. package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
  179. package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
  180. package/dist/skills/katlux-tokens/SKILL.md +2 -1
  181. package/dist/types.d.mts +1 -1
  182. package/package.json +7 -3
  183. 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
@@ -77,11 +77,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
77
77
  }>, {
78
78
  label: string;
79
79
  disabled: boolean;
80
- value: any;
81
80
  validation: "error" | "success" | "warning" | null | undefined;
82
81
  validationText: string;
83
82
  idKey: string;
84
83
  indeterminate: boolean;
84
+ value: any;
85
85
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
86
86
  declare const _default: typeof __VLS_export;
87
87
  export default _default;
@@ -77,11 +77,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
77
77
  }>, {
78
78
  label: string;
79
79
  disabled: boolean;
80
- value: any;
81
80
  validation: "error" | "success" | "warning" | null | undefined;
82
81
  validationText: string;
83
82
  idKey: string;
84
83
  indeterminate: boolean;
84
+ value: any;
85
85
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
86
86
  declare const _default: typeof __VLS_export;
87
87
  export default _default;
@@ -110,7 +110,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
110
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;
@@ -215,7 +215,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
215
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;
@@ -226,6 +226,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
226
226
  label: string;
227
227
  disabled: boolean;
228
228
  validation: "error" | "success" | "warning" | null | undefined;
229
+ validationText: string;
229
230
  searchbox: boolean;
230
231
  searchtext: string;
231
232
  searchPlaceholder: string;
@@ -236,7 +237,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
236
237
  placeholder: string;
237
238
  teleportTo: string;
238
239
  fullWidth: boolean;
239
- validationText: string;
240
240
  maxHeight: number;
241
241
  closeOnSelect: boolean;
242
242
  multiSelect: boolean;
@@ -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,
@@ -110,7 +110,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
110
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;
@@ -215,7 +215,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
215
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;
@@ -226,6 +226,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
226
226
  label: string;
227
227
  disabled: boolean;
228
228
  validation: "error" | "success" | "warning" | null | undefined;
229
+ validationText: string;
229
230
  searchbox: boolean;
230
231
  searchtext: string;
231
232
  searchPlaceholder: string;
@@ -236,7 +237,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
236
237
  placeholder: string;
237
238
  teleportTo: string;
238
239
  fullWidth: boolean;
239
- validationText: string;
240
240
  maxHeight: number;
241
241
  closeOnSelect: boolean;
242
242
  multiSelect: boolean;
@@ -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;
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
191
191
  modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
192
192
  type: import("./KCompositeInput.logic.js").CompositeInputType;
193
193
  label: string;
194
+ mask: string;
194
195
  validation: "error" | "success" | "warning" | null | undefined;
196
+ validationText: string;
195
197
  searchbox: boolean;
196
198
  labelField: string;
197
199
  placeholder: string;
198
200
  teleportTo: string;
199
- validationText: string;
200
- mask: string;
201
201
  valueField: string;
202
202
  inputType: "number" | "search" | "url" | "text" | "password" | "email" | "tel" | undefined;
203
203
  selectionValue: string | number | Record<string, any> | unknown[];
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
191
191
  modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
192
192
  type: import("./KCompositeInput.logic.js").CompositeInputType;
193
193
  label: string;
194
+ mask: string;
194
195
  validation: "error" | "success" | "warning" | null | undefined;
196
+ validationText: string;
195
197
  searchbox: boolean;
196
198
  labelField: string;
197
199
  placeholder: string;
198
200
  teleportTo: string;
199
- validationText: string;
200
- mask: string;
201
201
  valueField: string;
202
202
  inputType: "number" | "search" | "url" | "text" | "password" | "email" | "tel" | undefined;
203
203
  selectionValue: string | number | Record<string, any> | unknown[];
@@ -113,6 +113,11 @@ export function useKContextMenuLogic(props, emit) {
113
113
  boundElement.addEventListener("contextmenu", onContextMenu);
114
114
  }
115
115
  };
116
+ onMounted(() => {
117
+ nextTick(() => {
118
+ setupTriggerListener();
119
+ });
120
+ });
116
121
  watch(() => [props.target, sourceRef.value, props.x, props.y], () => {
117
122
  setupTriggerListener();
118
123
  });