From a0150e7520376064469cfa5ae0e3394635620022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Wed, 7 Jun 2023 13:43:44 +0800 Subject: [PATCH] fix(form): fix inheriting references to other of ui (#1600) --- packages/form/src/sf.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/form/src/sf.component.ts b/packages/form/src/sf.component.ts index e4750b10d8..002fda9677 100644 --- a/packages/form/src/sf.component.ts +++ b/packages/form/src/sf.component.ts @@ -322,7 +322,8 @@ export class SFComponent implements OnInit, OnChanges, OnDestroy { if (!Array.isArray(schema.required)) schema.required = []; Object.keys(schema.properties!).forEach(key => { - const uiKey = `$${key}`; + const uiKeyPrefix = '$'; + const uiKey = uiKeyPrefix + key; const property = retrieveSchema(schema.properties![key] as SFSchema, definitions); const curUi = { ...(property.ui as SFUISchemaItem), @@ -342,6 +343,9 @@ export class SFComponent implements OnInit, OnChanges, OnDestroy { : null), ...curUi } as SFUISchemaItemRun; + Object.keys(ui) + .filter(key => key.startsWith(uiKeyPrefix)) + .forEach(key => delete ui[key]); // 继承父节点布局属性 if (isHorizontal) { if (parentUiSchema.spanLabelFixed) {