From d232e94968ca4f9ab2225d33b88afc295d24e9eb Mon Sep 17 00:00:00 2001 From: zhaojianhui Date: Mon, 5 Dec 2022 16:14:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=84=E4=BB=B6=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=E6=80=A7=E3=80=81=E5=8F=AF=E7=94=A8=E6=80=A7=E5=8A=A8=E4=BD=9C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/actions/CmptAction.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/amis-core/src/actions/CmptAction.ts b/packages/amis-core/src/actions/CmptAction.ts index eb4cd036e..6c7ff398e 100644 --- a/packages/amis-core/src/actions/CmptAction.ts +++ b/packages/amis-core/src/actions/CmptAction.ts @@ -12,9 +12,11 @@ export interface ICmptAction extends ListenerAction { | 'static' | 'nonstatic' | 'show' + | 'visibility' | 'hidden' | 'enabled' | 'disabled' + | 'usability' | 'reload'; args: { value?: string | {[key: string]: string}; @@ -46,20 +48,24 @@ export class CmptAction implements RendererAction { const dataMergeMode = action.dataMergeMode || 'merge'; // 显隐&状态控制 - if (['show', 'hidden'].includes(action.actionType)) { + if (['show', 'hidden','visibility'].includes(action.actionType)) { + let visibility = action.actionType === 'visibility' + ? action.args?.value : action.actionType === 'show'; return renderer.props.topStore.setVisible( action.componentId, - action.actionType === 'show' + visibility ); } else if (['static', 'nonstatic'].includes(action.actionType)) { return renderer.props.topStore.setStatic( action.componentId, action.actionType === 'static' ); - } else if (['enabled', 'disabled'].includes(action.actionType)) { + } else if (['enabled', 'disabled', 'usability'].includes(action.actionType)) { + let usability = action.actionType === 'usability' + ? !action.args?.value : action.actionType === 'disabled'; return renderer.props.topStore.setDisable( action.componentId, - action.actionType === 'disabled' + usability ); }