refactor(data-table): reuse rowIds

This commit is contained in:
Eric Liu 2022-03-12 19:05:39 -08:00
commit 70c622f9eb

View file

@ -174,12 +174,13 @@
let refSelectAll = null; let refSelectAll = null;
$: batchSelectedIds.set(selectedRowIds); $: batchSelectedIds.set(selectedRowIds);
$: expandableRowIds = rows $: rowIds = rows.map((row) => row.id);
.map((row) => row.id) $: expandableRowIds = rowIds.filter(
.filter((id) => !nonExpandableRowIds.includes(id)); (id) => !nonExpandableRowIds.includes(id)
$: selectableRowIds = rows );
.map((row) => row.id) $: selectableRowIds = rowIds.filter(
.filter((id) => !nonSelectableRowIds.includes(id)); (id) => !nonSelectableRowIds.includes(id)
);
$: indeterminate = $: indeterminate =
selectedRowIds.length > 0 && selectedRowIds.length < rows.length; selectedRowIds.length > 0 && selectedRowIds.length < rows.length;
$: if (batchExpansion) { $: if (batchExpansion) {