From e834f56c0d8736b759a6ba4b37be7c0076334a87 Mon Sep 17 00:00:00 2001 From: Zurab Developer <75216044+ZurabDev@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:35:40 +0300 Subject: [PATCH 1/2] fix(components/input-text): incorrect behavior occurring in PrizmInputComponent when NgxMaskDirective is applied and the value changes from an empty state. #1190 --- .../input/input-text/input-block.component.ts | 7 ++- .../input/input-text/input-text.component.ts | 41 +++++++------- .../input-text/input-text.component.ts.ng14 | 56 ++++++++++--------- .../input-text/input-text.component.ts.ng15 | 53 +++++++++--------- .../input-text/input-text.component.ts.ng16 | 41 +++++++------- 5 files changed, 99 insertions(+), 99 deletions(-) diff --git a/libs/components/src/lib/components/input/input-text/input-block.component.ts b/libs/components/src/lib/components/input/input-text/input-block.component.ts index 60eb85f986..017c509c75 100644 --- a/libs/components/src/lib/components/input/input-text/input-block.component.ts +++ b/libs/components/src/lib/components/input/input-text/input-block.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, ElementRef, Optional, Self } from '@angular/core'; +import { ChangeDetectorRef, Component, ElementRef, Optional, Renderer2, Self } from '@angular/core'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { PrizmDestroyService } from '@prizm-ui/helpers'; import { PrizmInputControl } from '../common/base/input-control.class'; @@ -43,9 +43,10 @@ export class PrizmInputBlockComponent extends PrizmInputTextComponent implements @Optional() @Self() public readonly ngControl_: NgControl, public readonly elementRef_: ElementRef, private readonly destroy_: PrizmDestroyService, - private readonly cdr_: ChangeDetectorRef + private readonly cdr_: ChangeDetectorRef, + private readonly renderer_: Renderer2 ) { - super(ngControl_, elementRef_, destroy_, cdr_); + super(ngControl_, elementRef_, destroy_, cdr_, renderer_); if (this.ngControl != null) { this.ngControl.valueAccessor = this; diff --git a/libs/components/src/lib/components/input/input-text/input-text.component.ts b/libs/components/src/lib/components/input/input-text/input-text.component.ts index eddd77a411..b39486f1c7 100644 --- a/libs/components/src/lib/components/input/input-text/input-text.component.ts +++ b/libs/components/src/lib/components/input/input-text/input-text.component.ts @@ -12,6 +12,7 @@ import { OnInit, Optional, Output, + Renderer2, Self, } from '@angular/core'; import { NgControl, NgModel, UntypedFormControl, Validators } from '@angular/forms'; @@ -113,7 +114,7 @@ export class PrizmInputTextComponent, private readonly destroy: PrizmDestroyService, - private readonly cdr: ChangeDetectorRef + private readonly cdr: ChangeDetectorRef, + private readonly renderer2_: Renderer2 ) { super(); this.nativeElementType = elementRef.nativeElement.type; @@ -205,14 +207,6 @@ export class PrizmInputTextComponent, private readonly destroy: PrizmDestroyService, - private readonly cdr: ChangeDetectorRef + private readonly cdr: ChangeDetectorRef, + private readonly renderer2_: Renderer2, ) { super(); this.nativeElementType = elementRef.nativeElement.type; @@ -183,7 +190,7 @@ export class PrizmInputTextComponent { - this.maybeMask, this.maybeMask?.writeValue(null as any); + this.maybeMask?.writeValue(null as any); }), takeUntil(this.destroy) ) @@ -200,14 +207,6 @@ export class PrizmInputTextComponent, private readonly destroy: PrizmDestroyService, - private readonly cdr: ChangeDetectorRef + private readonly cdr: ChangeDetectorRef, + private readonly renderer2_: Renderer2, ) { super(); this.nativeElementType = elementRef.nativeElement.type; @@ -182,7 +190,7 @@ export class PrizmInputTextComponent { - this.maybeMask, this.maybeMask?.writeValue(null as any); + this.maybeMask?.writeValue(null as any); }), takeUntil(this.destroy) ) @@ -199,14 +207,6 @@ export class PrizmInputTextComponent, private readonly destroy: PrizmDestroyService, - private readonly cdr: ChangeDetectorRef + private readonly cdr: ChangeDetectorRef, + private readonly renderer2_: Renderer2, ) { super(); this.nativeElementType = elementRef.nativeElement.type; @@ -205,14 +207,6 @@ export class PrizmInputTextComponent Date: Fri, 19 Jul 2024 14:39:22 +0300 Subject: [PATCH 2/2] fix(components/input-text): for ng14 #000\ --- .../input/input-text/input-text.component.ts.ng14 | 10 +++++----- .../input/input-text/input-text.component.ts.ng15 | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/components/src/lib/components/input/input-text/input-text.component.ts.ng14 b/libs/components/src/lib/components/input/input-text/input-text.component.ts.ng14 index f215f14610..deabe5fb13 100644 --- a/libs/components/src/lib/components/input/input-text/input-text.component.ts.ng14 +++ b/libs/components/src/lib/components/input/input-text/input-text.component.ts.ng14 @@ -15,13 +15,12 @@ import { Renderer2, Self, } from '@angular/core'; -import { NgControl, NgModel, UntypedFormControl, Validators } from '@angular/forms'; +import { NgControl, Validators } from '@angular/forms'; import { PrizmDestroyService } from '@prizm-ui/helpers'; import { takeUntil, tap } from 'rxjs/operators'; import { PrizmInputControl } from '../common/base/input-control.class'; import { PrizmInputHintDirective, PrizmInputLayoutComponent } from '../common'; -import { NgxMaskDirective } from 'ngx-mask'; -import { timer } from 'rxjs'; +import { MaskDirective } from 'ngx-mask'; @Component({ selector: @@ -75,6 +74,7 @@ export class PrizmInputTextComponent