diff --git a/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.ts b/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.ts index f8f5946f..b21fe89a 100644 --- a/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/checkbox/checkbox.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { ItAbstractFormComponent } from '../../../abstracts/abstract-form.component'; import { BooleanInput, isTrueBooleanInput } from '../../../utils/boolean-input'; import { AsyncPipe, NgIf, NgTemplateOutlet } from '@angular/common'; @@ -11,7 +11,7 @@ import { ReactiveFormsModule } from '@angular/forms'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgIf, NgTemplateOutlet, ReactiveFormsModule, AsyncPipe] }) -export class ItCheckboxComponent extends ItAbstractFormComponent implements OnInit { +export class ItCheckboxComponent extends ItAbstractFormComponent implements OnInit, OnChanges { /** * If show checkbox as toggle @@ -48,7 +48,16 @@ export class ItCheckboxComponent extends ItAbstractFormComponent implem override ngOnInit() { super.ngOnInit(); + this.markAsChecked(); + } + + ngOnChanges(changes: SimpleChanges) { + if (changes['checked']) { + this.markAsChecked(); + } + } + private markAsChecked(): void { if (this.control.value || this.checked === undefined) { return; } diff --git a/projects/design-angular-kit/src/lib/components/form/input/input.component.ts b/projects/design-angular-kit/src/lib/components/form/input/input.component.ts index f5fef6ae..3fe6a15e 100644 --- a/projects/design-angular-kit/src/lib/components/form/input/input.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/input/input.component.ts @@ -18,7 +18,7 @@ import { MarkMatchingTextPipe } from '../../../pipes/mark-matching-text.pipe'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgIf, ReactiveFormsModule, TranslateModule, AsyncPipe, ItIconComponent, MarkMatchingTextPipe, NgTemplateOutlet, NgForOf] }) -export class ItInputComponent extends ItAbstractFormComponent implements OnInit { +export class ItInputComponent extends ItAbstractFormComponent implements OnInit { /** * The input type diff --git a/projects/design-angular-kit/src/lib/components/form/password-input/password-input.component.ts b/projects/design-angular-kit/src/lib/components/form/password-input/password-input.component.ts index 319eb672..4e444ecf 100644 --- a/projects/design-angular-kit/src/lib/components/form/password-input/password-input.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/password-input/password-input.component.ts @@ -17,7 +17,7 @@ import { TranslateModule } from '@ngx-translate/core'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgIf, ReactiveFormsModule, ItIconComponent, AsyncPipe, TranslateModule] }) -export class ItPasswordInputComponent extends ItAbstractFormComponent implements OnInit, AfterViewInit { +export class ItPasswordInputComponent extends ItAbstractFormComponent implements OnInit, AfterViewInit { /** * The field is required diff --git a/projects/design-angular-kit/src/lib/components/form/radio-button/radio-button.component.ts b/projects/design-angular-kit/src/lib/components/form/radio-button/radio-button.component.ts index b24cc073..1db7ff94 100644 --- a/projects/design-angular-kit/src/lib/components/form/radio-button/radio-button.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/radio-button/radio-button.component.ts @@ -12,12 +12,12 @@ import { AsyncPipe, NgIf } from '@angular/common'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [ReactiveFormsModule, NgIf, AsyncPipe] }) -export class ItRadioButtonComponent extends ItAbstractFormComponent implements OnInit { +export class ItRadioButtonComponent extends ItAbstractFormComponent implements OnInit { /** * The radio value */ - @Input() value: string | number | undefined; + @Input() value: string | number | undefined | null; /** * If show radio inline diff --git a/projects/design-angular-kit/src/lib/components/form/rating/rating.component.ts b/projects/design-angular-kit/src/lib/components/form/rating/rating.component.ts index 8ad1f605..e0e14ac6 100644 --- a/projects/design-angular-kit/src/lib/components/form/rating/rating.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/rating/rating.component.ts @@ -12,7 +12,7 @@ import { ItIconComponent } from '../../utils/icon/icon.component'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [TranslateModule, NgForOf, ReactiveFormsModule, ItIconComponent] }) -export class ItRatingComponent extends ItAbstractFormComponent implements OnInit, OnChanges { +export class ItRatingComponent extends ItAbstractFormComponent implements OnInit, OnChanges { /** * The rating value diff --git a/projects/design-angular-kit/src/lib/components/form/textarea/textarea.component.ts b/projects/design-angular-kit/src/lib/components/form/textarea/textarea.component.ts index f16645cb..26a42920 100644 --- a/projects/design-angular-kit/src/lib/components/form/textarea/textarea.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/textarea/textarea.component.ts @@ -12,7 +12,7 @@ import { ReactiveFormsModule } from '@angular/forms'; changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgIf, ReactiveFormsModule, AsyncPipe] }) -export class ItTextareaComponent extends ItAbstractFormComponent { +export class ItTextareaComponent extends ItAbstractFormComponent { /** * Textarea Rows