@agile-team/mach-table 0.14.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> {
@@ -496,6 +498,8 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
496
498
  rowBuffer?: number;
497
499
  /** `fit` continuously fills the container without grid-ready glue code. */
498
500
  columnLayout?: ColumnLayoutMode;
501
+ /** Enables pointer, double-click and Alt+Arrow column resizing. Disabled by default. */
502
+ enableColumnResize?: boolean;
499
503
  /** Lets small grids grow with their rows. Avoid for large or infinite datasets. */
500
504
  domLayout?: DomLayoutMode;
501
505
  rowSelection?: RowSelectionMode;
@@ -606,6 +610,7 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
606
610
  headerHeight: number;
607
611
  rowBuffer: number;
608
612
  columnLayout: ColumnLayoutMode;
613
+ enableColumnResize: boolean;
609
614
  domLayout: DomLayoutMode;
610
615
  rowSelection: RowSelectionMode;
611
616
  multiSort: boolean;
@@ -796,6 +801,8 @@ interface GridApi<TData = any> {
796
801
  setColumnVisibility(colId: string, visible: boolean): void;
797
802
  moveColumn(colId: string, toIndex: number): void;
798
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;
799
806
  sizeColumnsToFit(width?: number): void;
800
807
  autoSizeColumn(colId: string, skipHeader?: boolean): void;
801
808
  autoSizeAllColumns(skipHeader?: boolean): void;
@@ -1120,6 +1127,10 @@ interface ColumnState {
1120
1127
  colId: string;
1121
1128
  hide?: boolean;
1122
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";
1123
1134
  pinned?: "left" | "right" | null;
1124
1135
  sort?: SortDirection | null;
1125
1136
  sortIndex?: number | null;
@@ -1173,12 +1184,14 @@ declare class ColumnModel {
1173
1184
  paneOf(column: Column): PaneType;
1174
1185
  computeLayout(viewportWidth: number): void;
1175
1186
  private widthInputOf;
1176
- setColumnWidth(column: Column, width: number): void;
1187
+ setColumnWidth(column: Column, width: number): boolean;
1177
1188
  setColumnVisibility(colId: string, visible: boolean): void;
1178
1189
  moveColumn(colId: string, toIndex: number): boolean;
1179
1190
  setColumnPinned(colId: string, pinned: PinnedDirection | null): void;
1180
1191
  getColumnState(): ColumnState[];
1181
1192
  applyColumnState(states: ColumnState[]): void;
1193
+ private applyColumnViewState;
1194
+ private sortModelFromState;
1182
1195
  private applyStateOrder;
1183
1196
  resetColumnState(): void;
1184
1197
  getSortModel(): SortModel;
@@ -1335,16 +1348,25 @@ declare class SelectionService {
1335
1348
  private recomputeTriState;
1336
1349
  }
1337
1350
 
1338
- type ResizeContext = Pick<GridCore<any>, "columnModel" | "emit" | "persistColumnState" | "relayoutColumns" | "skeleton">;
1351
+ type ResizeContext = Pick<GridCore<any>, "columnModel" | "commitColumnWidths" | "emitColumnResize" | "options" | "relayoutColumns" | "skeleton">;
1339
1352
  declare class ResizeService {
1340
1353
  private core;
1341
1354
  private active;
1342
1355
  private rafId;
1343
1356
  private pendingWidth;
1344
1357
  constructor(core: ResizeContext);
1345
- startResize(e: PointerEvent, column: Column): void;
1358
+ startResize(event: PointerEvent, column: Column): void;
1359
+ cancelResize(restore?: boolean): void;
1346
1360
  private onMove;
1347
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;
1348
1370
  destroy(): void;
1349
1371
  }
1350
1372
 
@@ -1620,7 +1642,7 @@ declare class GridSkeleton {
1620
1642
  private cleanupOverlayContent;
1621
1643
  }
1622
1644
 
1623
- 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">;
1624
1646
  declare class HeaderRenderer {
1625
1647
  private core;
1626
1648
  private leafCells;
@@ -1634,6 +1656,7 @@ declare class HeaderRenderer {
1634
1656
  private visiblePaneLeaves;
1635
1657
  private onHeaderKeyDown;
1636
1658
  private focusHeaderCell;
1659
+ private canResizeColumn;
1637
1660
  refreshSortIndicators(): void;
1638
1661
  refreshFilterIcons(): void;
1639
1662
  refreshSelectAllCheckbox(): void;
@@ -1922,6 +1945,9 @@ declare class GridCore<TData = any> {
1922
1945
  applyQuickFilter(): void;
1923
1946
  moveColumn(colId: string, toIndex: number): void;
1924
1947
  toggleDetail(rowId: string): boolean;
1948
+ emitColumnResize(column: Column, finished: boolean): void;
1949
+ /** Finalizes one logical resize operation and persists its state once. */
1950
+ commitColumnWidths(columns: readonly Column[]): void;
1925
1951
  private columnStateLoadToken;
1926
1952
  loadPersistedColumnState(): void;
1927
1953
  persistColumnState(): void;
@@ -2022,6 +2048,10 @@ declare const GRID_OPTION_META: {
2022
2048
  readonly kind: "string";
2023
2049
  readonly update: "options";
2024
2050
  };
2051
+ readonly enableColumnResize: {
2052
+ readonly kind: "boolean";
2053
+ readonly update: "options";
2054
+ };
2025
2055
  readonly domLayout: {
2026
2056
  readonly kind: "string";
2027
2057
  readonly update: "options";
package/dist/index.d.ts 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> {
@@ -496,6 +498,8 @@ interface GridOptions<TData = any> extends EventHandlers<TData> {
496
498
  rowBuffer?: number;
497
499
  /** `fit` continuously fills the container without grid-ready glue code. */
498
500
  columnLayout?: ColumnLayoutMode;
501
+ /** Enables pointer, double-click and Alt+Arrow column resizing. Disabled by default. */
502
+ enableColumnResize?: boolean;
499
503
  /** Lets small grids grow with their rows. Avoid for large or infinite datasets. */
500
504
  domLayout?: DomLayoutMode;
501
505
  rowSelection?: RowSelectionMode;
@@ -606,6 +610,7 @@ interface ResolvedGridOptions<TData = any> extends EventHandlers<TData> {
606
610
  headerHeight: number;
607
611
  rowBuffer: number;
608
612
  columnLayout: ColumnLayoutMode;
613
+ enableColumnResize: boolean;
609
614
  domLayout: DomLayoutMode;
610
615
  rowSelection: RowSelectionMode;
611
616
  multiSort: boolean;
@@ -796,6 +801,8 @@ interface GridApi<TData = any> {
796
801
  setColumnVisibility(colId: string, visible: boolean): void;
797
802
  moveColumn(colId: string, toIndex: number): void;
798
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;
799
806
  sizeColumnsToFit(width?: number): void;
800
807
  autoSizeColumn(colId: string, skipHeader?: boolean): void;
801
808
  autoSizeAllColumns(skipHeader?: boolean): void;
@@ -1120,6 +1127,10 @@ interface ColumnState {
1120
1127
  colId: string;
1121
1128
  hide?: boolean;
1122
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";
1123
1134
  pinned?: "left" | "right" | null;
1124
1135
  sort?: SortDirection | null;
1125
1136
  sortIndex?: number | null;
@@ -1173,12 +1184,14 @@ declare class ColumnModel {
1173
1184
  paneOf(column: Column): PaneType;
1174
1185
  computeLayout(viewportWidth: number): void;
1175
1186
  private widthInputOf;
1176
- setColumnWidth(column: Column, width: number): void;
1187
+ setColumnWidth(column: Column, width: number): boolean;
1177
1188
  setColumnVisibility(colId: string, visible: boolean): void;
1178
1189
  moveColumn(colId: string, toIndex: number): boolean;
1179
1190
  setColumnPinned(colId: string, pinned: PinnedDirection | null): void;
1180
1191
  getColumnState(): ColumnState[];
1181
1192
  applyColumnState(states: ColumnState[]): void;
1193
+ private applyColumnViewState;
1194
+ private sortModelFromState;
1182
1195
  private applyStateOrder;
1183
1196
  resetColumnState(): void;
1184
1197
  getSortModel(): SortModel;
@@ -1335,16 +1348,25 @@ declare class SelectionService {
1335
1348
  private recomputeTriState;
1336
1349
  }
1337
1350
 
1338
- type ResizeContext = Pick<GridCore<any>, "columnModel" | "emit" | "persistColumnState" | "relayoutColumns" | "skeleton">;
1351
+ type ResizeContext = Pick<GridCore<any>, "columnModel" | "commitColumnWidths" | "emitColumnResize" | "options" | "relayoutColumns" | "skeleton">;
1339
1352
  declare class ResizeService {
1340
1353
  private core;
1341
1354
  private active;
1342
1355
  private rafId;
1343
1356
  private pendingWidth;
1344
1357
  constructor(core: ResizeContext);
1345
- startResize(e: PointerEvent, column: Column): void;
1358
+ startResize(event: PointerEvent, column: Column): void;
1359
+ cancelResize(restore?: boolean): void;
1346
1360
  private onMove;
1347
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;
1348
1370
  destroy(): void;
1349
1371
  }
1350
1372
 
@@ -1620,7 +1642,7 @@ declare class GridSkeleton {
1620
1642
  private cleanupOverlayContent;
1621
1643
  }
1622
1644
 
1623
- 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">;
1624
1646
  declare class HeaderRenderer {
1625
1647
  private core;
1626
1648
  private leafCells;
@@ -1634,6 +1656,7 @@ declare class HeaderRenderer {
1634
1656
  private visiblePaneLeaves;
1635
1657
  private onHeaderKeyDown;
1636
1658
  private focusHeaderCell;
1659
+ private canResizeColumn;
1637
1660
  refreshSortIndicators(): void;
1638
1661
  refreshFilterIcons(): void;
1639
1662
  refreshSelectAllCheckbox(): void;
@@ -1922,6 +1945,9 @@ declare class GridCore<TData = any> {
1922
1945
  applyQuickFilter(): void;
1923
1946
  moveColumn(colId: string, toIndex: number): void;
1924
1947
  toggleDetail(rowId: string): boolean;
1948
+ emitColumnResize(column: Column, finished: boolean): void;
1949
+ /** Finalizes one logical resize operation and persists its state once. */
1950
+ commitColumnWidths(columns: readonly Column[]): void;
1925
1951
  private columnStateLoadToken;
1926
1952
  loadPersistedColumnState(): void;
1927
1953
  persistColumnState(): void;
@@ -2022,6 +2048,10 @@ declare const GRID_OPTION_META: {
2022
2048
  readonly kind: "string";
2023
2049
  readonly update: "options";
2024
2050
  };
2051
+ readonly enableColumnResize: {
2052
+ readonly kind: "boolean";
2053
+ readonly update: "options";
2054
+ };
2025
2055
  readonly domLayout: {
2026
2056
  readonly kind: "string";
2027
2057
  readonly update: "options";