@atlaskit/editor-plugin-table 7.6.2 → 7.6.3
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 +6 -0
- package/dist/cjs/nodeviews/TableComponent.js +25 -11
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +87 -0
- package/dist/cjs/nodeviews/TableContainer.js +8 -4
- package/dist/cjs/nodeviews/TableResizer.js +4 -5
- package/dist/cjs/nodeviews/table.js +21 -1
- package/dist/cjs/plugin.js +24 -2
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -2
- package/dist/cjs/ui/TableFloatingColumnControls/index.js +5 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +48 -1
- package/dist/cjs/ui/TableFloatingControls/CornerControls/index.js +6 -0
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +47 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +3 -2
- package/dist/cjs/ui/TableFloatingControls/index.js +25 -3
- package/dist/cjs/ui/common-styles.js +11 -6
- package/dist/es2019/nodeviews/TableComponent.js +27 -12
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +83 -0
- package/dist/es2019/nodeviews/TableContainer.js +8 -4
- package/dist/es2019/nodeviews/TableResizer.js +2 -4
- package/dist/es2019/nodeviews/table.js +21 -1
- package/dist/es2019/plugin.js +25 -3
- package/dist/es2019/types.js +3 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -2
- package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -2
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +55 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/index.js +1 -1
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +42 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +3 -2
- package/dist/es2019/ui/TableFloatingControls/index.js +26 -4
- package/dist/es2019/ui/common-styles.js +589 -588
- package/dist/esm/nodeviews/TableComponent.js +25 -11
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +80 -0
- package/dist/esm/nodeviews/TableContainer.js +8 -4
- package/dist/esm/nodeviews/TableResizer.js +4 -5
- package/dist/esm/nodeviews/table.js +21 -1
- package/dist/esm/plugin.js +25 -3
- package/dist/esm/types.js +3 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +6 -2
- package/dist/esm/ui/TableFloatingColumnControls/index.js +5 -2
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +47 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +40 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +3 -2
- package/dist/esm/ui/TableFloatingControls/index.js +26 -4
- package/dist/esm/ui/common-styles.js +10 -5
- package/dist/types/nodeviews/TableComponent.d.ts +7 -2
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +27 -0
- package/dist/types/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/plugin.d.ts +11 -7
- package/dist/types/types.d.ts +8 -2
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +113 -1
- package/dist/types/ui/TableFloatingColumnControls/index.d.ts +3 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +223 -0
- package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/FloatingControlsWithSelection.d.ts +20 -0
- package/dist/types/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +2 -0
- package/dist/types/ui/TableFloatingControls/index.d.ts +113 -1
- package/dist/types/ui/common-styles.d.ts +3 -0
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +7 -2
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +27 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +11 -7
- package/dist/types-ts4.5/types.d.ts +8 -2
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +144 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +285 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/FloatingControlsWithSelection.d.ts +20 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +144 -1
- package/dist/types-ts4.5/ui/common-styles.d.ts +3 -0
- package/package.json +6 -3
- package/src/nodeviews/TableComponent.tsx +36 -7
- package/src/nodeviews/TableComponentWithSharedState.tsx +125 -0
- package/src/nodeviews/TableContainer.tsx +6 -0
- package/src/nodeviews/TableResizer.tsx +2 -1
- package/src/nodeviews/table.tsx +22 -1
- package/src/nodeviews/types.ts +1 -0
- package/src/plugin.tsx +46 -6
- package/src/types.ts +27 -2
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +10 -2
- package/src/ui/TableFloatingColumnControls/index.tsx +13 -1
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +58 -0
- package/src/ui/TableFloatingControls/CornerControls/index.tsx +4 -1
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +68 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -1
- package/src/ui/TableFloatingControls/index.tsx +42 -8
- package/src/ui/common-styles.ts +611 -610
|
@@ -498,9 +498,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
498
498
|
options = _this$props10.options,
|
|
499
499
|
isTableScalingEnabled = _this$props10.isTableScalingEnabled,
|
|
500
500
|
getPos = _this$props10.getPos;
|
|
501
|
-
var
|
|
502
|
-
isInDanger = _getPluginState.isInDanger;
|
|
501
|
+
var isInDanger = this.props.isInDanger;
|
|
503
502
|
var table = findTable(view.state.selection);
|
|
503
|
+
if (!getBooleanFF('platform.editor.table.use-shared-state-hook')) {
|
|
504
|
+
var pluginState = getPluginState(view.state);
|
|
505
|
+
isInDanger = pluginState.isInDanger;
|
|
506
|
+
}
|
|
504
507
|
if (isTableScalingEnabled) {
|
|
505
508
|
this.handleColgroupUpdates();
|
|
506
509
|
}
|
|
@@ -602,16 +605,24 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
602
605
|
isDragAndDropEnabled = _this$props11.isDragAndDropEnabled,
|
|
603
606
|
getEditorFeatureFlags = _this$props11.getEditorFeatureFlags,
|
|
604
607
|
isTableScalingEnabled = _this$props11.isTableScalingEnabled;
|
|
608
|
+
var _this$props12 = this.props,
|
|
609
|
+
isInDanger = _this$props12.isInDanger,
|
|
610
|
+
hoveredRows = _this$props12.hoveredRows,
|
|
611
|
+
hoveredCell = _this$props12.hoveredCell,
|
|
612
|
+
isTableHovered = _this$props12.isTableHovered,
|
|
613
|
+
isWholeTableInDanger = _this$props12.isWholeTableInDanger;
|
|
605
614
|
var _this$state3 = this.state,
|
|
606
615
|
showBeforeShadow = _this$state3.showBeforeShadow,
|
|
607
616
|
showAfterShadow = _this$state3.showAfterShadow;
|
|
608
617
|
var node = getNode();
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
isInDanger =
|
|
612
|
-
hoveredRows =
|
|
613
|
-
hoveredCell =
|
|
614
|
-
isTableHovered =
|
|
618
|
+
if (!getBooleanFF('platform.editor.table.use-shared-state-hook')) {
|
|
619
|
+
var pluginState = getPluginState(view.state);
|
|
620
|
+
isInDanger = pluginState.isInDanger;
|
|
621
|
+
hoveredRows = pluginState.hoveredRows;
|
|
622
|
+
hoveredCell = pluginState.hoveredCell;
|
|
623
|
+
isTableHovered = pluginState.isTableHovered;
|
|
624
|
+
isWholeTableInDanger = pluginState.isWholeTableInDanger;
|
|
625
|
+
}
|
|
615
626
|
var tableRef = this.table || undefined;
|
|
616
627
|
var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
|
|
617
628
|
var hasHeaderRow = containsHeaderRow(node);
|
|
@@ -636,7 +647,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
636
647
|
selection: view.state.selection,
|
|
637
648
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
638
649
|
stickyHeader: this.state.stickyHeader,
|
|
639
|
-
tableWrapperWidth: this.state.tableWrapperWidth
|
|
650
|
+
tableWrapperWidth: this.state.tableWrapperWidth,
|
|
651
|
+
api: pluginInjectionApi
|
|
640
652
|
});
|
|
641
653
|
var tableContainerWidth = getTableContainerWidth(node);
|
|
642
654
|
var colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
|
|
@@ -663,7 +675,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
663
675
|
var _this4$wrapper;
|
|
664
676
|
return ((_this4$wrapper = _this4.wrapper) === null || _this4$wrapper === void 0 ? void 0 : _this4$wrapper.scrollLeft) || 0;
|
|
665
677
|
},
|
|
666
|
-
tableWrapperHeight: this.state.tableWrapperHeight
|
|
678
|
+
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
679
|
+
api: pluginInjectionApi
|
|
667
680
|
}) : null;
|
|
668
681
|
var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
|
|
669
682
|
var shadowStyle = memoizeOne(function (visible) {
|
|
@@ -700,7 +713,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
700
713
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
701
714
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
|
|
702
715
|
isResizing: isResizing,
|
|
703
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
716
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
717
|
+
isWholeTableInDanger: isWholeTableInDanger
|
|
704
718
|
}, /*#__PURE__*/React.createElement("div", {
|
|
705
719
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
706
720
|
"data-testid": "sticky-sentinel-top"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { findTable } from '@atlaskit/editor-tables';
|
|
4
|
+
import TableComponent from './TableComponent';
|
|
5
|
+
/**
|
|
6
|
+
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
7
|
+
*/
|
|
8
|
+
export var TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
|
|
9
|
+
var view = _ref.view,
|
|
10
|
+
options = _ref.options,
|
|
11
|
+
getNode = _ref.getNode,
|
|
12
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
13
|
+
api = _ref.api,
|
|
14
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
15
|
+
eventDispatcher = _ref.eventDispatcher,
|
|
16
|
+
allowColumnResizing = _ref.allowColumnResizing,
|
|
17
|
+
allowControls = _ref.allowControls,
|
|
18
|
+
getPos = _ref.getPos,
|
|
19
|
+
forwardRef = _ref.forwardRef;
|
|
20
|
+
var _useSharedPluginState = useSharedPluginState(api, ['width', 'table', 'media']),
|
|
21
|
+
widthState = _useSharedPluginState.widthState,
|
|
22
|
+
tableState = _useSharedPluginState.tableState,
|
|
23
|
+
mediaState = _useSharedPluginState.mediaState;
|
|
24
|
+
if (!tableState) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var _ref2 = tableState,
|
|
28
|
+
isTableResizing = _ref2.isTableResizing,
|
|
29
|
+
isHeaderColumnEnabled = _ref2.isHeaderColumnEnabled,
|
|
30
|
+
isHeaderRowEnabled = _ref2.isHeaderRowEnabled,
|
|
31
|
+
ordering = _ref2.ordering,
|
|
32
|
+
isResizing = _ref2.isResizing,
|
|
33
|
+
isInDanger = _ref2.isInDanger,
|
|
34
|
+
hoveredCell = _ref2.hoveredCell,
|
|
35
|
+
hoveredRows = _ref2.hoveredRows,
|
|
36
|
+
isTableHovered = _ref2.isTableHovered,
|
|
37
|
+
isWholeTableInDanger = _ref2.isWholeTableInDanger;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* ED-19810
|
|
41
|
+
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
42
|
+
* directly to confluence since this bug is now in production.
|
|
43
|
+
*/
|
|
44
|
+
var currentTablePos;
|
|
45
|
+
try {
|
|
46
|
+
currentTablePos = getPos ? getPos() : undefined;
|
|
47
|
+
} catch (e) {
|
|
48
|
+
currentTablePos = undefined;
|
|
49
|
+
}
|
|
50
|
+
var selectedTable = findTable(view.state.selection);
|
|
51
|
+
var tablePos = selectedTable && selectedTable.start - 1;
|
|
52
|
+
var tableActive = typeof currentTablePos === 'number' && typeof tablePos === 'number' && currentTablePos === tablePos && !isTableResizing;
|
|
53
|
+
return /*#__PURE__*/React.createElement(TableComponent, {
|
|
54
|
+
view: view,
|
|
55
|
+
allowColumnResizing: allowColumnResizing,
|
|
56
|
+
eventDispatcher: eventDispatcher,
|
|
57
|
+
getPos: getPos,
|
|
58
|
+
isMediaFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
59
|
+
options: options,
|
|
60
|
+
allowControls: !!allowControls,
|
|
61
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
62
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
63
|
+
isDragAndDropEnabled: options === null || options === void 0 ? void 0 : options.isDragAndDropEnabled,
|
|
64
|
+
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
65
|
+
tableActive: tableActive,
|
|
66
|
+
ordering: ordering,
|
|
67
|
+
isResizing: isResizing,
|
|
68
|
+
getNode: getNode,
|
|
69
|
+
containerWidth: widthState,
|
|
70
|
+
contentDOM: forwardRef,
|
|
71
|
+
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
72
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
73
|
+
pluginInjectionApi: api,
|
|
74
|
+
isInDanger: !!isInDanger,
|
|
75
|
+
hoveredRows: hoveredRows,
|
|
76
|
+
hoveredCell: hoveredCell,
|
|
77
|
+
isTableHovered: isTableHovered,
|
|
78
|
+
isWholeTableInDanger: isWholeTableInDanger
|
|
79
|
+
});
|
|
80
|
+
};
|
|
@@ -46,7 +46,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
46
46
|
isResizing = _ref2.isResizing,
|
|
47
47
|
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
48
48
|
isTableScalingEnabled = _ref2.isTableScalingEnabled,
|
|
49
|
-
tableWrapperHeight = _ref2.tableWrapperHeight
|
|
49
|
+
tableWrapperHeight = _ref2.tableWrapperHeight,
|
|
50
|
+
isWholeTableInDanger = _ref2.isWholeTableInDanger;
|
|
50
51
|
var containerRef = useRef(null);
|
|
51
52
|
var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
|
|
52
53
|
var _useState = useState(false),
|
|
@@ -125,7 +126,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
125
126
|
displayGuideline: displayGuideline,
|
|
126
127
|
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
127
128
|
displayGapCursor: displayGapCursor,
|
|
128
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
129
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
130
|
+
isWholeTableInDanger: isWholeTableInDanger
|
|
129
131
|
};
|
|
130
132
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
131
133
|
tableResizerProps = _objectSpread(_objectSpread({}, tableResizerProps), {}, {
|
|
@@ -166,7 +168,8 @@ export var TableContainer = function TableContainer(_ref3) {
|
|
|
166
168
|
tableWrapperHeight = _ref3.tableWrapperHeight,
|
|
167
169
|
isResizing = _ref3.isResizing,
|
|
168
170
|
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
169
|
-
isTableScalingEnabled = _ref3.isTableScalingEnabled
|
|
171
|
+
isTableScalingEnabled = _ref3.isTableScalingEnabled,
|
|
172
|
+
isWholeTableInDanger = _ref3.isWholeTableInDanger;
|
|
170
173
|
if (isTableResizingEnabled && !isNested) {
|
|
171
174
|
return /*#__PURE__*/React.createElement(ResizableTableContainer, {
|
|
172
175
|
className: className,
|
|
@@ -178,7 +181,8 @@ export var TableContainer = function TableContainer(_ref3) {
|
|
|
178
181
|
tableWrapperHeight: tableWrapperHeight,
|
|
179
182
|
isResizing: isResizing,
|
|
180
183
|
pluginInjectionApi: pluginInjectionApi,
|
|
181
|
-
isTableScalingEnabled: isTableScalingEnabled
|
|
184
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
185
|
+
isWholeTableInDanger: isWholeTableInDanger
|
|
182
186
|
}, children);
|
|
183
187
|
}
|
|
184
188
|
var tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
|
|
@@ -90,7 +90,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
90
90
|
displayGuideline = _ref.displayGuideline,
|
|
91
91
|
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
92
92
|
displayGapCursor = _ref.displayGapCursor,
|
|
93
|
-
isTableScalingEnabled = _ref.isTableScalingEnabled
|
|
93
|
+
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
94
|
+
isWholeTableInDanger = _ref.isWholeTableInDanger;
|
|
94
95
|
var currentGap = useRef(0);
|
|
95
96
|
// track resizing state - use ref over state to avoid re-render
|
|
96
97
|
var isResizing = useRef(false);
|
|
@@ -126,8 +127,6 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
126
127
|
var isTableSelected = ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos();
|
|
127
128
|
var resizerMinWidth = getResizerMinWidth(node);
|
|
128
129
|
var handleSize = getResizerHandleHeight(tableRef);
|
|
129
|
-
var _getPluginState = getPluginState(editorView.state),
|
|
130
|
-
isWholeTableInDanger = _getPluginState.isWholeTableInDanger;
|
|
131
130
|
var _useMeasureFramerate = useMeasureFramerate(),
|
|
132
131
|
startMeasure = _useMeasureFramerate.startMeasure,
|
|
133
132
|
endMeasure = _useMeasureFramerate.endMeasure,
|
|
@@ -223,8 +222,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
223
222
|
var state = editorView.state,
|
|
224
223
|
dispatch = editorView.dispatch;
|
|
225
224
|
var pos = getPos();
|
|
226
|
-
var
|
|
227
|
-
widthToWidest =
|
|
225
|
+
var _getPluginState = getPluginState(editorView.state),
|
|
226
|
+
widthToWidest = _getPluginState.widthToWidest;
|
|
228
227
|
newWidth = widthToWidest ? akEditorFullWidthLayoutWidth : newWidth;
|
|
229
228
|
var tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
230
229
|
resizing: false
|
|
@@ -17,6 +17,7 @@ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
|
17
17
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
18
18
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
21
|
import { pluginConfig as getPluginConfig } from '../create-plugin-config';
|
|
21
22
|
import { pluginKey as tableDragAndDropPluginKey } from '../pm-plugins/drag-and-drop';
|
|
22
23
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -26,6 +27,7 @@ import { generateColgroup } from '../pm-plugins/table-resizing/utils';
|
|
|
26
27
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
27
28
|
import { isTableNested } from '../utils';
|
|
28
29
|
import TableComponent from './TableComponent';
|
|
30
|
+
import { TableComponentWithSharedState } from './TableComponentWithSharedState';
|
|
29
31
|
var tableAttributes = function tableAttributes(node) {
|
|
30
32
|
return {
|
|
31
33
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
@@ -116,6 +118,22 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
116
118
|
key: "render",
|
|
117
119
|
value: function render(props, forwardRef) {
|
|
118
120
|
var _this3 = this;
|
|
121
|
+
if (getBooleanFF('platform.editor.table.use-shared-state-hook')) {
|
|
122
|
+
return /*#__PURE__*/React.createElement(TableComponentWithSharedState, {
|
|
123
|
+
forwardRef: forwardRef,
|
|
124
|
+
getNode: this.getNode,
|
|
125
|
+
view: props.view,
|
|
126
|
+
options: props.options,
|
|
127
|
+
eventDispatcher: props.eventDispatcher,
|
|
128
|
+
api: props.pluginInjectionApi,
|
|
129
|
+
allowColumnResizing: props.allowColumnResizing,
|
|
130
|
+
allowControls: props.allowControls,
|
|
131
|
+
getPos: props.getPos,
|
|
132
|
+
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
133
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
119
137
|
// TODO: ED-15663
|
|
120
138
|
// Please, do not copy or use this kind of code below
|
|
121
139
|
// @ts-ignore
|
|
@@ -262,12 +280,14 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
262
280
|
isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled,
|
|
263
281
|
isTableScalingEnabled = _getPluginState2.isTableScalingEnabled;
|
|
264
282
|
var _getPluginConfig = getPluginConfig(pluginConfig),
|
|
265
|
-
allowColumnResizing = _getPluginConfig.allowColumnResizing
|
|
283
|
+
allowColumnResizing = _getPluginConfig.allowColumnResizing,
|
|
284
|
+
allowControls = _getPluginConfig.allowControls;
|
|
266
285
|
var hasIntlContext = true;
|
|
267
286
|
return new TableView({
|
|
268
287
|
node: node,
|
|
269
288
|
view: view,
|
|
270
289
|
allowColumnResizing: allowColumnResizing,
|
|
290
|
+
allowControls: allowControls,
|
|
271
291
|
portalProviderAPI: portalProviderAPI,
|
|
272
292
|
eventDispatcher: eventDispatcher,
|
|
273
293
|
getPos: getPos,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -24,7 +24,7 @@ import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPl
|
|
|
24
24
|
import { createPlugin as createStickyHeadersPlugin, findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from './pm-plugins/sticky-headers';
|
|
25
25
|
import { createPlugin as createTableOverflowAnalyticsPlugin } from './pm-plugins/table-analytics';
|
|
26
26
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
27
|
-
import { createPlugin as createFlexiResizingPlugin, pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
27
|
+
import { createPlugin as createFlexiResizingPlugin, getPluginState as getFlexiResizingPlugin, pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
28
28
|
import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
|
|
29
29
|
import { createPlugin as createTableWidthPlugin, pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
|
|
30
30
|
import { getToolbarConfig } from './toolbar';
|
|
@@ -38,6 +38,9 @@ import { createTableWithWidth, isLayoutSupported } from './utils';
|
|
|
38
38
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
39
|
return {};
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
// TODO: duplicating type instead of importing media plugin causing a circular dependency
|
|
43
|
+
|
|
41
44
|
/**
|
|
42
45
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
43
46
|
* from `@atlaskit/editor-core`.
|
|
@@ -60,10 +63,29 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
60
63
|
name: 'table',
|
|
61
64
|
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
62
65
|
// to most up to date values - passing to createPluginState will not re-initialise the state
|
|
63
|
-
getSharedState: function getSharedState() {
|
|
66
|
+
getSharedState: function getSharedState(editorState) {
|
|
67
|
+
if (!editorState) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
var tablePluginState = getPluginState(editorState);
|
|
71
|
+
var tableResizingPluginState = getFlexiResizingPlugin(editorState);
|
|
72
|
+
var tableWidthResizingPluginState = tableWidthPluginKey.getState(editorState);
|
|
64
73
|
return {
|
|
65
74
|
isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
|
|
66
|
-
wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled)
|
|
75
|
+
wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled),
|
|
76
|
+
isHeaderRowEnabled: tablePluginState.isHeaderRowEnabled,
|
|
77
|
+
isHeaderColumnEnabled: tablePluginState.isHeaderColumnEnabled,
|
|
78
|
+
ordering: tablePluginState.ordering,
|
|
79
|
+
isResizing: !!(tableResizingPluginState !== null && tableResizingPluginState !== void 0 && tableResizingPluginState.dragging || tableWidthResizingPluginState !== null && tableWidthResizingPluginState !== void 0 && tableWidthResizingPluginState.resizing),
|
|
80
|
+
isTableResizing: tableWidthResizingPluginState === null || tableWidthResizingPluginState === void 0 ? void 0 : tableWidthResizingPluginState.resizing,
|
|
81
|
+
isInDanger: tablePluginState.isInDanger,
|
|
82
|
+
hoveredRows: tablePluginState.hoveredRows,
|
|
83
|
+
hoveredCell: tablePluginState.hoveredCell,
|
|
84
|
+
isTableHovered: tablePluginState.isTableHovered,
|
|
85
|
+
isWholeTableInDanger: tablePluginState.isWholeTableInDanger,
|
|
86
|
+
// IMPORTANT: Need to continue to pass tableNode to control re-renders
|
|
87
|
+
// TableComponent listens for node attribute changes to update colgroups
|
|
88
|
+
tableNode: tablePluginState.tableNode
|
|
67
89
|
};
|
|
68
90
|
},
|
|
69
91
|
actions: {
|
package/dist/esm/types.js
CHANGED
|
@@ -9,6 +9,9 @@ export var RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
|
9
9
|
* @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-6877 Internal documentation for deprecation (no external access)}
|
|
10
10
|
**/
|
|
11
11
|
|
|
12
|
+
// override getPluginState but do not expose publicly as this type is experimental and will change
|
|
13
|
+
// in the future
|
|
14
|
+
|
|
12
15
|
/*
|
|
13
16
|
* This type represents the start and end from a cell in a column,
|
|
14
17
|
* for example, on this table the cell C1 will have
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
6
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
@@ -36,8 +37,11 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
36
37
|
tableContainerWidth = _ref.tableContainerWidth,
|
|
37
38
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
38
39
|
isDragging = _ref.isDragging,
|
|
39
|
-
getScrollOffset = _ref.getScrollOffset
|
|
40
|
+
getScrollOffset = _ref.getScrollOffset,
|
|
41
|
+
api = _ref.api;
|
|
40
42
|
var columnControlsRef = useRef(null);
|
|
43
|
+
var _useSharedPluginState = useSharedPluginState(api, ['selection']),
|
|
44
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
41
45
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
42
46
|
return (
|
|
43
47
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
@@ -48,7 +52,7 @@ export var ColumnControls = function ColumnControls(_ref) {
|
|
|
48
52
|
// TODO: reusing getRowsParams here because it's generic enough to work for columns -> rename
|
|
49
53
|
var columnParams = getRowsParams(colWidths !== null && colWidths !== void 0 ? colWidths : []);
|
|
50
54
|
var colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
|
|
51
|
-
var selectedColIndexes = getSelectedColumns(editorView.state.selection);
|
|
55
|
+
var selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
|
|
52
56
|
var firstRow = tableRef.querySelector('tr');
|
|
53
57
|
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
54
58
|
var marginTop = hasHeaderRow && stickyTop !== undefined ? (_rowHeights$ = rowHeights === null || rowHeights === void 0 ? void 0 : rowHeights[0]) !== null && _rowHeights$ !== void 0 ? _rowHeights$ : 0 : 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
4
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
5
6
|
import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
|
|
@@ -20,7 +21,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
20
21
|
tableContainerWidth = _ref.tableContainerWidth,
|
|
21
22
|
isNumberColumnEnabled = _ref.isNumberColumnEnabled,
|
|
22
23
|
getScrollOffset = _ref.getScrollOffset,
|
|
23
|
-
tableWrapperHeight = _ref.tableWrapperHeight
|
|
24
|
+
tableWrapperHeight = _ref.tableWrapperHeight,
|
|
25
|
+
api = _ref.api;
|
|
24
26
|
var _useState = useState(false),
|
|
25
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
28
|
isDragging = _useState2[0],
|
|
@@ -87,7 +89,8 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
87
89
|
tableContainerWidth: tableContainerWidth,
|
|
88
90
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
89
91
|
isDragging: isDragging,
|
|
90
|
-
getScrollOffset: getScrollOffset
|
|
92
|
+
getScrollOffset: getScrollOffset,
|
|
93
|
+
api: getBooleanFF('platform.editor.table.use-shared-state-hook') ? api : undefined
|
|
91
94
|
}), isDragging && /*#__PURE__*/React.createElement(ColumnDropTargets, {
|
|
92
95
|
tableRef: tableRef,
|
|
93
96
|
isHeaderSticky: (stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.sticky) && hasHeaderRow,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
6
7
|
import { clearHoverSelection } from '../../../commands';
|
|
@@ -45,4 +46,50 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
45
46
|
className: ClassName.DRAG_CORNER_BUTTON_INNER
|
|
46
47
|
}));
|
|
47
48
|
};
|
|
49
|
+
var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
|
|
50
|
+
var editorView = _ref2.editorView,
|
|
51
|
+
isInDanger = _ref2.isInDanger,
|
|
52
|
+
isResizing = _ref2.isResizing,
|
|
53
|
+
formatMessage = _ref2.intl.formatMessage,
|
|
54
|
+
api = _ref2.api;
|
|
55
|
+
var _useSharedPluginState = useSharedPluginState(api, ['selection']),
|
|
56
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
57
|
+
var handleOnClick = function handleOnClick() {
|
|
58
|
+
var state = editorView.state,
|
|
59
|
+
dispatch = editorView.dispatch;
|
|
60
|
+
dispatch(selectTable(state.tr).setMeta('addToHistory', false));
|
|
61
|
+
};
|
|
62
|
+
var handleMouseOut = function handleMouseOut() {
|
|
63
|
+
var state = editorView.state,
|
|
64
|
+
dispatch = editorView.dispatch;
|
|
65
|
+
clearHoverSelection()(state, dispatch);
|
|
66
|
+
};
|
|
67
|
+
var isActive = useMemo(function () {
|
|
68
|
+
if (!(selectionState !== null && selectionState !== void 0 && selectionState.selection)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
var table = findTable(selectionState.selection);
|
|
72
|
+
if (!table) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return isTableSelected(selectionState.selection);
|
|
76
|
+
}, [selectionState]);
|
|
77
|
+
if (isResizing) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
81
|
+
className: classnames(ClassName.DRAG_CORNER_BUTTON, {
|
|
82
|
+
active: isActive,
|
|
83
|
+
danger: isActive && isInDanger
|
|
84
|
+
}),
|
|
85
|
+
"aria-label": formatMessage(messages.cornerControl),
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: handleOnClick,
|
|
88
|
+
onMouseOut: handleMouseOut,
|
|
89
|
+
contentEditable: false
|
|
90
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: ClassName.DRAG_CORNER_BUTTON_INNER
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
94
|
+
export var DragCornerControlsWithSelection = injectIntl(DragCornerControlsComponentWithSelection);
|
|
48
95
|
export var DragCornerControls = injectIntl(DragCornerControlsComponent);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { CornerControls } from './ClassicCornerControls';
|
|
2
|
-
export { DragCornerControls } from './DragCornerControls';
|
|
2
|
+
export { DragCornerControls, DragCornerControlsWithSelection } from './DragCornerControls';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { CornerControls } from './CornerControls';
|
|
4
|
+
import { RowControls } from './RowControls';
|
|
5
|
+
export var FloatingControlsWithSelection = function FloatingControlsWithSelection(_ref) {
|
|
6
|
+
var editorView = _ref.editorView,
|
|
7
|
+
tableRef = _ref.tableRef,
|
|
8
|
+
isInDanger = _ref.isInDanger,
|
|
9
|
+
isResizing = _ref.isResizing,
|
|
10
|
+
isHeaderRowEnabled = _ref.isHeaderRowEnabled,
|
|
11
|
+
isHeaderColumnEnabled = _ref.isHeaderColumnEnabled,
|
|
12
|
+
hoveredRows = _ref.hoveredRows,
|
|
13
|
+
stickyTop = _ref.stickyTop,
|
|
14
|
+
hoverRows = _ref.hoverRows,
|
|
15
|
+
selectRow = _ref.selectRow,
|
|
16
|
+
tableActive = _ref.tableActive,
|
|
17
|
+
api = _ref.api;
|
|
18
|
+
var _useSharedPluginState = useSharedPluginState(api, ['selection']),
|
|
19
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
20
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
21
|
+
editorView: editorView,
|
|
22
|
+
tableRef: tableRef,
|
|
23
|
+
isInDanger: isInDanger,
|
|
24
|
+
isResizing: isResizing,
|
|
25
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
26
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
27
|
+
hoveredRows: hoveredRows,
|
|
28
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
29
|
+
}), /*#__PURE__*/React.createElement(RowControls, {
|
|
30
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
|
|
31
|
+
editorView: editorView,
|
|
32
|
+
tableRef: tableRef,
|
|
33
|
+
hoverRows: hoverRows,
|
|
34
|
+
hoveredRows: hoveredRows,
|
|
35
|
+
isInDanger: isInDanger,
|
|
36
|
+
isResizing: isResizing,
|
|
37
|
+
selectRow: selectRow,
|
|
38
|
+
stickyTop: tableActive ? stickyTop : undefined
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
@@ -42,7 +42,8 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
42
42
|
hoveredRows = _this$props.hoveredRows,
|
|
43
43
|
isInDanger = _this$props.isInDanger,
|
|
44
44
|
isResizing = _this$props.isResizing,
|
|
45
|
-
formatMessage = _this$props.intl.formatMessage
|
|
45
|
+
formatMessage = _this$props.intl.formatMessage,
|
|
46
|
+
selectionState = _this$props.selection;
|
|
46
47
|
if (!tableRef) {
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
@@ -66,7 +67,7 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
|
|
|
66
67
|
}
|
|
67
68
|
var thisRowSticky = _this2.props.stickyTop !== undefined && index === 0 && hasHeaderRow;
|
|
68
69
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
-
className: "".concat(ClassName.ROW_CONTROLS_BUTTON_WRAP, " ").concat(getRowClassNames(startIndex, selection, hoveredRows, isInDanger, isResizing), " ").concat(thisRowSticky ? 'sticky' : ''),
|
|
70
|
+
className: "".concat(ClassName.ROW_CONTROLS_BUTTON_WRAP, " ").concat(getRowClassNames(startIndex, selectionState || selection, hoveredRows, isInDanger, isResizing), " ").concat(thisRowSticky ? 'sticky' : ''),
|
|
70
71
|
key: startIndex,
|
|
71
72
|
style: {
|
|
72
73
|
height: height,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../commands';
|
|
4
5
|
import { TableCssClassName as ClassName } from '../../types';
|
|
5
|
-
import { CornerControls, DragCornerControls } from './CornerControls';
|
|
6
|
+
import { CornerControls, DragCornerControls, DragCornerControlsWithSelection } from './CornerControls';
|
|
7
|
+
import { FloatingControlsWithSelection } from './FloatingControlsWithSelection';
|
|
6
8
|
import NumberColumn from './NumberColumn';
|
|
7
9
|
import { DragControls, RowControls } from './RowControls';
|
|
8
10
|
export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
@@ -21,7 +23,8 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
21
23
|
isDragAndDropEnabled = _ref.isDragAndDropEnabled,
|
|
22
24
|
hoveredCell = _ref.hoveredCell,
|
|
23
25
|
isTableHovered = _ref.isTableHovered,
|
|
24
|
-
tableWrapperWidth = _ref.tableWrapperWidth
|
|
26
|
+
tableWrapperWidth = _ref.tableWrapperWidth,
|
|
27
|
+
api = _ref.api;
|
|
25
28
|
var _selectRow = useCallback(function (row, expand) {
|
|
26
29
|
var state = editorView.state,
|
|
27
30
|
dispatch = editorView.dispatch;
|
|
@@ -82,7 +85,13 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
82
85
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
83
86
|
stickyTop: stickyTop,
|
|
84
87
|
isDragAndDropEnabled: isDragAndDropEnabled
|
|
85
|
-
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
88
|
+
}) : null, tableActive && /*#__PURE__*/React.createElement(React.Fragment, null, isDragAndDropEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(DragCornerControlsWithSelection, {
|
|
89
|
+
editorView: editorView,
|
|
90
|
+
tableRef: tableRef,
|
|
91
|
+
isInDanger: isInDanger,
|
|
92
|
+
isResizing: isResizing,
|
|
93
|
+
api: api
|
|
94
|
+
}) : /*#__PURE__*/React.createElement(DragCornerControls, {
|
|
86
95
|
editorView: editorView,
|
|
87
96
|
tableRef: tableRef,
|
|
88
97
|
isInDanger: isInDanger,
|
|
@@ -101,7 +110,20 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
101
110
|
selectRow: _selectRow,
|
|
102
111
|
selectRows: _selectRows,
|
|
103
112
|
updateCellHoverLocation: updateCellHoverLocation
|
|
104
|
-
})) :
|
|
113
|
+
})) : getBooleanFF('platform.editor.table.use-shared-state-hook') ? /*#__PURE__*/React.createElement(FloatingControlsWithSelection, {
|
|
114
|
+
editorView: editorView,
|
|
115
|
+
tableRef: tableRef,
|
|
116
|
+
isInDanger: isInDanger,
|
|
117
|
+
isResizing: isResizing,
|
|
118
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
119
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
120
|
+
hoveredRows: hoveredRows,
|
|
121
|
+
stickyTop: tableActive ? stickyTop : undefined,
|
|
122
|
+
tableActive: tableActive,
|
|
123
|
+
hoverRows: _hoverRows,
|
|
124
|
+
selectRow: _selectRow,
|
|
125
|
+
api: api
|
|
126
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
105
127
|
editorView: editorView,
|
|
106
128
|
tableRef: tableRef,
|
|
107
129
|
isInDanger: isInDanger,
|