Skip to content

Commit

Permalink
Merge pull request #615 from Neovici/fix/renderMini-index
Browse files Browse the repository at this point in the history
feat: add index to renderMini
  • Loading branch information
megheaiulian authored May 28, 2024
2 parents d891019 + d71ff90 commit 32974ee
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions lib/use-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,28 @@ const arrow = html`
const _getGroupRowClasses = (folded) =>
folded ? 'groupRow groupRow-folded' : 'groupRow';

const renderMinis = (item) => (columns) =>
when(
columns?.length > 0,
() => html`
<div class="itemRow-minis" part="item-minis">
${columns.map(
(column) =>
html`<div
class="itemRow-mini"
part="item-mini item-mini-${column.name}"
>
${(column.renderMini ?? column.renderCell)(column, { item })}
</div>`,
)}
</div>
`,
);
const renderMinis =
({ item, index }) =>
(columns) =>
when(
columns?.length > 0,
() => html`
<div class="itemRow-minis" part="item-minis">
${columns.map(
(column) =>
html`<div
class="itemRow-mini"
part="item-mini item-mini-${column.name}"
>
${(column.renderMini ?? column.renderCell)(column, {
item,
index,
})}
</div>`,
)}
</div>
`,
);

const renderItem =
({
Expand Down Expand Up @@ -94,7 +99,7 @@ const renderItem =
${arrow}
</button>
</div>
${renderMinis(item)(miniColumns)}
${renderMinis({ item, index })(miniColumns)}
</div>
<cosmoz-omnitable-item-expand
.columns=${collapsedColumns}
Expand Down

0 comments on commit 32974ee

Please sign in to comment.