@katlux/toolkit 0.1.0-beta.6 → 0.1.0-beta.66

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 (184) hide show
  1. package/dist/compiled/composables/usePresetComponent.mjs +21 -16
  2. package/dist/module.cjs +52 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +52 -0
  5. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +9 -2
  6. package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +11 -12
  7. package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +11 -12
  8. package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +1 -0
  9. package/dist/runtime/components/KCalendar/KCalendar.logic.js +25 -10
  10. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +30 -0
  11. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -1
  12. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +30 -0
  13. package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +17 -0
  14. package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +16 -1
  15. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +75 -8
  16. package/dist/runtime/components/KCombobox/KCombobox.global.vue +18 -4
  17. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +75 -8
  18. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +46 -8
  19. package/dist/runtime/components/KCombobox/KCombobox.logic.js +77 -9
  20. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +169 -0
  21. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +46 -0
  22. package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +169 -0
  23. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +127 -0
  24. package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.js +160 -0
  25. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +1 -1
  26. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +2 -2
  27. package/dist/runtime/components/KDatatable/KDatatable.global.vue +1 -1
  28. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +2 -2
  29. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +95 -8
  30. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +27 -3
  31. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +95 -8
  32. package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +43 -1
  33. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +106 -7
  34. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +84 -8
  35. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +26 -3
  36. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +84 -8
  37. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +38 -1
  38. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +161 -7
  39. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +27 -0
  40. package/dist/runtime/components/KDropdown/KDropdown.global.vue +14 -4
  41. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +27 -0
  42. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +36 -1
  43. package/dist/runtime/components/KDropdown/KDropdown.logic.js +92 -4
  44. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +7 -56
  45. package/dist/runtime/components/KGrid/KGrid.global.vue +9 -2
  46. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +7 -56
  47. package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +41 -0
  48. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue +27 -12
  49. package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +41 -0
  50. package/dist/runtime/components/KHourPicker/KHourPicker.logic.d.ts +26 -3
  51. package/dist/runtime/components/KHourPicker/KHourPicker.logic.js +34 -10
  52. package/dist/runtime/components/KHourSelect/KHourSelect.logic.js +4 -1
  53. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
  54. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
  55. package/dist/runtime/components/KIcon/KIcon.logic.d.ts +1 -1
  56. package/dist/runtime/components/KIcon/KIcon.logic.js +13 -8
  57. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +21 -0
  58. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue +4 -2
  59. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +21 -0
  60. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.d.ts +11 -0
  61. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +9 -0
  62. package/dist/runtime/components/KModal/KModal.global.d.vue.ts +14 -2
  63. package/dist/runtime/components/KModal/KModal.global.vue +5 -1
  64. package/dist/runtime/components/KModal/KModal.global.vue.d.ts +14 -2
  65. package/dist/runtime/components/KModal/KModal.logic.d.ts +10 -2
  66. package/dist/runtime/components/KModal/KModal.logic.js +12 -3
  67. package/dist/runtime/components/KPagination/KPagination.global.vue +1 -1
  68. package/dist/runtime/components/KPanel/KPanel.global.d.vue.ts +5 -28
  69. package/dist/runtime/components/KPanel/KPanel.global.vue +12 -4
  70. package/dist/runtime/components/KPanel/KPanel.global.vue.d.ts +5 -28
  71. package/dist/runtime/components/KPanel/KPanel.logic.d.ts +10 -0
  72. package/dist/runtime/components/KPanel/KPanel.logic.js +8 -0
  73. package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +21 -0
  74. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue +3 -1
  75. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +21 -0
  76. package/dist/runtime/components/KRadiobox/KRadiobox.logic.d.ts +11 -0
  77. package/dist/runtime/components/KRadiobox/KRadiobox.logic.js +9 -0
  78. package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +21 -0
  79. package/dist/runtime/components/KTextarea/KTextarea.global.vue +3 -1
  80. package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +21 -0
  81. package/dist/runtime/components/KTextarea/KTextarea.logic.d.ts +11 -0
  82. package/dist/runtime/components/KTextarea/KTextarea.logic.js +9 -0
  83. package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +35 -2
  84. package/dist/runtime/components/KTextbox/KTextbox.global.vue +7 -4
  85. package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +35 -2
  86. package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +21 -4
  87. package/dist/runtime/components/KTextbox/KTextbox.logic.js +21 -5
  88. package/dist/runtime/components/KToast/KToast.global.d.vue.ts +57 -0
  89. package/dist/runtime/components/KToast/KToast.global.vue +32 -0
  90. package/dist/runtime/components/KToast/KToast.global.vue.d.ts +57 -0
  91. package/dist/runtime/components/KToast/KToast.logic.d.ts +34 -0
  92. package/dist/runtime/components/KToast/KToast.logic.js +47 -0
  93. package/dist/runtime/components/KTree/KTree.logic.d.ts +1 -1
  94. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +63 -5
  95. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +15 -3
  96. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +63 -5
  97. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +37 -5
  98. package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +32 -1
  99. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +5 -5
  100. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +5 -5
  101. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +1 -1
  102. package/dist/runtime/composables/usePresetComponent.d.ts +16 -0
  103. package/dist/runtime/composables/usePresetComponent.js +21 -16
  104. package/dist/runtime/presets/default/assets/scss/css-variables.css +64 -13
  105. package/dist/runtime/presets/default/assets/scss/css-variables.scss +286 -0
  106. package/dist/runtime/presets/default/assets/scss/docs.scss +52 -0
  107. package/dist/runtime/presets/default/assets/scss/index.css +99 -13
  108. package/dist/runtime/presets/default/assets/scss/index.scss +42 -0
  109. package/dist/runtime/presets/default/assets/scss/mixins.scss +94 -0
  110. package/dist/runtime/presets/default/assets/scss/reset.scss +16 -0
  111. package/dist/runtime/presets/default/components/KAccordion/KAccordion.vue +5 -2
  112. package/dist/runtime/presets/default/components/KAccordion/KAccordionItem.vue +40 -37
  113. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +29 -22
  114. package/dist/runtime/presets/default/components/KButton/KButton.vue +147 -428
  115. package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +57 -53
  116. package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +189 -161
  117. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +3 -0
  118. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +59 -42
  119. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +3 -0
  120. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +7 -0
  121. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +108 -79
  122. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +7 -0
  123. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -0
  124. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +79 -61
  125. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -0
  126. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +29 -0
  127. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +202 -0
  128. package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +29 -0
  129. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +40 -31
  130. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +110 -92
  131. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +7 -0
  132. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +58 -25
  133. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +7 -0
  134. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +6 -0
  135. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +81 -52
  136. package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +6 -0
  137. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +10 -0
  138. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +57 -25
  139. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +10 -0
  140. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +337 -241
  141. package/dist/runtime/presets/default/components/KGantt/KGanttRuler.vue +40 -35
  142. package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +170 -140
  143. package/dist/runtime/presets/default/components/KGrid/KGrid.vue +62 -60
  144. package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +8 -2
  145. package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +48 -28
  146. package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +8 -2
  147. package/dist/runtime/presets/default/components/KHourSelect/KHourSelect.vue +34 -28
  148. package/dist/runtime/presets/default/components/KIcon/KIcon.d.vue.ts +1 -1
  149. package/dist/runtime/presets/default/components/KIcon/KIcon.vue +31 -22
  150. package/dist/runtime/presets/default/components/KIcon/KIcon.vue.d.ts +1 -1
  151. package/dist/runtime/presets/default/components/KLoader/KLoader.vue +65 -48
  152. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.d.vue.ts +2 -0
  153. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +117 -84
  154. package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue.d.ts +2 -0
  155. package/dist/runtime/presets/default/components/KModal/KModal.d.vue.ts +2 -0
  156. package/dist/runtime/presets/default/components/KModal/KModal.vue +85 -35
  157. package/dist/runtime/presets/default/components/KModal/KModal.vue.d.ts +2 -0
  158. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +42 -40
  159. package/dist/runtime/presets/default/components/KPanel/KPanel.d.vue.ts +3 -0
  160. package/dist/runtime/presets/default/components/KPanel/KPanel.vue +97 -34
  161. package/dist/runtime/presets/default/components/KPanel/KPanel.vue.d.ts +3 -0
  162. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.d.vue.ts +2 -0
  163. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +40 -35
  164. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue.d.ts +2 -0
  165. package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +158 -125
  166. package/dist/runtime/presets/default/components/KSlider/KSlider.vue +123 -100
  167. package/dist/runtime/presets/default/components/KTabs/KTabItem.vue +40 -37
  168. package/dist/runtime/presets/default/components/KTabs/KTabs.vue +9 -6
  169. package/dist/runtime/presets/default/components/KTextarea/KTextarea.d.vue.ts +2 -0
  170. package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +40 -21
  171. package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue.d.ts +2 -0
  172. package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
  173. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +76 -37
  174. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
  175. package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +17 -0
  176. package/dist/runtime/presets/default/components/KToast/KToast.vue +118 -0
  177. package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +17 -0
  178. package/dist/runtime/presets/default/components/KTree/KTree.vue +103 -80
  179. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.d.vue.ts +6 -0
  180. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +88 -55
  181. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue.d.ts +6 -0
  182. package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +31 -30
  183. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +34 -27
  184. package/package.json +5 -5
@@ -9,35 +9,41 @@
9
9
  ) {{ time }}
10
10
  </template>
11
11
 
12
- <script setup>
13
- const props = defineProps({
14
- timeSlots: { type: Array, required: true },
15
- selectedTime: { type: String, required: true },
16
- selectTime: { type: Function, required: true }
17
- });
12
+ <script lang="ts" setup>
13
+ const props = defineProps<{
14
+ timeSlots: string[]
15
+ selectedTime: string
16
+ selectTime: (time: string) => void
17
+ }>()
18
18
  </script>
19
19
 
20
- <style scoped>
21
- .KHourSelect .time-list {
22
- max-height: 200px;
23
- overflow-y: auto;
24
- border: 1px solid var(--border-color, #ccc);
25
- border-radius: 4px;
26
- }
27
- .KHourSelect .time-list .time-item {
28
- padding: 8px 12px;
29
- cursor: pointer;
30
- transition: background-color 0.2s;
31
- }
32
- .KHourSelect .time-list .time-item:hover {
33
- background-color: var(--hover-bg, #f0f0f0);
34
- }
35
- .KHourSelect .time-list .time-item.selected {
36
- background-color: var(--primary-color, #007bff);
37
- color: var(--primary-text, white);
38
- font-weight: 500;
39
- }
40
- .KHourSelect .time-list .time-item:not(:last-child) {
41
- border-bottom: 1px solid var(--border-light, #e0e0e0);
20
+ <style lang="scss" scoped>
21
+ .KHourSelect {
22
+ .time-list {
23
+ max-height: 200px;
24
+ overflow-y: auto;
25
+ border: 1px solid var(--border-color, #ccc);
26
+ border-radius: 4px;
27
+
28
+ .time-item {
29
+ padding: 8px 12px;
30
+ cursor: pointer;
31
+ transition: background-color 0.2s;
32
+
33
+ &:hover {
34
+ background-color: var(--hover-bg, #f0f0f0);
35
+ }
36
+
37
+ &.selected {
38
+ background-color: var(--primary-color, #007bff);
39
+ color: var(--primary-text, white);
40
+ font-weight: 500;
41
+ }
42
+
43
+ &:not(:last-child) {
44
+ border-bottom: 1px solid var(--border-light, #e0e0e0);
45
+ }
46
+ }
47
+ }
42
48
  }
43
49
  </style>
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  widthPx?: string;
3
3
  heightPx?: string;
4
- iconComponent: any;
4
+ iconComponent: string;
5
5
  rotate: number | string;
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,30 +1,39 @@
1
1
  <template lang="pug">
2
- span.KIcon(:style="{ width: widthPx, height: heightPx }")
3
- component(
4
- v-if="iconComponent"
5
- :is="iconComponent"
6
- :style="{ transform: rotate ? `rotate(${rotate}deg)` : undefined }"
7
- )
2
+ span.KIcon(
3
+ v-if="iconComponent"
4
+ :style="iconStyle"
5
+ v-html="iconComponent"
6
+ )
8
7
  </template>
9
8
 
10
- <script setup>
11
- const props = defineProps({
12
- widthPx: { type: String, required: false },
13
- heightPx: { type: String, required: false },
14
- iconComponent: { type: null, required: true },
15
- rotate: { type: [Number, String], required: true }
16
- });
9
+ <script lang="ts" setup>
10
+ import { computed } from 'vue'
11
+
12
+ const props = defineProps<{
13
+ widthPx?: string
14
+ heightPx?: string
15
+ iconComponent: string
16
+ rotate: number | string
17
+ }>()
18
+
19
+ const iconStyle = computed(() => ({
20
+ width: props.widthPx,
21
+ height: props.heightPx,
22
+ transform: props.rotate ? `rotate(${props.rotate}deg)` : undefined
23
+ }))
17
24
  </script>
18
25
 
19
- <style scoped>
26
+ <style lang="scss" scoped>
20
27
  .KIcon {
21
- display: inline-flex;
22
- align-items: center;
23
- justify-content: center;
24
- line-height: 0;
25
- vertical-align: middle;
26
- }
27
- .KIcon svg {
28
- height: 100%;
28
+ display: inline-flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ line-height: 0;
32
+ vertical-align: middle;
33
+
34
+ :deep(svg) {
35
+ width: 100%;
36
+ height: 100%;
37
+ }
29
38
  }
30
39
  </style>
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  widthPx?: string;
3
3
  heightPx?: string;
4
- iconComponent: any;
4
+ iconComponent: string;
5
5
  rotate: number | string;
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,60 +1,77 @@
1
1
  <template lang="pug">
2
- .KLoader(:class="loaderClasses")
2
+ .KLoader(:class="computedClasses")
3
3
  .KLoader__spinner
4
+ slot
4
5
  </template>
5
6
 
6
- <script setup>
7
- defineProps({
8
- loading: { type: Boolean, required: true },
9
- overlay: { type: Boolean, required: false },
10
- size: { type: String, required: false },
11
- loaderClasses: { type: null, required: false }
12
- });
7
+ <script lang="ts" setup>
8
+ import { computed } from 'vue'
9
+ const props = defineProps<{
10
+ loading: boolean
11
+ overlay?: boolean
12
+ size?: 'small' | 'medium' | 'large'
13
+ loaderClasses?: any
14
+ }>()
15
+
16
+ const computedClasses = computed(() => {
17
+ return {
18
+ 'is-loading': props.loading,
19
+ 'is-overlay': props.overlay,
20
+ [`is-${props.size || 'medium'}`]: true,
21
+ ...props.loaderClasses
22
+ }
23
+ })
13
24
  </script>
14
25
 
15
- <style scoped>
26
+ <style lang="scss" scoped>
16
27
  .KLoader {
17
- display: none;
18
- }
19
- .KLoader.is-loading {
20
- display: flex;
21
- justify-content: center;
22
- align-items: center;
23
- }
24
- .KLoader.is-overlay {
25
- position: absolute;
26
- top: 0;
27
- left: 0;
28
- width: 100%;
29
- height: 100%;
30
- background-color: rgba(255, 255, 255, 0.7);
31
- z-index: 10;
32
- }
33
- .KLoader__spinner {
34
- border: 3px solid var(--border-color-light);
35
- border-top-color: var(--primary-500);
36
- border-radius: 50%;
37
- animation: spin 0.8s linear infinite;
38
- }
39
- .KLoader.is-small .KLoader__spinner {
40
- width: var(--gap-md);
41
- height: var(--gap-md);
42
- border-width: 2px;
43
- }
44
- .KLoader.is-medium .KLoader__spinner {
45
- width: var(--gap-lg);
46
- height: var(--gap-lg);
47
- border-width: 3px;
48
- }
49
- .KLoader.is-large .KLoader__spinner {
50
- width: var(--gap-xl);
51
- height: var(--gap-xl);
52
- border-width: 4px;
28
+ display: none;
29
+
30
+ &.is-loading {
31
+ display: flex;
32
+ justify-content: center;
33
+ align-items: center;
34
+ }
35
+
36
+ &.is-overlay {
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ width: 100%;
41
+ height: 100%;
42
+ background-color: rgba(255, 255, 255, 0.7);
43
+ z-index: 10;
44
+ }
45
+
46
+ &__spinner {
47
+ border: 3px solid var(--border-color-light);
48
+ border-top-color: var(--primary-500);
49
+ border-radius: 50%;
50
+ animation: spin 0.8s linear infinite;
51
+ }
52
+
53
+ &.is-small .KLoader__spinner {
54
+ width: var(--gap-md);
55
+ height: var(--gap-md);
56
+ border-width: 2px;
57
+ }
58
+
59
+ &.is-medium .KLoader__spinner {
60
+ width: var(--gap-lg);
61
+ height: var(--gap-lg);
62
+ border-width: 3px;
63
+ }
64
+
65
+ &.is-large .KLoader__spinner {
66
+ width: var(--gap-xl);
67
+ height: var(--gap-xl);
68
+ border-width: 4px;
69
+ }
53
70
  }
54
71
 
55
72
  @keyframes spin {
56
- to {
57
- transform: rotate(360deg);
58
- }
73
+ to {
74
+ transform: rotate(360deg);
75
+ }
59
76
  }
60
77
  </style>
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  placeholder: string;
4
4
  showClear: boolean;
5
5
  mask: string;
6
+ validation?: 'success' | 'warning' | 'error' | null;
7
+ validationText?: string;
6
8
  };
7
9
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
10
  clear: () => any;
@@ -4,96 +4,129 @@
4
4
  :modelValue="maskedValue"
5
5
  :placeholder="placeholder"
6
6
  :showClear="showClear"
7
+ :clear="handleClear"
7
8
  :maxlength="mask.length"
9
+ :validation="validation"
10
+ :validationText="validationText"
8
11
  @update:modelValue="handleUpdate"
9
12
  @beforeinput="handleBeforeInput"
10
13
  )
11
14
  </template>
12
15
 
13
- <script setup>
14
- import { getMaskPatternDef } from "../../../../components/KMaskTextbox/KMaskTextbox.logic";
15
- const props = defineProps({
16
- maskedValue: { type: String, required: true },
17
- placeholder: { type: String, required: true },
18
- showClear: { type: Boolean, required: true },
19
- mask: { type: String, required: true }
20
- });
21
- const emit = defineEmits(["update:maskedValue", "clear"]);
22
- const handleBeforeInput = (event) => {
23
- if (!event.data || event.inputType !== "insertText") {
24
- return;
25
- }
26
- const char = event.data;
27
- if (!/[0-9]/.test(char)) {
28
- return;
29
- }
30
- const target = event.target;
31
- const cursorPos = target.selectionStart || 0;
32
- const currentValue = target.value;
33
- let maskIdx = 0;
34
- let valIdx = 0;
35
- while (valIdx < cursorPos && maskIdx < props.mask.length) {
36
- const def = getMaskPatternDef(props.mask, maskIdx);
37
- if (def) {
38
- let consumed = 0;
39
- while (consumed < def.length && valIdx < currentValue.length) {
40
- if (def.pattern.test(currentValue[valIdx])) {
41
- consumed++;
42
- }
43
- valIdx++;
44
- if (valIdx >= cursorPos) break;
45
- }
46
- maskIdx += def.length;
47
- } else {
48
- valIdx++;
49
- maskIdx++;
50
- }
51
- }
52
- const patternType = props.mask.substring(maskIdx, maskIdx + 4);
53
- const digit = parseInt(char, 10);
54
- let digitsInPattern = 0;
55
- let scanIdx = cursorPos;
56
- while (scanIdx > 0 && digitsInPattern < 10) {
57
- scanIdx--;
58
- const ch = currentValue[scanIdx];
59
- if (/[0-9]/.test(ch)) {
60
- digitsInPattern++;
61
- } else {
62
- break;
63
- }
64
- }
65
- if (patternType.startsWith("DD")) {
66
- if (digitsInPattern === 0) {
67
- if (digit > 3) event.preventDefault();
68
- } else if (digitsInPattern === 1) {
69
- const firstDigit = parseInt(currentValue[cursorPos - 1], 10);
70
- if (firstDigit === 0 && digit === 0) event.preventDefault();
71
- if (firstDigit === 3 && digit > 1) event.preventDefault();
72
- }
73
- } else if (patternType.startsWith("MM")) {
74
- if (digitsInPattern === 0) {
75
- if (digit > 1) event.preventDefault();
76
- } else if (digitsInPattern === 1) {
77
- const firstDigit = parseInt(currentValue[cursorPos - 1], 10);
78
- if (firstDigit === 0 && digit === 0) event.preventDefault();
79
- if (firstDigit === 1 && digit > 2) event.preventDefault();
80
- }
81
- } else if (patternType.startsWith("HH")) {
82
- if (digitsInPattern === 0) {
83
- if (digit > 2) event.preventDefault();
84
- } else if (digitsInPattern === 1) {
85
- const firstDigit = parseInt(currentValue[cursorPos - 1], 10);
86
- if (firstDigit === 2 && digit > 3) event.preventDefault();
87
- }
88
- } else if (patternType.startsWith("mm") || patternType.startsWith("ss")) {
89
- if (digitsInPattern === 0) {
90
- if (digit > 5) event.preventDefault();
91
- }
92
- }
93
- };
94
- const handleUpdate = (value) => {
95
- emit("update:maskedValue", value);
96
- };
16
+ <script lang="ts" setup>
17
+ import { getMaskPatternDef } from '../../../../components/KMaskTextbox/KMaskTextbox.logic'
18
+
19
+ const props = defineProps<{
20
+ maskedValue: string
21
+ placeholder: string
22
+ showClear: boolean
23
+ mask: string
24
+ validation?: 'success' | 'warning' | 'error' | null
25
+ validationText?: string
26
+ }>()
27
+
28
+ const emit = defineEmits<{
29
+ (e: 'update:maskedValue', value: string): void
30
+ (e: 'clear'): void
31
+ }>()
32
+
33
+ // Use beforeinput for better validation (fires before input is accepted)
34
+ const handleBeforeInput = (event: InputEvent) => {
35
+ if (!event.data || event.inputType !== 'insertText') {
36
+ return // Allow deletions, etc.
37
+ }
38
+
39
+ const char = event.data
40
+ if (!/[0-9]/.test(char)) {
41
+ return // Not a digit, let through for other patterns
42
+ }
43
+
44
+ const target = event.target as HTMLInputElement
45
+ const cursorPos = target.selectionStart || 0
46
+ const currentValue = target.value
47
+
48
+ // Find the mask pattern at cursor position
49
+ let maskIdx = 0
50
+ let valIdx = 0
51
+
52
+ // Walk through to find where we are in the mask
53
+ while (valIdx < cursorPos && maskIdx < props.mask.length) {
54
+ const def = getMaskPatternDef(props.mask, maskIdx)
55
+ if (def) {
56
+ // Pattern - check how many chars it uses in value
57
+ let consumed = 0
58
+ while (consumed < def.length && valIdx < currentValue.length) {
59
+ if (def.pattern.test(currentValue[valIdx])) {
60
+ consumed++
61
+ }
62
+ valIdx++
63
+ if (valIdx >= cursorPos) break
64
+ }
65
+ maskIdx += def.length
66
+ } else {
67
+ // Literal
68
+ valIdx++
69
+ maskIdx++
70
+ }
71
+ }
72
+
73
+ // Get pattern at current position
74
+ const patternType = props.mask.substring(maskIdx, maskIdx + 4)
75
+ const digit = parseInt(char, 10)
76
+
77
+ // Find how many digits already entered for this specific pattern instance
78
+ let digitsInPattern = 0
79
+ let scanIdx = cursorPos
80
+
81
+ // Count backwards to start of this pattern
82
+ while (scanIdx > 0 && digitsInPattern < 10) {
83
+ scanIdx--
84
+ const ch = currentValue[scanIdx]
85
+ if (/[0-9]/.test(ch)) {
86
+ digitsInPattern++
87
+ } else {
88
+ break // Hit a literal, stop
89
+ }
90
+ }
91
+
92
+ // Validate based on pattern
93
+ if (patternType.startsWith('DD')) {
94
+ if (digitsInPattern === 0) {
95
+ if (digit > 3) event.preventDefault()
96
+ } else if (digitsInPattern === 1) {
97
+ const firstDigit = parseInt(currentValue[cursorPos - 1], 10)
98
+ if (firstDigit === 0 && digit === 0) event.preventDefault()
99
+ if (firstDigit === 3 && digit > 1) event.preventDefault()
100
+ }
101
+ } else if (patternType.startsWith('MM')) {
102
+ if (digitsInPattern === 0) {
103
+ if (digit > 1) event.preventDefault()
104
+ } else if (digitsInPattern === 1) {
105
+ const firstDigit = parseInt(currentValue[cursorPos - 1], 10)
106
+ if (firstDigit === 0 && digit === 0) event.preventDefault()
107
+ if (firstDigit === 1 && digit > 2) event.preventDefault()
108
+ }
109
+ } else if (patternType.startsWith('HH')) {
110
+ if (digitsInPattern === 0) {
111
+ if (digit > 2) event.preventDefault()
112
+ } else if (digitsInPattern === 1) {
113
+ const firstDigit = parseInt(currentValue[cursorPos - 1], 10)
114
+ if (firstDigit === 2 && digit > 3) event.preventDefault()
115
+ }
116
+ } else if (patternType.startsWith('mm') || patternType.startsWith('ss')) {
117
+ if (digitsInPattern === 0) {
118
+ if (digit > 5) event.preventDefault()
119
+ }
120
+ }
121
+ }
122
+
123
+ const handleUpdate = (value: string) => {
124
+ emit('update:maskedValue', value)
125
+ }
126
+
127
+ const handleClear = () => {
128
+ emit('clear')
129
+ }
97
130
  </script>
98
131
 
99
132
  <style lang="scss" scoped>
@@ -3,6 +3,8 @@ type __VLS_Props = {
3
3
  placeholder: string;
4
4
  showClear: boolean;
5
5
  mask: string;
6
+ validation?: 'success' | 'warning' | 'error' | null;
7
+ validationText?: string;
6
8
  };
7
9
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
10
  clear: () => any;
@@ -1,5 +1,7 @@
1
1
  type __VLS_Props = {
2
+ modalId: string;
2
3
  opened: boolean;
4
+ closeOnOutsideClick: boolean;
3
5
  closeModal: () => void;
4
6
  };
5
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,42 +1,92 @@
1
1
  <template lang="pug">
2
- .modal(v-if="opened")
3
- .layover(@click.self="closeModal()")
4
- KPanel(no-gap flex-content scrollable).modal-container
5
- template(#header)
6
- slot(name="header")
7
- slot(name="content")
8
- template(#footer)
9
- slot(name="footer")
2
+ dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick" @mousedown="handleMouseDown")
3
+ .modal-portal(:id="modalId" style="position: absolute; top: 0; left: 0; z-index: 2000;")
4
+ KPanel(no-gap flex-content scrollable).modal-container
5
+ template(#header)
6
+ slot(name="header")
7
+ slot(name="content")
8
+ template(#footer)
9
+ slot(name="footer")
10
10
  </template>
11
11
 
12
- <script setup>
13
- const props = defineProps({
14
- opened: { type: Boolean, required: true },
15
- closeModal: { type: Function, required: true }
16
- });
17
- </script>
12
+ <script lang="ts" setup>
13
+ import { ref, watch, onMounted } from 'vue'
14
+
15
+ const props = defineProps<{
16
+ modalId: string
17
+ opened: boolean
18
+ closeOnOutsideClick: boolean
19
+ closeModal: () => void
20
+ }>()
21
+
22
+ const dialogRef = ref<HTMLDialogElement | null>(null)
23
+ let isMouseDownOnBackdrop = false
24
+
25
+ // When your prop changes, trigger the native browser methods to enter/exit the Top Layer
26
+ watch(() => props.opened, (isOpen) => {
27
+ if (!dialogRef.value) return
28
+ if (isOpen) {
29
+ dialogRef.value.showModal()
30
+ } else {
31
+ dialogRef.value.close()
32
+ }
33
+ })
34
+
35
+ // Sync the initial state if the modal was initially rendered as opened
36
+ onMounted(() => {
37
+ if (props.opened && dialogRef.value) {
38
+ dialogRef.value.showModal()
39
+ }
40
+ })
41
+
42
+ const handleMouseDown = (event: MouseEvent) => {
43
+ isMouseDownOnBackdrop = event.target === dialogRef.value
44
+ }
18
45
 
19
- <style scoped>
20
- .modal .layover {
21
- position: fixed;
22
- background-color: var(--modal-overlay-bg);
23
- left: 0px;
24
- right: 0px;
25
- top: 0px;
26
- bottom: 0px;
27
- z-index: 2;
46
+ // Native dialogs require a script trick to close when clicking the ::backdrop pseudo-element
47
+ const handleBackdropClick = (event: MouseEvent) => {
48
+ if (props.closeOnOutsideClick && isMouseDownOnBackdrop && event.target === dialogRef.value) {
49
+ props.closeModal()
50
+ }
51
+ isMouseDownOnBackdrop = false
28
52
  }
29
- .modal .layover .modal-container {
30
- bottom: 0;
31
- max-height: 600px;
32
- height: 80%;
33
- max-width: 700px;
34
- min-width: 500px;
35
- left: 0;
36
- margin: auto;
37
- position: absolute;
38
- right: 0;
39
- top: 0;
40
- z-index: 2;
53
+ </script>
54
+
55
+ <style lang="scss" scoped>
56
+ .k-modal {
57
+ border: none;
58
+ background: transparent;
59
+ padding: 0;
60
+ /* margin: auto applied natively by browsers for showModal */
61
+ overflow: visible;
62
+ max-width: 95vw;
63
+ max-height: 95vh;
64
+ width: fit-content;
65
+ height: fit-content;
66
+
67
+ &:not([open]) {
68
+ display: none;
69
+ }
70
+
71
+ &[open] {
72
+ display: flex;
73
+ flex-direction: column;
74
+ }
75
+
76
+ &::backdrop {
77
+ background-color: var(--modal-overlay-bg);
78
+ backdrop-filter: blur(var(--modal-backdrop-blur));
79
+ }
80
+
81
+ .modal-container {
82
+ flex: 1;
83
+ display: flex;
84
+ flex-direction: column;
85
+ min-height: 0;
86
+ max-height: 100%;
87
+ width: 100%;
88
+ min-width: 400px;
89
+ }
41
90
  }
42
91
  </style>
92
+
@@ -1,5 +1,7 @@
1
1
  type __VLS_Props = {
2
+ modalId: string;
2
3
  opened: boolean;
4
+ closeOnOutsideClick: boolean;
3
5
  closeModal: () => void;
4
6
  };
5
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;