From 0cf5cbbfcdbe8e97a789757f2e12757b663a33f6 Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Tue, 22 Oct 2019 17:12:10 +0800 Subject: [PATCH] =?UTF-8?q?Subform=20modal=20=E5=BC=B9=E5=87=BA=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E4=BC=98=E5=8C=96=20&=20=E8=A7=A3=E5=86=B3=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=A4=9A=E4=BA=86=E4=B8=AA=20}=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/SubForm.tsx | 57 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/renderers/Form/SubForm.tsx b/src/renderers/Form/SubForm.tsx index 1877f5ff..6870b2a1 100644 --- a/src/renderers/Form/SubForm.tsx +++ b/src/renderers/Form/SubForm.tsx @@ -179,15 +179,17 @@ export default class SubFormControl extends React.PureComponent - {(value && labelField && value[labelField] && stripTag(value[labelField])) - || render('label', - { - type: 'tpl', - tpl: btnLabel - }, - { - data - })} + {(value && labelField && value[labelField] && stripTag(value[labelField])) || + render( + 'label', + { + type: 'tpl', + tpl: btnLabel + }, + { + data + } + )} )) @@ -225,16 +227,17 @@ export default class SubFormControl extends React.PureComponent - {(value && labelField && value[labelField] && stripTag(value[labelField])) - || render('label', - { - type: 'tpl', - tpl: btnLabel - }, - { - data - } - )}} + {(value && labelField && value[labelField] && stripTag(value[labelField])) || + render( + 'label', + { + type: 'tpl', + tpl: btnLabel + }, + { + data + } + )} @@ -248,16 +251,12 @@ export default class SubFormControl extends React.PureComponent {multiple ? this.renderMultipe() : this.renderSingle()} - {openedIndex !== -1 - ? render(`dalog/${openedIndex}`, this.buildDialogSchema(), { - onClose: this.close, - onConfirm: this.handleDialogConfirm, - data: createObject( - data, - (multiple ? Array.isArray(value) && value[openedIndex] : value) || {} - ) - }) - : null} + {render(`dalog/${openedIndex}`, this.buildDialogSchema(), { + show: openedIndex !== -1, + onClose: this.close, + onConfirm: this.handleDialogConfirm, + data: createObject(data, (multiple ? Array.isArray(value) && value[openedIndex] : value) || {}) + })} ); }