From 760f4eddfc9b0efea0f207dd6f9395b4496ec2a9 Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Wed, 10 May 2023 20:46:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20formulaControl=20?= =?UTF-8?q?=E7=94=B1=E4=BA=8E=20name=20=E5=B9=B2=E6=89=B0=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=B5=8B=E5=80=BC=E4=B8=8D=E7=AC=A6=E5=90=88=E9=A2=84?= =?UTF-8?q?=E6=9C=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-editor/src/renderer/FormulaControl.tsx | 9 ++++----- packages/amis-editor/src/tpl/common.tsx | 7 ------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/amis-editor/src/renderer/FormulaControl.tsx b/packages/amis-editor/src/renderer/FormulaControl.tsx index 4152e35c8..92bb59215 100644 --- a/packages/amis-editor/src/renderer/FormulaControl.tsx +++ b/packages/amis-editor/src/renderer/FormulaControl.tsx @@ -402,9 +402,11 @@ export default class FormulaControl extends React.Component< let curRendererSchema: any = null; if (rendererSchema) { - curRendererSchema = Object.assign({}, rendererSchema, data, { + curRendererSchema = Object.assign({}, rendererSchema, { type: rendererSchema.type ?? data.type, - name: rendererSchema.name ?? data.name ?? 'value' + // 目前表单项 wrapControl 还必须依赖一个 name + // 所以这里先随便取个名字,这里渲染的时候应该是 value 控制,而不是关联 name + name: 'FORMULA_CONTROL_PLACEHOLDER' }); // 默认要剔除的字段 @@ -521,9 +523,6 @@ export default class FormulaControl extends React.Component< const {formulaPickerOpen, variables, variableMode} = this.state; - // 自身字段 - const selfName = this.props?.data?.name; - // 判断是否含有公式表达式 const isExpr = isExpression(value); diff --git a/packages/amis-editor/src/tpl/common.tsx b/packages/amis-editor/src/tpl/common.tsx index e85514e4b..e21f52c3d 100644 --- a/packages/amis-editor/src/tpl/common.tsx +++ b/packages/amis-editor/src/tpl/common.tsx @@ -1159,13 +1159,6 @@ setSchemaTpl('nav-badge', { setSchemaTpl('nav-default-active', { type: 'ae-nav-default-active' }); -// 暂未使用 -setSchemaTpl('formulaControl', (schema: object = {}) => { - return { - type: 'ae-formulaControl', - ...schema - }; -}); /** * 日期范围快捷键组件