@tanstack/svelte-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.
|
@@ -2027,7 +2027,7 @@
|
|
|
2027
2027
|
const isSelected = row.getIsSelected();
|
|
2028
2028
|
table.setRowSelection(old => {
|
|
2029
2029
|
value = typeof value !== 'undefined' ? value : !isSelected;
|
|
2030
|
-
if (isSelected === value) {
|
|
2030
|
+
if (row.getCanSelect() && isSelected === value) {
|
|
2031
2031
|
return old;
|
|
2032
2032
|
}
|
|
2033
2033
|
const selectedRowIds = {
|
|
@@ -2148,23 +2148,37 @@
|
|
|
2148
2148
|
return (_selection$row$id = selection[row.id]) != null ? _selection$row$id : false;
|
|
2149
2149
|
}
|
|
2150
2150
|
function isSubRowSelected(row, selection, table) {
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2151
|
+
var _row$subRows3;
|
|
2152
|
+
if (!((_row$subRows3 = row.subRows) != null && _row$subRows3.length)) return false;
|
|
2153
|
+
let allChildrenSelected = true;
|
|
2154
|
+
let someSelected = false;
|
|
2155
|
+
row.subRows.forEach(subRow => {
|
|
2156
|
+
// Bail out early if we know both of these
|
|
2157
|
+
if (someSelected && !allChildrenSelected) {
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
if (subRow.getCanSelect()) {
|
|
2159
2161
|
if (isRowSelected(subRow, selection)) {
|
|
2160
2162
|
someSelected = true;
|
|
2161
2163
|
} else {
|
|
2162
2164
|
allChildrenSelected = false;
|
|
2163
2165
|
}
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
// Check row selection of nested subrows
|
|
2169
|
+
if (subRow.subRows && subRow.subRows.length) {
|
|
2170
|
+
const subRowChildrenSelected = isSubRowSelected(subRow, selection);
|
|
2171
|
+
if (subRowChildrenSelected === 'all') {
|
|
2172
|
+
someSelected = true;
|
|
2173
|
+
} else if (subRowChildrenSelected === 'some') {
|
|
2174
|
+
someSelected = true;
|
|
2175
|
+
allChildrenSelected = false;
|
|
2176
|
+
} else {
|
|
2177
|
+
allChildrenSelected = false;
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
return allChildrenSelected ? 'all' : someSelected ? 'some' : false;
|
|
2168
2182
|
}
|
|
2169
2183
|
|
|
2170
2184
|
const reSplitAlphaNumeric = /([0-9]+)/gm;
|