@atlaskit/editor-plugin-table 10.9.3 → 10.9.5
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/nodeviews/TableComponentWithSharedState.js +72 -19
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -2
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -5
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +11 -2
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -1
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +11 -2
- package/dist/cjs/ui/icons/SortingIconWrapper.js +12 -2
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +72 -20
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -2
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -5
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +11 -2
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -1
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +11 -2
- package/dist/es2019/ui/icons/SortingIconWrapper.js +12 -2
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +72 -19
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +12 -2
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -5
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +11 -2
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -1
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +11 -2
- package/dist/esm/ui/icons/SortingIconWrapper.js +12 -2
- package/package.json +1 -1
- package/src/nodeviews/TableComponentWithSharedState.tsx +127 -21
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +15 -5
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +16 -5
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +13 -2
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +4 -4
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +13 -2
- package/src/ui/icons/SortingIconWrapper.tsx +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.9.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#145710](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145710)
|
|
8
|
+
[`0cccd72c0228f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0cccd72c0228f) -
|
|
9
|
+
ED-27559 Enable useSharedPluginStateSelector in Table
|
|
10
|
+
|
|
11
|
+
## 10.9.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#145762](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145762)
|
|
16
|
+
[`e6f1c6c538e39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e6f1c6c538e39) -
|
|
17
|
+
Enable useSharedPluginStateSelector in Table
|
|
18
|
+
|
|
3
19
|
## 10.9.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -7,11 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TableComponentWithSharedState = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
11
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
13
|
var _TableComponent = _interopRequireDefault(require("./TableComponent"));
|
|
12
14
|
// Ignored via go/ees005
|
|
13
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
16
|
|
|
17
|
+
var useSharedTablePluginStateSelector = function useSharedTablePluginStateSelector(api, key) {
|
|
18
|
+
var value = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, "table.".concat(key), {
|
|
19
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
20
|
+
});
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
17
26
|
*/
|
|
@@ -29,27 +38,68 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
29
38
|
forwardRef = _ref.forwardRef,
|
|
30
39
|
allowTableAlignment = _ref.allowTableAlignment,
|
|
31
40
|
allowTableResizing = _ref.allowTableResizing;
|
|
32
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode']
|
|
41
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode'], {
|
|
42
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
43
|
+
}),
|
|
33
44
|
widthState = _useSharedPluginState.widthState,
|
|
34
45
|
tableState = _useSharedPluginState.tableState,
|
|
35
46
|
mediaState = _useSharedPluginState.mediaState,
|
|
36
47
|
selectionState = _useSharedPluginState.selectionState,
|
|
37
48
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
38
|
-
var
|
|
39
|
-
|
|
49
|
+
var isTableResizingSelector = useSharedTablePluginStateSelector(api, 'isTableResizing');
|
|
50
|
+
var isHeaderColumnEnabledSelector = useSharedTablePluginStateSelector(api, 'isHeaderColumnEnabled');
|
|
51
|
+
var isHeaderRowEnabledSelector = useSharedTablePluginStateSelector(api, 'isHeaderRowEnabled');
|
|
52
|
+
var orderingSelector = useSharedTablePluginStateSelector(api, 'ordering');
|
|
53
|
+
var isResizingSelector = useSharedTablePluginStateSelector(api, 'isResizing');
|
|
54
|
+
var isInDangerSelector = useSharedTablePluginStateSelector(api, 'isInDanger');
|
|
55
|
+
var hoveredCellSelector = useSharedTablePluginStateSelector(api, 'hoveredCell');
|
|
56
|
+
var hoveredRowsSelector = useSharedTablePluginStateSelector(api, 'hoveredRows');
|
|
57
|
+
var isTableHoveredSelector = useSharedTablePluginStateSelector(api, 'isTableHovered');
|
|
58
|
+
var isWholeTableInDangerSelector = useSharedTablePluginStateSelector(api, 'isWholeTableInDanger');
|
|
59
|
+
|
|
60
|
+
// mediaState
|
|
61
|
+
var isFullscreenSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen', {
|
|
62
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
63
|
+
});
|
|
64
|
+
var isFullscreen = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isFullscreenSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen;
|
|
65
|
+
|
|
66
|
+
// selectionState
|
|
67
|
+
var selectionSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
68
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
69
|
+
});
|
|
70
|
+
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
71
|
+
|
|
72
|
+
// editorViewModeState
|
|
73
|
+
var editorViewModeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
|
|
74
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
75
|
+
});
|
|
76
|
+
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? editorViewModeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
77
|
+
var isLivePageViewMode = mode === 'view';
|
|
78
|
+
|
|
79
|
+
// widthState
|
|
80
|
+
var widthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width', {
|
|
81
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
82
|
+
});
|
|
83
|
+
var width = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.width;
|
|
84
|
+
var lineLengthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength', {
|
|
85
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
86
|
+
});
|
|
87
|
+
var lineLength = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? lineLengthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.lineLength;
|
|
88
|
+
if ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false) && !tableState) {
|
|
40
89
|
return null;
|
|
41
90
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
91
|
+
|
|
92
|
+
// tableState
|
|
93
|
+
var isTableResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableResizingSelector : tableState.isTableResizing;
|
|
94
|
+
var isHeaderColumnEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderColumnEnabledSelector : tableState.isHeaderColumnEnabled;
|
|
95
|
+
var isHeaderRowEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderRowEnabledSelector : tableState.isHeaderRowEnabled;
|
|
96
|
+
var ordering = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? orderingSelector : tableState.ordering;
|
|
97
|
+
var isResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isResizingSelector : tableState.isResizing;
|
|
98
|
+
var isInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isInDangerSelector : tableState.isInDanger;
|
|
99
|
+
var hoveredCell = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredCellSelector : tableState.hoveredCell;
|
|
100
|
+
var hoveredRows = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState.hoveredRows;
|
|
101
|
+
var isTableHovered = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableHoveredSelector : tableState.isTableHovered;
|
|
102
|
+
var isWholeTableInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isWholeTableInDangerSelector : tableState.isWholeTableInDanger;
|
|
53
103
|
|
|
54
104
|
/**
|
|
55
105
|
* ED-19810
|
|
@@ -70,7 +120,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
70
120
|
allowColumnResizing: allowColumnResizing,
|
|
71
121
|
eventDispatcher: eventDispatcher,
|
|
72
122
|
getPos: getPos,
|
|
73
|
-
isMediaFullscreen:
|
|
123
|
+
isMediaFullscreen: isFullscreen,
|
|
74
124
|
options: options,
|
|
75
125
|
allowControls: allowControls,
|
|
76
126
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
@@ -82,11 +132,14 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
82
132
|
tableActive: tableActive && !isLivePageViewMode,
|
|
83
133
|
ordering: ordering,
|
|
84
134
|
isResizing: isResizing,
|
|
85
|
-
getNode: getNode
|
|
135
|
+
getNode: getNode,
|
|
136
|
+
containerWidth: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? {
|
|
137
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
138
|
+
lineLength: lineLength
|
|
139
|
+
} :
|
|
86
140
|
// Ignored via go/ees005
|
|
87
141
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
88
|
-
,
|
|
89
|
-
containerWidth: widthState,
|
|
142
|
+
widthState,
|
|
90
143
|
contentDOM: forwardRef,
|
|
91
144
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
92
145
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -96,6 +149,6 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
96
149
|
hoveredCell: hoveredCell,
|
|
97
150
|
isTableHovered: isTableHovered,
|
|
98
151
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
99
|
-
selection:
|
|
152
|
+
selection: selection
|
|
100
153
|
});
|
|
101
154
|
};
|
|
@@ -8,10 +8,12 @@ exports.ColumnControls = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
13
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
17
|
var _commands = require("../../../pm-plugins/commands");
|
|
16
18
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
17
19
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
@@ -50,8 +52,16 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
50
52
|
getScrollOffset = _ref.getScrollOffset,
|
|
51
53
|
api = _ref.api;
|
|
52
54
|
var columnControlsRef = (0, _react.useRef)(null);
|
|
53
|
-
|
|
55
|
+
|
|
56
|
+
// selection
|
|
57
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
58
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
59
|
+
}),
|
|
54
60
|
selectionState = _useSharedPluginState.selectionState;
|
|
61
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
62
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
63
|
+
});
|
|
64
|
+
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
55
65
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
56
66
|
return (
|
|
57
67
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
@@ -62,7 +72,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
62
72
|
// TODO: ED-26961 - reusing getRowsParams here because it's generic enough to work for columns -> rename
|
|
63
73
|
var columnParams = (0, _rowControls.getRowsParams)(colWidths !== null && colWidths !== void 0 ? colWidths : []);
|
|
64
74
|
var colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
|
|
65
|
-
var selectedColIndexes = getSelectedColumns(
|
|
75
|
+
var selectedColIndexes = getSelectedColumns(selection || editorView.state.selection);
|
|
66
76
|
var firstRow = tableRef.querySelector('tr');
|
|
67
77
|
var hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
68
78
|
var rowControlStickyTop = 45;
|
|
@@ -11,7 +11,9 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _reactIntlNext = require("react-intl-next");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
15
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
16
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
17
|
var _commands = require("../../../pm-plugins/commands");
|
|
16
18
|
var _types = require("../../../types");
|
|
17
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -65,8 +67,15 @@ var DragCornerControlsComponentWithSelection = function DragCornerControlsCompon
|
|
|
65
67
|
isResizing = _ref2.isResizing,
|
|
66
68
|
formatMessage = _ref2.intl.formatMessage,
|
|
67
69
|
api = _ref2.api;
|
|
68
|
-
|
|
70
|
+
// selection
|
|
71
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
72
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
73
|
+
}),
|
|
69
74
|
selectionState = _useSharedPluginState.selectionState;
|
|
75
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
76
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
77
|
+
});
|
|
78
|
+
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
70
79
|
var handleOnClick = function handleOnClick() {
|
|
71
80
|
var state = editorView.state,
|
|
72
81
|
dispatch = editorView.dispatch;
|
|
@@ -78,15 +87,15 @@ var DragCornerControlsComponentWithSelection = function DragCornerControlsCompon
|
|
|
78
87
|
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
79
88
|
};
|
|
80
89
|
var isActive = (0, _react.useMemo)(function () {
|
|
81
|
-
if (!
|
|
90
|
+
if (!selection) {
|
|
82
91
|
return;
|
|
83
92
|
}
|
|
84
|
-
var table = (0, _utils.findTable)(
|
|
93
|
+
var table = (0, _utils.findTable)(selection);
|
|
85
94
|
if (!table) {
|
|
86
95
|
return false;
|
|
87
96
|
}
|
|
88
|
-
return (0, _utils.isTableSelected)(
|
|
89
|
-
}, [
|
|
97
|
+
return (0, _utils.isTableSelected)(selection);
|
|
98
|
+
}, [selection]);
|
|
90
99
|
if (isResizing) {
|
|
91
100
|
return null;
|
|
92
101
|
}
|
|
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.FloatingControlsWithSelection = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
12
|
var _ClassicCornerControls = require("./CornerControls/ClassicCornerControls");
|
|
11
13
|
var _ClassicControls = require("./RowControls/ClassicControls");
|
|
12
14
|
var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = function FloatingControlsWithSelection(_ref) {
|
|
@@ -22,8 +24,15 @@ var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = func
|
|
|
22
24
|
selectRow = _ref.selectRow,
|
|
23
25
|
tableActive = _ref.tableActive,
|
|
24
26
|
api = _ref.api;
|
|
25
|
-
|
|
27
|
+
// selection
|
|
28
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
29
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
30
|
+
}),
|
|
26
31
|
selectionState = _useSharedPluginState.selectionState;
|
|
32
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
33
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
34
|
+
});
|
|
35
|
+
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
27
36
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClassicCornerControls.CornerControls, {
|
|
28
37
|
editorView: editorView,
|
|
29
38
|
tableRef: tableRef,
|
|
@@ -34,7 +43,7 @@ var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = func
|
|
|
34
43
|
hoveredRows: hoveredRows,
|
|
35
44
|
stickyTop: tableActive ? stickyTop : undefined
|
|
36
45
|
}), /*#__PURE__*/_react.default.createElement(_ClassicControls.RowControls, {
|
|
37
|
-
selection:
|
|
46
|
+
selection: selection,
|
|
38
47
|
editorView: editorView,
|
|
39
48
|
tableRef: tableRef,
|
|
40
49
|
hoverRows: hoverRows,
|
|
@@ -148,7 +148,7 @@ var NumberColumn = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
148
148
|
}
|
|
149
149
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1) :
|
|
150
150
|
/*#__PURE__*/
|
|
151
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
151
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
152
152
|
_react.default.createElement("div", {
|
|
153
153
|
// Ignored via go/ees005
|
|
154
154
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -9,10 +9,12 @@ exports.DragControlsWithSelection = exports.DragControls = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
13
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
14
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
17
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
18
|
var _commands = require("../../../pm-plugins/commands");
|
|
17
19
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
18
20
|
var _pluginFactory = require("../../../pm-plugins/plugin-factory");
|
|
@@ -302,8 +304,15 @@ var DragControlsWithSelection = exports.DragControlsWithSelection = function Dra
|
|
|
302
304
|
selectRows = _ref5.selectRows,
|
|
303
305
|
updateCellHoverLocation = _ref5.updateCellHoverLocation,
|
|
304
306
|
api = _ref5.api;
|
|
305
|
-
|
|
307
|
+
// selection
|
|
308
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
309
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
310
|
+
}),
|
|
306
311
|
selectionState = _useSharedPluginState.selectionState;
|
|
312
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
313
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
314
|
+
});
|
|
315
|
+
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
307
316
|
return /*#__PURE__*/_react.default.createElement(DragControls, {
|
|
308
317
|
editorView: editorView,
|
|
309
318
|
tableRef: tableRef,
|
|
@@ -319,6 +328,6 @@ var DragControlsWithSelection = exports.DragControlsWithSelection = function Dra
|
|
|
319
328
|
selectRows: selectRows,
|
|
320
329
|
updateCellHoverLocation: updateCellHoverLocation,
|
|
321
330
|
api: api,
|
|
322
|
-
selection:
|
|
331
|
+
selection: selection
|
|
323
332
|
});
|
|
324
333
|
};
|
|
@@ -8,10 +8,20 @@ exports.SortingIconWrapper = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _table = require("@atlaskit/editor-common/table");
|
|
11
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
13
|
var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
|
|
12
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(props.api, ['editorViewMode']
|
|
14
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(props.api, ['editorViewMode'], {
|
|
15
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
16
|
+
}),
|
|
13
17
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
14
|
-
|
|
18
|
+
|
|
19
|
+
// mode
|
|
20
|
+
var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(props.api, 'editorViewMode.mode', {
|
|
21
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
22
|
+
});
|
|
23
|
+
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
24
|
+
if (mode === 'edit') {
|
|
15
25
|
return null;
|
|
16
26
|
}
|
|
17
27
|
// Ignored via go/ees005
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
3
4
|
import { findTable } from '@atlaskit/editor-tables';
|
|
5
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
6
|
import TableComponent from './TableComponent';
|
|
5
7
|
|
|
6
8
|
// Ignored via go/ees005
|
|
7
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
|
|
11
|
+
const useSharedTablePluginStateSelector = (api, key) => {
|
|
12
|
+
const value = useSharedPluginStateSelector(api, `table.${key}`, {
|
|
13
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
14
|
+
});
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
11
20
|
*/
|
|
@@ -30,23 +39,63 @@ export const TableComponentWithSharedState = ({
|
|
|
30
39
|
mediaState,
|
|
31
40
|
selectionState,
|
|
32
41
|
editorViewModeState
|
|
33
|
-
} = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode']
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
} = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode'], {
|
|
43
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
44
|
+
});
|
|
45
|
+
const isTableResizingSelector = useSharedTablePluginStateSelector(api, 'isTableResizing');
|
|
46
|
+
const isHeaderColumnEnabledSelector = useSharedTablePluginStateSelector(api, 'isHeaderColumnEnabled');
|
|
47
|
+
const isHeaderRowEnabledSelector = useSharedTablePluginStateSelector(api, 'isHeaderRowEnabled');
|
|
48
|
+
const orderingSelector = useSharedTablePluginStateSelector(api, 'ordering');
|
|
49
|
+
const isResizingSelector = useSharedTablePluginStateSelector(api, 'isResizing');
|
|
50
|
+
const isInDangerSelector = useSharedTablePluginStateSelector(api, 'isInDanger');
|
|
51
|
+
const hoveredCellSelector = useSharedTablePluginStateSelector(api, 'hoveredCell');
|
|
52
|
+
const hoveredRowsSelector = useSharedTablePluginStateSelector(api, 'hoveredRows');
|
|
53
|
+
const isTableHoveredSelector = useSharedTablePluginStateSelector(api, 'isTableHovered');
|
|
54
|
+
const isWholeTableInDangerSelector = useSharedTablePluginStateSelector(api, 'isWholeTableInDanger');
|
|
55
|
+
|
|
56
|
+
// mediaState
|
|
57
|
+
const isFullscreenSelector = useSharedPluginStateSelector(api, 'media.isFullscreen', {
|
|
58
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
59
|
+
});
|
|
60
|
+
const isFullscreen = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isFullscreenSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen;
|
|
61
|
+
|
|
62
|
+
// selectionState
|
|
63
|
+
const selectionSelector = useSharedPluginStateSelector(api, 'selection.selection', {
|
|
64
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
65
|
+
});
|
|
66
|
+
const selection = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectionSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
67
|
+
|
|
68
|
+
// editorViewModeState
|
|
69
|
+
const editorViewModeSelector = useSharedPluginStateSelector(api, 'editorViewMode.mode', {
|
|
70
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
71
|
+
});
|
|
72
|
+
const mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? editorViewModeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
73
|
+
const isLivePageViewMode = mode === 'view';
|
|
74
|
+
|
|
75
|
+
// widthState
|
|
76
|
+
const widthSelector = useSharedPluginStateSelector(api, 'width.width', {
|
|
77
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
78
|
+
});
|
|
79
|
+
const width = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? widthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.width;
|
|
80
|
+
const lineLengthSelector = useSharedPluginStateSelector(api, 'width.lineLength', {
|
|
81
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
82
|
+
});
|
|
83
|
+
const lineLength = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? lineLengthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.lineLength;
|
|
84
|
+
if (editorExperiment('platform_editor_usesharedpluginstateselector', false) && !tableState) {
|
|
36
85
|
return null;
|
|
37
86
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
87
|
+
|
|
88
|
+
// tableState
|
|
89
|
+
const isTableResizing = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableResizingSelector : tableState.isTableResizing;
|
|
90
|
+
const isHeaderColumnEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isHeaderColumnEnabledSelector : tableState.isHeaderColumnEnabled;
|
|
91
|
+
const isHeaderRowEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isHeaderRowEnabledSelector : tableState.isHeaderRowEnabled;
|
|
92
|
+
const ordering = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? orderingSelector : tableState.ordering;
|
|
93
|
+
const isResizing = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isResizingSelector : tableState.isResizing;
|
|
94
|
+
const isInDanger = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isInDangerSelector : tableState.isInDanger;
|
|
95
|
+
const hoveredCell = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredCellSelector : tableState.hoveredCell;
|
|
96
|
+
const hoveredRows = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState.hoveredRows;
|
|
97
|
+
const isTableHovered = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableHoveredSelector : tableState.isTableHovered;
|
|
98
|
+
const isWholeTableInDanger = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isWholeTableInDangerSelector : tableState.isWholeTableInDanger;
|
|
50
99
|
|
|
51
100
|
/**
|
|
52
101
|
* ED-19810
|
|
@@ -67,7 +116,7 @@ export const TableComponentWithSharedState = ({
|
|
|
67
116
|
allowColumnResizing: allowColumnResizing,
|
|
68
117
|
eventDispatcher: eventDispatcher,
|
|
69
118
|
getPos: getPos,
|
|
70
|
-
isMediaFullscreen:
|
|
119
|
+
isMediaFullscreen: isFullscreen,
|
|
71
120
|
options: options,
|
|
72
121
|
allowControls: allowControls,
|
|
73
122
|
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
@@ -79,11 +128,14 @@ export const TableComponentWithSharedState = ({
|
|
|
79
128
|
tableActive: tableActive && !isLivePageViewMode,
|
|
80
129
|
ordering: ordering,
|
|
81
130
|
isResizing: isResizing,
|
|
82
|
-
getNode: getNode
|
|
131
|
+
getNode: getNode,
|
|
132
|
+
containerWidth: editorExperiment('platform_editor_usesharedpluginstateselector', true) ? {
|
|
133
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
134
|
+
lineLength
|
|
135
|
+
} :
|
|
83
136
|
// Ignored via go/ees005
|
|
84
137
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
85
|
-
,
|
|
86
|
-
containerWidth: widthState,
|
|
138
|
+
widthState,
|
|
87
139
|
contentDOM: forwardRef,
|
|
88
140
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
89
141
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -93,6 +145,6 @@ export const TableComponentWithSharedState = ({
|
|
|
93
145
|
hoveredCell: hoveredCell,
|
|
94
146
|
isTableHovered: isTableHovered,
|
|
95
147
|
isWholeTableInDanger: isWholeTableInDanger,
|
|
96
|
-
selection:
|
|
148
|
+
selection: selection
|
|
97
149
|
});
|
|
98
150
|
};
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
7
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
8
9
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
12
|
import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
|
|
11
13
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
12
14
|
import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
|
|
@@ -42,9 +44,17 @@ export const ColumnControls = ({
|
|
|
42
44
|
}) => {
|
|
43
45
|
var _colWidths$map$join;
|
|
44
46
|
const columnControlsRef = useRef(null);
|
|
47
|
+
|
|
48
|
+
// selection
|
|
45
49
|
const {
|
|
46
50
|
selectionState
|
|
47
|
-
} = useSharedPluginState(api, ['selection']
|
|
51
|
+
} = useSharedPluginState(api, ['selection'], {
|
|
52
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
53
|
+
});
|
|
54
|
+
const selectionsSelector = useSharedPluginStateSelector(api, 'selection.selection', {
|
|
55
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
56
|
+
});
|
|
57
|
+
const selection = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
48
58
|
const widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(width =>
|
|
49
59
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
50
60
|
// we need to reduce the width by 1px to avoid misalignment of column controls.
|
|
@@ -52,7 +62,7 @@ export const ColumnControls = ({
|
|
|
52
62
|
// TODO: ED-26961 - reusing getRowsParams here because it's generic enough to work for columns -> rename
|
|
53
63
|
const columnParams = getRowsParams(colWidths !== null && colWidths !== void 0 ? colWidths : []);
|
|
54
64
|
const colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
|
|
55
|
-
const selectedColIndexes = getSelectedColumns(
|
|
65
|
+
const selectedColIndexes = getSelectedColumns(selection || editorView.state.selection);
|
|
56
66
|
const firstRow = tableRef.querySelector('tr');
|
|
57
67
|
const hasHeaderRow = firstRow ? firstRow.getAttribute('data-header-row') : false;
|
|
58
68
|
const rowControlStickyTop = 45;
|
|
@@ -3,7 +3,9 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
7
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
8
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
9
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
8
10
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
9
11
|
const DragCornerControlsComponent = ({
|
|
@@ -67,9 +69,16 @@ const DragCornerControlsComponentWithSelection = ({
|
|
|
67
69
|
},
|
|
68
70
|
api
|
|
69
71
|
}) => {
|
|
72
|
+
// selection
|
|
70
73
|
const {
|
|
71
74
|
selectionState
|
|
72
|
-
} = useSharedPluginState(api, ['selection']
|
|
75
|
+
} = useSharedPluginState(api, ['selection'], {
|
|
76
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
77
|
+
});
|
|
78
|
+
const selectionsSelector = useSharedPluginStateSelector(api, 'selection.selection', {
|
|
79
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
80
|
+
});
|
|
81
|
+
const selection = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
73
82
|
const handleOnClick = () => {
|
|
74
83
|
const {
|
|
75
84
|
state,
|
|
@@ -85,15 +94,15 @@ const DragCornerControlsComponentWithSelection = ({
|
|
|
85
94
|
clearHoverSelection()(state, dispatch);
|
|
86
95
|
};
|
|
87
96
|
const isActive = useMemo(() => {
|
|
88
|
-
if (!
|
|
97
|
+
if (!selection) {
|
|
89
98
|
return;
|
|
90
99
|
}
|
|
91
|
-
const table = findTable(
|
|
100
|
+
const table = findTable(selection);
|
|
92
101
|
if (!table) {
|
|
93
102
|
return false;
|
|
94
103
|
}
|
|
95
|
-
return isTableSelected(
|
|
96
|
-
}, [
|
|
104
|
+
return isTableSelected(selection);
|
|
105
|
+
}, [selection]);
|
|
97
106
|
if (isResizing) {
|
|
98
107
|
return null;
|
|
99
108
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
5
|
import { CornerControls } from './CornerControls/ClassicCornerControls';
|
|
4
6
|
import { RowControls } from './RowControls/ClassicControls';
|
|
5
7
|
export const FloatingControlsWithSelection = ({
|
|
@@ -16,9 +18,16 @@ export const FloatingControlsWithSelection = ({
|
|
|
16
18
|
tableActive,
|
|
17
19
|
api
|
|
18
20
|
}) => {
|
|
21
|
+
// selection
|
|
19
22
|
const {
|
|
20
23
|
selectionState
|
|
21
|
-
} = useSharedPluginState(api, ['selection']
|
|
24
|
+
} = useSharedPluginState(api, ['selection'], {
|
|
25
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
26
|
+
});
|
|
27
|
+
const selectionsSelector = useSharedPluginStateSelector(api, 'selection.selection', {
|
|
28
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
29
|
+
});
|
|
30
|
+
const selection = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
22
31
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
|
|
23
32
|
editorView: editorView,
|
|
24
33
|
tableRef: tableRef,
|
|
@@ -29,7 +38,7 @@ export const FloatingControlsWithSelection = ({
|
|
|
29
38
|
hoveredRows: hoveredRows,
|
|
30
39
|
stickyTop: tableActive ? stickyTop : undefined
|
|
31
40
|
}), /*#__PURE__*/React.createElement(RowControls, {
|
|
32
|
-
selection:
|
|
41
|
+
selection: selection,
|
|
33
42
|
editorView: editorView,
|
|
34
43
|
tableRef: tableRef,
|
|
35
44
|
hoverRows: hoverRows,
|
|
@@ -133,7 +133,7 @@ export default class NumberColumn extends Component {
|
|
|
133
133
|
onMouseOver: () => updateCellHoverLocation(index)
|
|
134
134
|
}, hasHeaderRow ? index > 0 ? index : null : index + 1) :
|
|
135
135
|
/*#__PURE__*/
|
|
136
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
136
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions, @atlassian/a11y/interactive-element-not-keyboard-focusable
|
|
137
137
|
React.createElement("div", {
|
|
138
138
|
// Ignored via go/ees005
|
|
139
139
|
// eslint-disable-next-line react/no-array-index-key
|