Skip to content

Commit

Permalink
Add dynamic number field.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimafisk committed Jul 12, 2022
1 parent b8cfa4f commit 9cdd291
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/defaults/ejected/cms/dynamic_form_input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@
<div class="field">{field} is null</div>
{:else if field === undefined}
<div class="field">{field} is undefined</div>
{:else if field.constructor === "".constructor}
{:else if typeof field === "number"}
<div class="field">
<input id="{label}" type="number" bind:value={field} />
</div>
{:else if typeof field === "string"}
{#if isDate(field)}
<div class="field">
<input type="date" value={makeDate(field)} on:input={date => bindDate(date.target.value)} />
Expand Down Expand Up @@ -219,7 +223,7 @@
<div id="{label}" class="textarea" contenteditable=true bind:innerHTML={field} bind:this={textarea}></div>
</div>
{/if}
{:else if field.constructor === true.constructor}
{:else if typeof field === "boolean"}
<div class="field">
<input id="{label}" type="checkbox" bind:checked={field} /><span>{field}</span>
</div>
Expand Down

0 comments on commit 9cdd291

Please sign in to comment.