1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 21:17:59 +00:00

Update ObjectGrid to not display menu in object

This commit is contained in:
Romein van Buren 2023-01-21 15:12:27 +01:00
parent 01166166e9
commit 53093681ec
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
2 changed files with 9 additions and 5 deletions

View File

@ -5,6 +5,7 @@
export let key = '_id'; export let key = '_id';
export let activePath = []; export let activePath = [];
export let hideObjectIndicators = false; export let hideObjectIndicators = false;
export let getRootMenu = () => undefined;
const columns = [ const columns = [
{ key: 'key', label: 'Key' }, { key: 'key', label: 'Key' },
@ -23,7 +24,7 @@
newItem.key = item[key]; newItem.key = item[key];
newItem.type = getType(item[key]); newItem.type = getType(item[key]);
newItem.children = dissectObject(item); newItem.children = dissectObject(item);
newItem.menu = item.menu; newItem.menu = getRootMenu(key, item[key]);
items = [ ...items, newItem ]; items = [ ...items, newItem ];
} }
} }

View File

@ -50,10 +50,13 @@
</div> </div>
<div class="grid"> <div class="grid">
<ObjectGrid key="name" data={indexes.map(idx => ({ <ObjectGrid
...idx, key="name"
menu: [ { label: 'Drop this index', fn: () => drop(idx.name) } ], data={indexes}
}))} bind:activePath on:trigger={e => openJson(e.detail.itemKey)} /> getRootMenu={(_, idx) => [ { label: 'Drop this index', fn: () => drop(idx.name) } ]}
bind:activePath
on:trigger={e => openJson(e.detail.itemKey)}
/>
</div> </div>
</div> </div>