@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.
- package/dist/compiled/composables/usePresetComponent.mjs +21 -16
- package/dist/module.cjs +52 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +52 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +9 -2
- package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +11 -12
- package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +11 -12
- package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +1 -0
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +25 -10
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +30 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +30 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +17 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +16 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +75 -8
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +18 -4
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +75 -8
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +46 -8
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +77 -9
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +169 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +46 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +169 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +127 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.js +160 -0
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +2 -2
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +95 -8
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +27 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +95 -8
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +43 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +106 -7
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +84 -8
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +26 -3
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +84 -8
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +38 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +161 -7
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +27 -0
- package/dist/runtime/components/KDropdown/KDropdown.global.vue +14 -4
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +27 -0
- package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +36 -1
- package/dist/runtime/components/KDropdown/KDropdown.logic.js +92 -4
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +7 -56
- package/dist/runtime/components/KGrid/KGrid.global.vue +9 -2
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +7 -56
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +41 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue +27 -12
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +41 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.d.ts +26 -3
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.js +34 -10
- package/dist/runtime/components/KHourSelect/KHourSelect.logic.js +4 -1
- package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.logic.d.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.logic.js +13 -8
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +21 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue +4 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +21 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.d.ts +11 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +9 -0
- package/dist/runtime/components/KModal/KModal.global.d.vue.ts +14 -2
- package/dist/runtime/components/KModal/KModal.global.vue +5 -1
- package/dist/runtime/components/KModal/KModal.global.vue.d.ts +14 -2
- package/dist/runtime/components/KModal/KModal.logic.d.ts +10 -2
- package/dist/runtime/components/KModal/KModal.logic.js +12 -3
- package/dist/runtime/components/KPagination/KPagination.global.vue +1 -1
- package/dist/runtime/components/KPanel/KPanel.global.d.vue.ts +5 -28
- package/dist/runtime/components/KPanel/KPanel.global.vue +12 -4
- package/dist/runtime/components/KPanel/KPanel.global.vue.d.ts +5 -28
- package/dist/runtime/components/KPanel/KPanel.logic.d.ts +10 -0
- package/dist/runtime/components/KPanel/KPanel.logic.js +8 -0
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +21 -0
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue +3 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +21 -0
- package/dist/runtime/components/KRadiobox/KRadiobox.logic.d.ts +11 -0
- package/dist/runtime/components/KRadiobox/KRadiobox.logic.js +9 -0
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +21 -0
- package/dist/runtime/components/KTextarea/KTextarea.global.vue +3 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +21 -0
- package/dist/runtime/components/KTextarea/KTextarea.logic.d.ts +11 -0
- package/dist/runtime/components/KTextarea/KTextarea.logic.js +9 -0
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +35 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +7 -4
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +35 -2
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +21 -4
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +21 -5
- package/dist/runtime/components/KToast/KToast.global.d.vue.ts +57 -0
- package/dist/runtime/components/KToast/KToast.global.vue +32 -0
- package/dist/runtime/components/KToast/KToast.global.vue.d.ts +57 -0
- package/dist/runtime/components/KToast/KToast.logic.d.ts +34 -0
- package/dist/runtime/components/KToast/KToast.logic.js +47 -0
- package/dist/runtime/components/KTree/KTree.logic.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +63 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +15 -3
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +63 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +37 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +32 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +5 -5
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +5 -5
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +1 -1
- package/dist/runtime/composables/usePresetComponent.d.ts +16 -0
- package/dist/runtime/composables/usePresetComponent.js +21 -16
- package/dist/runtime/presets/default/assets/scss/css-variables.css +64 -13
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +286 -0
- package/dist/runtime/presets/default/assets/scss/docs.scss +52 -0
- package/dist/runtime/presets/default/assets/scss/index.css +99 -13
- package/dist/runtime/presets/default/assets/scss/index.scss +42 -0
- package/dist/runtime/presets/default/assets/scss/mixins.scss +94 -0
- package/dist/runtime/presets/default/assets/scss/reset.scss +16 -0
- package/dist/runtime/presets/default/components/KAccordion/KAccordion.vue +5 -2
- package/dist/runtime/presets/default/components/KAccordion/KAccordionItem.vue +40 -37
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +29 -22
- package/dist/runtime/presets/default/components/KButton/KButton.vue +147 -428
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +57 -53
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +189 -161
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +59 -42
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +7 -0
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +108 -79
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +7 -0
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +79 -61
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +29 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +202 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +29 -0
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +40 -31
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +110 -92
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +7 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +58 -25
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +7 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +6 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +81 -52
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +6 -0
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +10 -0
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +57 -25
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +10 -0
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +337 -241
- package/dist/runtime/presets/default/components/KGantt/KGanttRuler.vue +40 -35
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +170 -140
- package/dist/runtime/presets/default/components/KGrid/KGrid.vue +62 -60
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +8 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +48 -28
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +8 -2
- package/dist/runtime/presets/default/components/KHourSelect/KHourSelect.vue +34 -28
- package/dist/runtime/presets/default/components/KIcon/KIcon.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KIcon/KIcon.vue +31 -22
- package/dist/runtime/presets/default/components/KIcon/KIcon.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +65 -48
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +117 -84
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KModal/KModal.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KModal/KModal.vue +85 -35
- package/dist/runtime/presets/default/components/KModal/KModal.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +42 -40
- package/dist/runtime/presets/default/components/KPanel/KPanel.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KPanel/KPanel.vue +97 -34
- package/dist/runtime/presets/default/components/KPanel/KPanel.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +40 -35
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +158 -125
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +123 -100
- package/dist/runtime/presets/default/components/KTabs/KTabItem.vue +40 -37
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +9 -6
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +40 -21
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +76 -37
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +17 -0
- package/dist/runtime/presets/default/components/KToast/KToast.vue +118 -0
- package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +17 -0
- package/dist/runtime/presets/default/components/KTree/KTree.vue +103 -80
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.d.vue.ts +6 -0
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +88 -55
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue.d.ts +6 -0
- package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +31 -30
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +34 -27
- 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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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:
|
|
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(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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:
|
|
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="
|
|
2
|
+
.KLoader(:class="computedClasses")
|
|
3
3
|
.KLoader__spinner
|
|
4
|
+
slot
|
|
4
5
|
</template>
|
|
5
6
|
|
|
6
|
-
<script setup>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
57
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
const
|
|
95
|
-
|
|
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(
|
|
3
|
-
.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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>;
|