@particle-academy/fancy-sheets 0.4.4 → 0.4.5

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
@@ -1607,7 +1607,7 @@ function ColumnResizeHandle({ colIndex }) {
1607
1607
  }
1608
1608
  ColumnResizeHandle.displayName = "ColumnResizeHandle";
1609
1609
  function ColumnHeaders() {
1610
- const { columnCount, rowCount, rowHeight, getColumnWidth, selection, selectRange, _isDragging, isCellSelected } = useSpreadsheet();
1610
+ const { columnCount, rowCount, rowHeight, getColumnWidth, selection, selectRange, _isDragging } = useSpreadsheet();
1611
1611
  const handleColumnMouseDown = react.useCallback(
1612
1612
  (colIdx, e) => {
1613
1613
  if (e.button !== 0) return;
@@ -1652,7 +1652,15 @@ function ColumnHeaders() {
1652
1652
  }
1653
1653
  ),
1654
1654
  Array.from({ length: columnCount }, (_, i) => {
1655
- const isColSelected = isCellSelected(toAddress(0, i));
1655
+ const isColSelected = selection.ranges.some((range) => {
1656
+ const s = parseAddress(range.start);
1657
+ const e = parseAddress(range.end);
1658
+ const minCol = Math.min(s.col, e.col);
1659
+ const maxCol = Math.max(s.col, e.col);
1660
+ const minRow = Math.min(s.row, e.row);
1661
+ const maxRow = Math.max(s.row, e.row);
1662
+ return i >= minCol && i <= maxCol && minRow === 0 && maxRow >= rowCount - 1;
1663
+ });
1656
1664
  return /* @__PURE__ */ jsxRuntime.jsxs(
1657
1665
  "div",
1658
1666
  {
@@ -1678,8 +1686,16 @@ function ColumnHeaders() {
1678
1686
  }
1679
1687
  ColumnHeaders.displayName = "ColumnHeaders";
1680
1688
  function RowHeader({ rowIndex }) {
1681
- const { rowHeight, columnCount, selection, selectRange, _isDragging, isCellSelected } = useSpreadsheet();
1682
- const isRowSelected = isCellSelected(toAddress(rowIndex, 0));
1689
+ const { rowHeight, columnCount, selection, selectRange, _isDragging } = useSpreadsheet();
1690
+ const isRowSelected = selection.ranges.some((range) => {
1691
+ const s = parseAddress(range.start);
1692
+ const e = parseAddress(range.end);
1693
+ const minRow = Math.min(s.row, e.row);
1694
+ const maxRow = Math.max(s.row, e.row);
1695
+ const minCol = Math.min(s.col, e.col);
1696
+ const maxCol = Math.max(s.col, e.col);
1697
+ return rowIndex >= minRow && rowIndex <= maxRow && minCol === 0 && maxCol >= columnCount - 1;
1698
+ });
1683
1699
  const handleMouseDown = react.useCallback(
1684
1700
  (e) => {
1685
1701
  if (e.button !== 0) return;