@vuecs/forms 4.0.0 → 5.0.0
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/components/form-group/FormGroup.vue.d.ts +69 -21
- package/dist/components/form-group/FormGroup.vue.d.ts.map +1 -1
- package/dist/components/form-group/index.d.ts +1 -1
- package/dist/components/form-group/index.d.ts.map +1 -1
- package/dist/components/type.d.ts +27 -0
- package/dist/components/type.d.ts.map +1 -1
- package/dist/components/validation-group/ValidationGroup.vue.d.ts +57 -12
- package/dist/components/validation-group/ValidationGroup.vue.d.ts.map +1 -1
- package/dist/index.mjs +51 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentThemeDefinition, ThemeClassesOverride, ThemeElementDefinition, VariantValues } from '@vuecs/core';
|
|
2
2
|
import type { ExtractPublicPropTypes, PropType, SlotsType } from 'vue';
|
|
3
3
|
import { ValidationSeverity } from '../constants';
|
|
4
|
-
import type { ValidationMessages } from '../type';
|
|
4
|
+
import type { FieldValidation, ValidationMessages } from '../type';
|
|
5
5
|
import { type ValidationGroupDefaultSlotProps, type ValidationGroupItemSlotProps } from '../validation-group';
|
|
6
6
|
export type FormGroupThemeClasses = {
|
|
7
7
|
root: string;
|
|
@@ -10,16 +10,10 @@ export type FormGroupThemeClasses = {
|
|
|
10
10
|
validationError: string;
|
|
11
11
|
validationWarning: string;
|
|
12
12
|
};
|
|
13
|
-
export type FormGroupDefaults = {
|
|
14
|
-
validation: boolean;
|
|
15
|
-
};
|
|
16
13
|
declare module '@vuecs/core' {
|
|
17
14
|
interface ThemeElements {
|
|
18
15
|
formGroup?: ThemeElementDefinition<FormGroupThemeClasses>;
|
|
19
16
|
}
|
|
20
|
-
interface ComponentDefaults {
|
|
21
|
-
formGroup?: ComponentDefaultValues<FormGroupDefaults>;
|
|
22
|
-
}
|
|
23
17
|
}
|
|
24
18
|
export declare const formGroupThemeDefaults: ComponentThemeDefinition<FormGroupThemeClasses>;
|
|
25
19
|
declare const formGroupProps: {
|
|
@@ -53,17 +47,35 @@ declare const formGroupProps: {
|
|
|
53
47
|
type: StringConstructor;
|
|
54
48
|
default: any;
|
|
55
49
|
};
|
|
56
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Bundle prop accepting a `FieldValidation` (`{ severity, messages }`)
|
|
52
|
+
* — wins over `validationSeverity` + `validationMessages` when set.
|
|
53
|
+
*
|
|
54
|
+
* Canonical use is with `@ilingo/validup-vue`'s `useFieldValidation`:
|
|
55
|
+
* `<VCFormGroup :validation="useFieldValidation($v.fields.email)">`.
|
|
56
|
+
* Structural typing — vuecs and `@ilingo/validup-vue` declare matching
|
|
57
|
+
* shapes without either importing the other.
|
|
58
|
+
*
|
|
59
|
+
* Pass `null` / `undefined` to fall through to the legacy props.
|
|
60
|
+
*/
|
|
57
61
|
validation: {
|
|
58
|
-
type:
|
|
62
|
+
type: PropType<FieldValidation | null>;
|
|
59
63
|
default: any;
|
|
60
64
|
};
|
|
61
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
67
|
+
* Severity used to colour the validation messages (`error` /
|
|
68
|
+
* `warning`). Ignored when `:validation` is set.
|
|
69
|
+
*/
|
|
62
70
|
validationSeverity: {
|
|
63
71
|
type: PropType<`${ValidationSeverity}` | undefined>;
|
|
64
72
|
default: any;
|
|
65
73
|
};
|
|
66
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
76
|
+
* Validation messages — keyed object or ordered array of
|
|
77
|
+
* `{ key, value }`. Ignored when `:validation` is set.
|
|
78
|
+
*/
|
|
67
79
|
validationMessages: {
|
|
68
80
|
type: PropType<ValidationMessages>;
|
|
69
81
|
default: any;
|
|
@@ -113,17 +125,35 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
113
125
|
type: StringConstructor;
|
|
114
126
|
default: any;
|
|
115
127
|
};
|
|
116
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Bundle prop accepting a `FieldValidation` (`{ severity, messages }`)
|
|
130
|
+
* — wins over `validationSeverity` + `validationMessages` when set.
|
|
131
|
+
*
|
|
132
|
+
* Canonical use is with `@ilingo/validup-vue`'s `useFieldValidation`:
|
|
133
|
+
* `<VCFormGroup :validation="useFieldValidation($v.fields.email)">`.
|
|
134
|
+
* Structural typing — vuecs and `@ilingo/validup-vue` declare matching
|
|
135
|
+
* shapes without either importing the other.
|
|
136
|
+
*
|
|
137
|
+
* Pass `null` / `undefined` to fall through to the legacy props.
|
|
138
|
+
*/
|
|
117
139
|
validation: {
|
|
118
|
-
type:
|
|
140
|
+
type: PropType<FieldValidation | null>;
|
|
119
141
|
default: any;
|
|
120
142
|
};
|
|
121
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
145
|
+
* Severity used to colour the validation messages (`error` /
|
|
146
|
+
* `warning`). Ignored when `:validation` is set.
|
|
147
|
+
*/
|
|
122
148
|
validationSeverity: {
|
|
123
149
|
type: PropType<`${ValidationSeverity}` | undefined>;
|
|
124
150
|
default: any;
|
|
125
151
|
};
|
|
126
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
154
|
+
* Validation messages — keyed object or ordered array of
|
|
155
|
+
* `{ key, value }`. Ignored when `:validation` is set.
|
|
156
|
+
*/
|
|
127
157
|
validationMessages: {
|
|
128
158
|
type: PropType<ValidationMessages>;
|
|
129
159
|
default: any;
|
|
@@ -171,17 +201,35 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
171
201
|
type: StringConstructor;
|
|
172
202
|
default: any;
|
|
173
203
|
};
|
|
174
|
-
/**
|
|
204
|
+
/**
|
|
205
|
+
* Bundle prop accepting a `FieldValidation` (`{ severity, messages }`)
|
|
206
|
+
* — wins over `validationSeverity` + `validationMessages` when set.
|
|
207
|
+
*
|
|
208
|
+
* Canonical use is with `@ilingo/validup-vue`'s `useFieldValidation`:
|
|
209
|
+
* `<VCFormGroup :validation="useFieldValidation($v.fields.email)">`.
|
|
210
|
+
* Structural typing — vuecs and `@ilingo/validup-vue` declare matching
|
|
211
|
+
* shapes without either importing the other.
|
|
212
|
+
*
|
|
213
|
+
* Pass `null` / `undefined` to fall through to the legacy props.
|
|
214
|
+
*/
|
|
175
215
|
validation: {
|
|
176
|
-
type:
|
|
216
|
+
type: PropType<FieldValidation | null>;
|
|
177
217
|
default: any;
|
|
178
218
|
};
|
|
179
|
-
/**
|
|
219
|
+
/**
|
|
220
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
221
|
+
* Severity used to colour the validation messages (`error` /
|
|
222
|
+
* `warning`). Ignored when `:validation` is set.
|
|
223
|
+
*/
|
|
180
224
|
validationSeverity: {
|
|
181
225
|
type: PropType<`${ValidationSeverity}` | undefined>;
|
|
182
226
|
default: any;
|
|
183
227
|
};
|
|
184
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
230
|
+
* Validation messages — keyed object or ordered array of
|
|
231
|
+
* `{ key, value }`. Ignored when `:validation` is set.
|
|
232
|
+
*/
|
|
185
233
|
validationMessages: {
|
|
186
234
|
type: PropType<ValidationMessages>;
|
|
187
235
|
default: any;
|
|
@@ -205,7 +253,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
205
253
|
labelTag: string;
|
|
206
254
|
hintTag: string;
|
|
207
255
|
hintContent: string;
|
|
208
|
-
validation:
|
|
256
|
+
validation: FieldValidation;
|
|
209
257
|
validationSeverity: "error" | "warning";
|
|
210
258
|
validationMessages: ValidationMessages;
|
|
211
259
|
}, SlotsType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form-group/FormGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/form-group/FormGroup.vue"],"names":[],"mappings":"AA+NA,OAAO,KAAK,EACR,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACR,sBAAsB,EACtB,QAAQ,EACR,SAAS,EAEZ,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAEH,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACpC,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,qBAAqB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,OAAO,QAAQ,aAAa,CAAC;IACzB,UAAU,aAAa;QACnB,SAAS,CAAC,EAAE,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;KAC7D;CACJ;AAED,eAAO,MAAM,sBAAsB,EAAE,wBAAwB,CAAC,qBAAqB,CAQlF,CAAC;AAEF,QAAA,MAAM,cAAc;IAChB,6HAA6H;;;;;IAE7H,2CAA2C;;;;;IAE3C,8DAA8D;;;;;IAG9D,2HAA2H;;;;;IAE3H,0CAA0C;;;;;IAE1C,6DAA6D;;;;;IAG7D;;;;;;;;;;OAUG;;cAImC,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC;;;IAEtE;;;;OAIG;;cACmC,QAAQ,CAAC,GAAG,kBAAkB,EAAE,GAAG,SAAS,CAAC;;;IAEnF;;;;OAIG;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kB1C,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;WACvB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;UACtB,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;qBACV,+BAA+B;oBAChC,4BAA4B;yEA4GlD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import FormGroup from './FormGroup.vue';
|
|
2
2
|
export { FormGroup as VCFormGroup };
|
|
3
3
|
export { formGroupThemeDefaults } from './FormGroup.vue';
|
|
4
|
-
export type { FormGroupProps, FormGroupThemeClasses
|
|
4
|
+
export type { FormGroupProps, FormGroupThemeClasses } from './FormGroup.vue';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-group/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -14,4 +14,31 @@ export type ValidationMessagesArrayStyle = {
|
|
|
14
14
|
value: string;
|
|
15
15
|
}[];
|
|
16
16
|
export type ValidationMessages = ValidationMessagesArrayStyle | ValidationMessagesRecordStyle;
|
|
17
|
+
/**
|
|
18
|
+
* Single-prop bundle a `<VCFormGroup>` host consumes via `:validation`.
|
|
19
|
+
*
|
|
20
|
+
* Structurally identical to `@ilingo/validup-vue`'s exported
|
|
21
|
+
* `FieldValidation` (and the return shape of `useFieldValidation`), so
|
|
22
|
+
* the canonical bridge usage —
|
|
23
|
+
* `<VCFormGroup :validation="useFieldValidation($v.fields.email)">` —
|
|
24
|
+
* type-checks without either package importing the other (cross-package
|
|
25
|
+
* structural compatibility; vuecs stays neutral about validation
|
|
26
|
+
* libraries).
|
|
27
|
+
*
|
|
28
|
+
* `severity` accepts `'success'` for forward compatibility with
|
|
29
|
+
* validation bridges that surface a "passed" state; vuecs currently
|
|
30
|
+
* renders no class for it (the `:validation-success` theme slot is not
|
|
31
|
+
* yet defined), so `'success'` behaves like `undefined` at the DOM
|
|
32
|
+
* level. `error` and `warning` apply the matching `validationError` /
|
|
33
|
+
* `validationWarning` theme class on the root.
|
|
34
|
+
*
|
|
35
|
+
* `messages` is array-style only (the `{ key, value }[]` shape vuecs
|
|
36
|
+
* already renders inside `<VCValidationGroup>`). Producers using the
|
|
37
|
+
* legacy record shape (`Record<string, string>`) keep using
|
|
38
|
+
* `:validation-messages` directly.
|
|
39
|
+
*/
|
|
40
|
+
export type FieldValidation = {
|
|
41
|
+
severity?: 'error' | 'warning' | 'success';
|
|
42
|
+
messages: ValidationMessagesArrayStyle;
|
|
43
|
+
};
|
|
17
44
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/components/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,MAAM,EAAE,CAAC,CAAC;IAEV,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,Q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AAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,4BAA4B,CAAC;CAC1C,CAAC"}
|
|
@@ -11,9 +11,18 @@ declare module '@vuecs/core' {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
export declare const validationGroupThemeDefaults: ComponentThemeDefinition<ValidationGroupThemeClasses>;
|
|
14
|
+
/**
|
|
15
|
+
* Severity union the slot props expose. Wider than `ValidationSeverity`
|
|
16
|
+
* (`error` / `warning`) so a `<VCFormGroup :validation>` bundle whose
|
|
17
|
+
* `severity` is `'success'` or `undefined` flows through to slot
|
|
18
|
+
* consumers as-is — instead of being collapsed back to `'error'` by
|
|
19
|
+
* the prop default, which would mislead the slot rendering on
|
|
20
|
+
* pristine / valid fields.
|
|
21
|
+
*/
|
|
22
|
+
export type ValidationGroupSeverity = `${ValidationSeverity}` | 'success' | undefined;
|
|
14
23
|
export type ValidationGroupDefaultSlotProps = {
|
|
15
24
|
data: ValidationMessagesArrayStyle;
|
|
16
|
-
severity:
|
|
25
|
+
severity: ValidationGroupSeverity;
|
|
17
26
|
itemClass: string;
|
|
18
27
|
itemTag: string;
|
|
19
28
|
};
|
|
@@ -22,13 +31,25 @@ export type ValidationGroupItemSlotProps = {
|
|
|
22
31
|
value: string;
|
|
23
32
|
class: string;
|
|
24
33
|
tag: string;
|
|
25
|
-
severity:
|
|
34
|
+
severity: ValidationGroupSeverity;
|
|
26
35
|
};
|
|
27
36
|
declare const validationGroupProps: {
|
|
28
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Severity used to colour the rendered messages. Accepts
|
|
39
|
+
* `'error' | 'warning'` (the vuecs-native vocabulary) plus
|
|
40
|
+
* `'success'` for forward-compat with validation bridges that
|
|
41
|
+
* surface a "passed" state (see `<VCFormGroup>`'s `:validation`
|
|
42
|
+
* bundle).
|
|
43
|
+
*
|
|
44
|
+
* Default is `undefined` — slot consumers receive the actual
|
|
45
|
+
* value passed by the host. The previous default of
|
|
46
|
+
* `ValidationSeverity.ERROR` is gone; if a slot template needs an
|
|
47
|
+
* error fallback when none is supplied, do it at the call site
|
|
48
|
+
* (`severity ?? 'error'`).
|
|
49
|
+
*/
|
|
29
50
|
severity: {
|
|
30
|
-
type: PropType
|
|
31
|
-
default:
|
|
51
|
+
type: PropType<ValidationGroupSeverity>;
|
|
52
|
+
default: any;
|
|
32
53
|
};
|
|
33
54
|
/** Validation messages — keyed object or ordered array of `{ key, value }`. */
|
|
34
55
|
messages: {
|
|
@@ -55,10 +76,22 @@ export type ValidationGroupProps = ExtractPublicPropTypes<typeof validationGroup
|
|
|
55
76
|
declare const _default: typeof __VLS_export;
|
|
56
77
|
export default _default;
|
|
57
78
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
58
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Severity used to colour the rendered messages. Accepts
|
|
81
|
+
* `'error' | 'warning'` (the vuecs-native vocabulary) plus
|
|
82
|
+
* `'success'` for forward-compat with validation bridges that
|
|
83
|
+
* surface a "passed" state (see `<VCFormGroup>`'s `:validation`
|
|
84
|
+
* bundle).
|
|
85
|
+
*
|
|
86
|
+
* Default is `undefined` — slot consumers receive the actual
|
|
87
|
+
* value passed by the host. The previous default of
|
|
88
|
+
* `ValidationSeverity.ERROR` is gone; if a slot template needs an
|
|
89
|
+
* error fallback when none is supplied, do it at the call site
|
|
90
|
+
* (`severity ?? 'error'`).
|
|
91
|
+
*/
|
|
59
92
|
severity: {
|
|
60
|
-
type: PropType
|
|
61
|
-
default:
|
|
93
|
+
type: PropType<ValidationGroupSeverity>;
|
|
94
|
+
default: any;
|
|
62
95
|
};
|
|
63
96
|
/** Validation messages — keyed object or ordered array of `{ key, value }`. */
|
|
64
97
|
messages: {
|
|
@@ -81,10 +114,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
114
|
default: any;
|
|
82
115
|
};
|
|
83
116
|
}>, () => VNodeChild, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Severity used to colour the rendered messages. Accepts
|
|
119
|
+
* `'error' | 'warning'` (the vuecs-native vocabulary) plus
|
|
120
|
+
* `'success'` for forward-compat with validation bridges that
|
|
121
|
+
* surface a "passed" state (see `<VCFormGroup>`'s `:validation`
|
|
122
|
+
* bundle).
|
|
123
|
+
*
|
|
124
|
+
* Default is `undefined` — slot consumers receive the actual
|
|
125
|
+
* value passed by the host. The previous default of
|
|
126
|
+
* `ValidationSeverity.ERROR` is gone; if a slot template needs an
|
|
127
|
+
* error fallback when none is supplied, do it at the call site
|
|
128
|
+
* (`severity ?? 'error'`).
|
|
129
|
+
*/
|
|
85
130
|
severity: {
|
|
86
|
-
type: PropType
|
|
87
|
-
default:
|
|
131
|
+
type: PropType<ValidationGroupSeverity>;
|
|
132
|
+
default: any;
|
|
88
133
|
};
|
|
89
134
|
/** Validation messages — keyed object or ordered array of `{ key, value }`. */
|
|
90
135
|
messages: {
|
|
@@ -109,7 +154,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
109
154
|
}>> & Readonly<{}>, {
|
|
110
155
|
themeClass: ThemeClassesOverride<ValidationGroupThemeClasses>;
|
|
111
156
|
themeVariant: VariantValues;
|
|
112
|
-
severity:
|
|
157
|
+
severity: ValidationGroupSeverity;
|
|
113
158
|
messages: ValidationMessages;
|
|
114
159
|
itemTag: string;
|
|
115
160
|
}, SlotsType<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/validation-group/ValidationGroup.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidationGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/validation-group/ValidationGroup.vue"],"names":[],"mappings":"AA6IA,OAAO,KAAK,EACR,wBAAwB,E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CAAC,CAAC;;;IACzF,wDAAwD;;cACxB,QAAQ,CAAC,aAAa,CAAC;;;CAC1D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,CAAC,OAAO,oBAAoB,CAAC,CAAC;wBAElE,OAAO,YAAY;AAAxC,wBAAyC;AAQzC,QAAA,MAAM,YAAY;IAlCd;;;;;;;;;;;;OAYG;;cACyB,QAAQ,CAAC,uBAAuB,CAAC;;;IAC7D,+EAA+E;;cAC1C,QAAQ,CAAC,kBAAkB,CAAC;;;IACjE,+CAA+C;;;;;IAE/C,yDAAyD;;cAC3B,QAAQ,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;;;IACzF,wDAAwD;;cACxB,QAAQ,CAAC,aAAa,CAAC;;;;IArBvD;;;;;;;;;;;;OAYG;;cACyB,QAAQ,CAAC,uBAAuB,CAAC;;;IAC7D,+EAA+E;;cAC1C,QAAQ,CAAC,kBAAkB,CAAC;;;IACjE,+CAA+C;;;;;IAE/C,yDAAyD;;cAC3B,QAAQ,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;;;IACzF,wDAAwD;;cACxB,QAAQ,CAAC,aAAa,CAAC;;;;;;;;;;aAiB1C,+BAA+B;UAClC,4BAA4B;yEA+CxC,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ const formCheckboxThemeDefaults = { classes: {
|
|
|
9
9
|
label: "vc-form-checkbox-label",
|
|
10
10
|
group: "vc-form-checkbox-wrapper"
|
|
11
11
|
} };
|
|
12
|
-
const behavioralDefaults$
|
|
12
|
+
const behavioralDefaults$3 = { labelContent: "Input" };
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/components/form-checkbox/FormCheckbox.vue
|
|
15
15
|
var FormCheckbox_default = defineComponent({
|
|
@@ -80,7 +80,7 @@ var FormCheckbox_default = defineComponent({
|
|
|
80
80
|
slots: Object,
|
|
81
81
|
setup(props, { attrs, emit, slots }) {
|
|
82
82
|
const theme = useComponentTheme("formCheckbox", props, formCheckboxThemeDefaults);
|
|
83
|
-
const defaults = useComponentDefaults("formCheckbox", props, behavioralDefaults$
|
|
83
|
+
const defaults = useComponentDefaults("formCheckbox", props, behavioralDefaults$3);
|
|
84
84
|
const fallbackId = useId(void 0, "vc-form-checkbox");
|
|
85
85
|
return () => {
|
|
86
86
|
const resolved = theme.value;
|
|
@@ -194,10 +194,22 @@ const validationGroupThemeDefaults = { classes: { item: "form-group-hint group-r
|
|
|
194
194
|
var ValidationGroup_default = defineComponent({
|
|
195
195
|
name: "VCValidationGroup",
|
|
196
196
|
props: {
|
|
197
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Severity used to colour the rendered messages. Accepts
|
|
199
|
+
* `'error' | 'warning'` (the vuecs-native vocabulary) plus
|
|
200
|
+
* `'success'` for forward-compat with validation bridges that
|
|
201
|
+
* surface a "passed" state (see `<VCFormGroup>`'s `:validation`
|
|
202
|
+
* bundle).
|
|
203
|
+
*
|
|
204
|
+
* Default is `undefined` — slot consumers receive the actual
|
|
205
|
+
* value passed by the host. The previous default of
|
|
206
|
+
* `ValidationSeverity.ERROR` is gone; if a slot template needs an
|
|
207
|
+
* error fallback when none is supplied, do it at the call site
|
|
208
|
+
* (`severity ?? 'error'`).
|
|
209
|
+
*/
|
|
198
210
|
severity: {
|
|
199
211
|
type: String,
|
|
200
|
-
default:
|
|
212
|
+
default: void 0
|
|
201
213
|
},
|
|
202
214
|
/** Validation messages — keyed object or ordered array of `{ key, value }`. */
|
|
203
215
|
messages: {
|
|
@@ -263,7 +275,6 @@ const formGroupThemeDefaults = { classes: {
|
|
|
263
275
|
validationError: "",
|
|
264
276
|
validationWarning: ""
|
|
265
277
|
} };
|
|
266
|
-
const behavioralDefaults$3 = { validation: true };
|
|
267
278
|
//#endregion
|
|
268
279
|
//#region src/components/form-group/FormGroup.vue
|
|
269
280
|
var FormGroup_default = defineComponent({
|
|
@@ -300,17 +311,35 @@ var FormGroup_default = defineComponent({
|
|
|
300
311
|
type: String,
|
|
301
312
|
default: void 0
|
|
302
313
|
},
|
|
303
|
-
/**
|
|
314
|
+
/**
|
|
315
|
+
* Bundle prop accepting a `FieldValidation` (`{ severity, messages }`)
|
|
316
|
+
* — wins over `validationSeverity` + `validationMessages` when set.
|
|
317
|
+
*
|
|
318
|
+
* Canonical use is with `@ilingo/validup-vue`'s `useFieldValidation`:
|
|
319
|
+
* `<VCFormGroup :validation="useFieldValidation($v.fields.email)">`.
|
|
320
|
+
* Structural typing — vuecs and `@ilingo/validup-vue` declare matching
|
|
321
|
+
* shapes without either importing the other.
|
|
322
|
+
*
|
|
323
|
+
* Pass `null` / `undefined` to fall through to the legacy props.
|
|
324
|
+
*/
|
|
304
325
|
validation: {
|
|
305
|
-
type:
|
|
326
|
+
type: [Object, null],
|
|
306
327
|
default: void 0
|
|
307
328
|
},
|
|
308
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
331
|
+
* Severity used to colour the validation messages (`error` /
|
|
332
|
+
* `warning`). Ignored when `:validation` is set.
|
|
333
|
+
*/
|
|
309
334
|
validationSeverity: {
|
|
310
335
|
type: String,
|
|
311
336
|
default: void 0
|
|
312
337
|
},
|
|
313
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* @deprecated Pass a `FieldValidation` via `:validation` instead.
|
|
340
|
+
* Validation messages — keyed object or ordered array of
|
|
341
|
+
* `{ key, value }`. Ignored when `:validation` is set.
|
|
342
|
+
*/
|
|
314
343
|
validationMessages: {
|
|
315
344
|
type: [Object, Array],
|
|
316
345
|
default: void 0
|
|
@@ -329,19 +358,23 @@ var FormGroup_default = defineComponent({
|
|
|
329
358
|
slots: Object,
|
|
330
359
|
setup(props, { attrs, slots }) {
|
|
331
360
|
const theme = useComponentTheme("formGroup", props, formGroupThemeDefaults);
|
|
332
|
-
const defaults = useComponentDefaults("formGroup", props, behavioralDefaults$3);
|
|
333
361
|
return () => {
|
|
334
362
|
const resolved = theme.value;
|
|
335
|
-
const resolvedDefaults = defaults.value;
|
|
336
363
|
const children = [];
|
|
337
364
|
if (typeof props.label === "boolean" ? props.label : !!props.labelContent || !!slots.label) {
|
|
338
365
|
if (slots.label) children.push(h(props.labelTag, { class: resolved.label || void 0 }, slots.label({})));
|
|
339
366
|
else if (props.labelContent) children.push(h(props.labelTag, { class: resolved.label || void 0 }, [props.labelContent]));
|
|
340
367
|
}
|
|
341
368
|
if (slots.default) children.push(slots.default({}));
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
369
|
+
const usingBundle = props.validation != null;
|
|
370
|
+
const bundleSeverity = usingBundle ? props.validation.severity : void 0;
|
|
371
|
+
const effectiveSeverity = usingBundle ? bundleSeverity : props.validationSeverity;
|
|
372
|
+
const effectiveMessages = usingBundle ? props.validation.messages : props.validationMessages;
|
|
373
|
+
const hasMessages = !!effectiveMessages && (Array.isArray(effectiveMessages) ? effectiveMessages.length > 0 : Object.keys(effectiveMessages).length > 0);
|
|
374
|
+
const hasValidationSlot = !!slots.validationGroup || !!slots.validationItem;
|
|
375
|
+
if (hasMessages || hasValidationSlot) children.push(h(ValidationGroup_default, {
|
|
376
|
+
severity: effectiveSeverity,
|
|
377
|
+
messages: effectiveMessages || {}
|
|
345
378
|
}, {
|
|
346
379
|
...slots.validationGroup ? { default: slots.validationGroup } : {},
|
|
347
380
|
...slots.validationItem ? { item: slots.validationItem } : {}
|
|
@@ -351,8 +384,10 @@ var FormGroup_default = defineComponent({
|
|
|
351
384
|
else if (props.hintContent) children.push(h(props.hintTag, { class: resolved.hint || void 0 }, [props.hintContent]));
|
|
352
385
|
}
|
|
353
386
|
let validationClass;
|
|
354
|
-
if (
|
|
355
|
-
if (
|
|
387
|
+
if (hasMessages) {
|
|
388
|
+
if (effectiveSeverity === "warning") validationClass = resolved.validationWarning;
|
|
389
|
+
else if (effectiveSeverity === "error") validationClass = resolved.validationError;
|
|
390
|
+
else if (!usingBundle) validationClass = resolved.validationError;
|
|
356
391
|
}
|
|
357
392
|
return h("div", mergeProps(attrs, { class: [resolved.root || void 0, validationClass || void 0] }), children);
|
|
358
393
|
};
|