mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 02:56:01 +00:00
macro parameters
This commit is contained in:
27
packages/web/src/forms/FormArgument.svelte
Normal file
27
packages/web/src/forms/FormArgument.svelte
Normal file
@@ -0,0 +1,27 @@
|
||||
<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} />
|
||||
{: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}
|
||||
Reference in New Issue
Block a user