@homebound/beam 2.163.0 → 2.164.0

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.
@@ -342,6 +342,8 @@ export declare type GridDataRow<R extends Kinded> = {
342
342
  data: unknown;
343
343
  /** Whether to have the row collapsed (children not visible) on initial load. This will be ignore in subsequent re-renders of the table */
344
344
  initCollapsed?: boolean;
345
+ /** Whether to have the row selected on initial load. This will be ignore in subsequent re-renders of the table */
346
+ initSelected?: boolean;
345
347
  /** Whether row can be selected */
346
348
  selectable?: false;
347
349
  } & IfAny<R, {}, DiscriminateUnion<R, "kind", R["kind"]>>;
@@ -33,6 +33,7 @@ class GridTableApiImpl {
33
33
  /** Called once by the GridTable when it takes ownership of this api instance. */
34
34
  init(persistCollapse, virtuosoRef, rows) {
35
35
  this.rowState.loadCollapse(persistCollapse, rows);
36
+ this.rowState.loadSelected(rows);
36
37
  this.virtuosoRef = virtuosoRef;
37
38
  }
38
39
  scrollToIndex(index) {
@@ -28,6 +28,7 @@ export declare class RowState {
28
28
  */
29
29
  constructor();
30
30
  loadCollapse(persistCollapse: string | undefined, rows: GridDataRow<any>[]): void;
31
+ loadSelected(rows: GridDataRow<any>[]): void;
31
32
  setRows(rows: GridDataRow<any>[]): void;
32
33
  setMatchedRows(rowIds: string[]): void;
33
34
  get selectedIds(): string[];
@@ -67,6 +67,15 @@ class RowState {
67
67
  }
68
68
  }
69
69
  }
70
+ loadSelected(rows) {
71
+ const selectedRows = rows.filter(row => row.initSelected);
72
+ // Initialize with selected rows as defined
73
+ const map = new Map();
74
+ selectedRows.forEach(row => {
75
+ map.set(row.id, "checked");
76
+ });
77
+ this.selectedRows.merge(map);
78
+ }
70
79
  // Updates the list of rows and regenerates the collapsedRows property if needed.
71
80
  setRows(rows) {
72
81
  // If the set of rows are different, and this is the first time adding "data" rows (non "totals" or "header" rows), then collapsedRows may need to be updated.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.163.0",
3
+ "version": "2.164.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",