@guiexpert/table 1.1.85 → 1.1.88
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/css/main.css +8 -1
- package/css/table-classes.css +8 -1
- package/index.cjs +27 -27
- package/index.d.ts +2 -0
- package/index.js +812 -638
- package/lib/table/render-scope.d.ts +5 -0
- package/lib/table/resize-handler.d.ts +6 -0
- package/lib/table/selection/selection-service.d.ts +15 -0
- package/lib/table/table-api.d.ts +14 -0
- package/lib/table/table-scope.d.ts +44 -0
- package/package.json +1 -1
|
@@ -335,6 +335,11 @@ export declare class RenderScope extends EleScope {
|
|
|
335
335
|
*
|
|
336
336
|
* @return {undefined}
|
|
337
337
|
*/
|
|
338
|
+
/**
|
|
339
|
+
* Cancels a pending debounced rendering and calls all renderer cleanup functions
|
|
340
|
+
* (e.g. unmounts framework components rendered into cells). Used by {@link TableScope.destroy}.
|
|
341
|
+
*/
|
|
342
|
+
protected disposeRendering(): void;
|
|
338
343
|
protected debounce(fn: () => void, delay?: number): void;
|
|
339
344
|
/**
|
|
340
345
|
* Adjusts the dragging column during a mouse move event.
|
|
@@ -8,6 +8,12 @@ import { TableScope } from './table-scope';
|
|
|
8
8
|
export declare class ResizeHandler {
|
|
9
9
|
protected tableScope: TableScope;
|
|
10
10
|
protected debounceDelay: number;
|
|
11
|
+
private readonly resizeObserver;
|
|
12
|
+
private disconnected;
|
|
11
13
|
constructor(tableScope: TableScope, debounceDelay?: number);
|
|
14
|
+
/**
|
|
15
|
+
* Stops observing the host element. Called by {@link TableScope.destroy}.
|
|
16
|
+
*/
|
|
17
|
+
disconnect(): void;
|
|
12
18
|
private handleResize;
|
|
13
19
|
}
|
|
@@ -11,7 +11,22 @@ export declare class SelectionService implements OnActionTriggeredIf {
|
|
|
11
11
|
getSelectionModel?: GetT<SelectionModelIf>;
|
|
12
12
|
getFocusModel?: GetT<FocusModelIf>;
|
|
13
13
|
protected previousEvt?: GeMouseEvent;
|
|
14
|
+
/** A drag selection ends with a click on another cell – that click must not clear the new range. */
|
|
15
|
+
protected ignoreNextClick: boolean;
|
|
14
16
|
constructor(tableScope: TableScope);
|
|
17
|
+
/**
|
|
18
|
+
* Called on mouse down: a new gesture starts.
|
|
19
|
+
*/
|
|
20
|
+
onMouseDown(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Selects a range by dragging the mouse over body cells (selection type "range").
|
|
23
|
+
* The cell where the drag started stays the anchor, so a following shift-click extends from there.
|
|
24
|
+
*
|
|
25
|
+
* @param {GeMouseEvent} evt - the current mouse position
|
|
26
|
+
* @param {GeMouseEvent} startEvt - the mouse down event that started the drag
|
|
27
|
+
* @returns {boolean} true if the selection changed (repaint needed)
|
|
28
|
+
*/
|
|
29
|
+
onMouseDragging(evt: GeMouseEvent, startEvt: GeMouseEvent | undefined): boolean;
|
|
15
30
|
onMouseClicked(evt: GeMouseEvent, _previousEvt: GeMouseEvent | undefined): boolean;
|
|
16
31
|
onActionTriggered(actionId: ActionId): boolean;
|
|
17
32
|
private createRangeByEvents;
|
package/lib/table/table-api.d.ts
CHANGED
|
@@ -718,6 +718,20 @@ export declare class TableApi {
|
|
|
718
718
|
* @returns {void}
|
|
719
719
|
*/
|
|
720
720
|
repaint(): void;
|
|
721
|
+
/**
|
|
722
|
+
* Releases the table: removes all DOM listeners (incl. the window resize listener), stops the
|
|
723
|
+
* resize observer, calls the cleanup functions of all cell renderers and clears the host element.
|
|
724
|
+
* The framework wrappers call it automatically when they are unmounted or receive a new table model.
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* // Plain TS: replace the table with a new model
|
|
728
|
+
* tableApi.destroy();
|
|
729
|
+
* const scope = new TableScope(hostDiv, newModel, new SimpleDomService(), new TableOptions(), new EventAdapter());
|
|
730
|
+
* scope.firstInit();
|
|
731
|
+
*
|
|
732
|
+
* @returns {void}
|
|
733
|
+
*/
|
|
734
|
+
destroy(): void;
|
|
721
735
|
/**
|
|
722
736
|
* Performs a complete repaint of the table by triggering a hard repaint on the underlying table scope.
|
|
723
737
|
*
|
|
@@ -57,6 +57,12 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
57
57
|
readonly copyService: CopyServiceIf;
|
|
58
58
|
readonly excelService: ExcelServiceIf;
|
|
59
59
|
licenseManager: LicenseManager;
|
|
60
|
+
/**
|
|
61
|
+
* Signal for all DOM listeners of this table (host element, scroll viewport, window).
|
|
62
|
+
* {@link destroy} aborts it, which removes every listener at once.
|
|
63
|
+
*/
|
|
64
|
+
readonly listenerAbortController: AbortController;
|
|
65
|
+
private destroyed;
|
|
60
66
|
mouseHandler: MouseHandler;
|
|
61
67
|
inputHandler: InputHandler;
|
|
62
68
|
resizeHandler: ResizeHandler;
|
|
@@ -74,6 +80,8 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
74
80
|
private lastDragFrom;
|
|
75
81
|
private lastDragTo;
|
|
76
82
|
private firstDraggingRendering;
|
|
83
|
+
/** Last comparator passed to `sort()`; re-applied after filtering. Cleared by a header sort. */
|
|
84
|
+
private lastSortCompareFn?;
|
|
77
85
|
constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, domService: DomServiceIf, tableOptions: TableOptionsIf, eventListener: EventListenerIf, copyService?: CopyServiceIf, excelService?: ExcelServiceIf);
|
|
78
86
|
/**
|
|
79
87
|
* Creates a TableScope instance.
|
|
@@ -113,6 +121,27 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
113
121
|
* @returns {TableScope} This instance of the table scope.
|
|
114
122
|
*/
|
|
115
123
|
firstInit(): TableScope;
|
|
124
|
+
/**
|
|
125
|
+
* Releases the table: removes all DOM listeners (host element, scroll viewport, window resize),
|
|
126
|
+
* stops the resize observer, unregisters from the selection and focus model, calls the cleanup
|
|
127
|
+
* functions of all cell renderers and clears the host element.
|
|
128
|
+
*
|
|
129
|
+
* Call it before you create a new `TableScope` for the same host element (e.g. when a framework
|
|
130
|
+
* wrapper receives a new table model) or when the table is removed from the page.
|
|
131
|
+
* Calling it twice is harmless.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* const scope = new TableScope(hostDiv, tableModel, new SimpleDomService(), new TableOptions(), new EventAdapter());
|
|
135
|
+
* scope.firstInit();
|
|
136
|
+
* // later, e.g. when a new model arrives:
|
|
137
|
+
* scope.destroy();
|
|
138
|
+
* new TableScope(hostDiv, newTableModel, new SimpleDomService(), new TableOptions(), new EventAdapter()).firstInit();
|
|
139
|
+
*/
|
|
140
|
+
destroy(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Returns `true` once {@link destroy} has been called.
|
|
143
|
+
*/
|
|
144
|
+
isDestroyed(): boolean;
|
|
116
145
|
/**
|
|
117
146
|
* Creates a GeMouseEvent object based on a MouseEvent.
|
|
118
147
|
*
|
|
@@ -294,12 +323,27 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
294
323
|
* @private
|
|
295
324
|
*/
|
|
296
325
|
private autoRestoreCollapsedExpandedState;
|
|
326
|
+
/**
|
|
327
|
+
* Calculates a width per column that fits the widest text of header, body and footer.
|
|
328
|
+
*
|
|
329
|
+
* The text is measured with the font and padding of a rendered cell label (canvas `measureText`),
|
|
330
|
+
* so dates, numbers and long names are no longer cut off. To stay fast with millions of rows, the body
|
|
331
|
+
* is scanned once by character length and only the longest candidates per column are measured.
|
|
332
|
+
* Without a canvas (e.g. in tests) it falls back to 8 px per character.
|
|
333
|
+
*
|
|
334
|
+
* @returns {number[]} one width in px per column (at least 50 px)
|
|
335
|
+
*/
|
|
297
336
|
calcAutoColumnWidths(): number[];
|
|
298
337
|
setColumnWidth(columnIndex: number, width: number): void;
|
|
299
338
|
autoResizeColumns(recalcWrappers?: boolean): void;
|
|
300
339
|
recalcWrappers(): void;
|
|
301
340
|
reSort(): void;
|
|
302
341
|
sort(compareFn: (a: any, b: any) => number): void;
|
|
342
|
+
/**
|
|
343
|
+
* Sorts the (freshly filtered) body rows again, so a filter keeps the current order:
|
|
344
|
+
* the last `sort(compareFn)` call, otherwise the columns with a `sortState` (header icons).
|
|
345
|
+
*/
|
|
346
|
+
protected reapplySorting(): void;
|
|
303
347
|
/**
|
|
304
348
|
* Ensures that a specific row is visible in the viewport by scrolling if necessary.
|
|
305
349
|
* This method checks if the target row is within the currently visible range and
|