1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2024-12-01 13:20:54 +00:00

*Really* close all items

This commit is contained in:
Romein van Buren 2023-01-17 16:08:41 +01:00
parent 6d7f35775c
commit 1d200db534
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49

View File

@ -45,11 +45,10 @@
dispatch('selectChild', childKey); dispatch('selectChild', childKey);
} }
function toggleChildren(itemKey, closeAll) { function toggleChildren(itemKey, shift) {
childrenOpen[itemKey] = !childrenOpen[itemKey]; childrenOpen[itemKey] = !childrenOpen[itemKey];
if (closeAll) { if (shift) {
childrenOpen = {}; closeAll();
dispatch('closeAll');
} }
} }
@ -81,6 +80,11 @@
} }
return String(value).slice(0, 1000) + '…'; return String(value).slice(0, 1000) + '…';
} }
function closeAll() {
childrenOpen = {};
dispatch('closeAll');
}
</script> </script>
<div class:grid={level === 0} class:subgrid={level > 0} class:contained> <div class:grid={level === 0} class:subgrid={level > 0} class:contained>
@ -150,7 +154,7 @@
items={item.children} items={item.children}
level={level + 1} level={level + 1}
on:select={e => selectChild(item[key], e.detail)} on:select={e => selectChild(item[key], e.detail)}
on:closeAll={() => (childrenOpen = {})} on:closeAll={closeAll}
/> />
</td> </td>
</tr> </tr>