gm-datagrid 0.1.4 → 0.1.5

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.
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { Row } from '../types';
2
+ import { GroupHeader, Row } from '../types';
3
3
  import { DataSetState } from '../dataset/useGMDataSet';
4
4
  interface GridContextValue extends DataSetState {
5
5
  pageRows: Row[];
@@ -12,6 +12,12 @@ interface GridContextValue extends DataSetState {
12
12
  engineReady: boolean;
13
13
  engineError: Error | null;
14
14
  retryEngine: () => void;
15
+ groupBy: string | null;
16
+ setGroupBy: (field: string | null) => void;
17
+ groups: GroupHeader[];
18
+ expandedGroups: Set<string>;
19
+ groupRows: Record<string, Row[]>;
20
+ toggleGroup: (key: string) => void;
15
21
  }
16
22
  interface GridProviderProps {
17
23
  dataset: DataSetState;
@@ -1,4 +1,4 @@
1
- import { ColumnDef, FilterGroup, Row, SortKey } from '../types';
1
+ import { ColumnDef, FilterGroup, GroupHeader, Row, SortKey } from '../types';
2
2
  interface UseEngineSyncProps {
3
3
  engine: any;
4
4
  ready: boolean;
@@ -12,6 +12,9 @@ interface UseEngineSyncProps {
12
12
  sortStack?: SortKey[];
13
13
  filterGroup?: FilterGroup | null;
14
14
  quickFilterText?: string;
15
+ /** When set, calls engine.set_group_by() and fires onGroups with the resulting headers. */
16
+ groupBy?: string | null;
17
+ onGroups?: (groups: GroupHeader[]) => void;
15
18
  }
16
19
  /**
17
20
  * Syncs React state → Wasm engine (push) and pulls page data + subtotals back.
@@ -27,5 +30,5 @@ interface UseEngineSyncProps {
27
30
  * within one borrow, and the pull (get_page / get_subtotals) always sees the
28
31
  * data that was just loaded.
29
32
  */
30
- export declare function useEngineSync({ engine, ready, rows, columns, onSynced, page, pageSize, onPageData, sortStack, filterGroup, quickFilterText, }: UseEngineSyncProps): void;
33
+ export declare function useEngineSync({ engine, ready, rows, columns, onSynced, page, pageSize, onPageData, sortStack, filterGroup, quickFilterText, groupBy, onGroups, }: UseEngineSyncProps): void;
31
34
  export {};