@katlux/toolkit 0.1.0-beta.44 → 0.1.0-beta.46
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/module.json +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +0 -20
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +0 -12
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +15 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +13 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +15 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +6 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +49 -4
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +45 -8
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +26 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +45 -8
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +16 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +132 -13
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +21 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue +24 -11
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +21 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.d.ts +14 -3
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.js +25 -10
- package/dist/runtime/components/KHourSelect/KHourSelect.logic.js +4 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +3 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +3 -2
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +4 -4
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +3 -3
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +3 -3
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +3 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +3 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +5 -1
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +6 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +23 -13
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +6 -2
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +6 -1
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +2 -2
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, onMounted, computed } from "vue";
|
|
1
|
+
import { ref, watch, onMounted, computed } from "vue";
|
|
2
2
|
export const KDateTimePickerDefaultProps = {
|
|
3
3
|
format: {
|
|
4
4
|
type: String,
|
|
@@ -12,6 +12,18 @@ export const KDateTimePickerDefaultProps = {
|
|
|
12
12
|
type: [Date, String],
|
|
13
13
|
default: void 0
|
|
14
14
|
},
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: [Date, String],
|
|
17
|
+
default: void 0
|
|
18
|
+
},
|
|
19
|
+
isOpen: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
showClear: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
15
27
|
timeStep: {
|
|
16
28
|
type: Number,
|
|
17
29
|
default: 30
|
|
@@ -30,22 +42,91 @@ export function useKDateTimePickerLogic(props) {
|
|
|
30
42
|
const _time = ref("");
|
|
31
43
|
const maskedModel = ref("");
|
|
32
44
|
const calendarShow = ref(false);
|
|
45
|
+
watch(maskedModel, (newVal) => {
|
|
46
|
+
if (newVal === "") {
|
|
47
|
+
if (_date.value !== "") {
|
|
48
|
+
_date.value = "";
|
|
49
|
+
_time.value = "";
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const format = props.format || "MM-DD-YYYY HH:mm";
|
|
54
|
+
let day = "", month = "", year = "", hours = "", minutes = "";
|
|
55
|
+
let rawIdx = 0;
|
|
56
|
+
for (let i = 0; i < format.length; i++) {
|
|
57
|
+
const char = format[i];
|
|
58
|
+
if (char === "M") {
|
|
59
|
+
month += newVal[rawIdx] || "";
|
|
60
|
+
rawIdx++;
|
|
61
|
+
} else if (char === "D") {
|
|
62
|
+
day += newVal[rawIdx] || "";
|
|
63
|
+
rawIdx++;
|
|
64
|
+
} else if (char === "Y") {
|
|
65
|
+
year += newVal[rawIdx] || "";
|
|
66
|
+
rawIdx++;
|
|
67
|
+
} else if (char === "H") {
|
|
68
|
+
hours += newVal[rawIdx] || "";
|
|
69
|
+
rawIdx++;
|
|
70
|
+
} else if (char === "m") {
|
|
71
|
+
minutes += newVal[rawIdx] || "";
|
|
72
|
+
rawIdx++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (month.length === 2 && day.length === 2 && year.length === 4) {
|
|
76
|
+
const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
|
77
|
+
if (hours.length === 2 && minutes.length === 2) {
|
|
78
|
+
d.setHours(parseInt(hours));
|
|
79
|
+
d.setMinutes(parseInt(minutes));
|
|
80
|
+
}
|
|
81
|
+
if (!isNaN(d.getTime())) {
|
|
82
|
+
const oldTime = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value).getTime();
|
|
83
|
+
if (d.getTime() !== oldTime) {
|
|
84
|
+
_date.value = d;
|
|
85
|
+
if (hours.length === 2 && minutes.length === 2) {
|
|
86
|
+
_time.value = `${hours}:${minutes}`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
33
92
|
const textboxClicked = () => {
|
|
34
93
|
calendarShow.value = true;
|
|
35
94
|
};
|
|
36
95
|
const dateSelected = (date) => {
|
|
37
|
-
|
|
96
|
+
const newDate = new Date(date);
|
|
97
|
+
if (_time.value) {
|
|
98
|
+
const [h, m] = _time.value.split(":").map(Number);
|
|
99
|
+
newDate.setHours(h);
|
|
100
|
+
newDate.setMinutes(m);
|
|
101
|
+
} else {
|
|
102
|
+
_time.value = "00:00";
|
|
103
|
+
newDate.setHours(0);
|
|
104
|
+
newDate.setMinutes(0);
|
|
105
|
+
}
|
|
106
|
+
_date.value = newDate;
|
|
38
107
|
updateMaskedModel();
|
|
39
108
|
};
|
|
40
109
|
const timeSelected = (time) => {
|
|
41
110
|
_time.value = time;
|
|
111
|
+
if (_date.value) {
|
|
112
|
+
const current = _date.value instanceof Date ? _date.value : new Date(_date.value);
|
|
113
|
+
const newDate = new Date(current);
|
|
114
|
+
const [h, m] = time.split(":").map(Number);
|
|
115
|
+
newDate.setHours(h);
|
|
116
|
+
newDate.setMinutes(m);
|
|
117
|
+
_date.value = newDate;
|
|
118
|
+
}
|
|
42
119
|
updateMaskedModel();
|
|
43
120
|
calendarShow.value = false;
|
|
44
121
|
};
|
|
45
122
|
const updateMaskedModel = () => {
|
|
46
|
-
if (_date.value
|
|
47
|
-
const
|
|
48
|
-
|
|
123
|
+
if (_date.value) {
|
|
124
|
+
const d = _date.value instanceof Date ? _date.value : new Date(_date.value);
|
|
125
|
+
if (!isNaN(d.getTime())) {
|
|
126
|
+
const dateStr = formatDate(d);
|
|
127
|
+
const timeStr = _time.value || "00:00";
|
|
128
|
+
maskedModel.value = `${dateStr} ${timeStr}`;
|
|
129
|
+
}
|
|
49
130
|
}
|
|
50
131
|
};
|
|
51
132
|
const formatDate = (date) => {
|
|
@@ -60,20 +141,58 @@ export function useKDateTimePickerLogic(props) {
|
|
|
60
141
|
return formattedDate;
|
|
61
142
|
};
|
|
62
143
|
const calendarDay = computed(() => {
|
|
63
|
-
|
|
64
|
-
|
|
144
|
+
const val = props.modelValue || props.day;
|
|
145
|
+
if (val) {
|
|
146
|
+
return val;
|
|
65
147
|
}
|
|
66
148
|
return /* @__PURE__ */ new Date();
|
|
67
149
|
});
|
|
68
150
|
onMounted(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
151
|
+
syncValue(props.modelValue || props.day);
|
|
152
|
+
if (props.isOpen) {
|
|
153
|
+
calendarShow.value = props.isOpen;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
const syncValue = (val) => {
|
|
157
|
+
if (!val) return;
|
|
158
|
+
if (val instanceof Date) {
|
|
159
|
+
_date.value = val;
|
|
160
|
+
const h = val.getHours().toString().padStart(2, "0");
|
|
161
|
+
const m = val.getMinutes().toString().padStart(2, "0");
|
|
162
|
+
_time.value = `${h}:${m}`;
|
|
163
|
+
} else if (typeof val === "string") {
|
|
164
|
+
if (val.includes(" ")) {
|
|
165
|
+
const parts = val.split(" ");
|
|
166
|
+
_date.value = parts[0];
|
|
167
|
+
_time.value = parts[1];
|
|
168
|
+
} else if (val.includes(":")) {
|
|
169
|
+
_time.value = val;
|
|
170
|
+
} else {
|
|
171
|
+
_date.value = val;
|
|
74
172
|
}
|
|
75
|
-
updateMaskedModel();
|
|
76
173
|
}
|
|
174
|
+
updateMaskedModel();
|
|
175
|
+
};
|
|
176
|
+
watch(() => props.modelValue, (newVal) => {
|
|
177
|
+
if (newVal) {
|
|
178
|
+
const d1 = newVal instanceof Date ? newVal.getTime() : new Date(newVal).getTime();
|
|
179
|
+
const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value).getTime();
|
|
180
|
+
if (d1 !== d2) {
|
|
181
|
+
syncValue(newVal);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
watch(() => props.day, (newDay) => {
|
|
186
|
+
if (newDay) {
|
|
187
|
+
const d1 = newDay instanceof Date ? newDay.getTime() : new Date(newDay).getTime();
|
|
188
|
+
const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value).getTime();
|
|
189
|
+
if (d1 !== d2) {
|
|
190
|
+
syncValue(newDay);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
watch(() => props.isOpen, (newVal) => {
|
|
195
|
+
calendarShow.value = !!newVal;
|
|
77
196
|
});
|
|
78
197
|
return {
|
|
79
198
|
_date,
|
|
@@ -27,8 +27,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
type: BooleanConstructor;
|
|
28
28
|
default: boolean;
|
|
29
29
|
};
|
|
30
|
+
isOpen: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
showClear: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
30
38
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
39
|
"update:modelValue": (value: string) => any;
|
|
40
|
+
"update:isOpen": (value: boolean) => any;
|
|
32
41
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
42
|
step: {
|
|
34
43
|
type: NumberConstructor;
|
|
@@ -58,13 +67,24 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
67
|
type: BooleanConstructor;
|
|
59
68
|
default: boolean;
|
|
60
69
|
};
|
|
70
|
+
isOpen: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
showClear: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
61
78
|
}>> & Readonly<{
|
|
62
79
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
80
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
81
|
}>, {
|
|
82
|
+
isOpen: boolean;
|
|
64
83
|
disabled: boolean;
|
|
65
|
-
placeholder: string;
|
|
66
84
|
modelValue: string;
|
|
85
|
+
placeholder: string;
|
|
67
86
|
format: string;
|
|
87
|
+
showClear: boolean;
|
|
68
88
|
step: number;
|
|
69
89
|
startHour: string;
|
|
70
90
|
endHour: 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,31 @@ 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
|
|
28
31
|
}));
|
|
29
|
-
const
|
|
32
|
+
const updateIsOpen = (val) => {
|
|
30
33
|
isOpen.value = val;
|
|
31
34
|
};
|
|
35
|
+
const updateMaskedModel = (val) => {
|
|
36
|
+
maskedModel.value = val;
|
|
37
|
+
};
|
|
38
|
+
watch(maskedModel, (newVal) => {
|
|
39
|
+
emit("update:modelValue", newVal);
|
|
40
|
+
});
|
|
41
|
+
watch(isOpen, (newVal) => {
|
|
42
|
+
emit("update:isOpen", newVal);
|
|
43
|
+
});
|
|
32
44
|
</script>
|
|
33
45
|
|
|
34
46
|
<template lang="pug">
|
|
35
47
|
component(
|
|
36
48
|
:is="presetComponent"
|
|
37
49
|
v-bind="{...templateProps, ...$attrs}"
|
|
38
|
-
@update:isOpen="
|
|
50
|
+
@update:isOpen="updateIsOpen"
|
|
51
|
+
@update:maskedModel="updateMaskedModel"
|
|
39
52
|
)
|
|
40
53
|
</template>
|
|
@@ -27,8 +27,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
27
27
|
type: BooleanConstructor;
|
|
28
28
|
default: boolean;
|
|
29
29
|
};
|
|
30
|
+
isOpen: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
showClear: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
30
38
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
39
|
"update:modelValue": (value: string) => any;
|
|
40
|
+
"update:isOpen": (value: boolean) => any;
|
|
32
41
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
42
|
step: {
|
|
34
43
|
type: NumberConstructor;
|
|
@@ -58,13 +67,24 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
58
67
|
type: BooleanConstructor;
|
|
59
68
|
default: boolean;
|
|
60
69
|
};
|
|
70
|
+
isOpen: {
|
|
71
|
+
type: BooleanConstructor;
|
|
72
|
+
default: boolean;
|
|
73
|
+
};
|
|
74
|
+
showClear: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
default: boolean;
|
|
77
|
+
};
|
|
61
78
|
}>> & Readonly<{
|
|
62
79
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
80
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
81
|
}>, {
|
|
82
|
+
isOpen: boolean;
|
|
64
83
|
disabled: boolean;
|
|
65
|
-
placeholder: string;
|
|
66
84
|
modelValue: string;
|
|
85
|
+
placeholder: string;
|
|
67
86
|
format: string;
|
|
87
|
+
showClear: boolean;
|
|
68
88
|
step: number;
|
|
69
89
|
startHour: string;
|
|
70
90
|
endHour: string;
|
|
@@ -6,6 +6,8 @@ export interface KHourPickerProps {
|
|
|
6
6
|
modelValue?: string;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
showClear?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare const KHourPickerDefaultProps: {
|
|
11
13
|
step: {
|
|
@@ -36,11 +38,20 @@ export declare const KHourPickerDefaultProps: {
|
|
|
36
38
|
type: BooleanConstructor;
|
|
37
39
|
default: boolean;
|
|
38
40
|
};
|
|
41
|
+
isOpen: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
showClear: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
39
49
|
};
|
|
40
|
-
export declare function useKHourPickerLogic(props: KHourPickerProps
|
|
50
|
+
export declare function useKHourPickerLogic(props: KHourPickerProps): {
|
|
41
51
|
isOpen: import("vue").Ref<boolean, boolean>;
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
maskedModel: import("vue").Ref<string, string>;
|
|
53
|
+
textboxClicked: () => void;
|
|
44
54
|
closeDropdown: () => void;
|
|
45
55
|
onTimeSelect: (time: string) => void;
|
|
56
|
+
clear: () => void;
|
|
46
57
|
};
|
|
@@ -28,12 +28,20 @@ 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
|
|
31
39
|
}
|
|
32
40
|
};
|
|
33
|
-
export function useKHourPickerLogic(props
|
|
34
|
-
const isOpen = ref(false);
|
|
35
|
-
const
|
|
36
|
-
const
|
|
41
|
+
export function useKHourPickerLogic(props) {
|
|
42
|
+
const isOpen = ref(props.isOpen || false);
|
|
43
|
+
const maskedModel = ref(props.modelValue || "");
|
|
44
|
+
const textboxClicked = () => {
|
|
37
45
|
if (props.disabled) return;
|
|
38
46
|
isOpen.value = !isOpen.value;
|
|
39
47
|
};
|
|
@@ -41,18 +49,25 @@ export function useKHourPickerLogic(props, emit) {
|
|
|
41
49
|
isOpen.value = false;
|
|
42
50
|
};
|
|
43
51
|
const onTimeSelect = (time) => {
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
maskedModel.value = time;
|
|
53
|
+
closeDropdown();
|
|
54
|
+
};
|
|
55
|
+
const clear = () => {
|
|
56
|
+
maskedModel.value = "";
|
|
46
57
|
closeDropdown();
|
|
47
58
|
};
|
|
48
59
|
watch(() => props.modelValue, (val) => {
|
|
49
|
-
|
|
60
|
+
maskedModel.value = val || "";
|
|
61
|
+
});
|
|
62
|
+
watch(() => props.isOpen, (val) => {
|
|
63
|
+
isOpen.value = !!val;
|
|
50
64
|
});
|
|
51
65
|
return {
|
|
52
66
|
isOpen,
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
maskedModel,
|
|
68
|
+
textboxClicked,
|
|
55
69
|
closeDropdown,
|
|
56
|
-
onTimeSelect
|
|
70
|
+
onTimeSelect,
|
|
71
|
+
clear
|
|
57
72
|
};
|
|
58
73
|
}
|
|
@@ -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,
|
|
@@ -37,8 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
37
37
|
}>> & Readonly<{
|
|
38
38
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
|
-
placeholder: string;
|
|
41
40
|
modelValue: string;
|
|
41
|
+
placeholder: string;
|
|
42
42
|
showClear: boolean;
|
|
43
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
44
44
|
declare const _default: typeof __VLS_export;
|
|
@@ -37,8 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
37
37
|
}>> & Readonly<{
|
|
38
38
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
39
39
|
}>, {
|
|
40
|
-
placeholder: string;
|
|
41
40
|
modelValue: string;
|
|
41
|
+
placeholder: string;
|
|
42
42
|
showClear: boolean;
|
|
43
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
44
44
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,7 +2,7 @@ import { type KTextboxProps } from './KTextbox.logic.js';
|
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
3
|
modelValue: {
|
|
4
4
|
type: StringConstructor;
|
|
5
|
-
|
|
5
|
+
default: string;
|
|
6
6
|
};
|
|
7
7
|
placeholder: {
|
|
8
8
|
type: StringConstructor;
|
|
@@ -22,7 +22,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
23
|
modelValue: {
|
|
24
24
|
type: StringConstructor;
|
|
25
|
-
|
|
25
|
+
default: string;
|
|
26
26
|
};
|
|
27
27
|
placeholder: {
|
|
28
28
|
type: StringConstructor;
|
|
@@ -41,6 +41,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
41
41
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
42
42
|
}>, {
|
|
43
43
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
44
|
+
modelValue: string;
|
|
44
45
|
placeholder: string;
|
|
45
46
|
showClear: boolean;
|
|
46
47
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -5,11 +5,11 @@ import { computed } from "vue";
|
|
|
5
5
|
import KTextboxDefault from "../../presets/default/components/KTextbox/KTextbox.vue";
|
|
6
6
|
const props = defineProps(KTextboxDefaultProps);
|
|
7
7
|
const emit = defineEmits(["update:modelValue"]);
|
|
8
|
-
const { text,
|
|
8
|
+
const { text, showClear, clear } = useKTextboxLogic(props, emit);
|
|
9
9
|
const presetComponent = usePresetComponent("KTextbox", KTextboxDefault);
|
|
10
10
|
const templateProps = computed(() => ({
|
|
11
11
|
text: text.value,
|
|
12
|
-
|
|
12
|
+
showClear: showClear.value,
|
|
13
13
|
clear,
|
|
14
14
|
placeholder: props.placeholder,
|
|
15
15
|
type: props.type
|
|
@@ -2,7 +2,7 @@ import { type KTextboxProps } from './KTextbox.logic.js';
|
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
3
|
modelValue: {
|
|
4
4
|
type: StringConstructor;
|
|
5
|
-
|
|
5
|
+
default: string;
|
|
6
6
|
};
|
|
7
7
|
placeholder: {
|
|
8
8
|
type: StringConstructor;
|
|
@@ -22,7 +22,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
23
|
modelValue: {
|
|
24
24
|
type: StringConstructor;
|
|
25
|
-
|
|
25
|
+
default: string;
|
|
26
26
|
};
|
|
27
27
|
placeholder: {
|
|
28
28
|
type: StringConstructor;
|
|
@@ -41,6 +41,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
41
41
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
42
42
|
}>, {
|
|
43
43
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
44
|
+
modelValue: string;
|
|
44
45
|
placeholder: string;
|
|
45
46
|
showClear: boolean;
|
|
46
47
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface KTextboxProps {
|
|
2
|
-
modelValue
|
|
3
|
-
placeholder
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
4
|
showClear?: boolean;
|
|
5
5
|
type?: 'text' | 'password' | 'email' | 'url' | 'tel' | 'search' | 'number';
|
|
6
6
|
}
|
|
@@ -12,7 +12,7 @@ export interface KTextboxEmits {
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function useKTextboxLogic(props: KTextboxProps, emit: KTextboxEmits): {
|
|
14
14
|
text: import("vue").WritableComputedRef<string, string>;
|
|
15
|
-
|
|
15
|
+
showClear: import("vue").ComputedRef<boolean | undefined>;
|
|
16
16
|
clear: () => void;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
@@ -21,7 +21,7 @@ export declare function useKTextboxLogic(props: KTextboxProps, emit: KTextboxEmi
|
|
|
21
21
|
export declare const KTextboxDefaultProps: {
|
|
22
22
|
modelValue: {
|
|
23
23
|
type: StringConstructor;
|
|
24
|
-
|
|
24
|
+
default: string;
|
|
25
25
|
};
|
|
26
26
|
placeholder: {
|
|
27
27
|
type: StringConstructor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
export function useKTextboxLogic(props, emit) {
|
|
3
3
|
const text = computed({
|
|
4
|
-
get: () => props.modelValue,
|
|
4
|
+
get: () => props.modelValue ?? "",
|
|
5
5
|
set: (value) => emit("update:modelValue", value)
|
|
6
6
|
});
|
|
7
|
-
const
|
|
7
|
+
const showClear = computed(() => {
|
|
8
8
|
return props.showClear && text.value !== "";
|
|
9
9
|
});
|
|
10
10
|
const clear = () => {
|
|
@@ -12,14 +12,14 @@ export function useKTextboxLogic(props, emit) {
|
|
|
12
12
|
};
|
|
13
13
|
return {
|
|
14
14
|
text,
|
|
15
|
-
|
|
15
|
+
showClear,
|
|
16
16
|
clear
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export const KTextboxDefaultProps = {
|
|
20
20
|
modelValue: {
|
|
21
21
|
type: String,
|
|
22
|
-
|
|
22
|
+
default: ""
|
|
23
23
|
},
|
|
24
24
|
placeholder: {
|
|
25
25
|
type: String,
|
|
@@ -103,17 +103,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
103
103
|
onChange?: ((value: any) => any) | undefined;
|
|
104
104
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
105
105
|
}>, {
|
|
106
|
-
parentKey: string;
|
|
107
|
-
idKey: string;
|
|
108
106
|
disabled: boolean;
|
|
109
107
|
loading: boolean;
|
|
108
|
+
modelValue: any;
|
|
110
109
|
searchbox: boolean;
|
|
111
110
|
placeholder: string;
|
|
112
111
|
dataProvider: any;
|
|
113
112
|
closeOnSelect: boolean;
|
|
114
113
|
multiSelect: boolean;
|
|
115
|
-
modelValue: any;
|
|
116
114
|
iconField: string;
|
|
115
|
+
idKey: string;
|
|
116
|
+
parentKey: string;
|
|
117
117
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
118
118
|
declare const _default: typeof __VLS_export;
|
|
119
119
|
export default _default;
|
|
@@ -103,17 +103,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
103
103
|
onChange?: ((value: any) => any) | undefined;
|
|
104
104
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
105
105
|
}>, {
|
|
106
|
-
parentKey: string;
|
|
107
|
-
idKey: string;
|
|
108
106
|
disabled: boolean;
|
|
109
107
|
loading: boolean;
|
|
108
|
+
modelValue: any;
|
|
110
109
|
searchbox: boolean;
|
|
111
110
|
placeholder: string;
|
|
112
111
|
dataProvider: any;
|
|
113
112
|
closeOnSelect: boolean;
|
|
114
113
|
multiSelect: boolean;
|
|
115
|
-
modelValue: any;
|
|
116
114
|
iconField: string;
|
|
115
|
+
idKey: string;
|
|
116
|
+
parentKey: string;
|
|
117
117
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
118
118
|
declare const _default: typeof __VLS_export;
|
|
119
119
|
export default _default;
|
|
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
default: () => {};
|
|
82
82
|
};
|
|
83
83
|
}>> & Readonly<{}>, {
|
|
84
|
-
parentKey: string;
|
|
85
|
-
idKey: string;
|
|
86
|
-
expandedByDefault: boolean;
|
|
87
84
|
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
88
85
|
rowActions: import("./KTreeView.logic.js").IRowAction[];
|
|
89
86
|
cellSlots: Record<string, any>;
|
|
90
87
|
headerSlots: Record<string, any>;
|
|
91
88
|
treeColumnIndex: number;
|
|
89
|
+
idKey: string;
|
|
90
|
+
parentKey: string;
|
|
91
|
+
expandedByDefault: boolean;
|
|
92
92
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
93
|
declare const _default: typeof __VLS_export;
|
|
94
94
|
export default _default;
|
|
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
default: () => {};
|
|
82
82
|
};
|
|
83
83
|
}>> & Readonly<{}>, {
|
|
84
|
-
parentKey: string;
|
|
85
|
-
idKey: string;
|
|
86
|
-
expandedByDefault: boolean;
|
|
87
84
|
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
88
85
|
rowActions: import("./KTreeView.logic.js").IRowAction[];
|
|
89
86
|
cellSlots: Record<string, any>;
|
|
90
87
|
headerSlots: Record<string, any>;
|
|
91
88
|
treeColumnIndex: number;
|
|
89
|
+
idKey: string;
|
|
90
|
+
parentKey: string;
|
|
91
|
+
expandedByDefault: boolean;
|
|
92
92
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
93
|
declare const _default: typeof __VLS_export;
|
|
94
94
|
export default _default;
|