Spaces:
Running
Running
File size: 1,372 Bytes
b7a4f8b cd932aa db436f7 cd932aa db436f7 321edbc db436f7 cd932aa aa0792f cd932aa 9b4d818 cd932aa b7a4f8b cd932aa b7a4f8b 52ec402 cd932aa 1a96959 cd932aa dc3ebef cd932aa 52ec402 cd932aa 52ec402 b7a4f8b |
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 47 48 49 50 51 52 53 54 55 56 57 |
<script lang="ts">
export let name: string;
export let value;
export let meta;
export let onChange;
</script>
<label class="param">
<span class="param-name">{name.replace(/_/g, ' ')}</span>
{#if meta?.type?.format === 'collapsed'}
<button class="collapsed-param form-control form-control-sm">
⋯
</button>
{:else if meta?.type?.format === 'textarea'}
<textarea class="form-control form-control-sm"
rows="6"
value={value}
on:change={(evt) => onChange(evt.currentTarget.value)}
/>
{:else if meta?.type?.enum}
<select class="form-select form-select-sm"
value={value || meta.type.enum[0]}
on:change={(evt) => onChange(evt.currentTarget.value)}
>
{#each meta.type.enum as option}
<option value={option}>{option}</option>
{/each}
</select>
{:else}
<input class="form-control form-control-sm"
value={value}
on:change={(evt) => onChange(evt.currentTarget.value)}
/>
{/if}
</label>
<style>
.param {
padding: 4px 8px 4px 8px;
display: block;
}
.param-name {
display: block;
font-size: 10px;
letter-spacing: 0.05em;
margin-left: 10px;
background: var(--bs-border-color);
width: fit-content;
padding: 2px 8px;
border-radius: 4px 4px 0 0;
}
.collapsed-param {
min-height: 20px;
line-height: 10px;
}
</style>
|