@atlaskit/editor-plugin-table 15.6.3 → 15.6.4
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/CHANGELOG.md +8 -0
- package/dist/cjs/nodeviews/TableRowNativeStickyWithFallback.js +47 -94
- package/dist/es2019/nodeviews/TableRowNativeStickyWithFallback.js +7 -53
- package/dist/esm/nodeviews/TableRowNativeStickyWithFallback.js +47 -94
- package/dist/types/nodeviews/TableRowNativeStickyWithFallback.d.ts +0 -3
- package/dist/types-ts4.5/nodeviews/TableRowNativeStickyWithFallback.d.ts +0 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`20fb93093ca02`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20fb93093ca02) -
|
|
8
|
+
Remove data attribute for sticky state instead of setting false
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.6.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -77,7 +77,6 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
77
77
|
(0, _defineProperty2.default)(_this, "padding", 0);
|
|
78
78
|
(0, _defineProperty2.default)(_this, "top", 0);
|
|
79
79
|
(0, _defineProperty2.default)(_this, "isNativeSticky", false);
|
|
80
|
-
(0, _defineProperty2.default)(_this, "hasScrolledSinceLoad", false);
|
|
81
80
|
/**
|
|
82
81
|
* Methods
|
|
83
82
|
*/
|
|
@@ -184,7 +183,6 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
184
183
|
if (this.isStickyHeaderEnabled) {
|
|
185
184
|
this.unsubscribe();
|
|
186
185
|
this.overflowObserver && this.overflowObserver.disconnect();
|
|
187
|
-
this.overflowObserverEntries = undefined;
|
|
188
186
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
189
187
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
190
188
|
var tree = (0, _dom2.getTree)(this.dom);
|
|
@@ -228,51 +226,12 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
228
226
|
}, {
|
|
229
227
|
key: "subscribe",
|
|
230
228
|
value: function subscribe() {
|
|
231
|
-
var _this2 = this;
|
|
232
229
|
// Ignored via go/ees005
|
|
233
230
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
234
231
|
this.editorScrollableElement = (0, _ui.findOverflowScrollParent)(this.view.dom) || window;
|
|
235
232
|
if (this.editorScrollableElement) {
|
|
236
233
|
this.initObservers();
|
|
237
234
|
this.topPosEditorElement = (0, _dom2.getTop)(this.editorScrollableElement);
|
|
238
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_3')) {
|
|
239
|
-
this.scrollListener = function () {
|
|
240
|
-
if (!_this2.hasScrolledSinceLoad) {
|
|
241
|
-
_this2.hasScrolledSinceLoad = true;
|
|
242
|
-
// Re-check intersection state now that scrolling has occurred
|
|
243
|
-
if (_this2.overflowObserver) {
|
|
244
|
-
var _this2$overflowObserv;
|
|
245
|
-
var entries = (_this2$overflowObserv = _this2.overflowObserverEntries) !== null && _this2$overflowObserv !== void 0 ? _this2$overflowObserv : _this2.overflowObserver.takeRecords();
|
|
246
|
-
_this2.overflowObserverEntries = undefined;
|
|
247
|
-
|
|
248
|
-
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
249
|
-
* to avoid conflicting with a follow up refactor where this will
|
|
250
|
-
* be cleaned up.
|
|
251
|
-
*/
|
|
252
|
-
entries.forEach(function (entry) {
|
|
253
|
-
var tableWrapper = _this2.dom.closest(".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
|
|
254
|
-
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
255
|
-
if (entry.isIntersecting) {
|
|
256
|
-
tableWrapper.classList.add(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
257
|
-
_this2.dom.classList.add(_types.TableCssClassName.NATIVE_STICKY);
|
|
258
|
-
_this2.isNativeSticky = true;
|
|
259
|
-
} else {
|
|
260
|
-
tableWrapper.classList.remove(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
261
|
-
_this2.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY);
|
|
262
|
-
_this2.isNativeSticky = false;
|
|
263
|
-
}
|
|
264
|
-
_this2.refreshLegacyStickyState();
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
271
|
-
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
272
|
-
passive: true,
|
|
273
|
-
once: true
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
235
|
}
|
|
277
236
|
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
278
237
|
|
|
@@ -311,11 +270,6 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
311
270
|
if (this.resizeObserver) {
|
|
312
271
|
this.resizeObserver.disconnect();
|
|
313
272
|
}
|
|
314
|
-
if (this.scrollListener && this.editorScrollableElement) {
|
|
315
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
316
|
-
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
317
|
-
this.scrollListener = undefined;
|
|
318
|
-
}
|
|
319
273
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
320
274
|
// Ignored via go/ees005
|
|
321
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -332,7 +286,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
332
286
|
}, {
|
|
333
287
|
key: "initOverflowObserver",
|
|
334
288
|
value: function initOverflowObserver() {
|
|
335
|
-
var
|
|
289
|
+
var _this2 = this;
|
|
336
290
|
var tableWrapper = this.dom.closest(".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
|
|
337
291
|
if (!tableWrapper) {
|
|
338
292
|
return;
|
|
@@ -346,21 +300,16 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
346
300
|
if (!(observer.root instanceof HTMLElement)) {
|
|
347
301
|
return;
|
|
348
302
|
}
|
|
349
|
-
// Only apply classes if page has scrolled since load
|
|
350
|
-
if (!_this3.hasScrolledSinceLoad && (0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_3')) {
|
|
351
|
-
_this3.overflowObserverEntries = entries;
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
303
|
if (entry.isIntersecting) {
|
|
355
304
|
observer.root.classList.add(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
356
|
-
|
|
357
|
-
|
|
305
|
+
_this2.dom.classList.add(_types.TableCssClassName.NATIVE_STICKY);
|
|
306
|
+
_this2.isNativeSticky = true;
|
|
358
307
|
} else {
|
|
359
308
|
observer.root.classList.remove(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
360
|
-
|
|
361
|
-
|
|
309
|
+
_this2.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY);
|
|
310
|
+
_this2.isNativeSticky = false;
|
|
362
311
|
}
|
|
363
|
-
|
|
312
|
+
_this2.refreshLegacyStickyState();
|
|
364
313
|
});
|
|
365
314
|
}, options);
|
|
366
315
|
}
|
|
@@ -373,7 +322,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
373
322
|
}, {
|
|
374
323
|
key: "initStickyStateObserver",
|
|
375
324
|
value: function initStickyStateObserver() {
|
|
376
|
-
var
|
|
325
|
+
var _this3 = this;
|
|
377
326
|
if (!this.editorScrollableElement || !(this.editorScrollableElement instanceof Element)) {
|
|
378
327
|
return;
|
|
379
328
|
}
|
|
@@ -385,16 +334,20 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
385
334
|
this.stickyStateObserver = new IntersectionObserver(function (entries) {
|
|
386
335
|
entries.forEach(function (entry) {
|
|
387
336
|
var _entry$rootBounds;
|
|
388
|
-
var tableContainer =
|
|
337
|
+
var tableContainer = _this3.dom.closest(".".concat(_types.TableCssClassName.TABLE_CONTAINER));
|
|
389
338
|
if (entry.intersectionRect.top === ((_entry$rootBounds = entry.rootBounds) === null || _entry$rootBounds === void 0 ? void 0 : _entry$rootBounds.top)) {
|
|
390
|
-
|
|
339
|
+
_this3.dom.classList.add(_types.TableCssClassName.NATIVE_STICKY_ACTIVE);
|
|
391
340
|
if (tableContainer && tableContainer instanceof HTMLElement) {
|
|
392
341
|
tableContainer.dataset.tableHeaderIsStuck = 'true';
|
|
393
342
|
}
|
|
394
343
|
} else {
|
|
395
|
-
|
|
344
|
+
_this3.dom.classList.remove(_types.TableCssClassName.NATIVE_STICKY_ACTIVE);
|
|
396
345
|
if (tableContainer && tableContainer instanceof HTMLElement) {
|
|
397
|
-
|
|
346
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_table_sticky_header_patch_3')) {
|
|
347
|
+
delete tableContainer.dataset.tableHeaderIsStuck;
|
|
348
|
+
} else {
|
|
349
|
+
tableContainer.dataset.tableHeaderIsStuck = 'false';
|
|
350
|
+
}
|
|
398
351
|
}
|
|
399
352
|
}
|
|
400
353
|
});
|
|
@@ -405,7 +358,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
405
358
|
}, {
|
|
406
359
|
key: "initObservers",
|
|
407
360
|
value: function initObservers() {
|
|
408
|
-
var
|
|
361
|
+
var _this4 = this;
|
|
409
362
|
if (!this.dom || this.dom.dataset.isObserved) {
|
|
410
363
|
return;
|
|
411
364
|
}
|
|
@@ -439,7 +392,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
439
392
|
window.requestAnimationFrame(function () {
|
|
440
393
|
var getTableContainer = function getTableContainer() {
|
|
441
394
|
var _getTree;
|
|
442
|
-
return (_getTree = (0, _dom2.getTree)(
|
|
395
|
+
return (_getTree = (0, _dom2.getTree)(_this4.dom)) === null || _getTree === void 0 ? void 0 : _getTree.wrapper.closest(".".concat(_types.TableCssClassName.NODEVIEW_WRAPPER));
|
|
443
396
|
};
|
|
444
397
|
|
|
445
398
|
// we expect tree to be defined after animation frame
|
|
@@ -465,16 +418,16 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
465
418
|
return getSentinelTop() !== null && getSentinelBottom() !== null;
|
|
466
419
|
};
|
|
467
420
|
var observeStickySentinels = function observeStickySentinels() {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
[
|
|
421
|
+
_this4.sentinels.top = getSentinelTop();
|
|
422
|
+
_this4.sentinels.bottom = getSentinelBottom();
|
|
423
|
+
[_this4.sentinels.top, _this4.sentinels.bottom].forEach(function (el) {
|
|
471
424
|
// skip if already observed for another row on this table
|
|
472
425
|
if (el && !el.dataset.isObserved) {
|
|
473
426
|
el.dataset.isObserved = 'true';
|
|
474
427
|
|
|
475
428
|
// Ignored via go/ees005
|
|
476
429
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
477
|
-
|
|
430
|
+
_this4.intersectionObserver.observe(el);
|
|
478
431
|
}
|
|
479
432
|
});
|
|
480
433
|
};
|
|
@@ -489,7 +442,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
489
442
|
// observe sentinels before they are in the DOM, use MutationObserver
|
|
490
443
|
// to wait for sentinels to be added to the parent Table node DOM
|
|
491
444
|
// then attach the IntersectionObserver
|
|
492
|
-
|
|
445
|
+
_this4.tableContainerObserver = new MutationObserver(function () {
|
|
493
446
|
// Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
|
|
494
447
|
// prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
|
|
495
448
|
|
|
@@ -497,14 +450,14 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
497
450
|
tableContainer = getTableContainer();
|
|
498
451
|
}
|
|
499
452
|
if (sentinelsInDom()) {
|
|
500
|
-
var
|
|
453
|
+
var _this4$tableContainer;
|
|
501
454
|
observeStickySentinels();
|
|
502
|
-
(
|
|
455
|
+
(_this4$tableContainer = _this4.tableContainerObserver) === null || _this4$tableContainer === void 0 || _this4$tableContainer.disconnect();
|
|
503
456
|
}
|
|
504
457
|
});
|
|
505
458
|
var mutatingNode = tableContainer;
|
|
506
|
-
if (mutatingNode &&
|
|
507
|
-
|
|
459
|
+
if (mutatingNode && _this4.tableContainerObserver) {
|
|
460
|
+
_this4.tableContainerObserver.observe(mutatingNode, {
|
|
508
461
|
subtree: true,
|
|
509
462
|
childList: true
|
|
510
463
|
});
|
|
@@ -519,32 +472,32 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
519
472
|
}, {
|
|
520
473
|
key: "createResizeObserver",
|
|
521
474
|
value: function createResizeObserver() {
|
|
522
|
-
var
|
|
475
|
+
var _this5 = this;
|
|
523
476
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
524
|
-
var tree = (0, _dom2.getTree)(
|
|
477
|
+
var tree = (0, _dom2.getTree)(_this5.dom);
|
|
525
478
|
if (!tree) {
|
|
526
479
|
return;
|
|
527
480
|
}
|
|
528
481
|
var table = tree.table;
|
|
529
482
|
entries.forEach(function (entry) {
|
|
530
|
-
var
|
|
483
|
+
var _this5$editorScrollab;
|
|
531
484
|
// On resize of the parent scroll element we need to adjust the width
|
|
532
485
|
// of the sticky header
|
|
533
486
|
// Ignored via go/ees005
|
|
534
487
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
535
|
-
if (entry.target.className === ((
|
|
536
|
-
|
|
488
|
+
if (entry.target.className === ((_this5$editorScrollab = _this5.editorScrollableElement) === null || _this5$editorScrollab === void 0 ? void 0 : _this5$editorScrollab.className)) {
|
|
489
|
+
_this5.updateStickyHeaderWidth();
|
|
537
490
|
} else {
|
|
538
491
|
var newHeight = entry.contentRect ? entry.contentRect.height :
|
|
539
492
|
// Ignored via go/ees005
|
|
540
493
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
541
494
|
entry.target.offsetHeight;
|
|
542
|
-
if (
|
|
495
|
+
if (_this5.sentinels.bottom &&
|
|
543
496
|
// When the table header is sticky, it would be taller by a 1px (border-bottom),
|
|
544
497
|
// So we adding this check to allow a 1px difference.
|
|
545
|
-
Math.abs(newHeight - (
|
|
546
|
-
|
|
547
|
-
|
|
498
|
+
Math.abs(newHeight - (_this5.stickyRowHeight || 0)) > _consts.stickyHeaderBorderBottomWidth) {
|
|
499
|
+
_this5.stickyRowHeight = newHeight;
|
|
500
|
+
_this5.sentinels.bottom.style.bottom = "".concat(_consts.tableScrollbarOffset + _consts.stickyRowOffsetTop + newHeight, "px");
|
|
548
501
|
(0, _dom.updateStickyMargins)(table);
|
|
549
502
|
}
|
|
550
503
|
}
|
|
@@ -554,13 +507,13 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
554
507
|
}, {
|
|
555
508
|
key: "createIntersectionObserver",
|
|
556
509
|
value: function createIntersectionObserver() {
|
|
557
|
-
var
|
|
510
|
+
var _this6 = this;
|
|
558
511
|
this.intersectionObserver = new IntersectionObserver(function (entries, _) {
|
|
559
|
-
var
|
|
512
|
+
var _this6$editorScrollab, _this6$editorScrollab2;
|
|
560
513
|
// IMPORTANT: please try and avoid using entry.rootBounds it's terribly inconsistent. For example; sometimes it may return
|
|
561
514
|
// 0 height. In safari it will multiply all values by the window scale factor, however chrome & firfox won't.
|
|
562
515
|
// This is why i just get the scroll view bounding rect here and use it, and fallback to the entry.rootBounds if needed.
|
|
563
|
-
var rootBounds = (
|
|
516
|
+
var rootBounds = (_this6$editorScrollab = _this6.editorScrollableElement) === null || _this6$editorScrollab === void 0 || (_this6$editorScrollab2 = _this6$editorScrollab.getBoundingClientRect) === null || _this6$editorScrollab2 === void 0 ? void 0 : _this6$editorScrollab2.call(_this6$editorScrollab);
|
|
564
517
|
entries.forEach(function (entry) {
|
|
565
518
|
var target = entry.target,
|
|
566
519
|
isIntersecting = entry.isIntersecting,
|
|
@@ -568,15 +521,15 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
568
521
|
// This observer only every looks at the top/bottom sentinels, we can assume if it's not one then it's the other.
|
|
569
522
|
var targetKey = target.classList.contains(_types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP) ? 'top' : 'bottom';
|
|
570
523
|
// Cache the latest sentinel information
|
|
571
|
-
|
|
524
|
+
_this6.sentinelData[targetKey] = {
|
|
572
525
|
isIntersecting: isIntersecting,
|
|
573
526
|
boundingClientRect: boundingClientRect,
|
|
574
527
|
rootBounds: rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds
|
|
575
528
|
};
|
|
576
529
|
// Keep the other sentinels rootBounds in sync with this latest one
|
|
577
|
-
|
|
530
|
+
_this6.sentinelData[targetKey === 'top' ? 'bottom' : targetKey].rootBounds = rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds;
|
|
578
531
|
});
|
|
579
|
-
|
|
532
|
+
_this6.refreshLegacyStickyState();
|
|
580
533
|
}, {
|
|
581
534
|
threshold: 0,
|
|
582
535
|
root: this.editorScrollableElement
|
|
@@ -751,12 +704,12 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
751
704
|
}, {
|
|
752
705
|
key: "refireIntersectionObservers",
|
|
753
706
|
value: function refireIntersectionObservers() {
|
|
754
|
-
var
|
|
707
|
+
var _this7 = this;
|
|
755
708
|
if (this.isLegacySticky) {
|
|
756
709
|
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
757
|
-
if (el &&
|
|
758
|
-
|
|
759
|
-
|
|
710
|
+
if (el && _this7.intersectionObserver) {
|
|
711
|
+
_this7.intersectionObserver.unobserve(el);
|
|
712
|
+
_this7.intersectionObserver.observe(el);
|
|
760
713
|
}
|
|
761
714
|
});
|
|
762
715
|
}
|
|
@@ -765,7 +718,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
765
718
|
key: "makeHeaderRowLegacySticky",
|
|
766
719
|
value: function makeHeaderRowLegacySticky(tree, scrollTop) {
|
|
767
720
|
var _tbody$firstChild,
|
|
768
|
-
|
|
721
|
+
_this8 = this;
|
|
769
722
|
// If header row height is more than 50% of viewport height don't do this
|
|
770
723
|
if (this.isLegacySticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
|
|
771
724
|
return;
|
|
@@ -804,7 +757,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
|
|
|
804
757
|
});
|
|
805
758
|
var fastScrollThresholdMs = 500;
|
|
806
759
|
setTimeout(function () {
|
|
807
|
-
|
|
760
|
+
_this8.refireIntersectionObservers();
|
|
808
761
|
}, fastScrollThresholdMs);
|
|
809
762
|
}
|
|
810
763
|
this.dom.style.top = "0px";
|
|
@@ -61,7 +61,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
61
61
|
_defineProperty(this, "padding", 0);
|
|
62
62
|
_defineProperty(this, "top", 0);
|
|
63
63
|
_defineProperty(this, "isNativeSticky", false);
|
|
64
|
-
_defineProperty(this, "hasScrolledSinceLoad", false);
|
|
65
64
|
/**
|
|
66
65
|
* Methods
|
|
67
66
|
*/
|
|
@@ -162,7 +161,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
162
161
|
if (this.isStickyHeaderEnabled) {
|
|
163
162
|
this.unsubscribe();
|
|
164
163
|
this.overflowObserver && this.overflowObserver.disconnect();
|
|
165
|
-
this.overflowObserverEntries = undefined;
|
|
166
164
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
167
165
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
168
166
|
const tree = getTree(this.dom);
|
|
@@ -208,44 +206,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
208
206
|
if (this.editorScrollableElement) {
|
|
209
207
|
this.initObservers();
|
|
210
208
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
211
|
-
if (fg('platform_editor_table_sticky_header_patch_3')) {
|
|
212
|
-
this.scrollListener = () => {
|
|
213
|
-
if (!this.hasScrolledSinceLoad) {
|
|
214
|
-
this.hasScrolledSinceLoad = true;
|
|
215
|
-
// Re-check intersection state now that scrolling has occurred
|
|
216
|
-
if (this.overflowObserver) {
|
|
217
|
-
var _this$overflowObserve;
|
|
218
|
-
const entries = (_this$overflowObserve = this.overflowObserverEntries) !== null && _this$overflowObserve !== void 0 ? _this$overflowObserve : this.overflowObserver.takeRecords();
|
|
219
|
-
this.overflowObserverEntries = undefined;
|
|
220
|
-
|
|
221
|
-
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
222
|
-
* to avoid conflicting with a follow up refactor where this will
|
|
223
|
-
* be cleaned up.
|
|
224
|
-
*/
|
|
225
|
-
entries.forEach(entry => {
|
|
226
|
-
const tableWrapper = this.dom.closest(`.${ClassName.TABLE_NODE_WRAPPER}`);
|
|
227
|
-
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
228
|
-
if (entry.isIntersecting) {
|
|
229
|
-
tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
230
|
-
this.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
231
|
-
this.isNativeSticky = true;
|
|
232
|
-
} else {
|
|
233
|
-
tableWrapper.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
234
|
-
this.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
235
|
-
this.isNativeSticky = false;
|
|
236
|
-
}
|
|
237
|
-
this.refreshLegacyStickyState();
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
244
|
-
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
245
|
-
passive: true,
|
|
246
|
-
once: true
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
209
|
}
|
|
250
210
|
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
251
211
|
|
|
@@ -282,11 +242,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
282
242
|
if (this.resizeObserver) {
|
|
283
243
|
this.resizeObserver.disconnect();
|
|
284
244
|
}
|
|
285
|
-
if (this.scrollListener && this.editorScrollableElement) {
|
|
286
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
287
|
-
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
288
|
-
this.scrollListener = undefined;
|
|
289
|
-
}
|
|
290
245
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
291
246
|
// Ignored via go/ees005
|
|
292
247
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -314,11 +269,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
314
269
|
if (!(observer.root instanceof HTMLElement)) {
|
|
315
270
|
return;
|
|
316
271
|
}
|
|
317
|
-
// Only apply classes if page has scrolled since load
|
|
318
|
-
if (!this.hasScrolledSinceLoad && fg('platform_editor_table_sticky_header_patch_3')) {
|
|
319
|
-
this.overflowObserverEntries = entries;
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
272
|
if (entry.isIntersecting) {
|
|
323
273
|
observer.root.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
324
274
|
this.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
@@ -359,7 +309,11 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
359
309
|
} else {
|
|
360
310
|
this.dom.classList.remove(ClassName.NATIVE_STICKY_ACTIVE);
|
|
361
311
|
if (tableContainer && tableContainer instanceof HTMLElement) {
|
|
362
|
-
|
|
312
|
+
if (fg('platform_editor_table_sticky_header_patch_3')) {
|
|
313
|
+
delete tableContainer.dataset.tableHeaderIsStuck;
|
|
314
|
+
} else {
|
|
315
|
+
tableContainer.dataset.tableHeaderIsStuck = 'false';
|
|
316
|
+
}
|
|
363
317
|
}
|
|
364
318
|
}
|
|
365
319
|
});
|
|
@@ -386,8 +340,8 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
|
|
|
386
340
|
this.initOverflowObserver();
|
|
387
341
|
const closestTable = this.dom.closest('table');
|
|
388
342
|
if (closestTable) {
|
|
389
|
-
var _this$
|
|
390
|
-
(_this$
|
|
343
|
+
var _this$overflowObserve;
|
|
344
|
+
(_this$overflowObserve = this.overflowObserver) === null || _this$overflowObserve === void 0 ? void 0 : _this$overflowObserve.observe(closestTable);
|
|
391
345
|
}
|
|
392
346
|
this.initStickyStateObserver();
|
|
393
347
|
(_this$stickyStateObse = this.stickyStateObserver) === null || _this$stickyStateObse === void 0 ? void 0 : _this$stickyStateObse.observe(this.dom);
|
|
@@ -70,7 +70,6 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
70
70
|
_defineProperty(_this, "padding", 0);
|
|
71
71
|
_defineProperty(_this, "top", 0);
|
|
72
72
|
_defineProperty(_this, "isNativeSticky", false);
|
|
73
|
-
_defineProperty(_this, "hasScrolledSinceLoad", false);
|
|
74
73
|
/**
|
|
75
74
|
* Methods
|
|
76
75
|
*/
|
|
@@ -177,7 +176,6 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
177
176
|
if (this.isStickyHeaderEnabled) {
|
|
178
177
|
this.unsubscribe();
|
|
179
178
|
this.overflowObserver && this.overflowObserver.disconnect();
|
|
180
|
-
this.overflowObserverEntries = undefined;
|
|
181
179
|
this.stickyStateObserver && this.stickyStateObserver.disconnect();
|
|
182
180
|
this.nodeVisibilityObserverCleanupFn && this.nodeVisibilityObserverCleanupFn();
|
|
183
181
|
var tree = getTree(this.dom);
|
|
@@ -221,51 +219,12 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
221
219
|
}, {
|
|
222
220
|
key: "subscribe",
|
|
223
221
|
value: function subscribe() {
|
|
224
|
-
var _this2 = this;
|
|
225
222
|
// Ignored via go/ees005
|
|
226
223
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
227
224
|
this.editorScrollableElement = findOverflowScrollParent(this.view.dom) || window;
|
|
228
225
|
if (this.editorScrollableElement) {
|
|
229
226
|
this.initObservers();
|
|
230
227
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
231
|
-
if (fg('platform_editor_table_sticky_header_patch_3')) {
|
|
232
|
-
this.scrollListener = function () {
|
|
233
|
-
if (!_this2.hasScrolledSinceLoad) {
|
|
234
|
-
_this2.hasScrolledSinceLoad = true;
|
|
235
|
-
// Re-check intersection state now that scrolling has occurred
|
|
236
|
-
if (_this2.overflowObserver) {
|
|
237
|
-
var _this2$overflowObserv;
|
|
238
|
-
var entries = (_this2$overflowObserv = _this2.overflowObserverEntries) !== null && _this2$overflowObserv !== void 0 ? _this2$overflowObserv : _this2.overflowObserver.takeRecords();
|
|
239
|
-
_this2.overflowObserverEntries = undefined;
|
|
240
|
-
|
|
241
|
-
/** NOTE: This logic is duplicated in the overflowObserver callback
|
|
242
|
-
* to avoid conflicting with a follow up refactor where this will
|
|
243
|
-
* be cleaned up.
|
|
244
|
-
*/
|
|
245
|
-
entries.forEach(function (entry) {
|
|
246
|
-
var tableWrapper = _this2.dom.closest(".".concat(ClassName.TABLE_NODE_WRAPPER));
|
|
247
|
-
if (tableWrapper && tableWrapper instanceof HTMLElement) {
|
|
248
|
-
if (entry.isIntersecting) {
|
|
249
|
-
tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
250
|
-
_this2.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
251
|
-
_this2.isNativeSticky = true;
|
|
252
|
-
} else {
|
|
253
|
-
tableWrapper.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
254
|
-
_this2.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
255
|
-
_this2.isNativeSticky = false;
|
|
256
|
-
}
|
|
257
|
-
_this2.refreshLegacyStickyState();
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
264
|
-
this.editorScrollableElement.addEventListener('scroll', this.scrollListener, {
|
|
265
|
-
passive: true,
|
|
266
|
-
once: true
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
228
|
}
|
|
270
229
|
this.eventDispatcher.on('widthPlugin', this.updateStickyHeaderWidth.bind(this));
|
|
271
230
|
|
|
@@ -304,11 +263,6 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
304
263
|
if (this.resizeObserver) {
|
|
305
264
|
this.resizeObserver.disconnect();
|
|
306
265
|
}
|
|
307
|
-
if (this.scrollListener && this.editorScrollableElement) {
|
|
308
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
309
|
-
this.editorScrollableElement.removeEventListener('scroll', this.scrollListener);
|
|
310
|
-
this.scrollListener = undefined;
|
|
311
|
-
}
|
|
312
266
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
313
267
|
// Ignored via go/ees005
|
|
314
268
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -325,7 +279,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
325
279
|
}, {
|
|
326
280
|
key: "initOverflowObserver",
|
|
327
281
|
value: function initOverflowObserver() {
|
|
328
|
-
var
|
|
282
|
+
var _this2 = this;
|
|
329
283
|
var tableWrapper = this.dom.closest(".".concat(ClassName.TABLE_NODE_WRAPPER));
|
|
330
284
|
if (!tableWrapper) {
|
|
331
285
|
return;
|
|
@@ -339,21 +293,16 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
339
293
|
if (!(observer.root instanceof HTMLElement)) {
|
|
340
294
|
return;
|
|
341
295
|
}
|
|
342
|
-
// Only apply classes if page has scrolled since load
|
|
343
|
-
if (!_this3.hasScrolledSinceLoad && fg('platform_editor_table_sticky_header_patch_3')) {
|
|
344
|
-
_this3.overflowObserverEntries = entries;
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
296
|
if (entry.isIntersecting) {
|
|
348
297
|
observer.root.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
349
|
-
|
|
350
|
-
|
|
298
|
+
_this2.dom.classList.add(ClassName.NATIVE_STICKY);
|
|
299
|
+
_this2.isNativeSticky = true;
|
|
351
300
|
} else {
|
|
352
301
|
observer.root.classList.remove(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
|
|
353
|
-
|
|
354
|
-
|
|
302
|
+
_this2.dom.classList.remove(ClassName.NATIVE_STICKY);
|
|
303
|
+
_this2.isNativeSticky = false;
|
|
355
304
|
}
|
|
356
|
-
|
|
305
|
+
_this2.refreshLegacyStickyState();
|
|
357
306
|
});
|
|
358
307
|
}, options);
|
|
359
308
|
}
|
|
@@ -366,7 +315,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
366
315
|
}, {
|
|
367
316
|
key: "initStickyStateObserver",
|
|
368
317
|
value: function initStickyStateObserver() {
|
|
369
|
-
var
|
|
318
|
+
var _this3 = this;
|
|
370
319
|
if (!this.editorScrollableElement || !(this.editorScrollableElement instanceof Element)) {
|
|
371
320
|
return;
|
|
372
321
|
}
|
|
@@ -378,16 +327,20 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
378
327
|
this.stickyStateObserver = new IntersectionObserver(function (entries) {
|
|
379
328
|
entries.forEach(function (entry) {
|
|
380
329
|
var _entry$rootBounds;
|
|
381
|
-
var tableContainer =
|
|
330
|
+
var tableContainer = _this3.dom.closest(".".concat(ClassName.TABLE_CONTAINER));
|
|
382
331
|
if (entry.intersectionRect.top === ((_entry$rootBounds = entry.rootBounds) === null || _entry$rootBounds === void 0 ? void 0 : _entry$rootBounds.top)) {
|
|
383
|
-
|
|
332
|
+
_this3.dom.classList.add(ClassName.NATIVE_STICKY_ACTIVE);
|
|
384
333
|
if (tableContainer && tableContainer instanceof HTMLElement) {
|
|
385
334
|
tableContainer.dataset.tableHeaderIsStuck = 'true';
|
|
386
335
|
}
|
|
387
336
|
} else {
|
|
388
|
-
|
|
337
|
+
_this3.dom.classList.remove(ClassName.NATIVE_STICKY_ACTIVE);
|
|
389
338
|
if (tableContainer && tableContainer instanceof HTMLElement) {
|
|
390
|
-
|
|
339
|
+
if (fg('platform_editor_table_sticky_header_patch_3')) {
|
|
340
|
+
delete tableContainer.dataset.tableHeaderIsStuck;
|
|
341
|
+
} else {
|
|
342
|
+
tableContainer.dataset.tableHeaderIsStuck = 'false';
|
|
343
|
+
}
|
|
391
344
|
}
|
|
392
345
|
}
|
|
393
346
|
});
|
|
@@ -398,7 +351,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
398
351
|
}, {
|
|
399
352
|
key: "initObservers",
|
|
400
353
|
value: function initObservers() {
|
|
401
|
-
var
|
|
354
|
+
var _this4 = this;
|
|
402
355
|
if (!this.dom || this.dom.dataset.isObserved) {
|
|
403
356
|
return;
|
|
404
357
|
}
|
|
@@ -432,7 +385,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
432
385
|
window.requestAnimationFrame(function () {
|
|
433
386
|
var getTableContainer = function getTableContainer() {
|
|
434
387
|
var _getTree;
|
|
435
|
-
return (_getTree = getTree(
|
|
388
|
+
return (_getTree = getTree(_this4.dom)) === null || _getTree === void 0 ? void 0 : _getTree.wrapper.closest(".".concat(TableCssClassName.NODEVIEW_WRAPPER));
|
|
436
389
|
};
|
|
437
390
|
|
|
438
391
|
// we expect tree to be defined after animation frame
|
|
@@ -458,16 +411,16 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
458
411
|
return getSentinelTop() !== null && getSentinelBottom() !== null;
|
|
459
412
|
};
|
|
460
413
|
var observeStickySentinels = function observeStickySentinels() {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
[
|
|
414
|
+
_this4.sentinels.top = getSentinelTop();
|
|
415
|
+
_this4.sentinels.bottom = getSentinelBottom();
|
|
416
|
+
[_this4.sentinels.top, _this4.sentinels.bottom].forEach(function (el) {
|
|
464
417
|
// skip if already observed for another row on this table
|
|
465
418
|
if (el && !el.dataset.isObserved) {
|
|
466
419
|
el.dataset.isObserved = 'true';
|
|
467
420
|
|
|
468
421
|
// Ignored via go/ees005
|
|
469
422
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
470
|
-
|
|
423
|
+
_this4.intersectionObserver.observe(el);
|
|
471
424
|
}
|
|
472
425
|
});
|
|
473
426
|
};
|
|
@@ -482,7 +435,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
482
435
|
// observe sentinels before they are in the DOM, use MutationObserver
|
|
483
436
|
// to wait for sentinels to be added to the parent Table node DOM
|
|
484
437
|
// then attach the IntersectionObserver
|
|
485
|
-
|
|
438
|
+
_this4.tableContainerObserver = new MutationObserver(function () {
|
|
486
439
|
// Check if the tableContainer is still connected to the DOM. It can become disconnected when the placholder
|
|
487
440
|
// prosemirror node is replaced with the fully rendered React node (see _handleTableRef).
|
|
488
441
|
|
|
@@ -490,14 +443,14 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
490
443
|
tableContainer = getTableContainer();
|
|
491
444
|
}
|
|
492
445
|
if (sentinelsInDom()) {
|
|
493
|
-
var
|
|
446
|
+
var _this4$tableContainer;
|
|
494
447
|
observeStickySentinels();
|
|
495
|
-
(
|
|
448
|
+
(_this4$tableContainer = _this4.tableContainerObserver) === null || _this4$tableContainer === void 0 || _this4$tableContainer.disconnect();
|
|
496
449
|
}
|
|
497
450
|
});
|
|
498
451
|
var mutatingNode = tableContainer;
|
|
499
|
-
if (mutatingNode &&
|
|
500
|
-
|
|
452
|
+
if (mutatingNode && _this4.tableContainerObserver) {
|
|
453
|
+
_this4.tableContainerObserver.observe(mutatingNode, {
|
|
501
454
|
subtree: true,
|
|
502
455
|
childList: true
|
|
503
456
|
});
|
|
@@ -512,32 +465,32 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
512
465
|
}, {
|
|
513
466
|
key: "createResizeObserver",
|
|
514
467
|
value: function createResizeObserver() {
|
|
515
|
-
var
|
|
468
|
+
var _this5 = this;
|
|
516
469
|
this.resizeObserver = new ResizeObserver(function (entries) {
|
|
517
|
-
var tree = getTree(
|
|
470
|
+
var tree = getTree(_this5.dom);
|
|
518
471
|
if (!tree) {
|
|
519
472
|
return;
|
|
520
473
|
}
|
|
521
474
|
var table = tree.table;
|
|
522
475
|
entries.forEach(function (entry) {
|
|
523
|
-
var
|
|
476
|
+
var _this5$editorScrollab;
|
|
524
477
|
// On resize of the parent scroll element we need to adjust the width
|
|
525
478
|
// of the sticky header
|
|
526
479
|
// Ignored via go/ees005
|
|
527
480
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
528
|
-
if (entry.target.className === ((
|
|
529
|
-
|
|
481
|
+
if (entry.target.className === ((_this5$editorScrollab = _this5.editorScrollableElement) === null || _this5$editorScrollab === void 0 ? void 0 : _this5$editorScrollab.className)) {
|
|
482
|
+
_this5.updateStickyHeaderWidth();
|
|
530
483
|
} else {
|
|
531
484
|
var newHeight = entry.contentRect ? entry.contentRect.height :
|
|
532
485
|
// Ignored via go/ees005
|
|
533
486
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
534
487
|
entry.target.offsetHeight;
|
|
535
|
-
if (
|
|
488
|
+
if (_this5.sentinels.bottom &&
|
|
536
489
|
// When the table header is sticky, it would be taller by a 1px (border-bottom),
|
|
537
490
|
// So we adding this check to allow a 1px difference.
|
|
538
|
-
Math.abs(newHeight - (
|
|
539
|
-
|
|
540
|
-
|
|
491
|
+
Math.abs(newHeight - (_this5.stickyRowHeight || 0)) > stickyHeaderBorderBottomWidth) {
|
|
492
|
+
_this5.stickyRowHeight = newHeight;
|
|
493
|
+
_this5.sentinels.bottom.style.bottom = "".concat(tableScrollbarOffset + stickyRowOffsetTop + newHeight, "px");
|
|
541
494
|
updateTableMargin(table);
|
|
542
495
|
}
|
|
543
496
|
}
|
|
@@ -547,13 +500,13 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
547
500
|
}, {
|
|
548
501
|
key: "createIntersectionObserver",
|
|
549
502
|
value: function createIntersectionObserver() {
|
|
550
|
-
var
|
|
503
|
+
var _this6 = this;
|
|
551
504
|
this.intersectionObserver = new IntersectionObserver(function (entries, _) {
|
|
552
|
-
var
|
|
505
|
+
var _this6$editorScrollab, _this6$editorScrollab2;
|
|
553
506
|
// IMPORTANT: please try and avoid using entry.rootBounds it's terribly inconsistent. For example; sometimes it may return
|
|
554
507
|
// 0 height. In safari it will multiply all values by the window scale factor, however chrome & firfox won't.
|
|
555
508
|
// This is why i just get the scroll view bounding rect here and use it, and fallback to the entry.rootBounds if needed.
|
|
556
|
-
var rootBounds = (
|
|
509
|
+
var rootBounds = (_this6$editorScrollab = _this6.editorScrollableElement) === null || _this6$editorScrollab === void 0 || (_this6$editorScrollab2 = _this6$editorScrollab.getBoundingClientRect) === null || _this6$editorScrollab2 === void 0 ? void 0 : _this6$editorScrollab2.call(_this6$editorScrollab);
|
|
557
510
|
entries.forEach(function (entry) {
|
|
558
511
|
var target = entry.target,
|
|
559
512
|
isIntersecting = entry.isIntersecting,
|
|
@@ -561,15 +514,15 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
561
514
|
// This observer only every looks at the top/bottom sentinels, we can assume if it's not one then it's the other.
|
|
562
515
|
var targetKey = target.classList.contains(ClassName.TABLE_STICKY_SENTINEL_TOP) ? 'top' : 'bottom';
|
|
563
516
|
// Cache the latest sentinel information
|
|
564
|
-
|
|
517
|
+
_this6.sentinelData[targetKey] = {
|
|
565
518
|
isIntersecting: isIntersecting,
|
|
566
519
|
boundingClientRect: boundingClientRect,
|
|
567
520
|
rootBounds: rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds
|
|
568
521
|
};
|
|
569
522
|
// Keep the other sentinels rootBounds in sync with this latest one
|
|
570
|
-
|
|
523
|
+
_this6.sentinelData[targetKey === 'top' ? 'bottom' : targetKey].rootBounds = rootBounds !== null && rootBounds !== void 0 ? rootBounds : entry.rootBounds;
|
|
571
524
|
});
|
|
572
|
-
|
|
525
|
+
_this6.refreshLegacyStickyState();
|
|
573
526
|
}, {
|
|
574
527
|
threshold: 0,
|
|
575
528
|
root: this.editorScrollableElement
|
|
@@ -744,12 +697,12 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
744
697
|
}, {
|
|
745
698
|
key: "refireIntersectionObservers",
|
|
746
699
|
value: function refireIntersectionObservers() {
|
|
747
|
-
var
|
|
700
|
+
var _this7 = this;
|
|
748
701
|
if (this.isLegacySticky) {
|
|
749
702
|
[this.sentinels.top, this.sentinels.bottom].forEach(function (el) {
|
|
750
|
-
if (el &&
|
|
751
|
-
|
|
752
|
-
|
|
703
|
+
if (el && _this7.intersectionObserver) {
|
|
704
|
+
_this7.intersectionObserver.unobserve(el);
|
|
705
|
+
_this7.intersectionObserver.observe(el);
|
|
753
706
|
}
|
|
754
707
|
});
|
|
755
708
|
}
|
|
@@ -758,7 +711,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
758
711
|
key: "makeHeaderRowLegacySticky",
|
|
759
712
|
value: function makeHeaderRowLegacySticky(tree, scrollTop) {
|
|
760
713
|
var _tbody$firstChild,
|
|
761
|
-
|
|
714
|
+
_this8 = this;
|
|
762
715
|
// If header row height is more than 50% of viewport height don't do this
|
|
763
716
|
if (this.isLegacySticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
|
|
764
717
|
return;
|
|
@@ -797,7 +750,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
|
|
|
797
750
|
});
|
|
798
751
|
var fastScrollThresholdMs = 500;
|
|
799
752
|
setTimeout(function () {
|
|
800
|
-
|
|
753
|
+
_this8.refireIntersectionObservers();
|
|
801
754
|
}, fastScrollThresholdMs);
|
|
802
755
|
}
|
|
803
756
|
this.dom.style.top = "0px";
|
|
@@ -32,9 +32,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
32
32
|
private overflowObserver?;
|
|
33
33
|
private stickyStateObserver?;
|
|
34
34
|
private isNativeSticky;
|
|
35
|
-
private hasScrolledSinceLoad;
|
|
36
|
-
private scrollListener?;
|
|
37
|
-
private overflowObserverEntries?;
|
|
38
35
|
/**
|
|
39
36
|
* Methods: Nodeview Lifecycle
|
|
40
37
|
*/
|
|
@@ -32,9 +32,6 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView<HTML
|
|
|
32
32
|
private overflowObserver?;
|
|
33
33
|
private stickyStateObserver?;
|
|
34
34
|
private isNativeSticky;
|
|
35
|
-
private hasScrolledSinceLoad;
|
|
36
|
-
private scrollListener?;
|
|
37
|
-
private overflowObserverEntries?;
|
|
38
35
|
/**
|
|
39
36
|
* Methods: Nodeview Lifecycle
|
|
40
37
|
*/
|