mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 21:06:00 +00:00
clickhouse: edit table options
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user