mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 04:57:59 +00:00
Fixed selected item highlighting bug in grid
This commit is contained in:
parent
1b834de091
commit
a01c56ab69
@ -52,7 +52,10 @@
|
||||
return obj;
|
||||
}
|
||||
else if ((typeof obj === 'object') && (obj !== null)) {
|
||||
return Object.entries(obj).map(([ k, item ]) => {
|
||||
return Object.entries(obj).map(([
|
||||
k,
|
||||
item,
|
||||
]) => {
|
||||
return { ...item, [key]: k };
|
||||
});
|
||||
}
|
||||
@ -67,7 +70,10 @@
|
||||
}
|
||||
|
||||
activeKey = itemKey;
|
||||
activePath = [ ...path.slice(0, level), itemKey ];
|
||||
activePath = [
|
||||
...path.slice(0, level),
|
||||
itemKey,
|
||||
];
|
||||
dispatch('select', { level, itemKey, index, path: activePath });
|
||||
}
|
||||
|
||||
@ -126,12 +132,17 @@
|
||||
</script>
|
||||
|
||||
{#each _items as item, index}
|
||||
{@const selected = canSelect && pathsAreEqual(activePath, [
|
||||
...path,
|
||||
item[key],
|
||||
])}
|
||||
|
||||
<tr
|
||||
on:click={() => select(item[key], index)}
|
||||
on:dblclick={() => doubleClick(item[key], index)}
|
||||
on:contextmenu|preventDefault={evt => showContextMenu(evt, item)}
|
||||
class:selectable={canSelect}
|
||||
class:selected={canSelect && pathsAreEqual(activePath, ...path, item[key])}
|
||||
class:selected
|
||||
class:striped
|
||||
>
|
||||
{#if !hideChildrenToggles}
|
||||
@ -193,7 +204,10 @@
|
||||
{hideChildrenToggles}
|
||||
{canSelect}
|
||||
{canRemoveItems}
|
||||
path={[ ...path, item[key] ]}
|
||||
path={[
|
||||
...path,
|
||||
item[key],
|
||||
]}
|
||||
items={item.children}
|
||||
level={level + 1}
|
||||
bind:activePath
|
||||
|
Loading…
Reference in New Issue
Block a user