Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion packages/vue-vuetify/dev/views/ExampleView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ const reloadMonacoSchema = () => {
const saveMonacoSchema = () => {
saveMonacoModel(
schemaModel,
(modelValue) => (state.schema = JSON.parse(modelValue)),
(modelValue) =>
(state.schema = modelValue ? JSON.parse(modelValue) : undefined),
'New schema applied',
);

Expand Down Expand Up @@ -277,6 +278,10 @@ const handleAction = (action: Action) => {
if (action) {
const newState = action.apply(state);
if (newState) {
if (newState.renderers) {
newState.renderers = markRaw(newState.renderers);
}

Object.assign(state, newState);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ const controlRenderer = defineComponent({
},
setup(props: RendererProps<ControlElement>) {
const clearValue = determineClearValue('');
return useVuetifyControl(useJsonFormsControl(props), (value) =>
value === null ? clearValue : value,
return useVuetifyControl(
useJsonFormsControl(props),
(value) => value || clearValue,
);
},
computed: {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-vuetify/src/controls/DateControlRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const controlRenderer = defineComponent({

const showMenu = ref(false);

const adaptValue = (value: any) => (value === null ? clearValue : value);
const adaptValue = (value: any) => value || clearValue;
const control = useVuetifyControl(useJsonFormsControl(props), adaptValue);

const dateFormat = computed<string>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const controlRenderer = defineComponent({
const t = useTranslator();
const showMenu = ref(false);
const activeTab = ref<'date' | 'time'>('date');
const adaptValue = (value: any) => (value === null ? clearValue : value);
const adaptValue = (value: any) => value || clearValue;

const control = useVuetifyControl(useJsonFormsControl(props), adaptValue);
const { mobile } = useDisplay();
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-vuetify/src/controls/EnumControlRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const controlRenderer = defineComponent({
setup(props: RendererProps<ControlElement>) {
const clearValue = determineClearValue('');
return useVuetifyControl(useJsonFormsEnumControl(props), (value) =>
value === null ? clearValue : value,
value !== null ? value : clearValue,
);
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const controlRenderer = defineComponent({
const clearValue = determineClearValue('');
return useVuetifyControl(
useJsonFormsControl(props),
(value) => (value === null ? clearValue : value),
(value) => value || clearValue,
300,
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const controlRenderer = defineComponent({
const clearValue = determineClearValue('');
return useVuetifyControl(
useJsonFormsControl(props),
(value) => (value === null ? clearValue : value),
(value) => value || clearValue,
300,
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const controlRenderer = defineComponent({
},
setup(props: RendererProps<ControlElement>) {
const clearValue = determineClearValue('');
const adaptValue = (value: any) => (value === null ? clearValue : value);
const adaptValue = (value: any) => value || clearValue;
const control = useVuetifyControl(useJsonFormsControl(props), adaptValue);

const toTokens = (tokenParams: Record<string, any>): MaskTokens => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-vuetify/src/controls/TimeControlRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ const controlRenderer = defineComponent({

const showMenu = ref(false);

const adaptValue = (value: any) => (value === null ? clearValue : value);
const adaptValue = (value: any) => value || clearValue;
const control = useVuetifyControl(useJsonFormsControl(props), adaptValue);

const icons = useIcons();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const controlRenderer = defineComponent({
const clearValue = determineClearValue('');
return useVuetifyControl(
useJsonFormsEnumControl(props),
(value) => (value === null ? clearValue : value),
(value) => (value !== null ? value : clearValue),
300,
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const controlRenderer = defineComponent({
const clearValue = determineClearValue('');
return useVuetifyControl(
useJsonFormsOneOfEnumControl(props),
(value) => (value === null ? clearValue : value),
(value) => (value !== null ? value : clearValue),
300,
);
},
Expand Down