@guiexpert/table 1.1.109 → 1.1.110

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.
@@ -0,0 +1,29 @@
1
+ import { ColumnDefIf } from '../data/tablemodel/column/column-def.if.js';
2
+
3
+ /**
4
+ * What {@link ColumnAutoWidthOptionsIf.getWidth} gets to measure a column itself.
5
+ *
6
+ * @category Column drag
7
+ * @since 1.1.110
8
+ */
9
+ export interface ColumnAutoWidthContextIf {
10
+ /** Model index of the column. */
11
+ columnIndex: number;
12
+ /** The column definition (`undefined` for a table model without column definitions). */
13
+ columnDef: ColumnDefIf | undefined;
14
+ /** The property of the column. */
15
+ property: string | undefined;
16
+ /** A double click on the resize handle, or a call of {@link TableApi.autoResizeColumn} / {@link TableApi.autoResizeColumns}. */
17
+ source: "dblclick" | "api";
18
+ /** First body row drawn now (display index). */
19
+ firstRenderedRow: number;
20
+ /** Last body row drawn now (display index, `-1` without rows). */
21
+ lastRenderedRow: number;
22
+ /**
23
+ * Width in px a cell needs for this text: measured with the font of a rendered cell label, plus its padding (the
24
+ * same measurement as the default).
25
+ */
26
+ measureText(text: string): number;
27
+ /** The default measurement of this column (header, footer, body rows up to {@link ColumnAutoWidthOptionsIf.maxRows}). */
28
+ getDefaultWidth(): number;
29
+ }
@@ -0,0 +1,24 @@
1
+ import { ColumnAutoWidthOptionsIf } from './column-auto-width-options.if.js';
2
+
3
+ /**
4
+ * The defaults of {@link ColumnAutoWidthOptionsIf}: double click on, all body rows up to 10 000, no own measurement.
5
+ *
6
+ * @example
7
+ * const options = ColumnAutoWidthOptions.create({ maxRows: 1_000 });
8
+ * console.log(options.doubleClick, options.maxRows); // true 1000
9
+ *
10
+ * @category Column drag
11
+ * @since 1.1.110
12
+ */
13
+ export declare class ColumnAutoWidthOptions implements ColumnAutoWidthOptionsIf {
14
+ doubleClick: boolean;
15
+ maxRows: number;
16
+ getWidth?: ColumnAutoWidthOptionsIf["getWidth"];
17
+ /**
18
+ * The defaults merged with `options` (`tableOptions.columnAutoWidth`).
19
+ *
20
+ * @param {Partial<ColumnAutoWidthOptionsIf>} [options] - own values
21
+ * @returns {ColumnAutoWidthOptionsIf} complete options
22
+ */
23
+ static create(options?: Partial<ColumnAutoWidthOptionsIf>): ColumnAutoWidthOptionsIf;
24
+ }
@@ -0,0 +1,35 @@
1
+ import { ColumnAutoWidthContextIf } from './column-auto-width-context.if.js';
2
+
3
+ /**
4
+ * Fitting a column width to its content: a double click on the resize handle, {@link TableApi.autoResizeColumn} and
5
+ * {@link TableApi.autoResizeColumns} (`tableOptions.columnAutoWidth`).
6
+ *
7
+ * @example
8
+ * const tableOptions: TableOptionsIf = {
9
+ * ...new TableOptions(),
10
+ * columnAutoWidth: {
11
+ * maxRows: 50_000,
12
+ * getWidth: ctx => ctx.property === "message" ? ctx.measureText("x".repeat(80)) : undefined,
13
+ * },
14
+ * };
15
+ *
16
+ * @category Column drag
17
+ * @since 1.1.110
18
+ */
19
+ export interface ColumnAutoWidthOptionsIf {
20
+ /**
21
+ * A double click on the resize handle fits the width of the column to its content. Only where a handle is
22
+ * (`columnsResizable` and the column is not `resizable: false`). Default `true`.
23
+ */
24
+ doubleClick: boolean;
25
+ /**
26
+ * Body rows that are measured: up to this number of rows all of them, above only the rows drawn now (the time stays
27
+ * the same with millions of rows). Header and footer are always measured. Default `10_000`.
28
+ */
29
+ maxRows: number;
30
+ /**
31
+ * Own measurement: return the width in px, or `undefined` for the default. The result is limited by
32
+ * `minWidth` / `maxWidth` of the column.
33
+ */
34
+ getWidth?: (ctx: ColumnAutoWidthContextIf) => number | undefined;
35
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * DOM-free order rules of a column drag (prompt 022): columns with `movable: false` are fixed places – the movable
3
+ * columns fill the other places –, and a column stays in its area (fixed west, center, fixed east).
4
+ *
5
+ * Not exported from the package: internals of {@link TableScope} and {@link TableStateService}.
6
+ */
7
+ /**
8
+ * The `changeColumnOrder(from, to)` calls that move the column at `from` to the index `to` while every locked column
9
+ * keeps its index. Without a locked column between `from` and `to` this is the single move `[[from, to]]`.
10
+ *
11
+ * @param movable - per column: `false` = locked (fixed place)
12
+ * @param from - current index of the dragged column
13
+ * @param to - index the dragged column should get
14
+ * @returns the moves in order, `[]` for `from === to`, `undefined` if the move is not allowed (a locked source or
15
+ * target, an index out of range)
16
+ */
17
+ export declare function planColumnMove(movable: boolean[], from: number, to: number): [number, number][] | undefined;
18
+ /**
19
+ * Limits a drop index to the area of the dragged column: a fixed west column stays west, a center column in the
20
+ * center, a fixed east column east (before 1.1.110 a drag over the border silently changed which column was fixed).
21
+ *
22
+ * @param from - index of the dragged column
23
+ * @param to - index under the mouse
24
+ * @param count - number of columns
25
+ * @param fixedLeft - `fixedLeftColumnCount`
26
+ * @param fixedRight - `fixedRightColumnCount`
27
+ * @returns `to` within the area of `from`
28
+ */
29
+ export declare function clampToColumnArea(from: number, to: number, count: number, fixedLeft: number, fixedRight: number): number;
30
+ /**
31
+ * A column order to apply (e.g. from a stored state) with the locked columns at their current index.
32
+ *
33
+ * @param target - the wanted order (properties)
34
+ * @param current - the order now (properties)
35
+ * @param locked - properties of the locked columns (`movable: false`)
36
+ * @returns the order to apply
37
+ */
38
+ export declare function orderKeepingLocked(target: string[], current: string[], locked: Set<string>): string[];
@@ -0,0 +1,26 @@
1
+ import { AreaModelIf } from '../data/tablemodel/areamodel/area-model.if.js';
2
+
3
+ /**
4
+ * Measures the width a cell needs for its text (prompt 022, before part of `TableScope.calcAutoColumnWidths`).
5
+ *
6
+ * The text is measured with the font and padding of a rendered cell label (canvas `measureText`). Without a canvas
7
+ * (e.g. in a test environment without one) it falls back to 8 px per character.
8
+ *
9
+ * Not exported from the package: an internal of {@link TableScope}.
10
+ */
11
+ export declare class ColumnWidthMeasurer {
12
+ /** Texts (per column) whose character length is close to the longest – only they are measured. */
13
+ static readonly maxCandidates = 30;
14
+ private readonly ctx;
15
+ private readonly padding;
16
+ constructor(hostElement: HTMLElement);
17
+ /** Width in px of a cell with this text: text width + cell padding + 2 px (rounded up). */
18
+ measureText(text: string): number;
19
+ /** The widest of the texts (at least 50 px, like the column widths before 1.1.110). */
20
+ measureWidest(texts: Set<string>): number;
21
+ }
22
+ /**
23
+ * Collects per column the texts with (almost) the greatest character length of the rows `fromRow … toRow`.
24
+ * One pass over the rows and the given columns; `candidates[k]` / `maxLength[k]` belong to `columns[k]`.
25
+ */
26
+ export declare function collectColumnTextCandidates(model: AreaModelIf | undefined, fromRow: number, toRow: number, columns: number[], candidates: Set<string>[], maxLength: number[]): void;
@@ -0,0 +1,56 @@
1
+ import { ColumnDefIf } from '../../tablemodel/column/column-def.if.js';
2
+ import { GeColumnDragEventType } from './ge-column-resize-event.js';
3
+
4
+ /**
5
+ * The user moves a column by dragging its header ({@link EventListenerIf.onColumnMoveStart},
6
+ * {@link EventListenerIf.onColumnMoveEnd}).
7
+ *
8
+ * One start and one end per drag – no event for the steps in between (the table moves the column while the mouse
9
+ * moves). Only user actions report it, not {@link TableApi.applyState} or `tableModel.changeColumnOrder()`. The end
10
+ * comes after the table applied the order: in the handler `tableApi.getTableModel().getColumnDefs()` and
11
+ * {@link TableApi.getState} already have it.
12
+ *
13
+ * @example
14
+ * const listener = new EventAdapter();
15
+ * listener.onColumnMoveEnd = (evt: GeColumnMoveEvent) => {
16
+ * if (evt.moved) {
17
+ * localStorage.setItem("column-order", JSON.stringify(evt.columnOrder));
18
+ * }
19
+ * };
20
+ *
21
+ * @category Column drag
22
+ * @since 1.1.110
23
+ */
24
+ export declare class GeColumnMoveEvent {
25
+ /** Phase: `"start"`, `"end"` or `"cancel"` (Escape: the old order is back). */
26
+ readonly type: GeColumnDragEventType;
27
+ /** Model index of the column when the drag started. */
28
+ readonly fromIndex: number;
29
+ /** Model index of the column now (`"start"` and `"cancel"`: `fromIndex`; `"end"`: also when it did not change). */
30
+ readonly toIndex: number;
31
+ /** The column definition of the dragged column. */
32
+ readonly columnDef: ColumnDefIf | undefined;
33
+ /** The property of the dragged column (`columnDef.property`). */
34
+ readonly property: string | undefined;
35
+ /** The properties of all columns in the order now (after the move for `"end"`). */
36
+ readonly columnOrder: string[];
37
+ /** The browser event behind it (mouse up; `undefined` for {@link TableApi.cancelColumnDrag}). */
38
+ readonly originalEvent?: Event | undefined;
39
+ constructor(
40
+ /** Phase: `"start"`, `"end"` or `"cancel"` (Escape: the old order is back). */
41
+ type: GeColumnDragEventType,
42
+ /** Model index of the column when the drag started. */
43
+ fromIndex: number,
44
+ /** Model index of the column now (`"start"` and `"cancel"`: `fromIndex`; `"end"`: also when it did not change). */
45
+ toIndex: number,
46
+ /** The column definition of the dragged column. */
47
+ columnDef: ColumnDefIf | undefined,
48
+ /** The property of the dragged column (`columnDef.property`). */
49
+ property: string | undefined,
50
+ /** The properties of all columns in the order now (after the move for `"end"`). */
51
+ columnOrder: string[],
52
+ /** The browser event behind it (mouse up; `undefined` for {@link TableApi.cancelColumnDrag}). */
53
+ originalEvent?: Event | undefined);
54
+ /** true if the column has another index now (`toIndex !== fromIndex`). */
55
+ get moved(): boolean;
56
+ }
@@ -0,0 +1,72 @@
1
+ import { ColumnDefIf } from '../../tablemodel/column/column-def.if.js';
2
+
3
+ /**
4
+ * Phase of a column drag (resize or move): `"start"` (the mouse moved past the drag threshold of 4 px, or a double
5
+ * click on the resize handle), `"end"` (released – also outside of the table) or `"cancel"` (Escape,
6
+ * {@link TableApi.cancelColumnDrag}: the old width resp. order is back).
7
+ *
8
+ * @category Column drag
9
+ * @since 1.1.110
10
+ */
11
+ export type GeColumnDragEventType = "start" | "end" | "cancel";
12
+ /**
13
+ * What changed the width: dragging the resize handle (`"mouse"`) or a double click on it (`"dblclick"`, fits the width
14
+ * to the content).
15
+ *
16
+ * @category Column drag
17
+ * @since 1.1.110
18
+ */
19
+ export type GeColumnResizeSource = "mouse" | "dblclick";
20
+ /**
21
+ * The user resizes a column ({@link EventListenerIf.onColumnResizeStart}, {@link EventListenerIf.onColumnResizeEnd}).
22
+ *
23
+ * Only user actions report it – not {@link TableApi.setColumnWidth}, {@link TableApi.applyState},
24
+ * {@link TableApi.autoResizeColumns} or {@link TableApi.autoResizeColumn}. The end comes once per start, after the
25
+ * table applied the width: in the handler {@link TableApi.getState} and the table model already have it.
26
+ *
27
+ * @example
28
+ * const listener = new EventAdapter();
29
+ * listener.onColumnResizeEnd = (evt: GeColumnResizeEvent) => {
30
+ * if (evt.type === "end" && evt.property) {
31
+ * localStorage.setItem(`width-${evt.property}`, String(evt.newWidth));
32
+ * }
33
+ * };
34
+ *
35
+ * @category Column drag
36
+ * @since 1.1.110
37
+ */
38
+ export declare class GeColumnResizeEvent {
39
+ /** Phase: `"start"`, `"end"` or `"cancel"`. */
40
+ readonly type: GeColumnDragEventType;
41
+ /** Dragging the handle or a double click on it. */
42
+ readonly source: GeColumnResizeSource;
43
+ /** Model index of the column (over west, center and east). */
44
+ readonly columnIndex: number;
45
+ /** The column definition – `undefined` for a table model without column definitions. */
46
+ readonly columnDef: ColumnDefIf | undefined;
47
+ /** The property of the column (`columnDef.property`) – use it to store the width, indices change. */
48
+ readonly property: string | undefined;
49
+ /** Width in px when the drag started. */
50
+ readonly oldWidth: number;
51
+ /** Width in px now: `"start"` = `oldWidth`, `"end"` = the new width, `"cancel"` = `oldWidth` again. */
52
+ readonly newWidth: number;
53
+ /** The browser event behind it (mouse up, double click; `undefined` for {@link TableApi.cancelColumnDrag}). */
54
+ readonly originalEvent?: Event | undefined;
55
+ constructor(
56
+ /** Phase: `"start"`, `"end"` or `"cancel"`. */
57
+ type: GeColumnDragEventType,
58
+ /** Dragging the handle or a double click on it. */
59
+ source: GeColumnResizeSource,
60
+ /** Model index of the column (over west, center and east). */
61
+ columnIndex: number,
62
+ /** The column definition – `undefined` for a table model without column definitions. */
63
+ columnDef: ColumnDefIf | undefined,
64
+ /** The property of the column (`columnDef.property`) – use it to store the width, indices change. */
65
+ property: string | undefined,
66
+ /** Width in px when the drag started. */
67
+ oldWidth: number,
68
+ /** Width in px now: `"start"` = `oldWidth`, `"end"` = the new width, `"cancel"` = `oldWidth` again. */
69
+ newWidth: number,
70
+ /** The browser event behind it (mouse up, double click; `undefined` for {@link TableApi.cancelColumnDrag}). */
71
+ originalEvent?: Event | undefined);
72
+ }
@@ -48,6 +48,10 @@ export declare class RowNumberColumnDef implements ColumnDefIf {
48
48
  rendererMap: AreaObjectMapType<CellRendererIf>;
49
49
  classes: AreaObjectMapType<string[]>;
50
50
  isVisible: BooleanFunction;
51
+ /** No resize handle: the width follows the largest number (since 1.1.110 a flag, before a special case). */
52
+ resizable: boolean;
53
+ /** Stays in front: can't be dragged, no column is dropped in front of it (since 1.1.110 a flag). */
54
+ movable: boolean;
51
55
  /** The options (defaults from {@link RowNumberOptions}). */
52
56
  readonly options: RowNumberOptionsIf;
53
57
  /**
@@ -15,6 +15,7 @@ import { HeaderGroupOptions } from './header-group-options.js';
15
15
  import { AriaTextsIf } from '../../aria/aria-texts.if.js';
16
16
  import { OverlayOptionsIf } from './overlay-options.if.js';
17
17
  import { RowDragOptionsIf } from '../../row-drag/row-drag-options.if.js';
18
+ import { ColumnAutoWidthOptionsIf } from '../../column-drag/column-auto-width-options.if.js';
18
19
  import { FillHandleOptionsIf } from '../../fill/fill-handle-options.if.js';
19
20
  import { EditingOptionsIf } from '../../sheet-editing/editing-options.if.js';
20
21
  import { ClipboardOptionsIf } from '../../clipboard/clipboard-options.if.js';
@@ -104,6 +105,8 @@ export declare class TableOptions implements TableOptionsIf {
104
105
  /** Texts and behaviour of the "Loading…" / "No rows" overlays; missing fields use {@link OverlayOptions}. @since 1.1.92 */
105
106
  overlayOptions?: Partial<OverlayOptionsIf>;
106
107
  rowDragOptions?: Partial<RowDragOptionsIf>;
108
+ /** Fitting a column width to its content (double click on the resize handle …). @since 1.1.110 */
109
+ columnAutoWidth?: Partial<ColumnAutoWidthOptionsIf>;
107
110
  fillHandle?: boolean | Partial<FillHandleOptionsIf>;
108
111
  masterDetail?: Partial<MasterDetailOptionsIf>;
109
112
  batchEdit?: boolean | Partial<BatchEditOptionsIf>;
@@ -23,6 +23,7 @@ import { AriaTextsIf } from '../../aria/aria-texts.if.js';
23
23
  import { TableStateIf } from '../../state/table-state.if.js';
24
24
  import { OverlayOptionsIf } from './overlay-options.if.js';
25
25
  import { TableDirection } from '../../rtl/table-direction.type.js';
26
+ import { ColumnAutoWidthOptionsIf } from '../../column-drag/column-auto-width-options.if.js';
26
27
 
27
28
  /**
28
29
  * Represents the options for configuring a table.
@@ -166,13 +167,17 @@ export interface TableOptionsIf {
166
167
  */
167
168
  hoverColumnVisible: boolean;
168
169
  /**
169
- * Represents whether the columns are resizable.
170
+ * The user can change column widths by dragging the handle at the end of a header cell (and fit a width to the
171
+ * content by a double click on it, {@link columnAutoWidth}). A single column is locked with
172
+ * `ColumnDef.resizable: false`. Events: {@link EventListenerIf.onColumnResizeStart} / `onColumnResizeEnd`.
170
173
  *
171
174
  * @type {boolean}
172
175
  */
173
176
  columnsResizable: boolean;
174
177
  /**
175
- * Flag indicating whether the columns are draggable.
178
+ * The user can move columns by dragging a header cell. A single column is locked with `ColumnDef.movable: false`;
179
+ * a column stays in its area (fixed west, center, fixed east – since 1.1.110). Events:
180
+ * {@link EventListenerIf.onColumnMoveStart} / `onColumnMoveEnd`.
176
181
  *
177
182
  * @type {boolean}
178
183
  */
@@ -352,6 +357,20 @@ export interface TableOptionsIf {
352
357
  * @see [Live demo: row drag](https://gui.expert/showcase/rowdrag/run/) · Training: [Dragging rows into order](https://gui.expert/training/events-and-context-menu/#row-drag)
353
358
  */
354
359
  rowDragOptions?: Partial<RowDragOptionsIf>;
360
+ /**
361
+ * Fitting a column width to its content: double click on the resize handle (on by default), the number of body
362
+ * rows that are measured, an own measurement (see {@link ColumnAutoWidthOptionsIf}). Also used by
363
+ * {@link TableApi.autoResizeColumn} and {@link TableApi.autoResizeColumns}.
364
+ *
365
+ * @example
366
+ * const tableOptions: TableOptionsIf = {
367
+ * ...new TableOptions(),
368
+ * columnAutoWidth: { getWidth: ctx => ctx.property === "id" ? 80 : undefined },
369
+ * };
370
+ *
371
+ * @since 1.1.110
372
+ */
373
+ columnAutoWidth?: Partial<ColumnAutoWidthOptionsIf>;
355
374
  /**
356
375
  * The fill handle: a small square at the bottom right corner of the selected range. Dragging it fills the
357
376
  * neighbouring cells (copy, or a series: 1, 2, 3 …, dates, `Item 1` → `Item 2`); ⌥/Alt switches between series and
@@ -71,6 +71,10 @@ export declare class ColumnDef implements ColumnDefIf {
71
71
  emptyValue?: unknown;
72
72
  /** `false`: no cell formulas in this column, see {@link ColumnDefIf.cellFormulas} (since 1.1.99). */
73
73
  cellFormulas?: boolean;
74
+ /** `false`: no resize handle, no auto width, see {@link ColumnDefIf.resizable} (since 1.1.110). */
75
+ resizable?: boolean;
76
+ /** `false`: can't be moved by dragging, see {@link ColumnDefIf.movable} (since 1.1.110). */
77
+ movable?: boolean;
74
78
  /** Lower limit for % widths and for resizing with the mouse, see {@link ColumnDefIf.minWidth}. Default `0px`. */
75
79
  minWidth: SizeIf;
76
80
  /** Upper limit for % widths and for resizing with the mouse, see {@link ColumnDefIf.maxWidth}. Default `100000px`. */
@@ -154,5 +158,9 @@ export declare class ColumnDef implements ColumnDefIf {
154
158
  emptyValue?: unknown;
155
159
  /** `false`: `"=…"` stays text in this column of a table with cell formulas (since 1.1.99). */
156
160
  cellFormulas?: boolean;
161
+ /** `false`: the user can't resize the column (since 1.1.110). */
162
+ resizable?: boolean;
163
+ /** `false`: the user can't move the column (since 1.1.110). */
164
+ movable?: boolean;
157
165
  }): ColumnDefIf;
158
166
  }
@@ -228,6 +228,28 @@ export interface ColumnDefIf {
228
228
  * @since 1.1.99
229
229
  */
230
230
  cellFormulas?: boolean;
231
+ /**
232
+ * `false`: the user can't change the width of this column – no resize handle, no double click, and
233
+ * {@link TableApi.autoResizeColumns} / {@link TableApi.autoResizeColumn} leave it out. `setColumnWidth` and
234
+ * `applyState` still set it. Default `true` (works only with `tableOptions.columnsResizable`).
235
+ *
236
+ * @example
237
+ * ColumnDef.create({ property: "line", headerLabel: "#", width: px50, resizable: false, movable: false })
238
+ *
239
+ * @since 1.1.110
240
+ */
241
+ resizable?: boolean;
242
+ /**
243
+ * `false`: the user can't move this column – its header is not draggable, and no other column pushes it away (it
244
+ * keeps its index; `applyState` with another order leaves it in place, too). Default `true` (works only with
245
+ * `tableOptions.columnsDraggable`). A {@link RowNumberColumnDef} has `resizable` and `movable` `false`.
246
+ *
247
+ * @example
248
+ * ColumnDef.create({ property: "id", headerLabel: "ID", movable: false })
249
+ *
250
+ * @since 1.1.110
251
+ */
252
+ movable?: boolean;
231
253
  }
232
254
  /**
233
255
  * {@link ColumnDefIf.validate}: a message for an invalid value, `undefined` (or `null`, `""`) for a valid one.
@@ -10,6 +10,8 @@ import { FocusModelIf } from './focus/focus-model.if.js';
10
10
  import { GeStateChangeEvent } from './data/common/event/ge-state-change-event.js';
11
11
  import { GeBatchEditEvent } from './data/common/event/ge-batch-edit-event.js';
12
12
  import { GeRowDragEvent } from './data/common/event/ge-row-drag-event.js';
13
+ import { GeColumnResizeEvent } from './data/common/event/ge-column-resize-event.js';
14
+ import { GeColumnMoveEvent } from './data/common/event/ge-column-move-event.js';
13
15
 
14
16
  /**
15
17
  * Empty implementation of {@link EventListenerIf} – extend it and override only the events you need.
@@ -49,4 +51,12 @@ export declare class EventAdapter implements EventListenerIf {
49
51
  onEditingChanged(_evt: GeEditEvent): void;
50
52
  /** @since 1.1.99 */
51
53
  onUndoStackChanged(_evt: GeUndoEvent): void;
54
+ /** @since 1.1.110 */
55
+ onColumnResizeStart(_evt: GeColumnResizeEvent): void;
56
+ /** @since 1.1.110 */
57
+ onColumnResizeEnd(_evt: GeColumnResizeEvent): void;
58
+ /** @since 1.1.110 */
59
+ onColumnMoveStart(_evt: GeColumnMoveEvent): void;
60
+ /** @since 1.1.110 */
61
+ onColumnMoveEnd(_evt: GeColumnMoveEvent): void;
52
62
  }
@@ -1,6 +1,8 @@
1
1
  import { GeEditEvent } from './data/common/event/ge-edit-event.js';
2
2
  import { GeUndoEvent } from './data/common/event/ge-undo-event.js';
3
3
  import { GeDetailEvent } from './data/common/event/ge-detail-event.js';
4
+ import { GeColumnResizeEvent } from './data/common/event/ge-column-resize-event.js';
5
+ import { GeColumnMoveEvent } from './data/common/event/ge-column-move-event.js';
4
6
  import { GeMouseEvent } from './data/common/event/ge-mouse-event.js';
5
7
  import { GeModelChangeEvent } from './data/common/event/ge-model-change-event.js';
6
8
  import { GeScrollEvent } from './data/common/event/ge-scroll-event.js';
@@ -118,4 +120,32 @@ export interface EventListenerIf extends EventFocusChangedListenerIf, EventSelec
118
120
  * @since 1.1.99
119
121
  */
120
122
  onUndoStackChanged?(evt: GeUndoEvent): void;
123
+ /**
124
+ * Optional: the user started to resize a column (the mouse moved 4 px with the resize handle pressed, or a double
125
+ * click on it). Not reported for API calls. See {@link GeColumnResizeEvent}.
126
+ *
127
+ * @since 1.1.110
128
+ */
129
+ onColumnResizeStart?(evt: GeColumnResizeEvent): void;
130
+ /**
131
+ * Optional: a column resize ended – `evt.type` `"end"` (also released outside the table) or `"cancel"` (Escape: the
132
+ * old width is back). Once per start, after the table applied the width: save the column layout here.
133
+ *
134
+ * @since 1.1.110
135
+ */
136
+ onColumnResizeEnd?(evt: GeColumnResizeEvent): void;
137
+ /**
138
+ * Optional: the user started to move a column (dragged its header 4 px). Not reported for API calls. See
139
+ * {@link GeColumnMoveEvent}.
140
+ *
141
+ * @since 1.1.110
142
+ */
143
+ onColumnMoveStart?(evt: GeColumnMoveEvent): void;
144
+ /**
145
+ * Optional: a column move ended – `evt.type` `"end"` (`evt.moved` = another index) or `"cancel"` (Escape: the old
146
+ * order is back). Once per start, no event for the steps in between, after the table applied the order.
147
+ *
148
+ * @since 1.1.110
149
+ */
150
+ onColumnMoveEnd?(evt: GeColumnMoveEvent): void;
121
151
  }
@@ -658,8 +658,16 @@ export declare class RenderScope extends EleScope {
658
658
  * @since 1.1.93
659
659
  */
660
660
  getFirstDataColumnIndex(): number;
661
- /** false for a row number column: it has no resize handle (its width follows the numbers). */
661
+ /**
662
+ * false for `ColumnDef.resizable: false` (e.g. a row number column – its width follows the numbers): no resize handle,
663
+ * no double click, no auto width (since 1.1.110 a flag, before a special case of the row numbers).
664
+ */
662
665
  protected isColumnResizable(columnIndex: number): boolean;
666
+ /**
667
+ * false for `ColumnDef.movable: false` (e.g. a row number column): the header can't be dragged, and no other column
668
+ * is dropped onto its place (since 1.1.110).
669
+ */
670
+ protected isColumnMovable(columnIndex: number): boolean;
663
671
  /**
664
672
  * The last measured text of the row number column and its width (measured again only when the text changes).
665
673
  * `approximate`: measured with the font of the host before a number cell existed – measured again with the font of
@@ -977,14 +977,63 @@ export declare class TableApi {
977
977
  */
978
978
  getSelectionAggregates(): SelectionAggregatesIf;
979
979
  /**
980
- * Automatically resizes all columns to fit their content.
980
+ * Automatically resizes all columns to fit their content (header, footer and body rows – all up to
981
+ * {@link ColumnAutoWidthOptionsIf.maxRows}, 10 000, above only the rows drawn now). Leaves out row number columns and
982
+ * columns with `resizable: false`; uses {@link ColumnAutoWidthOptionsIf.getWidth} and `minWidth` / `maxWidth`.
983
+ * Reports no column events.
981
984
  *
982
985
  * @param {boolean} recalcWrappers - Determines whether to recalculate wrapper dimensions after resizing columns.
983
986
  * Default value is true.
984
987
  *
988
+ * @example
989
+ * tableApi.autoResizeColumns();
990
+ *
985
991
  * @return {void} - This method doesn't return anything.
986
992
  */
987
993
  autoResizeColumns(recalcWrappers?: boolean): void;
994
+ /**
995
+ * Fits the width of **one** column to its content – what a double click on its resize handle does, but without
996
+ * events. Measures header, footer and body rows (all up to {@link ColumnAutoWidthOptionsIf.maxRows}, 10 000, above
997
+ * only the rows drawn now – the time does not grow with millions of rows), or asks
998
+ * {@link ColumnAutoWidthOptionsIf.getWidth}; limited by `minWidth` / `maxWidth`.
999
+ *
1000
+ * @param {number | string | ColumnDefIf} column - column index, property or column definition
1001
+ * @returns {number | undefined} the width set in px; `undefined` for an unknown column, a row number column or a
1002
+ * column with `resizable: false`
1003
+ *
1004
+ * @example
1005
+ * const width = tableApi.autoResizeColumn("message");
1006
+ * console.log(`message is ${width} px wide now`);
1007
+ *
1008
+ * @since 1.1.110
1009
+ * @see Training: [Remember the state](https://gui.expert/training/persist-state/#column-events)
1010
+ */
1011
+ autoResizeColumn(column: number | string | ColumnDefIf): number | undefined;
1012
+ /**
1013
+ * True while the user resizes or moves a column (between `onColumnResizeStart` / `onColumnMoveStart` and the end).
1014
+ * Renders through the API (repaint, live data) are fine meanwhile; do not change column widths or the column order
1015
+ * yourself then.
1016
+ *
1017
+ * @returns {boolean} true during a column drag
1018
+ *
1019
+ * @example
1020
+ * if (!tableApi.isColumnDragging()) {
1021
+ * tableApi.applyState(savedLayout, ["columns"]);
1022
+ * }
1023
+ *
1024
+ * @since 1.1.110
1025
+ */
1026
+ isColumnDragging(): boolean;
1027
+ /**
1028
+ * Cancels a running column resize or move like Escape: the old width resp. order is back, `onColumnResizeEnd` /
1029
+ * `onColumnMoveEnd` get the type `"cancel"`. Without a running drag nothing happens.
1030
+ *
1031
+ * @example
1032
+ * tableApi.cancelColumnDrag(); // e.g. another layout was loaded
1033
+ *
1034
+ * @since 1.1.110
1035
+ */
1036
+ cancelColumnDrag(): void;
988
1037
  /**
989
1038
  * Recalculates the dimensions of all wrapper elements in the table.
990
1039
  *