show both expand / collapse all

This commit is contained in:
Nikita Galaiko 2023-08-03 09:01:22 +02:00
parent 2f40e62dbe
commit 65396ce379

View File

@ -104,14 +104,18 @@
allExpanded = undefined;
}
}
function handleToggleExpandAll() {
if (allExpanded == true) {
files.forEach((f) => setExpandedWithCache(f, false));
allExpanded = false;
} else {
files.forEach((f) => setExpandedWithCache(f, true));
allExpanded = true;
}
$: allCollapsed = files.every((f) => getExpandedWithCacheFallback(f) === false);
function handleCollapseAll() {
files.forEach((f) => setExpandedWithCache(f, false));
allExpanded = false;
files = files;
}
function handleExpandAll() {
files.forEach((f) => setExpandedWithCache(f, true));
allExpanded = true;
files = files;
}
@ -526,13 +530,9 @@
Unapply
</PopupMenuItem>
<PopupMenuItem on:click={handleToggleExpandAll}>
{#if allExpanded}
Collapse all
{:else}
Expand all
{/if}
</PopupMenuItem>
<PopupMenuItem on:click={handleExpandAll} disabled={allExpanded}>Expand all</PopupMenuItem>
<PopupMenuItem on:click={handleCollapseAll} disabled={allCollapsed}>Collapse all</PopupMenuItem>
<div class="mx-3">
<div class="my-2 h-[0.0625rem] w-full bg-light-300 dark:bg-dark-500" />