fix: fix resetting form to default values (#2816)

This commit is contained in:
Alex Inkin
2025-01-22 07:52:47 +04:00
committed by GitHub
parent 479797361e
commit baa4c1fd25
3 changed files with 2 additions and 4 deletions

View File

@@ -123,10 +123,7 @@ export class FormComponent<T extends Record<string, any>> implements OnInit {
}
onReset() {
const { value } = this.form
this.form = this.formService.createForm(this.spec)
this.process(compare(this.form.value, value))
tuiMarkControlAsTouchedAndValidate(this.form)
this.markAsDirty()
}

View File

@@ -5,6 +5,7 @@
></tui-tooltip>
<tui-toggle
size="l"
[style.margin-inline-start]="'auto'"
[disabled]="!!spec.disabled || readOnly"
[(ngModel)]="value"
(focusedChange)="onFocus($event)"

View File

@@ -5,7 +5,7 @@ import { Control } from '../control'
@Component({
selector: 'form-toggle',
templateUrl: './form-toggle.component.html',
host: { class: 'g-toggle' },
host: { style: 'display: flex' },
})
export class FormToggleComponent extends Control<
IST.ValueSpecToggle,