@atlaskit/editor-plugin-table 2.9.0 → 2.10.0
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 +16 -0
- package/dist/cjs/plugins/table/event-handlers.js +52 -56
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +19 -69
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/cjs/plugins/table/nodeviews/table.js +23 -30
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +3 -6
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +2 -40
- package/dist/cjs/plugins/table/pm-plugins/main.js +3 -3
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -73
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +3 -7
- package/dist/cjs/plugins/table/ui/common-styles.js +2 -2
- package/dist/cjs/plugins/table/utils/dom.js +5 -12
- package/dist/es2019/plugins/table/event-handlers.js +3 -6
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +18 -69
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/es2019/plugins/table/nodeviews/table.js +24 -32
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +3 -7
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +0 -35
- package/dist/es2019/plugins/table/pm-plugins/main.js +3 -4
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -77
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +3 -9
- package/dist/es2019/plugins/table/ui/common-styles.js +3 -3
- package/dist/es2019/plugins/table/utils/dom.js +5 -12
- package/dist/esm/plugins/table/event-handlers.js +52 -56
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +19 -69
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/esm/plugins/table/nodeviews/table.js +23 -30
- package/dist/esm/plugins/table/nodeviews/tableCell.js +3 -6
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +0 -37
- package/dist/esm/plugins/table/pm-plugins/main.js +3 -3
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -73
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +3 -7
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/utils/dom.js +5 -12
- package/dist/types/plugins/table/event-handlers.d.ts +1 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +0 -2
- package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +6 -5
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +2 -3
- package/dist/types/plugins/table/nodeviews/types.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -6
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -6
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -2
- package/dist/types/plugins/table/types.d.ts +2 -2
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +0 -1
- package/dist/types/plugins/table/utils/dom.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +6 -5
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +2 -3
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +2 -0
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +6 -9
- package/src/__tests__/integration/resize.ts +6 -16
- package/src/__tests__/unit/event-handlers.ts +1 -4
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +48 -92
- package/src/__tests__/unit/nodeviews/cell.ts +1 -3
- package/src/__tests__/unit/nodeviews/table.ts +71 -83
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +5 -9
- package/src/__tests__/unit/ui/RowControls.tsx +1 -0
- package/src/__tests__/unit/utils/dom.ts +6 -112
- package/src/plugins/table/event-handlers.ts +72 -79
- package/src/plugins/table/nodeviews/TableComponent.tsx +37 -114
- package/src/plugins/table/nodeviews/TableContainer.tsx +17 -11
- package/src/plugins/table/nodeviews/TableResizer.tsx +34 -4
- package/src/plugins/table/nodeviews/table.tsx +22 -30
- package/src/plugins/table/nodeviews/tableCell.tsx +3 -11
- package/src/plugins/table/nodeviews/types.ts +0 -1
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +0 -54
- package/src/plugins/table/pm-plugins/main.ts +4 -22
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +1 -83
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -7
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +1 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +30 -48
- package/src/plugins/table/types.ts +3 -2
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +3 -15
- package/src/plugins/table/ui/common-styles.ts +1 -1
- package/src/plugins/table/utils/dom.ts +3 -11
- package/tmp/api-report-tmp.d.ts +2 -0
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
|
@@ -2,7 +2,6 @@ import debounce from 'lodash/debounce';
|
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
3
|
|
|
4
4
|
import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
5
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
7
6
|
import { mapChildren } from '@atlaskit/editor-common/utils';
|
|
8
7
|
import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -78,7 +77,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
78
77
|
|
|
79
78
|
private intersectionObserver?: IntersectionObserver;
|
|
80
79
|
private resizeObserver?: ResizeObserver;
|
|
81
|
-
private stickyHeadersOptimization = false;
|
|
82
80
|
private sentinels: {
|
|
83
81
|
top?: HTMLElement | null;
|
|
84
82
|
bottom?: HTMLElement | null;
|
|
@@ -94,7 +92,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
94
92
|
view: EditorView,
|
|
95
93
|
getPos: any,
|
|
96
94
|
eventDispatcher: EventDispatcher,
|
|
97
|
-
getEditorFeatureFlags: GetEditorFeatureFlags,
|
|
98
95
|
) {
|
|
99
96
|
this.view = view;
|
|
100
97
|
this.node = node;
|
|
@@ -104,9 +101,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
104
101
|
this.dom = document.createElement('tr');
|
|
105
102
|
this.contentDOM = this.dom;
|
|
106
103
|
|
|
107
|
-
const featureFlags = getEditorFeatureFlags();
|
|
108
|
-
const { stickyHeadersOptimization } = featureFlags;
|
|
109
|
-
this.stickyHeadersOptimization = !!stickyHeadersOptimization;
|
|
110
104
|
this.lastTimePainted = 0;
|
|
111
105
|
this.isHeaderRow = supportedHeaderRow(node);
|
|
112
106
|
this.isSticky = false;
|
|
@@ -139,11 +133,7 @@ export class TableRowNodeView implements NodeView {
|
|
|
139
133
|
findOverflowScrollParent(this.view.dom as HTMLElement) || window;
|
|
140
134
|
|
|
141
135
|
if (this.editorScrollableElement) {
|
|
142
|
-
|
|
143
|
-
this.initObservers();
|
|
144
|
-
} else {
|
|
145
|
-
this.editorScrollableElement.addEventListener('scroll', this.onScroll);
|
|
146
|
-
}
|
|
136
|
+
this.initObservers();
|
|
147
137
|
this.topPosEditorElement = getTop(this.editorScrollableElement);
|
|
148
138
|
}
|
|
149
139
|
|
|
@@ -182,10 +172,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
182
172
|
this.resizeObserver.disconnect();
|
|
183
173
|
}
|
|
184
174
|
|
|
185
|
-
if (this.editorScrollableElement && !this.stickyHeadersOptimization) {
|
|
186
|
-
this.editorScrollableElement.removeEventListener('scroll', this.onScroll);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
175
|
this.eventDispatcher.off('widthPlugin', this.updateStickyHeaderWidth);
|
|
190
176
|
this.eventDispatcher.off(
|
|
191
177
|
(tablePluginKey as any).key,
|
|
@@ -340,66 +326,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
340
326
|
|
|
341
327
|
nextFrame: number | undefined;
|
|
342
328
|
|
|
343
|
-
onScroll = () => {
|
|
344
|
-
if (!this.tree) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
this.latestDomTop = getTop(this.tree.wrapper);
|
|
349
|
-
|
|
350
|
-
// kick off rAF loop again if it hasn't already happened
|
|
351
|
-
if (!this.nextFrame) {
|
|
352
|
-
this.loop();
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
loop = () => {
|
|
357
|
-
this.nextFrame = window.requestAnimationFrame(() => {
|
|
358
|
-
if (
|
|
359
|
-
this.previousDomTop === this.latestDomTop &&
|
|
360
|
-
this.previousPadding === this.padding
|
|
361
|
-
) {
|
|
362
|
-
this.nextFrame = undefined;
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// can't store these since React might re-render at any time
|
|
367
|
-
const tree = this.tree;
|
|
368
|
-
if (!tree) {
|
|
369
|
-
this.nextFrame = undefined;
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
this.paint(tree);
|
|
374
|
-
|
|
375
|
-
// run again on next frame
|
|
376
|
-
this.previousPadding = this.padding;
|
|
377
|
-
this.previousDomTop = this.latestDomTop;
|
|
378
|
-
this.loop();
|
|
379
|
-
});
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
paint = (tree: TableDOMElements) => {
|
|
383
|
-
const { table, wrapper } = tree;
|
|
384
|
-
|
|
385
|
-
// If the previous refresh is less than 10ms then don't do anything.
|
|
386
|
-
// The jumpiness happen under that time and this is to avoid it.
|
|
387
|
-
const timelapse = Math.abs(performance.now() - this.lastTimePainted);
|
|
388
|
-
if (timelapse < 10) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
if (this.shouldHeaderStick(tree)) {
|
|
393
|
-
this.makeHeaderRowSticky(tree);
|
|
394
|
-
} else {
|
|
395
|
-
this.makeRowHeaderNotSticky(table);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
// ensure scroll positions are locked
|
|
399
|
-
this.dom.scrollLeft = wrapper.scrollLeft;
|
|
400
|
-
this.lastTimePainted = performance.now();
|
|
401
|
-
};
|
|
402
|
-
|
|
403
329
|
/* nodeview lifecycle */
|
|
404
330
|
update(node: PmNode, ..._args: any[]) {
|
|
405
331
|
// do nothing if nodes were identical
|
|
@@ -477,7 +403,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
477
403
|
|
|
478
404
|
onTablePluginState = (state: TablePluginState) => {
|
|
479
405
|
const tableRef = state.tableRef;
|
|
480
|
-
let focusChanged = false;
|
|
481
406
|
|
|
482
407
|
const tree = this.tree;
|
|
483
408
|
if (!tree) {
|
|
@@ -499,9 +424,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
499
424
|
if (isCurrentTableSelected && !state.isHeaderRowEnabled && this.tree) {
|
|
500
425
|
this.makeRowHeaderNotSticky(this.tree.table);
|
|
501
426
|
}
|
|
502
|
-
if (isCurrentTableSelected !== this.focused) {
|
|
503
|
-
focusChanged = true;
|
|
504
|
-
}
|
|
505
427
|
this.focused = isCurrentTableSelected;
|
|
506
428
|
|
|
507
429
|
const { wrapper } = tree;
|
|
@@ -535,10 +457,6 @@ export class TableRowNodeView implements NodeView {
|
|
|
535
457
|
|
|
536
458
|
// run after table style changes have been committed
|
|
537
459
|
setTimeout(() => {
|
|
538
|
-
// if focus changed while header is sticky - still repaint the positions will shift
|
|
539
|
-
if (!this.stickyHeadersOptimization || (focusChanged && this.isSticky)) {
|
|
540
|
-
this.paint(tree);
|
|
541
|
-
}
|
|
542
460
|
syncStickyRowToTable(tree.table);
|
|
543
461
|
}, 0);
|
|
544
462
|
};
|
|
@@ -21,13 +21,7 @@ export const createPlugin = (
|
|
|
21
21
|
props: {
|
|
22
22
|
nodeViews: {
|
|
23
23
|
tableRow: (node, view, getPos) => {
|
|
24
|
-
return new TableRowNodeView(
|
|
25
|
-
node,
|
|
26
|
-
view,
|
|
27
|
-
getPos,
|
|
28
|
-
eventDispatcher,
|
|
29
|
-
getEditorFeatureFlags,
|
|
30
|
-
);
|
|
24
|
+
return new TableRowNodeView(node, view, getPos, eventDispatcher);
|
|
31
25
|
},
|
|
32
26
|
},
|
|
33
27
|
},
|
|
@@ -2,7 +2,6 @@ import {
|
|
|
2
2
|
tableCellBorderWidth,
|
|
3
3
|
tableMarginTop,
|
|
4
4
|
} from '@atlaskit/editor-common/styles';
|
|
5
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
5
|
import {
|
|
7
6
|
closestElement,
|
|
8
7
|
containsClassName,
|
|
@@ -11,65 +10,48 @@ import {
|
|
|
11
10
|
import { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
12
11
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
13
12
|
|
|
14
|
-
import { updateOverflowShadows } from '../../../nodeviews/update-overflow-shadows';
|
|
15
13
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
16
14
|
import { colWidthsForRow } from '../../../utils/column-controls';
|
|
17
15
|
import { getRowHeights } from '../../../utils/row-controls';
|
|
18
16
|
import { getPluginState as getMainPluginState } from '../../plugin-factory';
|
|
19
17
|
|
|
20
|
-
export const updateControls =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
18
|
+
export const updateControls = () => (state: EditorState) => {
|
|
19
|
+
const { tableRef } = getMainPluginState(state);
|
|
20
|
+
if (!tableRef) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const tr = tableRef.querySelector('tr');
|
|
24
|
+
if (!tr) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const wrapper = tableRef.parentElement;
|
|
28
|
+
if (!(wrapper && wrapper.parentElement)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
34
31
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
const rowControls = wrapper.parentElement.querySelectorAll<HTMLElement>(
|
|
33
|
+
`.${ClassName.ROW_CONTROLS_BUTTON_WRAP}`,
|
|
34
|
+
);
|
|
35
|
+
const numberedRows = wrapper.parentElement.querySelectorAll<HTMLElement>(
|
|
36
|
+
ClassName.NUMBERED_COLUMN_BUTTON,
|
|
37
|
+
);
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
syncStickyRowToTable(tableRef);
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
const rowHeights = getRowHeights(tableRef);
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
// update rows controls height on resize
|
|
44
|
+
for (let i = 0, count = rowControls.length; i < count; i++) {
|
|
45
|
+
const height = rowHeights[i];
|
|
46
|
+
if (height) {
|
|
47
|
+
rowControls[i].style.height = `${height}px`;
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
49
|
+
if (numberedRows.length) {
|
|
50
|
+
numberedRows[i].style.height = `${height}px`;
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`.${ClassName.TABLE_RIGHT_SHADOW}`,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const leftShadows = wrapper.parentElement.querySelectorAll<HTMLElement>(
|
|
63
|
-
`.${ClassName.TABLE_LEFT_SHADOW}`,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
updateOverflowShadows(getEditorFeatureFlags)(
|
|
67
|
-
wrapper,
|
|
68
|
-
tableRef,
|
|
69
|
-
rightShadows,
|
|
70
|
-
leftShadows,
|
|
71
|
-
);
|
|
72
|
-
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
73
55
|
|
|
74
56
|
export const isClickNear = (
|
|
75
57
|
event: MouseEvent,
|
|
@@ -53,13 +53,15 @@ export interface PluginConfig {
|
|
|
53
53
|
permittedLayouts?: PermittedLayoutsDescriptor;
|
|
54
54
|
allowControls?: boolean;
|
|
55
55
|
stickyHeaders?: boolean;
|
|
56
|
+
allowCellOptionsInFloatingToolbar?: boolean;
|
|
57
|
+
allowDistributeColumns?: boolean;
|
|
58
|
+
// to be cleaned up in ED-19477 after confluence no longer consumes table optimisation flags
|
|
56
59
|
tableCellOptimization?: boolean;
|
|
57
60
|
tableRenderOptimization?: boolean;
|
|
58
61
|
stickyHeadersOptimization?: boolean;
|
|
59
62
|
initialRenderOptimization?: boolean;
|
|
60
63
|
mouseMoveOptimization?: boolean;
|
|
61
64
|
tableOverflowShadowsOptimization?: boolean;
|
|
62
|
-
allowDistributeColumns?: boolean;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
|
|
@@ -115,7 +117,6 @@ export interface TablePluginState {
|
|
|
115
117
|
ordering?: TableColumnOrdering;
|
|
116
118
|
resizeHandleRowIndex?: number;
|
|
117
119
|
resizeHandleColumnIndex?: number;
|
|
118
|
-
tableCellOptimization?: boolean;
|
|
119
120
|
// for table wrap/collapse
|
|
120
121
|
isTableCollapsed?: boolean; // is the current table already in an expand?
|
|
121
122
|
canCollapseTable?: boolean; // enabled/disabled state of collapse option
|
|
@@ -26,7 +26,6 @@ export interface Props {
|
|
|
26
26
|
isHeaderColumnEnabled?: boolean;
|
|
27
27
|
isNumberColumnEnabled?: boolean;
|
|
28
28
|
hasHeaderRow?: boolean;
|
|
29
|
-
tableHeight?: number;
|
|
30
29
|
headerRowHeight?: number;
|
|
31
30
|
hoveredRows?: number[];
|
|
32
31
|
ordering?: TableColumnOrdering;
|
|
@@ -53,13 +52,7 @@ export default class TableFloatingControls extends Component<Props, State> {
|
|
|
53
52
|
// tracking the table height changes to update floating controls
|
|
54
53
|
private tryInitResizeObserver() {
|
|
55
54
|
let { tableRef } = this.props;
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
tableRenderOptimization &&
|
|
59
|
-
tableRef &&
|
|
60
|
-
!this.resizeObserver &&
|
|
61
|
-
window?.ResizeObserver
|
|
62
|
-
) {
|
|
55
|
+
if (tableRef && !this.resizeObserver && window?.ResizeObserver) {
|
|
63
56
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
64
57
|
for (let entry of entries) {
|
|
65
58
|
const tableHeight = entry.contentRect.height;
|
|
@@ -85,13 +78,8 @@ export default class TableFloatingControls extends Component<Props, State> {
|
|
|
85
78
|
headerRowHeight,
|
|
86
79
|
stickyHeader,
|
|
87
80
|
} = this.props;
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
? this.state?.tableHeight
|
|
91
|
-
: this.props.tableHeight;
|
|
92
|
-
const nextTableHeight = tableRenderOptimization
|
|
93
|
-
? nextState?.tableHeight
|
|
94
|
-
: nextProps.tableHeight;
|
|
81
|
+
const tableHeight = this.state?.tableHeight;
|
|
82
|
+
const nextTableHeight = nextState?.tableHeight;
|
|
95
83
|
return (
|
|
96
84
|
ordering !== nextProps.ordering ||
|
|
97
85
|
tableRef !== nextProps.tableRef ||
|
|
@@ -409,7 +409,7 @@ export const tableStyles = (
|
|
|
409
409
|
${token('elevation.surface', 'white')};
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
${
|
|
412
|
+
${sentinelStyles}
|
|
413
413
|
${OverflowShadow(props)}
|
|
414
414
|
|
|
415
415
|
.${ClassName.TABLE_STICKY} .${ClassName.TABLE_STICKY_SHADOW} {
|
|
@@ -106,7 +106,6 @@ export const isTableContainerOrWrapper = (node: HTMLElement | null): boolean =>
|
|
|
106
106
|
|
|
107
107
|
export const getMousePositionHorizontalRelativeByElement = (
|
|
108
108
|
mouseEvent: MouseEvent,
|
|
109
|
-
mouseMoveOptimization?: boolean,
|
|
110
109
|
elementContentRects?: ElementContentRects,
|
|
111
110
|
gapInPixels?: number,
|
|
112
111
|
): 'left' | 'right' | null => {
|
|
@@ -116,16 +115,9 @@ export const getMousePositionHorizontalRelativeByElement = (
|
|
|
116
115
|
let width, x;
|
|
117
116
|
const closestCell = element.closest(SELECTOR_TABLE_LEAFS);
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
x = mouseEvent.offsetX;
|
|
123
|
-
} else {
|
|
124
|
-
const elementRect = element.getBoundingClientRect();
|
|
125
|
-
width = elementRect.width;
|
|
126
|
-
const left = elementRect.left;
|
|
127
|
-
x = mouseEvent.clientX - left;
|
|
128
|
-
}
|
|
118
|
+
const id = closestCell?.id ?? '';
|
|
119
|
+
width = elementContentRects?.[id]?.width ?? 0;
|
|
120
|
+
x = mouseEvent.offsetX;
|
|
129
121
|
|
|
130
122
|
if (width <= 0) {
|
|
131
123
|
return null;
|
package/tmp/api-report-tmp.d.ts
CHANGED
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED