@guiexpert/table 1.1.85 → 1.1.86

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.
@@ -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
  }
@@ -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;
@@ -113,6 +119,27 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
113
119
  * @returns {TableScope} This instance of the table scope.
114
120
  */
115
121
  firstInit(): TableScope;
122
+ /**
123
+ * Releases the table: removes all DOM listeners (host element, scroll viewport, window resize),
124
+ * stops the resize observer, unregisters from the selection and focus model, calls the cleanup
125
+ * functions of all cell renderers and clears the host element.
126
+ *
127
+ * Call it before you create a new `TableScope` for the same host element (e.g. when a framework
128
+ * wrapper receives a new table model) or when the table is removed from the page.
129
+ * Calling it twice is harmless.
130
+ *
131
+ * @example
132
+ * const scope = new TableScope(hostDiv, tableModel, new SimpleDomService(), new TableOptions(), new EventAdapter());
133
+ * scope.firstInit();
134
+ * // later, e.g. when a new model arrives:
135
+ * scope.destroy();
136
+ * new TableScope(hostDiv, newTableModel, new SimpleDomService(), new TableOptions(), new EventAdapter()).firstInit();
137
+ */
138
+ destroy(): void;
139
+ /**
140
+ * Returns `true` once {@link destroy} has been called.
141
+ */
142
+ isDestroyed(): boolean;
116
143
  /**
117
144
  * Creates a GeMouseEvent object based on a MouseEvent.
118
145
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiexpert/table",
3
- "version": "1.1.85",
3
+ "version": "1.1.86",
4
4
  "license": "MIT",
5
5
  "author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
6
6
  "repository": {