diff --git a/npm/ng-packs/packages/components/chart.js/src/chart.component.ts b/npm/ng-packs/packages/components/chart.js/src/chart.component.ts index c51b01dfe8..fcc047747a 100644 --- a/npm/ng-packs/packages/components/chart.js/src/chart.component.ts +++ b/npm/ng-packs/packages/components/chart.js/src/chart.component.ts @@ -1,7 +1,6 @@ import { AfterViewInit, ChangeDetectionStrategy, - ChangeDetectorRef, Component, ElementRef, OnDestroy, @@ -36,7 +35,6 @@ let Chart: any; }) export class ChartComponent implements AfterViewInit, OnDestroy { el = inject(ElementRef); - private cdr = inject(ChangeDetectorRef); readonly type = input.required(); readonly data = input({}); @@ -129,7 +127,6 @@ export class ChartComponent implements AfterViewInit, OnDestroy { refresh = () => { if (this.chart) { this.chart.update(); - this.cdr.detectChanges(); } }; @@ -146,4 +143,3 @@ export class ChartComponent implements AfterViewInit, OnDestroy { } } } - diff --git a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.html b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.html index 2608180d15..483f78452a 100644 --- a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.html +++ b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.html @@ -22,7 +22,7 @@
- @for (item of formArray.controls; track trackByIndex($index)) { + @for (item of formArray.controls; track $index + '-' + formArrayVersion()) {
diff --git a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.ts b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.ts index eb86a9da7f..f891a1f48f 100644 --- a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.ts +++ b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-array/dynamic-form-array.component.ts @@ -3,7 +3,7 @@ import { Component, input, inject, - ChangeDetectorRef, + signal, forwardRef, } from '@angular/core'; import { FormGroup, FormArray, FormBuilder, ReactiveFormsModule } from '@angular/forms'; @@ -35,7 +35,7 @@ export class DynamicFormArrayComponent { private fb = inject(FormBuilder); private dynamicFormService = inject(DynamicFormService); - private cdr = inject(ChangeDetectorRef); + readonly formArrayVersion = signal(0); get formArray(): FormArray { return this.formGroup().get(this.arrayConfig().key) as FormArray; @@ -58,20 +58,20 @@ export class DynamicFormArrayComponent { addItem() { if (!this.canAddItem) return; - + const itemGroup = this.dynamicFormService.createFormGroup( this.arrayConfig().children || [] ); - + this.formArray.push(itemGroup); - this.cdr.markForCheck(); + this.formArrayVersion.update(version => version + 1); } removeItem(index: number) { if (!this.canRemoveItem) return; - + this.formArray.removeAt(index); - this.cdr.markForCheck(); + this.formArrayVersion.update(version => version + 1); } getItemFormGroup(index: number): FormGroup { diff --git a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field-host.component.ts b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field-host.component.ts index d711b2030a..920b7deba3 100644 --- a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field-host.component.ts +++ b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field-host.component.ts @@ -1,5 +1,4 @@ -import { - Component, +import {Component, ViewContainerRef, ChangeDetectionStrategy, forwardRef, @@ -8,8 +7,7 @@ import { DestroyRef, inject, input, - viewChild -} from '@angular/core'; + viewChild,} from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule } from '@angular/forms'; diff --git a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.html b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.html index 3b00b4c171..8124f6d537 100644 --- a/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.html +++ b/npm/ng-packs/packages/components/dynamic-form/src/dynamic-form-field/dynamic-form-field.component.html @@ -1,356 +1,368 @@ @if (visible()) { -
- - - - - @if (field().type === 'text') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'select') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'checkbox') { - -
- - @if (isInvalid) { - - } -
- } @else if (field().type === 'email') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'textarea') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'number') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'date') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'datetime-local') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'time') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'password') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'tel') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'url') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'radio') { - -
- -
- @for (option of options$ | async; track option.key) { -
- + } +
+ } @else if (field().type === 'number') { + +
+ + - + [attr.aria-invalid]="isInvalid() || null" + [attr.aria-describedby]="isInvalid() ? errorId : null" + [attr.aria-label]="field().label | abpLocalization" + /> + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'date') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'datetime-local') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'time') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'password') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'tel') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'url') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'radio') { + +
+ +
+ @for (option of options$ | async; track option.key) { +
+ + +
+ } +
+ @if (isInvalid()) { + + } +
+ } @else if (field().type === 'file') { + +
+ + + @if (isInvalid()) { + + } +
+ } @else if (field().type === 'range') { + +
+ +
+ + {{ value.value }} +
+ @if (isInvalid()) { + + } +
+ } @else if (field().type === 'color') { + +
+ +
+ + {{ value.value || '#000000' }} +
+ @if (isInvalid()) { + + }
- } -
- @if (isInvalid) { - - } -
- } @else if (field().type === 'file') { - -
- - - @if (isInvalid) { - - } -
- } @else if (field().type === 'range') { - -
- -
- - {{ value.value }} -
- @if (isInvalid) { - - } -
- } @else if (field().type === 'color') { - -
- -
- - {{ value.value || '#000000' }} -
- @if (isInvalid) { - }
- } -
} - -