Skip to content

Commit

Permalink
fix(kit,legacy): all textfield controls should handle initial `ngMode…
Browse files Browse the repository at this point in the history
…l` phantom `null` value (#10171)
  • Loading branch information
nsbarsukov authored Jan 16, 2025
1 parent 68fcf90 commit b490860
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export class TuiInputPhoneInternational extends TuiControl<string> {
const maskOptions = this.mask();

this.textfieldValue = maskOptions
? maskitoTransform(unmaskedValue, maskOptions)
: unmaskedValue; // it will be calibrated later when mask is ready (by maskitoInitialCalibrationPlugin)
? maskitoTransform(this.value(), maskOptions)
: this.value(); // it will be calibrated later when mask is ready (by maskitoInitialCalibrationPlugin)
this.cdr.detectChanges();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class TuiInputDateComponent

public override writeValue(value: TuiDay | null): void {
super.writeValue(value);
this.nativeValue.set(value ? this.computedValue : '');
this.nativeValue.set(this.value ? this.computedValue : '');
}

protected get size(): TuiSizeL | TuiSizeS {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class TuiInputPhoneComponent

public override writeValue(value: string | null): void {
super.writeValue(value);
this.nativeValue = maskitoTransform(value || '', this.maskOptions);
this.nativeValue = maskitoTransform(this.value || '', this.maskOptions);
this.updateSearch('');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class TuiInputTimeComponent

public override writeValue(value: TuiTime | null): void {
super.writeValue(value);
this.nativeValue = value ? this.computedValue : '';
this.nativeValue = this.value ? this.computedValue : '';
}

public onValueChange(value: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class TuiInputYearComponent

public override writeValue(value: number | null): void {
super.writeValue(value);
this.updateNativeValue(value);
this.updateNativeValue(this.value);
}

protected get size(): TuiSizeL | TuiSizeS {
Expand Down

0 comments on commit b490860

Please sign in to comment.