1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Set default enum values (#10377)

This commit is contained in:
melohagan 2023-04-21 14:37:15 +01:00 committed by GitHub
parent 538424a469
commit 476bf65957

View file

@ -67,6 +67,15 @@
newInputData = cloneDeep(blockInputs)
}
inputData = newInputData
setDefaultEnumValues()
}
const setDefaultEnumValues = () => {
for (const [key, value] of schemaProperties) {
if (value.type === "string" && value.enum && inputData[key] == null) {
inputData[key] = value.enum[0]
}
}
}
const onChange = Utils.sequential(async (e, key) => {
@ -243,6 +252,7 @@
<Select
on:change={e => onChange(e, key)}
value={inputData[key]}
placeholder={false}
options={value.enum}
getOptionLabel={(x, idx) => (value.pretty ? value.pretty[idx] : x)}
/>