Form: reset not working, changed value not update input (#6767)

* 6755 - update input value after form reset

* code refactoring

* fix: select button

* cleanup
pull/7055/head
Damián Paranič 2025-01-06 12:24:26 +01:00 committed by GitHub
parent 32daa566d1
commit 7925d86aa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,14 @@ export default {
handler(newValue) {
this.d_value !== newValue && (this.d_value = newValue);
}
},
$formValue: {
immediate: false,
handler(newValue) {
if (this.$formName !== undefined && this.$pcForm?.states?.[this.$formName] && newValue !== this.d_value) {
this.d_value = newValue;
}
}
}
},
formField: {},
@ -103,6 +111,9 @@ export default {
$formDefaultValue() {
return this.d_value ?? this.$pcFormField?.initialValue ?? this.$pcForm?.initialValues?.[this.$formName];
},
$formValue() {
return this.$pcForm?.states?.[this.$formName]?.value;
},
controlled() {
return this.$inProps.hasOwnProperty('modelValue') || (!this.$inProps.hasOwnProperty('modelValue') && !this.$inProps.hasOwnProperty('defaultValue'));
},