@agile-team/mach-table 0.13.0 → 0.15.0

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.cts CHANGED
@@ -14,6 +14,7 @@ declare class Column<TData = any> {
14
14
  hide: boolean;
15
15
  pinned: PinnedDirection | null;
16
16
  manualWidth: number | null;
17
+ flex: number | null;
17
18
  currentWidth: number;
18
19
  parentGroup: ColumnGroup<TData> | null;
19
20
  level: number;
@@ -25,6 +26,7 @@ declare class Column<TData = any> {
25
26
  get filterable(): boolean;
26
27
  get filterType(): FilterType;
27
28
  get hasCheckbox(): boolean;
29
+ resetWidth(): void;
28
30
  }
29
31
 
30
32
  interface RowNode<TData = any> {
@@ -303,6 +305,15 @@ declare const DEFAULT_LOCALE: {
303
305
  readonly pagePrev: "上一页";
304
306
  readonly pageNext: "下一页";
305
307
  readonly pageLast: "末页";
308
+ readonly requestFailed: "数据加载失败";
309
+ readonly requestFailedHint: "请检查网络后重试";
310
+ readonly actionView: "查看";
311
+ readonly actionEdit: "编辑";
312
+ readonly actionDelete: "删除";
313
+ readonly actionConfirm: "确认";
314
+ readonly actionSave: "保存";
315
+ readonly actionCancel: "取消";
316
+ readonly actionMore: "更多操作";
306
317
  };
307
318
  type RgLocaleKey = keyof typeof DEFAULT_LOCALE;
308
319
  type RgLocale = Partial<Record<RgLocaleKey, string>>;
@@ -336,10 +347,31 @@ interface ApplyGridStateOptions {
336
347
  emitEvents?: boolean;
337
348
  }
338
349
 
350
+ type Callable = (...args: never[]) => unknown;
351
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Callable;
352
+ type Depth = 0 | 1 | 2 | 3 | 4;
353
+ type Previous = {
354
+ 0: 0;
355
+ 1: 0;
356
+ 2: 1;
357
+ 3: 2;
358
+ 4: 3;
359
+ };
360
+ /** Dot-separated path to a serializable field, capped to keep editor inference fast. */
361
+ type FieldPath<T, D extends Depth = 4> = D extends 0 ? never : T extends Primitive ? never : {
362
+ [K in keyof T & string]: NonNullable<T[K]> extends Primitive | readonly unknown[] ? K : K | `${K}.${FieldPath<NonNullable<T[K]>, Previous[D]>}`;
363
+ }[keyof T & string];
364
+ type FieldPathValue<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer Head}.${infer Tail}` ? Head extends keyof T ? FieldPathValue<NonNullable<T[Head]>, Tail> : unknown : unknown;
365
+
339
366
  interface ColumnStateStore {
340
367
  load(key: string): ColumnState[] | null | Promise<ColumnState[] | null>;
341
368
  save(key: string, state: ColumnState[]): void | Promise<void>;
342
369
  }
370
+ interface GridStateStore {
371
+ load(key: string): GridState | null | Promise<GridState | null>;
372
+ save(key: string, state: GridState): void | Promise<void>;
373
+ clear?(key: string): void | Promise<void>;
374
+ }
343
375
  /** Per-grid component overrides. These take precedence over the global registry. */
344
376
  interface GridComponents {
345
377
  cellRenderers?: Readonly<Record<string, CellRendererFn>>;
@@ -392,6 +424,7 @@ type EventHandlers<TData = any> = {
392
424
  type RowSelectionMode = "none" | "single" | "multiple";
393
425
  type GridSize = "compact" | "normal" | "large";
394
426
  type ColumnLayoutMode = "normal" | "fit";
427
+ type DomLayoutMode = "normal" | "autoHeight";
395
428
  type ThemeMode = "light" | "dark" | "auto";
396
429
  type GridEditType = "cell" | "fullRow";
397
430
  type EditableIndicator = "hover" | "always" | "none";
@@ -458,11 +491,17 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
458
491
  /** Reusable semantic column definitions referenced through `colDef.type`. */
459
492
  columnTypes?: Readonly<Record<string, Partial<ColDef<TData>>>>;
460
493
  getRowId?: (params: GetRowIdParams<TData>) => string;
494
+ /** Stable business key shorthand. `getRowId` takes precedence when both are set. */
495
+ rowKey?: FieldPath<TData> | ((row: TData) => string | number);
461
496
  rowHeight?: number;
462
497
  headerHeight?: number;
463
498
  rowBuffer?: number;
464
499
  /** `fit` continuously fills the container without grid-ready glue code. */
465
500
  columnLayout?: ColumnLayoutMode;
501
+ /** Enables pointer, double-click and Alt+Arrow column resizing. Disabled by default. */
502
+ enableColumnResize?: boolean;
503
+ /** Lets small grids grow with their rows. Avoid for large or infinite datasets. */
504
+ domLayout?: DomLayoutMode;
466
505
  rowSelection?: RowSelectionMode;
467
506
  multiSort?: boolean;
468
507
  size?: GridSize;
@@ -485,6 +524,10 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
485
524
  features?: readonly GridFeature<TData>[];
486
525
  /** State restored atomically after columns and initial rows are available. */
487
526
  initialState?: GridState;
527
+ /** Persist the complete user-visible GridState with a versioned store. */
528
+ stateKey?: string | null;
529
+ stateStore?: GridStateStore;
530
+ stateSaveDebounceMs?: number;
488
531
  locale?: RgLocale;
489
532
  /** Cell editing is isolated; fullRow stages every editable cell and commits them together. */
490
533
  editType?: GridEditType;
@@ -547,8 +590,11 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
547
590
  /** ID of an external element that provides additional grid instructions. */
548
591
  ariaDescribedBy?: string;
549
592
  loading?: boolean;
593
+ /** Non-null errors take precedence over the empty state and remain retryable by the host. */
594
+ error?: unknown | null;
550
595
  overlayNoRowsTemplate?: OverlayTemplate;
551
596
  overlayLoadingTemplate?: OverlayTemplate;
597
+ overlayErrorTemplate?: OverlayTemplate;
552
598
  /** Opt in only for trusted overlay strings. Prefer HTMLElement factories. */
553
599
  allowUnsafeOverlayHtml?: boolean;
554
600
  className?: string;
@@ -559,10 +605,13 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
559
605
  defaultColDef: Partial<ColDef<TData>>;
560
606
  columnTypes: Readonly<Record<string, Partial<ColDef<TData>>>>;
561
607
  getRowId?: (params: GetRowIdParams<TData>) => string;
608
+ rowKey?: FieldPath<TData> | ((row: TData) => string | number);
562
609
  rowHeight: number;
563
610
  headerHeight: number;
564
611
  rowBuffer: number;
565
612
  columnLayout: ColumnLayoutMode;
613
+ enableColumnResize: boolean;
614
+ domLayout: DomLayoutMode;
566
615
  rowSelection: RowSelectionMode;
567
616
  multiSort: boolean;
568
617
  size: GridSize;
@@ -583,6 +632,9 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
583
632
  actionPolicy?: ActionPolicy<TData>;
584
633
  features: readonly GridFeature<TData>[];
585
634
  initialState?: GridState;
635
+ stateKey: string | null;
636
+ stateStore?: GridStateStore;
637
+ stateSaveDebounceMs: number;
586
638
  locale: RgLocale;
587
639
  editType: GridEditType;
588
640
  editableIndicator: EditableIndicator;
@@ -643,8 +695,10 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
643
695
  ariaLabelledBy: string;
644
696
  ariaDescribedBy: string;
645
697
  loading: boolean;
698
+ error: unknown | null;
646
699
  overlayNoRowsTemplate: OverlayTemplate;
647
700
  overlayLoadingTemplate: OverlayTemplate;
701
+ overlayErrorTemplate: OverlayTemplate;
648
702
  allowUnsafeOverlayHtml: boolean;
649
703
  className: string;
650
704
  }
@@ -727,6 +781,8 @@ type SaveChangesHandler<TData = any> = (changes: readonly GridChange<TData>[]) =
727
781
  interface GridApi<TData = any> {
728
782
  /** Resolves after the first layout frame and gridReady emission. */
729
783
  whenReady(): Promise<GridApi<TData>>;
784
+ /** Stable grid root for portals, measurements and fullscreen targets; null after destroy. */
785
+ getRootElement(): HTMLElement | null;
730
786
  /** Reads the currently resolved value after application, preset and table overrides. */
731
787
  getGridOption<K extends keyof GridOptions<TData>>(key: K): GridOptions<TData>[K];
732
788
  /** Typed shorthand for updating one runtime option. */
@@ -745,6 +801,8 @@ interface GridApi<TData = any> {
745
801
  setColumnVisibility(colId: string, visible: boolean): void;
746
802
  moveColumn(colId: string, toIndex: number): void;
747
803
  setColumnPinned(colId: string, pinned: "left" | "right" | null): void;
804
+ /** Sets one width without replacing the rest of the column state. */
805
+ setColumnWidth(colId: string, width: number): boolean;
748
806
  sizeColumnsToFit(width?: number): void;
749
807
  autoSizeColumn(colId: string, skipHeader?: boolean): void;
750
808
  autoSizeAllColumns(skipHeader?: boolean): void;
@@ -845,7 +903,7 @@ interface GridApi<TData = any> {
845
903
  applyState(state: GridState, options?: ApplyGridStateOptions): void;
846
904
  /** Lightweight runtime snapshot suitable for support logs and health panels. */
847
905
  getDiagnostics(): GridDiagnostics;
848
- setOverlay(type: "loading" | "noRows" | null): void;
906
+ setOverlay(type: "loading" | "noRows" | "error" | null): void;
849
907
  hideOverlays(): void;
850
908
  addEventListener<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): () => void;
851
909
  removeEventListener<K extends GridEventType>(eventType: K, listener: (event: GridEventMap<TData>[K]) => void): void;
@@ -1069,6 +1127,10 @@ interface ColumnState {
1069
1127
  colId: string;
1070
1128
  hide?: boolean;
1071
1129
  width?: number;
1130
+ /** Active flex weight. A resize clears flex and turns width into a manual override. */
1131
+ flex?: number | null;
1132
+ /** Distinguishes responsive/definition width from an explicit user or API override. */
1133
+ widthMode?: "auto" | "manual";
1072
1134
  pinned?: "left" | "right" | null;
1073
1135
  sort?: SortDirection | null;
1074
1136
  sortIndex?: number | null;
@@ -1122,12 +1184,14 @@ declare class ColumnModel {
1122
1184
  paneOf(column: Column): PaneType;
1123
1185
  computeLayout(viewportWidth: number): void;
1124
1186
  private widthInputOf;
1125
- setColumnWidth(column: Column, width: number): void;
1187
+ setColumnWidth(column: Column, width: number): boolean;
1126
1188
  setColumnVisibility(colId: string, visible: boolean): void;
1127
1189
  moveColumn(colId: string, toIndex: number): boolean;
1128
1190
  setColumnPinned(colId: string, pinned: PinnedDirection | null): void;
1129
1191
  getColumnState(): ColumnState[];
1130
1192
  applyColumnState(states: ColumnState[]): void;
1193
+ private applyColumnViewState;
1194
+ private sortModelFromState;
1131
1195
  private applyStateOrder;
1132
1196
  resetColumnState(): void;
1133
1197
  getSortModel(): SortModel;
@@ -1284,16 +1348,25 @@ declare class SelectionService {
1284
1348
  private recomputeTriState;
1285
1349
  }
1286
1350
 
1287
- type ResizeContext = Pick<GridCore<any>, "columnModel" | "emit" | "persistColumnState" | "relayoutColumns" | "skeleton">;
1351
+ type ResizeContext = Pick<GridCore<any>, "columnModel" | "commitColumnWidths" | "emitColumnResize" | "options" | "relayoutColumns" | "skeleton">;
1288
1352
  declare class ResizeService {
1289
1353
  private core;
1290
1354
  private active;
1291
1355
  private rafId;
1292
1356
  private pendingWidth;
1293
1357
  constructor(core: ResizeContext);
1294
- startResize(e: PointerEvent, column: Column): void;
1358
+ startResize(event: PointerEvent, column: Column): void;
1359
+ cancelResize(restore?: boolean): void;
1295
1360
  private onMove;
1296
1361
  private onUp;
1362
+ private onCancel;
1363
+ private onLostPointerCapture;
1364
+ private finishResize;
1365
+ private applyPendingWidth;
1366
+ private widthFromPointer;
1367
+ private matchActivePointer;
1368
+ private clearFrame;
1369
+ private removeListeners;
1297
1370
  destroy(): void;
1298
1371
  }
1299
1372
 
@@ -1559,15 +1632,17 @@ declare class GridSkeleton {
1559
1632
  private systemPrefersDark;
1560
1633
  setStriped(on: boolean): void;
1561
1634
  setCellBorders(on: boolean): void;
1635
+ applyDomLayout(layout: DomLayoutMode): void;
1562
1636
  setCustomClass(className: string | null | undefined): void;
1563
- showOverlay(type: "loading" | "noRows", content: OverlayTemplate, allowUnsafeHtml?: boolean): void;
1637
+ showOverlay(type: "loading" | "noRows" | "error", content: OverlayTemplate, allowUnsafeHtml?: boolean): void;
1564
1638
  hideOverlay(): void;
1639
+ private applyOverlayRole;
1565
1640
  setInfiniteLoading(active: boolean, text: string): void;
1566
1641
  destroy(): void;
1567
1642
  private cleanupOverlayContent;
1568
1643
  }
1569
1644
 
1570
- type HeaderContext = Pick<GridCore<any>, "columnDragService" | "columnMenu" | "columnModel" | "cycleSort" | "emit" | "filterPopup" | "getApi" | "isDestroyed" | "moveColumn" | "options" | "relayoutColumns" | "reportError" | "resizeService" | "rowModel" | "selectionService" | "skeleton">;
1645
+ type HeaderContext = Pick<GridCore<any>, "columnDragService" | "columnMenu" | "columnModel" | "commitColumnWidths" | "cycleSort" | "emit" | "filterPopup" | "getApi" | "isDestroyed" | "moveColumn" | "options" | "relayoutColumns" | "reportError" | "resizeService" | "rowModel" | "selectionService" | "skeleton">;
1571
1646
  declare class HeaderRenderer {
1572
1647
  private core;
1573
1648
  private leafCells;
@@ -1581,6 +1656,7 @@ declare class HeaderRenderer {
1581
1656
  private visiblePaneLeaves;
1582
1657
  private onHeaderKeyDown;
1583
1658
  private focusHeaderCell;
1659
+ private canResizeColumn;
1584
1660
  refreshSortIndicators(): void;
1585
1661
  refreshFilterIcons(): void;
1586
1662
  refreshSelectAllCheckbox(): void;
@@ -1594,7 +1670,7 @@ interface NormalizedRange {
1594
1670
  c2: number;
1595
1671
  }
1596
1672
 
1597
- type BodyContext = Pick<GridCore<any>, "buildDefaultEmptyState" | "columnModel" | "contextMenuService" | "editingService" | "emit" | "getApi" | "getCellValue" | "gridId" | "isDestroyed" | "options" | "pinnedRowsRenderer" | "reportError" | "resolveCellRenderer" | "rowModel" | "selectionService" | "setCellValue" | "skeleton" | "summaryRenderer" | "toggleDetail" | "tooltipService" | "undoService">;
1673
+ type BodyContext = Pick<GridCore<any>, "buildDefaultEmptyState" | "buildDefaultErrorState" | "columnModel" | "contextMenuService" | "editingService" | "emit" | "getApi" | "getCellValue" | "gridId" | "isDestroyed" | "options" | "pinnedRowsRenderer" | "reportError" | "resolveCellRenderer" | "rowModel" | "selectionService" | "setCellValue" | "skeleton" | "summaryRenderer" | "toggleDetail" | "tooltipService" | "undoService">;
1598
1674
  interface FocusedCell {
1599
1675
  rowIndex: number;
1600
1676
  colId: string;
@@ -1628,6 +1704,7 @@ declare class BodyRenderer {
1628
1704
  private measureCanvas;
1629
1705
  applyContainerSizes(): void;
1630
1706
  invalidateRowHeight(node: RowNode<any>): void;
1707
+ private applyDomLayoutHeight;
1631
1708
  invalidateAllRowHeights(): void;
1632
1709
  private collectAutoHeightColumns;
1633
1710
  private get hasAnyAutoHeight();
@@ -1643,6 +1720,8 @@ declare class BodyRenderer {
1643
1720
  applyCellLayout(): void;
1644
1721
  private computeColWindow;
1645
1722
  updateRange(force?: boolean): void;
1723
+ private reconcileColumnWindow;
1724
+ private renderAutoHeightRange;
1646
1725
  private hideSlot;
1647
1726
  private assignSlot;
1648
1727
  private renderPaneCells;
@@ -1822,6 +1901,8 @@ declare class GridCore<TData = any> {
1822
1901
  private lastColumnLayoutSignature;
1823
1902
  private activeFeatures;
1824
1903
  private recentErrors;
1904
+ private stateSaveTimer;
1905
+ private gridStateLoadToken;
1825
1906
  constructor(container: HTMLElement, options: GridOptions<TData>);
1826
1907
  getApi(): GridApi<TData>;
1827
1908
  whenReady(): Promise<GridApi<TData>>;
@@ -1864,9 +1945,16 @@ declare class GridCore<TData = any> {
1864
1945
  applyQuickFilter(): void;
1865
1946
  moveColumn(colId: string, toIndex: number): void;
1866
1947
  toggleDetail(rowId: string): boolean;
1867
- private stateLoadToken;
1948
+ emitColumnResize(column: Column, finished: boolean): void;
1949
+ /** Finalizes one logical resize operation and persists its state once. */
1950
+ commitColumnWidths(columns: readonly Column[]): void;
1951
+ private columnStateLoadToken;
1868
1952
  loadPersistedColumnState(): void;
1869
1953
  persistColumnState(): void;
1954
+ loadPersistedGridState(): void;
1955
+ scheduleGridStateSave(): void;
1956
+ persistGridState(): void;
1957
+ buildDefaultErrorState(): HTMLElement;
1870
1958
  buildDefaultEmptyState(): HTMLElement;
1871
1959
  private lastValidatedDefs;
1872
1960
  private issuedWarningSignatures;
@@ -1940,6 +2028,10 @@ declare const GRID_OPTION_META: {
1940
2028
  readonly kind: "function";
1941
2029
  readonly update: "options";
1942
2030
  };
2031
+ readonly rowKey: {
2032
+ readonly kind: "unknown";
2033
+ readonly update: "options";
2034
+ };
1943
2035
  readonly rowHeight: {
1944
2036
  readonly kind: "number";
1945
2037
  readonly update: "options";
@@ -1956,6 +2048,14 @@ declare const GRID_OPTION_META: {
1956
2048
  readonly kind: "string";
1957
2049
  readonly update: "options";
1958
2050
  };
2051
+ readonly enableColumnResize: {
2052
+ readonly kind: "boolean";
2053
+ readonly update: "options";
2054
+ };
2055
+ readonly domLayout: {
2056
+ readonly kind: "string";
2057
+ readonly update: "options";
2058
+ };
1959
2059
  readonly rowSelection: {
1960
2060
  readonly kind: "string";
1961
2061
  readonly update: "options";
@@ -2036,6 +2136,18 @@ declare const GRID_OPTION_META: {
2036
2136
  readonly kind: "object";
2037
2137
  readonly update: "options";
2038
2138
  };
2139
+ readonly stateKey: {
2140
+ readonly kind: "string";
2141
+ readonly update: "options";
2142
+ };
2143
+ readonly stateStore: {
2144
+ readonly kind: "object";
2145
+ readonly update: "options";
2146
+ };
2147
+ readonly stateSaveDebounceMs: {
2148
+ readonly kind: "number";
2149
+ readonly update: "options";
2150
+ };
2039
2151
  readonly locale: {
2040
2152
  readonly kind: "object";
2041
2153
  readonly update: "options";
@@ -2224,6 +2336,10 @@ declare const GRID_OPTION_META: {
2224
2336
  readonly kind: "boolean";
2225
2337
  readonly update: "options";
2226
2338
  };
2339
+ readonly error: {
2340
+ readonly kind: "unknown";
2341
+ readonly update: "options";
2342
+ };
2227
2343
  readonly overlayNoRowsTemplate: {
2228
2344
  readonly kind: "unknown";
2229
2345
  readonly update: "options";
@@ -2232,6 +2348,10 @@ declare const GRID_OPTION_META: {
2232
2348
  readonly kind: "unknown";
2233
2349
  readonly update: "options";
2234
2350
  };
2351
+ readonly overlayErrorTemplate: {
2352
+ readonly kind: "unknown";
2353
+ readonly update: "options";
2354
+ };
2235
2355
  readonly allowUnsafeOverlayHtml: {
2236
2356
  readonly kind: "boolean";
2237
2357
  readonly update: "options";
@@ -2332,6 +2452,28 @@ declare function saveColumnState(key: string, state: ColumnState[]): void;
2332
2452
  declare function loadColumnState(key: string): ColumnState[] | null;
2333
2453
  declare function clearColumnState(key: string): void;
2334
2454
 
2455
+ interface StoredGridState {
2456
+ schemaVersion: 1;
2457
+ savedAt: number;
2458
+ state: GridState;
2459
+ }
2460
+ interface LocalGridStateStoreOptions {
2461
+ namespace?: string;
2462
+ storage?: ColumnStateStorage;
2463
+ /** Reject unexpectedly large or corrupted payloads. Defaults to 512 KiB. */
2464
+ maxBytes?: number;
2465
+ onError?(error: unknown, operation: "load" | "save" | "clear", key: string): void;
2466
+ }
2467
+ interface ManagedGridStateStore extends GridStateStore {
2468
+ clear(key: string): void;
2469
+ storageKey(key: string): string;
2470
+ }
2471
+ /** Safe, versioned localStorage adapter for full grid state. */
2472
+ declare function createLocalGridStateStore(options?: LocalGridStateStoreOptions): ManagedGridStateStore;
2473
+ declare function saveGridState(key: string, state: GridState): void;
2474
+ declare function loadGridState(key: string): GridState | null;
2475
+ declare function clearGridState(key: string): void;
2476
+
2335
2477
  type AggValues = Record<string, any>;
2336
2478
  type AggFunction = (values: any[]) => any;
2337
2479
  declare const BUILTIN_AGG_FUNCS: Record<string, AggFunction>;
@@ -2345,6 +2487,29 @@ declare function parseDelimited(text: string, separator: string): string[][];
2345
2487
  declare function escapeHtml(value: any): string;
2346
2488
  declare function downloadFile(filename: string, content: string, mime?: string): boolean;
2347
2489
 
2490
+ interface MachTableCommandOptions<TData = any> {
2491
+ getApi(): GridApi<TData> | null;
2492
+ /** Overrides refresh for remote-query workflows. */
2493
+ reload?: () => void | Promise<void>;
2494
+ /** Fullscreen target. Defaults to the grid root's parent when available. */
2495
+ getFullscreenElement?: () => HTMLElement | null;
2496
+ }
2497
+ interface MachTableCommands {
2498
+ search(text: string | null | undefined): void;
2499
+ refresh(): Promise<void>;
2500
+ openColumns(anchor?: HTMLElement): void;
2501
+ setDensity(size: GridSize): void;
2502
+ resetColumns(): void;
2503
+ undo(): boolean;
2504
+ redo(): boolean;
2505
+ canUndo(): boolean;
2506
+ canRedo(): boolean;
2507
+ exportCsv(filename?: string): boolean;
2508
+ toggleFullscreen(): Promise<boolean>;
2509
+ }
2510
+ /** Framework-neutral command surface used by Vue/React controllers and toolbars. */
2511
+ declare function createMachTableCommands<TData = any>(options: MachTableCommandOptions<TData>): MachTableCommands;
2512
+
2348
2513
  declare function sanitizeFormulaCell(value: any): any;
2349
2514
 
2350
2515
  declare function registerCellRenderer(name: string, renderer: CellRendererFn): () => void;
@@ -2367,12 +2532,26 @@ interface ProgressConfig {
2367
2532
  }
2368
2533
  declare function createProgressBarRenderer(config?: ProgressConfig): CellRendererFn;
2369
2534
  declare function linkRenderer(params: CellRendererParams): string | HTMLElement;
2535
+ declare const ICON_PATHS: {
2536
+ readonly edit: "<path d=\"M11.5 2.5l2 2L5 13H3v-2l8.5-8.5z\"/>";
2537
+ readonly delete: "<path d=\"M3 5h10M6 5V3h4v2M5 5l.7 8h4.6L11 5\"/>";
2538
+ readonly view: "<path d=\"M1.5 8s2.4-4.2 6.5-4.2S14.5 8 14.5 8s-2.4 4.2-6.5 4.2S1.5 8 1.5 8z\"/><circle cx=\"8\" cy=\"8\" r=\"1.8\"/>";
2539
+ readonly copy: "<rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1\"/><path d=\"M3 11V3h8\"/>";
2540
+ readonly download: "<path d=\"M8 2v8m0 0l-3-3m3 3l3-3M2.5 13.5h11\"/>";
2541
+ readonly refresh: "<path d=\"M13 3v4h-4M3 13V9h4\"/><path d=\"M13 7a5.5 5.5 0 00-9.7-2.6M3 9a5.5 5.5 0 009.7 2.6\"/>";
2542
+ readonly close: "<path d=\"M3.5 3.5l9 9m0-9l-9 9\"/>";
2543
+ readonly check: "<path d=\"M2.5 8.5l3.5 3.5 7.5-8\"/>";
2544
+ readonly plus: "<path d=\"M8 2.5v11M2.5 8h11\"/>";
2545
+ readonly search: "<circle cx=\"7\" cy=\"7\" r=\"4.5\"/><path d=\"M10.5 10.5L14 14\"/>";
2546
+ readonly more: "<circle cx=\"3\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"8\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"13\" cy=\"8\" r=\".9\" fill=\"currentColor\" stroke=\"none\"/>";
2547
+ };
2548
+ type BuiltInActionIcon = keyof typeof ICON_PATHS;
2370
2549
  type ActionVariant = "default" | "primary" | "warning" | "success" | "danger";
2371
2550
  type ActionOverflowMode = "menu" | "drawer" | "inline";
2372
2551
  interface ActionItem<TData = any> {
2373
2552
  /** Stable identifier used by permission, telemetry and error policies. */
2374
2553
  id?: string;
2375
- icon?: string;
2554
+ icon?: BuiltInActionIcon;
2376
2555
  label?: string;
2377
2556
  title?: string;
2378
2557
  /** Backwards-compatible shorthand for variant="danger". */
@@ -2398,10 +2577,12 @@ interface ActionButtonsConfig<TData = any> {
2398
2577
  interface RowActionsConfig<TData = any> extends Omit<ActionButtonsConfig<TData>, "actions"> {
2399
2578
  onView?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
2400
2579
  onDelete?: (params: CellRendererParams<TData>) => unknown | Promise<unknown>;
2580
+ /** Persists the just-validated row. Failures reopen row editing and keep the change dirty. */
2581
+ onSave?: (params: CellRendererParams<TData>, changes: readonly GridChange<TData>[]) => unknown | Promise<unknown>;
2401
2582
  /** Set false when this table has no full-row edit workflow. */
2402
2583
  edit?: boolean;
2403
2584
  extraActions?: ActionItem<TData>[];
2404
- labels?: Partial<Record<"view" | "edit" | "delete" | "save" | "cancel", string>>;
2585
+ labels?: Partial<Record<"view" | "edit" | "delete" | "confirm" | "save" | "cancel", string>>;
2405
2586
  permissions?: Partial<Record<"view" | "edit" | "delete", string | readonly string[]>>;
2406
2587
  /** Defaults to the translated delete label when true. */
2407
2588
  confirmDelete?: boolean | string | ((params: CellRendererParams<TData>) => boolean | string | Promise<boolean | string>);
@@ -2422,20 +2603,6 @@ declare function rowActionsColumn<TData = any>(config?: RowActionsConfig<TData>
2422
2603
  pinned?: "left" | "right";
2423
2604
  }): ColDef<TData>;
2424
2605
 
2425
- type Callable = (...args: never[]) => unknown;
2426
- type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | Callable;
2427
- type Depth = 0 | 1 | 2 | 3 | 4;
2428
- type Previous = {
2429
- 0: 0;
2430
- 1: 0;
2431
- 2: 1;
2432
- 3: 2;
2433
- 4: 3;
2434
- };
2435
- type FieldPath<T, D extends Depth = 4> = D extends 0 ? never : T extends Primitive ? never : {
2436
- [K in keyof T & string]: NonNullable<T[K]> extends Primitive | readonly unknown[] ? K : K | `${K}.${FieldPath<NonNullable<T[K]>, Previous[D]>}`;
2437
- }[keyof T & string];
2438
- type FieldPathValue<T, P extends string> = P extends keyof T ? T[P] : P extends `${infer Head}.${infer Tail}` ? Head extends keyof T ? FieldPathValue<NonNullable<T[Head]>, Tail> : unknown : unknown;
2439
2606
  interface ColumnHelper<TData> {
2440
2607
  accessor<TPath extends FieldPath<TData>>(field: TPath, definition?: Omit<ColDef<TData, FieldPathValue<TData, TPath>>, "field">): ColDef<TData, FieldPathValue<TData, TPath>>;
2441
2608
  display<TValue = unknown>(definition: Omit<ColDef<TData, TValue>, "field"> & Required<Pick<ColDef<TData, TValue>, "colId">>): ColDef<TData, TValue>;
@@ -2455,6 +2622,51 @@ declare function defineMachTablePreset<TData>(preset: Partial<GridOptions<TData>
2455
2622
  /** Compile-time helper for reusable, typed grid option objects. */
2456
2623
  declare function defineGridOptions<TData>(options: GridOptions<TData>): GridOptions<TData>;
2457
2624
 
2625
+ type MachTablePresetSelection = string | readonly string[] | false | null;
2626
+ interface MachTableConfigWarning {
2627
+ code: "UNKNOWN_PRESET";
2628
+ message: string;
2629
+ preset?: string;
2630
+ }
2631
+ interface MachTableRuntimeConfig {
2632
+ /** Defaults inherited by every table in this application or subtree. */
2633
+ defaults?: Partial<GridOptions<any>>;
2634
+ /** Application-wide semantic column types. Kept separate for config readability. */
2635
+ columnTypes?: Readonly<Record<string, Partial<ColDef<any>>>>;
2636
+ /** Application-wide renderer/editor registry. Per-table components can override it. */
2637
+ components?: GridComponents;
2638
+ /** Named, reusable behavior profiles such as `list`, `crud` or `picker`. */
2639
+ presets?: Readonly<Record<string, Partial<GridOptions<any>>>>;
2640
+ /** Preset used when a table does not declare its own preset. Set false to disable. */
2641
+ defaultPreset?: MachTablePresetSelection;
2642
+ onConfigWarning?: (warning: MachTableConfigWarning) => void;
2643
+ }
2644
+ interface ResolvedMachTableConfig {
2645
+ readonly defaults: Partial<GridOptions<any>>;
2646
+ readonly presets: Readonly<Record<string, Partial<GridOptions<any>>>>;
2647
+ readonly defaultPreset: MachTablePresetSelection;
2648
+ readonly onConfigWarning?: (warning: MachTableConfigWarning) => void;
2649
+ }
2650
+ interface MachTableOptionExplanation {
2651
+ readonly key: keyof GridOptions<any> | string;
2652
+ readonly value: unknown;
2653
+ readonly source: string;
2654
+ readonly layers: readonly {
2655
+ name: string;
2656
+ value: unknown;
2657
+ }[];
2658
+ }
2659
+ interface ResolvedMachTableGridOptions<TData = any> {
2660
+ readonly options: GridOptions<TData>;
2661
+ explain(key: keyof GridOptions<TData> | string): MachTableOptionExplanation;
2662
+ }
2663
+ /** Type-checks a dedicated `mach-table.config.ts` without runtime work. */
2664
+ declare function defineMachTableConfig<const TConfig extends MachTableRuntimeConfig>(config: TConfig): TConfig;
2665
+ declare function normalizeMachTableConfig(config?: MachTableRuntimeConfig): ResolvedMachTableConfig;
2666
+ /** Merges app, route and layout configuration while preserving named presets. */
2667
+ declare function mergeMachTableConfig(parent: ResolvedMachTableConfig, child: MachTableRuntimeConfig): ResolvedMachTableConfig;
2668
+ declare function resolveMachTableGridOptions<TData>(config: ResolvedMachTableConfig, requestedPreset: MachTablePresetSelection | undefined, explicit: Partial<GridOptions<TData>>, reportWarning?: (warning: MachTableConfigWarning) => void): ResolvedMachTableGridOptions<TData>;
2669
+
2458
2670
  type BusinessColumnType = "text" | "number" | "integer" | "money" | "percent" | "percentage" | "date" | "datetime" | "boolean" | "status" | "link";
2459
2671
  interface BusinessColumnTypeOptions {
2460
2672
  locale?: string | readonly string[];
@@ -2509,4 +2721,4 @@ declare function sortNodes<TData>(nodes: RowNode<TData>[], sortModel: SortModel,
2509
2721
 
2510
2722
  declare const version: string;
2511
2723
 
2512
- export { type ActionButtonsConfig, type ActionItem, type ActionOverflowMode, type ActionPolicy, type ActionPolicyContext, type ActionVariant, type AggFunction, type AggValues, type ApplyGridStateOptions, BUILTIN_AGG_FUNCS, type BusinessColumnType, type BusinessColumnTypeOptions, type CachedDictionary, type CachedDictionaryOptions, type CellAlign, type CellClassParams, type CellClassRule, type CellClickEvent, type CellContextMenuEvent, type CellDoubleClickEvent, type CellEditingStartedEvent, type CellEditingStoppedEvent, type CellEditorFactory, type CellEditorParams, type CellRendererFn, type CellRendererOutput, type CellRendererParams, type CellStyleRule, type CellValueChangedEvent, type ColDef, type ColDefGroup, type ColDefOrGroup, Column, type ColumnFilter, type ColumnHelper, type ColumnLayoutMode, type ColumnMovedEvent, type ColumnResizedEvent, type ColumnState, type ColumnStateKeyParts, type ColumnStateStorage, type ColumnStateStore, type ColumnVisibilityChangedEvent, type ColumnWorkbenchItem, type ContextMenuItem, type ContextMenuParams, type CsvExportParams, DEFAULT_LOCALE, DIRECT_GRID_OPTION_KEYS, type DateFilterCondition, type DateFilterMatch, type DetailRowRendererParams, type DetailToggledEvent, type DictionaryEntry, type DictionaryKey, type DictionaryRendererOptions, type DirtyStateChangedEvent, EVENT_TYPES, type EditableIndicator, type EditableParams, EventBus, type EventHandlers, type FieldPath, type FieldPathValue, type FilterChangedEvent, type FilterModel, type FilterType, GRID_OPTION_KEYS, GRID_OPTION_META, GRID_SIZE_PRESETS, type GetRowHeightParams, type GetRowIdParams, type GridApi, type GridCellChange, type GridCellRange, type GridChange, type GridComponents, GridCore, type GridDatasource, type GridDiagnosticError, type GridDiagnostics, type GridEditType, type GridErrorCode, type GridErrorEvent, type GridEventBase, type GridEventMap, type GridEventType, type GridFeature, type GridFeatureContext, type GridOptionKey, type GridOptionMetadata, type GridOptionUpdateMode, type GridOptionValueKind, type GridOptions, type GridReadyEvent, type GridSchema, type GridSchemaField, type GridSchemaFieldType, type GridSchemaGroup, type GridSize, type GridSizePreset, type GridState, type GridStateSection, type GridValidationCode, type GridValidationIssue, type HeaderComponentParams, type ICellEditor, type ICellRendererResult, type ImportCsvOptions, type InfiniteGetRowsParams, LOCALE_EN, type LocalColumnStateStoreOptions, type ManagedColumnStateStore, type ModelUpdatedEvent, type NumberFilterCondition, type NumberFilterMatch, type OverlayContent, type OverlayTemplate, type PaginationChangedEvent, type PaginationConfig, type PinnedDirection, type PrintOptions, type ProgressConfig, type RangeSelectionChangedEvent, type ResolvedGridOptions, type RgLocale, type RgLocaleKey, type RowActionsConfig, type RowClickEvent, type RowDragEndEvent, type RowEditChange, type RowEditValidationParams, type RowEditValidationResult, type RowEditingStartedEvent, type RowEditingStoppedEvent, type RowNode, type RowSelectionMode, type RowTransaction, type SaveChangesHandler, type SaveChangesResult, type SchemaSelectOption, type SelectEditorParams, type SelectionChangedEvent, type SetFilterCondition, type SetFilterParams, type SortChangedEvent, type SortDirection, type SortModel, type SortModelItem, type StatusBarConfig, type StatusBarPanel, type StatusTagConfig, type StoredColumnState, type TagVariant, type TextFilterCondition, type TextFilterMatch, type ThemeMode, type TooltipParams, type TreeChildrenLoadFailedEvent, type TreeChildrenLoadedEvent, type TreeDataLoadParams, type ValueFormatterParams, type ValueGetterParams, type ValueSetterParams, type WatermarkConfig, type WidthInput, actionsColumn, buildColDefsFromSchema, clearColumnState, clearComponentRegistries, computeColumnWidths, createActionButtonsRenderer, createAggResolver, createBusinessColumnTypes, createCachedDictionary, createColumnHelper, createColumnStateKey, createDictionaryRenderer, createEnterprisePreset, createGrid, createLocalColumnStateStore, createMachTablePreset, createProgressBarRenderer, createRowActionsRenderer, createStatusTagRenderer, defaultComparator, defineColumns, defineGridOptions, defineMachTablePreset, describeFilter, downloadFile, dragColumn, escapeHtml, evaluateColumnFilter, fitColumnWidths, formatText, formatTwo, getByPath, getCellEditor, getCellRenderer, indexColumn, isColDefGroup, isSafePath, linkRenderer, loadColumnState, matchLocaleKey, parseCsv, parseDelimited, parseTsv, registerBuiltinRenderers, registerCellEditor, registerCellRenderer, resolveTagVariant, rowActionsColumn, sanitizeFormulaCell, saveColumnState, selectionColumn, setByPath, sortNodes, toTsv, validateGridOptions, version };
2724
+ export { type ActionButtonsConfig, type ActionItem, type ActionOverflowMode, type ActionPolicy, type ActionPolicyContext, type ActionVariant, type AggFunction, type AggValues, type ApplyGridStateOptions, BUILTIN_AGG_FUNCS, type BuiltInActionIcon, type BusinessColumnType, type BusinessColumnTypeOptions, type CachedDictionary, type CachedDictionaryOptions, type CellAlign, type CellClassParams, type CellClassRule, type CellClickEvent, type CellContextMenuEvent, type CellDoubleClickEvent, type CellEditingStartedEvent, type CellEditingStoppedEvent, type CellEditorFactory, type CellEditorParams, type CellRendererFn, type CellRendererOutput, type CellRendererParams, type CellStyleRule, type CellValueChangedEvent, type ColDef, type ColDefGroup, type ColDefOrGroup, Column, type ColumnFilter, type ColumnHelper, type ColumnLayoutMode, type ColumnMovedEvent, type ColumnResizedEvent, type ColumnState, type ColumnStateKeyParts, type ColumnStateStorage, type ColumnStateStore, type ColumnVisibilityChangedEvent, type ColumnWorkbenchItem, type ContextMenuItem, type ContextMenuParams, type CsvExportParams, DEFAULT_LOCALE, DIRECT_GRID_OPTION_KEYS, type DateFilterCondition, type DateFilterMatch, type DetailRowRendererParams, type DetailToggledEvent, type DictionaryEntry, type DictionaryKey, type DictionaryRendererOptions, type DirtyStateChangedEvent, type DomLayoutMode, EVENT_TYPES, type EditableIndicator, type EditableParams, EventBus, type EventHandlers, type FieldPath, type FieldPathValue, type FilterChangedEvent, type FilterModel, type FilterType, GRID_OPTION_KEYS, GRID_OPTION_META, GRID_SIZE_PRESETS, type GetRowHeightParams, type GetRowIdParams, type GridApi, type GridCellChange, type GridCellRange, type GridChange, type GridComponents, GridCore, type GridDatasource, type GridDiagnosticError, type GridDiagnostics, type GridEditType, type GridErrorCode, type GridErrorEvent, type GridEventBase, type GridEventMap, type GridEventType, type GridFeature, type GridFeatureContext, type GridOptionKey, type GridOptionMetadata, type GridOptionUpdateMode, type GridOptionValueKind, type GridOptions, type GridReadyEvent, type GridSchema, type GridSchemaField, type GridSchemaFieldType, type GridSchemaGroup, type GridSize, type GridSizePreset, type GridState, type GridStateSection, type GridStateStore, type GridValidationCode, type GridValidationIssue, type HeaderComponentParams, type ICellEditor, type ICellRendererResult, type ImportCsvOptions, type InfiniteGetRowsParams, LOCALE_EN, type LocalColumnStateStoreOptions, type LocalGridStateStoreOptions, type MachTableCommandOptions, type MachTableCommands, type MachTableConfigWarning, type MachTableOptionExplanation, type MachTablePresetSelection, type MachTableRuntimeConfig, type ManagedColumnStateStore, type ManagedGridStateStore, type ModelUpdatedEvent, type NumberFilterCondition, type NumberFilterMatch, type OverlayContent, type OverlayTemplate, type PaginationChangedEvent, type PaginationConfig, type PinnedDirection, type PrintOptions, type ProgressConfig, type RangeSelectionChangedEvent, type ResolvedGridOptions, type ResolvedMachTableConfig, type ResolvedMachTableGridOptions, type RgLocale, type RgLocaleKey, type RowActionsConfig, type RowClickEvent, type RowDragEndEvent, type RowEditChange, type RowEditValidationParams, type RowEditValidationResult, type RowEditingStartedEvent, type RowEditingStoppedEvent, type RowNode, type RowSelectionMode, type RowTransaction, type SaveChangesHandler, type SaveChangesResult, type SchemaSelectOption, type SelectEditorParams, type SelectionChangedEvent, type SetFilterCondition, type SetFilterParams, type SortChangedEvent, type SortDirection, type SortModel, type SortModelItem, type StatusBarConfig, type StatusBarPanel, type StatusTagConfig, type StoredColumnState, type StoredGridState, type TagVariant, type TextFilterCondition, type TextFilterMatch, type ThemeMode, type TooltipParams, type TreeChildrenLoadFailedEvent, type TreeChildrenLoadedEvent, type TreeDataLoadParams, type ValueFormatterParams, type ValueGetterParams, type ValueSetterParams, type WatermarkConfig, type WidthInput, actionsColumn, buildColDefsFromSchema, clearColumnState, clearComponentRegistries, clearGridState, computeColumnWidths, createActionButtonsRenderer, createAggResolver, createBusinessColumnTypes, createCachedDictionary, createColumnHelper, createColumnStateKey, createDictionaryRenderer, createEnterprisePreset, createGrid, createLocalColumnStateStore, createLocalGridStateStore, createMachTableCommands, createMachTablePreset, createProgressBarRenderer, createRowActionsRenderer, createStatusTagRenderer, defaultComparator, defineColumns, defineGridOptions, defineMachTableConfig, defineMachTablePreset, describeFilter, downloadFile, dragColumn, escapeHtml, evaluateColumnFilter, fitColumnWidths, formatText, formatTwo, getByPath, getCellEditor, getCellRenderer, indexColumn, isColDefGroup, isSafePath, linkRenderer, loadColumnState, loadGridState, matchLocaleKey, mergeMachTableConfig, normalizeMachTableConfig, parseCsv, parseDelimited, parseTsv, registerBuiltinRenderers, registerCellEditor, registerCellRenderer, resolveMachTableGridOptions, resolveTagVariant, rowActionsColumn, sanitizeFormulaCell, saveColumnState, saveGridState, selectionColumn, setByPath, sortNodes, toTsv, validateGridOptions, version };