@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.
- package/{dist/es/Field.d.ts → Field.d.ts} +4 -0
- package/FieldArray.d.ts +11 -0
- package/{dist/es/FieldWrapper.d.ts → FieldWrapper.d.ts} +4 -0
- package/{dist/es/Form.d.ts → Form.d.ts} +5 -1
- package/{dist/es/FormContext.d.ts → FormContext.d.ts} +5 -1
- package/{dist/es/FormElement.d.ts → FormElement.d.ts} +4 -0
- package/LICENSE.md +1 -1
- package/dist/cdn/js/kendo-react-form.js +5 -1
- package/index.d.ts +20 -0
- package/index.js +5 -0
- package/index.mjs +409 -0
- package/{dist/npm/interfaces → interfaces}/FieldArrayProps.d.ts +4 -1
- package/{dist/npm/interfaces → interfaces}/FieldArrayRenderProps.d.ts +4 -0
- package/{dist/npm/interfaces → interfaces}/FieldProps.d.ts +4 -1
- package/{dist/es/interfaces → interfaces}/FieldRenderProps.d.ts +4 -0
- package/{dist/es/interfaces → interfaces}/FieldValidator.d.ts +5 -1
- package/{dist/es/interfaces → interfaces}/FormProps.d.ts +4 -1
- package/{dist/npm/interfaces → interfaces}/FormRenderProps.d.ts +4 -1
- package/{dist/npm/interfaces → interfaces}/FormSubmitClickEvent.d.ts +4 -1
- package/interfaces/FormValidator.d.ts +14 -0
- package/interfaces/KeyValue.d.ts +10 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +26 -42
- package/about.md +0 -3
- package/dist/es/Field.js +0 -92
- package/dist/es/FieldArray.d.ts +0 -7
- package/dist/es/FieldArray.js +0 -72
- package/dist/es/FieldWrapper.js +0 -15
- package/dist/es/Form.js +0 -607
- package/dist/es/FormContext.js +0 -3
- package/dist/es/FormElement.js +0 -49
- package/dist/es/interfaces/FieldArrayProps.d.ts +0 -29
- package/dist/es/interfaces/FieldArrayProps.js +0 -1
- package/dist/es/interfaces/FieldArrayRenderProps.d.ts +0 -89
- package/dist/es/interfaces/FieldArrayRenderProps.js +0 -1
- package/dist/es/interfaces/FieldProps.d.ts +0 -40
- package/dist/es/interfaces/FieldProps.js +0 -1
- package/dist/es/interfaces/FieldRenderProps.js +0 -1
- package/dist/es/interfaces/FieldValidator.js +0 -1
- package/dist/es/interfaces/FormProps.js +0 -1
- package/dist/es/interfaces/FormRenderProps.d.ts +0 -75
- package/dist/es/interfaces/FormRenderProps.js +0 -1
- package/dist/es/interfaces/FormSubmitClickEvent.d.ts +0 -24
- package/dist/es/interfaces/FormSubmitClickEvent.js +0 -1
- package/dist/es/interfaces/FormValidator.d.ts +0 -10
- package/dist/es/interfaces/FormValidator.js +0 -1
- package/dist/es/interfaces/KeyValue.d.ts +0 -6
- package/dist/es/interfaces/KeyValue.js +0 -1
- package/dist/es/main.d.ts +0 -16
- package/dist/es/main.js +0 -6
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/npm/Field.d.ts +0 -10
- package/dist/npm/Field.js +0 -96
- package/dist/npm/FieldArray.d.ts +0 -7
- package/dist/npm/FieldArray.js +0 -76
- package/dist/npm/FieldWrapper.d.ts +0 -28
- package/dist/npm/FieldWrapper.js +0 -19
- package/dist/npm/Form.d.ts +0 -262
- package/dist/npm/Form.js +0 -610
- package/dist/npm/FormContext.d.ts +0 -50
- package/dist/npm/FormContext.js +0 -6
- package/dist/npm/FormElement.d.ts +0 -52
- package/dist/npm/FormElement.js +0 -52
- package/dist/npm/interfaces/FieldArrayProps.js +0 -2
- package/dist/npm/interfaces/FieldArrayRenderProps.js +0 -2
- package/dist/npm/interfaces/FieldProps.js +0 -2
- package/dist/npm/interfaces/FieldRenderProps.d.ts +0 -65
- package/dist/npm/interfaces/FieldRenderProps.js +0 -2
- package/dist/npm/interfaces/FieldValidator.d.ts +0 -14
- package/dist/npm/interfaces/FieldValidator.js +0 -2
- package/dist/npm/interfaces/FormProps.d.ts +0 -47
- package/dist/npm/interfaces/FormProps.js +0 -2
- package/dist/npm/interfaces/FormRenderProps.js +0 -2
- package/dist/npm/interfaces/FormSubmitClickEvent.js +0 -2
- package/dist/npm/interfaces/FormValidator.d.ts +0 -10
- package/dist/npm/interfaces/FormValidator.js +0 -2
- package/dist/npm/interfaces/KeyValue.d.ts +0 -6
- package/dist/npm/interfaces/KeyValue.js +0 -2
- package/dist/npm/main.d.ts +0 -16
- package/dist/npm/main.js +0 -13
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/systemjs/kendo-react-form.js +0 -1
- package/e2e-next/form.basic.tests.ts +0 -23
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the props that are passed to the component which is rendered by FieldArray.
|
|
3
|
-
*/
|
|
4
|
-
export interface FieldArrayRenderProps {
|
|
5
|
-
/**
|
|
6
|
-
* Represents the current value of the FieldArray
|
|
7
|
-
* ([see example]({% slug custom_components_form %}#toc-using-basic-properties)).
|
|
8
|
-
*/
|
|
9
|
-
value: any;
|
|
10
|
-
/**
|
|
11
|
-
* Represents the error message that is returned by the validator.
|
|
12
|
-
* The FieldArray is considered valid if the `validationMessage` field is empty.
|
|
13
|
-
*/
|
|
14
|
-
validationMessage: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Indicates if the field is touched.
|
|
17
|
-
* The touched state is set to `true` when the `onBlur` callback is called.
|
|
18
|
-
*/
|
|
19
|
-
touched: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Indicates if the field is modified.
|
|
22
|
-
* The modified state is set to `true` when the `onChange` callback for the current field is called for first time.
|
|
23
|
-
*/
|
|
24
|
-
modified: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Indicates if the field is visited.
|
|
27
|
-
* The visited state is set to `true` when the `onFocus` callback is called.
|
|
28
|
-
*/
|
|
29
|
-
visited: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* A calculated property based on whether `validationMessage` is present and the `touched` state is set to `true`.
|
|
32
|
-
*/
|
|
33
|
-
valid: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Represents the children that are passed to the FieldArray.
|
|
36
|
-
*/
|
|
37
|
-
children: any;
|
|
38
|
-
/**
|
|
39
|
-
* The name of the field in the Form state.
|
|
40
|
-
*/
|
|
41
|
-
name: string;
|
|
42
|
-
/**
|
|
43
|
-
* A callback to add a value to the beginning of the array.
|
|
44
|
-
*/
|
|
45
|
-
onUnshift: (options: {
|
|
46
|
-
value: any;
|
|
47
|
-
}) => number;
|
|
48
|
-
/**
|
|
49
|
-
* A callback to add a value to the end of the array.
|
|
50
|
-
*/
|
|
51
|
-
onPush: (options: {
|
|
52
|
-
value: any;
|
|
53
|
-
}) => void;
|
|
54
|
-
/**
|
|
55
|
-
* A callback to insert value at given index of the array.
|
|
56
|
-
*/
|
|
57
|
-
onInsert: (options: {
|
|
58
|
-
value: any;
|
|
59
|
-
index: number;
|
|
60
|
-
}) => void;
|
|
61
|
-
/**
|
|
62
|
-
* A callback to remove a value from the end of the array. The value is returned.
|
|
63
|
-
*/
|
|
64
|
-
onPop: () => any;
|
|
65
|
-
/**
|
|
66
|
-
* A callback to remove a value from given index of the array.
|
|
67
|
-
*/
|
|
68
|
-
onRemove: (options: {
|
|
69
|
-
index: number;
|
|
70
|
-
}) => any;
|
|
71
|
-
/**
|
|
72
|
-
* A callback to replace value at given index of the array.
|
|
73
|
-
*/
|
|
74
|
-
onReplace: (options: {
|
|
75
|
-
value: any;
|
|
76
|
-
index: number;
|
|
77
|
-
}) => void;
|
|
78
|
-
/**
|
|
79
|
-
* A callback to move a value from one index to another. Useful for drag and drop reordering.
|
|
80
|
-
*/
|
|
81
|
-
onMove: (options: {
|
|
82
|
-
prevIndex: number;
|
|
83
|
-
nextIndex: number;
|
|
84
|
-
}) => void;
|
|
85
|
-
/**
|
|
86
|
-
* @hidden
|
|
87
|
-
*/
|
|
88
|
-
[customProp: string]: any;
|
|
89
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FieldValidatorType } from './FieldValidator';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the props of the Field component that is used inside the KendoReact Form component.
|
|
5
|
-
*/
|
|
6
|
-
export interface FieldProps {
|
|
7
|
-
/**
|
|
8
|
-
* The name of the field in the Form state.
|
|
9
|
-
* Supports nested fields in the `user.age` and `users[index].name` formats.
|
|
10
|
-
*/
|
|
11
|
-
name: string;
|
|
12
|
-
/**
|
|
13
|
-
* Can be set to a React component or to the name of an HTML element,
|
|
14
|
-
* for example, `input`, `select`, and `textarea`.
|
|
15
|
-
* The props that are passed to component are the
|
|
16
|
-
* [`FieldRenderProps`]({% slug api_form_fieldrenderprops %}).
|
|
17
|
-
*/
|
|
18
|
-
component: string | React.ComponentType<any>;
|
|
19
|
-
/**
|
|
20
|
-
* The validation functions for the Field level.
|
|
21
|
-
* Currently, `validator` supports only synchronous functions.
|
|
22
|
-
* Using the array overload with inline array will cause an infinite loop - in this case use a `useMemo` hook to memoize the array.
|
|
23
|
-
*/
|
|
24
|
-
validator?: FieldValidatorType | FieldValidatorType[];
|
|
25
|
-
/**
|
|
26
|
-
* The React elements that are passed as children to the rendered component.
|
|
27
|
-
*/
|
|
28
|
-
children?: any;
|
|
29
|
-
/**
|
|
30
|
-
* Called when underlying editor triggers it's `onChange` event and the Form update it's internal state.
|
|
31
|
-
* Useful for updating related fields.
|
|
32
|
-
* > The `Form` listens to this editor event and automatically keeps it's internal state up to date.
|
|
33
|
-
* That why this event should be used only for executing custom logic.
|
|
34
|
-
*/
|
|
35
|
-
onChange?: (event: any) => void;
|
|
36
|
-
/**
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
[customProp: string]: any;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { KeyValue } from './KeyValue';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the props that are passed to the `render` option component of the Form.
|
|
5
|
-
*/
|
|
6
|
-
export interface FormRenderProps {
|
|
7
|
-
/**
|
|
8
|
-
* A callback for submitting the Form.
|
|
9
|
-
* Can be passed to the `onClick` property of the **Submit** button.
|
|
10
|
-
*/
|
|
11
|
-
onSubmit: (event: React.SyntheticEvent<any>) => void;
|
|
12
|
-
/**
|
|
13
|
-
* A callback for emiting changes to a specific field without using the Field component
|
|
14
|
-
* ([see example]({% slug common_scenarios_form %}#toc-changing-the-field-value)).
|
|
15
|
-
*
|
|
16
|
-
* > Use `onChange` only if you cannot achieve the desired behavior through the Field component.
|
|
17
|
-
*/
|
|
18
|
-
onChange: (name: string, options: {
|
|
19
|
-
value: any;
|
|
20
|
-
}) => void;
|
|
21
|
-
/**
|
|
22
|
-
* A callback for resetting the Form.
|
|
23
|
-
*/
|
|
24
|
-
onFormReset: () => void;
|
|
25
|
-
/**
|
|
26
|
-
* The key-value pair containing the current errors by field path, combined from both field and form level validators.
|
|
27
|
-
*/
|
|
28
|
-
errors: KeyValue<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Indicates if the Form is valid.
|
|
31
|
-
* If any field is invalid, `valid` is set to `false`.
|
|
32
|
-
*/
|
|
33
|
-
valid: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Indicates if the Form is touched.
|
|
36
|
-
* If any field is touched, `touched` is set to `true`.
|
|
37
|
-
* The touched state of field is set to `true` when the `onBlur`
|
|
38
|
-
* callback of the Field component is called or when the user tries to submit the form.
|
|
39
|
-
*/
|
|
40
|
-
touched: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Indicates if the Form is visited.
|
|
43
|
-
* If any field is visited, `visited` is set to `true`.
|
|
44
|
-
* The visited state of field is set to `true` when the `onFocus`
|
|
45
|
-
* callback of the Field component is called or when the user tries to submit the form.
|
|
46
|
-
*/
|
|
47
|
-
visited: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Indicates if the Form is modified.
|
|
50
|
-
* If any field is modified, `modified` is set to `true`.
|
|
51
|
-
* The modified state of field is set to `true` when the `onChange`
|
|
52
|
-
* callback of the Field component is called for first time.
|
|
53
|
-
*/
|
|
54
|
-
modified: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Indicates if the Form is successfuly submitted.
|
|
57
|
-
* Useful for detecting if user is leaving the form before saving changes.
|
|
58
|
-
*/
|
|
59
|
-
submitted: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Indicates if the Form is ready to be submitted.
|
|
62
|
-
* * If `allowSubmit` is set to `true` and the Form is valid, the user will be able to submit the form.
|
|
63
|
-
* * If `allowSubmit` is set to `true` and the Form is not valid, the user will be able to set the `touched` and `visited` state of all fields to `true`.
|
|
64
|
-
* `touched` and `visited` state to true.
|
|
65
|
-
*
|
|
66
|
-
* Useful for toggling the disabled state of the **Submit** button.
|
|
67
|
-
*/
|
|
68
|
-
allowSubmit: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* A callback for getting the value of a field without using the Field component
|
|
71
|
-
* ([see example]({% slug common_scenarios_form %}#toc-reading-the-field-state)).
|
|
72
|
-
* Useful for creating and modifying the UI based on the field values.
|
|
73
|
-
*/
|
|
74
|
-
valueGetter: (name: string) => any;
|
|
75
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* The FormSubmitClick event.
|
|
4
|
-
*/
|
|
5
|
-
export interface FormSubmitClickEvent {
|
|
6
|
-
/**
|
|
7
|
-
* Contains the current values of the form.
|
|
8
|
-
*/
|
|
9
|
-
values: {
|
|
10
|
-
[name: string]: any;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The native event.
|
|
14
|
-
*/
|
|
15
|
-
event?: React.SyntheticEvent<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Represents the validity state of the form.
|
|
18
|
-
*/
|
|
19
|
-
isValid: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Represents the modified state of the form.
|
|
22
|
-
*/
|
|
23
|
-
isModified: boolean;
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { KeyValue } from './KeyValue';
|
|
2
|
-
/**
|
|
3
|
-
* The validator function for the Form component.
|
|
4
|
-
*
|
|
5
|
-
* * values - The current values of the form.
|
|
6
|
-
* * valueGetter - Function which can be used to get field value. Supports field paths.
|
|
7
|
-
*
|
|
8
|
-
* Returns key-value pair with errors if such are present. The key is the field path, where the value is the error message.
|
|
9
|
-
*/
|
|
10
|
-
export declare type FormValidatorType = (values: any, valueGetter: (name: string) => any) => KeyValue<string> | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/es/main.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FieldProps } from './interfaces/FieldProps';
|
|
2
|
-
import { FieldRenderProps } from './interfaces/FieldRenderProps';
|
|
3
|
-
import { FormProps } from './interfaces/FormProps';
|
|
4
|
-
import { FormRenderProps } from './interfaces/FormRenderProps';
|
|
5
|
-
import { Field } from './Field';
|
|
6
|
-
import { Form } from './Form';
|
|
7
|
-
import { FormValidatorType } from './interfaces/FormValidator';
|
|
8
|
-
import { FieldValidatorType } from './interfaces/FieldValidator';
|
|
9
|
-
import { FieldArray } from './FieldArray';
|
|
10
|
-
import { FieldArrayProps } from './interfaces/FieldArrayProps';
|
|
11
|
-
import { FieldArrayRenderProps } from './interfaces/FieldArrayRenderProps';
|
|
12
|
-
import { KeyValue } from './interfaces/KeyValue';
|
|
13
|
-
import { FieldWrapper, FieldWrapperProps } from './FieldWrapper';
|
|
14
|
-
import { FormElement, FormElementProps, FormElementHandle } from './FormElement';
|
|
15
|
-
import { FormSubmitClickEvent } from './interfaces/FormSubmitClickEvent';
|
|
16
|
-
export { FieldArray, FieldArrayProps, FieldArrayRenderProps, Field, FieldProps, FieldRenderProps, Form, FormProps, FormRenderProps, FormValidatorType, FieldValidatorType, KeyValue, FieldWrapper, FieldWrapperProps, FormElement, FormElementHandle, FormElementProps, FormSubmitClickEvent };
|
package/dist/es/main.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Field } from './Field';
|
|
2
|
-
import { Form } from './Form';
|
|
3
|
-
import { FieldArray } from './FieldArray';
|
|
4
|
-
import { FieldWrapper } from './FieldWrapper';
|
|
5
|
-
import { FormElement } from './FormElement';
|
|
6
|
-
export { FieldArray, Field, Form, FieldWrapper, FormElement };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @hidden
|
|
3
|
-
*/
|
|
4
|
-
export var packageMetadata = {
|
|
5
|
-
name: '@progress/kendo-react-form',
|
|
6
|
-
productName: 'KendoReact',
|
|
7
|
-
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
8
|
-
publishDate: 1700063972,
|
|
9
|
-
version: '',
|
|
10
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
|
|
11
|
-
};
|
package/dist/npm/Field.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FieldProps } from './interfaces/FieldProps';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the Field component that is used inside the KendoReact Form component.
|
|
5
|
-
* It uses `name` property to access field value and meta information from Form state.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Field: {
|
|
8
|
-
(props: FieldProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
package/dist/npm/Field.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.Field = void 0;
|
|
26
|
-
var React = require("react");
|
|
27
|
-
var FormContext_1 = require("./FormContext");
|
|
28
|
-
/**
|
|
29
|
-
* Represents the Field component that is used inside the KendoReact Form component.
|
|
30
|
-
* It uses `name` property to access field value and meta information from Form state.
|
|
31
|
-
*/
|
|
32
|
-
var Field = function (props) {
|
|
33
|
-
var name = props.name, component = props.component, validator = props.validator, children = props.children, onChange = props.onChange, others = __rest(props, ["name", "component", "validator", "children", "onChange"]);
|
|
34
|
-
var form = React.useContext(FormContext_1.FormContext);
|
|
35
|
-
var formId = form ? form.id : '';
|
|
36
|
-
React.useEffect(function () {
|
|
37
|
-
if (!form) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
var unregisterField = form.registerField(name, validator);
|
|
41
|
-
return unregisterField;
|
|
42
|
-
}, [name, formId, validator]);
|
|
43
|
-
var handleOnChange = React.useCallback(function (event) {
|
|
44
|
-
// Adding a name here slows down the performance.
|
|
45
|
-
// However, the other apprach taken by Formik is to search for the `name` attribute
|
|
46
|
-
// on `event.target.value` which does not work for all KendoReact components.
|
|
47
|
-
// If Formik uses custom components like the KendoReact ones, it would take the same approach.
|
|
48
|
-
// On the other hand, ReactFinal Form performs better in both cases due to its
|
|
49
|
-
// subscribtion-based model - the fields are subscribed for changes to a given field,
|
|
50
|
-
// which prevents unnececery rerenders. Note that this might be fragile in future React versions -
|
|
51
|
-
// the current performance testing accunts for a slight lag after 300 native HTML inputs in the 120ms-200ms range.
|
|
52
|
-
var newValue = event
|
|
53
|
-
? (event.value !== undefined
|
|
54
|
-
? event.value
|
|
55
|
-
: (event.target
|
|
56
|
-
? event.target.value
|
|
57
|
-
: event.target))
|
|
58
|
-
: event;
|
|
59
|
-
form.onChange(name, { value: newValue });
|
|
60
|
-
if (onChange) {
|
|
61
|
-
onChange.call(undefined, event);
|
|
62
|
-
}
|
|
63
|
-
}, [name, formId, onChange]);
|
|
64
|
-
var onNativeComponentChange = React.useCallback(function (event) { return form.onChange(name, { value: event.target.value }); }, [name, formId]);
|
|
65
|
-
var handleOnBlur = React.useCallback(function () { return form.onBlur(name); }, [name, formId]);
|
|
66
|
-
var handleOnFocus = React.useCallback(function () { return form.onFocus(name); }, [name, formId]);
|
|
67
|
-
if (!form) {
|
|
68
|
-
// TODO: For future versions - warn for missing form in dev mode
|
|
69
|
-
// if (__process.env.NODE_ENV !== 'production') { // or __DEV__
|
|
70
|
-
// throw new Error('Field must be used inside of a <Form> component');
|
|
71
|
-
// }
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
var value = form.valueGetter(name);
|
|
75
|
-
// TODO: For future versions as it's better to have render prop
|
|
76
|
-
// if (typeof children === 'function') {
|
|
77
|
-
// return children({ ...field, children: undefined, ...others });
|
|
78
|
-
// }
|
|
79
|
-
if (typeof component === 'string') {
|
|
80
|
-
// ignore meta, combine input with any other props
|
|
81
|
-
return React.createElement(component, __assign({ onChange: onNativeComponentChange, onBlur: handleOnBlur, onFocus: handleOnFocus, value: value, children: children }, others));
|
|
82
|
-
}
|
|
83
|
-
return React.createElement(component, __assign(__assign({ children: children }, others), {
|
|
84
|
-
// input
|
|
85
|
-
onChange: handleOnChange, onBlur: handleOnBlur, onFocus: handleOnFocus, value: value,
|
|
86
|
-
// meta
|
|
87
|
-
validationMessage: form.errors[name], touched: form.touched[name], modified: form.modified[name], visited: form.visited[name],
|
|
88
|
-
// Our `valid` implementation requires double submit to show html5 validation errors,
|
|
89
|
-
// however it's NOT recommended to show html5 validation errors at all as:
|
|
90
|
-
// - There is no standard way to change validation look and feel with CSS.
|
|
91
|
-
// - Look different in each browser / OS
|
|
92
|
-
// - You can have a page in one language but an error message displayed in another language (not localizable)
|
|
93
|
-
valid: !(Boolean(form.errors[name]) && form.touched[name]), name: name }));
|
|
94
|
-
};
|
|
95
|
-
exports.Field = Field;
|
|
96
|
-
exports.Field.displayName = 'KendoReactField';
|
package/dist/npm/FieldArray.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FieldArrayProps } from './interfaces/FieldArrayProps';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the FieldArray component that is used inside the KendoReact Form component.
|
|
5
|
-
* It provides methods via render props for common array manipulations.
|
|
6
|
-
*/
|
|
7
|
-
export declare const FieldArray: React.FunctionComponent<FieldArrayProps>;
|
package/dist/npm/FieldArray.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.FieldArray = void 0;
|
|
26
|
-
var React = require("react");
|
|
27
|
-
var FormContext_1 = require("./FormContext");
|
|
28
|
-
/**
|
|
29
|
-
* Represents the FieldArray component that is used inside the KendoReact Form component.
|
|
30
|
-
* It provides methods via render props for common array manipulations.
|
|
31
|
-
*/
|
|
32
|
-
var FieldArray = function (props) {
|
|
33
|
-
var name = props.name, component = props.component, validator = props.validator, type = props.type, children = props.children, others = __rest(props, ["name", "component", "validator", "type", "children"]);
|
|
34
|
-
var form = React.useContext(FormContext_1.FormContext);
|
|
35
|
-
var formId = form ? form.id : '';
|
|
36
|
-
React.useEffect(function () {
|
|
37
|
-
if (!form) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
var unregisterField = form.registerField(name, validator);
|
|
41
|
-
return unregisterField;
|
|
42
|
-
}, [name, formId, validator]);
|
|
43
|
-
var onUnshift = React.useCallback(function (event) { return form.onUnshift(name, event); }, [name, formId]);
|
|
44
|
-
var onPush = React.useCallback(function (event) { return form.onPush(name, event); }, [name, formId]);
|
|
45
|
-
var onInsert = React.useCallback(function (event) { return form.onInsert(name, event); }, [name, formId]);
|
|
46
|
-
var onPop = React.useCallback(function () { return form.onPop(name); }, [name, formId]);
|
|
47
|
-
var onRemove = React.useCallback(function (event) { return form.onRemove(name, event); }, [name, formId]);
|
|
48
|
-
var onReplace = React.useCallback(function (event) { return form.onReplace(name, event); }, [name, formId]);
|
|
49
|
-
var onMove = React.useCallback(function (event) { return form.onMove(name, event); }, [name, formId]);
|
|
50
|
-
if (!form) {
|
|
51
|
-
// TODO: For future versions - warn for missing form in dev mode
|
|
52
|
-
// if (__process.env.NODE_ENV !== 'production') { // or __DEV__
|
|
53
|
-
// throw new Error('Field must be used inside of a <Form> component');
|
|
54
|
-
// }
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
// TODO: remove this and pass down getter to allow users optimize when to refresh the data?
|
|
58
|
-
var value = form.valueGetter(name);
|
|
59
|
-
// TODO: For future versions as it's better to have render prop
|
|
60
|
-
// if (typeof children === 'function') {
|
|
61
|
-
// return children({ ...field, children: undefined, ...others });
|
|
62
|
-
// }
|
|
63
|
-
return React.createElement(component, __assign({
|
|
64
|
-
// input
|
|
65
|
-
value: value,
|
|
66
|
-
// meta
|
|
67
|
-
validationMessage: form.errors[name], touched: form.touched[name], modified: form.modified[name], visited: form.visited[name],
|
|
68
|
-
// Our `valid` implementation requires double submit to show html5 validation errors,
|
|
69
|
-
// however it's NOT recommended to show html5 validation errors at all as:
|
|
70
|
-
// - There is no standard way to change validation look and feel with CSS.
|
|
71
|
-
// - Look different in each browser / OS
|
|
72
|
-
// - You can have a page in one language but an error message displayed in another language (not localizable)
|
|
73
|
-
valid: !(Boolean(form.errors[name]) && form.touched[name]), onUnshift: onUnshift, onPush: onPush, onInsert: onInsert, onPop: onPop, onRemove: onRemove, onReplace: onReplace, onMove: onMove, children: children, name: name }, others));
|
|
74
|
-
};
|
|
75
|
-
exports.FieldArray = FieldArray;
|
|
76
|
-
exports.FieldArray.displayName = 'KendoReactFieldArray';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the props of the KendoReact FieldWrapper component.
|
|
4
|
-
*/
|
|
5
|
-
export interface FieldWrapperProps {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
children: any;
|
|
10
|
-
/**
|
|
11
|
-
* The styles that are applied to the FieldWrapper.
|
|
12
|
-
*/
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
/**
|
|
15
|
-
* Sets a class of the FieldWrapper DOM element.
|
|
16
|
-
*/
|
|
17
|
-
className?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Specifies the direction of the content.
|
|
20
|
-
*/
|
|
21
|
-
dir?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Represents the KendoReact FieldWrapper component.
|
|
25
|
-
* It's designed to wrap the field editor, Label, Hint and Error components.
|
|
26
|
-
* The FieldWrapper supports only single editor inside it.
|
|
27
|
-
*/
|
|
28
|
-
export declare const FieldWrapper: React.FunctionComponent<FieldWrapperProps>;
|
package/dist/npm/FieldWrapper.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FieldWrapper = void 0;
|
|
4
|
-
var React = require("react");
|
|
5
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
6
|
-
/**
|
|
7
|
-
* Represents the KendoReact FieldWrapper component.
|
|
8
|
-
* It's designed to wrap the field editor, Label, Hint and Error components.
|
|
9
|
-
* The FieldWrapper supports only single editor inside it.
|
|
10
|
-
*/
|
|
11
|
-
var FieldWrapper = function (props) {
|
|
12
|
-
var fieldClassName = (0, kendo_react_common_1.classNames)({
|
|
13
|
-
'k-form-field': true,
|
|
14
|
-
'k-rtl': props.dir === 'rtl'
|
|
15
|
-
}, props.className);
|
|
16
|
-
return (React.createElement("div", { className: fieldClassName, style: props.style }, props.children));
|
|
17
|
-
};
|
|
18
|
-
exports.FieldWrapper = FieldWrapper;
|
|
19
|
-
exports.FieldWrapper.displayName = 'KendoReactFieldWrapper';
|