diff --git a/src/views/FormBuilder.svelte b/src/views/FormBuilder.svelte index 4ae67565..480f91e2 100644 --- a/src/views/FormBuilder.svelte +++ b/src/views/FormBuilder.svelte @@ -230,80 +230,18 @@ bind:options={field.input.options} bind:folder={field.input.folder} notifyChange={onChange} + is_multi={false} /> {:else if field.input.type === "multiselect"} - {@const source_id = `source_${index}`} -
- - -
- {#if field.input.source === "fixed"} - {@const options_id = `options_btn_${index}`} - - - {#each field.input.multi_select_options || [] as option, idx} - {@const value_id = `${options_id}_option_${idx}`} -
- - - - -
- {/each} -
- {:else if field.input.source === "notes"} - - {/if} + + {:else if field.input.type === "slider"} {@const min_id = `min_${index}`} {@const max_id = `max_${index}`} diff --git a/src/views/components/InputBuilderSelect.svelte b/src/views/components/InputBuilderSelect.svelte index 730fb7ab..4b3ab7ab 100644 --- a/src/views/components/InputBuilderSelect.svelte +++ b/src/views/components/InputBuilderSelect.svelte @@ -14,8 +14,19 @@ export let folder: string | undefined; export let options: EditableInput["options"] = []; export let notifyChange: () => void; + export let is_multi: boolean; $: id = `builder_select_${index}`; $: options_id = `builder_select_options_btn_${index}`; + + function moveOption(from: number, direction: "up" | "down") { + const to = direction === "up" ? from - 1 : from + 1; + if (to < 0 || to >= options.length) return; + const tmp = options[from] + options[from] = options[to] + options[to] = tmp; + options = options; + notifyChange(); + } @@ -29,15 +40,53 @@ {#each options || [] as option, idx} {@const value_id = `${options_id}_option_${idx}`} - {@const label_id = `${options_id}_option_label_${idx}`}