From 1d200db53407121ee51e313c3d444744d2d25408 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Tue, 17 Jan 2023 16:08:41 +0100 Subject: [PATCH] *Really* close all items --- frontend/src/components/grid.svelte | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/grid.svelte b/frontend/src/components/grid.svelte index 8ee7cf0..675c495 100644 --- a/frontend/src/components/grid.svelte +++ b/frontend/src/components/grid.svelte @@ -45,11 +45,10 @@ dispatch('selectChild', childKey); } - function toggleChildren(itemKey, closeAll) { + function toggleChildren(itemKey, shift) { childrenOpen[itemKey] = !childrenOpen[itemKey]; - if (closeAll) { - childrenOpen = {}; - dispatch('closeAll'); + if (shift) { + closeAll(); } } @@ -81,6 +80,11 @@ } return String(value).slice(0, 1000) + '…'; } + + function closeAll() { + childrenOpen = {}; + dispatch('closeAll'); + }
0} class:contained> @@ -150,7 +154,7 @@ items={item.children} level={level + 1} on:select={e => selectChild(item[key], e.detail)} - on:closeAll={() => (childrenOpen = {})} + on:closeAll={closeAll} />