@xleddyl/443-components-vue 0.8.2 → 0.8.3
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/README.md +33 -18
- package/dist/components/core/FormField.vue +5 -0
- package/dist/components/core/FormField.vue.d.ts +4 -0
- package/dist/components/core/Input.vue +59 -5
- package/dist/components/core/Input.vue.d.ts +8 -4
- package/dist/components/core/Textarea.vue +28 -3
- package/dist/components/core/Textarea.vue.d.ts +6 -4
- package/dist/components/data/DescriptionList.vue.d.ts +1 -1
- package/dist/components/data/Pagination.vue +8 -2
- package/dist/components/data/Pagination.vue.d.ts +2 -0
- package/dist/components/forms/CheckboxGroup.vue +7 -1
- package/dist/components/forms/CheckboxGroup.vue.d.ts +1 -0
- package/dist/components/forms/ColorInput.vue.d.ts +4 -4
- package/dist/components/forms/Combobox.vue +4 -3
- package/dist/components/forms/Combobox.vue.d.ts +1 -0
- package/dist/components/forms/DateInput.vue.d.ts +8 -4
- package/dist/components/forms/NumberInput.vue.d.ts +4 -4
- package/dist/components/forms/PasswordInput.vue.d.ts +8 -4
- package/dist/components/forms/PinInput.vue.d.ts +4 -4
- package/dist/components/forms/Select.vue +21 -2
- package/dist/components/forms/Select.vue.d.ts +3 -3
- package/dist/components/forms/Slider.vue.d.ts +4 -4
- package/dist/components/forms/TimeInput.vue.d.ts +8 -4
- package/dist/components/layout/Card.vue.d.ts +1 -1
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +2 -2
- package/dist/components/overlays/ConfirmHost.vue.d.ts +2 -2
- package/dist/components/overlays/ContextMenu.vue.d.ts +2 -2
- package/dist/components/overlays/DropdownMenu.vue.d.ts +2 -2
- package/dist/components/overlays/types.d.ts +2 -2
- package/dist/components/templates/SettingsModal.vue.d.ts +2 -2
- package/dist/composables/useForm.d.ts +8 -1
- package/dist/composables/useForm.mjs +22 -4
- package/dist/composables/useOverlay.d.ts +1 -1
- package/dist/editor/RichTextEditor.vue +95 -9
- package/dist/editor/RichTextEditor.vue.d.ts +4 -1
- package/dist/editor/rich-text-editor.css +21 -0
- package/dist/editor/types.d.ts +1 -0
- package/dist/grid/DataGrid.vue +48 -18
- package/dist/grid/DataGrid.vue.d.ts +6 -1
- package/dist/grid/cells/ImageCell.vue +6 -1
- package/dist/grid/data-grid.css +16 -2
- package/dist/grid/index.d.ts +2 -1
- package/dist/grid/index.mjs +6 -1
- package/dist/grid/modules.d.ts +1 -0
- package/dist/grid/modules.mjs +23 -0
- package/dist/grid/theme.mjs +1 -1
- package/dist/grid/types.d.ts +3 -0
- package/dist/internal/forms/counter.d.ts +18 -0
- package/dist/internal/forms/counter.mjs +31 -0
- package/dist/internal/overlays/OverlayView.vue.d.ts +2 -2
- package/dist/locale/de.mjs +11 -1
- package/dist/locale/en.mjs +11 -1
- package/dist/locale/it.mjs +11 -1
- package/dist/locale/types.d.ts +10 -0
- package/dist/styles/core/form-field.css +6 -0
- package/dist/styles/core/input.css +29 -0
- package/dist/styles/core/textarea.css +10 -0
- package/dist/styles/forms/choice.css +6 -0
- package/package.json +1 -1
|
@@ -131,6 +131,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
131
131
|
lang?: string | undefined;
|
|
132
132
|
width?: (string | number) | undefined;
|
|
133
133
|
tabindex?: (string | number) | undefined;
|
|
134
|
+
transform?: (value: string) => string;
|
|
134
135
|
'aria-activedescendant'?: string | undefined;
|
|
135
136
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
136
137
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -229,16 +230,17 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
229
230
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
230
231
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
231
232
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
233
|
+
maxlength?: (string | number) | undefined;
|
|
232
234
|
clearLabel?: string;
|
|
233
235
|
noAutofill?: boolean;
|
|
236
|
+
counter?: boolean;
|
|
234
237
|
onClear?: (() => any) | undefined;
|
|
238
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
235
239
|
accept?: string | undefined;
|
|
236
240
|
alt?: string | undefined;
|
|
237
241
|
capture?: boolean | "user" | "environment" | undefined;
|
|
238
242
|
crossorigin?: string | undefined;
|
|
239
|
-
maxlength?: (string | number) | undefined;
|
|
240
243
|
minlength?: (string | number) | undefined;
|
|
241
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
242
244
|
src?: string | undefined;
|
|
243
245
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
244
246
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -376,6 +378,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
376
378
|
lang?: string | undefined;
|
|
377
379
|
width?: (string | number) | undefined;
|
|
378
380
|
tabindex?: (string | number) | undefined;
|
|
381
|
+
transform?: (value: string) => string;
|
|
379
382
|
'aria-activedescendant'?: string | undefined;
|
|
380
383
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
381
384
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -474,16 +477,17 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
474
477
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
475
478
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
476
479
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
480
|
+
maxlength?: (string | number) | undefined;
|
|
477
481
|
clearLabel?: string;
|
|
478
482
|
noAutofill?: boolean;
|
|
483
|
+
counter?: boolean;
|
|
479
484
|
onClear?: (() => any) | undefined;
|
|
485
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
480
486
|
accept?: string | undefined;
|
|
481
487
|
alt?: string | undefined;
|
|
482
488
|
capture?: boolean | "user" | "environment" | undefined;
|
|
483
489
|
crossorigin?: string | undefined;
|
|
484
|
-
maxlength?: (string | number) | undefined;
|
|
485
490
|
minlength?: (string | number) | undefined;
|
|
486
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
487
491
|
src?: string | undefined;
|
|
488
492
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
489
493
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -230,13 +230,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
230
230
|
popovertarget?: string | undefined;
|
|
231
231
|
popovertargetaction?: import("../../index.ts").PopoverTargetAction | undefined;
|
|
232
232
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
233
|
+
maxlength?: (string | number) | undefined;
|
|
234
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
233
235
|
accept?: string | undefined | undefined;
|
|
234
236
|
alt?: string | undefined | undefined;
|
|
235
237
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
236
238
|
crossorigin?: string | undefined | undefined;
|
|
237
|
-
maxlength?: (string | number) | undefined;
|
|
238
239
|
minlength?: (string | number) | undefined;
|
|
239
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
240
240
|
src?: string | undefined | undefined;
|
|
241
241
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
242
242
|
}, {
|
|
@@ -474,13 +474,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
474
474
|
popovertarget?: string | undefined;
|
|
475
475
|
popovertargetaction?: import("../../index.ts").PopoverTargetAction | undefined;
|
|
476
476
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
477
|
+
maxlength?: (string | number) | undefined;
|
|
478
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
477
479
|
accept?: string | undefined | undefined;
|
|
478
480
|
alt?: string | undefined | undefined;
|
|
479
481
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
480
482
|
crossorigin?: string | undefined | undefined;
|
|
481
|
-
maxlength?: (string | number) | undefined;
|
|
482
483
|
minlength?: (string | number) | undefined;
|
|
483
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
484
484
|
src?: string | undefined | undefined;
|
|
485
485
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
486
486
|
}> & Readonly<{
|
|
@@ -142,6 +142,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
142
142
|
type?: string | undefined;
|
|
143
143
|
width?: (string | number) | undefined;
|
|
144
144
|
tabindex?: (string | number) | undefined;
|
|
145
|
+
transform?: (value: string) => string;
|
|
145
146
|
'aria-activedescendant'?: string | undefined;
|
|
146
147
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
147
148
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -240,17 +241,18 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
240
241
|
onVnodeUpdated?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
|
|
241
242
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
242
243
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
244
|
+
maxlength?: (string | number) | undefined;
|
|
243
245
|
clearable?: boolean;
|
|
244
246
|
clearLabel?: string;
|
|
245
247
|
noAutofill?: boolean;
|
|
248
|
+
counter?: boolean;
|
|
246
249
|
onClear?: (() => any) | undefined;
|
|
250
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
247
251
|
accept?: string | undefined;
|
|
248
252
|
alt?: string | undefined;
|
|
249
253
|
capture?: boolean | "user" | "environment" | undefined;
|
|
250
254
|
crossorigin?: string | undefined;
|
|
251
|
-
maxlength?: (string | number) | undefined;
|
|
252
255
|
minlength?: (string | number) | undefined;
|
|
253
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
254
256
|
src?: string | undefined;
|
|
255
257
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
256
258
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -401,6 +403,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
401
403
|
type?: string | undefined;
|
|
402
404
|
width?: (string | number) | undefined;
|
|
403
405
|
tabindex?: (string | number) | undefined;
|
|
406
|
+
transform?: (value: string) => string;
|
|
404
407
|
'aria-activedescendant'?: string | undefined;
|
|
405
408
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
406
409
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -499,17 +502,18 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
499
502
|
onVnodeUpdated?: (((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void) | ((vnode: import("vue").VNode, oldVNode: import("vue").VNode) => void)[]) | undefined;
|
|
500
503
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
501
504
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
505
|
+
maxlength?: (string | number) | undefined;
|
|
502
506
|
clearable?: boolean;
|
|
503
507
|
clearLabel?: string;
|
|
504
508
|
noAutofill?: boolean;
|
|
509
|
+
counter?: boolean;
|
|
505
510
|
onClear?: (() => any) | undefined;
|
|
511
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
506
512
|
accept?: string | undefined;
|
|
507
513
|
alt?: string | undefined;
|
|
508
514
|
capture?: boolean | "user" | "environment" | undefined;
|
|
509
515
|
crossorigin?: string | undefined;
|
|
510
|
-
maxlength?: (string | number) | undefined;
|
|
511
516
|
minlength?: (string | number) | undefined;
|
|
512
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
513
517
|
src?: string | undefined;
|
|
514
518
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
515
519
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -229,13 +229,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
229
229
|
formtarget?: string | undefined | undefined;
|
|
230
230
|
popovertarget?: string | undefined;
|
|
231
231
|
popovertargetaction?: import("../..").PopoverTargetAction | undefined;
|
|
232
|
+
maxlength?: (string | number) | undefined;
|
|
233
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
232
234
|
accept?: string | undefined | undefined;
|
|
233
235
|
alt?: string | undefined | undefined;
|
|
234
236
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
235
237
|
crossorigin?: string | undefined | undefined;
|
|
236
|
-
maxlength?: (string | number) | undefined;
|
|
237
238
|
minlength?: (string | number) | undefined;
|
|
238
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
239
239
|
src?: string | undefined | undefined;
|
|
240
240
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
241
241
|
}, {
|
|
@@ -474,13 +474,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
474
474
|
formtarget?: string | undefined | undefined;
|
|
475
475
|
popovertarget?: string | undefined;
|
|
476
476
|
popovertargetaction?: import("../..").PopoverTargetAction | undefined;
|
|
477
|
+
maxlength?: (string | number) | undefined;
|
|
478
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
477
479
|
accept?: string | undefined | undefined;
|
|
478
480
|
alt?: string | undefined | undefined;
|
|
479
481
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
480
482
|
crossorigin?: string | undefined | undefined;
|
|
481
|
-
maxlength?: (string | number) | undefined;
|
|
482
483
|
minlength?: (string | number) | undefined;
|
|
483
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
484
484
|
src?: string | undefined | undefined;
|
|
485
485
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
486
486
|
}> & Readonly<{
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
v-for="option in entry.options"
|
|
42
42
|
:key="keyOf(option.value)"
|
|
43
43
|
:value="keyOf(option.value)"
|
|
44
|
+
:data-k-option="indexOf(option)"
|
|
44
45
|
:disabled="option.disabled"
|
|
45
46
|
:selected="isSelected(option.value)"
|
|
46
47
|
>
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
<option
|
|
51
52
|
v-else
|
|
52
53
|
:value="keyOf(entry.value)"
|
|
54
|
+
:data-k-option="indexOf(entry)"
|
|
53
55
|
:disabled="entry.disabled"
|
|
54
56
|
:selected="isSelected(entry.value)"
|
|
55
57
|
>
|
|
@@ -89,8 +91,12 @@ const control = useFieldControl({
|
|
|
89
91
|
const flatOptions = computed(
|
|
90
92
|
() => props.options.flatMap((entry) => isGroup(entry) ? entry.options : [entry])
|
|
91
93
|
);
|
|
94
|
+
const optionIndex = computed(
|
|
95
|
+
() => new Map(flatOptions.value.map((option, index) => [option, index]))
|
|
96
|
+
);
|
|
97
|
+
const hasEmptyOption = computed(() => flatOptions.value.some((option) => option.value === ""));
|
|
92
98
|
const isEmpty = computed(
|
|
93
|
-
() => model.value === null || model.value === void 0 || model.value === ""
|
|
99
|
+
() => model.value === null || model.value === void 0 || model.value === "" && !hasEmptyOption.value
|
|
94
100
|
);
|
|
95
101
|
function isGroup(entry) {
|
|
96
102
|
return "options" in entry && Array.isArray(entry.options);
|
|
@@ -101,8 +107,21 @@ function keyOf(value) {
|
|
|
101
107
|
function isSelected(value) {
|
|
102
108
|
return !isEmpty.value && keyOf(value) === keyOf(model.value);
|
|
103
109
|
}
|
|
110
|
+
function indexOf(option) {
|
|
111
|
+
return optionIndex.value.get(option);
|
|
112
|
+
}
|
|
104
113
|
function onChange(event) {
|
|
105
|
-
const
|
|
114
|
+
const select = event.target;
|
|
115
|
+
const chosen = select.selectedOptions[0];
|
|
116
|
+
const index = chosen?.dataset.kOption;
|
|
117
|
+
if (index !== void 0) {
|
|
118
|
+
const match2 = flatOptions.value[Number(index)];
|
|
119
|
+
if (match2) {
|
|
120
|
+
model.value = match2.value;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const raw = select.value;
|
|
106
125
|
if (raw === "" && props.placeholder !== void 0) {
|
|
107
126
|
model.value = null;
|
|
108
127
|
return;
|
|
@@ -13,9 +13,9 @@ declare const __VLS_export: <T extends string | number | boolean>(__VLS_props: N
|
|
|
13
13
|
class?: unknown;
|
|
14
14
|
style?: unknown;
|
|
15
15
|
} & {
|
|
16
|
-
modelValue?: T |
|
|
16
|
+
modelValue?: T | null | undefined;
|
|
17
17
|
}) & {
|
|
18
|
-
"onUpdate:modelValue"?: ((value:
|
|
18
|
+
"onUpdate:modelValue"?: ((value: T | null | undefined) => any) | undefined;
|
|
19
19
|
} & Partial<import("vue").SelectHTMLAttributes & import("vue").ReservedProps>> & (typeof globalThis extends {
|
|
20
20
|
__VLS_PROPS_FALLBACK: infer P;
|
|
21
21
|
} ? P : {});
|
|
@@ -27,7 +27,7 @@ declare const __VLS_export: <T extends string | number | boolean>(__VLS_props: N
|
|
|
27
27
|
slots: {
|
|
28
28
|
default?: (props: {}) => any;
|
|
29
29
|
};
|
|
30
|
-
emit: (event: "update:modelValue", value:
|
|
30
|
+
emit: (event: "update:modelValue", value: T | null | undefined) => void;
|
|
31
31
|
}>) => import("vue").VNode & {
|
|
32
32
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
33
33
|
};
|
|
@@ -224,13 +224,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
224
224
|
popovertarget?: string | undefined;
|
|
225
225
|
popovertargetaction?: import("../..").PopoverTargetAction | undefined;
|
|
226
226
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
227
|
+
maxlength?: (string | number) | undefined;
|
|
228
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
227
229
|
accept?: string | undefined | undefined;
|
|
228
230
|
alt?: string | undefined | undefined;
|
|
229
231
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
230
232
|
crossorigin?: string | undefined | undefined;
|
|
231
|
-
maxlength?: (string | number) | undefined;
|
|
232
233
|
minlength?: (string | number) | undefined;
|
|
233
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
234
234
|
src?: string | undefined | undefined;
|
|
235
235
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
236
236
|
}, {
|
|
@@ -463,13 +463,13 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
463
463
|
popovertarget?: string | undefined;
|
|
464
464
|
popovertargetaction?: import("../..").PopoverTargetAction | undefined;
|
|
465
465
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
466
|
+
maxlength?: (string | number) | undefined;
|
|
467
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
466
468
|
accept?: string | undefined | undefined;
|
|
467
469
|
alt?: string | undefined | undefined;
|
|
468
470
|
capture?: boolean | "user" | "environment" | undefined | undefined;
|
|
469
471
|
crossorigin?: string | undefined | undefined;
|
|
470
|
-
maxlength?: (string | number) | undefined;
|
|
471
472
|
minlength?: (string | number) | undefined;
|
|
472
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
473
473
|
src?: string | undefined | undefined;
|
|
474
474
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
475
475
|
}> & Readonly<{
|
|
@@ -132,6 +132,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
132
132
|
type?: string | undefined;
|
|
133
133
|
width?: (string | number) | undefined;
|
|
134
134
|
tabindex?: (string | number) | undefined;
|
|
135
|
+
transform?: (value: string) => string;
|
|
135
136
|
'aria-activedescendant'?: string | undefined;
|
|
136
137
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
137
138
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -230,16 +231,17 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
230
231
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
231
232
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
232
233
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
234
|
+
maxlength?: (string | number) | undefined;
|
|
233
235
|
clearLabel?: string;
|
|
234
236
|
noAutofill?: boolean;
|
|
237
|
+
counter?: boolean;
|
|
235
238
|
onClear?: (() => any) | undefined;
|
|
239
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
236
240
|
accept?: string | undefined;
|
|
237
241
|
alt?: string | undefined;
|
|
238
242
|
capture?: boolean | "user" | "environment" | undefined;
|
|
239
243
|
crossorigin?: string | undefined;
|
|
240
|
-
maxlength?: (string | number) | undefined;
|
|
241
244
|
minlength?: (string | number) | undefined;
|
|
242
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
243
245
|
src?: string | undefined;
|
|
244
246
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
245
247
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -378,6 +380,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
378
380
|
type?: string | undefined;
|
|
379
381
|
width?: (string | number) | undefined;
|
|
380
382
|
tabindex?: (string | number) | undefined;
|
|
383
|
+
transform?: (value: string) => string;
|
|
381
384
|
'aria-activedescendant'?: string | undefined;
|
|
382
385
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
383
386
|
'aria-autocomplete'?: "none" | "inline" | "list" | "both" | undefined;
|
|
@@ -476,16 +479,17 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
476
479
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
477
480
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
478
481
|
autocomplete?: import("vue").InputAutoCompleteAttribute | undefined;
|
|
482
|
+
maxlength?: (string | number) | undefined;
|
|
479
483
|
clearLabel?: string;
|
|
480
484
|
noAutofill?: boolean;
|
|
485
|
+
counter?: boolean;
|
|
481
486
|
onClear?: (() => any) | undefined;
|
|
487
|
+
multiple?: (boolean | "true" | "false") | undefined;
|
|
482
488
|
accept?: string | undefined;
|
|
483
489
|
alt?: string | undefined;
|
|
484
490
|
capture?: boolean | "user" | "environment" | undefined;
|
|
485
491
|
crossorigin?: string | undefined;
|
|
486
|
-
maxlength?: (string | number) | undefined;
|
|
487
492
|
minlength?: (string | number) | undefined;
|
|
488
|
-
multiple?: (boolean | "true" | "false") | undefined;
|
|
489
493
|
src?: string | undefined;
|
|
490
494
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
491
495
|
modelModifiers?: Partial<Record<"number" | "trim", true>>;
|
|
@@ -463,8 +463,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
463
463
|
selected: boolean;
|
|
464
464
|
variant: CardVariant;
|
|
465
465
|
as: string;
|
|
466
|
-
level: HeadingLevel;
|
|
467
466
|
padding: CardPadding;
|
|
467
|
+
level: HeadingLevel;
|
|
468
468
|
animated: boolean;
|
|
469
469
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
470
470
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -221,8 +221,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
221
221
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
222
222
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
223
223
|
flush?: boolean;
|
|
224
|
-
onClose?: (() => any) | undefined;
|
|
225
224
|
sheet?: boolean;
|
|
225
|
+
onClose?: (() => any) | undefined;
|
|
226
226
|
onOpen?: (() => any) | undefined;
|
|
227
227
|
closeLabel?: string;
|
|
228
228
|
rootClass?: unknown;
|
|
@@ -451,8 +451,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
451
451
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
452
452
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
453
453
|
flush?: boolean;
|
|
454
|
-
onClose?: (() => any) | undefined;
|
|
455
454
|
sheet?: boolean;
|
|
455
|
+
onClose?: (() => any) | undefined;
|
|
456
456
|
onOpen?: (() => any) | undefined;
|
|
457
457
|
closeLabel?: string;
|
|
458
458
|
rootClass?: unknown;
|
|
@@ -211,8 +211,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
211
211
|
readonly onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
212
212
|
readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
213
213
|
readonly flush?: boolean | undefined;
|
|
214
|
-
readonly onClose?: (() => any) | undefined;
|
|
215
214
|
readonly sheet?: boolean | undefined;
|
|
215
|
+
readonly onClose?: (() => any) | undefined;
|
|
216
216
|
readonly onOpen?: (() => any) | undefined;
|
|
217
217
|
readonly closeLabel?: string | undefined;
|
|
218
218
|
readonly rootClass?: unknown;
|
|
@@ -437,8 +437,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
437
437
|
readonly onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
438
438
|
readonly onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
439
439
|
readonly flush?: boolean | undefined;
|
|
440
|
-
readonly onClose?: (() => any) | undefined;
|
|
441
440
|
readonly sheet?: boolean | undefined;
|
|
441
|
+
readonly onClose?: (() => any) | undefined;
|
|
442
442
|
readonly onOpen?: (() => any) | undefined;
|
|
443
443
|
readonly closeLabel?: string | undefined;
|
|
444
444
|
readonly rootClass?: unknown;
|
|
@@ -12,7 +12,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
12
12
|
open?: boolean;
|
|
13
13
|
key?: PropertyKey | undefined;
|
|
14
14
|
prefix?: string | undefined;
|
|
15
|
-
anchor?: (() => import("
|
|
15
|
+
anchor?: (() => import("./types").OverlayAnchorTarget | null | undefined) | undefined;
|
|
16
16
|
title?: string | undefined;
|
|
17
17
|
style?: import("vue").StyleValue;
|
|
18
18
|
results?: (string | number) | undefined;
|
|
@@ -228,7 +228,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
228
228
|
open?: boolean;
|
|
229
229
|
key?: PropertyKey | undefined;
|
|
230
230
|
prefix?: string | undefined;
|
|
231
|
-
anchor?: (() => import("
|
|
231
|
+
anchor?: (() => import("./types").OverlayAnchorTarget | null | undefined) | undefined;
|
|
232
232
|
title?: string | undefined;
|
|
233
233
|
style?: import("vue").StyleValue;
|
|
234
234
|
results?: (string | number) | undefined;
|
|
@@ -15,7 +15,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
15
15
|
open?: boolean;
|
|
16
16
|
key?: PropertyKey | undefined;
|
|
17
17
|
prefix?: string | undefined;
|
|
18
|
-
anchor?: (() => import("
|
|
18
|
+
anchor?: (() => import("./types").OverlayAnchorTarget | null | undefined) | undefined;
|
|
19
19
|
title?: string | undefined;
|
|
20
20
|
style?: import("vue").StyleValue;
|
|
21
21
|
results?: (string | number) | undefined;
|
|
@@ -232,7 +232,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
232
232
|
open?: boolean;
|
|
233
233
|
key?: PropertyKey | undefined;
|
|
234
234
|
prefix?: string | undefined;
|
|
235
|
-
anchor?: (() => import("
|
|
235
|
+
anchor?: (() => import("./types").OverlayAnchorTarget | null | undefined) | undefined;
|
|
236
236
|
title?: string | undefined;
|
|
237
237
|
style?: import("vue").StyleValue;
|
|
238
238
|
results?: (string | number) | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LinkTarget } from '../core/types';
|
|
2
2
|
import type { IconName } from '../../composables/useIcons';
|
|
3
|
-
import type { Placement, Side } from '../../internal/floating/position';
|
|
4
|
-
export type { Placement as OverlayPlacement, Side as OverlaySide };
|
|
3
|
+
import type { AnchorTarget, Placement, Side, VirtualAnchor } from '../../internal/floating/position';
|
|
4
|
+
export type { AnchorTarget as OverlayAnchorTarget, Placement as OverlayPlacement, Side as OverlaySide, VirtualAnchor as OverlayVirtualAnchor, };
|
|
5
5
|
export type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'fit' | 'fullscreen';
|
|
6
6
|
export type DialogCloseReason = 'escape' | 'backdrop' | 'close-button' | 'action';
|
|
7
7
|
export type DialogBeforeClose = (reason: DialogCloseReason) => boolean | Promise<boolean>;
|
|
@@ -237,8 +237,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
237
237
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
238
238
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
239
239
|
flush?: boolean;
|
|
240
|
-
onCancel?: ((payload: Event) => void) | undefined;
|
|
241
240
|
sheet?: boolean;
|
|
241
|
+
onCancel?: ((payload: Event) => void) | undefined;
|
|
242
242
|
rootClass?: unknown;
|
|
243
243
|
hideClose?: boolean;
|
|
244
244
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -476,8 +476,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
476
476
|
onVnodeBeforeUnmount?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
477
477
|
onVnodeUnmounted?: (((vnode: import("vue").VNode) => void) | ((vnode: import("vue").VNode) => void)[]) | undefined;
|
|
478
478
|
flush?: boolean;
|
|
479
|
-
onCancel?: ((payload: Event) => void) | undefined;
|
|
480
479
|
sheet?: boolean;
|
|
480
|
+
onCancel?: ((payload: Event) => void) | undefined;
|
|
481
481
|
rootClass?: unknown;
|
|
482
482
|
hideClose?: boolean;
|
|
483
483
|
closedby?: import("../../index.ts").DialogClosedBy;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { App, ComputedRef, MaybeRefOrGetter, Ref, UnwrapRef } from 'vue';
|
|
2
2
|
import type { IssueKeyResolver, StandardSchemaIssue, StandardSchemaV1 } from '../internal/forms/standard-schema';
|
|
3
|
+
import type { MessageParams } from '../locale/types';
|
|
3
4
|
export type { IssuePath as FormIssuePath, StandardSchemaIssue, StandardSchemaResult, StandardSchemaV1, } from '../internal/forms/standard-schema';
|
|
4
|
-
export
|
|
5
|
+
export interface FieldValidationMessage {
|
|
6
|
+
message: string;
|
|
7
|
+
params?: MessageParams;
|
|
8
|
+
}
|
|
9
|
+
export type FieldValidationResult = string | FieldValidationMessage | undefined | null | boolean;
|
|
5
10
|
export interface FieldDefinition<T = unknown> {
|
|
6
11
|
initial?: T | (() => T);
|
|
7
12
|
label?: string;
|
|
@@ -11,6 +16,7 @@ export interface FieldDefinition<T = unknown> {
|
|
|
11
16
|
minLength?: number;
|
|
12
17
|
maxLength?: number;
|
|
13
18
|
pattern?: RegExp;
|
|
19
|
+
isEmpty?: (value: T) => boolean;
|
|
14
20
|
schema?: StandardSchemaV1;
|
|
15
21
|
validate?: (value: T, values: Record<string, unknown>) => FieldValidationResult | Promise<FieldValidationResult>;
|
|
16
22
|
messages?: Partial<FormMessages>;
|
|
@@ -40,6 +46,7 @@ export interface FormTranslateContext {
|
|
|
40
46
|
name?: string;
|
|
41
47
|
label?: string;
|
|
42
48
|
kind: 'error' | 'warning';
|
|
49
|
+
params?: MessageParams;
|
|
43
50
|
}
|
|
44
51
|
export type FormTranslateMessage = (message: string, context: FormTranslateContext) => string;
|
|
45
52
|
export interface FormConfig {
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
schemaIssues
|
|
21
21
|
} from "../internal/forms/standard-schema.mjs";
|
|
22
22
|
import { FORM_CONFIG_KEY, FORM_KEY } from "../internal/keys.mjs";
|
|
23
|
+
import { formatLocaleMessage } from "../locale/index.mjs";
|
|
23
24
|
import { useLocale } from "./useLocale.mjs";
|
|
24
25
|
function localeFormMessages(t) {
|
|
25
26
|
return {
|
|
@@ -32,11 +33,17 @@ function localeFormMessages(t) {
|
|
|
32
33
|
invalid: () => t("form.invalid")
|
|
33
34
|
};
|
|
34
35
|
}
|
|
36
|
+
function isPlainObject(value) {
|
|
37
|
+
if (value === null || typeof value !== "object") return false;
|
|
38
|
+
const prototype = Object.getPrototypeOf(value);
|
|
39
|
+
return prototype === Object.prototype || prototype === null;
|
|
40
|
+
}
|
|
35
41
|
export function isEmptyValue(value) {
|
|
36
42
|
if (value === null || value === void 0) return true;
|
|
37
43
|
if (typeof value === "string") return value.trim() === "";
|
|
38
44
|
if (Array.isArray(value)) return value.length === 0;
|
|
39
45
|
if (typeof value === "number") return Number.isNaN(value);
|
|
46
|
+
if (isPlainObject(value)) return Object.values(value).every(isEmptyValue);
|
|
40
47
|
return false;
|
|
41
48
|
}
|
|
42
49
|
function cloneValue(value) {
|
|
@@ -101,7 +108,7 @@ export function useForm(options) {
|
|
|
101
108
|
const schema = options.schema ?? {};
|
|
102
109
|
const schemaNames = Object.keys(schema);
|
|
103
110
|
const external = options.values !== void 0;
|
|
104
|
-
const { t } = useLocale();
|
|
111
|
+
const { t, locale } = useLocale();
|
|
105
112
|
const config = hasInjectionContext() && inject(FORM_CONFIG_KEY, null) || null;
|
|
106
113
|
const messages = computed(() => ({
|
|
107
114
|
...localeFormMessages(t),
|
|
@@ -109,7 +116,11 @@ export function useForm(options) {
|
|
|
109
116
|
...options.messages
|
|
110
117
|
}));
|
|
111
118
|
const translator = options.translateMessage ?? config?.translateMessage;
|
|
112
|
-
const translate = (message, context) =>
|
|
119
|
+
const translate = (message, context) => {
|
|
120
|
+
if (!message) return message;
|
|
121
|
+
if (translator) return translator(message, context);
|
|
122
|
+
return context.params ? formatLocaleMessage(locale.value.code, message, context.params) : message;
|
|
123
|
+
};
|
|
113
124
|
const translateIssues = (issues, kind) => issues.map((issue) => {
|
|
114
125
|
const name = issue.path.map(String).join(".") || void 0;
|
|
115
126
|
const label = name ? schema[name]?.label : void 0;
|
|
@@ -177,7 +188,12 @@ export function useForm(options) {
|
|
|
177
188
|
if (!definition) return void 0;
|
|
178
189
|
const value = readValue(name);
|
|
179
190
|
const fieldMessages = { ...messages.value, ...definition.messages };
|
|
180
|
-
const own = (message) => translate(message, {
|
|
191
|
+
const own = (message, params) => translate(message, {
|
|
192
|
+
name,
|
|
193
|
+
label: definition.label,
|
|
194
|
+
kind: "error",
|
|
195
|
+
...params ? { params } : {}
|
|
196
|
+
});
|
|
181
197
|
const context = {
|
|
182
198
|
label: definition.label,
|
|
183
199
|
value,
|
|
@@ -186,7 +202,7 @@ export function useForm(options) {
|
|
|
186
202
|
minLength: definition.minLength,
|
|
187
203
|
maxLength: definition.maxLength
|
|
188
204
|
};
|
|
189
|
-
if (isEmptyValue(value)) {
|
|
205
|
+
if (definition.isEmpty ? definition.isEmpty(value) : isEmptyValue(value)) {
|
|
190
206
|
if (definition.required) return fieldMessages.required(context);
|
|
191
207
|
} else {
|
|
192
208
|
if (typeof value === "number") {
|
|
@@ -217,6 +233,8 @@ export function useForm(options) {
|
|
|
217
233
|
if (!definition.validate) return runSchema();
|
|
218
234
|
return chain(definition.validate(value, target()), (result) => {
|
|
219
235
|
if (typeof result === "string" && result) return own(result);
|
|
236
|
+
if (result && typeof result === "object" && result.message)
|
|
237
|
+
return own(result.message, result.params);
|
|
220
238
|
if (result === false) return fieldMessages.invalid(context);
|
|
221
239
|
return runSchema();
|
|
222
240
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AllowedComponentProps, Component, VNodeProps } from 'vue';
|
|
2
2
|
import type { OverlayContext, OverlayEntry, OverlayKind, OverlayOptions } from '../internal/overlays/stack';
|
|
3
|
-
export type { OverlayContext, OverlayKind, OverlayOptions };
|
|
3
|
+
export type { OverlayContext, OverlayEntry, OverlayKind, OverlayOptions };
|
|
4
4
|
export type OverlayComponentProps<C> = C extends new (...args: never[]) => {
|
|
5
5
|
$props: infer P;
|
|
6
6
|
} ? Omit<P, keyof VNodeProps | keyof AllowedComponentProps> : Record<string, unknown>;
|