@progress/kendo-vue-form 11.0.0-develop.1 → 11.0.1-develop.1
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/Field.d.ts +10 -0
- package/FieldArray.d.ts +8 -1
- package/FieldWrapper.d.ts +18 -4
- package/Form.d.ts +21 -7
- package/Form.mjs +6 -6
- package/FormElement.d.ts +19 -7
- package/FormFieldSet.d.ts +21 -9
- package/NOTICE.txt +17 -17
- package/dist/cdn/js/kendo-vue-form.js +1 -1
- package/interfaces/FieldArrayProps.d.ts +5 -5
- package/interfaces/FieldArrayRenderProps.d.ts +1 -1
- package/interfaces/FieldInjectedProps.d.ts +3 -3
- package/interfaces/FieldProps.d.ts +19 -15
- package/interfaces/FieldRenderProps.d.ts +2 -2
- package/interfaces/FormProps.d.ts +22 -23
- package/interfaces/FormRenderProps.d.ts +33 -33
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +4 -4
package/Field.d.ts
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Represents the KendoVue Field component ([see example](slug:overview_form)).
|
|
10
|
+
* Accepts properties of type [FieldProps](slug:api_form_fieldprops).
|
|
11
|
+
* Use the Field to connect an editor to the Form state.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```vue
|
|
15
|
+
* <Field :name="'email'" :component="'myTemplate'" :validator="emailValidator" />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
8
18
|
declare const Field: import('vue').DefineComponent<{}, {}, {}, {}, {
|
|
9
19
|
handleOnChange(event: any): void;
|
|
10
20
|
onNativeComponentChange(event: any): void;
|
package/FieldArray.d.ts
CHANGED
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { PropType } from 'vue';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Represents the KendoVue FieldArray component ([see example](slug:validation_form)).
|
|
11
|
+
* Accepts properties of type [FieldArrayProps](slug:api_form_fieldarrayprops).
|
|
12
|
+
* Use the FieldArray to connect an array of values to the Form state.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```vue
|
|
16
|
+
* <FieldArray :name="'users'" :component="'usersTemplate'" :validator="arrayLengthValidator" />
|
|
17
|
+
* ```
|
|
11
18
|
*/
|
|
12
19
|
declare const FieldArray: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
13
20
|
value: PropType<any>;
|
package/FieldWrapper.d.ts
CHANGED
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
import { PropType } from 'vue';
|
|
9
9
|
import { ResponsiveFormBreakPoint } from './interfaces/ResponsiveFormBreakPoint';
|
|
10
10
|
/**
|
|
11
|
-
* Represents the props of the Kendo
|
|
11
|
+
* Represents the props of the Kendo UI for Vue FieldWrapper component.
|
|
12
12
|
*/
|
|
13
13
|
export interface FieldWrapperProps {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* When set to `true`, shows the form editors in a horizontal layout.
|
|
16
16
|
*/
|
|
17
17
|
horizontal?: boolean;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Sets how many columns of the parent Form layout the field spans.
|
|
20
|
+
* Accepts a number or an array of responsive breakpoints.
|
|
20
21
|
*/
|
|
21
22
|
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
22
23
|
/**
|
|
@@ -25,7 +26,20 @@ export interface FieldWrapperProps {
|
|
|
25
26
|
[customProp: string]: any;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
*
|
|
29
|
+
* Represents the KendoVue FieldWrapper component ([see example](slug:layout_form)).
|
|
30
|
+
* Accepts properties of type [FieldWrapperProps](slug:api_form_fieldwrapperprops).
|
|
31
|
+
* Use the FieldWrapper to group an editor with its label, hint, and error message.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```vue
|
|
35
|
+
* <FieldWrapper :col-span="2">
|
|
36
|
+
* <Label :editor-id="'email'">Email</Label>
|
|
37
|
+
* <Hint :id="'email-hint'">Enter your work email.</Hint>
|
|
38
|
+
* </FieldWrapper>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Supported children components are: {@link Label}, {@link FloatingLabel}, {@link Hint}, {@link Error}.
|
|
29
43
|
*/
|
|
30
44
|
declare const FieldWrapper: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
31
45
|
dir: PropType<any>;
|
package/Form.d.ts
CHANGED
|
@@ -10,7 +10,21 @@ import { FormRenderProps } from './interfaces/FormRenderProps';
|
|
|
10
10
|
import { KeyValue } from './interfaces/KeyValue';
|
|
11
11
|
import { PropType } from 'vue';
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Represents the [KendoVue Form component](slug:overview_form).
|
|
14
|
+
* Accepts properties of type [FormProps](slug:api_form_formprops).
|
|
15
|
+
* Use the Form to manage the values, validation, and submission of your form fields.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```vue
|
|
19
|
+
* <Form :initial-values="{ email: '' }" @submit="handleSubmit">
|
|
20
|
+
* <FormElement>
|
|
21
|
+
* <Field :name="'email'" :component="'myTemplate'" />
|
|
22
|
+
* </FormElement>
|
|
23
|
+
* </Form>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* Supported children components are: {@link FormElement}.
|
|
14
28
|
*/
|
|
15
29
|
declare const Form: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
16
30
|
renderForm: PropType<(props: FormRenderProps) => any>;
|
|
@@ -69,20 +83,20 @@ declare const Form: import('vue').DefineComponent<import('vue').ExtractPropTypes
|
|
|
69
83
|
*/
|
|
70
84
|
resetForm(): void;
|
|
71
85
|
/**
|
|
72
|
-
*
|
|
86
|
+
* Resets the Form state from outside the Form component.
|
|
73
87
|
*
|
|
74
|
-
* > Use `onReset` only
|
|
75
|
-
*
|
|
88
|
+
* > Use `onReset` only when you cannot get the result you need
|
|
89
|
+
* through the Field component or the `FormRenderProps`.
|
|
76
90
|
*/
|
|
77
91
|
onReset(): void;
|
|
78
92
|
addField(field: string): void;
|
|
79
93
|
validate(fields: object): void;
|
|
80
94
|
onSubmit(event: any): void;
|
|
81
95
|
/**
|
|
82
|
-
*
|
|
96
|
+
* Changes the value of a specific field from outside the Form component.
|
|
83
97
|
*
|
|
84
|
-
* > Use `onChange` only
|
|
85
|
-
*
|
|
98
|
+
* > Use `onChange` only when you cannot get the result you need
|
|
99
|
+
* through the Field component or the `FormRenderProps`.
|
|
86
100
|
*/
|
|
87
101
|
handleFieldChange(name: string, options: {
|
|
88
102
|
value: any;
|
package/Form.mjs
CHANGED
|
@@ -133,10 +133,10 @@ const F = 0, B = /* @__PURE__ */ c({
|
|
|
133
133
|
this.form.values = l(this.$props.initialValues), this.id = a(), this.form.touchedByField = {}, this.form.visitedByField = {}, this.form.modifiedByField = {}, this.form.submitted = !1;
|
|
134
134
|
},
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* Resets the Form state from outside the Form component.
|
|
137
137
|
*
|
|
138
|
-
* > Use `onReset` only
|
|
139
|
-
*
|
|
138
|
+
* > Use `onReset` only when you cannot get the result you need
|
|
139
|
+
* through the Field component or the `FormRenderProps`.
|
|
140
140
|
*/
|
|
141
141
|
onReset() {
|
|
142
142
|
this.resetForm();
|
|
@@ -170,10 +170,10 @@ const F = 0, B = /* @__PURE__ */ c({
|
|
|
170
170
|
}), r && (this.$props.ignoreModified || o) && (this.form.submitted = !0, this.$emit("submit", s, i));
|
|
171
171
|
},
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
173
|
+
* Changes the value of a specific field from outside the Form component.
|
|
174
174
|
*
|
|
175
|
-
* > Use `onChange` only
|
|
176
|
-
*
|
|
175
|
+
* > Use `onChange` only when you cannot get the result you need
|
|
176
|
+
* through the Field component or the `FormRenderProps`.
|
|
177
177
|
*/
|
|
178
178
|
handleFieldChange(i, t) {
|
|
179
179
|
const {
|
package/FormElement.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ import { PropType } from 'vue';
|
|
|
9
9
|
import { ResponsiveFormBreakPoint } from './interfaces/ResponsiveFormBreakPoint';
|
|
10
10
|
import { Gutters } from './interfaces/Gutters';
|
|
11
11
|
/**
|
|
12
|
-
* Represents the props of the Kendo
|
|
12
|
+
* Represents the props of the Kendo UI for Vue FormElement component.
|
|
13
13
|
*/
|
|
14
14
|
export interface FormElementProps {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Sets the `size` of the Form.
|
|
17
17
|
*
|
|
18
18
|
* The available options are:
|
|
19
19
|
* - small
|
|
@@ -25,16 +25,16 @@ export interface FormElementProps {
|
|
|
25
25
|
*/
|
|
26
26
|
size?: null | 'small' | 'medium' | 'large';
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* When set to `true`, shows the form editors in a horizontal layout.
|
|
29
29
|
*/
|
|
30
30
|
horizontal?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Sets the number of columns in the form. Accepts a number or an array of responsive breakpoints.
|
|
33
33
|
*/
|
|
34
34
|
cols?: number | ResponsiveFormBreakPoint[];
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* Accepts a number (
|
|
36
|
+
* Sets the gutters for the form layout. You can set gutters for the rows and the columns.
|
|
37
|
+
* Accepts a number (in pixels), a CSS string, a `Gutters` object with `cols` and `rows` keys,
|
|
38
38
|
* or an array of responsive breakpoints.
|
|
39
39
|
*/
|
|
40
40
|
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
@@ -44,7 +44,19 @@ export interface FormElementProps {
|
|
|
44
44
|
[customProp: string]: any;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Represents the KendoVue FormElement component ([see example](slug:layout_form)).
|
|
48
|
+
* Accepts properties of type [FormElementProps](slug:api_form_formelementprops).
|
|
49
|
+
* Use the FormElement to render the `form` element and to arrange the fields of the Form.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```vue
|
|
53
|
+
* <FormElement :cols="2" :size="'medium'">
|
|
54
|
+
* <Field :name="'firstName'" :component="'myTemplate'" />
|
|
55
|
+
* </FormElement>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* Supported children components are: {@link Field}, {@link FieldArray}, {@link FieldWrapper}, {@link FormFieldSet}.
|
|
48
60
|
*/
|
|
49
61
|
declare const FormElement: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
50
62
|
horizontal: PropType<boolean>;
|
package/FormFieldSet.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import { Gutters } from './interfaces/Gutters';
|
|
|
13
13
|
*/
|
|
14
14
|
export interface FormFieldSetProps {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Sets the number of columns of the fieldset.
|
|
17
|
+
* Accepts a number or an array of responsive breakpoints.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```vue
|
|
@@ -23,8 +23,8 @@ export interface FormFieldSetProps {
|
|
|
23
23
|
*/
|
|
24
24
|
cols?: number | ResponsiveFormBreakPoint[];
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Sets how many columns of the parent FormElement the fieldset spans.
|
|
27
|
+
* Accepts a number or an array of responsive breakpoints.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```vue
|
|
@@ -33,10 +33,10 @@ export interface FormFieldSetProps {
|
|
|
33
33
|
*/
|
|
34
34
|
colSpan?: number | ResponsiveFormBreakPoint[];
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* Accepts a number (
|
|
36
|
+
* Sets the gutters for the fieldset layout.
|
|
37
|
+
* Accepts a number (in pixels), a CSS string, a `Gutters` object with `cols` and `rows` keys,
|
|
38
38
|
* or an array of responsive breakpoints.
|
|
39
|
-
*
|
|
39
|
+
* When you set `cols`, the gutters default to `{ rows: '0px', cols: '16px' }`.
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```vue
|
|
@@ -45,7 +45,7 @@ export interface FormFieldSetProps {
|
|
|
45
45
|
*/
|
|
46
46
|
gutters?: string | number | Gutters | ResponsiveFormBreakPoint[];
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Sets the legend text of the fieldset.
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
51
|
* ```vue
|
|
@@ -59,7 +59,19 @@ export interface FormFieldSetProps {
|
|
|
59
59
|
[customProp: string]: any;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Represents the KendoVue FormFieldSet component ([see example](slug:layout_form)).
|
|
63
|
+
* Accepts properties of type [FormFieldSetProps](slug:api_form_formfieldsetprops).
|
|
64
|
+
* Use the FormFieldSet to group related fields of the Form under a common legend.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```vue
|
|
68
|
+
* <FormFieldSet :legend="'Shipping Address'" :cols="2">
|
|
69
|
+
* <Field :name="'city'" :component="'myTemplate'" />
|
|
70
|
+
* </FormFieldSet>
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Supported children components are: {@link Field}, {@link FieldWrapper}.
|
|
63
75
|
*/
|
|
64
76
|
declare const FormFieldSet: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
65
77
|
cols: PropType<number | ResponsiveFormBreakPoint[]>;
|
package/NOTICE.txt
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
Progress Kendo UI for Vue 2026
|
|
2
|
+
Progress Kendo UI for Vue 2026 Updated November 2026
|
|
3
3
|
|
|
4
4
|
----------------------------------------------------------------------------------------------------------------------------
|
|
5
5
|
NOTICES REPORT
|
|
6
6
|
----------------------------------------------------------------------------------------------------------------------------
|
|
7
7
|
|
|
8
8
|
Portions of the Products include certain open source and commercial third-party components listed below ("Third-Party
|
|
9
|
-
Components"). The authors of the Third-Party Components require Progress Software Corporation ("PSC") to include
|
|
10
|
-
following notices and additional licensing terms as a condition of PSC's use of such Third-Party Components. You
|
|
11
|
-
acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-
|
|
12
|
-
Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party
|
|
9
|
+
Components"). The authors of the Third-Party Components require Progress Software Corporation ("PSC") to include
|
|
10
|
+
the following notices and additional licensing terms as a condition of PSC's use of such Third-Party Components. You
|
|
11
|
+
acknowledge that the authors of the Third-Party Components have no obligation to provide support to you for the Third-
|
|
12
|
+
Party Components or the Product. You hereby undertake to comply with all licenses related to the applicable Third-Party
|
|
13
13
|
Components. Notwithstanding anything to the contrary, to the extent that any of the terms and conditions of the Progress
|
|
14
|
-
Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for
|
|
15
|
-
technologies, such terms and conditions are offered by PSC alone and not by any other party.
|
|
14
|
+
Agreement conflict, vary, or are in addition to the terms and conditions of the aforementioned third-party licenses for
|
|
15
|
+
these technologies, such terms and conditions are offered by PSC alone and not by any other party.
|
|
16
16
|
|
|
17
17
|
----------------------------------------------------------------------------------------------------------------------------
|
|
18
18
|
Report Content
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
GENERATIVE ARTIFICIAL INTELLIGENCE INTEGRATION
|
|
29
29
|
If the Software documentation specifies integration with some form of generative artificial intelligence (AI), then the
|
|
30
30
|
Software will include a configuration to connect to AI. You acknowledge that a separate license or subscription access
|
|
31
|
-
to AI governed by the terms and conditions of a license agreement from AI licensor will be required for use and access
|
|
32
|
-
AI capabilities integrated with the Software. You will be responsible to comply with the terms of such license agreement
|
|
31
|
+
to AI governed by the terms and conditions of a license agreement from AI licensor will be required for use and access
|
|
32
|
+
of AI capabilities integrated with the Software. You will be responsible to comply with the terms of such license agreement
|
|
33
33
|
for a valid use of AI. You acknowledge and accept that Progress is not a party to the license agreement between You
|
|
34
34
|
and AI licensor for AI use, and as a result Progress does not have any control over AI and its availability, and Progress
|
|
35
35
|
disclaims any and all liabilities for any output, error, damages, loss, etc., or any other result of Your use of AI
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
|
|
38
38
|
----------------------------------------------------------------------------------------------------------------------------
|
|
39
39
|
|
|
40
|
-
NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or
|
|
41
|
-
documentation that accompanies updates received in connection with support of the Product.
|
|
40
|
+
NOTICE FROM PROGRESS SOFTWARE CORPORATION: Additional notices may be included in the release notes or
|
|
41
|
+
other documentation that accompanies updates received in connection with support of the Product.
|
|
42
42
|
|
|
43
43
|
----------------------------------------------------------------------------------------------------------------------------
|
|
44
44
|
|
|
@@ -52,9 +52,9 @@ Components:
|
|
|
52
52
|
| | readme | |
|
|
53
53
|
| @progress/pako-esm 1.0.1 | https://github.com/telerik/pako-esm#r | MIT License |
|
|
54
54
|
| | eadme | |
|
|
55
|
-
| prosemirror-commands 1.7.
|
|
55
|
+
| prosemirror-commands 1.7.2 | https://github.com/prosemirror/prosem | MIT License |
|
|
56
56
|
| | irror-commands#readme | |
|
|
57
|
-
| prosemirror-dropcursor 1.8.
|
|
57
|
+
| prosemirror-dropcursor 1.8.3 | https://github.com/prosemirror/prosem | MIT License |
|
|
58
58
|
| | irror-dropcursor#readme | |
|
|
59
59
|
| prosemirror-gapcursor 1.4.1 | https://github.com/prosemirror/prosem | MIT License |
|
|
60
60
|
| | irror-gapcursor#readme | |
|
|
@@ -64,7 +64,7 @@ Components:
|
|
|
64
64
|
| | irror-inputrules#readme | |
|
|
65
65
|
| prosemirror-keymap 1.2.3 | https://github.com/prosemirror/prosem | MIT License |
|
|
66
66
|
| | irror-keymap#readme | |
|
|
67
|
-
| prosemirror-model 1.25.
|
|
67
|
+
| prosemirror-model 1.25.12 | https://github.com/prosemirror/prosem | MIT License |
|
|
68
68
|
| | irror-model#readme | |
|
|
69
69
|
| prosemirror-schema-list 1.5.1 | https://github.com/prosemirror/prosem | MIT License |
|
|
70
70
|
| | irror-schema-list#readme | |
|
|
@@ -72,9 +72,9 @@ Components:
|
|
|
72
72
|
| | irror-state#readme | |
|
|
73
73
|
| prosemirror-tables 1.8.5 | https://github.com/prosemirror/prosem | MIT License |
|
|
74
74
|
| | irror-tables#readme | |
|
|
75
|
-
| prosemirror-transform 1.
|
|
75
|
+
| prosemirror-transform 1.12.1 | https://github.com/prosemirror/prosem | MIT License |
|
|
76
76
|
| | irror-transform#readme | |
|
|
77
|
-
| prosemirror-view 1.
|
|
77
|
+
| prosemirror-view 1.42.5 | https://github.com/prosemirror/prosem | MIT License |
|
|
78
78
|
| | irror-view#readme | |
|
|
79
79
|
| -------------------------------------- | ------------------------------------- | ---------------------------------------- |
|
|
80
80
|
|
|
@@ -269,7 +269,7 @@ third-party archives.
|
|
|
269
269
|
---
|
|
270
270
|
|
|
271
271
|
MIT License
|
|
272
|
-
(@progress/jszip-esm 1.0.4, @progress/pako-esm 1.0.1, prosemirror-commands 1.7.
|
|
272
|
+
(@progress/jszip-esm 1.0.4, @progress/pako-esm 1.0.1, prosemirror-commands 1.7.2, prosemirror-dropcursor 1.8.3, prosemirror-gapcursor 1.4.1, prosemirror-history 1.5.0, prosemirror-inputrules 1.5.1, prosemirror-keymap 1.2.3, prosemirror-model 1.25.12, prosemirror-schema-list 1.5.1, prosemirror-state 1.4.4, prosemirror-tables 1.8.5, prosemirror-transform 1.12.1, prosemirror-view 1.42.5)
|
|
273
273
|
|
|
274
274
|
The MIT License
|
|
275
275
|
===============
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueForm={},e.Vue,e.KendoVueCommon)}(this,function(e,t,s){"use strict";const i=t.defineComponent({name:"KendoField",props:{component:[String,Number,Boolean,Object],validator:[Function,Array],name:String,colSpan:[Number,Array]},created(){return this.kendoForm?this.kendoForm.registerField(this.$props.name,this.$props.validator):void 0},inject:{kendoForm:{default:null}},emits:["change"],methods:{handleOnChange(e){const t=e&&(void 0!==e.value?e.value:e.target?e.target.value:e.target);this.kendoForm.onChange(this.$props.name,{value:t}),this.$emit("change",e)},onNativeComponentChange(e){this.kendoForm.onChange(this.$props.name,{value:e.target.value})},handleOnBlur(){this.kendoForm.onBlur(this.$props.name)},handleOnFocus(){this.kendoForm.onFocus(this.$props.name)}},render(){const e=s.getDefaultSlots(this),{name:i,component:o,id:r,colSpan:n}=this.$props;if(!this.kendoForm)return null;const l=this.kendoForm.values[i];if("string"==typeof o&&("input"===o||"textarea"===o))return t.h(o,{onBlur:this.handleOnBlur,onFocus:this.handleOnFocus,name:i,value:l||""});if(o){const d=s.templateRendering.call(this,o,s.getListeners.call(this));return s.getTemplate.call(this,{h:t.h,template:d,additionalProps:{value:l,validationMessage:this.kendoForm.errors[i],touched:this.kendoForm.touchedByField[i],modified:this.kendoForm.modifiedByField[i],visited:this.kendoForm.visitedByField[i],valid:!(this.kendoForm.errors[i]&&this.kendoForm.touchedByField[i]),name:i,id:r,...void 0!==n?{colSpan:n}:{},...this.$attrs},additionalListeners:{change:this.handleOnChange,input:this.handleOnChange,blur:this.handleOnBlur,focus:this.handleOnFocus},defaultSlots:e})}}}),o={name:"@progress/kendo-vue-form",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"11.0.0-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},r=t.defineComponent({name:"KendoForm",inheritAttrs:!1,props:{renderForm:[Object,Function],initialValues:Object,validator:Function,ignoreModified:Boolean,errors:Object,onChange:Function},emits:{submitclick:null,submit:null},created(){this._accumulatorTimeout=void 0,s.validatePackage(o),this.form.values=s.clone(this.$props.initialValues)},mounted(){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()},unmounted(){this.onDestroy()},data(){return{validatorsByField:{},fields:[],unmounted:!1,form:{id:this.id,errors:{},values:{},modifiedByField:{},touchedByField:{},visitedByField:{},valid:!1,modified:!1,touched:!1,visited:!1,submitted:!1,valueGetter:this.valueGetter,allowSubmit:!1,validate:this.validate,onChange:this.handleFieldChange,onSubmit:this.onSubmit,onFormReset:this.resetForm,registerField:this.onFieldRegister,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}}},provide(){return{kendoForm:this.$data.form}},watch:{"form.values"(){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()},"form.touchedByField"(e){this.form.touched=this.isFormTouched(e,this.fields),this.form.allowSubmit=this.allowSubmit()},"form.modifiedByField"(e){this.form.modified=this.isFormModified(e,this.fields),this.form.allowSubmit=this.allowSubmit()},"form.visitedByField"(e){this.form.visited=this.isFormVisited(e,this.fields)},errors(e){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()}},methods:{isValid(){return this.isFormValid(this.form.errors)},formErrors(){if(this.$props.validator)return this.$props.validator(this.form.values,this.valueGetter)},getErrors(){const e={},t=this.validatorsByField;return Object.keys(this.fields).forEach(s=>{if(e[s]="",t[s]){const i=[];t[s].forEach(e=>{Array.isArray(e)?i.push(...e):i.push(e)}),i.find(t=>{if(t){const i=t(this.valueGetter(s),this.valueGetter,{name:s});if(i)return e[s]=i,!0}return!1})}}),this.formErrors()&&s.cloneObject(this.formErrors(),e),this.$props.errors&&s.cloneObject(this.$props.errors,e),e},accumulatedForceUpdate(){this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout),s.canUseDOM&&(this._accumulatorTimeout=window.setTimeout(()=>{this._accumulatorTimeout=void 0},0))},resetForm(){this.form.values=s.clone(this.$props.initialValues),this.id=s.guid(),this.form.touchedByField={},this.form.visitedByField={},this.form.modifiedByField={},this.form.submitted=!1},onReset(){this.resetForm()},addField(e){this.fields[e]=!0},validate(e){const t={},s=e||this.fields;Object.keys(s).forEach(e=>{t[e]=!0}),this.form.touchedByField={...t}},onSubmit(e){const t={},s=this.fields;e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation&&e.stopPropagation()),Object.keys(s).forEach(e=>{t[e]=!0}),this.form.visitedByField={...t},this.form.touchedByField={...t};const i=this.form.values,o=this.isValid(),r=this.isFormModified(this.form.modifiedByField,s);this.$emit("submitclick",{values:i,isValid:o,isModified:r,event:e}),o&&(this.$props.ignoreModified||r)&&(this.form.submitted=!0,this.$emit("submit",i,e))},handleFieldChange(e,t){const{value:s}=t;this.addField(e),this.form.modifiedByField[e]||(this.form.modifiedByField={...this.form.modifiedByField,[e]:!0}),this.valueSetter(e,s),this.$props.onChange&&this.$props.onChange(e,s,this.valueGetter)},onFocus(e){this.form.visitedByField[e]||(this.form.visitedByField={...this.form.visitedByField,[e]:!0})},onBlur(e){this.form.touchedByField[e]||(this.onFocus(e),this.form.touchedByField={...this.form.touchedByField,[e]:!0})},onFieldRegister(e,t){this.addField(e);const s=this.validatorsByField[e]||[],i=s.length;return this.validatorsByField={...this.validatorsByField,[e]:[...s,t]},this.accumulatedForceUpdate(),()=>{if(this._unmounted)return;const t=[...this.validatorsByField[e]||[]],s=!!t[i];t[i]=void 0,this.validatorsByField={...this.validatorsByField,[e]:t},s&&this.accumulatedForceUpdate()}},isFormValid:e=>!Object.keys(e).some(t=>!!e[t]),isFormModified:(e,t)=>Object.keys(t).some(t=>e[t]),isFormHasNotTouched:(e,t)=>Object.keys(t).some(t=>!e[t]),isFormTouched:(e,t)=>Object.keys(t).some(t=>e[t]),isFormVisited:(e,t)=>Object.keys(t).some(t=>e[t]),formHasNotTouched(){return this.isFormHasNotTouched(this.form.touchedByField,this.fields)},allowSubmit(){return this.formHasNotTouched()&&!this.isValid()||this.isValid()&&(this.$props.ignoreModified||this.isFormModified(this.form.modifiedByField,this.fields))},valueGetter(e){return this.form.values[e]},valueSetter(e,t){this.form.values={...this.form.values,[e]:t}},onArrayAction(e){this.addField(e),this.form.modifiedByField[e]||(this.form.modifiedByField={...this.form.modifiedByField,[e]:!0}),this.onBlur(e,!0)},onInsert(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,0,t.value),this.valueSetter(e,s)},onUnshift(e,t){this.onInsert(e,{value:t.value,index:0})},onPush(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[],t.value];this.valueSetter(e,s)},onPop(e){this.onArrayAction(e);const t=[...this.valueGetter(e)||[]],s=t.pop();return this.valueSetter(e,t),s},onRemove(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s.splice(t.index,1);return this.valueSetter(e,s),i},onReplace(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,1,t.value),this.valueSetter(e,s)},onMove(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s[t.prevIndex];s.splice(t.prevIndex,1),s.splice(t.nextIndex,0,i),this.valueSetter(e,s)},onDestroy(){this.unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)}},render(){const e={onSubmit:this.onSubmit,onChange:this.handleFieldChange,onFormreset:this.resetForm,errors:this.form.errors,valid:this.form.valid,touched:this.form.touched,visited:this.form.visited,modified:this.form.modified,submitted:this.form.submitted,allowSubmit:this.form.allowSubmit,valueGetter:this.valueGetter};return this.$props.renderForm?this.$props.renderForm(e):s.getDefaultSlots(this)}}),n=t.defineComponent({name:"KendoFieldArray",props:{value:[String,Number,Boolean,Object,Array],component:[String,Number,Boolean,Object],validationMessage:String,touched:Boolean,modified:Boolean,validator:[Function,Array],visited:Boolean,valid:Boolean,name:String,id:String},created(){return this.kendoForm?this.kendoForm.registerField(this.$props.name,this.$props.validator):void 0},methods:{onUnshift(e){this.kendoForm.onUnshift(this.$props.name,e)},onPush(e){this.kendoForm.onPush(this.$props.name,e)},onInsert(e){this.kendoForm.onInsert(this.$props.name,e)},onPop(){this.kendoForm.onPop(this.$props.name)},onRemove(e){this.kendoForm.onRemove(this.$props.name,e)},onReplace(e){this.kendoForm.onReplace(this.$props.name,e)},onMove(e){this.kendoForm.onMove(this.$props.name,e)}},inject:{kendoForm:{default:null}},render(){const{name:e,component:i,id:o}=this.$props;if(!this.kendoForm)return null;const r=this.kendoForm.values[e];if(i){const n=s.templateRendering.call(this,i,s.getListeners.call(this));return s.getTemplate.call(this,{h:t.h,template:n,additionalProps:{value:r,validationMessage:this.kendoForm.errors[e],touched:this.kendoForm.touchedByField[e],modified:this.kendoForm.modifiedByField[e],visited:this.kendoForm.visitedByField[e],valid:!(this.kendoForm.errors[e]&&this.kendoForm.touchedByField[e]),name:e,id:o,...this.$attrs},additionalListeners:{unshift:this.onUnshift,push:this.onPush,insert:this.onInsert,pop:this.onPop,remove:this.onRemove,replace:this.onReplace,move:this.onMove}})}}});function l(e){let t=e.clientWidth;const s=getComputedStyle(e);return t-=(parseFloat(s.paddingLeft)||0)+(parseFloat(s.borderLeftWidth)||0),t-=(parseFloat(s.paddingRight)||0)+(parseFloat(s.borderRightWidth)||0),t}function d(e,t){var s,i;if(null==e||!e.length||null==t)return"";for(const[o,r]of e.entries()){const n=o>0&&void 0!==e[o-1].maxWidth?e[o-1].maxWidth:void 0,l=o<e.length-1&&void 0!==e[o+1].minWidth?e[o+1].minWidth:void 0,d=null!=(s=r.minWidth)?s:void 0!==n?n+1:0,a=null!=(i=r.maxWidth)?i:void 0!==l?l-1:1/0;if(t>=d&&t<=a)return r.value}return""}function a(e,t){if(!e)return null;if(Array.isArray(e)&&e.length>0){const s=d(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return"number"==typeof e?e:null}function h(e){return e&&e>0?`k-grid-cols-${e}`:""}function u(e,t){if(!e)return null;if("number"==typeof e)return e;if(Array.isArray(e)&&e.length>0){const s=d(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return null}function m(e){return e?`k-col-span-${e}`:""}function c(e){if(null==e)return null;if("number"==typeof e)return`${e}px`;const t=e.trim(),s=parseInt(t,10);return!isNaN(s)&&Number.isFinite(s)?s.toString()===t?`${s}px`:e:null}function p(e,t){if(!e)return null;if("number"==typeof e)return{cols:e,rows:e};if("string"==typeof e){if(!e.includes(" "))return{cols:e,rows:e};const t=e.split(" ");return{cols:t[1],rows:t[0]}}if(Array.isArray(e)){const s=d(e,t)||null;return null!==s?{cols:s,rows:s}:null}if("object"==typeof e){const s=e,i={rows:null,cols:null};return void 0!==s.cols&&null!==s.cols&&("number"==typeof s.cols||"string"==typeof s.cols?i.cols=s.cols:Array.isArray(s.cols)&&(i.cols=d(s.cols,t)||null)),void 0!==s.rows&&("number"==typeof s.rows||"string"==typeof s.rows?i.rows=s.rows:Array.isArray(s.rows)&&(i.rows=d(s.rows,t)||null)),i}return null}function f(e,t){var s,i,o,r;const n=c(null!=(i=null!=(s=null==e?void 0:e.rows)?s:t.rows)?i:"0px"),l=c(null!=(r=null!=(o=null==e?void 0:e.cols)?o:t.cols)?r:"32px");return`${null!=n?n:"0px"} ${null!=l?l:"32px"}`}const v=t.defineComponent({name:"KendoFieldWrapper",props:{dir:String,horizontal:Boolean,colSpan:[Number,Array]},data:()=>({colSpanClass:""}),created(){s.validatePackage(o),this._resizeObserver=null,this._formElement=null},mounted(){var e;void 0!==this.$props.colSpan&&(this._formElement=(null==(e=this.$el)?void 0:e.closest("form"))||null,this._setupColSpanObserver())},beforeUnmount(){this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null)},watch:{colSpan(e){var t;void 0!==e?(this._formElement=(null==(t=this.$el)?void 0:t.closest("form"))||null,this._setupColSpanObserver()):(this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null),this.colSpanClass="")}},computed:{fieldClassName(){return{"k-form-field":!0,"k-rtl":"rtl"===this.$props.dir,...this.colSpanClass?{[this.colSpanClass]:!0}:{}}}},methods:{_updateColSpanClass(){const e="undefined"!=typeof window?window.innerWidth:0,t=this._formElement?l(this._formElement):e,s=u(this.$props.colSpan,t);this.colSpanClass=m(s)},_setupColSpanObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._updateColSpanClass(),this._formElement&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._updateColSpanClass()),this._resizeObserver.observe(this._formElement))}},render(){const e=s.getDefaultSlots(this);return t.createVNode("div",{class:this.fieldClassName},[e])}}),F=t.defineComponent({name:"KendoFormElement",props:{horizontal:Boolean,size:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large"].includes(e)}},cols:[Number,Array],gutters:[String,Number,Object,Array]},data:()=>({columnClass:"",gapStyle:""}),created(){s.validatePackage(o),this._resizeObserver=null},inject:{kendoForm:{default:null}},mounted(){var e;this._handlePasteEvent=e=>{var t;const s=null==(t=e.detail)?void 0:t.fieldValues;s&&this.kendoForm&&Object.entries(s).forEach(([e,t])=>{this.kendoForm.onChange(e,{value:t})})},null==(e=this.$el)||e.addEventListener(s.KENDO_PASTE_EVENT_NAME,this._handlePasteEvent),this.$props.cols&&this._setupColsObserver()},beforeUnmount(){var e;this._resizeObserver&&this.$el&&(this._resizeObserver.unobserve(this.$el),this._resizeObserver.disconnect()),null==(e=this.$el)||e.removeEventListener(s.KENDO_PASTE_EVENT_NAME,this._handlePasteEvent)},watch:{cols(e){e?this._setupColsObserver():(this._resizeObserver&&this.$el&&(this._resizeObserver.unobserve(this.$el),this._resizeObserver.disconnect(),this._resizeObserver=null),this.columnClass="")}},computed:{formElementClassName(){const{size:e}=this.$props;return{"k-form":!0,[`k-form-${s.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-form-horizontal":!0===this.$props.horizontal}}},methods:{handleSubmit(e){this.kendoForm&&this.kendoForm.onSubmit(e)},_updateColumnClass(){const e="undefined"!=typeof window?window.innerWidth:0,t=this.$el?l(this.$el):e,s=a(this.$props.cols,t);this.columnClass=h(s);const i=p(this.$props.gutters,t);this.gapStyle=f(i,{rows:"0px",cols:"32px"})},_setupColsObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._updateColumnClass(),this.$el&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._updateColumnClass()),this._resizeObserver.observe(this.$el))}},render(){const e=s.getDefaultSlots(this);return t.createVNode("form",{class:this.formElementClassName,onSubmit:this.handleSubmit},[this.$props.cols?t.createVNode("div",{class:`k-form-layout k-d-grid ${this.columnClass}`,style:{gap:this.gapStyle||"0px 32px"}},[e]):e])}}),b={rows:"0px",cols:"16px"},y=t.defineComponent({name:"KendoFormFieldSet",props:{cols:[Number,Array],colSpan:[Number,Array],gutters:[String,Number,Object,Array],legend:String},data:()=>({columnClass:"",colSpanClass:"",gapStyle:""}),created(){s.validatePackage(o),this._resizeObserver=null,this._formElement=null},mounted(){var e;this._formElement=(null==(e=this.$el)?void 0:e.closest("form"))||null,(void 0!==this.$props.cols||void 0!==this.$props.colSpan)&&this._setupObserver()},beforeUnmount(){this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect())},watch:{cols(e){void 0!==e?this._setupObserver():(this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null),this.columnClass="",this.gapStyle="")},colSpan(e){void 0!==e?this._setupObserver():this.colSpanClass=""},gutters(){this._update()}},computed:{fieldsetClass(){return["k-form-fieldset",this.colSpanClass].filter(Boolean).join(" ")},divClass(){return["k-form-layout","k-d-grid",this.columnClass].filter(Boolean).join(" ")}},methods:{_update(){const e="undefined"!=typeof window?window.innerWidth:0,t=this._formElement?l(this._formElement):e;if(void 0!==this.$props.cols){const e=a(this.$props.cols,t);this.columnClass=h(e)}if(void 0!==this.$props.colSpan){const e=u(this.$props.colSpan,t);this.colSpanClass=m(e)}const s=void 0!==this.$props.cols?b:void 0,i=void 0!==this.$props.gutters?this.$props.gutters:s;if(void 0!==i){const e=p(i,t);this.gapStyle=f(e,b)}else this.gapStyle=""},_setupObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._update(),this._formElement&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._update()),this._resizeObserver.observe(this._formElement))}},render(){const e=s.getDefaultSlots(this),{legend:i}=this.$props;return t.createVNode("fieldset",{class:this.fieldsetClass},[i&&t.createVNode("legend",{class:"k-form-legend"},[i]),this.$props.cols?t.createVNode("div",{class:this.divClass,style:{gap:this.gapStyle||"0px 16px"}},[e]):e])}});e.Field=i,e.FieldArray=n,e.FieldWrapper=v,e.Form=r,e.FormElement=F,e.FormFieldSet=y});
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueForm={},e.Vue,e.KendoVueCommon)}(this,function(e,t,s){"use strict";const i=t.defineComponent({name:"KendoField",props:{component:[String,Number,Boolean,Object],validator:[Function,Array],name:String,colSpan:[Number,Array]},created(){return this.kendoForm?this.kendoForm.registerField(this.$props.name,this.$props.validator):void 0},inject:{kendoForm:{default:null}},emits:["change"],methods:{handleOnChange(e){const t=e&&(void 0!==e.value?e.value:e.target?e.target.value:e.target);this.kendoForm.onChange(this.$props.name,{value:t}),this.$emit("change",e)},onNativeComponentChange(e){this.kendoForm.onChange(this.$props.name,{value:e.target.value})},handleOnBlur(){this.kendoForm.onBlur(this.$props.name)},handleOnFocus(){this.kendoForm.onFocus(this.$props.name)}},render(){const e=s.getDefaultSlots(this),{name:i,component:o,id:r,colSpan:n}=this.$props;if(!this.kendoForm)return null;const l=this.kendoForm.values[i];if("string"==typeof o&&("input"===o||"textarea"===o))return t.h(o,{onBlur:this.handleOnBlur,onFocus:this.handleOnFocus,name:i,value:l||""});if(o){const d=s.templateRendering.call(this,o,s.getListeners.call(this));return s.getTemplate.call(this,{h:t.h,template:d,additionalProps:{value:l,validationMessage:this.kendoForm.errors[i],touched:this.kendoForm.touchedByField[i],modified:this.kendoForm.modifiedByField[i],visited:this.kendoForm.visitedByField[i],valid:!(this.kendoForm.errors[i]&&this.kendoForm.touchedByField[i]),name:i,id:r,...void 0!==n?{colSpan:n}:{},...this.$attrs},additionalListeners:{change:this.handleOnChange,input:this.handleOnChange,blur:this.handleOnBlur,focus:this.handleOnFocus},defaultSlots:e})}}}),o={name:"@progress/kendo-vue-form",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:0,version:"11.0.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"},r=t.defineComponent({name:"KendoForm",inheritAttrs:!1,props:{renderForm:[Object,Function],initialValues:Object,validator:Function,ignoreModified:Boolean,errors:Object,onChange:Function},emits:{submitclick:null,submit:null},created(){this._accumulatorTimeout=void 0,s.validatePackage(o),this.form.values=s.clone(this.$props.initialValues)},mounted(){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()},unmounted(){this.onDestroy()},data(){return{validatorsByField:{},fields:[],unmounted:!1,form:{id:this.id,errors:{},values:{},modifiedByField:{},touchedByField:{},visitedByField:{},valid:!1,modified:!1,touched:!1,visited:!1,submitted:!1,valueGetter:this.valueGetter,allowSubmit:!1,validate:this.validate,onChange:this.handleFieldChange,onSubmit:this.onSubmit,onFormReset:this.resetForm,registerField:this.onFieldRegister,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}}},provide(){return{kendoForm:this.$data.form}},watch:{"form.values"(){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()},"form.touchedByField"(e){this.form.touched=this.isFormTouched(e,this.fields),this.form.allowSubmit=this.allowSubmit()},"form.modifiedByField"(e){this.form.modified=this.isFormModified(e,this.fields),this.form.allowSubmit=this.allowSubmit()},"form.visitedByField"(e){this.form.visited=this.isFormVisited(e,this.fields)},errors(e){this.form.errors=this.getErrors(),this.form.allowSubmit=this.allowSubmit(),this.form.valid=this.isValid()}},methods:{isValid(){return this.isFormValid(this.form.errors)},formErrors(){if(this.$props.validator)return this.$props.validator(this.form.values,this.valueGetter)},getErrors(){const e={},t=this.validatorsByField;return Object.keys(this.fields).forEach(s=>{if(e[s]="",t[s]){const i=[];t[s].forEach(e=>{Array.isArray(e)?i.push(...e):i.push(e)}),i.find(t=>{if(t){const i=t(this.valueGetter(s),this.valueGetter,{name:s});if(i)return e[s]=i,!0}return!1})}}),this.formErrors()&&s.cloneObject(this.formErrors(),e),this.$props.errors&&s.cloneObject(this.$props.errors,e),e},accumulatedForceUpdate(){this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout),s.canUseDOM&&(this._accumulatorTimeout=window.setTimeout(()=>{this._accumulatorTimeout=void 0},0))},resetForm(){this.form.values=s.clone(this.$props.initialValues),this.id=s.guid(),this.form.touchedByField={},this.form.visitedByField={},this.form.modifiedByField={},this.form.submitted=!1},onReset(){this.resetForm()},addField(e){this.fields[e]=!0},validate(e){const t={},s=e||this.fields;Object.keys(s).forEach(e=>{t[e]=!0}),this.form.touchedByField={...t}},onSubmit(e){const t={},s=this.fields;e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation&&e.stopPropagation()),Object.keys(s).forEach(e=>{t[e]=!0}),this.form.visitedByField={...t},this.form.touchedByField={...t};const i=this.form.values,o=this.isValid(),r=this.isFormModified(this.form.modifiedByField,s);this.$emit("submitclick",{values:i,isValid:o,isModified:r,event:e}),o&&(this.$props.ignoreModified||r)&&(this.form.submitted=!0,this.$emit("submit",i,e))},handleFieldChange(e,t){const{value:s}=t;this.addField(e),this.form.modifiedByField[e]||(this.form.modifiedByField={...this.form.modifiedByField,[e]:!0}),this.valueSetter(e,s),this.$props.onChange&&this.$props.onChange(e,s,this.valueGetter)},onFocus(e){this.form.visitedByField[e]||(this.form.visitedByField={...this.form.visitedByField,[e]:!0})},onBlur(e){this.form.touchedByField[e]||(this.onFocus(e),this.form.touchedByField={...this.form.touchedByField,[e]:!0})},onFieldRegister(e,t){this.addField(e);const s=this.validatorsByField[e]||[],i=s.length;return this.validatorsByField={...this.validatorsByField,[e]:[...s,t]},this.accumulatedForceUpdate(),()=>{if(this._unmounted)return;const t=[...this.validatorsByField[e]||[]],s=!!t[i];t[i]=void 0,this.validatorsByField={...this.validatorsByField,[e]:t},s&&this.accumulatedForceUpdate()}},isFormValid:e=>!Object.keys(e).some(t=>!!e[t]),isFormModified:(e,t)=>Object.keys(t).some(t=>e[t]),isFormHasNotTouched:(e,t)=>Object.keys(t).some(t=>!e[t]),isFormTouched:(e,t)=>Object.keys(t).some(t=>e[t]),isFormVisited:(e,t)=>Object.keys(t).some(t=>e[t]),formHasNotTouched(){return this.isFormHasNotTouched(this.form.touchedByField,this.fields)},allowSubmit(){return this.formHasNotTouched()&&!this.isValid()||this.isValid()&&(this.$props.ignoreModified||this.isFormModified(this.form.modifiedByField,this.fields))},valueGetter(e){return this.form.values[e]},valueSetter(e,t){this.form.values={...this.form.values,[e]:t}},onArrayAction(e){this.addField(e),this.form.modifiedByField[e]||(this.form.modifiedByField={...this.form.modifiedByField,[e]:!0}),this.onBlur(e,!0)},onInsert(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,0,t.value),this.valueSetter(e,s)},onUnshift(e,t){this.onInsert(e,{value:t.value,index:0})},onPush(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[],t.value];this.valueSetter(e,s)},onPop(e){this.onArrayAction(e);const t=[...this.valueGetter(e)||[]],s=t.pop();return this.valueSetter(e,t),s},onRemove(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s.splice(t.index,1);return this.valueSetter(e,s),i},onReplace(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]];s.splice(t.index,1,t.value),this.valueSetter(e,s)},onMove(e,t){this.onArrayAction(e);const s=[...this.valueGetter(e)||[]],i=s[t.prevIndex];s.splice(t.prevIndex,1),s.splice(t.nextIndex,0,i),this.valueSetter(e,s)},onDestroy(){this.unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)}},render(){const e={onSubmit:this.onSubmit,onChange:this.handleFieldChange,onFormreset:this.resetForm,errors:this.form.errors,valid:this.form.valid,touched:this.form.touched,visited:this.form.visited,modified:this.form.modified,submitted:this.form.submitted,allowSubmit:this.form.allowSubmit,valueGetter:this.valueGetter};return this.$props.renderForm?this.$props.renderForm(e):s.getDefaultSlots(this)}}),n=t.defineComponent({name:"KendoFieldArray",props:{value:[String,Number,Boolean,Object,Array],component:[String,Number,Boolean,Object],validationMessage:String,touched:Boolean,modified:Boolean,validator:[Function,Array],visited:Boolean,valid:Boolean,name:String,id:String},created(){return this.kendoForm?this.kendoForm.registerField(this.$props.name,this.$props.validator):void 0},methods:{onUnshift(e){this.kendoForm.onUnshift(this.$props.name,e)},onPush(e){this.kendoForm.onPush(this.$props.name,e)},onInsert(e){this.kendoForm.onInsert(this.$props.name,e)},onPop(){this.kendoForm.onPop(this.$props.name)},onRemove(e){this.kendoForm.onRemove(this.$props.name,e)},onReplace(e){this.kendoForm.onReplace(this.$props.name,e)},onMove(e){this.kendoForm.onMove(this.$props.name,e)}},inject:{kendoForm:{default:null}},render(){const{name:e,component:i,id:o}=this.$props;if(!this.kendoForm)return null;const r=this.kendoForm.values[e];if(i){const n=s.templateRendering.call(this,i,s.getListeners.call(this));return s.getTemplate.call(this,{h:t.h,template:n,additionalProps:{value:r,validationMessage:this.kendoForm.errors[e],touched:this.kendoForm.touchedByField[e],modified:this.kendoForm.modifiedByField[e],visited:this.kendoForm.visitedByField[e],valid:!(this.kendoForm.errors[e]&&this.kendoForm.touchedByField[e]),name:e,id:o,...this.$attrs},additionalListeners:{unshift:this.onUnshift,push:this.onPush,insert:this.onInsert,pop:this.onPop,remove:this.onRemove,replace:this.onReplace,move:this.onMove}})}}});function l(e){let t=e.clientWidth;const s=getComputedStyle(e);return t-=(parseFloat(s.paddingLeft)||0)+(parseFloat(s.borderLeftWidth)||0),t-=(parseFloat(s.paddingRight)||0)+(parseFloat(s.borderRightWidth)||0),t}function d(e,t){var s,i;if(null==e||!e.length||null==t)return"";for(const[o,r]of e.entries()){const n=o>0&&void 0!==e[o-1].maxWidth?e[o-1].maxWidth:void 0,l=o<e.length-1&&void 0!==e[o+1].minWidth?e[o+1].minWidth:void 0,d=null!=(s=r.minWidth)?s:void 0!==n?n+1:0,a=null!=(i=r.maxWidth)?i:void 0!==l?l-1:1/0;if(t>=d&&t<=a)return r.value}return""}function a(e,t){if(!e)return null;if(Array.isArray(e)&&e.length>0){const s=d(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return"number"==typeof e?e:null}function h(e){return e&&e>0?`k-grid-cols-${e}`:""}function u(e,t){if(!e)return null;if("number"==typeof e)return e;if(Array.isArray(e)&&e.length>0){const s=d(e,t)||null;return"string"==typeof s?parseInt(s,10):s}return null}function m(e){return e?`k-col-span-${e}`:""}function c(e){if(null==e)return null;if("number"==typeof e)return`${e}px`;const t=e.trim(),s=parseInt(t,10);return!isNaN(s)&&Number.isFinite(s)?s.toString()===t?`${s}px`:e:null}function p(e,t){if(!e)return null;if("number"==typeof e)return{cols:e,rows:e};if("string"==typeof e){if(!e.includes(" "))return{cols:e,rows:e};const t=e.split(" ");return{cols:t[1],rows:t[0]}}if(Array.isArray(e)){const s=d(e,t)||null;return null!==s?{cols:s,rows:s}:null}if("object"==typeof e){const s=e,i={rows:null,cols:null};return void 0!==s.cols&&null!==s.cols&&("number"==typeof s.cols||"string"==typeof s.cols?i.cols=s.cols:Array.isArray(s.cols)&&(i.cols=d(s.cols,t)||null)),void 0!==s.rows&&("number"==typeof s.rows||"string"==typeof s.rows?i.rows=s.rows:Array.isArray(s.rows)&&(i.rows=d(s.rows,t)||null)),i}return null}function f(e,t){var s,i,o,r;const n=c(null!=(i=null!=(s=null==e?void 0:e.rows)?s:t.rows)?i:"0px"),l=c(null!=(r=null!=(o=null==e?void 0:e.cols)?o:t.cols)?r:"32px");return`${null!=n?n:"0px"} ${null!=l?l:"32px"}`}const v=t.defineComponent({name:"KendoFieldWrapper",props:{dir:String,horizontal:Boolean,colSpan:[Number,Array]},data:()=>({colSpanClass:""}),created(){s.validatePackage(o),this._resizeObserver=null,this._formElement=null},mounted(){var e;void 0!==this.$props.colSpan&&(this._formElement=(null==(e=this.$el)?void 0:e.closest("form"))||null,this._setupColSpanObserver())},beforeUnmount(){this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null)},watch:{colSpan(e){var t;void 0!==e?(this._formElement=(null==(t=this.$el)?void 0:t.closest("form"))||null,this._setupColSpanObserver()):(this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null),this.colSpanClass="")}},computed:{fieldClassName(){return{"k-form-field":!0,"k-rtl":"rtl"===this.$props.dir,...this.colSpanClass?{[this.colSpanClass]:!0}:{}}}},methods:{_updateColSpanClass(){const e="undefined"!=typeof window?window.innerWidth:0,t=this._formElement?l(this._formElement):e,s=u(this.$props.colSpan,t);this.colSpanClass=m(s)},_setupColSpanObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._updateColSpanClass(),this._formElement&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._updateColSpanClass()),this._resizeObserver.observe(this._formElement))}},render(){const e=s.getDefaultSlots(this);return t.createVNode("div",{class:this.fieldClassName},[e])}}),F=t.defineComponent({name:"KendoFormElement",props:{horizontal:Boolean,size:{type:String,default:"medium",validator:function(e){return[null,"small","medium","large"].includes(e)}},cols:[Number,Array],gutters:[String,Number,Object,Array]},data:()=>({columnClass:"",gapStyle:""}),created(){s.validatePackage(o),this._resizeObserver=null},inject:{kendoForm:{default:null}},mounted(){var e;this._handlePasteEvent=e=>{var t;const s=null==(t=e.detail)?void 0:t.fieldValues;s&&this.kendoForm&&Object.entries(s).forEach(([e,t])=>{this.kendoForm.onChange(e,{value:t})})},null==(e=this.$el)||e.addEventListener(s.KENDO_PASTE_EVENT_NAME,this._handlePasteEvent),this.$props.cols&&this._setupColsObserver()},beforeUnmount(){var e;this._resizeObserver&&this.$el&&(this._resizeObserver.unobserve(this.$el),this._resizeObserver.disconnect()),null==(e=this.$el)||e.removeEventListener(s.KENDO_PASTE_EVENT_NAME,this._handlePasteEvent)},watch:{cols(e){e?this._setupColsObserver():(this._resizeObserver&&this.$el&&(this._resizeObserver.unobserve(this.$el),this._resizeObserver.disconnect(),this._resizeObserver=null),this.columnClass="")}},computed:{formElementClassName(){const{size:e}=this.$props;return{"k-form":!0,[`k-form-${s.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-form-horizontal":!0===this.$props.horizontal}}},methods:{handleSubmit(e){this.kendoForm&&this.kendoForm.onSubmit(e)},_updateColumnClass(){const e="undefined"!=typeof window?window.innerWidth:0,t=this.$el?l(this.$el):e,s=a(this.$props.cols,t);this.columnClass=h(s);const i=p(this.$props.gutters,t);this.gapStyle=f(i,{rows:"0px",cols:"32px"})},_setupColsObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._updateColumnClass(),this.$el&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._updateColumnClass()),this._resizeObserver.observe(this.$el))}},render(){const e=s.getDefaultSlots(this);return t.createVNode("form",{class:this.formElementClassName,onSubmit:this.handleSubmit},[this.$props.cols?t.createVNode("div",{class:`k-form-layout k-d-grid ${this.columnClass}`,style:{gap:this.gapStyle||"0px 32px"}},[e]):e])}}),b={rows:"0px",cols:"16px"},y=t.defineComponent({name:"KendoFormFieldSet",props:{cols:[Number,Array],colSpan:[Number,Array],gutters:[String,Number,Object,Array],legend:String},data:()=>({columnClass:"",colSpanClass:"",gapStyle:""}),created(){s.validatePackage(o),this._resizeObserver=null,this._formElement=null},mounted(){var e;this._formElement=(null==(e=this.$el)?void 0:e.closest("form"))||null,(void 0!==this.$props.cols||void 0!==this.$props.colSpan)&&this._setupObserver()},beforeUnmount(){this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect())},watch:{cols(e){void 0!==e?this._setupObserver():(this._resizeObserver&&this._formElement&&(this._resizeObserver.unobserve(this._formElement),this._resizeObserver.disconnect(),this._resizeObserver=null),this.columnClass="",this.gapStyle="")},colSpan(e){void 0!==e?this._setupObserver():this.colSpanClass=""},gutters(){this._update()}},computed:{fieldsetClass(){return["k-form-fieldset",this.colSpanClass].filter(Boolean).join(" ")},divClass(){return["k-form-layout","k-d-grid",this.columnClass].filter(Boolean).join(" ")}},methods:{_update(){const e="undefined"!=typeof window?window.innerWidth:0,t=this._formElement?l(this._formElement):e;if(void 0!==this.$props.cols){const e=a(this.$props.cols,t);this.columnClass=h(e)}if(void 0!==this.$props.colSpan){const e=u(this.$props.colSpan,t);this.colSpanClass=m(e)}const s=void 0!==this.$props.cols?b:void 0,i=void 0!==this.$props.gutters?this.$props.gutters:s;if(void 0!==i){const e=p(i,t);this.gapStyle=f(e,b)}else this.gapStyle=""},_setupObserver(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._update(),this._formElement&&"undefined"!=typeof window&&"ResizeObserver"in window&&(this._resizeObserver=new ResizeObserver(()=>this._update()),this._resizeObserver.observe(this._formElement))}},render(){const e=s.getDefaultSlots(this),{legend:i}=this.$props;return t.createVNode("fieldset",{class:this.fieldsetClass},[i&&t.createVNode("legend",{class:"k-form-legend"},[i]),this.$props.cols?t.createVNode("div",{class:this.divClass,style:{gap:this.gapStyle||"0px 16px"}},[e]):e])}});e.Field=i,e.FieldArray=n,e.FieldWrapper=v,e.Form=r,e.FormElement=F,e.FormFieldSet=y});
|
|
@@ -7,20 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { FieldValidatorType } from './FieldValidator';
|
|
9
9
|
/**
|
|
10
|
-
* Represents the props of the FieldArray component that
|
|
10
|
+
* Represents the props of the FieldArray component that you use inside the Kendo UI for Vue Form component.
|
|
11
11
|
*/
|
|
12
12
|
export interface FieldArrayProps {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Sets the name of the field in the Form state.
|
|
15
15
|
*/
|
|
16
16
|
name: string;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
* [`FieldArrayRenderProps`](
|
|
18
|
+
* Sets the Vue component that the FieldArray renders.
|
|
19
|
+
* The component receives the [`FieldArrayRenderProps`](slug:api_form_fieldarrayprops).
|
|
20
20
|
*/
|
|
21
21
|
component: any;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Sets the validation functions for the FieldArray level.
|
|
24
24
|
* Currently, `validator` supports only synchronous functions.
|
|
25
25
|
*/
|
|
26
26
|
validator?: FieldValidatorType | FieldValidatorType[];
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export interface FieldArrayRenderProps {
|
|
12
12
|
/**
|
|
13
13
|
* Represents the current value of the FieldArray
|
|
14
|
-
* ([see example](
|
|
14
|
+
* ([see example](slug:custom_components_form#toc-using-basic-properties)).
|
|
15
15
|
*/
|
|
16
16
|
value: any;
|
|
17
17
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Represents the props that are passed from the Form component to the components nested inside it.
|
|
10
|
-
* To use the [KendoFrom Injected Property](
|
|
10
|
+
* To use the [KendoFrom Injected Property](slug:api_form_fieldinjectedprops) it should be
|
|
11
11
|
* [injected](https://v3.vuejs.org/guide/component-provide-inject.html) it in the component that defines the Form content using the below code.
|
|
12
12
|
*
|
|
13
13
|
* ```js-no-run
|
|
@@ -64,7 +64,7 @@ export interface FieldInjectedProps {
|
|
|
64
64
|
valid: boolean;
|
|
65
65
|
/**
|
|
66
66
|
* A callback for getting the value of a field without using the Field component
|
|
67
|
-
* ([see example](
|
|
67
|
+
* ([see example](slug:common_scenarios_form#toc-reading-the-field-state)).
|
|
68
68
|
* Useful for creating and modifying the UI based on the field values.
|
|
69
69
|
*/
|
|
70
70
|
valueGetter: (name: string) => any;
|
|
@@ -102,7 +102,7 @@ export interface FieldInjectedProps {
|
|
|
102
102
|
onBlur: () => void;
|
|
103
103
|
/**
|
|
104
104
|
* A callback you have to call when the value of the rendered component is changed
|
|
105
|
-
* ([see example](
|
|
105
|
+
* ([see example](slug:common_scenarios_form#toc-changing-the-field-value)).
|
|
106
106
|
* The `value` property of the event takes precedence over `target.value`.
|
|
107
107
|
*/
|
|
108
108
|
onChange: (fieldName: string, event: {
|
|
@@ -8,42 +8,46 @@
|
|
|
8
8
|
import { FieldValidatorType } from './FieldValidator';
|
|
9
9
|
import { ResponsiveFormBreakPoint } from './ResponsiveFormBreakPoint';
|
|
10
10
|
/**
|
|
11
|
-
* Represents the props of the Field component that
|
|
11
|
+
* Represents the props of the Field component that you use inside the Kendo UI for Vue Form component.
|
|
12
12
|
*/
|
|
13
13
|
export interface FieldProps {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Sets the name of the field in the Form state.
|
|
16
16
|
* Supports nested fields in the `user.age` and `users[index].name` formats.
|
|
17
17
|
*/
|
|
18
18
|
name: string;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Sets the `id` of the field. The Field passes it to the rendered component,
|
|
21
|
+
* so that a label can target the editor.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* This property is related to accessibility.
|
|
21
25
|
*/
|
|
22
26
|
id?: string;
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
25
|
-
* for example, `input`, `select`,
|
|
26
|
-
* The
|
|
27
|
-
* [`FieldRenderProps`](
|
|
28
|
+
* Sets the component that the Field renders. You can set it to a Vue component
|
|
29
|
+
* or to the name of an HTML element, for example, `input`, `select`, or `textarea`.
|
|
30
|
+
* The component receives the
|
|
31
|
+
* [`FieldRenderProps`](slug:api_form_fieldrenderprops).
|
|
28
32
|
*/
|
|
29
33
|
component: string | any;
|
|
30
34
|
/**
|
|
31
|
-
*
|
|
35
|
+
* Sets the validation functions for the Field level.
|
|
32
36
|
* Currently, `validator` supports only synchronous functions.
|
|
33
|
-
*
|
|
34
|
-
*
|
|
37
|
+
* When you pass an array, do not create it inline in the template, because an inline array
|
|
38
|
+
* can cause an infinite loop. Define the array once in your `<script setup>` block instead.
|
|
35
39
|
*/
|
|
36
40
|
validator?: FieldValidatorType | FieldValidatorType[];
|
|
37
41
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* >
|
|
41
|
-
*
|
|
42
|
+
* Fires when the editor of the Field changes its value and the Form updates its internal state.
|
|
43
|
+
* The event name is `change`. Use it to update related fields.
|
|
44
|
+
* > The Form listens to this editor event and keeps its internal state up to date on its own.
|
|
45
|
+
* Use this event only to run custom logic.
|
|
42
46
|
*/
|
|
43
47
|
onChange?: (event: any) => void;
|
|
44
48
|
/**
|
|
45
49
|
* Sets how many columns the field spans in the form layout.
|
|
46
|
-
*
|
|
50
|
+
* The parent FormElement must have the `cols` prop set.
|
|
47
51
|
* Accepts a number or an array of responsive breakpoints.
|
|
48
52
|
*
|
|
49
53
|
* @example
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export interface FieldRenderProps {
|
|
12
12
|
/**
|
|
13
13
|
* A callback you have to call when the value of the rendered component is changed
|
|
14
|
-
* ([see example](
|
|
14
|
+
* ([see example](slug:common_scenarios_form#toc-changing-the-field-value)).
|
|
15
15
|
* The `value` property of the event takes precedence over `target.value`.
|
|
16
16
|
*/
|
|
17
17
|
onChange?: (event: {
|
|
@@ -30,7 +30,7 @@ export interface FieldRenderProps {
|
|
|
30
30
|
onBlur?: () => void;
|
|
31
31
|
/**
|
|
32
32
|
* Represents the current value of the Field
|
|
33
|
-
* ([see example](
|
|
33
|
+
* ([see example](slug:custom_components_form#toc-using-basic-properties)).
|
|
34
34
|
*/
|
|
35
35
|
value: any;
|
|
36
36
|
/**
|
|
@@ -9,23 +9,23 @@ import { FormRenderProps } from './FormRenderProps';
|
|
|
9
9
|
import { FormValidatorType } from './FormValidator';
|
|
10
10
|
import { FormSubmitClickEvent } from './FormSubmitClickEvent';
|
|
11
11
|
/**
|
|
12
|
-
* Represents the props of the Kendo
|
|
12
|
+
* Represents the props of the [Kendo UI for Vue Form component](slug:overview_form).
|
|
13
13
|
*/
|
|
14
14
|
export interface FormProps {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Sets the initial field values of the Form.
|
|
17
17
|
*
|
|
18
|
-
* > When you initialize the Form fields, set initial values
|
|
19
|
-
* components might throw errors
|
|
18
|
+
* > When you initialize the Form fields, set initial values for them. Otherwise, some
|
|
19
|
+
* components might throw errors when they switch from uncontrolled to controlled mode.
|
|
20
20
|
*/
|
|
21
21
|
initialValues?: {
|
|
22
22
|
[name: string]: any;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Sets validation errors that override the field and form validators.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
* When both `validator` and `errors`
|
|
27
|
+
* Use this prop to pass errors directly as an object. The `validator` prop, in contrast, expects a callback.
|
|
28
|
+
* When both `validator` and `errors` set an error for the same field, the `errors` prop wins.
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
31
31
|
* ```vue
|
|
@@ -36,19 +36,19 @@ export interface FormProps {
|
|
|
36
36
|
[name: string]: string;
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* You can use the same field path to
|
|
43
|
-
* values object
|
|
39
|
+
* Sets the validation function for the Form level.
|
|
40
|
+
* The function returns key-value pairs. The key is the field path, and the value is the error message.
|
|
41
|
+
* The function supports nested fields, for example, `'users[0].name'`.
|
|
42
|
+
* You can use the same field path to get the value from the
|
|
43
|
+
* values object with the `getter` function from the `kendo-vue-common` package.
|
|
44
44
|
* Currently, `validator` supports only synchronous functions.
|
|
45
45
|
*/
|
|
46
46
|
validator?: FormValidatorType;
|
|
47
47
|
/**
|
|
48
|
-
* Fires each time
|
|
48
|
+
* Fires each time a field value changes.
|
|
49
49
|
*
|
|
50
|
-
* The third parameter `valueGetter
|
|
51
|
-
*
|
|
50
|
+
* The third parameter, `valueGetter`, lets you read other field values.
|
|
51
|
+
* Use it for cross-field validation or to clear related errors.
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```vue
|
|
@@ -57,25 +57,24 @@ export interface FormProps {
|
|
|
57
57
|
*/
|
|
58
58
|
onChange?: (fieldName: string, value: any, valueGetter: (name: string) => any) => void;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* the **Submit** button, and the form validation was successful.
|
|
60
|
+
* Fires when the user clicks the **Submit** button, at least one field is modified,
|
|
61
|
+
* and the form validation passes. The event name is `submit`.
|
|
63
62
|
*/
|
|
64
63
|
onSubmit?: (values: {
|
|
65
64
|
[name: string]: any;
|
|
66
65
|
}, event?: any) => void;
|
|
67
66
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* submit
|
|
67
|
+
* Fires each time the user clicks the **Submit** button. The event name is `submitclick`.
|
|
68
|
+
* Use it in advanced scenarios when you need to handle every
|
|
69
|
+
* submit, even when the form is not valid or not modified.
|
|
71
70
|
*/
|
|
72
71
|
onSubmitclick?: (event: FormSubmitClickEvent) => void;
|
|
73
72
|
/**
|
|
74
|
-
*
|
|
73
|
+
* Sets the content that the Form renders. It receives the `FormRenderProps`.
|
|
75
74
|
*/
|
|
76
75
|
renderForm?: (props: FormRenderProps) => any;
|
|
77
76
|
/**
|
|
78
|
-
*
|
|
77
|
+
* When set to `true`, lets the user submit the Form even when no field is modified.
|
|
79
78
|
*/
|
|
80
79
|
ignoreModified?: boolean;
|
|
81
80
|
}
|
|
@@ -7,76 +7,76 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { KeyValue } from './KeyValue';
|
|
9
9
|
/**
|
|
10
|
-
* Represents the props that
|
|
10
|
+
* Represents the props that the Form passes to its `renderForm` function.
|
|
11
11
|
*/
|
|
12
12
|
export interface FormRenderProps {
|
|
13
13
|
/**
|
|
14
|
-
* A callback
|
|
15
|
-
*
|
|
14
|
+
* A callback that submits the Form.
|
|
15
|
+
* You can bind it to the `click` event of the **Submit** button.
|
|
16
16
|
*/
|
|
17
17
|
onSubmit?: (event: any) => void;
|
|
18
18
|
/**
|
|
19
|
-
* A callback
|
|
20
|
-
* ([see example](
|
|
19
|
+
* A callback that changes the value of a specific field without the Field component
|
|
20
|
+
* ([see example](slug:common_scenarios_form#toc-changing-the-field-value)).
|
|
21
21
|
*
|
|
22
|
-
* > Use `onChange` only
|
|
22
|
+
* > Use `onChange` only when you cannot get the result you need through the Field component.
|
|
23
23
|
*/
|
|
24
24
|
onChange?: (name: string, options: {
|
|
25
25
|
value: any;
|
|
26
26
|
}) => void;
|
|
27
27
|
/**
|
|
28
|
-
* A callback
|
|
28
|
+
* A callback that resets the Form.
|
|
29
29
|
*/
|
|
30
30
|
onFormreset?: () => void;
|
|
31
31
|
/**
|
|
32
|
-
* The key-value
|
|
33
|
-
*
|
|
32
|
+
* The key-value pairs of the current errors by field path.
|
|
33
|
+
* They combine the errors from the field-level and form-level validators.
|
|
34
34
|
*/
|
|
35
35
|
errors: KeyValue<string>;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* Shows whether the Form is valid.
|
|
38
|
+
* When any field is not valid, `valid` is `false`.
|
|
39
39
|
*/
|
|
40
40
|
valid: boolean;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
42
|
+
* Shows whether the Form is touched.
|
|
43
|
+
* When any field is touched, `touched` is `true`.
|
|
44
|
+
* A field becomes touched when the Field component handles the `blur` event
|
|
45
|
+
* of its editor or when the user tries to submit the Form.
|
|
46
46
|
*/
|
|
47
47
|
touched: boolean;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
* Shows whether the Form is visited.
|
|
50
|
+
* When any field is visited, `visited` is `true`.
|
|
51
|
+
* A field becomes visited when the Field component handles the `focus` event
|
|
52
|
+
* of its editor or when the user tries to submit the Form.
|
|
53
53
|
*/
|
|
54
54
|
visited: boolean;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
56
|
+
* Shows whether the Form is modified.
|
|
57
|
+
* When any field is modified, `modified` is `true`.
|
|
58
|
+
* A field becomes modified the first time the Field component handles
|
|
59
|
+
* the `change` event of its editor.
|
|
60
60
|
*/
|
|
61
61
|
modified: boolean;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* Shows whether the Form is successfully submitted.
|
|
64
|
+
* Use it to detect when the user leaves the Form before saving the changes.
|
|
65
65
|
*/
|
|
66
66
|
submitted: boolean;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* * If `allowSubmit` is
|
|
70
|
-
* * If `allowSubmit` is
|
|
71
|
-
* `touched` and `visited` state to true
|
|
68
|
+
* Shows whether the Form is ready for submission.
|
|
69
|
+
* * If `allowSubmit` is `true` and the Form is valid, the user can submit the Form.
|
|
70
|
+
* * If `allowSubmit` is `true` and the Form is not valid, a submit sets the
|
|
71
|
+
* `touched` and `visited` state of all fields to `true`.
|
|
72
72
|
*
|
|
73
|
-
*
|
|
73
|
+
* Use it to toggle the disabled state of the **Submit** button.
|
|
74
74
|
*/
|
|
75
75
|
allowSubmit: boolean;
|
|
76
76
|
/**
|
|
77
|
-
* A callback
|
|
78
|
-
* ([see example](
|
|
79
|
-
*
|
|
77
|
+
* A callback that returns the value of a field without the Field component
|
|
78
|
+
* ([see example](slug:common_scenarios_form#toc-reading-the-field-state)).
|
|
79
|
+
* Use it to build or change the UI based on the field values.
|
|
80
80
|
*/
|
|
81
81
|
valueGetter: (name: string) => any;
|
|
82
82
|
}
|
package/package-metadata.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-form",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-vue-form",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate: 1794913633,version:"11.0.1-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -10,8 +10,8 @@ const e = {
|
|
|
10
10
|
productName: "Kendo UI for Vue",
|
|
11
11
|
productCode: "KENDOUIVUE",
|
|
12
12
|
productCodes: ["KENDOUIVUE"],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: "11.0.
|
|
13
|
+
publishDate: 1794913633,
|
|
14
|
+
version: "11.0.1-develop.1",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
16
16
|
};
|
|
17
17
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-form",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1-develop.1",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@progress/kendo-licensing": "^1.13.
|
|
28
|
-
"@progress/kendo-vue-common": "11.0.
|
|
27
|
+
"@progress/kendo-licensing": "^1.13.1",
|
|
28
|
+
"@progress/kendo-vue-common": "11.0.1-develop.1",
|
|
29
29
|
"vue": "^3.0.2"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"package": {
|
|
46
46
|
"productName": "Kendo UI for Vue",
|
|
47
47
|
"productCode": "KENDOUIVUE",
|
|
48
|
-
"publishDate":
|
|
48
|
+
"publishDate": 1794913633,
|
|
49
49
|
"licensingDocsUrl": "https://www.telerik.com/kendo-vue-ui/my-license/"
|
|
50
50
|
}
|
|
51
51
|
},
|