gm-datagrid 0.1.5 → 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';
@@ -96,6 +96,16 @@ export interface ApiContext {
96
96
  authToken?: string;
97
97
  [key: string]: unknown;
98
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
+ }
99
109
  export interface GMDatagridProps {
100
110
  title: string;
101
111
  columns: ColumnDef[];
@@ -125,4 +135,46 @@ export interface GMDatagridProps {
125
135
  };
126
136
  /** Triggered from toolbar or menu-action column. Parent handles the detail view. */
127
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';
128
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-datagrid",
3
- "version": "0.1.5",
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
  },