You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-26 05:01:05 +02:00
chore: migrate away from event dispatcher (#12820)
This commit is contained in:
@ -19,22 +19,18 @@
|
||||
import LinkButton from './buttons/link-button.svelte';
|
||||
import { clickOutside } from '$lib/actions/click-outside';
|
||||
import { fly } from 'svelte/transition';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
||||
let className = '';
|
||||
export { className as class };
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
select: T;
|
||||
'click-outside': void;
|
||||
}>();
|
||||
|
||||
export let options: T[];
|
||||
export let selectedOption = options[0];
|
||||
export let showMenu = false;
|
||||
export let controlable = false;
|
||||
export let hideTextOnSmallScreen = true;
|
||||
export let title: string | undefined = undefined;
|
||||
export let onSelect: (option: T) => void;
|
||||
export let onClickOutside: () => void = () => {};
|
||||
|
||||
export let render: (item: T) => string | RenderedOption = String;
|
||||
|
||||
@ -43,11 +39,11 @@
|
||||
showMenu = false;
|
||||
}
|
||||
|
||||
dispatch('click-outside');
|
||||
onClickOutside();
|
||||
};
|
||||
|
||||
const handleSelectOption = (option: T) => {
|
||||
dispatch('select', option);
|
||||
onSelect(option);
|
||||
selectedOption = option;
|
||||
|
||||
showMenu = false;
|
||||
|
Reference in New Issue
Block a user