Switch event listener

This commit is contained in:
rxdn 2023-07-15 19:45:25 +01:00
parent b936871bad
commit e35f4b55bc
4 changed files with 9 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<label class="form-label">{label}</label> <label class="form-label">{label}</label>
<WrappedSelect placeholder="Select panel..." items={panels} optionIdentifier="panel_id" nameMapper={labelMapper} <WrappedSelect placeholder="Select panel..." items={panels} optionIdentifier="panel_id" nameMapper={labelMapper}
bind:selectedValue={selectedRaw} on:select={update} on:clear={handleClear} {isMulti} {isSearchable} /> bind:selectedValue={selectedRaw} on:change={update} on:clear={handleClear} {isMulti} {isSearchable} />
<script> <script>
import {onMount} from "svelte"; import {onMount} from "svelte";
@ -24,6 +24,8 @@
selectedRaw = []; selectedRaw = [];
} }
console.log(selectedRaw)
if (isMulti) { if (isMulti) {
selected = selectedRaw.map((panel) => panel.panel_id); selected = selectedRaw.map((panel) => panel.panel_id);
} else { } else {

View File

@ -1,6 +1,7 @@
<Select {items} <Select {items}
bind:value={selectedValue} bind:value={selectedValue}
on:select on:change
on:clear
searchable={searchable} searchable={searchable}
clearable={isClearable} clearable={isClearable}
itemId={optionIdentifier} itemId={optionIdentifier}

View File

@ -8,7 +8,7 @@
<div class="col-1"> <div class="col-1">
<WrappedSelect items={mentionItems} <WrappedSelect items={mentionItems}
bind:selectedValue={selectedMentions} bind:selectedValue={selectedMentions}
on:select={updateMentions} on:change={updateMentions}
optionIdentifier="id" optionIdentifier="id"
nameMapper={mentionNameMapper} nameMapper={mentionNameMapper}
placeholder="Select roles..." placeholder="Select roles..."
@ -19,7 +19,7 @@
<label class="form-label">Support Teams</label> <label class="form-label">Support Teams</label>
<WrappedSelect items={teamsWithDefault} <WrappedSelect items={teamsWithDefault}
bind:selectedValue={selectedTeams} bind:selectedValue={selectedTeams}
on:select={updateTeams} on:change={updateTeams}
optionIdentifier="id" optionIdentifier="id"
nameMapper={nameMapper} nameMapper={nameMapper}
placeholder="Select teams..." placeholder="Select teams..."
@ -129,7 +129,7 @@
optionIdentifier="id" optionIdentifier="id"
nameMapper={emojiNameMapper} nameMapper={emojiNameMapper}
placeholderAlwaysShow={true} placeholderAlwaysShow={true}
on:select={handleCustomEmojiChange} /> on:change={handleCustomEmojiChange} />
</div> </div>
{:else} {:else}
<EmojiInput col1=true bind:value={data.emote}/> <EmojiInput col1=true bind:value={data.emote}/>

View File

@ -23,7 +23,7 @@
<div class="col-1"> <div class="col-1">
<WrappedSelect isSearchable={false} isClearable={false} optionIdentifier="id" items={teams} placeholder="Select a team..." <WrappedSelect isSearchable={false} isClearable={false} optionIdentifier="id" items={teams} placeholder="Select a team..."
bind:selectedValue={activeTeam} nameMapper={labelMapper} bind:selectedValue={activeTeam} nameMapper={labelMapper}
on:select={updateActiveTeam}/> on:change={updateActiveTeam}/>
</div> </div>
</div> </div>