From e9f2c04eb5aae22e107caa714fbc0c733f30c77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E9=80=A2?= Date: Tue, 26 Nov 2019 17:18:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FieldEditor.tsx | 43 ++++++------------- .../src/utils/fieldEditorHelpers.ts | 2 +- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/packages/react-schema-editor/src/components/FieldEditor.tsx b/packages/react-schema-editor/src/components/FieldEditor.tsx index ab0f585ccc1..f877491bc90 100644 --- a/packages/react-schema-editor/src/components/FieldEditor.tsx +++ b/packages/react-schema-editor/src/components/FieldEditor.tsx @@ -59,12 +59,7 @@ const FormItemGroup: React.FC = ({ const componentPropsValue = getComponentPropsValue({ schema, propsKey }) - const handleXComponentPropsValueChange = ( - value, - property, - schema, - propsKey - ) => { + const handleXComponentPropsValueChange = (value, property) => { const newSchema = { ...schema } if (propsKey === ComponentPropsTypes.X_RULES) { const newRules = _.map(schema[propsKey], rule => { @@ -83,10 +78,10 @@ const FormItemGroup: React.FC = ({ onChange(newSchema) } - const handleInputTypeChange = (inputType, property, schema, propsKey) => { + const handleInputTypeChange = (value, property) => { const newSchema = { ...schema } let defaultValue - switch (inputType) { + switch (value) { case InputTypes.INPUT: { defaultValue = '' break @@ -230,7 +225,7 @@ const FormItemGroup: React.FC = ({ handlePropertyChange(value, property) }} > - {componentPropsData.options.map(({ label, value }) => ( + {_.map(componentPropsData.options, ({ label, value }) => ( {label} @@ -245,10 +240,10 @@ const FormItemGroup: React.FC = ({