gm-datagrid 0.1.4 → 0.1.6

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.
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { GMDatagrid } from './GMDatagrid';
2
2
  export { GMGridContainer } from './GMGridContainer';
3
3
  export type { GMGridContainerRef } from './GMGridContainer';
4
4
  export { useGMGrid } from './context/GridContext';
5
- export type { GMDatagridProps, ColumnDef, Row, CellRange, CellCoord, FilterGroup, FilterCondition, SortKey, ApiContext, DensityMode, MuiChipColor, StatusMapEntry, CellRenderParams, } from './types';
5
+ export type { GMDatagridProps, GMDatagridRef, ColumnDef, Row, CellRange, CellCoord, FilterGroup, FilterCondition, SortKey, ApiContext, DensityMode, MuiChipColor, StatusMapEntry, CellRenderParams, } from './types';
6
6
  export { ColumnDataTypesEnum } from './types';
@@ -12,6 +12,17 @@ interface GridToolbarProps {
12
12
  onToggleDensity: () => void;
13
13
  subtotals?: Record<string, number>;
14
14
  subtotalFields?: string[];
15
+ /** Column filter row toggle */
16
+ filterOpen?: boolean;
17
+ onToggleFilter?: () => void;
18
+ activeFilterCount?: number;
19
+ /** Group-by picker */
20
+ groupableColumns?: Array<{
21
+ field: string;
22
+ headerName: string;
23
+ }>;
24
+ groupByField?: string | null;
25
+ onGroupBy?: (field: string | null) => void;
15
26
  }
16
27
  /**
17
28
  * Desktop toolbar: title, optional quick-filter input, action buttons, subtotals row.
@@ -86,11 +86,26 @@ export interface FilterGroup {
86
86
  logic: FilterLogic;
87
87
  conditions: FilterCondition[];
88
88
  }
89
+ export interface GroupHeader {
90
+ key: string;
91
+ count: number;
92
+ subtotals: Record<string, number>;
93
+ }
89
94
  export interface ApiContext {
90
95
  companyId?: string;
91
96
  authToken?: string;
92
97
  [key: string]: unknown;
93
98
  }
99
+ export interface GMDatagridRef {
100
+ /** Returns a copy of all currently selected rows. */
101
+ getSelectedRows: () => Row[];
102
+ /** Clears the current selection. */
103
+ clearSelection: () => void;
104
+ /** Programmatically select rows by their `id` field. */
105
+ setSelectedIds: (ids: string[]) => void;
106
+ /** Re-fetch data (same as toolbar Refresh button). */
107
+ refresh: () => void;
108
+ }
94
109
  export interface GMDatagridProps {
95
110
  title: string;
96
111
  columns: ColumnDef[];
@@ -120,4 +135,46 @@ export interface GMDatagridProps {
120
135
  };
121
136
  /** Triggered from toolbar or menu-action column. Parent handles the detail view. */
122
137
  onRowDetail?: (row: Row) => void;
138
+ /** Enables row selection checkboxes. Default: false. */
139
+ checkboxSelection?: boolean;
140
+ /** Fired whenever the selection changes. Receives the full array of selected rows. */
141
+ onRowSelectionChange?: (rows: Row[]) => void;
142
+ /**
143
+ * Controls the active page and page size.
144
+ * Equivalent to MUI DataGrid v9 `paginationModel`.
145
+ * @default { page: 0, pageSize: 50 }
146
+ */
147
+ paginationModel?: {
148
+ page: number;
149
+ pageSize: number;
150
+ };
151
+ /**
152
+ * Callback fired when page or pageSize changes.
153
+ * Equivalent to MUI DataGrid v9 `onPaginationModelChange`.
154
+ */
155
+ onPaginationModelChange?: (model: {
156
+ page: number;
157
+ pageSize: number;
158
+ }) => void;
159
+ /**
160
+ * Available page size options shown in the footer dropdown.
161
+ * Equivalent to MUI DataGrid v9 `pageSizeOptions`.
162
+ * @default [25, 50, 100]
163
+ */
164
+ pageSizeOptions?: number[];
165
+ /**
166
+ * Total row count when data is paginated server-side.
167
+ * Equivalent to MUI DataGrid v9 `rowCount`.
168
+ * When provided together with `paginationMode="server"`, the grid uses this
169
+ * value instead of `engine.get_total_count()`.
170
+ */
171
+ rowCount?: number;
172
+ /**
173
+ * `"client"` — engine paginates local rows in memory (default).
174
+ * `"server"` — parent owns pagination; grid fires `onPaginationModelChange`
175
+ * and renders `rowCount` as the total.
176
+ * Equivalent to MUI DataGrid v9 `paginationMode`.
177
+ * @default "client"
178
+ */
179
+ paginationMode?: 'client' | 'server';
123
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-datagrid",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Enterprise Excel-like data grid powered by a Rust/Wasm core engine and React",
5
5
  "keywords": [
6
6
  "datagrid",
@@ -44,6 +44,7 @@
44
44
  "react-dom": ">=18"
45
45
  },
46
46
  "dependencies": {
47
+ "match-sorter": "^8.3.0",
47
48
  "moment": "^2.30.1",
48
49
  "numeral": "^2.0.6"
49
50
  },