From 3e55228f70d845c3398cc2af7a06e99239487b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=89=B2?= Date: Mon, 25 Dec 2023 21:42:25 +0800 Subject: [PATCH] fix(form:array): fix invalid trackBy (#1741) --- packages/form/src/widgets/array/array.widget.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/form/src/widgets/array/array.widget.ts b/packages/form/src/widgets/array/array.widget.ts index 7802b06cbe..fdc5860d0e 100644 --- a/packages/form/src/widgets/array/array.widget.ts +++ b/packages/form/src/widgets/array/array.widget.ts @@ -46,7 +46,7 @@ import { ArrayLayoutWidget } from '../../widget';
- @for (i of $any(formProperty).properties; track $index) { + @if (i.visible && !i.ui.hidden) {
@@ -59,7 +59,7 @@ import { ArrayLayoutWidget } from '../../widget';
} - } +
@if (!ui.onlyVisual && showError) {
{{ error }}
@@ -115,16 +115,12 @@ export class ArrayWidget extends ArrayLayoutWidget implements OnInit { addItem(): void { const property = this.formProperty.add({}); this.reValid(); - if (this.ui.add) { - this.ui.add(property); - } + this.ui.add?.(property); } removeItem(index: number): void { this.formProperty.remove(index); this.reValid(); - if (this.ui.remove) { - this.ui.remove(index); - } + this.ui.remove?.(index); } }