action select: add onchange callback
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
tabbable?: boolean;
|
||||
options: ActionSelectOption[];
|
||||
class?: ClassValue | null | undefined;
|
||||
onchange?: (value: ActionSelectOption | undefined) => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -33,14 +34,18 @@
|
||||
stateless = false,
|
||||
tabbable = true,
|
||||
options,
|
||||
class: classValue
|
||||
class: classValue,
|
||||
onchange
|
||||
}: Props = $props();
|
||||
|
||||
const select = new Select<ActionSelectOption>({
|
||||
value: () => value,
|
||||
onValueChange: (val) => {
|
||||
val?.onchoose?.(val);
|
||||
if (!stateless) value = val;
|
||||
if (!stateless) {
|
||||
value = val;
|
||||
onchange?.(val);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user