Skip to content

Commit

Permalink
Merge pull request #1748 from zyfra/fix/input-number-v3-1645-1644
Browse files Browse the repository at this point in the history
fix(components/input-number): fix sync state with input-layout FOR V3 #1645 #1644
  • Loading branch information
ickisIckis authored May 31, 2024
2 parents 99e6808 + b676cdf commit 4563f01
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { PrizmHintDirective } from '../../../directives';
export class PrizmInputNumberComponent extends PrizmInputControl<number> implements OnInit {
private hasSymbol = false;

destroy$ = inject(PrizmDestroyService);
readonly destroy$ = inject(PrizmDestroyService);
public get empty() {
return this.el.nativeElement.value == '' && !this.hasSymbol;
}
Expand Down Expand Up @@ -198,6 +198,7 @@ export class PrizmInputNumberComponent extends PrizmInputControl<number> impleme
// this.overrideSetValueMethod();
this.prizmHint_.ngOnInit();
this.inputHint?.updateHint();
this.initUpdateParentOnChangeStatus();

this.input$$
.pipe(
Expand All @@ -215,6 +216,17 @@ export class PrizmInputNumberComponent extends PrizmInputControl<number> impleme
this.prizmHint_.ngOnDestroy();
}

private initUpdateParentOnChangeStatus() {
this.ngControl?.statusChanges
?.pipe(
tap(() => {
this.stateChanges.next();
}),
takeUntil(this.destroy$)
)
.subscribe();
}

// TODO change overriding later
// private overrideSetValueMethod(): void {
// if (this.ngControl.control) {
Expand Down

0 comments on commit 4563f01

Please sign in to comment.