@homebound/beam 2.312.0 → 2.313.1

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.
@@ -24,6 +24,10 @@ export declare function useGridTableApi<R extends Kinded>(): GridTableApi<R>;
24
24
  export type GridTableApi<R extends Kinded> = {
25
25
  /** Scrolls row `index` into view; only supported with `as=virtual` and after a `useEffect`. */
26
26
  scrollToIndex(index: number): void;
27
+ /** Returns the currently-visible rows. */
28
+ getVisibleRows(): GridDataRow<R>[];
29
+ /** Returns the currently-visible rows of the given `kind`. */
30
+ getVisibleRows<K extends R["kind"]>(kind: K): GridDataRow<DiscriminateUnion<R, "kind", K>>[];
27
31
  /** Returns the ids of currently-selected rows. */
28
32
  getSelectedRowIds(): string[];
29
33
  getSelectedRowIds<K extends R["kind"]>(kind: K): string[];
@@ -65,6 +69,7 @@ export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<
65
69
  scrollToIndex(index: number): void;
66
70
  getSelectedRowIds(kind?: string): string[];
67
71
  getSelectedRows(kind?: string): any;
72
+ getVisibleRows(kind?: string): any;
68
73
  clearSelections(id?: string): void;
69
74
  setActiveRowId(id: string | undefined): void;
70
75
  setActiveCellId(id: string | undefined): void;
@@ -48,7 +48,11 @@ class GridTableApiImpl {
48
48
  }
49
49
  // The `any` is not great, but getting the overload to handle the optional kind is annoying
50
50
  getSelectedRows(kind) {
51
- return this.tableState.selectedRows.filter((row) => !kind || row.kind === kind);
51
+ return this.tableState.selectedRows.filter((rs) => !kind || rs.kind === kind).map((rs) => rs.row);
52
+ }
53
+ // The `any` is not great, but getting the overload to handle the optional kind is annoying
54
+ getVisibleRows(kind) {
55
+ return this.tableState.visibleRows.filter((row) => !kind || row.kind === kind).map((rs) => rs.row);
52
56
  }
53
57
  clearSelections(id) {
54
58
  this.tableState.selectRow("header", false);
@@ -65,7 +65,7 @@ export declare class TableState<R extends Kinded> {
65
65
  * Returns selected data rows (non-header, non-totals, etc.), ignoring rows that
66
66
  * have `row.selectable !== false`.
67
67
  */
68
- get selectedRows(): GridDataRow<R>[];
68
+ get selectedRows(): RowState<R>[];
69
69
  /** Returns kept group row, with the latest kept children, if any. */
70
70
  get keptRowGroup(): GridDataRow<R>;
71
71
  /** Returns kept rows, i.e. those that were user-selected but then client-side or server-side filtered. */
@@ -179,9 +179,7 @@ class TableState {
179
179
  * have `row.selectable !== false`.
180
180
  */
181
181
  get selectedRows() {
182
- return this.rowStates.allStates
183
- .filter((rs) => rs.isSelected && !utils_1.reservedRowKinds.includes(rs.row.kind))
184
- .map((rs) => rs.row);
182
+ return this.rowStates.allStates.filter((rs) => rs.isSelected && !utils_1.reservedRowKinds.includes(rs.row.kind));
185
183
  }
186
184
  /** Returns kept group row, with the latest kept children, if any. */
187
185
  get keptRowGroup() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.312.0",
3
+ "version": "2.313.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",