gm-datagrid 0.1.18 → 0.1.20

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.
@@ -32,5 +32,37 @@ export interface GridLabels {
32
32
  exportFormats: Record<string, string>;
33
33
  /** Date operator dropdown labels keyed by DateFilterOp */
34
34
  dateOps: Record<string, string>;
35
+ /** Aggregation function display names keyed by AggregationFunction */
36
+ aggregationFns: Record<string, string>;
37
+ /** Tooltip prefix shown on aggregation footer cells, e.g. "Suma: 1,234" */
38
+ aggregationTooltipLabel: string;
39
+ /** Pagination: no rows */
40
+ noRows: string;
41
+ /** Pagination: rows range label. Use {from}, {to}, {total} as placeholders */
42
+ rowsRange: string;
43
+ /** Pagination: rows-per-page label */
44
+ rowsPerPage: string;
45
+ /** Pagination: first page tooltip */
46
+ firstPage: string;
47
+ /** Pagination: previous page tooltip */
48
+ prevPage: string;
49
+ /** Pagination: next page tooltip */
50
+ nextPage: string;
51
+ /** Pagination: last page tooltip */
52
+ lastPage: string;
53
+ /** Checkbox column: select all tooltip */
54
+ selectAll: string;
55
+ /** Checkbox column: deselect all tooltip */
56
+ deselectAll: string;
57
+ /** Bulk action bar: N elements selected (singular) */
58
+ selectionSingular: string;
59
+ /** Bulk action bar: N elements selected (plural) */
60
+ selectionPlural: string;
61
+ /** Bulk action bar: clear selection button */
62
+ clearSelection: string;
63
+ /** Group header: fallback label when group key is empty */
64
+ emptyGroup: string;
65
+ /** Engine error message */
66
+ engineError: string;
35
67
  }
36
68
  export declare const GRID_LABELS: Record<GridLocale, GridLabels>;
@@ -26,6 +26,23 @@ export type MuiChipColor = ChipProps['color'];
26
26
  export type DensityMode = 'compact' | 'standard' | 'comfortable';
27
27
  /** Supported export formats. xlsx is generated by the Wasm engine; others are built client-side. */
28
28
  export type ExportFormat = 'xlsx' | 'csv' | 'txt' | 'json';
29
+ /**
30
+ * Built-in aggregation functions — mirrors MUI DataGrid Premium's built-in set.
31
+ * - `sum` — total of all numeric values
32
+ * - `avg` — arithmetic mean of non-null values
33
+ * - `min` — smallest value
34
+ * - `max` — largest value
35
+ * - `size` — count of non-null cells
36
+ */
37
+ export type AggregationFunction = 'sum' | 'avg' | 'min' | 'max' | 'size';
38
+ /**
39
+ * Aggregation model — keys are column `field` names, values are function names.
40
+ * Compatible with MUI DataGrid Premium `aggregationModel` prop.
41
+ * @example { gross: 'sum', year: 'max' }
42
+ */
43
+ export type AggregationModel = Record<string, AggregationFunction>;
44
+ /** Computed aggregation results — keys are column `field` names, values are the aggregated numbers. */
45
+ export type AggregationResults = Record<string, number | null>;
29
46
  export interface StatusMapEntry {
30
47
  label: string;
31
48
  color: MuiChipColor;
@@ -51,6 +68,18 @@ export interface ColumnDef {
51
68
  editable?: boolean;
52
69
  /** Show running sum in the column header, updated as filters change. */
53
70
  calculateSubTotal?: boolean;
71
+ /**
72
+ * Allow end users to aggregate this column via the column header menu.
73
+ * Compatible with MUI DataGrid Premium `GridColDef.aggregable`.
74
+ * @default true (when the grid-level `aggregable` flag is enabled)
75
+ */
76
+ aggregable?: boolean;
77
+ /**
78
+ * Limits the aggregation functions offered in the column header menu.
79
+ * When omitted all built-in functions compatible with the column type are shown.
80
+ * Compatible with MUI DataGrid Premium `GridColDef.availableAggregationFunctions`.
81
+ */
82
+ availableAggregationFunctions?: AggregationFunction[];
54
83
  /** Custom cell renderer. Must destructure `key` separately when using renderOption pattern. */
55
84
  renderCell?: (params: CellRenderParams) => React.ReactNode;
56
85
  /** Transform raw cell value before rendering. */
@@ -285,4 +314,33 @@ export interface GMDatagridProps {
285
314
  * When omitted, every column with `editable: true` in its definition is editable.
286
315
  */
287
316
  editableColumns?: string[];
317
+ /**
318
+ * Enable the aggregation feature — shows a footer row with computed values and
319
+ * exposes a function picker in each aggregable column's header menu.
320
+ * Compatible with MUI DataGrid Premium's `disableAggregation` (inverted).
321
+ * @default false
322
+ */
323
+ aggregable?: boolean;
324
+ /**
325
+ * Controlled aggregation model.
326
+ * Keys are column `field` names; values are the function to apply.
327
+ * Compatible with MUI DataGrid Premium `aggregationModel` prop.
328
+ * @example { total: 'sum', price: 'avg' }
329
+ */
330
+ aggregationModel?: AggregationModel;
331
+ /**
332
+ * Callback fired when the user changes the aggregation function for a column.
333
+ * Compatible with MUI DataGrid Premium `onAggregationModelChange`.
334
+ */
335
+ onAggregationModelChange?: (model: AggregationModel) => void;
336
+ /**
337
+ * Initial uncontrolled state. The `aggregation.model` key seeds the internal
338
+ * aggregation model when the grid first mounts.
339
+ * Compatible with MUI DataGrid Premium `initialState.aggregation.model`.
340
+ */
341
+ initialState?: {
342
+ aggregation?: {
343
+ model: AggregationModel;
344
+ };
345
+ };
288
346
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gm-datagrid",
3
- "version": "0.1.18",
4
- "description": "Enterprise Excel-like data grid powered by a Rust/Wasm core engine and React",
3
+ "version": "0.1.20",
4
+ "description": "Enterprise Excel-like data grid with Rust/Wasm engine, featuring inline-aligned group subtotals",
5
5
  "keywords": [
6
6
  "datagrid",
7
7
  "data-grid",