mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
selecting all iteratively instead or recursively
This commit is contained in:
@@ -61,20 +61,13 @@ function selectAll(selected: boolean) {
|
||||
const newValue: string[] = [];
|
||||
if (selected) {
|
||||
props.options.forEach((option) => {
|
||||
selectRecursively(option, newValue);
|
||||
if (option.value) {
|
||||
newValue.push(option.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
emit("input", newValue.length === 0 ? null : newValue);
|
||||
}
|
||||
|
||||
function selectRecursively(option: Option, currentValue: string[]) {
|
||||
currentValue.push(option.value);
|
||||
if (option.options.length > 0) {
|
||||
option.options.forEach((option) => {
|
||||
selectRecursively(option, currentValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user