@progress/kendo-react-form 6.1.1-dev.202311151536 → 7.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{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,52 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the props of the KendoReact FormElement component.
|
|
4
|
-
*/
|
|
5
|
-
export interface FormElementProps {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
children: any;
|
|
10
|
-
/**
|
|
11
|
-
* The styles that are applied to the form DOM element.
|
|
12
|
-
*/
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
/**
|
|
15
|
-
* Sets a class of the form DOM element.
|
|
16
|
-
*/
|
|
17
|
-
className?: string;
|
|
18
|
-
/**
|
|
19
|
-
* If set to `true` enable the horizontal layout of the form editors.
|
|
20
|
-
*/
|
|
21
|
-
horizontal?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
25
|
-
[customProp: string]: any;
|
|
26
|
-
/**
|
|
27
|
-
* Configures the `size` of the Form.
|
|
28
|
-
*
|
|
29
|
-
* The available options are:
|
|
30
|
-
* - small
|
|
31
|
-
* - medium
|
|
32
|
-
* - large
|
|
33
|
-
* - null—Does not set a size `className`.
|
|
34
|
-
*
|
|
35
|
-
* @default `medium`
|
|
36
|
-
*/
|
|
37
|
-
size?: null | 'small' | 'medium' | 'large';
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Represent the `ref` of the FormElement component.
|
|
41
|
-
*/
|
|
42
|
-
export interface FormElementHandle {
|
|
43
|
-
props: FormElementProps;
|
|
44
|
-
element: HTMLFormElement | null;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Represents the KendoReact FormElement component.
|
|
48
|
-
* It's small wrapper around HTML form element which automatically attach the
|
|
49
|
-
* Form component's `onSubmit` render prop and Kendo CSS classes.
|
|
50
|
-
* Other props are passed to the DOM node.
|
|
51
|
-
*/
|
|
52
|
-
export declare const FormElement: React.FunctionComponent<FormElementProps>;
|
package/dist/npm/FormElement.js
DELETED
|
@@ -1,52 +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.FormElement = void 0;
|
|
26
|
-
var React = require("react");
|
|
27
|
-
var kendo_react_common_1 = require("@progress/kendo-react-common");
|
|
28
|
-
var FormContext_1 = require("./FormContext");
|
|
29
|
-
/**
|
|
30
|
-
* Represents the KendoReact FormElement component.
|
|
31
|
-
* It's small wrapper around HTML form element which automatically attach the
|
|
32
|
-
* Form component's `onSubmit` render prop and Kendo CSS classes.
|
|
33
|
-
* Other props are passed to the DOM node.
|
|
34
|
-
*/
|
|
35
|
-
exports.FormElement = React.forwardRef(function (props, ref) {
|
|
36
|
-
var _a;
|
|
37
|
-
var combinedProps = __assign({ size: 'medium' }, props);
|
|
38
|
-
var element = React.useRef(null);
|
|
39
|
-
var target = React.useRef(null);
|
|
40
|
-
React.useImperativeHandle(target, function () { return ({ element: element.current, props: combinedProps }); });
|
|
41
|
-
React.useImperativeHandle(ref, function () { return target.current; });
|
|
42
|
-
var form = React.useContext(FormContext_1.FormContext);
|
|
43
|
-
var className = combinedProps.className, style = combinedProps.style, horizontal = combinedProps.horizontal, size = combinedProps.size, others = __rest(combinedProps, ["className", "style", "horizontal", "size"]);
|
|
44
|
-
var formClassName = (0, kendo_react_common_1.classNames)((_a = {
|
|
45
|
-
'k-form': true
|
|
46
|
-
},
|
|
47
|
-
_a["k-form-".concat(kendo_react_common_1.kendoThemeMaps.sizeMap[size] || size)] = size,
|
|
48
|
-
_a['k-form-horizontal'] = horizontal === true,
|
|
49
|
-
_a), className);
|
|
50
|
-
return (React.createElement("form", __assign({ ref: element }, others, { style: props.style, className: formClassName, onSubmit: form ? form.onSubmit : undefined }), props.children));
|
|
51
|
-
});
|
|
52
|
-
exports.FormElement.displayName = 'KendoReactFormElement';
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents the props that are passed to the component which is rendered by Field.
|
|
3
|
-
*/
|
|
4
|
-
export interface FieldRenderProps {
|
|
5
|
-
/**
|
|
6
|
-
* A callback you have to call when the value of the rendered component is changed
|
|
7
|
-
* ([see example]({% slug common_scenarios_form %}#toc-changing-the-field-value)).
|
|
8
|
-
* The `value` property of the event takes precedence over `target.value`.
|
|
9
|
-
*/
|
|
10
|
-
onChange: (event: {
|
|
11
|
-
target?: any;
|
|
12
|
-
value?: any;
|
|
13
|
-
}) => void;
|
|
14
|
-
/**
|
|
15
|
-
* A callback you have to call when the rendered component is focused.
|
|
16
|
-
* Responsible for setting the visited state of the Field.
|
|
17
|
-
*/
|
|
18
|
-
onFocus: () => void;
|
|
19
|
-
/**
|
|
20
|
-
* A callback you have to call when the rendered component is blurred.
|
|
21
|
-
* Responsible for setting the touched state of the Field.
|
|
22
|
-
*/
|
|
23
|
-
onBlur: () => void;
|
|
24
|
-
/**
|
|
25
|
-
* Represents the current value of the Field
|
|
26
|
-
* ([see example]({% slug custom_components_form %}#toc-using-basic-properties)).
|
|
27
|
-
*/
|
|
28
|
-
value: any;
|
|
29
|
-
/**
|
|
30
|
-
* Represents the error message that is returned by the validator.
|
|
31
|
-
* The Field is considered valid if the `validationMessage` field is empty.
|
|
32
|
-
*/
|
|
33
|
-
validationMessage: string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Indicates if the field is touched.
|
|
36
|
-
* The touched state is set to `true` when the `onBlur` callback is called.
|
|
37
|
-
*/
|
|
38
|
-
touched: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Indicates if the field is modified.
|
|
41
|
-
* The modified state is set to `true` when the `onChange` callback for the current field is called for first time.
|
|
42
|
-
*/
|
|
43
|
-
modified: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Indicates if the field is visited.
|
|
46
|
-
* The visited state is set to `true` when the `onFocus` callback is called.
|
|
47
|
-
*/
|
|
48
|
-
visited: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* A calculated property based on whether `validationMessage` is present and the `touched` state is set to `true`.
|
|
51
|
-
*/
|
|
52
|
-
valid: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Represents the children that are passed to the Field.
|
|
55
|
-
*/
|
|
56
|
-
children: any;
|
|
57
|
-
/**
|
|
58
|
-
* The name of the field in the Form state.
|
|
59
|
-
*/
|
|
60
|
-
name: string;
|
|
61
|
-
/**
|
|
62
|
-
* @hidden
|
|
63
|
-
*/
|
|
64
|
-
[customProp: string]: any;
|
|
65
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The validator function for the Field component. The function arguments are:
|
|
3
|
-
*
|
|
4
|
-
* * value - The current value of the field.
|
|
5
|
-
* * valueGetter - Function which can be used to get other fields value.
|
|
6
|
-
* Usable when validator depends on more than one field. Supports field paths.
|
|
7
|
-
* * fieldProps - Props of the Field component. Currently contains only the `name` prop.
|
|
8
|
-
* Usable when one validator is used across multiple fields.
|
|
9
|
-
*
|
|
10
|
-
* Returns `string` to signify error or `undefined` to signify validation success.
|
|
11
|
-
*/
|
|
12
|
-
export declare type FieldValidatorType = (value: any, valueGetter: (name: string) => any, fieldProps: {
|
|
13
|
-
name: string;
|
|
14
|
-
}) => string | undefined;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormRenderProps } from './FormRenderProps';
|
|
3
|
-
import { FormValidatorType } from './FormValidator';
|
|
4
|
-
import { FormSubmitClickEvent } from './FormSubmitClickEvent';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the props of the KendoReact Form component.
|
|
7
|
-
*/
|
|
8
|
-
export interface FormProps {
|
|
9
|
-
/**
|
|
10
|
-
* The initial field values of the Form.
|
|
11
|
-
*
|
|
12
|
-
* > When you initialize the Form felds, set initial values to them. Otherwise, some
|
|
13
|
-
* components might throw errors related to switching from uncontrolled to controlled mode.
|
|
14
|
-
*/
|
|
15
|
-
initialValues?: {
|
|
16
|
-
[name: string]: any;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The validation function for the Form level.
|
|
20
|
-
* Should return key-value pair where the key is the field path and the value is the error message.
|
|
21
|
-
* Nested fields are supported, e.g.: 'users[0].name'.
|
|
22
|
-
* You can use the same field path to access the value from the
|
|
23
|
-
* values object using the `getter` function from the `kendo-react-common` package.
|
|
24
|
-
* Currently, `validator` supports only synchronous functions.
|
|
25
|
-
*/
|
|
26
|
-
validator?: FormValidatorType;
|
|
27
|
-
/**
|
|
28
|
-
* The submission handler for the Form.
|
|
29
|
-
* Called when at least one field has been modified, the user pressed the **Submit** button, and the form validation was successful.
|
|
30
|
-
*/
|
|
31
|
-
onSubmit?: (values: {
|
|
32
|
-
[name: string]: any;
|
|
33
|
-
}, event?: React.SyntheticEvent<any>) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Called every time the user presses the **Submit** button.
|
|
36
|
-
* Useful in advanced scenarios when you need to handle every submit event, even when the form is invalid or not modified state.
|
|
37
|
-
*/
|
|
38
|
-
onSubmitClick?: (event: FormSubmitClickEvent) => void;
|
|
39
|
-
/**
|
|
40
|
-
* The Form content that will be rendered.
|
|
41
|
-
*/
|
|
42
|
-
render: (props: FormRenderProps) => any;
|
|
43
|
-
/**
|
|
44
|
-
* Set this to `true` to allow the form submit without modifed fields.
|
|
45
|
-
*/
|
|
46
|
-
ignoreModified?: boolean;
|
|
47
|
-
}
|
|
@@ -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;
|
package/dist/npm/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/npm/main.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FormElement = exports.FieldWrapper = exports.Form = exports.Field = exports.FieldArray = void 0;
|
|
4
|
-
var Field_1 = require("./Field");
|
|
5
|
-
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return Field_1.Field; } });
|
|
6
|
-
var Form_1 = require("./Form");
|
|
7
|
-
Object.defineProperty(exports, "Form", { enumerable: true, get: function () { return Form_1.Form; } });
|
|
8
|
-
var FieldArray_1 = require("./FieldArray");
|
|
9
|
-
Object.defineProperty(exports, "FieldArray", { enumerable: true, get: function () { return FieldArray_1.FieldArray; } });
|
|
10
|
-
var FieldWrapper_1 = require("./FieldWrapper");
|
|
11
|
-
Object.defineProperty(exports, "FieldWrapper", { enumerable: true, get: function () { return FieldWrapper_1.FieldWrapper; } });
|
|
12
|
-
var FormElement_1 = require("./FormElement");
|
|
13
|
-
Object.defineProperty(exports, "FormElement", { enumerable: true, get: function () { return FormElement_1.FormElement; } });
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.packageMetadata = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
exports.packageMetadata = {
|
|
8
|
-
name: '@progress/kendo-react-form',
|
|
9
|
-
productName: 'KendoReact',
|
|
10
|
-
productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
|
|
11
|
-
publishDate: 1700060228,
|
|
12
|
-
version: '',
|
|
13
|
-
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'
|
|
14
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
System.register("@progress/kendo-react-form",["@progress/kendo-react-common","prop-types","react"],function(e,t){var c={},d={},f={};return Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(d,"__esModule",{value:!0}),Object.defineProperty(f,"__esModule",{value:!0}),{setters:[function(t){Object.keys(t).forEach(function(e){c[e]=t[e]})},function(t){Object.keys(t).forEach(function(e){d[e]=t[e]})},function(t){Object.keys(t).forEach(function(e){f[e]=t[e]})}],execute:function(){e((()=>{"use strict";var r={303:function(e,t,r){var f=this&&this.__assign||function(){return(f=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},p=this&&this.__rest||function(e,t){var r={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},m=(Object.defineProperty(t,"__esModule",{value:!0}),t.Field=void 0,r(954)),v=r(779);t.Field=function(e){var t,r=e.name,o=e.component,n=e.validator,i=e.children,a=e.onChange,e=p(e,["name","component","validator","children","onChange"]),u=m.useContext(v.FormContext),s=u?u.id:"",l=(m.useEffect(function(){if(u)return u.registerField(r,n)},[r,s,n]),m.useCallback(function(e){var t=e&&(void 0!==e.value?e.value:e.target&&e.target.value);u.onChange(r,{value:t}),a&&a.call(void 0,e)},[r,s,a])),c=m.useCallback(function(e){return u.onChange(r,{value:e.target.value})},[r,s]),d=m.useCallback(function(){return u.onBlur(r)},[r,s]),s=m.useCallback(function(){return u.onFocus(r)},[r,s]);return u?(t=u.valueGetter(r),"string"==typeof o?m.createElement(o,f({onChange:c,onBlur:d,onFocus:s,value:t,children:i},e)):m.createElement(o,f(f({children:i},e),{onChange:l,onBlur:d,onFocus:s,value:t,validationMessage:u.errors[r],touched:u.touched[r],modified:u.modified[r],visited:u.visited[r],valid:!(Boolean(u.errors[r])&&u.touched[r]),name:r}))):null},t.Field.displayName="KendoReactField"},920:function(e,t,r){var m=this&&this.__assign||function(){return(m=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},v=this&&this.__rest||function(e,t){var r={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},h=(Object.defineProperty(t,"__esModule",{value:!0}),t.FieldArray=void 0,r(954)),y=r(779);t.FieldArray=function(e){var t,r=e.name,o=e.component,n=e.validator,i=(e.type,e.children),e=v(e,["name","component","validator","type","children"]),a=h.useContext(y.FormContext),u=a?a.id:"",s=(h.useEffect(function(){if(a)return a.registerField(r,n)},[r,u,n]),h.useCallback(function(e){return a.onUnshift(r,e)},[r,u])),l=h.useCallback(function(e){return a.onPush(r,e)},[r,u]),c=h.useCallback(function(e){return a.onInsert(r,e)},[r,u]),d=h.useCallback(function(){return a.onPop(r)},[r,u]),f=h.useCallback(function(e){return a.onRemove(r,e)},[r,u]),p=h.useCallback(function(e){return a.onReplace(r,e)},[r,u]),u=h.useCallback(function(e){return a.onMove(r,e)},[r,u]);return a?(t=a.valueGetter(r),h.createElement(o,m({value:t,validationMessage:a.errors[r],touched:a.touched[r],modified:a.modified[r],visited:a.visited[r],valid:!(Boolean(a.errors[r])&&a.touched[r]),onUnshift:s,onPush:l,onInsert:c,onPop:d,onRemove:f,onReplace:p,onMove:u,children:i,name:r},e))):null},t.FieldArray.displayName="KendoReactFieldArray"},113:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FieldWrapper=void 0;var o=r(954),n=r(811);t.FieldWrapper=function(e){var t=(0,n.classNames)({"k-form-field":!0,"k-rtl":"rtl"===e.dir},e.className);return o.createElement("div",{className:t,style:e.style},e.children)},t.FieldWrapper.displayName="KendoReactFieldWrapper"},446:function(e,t,r){var o,n,i=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},u=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||((o=o||Array.prototype.slice.call(t,0,n))[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},c=(Object.defineProperty(t,"__esModule",{value:!0}),t.Form=void 0,r(954)),s=r(895),d=r(779),l=r(811),f=r(811),p=r(363),r=(n=c.Component,i(m,n),Object.defineProperty(m.prototype,"touched",{get:function(){return this._touched},set:function(e){this._touched=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"visited",{get:function(){return this._visited},set:function(e){this._visited=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"modified",{get:function(){return this._modified},set:function(e){this._modified=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"validatorsByField",{get:function(){return this._validatorsByField},set:function(e){this._validatorsByField=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"values",{get:function(){return this._values},set:function(e){this._values=e},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"fields",{get:function(){return Object.keys(this._fields)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"formErrors",{get:function(){if(this.props.validator)return this.props.validator(this.values,this.valueGetter)},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"errors",{get:function(){var o=this,n={},e=this.fields,i=this.validatorsByField;return e.forEach(function(t){var r;n[t]="",i[t]&&(r=[],i[t].forEach(function(e){Array.isArray(e)?r.push.apply(r,e):r.push(e)}),r.find(function(e){if(e){e=e(o.valueGetter(t),o.valueGetter,{name:t});if(e)return n[t]=e,!0}return!1}))}),this.formErrors&&(0,l.cloneObject)(this.formErrors,n),n},enumerable:!1,configurable:!0}),m.prototype.componentWillUnmount=function(){this._unmounted=!0,this._accumulatorTimeout&&clearTimeout(this._accumulatorTimeout)},m.prototype.render=function(){var e=this.props.render,t=this.touched,r=this.visited,o=this.modified,n=this.fields,i=this.errors,a=this.isFormValid(i),u=this.isFormModified(o,n),s=this.isFormTouched(t,n),l=this.isFormVisited(r,n),n=this.isFormHasNotTouched(t,n)&&!a||a&&(this.props.ignoreModified||u);return c.createElement(d.FormContext.Provider,{key:this._id,value:{id:this._id,valueGetter:this.valueGetter,errors:i,modified:o,touched:t,visited:r,registerField:this.onFieldRegister,onSubmit:this.onSubmit,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onUnshift:this.onUnshift,onPush:this.onPush,onInsert:this.onInsert,onPop:this.onPop,onRemove:this.onRemove,onReplace:this.onReplace,onMove:this.onMove}},e({valid:a,modified:u,touched:s,visited:l,submitted:this._submitted,valueGetter:this.valueGetter,errors:i,allowSubmit:n,onChange:this.onChange,onSubmit:this.onSubmit,onFormReset:this.resetForm}))},m.displayName="KendoReactForm",m.propTypes={initialValues:s.any,onSubmit:s.func,onSubmitClick:s.func,render:s.func.isRequired},m);function m(e){var i=n.call(this,e)||this;return i._id=(0,l.guid)(),i._touched={},i._visited={},i._modified={},i._validatorsByField={},i._values={},i._fields={},i._unmounted=!1,i._submitted=!1,i.isValid=function(){return i.isFormValid(i.errors)},i.accumulatedForceUpdate=function(){i._accumulatorTimeout&&clearTimeout(i._accumulatorTimeout),i._accumulatorTimeout=window.setTimeout(function(){i._accumulatorTimeout=void 0,i.forceUpdate()},0)},i.resetForm=function(){i.values=(0,l.clone)(i.props.initialValues),i._id=(0,l.guid)(),i._touched={},i._visited={},i._modified={},i._validatorsByField={},i._fields={},i._submitted=!1,i.forceUpdate()},i.onReset=function(){return i.resetForm()},i.addField=function(e){i._fields[e]=!0},i.onSubmit=function(e){var t={},r=i.fields,o=(e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation)&&e.stopPropagation(),r.forEach(function(e){t[e]=!0}),i.visited=a({},t),i.touched=a({},t),i.values),n=i.isFormValid(i.errors),r=i.isFormModified(i.modified,r);i.props.onSubmitClick&&i.props.onSubmitClick.call(void 0,{values:o,isValid:n,isModified:r,event:e}),n&&(i.props.ignoreModified||r)&&i.props.onSubmit&&(i._submitted=!0,i.props.onSubmit.call(void 0,o,e)),i.forceUpdate()},i.onChange=function(e,t){var r,t=t.value;i.addField(e),i.modified[e]||(i.modified=a(a({},i.modified),((r={})[e]=!0,r))),i.valueSetter(e,t),i.forceUpdate()},i.onFocus=function(e,t){var r;i.visited[e]||(i.visited=a(a({},i.visited),((r={})[e]=!0,r)),t)||i.forceUpdate()},i.onBlur=function(e,t){var r;i.touched[e]||(i.onFocus(e,t),i.touched=a(a({},i.touched),((r={})[e]=!0,r)),t)||i.forceUpdate()},i.onFieldRegister=function(o,e){i.addField(o);var t,r=i.validatorsByField[o]||[],n=r.length;return i.validatorsByField=a(a({},i.validatorsByField),((t={})[o]=u(u([],r,!0),[e],!1),t)),i.accumulatedForceUpdate(),function(){var e,t,r;i._unmounted||(t=u([],i.validatorsByField[o]||[],!0),r=Boolean(t[n]),t[n]=void 0,i.validatorsByField=a(a({},i.validatorsByField),((e={})[o]=t,e)),r&&i.accumulatedForceUpdate())}},i.isFormValid=function(t){return!Object.keys(t).some(function(e){return Boolean(t[e])})},i.isFormModified=function(t,e){return e.some(function(e){return t[e]})},i.isFormHasNotTouched=function(t,e){return e.some(function(e){return!t[e]})},i.isFormTouched=function(t,e){return e.some(function(e){return t[e]})},i.isFormVisited=function(t,e){return e.some(function(e){return t[e]})},i.valueGetter=function(e){return(0,l.getter)(e)(i.values)},i.valueSetter=function(e,t){return(0,l.setter)(e)(i.values,t)},i.onArrayAction=function(e){var t;i.addField(e),i.modified[e]||(i.modified=a(a({},i.modified),((t={})[e]=!0,t))),i.onBlur(e,!0)},i.onInsert=function(e,t){i.onArrayAction(e);var r=u([],i.valueGetter(e)||[],!0);r.splice(t.index,0,t.value),i.valueSetter(e,r),i.forceUpdate()},i.onUnshift=function(e,t){i.onInsert(e,{value:t.value,index:0})},i.onPush=function(e,t){i.onArrayAction(e);t=u(u([],i.valueGetter(e)||[],!0),[t.value],!1);i.valueSetter(e,t),i.forceUpdate()},i.onPop=function(e){i.onArrayAction(e);var t=u([],i.valueGetter(e)||[],!0),r=t.pop();return i.valueSetter(e,t),i.forceUpdate(),r},i.onRemove=function(e,t){i.onArrayAction(e);var r=u([],i.valueGetter(e)||[],!0),t=r.splice(t.index,1);return i.valueSetter(e,r),i.forceUpdate(),t},i.onReplace=function(e,t){i.onArrayAction(e);var r=u([],i.valueGetter(e)||[],!0);r.splice(t.index,1,t.value),i.valueSetter(e,r),i.forceUpdate()},i.onMove=function(e,t){i.onArrayAction(e);var r=u([],i.valueGetter(e)||[],!0),o=r[t.prevIndex];r.splice(t.prevIndex,1),r.splice(t.nextIndex,0,o),i.valueSetter(e,r),i.forceUpdate()},(0,f.validatePackage)(p.packageMetadata),i.values=(0,l.clone)(e.initialValues),i}t.Form=r},779:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FormContext=void 0;r=r(954);t.FormContext=r.createContext(null)},266:function(e,t,r){var c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},d=this&&this.__rest||function(e,t){var r={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r},f=(Object.defineProperty(t,"__esModule",{value:!0}),t.FormElement=void 0,r(954)),p=r(811),m=r(779);t.FormElement=f.forwardRef(function(e,t){var r,o=c({size:"medium"},e),n=f.useRef(null),i=f.useRef(null),t=(f.useImperativeHandle(i,function(){return{element:n.current,props:o}}),f.useImperativeHandle(t,function(){return i.current}),f.useContext(m.FormContext)),a=o.className,u=(o.style,o.horizontal),s=o.size,l=d(o,["className","style","horizontal","size"]),s=(0,p.classNames)(((r={"k-form":!0})["k-form-".concat(p.kendoThemeMaps.sizeMap[s]||s)]=s,r["k-form-horizontal"]=!0===u,r),a);return f.createElement("form",c({ref:n},l,{style:e.style,className:s,onSubmit:t?t.onSubmit:void 0}),e.children)}),t.FormElement.displayName="KendoReactFormElement"},363:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.packageMetadata=void 0,t.packageMetadata={name:"@progress/kendo-react-form",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1700060228,version:"",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"}},811:e=>{e.exports=c},895:e=>{e.exports=d},954:e=>{e.exports=f}},o={};function n(e){var t=o[e];return void 0!==t||(t=o[e]={exports:{}},r[e].call(t.exports,t,t.exports,n)),t.exports}var e,t,i,a,u,s,l={};return e=l,Object.defineProperty(e,"__esModule",{value:!0}),e.FormElement=e.FieldWrapper=e.Form=e.Field=e.FieldArray=void 0,t=n(303),Object.defineProperty(e,"Field",{enumerable:!0,get:function(){return t.Field}}),i=n(446),Object.defineProperty(e,"Form",{enumerable:!0,get:function(){return i.Form}}),a=n(920),Object.defineProperty(e,"FieldArray",{enumerable:!0,get:function(){return a.FieldArray}}),u=n(113),Object.defineProperty(e,"FieldWrapper",{enumerable:!0,get:function(){return u.FieldWrapper}}),s=n(266),Object.defineProperty(e,"FormElement",{enumerable:!0,get:function(){return s.FormElement}}),l})())}}});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Browser, By } from '@progress/kendo-e2e';
|
|
2
|
-
|
|
3
|
-
let browser: Browser;
|
|
4
|
-
|
|
5
|
-
beforeAll(() => {
|
|
6
|
-
browser = new Browser();
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await browser.navigateTo('http://localhost:3000/form/overview');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
afterEach(async () => {
|
|
14
|
-
expect(await browser.getErrorLogs()).toEqual([]);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
afterAll(async () => {
|
|
18
|
-
await browser.close();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should not have errors', async () => {
|
|
22
|
-
expect(await browser.isVisible(By.css('.k-form-field'))).toBe(true);
|
|
23
|
-
});
|