mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
This commit is contained in:
parent
7b65a15345
commit
2aeeb728a2
1 changed files with 11 additions and 2 deletions
|
@ -165,9 +165,18 @@
|
||||||
let refSelectAll = null;
|
let refSelectAll = null;
|
||||||
|
|
||||||
$: batchSelectedIds.set(selectedRowIds);
|
$: batchSelectedIds.set(selectedRowIds);
|
||||||
|
$: expandableRowIds = rows
|
||||||
|
.map((row) => row.id)
|
||||||
|
.filter((id) => !nonExpandableRowIds.includes(id));
|
||||||
$: indeterminate =
|
$: indeterminate =
|
||||||
selectedRowIds.length > 0 && selectedRowIds.length < rows.length;
|
selectedRowIds.length > 0 && selectedRowIds.length < rows.length;
|
||||||
$: if (batchExpansion) expandable = true;
|
$: if (batchExpansion) {
|
||||||
|
expandable = true;
|
||||||
|
|
||||||
|
if (expandedRowIds.length < expandableRowIds.length) {
|
||||||
|
expanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
$: if (radio || batchSelection) selectable = true;
|
$: if (radio || batchSelection) selectable = true;
|
||||||
$: tableSortable.set(sortable);
|
$: tableSortable.set(sortable);
|
||||||
$: headerKeys = headers.map(({ key }) => key);
|
$: headerKeys = headers.map(({ key }) => key);
|
||||||
|
@ -249,7 +258,7 @@
|
||||||
class:bx--table-expand__button="{true}"
|
class:bx--table-expand__button="{true}"
|
||||||
on:click="{() => {
|
on:click="{() => {
|
||||||
expanded = !expanded;
|
expanded = !expanded;
|
||||||
expandedRowIds = expanded ? rows.map((row) => row.id) : [];
|
expandedRowIds = expanded ? expandableRowIds : [];
|
||||||
|
|
||||||
dispatch('click:header--expand', { expanded });
|
dispatch('click:header--expand', { expanded });
|
||||||
}}"
|
}}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue