@particle-academy/fancy-sheets 0.4.4 → 0.4.6

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