@progress/kendo-react-form 7.2.4-develop.3 → 7.2.4-develop.4

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/Form.d.ts DELETED
@@ -1,272 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import PropTypes from 'prop-types';
7
- import { FieldValidatorType } from './interfaces/FieldValidator';
8
- import { FormProps } from './interfaces/FormProps';
9
- import { KeyValue } from './interfaces/KeyValue';
10
- /**
11
- * Represents the [KendoReact Form component]({% slug overview_form %}).
12
- *
13
- * @example
14
- * ```jsx
15
- * export const FormInput = (fieldRenderProps) => {
16
- * const onValueChange = React.useCallback(
17
- * (event) => fieldRenderProps.onChange(event.target.value),
18
- * [fieldRenderProps.onChange]
19
- * );
20
- * return (
21
- * <input
22
- * className={'k-input'}
23
- * value={fieldRenderProps.value}
24
- * onChange={onValueChange}
25
- * />
26
- * );
27
- * };
28
- *
29
- * export const App = () => {
30
- * const handleSubmit = (dataItem) => alert(JSON.stringify(dataItem));
31
- * return (
32
- * <Form
33
- * initialValues={{title: ''}}
34
- * onSubmit={handleSubmit}
35
- * render={(formRenderProps) => (
36
- * <div>
37
- * <Field name={'title'} component={FormInput} />
38
- * <button
39
- * className="k-button"
40
- * disabled={!formRenderProps.allowSubmit}
41
- * onClick={formRenderProps.onSubmit}
42
- * >
43
- * Submit
44
- * </button>
45
- * </div>
46
- * )}
47
- * />
48
- * );
49
- * };
50
- *
51
- * ReactDOM.render(<App />, document.querySelector('my-app'));
52
- * ```
53
- */
54
- export declare class Form extends React.Component<FormProps, {}> {
55
- /**
56
- * @hidden
57
- */
58
- static displayName: string;
59
- /**
60
- * @hidden
61
- */
62
- static propTypes: {
63
- initialValues: PropTypes.Requireable<any>;
64
- onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
65
- onSubmitClick: PropTypes.Requireable<(...args: any[]) => any>;
66
- render: PropTypes.Validator<(...args: any[]) => any>;
67
- id: PropTypes.Requireable<string>;
68
- };
69
- private _key?;
70
- private _touched;
71
- private _visited;
72
- private _modified;
73
- private _validatorsByField;
74
- private _values;
75
- private _fields;
76
- private _unmounted;
77
- private _submitted;
78
- /**
79
- * @hidden
80
- */
81
- private _accumulatorTimeout;
82
- /**
83
- * @hidden
84
- */
85
- get touched(): KeyValue<boolean>;
86
- /**
87
- * @hidden
88
- */
89
- set touched(value: KeyValue<boolean>);
90
- /**
91
- * @hidden
92
- */
93
- get visited(): KeyValue<boolean>;
94
- /**
95
- * @hidden
96
- */
97
- set visited(value: KeyValue<boolean>);
98
- /**
99
- * @hidden
100
- */
101
- get modified(): KeyValue<boolean>;
102
- /**
103
- * @hidden
104
- */
105
- set modified(value: KeyValue<boolean>);
106
- /**
107
- * @hidden
108
- */
109
- get validatorsByField(): KeyValue<(FieldValidatorType | FieldValidatorType[] | undefined)[]>;
110
- /**
111
- * @hidden
112
- */
113
- set validatorsByField(value: KeyValue<(FieldValidatorType | FieldValidatorType[] | undefined)[]>);
114
- /**
115
- * @hidden
116
- */
117
- get values(): KeyValue<any>;
118
- /**
119
- * @hidden
120
- */
121
- set values(value: KeyValue<any>);
122
- /**
123
- * @hidden
124
- */
125
- get fields(): string[];
126
- /**
127
- * @hidden
128
- */
129
- get formErrors(): KeyValue<string> | undefined;
130
- /**
131
- * @hidden
132
- */
133
- get errors(): KeyValue<string>;
134
- /**
135
- * @hidden
136
- */
137
- constructor(props: FormProps);
138
- /**
139
- * @hidden
140
- */
141
- componentWillUnmount(): void;
142
- /**
143
- * @hidden
144
- */
145
- isValid: () => boolean;
146
- /**
147
- * @hidden
148
- */
149
- accumulatedForceUpdate: () => void;
150
- /**
151
- * @hidden
152
- */
153
- resetForm: () => void;
154
- /**
155
- * Method for resetting the form state outside the form component.
156
- *
157
- * > Use `onReset` only if you cannot achieve the desired behavior through the Field component or by FormRenderProps.
158
- */
159
- onReset: () => void;
160
- /**
161
- * @hidden
162
- */
163
- addField: (field: string) => void;
164
- /**
165
- * @hidden
166
- */
167
- onSubmit: (event: React.SyntheticEvent<any>) => void;
168
- /**
169
- * Method for emiting changes to a specific field outside the form component.
170
- *
171
- * > Use `onChange` only if you cannot achieve the desired behavior through the Field component by FormRenderProps.
172
- */
173
- onChange: (name: string, options: {
174
- value: any;
175
- }) => void;
176
- /**
177
- * @hidden
178
- */
179
- onFocus: (name: string, skipForceUpdate?: boolean) => void;
180
- /**
181
- * @hidden
182
- */
183
- onBlur: (name: string, skipForceUpdate?: boolean) => void;
184
- /**
185
- * @hidden
186
- */
187
- onFieldRegister: (name: string, validator: FieldValidatorType | FieldValidatorType[] | undefined) => () => void;
188
- /**
189
- * @hidden
190
- */
191
- isFormValid: (errors: KeyValue<any>) => boolean;
192
- /**
193
- * @hidden
194
- */
195
- isFormModified: (modified: KeyValue<boolean>, fields: string[]) => boolean;
196
- /**
197
- * @hidden
198
- */
199
- isFormHasNotTouched: (touched: KeyValue<boolean>, fields: string[]) => boolean;
200
- /**
201
- * @hidden
202
- */
203
- isFormTouched: (touched: KeyValue<boolean>, fields: string[]) => boolean;
204
- /**
205
- * @hidden
206
- */
207
- isFormVisited: (visited: KeyValue<boolean>, fields: string[]) => boolean;
208
- /**
209
- * @hidden
210
- */
211
- valueGetter: (fieldName: string) => any;
212
- /**
213
- * @hidden
214
- */
215
- valueSetter: (fieldName: string, value: any) => any;
216
- /**
217
- * @hidden
218
- */
219
- onArrayAction: (name: string) => void;
220
- /**
221
- * @hidden
222
- */
223
- onInsert: (name: string, options: {
224
- value: any;
225
- index: number;
226
- }) => void;
227
- /**
228
- * @hidden
229
- */
230
- onUnshift: (name: string, options: {
231
- value: any;
232
- }) => void;
233
- /**
234
- * @hidden
235
- */
236
- onPush: (name: string, options: {
237
- value: any;
238
- }) => void;
239
- /**
240
- * @hidden
241
- */
242
- onPop: (name: string) => any;
243
- /**
244
- * @hidden
245
- */
246
- onRemove: (name: string, options: {
247
- index: number;
248
- }) => any;
249
- /**
250
- * @hidden
251
- */
252
- onReplace: (name: string, options: {
253
- value: any;
254
- index: number;
255
- }) => void;
256
- /**
257
- * @hidden
258
- */
259
- onMove: (name: string, options: {
260
- prevIndex: number;
261
- nextIndex: number;
262
- }) => void;
263
- /**
264
- * @hidden
265
- */
266
- render(): import("react/jsx-runtime").JSX.Element;
267
- }
268
- /**
269
- * Represent the `ref` of the Form component.
270
- */
271
- export interface FormHandle extends Pick<Form, keyof Form> {
272
- }
package/FormContext.d.ts DELETED
@@ -1,54 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import { FieldValidatorType } from './interfaces/FieldValidator';
7
- /** @hidden */
8
- export type FormContextType = {
9
- onSubmit: (event: React.SyntheticEvent<any>) => void;
10
- onChange: (name: string, options: {
11
- value: any;
12
- }) => void;
13
- onFocus: (name: string) => void;
14
- onBlur: (name: string) => void;
15
- onUnshift: (name: string, options: {
16
- value: any;
17
- }) => void;
18
- onPush: (name: string, options: {
19
- value: any;
20
- }) => void;
21
- onInsert: (name: string, options: {
22
- index: number;
23
- value: any;
24
- }) => void;
25
- onPop: (name: string) => any;
26
- onRemove: (name: string, options: {
27
- index: number;
28
- }) => any;
29
- onReplace: (name: string, options: {
30
- index: number;
31
- value: any;
32
- }) => void;
33
- onMove: (name: string, options: {
34
- prevIndex: number;
35
- nextIndex: number;
36
- }) => void;
37
- registerField: (name: string, validator: FieldValidatorType | FieldValidatorType[] | undefined) => void;
38
- valueGetter: (name: string) => any;
39
- errors: {
40
- [name: string]: string;
41
- };
42
- touched: {
43
- [name: string]: boolean;
44
- };
45
- visited: {
46
- [name: string]: boolean;
47
- };
48
- modified: {
49
- [name: string]: boolean;
50
- };
51
- id: string;
52
- };
53
- /** @hidden */
54
- export declare const FormContext: React.Context<FormContextType | null>;
package/FormElement.d.ts DELETED
@@ -1,56 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- /**
7
- * Represents the props of the KendoReact FormElement component.
8
- */
9
- export interface FormElementProps {
10
- /**
11
- * @hidden
12
- */
13
- children: any;
14
- /**
15
- * The styles that are applied to the form DOM element.
16
- */
17
- style?: React.CSSProperties;
18
- /**
19
- * Sets a class of the form DOM element.
20
- */
21
- className?: string;
22
- /**
23
- * If set to `true` enable the horizontal layout of the form editors.
24
- */
25
- horizontal?: boolean;
26
- /**
27
- * @hidden
28
- */
29
- [customProp: string]: any;
30
- /**
31
- * Configures the `size` of the Form.
32
- *
33
- * The available options are:
34
- * - small
35
- * - medium
36
- * - large
37
- * - null&mdash;Does not set a size `className`.
38
- *
39
- * @default `medium`
40
- */
41
- size?: null | 'small' | 'medium' | 'large';
42
- }
43
- /**
44
- * Represent the `ref` of the FormElement component.
45
- */
46
- export interface FormElementHandle {
47
- props: FormElementProps;
48
- element: HTMLFormElement | null;
49
- }
50
- /**
51
- * Represents the KendoReact FormElement component.
52
- * It's small wrapper around HTML form element which automatically attach the
53
- * Form component's `onSubmit` render prop and Kendo CSS classes.
54
- * Other props are passed to the DOM node.
55
- */
56
- export declare const FormElement: React.FunctionComponent<FormElementProps>;
@@ -1,32 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { FieldValidatorType } from './FieldValidator';
6
- /**
7
- * Represents the props of the FieldArray component that is used inside the KendoReact Form component.
8
- */
9
- export interface FieldArrayProps {
10
- /**
11
- * The name of the field in the Form state.
12
- */
13
- name: string;
14
- /**
15
- * Can be set to a React component.
16
- * [`FieldArrayRenderProps`]({% slug api_form_fieldarrayrenderprops %}).
17
- */
18
- component: React.ComponentType<any>;
19
- /**
20
- * The validation functions for the FieldArray level.
21
- * Currently, `validator` supports only synchronous functions.
22
- */
23
- validator?: FieldValidatorType | FieldValidatorType[];
24
- /**
25
- * The React elements that are passed as children to the rendered component.
26
- */
27
- children?: any;
28
- /**
29
- * @hidden
30
- */
31
- [customProp: string]: any;
32
- }
@@ -1,93 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * Represents the props that are passed to the component which is rendered by FieldArray.
7
- */
8
- export interface FieldArrayRenderProps {
9
- /**
10
- * Represents the current value of the FieldArray
11
- * ([see example]({% slug custom_components_form %}#toc-using-basic-properties)).
12
- */
13
- value: any;
14
- /**
15
- * Represents the error message that is returned by the validator.
16
- * The FieldArray is considered valid if the `validationMessage` field is empty.
17
- */
18
- validationMessage: string | null;
19
- /**
20
- * Indicates if the field is touched.
21
- * The touched state is set to `true` when the `onBlur` callback is called.
22
- */
23
- touched: boolean;
24
- /**
25
- * Indicates if the field is modified.
26
- * The modified state is set to `true` when the `onChange` callback for the current field is called for first time.
27
- */
28
- modified: boolean;
29
- /**
30
- * Indicates if the field is visited.
31
- * The visited state is set to `true` when the `onFocus` callback is called.
32
- */
33
- visited: boolean;
34
- /**
35
- * A calculated property based on whether `validationMessage` is present and the `touched` state is set to `true`.
36
- */
37
- valid: boolean;
38
- /**
39
- * Represents the children that are passed to the FieldArray.
40
- */
41
- children: any;
42
- /**
43
- * The name of the field in the Form state.
44
- */
45
- name: string;
46
- /**
47
- * A callback to add a value to the beginning of the array.
48
- */
49
- onUnshift: (options: {
50
- value: any;
51
- }) => number;
52
- /**
53
- * A callback to add a value to the end of the array.
54
- */
55
- onPush: (options: {
56
- value: any;
57
- }) => void;
58
- /**
59
- * A callback to insert value at given index of the array.
60
- */
61
- onInsert: (options: {
62
- value: any;
63
- index: number;
64
- }) => void;
65
- /**
66
- * A callback to remove a value from the end of the array. The value is returned.
67
- */
68
- onPop: () => any;
69
- /**
70
- * A callback to remove a value from given index of the array.
71
- */
72
- onRemove: (options: {
73
- index: number;
74
- }) => any;
75
- /**
76
- * A callback to replace value at given index of the array.
77
- */
78
- onReplace: (options: {
79
- value: any;
80
- index: number;
81
- }) => void;
82
- /**
83
- * A callback to move a value from one index to another. Useful for drag and drop reordering.
84
- */
85
- onMove: (options: {
86
- prevIndex: number;
87
- nextIndex: number;
88
- }) => void;
89
- /**
90
- * @hidden
91
- */
92
- [customProp: string]: any;
93
- }
@@ -1,43 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { FieldValidatorType } from './FieldValidator';
6
- /**
7
- * Represents the props of the Field component that is used inside the KendoReact Form component.
8
- */
9
- export interface FieldProps {
10
- /**
11
- * The name of the field in the Form state.
12
- * Supports nested fields in the `user.age` and `users[index].name` formats.
13
- */
14
- name: string;
15
- /**
16
- * Can be set to a React component or to the name of an HTML element,
17
- * for example, `input`, `select`, and `textarea`.
18
- * The props that are passed to component are the
19
- * [`FieldRenderProps`]({% slug api_form_fieldrenderprops %}).
20
- */
21
- component: string | React.ComponentType<any>;
22
- /**
23
- * The validation functions for the Field level.
24
- * Currently, `validator` supports only synchronous functions.
25
- * Using the array overload with inline array will cause an infinite loop - in this case use a `useMemo` hook to memoize the array.
26
- */
27
- validator?: FieldValidatorType | FieldValidatorType[];
28
- /**
29
- * The React elements that are passed as children to the rendered component.
30
- */
31
- children?: any;
32
- /**
33
- * Called when underlying editor triggers it's `onChange` event and the Form update it's internal state.
34
- * Useful for updating related fields.
35
- * > The `Form` listens to this editor event and automatically keeps it's internal state up to date.
36
- * That why this event should be used only for executing custom logic.
37
- */
38
- onChange?: (event: any) => void;
39
- /**
40
- * @hidden
41
- */
42
- [customProp: string]: any;
43
- }
@@ -1,10 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { FieldRenderPropsBase } from '@progress/kendo-react-common';
6
- /**
7
- * Represents the props that are passed to the component which is rendered by Field.
8
- */
9
- export interface FieldRenderProps extends FieldRenderPropsBase {
10
- }
@@ -1,18 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * The validator function for the Field component. The function arguments are:
7
- *
8
- * * value - The current value of the field.
9
- * * valueGetter - Function which can be used to get other fields value.
10
- * Usable when validator depends on more than one field. Supports field paths.
11
- * * fieldProps - Props of the Field component. Currently contains only the `name` prop.
12
- * Usable when one validator is used across multiple fields.
13
- *
14
- * Returns `string` to signify error or `undefined` to signify validation success.
15
- */
16
- export type FieldValidatorType = (value: any, valueGetter: (name: string) => any, fieldProps: {
17
- name: string;
18
- }) => string | undefined;
@@ -1,56 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { FormRenderProps } from './FormRenderProps';
6
- import { FormValidatorType } from './FormValidator';
7
- import { FormSubmitClickEvent } from './FormSubmitClickEvent';
8
- /**
9
- * Represents the props of the KendoReact Form component.
10
- */
11
- export interface FormProps {
12
- /**
13
- * The initial field values of the Form.
14
- *
15
- * > When you initialize the Form felds, set initial values to them. Otherwise, some
16
- * components might throw errors related to switching from uncontrolled to controlled mode.
17
- */
18
- initialValues?: {
19
- [name: string]: any;
20
- };
21
- /**
22
- * The validation function for the Form level.
23
- * Should return key-value pair where the key is the field path and the value is the error message.
24
- * Nested fields are supported, e.g.: 'users[0].name'.
25
- * You can use the same field path to access the value from the
26
- * values object using the `getter` function from the `kendo-react-common` package.
27
- * Currently, `validator` supports only synchronous functions.
28
- */
29
- validator?: FormValidatorType;
30
- /**
31
- * The submission handler for the Form.
32
- * Called when at least one field has been modified, the user pressed the **Submit** button, and the form validation was successful.
33
- */
34
- onSubmit?: (values: {
35
- [name: string]: any;
36
- }, event?: React.SyntheticEvent<any>) => void;
37
- /**
38
- * Called every time the user presses the **Submit** button.
39
- * Useful in advanced scenarios when you need to handle every submit event, even when the form is invalid or not modified state.
40
- */
41
- onSubmitClick?: (event: FormSubmitClickEvent) => void;
42
- /**
43
- * The Form content that will be rendered.
44
- */
45
- render: (props: FormRenderProps) => any;
46
- /**
47
- * Set this to `true` to allow the form submit without modifed fields.
48
- */
49
- ignoreModified?: boolean;
50
- /**
51
- * @hidden
52
- * This prop comes from the `withId` HOC and is used internally by the Form.
53
- * It replaces the previously used guid() function and generates an `id` of the Form.
54
- */
55
- id?: string;
56
- }