fixed regression - broken select tag, because of Svelte upgrade

This commit is contained in:
Jan Prochazka 2021-09-29 20:55:34 +02:00
parent 97215e31e9
commit 99876e3158
3 changed files with 6 additions and 5 deletions

View File

@ -10,6 +10,7 @@
export let isNative = false; export let isNative = false;
export let isMulti = false; export let isMulti = false;
export let notSelected = null; export let notSelected = null;
export let defaultValue = '';
let listOpen = false; let listOpen = false;
let isFocused = false; let isFocused = false;
@ -21,18 +22,19 @@
{#if isNative} {#if isNative}
<select <select
value={value || defaultValue}
{...$$restProps} {...$$restProps}
on:change={e => { on:change={e => {
dispatch('change', e.target['value']); dispatch('change', e.target['value']);
}} }}
> >
{#if notSelected} {#if notSelected}
<option value="" selected={!value}> <option value="">
{_.isString(notSelected) ? notSelected : '(not selected)'} {_.isString(notSelected) ? notSelected : '(not selected)'}
</option> </option>
{/if} {/if}
{#each _.compact(options) as x (x.value)} {#each _.compact(options) as x (x.value)}
<option value={x.value} selected={value == x.value}> <option value={x.value}>
{x.label} {x.label}
</option> </option>
{/each} {/each}

View File

@ -24,7 +24,6 @@
$: disabledFields = (currentAuthType ? currentAuthType.disabledFields : null) || []; $: disabledFields = (currentAuthType ? currentAuthType.disabledFields : null) || [];
$: driver = $extensions.drivers.find(x => x.engine == engine); $: driver = $extensions.drivers.find(x => x.engine == engine);
$: defaultDatabase = $values.defaultDatabase; $: defaultDatabase = $values.defaultDatabase;
</script> </script>
<FormSelectField <FormSelectField
@ -125,6 +124,7 @@
label="Password mode" label="Password mode"
isNative isNative
name="passwordMode" name="passwordMode"
defaultValue="saveEncrypted"
options={[ options={[
{ value: 'saveEncrypted', label: 'Save and encrypt' }, { value: 'saveEncrypted', label: 'Save and encrypt' },
{ value: 'saveRaw', label: 'Save raw (UNSAFE!!)' }, { value: 'saveRaw', label: 'Save raw (UNSAFE!!)' },
@ -154,5 +154,4 @@
.radio :global(label) { .radio :global(label) {
margin-right: 10px; margin-right: 10px;
} }
</style> </style>

View File

@ -43,4 +43,4 @@
} }
</script> </script>
<FormSelectFieldRaw {name} options={getOptions()} /> <FormSelectFieldRaw {name} options={getOptions()} isNative />