gm-datagrid 0.1.11 → 0.1.13
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/README.md +83 -0
- package/dist/features/useInlineEdit.d.ts +23 -2
- package/dist/gm-datagrid.js +2000 -1931
- package/dist/gm-datagrid.umd.cjs +19 -19
- package/dist/index.d.ts +1 -1
- package/dist/types/index.d.ts +47 -0
- package/package.json +1 -1
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, 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';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -113,6 +113,27 @@ export interface GMDatagridRef {
|
|
|
113
113
|
setSelectedIds: (ids: string[]) => void;
|
|
114
114
|
/** Re-fetch data (same as toolbar Refresh button). */
|
|
115
115
|
refresh: () => void;
|
|
116
|
+
/** Programmatically put a cell into edit mode (MUI DataGrid compatible). */
|
|
117
|
+
startCellEditMode: (params: {
|
|
118
|
+
id: string | number;
|
|
119
|
+
field: string;
|
|
120
|
+
}) => void;
|
|
121
|
+
/** Programmatically save and exit edit mode for a cell (MUI DataGrid compatible). */
|
|
122
|
+
stopCellEditMode: (params: {
|
|
123
|
+
id: string | number;
|
|
124
|
+
field: string;
|
|
125
|
+
ignoreModifications?: boolean;
|
|
126
|
+
}) => void;
|
|
127
|
+
}
|
|
128
|
+
export interface CellEditParams {
|
|
129
|
+
/** Row ID (from the `id` field). */
|
|
130
|
+
id: string | number;
|
|
131
|
+
/** Column field name. */
|
|
132
|
+
field: string;
|
|
133
|
+
/** Current cell value at the time of the event. */
|
|
134
|
+
value: unknown;
|
|
135
|
+
/** Full row object. */
|
|
136
|
+
row: Row;
|
|
116
137
|
}
|
|
117
138
|
export interface GMDatagridProps {
|
|
118
139
|
title: string;
|
|
@@ -133,6 +154,21 @@ export interface GMDatagridProps {
|
|
|
133
154
|
apiContext?: ApiContext;
|
|
134
155
|
/** MUI DataGrid-compatible save callback. Promise rejection reverts the cell. */
|
|
135
156
|
processRowUpdate?: (newRow: Row, oldRow: Row) => Row | Promise<Row>;
|
|
157
|
+
/**
|
|
158
|
+
* Called when a cell enters edit mode.
|
|
159
|
+
* MUI DataGrid compatible: receives `CellEditParams`.
|
|
160
|
+
*/
|
|
161
|
+
onCellEditStart?: (params: CellEditParams) => void;
|
|
162
|
+
/**
|
|
163
|
+
* Called when a cell exits edit mode (saved or cancelled).
|
|
164
|
+
* MUI DataGrid compatible: receives `CellEditParams`.
|
|
165
|
+
*/
|
|
166
|
+
onCellEditStop?: (params: CellEditParams) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Per-row/cell editability guard. Return `false` to prevent editing of a specific cell.
|
|
169
|
+
* Receives the same `CellEditParams` shape as MUI DataGrid's `isCellEditable`.
|
|
170
|
+
*/
|
|
171
|
+
isCellEditable?: (params: CellEditParams) => boolean;
|
|
136
172
|
/** Show/hide the global quick-filter search input in the toolbar. Default: true. */
|
|
137
173
|
quickFilter?: boolean;
|
|
138
174
|
quickFilterPlaceholder?: string;
|
|
@@ -230,4 +266,15 @@ export interface GMDatagridProps {
|
|
|
230
266
|
* When omitted (or empty) all non-action columns are offered.
|
|
231
267
|
*/
|
|
232
268
|
groupableColumns?: string[];
|
|
269
|
+
/**
|
|
270
|
+
* Enable inline cell editing globally. Per-column `editable` flag still applies.
|
|
271
|
+
* @default true
|
|
272
|
+
*/
|
|
273
|
+
editable?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Whitelist of column `field` names that may be edited.
|
|
276
|
+
* When set, only these fields are editable regardless of the per-column `editable` flag.
|
|
277
|
+
* When omitted, every column with `editable: true` in its definition is editable.
|
|
278
|
+
*/
|
|
279
|
+
editableColumns?: string[];
|
|
233
280
|
}
|