@katlux/toolkit 0.1.0-beta.50 → 0.1.0-beta.52
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.global.d.vue.ts +1 -1
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +21 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +3 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +21 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +11 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +9 -0
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +47 -6
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +47 -6
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +25 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +61 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +29 -9
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +2 -21
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +29 -9
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +15 -4
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.js +16 -5
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +22 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +3 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +22 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +11 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +9 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +22 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +3 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +22 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +11 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +9 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +21 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue +3 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +21 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.d.ts +12 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.js +9 -0
- package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +1 -1
- package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +21 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue +3 -1
- 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/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 +20 -0
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +3 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +20 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +11 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +9 -0
- 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.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +35 -6
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +8 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +35 -6
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +17 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +18 -1
- package/dist/runtime/presets/default/assets/scss/index.css +27 -0
- package/dist/runtime/presets/default/assets/scss/index.scss +30 -0
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +10 -6
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +25 -21
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -2
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +91 -79
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +13 -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 +12 -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 +2 -0
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +4 -0
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +4 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +10 -6
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +5 -1
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +7 -3
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +2 -0
- 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/KTreePicker/KTreePicker.d.vue.ts +4 -0
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +11 -1
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue.d.ts +4 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -46,7 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
46
46
|
}>> & Readonly<{
|
|
47
47
|
onClick?: (() => any) | undefined;
|
|
48
48
|
}>, {
|
|
49
|
-
size: "
|
|
49
|
+
size: "large" | "medium" | "small" | undefined;
|
|
50
50
|
type: "info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | undefined;
|
|
51
51
|
disabled: boolean;
|
|
52
52
|
href: string;
|
|
@@ -46,7 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
46
46
|
}>> & Readonly<{
|
|
47
47
|
onClick?: (() => any) | undefined;
|
|
48
48
|
}>, {
|
|
49
|
-
size: "
|
|
49
|
+
size: "large" | "medium" | "small" | undefined;
|
|
50
50
|
type: "info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | undefined;
|
|
51
51
|
disabled: boolean;
|
|
52
52
|
href: string;
|
|
@@ -22,7 +22,7 @@ export interface KButtonEmits {
|
|
|
22
22
|
export declare function useKButtonLogic(props: KButtonProps, emit: KButtonEmits): {
|
|
23
23
|
isLink: import("vue").ComputedRef<boolean>;
|
|
24
24
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
25
|
-
buttonClasses: import("vue").ComputedRef<("info" | "default" | "
|
|
25
|
+
buttonClasses: import("vue").ComputedRef<("info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "large" | "medium" | "small" | {
|
|
26
26
|
disabled: boolean | undefined;
|
|
27
27
|
})[]>;
|
|
28
28
|
onClick: () => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KCheckboxProps } from './KCheckbox.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
disabled: {
|
|
3
4
|
type: BooleanConstructor;
|
|
@@ -7,6 +8,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
7
8
|
type: import("vue").PropType<any>;
|
|
8
9
|
default: undefined;
|
|
9
10
|
};
|
|
11
|
+
validation: {
|
|
12
|
+
type: import("vue").PropType<KCheckboxProps["validation"]>;
|
|
13
|
+
default: null;
|
|
14
|
+
validator: (value: string) => boolean;
|
|
15
|
+
};
|
|
16
|
+
validationText: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
10
20
|
modelValue: {
|
|
11
21
|
type: import("vue").PropType<any>;
|
|
12
22
|
};
|
|
@@ -21,6 +31,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
21
31
|
type: import("vue").PropType<any>;
|
|
22
32
|
default: undefined;
|
|
23
33
|
};
|
|
34
|
+
validation: {
|
|
35
|
+
type: import("vue").PropType<KCheckboxProps["validation"]>;
|
|
36
|
+
default: null;
|
|
37
|
+
validator: (value: string) => boolean;
|
|
38
|
+
};
|
|
39
|
+
validationText: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
24
43
|
modelValue: {
|
|
25
44
|
type: import("vue").PropType<any>;
|
|
26
45
|
};
|
|
@@ -29,6 +48,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
29
48
|
}>, {
|
|
30
49
|
value: any;
|
|
31
50
|
disabled: boolean;
|
|
51
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
52
|
+
validationText: string;
|
|
32
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
54
|
declare const _default: typeof __VLS_export;
|
|
34
55
|
export default _default;
|
|
@@ -10,7 +10,9 @@ const presetComponent = usePresetComponent("KCheckbox", KCheckboxDefault);
|
|
|
10
10
|
const templateProps = computed(() => ({
|
|
11
11
|
model: model.value,
|
|
12
12
|
checkboxValue: checkboxValue.value,
|
|
13
|
-
isDisabled: isDisabled.value
|
|
13
|
+
isDisabled: isDisabled.value,
|
|
14
|
+
validation: props.validation,
|
|
15
|
+
validationText: props.validationText
|
|
14
16
|
}));
|
|
15
17
|
</script>
|
|
16
18
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KCheckboxProps } from './KCheckbox.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
disabled: {
|
|
3
4
|
type: BooleanConstructor;
|
|
@@ -7,6 +8,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
7
8
|
type: import("vue").PropType<any>;
|
|
8
9
|
default: undefined;
|
|
9
10
|
};
|
|
11
|
+
validation: {
|
|
12
|
+
type: import("vue").PropType<KCheckboxProps["validation"]>;
|
|
13
|
+
default: null;
|
|
14
|
+
validator: (value: string) => boolean;
|
|
15
|
+
};
|
|
16
|
+
validationText: {
|
|
17
|
+
type: StringConstructor;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
10
20
|
modelValue: {
|
|
11
21
|
type: import("vue").PropType<any>;
|
|
12
22
|
};
|
|
@@ -21,6 +31,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
21
31
|
type: import("vue").PropType<any>;
|
|
22
32
|
default: undefined;
|
|
23
33
|
};
|
|
34
|
+
validation: {
|
|
35
|
+
type: import("vue").PropType<KCheckboxProps["validation"]>;
|
|
36
|
+
default: null;
|
|
37
|
+
validator: (value: string) => boolean;
|
|
38
|
+
};
|
|
39
|
+
validationText: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
24
43
|
modelValue: {
|
|
25
44
|
type: import("vue").PropType<any>;
|
|
26
45
|
};
|
|
@@ -29,6 +48,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
29
48
|
}>, {
|
|
30
49
|
value: any;
|
|
31
50
|
disabled: boolean;
|
|
51
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
52
|
+
validationText: string;
|
|
32
53
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
33
54
|
declare const _default: typeof __VLS_export;
|
|
34
55
|
export default _default;
|
|
@@ -2,6 +2,8 @@ import { type PropType } from 'vue';
|
|
|
2
2
|
export interface KCheckboxProps {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
value?: any;
|
|
5
|
+
validation?: 'success' | 'warning' | 'error' | null;
|
|
6
|
+
validationText?: string;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* KCheckbox Logic Composable
|
|
@@ -25,4 +27,13 @@ export declare const KCheckboxDefaultProps: {
|
|
|
25
27
|
type: PropType<any>;
|
|
26
28
|
default: undefined;
|
|
27
29
|
};
|
|
30
|
+
validation: {
|
|
31
|
+
type: PropType<KCheckboxProps["validation"]>;
|
|
32
|
+
default: null;
|
|
33
|
+
validator: (value: string) => boolean;
|
|
34
|
+
};
|
|
35
|
+
validationText: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
28
39
|
};
|
|
@@ -16,5 +16,14 @@ export const KCheckboxDefaultProps = {
|
|
|
16
16
|
value: {
|
|
17
17
|
type: [String, Number, Boolean, Object],
|
|
18
18
|
default: void 0
|
|
19
|
+
},
|
|
20
|
+
validation: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: null,
|
|
23
|
+
validator: (value) => [null, "success", "warning", "error"].includes(value)
|
|
24
|
+
},
|
|
25
|
+
validationText: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
19
28
|
}
|
|
20
29
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KComboboxProps } from './KCombobox.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
dataProvider: {
|
|
3
4
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
@@ -35,16 +36,34 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
35
36
|
type: StringConstructor;
|
|
36
37
|
required: boolean;
|
|
37
38
|
};
|
|
39
|
+
valueField: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: null;
|
|
42
|
+
};
|
|
38
43
|
modelValue: {
|
|
39
|
-
type: import("vue").PropType<
|
|
44
|
+
type: import("vue").PropType<any>;
|
|
40
45
|
default: null;
|
|
41
46
|
};
|
|
42
47
|
teleportTo: {
|
|
43
48
|
type: import("vue").PropType<string>;
|
|
44
49
|
default: undefined;
|
|
45
50
|
};
|
|
51
|
+
validation: {
|
|
52
|
+
type: import("vue").PropType<KComboboxProps["validation"]>;
|
|
53
|
+
default: null;
|
|
54
|
+
validator: (value: string) => boolean;
|
|
55
|
+
};
|
|
56
|
+
validationText: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
isOptionsOpen: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
46
64
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
47
|
-
"update:modelValue": (value:
|
|
65
|
+
"update:modelValue": (value: any) => any;
|
|
66
|
+
"update:isOptionsOpen": (value: boolean) => any;
|
|
48
67
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
68
|
dataProvider: {
|
|
50
69
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
@@ -82,26 +101,48 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
82
101
|
type: StringConstructor;
|
|
83
102
|
required: boolean;
|
|
84
103
|
};
|
|
104
|
+
valueField: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
default: null;
|
|
107
|
+
};
|
|
85
108
|
modelValue: {
|
|
86
|
-
type: import("vue").PropType<
|
|
109
|
+
type: import("vue").PropType<any>;
|
|
87
110
|
default: null;
|
|
88
111
|
};
|
|
89
112
|
teleportTo: {
|
|
90
113
|
type: import("vue").PropType<string>;
|
|
91
114
|
default: undefined;
|
|
92
115
|
};
|
|
116
|
+
validation: {
|
|
117
|
+
type: import("vue").PropType<KComboboxProps["validation"]>;
|
|
118
|
+
default: null;
|
|
119
|
+
validator: (value: string) => boolean;
|
|
120
|
+
};
|
|
121
|
+
validationText: {
|
|
122
|
+
type: StringConstructor;
|
|
123
|
+
default: string;
|
|
124
|
+
};
|
|
125
|
+
isOptionsOpen: {
|
|
126
|
+
type: BooleanConstructor;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
93
129
|
}>> & Readonly<{
|
|
94
|
-
"onUpdate:modelValue"?: ((value:
|
|
130
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
131
|
+
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
95
132
|
}>, {
|
|
96
133
|
disabled: boolean;
|
|
97
|
-
|
|
98
|
-
|
|
134
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
135
|
+
validationText: string;
|
|
136
|
+
modelValue: any;
|
|
99
137
|
searchbox: boolean;
|
|
138
|
+
isOptionsOpen: boolean;
|
|
139
|
+
placeholder: string;
|
|
100
140
|
teleportTo: string;
|
|
101
141
|
closeOnSelect: boolean;
|
|
102
142
|
multiSelect: boolean;
|
|
103
143
|
maxSelectedDisplay: string | number | boolean;
|
|
104
144
|
visibleFields: String[];
|
|
145
|
+
valueField: string;
|
|
105
146
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
106
147
|
declare const _default: typeof __VLS_export;
|
|
107
148
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useKComboboxLogic, KComboboxDefaultProps } from "./KCombobox.logic";
|
|
3
3
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
-
import { computed } from "vue";
|
|
4
|
+
import { computed, watch } from "vue";
|
|
5
5
|
import KComboboxDefault from "../../presets/default/components/KCombobox/KCombobox.vue";
|
|
6
6
|
const props = defineProps(KComboboxDefaultProps);
|
|
7
|
-
const emit = defineEmits(["update:modelValue"]);
|
|
7
|
+
const emit = defineEmits(["update:modelValue", "update:isOptionsOpen"]);
|
|
8
8
|
const {
|
|
9
9
|
selectedItems,
|
|
10
10
|
isOptionsOpen,
|
|
@@ -17,6 +17,9 @@ const {
|
|
|
17
17
|
filteredOptions,
|
|
18
18
|
loading
|
|
19
19
|
} = useKComboboxLogic(props, emit);
|
|
20
|
+
watch(isOptionsOpen, (newVal) => {
|
|
21
|
+
emit("update:isOptionsOpen", newVal);
|
|
22
|
+
});
|
|
20
23
|
const presetComponent = usePresetComponent("KCombobox", KComboboxDefault);
|
|
21
24
|
const templateProps = computed(() => ({
|
|
22
25
|
disabled: props.disabled,
|
|
@@ -32,7 +35,10 @@ const templateProps = computed(() => ({
|
|
|
32
35
|
selectItem,
|
|
33
36
|
isSelected,
|
|
34
37
|
loading: loading.value,
|
|
35
|
-
teleportTo: props.teleportTo
|
|
38
|
+
teleportTo: props.teleportTo,
|
|
39
|
+
valueField: props.valueField,
|
|
40
|
+
validation: props.validation,
|
|
41
|
+
validationText: props.validationText
|
|
36
42
|
}));
|
|
37
43
|
function updateSearchText(val) {
|
|
38
44
|
searchtext.value = val;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type KComboboxProps } from './KCombobox.logic.js';
|
|
1
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
dataProvider: {
|
|
3
4
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
@@ -35,16 +36,34 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
35
36
|
type: StringConstructor;
|
|
36
37
|
required: boolean;
|
|
37
38
|
};
|
|
39
|
+
valueField: {
|
|
40
|
+
type: StringConstructor;
|
|
41
|
+
default: null;
|
|
42
|
+
};
|
|
38
43
|
modelValue: {
|
|
39
|
-
type: import("vue").PropType<
|
|
44
|
+
type: import("vue").PropType<any>;
|
|
40
45
|
default: null;
|
|
41
46
|
};
|
|
42
47
|
teleportTo: {
|
|
43
48
|
type: import("vue").PropType<string>;
|
|
44
49
|
default: undefined;
|
|
45
50
|
};
|
|
51
|
+
validation: {
|
|
52
|
+
type: import("vue").PropType<KComboboxProps["validation"]>;
|
|
53
|
+
default: null;
|
|
54
|
+
validator: (value: string) => boolean;
|
|
55
|
+
};
|
|
56
|
+
validationText: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: string;
|
|
59
|
+
};
|
|
60
|
+
isOptionsOpen: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
46
64
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
47
|
-
"update:modelValue": (value:
|
|
65
|
+
"update:modelValue": (value: any) => any;
|
|
66
|
+
"update:isOptionsOpen": (value: boolean) => any;
|
|
48
67
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
68
|
dataProvider: {
|
|
50
69
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
@@ -82,26 +101,48 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
82
101
|
type: StringConstructor;
|
|
83
102
|
required: boolean;
|
|
84
103
|
};
|
|
104
|
+
valueField: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
default: null;
|
|
107
|
+
};
|
|
85
108
|
modelValue: {
|
|
86
|
-
type: import("vue").PropType<
|
|
109
|
+
type: import("vue").PropType<any>;
|
|
87
110
|
default: null;
|
|
88
111
|
};
|
|
89
112
|
teleportTo: {
|
|
90
113
|
type: import("vue").PropType<string>;
|
|
91
114
|
default: undefined;
|
|
92
115
|
};
|
|
116
|
+
validation: {
|
|
117
|
+
type: import("vue").PropType<KComboboxProps["validation"]>;
|
|
118
|
+
default: null;
|
|
119
|
+
validator: (value: string) => boolean;
|
|
120
|
+
};
|
|
121
|
+
validationText: {
|
|
122
|
+
type: StringConstructor;
|
|
123
|
+
default: string;
|
|
124
|
+
};
|
|
125
|
+
isOptionsOpen: {
|
|
126
|
+
type: BooleanConstructor;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
93
129
|
}>> & Readonly<{
|
|
94
|
-
"onUpdate:modelValue"?: ((value:
|
|
130
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
131
|
+
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
95
132
|
}>, {
|
|
96
133
|
disabled: boolean;
|
|
97
|
-
|
|
98
|
-
|
|
134
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
135
|
+
validationText: string;
|
|
136
|
+
modelValue: any;
|
|
99
137
|
searchbox: boolean;
|
|
138
|
+
isOptionsOpen: boolean;
|
|
139
|
+
placeholder: string;
|
|
100
140
|
teleportTo: string;
|
|
101
141
|
closeOnSelect: boolean;
|
|
102
142
|
multiSelect: boolean;
|
|
103
143
|
maxSelectedDisplay: string | number | boolean;
|
|
104
144
|
visibleFields: String[];
|
|
145
|
+
valueField: string;
|
|
105
146
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
106
147
|
declare const _default: typeof __VLS_export;
|
|
107
148
|
export default _default;
|
|
@@ -12,11 +12,16 @@ export interface KComboboxProps {
|
|
|
12
12
|
searchbox?: boolean;
|
|
13
13
|
visibleFields?: Array<String> | null;
|
|
14
14
|
labelField: string;
|
|
15
|
-
|
|
15
|
+
valueField?: string;
|
|
16
|
+
modelValue?: any;
|
|
16
17
|
teleportTo?: string;
|
|
18
|
+
isOptionsOpen?: boolean;
|
|
19
|
+
validation?: 'success' | 'warning' | 'error' | null;
|
|
20
|
+
validationText?: string;
|
|
17
21
|
}
|
|
18
22
|
export interface KComboboxEmits {
|
|
19
|
-
(e: 'update:modelValue', value:
|
|
23
|
+
(e: 'update:modelValue', value: any): void;
|
|
24
|
+
(e: 'update:isOptionsOpen', value: boolean): void;
|
|
20
25
|
}
|
|
21
26
|
export declare const KComboboxDefaultProps: {
|
|
22
27
|
dataProvider: {
|
|
@@ -55,14 +60,31 @@ export declare const KComboboxDefaultProps: {
|
|
|
55
60
|
type: StringConstructor;
|
|
56
61
|
required: boolean;
|
|
57
62
|
};
|
|
63
|
+
valueField: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: null;
|
|
66
|
+
};
|
|
58
67
|
modelValue: {
|
|
59
|
-
type: PropType<
|
|
68
|
+
type: PropType<any>;
|
|
60
69
|
default: null;
|
|
61
70
|
};
|
|
62
71
|
teleportTo: {
|
|
63
72
|
type: PropType<string>;
|
|
64
73
|
default: undefined;
|
|
65
74
|
};
|
|
75
|
+
validation: {
|
|
76
|
+
type: PropType<KComboboxProps["validation"]>;
|
|
77
|
+
default: null;
|
|
78
|
+
validator: (value: string) => boolean;
|
|
79
|
+
};
|
|
80
|
+
validationText: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
84
|
+
isOptionsOpen: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
66
88
|
};
|
|
67
89
|
export declare function useKComboboxLogic(props: KComboboxProps, emit: KComboboxEmits): {
|
|
68
90
|
selectedItems: import("vue").Ref<TDataRow[] | null, TDataRow[] | null>;
|
|
@@ -39,19 +39,41 @@ export const KComboboxDefaultProps = {
|
|
|
39
39
|
type: String,
|
|
40
40
|
required: true
|
|
41
41
|
},
|
|
42
|
+
valueField: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: null
|
|
45
|
+
},
|
|
42
46
|
modelValue: {
|
|
43
|
-
type: [Object, Array],
|
|
47
|
+
type: [Object, Array, String, Number],
|
|
44
48
|
default: null
|
|
45
49
|
},
|
|
46
50
|
teleportTo: {
|
|
47
51
|
type: String,
|
|
48
52
|
default: void 0
|
|
53
|
+
},
|
|
54
|
+
validation: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: null,
|
|
57
|
+
validator: (value) => [null, "success", "warning", "error"].includes(value)
|
|
58
|
+
},
|
|
59
|
+
validationText: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ""
|
|
62
|
+
},
|
|
63
|
+
isOptionsOpen: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: void 0
|
|
49
66
|
}
|
|
50
67
|
};
|
|
51
68
|
export function useKComboboxLogic(props, emit) {
|
|
52
69
|
const selectedItems = ref(null);
|
|
53
70
|
const isOptionsOpen = ref(false);
|
|
54
71
|
const searchtext = ref("");
|
|
72
|
+
watch(() => props.isOptionsOpen, (newVal) => {
|
|
73
|
+
if (newVal !== void 0 && newVal !== isOptionsOpen.value) {
|
|
74
|
+
isOptionsOpen.value = newVal;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
55
77
|
function selectItem(option) {
|
|
56
78
|
if (props.multiSelect) {
|
|
57
79
|
if (isSelected(option)) {
|
|
@@ -66,12 +88,17 @@ export function useKComboboxLogic(props, emit) {
|
|
|
66
88
|
}
|
|
67
89
|
isOptionsOpen.value = !props.closeOnSelect;
|
|
68
90
|
if (props.multiSelect) {
|
|
69
|
-
|
|
91
|
+
const value = props.valueField ? selectedItems.value?.map((item) => item[props.valueField]) : selectedItems.value;
|
|
92
|
+
emit("update:modelValue", value);
|
|
70
93
|
} else {
|
|
71
|
-
|
|
94
|
+
const value = props.valueField ? selectedItems.value?.[0]?.[props.valueField] : selectedItems.value?.[0];
|
|
95
|
+
emit("update:modelValue", value || null);
|
|
72
96
|
}
|
|
73
97
|
}
|
|
74
98
|
function isSelected(option) {
|
|
99
|
+
if (props.valueField) {
|
|
100
|
+
return selectedItems.value?.some((item) => item[props.valueField] === option[props.valueField]);
|
|
101
|
+
}
|
|
75
102
|
return selectedItems.value?.some((item) => item[props.labelField] === option[props.labelField]);
|
|
76
103
|
}
|
|
77
104
|
function getSelectedContent() {
|
|
@@ -118,16 +145,44 @@ export function useKComboboxLogic(props, emit) {
|
|
|
118
145
|
const filteredOptions = computed(() => {
|
|
119
146
|
return props.dataProvider?.pageData.value || [];
|
|
120
147
|
});
|
|
148
|
+
function resolveSelectedFromValue() {
|
|
149
|
+
if (!props.modelValue) {
|
|
150
|
+
selectedItems.value = null;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (!props.valueField) {
|
|
154
|
+
selectedItems.value = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const provider = props.dataProvider;
|
|
158
|
+
const data = provider?.allData?.value || provider?.pageData?.value || [];
|
|
159
|
+
if (data.length === 0) return;
|
|
160
|
+
const values = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
161
|
+
const matchedItems = data.filter((item) => values.includes(item[props.valueField]));
|
|
162
|
+
if (matchedItems.length > 0) {
|
|
163
|
+
selectedItems.value = matchedItems;
|
|
164
|
+
} else if (typeof props.modelValue === "object") {
|
|
165
|
+
selectedItems.value = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
166
|
+
}
|
|
167
|
+
}
|
|
121
168
|
onMounted(() => {
|
|
122
|
-
|
|
169
|
+
resolveSelectedFromValue();
|
|
123
170
|
if (props.searchbox && props.dataProvider?.filter) {
|
|
124
171
|
props.dataProvider.filter.value = null;
|
|
125
172
|
}
|
|
126
173
|
});
|
|
127
174
|
watch(
|
|
128
175
|
() => props.modelValue,
|
|
129
|
-
(
|
|
130
|
-
|
|
176
|
+
() => {
|
|
177
|
+
resolveSelectedFromValue();
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
watch(
|
|
181
|
+
() => props.dataProvider?.allData?.value || props.dataProvider?.pageData?.value,
|
|
182
|
+
(newData) => {
|
|
183
|
+
if (newData && newData.length > 0 && props.modelValue && (!selectedItems.value || selectedItems.value.length === 0 || !selectedItems.value[0][props.labelField])) {
|
|
184
|
+
resolveSelectedFromValue();
|
|
185
|
+
}
|
|
131
186
|
}
|
|
132
187
|
);
|
|
133
188
|
return {
|
|
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
12
12
|
type: import("vue").PropType<import("./KCompositeInput.logic.js").ICompositeItem[]>;
|
|
13
13
|
default: () => never[];
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
type: import("vue").PropType<
|
|
15
|
+
dataProvider: {
|
|
16
|
+
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
17
17
|
required: boolean;
|
|
18
18
|
};
|
|
19
19
|
type: {
|
|
@@ -60,6 +60,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
60
60
|
type: StringConstructor;
|
|
61
61
|
default: undefined;
|
|
62
62
|
};
|
|
63
|
+
validation: {
|
|
64
|
+
type: import("vue").PropType<KCompositeInputProps["validation"]>;
|
|
65
|
+
default: null;
|
|
66
|
+
validator: (value: string) => boolean;
|
|
67
|
+
};
|
|
68
|
+
validationText: {
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
63
72
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
64
73
|
"update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
|
|
65
74
|
"update:selectionValue": (value: any) => any;
|
|
@@ -77,8 +86,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
77
86
|
type: import("vue").PropType<import("./KCompositeInput.logic.js").ICompositeItem[]>;
|
|
78
87
|
default: () => never[];
|
|
79
88
|
};
|
|
80
|
-
|
|
81
|
-
type: import("vue").PropType<
|
|
89
|
+
dataProvider: {
|
|
90
|
+
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
82
91
|
required: boolean;
|
|
83
92
|
};
|
|
84
93
|
type: {
|
|
@@ -125,25 +134,36 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
125
134
|
type: StringConstructor;
|
|
126
135
|
default: undefined;
|
|
127
136
|
};
|
|
137
|
+
validation: {
|
|
138
|
+
type: import("vue").PropType<KCompositeInputProps["validation"]>;
|
|
139
|
+
default: null;
|
|
140
|
+
validator: (value: string) => boolean;
|
|
141
|
+
};
|
|
142
|
+
validationText: {
|
|
143
|
+
type: StringConstructor;
|
|
144
|
+
default: string;
|
|
145
|
+
};
|
|
128
146
|
}>> & Readonly<{
|
|
129
147
|
"onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
|
|
130
148
|
"onUpdate:selectionValue"?: ((value: any) => any) | undefined;
|
|
131
149
|
"onUpdate:inputValue"?: ((value: any) => any) | undefined;
|
|
132
150
|
}>, {
|
|
133
151
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
152
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
153
|
+
validationText: string;
|
|
134
154
|
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
155
|
+
searchbox: boolean;
|
|
156
|
+
labelField: string;
|
|
157
|
+
placeholder: string;
|
|
158
|
+
teleportTo: string;
|
|
159
|
+
valueField: string;
|
|
135
160
|
inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
136
161
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
137
162
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
138
163
|
selectionSide: import("./KCompositeInput.logic.js").SelectionSide;
|
|
139
164
|
mask: string;
|
|
140
|
-
labelField: string;
|
|
141
|
-
valueField: string;
|
|
142
|
-
placeholder: string;
|
|
143
165
|
inputPlaceholder: string;
|
|
144
|
-
searchbox: boolean;
|
|
145
166
|
showClear: boolean;
|
|
146
|
-
teleportTo: string;
|
|
147
167
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
148
168
|
declare const _default: typeof __VLS_export;
|
|
149
169
|
export default _default;
|