@homebound/beam 2.296.0 → 2.297.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.
@@ -37,6 +37,8 @@ export type GridTableApi<R extends Kinded> = {
37
37
  setActiveCellId: (id: string | undefined) => void;
38
38
  /** Set selected state of a row by id */
39
39
  selectRow: (id: string, selected?: boolean) => void;
40
+ /** Deletes a row from the table */
41
+ deleteRows: (ids: string[]) => void;
40
42
  /** Toggle collapse state of a row by id */
41
43
  toggleCollapsedRow: (id: string) => void;
42
44
  isCollapsedRow: (id: string) => boolean;
@@ -59,4 +61,5 @@ export declare class GridTableApiImpl<R extends Kinded> implements GridTableApi<
59
61
  isCollapsedRow(id: string): boolean;
60
62
  setVisibleColumns(ids: string[]): void;
61
63
  getVisibleColumnIds(): string[];
64
+ deleteRows(ids: string[]): void;
62
65
  }
@@ -69,5 +69,8 @@ class GridTableApiImpl {
69
69
  getVisibleColumnIds() {
70
70
  return this.tableState.visibleColumnIds;
71
71
  }
72
+ deleteRows(ids) {
73
+ this.tableState.deleteRows(ids);
74
+ }
72
75
  }
73
76
  exports.GridTableApiImpl = GridTableApiImpl;
@@ -67,6 +67,7 @@ export declare class TableState {
67
67
  get collapsedIds(): string[];
68
68
  isCollapsed(id: string): boolean;
69
69
  toggleCollapsed(id: string): void;
70
+ deleteRows(ids: string[]): void;
70
71
  private getMatchedChildrenStates;
71
72
  private setNestedSelectedStates;
72
73
  }
@@ -492,6 +492,16 @@ class TableState {
492
492
  sessionStorage.setItem(this.persistCollapse, JSON.stringify(collapsedIds));
493
493
  }
494
494
  }
495
+ deleteRows(ids) {
496
+ this.rows = this.rows.filter((row) => !ids.includes(row.id));
497
+ this.keptSelectedRows = this.keptSelectedRows.filter((row) => !ids.includes(row.id));
498
+ ids.forEach((id) => {
499
+ this.selectedDataRows.delete(id);
500
+ this.rowSelectedState.delete(id);
501
+ this.collapsedRows.delete(id);
502
+ this.matchedRows.delete(id);
503
+ });
504
+ }
495
505
  getMatchedChildrenStates(children, map) {
496
506
  const respectedChildren = children.flatMap(getChildrenForDerivingSelectState);
497
507
  // When determining the children selected states to base the parent's state from, then only base this off of rows that match the filter or are in the "hidden selected" group (via the `filter` below)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.296.0",
3
+ "version": "2.297.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",