Skip to content

Commit

Permalink
hotfix for not exporting empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
DecDuck committed Jan 17, 2024
1 parent c2fcb35 commit e548d27
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions components/SchemaBoolean.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
passive
>{{ calculateSchemaTitle(props.schema) }}</SwitchLabel
>
<SwitchDescription as="span" class="text-sm text-zinc-400"
>{{ props.schema.description ?? "No description provided." }}</SwitchDescription
>
<SwitchDescription as="span" class="text-sm text-zinc-400">{{
props.schema.description ?? "No description provided."
}}</SwitchDescription>
</span>
<Switch
v-model="model"
Expand Down
16 changes: 13 additions & 3 deletions components/SchemaNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,30 @@ const model = computed({
return props.modelValue;
},
set(value) {
emit("update:modelValue", value);
if (value == null) {
emit("update:modelValue", undefined);
} else {
emit("update:modelValue", value);
}
},
});
model.value ??= props.schema.default ?? 0;
const minimum = computed(() => props.schema.min ?? props.schema.minimum);
const maximum = computed(() => props.schema.max ?? props.schema.maximum);
// '?? undefined' is for readable clarity
model.value ??= props.schema.default ?? minimum.value ?? undefined;
const bump = computed(() => {
if (minimum.value != null && maximum.value != null) {
return (maximum.value - minimum.value) / 100;
}
return 1;
});
if (!model.value && minimum.value) {
model.value = minimum.value;
}
const componentID = randomUUID();
</script>
2 changes: 1 addition & 1 deletion components/SchemaString.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const model = computed({
},
});
model.value ??= props.schema.default ?? "";
model.value ??= props.schema.default ?? undefined;
const componentID = randomUUID();
</script>

0 comments on commit e548d27

Please sign in to comment.