@tanstack/react-table 8.9.9 → 8.9.11
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.
|
@@ -2047,7 +2047,7 @@
|
|
|
2047
2047
|
const isSelected = row.getIsSelected();
|
|
2048
2048
|
table.setRowSelection(old => {
|
|
2049
2049
|
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
2050
|
-
if (isSelected === value) {
|
|
2050
|
+
if (row.getCanSelect() && isSelected === value) {
|
|
2051
2051
|
return old;
|
|
2052
2052
|
}
|
|
2053
2053
|
const selectedRowIds = {
|
|
@@ -2168,23 +2168,37 @@
|
|
|
2168
2168
|
return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
|
|
2169
2169
|
}
|
|
2170
2170
|
function isSubRowSelected(row, selection, table) {
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2171
|
+
var _row$subRows3;
|
|
2172
|
+
if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
|
|
2173
|
+
let allChildrenSelected = true;
|
|
2174
|
+
let someSelected = false;
|
|
2175
|
+
row.subRows.forEach(subRow => {
|
|
2176
|
+
// Bail out early if we know both of these
|
|
2177
|
+
if (someSelected && !allChildrenSelected) {
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
if (subRow.getCanSelect()) {
|
|
2179
2181
|
if (isRowSelected(subRow, selection)) {
|
|
2180
2182
|
someSelected = true;
|
|
2181
2183
|
} else {
|
|
2182
2184
|
allChildrenSelected = false;
|
|
2183
2185
|
}
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
// Check row selection of nested subrows
|
|
2189
|
+
if (subRow.subRows && subRow.subRows.length) {
|
|
2190
|
+
const subRowChildrenSelected = isSubRowSelected(subRow, selection);
|
|
2191
|
+
if (subRowChildrenSelected === 'all') {
|
|
2192
|
+
someSelected = true;
|
|
2193
|
+
} else if (subRowChildrenSelected === 'some') {
|
|
2194
|
+
someSelected = true;
|
|
2195
|
+
allChildrenSelected = false;
|
|
2196
|
+
} else {
|
|
2197
|
+
allChildrenSelected = false;
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
});
|
|
2201
|
+
return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
|
|
2188
2202
|
}
|
|
2189
2203
|
|
|
2190
2204
|
const reSplitAlphaNumeric = /([0-9]+)/gm;
|