@mirror-physics/fractal-ui 0.2.0-next.66 → 0.2.0-next.67

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 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;
@@ -1620,6 +1621,7 @@ function SortableTable({
1620
1621
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: visibleRows.map((row, rowIndex) => {
1621
1622
  const highlighted = highlightRow?.(row, rowIndex) ?? false;
1622
1623
  const disabled = isRowDisabled?.(row) ?? false;
1624
+ const selectionDisabled = disabled || (isRowSelectionDisabled?.(row) ?? false);
1623
1625
  const interactive = !disabled && Boolean(onRowClick || onRowDoubleClick);
1624
1626
  const action = !disabled && rowAction ? {
1625
1627
  label: rowAction.label(row, rowIndex),
@@ -1653,11 +1655,11 @@ function SortableTable({
1653
1655
  Checkbox,
1654
1656
  {
1655
1657
  "aria-label": selection.getRowLabel(row),
1656
- checked: !disabled && selection.isSelected(row),
1657
- disabled,
1658
+ checked: !selectionDisabled && selection.isSelected(row),
1659
+ disabled: selectionDisabled,
1658
1660
  onClick: (event) => event.stopPropagation(),
1659
1661
  onCheckedChange: (checked) => {
1660
- if (!disabled) selection.onSelectedChange(row, checked);
1662
+ if (!selectionDisabled) selection.onSelectedChange(row, checked);
1661
1663
  }
1662
1664
  }
1663
1665
  ) }),