handsontable 0.0.0-next-8d01ccc-20250117 → 0.0.0-next-f52ab71-20250121

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.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (43) hide show
  1. package/3rdparty/walkontable/src/core/_base.js +0 -19
  2. package/3rdparty/walkontable/src/core/_base.mjs +0 -19
  3. package/3rdparty/walkontable/src/overlay/_base.js +8 -44
  4. package/3rdparty/walkontable/src/overlay/_base.mjs +8 -44
  5. package/3rdparty/walkontable/src/overlay/bottom.js +1 -0
  6. package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -0
  7. package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.js +1 -0
  8. package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.mjs +1 -0
  9. package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -0
  10. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -0
  11. package/3rdparty/walkontable/src/overlay/top.js +1 -0
  12. package/3rdparty/walkontable/src/overlay/top.mjs +1 -0
  13. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +1 -0
  14. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +1 -0
  15. package/3rdparty/walkontable/src/overlays.js +45 -355
  16. package/3rdparty/walkontable/src/overlays.mjs +45 -355
  17. package/3rdparty/walkontable/src/table.js +99 -94
  18. package/3rdparty/walkontable/src/table.mjs +99 -94
  19. package/base.js +2 -2
  20. package/base.mjs +2 -2
  21. package/dist/handsontable.css +4 -20
  22. package/dist/handsontable.full.css +4 -20
  23. package/dist/handsontable.full.js +166 -522
  24. package/dist/handsontable.full.min.css +3 -3
  25. package/dist/handsontable.full.min.js +108 -108
  26. package/dist/handsontable.js +166 -522
  27. package/dist/handsontable.min.css +3 -3
  28. package/dist/handsontable.min.js +15 -15
  29. package/editors/baseEditor/baseEditor.js +1 -2
  30. package/editors/baseEditor/baseEditor.mjs +1 -2
  31. package/helpers/mixed.js +1 -1
  32. package/helpers/mixed.mjs +1 -1
  33. package/package.json +1 -1
  34. package/plugins/dragToScroll/dragToScroll.js +1 -1
  35. package/plugins/dragToScroll/dragToScroll.mjs +1 -1
  36. package/styles/handsontable.css +2 -7
  37. package/styles/handsontable.min.css +3 -3
  38. package/styles/ht-theme-horizon.css +2 -2
  39. package/styles/ht-theme-horizon.min.css +2 -2
  40. package/styles/ht-theme-main.css +2 -2
  41. package/styles/ht-theme-main.min.css +2 -2
  42. package/tableView.js +2 -2
  43. package/tableView.mjs +2 -2
@@ -3,9 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
- require("core-js/modules/esnext.iterator.constructor.js");
7
- require("core-js/modules/esnext.iterator.for-each.js");
8
- require("core-js/modules/esnext.iterator.reduce.js");
9
6
  var _element = require("../../../helpers/dom/element");
10
7
  var _feature = require("../../../helpers/feature");
11
8
  var _array = require("../../../helpers/array");
@@ -25,7 +22,6 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
25
22
  * @class Overlays
26
23
  */
27
24
  var _overlays = /*#__PURE__*/new WeakMap();
28
- var _hasRenderingStateChanged = /*#__PURE__*/new WeakMap();
29
25
  var _containerDomResizeCount = /*#__PURE__*/new WeakMap();
30
26
  var _containerDomResizeCountTimeout = /*#__PURE__*/new WeakMap();
31
27
  class Overlays {
@@ -100,12 +96,6 @@ class Overlays {
100
96
  * @type {Settings}
101
97
  */
102
98
  _defineProperty(this, "wtSettings", null);
103
- /**
104
- * Indicates whether the rendering state has changed for one of the overlays.
105
- *
106
- * @type {boolean}
107
- */
108
- _classPrivateFieldInitSpec(this, _hasRenderingStateChanged, false);
109
99
  /**
110
100
  * The amount of times the ResizeObserver callback was fired in direct succession.
111
101
  *
@@ -152,32 +142,16 @@ class Overlays {
152
142
  this.domBindings = domBindings;
153
143
  this.facadeGetter = facadeGetter;
154
144
  this.wtTable = wtTable;
145
+ this.eventManager = eventManager;
146
+ this.destroyed = false;
155
147
  const {
156
- rootDocument,
157
148
  rootWindow
158
149
  } = this.domBindings;
159
-
160
- // legacy support
161
- this.instance = this.wot; // todo refactoring: move to facade
162
- this.eventManager = eventManager;
163
-
164
- // TODO refactoring: probably invalid place to this logic
165
- this.scrollbarSize = (0, _element.getScrollbarWidth)(rootDocument);
166
150
  const isOverflowHidden = rootWindow.getComputedStyle(wtTable.wtRootElement.parentNode).getPropertyValue('overflow') === 'hidden';
167
151
  this.scrollableElement = isOverflowHidden ? wtTable.holder : (0, _element.getScrollableElement)(wtTable.TABLE);
168
152
  this.initOverlays();
169
- this.destroyed = false;
170
- this.keyPressed = false;
171
- this.spreaderLastSize = {
172
- width: null,
173
- height: null
174
- };
175
- this.verticalScrolling = false;
176
- this.horizontalScrolling = false;
177
153
  this.initBrowserLineHeight();
178
154
  this.registerListeners();
179
- this.lastScrollX = rootWindow.scrollX;
180
- this.lastScrollY = rootWindow.scrollY;
181
155
  }
182
156
 
183
157
  /**
@@ -212,8 +186,8 @@ class Overlays {
212
186
  * Https://developer.mozilla.org/pl/docs/Web/CSS/line-height#Values.
213
187
  */
214
188
  const lineHeight = parseInt(computedStyle.lineHeight, 10);
215
- const lineHeightFalback = parseInt(computedStyle.fontSize, 10) * 1.2;
216
- this.browserLineHeight = lineHeight || lineHeightFalback;
189
+ const lineHeightFallback = parseInt(computedStyle.fontSize, 10) * 1.2;
190
+ this.browserLineHeight = lineHeight || lineHeightFallback;
217
191
  }
218
192
 
219
193
  /**
@@ -223,15 +197,9 @@ class Overlays {
223
197
  */
224
198
  initOverlays() {
225
199
  const args = [this.wot, this.facadeGetter, this.wtSettings, this.domBindings];
226
-
227
- // todo refactoring: IOC, collection or factories.
228
- // TODO refactoring, conceive about using generic collection of overlays.
229
200
  this.topOverlay = new _overlay.TopOverlay(...args);
230
201
  this.bottomOverlay = new _overlay.BottomOverlay(...args);
231
202
  this.inlineStartOverlay = new _overlay.InlineStartOverlay(...args);
232
-
233
- // TODO discuss, the controversial here would be removing the lazy creation mechanism for corners.
234
- // TODO cond. Has no any visual impact. They're initially hidden in same way like left, top, and bottom overlays.
235
203
  this.topInlineStartCornerOverlay = new _overlay.TopInlineStartCornerOverlay(...args, this.topOverlay, this.inlineStartOverlay);
236
204
  this.bottomInlineStartCornerOverlay = new _overlay.BottomInlineStartCornerOverlay(...args, this.bottomOverlay, this.inlineStartOverlay);
237
205
  _classPrivateFieldSet(_overlays, this, [this.topOverlay, this.bottomOverlay, this.inlineStartOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay]);
@@ -240,48 +208,20 @@ class Overlays {
240
208
  /**
241
209
  * Runs logic for the overlays before the table is drawn.
242
210
  */
243
- beforeDraw() {
244
- _classPrivateFieldSet(_hasRenderingStateChanged, this, _classPrivateFieldGet(_overlays, this).reduce((acc, overlay) => {
245
- return overlay.hasRenderingStateChanged() || acc;
246
- }, false));
247
- _classPrivateFieldGet(_overlays, this).forEach(overlay => overlay.updateStateOfRendering('before'));
248
- }
211
+ beforeDraw() {}
249
212
 
250
213
  /**
251
214
  * Runs logic for the overlays after the table is drawn.
252
215
  */
253
- afterDraw() {
254
- this.syncScrollWithMaster();
255
- _classPrivateFieldGet(_overlays, this).forEach(overlay => {
256
- const hasRenderingStateChanged = overlay.hasRenderingStateChanged();
257
- overlay.updateStateOfRendering('after');
258
- if (hasRenderingStateChanged && !overlay.needFullRender) {
259
- overlay.reset();
260
- }
261
- });
262
- }
216
+ afterDraw() {}
263
217
 
264
218
  /**
265
219
  * Refresh and redraw table.
266
220
  */
267
- refreshAll() {
268
- if (!this.wot.drawn) {
269
- return;
270
- }
271
- if (!this.wtTable.holder.parentNode) {
272
- // Walkontable was detached from DOM, but this handler was not removed
273
- this.destroy();
274
- return;
275
- }
276
- this.wot.draw(true);
277
- if (this.verticalScrolling) {
278
- this.inlineStartOverlay.onScroll(); // todo the inlineStartOverlay.onScroll() fires hook. Why is it needed there, not in any another place?
279
- }
280
- if (this.horizontalScrolling) {
281
- this.topOverlay.onScroll();
282
- }
283
- this.verticalScrolling = false;
284
- this.horizontalScrolling = false;
221
+ draw(fastDraw) {
222
+ (0, _array.arrayEach)(_classPrivateFieldGet(_overlays, this), overlay => {
223
+ overlay.adjustRootElementSize();
224
+ });
285
225
  }
286
226
 
287
227
  /**
@@ -289,39 +229,22 @@ class Overlays {
289
229
  */
290
230
  registerListeners() {
291
231
  const {
292
- rootDocument,
293
232
  rootWindow
294
233
  } = this.domBindings;
295
- const {
296
- mainTableScrollableElement: topOverlayScrollableElement
297
- } = this.topOverlay;
298
- const {
299
- mainTableScrollableElement: inlineStartOverlayScrollableElement
300
- } = this.inlineStartOverlay;
301
- this.eventManager.addEventListener(rootDocument.documentElement, 'keydown', event => this.onKeyDown(event));
302
- this.eventManager.addEventListener(rootDocument.documentElement, 'keyup', () => this.onKeyUp());
303
- this.eventManager.addEventListener(rootDocument, 'visibilitychange', () => this.onKeyUp());
304
- this.eventManager.addEventListener(topOverlayScrollableElement, 'scroll', event => this.onTableScroll(event), {
305
- passive: true
306
- });
307
- if (topOverlayScrollableElement !== inlineStartOverlayScrollableElement) {
308
- this.eventManager.addEventListener(inlineStartOverlayScrollableElement, 'scroll', event => this.onTableScroll(event), {
309
- passive: true
310
- });
311
- }
312
234
  const isHighPixelRatio = rootWindow.devicePixelRatio && rootWindow.devicePixelRatio > 1;
313
235
  const isScrollOnWindow = this.scrollableElement === rootWindow;
314
236
  const preventWheel = this.wtSettings.getSetting('preventWheel');
315
237
  const wheelEventOptions = {
316
238
  passive: isScrollOnWindow
317
239
  };
240
+ this.eventManager.addEventListener(this.scrollableElement, 'scroll', event => {
241
+ this.wot.draw(true);
242
+ }, {
243
+ passive: true
244
+ });
318
245
  if (preventWheel || isHighPixelRatio || !(0, _browser.isChrome)()) {
319
246
  this.eventManager.addEventListener(this.wtTable.wtRootElement, 'wheel', event => this.onCloneWheel(event, preventWheel), wheelEventOptions);
320
247
  }
321
- const overlays = [this.topOverlay, this.bottomOverlay, this.inlineStartOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay];
322
- overlays.forEach(overlay => {
323
- this.eventManager.addEventListener(overlay.clone.wtTable.holder, 'wheel', event => this.onCloneWheel(event, preventWheel), wheelEventOptions);
324
- });
325
248
  let resizeTimeout;
326
249
  this.eventManager.addEventListener(rootWindow, 'resize', () => {
327
250
  (0, _feature.requestAnimationFrame)(() => {
@@ -338,29 +261,6 @@ class Overlays {
338
261
  }
339
262
  }
340
263
 
341
- /**
342
- * Scroll listener.
343
- *
344
- * @param {Event} event The mouse event object.
345
- */
346
- onTableScroll(event) {
347
- // There was if statement which controlled flow of this function. It avoided the execution of the next lines
348
- // on mobile devices. It was changed. Broader description of this case is included within issue #4856.
349
- const rootWindow = this.domBindings.rootWindow;
350
- const masterHorizontal = this.inlineStartOverlay.mainTableScrollableElement;
351
- const masterVertical = this.topOverlay.mainTableScrollableElement;
352
- const target = event.target;
353
-
354
- // For key press, sync only master -> overlay position because while pressing Walkontable.render is triggered
355
- // by hot.refreshBorder
356
- if (this.keyPressed) {
357
- if (masterVertical !== rootWindow && target !== rootWindow && !event.target.contains(masterVertical) || masterHorizontal !== rootWindow && target !== rootWindow && !event.target.contains(masterHorizontal)) {
358
- return;
359
- }
360
- }
361
- this.syncScrollPositions(event);
362
- }
363
-
364
264
  /**
365
265
  * Wheel listener for cloned overlays.
366
266
  *
@@ -371,43 +271,12 @@ class Overlays {
371
271
  const {
372
272
  rootWindow
373
273
  } = this.domBindings;
374
-
375
- // There was if statement which controlled flow of this function. It avoided the execution of the next lines
376
- // on mobile devices. It was changed. Broader description of this case is included within issue #4856.
377
-
378
- const masterHorizontal = this.inlineStartOverlay.mainTableScrollableElement;
379
- const masterVertical = this.topOverlay.mainTableScrollableElement;
380
- const target = event.target;
381
-
382
- // For key press, sync only master -> overlay position because while pressing Walkontable.render is triggered
383
- // by hot.refreshBorder
384
- const shouldNotWheelVertically = masterVertical !== rootWindow && target !== rootWindow && !target.contains(masterVertical);
385
- const shouldNotWheelHorizontally = masterHorizontal !== rootWindow && target !== rootWindow && !target.contains(masterHorizontal);
386
- if (this.keyPressed && (shouldNotWheelVertically || shouldNotWheelHorizontally) || this.scrollableElement === rootWindow) {
387
- return;
388
- }
389
274
  const isScrollPossible = this.translateMouseWheelToScroll(event);
390
275
  if (preventDefault || this.scrollableElement !== rootWindow && isScrollPossible) {
391
276
  event.preventDefault();
392
277
  }
393
278
  }
394
279
 
395
- /**
396
- * Key down listener.
397
- *
398
- * @param {Event} event The keyboard event object.
399
- */
400
- onKeyDown(event) {
401
- this.keyPressed = (0, _unicode.isKey)(event.keyCode, 'ARROW_UP|ARROW_RIGHT|ARROW_DOWN|ARROW_LEFT');
402
- }
403
-
404
- /**
405
- * Key up listener.
406
- */
407
- onKeyUp() {
408
- this.keyPressed = false;
409
- }
410
-
411
280
  /**
412
281
  * Translate wheel event into scroll event and sync scroll overlays position.
413
282
  *
@@ -450,130 +319,6 @@ class Overlays {
450
319
  this.scrollableElement.scrollLeft += delta;
451
320
  return previousScroll !== this.scrollableElement.scrollLeft;
452
321
  }
453
-
454
- /**
455
- * Synchronize scroll position between master table and overlay table.
456
- *
457
- * @private
458
- */
459
- syncScrollPositions() {
460
- if (this.destroyed) {
461
- return;
462
- }
463
- const {
464
- rootWindow
465
- } = this.domBindings;
466
- const topHolder = this.topOverlay.clone.wtTable.holder; // todo rethink
467
- const leftHolder = this.inlineStartOverlay.clone.wtTable.holder; // todo rethink
468
-
469
- const [scrollLeft, scrollTop] = [this.scrollableElement.scrollLeft, this.scrollableElement.scrollTop];
470
- this.horizontalScrolling = topHolder.scrollLeft !== scrollLeft || this.lastScrollX !== rootWindow.scrollX;
471
- this.verticalScrolling = leftHolder.scrollTop !== scrollTop || this.lastScrollY !== rootWindow.scrollY;
472
- this.lastScrollX = rootWindow.scrollX;
473
- this.lastScrollY = rootWindow.scrollY;
474
- if (this.horizontalScrolling) {
475
- topHolder.scrollLeft = scrollLeft;
476
- const bottomHolder = this.bottomOverlay.needFullRender ? this.bottomOverlay.clone.wtTable.holder : null; // todo rethink
477
-
478
- if (bottomHolder) {
479
- bottomHolder.scrollLeft = scrollLeft;
480
- }
481
- }
482
- if (this.verticalScrolling) {
483
- leftHolder.scrollTop = scrollTop;
484
- }
485
- this.refreshAll();
486
- }
487
-
488
- /**
489
- * Synchronize overlay scrollbars with the master scrollbar.
490
- */
491
- syncScrollWithMaster() {
492
- if (!_classPrivateFieldGet(_hasRenderingStateChanged, this)) {
493
- return;
494
- }
495
- const master = this.topOverlay.mainTableScrollableElement;
496
- const {
497
- scrollLeft,
498
- scrollTop
499
- } = master;
500
- if (this.topOverlay.needFullRender) {
501
- this.topOverlay.clone.wtTable.holder.scrollLeft = scrollLeft; // todo rethink, *overlay.setScroll*()
502
- }
503
- if (this.bottomOverlay.needFullRender) {
504
- this.bottomOverlay.clone.wtTable.holder.scrollLeft = scrollLeft; // todo rethink, *overlay.setScroll*()
505
- }
506
- if (this.inlineStartOverlay.needFullRender) {
507
- this.inlineStartOverlay.clone.wtTable.holder.scrollTop = scrollTop; // todo rethink, *overlay.setScroll*()
508
- }
509
- _classPrivateFieldSet(_hasRenderingStateChanged, this, false);
510
- }
511
-
512
- /**
513
- *
514
- */
515
- destroy() {
516
- this.resizeObserver.disconnect();
517
- this.eventManager.destroy();
518
- // todo, probably all below `destroy` calls has no sense. To analyze
519
- this.topOverlay.destroy();
520
- if (this.bottomOverlay.clone) {
521
- this.bottomOverlay.destroy();
522
- }
523
- this.inlineStartOverlay.destroy();
524
- if (this.topInlineStartCornerOverlay) {
525
- this.topInlineStartCornerOverlay.destroy();
526
- }
527
- if (this.bottomInlineStartCornerOverlay && this.bottomInlineStartCornerOverlay.clone) {
528
- this.bottomInlineStartCornerOverlay.destroy();
529
- }
530
- this.destroyed = true;
531
- }
532
-
533
- /**
534
- * @param {boolean} [fastDraw=false] When `true`, try to refresh only the positions of borders without rerendering
535
- * the data. It will only work if Table.draw() does not force
536
- * rendering anyway.
537
- */
538
- refresh() {
539
- let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
540
- const wasSpreaderSizeUpdated = this.updateLastSpreaderSize();
541
- if (wasSpreaderSizeUpdated) {
542
- this.adjustElementsSize();
543
- }
544
- if (this.bottomOverlay.clone) {
545
- this.bottomOverlay.refresh(fastDraw);
546
- }
547
- this.inlineStartOverlay.refresh(fastDraw);
548
- this.topOverlay.refresh(fastDraw);
549
- if (this.topInlineStartCornerOverlay) {
550
- this.topInlineStartCornerOverlay.refresh(fastDraw);
551
- }
552
- if (this.bottomInlineStartCornerOverlay && this.bottomInlineStartCornerOverlay.clone) {
553
- this.bottomInlineStartCornerOverlay.refresh(fastDraw);
554
- }
555
- }
556
-
557
- /**
558
- * Update the last cached spreader size with the current size.
559
- *
560
- * @returns {boolean} `true` if the lastSpreaderSize cache was updated, `false` otherwise.
561
- */
562
- updateLastSpreaderSize() {
563
- const spreader = this.wtTable.spreader;
564
- const width = spreader.clientWidth;
565
- const height = spreader.clientHeight;
566
- const needsUpdating = width !== this.spreaderLastSize.width || height !== this.spreaderLastSize.height;
567
- if (needsUpdating) {
568
- this.spreaderLastSize.width = width;
569
- this.spreaderLastSize.height = height;
570
- }
571
- return needsUpdating;
572
- }
573
-
574
- /**
575
- * Adjust overlays elements size and master table size.
576
- */
577
322
  adjustElementsSize() {
578
323
  const {
579
324
  wtViewport
@@ -593,99 +338,44 @@ class Overlays {
593
338
  const proposedHiderWidth = headerRowSize + this.inlineStartOverlay.sumCellSizes(0, totalColumns);
594
339
  const hiderElement = wtTable.hider;
595
340
  const hiderStyle = hiderElement.style;
596
- const isScrolledBeyondHiderHeight = () => {
597
- return isWindowScrolled ? false : this.scrollableElement.scrollTop > Math.max(0, proposedHiderHeight - wtTable.holder.clientHeight);
598
- };
599
- const isScrolledBeyondHiderWidth = () => {
600
- return isWindowScrolled ? false : this.scrollableElement.scrollLeft > Math.max(0, proposedHiderWidth - wtTable.holder.clientWidth);
601
- };
602
- const columnHeaderBorderCompensation = isScrolledBeyondHiderHeight() ? 1 : 0;
603
- const rowHeaderBorderCompensation = isScrolledBeyondHiderWidth() ? 1 : 0;
604
-
605
- // If the elements are being adjusted after scrolling the table from the very beginning to the very end,
606
- // we need to adjust the hider dimensions by the header border size. (https://github.com/handsontable/dev-handsontable/issues/1772)
607
- hiderStyle.width = `${proposedHiderWidth + rowHeaderBorderCompensation}px`;
608
- hiderStyle.height = `${proposedHiderHeight + columnHeaderBorderCompensation}px`;
609
- this.topOverlay.adjustElementsSize();
610
- this.inlineStartOverlay.adjustElementsSize();
611
- this.bottomOverlay.adjustElementsSize();
612
- }
613
-
614
- /**
615
- * Expand the hider vertically element by the provided delta value.
616
- *
617
- * @param {number} heightDelta The delta value to expand the hider element by.
618
- */
619
- expandHiderVerticallyBy(heightDelta) {
620
- const {
621
- wtTable
622
- } = this;
623
- wtTable.hider.style.height = `${parseInt(wtTable.hider.style.height, 10) + heightDelta}px`;
624
- }
625
-
626
- /**
627
- * Expand the hider horizontally element by the provided delta value.
628
- *
629
- * @param {number} widthDelta The delta value to expand the hider element by.
630
- */
631
- expandHiderHorizontallyBy(widthDelta) {
632
- const {
633
- wtTable
634
- } = this;
635
- wtTable.hider.style.width = `${parseInt(wtTable.hider.style.width, 10) + widthDelta}px`;
636
- }
637
-
638
- /**
639
- *
640
- */
641
- applyToDOM() {
642
- if (!this.wtTable.isVisible()) {
643
- return;
341
+ hiderStyle.width = `${proposedHiderWidth}px`;
342
+ hiderStyle.height = `${proposedHiderHeight}px`;
343
+ const styleProperty = this.wtSettings.getSetting('rtlMode') ? 'right' : 'left';
344
+ if (typeof this.wot.wtViewport.columnsRenderCalculator.startPosition === 'number') {
345
+ wtTable.spreader.style[styleProperty] = `${this.wot.wtViewport.columnsRenderCalculator.startPosition}px`;
346
+ } else if (totalColumns === 0) {
347
+ wtTable.spreader.style[styleProperty] = '0';
348
+ } else {
349
+ throw new Error('Incorrect value of the columnsRenderCalculator');
644
350
  }
645
- this.topOverlay.applyToDOM();
646
- if (this.bottomOverlay.clone) {
647
- this.bottomOverlay.applyToDOM();
351
+ if (typeof this.wot.wtViewport.rowsRenderCalculator.startPosition === 'number') {
352
+ wtTable.spreader.style.top = `${this.wot.wtViewport.rowsRenderCalculator.startPosition}px`;
353
+ } else if (totalRows === 0) {
354
+ wtTable.spreader.style.top = '0';
355
+ } else {
356
+ throw new Error('Incorrect value of the rowsRenderCalculator');
648
357
  }
649
- this.inlineStartOverlay.applyToDOM();
650
358
  }
651
359
 
652
360
  /**
653
- * Get the parent overlay of the provided element.
654
361
  *
655
- * @param {HTMLElement} element An element to process.
656
- * @returns {object|null}
657
362
  */
658
- getParentOverlay(element) {
659
- if (!element) {
660
- return null;
363
+ destroy() {
364
+ this.resizeObserver.disconnect();
365
+ this.eventManager.destroy();
366
+ // todo, probably all below `destroy` calls has no sense. To analyze
367
+ this.topOverlay.destroy();
368
+ if (this.bottomOverlay.clone) {
369
+ this.bottomOverlay.destroy();
661
370
  }
662
- const overlays = [this.topOverlay, this.inlineStartOverlay, this.bottomOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay];
663
- let result = null;
664
- (0, _array.arrayEach)(overlays, overlay => {
665
- if (!overlay) {
666
- return;
667
- }
668
- if (overlay.clone && overlay.clone.wtTable.TABLE.contains(element)) {
669
- // todo demeter
670
- result = overlay.clone;
671
- }
672
- });
673
- return result;
674
- }
675
-
676
- /**
677
- * Synchronize the class names between the main overlay table and the tables on the other overlays.
678
- *
679
- */
680
- syncOverlayTableClassNames() {
681
- const masterTable = this.wtTable.TABLE;
682
- const overlays = [this.topOverlay, this.inlineStartOverlay, this.bottomOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay];
683
- (0, _array.arrayEach)(overlays, elem => {
684
- if (!elem) {
685
- return;
686
- }
687
- elem.clone.wtTable.TABLE.className = masterTable.className; // todo demeter
688
- });
371
+ this.inlineStartOverlay.destroy();
372
+ if (this.topInlineStartCornerOverlay) {
373
+ this.topInlineStartCornerOverlay.destroy();
374
+ }
375
+ if (this.bottomInlineStartCornerOverlay && this.bottomInlineStartCornerOverlay.clone) {
376
+ this.bottomInlineStartCornerOverlay.destroy();
377
+ }
378
+ this.destroyed = true;
689
379
  }
690
380
  }
691
381
  var _default = exports.default = Overlays;