From 7171aa218d0a0411c8979c7d4c3716eb1d0f5160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=86=A0?= Date: Thu, 30 Jul 2020 12:42:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E7=81=B5=E7=8A=80vc=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E8=B0=83=E7=94=A8config,=20=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E8=BF=9B=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/designer/src/designer/setting/setting-field.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/designer/src/designer/setting/setting-field.ts b/packages/designer/src/designer/setting/setting-field.ts index 956de1c8d..a70e83bb6 100644 --- a/packages/designer/src/designer/setting/setting-field.ts +++ b/packages/designer/src/designer/setting/setting-field.ts @@ -21,6 +21,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry { readonly isSettingField = true; readonly isRequired: boolean; readonly transducer: Transducer; + private _config: FieldConfig; extraProps: FieldExtraProps; // ==== dynamic properties ==== @@ -53,6 +54,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry { super(parent, config.name, config.type); const { title, items, setter, extraProps, ...rest } = config; + this._config = config; this._title = title; this._setter = setter; this.extraProps = { @@ -80,6 +82,10 @@ export class SettingField extends SettingPropEntry implements SettingEntry { return this._items; } + get config(): FieldConfig { + return this._config; + } + private initItems(items: Array, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void; }) { this._items = items.map((item) => { if (isCustomView(item)) { From 83243686f51987481fa15c6fb4d8b273374b6339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=86=A0?= Date: Thu, 30 Jul 2020 12:51:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20condition=E5=A2=9E=E5=8A=A0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/settings/settings-pane.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/editor-skeleton/src/components/settings/settings-pane.tsx b/packages/editor-skeleton/src/components/settings/settings-pane.tsx index 76ea9c282..6ad763ac1 100644 --- a/packages/editor-skeleton/src/components/settings/settings-pane.tsx +++ b/packages/editor-skeleton/src/components/settings/settings-pane.tsx @@ -18,7 +18,13 @@ class SettingFieldView extends Component<{ field: SettingField }> { const { field } = this.props; const { extraProps } = field; const { condition, defaultValue, display } = extraProps; - const visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true; + let visible; + try { + visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true; + } catch (error) { + console.error('exception when condition (hidden) is excuted', error); + } + if (!visible) { return null; }