@rc-component/form
Advanced tools
+1
-1
@@ -24,3 +24,3 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
| // We use Class instead of Hooks here since it will cost much code by using Hooks. | ||
| class Field extends React.Component { | ||
| class Field extends React.PureComponent { | ||
| static contextType = FieldContext; | ||
@@ -27,0 +27,0 @@ state = { |
+1
-1
@@ -9,3 +9,3 @@ import * as React from 'react'; | ||
| children?: RenderProps | React.ReactNode; | ||
| component?: false | string | React.FC<any> | React.ComponentClass<any>; | ||
| component?: false | string | React.ComponentType<any>; | ||
| fields?: FieldData[]; | ||
@@ -12,0 +12,0 @@ name?: string; |
+18
-17
@@ -8,19 +8,20 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
| import ListContext from "./ListContext"; | ||
| const Form = ({ | ||
| name, | ||
| initialValues, | ||
| fields, | ||
| form, | ||
| preserve, | ||
| children, | ||
| component: Component = 'form', | ||
| validateMessages, | ||
| validateTrigger = 'onChange', | ||
| onValuesChange, | ||
| onFieldsChange, | ||
| onFinish, | ||
| onFinishFailed, | ||
| clearOnDestroy, | ||
| ...restProps | ||
| }, ref) => { | ||
| const Form = (props, ref) => { | ||
| const { | ||
| name, | ||
| initialValues, | ||
| fields, | ||
| form, | ||
| preserve, | ||
| children, | ||
| component: Component = 'form', | ||
| validateMessages, | ||
| validateTrigger = 'onChange', | ||
| onValuesChange, | ||
| onFieldsChange, | ||
| onFinish, | ||
| onFinishFailed, | ||
| clearOnDestroy, | ||
| ...restProps | ||
| } = props; | ||
| const nativeElementRef = React.useRef(null); | ||
@@ -27,0 +28,0 @@ const formContext = React.useContext(FormContext); |
+1
-1
@@ -33,3 +33,3 @@ "use strict"; | ||
| // We use Class instead of Hooks here since it will cost much code by using Hooks. | ||
| class Field extends React.Component { | ||
| class Field extends React.PureComponent { | ||
| static contextType = _FieldContext.default; | ||
@@ -36,0 +36,0 @@ state = { |
+1
-1
@@ -9,3 +9,3 @@ import * as React from 'react'; | ||
| children?: RenderProps | React.ReactNode; | ||
| component?: false | string | React.FC<any> | React.ComponentClass<any>; | ||
| component?: false | string | React.ComponentType<any>; | ||
| fields?: FieldData[]; | ||
@@ -12,0 +12,0 @@ name?: string; |
+18
-17
@@ -17,19 +17,20 @@ "use strict"; | ||
| function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
| const Form = ({ | ||
| name, | ||
| initialValues, | ||
| fields, | ||
| form, | ||
| preserve, | ||
| children, | ||
| component: Component = 'form', | ||
| validateMessages, | ||
| validateTrigger = 'onChange', | ||
| onValuesChange, | ||
| onFieldsChange, | ||
| onFinish, | ||
| onFinishFailed, | ||
| clearOnDestroy, | ||
| ...restProps | ||
| }, ref) => { | ||
| const Form = (props, ref) => { | ||
| const { | ||
| name, | ||
| initialValues, | ||
| fields, | ||
| form, | ||
| preserve, | ||
| children, | ||
| component: Component = 'form', | ||
| validateMessages, | ||
| validateTrigger = 'onChange', | ||
| onValuesChange, | ||
| onFieldsChange, | ||
| onFinish, | ||
| onFinishFailed, | ||
| clearOnDestroy, | ||
| ...restProps | ||
| } = props; | ||
| const nativeElementRef = React.useRef(null); | ||
@@ -36,0 +37,0 @@ const formContext = React.useContext(_FormContext.default); |
+1
-1
| { | ||
| "name": "@rc-component/form", | ||
| "version": "1.8.4", | ||
| "version": "1.8.5", | ||
| "description": "React Form Component", | ||
@@ -5,0 +5,0 @@ "typings": "es/index.d.ts", |
+0
-1
@@ -124,3 +124,2 @@ # rc-field-form | ||
| }; | ||
| render() { | ||
@@ -127,0 +126,0 @@ return <Form ref={this.setRef} />; |
249864
0.03%6480
0.03%286
-0.35%