clickhouse: edit table options

This commit is contained in:
Jan Prochazka
2024-09-11 12:51:09 +02:00
parent f6e0b634f0
commit ff33ec668b
6 changed files with 186 additions and 6 deletions

View File

@@ -5,11 +5,15 @@
import FormSelectField from './FormSelectField.svelte';
import FormTextField from './FormTextField.svelte';
import FormStringList from './FormStringList.svelte';
import FormDropDownTextField from './FormDropDownTextField.svelte';
import { getFormContext } from './FormProviderCore.svelte';
export let arg;
export let namePrefix;
$: name = `${namePrefix}${arg.name}`;
const { setFieldValue } = getFormContext();
</script>
{#if arg.type == 'text'}
@@ -19,14 +23,10 @@
defaultValue={arg.default}
focused={arg.focused}
placeholder={arg.placeholder}
disabled={arg.disabled}
/>
{:else if arg.type == 'stringlist'}
<FormStringList
label={arg.label}
addButtonLabel={arg.addButtonLabel}
{name}
placeholder={arg.placeholder}
/>
<FormStringList label={arg.label} addButtonLabel={arg.addButtonLabel} {name} placeholder={arg.placeholder} />
{:else if arg.type == 'number'}
<FormTextField
label={arg.label}
@@ -48,4 +48,16 @@
_.isString(opt) ? { label: opt, value: opt } : { label: opt.name, value: opt.value }
)}
/>
{:else if arg.type == 'dropdowntext'}
<FormDropDownTextField
label={arg.label}
{name}
defaultValue={arg.default}
menu={() => {
return arg.options.map(opt => ({
text: _.isString(opt) ? opt : opt.name,
onClick: () => setFieldValue(name, _.isString(opt) ? opt : opt.value),
}));
}}
/>
{/if}