From fbb0131b7e92ac8f94cbefc3b05c0fb4d0b2d9dc Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Tue, 22 Oct 2024 11:26:56 +0100 Subject: [PATCH] Fixed initial value issue in form components --- .../core/src/baseeditableholder/BaseEditableHolder.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core/src/baseeditableholder/BaseEditableHolder.vue b/packages/core/src/baseeditableholder/BaseEditableHolder.vue index 3a27d9c4e..a83444eaf 100644 --- a/packages/core/src/baseeditableholder/BaseEditableHolder.vue +++ b/packages/core/src/baseeditableholder/BaseEditableHolder.vue @@ -63,6 +63,12 @@ export default { handler(newValue) { this.formField = this.$pcForm?.register?.(newValue, this.formControl) || {}; } + }, + $formDefaultValue: { + immediate: true, + handler(newValue) { + this.d_value !== newValue && (this.d_value = newValue); + } } }, formField: {}, @@ -90,6 +96,9 @@ export default { $formName() { return this.formControl?.name || this.name; }, + $formDefaultValue() { + return this.d_value ?? this.$pcForm?.initialValues?.[this.$formName]; + }, uncontolled() { return this.defaultValue !== undefined && this.modelValue === undefined; },