@atlaskit/editor-plugin-table 16.1.5 → 16.1.6

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 16.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8c24728c97456`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c24728c97456) -
8
+ EDITOR-3638 Exclude zero intersection entries when scroll is detected
9
+ - Updated dependencies
10
+
3
11
  ## 16.1.5
4
12
 
5
13
  ### Patch Changes
@@ -285,7 +285,7 @@ var TableRowNativeStickyWithFallback = exports.default = /*#__PURE__*/function (
285
285
  */
286
286
  entries.forEach(function (entry) {
287
287
  var tableWrapper = _this3.dom.closest(".".concat(_types.TableCssClassName.TABLE_NODE_WRAPPER));
288
- if (tableWrapper && tableWrapper instanceof HTMLElement) {
288
+ if (tableWrapper && tableWrapper instanceof HTMLElement && (!(0, _dom2.areAllRectsZero)(entry) && (0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_patch_10', 'isEnabled', true) || !(0, _expValEquals.expValEquals)('platform_editor_table_sticky_header_patch_10', 'isEnabled', true))) {
289
289
  if (entry.isIntersecting) {
290
290
  tableWrapper.classList.add(_types.TableCssClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
291
291
  _this3.dom.classList.add(_types.TableCssClassName.NATIVE_STICKY);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isDragRowFloatingInsertDot = exports.isDragCornerButton = exports.isDragColumnFloatingInsertDot = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = exports.findNearestCellIndexToPoint = void 0;
6
+ exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isDragRowFloatingInsertDot = exports.isDragCornerButton = exports.isDragColumnFloatingInsertDot = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = exports.findNearestCellIndexToPoint = exports.areAllRectsZero = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  var _types = require("../../types");
9
9
  var isCell = exports.isCell = function isCell(node) {
@@ -202,4 +202,10 @@ var findNearestCellIndexToPoint = exports.findNearestCellIndexToPoint = function
202
202
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
203
203
  col: cell.cellIndex
204
204
  };
205
+ };
206
+ var areAllRectsZero = exports.areAllRectsZero = function areAllRectsZero(entry) {
207
+ var rects = [entry.boundingClientRect, entry.rootBounds, entry.intersectionRect];
208
+ return rects.every(function (rect) {
209
+ return rect && rect.width === 0 && rect.height === 0 && rect.top === 0 && rect.left === 0 && rect.bottom === 0 && rect.right === 0 && rect.x === 0 && rect.y === 0;
210
+ });
205
211
  };
@@ -14,7 +14,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
14
14
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
15
15
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
16
16
  import { syncStickyRowToTable, updateStickyMargins as updateTableMargin } from '../pm-plugins/table-resizing/utils/dom';
17
- import { getTop, getTree } from '../pm-plugins/utils/dom';
17
+ import { areAllRectsZero, getTop, getTree } from '../pm-plugins/utils/dom';
18
18
  import { supportedHeaderRow } from '../pm-plugins/utils/nodes';
19
19
  import { TableCssClassName as ClassName, TableCssClassName } from '../types';
20
20
  import { stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableControlsSpacing, tableScrollbarOffset } from '../ui/consts';
@@ -259,7 +259,7 @@ export default class TableRowNativeStickyWithFallback extends TableNodeView {
259
259
  */
260
260
  entries.forEach(entry => {
261
261
  const tableWrapper = this.dom.closest(`.${ClassName.TABLE_NODE_WRAPPER}`);
262
- if (tableWrapper && tableWrapper instanceof HTMLElement) {
262
+ if (tableWrapper && tableWrapper instanceof HTMLElement && (!areAllRectsZero(entry) && expValEquals('platform_editor_table_sticky_header_patch_10', 'isEnabled', true) || !expValEquals('platform_editor_table_sticky_header_patch_10', 'isEnabled', true))) {
263
263
  if (entry.isIntersecting) {
264
264
  tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
265
265
  this.dom.classList.add(ClassName.NATIVE_STICKY);
@@ -173,4 +173,8 @@ export const findNearestCellIndexToPoint = (x, y) => {
173
173
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
174
174
  col: cell.cellIndex
175
175
  };
176
+ };
177
+ export const areAllRectsZero = entry => {
178
+ const rects = [entry.boundingClientRect, entry.rootBounds, entry.intersectionRect];
179
+ return rects.every(rect => rect && rect.width === 0 && rect.height === 0 && rect.top === 0 && rect.left === 0 && rect.bottom === 0 && rect.right === 0 && rect.x === 0 && rect.y === 0);
176
180
  };
@@ -21,7 +21,7 @@ import { getPluginState } from '../pm-plugins/plugin-factory';
21
21
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
22
22
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
23
23
  import { syncStickyRowToTable, updateStickyMargins as updateTableMargin } from '../pm-plugins/table-resizing/utils/dom';
24
- import { getTop, getTree } from '../pm-plugins/utils/dom';
24
+ import { areAllRectsZero, getTop, getTree } from '../pm-plugins/utils/dom';
25
25
  import { supportedHeaderRow } from '../pm-plugins/utils/nodes';
26
26
  import { TableCssClassName as ClassName, TableCssClassName } from '../types';
27
27
  import { stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableControlsSpacing, tableScrollbarOffset } from '../ui/consts';
@@ -278,7 +278,7 @@ var TableRowNativeStickyWithFallback = /*#__PURE__*/function (_ref) {
278
278
  */
279
279
  entries.forEach(function (entry) {
280
280
  var tableWrapper = _this3.dom.closest(".".concat(ClassName.TABLE_NODE_WRAPPER));
281
- if (tableWrapper && tableWrapper instanceof HTMLElement) {
281
+ if (tableWrapper && tableWrapper instanceof HTMLElement && (!areAllRectsZero(entry) && expValEquals('platform_editor_table_sticky_header_patch_10', 'isEnabled', true) || !expValEquals('platform_editor_table_sticky_header_patch_10', 'isEnabled', true))) {
282
282
  if (entry.isIntersecting) {
283
283
  tableWrapper.classList.add(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW);
284
284
  _this3.dom.classList.add(ClassName.NATIVE_STICKY);
@@ -196,4 +196,10 @@ export var findNearestCellIndexToPoint = function findNearestCellIndexToPoint(x,
196
196
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
197
197
  col: cell.cellIndex
198
198
  };
199
+ };
200
+ export var areAllRectsZero = function areAllRectsZero(entry) {
201
+ var rects = [entry.boundingClientRect, entry.rootBounds, entry.intersectionRect];
202
+ return rects.every(function (rect) {
203
+ return rect && rect.width === 0 && rect.height === 0 && rect.top === 0 && rect.left === 0 && rect.bottom === 0 && rect.right === 0 && rect.x === 0 && rect.y === 0;
204
+ });
199
205
  };
@@ -36,3 +36,4 @@ export declare const findNearestCellIndexToPoint: (x: number, y: number) => {
36
36
  col: number;
37
37
  row: number;
38
38
  } | undefined;
39
+ export declare const areAllRectsZero: (entry: IntersectionObserverEntry) => boolean;
@@ -39,3 +39,4 @@ export declare const findNearestCellIndexToPoint: (x: number, y: number) => {
39
39
  col: number;
40
40
  row: number;
41
41
  } | undefined;
42
+ export declare const areAllRectsZero: (entry: IntersectionObserverEntry) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "16.1.5",
3
+ "version": "16.1.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
58
58
  "@atlaskit/primitives": "^17.0.0",
59
59
  "@atlaskit/theme": "^21.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^16.8.0",
60
+ "@atlaskit/tmp-editor-statsig": "^16.9.0",
61
61
  "@atlaskit/toggle": "^15.2.0",
62
62
  "@atlaskit/tokens": "^9.1.0",
63
63
  "@atlaskit/tooltip": "^20.12.0",