feat(table): Add prop isRowSelectable - #2228
Conversation
…state
- Introduce CheckboxRowLevelProps
- Apply in EditableInstrumentsTemplate: soft-deleted rows show checked+disabled
checkbox via { disabled: true, checked: true }
- Add Playwright CT test for soft-delete checkbox persistence across row selection
- Document in README
✅ Deploy Preview for papaya-valkyrie-395400 canceled.
|
heswell
left a comment
There was a problem hiding this comment.
We should park this. The problem is is intended to solve is better addressed with the solution we discussed offline.
Replace checkboxRowLevelProps with isRowSelectable: (dataRow: DataRow) => boolean on TableProps. Non-selectable rows are skipped in useSelection (all selection models — checkbox, extended, single, block). They receive a vuuTableRow-noSelect CSS class which styles the checkbox as visually disabled. The checkbox checked state is preserved for non-selectable rows even when isSelected is cleared by a subsequent selection.
…undo - tighten componentProps to Record<string, string|number|boolean> - UndoCellRenderer reads editSession from context; removes functions from componentProps - deleteSelectedRows guards against double-counting already-deleted keys - useEditableTable tracks deleteCount via editSession editState event
| * When provided on the checkbox column, rows returning false | ||
| * are always shown as checked (pending deletion) regardless of isSelected. | ||
| */ | ||
| isRowSelectable?: (dataRow: DataRow) => boolean; |
There was a problem hiding this comment.
We have this on tableProps, I don't think we need it on a column as well
| }); | ||
|
|
||
| const isChecked = !!dataRow.isSelected; | ||
| const { isRowSelectable } = column; |
There was a problem hiding this comment.
I don't think this is a general rule. It might be the case that a 'soft deleted' row could be assumed to be checked, if selection is being used for delete.
There are definitely other use cases though where we might want to make a row non-selectable based on data, where we would not want the checkbox to appear selected.
we can effect this locally be taking advantage of the noSelect className. eg.if we want the unselectable checkboxes to appear dimmed but checkin in a specific scenarion, we can use local css and the noSelect class to achieve this.
| : CheckboxColumnDescriptor(selectionModel, checkboxColumnWidth), | ||
| 1, | ||
| ); | ||
| if (isRowSelectable) { |
There was a problem hiding this comment.
This is all good but you're dodging the trickiest part which is the block selection logic (see selection-utils)
If user selects a row, then shift selects to select a block, we must not include any rows that are not selectable.
This will mean changing the single block request to one or more block requests that omit the non-selectable rows
feat(table): Add prop isRowSelectable