@katlux/toolkit 0.1.0-beta.6 → 0.1.0-beta.60
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/KButton/KButton.logic.d.ts +1 -1
- 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 +65 -7
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +15 -3
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +65 -7
- 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 +8 -8
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +8 -8
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ref, watch, onMounted } from "vue";
|
|
1
|
+
import { ref, watch, onMounted, onUnmounted, nextTick, inject, computed } from "vue";
|
|
2
|
+
import { KMODAL_PORTAL_ID_KEY } from "../KModal/KModal.logic.js";
|
|
2
3
|
export const KDropdownDefaultProps = {
|
|
3
4
|
isOpen: {
|
|
4
5
|
type: Boolean,
|
|
@@ -7,25 +8,112 @@ export const KDropdownDefaultProps = {
|
|
|
7
8
|
fullWidth: {
|
|
8
9
|
type: Boolean,
|
|
9
10
|
default: false
|
|
11
|
+
},
|
|
12
|
+
anchorEl: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: void 0
|
|
15
|
+
},
|
|
16
|
+
teleportTo: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
align: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "left"
|
|
10
23
|
}
|
|
11
24
|
};
|
|
12
25
|
export function useKDropdownLogic(props, emit) {
|
|
26
|
+
const modalPortalId = inject(KMODAL_PORTAL_ID_KEY, null);
|
|
27
|
+
const isInModal = computed(() => !!modalPortalId?.value);
|
|
28
|
+
const teleportTarget = computed(() => {
|
|
29
|
+
if (props.teleportTo) return props.teleportTo;
|
|
30
|
+
if (isInModal.value && modalPortalId?.value) {
|
|
31
|
+
const targetId = `#${modalPortalId.value}`;
|
|
32
|
+
if (typeof document !== "undefined" && !document.querySelector(targetId)) {
|
|
33
|
+
const activePortal = document.querySelector(".modal-portal");
|
|
34
|
+
if (activePortal && activePortal.id) return `#${activePortal.id}`;
|
|
35
|
+
}
|
|
36
|
+
return targetId;
|
|
37
|
+
}
|
|
38
|
+
return "body";
|
|
39
|
+
});
|
|
13
40
|
const open = ref(false);
|
|
41
|
+
const dropdownRect = ref({ top: 0, left: 0, right: 0, width: 0 });
|
|
14
42
|
const clickoutside = () => {
|
|
15
43
|
open.value = false;
|
|
16
44
|
emit("update:isOpen", open.value);
|
|
17
45
|
};
|
|
46
|
+
const updatePosition = () => {
|
|
47
|
+
try {
|
|
48
|
+
if (props.anchorEl) {
|
|
49
|
+
const el = props.anchorEl.$el || props.anchorEl;
|
|
50
|
+
if (el && typeof el.getBoundingClientRect === "function") {
|
|
51
|
+
const rect = el.getBoundingClientRect();
|
|
52
|
+
if (teleportTarget.value === "body" || teleportTarget.value === void 0) {
|
|
53
|
+
dropdownRect.value = {
|
|
54
|
+
top: rect.bottom + window.scrollY,
|
|
55
|
+
left: rect.left + window.scrollX,
|
|
56
|
+
right: document.documentElement.clientWidth - rect.right + window.scrollX,
|
|
57
|
+
width: rect.width
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
const portalEl = document.querySelector(teleportTarget.value);
|
|
61
|
+
const portalRect = portalEl ? portalEl.getBoundingClientRect() : { top: 0, left: 0 };
|
|
62
|
+
const portalWidth = portalEl ? portalEl.clientWidth : document.documentElement.clientWidth;
|
|
63
|
+
dropdownRect.value = {
|
|
64
|
+
top: rect.bottom - portalRect.top,
|
|
65
|
+
left: rect.left - portalRect.left,
|
|
66
|
+
right: portalWidth - (rect.right - portalRect.left),
|
|
67
|
+
width: rect.width
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error("[KDropdown] Failed to update position", e);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const onScrollResize = () => {
|
|
77
|
+
if (open.value) {
|
|
78
|
+
updatePosition();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
18
81
|
watch(
|
|
19
82
|
() => props.isOpen,
|
|
20
83
|
(newValue) => {
|
|
21
|
-
|
|
84
|
+
if (newValue) {
|
|
85
|
+
updatePosition();
|
|
86
|
+
nextTick(() => {
|
|
87
|
+
open.value = true;
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
open.value = false;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{ immediate: true }
|
|
94
|
+
);
|
|
95
|
+
watch(
|
|
96
|
+
() => props.anchorEl,
|
|
97
|
+
() => {
|
|
98
|
+
if (open.value) {
|
|
99
|
+
updatePosition();
|
|
100
|
+
}
|
|
22
101
|
}
|
|
23
102
|
);
|
|
24
103
|
onMounted(() => {
|
|
25
|
-
|
|
104
|
+
window.addEventListener("scroll", onScrollResize, true);
|
|
105
|
+
window.addEventListener("resize", onScrollResize);
|
|
106
|
+
});
|
|
107
|
+
onUnmounted(() => {
|
|
108
|
+
window.removeEventListener("scroll", onScrollResize, true);
|
|
109
|
+
window.removeEventListener("resize", onScrollResize);
|
|
26
110
|
});
|
|
27
111
|
return {
|
|
28
112
|
open,
|
|
29
|
-
|
|
113
|
+
dropdownRect,
|
|
114
|
+
clickoutside,
|
|
115
|
+
teleportTarget,
|
|
116
|
+
isInModal,
|
|
117
|
+
updatePosition
|
|
30
118
|
};
|
|
31
119
|
}
|
|
@@ -1,60 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
wrap: {
|
|
7
|
-
type: PropType<"wrap" | "nowrap">;
|
|
8
|
-
default: string;
|
|
9
|
-
};
|
|
10
|
-
flexChild: {
|
|
11
|
-
type: BooleanConstructor;
|
|
12
|
-
default: boolean;
|
|
13
|
-
};
|
|
14
|
-
align: {
|
|
15
|
-
type: PropType<"start" | "center" | "end" | "stretch" | "baseline">;
|
|
16
|
-
default: string;
|
|
17
|
-
};
|
|
18
|
-
justify: {
|
|
19
|
-
type: PropType<"start" | "center" | "end" | "space-between" | "around" | "evenly">;
|
|
20
|
-
default: string;
|
|
21
|
-
};
|
|
22
|
-
noGap: {
|
|
23
|
-
type: BooleanConstructor;
|
|
24
|
-
default: boolean;
|
|
25
|
-
};
|
|
26
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
-
direction: {
|
|
28
|
-
type: PropType<"row" | "column">;
|
|
29
|
-
default: string;
|
|
30
|
-
};
|
|
31
|
-
wrap: {
|
|
32
|
-
type: PropType<"wrap" | "nowrap">;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
flexChild: {
|
|
36
|
-
type: BooleanConstructor;
|
|
37
|
-
default: boolean;
|
|
38
|
-
};
|
|
39
|
-
align: {
|
|
40
|
-
type: PropType<"start" | "center" | "end" | "stretch" | "baseline">;
|
|
41
|
-
default: string;
|
|
42
|
-
};
|
|
43
|
-
justify: {
|
|
44
|
-
type: PropType<"start" | "center" | "end" | "space-between" | "around" | "evenly">;
|
|
45
|
-
default: string;
|
|
46
|
-
};
|
|
47
|
-
noGap: {
|
|
48
|
-
type: BooleanConstructor;
|
|
49
|
-
default: boolean;
|
|
50
|
-
};
|
|
51
|
-
}>> & Readonly<{}>, {
|
|
52
|
-
wrap: any;
|
|
53
|
-
direction: any;
|
|
1
|
+
import { type KGridProps } from './KGrid.logic.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
|
+
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
|
+
wrap: "wrap" | "nowrap";
|
|
5
|
+
direction: "row" | "column";
|
|
54
6
|
flexChild: boolean;
|
|
55
|
-
|
|
56
|
-
justify: any;
|
|
7
|
+
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
57
8
|
noGap: boolean;
|
|
58
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
59
10
|
declare const _default: typeof __VLS_export;
|
|
60
11
|
export default _default;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useKGridLogic
|
|
2
|
+
import { useKGridLogic } from "./KGrid.logic";
|
|
3
3
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
import KGridDefault from "../../presets/default/components/KGrid/KGrid.vue";
|
|
6
|
-
const props = defineProps(
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
direction: { type: String, required: false, default: "row" },
|
|
8
|
+
wrap: { type: String, required: false, default: "wrap" },
|
|
9
|
+
flexChild: { type: Boolean, required: false, default: false },
|
|
10
|
+
align: { type: String, required: false, default: "start" },
|
|
11
|
+
justify: { type: String, required: false, default: "start" },
|
|
12
|
+
noGap: { type: Boolean, required: false, default: false }
|
|
13
|
+
});
|
|
7
14
|
const { classes } = useKGridLogic(props);
|
|
8
15
|
const presetComponent = usePresetComponent("KGrid", KGridDefault);
|
|
9
16
|
const templateProps = computed(() => ({
|
|
@@ -1,60 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
wrap: {
|
|
7
|
-
type: PropType<"wrap" | "nowrap">;
|
|
8
|
-
default: string;
|
|
9
|
-
};
|
|
10
|
-
flexChild: {
|
|
11
|
-
type: BooleanConstructor;
|
|
12
|
-
default: boolean;
|
|
13
|
-
};
|
|
14
|
-
align: {
|
|
15
|
-
type: PropType<"start" | "center" | "end" | "stretch" | "baseline">;
|
|
16
|
-
default: string;
|
|
17
|
-
};
|
|
18
|
-
justify: {
|
|
19
|
-
type: PropType<"start" | "center" | "end" | "space-between" | "around" | "evenly">;
|
|
20
|
-
default: string;
|
|
21
|
-
};
|
|
22
|
-
noGap: {
|
|
23
|
-
type: BooleanConstructor;
|
|
24
|
-
default: boolean;
|
|
25
|
-
};
|
|
26
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
-
direction: {
|
|
28
|
-
type: PropType<"row" | "column">;
|
|
29
|
-
default: string;
|
|
30
|
-
};
|
|
31
|
-
wrap: {
|
|
32
|
-
type: PropType<"wrap" | "nowrap">;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
flexChild: {
|
|
36
|
-
type: BooleanConstructor;
|
|
37
|
-
default: boolean;
|
|
38
|
-
};
|
|
39
|
-
align: {
|
|
40
|
-
type: PropType<"start" | "center" | "end" | "stretch" | "baseline">;
|
|
41
|
-
default: string;
|
|
42
|
-
};
|
|
43
|
-
justify: {
|
|
44
|
-
type: PropType<"start" | "center" | "end" | "space-between" | "around" | "evenly">;
|
|
45
|
-
default: string;
|
|
46
|
-
};
|
|
47
|
-
noGap: {
|
|
48
|
-
type: BooleanConstructor;
|
|
49
|
-
default: boolean;
|
|
50
|
-
};
|
|
51
|
-
}>> & Readonly<{}>, {
|
|
52
|
-
wrap: any;
|
|
53
|
-
direction: any;
|
|
1
|
+
import { type KGridProps } from './KGrid.logic.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
|
+
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
|
+
wrap: "wrap" | "nowrap";
|
|
5
|
+
direction: "row" | "column";
|
|
54
6
|
flexChild: boolean;
|
|
55
|
-
|
|
56
|
-
justify: any;
|
|
7
|
+
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
57
8
|
noGap: boolean;
|
|
58
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
59
10
|
declare const _default: typeof __VLS_export;
|
|
60
11
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KHourPickerProps } from './KHourPicker.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
step: {
|
|
3
4
|
type: NumberConstructor;
|
|
@@ -27,8 +28,26 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
28
|
type: BooleanConstructor;
|
|
28
29
|
default: boolean;
|
|
29
30
|
};
|
|
31
|
+
isOpen: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
showClear: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
validation: {
|
|
40
|
+
type: import("vue").PropType<KHourPickerProps["validation"]>;
|
|
41
|
+
default: null;
|
|
42
|
+
validator: (value: string) => boolean;
|
|
43
|
+
};
|
|
44
|
+
validationText: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
30
48
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
49
|
"update:modelValue": (value: string) => any;
|
|
50
|
+
"update:isOpen": (value: boolean) => any;
|
|
32
51
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
52
|
step: {
|
|
34
53
|
type: NumberConstructor;
|
|
@@ -58,12 +77,34 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
77
|
type: BooleanConstructor;
|
|
59
78
|
default: boolean;
|
|
60
79
|
};
|
|
80
|
+
isOpen: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
showClear: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
88
|
+
validation: {
|
|
89
|
+
type: import("vue").PropType<KHourPickerProps["validation"]>;
|
|
90
|
+
default: null;
|
|
91
|
+
validator: (value: string) => boolean;
|
|
92
|
+
};
|
|
93
|
+
validationText: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
default: string;
|
|
96
|
+
};
|
|
61
97
|
}>> & Readonly<{
|
|
62
98
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
99
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
100
|
}>, {
|
|
101
|
+
isOpen: boolean;
|
|
64
102
|
disabled: boolean;
|
|
103
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
104
|
+
validationText: string;
|
|
65
105
|
modelValue: string;
|
|
66
106
|
placeholder: string;
|
|
107
|
+
showClear: boolean;
|
|
67
108
|
format: string;
|
|
68
109
|
step: number;
|
|
69
110
|
startHour: string;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, watch } from "vue";
|
|
3
3
|
import { useKHourPickerLogic, KHourPickerDefaultProps } from "./KHourPicker.logic";
|
|
4
4
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
5
5
|
import KHourPickerDefault from "../../presets/default/components/KHourPicker/KHourPicker.vue";
|
|
6
6
|
const props = defineProps(KHourPickerDefaultProps);
|
|
7
|
-
const emit = defineEmits(["update:modelValue"]);
|
|
7
|
+
const emit = defineEmits(["update:modelValue", "update:isOpen"]);
|
|
8
8
|
const {
|
|
9
9
|
isOpen,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
maskedModel,
|
|
11
|
+
textboxClicked,
|
|
12
12
|
closeDropdown,
|
|
13
|
-
onTimeSelect
|
|
14
|
-
|
|
13
|
+
onTimeSelect,
|
|
14
|
+
clear
|
|
15
|
+
} = useKHourPickerLogic(props);
|
|
15
16
|
const presetComponent = usePresetComponent("KHourPicker", KHourPickerDefault);
|
|
16
17
|
const templateProps = computed(() => ({
|
|
17
|
-
|
|
18
|
+
maskedModel: maskedModel.value,
|
|
18
19
|
isOpen: isOpen.value,
|
|
19
20
|
step: props.step,
|
|
20
21
|
format: props.format,
|
|
@@ -22,19 +23,33 @@ const templateProps = computed(() => ({
|
|
|
22
23
|
endHour: props.endHour,
|
|
23
24
|
placeholder: props.placeholder,
|
|
24
25
|
disabled: props.disabled,
|
|
25
|
-
|
|
26
|
+
showClear: props.showClear,
|
|
27
|
+
textboxClicked,
|
|
26
28
|
closeDropdown,
|
|
27
|
-
onTimeSelect
|
|
29
|
+
onTimeSelect,
|
|
30
|
+
clear,
|
|
31
|
+
validation: props.validation,
|
|
32
|
+
validationText: props.validationText
|
|
28
33
|
}));
|
|
29
|
-
const
|
|
34
|
+
const updateIsOpen = (val) => {
|
|
30
35
|
isOpen.value = val;
|
|
31
36
|
};
|
|
37
|
+
const updateMaskedModel = (val) => {
|
|
38
|
+
maskedModel.value = val;
|
|
39
|
+
};
|
|
40
|
+
watch(maskedModel, (newVal) => {
|
|
41
|
+
emit("update:modelValue", newVal);
|
|
42
|
+
});
|
|
43
|
+
watch(isOpen, (newVal) => {
|
|
44
|
+
emit("update:isOpen", newVal);
|
|
45
|
+
});
|
|
32
46
|
</script>
|
|
33
47
|
|
|
34
48
|
<template lang="pug">
|
|
35
49
|
component(
|
|
36
50
|
:is="presetComponent"
|
|
37
|
-
v-bind="templateProps"
|
|
38
|
-
@update:isOpen="
|
|
51
|
+
v-bind="{...templateProps, ...$attrs}"
|
|
52
|
+
@update:isOpen="updateIsOpen"
|
|
53
|
+
@update:maskedModel="updateMaskedModel"
|
|
39
54
|
)
|
|
40
55
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KHourPickerProps } from './KHourPicker.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
step: {
|
|
3
4
|
type: NumberConstructor;
|
|
@@ -27,8 +28,26 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
28
|
type: BooleanConstructor;
|
|
28
29
|
default: boolean;
|
|
29
30
|
};
|
|
31
|
+
isOpen: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
showClear: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
validation: {
|
|
40
|
+
type: import("vue").PropType<KHourPickerProps["validation"]>;
|
|
41
|
+
default: null;
|
|
42
|
+
validator: (value: string) => boolean;
|
|
43
|
+
};
|
|
44
|
+
validationText: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
30
48
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
49
|
"update:modelValue": (value: string) => any;
|
|
50
|
+
"update:isOpen": (value: boolean) => any;
|
|
32
51
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
52
|
step: {
|
|
34
53
|
type: NumberConstructor;
|
|
@@ -58,12 +77,34 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
77
|
type: BooleanConstructor;
|
|
59
78
|
default: boolean;
|
|
60
79
|
};
|
|
80
|
+
isOpen: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
showClear: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
88
|
+
validation: {
|
|
89
|
+
type: import("vue").PropType<KHourPickerProps["validation"]>;
|
|
90
|
+
default: null;
|
|
91
|
+
validator: (value: string) => boolean;
|
|
92
|
+
};
|
|
93
|
+
validationText: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
default: string;
|
|
96
|
+
};
|
|
61
97
|
}>> & Readonly<{
|
|
62
98
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
99
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
100
|
}>, {
|
|
101
|
+
isOpen: boolean;
|
|
64
102
|
disabled: boolean;
|
|
103
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
104
|
+
validationText: string;
|
|
65
105
|
modelValue: string;
|
|
66
106
|
placeholder: string;
|
|
107
|
+
showClear: boolean;
|
|
67
108
|
format: string;
|
|
68
109
|
step: number;
|
|
69
110
|
startHour: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
1
2
|
export interface KHourPickerProps {
|
|
2
3
|
step?: number;
|
|
3
4
|
format?: string;
|
|
@@ -6,6 +7,10 @@ export interface KHourPickerProps {
|
|
|
6
7
|
modelValue?: string;
|
|
7
8
|
placeholder?: string;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
isOpen?: boolean;
|
|
11
|
+
showClear?: boolean;
|
|
12
|
+
validation?: 'success' | 'warning' | 'error' | null;
|
|
13
|
+
validationText?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const KHourPickerDefaultProps: {
|
|
11
16
|
step: {
|
|
@@ -36,11 +41,29 @@ export declare const KHourPickerDefaultProps: {
|
|
|
36
41
|
type: BooleanConstructor;
|
|
37
42
|
default: boolean;
|
|
38
43
|
};
|
|
44
|
+
isOpen: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
showClear: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
validation: {
|
|
53
|
+
type: PropType<KHourPickerProps["validation"]>;
|
|
54
|
+
default: null;
|
|
55
|
+
validator: (value: string) => boolean;
|
|
56
|
+
};
|
|
57
|
+
validationText: {
|
|
58
|
+
type: StringConstructor;
|
|
59
|
+
default: string;
|
|
60
|
+
};
|
|
39
61
|
};
|
|
40
|
-
export declare function useKHourPickerLogic(props: KHourPickerProps
|
|
62
|
+
export declare function useKHourPickerLogic(props: KHourPickerProps): {
|
|
41
63
|
isOpen: import("vue").Ref<boolean, boolean>;
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
maskedModel: import("vue").Ref<string, string>;
|
|
65
|
+
textboxClicked: () => void;
|
|
44
66
|
closeDropdown: () => void;
|
|
45
67
|
onTimeSelect: (time: string) => void;
|
|
68
|
+
clear: () => void;
|
|
46
69
|
};
|
|
@@ -28,12 +28,29 @@ export const KHourPickerDefaultProps = {
|
|
|
28
28
|
disabled: {
|
|
29
29
|
type: Boolean,
|
|
30
30
|
default: false
|
|
31
|
+
},
|
|
32
|
+
isOpen: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
showClear: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
validation: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: null,
|
|
43
|
+
validator: (value) => [null, "success", "warning", "error"].includes(value)
|
|
44
|
+
},
|
|
45
|
+
validationText: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: ""
|
|
31
48
|
}
|
|
32
49
|
};
|
|
33
|
-
export function useKHourPickerLogic(props
|
|
34
|
-
const isOpen = ref(false);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
50
|
+
export function useKHourPickerLogic(props) {
|
|
51
|
+
const isOpen = ref(props.isOpen || false);
|
|
52
|
+
const maskedModel = ref(props.modelValue || "");
|
|
53
|
+
const textboxClicked = () => {
|
|
37
54
|
if (props.disabled) return;
|
|
38
55
|
isOpen.value = !isOpen.value;
|
|
39
56
|
};
|
|
@@ -41,18 +58,25 @@ export function useKHourPickerLogic(props, emit) {
|
|
|
41
58
|
isOpen.value = false;
|
|
42
59
|
};
|
|
43
60
|
const onTimeSelect = (time) => {
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
maskedModel.value = time;
|
|
62
|
+
closeDropdown();
|
|
63
|
+
};
|
|
64
|
+
const clear = () => {
|
|
65
|
+
maskedModel.value = "";
|
|
46
66
|
closeDropdown();
|
|
47
67
|
};
|
|
48
68
|
watch(() => props.modelValue, (val) => {
|
|
49
|
-
|
|
69
|
+
maskedModel.value = val || "";
|
|
70
|
+
});
|
|
71
|
+
watch(() => props.isOpen, (val) => {
|
|
72
|
+
isOpen.value = !!val;
|
|
50
73
|
});
|
|
51
74
|
return {
|
|
52
75
|
isOpen,
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
maskedModel,
|
|
77
|
+
textboxClicked,
|
|
55
78
|
closeDropdown,
|
|
56
|
-
onTimeSelect
|
|
79
|
+
onTimeSelect,
|
|
80
|
+
clear
|
|
57
81
|
};
|
|
58
82
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, computed } from "vue";
|
|
1
|
+
import { ref, computed, watch } from "vue";
|
|
2
2
|
export const KHourSelectDefaultProps = {
|
|
3
3
|
step: {
|
|
4
4
|
type: Number,
|
|
@@ -61,6 +61,9 @@ export function useKHourSelectLogic(props) {
|
|
|
61
61
|
const selectTime = (time) => {
|
|
62
62
|
selectedTime.value = time;
|
|
63
63
|
};
|
|
64
|
+
watch(() => props.modelValue, (val) => {
|
|
65
|
+
selectedTime.value = val || "";
|
|
66
|
+
});
|
|
64
67
|
return {
|
|
65
68
|
timeSlots,
|
|
66
69
|
selectedTime,
|
|
@@ -33,8 +33,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
33
33
|
default: number;
|
|
34
34
|
};
|
|
35
35
|
}>> & Readonly<{}>, {
|
|
36
|
-
rotate: string | number;
|
|
37
36
|
width: string | number;
|
|
37
|
+
rotate: string | number;
|
|
38
38
|
height: string | number;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
40
|
declare const _default: typeof __VLS_export;
|
|
@@ -33,8 +33,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
33
33
|
default: number;
|
|
34
34
|
};
|
|
35
35
|
}>> & Readonly<{}>, {
|
|
36
|
-
rotate: string | number;
|
|
37
36
|
width: string | number;
|
|
37
|
+
rotate: string | number;
|
|
38
38
|
height: string | number;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
40
|
declare const _default: typeof __VLS_export;
|
|
@@ -25,5 +25,5 @@ export declare const KIconDefaultProps: {
|
|
|
25
25
|
export declare function useKIconLogic(props: KIconProps): {
|
|
26
26
|
widthPx: import("vue").ComputedRef<string | undefined>;
|
|
27
27
|
heightPx: import("vue").ComputedRef<string>;
|
|
28
|
-
iconComponent: import("vue").ComputedRef<
|
|
28
|
+
iconComponent: import("vue").ComputedRef<string | null>;
|
|
29
29
|
};
|
|
@@ -18,20 +18,25 @@ export const KIconDefaultProps = {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
export function useKIconLogic(props) {
|
|
21
|
-
const modules = import.meta.glob("../../presets/default/assets/svg/*.svg", { eager: true });
|
|
21
|
+
const modules = import.meta.glob("../../presets/default/assets/svg/*.svg", { eager: true, as: "raw" });
|
|
22
22
|
const iconMap = {};
|
|
23
23
|
for (const path in modules) {
|
|
24
24
|
const match = path.match(/([^/]+)\.svg$/);
|
|
25
25
|
if (match) {
|
|
26
|
-
iconMap[match[1]] = modules[path]
|
|
26
|
+
iconMap[match[1]] = modules[path];
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const formatSize = (val) => {
|
|
30
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
31
|
+
if (typeof val === "number") return `${val}px`;
|
|
32
|
+
if (typeof val === "string") {
|
|
33
|
+
if (/^\d+$/.test(val)) return `${val}px`;
|
|
34
|
+
return val;
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
};
|
|
38
|
+
const widthPx = computed(() => formatSize(props.width));
|
|
39
|
+
const heightPx = computed(() => formatSize(props.height) || "12px");
|
|
35
40
|
const iconComponent = computed(() => iconMap[props.iconname] || null);
|
|
36
41
|
return {
|
|
37
42
|
widthPx,
|