@katlux/toolkit 0.1.0-beta.44 → 0.1.0-beta.45
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/KCombobox/KCombobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +9 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +1 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +9 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +5 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +32 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +39 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +9 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +39 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +15 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +113 -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 +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
- 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/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
package/dist/module.json
CHANGED
|
@@ -86,13 +86,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
86
86
|
"onUpdate:modelValue"?: ((value: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null) => any) | undefined;
|
|
87
87
|
}>, {
|
|
88
88
|
disabled: boolean;
|
|
89
|
+
modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
|
|
89
90
|
searchbox: boolean;
|
|
90
91
|
placeholder: string;
|
|
91
92
|
closeOnSelect: boolean;
|
|
92
93
|
multiSelect: boolean;
|
|
93
94
|
maxSelectedDisplay: string | number | boolean;
|
|
94
95
|
visibleFields: String[];
|
|
95
|
-
modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
97
|
declare const _default: typeof __VLS_export;
|
|
98
98
|
export default _default;
|
|
@@ -86,13 +86,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
86
86
|
"onUpdate:modelValue"?: ((value: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null) => any) | undefined;
|
|
87
87
|
}>, {
|
|
88
88
|
disabled: boolean;
|
|
89
|
+
modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
|
|
89
90
|
searchbox: boolean;
|
|
90
91
|
placeholder: string;
|
|
91
92
|
closeOnSelect: boolean;
|
|
92
93
|
multiSelect: boolean;
|
|
93
94
|
maxSelectedDisplay: string | number | boolean;
|
|
94
95
|
visibleFields: String[];
|
|
95
|
-
modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
|
|
96
96
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
97
97
|
declare const _default: typeof __VLS_export;
|
|
98
98
|
export default _default;
|
|
@@ -15,6 +15,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
15
15
|
type: BooleanConstructor;
|
|
16
16
|
default: boolean;
|
|
17
17
|
};
|
|
18
|
+
showClear: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
18
22
|
calendarDefinedDays: {
|
|
19
23
|
type: import("vue").PropType<IDefinedDay[]>;
|
|
20
24
|
default: () => never[];
|
|
@@ -46,6 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
46
50
|
type: BooleanConstructor;
|
|
47
51
|
default: boolean;
|
|
48
52
|
};
|
|
53
|
+
showClear: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
49
57
|
calendarDefinedDays: {
|
|
50
58
|
type: import("vue").PropType<IDefinedDay[]>;
|
|
51
59
|
default: () => never[];
|
|
@@ -65,6 +73,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
65
73
|
day: string | Date;
|
|
66
74
|
modelValue: string | Date;
|
|
67
75
|
format: string;
|
|
76
|
+
showClear: boolean;
|
|
68
77
|
calendarDefinedDays: IDefinedDay[];
|
|
69
78
|
calendarMarkedDays: IMarkedDay[];
|
|
70
79
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -20,6 +20,7 @@ const templateProps = computed(() => ({
|
|
|
20
20
|
_date: _date.value,
|
|
21
21
|
calendarDay: calendarDay.value,
|
|
22
22
|
format: props.format,
|
|
23
|
+
showClear: props.showClear,
|
|
23
24
|
calendarDefinedDays: props.calendarDefinedDays,
|
|
24
25
|
calendarMarkedDays: props.calendarMarkedDays,
|
|
25
26
|
textboxClicked,
|
|
@@ -15,6 +15,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
15
15
|
type: BooleanConstructor;
|
|
16
16
|
default: boolean;
|
|
17
17
|
};
|
|
18
|
+
showClear: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
18
22
|
calendarDefinedDays: {
|
|
19
23
|
type: import("vue").PropType<IDefinedDay[]>;
|
|
20
24
|
default: () => never[];
|
|
@@ -46,6 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
46
50
|
type: BooleanConstructor;
|
|
47
51
|
default: boolean;
|
|
48
52
|
};
|
|
53
|
+
showClear: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
49
57
|
calendarDefinedDays: {
|
|
50
58
|
type: import("vue").PropType<IDefinedDay[]>;
|
|
51
59
|
default: () => never[];
|
|
@@ -65,6 +73,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
65
73
|
day: string | Date;
|
|
66
74
|
modelValue: string | Date;
|
|
67
75
|
format: string;
|
|
76
|
+
showClear: boolean;
|
|
68
77
|
calendarDefinedDays: IDefinedDay[];
|
|
69
78
|
calendarMarkedDays: IMarkedDay[];
|
|
70
79
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -5,6 +5,7 @@ export interface KDatePickerProps {
|
|
|
5
5
|
day?: Date | string;
|
|
6
6
|
modelValue?: Date | string;
|
|
7
7
|
isOpen?: boolean;
|
|
8
|
+
showClear?: boolean;
|
|
8
9
|
calendarDefinedDays: IDefinedDay[];
|
|
9
10
|
calendarMarkedDays: IMarkedDay[];
|
|
10
11
|
}
|
|
@@ -25,6 +26,10 @@ export declare const KDatePickerDefaultProps: {
|
|
|
25
26
|
type: BooleanConstructor;
|
|
26
27
|
default: boolean;
|
|
27
28
|
};
|
|
29
|
+
showClear: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
28
33
|
calendarDefinedDays: {
|
|
29
34
|
type: PropType<IDefinedDay[]>;
|
|
30
35
|
default: () => never[];
|
|
@@ -16,6 +16,10 @@ export const KDatePickerDefaultProps = {
|
|
|
16
16
|
type: Boolean,
|
|
17
17
|
default: false
|
|
18
18
|
},
|
|
19
|
+
showClear: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
19
23
|
calendarDefinedDays: {
|
|
20
24
|
type: Array,
|
|
21
25
|
default: () => []
|
|
@@ -29,6 +33,34 @@ export function useKDatePickerLogic(props) {
|
|
|
29
33
|
const _date = ref("");
|
|
30
34
|
const maskedModel = ref("");
|
|
31
35
|
const calendarShow = ref(false);
|
|
36
|
+
watch(maskedModel, (newVal) => {
|
|
37
|
+
if (newVal === "") {
|
|
38
|
+
_date.value = "";
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const format = props.format;
|
|
42
|
+
let day = "", month = "", year = "";
|
|
43
|
+
let rawIdx = 0;
|
|
44
|
+
for (let i = 0; i < format.length; i++) {
|
|
45
|
+
const char = format[i];
|
|
46
|
+
if (char === "M") {
|
|
47
|
+
month += newVal[rawIdx] || "";
|
|
48
|
+
rawIdx++;
|
|
49
|
+
} else if (char === "D") {
|
|
50
|
+
day += newVal[rawIdx] || "";
|
|
51
|
+
rawIdx++;
|
|
52
|
+
} else if (char === "Y") {
|
|
53
|
+
year += newVal[rawIdx] || "";
|
|
54
|
+
rawIdx++;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (month.length === 2 && day.length === 2 && year.length === 4) {
|
|
58
|
+
const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
|
59
|
+
if (!isNaN(d.getTime())) {
|
|
60
|
+
_date.value = d;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
32
64
|
const textboxClicked = () => {
|
|
33
65
|
calendarShow.value = true;
|
|
34
66
|
};
|
|
@@ -11,6 +11,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
11
11
|
type: (DateConstructor | StringConstructor)[];
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: (DateConstructor | StringConstructor)[];
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
isOpen: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
showClear: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
14
26
|
timeStep: {
|
|
15
27
|
type: NumberConstructor;
|
|
16
28
|
default: number;
|
|
@@ -23,7 +35,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
23
35
|
type: import("vue").PropType<IMarkedDay[]>;
|
|
24
36
|
default: () => never[];
|
|
25
37
|
};
|
|
26
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
38
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
39
|
+
"update:modelValue": (value: string | Date) => any;
|
|
40
|
+
"update:maskedModel": (value: string) => any;
|
|
41
|
+
"update:calendarShow": (value: boolean) => any;
|
|
42
|
+
"update:isOpen": (value: boolean) => any;
|
|
43
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
44
|
format: {
|
|
28
45
|
type: StringConstructor;
|
|
29
46
|
default: string;
|
|
@@ -36,6 +53,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
36
53
|
type: (DateConstructor | StringConstructor)[];
|
|
37
54
|
default: undefined;
|
|
38
55
|
};
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: (DateConstructor | StringConstructor)[];
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
isOpen: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
showClear: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
39
68
|
timeStep: {
|
|
40
69
|
type: NumberConstructor;
|
|
41
70
|
default: number;
|
|
@@ -48,9 +77,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
77
|
type: import("vue").PropType<IMarkedDay[]>;
|
|
49
78
|
default: () => never[];
|
|
50
79
|
};
|
|
51
|
-
}>> & Readonly<{
|
|
80
|
+
}>> & Readonly<{
|
|
81
|
+
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
82
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
83
|
+
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
84
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
85
|
+
}>, {
|
|
86
|
+
isOpen: boolean;
|
|
52
87
|
day: string | Date;
|
|
88
|
+
modelValue: string | Date;
|
|
53
89
|
format: string;
|
|
90
|
+
showClear: boolean;
|
|
54
91
|
calendarDefinedDays: IDefinedDay[];
|
|
55
92
|
calendarMarkedDays: IMarkedDay[];
|
|
56
93
|
timeFormat: string;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useKDateTimePickerLogic, KDateTimePickerDefaultProps } from "./KDateTimePicker.logic";
|
|
3
3
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
-
import { computed } from "vue";
|
|
4
|
+
import { computed, watch } from "vue";
|
|
5
5
|
import KDateTimePickerDefault from "../../presets/default/components/KDateTimePicker/KDateTimePicker.vue";
|
|
6
6
|
const props = defineProps(KDateTimePickerDefaultProps);
|
|
7
|
+
const emit = defineEmits(["update:maskedModel", "update:calendarShow", "update:modelValue", "update:isOpen"]);
|
|
7
8
|
const {
|
|
8
9
|
_date,
|
|
9
10
|
_time,
|
|
@@ -26,6 +27,7 @@ const templateProps = computed(() => ({
|
|
|
26
27
|
timeStep: props.timeStep,
|
|
27
28
|
calendarDefinedDays: props.calendarDefinedDays,
|
|
28
29
|
calendarMarkedDays: props.calendarMarkedDays,
|
|
30
|
+
showClear: props.showClear,
|
|
29
31
|
textboxClicked,
|
|
30
32
|
dateSelected,
|
|
31
33
|
timeSelected
|
|
@@ -36,6 +38,12 @@ const updateMaskedModel = (val) => {
|
|
|
36
38
|
const updateCalendarShow = (val) => {
|
|
37
39
|
calendarShow.value = val;
|
|
38
40
|
};
|
|
41
|
+
watch(_date, (newDate) => {
|
|
42
|
+
emit("update:modelValue", newDate);
|
|
43
|
+
});
|
|
44
|
+
watch(calendarShow, (newVal) => {
|
|
45
|
+
emit("update:isOpen", newVal);
|
|
46
|
+
});
|
|
39
47
|
</script>
|
|
40
48
|
|
|
41
49
|
<template lang="pug">
|
|
@@ -11,6 +11,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
11
11
|
type: (DateConstructor | StringConstructor)[];
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: (DateConstructor | StringConstructor)[];
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
isOpen: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
showClear: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
14
26
|
timeStep: {
|
|
15
27
|
type: NumberConstructor;
|
|
16
28
|
default: number;
|
|
@@ -23,7 +35,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
23
35
|
type: import("vue").PropType<IMarkedDay[]>;
|
|
24
36
|
default: () => never[];
|
|
25
37
|
};
|
|
26
|
-
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
38
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
39
|
+
"update:modelValue": (value: string | Date) => any;
|
|
40
|
+
"update:maskedModel": (value: string) => any;
|
|
41
|
+
"update:calendarShow": (value: boolean) => any;
|
|
42
|
+
"update:isOpen": (value: boolean) => any;
|
|
43
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
44
|
format: {
|
|
28
45
|
type: StringConstructor;
|
|
29
46
|
default: string;
|
|
@@ -36,6 +53,18 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
36
53
|
type: (DateConstructor | StringConstructor)[];
|
|
37
54
|
default: undefined;
|
|
38
55
|
};
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: (DateConstructor | StringConstructor)[];
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
isOpen: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
showClear: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
39
68
|
timeStep: {
|
|
40
69
|
type: NumberConstructor;
|
|
41
70
|
default: number;
|
|
@@ -48,9 +77,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
77
|
type: import("vue").PropType<IMarkedDay[]>;
|
|
49
78
|
default: () => never[];
|
|
50
79
|
};
|
|
51
|
-
}>> & Readonly<{
|
|
80
|
+
}>> & Readonly<{
|
|
81
|
+
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
82
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
83
|
+
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
84
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
85
|
+
}>, {
|
|
86
|
+
isOpen: boolean;
|
|
52
87
|
day: string | Date;
|
|
88
|
+
modelValue: string | Date;
|
|
53
89
|
format: string;
|
|
90
|
+
showClear: boolean;
|
|
54
91
|
calendarDefinedDays: IDefinedDay[];
|
|
55
92
|
calendarMarkedDays: IMarkedDay[];
|
|
56
93
|
timeFormat: string;
|
|
@@ -4,6 +4,9 @@ export interface KDateTimePickerProps {
|
|
|
4
4
|
format?: string;
|
|
5
5
|
timeFormat?: string;
|
|
6
6
|
day?: Date | string;
|
|
7
|
+
modelValue?: Date | string;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
showClear?: boolean;
|
|
7
10
|
timeStep?: number;
|
|
8
11
|
calendarDefinedDays?: IDefinedDay[];
|
|
9
12
|
calendarMarkedDays?: IMarkedDay[];
|
|
@@ -21,6 +24,18 @@ export declare const KDateTimePickerDefaultProps: {
|
|
|
21
24
|
type: (DateConstructor | StringConstructor)[];
|
|
22
25
|
default: undefined;
|
|
23
26
|
};
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: (DateConstructor | StringConstructor)[];
|
|
29
|
+
default: undefined;
|
|
30
|
+
};
|
|
31
|
+
isOpen: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
showClear: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
24
39
|
timeStep: {
|
|
25
40
|
type: NumberConstructor;
|
|
26
41
|
default: number;
|
|
@@ -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,84 @@ 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
|
+
_date.value = "";
|
|
48
|
+
_time.value = "";
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const format = props.format || "MM-DD-YYYY HH:mm";
|
|
52
|
+
let day = "", month = "", year = "", hours = "", minutes = "";
|
|
53
|
+
let rawIdx = 0;
|
|
54
|
+
for (let i = 0; i < format.length; i++) {
|
|
55
|
+
const char = format[i];
|
|
56
|
+
if (char === "M") {
|
|
57
|
+
month += newVal[rawIdx] || "";
|
|
58
|
+
rawIdx++;
|
|
59
|
+
} else if (char === "D") {
|
|
60
|
+
day += newVal[rawIdx] || "";
|
|
61
|
+
rawIdx++;
|
|
62
|
+
} else if (char === "Y") {
|
|
63
|
+
year += newVal[rawIdx] || "";
|
|
64
|
+
rawIdx++;
|
|
65
|
+
} else if (char === "H") {
|
|
66
|
+
hours += newVal[rawIdx] || "";
|
|
67
|
+
rawIdx++;
|
|
68
|
+
} else if (char === "m") {
|
|
69
|
+
minutes += newVal[rawIdx] || "";
|
|
70
|
+
rawIdx++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (month.length === 2 && day.length === 2 && year.length === 4) {
|
|
74
|
+
const d = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
|
75
|
+
if (hours.length === 2 && minutes.length === 2) {
|
|
76
|
+
d.setHours(parseInt(hours));
|
|
77
|
+
d.setMinutes(parseInt(minutes));
|
|
78
|
+
_time.value = `${hours}:${minutes}`;
|
|
79
|
+
}
|
|
80
|
+
if (!isNaN(d.getTime())) {
|
|
81
|
+
_date.value = d;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
33
85
|
const textboxClicked = () => {
|
|
34
86
|
calendarShow.value = true;
|
|
35
87
|
};
|
|
36
88
|
const dateSelected = (date) => {
|
|
37
|
-
|
|
89
|
+
const newDate = new Date(date);
|
|
90
|
+
if (_time.value) {
|
|
91
|
+
const [h, m] = _time.value.split(":").map(Number);
|
|
92
|
+
newDate.setHours(h);
|
|
93
|
+
newDate.setMinutes(m);
|
|
94
|
+
} else {
|
|
95
|
+
_time.value = "00:00";
|
|
96
|
+
newDate.setHours(0);
|
|
97
|
+
newDate.setMinutes(0);
|
|
98
|
+
}
|
|
99
|
+
_date.value = newDate;
|
|
38
100
|
updateMaskedModel();
|
|
39
101
|
};
|
|
40
102
|
const timeSelected = (time) => {
|
|
41
103
|
_time.value = time;
|
|
104
|
+
if (_date.value) {
|
|
105
|
+
const current = _date.value instanceof Date ? _date.value : new Date(_date.value);
|
|
106
|
+
const newDate = new Date(current);
|
|
107
|
+
const [h, m] = time.split(":").map(Number);
|
|
108
|
+
newDate.setHours(h);
|
|
109
|
+
newDate.setMinutes(m);
|
|
110
|
+
_date.value = newDate;
|
|
111
|
+
}
|
|
42
112
|
updateMaskedModel();
|
|
43
113
|
calendarShow.value = false;
|
|
44
114
|
};
|
|
45
115
|
const updateMaskedModel = () => {
|
|
46
|
-
if (_date.value
|
|
47
|
-
const
|
|
48
|
-
|
|
116
|
+
if (_date.value) {
|
|
117
|
+
const d = _date.value instanceof Date ? _date.value : new Date(_date.value);
|
|
118
|
+
if (!isNaN(d.getTime())) {
|
|
119
|
+
const dateStr = formatDate(d);
|
|
120
|
+
const timeStr = _time.value || "00:00";
|
|
121
|
+
maskedModel.value = `${dateStr} ${timeStr}`;
|
|
122
|
+
}
|
|
49
123
|
}
|
|
50
124
|
};
|
|
51
125
|
const formatDate = (date) => {
|
|
@@ -60,20 +134,46 @@ export function useKDateTimePickerLogic(props) {
|
|
|
60
134
|
return formattedDate;
|
|
61
135
|
};
|
|
62
136
|
const calendarDay = computed(() => {
|
|
63
|
-
|
|
64
|
-
|
|
137
|
+
const val = props.modelValue || props.day;
|
|
138
|
+
if (val) {
|
|
139
|
+
return val;
|
|
65
140
|
}
|
|
66
141
|
return /* @__PURE__ */ new Date();
|
|
67
142
|
});
|
|
68
143
|
onMounted(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
144
|
+
syncValue(props.modelValue || props.day);
|
|
145
|
+
if (props.isOpen) {
|
|
146
|
+
calendarShow.value = props.isOpen;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const syncValue = (val) => {
|
|
150
|
+
if (!val) return;
|
|
151
|
+
if (val instanceof Date) {
|
|
152
|
+
_date.value = val;
|
|
153
|
+
const h = val.getHours().toString().padStart(2, "0");
|
|
154
|
+
const m = val.getMinutes().toString().padStart(2, "0");
|
|
155
|
+
_time.value = `${h}:${m}`;
|
|
156
|
+
} else if (typeof val === "string") {
|
|
157
|
+
if (val.includes(" ")) {
|
|
158
|
+
const parts = val.split(" ");
|
|
159
|
+
_date.value = parts[0];
|
|
160
|
+
_time.value = parts[1];
|
|
161
|
+
} else if (val.includes(":")) {
|
|
162
|
+
_time.value = val;
|
|
163
|
+
} else {
|
|
164
|
+
_date.value = val;
|
|
74
165
|
}
|
|
75
|
-
updateMaskedModel();
|
|
76
166
|
}
|
|
167
|
+
updateMaskedModel();
|
|
168
|
+
};
|
|
169
|
+
watch(() => props.modelValue, (newVal) => {
|
|
170
|
+
syncValue(newVal);
|
|
171
|
+
});
|
|
172
|
+
watch(() => props.day, (newDay) => {
|
|
173
|
+
syncValue(newDay);
|
|
174
|
+
});
|
|
175
|
+
watch(() => props.isOpen, (newVal) => {
|
|
176
|
+
calendarShow.value = !!newVal;
|
|
77
177
|
});
|
|
78
178
|
return {
|
|
79
179
|
_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,
|
|
@@ -107,12 +107,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
107
107
|
idKey: string;
|
|
108
108
|
disabled: boolean;
|
|
109
109
|
loading: boolean;
|
|
110
|
+
modelValue: any;
|
|
110
111
|
searchbox: boolean;
|
|
111
112
|
placeholder: string;
|
|
112
113
|
dataProvider: any;
|
|
113
114
|
closeOnSelect: boolean;
|
|
114
115
|
multiSelect: boolean;
|
|
115
|
-
modelValue: any;
|
|
116
116
|
iconField: string;
|
|
117
117
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
118
118
|
declare const _default: typeof __VLS_export;
|
|
@@ -107,12 +107,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
107
107
|
idKey: string;
|
|
108
108
|
disabled: boolean;
|
|
109
109
|
loading: boolean;
|
|
110
|
+
modelValue: any;
|
|
110
111
|
searchbox: boolean;
|
|
111
112
|
placeholder: string;
|
|
112
113
|
dataProvider: any;
|
|
113
114
|
closeOnSelect: boolean;
|
|
114
115
|
multiSelect: boolean;
|
|
115
|
-
modelValue: any;
|
|
116
116
|
iconField: string;
|
|
117
117
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
118
118
|
declare const _default: typeof __VLS_export;
|
|
@@ -5,9 +5,11 @@ type __VLS_Props = {
|
|
|
5
5
|
_date: any;
|
|
6
6
|
calendarDay: Date | string;
|
|
7
7
|
format: string;
|
|
8
|
+
showClear: boolean;
|
|
8
9
|
calendarDefinedDays: IDefinedDay[];
|
|
9
10
|
calendarMarkedDays: IMarkedDay[];
|
|
10
11
|
textboxClicked: () => void;
|
|
12
|
+
onClear: () => void;
|
|
11
13
|
dateSelected: (date: Date) => void;
|
|
12
14
|
};
|
|
13
15
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KDatePicker(ref="activatorRef")
|
|
3
|
-
KMaskTextbox(v-model="maskedModel" :key="maskedModel" :mask="format" :placeholder="format" @click.stop="textboxClicked" showClear)
|
|
3
|
+
KMaskTextbox(v-model="maskedModel" :key="maskedModel" :mask="format" :placeholder="format" @click.stop="textboxClicked" :showClear="showClear" @clear="onClear")
|
|
4
4
|
KDropdown(v-model:isOpen="calendarShow" :anchorEl="activatorRef")
|
|
5
5
|
KCalendar(view="month" :viewCount="1" :day="calendarDay" :selectedDay="_date" @dayClicked="dateSelected" :definedDays="calendarDefinedDays" :markedDays="calendarMarkedDays")
|
|
6
6
|
</template>
|
|
@@ -19,9 +19,11 @@ const props = defineProps<{
|
|
|
19
19
|
_date: any
|
|
20
20
|
calendarDay: Date | string
|
|
21
21
|
format: string
|
|
22
|
+
showClear: boolean
|
|
22
23
|
calendarDefinedDays: IDefinedDay[]
|
|
23
24
|
calendarMarkedDays: IMarkedDay[]
|
|
24
25
|
textboxClicked: () => void
|
|
26
|
+
onClear: () => void
|
|
25
27
|
dateSelected: (date: Date) => void
|
|
26
28
|
}>()
|
|
27
29
|
|
|
@@ -5,9 +5,11 @@ type __VLS_Props = {
|
|
|
5
5
|
_date: any;
|
|
6
6
|
calendarDay: Date | string;
|
|
7
7
|
format: string;
|
|
8
|
+
showClear: boolean;
|
|
8
9
|
calendarDefinedDays: IDefinedDay[];
|
|
9
10
|
calendarMarkedDays: IMarkedDay[];
|
|
10
11
|
textboxClicked: () => void;
|
|
12
|
+
onClear: () => void;
|
|
11
13
|
dateSelected: (date: Date) => void;
|
|
12
14
|
};
|
|
13
15
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -10,7 +10,9 @@ type __VLS_Props = {
|
|
|
10
10
|
timeStep: number;
|
|
11
11
|
calendarDefinedDays: IDefinedDay[];
|
|
12
12
|
calendarMarkedDays: IMarkedDay[];
|
|
13
|
+
showClear: boolean;
|
|
13
14
|
textboxClicked: () => void;
|
|
15
|
+
onClear: () => void;
|
|
14
16
|
dateSelected: (date: Date) => void;
|
|
15
17
|
timeSelected: (time: string) => void;
|
|
16
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KDateTimePicker(ref="activatorRef" @click.stop="textboxClicked")
|
|
3
|
-
KMaskTextbox(v-model="maskedModel" :key="maskedModel" :mask="format" :placeholder="format" showClear)
|
|
3
|
+
KMaskTextbox(v-model="maskedModel" :key="maskedModel" :mask="format" :placeholder="format" :showClear="showClear" @clear="onClear")
|
|
4
4
|
KDropdown(v-model:isOpen="calendarShow" :anchorEl="activatorRef")
|
|
5
5
|
KGrid(direction="row" align="start" :noGap="false" wrap="nowrap").datetime-picker-grid
|
|
6
6
|
.calendar-section
|
|
@@ -28,7 +28,9 @@ const props = defineProps<{
|
|
|
28
28
|
timeStep: number
|
|
29
29
|
calendarDefinedDays: IDefinedDay[]
|
|
30
30
|
calendarMarkedDays: IMarkedDay[]
|
|
31
|
+
showClear: boolean
|
|
31
32
|
textboxClicked: () => void
|
|
33
|
+
onClear: () => void
|
|
32
34
|
dateSelected: (date: Date) => void
|
|
33
35
|
timeSelected: (time: string) => void
|
|
34
36
|
}>()
|
|
@@ -10,7 +10,9 @@ type __VLS_Props = {
|
|
|
10
10
|
timeStep: number;
|
|
11
11
|
calendarDefinedDays: IDefinedDay[];
|
|
12
12
|
calendarMarkedDays: IMarkedDay[];
|
|
13
|
+
showClear: boolean;
|
|
13
14
|
textboxClicked: () => void;
|
|
15
|
+
onClear: () => void;
|
|
14
16
|
dateSelected: (date: Date) => void;
|
|
15
17
|
timeSelected: (time: string) => void;
|
|
16
18
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
|
|
2
|
+
maskedModel: string;
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
step: number;
|
|
5
5
|
format: string;
|
|
@@ -7,13 +7,17 @@ type __VLS_Props = {
|
|
|
7
7
|
endHour?: string;
|
|
8
8
|
placeholder: string;
|
|
9
9
|
disabled: boolean;
|
|
10
|
-
|
|
10
|
+
showClear: boolean;
|
|
11
|
+
textboxClicked: () => void;
|
|
11
12
|
closeDropdown: () => void;
|
|
12
13
|
onTimeSelect: (time: string) => void;
|
|
14
|
+
clear: () => void;
|
|
13
15
|
};
|
|
14
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
|
+
"update:maskedModel": (value: string) => any;
|
|
15
18
|
"update:isOpen": (value: boolean) => any;
|
|
16
19
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
17
21
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
18
22
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
23
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KHourPicker(ref="activatorRef"
|
|
3
|
-
|
|
4
|
-
:
|
|
2
|
+
.KHourPicker(ref="activatorRef")
|
|
3
|
+
KMaskTextbox(
|
|
4
|
+
v-model:maskedValue="maskedModel"
|
|
5
|
+
:mask="format"
|
|
5
6
|
:placeholder="placeholder"
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
@
|
|
7
|
+
:showClear="showClear"
|
|
8
|
+
@click.stop="textboxClicked"
|
|
9
|
+
@clear="clear"
|
|
9
10
|
)
|
|
10
11
|
template(#append)
|
|
11
|
-
KIcon(iconname="clock" clickable @click.stop="
|
|
12
|
+
KIcon(iconname="clock" clickable @click.stop="textboxClicked")
|
|
12
13
|
|
|
13
14
|
KDropdown(
|
|
14
15
|
:isOpen="isOpen"
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
:anchorEl="activatorRef"
|
|
17
18
|
)
|
|
18
19
|
KHourSelect(
|
|
19
|
-
:modelValue="
|
|
20
|
+
:modelValue="maskedModel"
|
|
20
21
|
:step="step"
|
|
21
22
|
:format="format"
|
|
22
23
|
:startHour="startHour"
|
|
@@ -26,12 +27,13 @@
|
|
|
26
27
|
</template>
|
|
27
28
|
|
|
28
29
|
<script lang="ts" setup>
|
|
29
|
-
import { ref } from 'vue'
|
|
30
|
+
import { ref, computed } from 'vue'
|
|
30
31
|
const activatorRef = ref<HTMLElement | null>(null)
|
|
31
32
|
import KHourSelect from '../../../../components/KHourSelect/KHourSelect.global.vue'
|
|
33
|
+
import KMaskTextbox from '../../../../components/KMaskTextbox/KMaskTextbox.global.vue'
|
|
32
34
|
|
|
33
|
-
defineProps<{
|
|
34
|
-
|
|
35
|
+
const props = defineProps<{
|
|
36
|
+
maskedModel: string
|
|
35
37
|
isOpen: boolean
|
|
36
38
|
step: number
|
|
37
39
|
format: string
|
|
@@ -39,14 +41,22 @@ defineProps<{
|
|
|
39
41
|
endHour?: string
|
|
40
42
|
placeholder: string
|
|
41
43
|
disabled: boolean
|
|
42
|
-
|
|
44
|
+
showClear: boolean
|
|
45
|
+
textboxClicked: () => void
|
|
43
46
|
closeDropdown: () => void
|
|
44
47
|
onTimeSelect: (time: string) => void
|
|
48
|
+
clear: () => void
|
|
45
49
|
}>()
|
|
46
50
|
|
|
47
|
-
defineEmits<{
|
|
51
|
+
const emit = defineEmits<{
|
|
48
52
|
(e: 'update:isOpen', value: boolean): void
|
|
53
|
+
(e: 'update:maskedModel', value: string): void
|
|
49
54
|
}>()
|
|
55
|
+
|
|
56
|
+
const maskedModel = computed({
|
|
57
|
+
get: () => props.maskedModel,
|
|
58
|
+
set: (value) => emit('update:maskedModel', value)
|
|
59
|
+
})
|
|
50
60
|
</script>
|
|
51
61
|
|
|
52
62
|
<style lang="scss" scoped>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
|
|
2
|
+
maskedModel: string;
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
step: number;
|
|
5
5
|
format: string;
|
|
@@ -7,13 +7,17 @@ type __VLS_Props = {
|
|
|
7
7
|
endHour?: string;
|
|
8
8
|
placeholder: string;
|
|
9
9
|
disabled: boolean;
|
|
10
|
-
|
|
10
|
+
showClear: boolean;
|
|
11
|
+
textboxClicked: () => void;
|
|
11
12
|
closeDropdown: () => void;
|
|
12
13
|
onTimeSelect: (time: string) => void;
|
|
14
|
+
clear: () => void;
|
|
13
15
|
};
|
|
14
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
|
+
"update:maskedModel": (value: string) => any;
|
|
15
18
|
"update:isOpen": (value: boolean) => any;
|
|
16
19
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
17
21
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
18
22
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
23
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KMaskTextbox
|
|
2
|
+
.KMaskTextbox(@click.stop)
|
|
3
3
|
KTextbox(
|
|
4
4
|
:modelValue="maskedValue"
|
|
5
5
|
:placeholder="placeholder"
|
|
6
6
|
:showClear="showClear"
|
|
7
|
+
:clear="handleClear"
|
|
7
8
|
:maxlength="mask.length"
|
|
8
9
|
@update:modelValue="handleUpdate"
|
|
9
10
|
@beforeinput="handleBeforeInput"
|
|
@@ -118,6 +119,10 @@ const handleBeforeInput = (event: InputEvent) => {
|
|
|
118
119
|
const handleUpdate = (value: string) => {
|
|
119
120
|
emit('update:maskedValue', value)
|
|
120
121
|
}
|
|
122
|
+
|
|
123
|
+
const handleClear = () => {
|
|
124
|
+
emit('clear')
|
|
125
|
+
}
|
|
121
126
|
</script>
|
|
122
127
|
|
|
123
128
|
<style lang="scss" scoped>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
KGrid(align="center" noGap).KTextbox
|
|
3
3
|
input(:type="props.type" v-model="text" :placeholder="placeholder")
|
|
4
|
-
KIcon(v-if="
|
|
4
|
+
KIcon(v-if="showClear" @click.stop="clear" @mousedown.stop iconname="close" width="12" height="12").closeIcon
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script lang="ts" setup>
|
|
@@ -9,7 +9,7 @@ import { computed } from 'vue'
|
|
|
9
9
|
// Default template for KTextbox
|
|
10
10
|
const props = defineProps<{
|
|
11
11
|
text: string
|
|
12
|
-
|
|
12
|
+
showClear: boolean
|
|
13
13
|
clear: () => void
|
|
14
14
|
placeholder: string
|
|
15
15
|
type: string
|