Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(kit,legacy): all textfield controls should handle initial ngModel phantom null value #10171

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading