@katlux/toolkit 0.1.0-beta.73 → 0.1.0-beta.75
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 +9 -0
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +1 -0
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +9 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +5 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +11 -7
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +45 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +11 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +45 -0
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +61 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.js +112 -9
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +10 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +1 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +10 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +5 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +12 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +10 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +1 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +10 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +5 -0
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +7 -0
- package/dist/runtime/components/KDropdown/KDropdown.logic.js +11 -29
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +9 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue +1 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +9 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.d.ts +5 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.logic.js +4 -0
- package/dist/runtime/components/KHourSelect/KHourSelect.global.d.vue.ts +9 -0
- package/dist/runtime/components/KHourSelect/KHourSelect.global.vue +1 -0
- package/dist/runtime/components/KHourSelect/KHourSelect.global.vue.d.ts +9 -0
- package/dist/runtime/components/KHourSelect/KHourSelect.logic.d.ts +5 -0
- package/dist/runtime/components/KHourSelect/KHourSelect.logic.js +4 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +9 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue +1 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +9 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.d.ts +5 -0
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +14 -5
- package/dist/runtime/components/KRangeSlider/KRangeSlider.global.d.vue.ts +9 -0
- package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue +1 -0
- package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue.d.ts +9 -0
- package/dist/runtime/components/KRangeSlider/KRangeSlider.logic.d.ts +5 -0
- package/dist/runtime/components/KRangeSlider/KRangeSlider.logic.js +4 -0
- package/dist/runtime/components/KSearchTree/KSearchTree.logic.d.ts +7 -1
- package/dist/runtime/components/KSearchTree/KSearchTree.logic.js +6 -1
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.d.ts +7 -1
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.js +6 -1
- package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +9 -0
- package/dist/runtime/components/KSlider/KSlider.global.vue +1 -0
- package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +9 -0
- package/dist/runtime/components/KSlider/KSlider.logic.d.ts +5 -0
- package/dist/runtime/components/KSlider/KSlider.logic.js +4 -0
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +9 -0
- package/dist/runtime/components/KTextarea/KTextarea.global.vue +1 -0
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +9 -0
- package/dist/runtime/components/KTextarea/KTextarea.logic.d.ts +5 -0
- package/dist/runtime/components/KTextarea/KTextarea.logic.js +4 -0
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +9 -0
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +1 -0
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +9 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +9 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +1 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +9 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +5 -0
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +4 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +3 -0
- package/dist/runtime/presets/default/assets/scss/index.css +11 -0
- package/dist/runtime/presets/default/assets/scss/index.scss +8 -1
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +22 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +5 -0
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +79 -47
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +5 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +2 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +2 -0
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +2 -0
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KHourSelect/KHourSelect.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KHourSelect/KHourSelect.vue +2 -0
- package/dist/runtime/presets/default/components/KHourSelect/KHourSelect.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +2 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +2 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue +9 -1
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue +9 -1
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KSlider/KSlider.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +2 -0
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +3 -1
- package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +36 -8
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +2 -0
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue.d.ts +1 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type KComboboxProps } from './KCombobox.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
label: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
3
7
|
dataProvider: {
|
|
4
8
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
5
9
|
required: boolean;
|
|
@@ -73,6 +77,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
73
77
|
"update:modelValue": (value: any) => any;
|
|
74
78
|
"update:isOptionsOpen": (value: boolean) => any;
|
|
75
79
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
|
+
label: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
76
84
|
dataProvider: {
|
|
77
85
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
78
86
|
required: boolean;
|
|
@@ -146,6 +154,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
146
154
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
147
155
|
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
148
156
|
}>, {
|
|
157
|
+
label: string;
|
|
149
158
|
disabled: boolean;
|
|
150
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
151
160
|
validationText: string;
|
|
@@ -22,6 +22,7 @@ watch(isOptionsOpen, (newVal) => {
|
|
|
22
22
|
});
|
|
23
23
|
const presetComponent = usePresetComponent("KCombobox", KComboboxDefault);
|
|
24
24
|
const templateProps = computed(() => ({
|
|
25
|
+
label: props.label,
|
|
25
26
|
disabled: props.disabled,
|
|
26
27
|
isOptionsOpen: isOptionsOpen.value,
|
|
27
28
|
labelField: props.labelField,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type KComboboxProps } from './KCombobox.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
label: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
3
7
|
dataProvider: {
|
|
4
8
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
5
9
|
required: boolean;
|
|
@@ -73,6 +77,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
73
77
|
"update:modelValue": (value: any) => any;
|
|
74
78
|
"update:isOptionsOpen": (value: boolean) => any;
|
|
75
79
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
|
+
label: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
76
84
|
dataProvider: {
|
|
77
85
|
type: import("vue").PropType<import("@katlux/providers").ADataProvider>;
|
|
78
86
|
required: boolean;
|
|
@@ -146,6 +154,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
146
154
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
147
155
|
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
148
156
|
}>, {
|
|
157
|
+
label: string;
|
|
149
158
|
disabled: boolean;
|
|
150
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
151
160
|
validationText: string;
|
|
@@ -3,6 +3,7 @@ import { type TDataRow } from '@katlux/providers';
|
|
|
3
3
|
import { type PropType } from 'vue';
|
|
4
4
|
export type ComboboxItem = TDataRow;
|
|
5
5
|
export interface KComboboxProps {
|
|
6
|
+
label?: string;
|
|
6
7
|
dataProvider: ADataProvider;
|
|
7
8
|
closeOnSelect?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
@@ -26,6 +27,10 @@ export interface KComboboxEmits {
|
|
|
26
27
|
(e: 'update:isOptionsOpen', value: boolean): void;
|
|
27
28
|
}
|
|
28
29
|
export declare const KComboboxDefaultProps: {
|
|
30
|
+
label: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
29
34
|
dataProvider: {
|
|
30
35
|
type: PropType<ADataProvider>;
|
|
31
36
|
required: boolean;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EDataFilterOperator
|
|
3
3
|
} from "@katlux/providers";
|
|
4
|
-
import { ref, watch, computed, onMounted } from "vue";
|
|
4
|
+
import { ref, watch, computed, onMounted, unref } from "vue";
|
|
5
5
|
export const KComboboxDefaultProps = {
|
|
6
|
+
label: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ""
|
|
9
|
+
},
|
|
6
10
|
dataProvider: {
|
|
7
11
|
type: Object,
|
|
8
12
|
required: true
|
|
@@ -147,11 +151,11 @@ export function useKComboboxLogic(props, emit) {
|
|
|
147
151
|
field: { [props.labelField]: newText.trim().toLowerCase() },
|
|
148
152
|
active: newText.trim().toLowerCase() != ""
|
|
149
153
|
};
|
|
150
|
-
props.dataProvider.filter
|
|
154
|
+
props.dataProvider.setFilter(filter);
|
|
151
155
|
}
|
|
152
156
|
);
|
|
153
157
|
const filteredOptions = computed(() => {
|
|
154
|
-
return props.dataProvider?.pageData
|
|
158
|
+
return unref(props.dataProvider?.pageData) || [];
|
|
155
159
|
});
|
|
156
160
|
function resolveSelectedFromValue() {
|
|
157
161
|
if (!props.modelValue) {
|
|
@@ -163,7 +167,7 @@ export function useKComboboxLogic(props, emit) {
|
|
|
163
167
|
return;
|
|
164
168
|
}
|
|
165
169
|
const provider = props.dataProvider;
|
|
166
|
-
const data = provider?.allData
|
|
170
|
+
const data = unref(provider?.allData) || unref(provider?.pageData) || [];
|
|
167
171
|
if (data.length === 0) return;
|
|
168
172
|
const values = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
|
|
169
173
|
const matchedItems = data.filter((item) => values.includes(item[props.valueField]));
|
|
@@ -176,7 +180,7 @@ export function useKComboboxLogic(props, emit) {
|
|
|
176
180
|
onMounted(() => {
|
|
177
181
|
resolveSelectedFromValue();
|
|
178
182
|
if (props.searchbox && props.dataProvider?.filter) {
|
|
179
|
-
props.dataProvider.
|
|
183
|
+
props.dataProvider.setFilter(null);
|
|
180
184
|
}
|
|
181
185
|
});
|
|
182
186
|
watch(
|
|
@@ -186,7 +190,7 @@ export function useKComboboxLogic(props, emit) {
|
|
|
186
190
|
}
|
|
187
191
|
);
|
|
188
192
|
watch(
|
|
189
|
-
() => props.dataProvider?.allData
|
|
193
|
+
() => unref(props.dataProvider?.allData) || unref(props.dataProvider?.pageData),
|
|
190
194
|
(newData) => {
|
|
191
195
|
if (newData && newData.length > 0 && props.modelValue && (!selectedItems.value || selectedItems.value.length === 0 || !selectedItems.value[0][props.labelField])) {
|
|
192
196
|
resolveSelectedFromValue();
|
|
@@ -203,6 +207,6 @@ export function useKComboboxLogic(props, emit) {
|
|
|
203
207
|
toggleDropdown,
|
|
204
208
|
closeDropdown,
|
|
205
209
|
filteredOptions,
|
|
206
|
-
loading: computed(() => props.dataProvider?.loading
|
|
210
|
+
loading: computed(() => unref(props.dataProvider?.loading) ?? false)
|
|
207
211
|
};
|
|
208
212
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type KCompositeInputProps } from './KCompositeInput.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
label: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
3
7
|
selectionValue: {
|
|
4
8
|
type: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
5
9
|
default: null;
|
|
@@ -52,6 +56,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
52
56
|
type: BooleanConstructor;
|
|
53
57
|
default: boolean;
|
|
54
58
|
};
|
|
59
|
+
inputFormat: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
55
63
|
showClear: {
|
|
56
64
|
type: BooleanConstructor;
|
|
57
65
|
default: boolean;
|
|
@@ -69,11 +77,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
77
|
type: StringConstructor;
|
|
70
78
|
default: string;
|
|
71
79
|
};
|
|
80
|
+
inputConfigField: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
84
|
+
validateAll: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
88
|
+
singleValue: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
72
92
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
73
93
|
"update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
|
|
74
94
|
"update:selectionValue": (value: any) => any;
|
|
75
95
|
"update:inputValue": (value: any) => any;
|
|
76
96
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
97
|
+
label: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
default: string;
|
|
100
|
+
};
|
|
77
101
|
selectionValue: {
|
|
78
102
|
type: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
79
103
|
default: null;
|
|
@@ -126,6 +150,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
126
150
|
type: BooleanConstructor;
|
|
127
151
|
default: boolean;
|
|
128
152
|
};
|
|
153
|
+
inputFormat: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
129
157
|
showClear: {
|
|
130
158
|
type: BooleanConstructor;
|
|
131
159
|
default: boolean;
|
|
@@ -143,11 +171,24 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
143
171
|
type: StringConstructor;
|
|
144
172
|
default: string;
|
|
145
173
|
};
|
|
174
|
+
inputConfigField: {
|
|
175
|
+
type: StringConstructor;
|
|
176
|
+
default: string;
|
|
177
|
+
};
|
|
178
|
+
validateAll: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
singleValue: {
|
|
183
|
+
type: BooleanConstructor;
|
|
184
|
+
default: boolean;
|
|
185
|
+
};
|
|
146
186
|
}>> & Readonly<{
|
|
147
187
|
"onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
|
|
148
188
|
"onUpdate:selectionValue"?: ((value: any) => any) | undefined;
|
|
149
189
|
"onUpdate:inputValue"?: ((value: any) => any) | undefined;
|
|
150
190
|
}>, {
|
|
191
|
+
label: string;
|
|
151
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
152
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
153
194
|
validationText: string;
|
|
@@ -164,6 +205,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
164
205
|
mask: string;
|
|
165
206
|
inputPlaceholder: string;
|
|
166
207
|
showClear: boolean;
|
|
208
|
+
inputConfigField: string;
|
|
209
|
+
validateAll: boolean;
|
|
210
|
+
inputFormat: string;
|
|
211
|
+
singleValue: boolean;
|
|
167
212
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
168
213
|
declare const _default: typeof __VLS_export;
|
|
169
214
|
export default _default;
|
|
@@ -13,16 +13,25 @@ const {
|
|
|
13
13
|
internalSelectionValue,
|
|
14
14
|
internalInputValue,
|
|
15
15
|
selectionProps,
|
|
16
|
-
inputProps
|
|
16
|
+
inputProps,
|
|
17
|
+
resolvedInputConfig,
|
|
18
|
+
resolvedValidation,
|
|
19
|
+
resolvedValidationText
|
|
17
20
|
} = useKCompositeInputLogic(props, emit);
|
|
18
21
|
const presetComponent = usePresetComponent("KCompositeInput", KCompositeInputDefault);
|
|
19
22
|
const templateProps = computed(() => ({
|
|
23
|
+
label: props.label,
|
|
20
24
|
...props,
|
|
21
25
|
selectionValue: internalSelectionValue.value,
|
|
22
26
|
inputValue: internalInputValue.value,
|
|
23
27
|
modelValue: props.modelValue,
|
|
24
28
|
// Determine if searchbox is needed
|
|
25
|
-
searchbox: props.searchbox
|
|
29
|
+
searchbox: props.searchbox,
|
|
30
|
+
// Pass resolved input config for per-selection rendering
|
|
31
|
+
resolvedInputConfig: resolvedInputConfig.value,
|
|
32
|
+
// Pass resolved validation based on active vs validate-all logic
|
|
33
|
+
validation: resolvedValidation.value,
|
|
34
|
+
validationText: resolvedValidationText.value
|
|
26
35
|
}));
|
|
27
36
|
function updateSelection(val) {
|
|
28
37
|
internalSelectionValue.value = val;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type KCompositeInputProps } from './KCompositeInput.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
label: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
};
|
|
3
7
|
selectionValue: {
|
|
4
8
|
type: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
5
9
|
default: null;
|
|
@@ -52,6 +56,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
52
56
|
type: BooleanConstructor;
|
|
53
57
|
default: boolean;
|
|
54
58
|
};
|
|
59
|
+
inputFormat: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: undefined;
|
|
62
|
+
};
|
|
55
63
|
showClear: {
|
|
56
64
|
type: BooleanConstructor;
|
|
57
65
|
default: boolean;
|
|
@@ -69,11 +77,27 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
77
|
type: StringConstructor;
|
|
70
78
|
default: string;
|
|
71
79
|
};
|
|
80
|
+
inputConfigField: {
|
|
81
|
+
type: StringConstructor;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
84
|
+
validateAll: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
default: boolean;
|
|
87
|
+
};
|
|
88
|
+
singleValue: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
72
92
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
73
93
|
"update:modelValue": (value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any;
|
|
74
94
|
"update:selectionValue": (value: any) => any;
|
|
75
95
|
"update:inputValue": (value: any) => any;
|
|
76
96
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
97
|
+
label: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
default: string;
|
|
100
|
+
};
|
|
77
101
|
selectionValue: {
|
|
78
102
|
type: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
79
103
|
default: null;
|
|
@@ -126,6 +150,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
126
150
|
type: BooleanConstructor;
|
|
127
151
|
default: boolean;
|
|
128
152
|
};
|
|
153
|
+
inputFormat: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: undefined;
|
|
156
|
+
};
|
|
129
157
|
showClear: {
|
|
130
158
|
type: BooleanConstructor;
|
|
131
159
|
default: boolean;
|
|
@@ -143,11 +171,24 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
143
171
|
type: StringConstructor;
|
|
144
172
|
default: string;
|
|
145
173
|
};
|
|
174
|
+
inputConfigField: {
|
|
175
|
+
type: StringConstructor;
|
|
176
|
+
default: string;
|
|
177
|
+
};
|
|
178
|
+
validateAll: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
singleValue: {
|
|
183
|
+
type: BooleanConstructor;
|
|
184
|
+
default: boolean;
|
|
185
|
+
};
|
|
146
186
|
}>> & Readonly<{
|
|
147
187
|
"onUpdate:modelValue"?: ((value: import("./KCompositeInput.logic.js").ICompositeItem[]) => any) | undefined;
|
|
148
188
|
"onUpdate:selectionValue"?: ((value: any) => any) | undefined;
|
|
149
189
|
"onUpdate:inputValue"?: ((value: any) => any) | undefined;
|
|
150
190
|
}>, {
|
|
191
|
+
label: string;
|
|
151
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
152
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
153
194
|
validationText: string;
|
|
@@ -164,6 +205,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
164
205
|
mask: string;
|
|
165
206
|
inputPlaceholder: string;
|
|
166
207
|
showClear: boolean;
|
|
208
|
+
inputConfigField: string;
|
|
209
|
+
validateAll: boolean;
|
|
210
|
+
inputFormat: string;
|
|
211
|
+
singleValue: boolean;
|
|
167
212
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
168
213
|
declare const _default: typeof __VLS_export;
|
|
169
214
|
export default _default;
|
|
@@ -6,7 +6,40 @@ export interface ICompositeItem {
|
|
|
6
6
|
selection: any;
|
|
7
7
|
value: any;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Per-selection input configuration.
|
|
11
|
+
* Each item in the selection dataProvider can carry this config
|
|
12
|
+
* to control what input component renders and how it behaves
|
|
13
|
+
* when that item is selected.
|
|
14
|
+
*/
|
|
15
|
+
export interface ICompositeInputConfig {
|
|
16
|
+
/** Which input component to render */
|
|
17
|
+
type?: CompositeInputType;
|
|
18
|
+
/** For textbox: HTML input type (text, email, tel, number, etc.) */
|
|
19
|
+
inputType?: 'text' | 'password' | 'email' | 'url' | 'tel' | 'search' | 'number';
|
|
20
|
+
/** For maskedtextbox: mask pattern */
|
|
21
|
+
mask?: string;
|
|
22
|
+
/** Placeholder for the input (overrides inputPlaceholder) */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Show clear button */
|
|
25
|
+
showClear?: boolean;
|
|
26
|
+
/** For combobox type: a separate dataProvider for the input side */
|
|
27
|
+
inputDataProvider?: ADataProvider;
|
|
28
|
+
/** For combobox type: label field */
|
|
29
|
+
inputLabelField?: string;
|
|
30
|
+
/** For combobox type: value field */
|
|
31
|
+
inputValueField?: string;
|
|
32
|
+
/** For combobox type: enable searchbox */
|
|
33
|
+
inputSearchbox?: boolean;
|
|
34
|
+
/** For date/time pickers: date or time format */
|
|
35
|
+
inputFormat?: string;
|
|
36
|
+
/** Per-selection validation state */
|
|
37
|
+
validation?: 'success' | 'warning' | 'error' | null;
|
|
38
|
+
/** Per-selection validation text */
|
|
39
|
+
validationText?: string;
|
|
40
|
+
}
|
|
9
41
|
export interface KCompositeInputProps {
|
|
42
|
+
label?: string;
|
|
10
43
|
selectionValue: any;
|
|
11
44
|
inputValue: any;
|
|
12
45
|
modelValue?: ICompositeItem[];
|
|
@@ -20,10 +53,14 @@ export interface KCompositeInputProps {
|
|
|
20
53
|
placeholder?: string;
|
|
21
54
|
inputPlaceholder?: string;
|
|
22
55
|
searchbox?: boolean;
|
|
56
|
+
inputFormat?: string;
|
|
23
57
|
showClear?: boolean;
|
|
24
58
|
teleportTo?: string;
|
|
25
59
|
validation?: 'success' | 'warning' | 'error' | null;
|
|
26
60
|
validationText?: string;
|
|
61
|
+
inputConfigField?: string;
|
|
62
|
+
validateAll?: boolean;
|
|
63
|
+
singleValue?: boolean;
|
|
27
64
|
}
|
|
28
65
|
export interface KCompositeInputEmits {
|
|
29
66
|
(e: 'update:selectionValue', value: any): void;
|
|
@@ -31,6 +68,10 @@ export interface KCompositeInputEmits {
|
|
|
31
68
|
(e: 'update:modelValue', value: ICompositeItem[]): void;
|
|
32
69
|
}
|
|
33
70
|
export declare const KCompositeInputDefaultProps: {
|
|
71
|
+
label: {
|
|
72
|
+
type: StringConstructor;
|
|
73
|
+
default: string;
|
|
74
|
+
};
|
|
34
75
|
selectionValue: {
|
|
35
76
|
type: (ObjectConstructor | ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
36
77
|
default: null;
|
|
@@ -83,6 +124,10 @@ export declare const KCompositeInputDefaultProps: {
|
|
|
83
124
|
type: BooleanConstructor;
|
|
84
125
|
default: boolean;
|
|
85
126
|
};
|
|
127
|
+
inputFormat: {
|
|
128
|
+
type: StringConstructor;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
86
131
|
showClear: {
|
|
87
132
|
type: BooleanConstructor;
|
|
88
133
|
default: boolean;
|
|
@@ -100,6 +145,18 @@ export declare const KCompositeInputDefaultProps: {
|
|
|
100
145
|
type: StringConstructor;
|
|
101
146
|
default: string;
|
|
102
147
|
};
|
|
148
|
+
inputConfigField: {
|
|
149
|
+
type: StringConstructor;
|
|
150
|
+
default: string;
|
|
151
|
+
};
|
|
152
|
+
validateAll: {
|
|
153
|
+
type: BooleanConstructor;
|
|
154
|
+
default: boolean;
|
|
155
|
+
};
|
|
156
|
+
singleValue: {
|
|
157
|
+
type: BooleanConstructor;
|
|
158
|
+
default: boolean;
|
|
159
|
+
};
|
|
103
160
|
};
|
|
104
161
|
export declare function useKCompositeInputLogic(props: KCompositeInputProps, emit: KCompositeInputEmits): {
|
|
105
162
|
internalSelectionValue: import("vue").WritableComputedRef<any, any>;
|
|
@@ -118,10 +175,13 @@ export declare function useKCompositeInputLogic(props: KCompositeInputProps, emi
|
|
|
118
175
|
inputProps: import("vue").ComputedRef<{
|
|
119
176
|
modelValue: any;
|
|
120
177
|
'onUpdate:modelValue': (val: any) => any;
|
|
121
|
-
placeholder: string;
|
|
178
|
+
placeholder: string | undefined;
|
|
122
179
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
123
180
|
mask: string | undefined;
|
|
124
181
|
showClear: boolean | undefined;
|
|
125
182
|
}>;
|
|
126
183
|
resolvedSelectionItem: import("vue").ComputedRef<any>;
|
|
184
|
+
resolvedInputConfig: import("vue").ComputedRef<ICompositeInputConfig>;
|
|
185
|
+
resolvedValidation: import("vue").ComputedRef<any>;
|
|
186
|
+
resolvedValidationText: import("vue").ComputedRef<any>;
|
|
127
187
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { computed, watch } from "vue";
|
|
1
|
+
import { computed, watch, unref } from "vue";
|
|
2
2
|
export const KCompositeInputDefaultProps = {
|
|
3
|
+
label: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: ""
|
|
6
|
+
},
|
|
3
7
|
selectionValue: {
|
|
4
8
|
type: [String, Number, Object, Array],
|
|
5
9
|
default: null
|
|
@@ -52,6 +56,10 @@ export const KCompositeInputDefaultProps = {
|
|
|
52
56
|
type: Boolean,
|
|
53
57
|
default: false
|
|
54
58
|
},
|
|
59
|
+
inputFormat: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
55
63
|
showClear: {
|
|
56
64
|
type: Boolean,
|
|
57
65
|
default: false
|
|
@@ -68,6 +76,18 @@ export const KCompositeInputDefaultProps = {
|
|
|
68
76
|
validationText: {
|
|
69
77
|
type: String,
|
|
70
78
|
default: ""
|
|
79
|
+
},
|
|
80
|
+
inputConfigField: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: "inputConfig"
|
|
83
|
+
},
|
|
84
|
+
validateAll: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false
|
|
87
|
+
},
|
|
88
|
+
singleValue: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: false
|
|
71
91
|
}
|
|
72
92
|
};
|
|
73
93
|
export function useKCompositeInputLogic(props, emit) {
|
|
@@ -82,11 +102,84 @@ export function useKCompositeInputLogic(props, emit) {
|
|
|
82
102
|
if (typeof props.selectionValue === "object") return props.selectionValue;
|
|
83
103
|
if (props.dataProvider && typeof props.dataProvider === "object") {
|
|
84
104
|
const provider = props.dataProvider;
|
|
85
|
-
const data = provider.allData
|
|
105
|
+
const data = unref(provider.allData) || unref(provider.pageData) || [];
|
|
86
106
|
return data.find((item) => getSelectionKey(item) === props.selectionValue) || props.selectionValue;
|
|
87
107
|
}
|
|
88
108
|
return props.selectionValue;
|
|
89
109
|
});
|
|
110
|
+
const resolvedInputConfig = computed(() => {
|
|
111
|
+
const configField = props.inputConfigField || "inputConfig";
|
|
112
|
+
const selectedItem = resolvedSelectionItem.value;
|
|
113
|
+
const itemConfig = selectedItem && typeof selectedItem === "object" && selectedItem[configField] ? { ...selectedItem[configField] } : {};
|
|
114
|
+
return {
|
|
115
|
+
type: itemConfig.type ?? props.type ?? "textbox",
|
|
116
|
+
inputType: itemConfig.inputType ?? props.inputType ?? "text",
|
|
117
|
+
mask: itemConfig.mask ?? props.mask ?? "",
|
|
118
|
+
placeholder: itemConfig.placeholder ?? props.inputPlaceholder ?? "",
|
|
119
|
+
showClear: itemConfig.showClear ?? props.showClear ?? false,
|
|
120
|
+
inputDataProvider: itemConfig.inputDataProvider ?? void 0,
|
|
121
|
+
inputLabelField: itemConfig.inputLabelField ?? props.labelField ?? "label",
|
|
122
|
+
inputValueField: itemConfig.inputValueField ?? props.valueField ?? "value",
|
|
123
|
+
inputSearchbox: itemConfig.inputSearchbox ?? false,
|
|
124
|
+
inputFormat: itemConfig.inputFormat ?? props.inputFormat ?? void 0,
|
|
125
|
+
validation: itemConfig.validation ?? props.validation ?? null,
|
|
126
|
+
validationText: itemConfig.validationText ?? props.validationText ?? ""
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
const resolvedValidation = computed(() => {
|
|
130
|
+
if (props.validateAll) {
|
|
131
|
+
const provider = props.dataProvider;
|
|
132
|
+
const data = unref(provider?.allData) || unref(provider?.pageData) || [];
|
|
133
|
+
const configField = props.inputConfigField || "inputConfig";
|
|
134
|
+
const activeConfig = resolvedInputConfig.value;
|
|
135
|
+
if (activeConfig.validation && activeConfig.validation !== "success") {
|
|
136
|
+
return activeConfig.validation;
|
|
137
|
+
}
|
|
138
|
+
for (const item of data) {
|
|
139
|
+
const itemConfig = item && typeof item === "object" && item[configField] ? item[configField] : null;
|
|
140
|
+
if (itemConfig && itemConfig.validation && itemConfig.validation !== "success") {
|
|
141
|
+
return itemConfig.validation;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (activeConfig.validation === "success") {
|
|
145
|
+
return "success";
|
|
146
|
+
}
|
|
147
|
+
for (const item of data) {
|
|
148
|
+
const itemConfig = item && typeof item === "object" && item[configField] ? item[configField] : null;
|
|
149
|
+
if (itemConfig && itemConfig.validation === "success") {
|
|
150
|
+
return "success";
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return resolvedInputConfig.value.validation || props.validation || null;
|
|
155
|
+
});
|
|
156
|
+
const resolvedValidationText = computed(() => {
|
|
157
|
+
if (props.validateAll) {
|
|
158
|
+
const provider = props.dataProvider;
|
|
159
|
+
const data = unref(provider?.allData) || unref(provider?.pageData) || [];
|
|
160
|
+
const configField = props.inputConfigField || "inputConfig";
|
|
161
|
+
const activeConfig = resolvedInputConfig.value;
|
|
162
|
+
if (activeConfig.validation && activeConfig.validation !== "success") {
|
|
163
|
+
return activeConfig.validationText || "";
|
|
164
|
+
}
|
|
165
|
+
for (const item of data) {
|
|
166
|
+
const itemConfig = item && typeof item === "object" && item[configField] ? item[configField] : null;
|
|
167
|
+
if (itemConfig && itemConfig.validation && itemConfig.validation !== "success") {
|
|
168
|
+
return itemConfig.validationText || "";
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (activeConfig.validation === "success") {
|
|
172
|
+
return activeConfig.validationText || "";
|
|
173
|
+
}
|
|
174
|
+
for (const item of data) {
|
|
175
|
+
const itemConfig = item && typeof item === "object" && item[configField] ? item[configField] : null;
|
|
176
|
+
if (itemConfig && itemConfig.validation === "success") {
|
|
177
|
+
return itemConfig.validationText || "";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return resolvedInputConfig.value.validationText || props.validationText || "";
|
|
182
|
+
});
|
|
90
183
|
const internalSelectionValue = computed({
|
|
91
184
|
get: () => resolvedSelectionItem.value,
|
|
92
185
|
set: (val) => {
|
|
@@ -110,15 +203,22 @@ export function useKCompositeInputLogic(props, emit) {
|
|
|
110
203
|
});
|
|
111
204
|
if (existingItem) {
|
|
112
205
|
emit("update:inputValue", existingItem.value);
|
|
113
|
-
} else {
|
|
114
|
-
const
|
|
206
|
+
} else if (!props.singleValue) {
|
|
207
|
+
const resolvedType = resolvedInputConfig.value.type;
|
|
208
|
+
const defaultValue = resolvedType?.includes("picker") ? null : "";
|
|
115
209
|
emit("update:inputValue", defaultValue);
|
|
210
|
+
} else if (props.inputValue !== null && props.inputValue !== "") {
|
|
211
|
+
updateModelValue(newSelection, props.inputValue);
|
|
116
212
|
}
|
|
117
213
|
}
|
|
118
214
|
});
|
|
119
215
|
function updateModelValue(selection, value) {
|
|
120
216
|
const selectionKey = getSelectionKey(selection);
|
|
121
217
|
if (selectionKey === void 0 || selectionKey === null) return;
|
|
218
|
+
if (props.singleValue) {
|
|
219
|
+
emit("update:modelValue", [{ selection, value }]);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
122
222
|
const currentModel = [...props.modelValue || []];
|
|
123
223
|
const index = currentModel.findIndex((item) => {
|
|
124
224
|
const itemKey = getSelectionKey(item.selection);
|
|
@@ -145,16 +245,19 @@ export function useKCompositeInputLogic(props, emit) {
|
|
|
145
245
|
const inputProps = computed(() => ({
|
|
146
246
|
modelValue: props.inputValue,
|
|
147
247
|
"onUpdate:modelValue": (val) => internalInputValue.value = val,
|
|
148
|
-
placeholder:
|
|
149
|
-
type:
|
|
150
|
-
mask:
|
|
151
|
-
showClear:
|
|
248
|
+
placeholder: resolvedInputConfig.value.placeholder,
|
|
249
|
+
type: resolvedInputConfig.value.inputType,
|
|
250
|
+
mask: resolvedInputConfig.value.mask,
|
|
251
|
+
showClear: resolvedInputConfig.value.showClear
|
|
152
252
|
}));
|
|
153
253
|
return {
|
|
154
254
|
internalSelectionValue,
|
|
155
255
|
internalInputValue,
|
|
156
256
|
selectionProps,
|
|
157
257
|
inputProps,
|
|
158
|
-
resolvedSelectionItem
|
|
258
|
+
resolvedSelectionItem,
|
|
259
|
+
resolvedInputConfig,
|
|
260
|
+
resolvedValidation,
|
|
261
|
+
resolvedValidationText
|
|
159
262
|
};
|
|
160
263
|
}
|