File size: 1,681 Bytes
1123781
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<script lang="ts">
  import { createEventDispatcher } from 'svelte';
  import type { FieldProps } from '$lib/types';
  import { FieldType } from '$lib/types';
  import InputRange from './InputRange.svelte';
  import SeedInput from './SeedInput.svelte';
  import TextArea from './TextArea.svelte';

  export let pipelineParams: FieldProps[];
  export let pipelineValues = {} as any;

  $: advanceOptions = pipelineParams?.filter((e) => e?.hide == true);
  $: featuredOptions = pipelineParams?.filter((e) => e?.hide !== true);
</script>

<div>
  {#if featuredOptions}
    {#each featuredOptions as params}
      {#if params.field === FieldType.range}
        <InputRange {params} bind:value={pipelineValues[params.title]}></InputRange>
      {:else if params.field === FieldType.seed}
        <SeedInput bind:value={pipelineValues[params.title]}></SeedInput>
      {:else if params.field === FieldType.textarea}
        <TextArea {params} bind:value={pipelineValues[params.title]}></TextArea>
      {/if}
    {/each}
  {/if}
</div>

<details open>
  <summary class="cursor-pointer font-medium">Advanced Options</summary>
  <div class="flex flex-col gap-3 py-3">
    {#if advanceOptions}
      {#each advanceOptions as params}
        {#if params.field === FieldType.range}
          <InputRange {params} bind:value={pipelineValues[params.title]}></InputRange>
        {:else if params.field === FieldType.seed}
          <SeedInput bind:value={pipelineValues[params.title]}></SeedInput>
        {:else if params.field === FieldType.textarea}
          <TextArea {params} bind:value={pipelineValues[params.title]}></TextArea>
        {/if}
      {/each}
    {/if}
  </div>
</details>