@progress/kendo-vue-form 3.5.0 → 3.5.1-dev.202208100944

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.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/cdn/js/kendo-vue-form.js +1 -1
  3. package/dist/es/Form.js +14 -18
  4. package/dist/es/FormContext.js +1 -0
  5. package/dist/es/interfaces/FieldArrayProps.js +1 -0
  6. package/dist/es/interfaces/FieldArrayRenderProps.js +1 -0
  7. package/dist/es/interfaces/FieldProps.js +1 -0
  8. package/dist/es/interfaces/FieldRenderProps.js +1 -0
  9. package/dist/es/interfaces/FieldValidator.js +1 -0
  10. package/dist/es/interfaces/FormInjectedProps.js +1 -0
  11. package/dist/es/interfaces/FormProps.js +1 -0
  12. package/dist/es/interfaces/FormRenderProps.js +1 -0
  13. package/dist/es/interfaces/FormSubmitClickEvent.js +1 -0
  14. package/dist/es/interfaces/FormValidator.js +1 -0
  15. package/dist/es/interfaces/KeyValue.js +1 -0
  16. package/dist/es/package-metadata.js +1 -1
  17. package/dist/esm/Field.d.ts +44 -0
  18. package/dist/esm/Field.js +177 -0
  19. package/dist/esm/FieldArray.d.ts +50 -0
  20. package/dist/esm/FieldArray.js +138 -0
  21. package/dist/esm/FieldWrapper.d.ts +61 -0
  22. package/dist/esm/FieldWrapper.js +48 -0
  23. package/dist/esm/Form.d.ts +62 -0
  24. package/dist/esm/Form.js +467 -0
  25. package/dist/esm/FormContext.d.ts +45 -0
  26. package/dist/esm/FormContext.js +1 -0
  27. package/dist/esm/FormElement.d.ts +63 -0
  28. package/dist/esm/FormElement.js +64 -0
  29. package/dist/esm/additionalTypes.ts +21 -0
  30. package/dist/esm/interfaces/FieldArrayProps.d.ts +24 -0
  31. package/dist/esm/interfaces/FieldArrayProps.js +1 -0
  32. package/dist/esm/interfaces/FieldArrayRenderProps.d.ts +85 -0
  33. package/dist/esm/interfaces/FieldArrayRenderProps.js +1 -0
  34. package/dist/esm/interfaces/FieldProps.d.ts +36 -0
  35. package/dist/esm/interfaces/FieldProps.js +1 -0
  36. package/dist/esm/interfaces/FieldRenderProps.d.ts +61 -0
  37. package/dist/esm/interfaces/FieldRenderProps.js +1 -0
  38. package/dist/esm/interfaces/FieldValidator.d.ts +14 -0
  39. package/dist/esm/interfaces/FieldValidator.js +1 -0
  40. package/dist/esm/interfaces/FormInjectedProps.d.ts +149 -0
  41. package/dist/esm/interfaces/FormInjectedProps.js +1 -0
  42. package/dist/esm/interfaces/FormProps.d.ts +48 -0
  43. package/dist/esm/interfaces/FormProps.js +1 -0
  44. package/dist/esm/interfaces/FormRenderProps.d.ts +75 -0
  45. package/dist/esm/interfaces/FormRenderProps.js +1 -0
  46. package/dist/esm/interfaces/FormSubmitClickEvent.d.ts +23 -0
  47. package/dist/esm/interfaces/FormSubmitClickEvent.js +1 -0
  48. package/dist/esm/interfaces/FormValidator.d.ts +11 -0
  49. package/dist/esm/interfaces/FormValidator.js +1 -0
  50. package/dist/esm/interfaces/KeyValue.d.ts +6 -0
  51. package/dist/esm/interfaces/KeyValue.js +1 -0
  52. package/dist/esm/main.d.ts +16 -0
  53. package/dist/esm/main.js +6 -0
  54. package/dist/esm/package-metadata.d.ts +5 -0
  55. package/dist/esm/package-metadata.js +11 -0
  56. package/dist/esm/package.json +3 -0
  57. package/dist/npm/Field.js +1 -1
  58. package/dist/npm/FieldWrapper.js +2 -2
  59. package/dist/npm/Form.js +20 -24
  60. package/dist/npm/FormElement.js +2 -2
  61. package/dist/npm/package-metadata.js +1 -1
  62. package/package.json +12 -12
@@ -0,0 +1,467 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
25
+ };
26
+
27
+ import { clone, cloneObject, guid, validatePackage } from '@progress/kendo-vue-common';
28
+ import { packageMetadata } from './package-metadata.js'; // @ts-ignore
29
+
30
+ import * as Vue from 'vue';
31
+ var allVue = Vue;
32
+ var gh = allVue.h;
33
+ var isV3 = allVue.version && allVue.version[0] === '3';
34
+ import { getDefaultSlots } from '@progress/kendo-vue-common';
35
+ /**
36
+ * @hidden
37
+ */
38
+
39
+ var FORCEUPDATE_ACCUMULATOR_TIMEOUT = 0;
40
+ /**
41
+ * @hidden
42
+ */
43
+
44
+ var FormVue2 = {
45
+ name: 'KendoForm',
46
+ inheritAttrs: false,
47
+ props: {
48
+ renderForm: [Object, Function],
49
+ initialValues: Object,
50
+ validator: Function,
51
+ ignoreModified: Boolean
52
+ },
53
+ // @ts-ignore
54
+ emits: {
55
+ submitclick: null,
56
+ submit: null
57
+ },
58
+ created: function created() {
59
+ this._accumulatorTimeout = undefined;
60
+ validatePackage(packageMetadata);
61
+ this.form.values = clone(this.$props.initialValues);
62
+ },
63
+ mounted: function mounted() {
64
+ this.form.errors = this.getErrors();
65
+ this.form.allowSubmit = this.allowSubmit();
66
+ this.form.valid = this.isValid();
67
+ },
68
+ destroyed: !!isV3 ? undefined : function () {
69
+ this.onDestroy();
70
+ },
71
+ // @ts-ignore
72
+ unmounted: function unmounted() {
73
+ this.onDestroy();
74
+ },
75
+ data: function data() {
76
+ return {
77
+ validatorsByField: {},
78
+ fields: [],
79
+ unmounted: false,
80
+ form: {
81
+ id: this.id,
82
+ errors: {},
83
+ values: {},
84
+ modifiedByField: {},
85
+ touchedByField: {},
86
+ visitedByField: {},
87
+ valid: false,
88
+ modified: false,
89
+ touched: false,
90
+ visited: false,
91
+ submitted: false,
92
+ valueGetter: this.valueGetter,
93
+ allowSubmit: false,
94
+ onChange: this.onChange,
95
+ onSubmit: this.onSubmit,
96
+ onFormReset: this.resetForm,
97
+ registerField: this.onFieldRegister,
98
+ onFocus: this.onFocus,
99
+ onBlur: this.onBlur,
100
+ onUnshift: this.onUnshift,
101
+ onPush: this.onPush,
102
+ onInsert: this.onInsert,
103
+ onPop: this.onPop,
104
+ onRemove: this.onRemove,
105
+ onReplace: this.onReplace,
106
+ onMove: this.onMove
107
+ }
108
+ };
109
+ },
110
+ provide: function provide() {
111
+ return {
112
+ kendoForm: this.$data.form
113
+ };
114
+ },
115
+ watch: {
116
+ 'form.values': function formValues() {
117
+ this.form.errors = this.getErrors();
118
+ this.form.allowSubmit = this.allowSubmit();
119
+ this.form.valid = this.isValid();
120
+ },
121
+ 'form.touchedByField': function formTouchedByField(newValue) {
122
+ this.form.touched = this.isFormTouched(newValue, this.fields);
123
+ this.form.allowSubmit = this.allowSubmit();
124
+ },
125
+ 'form.modifiedByField': function formModifiedByField(newValue) {
126
+ this.form.modified = this.isFormModified(newValue, this.fields);
127
+ this.form.allowSubmit = this.allowSubmit();
128
+ },
129
+ 'form.visitedByField': function formVisitedByField(newValue) {
130
+ this.form.visited = this.isFormVisited(newValue, this.fields);
131
+ }
132
+ },
133
+ methods: {
134
+ isValid: function isValid() {
135
+ return this.isFormValid(this.form.errors);
136
+ },
137
+ formErrors: function formErrors() {
138
+ if (this.$props.validator) {
139
+ return this.$props.validator(this.form.values, this.valueGetter);
140
+ }
141
+ },
142
+ getErrors: function getErrors() {
143
+ var _this = this;
144
+
145
+ var errors = {};
146
+ var validatorsByField = this.validatorsByField;
147
+ Object.keys(this.fields).forEach(function (fieldName) {
148
+ errors[fieldName] = '';
149
+
150
+ if (validatorsByField[fieldName]) {
151
+ var validators_1 = [];
152
+ validatorsByField[fieldName].forEach(function (validator) {
153
+ if (Array.isArray(validator)) {
154
+ validators_1.push.apply(validators_1, validator);
155
+ } else {
156
+ validators_1.push(validator);
157
+ }
158
+ }); // find first validation error
159
+
160
+ validators_1.find(function (validator) {
161
+ if (validator) {
162
+ var result = validator(_this.valueGetter(fieldName), _this.valueGetter, {
163
+ name: fieldName
164
+ });
165
+
166
+ if (result) {
167
+ errors[fieldName] = result;
168
+ return true;
169
+ }
170
+ }
171
+
172
+ return false;
173
+ });
174
+ }
175
+ });
176
+ var formErrors = this.formErrors();
177
+
178
+ if (formErrors) {
179
+ cloneObject(this.formErrors(), errors);
180
+ }
181
+
182
+ return errors;
183
+ },
184
+
185
+ /**
186
+ * @hidden
187
+ */
188
+ accumulatedForceUpdate: function accumulatedForceUpdate() {
189
+ var _this = this; // IMPORTANT:
190
+ // Should only be used for updates not coming from editors as it
191
+ // will cause cursor jump as vue will reset the editor to old value
192
+
193
+
194
+ if (this._accumulatorTimeout) {
195
+ clearTimeout(this._accumulatorTimeout);
196
+ }
197
+
198
+ this._accumulatorTimeout = window.setTimeout(function () {
199
+ _this._accumulatorTimeout = undefined;
200
+ }, FORCEUPDATE_ACCUMULATOR_TIMEOUT);
201
+ },
202
+
203
+ /**
204
+ * @hidden
205
+ */
206
+ resetForm: function resetForm() {
207
+ this.form.values = clone(this.$props.initialValues);
208
+ this.id = guid();
209
+ this.form.touchedByField = {};
210
+ this.form.visitedByField = {};
211
+ this.form.modifiedByField = {}; // this.validatorsByField = {};
212
+ // this.fields = [];
213
+
214
+ this.form.submitted = false;
215
+ },
216
+
217
+ /**
218
+ * Method for resetting the form state outside the form component.
219
+ *
220
+ * > Use `onReset` only if you cannot achieve the desired behavior
221
+ * through the Field component or by FormRenderProps.
222
+ */
223
+ onReset: function onReset() {
224
+ this.resetForm();
225
+ },
226
+ addField: function addField(field) {
227
+ this.fields[field] = true;
228
+ },
229
+ onSubmit: function onSubmit(event) {
230
+ var touchedVisited = {};
231
+ var fields = this.fields;
232
+
233
+ if (event) {
234
+ if (typeof event.preventDefault === 'function') {
235
+ event.preventDefault();
236
+ }
237
+
238
+ if (typeof event.stopPropagation === 'function') {
239
+ event.stopPropagation();
240
+ }
241
+ }
242
+
243
+ Object.keys(fields).forEach(function (fieldName) {
244
+ touchedVisited[fieldName] = true;
245
+ }); // show validations
246
+
247
+ this.form.visitedByField = __assign({}, touchedVisited);
248
+ this.form.touchedByField = __assign({}, touchedVisited);
249
+ var values = this.form.values;
250
+ var isValid = this.isValid();
251
+ var isModified = this.isFormModified(this.form.modifiedByField, fields);
252
+ this.$emit('submitclick', {
253
+ values: values,
254
+ isValid: isValid,
255
+ isModified: isModified,
256
+ event: event
257
+ });
258
+
259
+ if (isValid && (this.$props.ignoreModified || isModified)) {
260
+ this.form.submitted = true;
261
+ this.$emit('submit', values, event);
262
+ }
263
+ },
264
+
265
+ /**
266
+ * Method for emitting changes to a specific field outside the form component.
267
+ *
268
+ * > Use `onChange` only if you cannot achieve the desired behavior
269
+ * through the Field component by FormRenderProps.
270
+ */
271
+ onChange: function onChange(name, options) {
272
+ var _a;
273
+
274
+ var value = options.value;
275
+ this.addField(name);
276
+
277
+ if (!this.form.modifiedByField[name]) {
278
+ this.form.modifiedByField = __assign(__assign({}, this.form.modifiedByField), (_a = {}, _a[name] = true, _a));
279
+ }
280
+
281
+ this.valueSetter(name, value);
282
+ },
283
+ onFocus: function onFocus(name) {
284
+ var _a;
285
+
286
+ if (this.form.visitedByField[name]) {
287
+ return;
288
+ }
289
+
290
+ this.form.visitedByField = __assign(__assign({}, this.form.visitedByField), (_a = {}, _a[name] = true, _a));
291
+ },
292
+ onBlur: function onBlur(name) {
293
+ var _a;
294
+
295
+ if (this.form.touchedByField[name]) {
296
+ return;
297
+ }
298
+
299
+ this.onFocus(name);
300
+ this.form.touchedByField = __assign(__assign({}, this.form.touchedByField), (_a = {}, _a[name] = true, _a));
301
+ },
302
+ onFieldRegister: function onFieldRegister(name, validator) {
303
+ var _a;
304
+
305
+ var _this = this;
306
+
307
+ this.addField(name); // The sole reason for using class props over state - nextIndex, needed for destroying validators
308
+
309
+ var oldValidators = this.validatorsByField[name] || [];
310
+ var nextIndex = oldValidators.length;
311
+ this.validatorsByField = __assign(__assign({}, this.validatorsByField), (_a = {}, _a[name] = __spreadArray(__spreadArray([], oldValidators, true), [validator], false), _a));
312
+ this.accumulatedForceUpdate();
313
+ return function () {
314
+ var _a; // onFieldUnregister:
315
+
316
+
317
+ if (_this._unmounted) {
318
+ return;
319
+ }
320
+
321
+ var newValidators = __spreadArray([], _this.validatorsByField[name] || [], true);
322
+
323
+ var validatorIsUnregistered = Boolean(newValidators[nextIndex]);
324
+ newValidators[nextIndex] = undefined;
325
+ _this.validatorsByField = __assign(__assign({}, _this.validatorsByField), (_a = {}, _a[name] = newValidators, _a));
326
+
327
+ if (validatorIsUnregistered) {
328
+ _this.accumulatedForceUpdate();
329
+ }
330
+ };
331
+ },
332
+ isFormValid: function isFormValid(errors) {
333
+ return !Object.keys(errors).some(function (fieldName) {
334
+ return Boolean(errors[fieldName]);
335
+ });
336
+ },
337
+ isFormModified: function isFormModified(modified, fields) {
338
+ return Object.keys(fields).some(function (fieldName) {
339
+ return modified[fieldName];
340
+ });
341
+ },
342
+ isFormHasNotTouched: function isFormHasNotTouched(touched, fields) {
343
+ return Object.keys(fields).some(function (fieldName) {
344
+ return !touched[fieldName];
345
+ });
346
+ },
347
+ isFormTouched: function isFormTouched(touched, fields) {
348
+ return Object.keys(fields).some(function (fieldName) {
349
+ return touched[fieldName];
350
+ });
351
+ },
352
+ isFormVisited: function isFormVisited(visited, fields) {
353
+ return Object.keys(fields).some(function (fieldName) {
354
+ return visited[fieldName];
355
+ });
356
+ },
357
+ formHasNotTouched: function formHasNotTouched() {
358
+ return this.isFormHasNotTouched(this.form.touchedByField, this.fields);
359
+ },
360
+ // 1. The form is not touched, but has errors - allow submit to force validation.
361
+ // 2. The form is valid and modified - if not modified, disable submit.
362
+ allowSubmit: function allowSubmit() {
363
+ return this.formHasNotTouched() && !this.isValid() || this.isValid() && (this.$props.ignoreModified || this.isFormModified(this.form.modifiedByField, this.fields));
364
+ },
365
+ valueGetter: function valueGetter(fieldName) {
366
+ return this.form.values[fieldName];
367
+ },
368
+ valueSetter: function valueSetter(fieldName, value) {
369
+ var _a;
370
+
371
+ this.form.values = __assign(__assign({}, this.form.values), (_a = {}, _a[fieldName] = value, _a));
372
+ },
373
+ onArrayAction: function onArrayAction(name) {
374
+ var _a;
375
+
376
+ this.addField(name);
377
+
378
+ if (!this.form.modifiedByField[name]) {
379
+ this.form.modifiedByField = __assign(__assign({}, this.form.modifiedByField), (_a = {}, _a[name] = true, _a));
380
+ }
381
+
382
+ this.onBlur(name, true);
383
+ },
384
+ onInsert: function onInsert(name, options) {
385
+ this.onArrayAction(name);
386
+
387
+ var newArray = __spreadArray([], this.valueGetter(name) || [], true);
388
+
389
+ newArray.splice(options.index, 0, options.value);
390
+ this.valueSetter(name, newArray);
391
+ },
392
+ onUnshift: function onUnshift(name, options) {
393
+ this.onInsert(name, {
394
+ value: options.value,
395
+ index: 0
396
+ });
397
+ },
398
+ onPush: function onPush(name, options) {
399
+ this.onArrayAction(name);
400
+
401
+ var newArray = __spreadArray(__spreadArray([], this.valueGetter(name) || [], true), [options.value], false);
402
+
403
+ this.valueSetter(name, newArray);
404
+ },
405
+ onPop: function onPop(name) {
406
+ this.onArrayAction(name);
407
+
408
+ var newArray = __spreadArray([], this.valueGetter(name) || [], true);
409
+
410
+ var value = newArray.pop();
411
+ this.valueSetter(name, newArray);
412
+ return value;
413
+ },
414
+ onRemove: function onRemove(name, options) {
415
+ this.onArrayAction(name);
416
+
417
+ var newArray = __spreadArray([], this.valueGetter(name) || [], true);
418
+
419
+ var value = newArray.splice(options.index, 1);
420
+ this.valueSetter(name, newArray);
421
+ return value;
422
+ },
423
+ onReplace: function onReplace(name, options) {
424
+ this.onArrayAction(name);
425
+
426
+ var newArray = __spreadArray([], this.valueGetter(name) || [], true);
427
+
428
+ newArray.splice(options.index, 1, options.value);
429
+ this.valueSetter(name, newArray);
430
+ },
431
+ onMove: function onMove(name, options) {
432
+ this.onArrayAction(name);
433
+
434
+ var newArray = __spreadArray([], this.valueGetter(name) || [], true);
435
+
436
+ var value = newArray[options.prevIndex];
437
+ newArray.splice(options.prevIndex, 1);
438
+ newArray.splice(options.nextIndex, 0, value);
439
+ this.valueSetter(name, newArray);
440
+ },
441
+ onDestroy: function onDestroy() {
442
+ this.unmounted = true;
443
+
444
+ if (this._accumulatorTimeout) {
445
+ clearTimeout(this._accumulatorTimeout);
446
+ }
447
+ }
448
+ },
449
+ // @ts-ignore
450
+ setup: !isV3 ? undefined : function () {
451
+ var v3 = !!isV3;
452
+ return {
453
+ v3: v3
454
+ };
455
+ },
456
+ render: function render(createElement) {
457
+ var h = gh || createElement;
458
+ var defaultSlots = getDefaultSlots(this);
459
+ return defaultSlots;
460
+ }
461
+ };
462
+ /**
463
+ * @hidden
464
+ */
465
+
466
+ var Form = FormVue2;
467
+ export { Form, FormVue2 };
@@ -0,0 +1,45 @@
1
+ import { FieldValidatorType } from './interfaces/FieldValidator';
2
+ /** @hidden */
3
+ export declare type FormContextType = {
4
+ onSubmit: (event: any) => void;
5
+ onChange: (name: string, options: {
6
+ value: any;
7
+ }) => void;
8
+ onFocus: (name: string) => void;
9
+ onBlur: (name: string) => void;
10
+ onUnshift: (name: string, options: {}) => void;
11
+ onPush: (name: string, options: {
12
+ value: any;
13
+ }) => void;
14
+ onInsert: (name: string, options: {
15
+ index: number;
16
+ value: any;
17
+ }) => void;
18
+ onPop: (name: string) => any;
19
+ onRemove: (name: string, options: {
20
+ index: number;
21
+ }) => any;
22
+ onReplace: (name: string, options: {
23
+ index: number;
24
+ value: any;
25
+ }) => void;
26
+ onMove: (name: string, options: {
27
+ prevIndex: number;
28
+ nextIndex: number;
29
+ }) => void;
30
+ registerField: (name: string, validator: FieldValidatorType | FieldValidatorType[] | undefined) => void;
31
+ valueGetter: (name: string) => any;
32
+ errors: {
33
+ [name: string]: string;
34
+ };
35
+ touched: {
36
+ [name: string]: boolean;
37
+ };
38
+ visited: {
39
+ [name: string]: boolean;
40
+ };
41
+ modified: {
42
+ [name: string]: boolean;
43
+ };
44
+ id: string;
45
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
2
+ declare type DefaultData<V> = object | ((this: V) => {});
3
+ declare type DefaultMethods<V> = {
4
+ [key: string]: (this: V, ...args: any[]) => any;
5
+ };
6
+ import { FormContextType } from './FormContext';
7
+ /**
8
+ * Represents the props of the Kendo U for Vue FormElement component.
9
+ */
10
+ export interface FormElementProps {
11
+ /**
12
+ * If set to `true` enable the horizontal layout of the form editors.
13
+ */
14
+ horizontal?: boolean;
15
+ /**
16
+ * @hidden
17
+ */
18
+ [customProp: string]: any;
19
+ }
20
+ /**
21
+ * Represent the `ref` of the FormElement component.
22
+ */
23
+ export interface FormElementHandle {
24
+ props: FormElementProps;
25
+ element: HTMLFormElement | null;
26
+ }
27
+ /**
28
+ * @hidden
29
+ */
30
+ interface FormElementState {
31
+ }
32
+ /**
33
+ * @hidden
34
+ */
35
+ interface FormElementData {
36
+ }
37
+ /**
38
+ * @hidden
39
+ */
40
+ export interface FormElementMethods {
41
+ [key: string]: any;
42
+ }
43
+ /**
44
+ * @hidden
45
+ */
46
+ export interface FormElementComputed {
47
+ [key: string]: any;
48
+ formElementClassName: object;
49
+ }
50
+ /**
51
+ * @hidden
52
+ */
53
+ export interface FormElementAll extends FormElementMethods, FormElementState, FormElementData, FormElementComputed, FormContextType, Vue2type {
54
+ }
55
+ /**
56
+ * @hidden
57
+ */
58
+ declare const FormElementVue2: ComponentOptions<Vue2type, DefaultData<FormElementData>, DefaultMethods<FormElementAll>, FormElementComputed, RecordPropsDefinition<FormElementProps>>;
59
+ /**
60
+ * @hidden
61
+ */
62
+ declare let FormElement: DefineComponent<FormElementProps, any, FormElementData, FormElementComputed, FormElementMethods, {}, {}, {}, string, FormElementProps, FormElementProps, {}>;
63
+ export { FormElement, FormElementVue2 };
@@ -0,0 +1,64 @@
1
+ // @ts-ignore
2
+ import * as Vue from 'vue';
3
+ var allVue = Vue;
4
+ var gh = allVue.h;
5
+ var isV3 = allVue.version && allVue.version[0] === '3';
6
+ import { packageMetadata } from './package-metadata.js';
7
+ import { getDefaultSlots, validatePackage } from '@progress/kendo-vue-common';
8
+ /**
9
+ * @hidden
10
+ */
11
+
12
+ var FormElementVue2 = {
13
+ name: 'KendoFormElement',
14
+ props: {
15
+ horizontal: Boolean
16
+ },
17
+ created: function created() {
18
+ validatePackage(packageMetadata);
19
+ },
20
+ inject: {
21
+ kendoForm: {
22
+ default: null
23
+ }
24
+ },
25
+ computed: {
26
+ formElementClassName: function formElementClassName() {
27
+ return {
28
+ 'k-form': true,
29
+ 'k-form-horizontal': this.$props.horizontal === true
30
+ };
31
+ }
32
+ },
33
+ methods: {
34
+ handleSubmit: function handleSubmit(e) {
35
+ if (this.kendoForm) {
36
+ this.kendoForm.onSubmit(e);
37
+ }
38
+ }
39
+ },
40
+ // @ts-ignore
41
+ setup: !isV3 ? undefined : function () {
42
+ var v3 = !!isV3;
43
+ return {
44
+ v3: v3
45
+ };
46
+ },
47
+ render: function render(createElement) {
48
+ var h = gh || createElement;
49
+ var defaultSlots = getDefaultSlots(this);
50
+ return h("form", {
51
+ "class": this.formElementClassName,
52
+ onSubmit: this.handleSubmit,
53
+ on: this.v3 ? undefined : {
54
+ "submit": this.handleSubmit
55
+ }
56
+ }, [defaultSlots]);
57
+ }
58
+ };
59
+ /**
60
+ * @hidden
61
+ */
62
+
63
+ var FormElement = FormElementVue2;
64
+ export { FormElement, FormElementVue2 };
@@ -0,0 +1,21 @@
1
+ // @ts-ignore
2
+ import { DefineComponent } from 'vue';
3
+ // @ts-ignore
4
+ import * as Vue from 'vue';
5
+
6
+ /**
7
+ * @hidden
8
+ */
9
+ // @ts-ignore
10
+ type Vue2type = Vue.default;
11
+
12
+ /**
13
+ * @hidden
14
+ */
15
+ // @ts-ignore
16
+ import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
17
+ /**
18
+ * @hidden
19
+ */
20
+ // @ts-ignore
21
+ export { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type };
@@ -0,0 +1,24 @@
1
+ import { FieldValidatorType } from './FieldValidator';
2
+ /**
3
+ * Represents the props of the FieldArray component that is used inside the Kendo U for Vue Form component.
4
+ */
5
+ export interface FieldArrayProps {
6
+ /**
7
+ * The name of the field in the Form state.
8
+ */
9
+ name: string;
10
+ /**
11
+ * Can be set to a Vue component.
12
+ * [`FieldArrayRenderProps`]({% slug api_form_fieldarrayprops %}).
13
+ */
14
+ component: any;
15
+ /**
16
+ * The validation functions for the FieldArray level.
17
+ * Currently, `validator` supports only synchronous functions.
18
+ */
19
+ validator?: FieldValidatorType | FieldValidatorType[];
20
+ /**
21
+ * @hidden
22
+ */
23
+ [customProp: string]: any;
24
+ }
@@ -0,0 +1 @@
1
+ export {};