Add svelte as a view engine to swaf #33

Merged
ashpie merged 97 commits from svelte into develop 2021-11-09 19:31:22 +01:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 4d9dae5e3b - Show all commits

View File

@ -65,11 +65,11 @@
hint="This is a hint" validation={{message: 'This is a validation error'}}/> hint="This is a hint" validation={{message: 'This is a validation error'}}/>
<Field type="password" name="password" placeholder="Password field" icon="key" <Field type="password" name="password" placeholder="Password field" icon="key"
hint="This is a hint" validation={{message: 'This is a validation error'}}/> hint="This is a hint" validation={{message: 'This is a validation error'}}/>
<Field type="duration" name="duration" placeholder="Duration field" icon="clock" extraData={[ <Field type="duration" name="duration" placeholder="Duration field" icon="clock" extraData={{
'h', h: 'Hours',
'm', m: 'Minutes',
's', s: 'Seconds',
]} hint="This is a hint" validation={{message: 'This is a validation error'}}/> }} hint="This is a hint" validation={{message: 'This is a validation error'}}/>
<Field type="select" name="select" placeholder="Select field" icon="list" extraData={[ <Field type="select" name="select" placeholder="Select field" icon="list" extraData={[
'Option 1', 'Option 1',
'Option 2', 'Option 2',

View File

@ -387,13 +387,13 @@
{#if type === 'duration'} {#if type === 'duration'}
<fieldset> <fieldset>
<legend>{placeholder}</legend> <legend>{placeholder}</legend>
{#each extraData as f} {#each Object.keys(extraData) as f}
<div class="time-input"> <div class="time-input">
<input type="number" name="{name}[{f}]" id="{fieldId}-{f}" <input type="number" name="{name}[{f}]" id="{fieldId}-{f}"
value={durationValue(f)} value={durationValue(f)}
min="0" max={(f === 's' || f === 'm') && '60' || undefined} min="0" max={(f === 's' || f === 'm') && '60' || undefined}
{...$$restProps} on:click={e => e.stopPropagation()}> {...$$restProps} on:click={e => e.stopPropagation()}>
<label for="{fieldId}-{f}" on:click={e => e.stopPropagation()}>{f}</label> <label for="{fieldId}-{f}" on:click={e => e.stopPropagation()}>{extraData[f] || f}</label>
</div> </div>
{/each} {/each}
</fieldset> </fieldset>