@mirror-physics/fractal-ui 0.2.0-next.66 → 0.2.0-next.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1476,6 +1476,7 @@ function SortableTable({
|
|
|
1476
1476
|
highlightRow,
|
|
1477
1477
|
selection,
|
|
1478
1478
|
isRowDisabled,
|
|
1479
|
+
isRowSelectionDisabled,
|
|
1479
1480
|
onRowClick,
|
|
1480
1481
|
onRowDoubleClick,
|
|
1481
1482
|
rowAction
|
|
@@ -1523,7 +1524,7 @@ function SortableTable({
|
|
|
1523
1524
|
const startIndex = (page - 1) * pageSize;
|
|
1524
1525
|
return sorted.slice(startIndex, startIndex + pageSize);
|
|
1525
1526
|
}, [pagination, sorted]);
|
|
1526
|
-
const selectableRows = selection ? data.filter((row) => !isRowDisabled?.(row)) : [];
|
|
1527
|
+
const selectableRows = selection ? data.filter((row) => !isRowDisabled?.(row) && !isRowSelectionDisabled?.(row)) : [];
|
|
1527
1528
|
const selectedRowCount = selection ? selectableRows.filter(selection.isSelected).length : 0;
|
|
1528
1529
|
const allRowsSelected = selectableRows.length > 0 && selectedRowCount === selectableRows.length;
|
|
1529
1530
|
const someRowsSelected = selectedRowCount > 0 && !allRowsSelected;
|
|
@@ -1566,6 +1567,10 @@ function SortableTable({
|
|
|
1566
1567
|
disabled: selectableRows.length === 0,
|
|
1567
1568
|
indeterminate: someRowsSelected,
|
|
1568
1569
|
onCheckedChange: (checked) => {
|
|
1570
|
+
if (selection.onSelectAllChange) {
|
|
1571
|
+
selection.onSelectAllChange(selectableRows, checked);
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1569
1574
|
selectableRows.forEach((row) => {
|
|
1570
1575
|
if (selection.isSelected(row) !== checked) {
|
|
1571
1576
|
selection.onSelectedChange(row, checked);
|
|
@@ -1620,6 +1625,7 @@ function SortableTable({
|
|
|
1620
1625
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: visibleRows.map((row, rowIndex) => {
|
|
1621
1626
|
const highlighted = highlightRow?.(row, rowIndex) ?? false;
|
|
1622
1627
|
const disabled = isRowDisabled?.(row) ?? false;
|
|
1628
|
+
const selectionDisabled = disabled || (isRowSelectionDisabled?.(row) ?? false);
|
|
1623
1629
|
const interactive = !disabled && Boolean(onRowClick || onRowDoubleClick);
|
|
1624
1630
|
const action = !disabled && rowAction ? {
|
|
1625
1631
|
label: rowAction.label(row, rowIndex),
|
|
@@ -1653,11 +1659,11 @@ function SortableTable({
|
|
|
1653
1659
|
Checkbox,
|
|
1654
1660
|
{
|
|
1655
1661
|
"aria-label": selection.getRowLabel(row),
|
|
1656
|
-
checked: !
|
|
1657
|
-
disabled,
|
|
1662
|
+
checked: !selectionDisabled && selection.isSelected(row),
|
|
1663
|
+
disabled: selectionDisabled,
|
|
1658
1664
|
onClick: (event) => event.stopPropagation(),
|
|
1659
1665
|
onCheckedChange: (checked) => {
|
|
1660
|
-
if (!
|
|
1666
|
+
if (!selectionDisabled) selection.onSelectedChange(row, checked);
|
|
1661
1667
|
}
|
|
1662
1668
|
}
|
|
1663
1669
|
) }),
|