use the same editor as <Select />

This commit is contained in:
Clement Zhang
2024-11-04 19:00:23 +01:00
parent 29c9ba874c
commit 546da5b983
4 changed files with 14 additions and 2 deletions
@@ -2208,8 +2208,8 @@ This is a paragraph.
defaultItems: {
type: 'static',
fieldType: 'array',
subFieldType: 'text',
value: []
subFieldType: 'selectvalue',
value: undefined
} as StaticAppInput,
placeholder: {
type: 'static',
@@ -33,6 +33,8 @@
value.push({})
} else if (subFieldType === 'labeledresource' || subFieldType === 'labeledselect') {
value.push({ value: 'value', label: 'label' })
} else if (subFieldType === 'selectvalue') {
value.push('')
} else if (subFieldType === 'tab-select') {
value.push({ id: '', index: 0 })
} else if (
@@ -161,6 +161,14 @@
/>
</div>
{/if}
{:else if fieldType === 'selectvalue'}
<div class="flex w-full flex-col">
<JsonEditor
small
bind:value={componentInput.value}
code={JSON.stringify(componentInput.value, null, 2)}
/>
</div>
{:else if fieldType === 'array'}
<ArrayStaticInputEditor {id} {subFieldType} bind:componentInput on:deleteArrayItem />
{:else if fieldType === 'schema'}
@@ -20,6 +20,7 @@ export type InputType =
| 'any'
| 'labeledresource'
| 'labeledselect'
| 'selectvalue'
| 'tab-select'
| 'schema'
| 'ag-grid'
@@ -207,6 +208,7 @@ export type AppInput =
| (AppInputSpec<'array', string[], 'select'> & StaticOptions)
| AppInputSpec<'array', object[], 'labeledresource'>
| AppInputSpec<'array', object[], 'labeledselect'>
| AppInputSpec<'array', object[], 'selectvalue'>
| AppInputSpec<'labeledselect', object>
| AppInputSpec<'labeledresource', object>
| AppInputSpec<'array', object[], 'tab-select'>