@homebound/beam 2.302.0 → 2.302.2
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.
|
@@ -232,7 +232,9 @@ function GridTable(props) {
|
|
|
232
232
|
if (tooManyClientSideRows) {
|
|
233
233
|
visibleDataRows = visibleDataRows.slice(0, filterMaxRows + keptSelectedRows.length);
|
|
234
234
|
}
|
|
235
|
-
|
|
235
|
+
(0, react_1.useEffect)(() => {
|
|
236
|
+
tableState.setMatchedRows(filteredRowIds);
|
|
237
|
+
}, [tableState, filteredRowIds]);
|
|
236
238
|
// Push back to the caller a way to ask us where a row is.
|
|
237
239
|
const { rowLookup } = props;
|
|
238
240
|
if (rowLookup) {
|
|
@@ -48,4 +48,16 @@ export declare class RowState {
|
|
|
48
48
|
get isKept(): boolean;
|
|
49
49
|
private get inferSelectedState();
|
|
50
50
|
private get visibleChildren();
|
|
51
|
+
/**
|
|
52
|
+
* Returns whether this row should act like a parent.
|
|
53
|
+
*
|
|
54
|
+
* This means "has children" and "does not have inferSelectedState: false"
|
|
55
|
+
* set. I.e. `inferSelectedState: false` allows a parent with children to
|
|
56
|
+
* still act as its own selectable identity.
|
|
57
|
+
*
|
|
58
|
+
* We also check `children.length > 0`, because sometimes pages will calc a
|
|
59
|
+
* row's children as `children = someList.map(...)`, and if the list is empty,
|
|
60
|
+
* they want the row to be selectable.
|
|
61
|
+
*/
|
|
62
|
+
private get isParent();
|
|
51
63
|
}
|
|
@@ -37,7 +37,7 @@ class RowState {
|
|
|
37
37
|
*/
|
|
38
38
|
get isSelected() {
|
|
39
39
|
// We consider group rows selected if all of their children are selected.
|
|
40
|
-
if (this.
|
|
40
|
+
if (this.isParent)
|
|
41
41
|
return this.selectedState === "checked";
|
|
42
42
|
return this.selected;
|
|
43
43
|
}
|
|
@@ -46,7 +46,7 @@ class RowState {
|
|
|
46
46
|
// Parent `selectedState` is special b/c it does not directly depend on the parent's own selected-ness,
|
|
47
47
|
// but instead depends on the current visible children. I.e. a parent might be "selected", but then the
|
|
48
48
|
// client-side filter changes, a child reappears, and we need to transition to partial-ness.
|
|
49
|
-
if (this.
|
|
49
|
+
if (this.isParent) {
|
|
50
50
|
// Use visibleChildren b/c if filters are hiding some of our children, we still want to show fully selected
|
|
51
51
|
const children = this.visibleChildren;
|
|
52
52
|
const allChecked = children.every((child) => child.selectedState === "checked");
|
|
@@ -107,8 +107,7 @@ class RowState {
|
|
|
107
107
|
return (this.selected &&
|
|
108
108
|
// Headers, totals, etc., do not need keeping
|
|
109
109
|
!src_1.reservedRowKinds.includes(this.row.kind) &&
|
|
110
|
-
|
|
111
|
-
!(this.children && this.inferSelectedState) &&
|
|
110
|
+
!this.isParent &&
|
|
112
111
|
(!this.isMatched || this.wasRemoved));
|
|
113
112
|
}
|
|
114
113
|
get inferSelectedState() {
|
|
@@ -121,6 +120,20 @@ class RowState {
|
|
|
121
120
|
return (_a = this.children) !== null && _a !== void 0 ? _a : [];
|
|
122
121
|
return (_c = (_b = this.children) === null || _b === void 0 ? void 0 : _b.filter((c) => c.isMatched === true)) !== null && _c !== void 0 ? _c : [];
|
|
123
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Returns whether this row should act like a parent.
|
|
125
|
+
*
|
|
126
|
+
* This means "has children" and "does not have inferSelectedState: false"
|
|
127
|
+
* set. I.e. `inferSelectedState: false` allows a parent with children to
|
|
128
|
+
* still act as its own selectable identity.
|
|
129
|
+
*
|
|
130
|
+
* We also check `children.length > 0`, because sometimes pages will calc a
|
|
131
|
+
* row's children as `children = someList.map(...)`, and if the list is empty,
|
|
132
|
+
* they want the row to be selectable.
|
|
133
|
+
*/
|
|
134
|
+
get isParent() {
|
|
135
|
+
return !!this.children && this.children.length > 0 && this.inferSelectedState;
|
|
136
|
+
}
|
|
124
137
|
/** Pretty toString. */
|
|
125
138
|
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
126
139
|
return `RowState ${this.row.kind}-${this.row.id}`;
|
|
@@ -22,7 +22,7 @@ export type SelectedState = "checked" | "unchecked" | "partial";
|
|
|
22
22
|
export declare class TableState {
|
|
23
23
|
private readonly collapsedRows;
|
|
24
24
|
private persistCollapse;
|
|
25
|
-
rows
|
|
25
|
+
private rows;
|
|
26
26
|
private readonly rowStates;
|
|
27
27
|
activeRowId: string | undefined;
|
|
28
28
|
activeCellId: string | undefined;
|