Skip to content

Commit 29c010d

Browse files
authored
fix: radio control
The radio control did not store the actual value in the data but the event. This is now fixed. Other changes: - use @update:modelValue instead of @change where appropriate - add root schema to createDefaultValue of list-with-detail
1 parent 1723db1 commit 29c010d

7 files changed

+12
-12
lines changed

packages/vue-vuetify/src/additional/ListWithDetailRenderer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ const controlRenderer = defineComponent({
305305
addButtonClick() {
306306
this.addItem(
307307
this.control.path,
308-
createDefaultValue(this.control.schema)
308+
createDefaultValue(this.control.schema, this.control.rootSchema)
309309
)();
310310
},
311311
moveUpClick(event: Event, toMove: number): void {

packages/vue-vuetify/src/controls/AnyOfStringOrEnumControlRenderer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
:items="items"
3131
:clearable="isHovering"
3232
v-bind="vuetifyProps('v-combobox')"
33-
@change="onChange"
33+
@update:modelValue="onChange"
3434
@focus="handleFocus"
3535
@blur="handleBlur"
3636
/>

packages/vue-vuetify/src/controls/BooleanControlRenderer.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
:indeterminate="control.data === undefined"
2020
:model-value="control.data"
2121
v-bind="vuetifyProps('v-checkbox')"
22-
@change="onChange"
22+
@update:modelValue="onChange"
2323
@focus="handleFocus"
2424
@blur="handleBlur"
2525
/>
@@ -53,8 +53,8 @@ const controlRenderer = defineComponent({
5353
...rendererProps<ControlElement>(),
5454
},
5555
setup(props: RendererProps<ControlElement>) {
56-
return useVuetifyControl(useJsonFormsControl(props), (event) => {
57-
return event.target.checked || false;
56+
return useVuetifyControl(useJsonFormsControl(props), (value) => {
57+
return value || false;
5858
});
5959
},
6060
});

packages/vue-vuetify/src/controls/BooleanToggleControlRenderer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
:true-value="true"
2222
:false-value="false"
2323
v-bind="vuetifyProps('v-switch')"
24-
@change="onChange"
24+
@update:modelValue="onChange"
2525
@focus="handleFocus"
2626
@blur="handleBlur"
2727
/>
@@ -59,7 +59,7 @@ const controlRenderer = defineComponent({
5959
setup(props: RendererProps<ControlElement>) {
6060
return useVuetifyControl(
6161
useJsonFormsControl(props),
62-
(newValue) => newValue.target.checked || false
62+
(value) => value || false
6363
);
6464
},
6565
});

packages/vue-vuetify/src/controls/OneOfEnumControlRenderer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
:item-title="(item) => t(item.label, item.label)"
2525
item-value="value"
2626
v-bind="vuetifyProps('v-select')"
27-
@change="onChange"
27+
@update:modelValue="onChange"
2828
@focus="handleFocus"
2929
@blur="handleBlur"
3030
/>

packages/vue-vuetify/src/controls/OneOfRadioGroupControlRenderer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
:error-messages="control.errors"
2121
v-bind="vuetifyProps('v-radio-group')"
2222
:model-value="control.data"
23-
@change="onChange"
23+
@update:modelValue="onChange"
2424
@focus="handleFocus"
2525
@blur="handleBlur"
2626
>
@@ -29,7 +29,7 @@
2929
v-bind="vuetifyProps(`v-radio[${o.value}]`)"
3030
:key="o.value"
3131
:label="o.label"
32-
:model-value="o.value"
32+
:value="o.value"
3333
></v-radio>
3434
</v-radio-group>
3535
</control-wrapper>

packages/vue-vuetify/src/controls/RadioGroupControlRenderer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
:error-messages="control.errors"
2121
:model-value="control.data"
2222
v-bind="vuetifyProps('v-radio-group')"
23-
@change="onChange"
23+
@update:modelValue="onChange"
2424
@focus="handleFocus"
2525
@blur="handleBlur"
2626
>
@@ -29,7 +29,7 @@
2929
v-bind="vuetifyProps(`v-radio[${o.value}]`)"
3030
:key="o.value"
3131
:label="o.label"
32-
:model-value="o.value"
32+
:value="o.value"
3333
></v-radio>
3434
</v-radio-group>
3535
</control-wrapper>

0 commit comments

Comments
 (0)