mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 22:26:01 +00:00
28 lines
765 B
Svelte
28 lines
765 B
Svelte
<script lang="ts">
|
|
import _ from 'lodash';
|
|
|
|
import FormCheckboxField from './FormCheckboxField.svelte';
|
|
import FormSelectField from './FormSelectField.svelte';
|
|
import FormTextField from './FormTextField.svelte';
|
|
|
|
export let arg;
|
|
export let namePrefix;
|
|
|
|
$: name = `${namePrefix}${arg.name}`;
|
|
</script>
|
|
|
|
{#if arg.type == 'text'}
|
|
<FormTextField label={arg.label} {name} defaultValue={arg.default} />
|
|
{:else if arg.type == 'checkbox'}
|
|
<FormCheckboxField label={arg.label} {name} defaultValue={arg.default} />
|
|
{:else if arg.type == 'select'}
|
|
<FormSelectField
|
|
label={arg.label}
|
|
isNative
|
|
{name}
|
|
options={arg.options.map(opt =>
|
|
_.isString(opt) ? { label: opt, value: opt } : { label: opt.name, value: opt.value }
|
|
)}
|
|
/>
|
|
{/if}
|