@progress/kendo-react-form 6.1.1 → 7.0.0-develop.2

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 (85) hide show
  1. package/{dist/es/Field.d.ts → Field.d.ts} +4 -0
  2. package/FieldArray.d.ts +11 -0
  3. package/{dist/es/FieldWrapper.d.ts → FieldWrapper.d.ts} +4 -0
  4. package/{dist/es/Form.d.ts → Form.d.ts} +5 -1
  5. package/{dist/es/FormContext.d.ts → FormContext.d.ts} +5 -1
  6. package/{dist/es/FormElement.d.ts → FormElement.d.ts} +4 -0
  7. package/LICENSE.md +1 -1
  8. package/dist/cdn/js/kendo-react-form.js +5 -1
  9. package/index.d.ts +20 -0
  10. package/index.js +5 -0
  11. package/index.mjs +409 -0
  12. package/{dist/npm/interfaces → interfaces}/FieldArrayProps.d.ts +4 -1
  13. package/{dist/npm/interfaces → interfaces}/FieldArrayRenderProps.d.ts +4 -0
  14. package/{dist/npm/interfaces → interfaces}/FieldProps.d.ts +4 -1
  15. package/{dist/es/interfaces → interfaces}/FieldRenderProps.d.ts +4 -0
  16. package/{dist/es/interfaces → interfaces}/FieldValidator.d.ts +5 -1
  17. package/{dist/es/interfaces → interfaces}/FormProps.d.ts +4 -1
  18. package/{dist/npm/interfaces → interfaces}/FormRenderProps.d.ts +4 -1
  19. package/{dist/npm/interfaces → interfaces}/FormSubmitClickEvent.d.ts +4 -1
  20. package/interfaces/FormValidator.d.ts +14 -0
  21. package/interfaces/KeyValue.d.ts +10 -0
  22. package/package-metadata.d.ts +9 -0
  23. package/package.json +26 -42
  24. package/about.md +0 -3
  25. package/dist/es/Field.js +0 -92
  26. package/dist/es/FieldArray.d.ts +0 -7
  27. package/dist/es/FieldArray.js +0 -72
  28. package/dist/es/FieldWrapper.js +0 -15
  29. package/dist/es/Form.js +0 -607
  30. package/dist/es/FormContext.js +0 -3
  31. package/dist/es/FormElement.js +0 -49
  32. package/dist/es/interfaces/FieldArrayProps.d.ts +0 -29
  33. package/dist/es/interfaces/FieldArrayProps.js +0 -1
  34. package/dist/es/interfaces/FieldArrayRenderProps.d.ts +0 -89
  35. package/dist/es/interfaces/FieldArrayRenderProps.js +0 -1
  36. package/dist/es/interfaces/FieldProps.d.ts +0 -40
  37. package/dist/es/interfaces/FieldProps.js +0 -1
  38. package/dist/es/interfaces/FieldRenderProps.js +0 -1
  39. package/dist/es/interfaces/FieldValidator.js +0 -1
  40. package/dist/es/interfaces/FormProps.js +0 -1
  41. package/dist/es/interfaces/FormRenderProps.d.ts +0 -75
  42. package/dist/es/interfaces/FormRenderProps.js +0 -1
  43. package/dist/es/interfaces/FormSubmitClickEvent.d.ts +0 -24
  44. package/dist/es/interfaces/FormSubmitClickEvent.js +0 -1
  45. package/dist/es/interfaces/FormValidator.d.ts +0 -10
  46. package/dist/es/interfaces/FormValidator.js +0 -1
  47. package/dist/es/interfaces/KeyValue.d.ts +0 -6
  48. package/dist/es/interfaces/KeyValue.js +0 -1
  49. package/dist/es/main.d.ts +0 -16
  50. package/dist/es/main.js +0 -6
  51. package/dist/es/package-metadata.d.ts +0 -5
  52. package/dist/es/package-metadata.js +0 -11
  53. package/dist/npm/Field.d.ts +0 -10
  54. package/dist/npm/Field.js +0 -96
  55. package/dist/npm/FieldArray.d.ts +0 -7
  56. package/dist/npm/FieldArray.js +0 -76
  57. package/dist/npm/FieldWrapper.d.ts +0 -28
  58. package/dist/npm/FieldWrapper.js +0 -19
  59. package/dist/npm/Form.d.ts +0 -262
  60. package/dist/npm/Form.js +0 -610
  61. package/dist/npm/FormContext.d.ts +0 -50
  62. package/dist/npm/FormContext.js +0 -6
  63. package/dist/npm/FormElement.d.ts +0 -52
  64. package/dist/npm/FormElement.js +0 -52
  65. package/dist/npm/interfaces/FieldArrayProps.js +0 -2
  66. package/dist/npm/interfaces/FieldArrayRenderProps.js +0 -2
  67. package/dist/npm/interfaces/FieldProps.js +0 -2
  68. package/dist/npm/interfaces/FieldRenderProps.d.ts +0 -65
  69. package/dist/npm/interfaces/FieldRenderProps.js +0 -2
  70. package/dist/npm/interfaces/FieldValidator.d.ts +0 -14
  71. package/dist/npm/interfaces/FieldValidator.js +0 -2
  72. package/dist/npm/interfaces/FormProps.d.ts +0 -47
  73. package/dist/npm/interfaces/FormProps.js +0 -2
  74. package/dist/npm/interfaces/FormRenderProps.js +0 -2
  75. package/dist/npm/interfaces/FormSubmitClickEvent.js +0 -2
  76. package/dist/npm/interfaces/FormValidator.d.ts +0 -10
  77. package/dist/npm/interfaces/FormValidator.js +0 -2
  78. package/dist/npm/interfaces/KeyValue.d.ts +0 -6
  79. package/dist/npm/interfaces/KeyValue.js +0 -2
  80. package/dist/npm/main.d.ts +0 -16
  81. package/dist/npm/main.js +0 -13
  82. package/dist/npm/package-metadata.d.ts +0 -5
  83. package/dist/npm/package-metadata.js +0 -14
  84. package/dist/systemjs/kendo-react-form.js +0 -1
  85. package/e2e-next/form.basic.tests.ts +0 -23
package/dist/npm/Form.js DELETED
@@ -1,610 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
- if (ar || !(i in from)) {
31
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
- ar[i] = from[i];
33
- }
34
- }
35
- return to.concat(ar || Array.prototype.slice.call(from));
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.Form = void 0;
39
- var React = require("react");
40
- var PropTypes = require("prop-types");
41
- var FormContext_1 = require("./FormContext");
42
- var kendo_react_common_1 = require("@progress/kendo-react-common");
43
- var kendo_react_common_2 = require("@progress/kendo-react-common");
44
- var package_metadata_1 = require("./package-metadata");
45
- /**
46
- * @hidden
47
- */
48
- var FORCEUPDATE_ACCUMULATOR_TIMEOUT = 0;
49
- /**
50
- * Represents the [KendoReact Form component]({% slug overview_form %}).
51
- *
52
- * @example
53
- * ```jsx
54
- * export const FormInput = (fieldRenderProps) => {
55
- * const onValueChange = React.useCallback(
56
- * (event) => fieldRenderProps.onChange(event.target.value),
57
- * [fieldRenderProps.onChange]
58
- * );
59
- * return (
60
- * <input
61
- * className={'k-input'}
62
- * value={fieldRenderProps.value}
63
- * onChange={onValueChange}
64
- * />
65
- * );
66
- * };
67
- *
68
- * export const App = () => {
69
- * const handleSubmit = (dataItem) => alert(JSON.stringify(dataItem));
70
- * return (
71
- * <Form
72
- * initialValues={{title: ''}}
73
- * onSubmit={handleSubmit}
74
- * render={(formRenderProps) => (
75
- * <div>
76
- * <Field name={'title'} component={FormInput} />
77
- * <button
78
- * className="k-button"
79
- * disabled={!formRenderProps.allowSubmit}
80
- * onClick={formRenderProps.onSubmit}
81
- * >
82
- * Submit
83
- * </button>
84
- * </div>
85
- * )}
86
- * />
87
- * );
88
- * };
89
- *
90
- * ReactDOM.render(<App />, document.querySelector('my-app'));
91
- * ```
92
- */
93
- var Form = /** @class */ (function (_super) {
94
- __extends(Form, _super);
95
- /**
96
- * @hidden
97
- */
98
- function Form(props) {
99
- var _this = _super.call(this, props) || this;
100
- _this._id = (0, kendo_react_common_1.guid)();
101
- _this._touched = {};
102
- _this._visited = {};
103
- _this._modified = {};
104
- _this._validatorsByField = {};
105
- _this._values = {};
106
- _this._fields = {};
107
- _this._unmounted = false;
108
- _this._submitted = false;
109
- /**
110
- * @hidden
111
- */
112
- _this.isValid = function () {
113
- return _this.isFormValid(_this.errors);
114
- };
115
- /**
116
- * @hidden
117
- */
118
- _this.accumulatedForceUpdate = function () {
119
- // IMPORTANT:
120
- // Should only be used for updates not comming from editors as it
121
- // will cause cursor jump as react will reset the editor to old value
122
- if (_this._accumulatorTimeout) {
123
- clearTimeout(_this._accumulatorTimeout);
124
- }
125
- _this._accumulatorTimeout = window.setTimeout(function () {
126
- _this._accumulatorTimeout = undefined;
127
- _this.forceUpdate();
128
- }, FORCEUPDATE_ACCUMULATOR_TIMEOUT);
129
- };
130
- /**
131
- * @hidden
132
- */
133
- _this.resetForm = function () {
134
- _this.values = (0, kendo_react_common_1.clone)(_this.props.initialValues);
135
- _this._id = (0, kendo_react_common_1.guid)();
136
- _this._touched = {};
137
- _this._visited = {};
138
- _this._modified = {};
139
- _this._validatorsByField = {};
140
- _this._fields = {};
141
- _this._submitted = false;
142
- _this.forceUpdate();
143
- };
144
- /**
145
- * Method for resetting the form state outside the form component.
146
- *
147
- * > Use `onReset` only if you cannot achieve the desired behavior through the Field component or by FormRenderProps.
148
- */
149
- _this.onReset = function () { return _this.resetForm(); };
150
- /**
151
- * @hidden
152
- */
153
- _this.addField = function (field) {
154
- _this._fields[field] = true;
155
- };
156
- /**
157
- * @hidden
158
- */
159
- _this.onSubmit = function (event) {
160
- var touchedVisited = {};
161
- var fields = _this.fields;
162
- if (event) {
163
- if (typeof event.preventDefault === 'function') {
164
- event.preventDefault();
165
- }
166
- if (typeof event.stopPropagation === 'function') {
167
- event.stopPropagation();
168
- }
169
- }
170
- fields.forEach(function (fieldName) {
171
- touchedVisited[fieldName] = true;
172
- });
173
- // show validations
174
- _this.visited = __assign({}, touchedVisited);
175
- _this.touched = __assign({}, touchedVisited);
176
- var values = _this.values;
177
- var isValid = _this.isFormValid(_this.errors);
178
- var isModified = _this.isFormModified(_this.modified, fields);
179
- if (_this.props.onSubmitClick) {
180
- _this.props.onSubmitClick.call(undefined, {
181
- values: values,
182
- isValid: isValid,
183
- isModified: isModified,
184
- event: event
185
- });
186
- }
187
- if (isValid && (_this.props.ignoreModified || isModified) && _this.props.onSubmit) {
188
- _this._submitted = true;
189
- _this.props.onSubmit.call(undefined, values, event);
190
- }
191
- _this.forceUpdate();
192
- };
193
- /**
194
- * Method for emiting changes to a specific field outside the form component.
195
- *
196
- * > Use `onChange` only if you cannot achieve the desired behavior through the Field component by FormRenderProps.
197
- */
198
- _this.onChange = function (name, options) {
199
- var _a;
200
- var value = options.value;
201
- _this.addField(name);
202
- if (!_this.modified[name]) {
203
- _this.modified = __assign(__assign({}, _this.modified), (_a = {}, _a[name] = true, _a));
204
- }
205
- _this.valueSetter(name, value);
206
- _this.forceUpdate();
207
- };
208
- /**
209
- * @hidden
210
- */
211
- _this.onFocus = function (name, skipForceUpdate) {
212
- var _a;
213
- if (_this.visited[name]) {
214
- return;
215
- }
216
- _this.visited = __assign(__assign({}, _this.visited), (_a = {}, _a[name] = true, _a));
217
- if (!skipForceUpdate) {
218
- _this.forceUpdate();
219
- }
220
- };
221
- /**
222
- * @hidden
223
- */
224
- _this.onBlur = function (name, skipForceUpdate) {
225
- var _a;
226
- if (_this.touched[name]) {
227
- return;
228
- }
229
- _this.onFocus(name, skipForceUpdate);
230
- _this.touched = __assign(__assign({}, _this.touched), (_a = {}, _a[name] = true, _a));
231
- if (!skipForceUpdate) {
232
- _this.forceUpdate();
233
- }
234
- };
235
- /**
236
- * @hidden
237
- */
238
- _this.onFieldRegister = function (name, validator) {
239
- var _a;
240
- _this.addField(name);
241
- // The sole reason for using class props over state - nextIndex, needed for destroying validators
242
- var oldValidators = (_this.validatorsByField[name] || []);
243
- var nextIndex = oldValidators.length;
244
- _this.validatorsByField = __assign(__assign({}, _this.validatorsByField), (_a = {}, _a[name] = __spreadArray(__spreadArray([], oldValidators, true), [validator], false), _a));
245
- _this.accumulatedForceUpdate();
246
- return function () {
247
- var _a;
248
- // onFieldUnregister:
249
- if (_this._unmounted) {
250
- return;
251
- }
252
- var newValidators = __spreadArray([], (_this.validatorsByField[name] || []), true);
253
- var validatorIsUnregistered = Boolean(newValidators[nextIndex]);
254
- newValidators[nextIndex] = undefined;
255
- _this.validatorsByField = __assign(__assign({}, _this.validatorsByField), (_a = {}, _a[name] = newValidators, _a));
256
- if (validatorIsUnregistered) {
257
- _this.accumulatedForceUpdate();
258
- }
259
- };
260
- };
261
- /**
262
- * @hidden
263
- */
264
- _this.isFormValid = function (errors) {
265
- return !Object.keys(errors).some(function (fieldName) { return Boolean(errors[fieldName]); });
266
- };
267
- /**
268
- * @hidden
269
- */
270
- _this.isFormModified = function (modified, fields) {
271
- return fields.some(function (fieldName) { return modified[fieldName]; });
272
- };
273
- /**
274
- * @hidden
275
- */
276
- _this.isFormHasNotTouched = function (touched, fields) {
277
- return fields.some(function (fieldName) { return !touched[fieldName]; });
278
- };
279
- /**
280
- * @hidden
281
- */
282
- _this.isFormTouched = function (touched, fields) {
283
- return fields.some(function (fieldName) { return touched[fieldName]; });
284
- };
285
- /**
286
- * @hidden
287
- */
288
- _this.isFormVisited = function (visited, fields) {
289
- return fields.some(function (fieldName) { return visited[fieldName]; });
290
- };
291
- /**
292
- * @hidden
293
- */
294
- _this.valueGetter = function (fieldName) {
295
- return (0, kendo_react_common_1.getter)(fieldName)(_this.values);
296
- };
297
- /**
298
- * @hidden
299
- */
300
- _this.valueSetter = function (fieldName, value) {
301
- return (0, kendo_react_common_1.setter)(fieldName)(_this.values, value);
302
- };
303
- /**
304
- * @hidden
305
- */
306
- _this.onArrayAction = function (name) {
307
- var _a;
308
- _this.addField(name);
309
- if (!_this.modified[name]) {
310
- _this.modified = __assign(__assign({}, _this.modified), (_a = {}, _a[name] = true, _a));
311
- }
312
- _this.onBlur(name, true);
313
- };
314
- /**
315
- * @hidden
316
- */
317
- _this.onInsert = function (name, options) {
318
- _this.onArrayAction(name);
319
- var newArray = __spreadArray([], (_this.valueGetter(name) || []), true);
320
- newArray.splice(options.index, 0, options.value);
321
- _this.valueSetter(name, newArray);
322
- _this.forceUpdate();
323
- };
324
- /**
325
- * @hidden
326
- */
327
- _this.onUnshift = function (name, options) {
328
- _this.onInsert(name, {
329
- value: options.value,
330
- index: 0
331
- });
332
- };
333
- /**
334
- * @hidden
335
- */
336
- _this.onPush = function (name, options) {
337
- _this.onArrayAction(name);
338
- var newArray = __spreadArray(__spreadArray([], (_this.valueGetter(name) || []), true), [options.value], false);
339
- _this.valueSetter(name, newArray);
340
- _this.forceUpdate();
341
- };
342
- /**
343
- * @hidden
344
- */
345
- _this.onPop = function (name) {
346
- _this.onArrayAction(name);
347
- var newArray = __spreadArray([], (_this.valueGetter(name) || []), true);
348
- var value = newArray.pop();
349
- _this.valueSetter(name, newArray);
350
- _this.forceUpdate();
351
- return value;
352
- };
353
- /**
354
- * @hidden
355
- */
356
- _this.onRemove = function (name, options) {
357
- _this.onArrayAction(name);
358
- var newArray = __spreadArray([], (_this.valueGetter(name) || []), true);
359
- var value = newArray.splice(options.index, 1);
360
- _this.valueSetter(name, newArray);
361
- _this.forceUpdate();
362
- return value;
363
- };
364
- /**
365
- * @hidden
366
- */
367
- _this.onReplace = function (name, options) {
368
- _this.onArrayAction(name);
369
- var newArray = __spreadArray([], (_this.valueGetter(name) || []), true);
370
- newArray.splice(options.index, 1, options.value);
371
- _this.valueSetter(name, newArray);
372
- _this.forceUpdate();
373
- };
374
- /**
375
- * @hidden
376
- */
377
- _this.onMove = function (name, options) {
378
- _this.onArrayAction(name);
379
- var newArray = __spreadArray([], (_this.valueGetter(name) || []), true);
380
- var value = newArray[options.prevIndex];
381
- newArray.splice(options.prevIndex, 1);
382
- newArray.splice(options.nextIndex, 0, value);
383
- _this.valueSetter(name, newArray);
384
- _this.forceUpdate();
385
- };
386
- (0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
387
- _this.values = (0, kendo_react_common_1.clone)(props.initialValues);
388
- return _this;
389
- }
390
- Object.defineProperty(Form.prototype, "touched", {
391
- /**
392
- * @hidden
393
- */
394
- get: function () {
395
- return this._touched;
396
- },
397
- /**
398
- * @hidden
399
- */
400
- set: function (value) {
401
- this._touched = value;
402
- },
403
- enumerable: false,
404
- configurable: true
405
- });
406
- Object.defineProperty(Form.prototype, "visited", {
407
- /**
408
- * @hidden
409
- */
410
- get: function () {
411
- return this._visited;
412
- },
413
- /**
414
- * @hidden
415
- */
416
- set: function (value) {
417
- this._visited = value;
418
- },
419
- enumerable: false,
420
- configurable: true
421
- });
422
- Object.defineProperty(Form.prototype, "modified", {
423
- /**
424
- * @hidden
425
- */
426
- get: function () {
427
- return this._modified;
428
- },
429
- /**
430
- * @hidden
431
- */
432
- set: function (value) {
433
- this._modified = value;
434
- },
435
- enumerable: false,
436
- configurable: true
437
- });
438
- Object.defineProperty(Form.prototype, "validatorsByField", {
439
- /**
440
- * @hidden
441
- */
442
- get: function () {
443
- return this._validatorsByField;
444
- },
445
- /**
446
- * @hidden
447
- */
448
- set: function (value) {
449
- this._validatorsByField = value;
450
- },
451
- enumerable: false,
452
- configurable: true
453
- });
454
- Object.defineProperty(Form.prototype, "values", {
455
- /**
456
- * @hidden
457
- */
458
- get: function () {
459
- return this._values;
460
- },
461
- /**
462
- * @hidden
463
- */
464
- set: function (value) {
465
- this._values = value;
466
- },
467
- enumerable: false,
468
- configurable: true
469
- });
470
- Object.defineProperty(Form.prototype, "fields", {
471
- /**
472
- * @hidden
473
- */
474
- get: function () {
475
- return Object.keys(this._fields);
476
- },
477
- enumerable: false,
478
- configurable: true
479
- });
480
- Object.defineProperty(Form.prototype, "formErrors", {
481
- /**
482
- * @hidden
483
- */
484
- get: function () {
485
- if (this.props.validator) {
486
- return this.props.validator(this.values, this.valueGetter);
487
- }
488
- },
489
- enumerable: false,
490
- configurable: true
491
- });
492
- Object.defineProperty(Form.prototype, "errors", {
493
- /**
494
- * @hidden
495
- */
496
- get: function () {
497
- var _this = this;
498
- var errors = {};
499
- var fields = this.fields;
500
- var validatorsByField = this.validatorsByField;
501
- fields.forEach(function (fieldName) {
502
- errors[fieldName] = '';
503
- if (validatorsByField[fieldName]) {
504
- var validators_1 = [];
505
- validatorsByField[fieldName].forEach(function (validator) {
506
- if (Array.isArray(validator)) {
507
- validators_1.push.apply(validators_1, validator);
508
- }
509
- else {
510
- validators_1.push(validator);
511
- }
512
- });
513
- // find first validation error
514
- validators_1.find(function (validator) {
515
- if (validator) {
516
- var result = validator(_this.valueGetter(fieldName), _this.valueGetter, { name: fieldName });
517
- if (result) {
518
- errors[fieldName] = result;
519
- return true;
520
- }
521
- }
522
- return false;
523
- });
524
- }
525
- });
526
- var formErrors = this.formErrors;
527
- if (formErrors) {
528
- (0, kendo_react_common_1.cloneObject)(this.formErrors, errors);
529
- }
530
- return errors;
531
- },
532
- enumerable: false,
533
- configurable: true
534
- });
535
- /**
536
- * @hidden
537
- */
538
- Form.prototype.componentWillUnmount = function () {
539
- this._unmounted = true;
540
- if (this._accumulatorTimeout) {
541
- clearTimeout(this._accumulatorTimeout);
542
- }
543
- };
544
- /**
545
- * @hidden
546
- */
547
- Form.prototype.render = function () {
548
- var render = this.props.render;
549
- var touched = this.touched;
550
- var visited = this.visited;
551
- var modified = this.modified;
552
- var fields = this.fields;
553
- var errors = this.errors;
554
- var formValid = this.isFormValid(errors);
555
- var formModified = this.isFormModified(modified, fields);
556
- var formTouched = this.isFormTouched(touched, fields);
557
- var formVisited = this.isFormVisited(visited, fields);
558
- var formHasNotTouched = this.isFormHasNotTouched(touched, fields);
559
- // 1. The form is not touched, but has errors - allow submit to force validation.
560
- // 2. The form is valid and modified - if not modified, disable submit.
561
- var allowSubmit = (formHasNotTouched && !formValid) || (formValid && (this.props.ignoreModified || formModified));
562
- return (React.createElement(FormContext_1.FormContext.Provider, { key: this._id, value: {
563
- id: this._id,
564
- valueGetter: this.valueGetter,
565
- errors: errors,
566
- modified: modified,
567
- touched: touched,
568
- visited: visited,
569
- registerField: this.onFieldRegister,
570
- onSubmit: this.onSubmit,
571
- onChange: this.onChange,
572
- onFocus: this.onFocus,
573
- onBlur: this.onBlur,
574
- onUnshift: this.onUnshift,
575
- onPush: this.onPush,
576
- onInsert: this.onInsert,
577
- onPop: this.onPop,
578
- onRemove: this.onRemove,
579
- onReplace: this.onReplace,
580
- onMove: this.onMove
581
- } }, render({
582
- valid: formValid,
583
- modified: formModified,
584
- touched: formTouched,
585
- visited: formVisited,
586
- submitted: this._submitted,
587
- valueGetter: this.valueGetter,
588
- errors: errors,
589
- allowSubmit: allowSubmit,
590
- onChange: this.onChange,
591
- onSubmit: this.onSubmit,
592
- onFormReset: this.resetForm
593
- })));
594
- };
595
- /**
596
- * @hidden
597
- */
598
- Form.displayName = 'KendoReactForm';
599
- /**
600
- * @hidden
601
- */
602
- Form.propTypes = {
603
- initialValues: PropTypes.any,
604
- onSubmit: PropTypes.func,
605
- onSubmitClick: PropTypes.func,
606
- render: PropTypes.func.isRequired
607
- };
608
- return Form;
609
- }(React.Component));
610
- exports.Form = Form;
@@ -1,50 +0,0 @@
1
- import * as React from 'react';
2
- import { FieldValidatorType } from './interfaces/FieldValidator';
3
- /** @hidden */
4
- export declare type FormContextType = {
5
- onSubmit: (event: React.SyntheticEvent<any>) => void;
6
- onChange: (name: string, options: {
7
- value: any;
8
- }) => void;
9
- onFocus: (name: string) => void;
10
- onBlur: (name: string) => void;
11
- onUnshift: (name: string, options: {
12
- value: any;
13
- }) => void;
14
- onPush: (name: string, options: {
15
- value: any;
16
- }) => void;
17
- onInsert: (name: string, options: {
18
- index: number;
19
- value: any;
20
- }) => void;
21
- onPop: (name: string) => any;
22
- onRemove: (name: string, options: {
23
- index: number;
24
- }) => any;
25
- onReplace: (name: string, options: {
26
- index: number;
27
- value: any;
28
- }) => void;
29
- onMove: (name: string, options: {
30
- prevIndex: number;
31
- nextIndex: number;
32
- }) => void;
33
- registerField: (name: string, validator: FieldValidatorType | FieldValidatorType[] | undefined) => void;
34
- valueGetter: (name: string) => any;
35
- errors: {
36
- [name: string]: string;
37
- };
38
- touched: {
39
- [name: string]: boolean;
40
- };
41
- visited: {
42
- [name: string]: boolean;
43
- };
44
- modified: {
45
- [name: string]: boolean;
46
- };
47
- id: string;
48
- };
49
- /** @hidden */
50
- export declare const FormContext: React.Context<FormContextType | null>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormContext = void 0;
4
- var React = require("react");
5
- /** @hidden */
6
- exports.FormContext = React.createContext(null);