Commit f92c9cb
fix(component): [worksheet] prevent paste into disabled parent rows (#1846)
* fix(component): [worksheet] prevent paste into disabled parent rows
The paste handler was using `cell.rowIndex + 1` to check against
`disabledRows`, but `disabledRows` contains row IDs, not 1-based
indices. This meant paste was never blocked on disabled rows unless
IDs happened to be sequential numbers. Also, `setSelectedCells` was
called before any disabled check, visually updating the cell value.
Fix uses `rows[cell.rowIndex]?.id` to compare against `disabledRows`
and adds the disabled row check before `setSelectedCells` runs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(component): [worksheet] fix lint errors in useCopyPaste
Remove unnecessary non-null assertion and fix prettier formatting
in the disabled rows filter callback.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(component): [worksheet] remove unnecessary istanbul ignore comment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test(component): [worksheet] add tests for paste into disabled rows
Add two tests to the 'disable rows' describe block:
- Verify paste does not modify a disabled parent row
- Verify paste still works on non-disabled rows when disabledRows is set
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 1a80ed7 commit f92c9cb
File tree
2 files changed
+65
-2
lines changed- packages/big-design/src/components/Worksheet
- hooks/useCopyPaste
2 files changed
+65
-2
lines changedLines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
| 131 | + | |
130 | 132 | | |
131 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
| |||
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| 151 | + | |
145 | 152 | | |
146 | 153 | | |
147 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1573 | 1573 | | |
1574 | 1574 | | |
1575 | 1575 | | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
1576 | 1632 | | |
1577 | 1633 | | |
1578 | 1634 | | |
| |||
0 commit comments