gm-datagrid 0.1.12 → 0.1.14

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,6 @@ 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, GMDatagridRef, 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, CellEditParams, } from './types';
6
6
  export { ColumnDataTypesEnum } from './types';
7
+ export type { ExportFormat } from './types';
@@ -26,6 +26,10 @@ export interface GridLabels {
26
26
  max: string;
27
27
  /** Group-by picker: no-grouping option */
28
28
  noGroup: string;
29
+ /** Export button tooltip */
30
+ export: string;
31
+ /** Export format menu item labels keyed by ExportFormat */
32
+ exportFormats: Record<string, string>;
29
33
  /** Date operator dropdown labels keyed by DateFilterOp */
30
34
  dateOps: Record<string, string>;
31
35
  }
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { DensityMode } from '../types';
2
+ import { DensityMode, ExportFormat } from '../types';
3
3
  import { GridLabels } from '../lib/i18n';
4
4
  interface GridToolbarProps {
5
5
  title: string;
@@ -7,7 +7,10 @@ interface GridToolbarProps {
7
7
  quickFilter: boolean;
8
8
  quickFilterPlaceholder?: string;
9
9
  onQuickFilterChange: (text: string) => void;
10
- onExport?: () => void;
10
+ /** Available export formats — passed through to ToolbarButtons. */
11
+ exportFormats?: ExportFormat[];
12
+ /** Called when user picks an export format. */
13
+ onExportFormat?: (format: ExportFormat) => void;
11
14
  onRefresh: () => void;
12
15
  density: DensityMode;
13
16
  onToggleDensity: () => void;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { DensityMode } from '../types';
2
+ import { DensityMode, ExportFormat } from '../types';
3
3
  import { GridLabels } from '../lib/i18n';
4
4
  interface MobileToolbarProps {
5
5
  title: string;
@@ -7,7 +7,10 @@ interface MobileToolbarProps {
7
7
  quickFilter: boolean;
8
8
  quickFilterPlaceholder?: string;
9
9
  onQuickFilterChange: (text: string) => void;
10
- onExport?: () => void;
10
+ /** Available export formats — passed through to ToolbarButtons. */
11
+ exportFormats?: ExportFormat[];
12
+ /** Called when user picks an export format. */
13
+ onExportFormat?: (format: ExportFormat) => void;
11
14
  onRefresh: () => void;
12
15
  density: DensityMode;
13
16
  onToggleDensity: () => void;
@@ -1,14 +1,22 @@
1
1
  import { default as React } from 'react';
2
- import { DensityMode } from '../types';
2
+ import { DensityMode, ExportFormat } from '../types';
3
3
  interface ToolbarButtonsProps {
4
- onExport?: () => void;
4
+ /** Available export formats. When provided + non-empty, the export button opens a menu. */
5
+ exportFormats?: ExportFormat[];
6
+ /** Called when the user selects an export format. */
7
+ onExportFormat?: (format: ExportFormat) => void;
5
8
  onRefresh: () => void;
6
9
  onToggleDensity: () => void;
7
10
  density: DensityMode;
8
11
  loading?: boolean;
12
+ /** Export button tooltip label */
13
+ exportLabel?: string;
14
+ /** Per-format menu item labels */
15
+ exportFormatLabels?: Record<string, string>;
9
16
  }
10
17
  /**
11
- * Shared toolbar action buttons: Export (optional), Refresh, Density toggle.
18
+ * Shared toolbar action buttons: Export (optional, menu-based), Refresh, Density toggle.
19
+ * Compatible with MUI DataGrid toolbar export pattern.
12
20
  */
13
21
  declare const ToolbarButtons: React.NamedExoticComponent<ToolbarButtonsProps>;
14
22
  export default ToolbarButtons;
@@ -24,6 +24,8 @@ export declare enum ColumnDataTypesEnum {
24
24
  }
25
25
  export type MuiChipColor = ChipProps['color'];
26
26
  export type DensityMode = 'compact' | 'standard' | 'comfortable';
27
+ /** Supported export formats. xlsx is generated by the Wasm engine; others are built client-side. */
28
+ export type ExportFormat = 'xlsx' | 'csv' | 'txt' | 'json';
27
29
  export interface StatusMapEntry {
28
30
  label: string;
29
31
  color: MuiChipColor;
@@ -113,6 +115,27 @@ export interface GMDatagridRef {
113
115
  setSelectedIds: (ids: string[]) => void;
114
116
  /** Re-fetch data (same as toolbar Refresh button). */
115
117
  refresh: () => void;
118
+ /** Programmatically put a cell into edit mode (MUI DataGrid compatible). */
119
+ startCellEditMode: (params: {
120
+ id: string | number;
121
+ field: string;
122
+ }) => void;
123
+ /** Programmatically save and exit edit mode for a cell (MUI DataGrid compatible). */
124
+ stopCellEditMode: (params: {
125
+ id: string | number;
126
+ field: string;
127
+ ignoreModifications?: boolean;
128
+ }) => void;
129
+ }
130
+ export interface CellEditParams {
131
+ /** Row ID (from the `id` field). */
132
+ id: string | number;
133
+ /** Column field name. */
134
+ field: string;
135
+ /** Current cell value at the time of the event. */
136
+ value: unknown;
137
+ /** Full row object. */
138
+ row: Row;
116
139
  }
117
140
  export interface GMDatagridProps {
118
141
  title: string;
@@ -133,6 +156,21 @@ export interface GMDatagridProps {
133
156
  apiContext?: ApiContext;
134
157
  /** MUI DataGrid-compatible save callback. Promise rejection reverts the cell. */
135
158
  processRowUpdate?: (newRow: Row, oldRow: Row) => Row | Promise<Row>;
159
+ /**
160
+ * Called when a cell enters edit mode.
161
+ * MUI DataGrid compatible: receives `CellEditParams`.
162
+ */
163
+ onCellEditStart?: (params: CellEditParams) => void;
164
+ /**
165
+ * Called when a cell exits edit mode (saved or cancelled).
166
+ * MUI DataGrid compatible: receives `CellEditParams`.
167
+ */
168
+ onCellEditStop?: (params: CellEditParams) => void;
169
+ /**
170
+ * Per-row/cell editability guard. Return `false` to prevent editing of a specific cell.
171
+ * Receives the same `CellEditParams` shape as MUI DataGrid's `isCellEditable`.
172
+ */
173
+ isCellEditable?: (params: CellEditParams) => boolean;
136
174
  /** Show/hide the global quick-filter search input in the toolbar. Default: true. */
137
175
  quickFilter?: boolean;
138
176
  quickFilterPlaceholder?: string;
@@ -195,6 +233,12 @@ export interface GMDatagridProps {
195
233
  * @default true
196
234
  */
197
235
  exportable?: boolean;
236
+ /**
237
+ * Which export formats to show in the export menu.
238
+ * Supported: 'xlsx' | 'csv' | 'txt' | 'json'
239
+ * @default ['xlsx', 'csv']
240
+ */
241
+ exportFormats?: ExportFormat[];
198
242
  /**
199
243
  * Whitelist of column `field` names that may be exported.
200
244
  * When omitted (or empty) all visible columns are exported.
@@ -230,4 +274,15 @@ export interface GMDatagridProps {
230
274
  * When omitted (or empty) all non-action columns are offered.
231
275
  */
232
276
  groupableColumns?: string[];
277
+ /**
278
+ * Enable inline cell editing globally. Per-column `editable` flag still applies.
279
+ * @default true
280
+ */
281
+ editable?: boolean;
282
+ /**
283
+ * Whitelist of column `field` names that may be edited.
284
+ * When set, only these fields are editable regardless of the per-column `editable` flag.
285
+ * When omitted, every column with `editable: true` in its definition is editable.
286
+ */
287
+ editableColumns?: string[];
233
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-datagrid",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Enterprise Excel-like data grid powered by a Rust/Wasm core engine and React",
5
5
  "keywords": [
6
6
  "datagrid",