@atlaskit/editor-plugin-table 10.9.20 → 10.9.22
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 +21 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +91 -78
- package/dist/cjs/nodeviews/TableContainer.js +41 -37
- package/dist/cjs/nodeviews/TableResizer.js +15 -11
- package/dist/cjs/pm-plugins/main.js +4 -12
- package/dist/cjs/tablePlugin.js +22 -12
- package/dist/cjs/ui/ContentComponent.js +40 -65
- package/dist/cjs/ui/DragHandle/index.js +19 -17
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +14 -11
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -10
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +14 -10
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -10
- package/dist/cjs/ui/global-styles.js +14 -10
- package/dist/cjs/ui/icons/SortingIconWrapper.js +14 -11
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +92 -78
- package/dist/es2019/nodeviews/TableContainer.js +44 -39
- package/dist/es2019/nodeviews/TableResizer.js +17 -12
- package/dist/es2019/pm-plugins/main.js +4 -12
- package/dist/es2019/tablePlugin.js +24 -13
- package/dist/es2019/ui/ContentComponent.js +41 -66
- package/dist/es2019/ui/DragHandle/index.js +21 -18
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -12
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +16 -11
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +16 -11
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -11
- package/dist/es2019/ui/global-styles.js +16 -11
- package/dist/es2019/ui/icons/SortingIconWrapper.js +16 -12
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +92 -79
- package/dist/esm/nodeviews/TableContainer.js +42 -38
- package/dist/esm/nodeviews/TableResizer.js +16 -12
- package/dist/esm/pm-plugins/main.js +4 -12
- package/dist/esm/tablePlugin.js +23 -13
- package/dist/esm/ui/ContentComponent.js +41 -66
- package/dist/esm/ui/DragHandle/index.js +20 -18
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +15 -12
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +15 -11
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +15 -11
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +15 -11
- package/dist/esm/ui/global-styles.js +15 -11
- package/dist/esm/ui/icons/SortingIconWrapper.js +15 -12
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/ui/ContentComponent.d.ts +2 -1
- package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/ContentComponent.d.ts +2 -1
- package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/package.json +4 -7
- package/src/nodeviews/TableComponentWithSharedState.tsx +97 -125
- package/src/nodeviews/TableContainer.tsx +59 -67
- package/src/nodeviews/TableResizer.tsx +21 -17
- package/src/pm-plugins/main.ts +5 -13
- package/src/tablePlugin.tsx +30 -13
- package/src/types/index.ts +2 -0
- package/src/ui/ContentComponent.tsx +59 -65
- package/src/ui/DragHandle/index.tsx +24 -24
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +20 -13
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +20 -12
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +20 -13
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +20 -13
- package/src/ui/global-styles.tsx +20 -13
- package/src/ui/icons/SortingIconWrapper.tsx +20 -14
|
@@ -8,6 +8,8 @@ exports.ContentComponent = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
11
|
+
var _getDomRefFromSelection = require("@atlaskit/editor-common/get-dom-ref-from-selection");
|
|
12
|
+
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
11
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
14
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
15
|
var _FloatingContextualButton = _interopRequireDefault(require("./FloatingContextualButton"));
|
|
@@ -18,12 +20,13 @@ var _FloatingInsertButton = _interopRequireDefault(require("./FloatingInsertButt
|
|
|
18
20
|
var _FloatingToolbarLabel = require("./FloatingToolbarLabel/FloatingToolbarLabel");
|
|
19
21
|
var _globalStyles = require("./global-styles");
|
|
20
22
|
var _useInternalTablePluginStateSelector = require("./hooks/useInternalTablePluginStateSelector");
|
|
23
|
+
var _SizeSelector = require("./SizeSelector");
|
|
21
24
|
var _TableFullWidthLabel = require("./TableFullWidthLabel");
|
|
22
25
|
// Ignored via go/ees005
|
|
23
26
|
// eslint-disable-next-line import/no-named-as-default
|
|
24
27
|
|
|
25
28
|
var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
26
|
-
var _api$analytics, _api$accessibilityUti;
|
|
29
|
+
var _api$analytics, _api$accessibilityUti, _api$analytics2;
|
|
27
30
|
var api = _ref.api,
|
|
28
31
|
editorView = _ref.editorView,
|
|
29
32
|
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
@@ -31,75 +34,36 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
31
34
|
popupsMountPoint = _ref.popupsMountPoint,
|
|
32
35
|
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
33
36
|
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
37
|
+
isTableSelectorEnabled = _ref.isTableSelectorEnabled,
|
|
34
38
|
defaultGetEditorContainerWidth = _ref.defaultGetEditorContainerWidth,
|
|
35
39
|
defaultGetEditorFeatureFlags = _ref.defaultGetEditorFeatureFlags;
|
|
36
40
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
37
41
|
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
38
|
-
var resizingTableLocalId = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableLocalId'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
var targetCellPosition = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'targetCellPosition', {
|
|
57
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
58
|
-
});
|
|
59
|
-
var isContextualMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isContextualMenuOpen', {
|
|
60
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
61
|
-
});
|
|
62
|
-
var tableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableRef', {
|
|
63
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
64
|
-
});
|
|
65
|
-
var pluginConfig = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'pluginConfig', {
|
|
66
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
67
|
-
});
|
|
68
|
-
var insertColumnButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertColumnButtonIndex', {
|
|
69
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
70
|
-
});
|
|
71
|
-
var insertRowButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertRowButtonIndex', {
|
|
72
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
73
|
-
});
|
|
74
|
-
var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled', {
|
|
75
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
76
|
-
});
|
|
77
|
-
var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled', {
|
|
78
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
79
|
-
});
|
|
80
|
-
var isDragAndDropEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragAndDropEnabled', {
|
|
81
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
82
|
-
});
|
|
83
|
-
var tableWrapperTarget = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableWrapperTarget', {
|
|
84
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
85
|
-
});
|
|
86
|
-
var isCellMenuOpenByKeyboard = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isCellMenuOpenByKeyboard', {
|
|
87
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
88
|
-
});
|
|
42
|
+
var resizingTableLocalId = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableLocalId');
|
|
43
|
+
var resizingTableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableRef');
|
|
44
|
+
var isTableResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableResizing');
|
|
45
|
+
var isResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing');
|
|
46
|
+
var widthToWidest = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'widthToWidest');
|
|
47
|
+
var tableNode = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableNode');
|
|
48
|
+
var targetCellPosition = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'targetCellPosition');
|
|
49
|
+
var isContextualMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isContextualMenuOpen');
|
|
50
|
+
var tableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableRef');
|
|
51
|
+
var pluginConfig = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'pluginConfig');
|
|
52
|
+
var insertColumnButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertColumnButtonIndex');
|
|
53
|
+
var insertRowButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertRowButtonIndex');
|
|
54
|
+
var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled');
|
|
55
|
+
var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled');
|
|
56
|
+
var isDragAndDropEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragAndDropEnabled');
|
|
57
|
+
var tableWrapperTarget = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableWrapperTarget');
|
|
58
|
+
var isCellMenuOpenByKeyboard = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isCellMenuOpenByKeyboard');
|
|
89
59
|
var _ref2 = pluginConfig !== null && pluginConfig !== void 0 ? pluginConfig : {},
|
|
90
60
|
allowControls = _ref2.allowControls;
|
|
91
|
-
var stickyHeader = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'stickyHeader'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var dragMenuIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuIndex', {
|
|
98
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
99
|
-
});
|
|
100
|
-
var isDragMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragMenuOpen', {
|
|
101
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
102
|
-
});
|
|
61
|
+
var stickyHeader = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'stickyHeader');
|
|
62
|
+
var dragMenuDirection = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuDirection');
|
|
63
|
+
var dragMenuIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuIndex');
|
|
64
|
+
var isDragMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragMenuOpen');
|
|
65
|
+
var isSizeSelectorOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isSizeSelectorOpen');
|
|
66
|
+
var sizeSelectorTargetRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'sizeSelectorTargetRef');
|
|
103
67
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
104
68
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
105
69
|
editorView: editorView,
|
|
@@ -178,13 +142,22 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
178
142
|
api: api
|
|
179
143
|
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/_react.default.createElement(_FloatingToolbarLabel.FloatingToolbarLabel, {
|
|
180
144
|
target: resizingTableRef,
|
|
181
|
-
content: /*#__PURE__*/_react.default.createElement(
|
|
145
|
+
content: (0, _experiments.editorExperiment)('single_column_layouts', true) ? /*#__PURE__*/_react.default.createElement(_resizer.ResizerBreakoutModeLabel, {
|
|
146
|
+
layout: "full-width"
|
|
147
|
+
}) : /*#__PURE__*/_react.default.createElement(_TableFullWidthLabel.FullWidthDisplay, null),
|
|
182
148
|
alignX: 'center',
|
|
183
149
|
alignY: 'bottom',
|
|
184
150
|
stick: true,
|
|
185
151
|
forcePlacement: true,
|
|
186
152
|
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex,
|
|
187
153
|
offset: [0, 10]
|
|
154
|
+
}), isTableSelectorEnabled && isSizeSelectorOpen && /*#__PURE__*/_react.default.createElement(_SizeSelector.SizeSelector, {
|
|
155
|
+
api: api,
|
|
156
|
+
isOpenedByKeyboard: false,
|
|
157
|
+
popupsMountPoint: popupsMountPoint,
|
|
158
|
+
target: sizeSelectorTargetRef !== null && sizeSelectorTargetRef !== void 0 ? sizeSelectorTargetRef : (0, _getDomRefFromSelection.getDomRefFromSelection)(editorView, _analytics.ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions),
|
|
159
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
160
|
+
popupsScrollableElement: popupsScrollableElement
|
|
188
161
|
}));
|
|
189
162
|
};
|
|
190
163
|
var ContentComponent = exports.ContentComponent = function ContentComponent(_ref3) {
|
|
@@ -196,6 +169,7 @@ var ContentComponent = exports.ContentComponent = function ContentComponent(_ref
|
|
|
196
169
|
popupsMountPoint = _ref3.popupsMountPoint,
|
|
197
170
|
popupsBoundariesElement = _ref3.popupsBoundariesElement,
|
|
198
171
|
popupsScrollableElement = _ref3.popupsScrollableElement,
|
|
172
|
+
isTableSelectorEnabled = _ref3.isTableSelectorEnabled,
|
|
199
173
|
defaultGetEditorContainerWidth = _ref3.defaultGetEditorContainerWidth,
|
|
200
174
|
defaultGetEditorFeatureFlags = _ref3.defaultGetEditorFeatureFlags;
|
|
201
175
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
@@ -214,6 +188,7 @@ var ContentComponent = exports.ContentComponent = function ContentComponent(_ref
|
|
|
214
188
|
popupsMountPoint: popupsMountPoint,
|
|
215
189
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
216
190
|
popupsScrollableElement: popupsScrollableElement,
|
|
191
|
+
isTableSelectorEnabled: isTableSelectorEnabled,
|
|
217
192
|
defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
218
193
|
defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags
|
|
219
194
|
}));
|
|
@@ -19,7 +19,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
19
19
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
20
20
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
21
21
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
22
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _pluginFactory = require("../../pm-plugins/drag-and-drop/plugin-factory");
|
|
24
23
|
var _pluginFactory2 = require("../../pm-plugins/plugin-factory");
|
|
25
24
|
var _mergedCells = require("../../pm-plugins/utils/merged-cells");
|
|
@@ -255,6 +254,22 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
255
254
|
height: previewHeight
|
|
256
255
|
}), previewContainer));
|
|
257
256
|
};
|
|
257
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
258
|
+
var hoveredColumns = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredColumns');
|
|
259
|
+
var hoveredRows = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows');
|
|
260
|
+
return {
|
|
261
|
+
hoveredColumns: hoveredColumns,
|
|
262
|
+
hoveredRows: hoveredRows
|
|
263
|
+
};
|
|
264
|
+
}, function (api) {
|
|
265
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['table']),
|
|
266
|
+
tableState = _useSharedPluginState.tableState;
|
|
267
|
+
var tableStateInternal = tableState;
|
|
268
|
+
return {
|
|
269
|
+
hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
|
|
270
|
+
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
|
|
271
|
+
};
|
|
272
|
+
});
|
|
258
273
|
var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
|
|
259
274
|
var isDragMenuTarget = _ref5.isDragMenuTarget,
|
|
260
275
|
tableLocalId = _ref5.tableLocalId,
|
|
@@ -272,22 +287,9 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
|
|
|
272
287
|
editorView = _ref5.editorView,
|
|
273
288
|
intl = _ref5.intl,
|
|
274
289
|
api = _ref5.api;
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
tableState = _ref6.tableState;
|
|
279
|
-
|
|
280
|
-
// hoveredColumns
|
|
281
|
-
var hoveredColumnsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredColumns', {
|
|
282
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
283
|
-
});
|
|
284
|
-
var hoveredColumns = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredColumnsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns;
|
|
285
|
-
|
|
286
|
-
// hoveredRows
|
|
287
|
-
var hoveredRowsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows', {
|
|
288
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
289
|
-
});
|
|
290
|
-
var hoveredRows = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows;
|
|
290
|
+
var _useSharedState = useSharedState(api),
|
|
291
|
+
hoveredColumns = _useSharedState.hoveredColumns,
|
|
292
|
+
hoveredRows = _useSharedState.hoveredRows;
|
|
291
293
|
return /*#__PURE__*/_react.default.createElement(DragHandleComponent, {
|
|
292
294
|
isDragMenuTarget: isDragMenuTarget,
|
|
293
295
|
tableLocalId: tableLocalId,
|
|
@@ -13,7 +13,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
13
13
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _commands = require("../../../pm-plugins/commands");
|
|
18
17
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
19
18
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
@@ -34,6 +33,18 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
34
33
|
}
|
|
35
34
|
return [];
|
|
36
35
|
};
|
|
36
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
37
|
+
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
38
|
+
return {
|
|
39
|
+
selection: selection
|
|
40
|
+
};
|
|
41
|
+
}, function (api) {
|
|
42
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
43
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
44
|
+
return {
|
|
45
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
46
|
+
};
|
|
47
|
+
});
|
|
37
48
|
var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
38
49
|
var _colWidths$map$join;
|
|
39
50
|
var editorView = _ref.editorView,
|
|
@@ -52,16 +63,8 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
52
63
|
getScrollOffset = _ref.getScrollOffset,
|
|
53
64
|
api = _ref.api;
|
|
54
65
|
var columnControlsRef = (0, _react.useRef)(null);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
58
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
59
|
-
}),
|
|
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;
|
|
66
|
+
var _useSharedState = useSharedState(api),
|
|
67
|
+
selection = _useSharedState.selection;
|
|
65
68
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
66
69
|
return (
|
|
67
70
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|
|
@@ -13,7 +13,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
13
13
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
14
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
15
15
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _commands = require("../../../pm-plugins/commands");
|
|
18
17
|
var _types = require("../../../types");
|
|
19
18
|
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); }
|
|
@@ -61,21 +60,26 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
61
60
|
className: _types.TableCssClassName.DRAG_CORNER_BUTTON_INNER
|
|
62
61
|
}));
|
|
63
62
|
};
|
|
63
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
64
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
65
|
+
return {
|
|
66
|
+
selection: selectionsSelector
|
|
67
|
+
};
|
|
68
|
+
}, function (api) {
|
|
69
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
70
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
71
|
+
return {
|
|
72
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
73
|
+
};
|
|
74
|
+
});
|
|
64
75
|
var DragCornerControlsComponentWithSelection = function DragCornerControlsComponentWithSelection(_ref2) {
|
|
65
76
|
var editorView = _ref2.editorView,
|
|
66
77
|
isInDanger = _ref2.isInDanger,
|
|
67
78
|
isResizing = _ref2.isResizing,
|
|
68
79
|
formatMessage = _ref2.intl.formatMessage,
|
|
69
80
|
api = _ref2.api;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
73
|
-
}),
|
|
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;
|
|
81
|
+
var _useSharedState = useSharedState(api),
|
|
82
|
+
selection = _useSharedState.selection;
|
|
79
83
|
var handleOnClick = function handleOnClick() {
|
|
80
84
|
var state = editorView.state,
|
|
81
85
|
dispatch = editorView.dispatch;
|
|
@@ -8,9 +8,20 @@ exports.FloatingControlsWithSelection = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
11
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
12
11
|
var _ClassicCornerControls = require("./CornerControls/ClassicCornerControls");
|
|
13
12
|
var _ClassicControls = require("./RowControls/ClassicControls");
|
|
13
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
14
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
15
|
+
return {
|
|
16
|
+
selection: selectionsSelector
|
|
17
|
+
};
|
|
18
|
+
}, function (api) {
|
|
19
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
20
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
21
|
+
return {
|
|
22
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
23
|
+
};
|
|
24
|
+
});
|
|
14
25
|
var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = function FloatingControlsWithSelection(_ref) {
|
|
15
26
|
var editorView = _ref.editorView,
|
|
16
27
|
tableRef = _ref.tableRef,
|
|
@@ -24,15 +35,8 @@ var FloatingControlsWithSelection = exports.FloatingControlsWithSelection = func
|
|
|
24
35
|
selectRow = _ref.selectRow,
|
|
25
36
|
tableActive = _ref.tableActive,
|
|
26
37
|
api = _ref.api;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
30
|
-
}),
|
|
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;
|
|
38
|
+
var _useSharedState = useSharedState(api),
|
|
39
|
+
selection = _useSharedState.selection;
|
|
36
40
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ClassicCornerControls.CornerControls, {
|
|
37
41
|
editorView: editorView,
|
|
38
42
|
tableRef: tableRef,
|
|
@@ -14,7 +14,6 @@ var _editorTables = require("@atlaskit/editor-tables");
|
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
17
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
17
|
var _commands = require("../../../pm-plugins/commands");
|
|
19
18
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
20
19
|
var _pluginFactory = require("../../../pm-plugins/plugin-factory");
|
|
@@ -289,6 +288,18 @@ var DragControls = exports.DragControls = function DragControls(_ref) {
|
|
|
289
288
|
}), rowHandles())
|
|
290
289
|
);
|
|
291
290
|
};
|
|
291
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
292
|
+
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
293
|
+
return {
|
|
294
|
+
selection: selectionsSelector
|
|
295
|
+
};
|
|
296
|
+
}, function (api) {
|
|
297
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
298
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
299
|
+
return {
|
|
300
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
301
|
+
};
|
|
302
|
+
});
|
|
292
303
|
var DragControlsWithSelection = exports.DragControlsWithSelection = function DragControlsWithSelection(_ref5) {
|
|
293
304
|
var editorView = _ref5.editorView,
|
|
294
305
|
tableRef = _ref5.tableRef,
|
|
@@ -304,15 +315,8 @@ var DragControlsWithSelection = exports.DragControlsWithSelection = function Dra
|
|
|
304
315
|
selectRows = _ref5.selectRows,
|
|
305
316
|
updateCellHoverLocation = _ref5.updateCellHoverLocation,
|
|
306
317
|
api = _ref5.api;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
310
|
-
}),
|
|
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;
|
|
318
|
+
var _useSharedState = useSharedState(api),
|
|
319
|
+
selection = _useSharedState.selection;
|
|
316
320
|
return /*#__PURE__*/_react.default.createElement(DragControls, {
|
|
317
321
|
editorView: editorView,
|
|
318
322
|
tableRef: tableRef,
|
|
@@ -7,7 +7,6 @@ exports.GlobalStylesWrapper = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
9
9
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
11
10
|
var _commonStyles = require("./common-styles");
|
|
12
11
|
/**
|
|
13
12
|
* @jsxRuntime classic
|
|
@@ -15,19 +14,24 @@ var _commonStyles = require("./common-styles");
|
|
|
15
14
|
*/
|
|
16
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
16
|
|
|
17
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
18
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
19
|
+
return {
|
|
20
|
+
mode: mode
|
|
21
|
+
};
|
|
22
|
+
}, function (api) {
|
|
23
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
|
|
24
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
25
|
+
return {
|
|
26
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
27
|
+
};
|
|
28
|
+
});
|
|
18
29
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
19
30
|
var featureFlags = _ref.featureFlags,
|
|
20
31
|
isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
|
|
21
32
|
api = _ref.api;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
25
|
-
}),
|
|
26
|
-
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
27
|
-
var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
|
|
28
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
29
|
-
});
|
|
30
|
-
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
33
|
+
var _useSharedState = useSharedState(api),
|
|
34
|
+
mode = _useSharedState.mode;
|
|
31
35
|
var isLivePageViewMode = mode === 'view';
|
|
32
36
|
return (0, _react.jsx)(_react.Global, {
|
|
33
37
|
styles: (0, _commonStyles.tableStyles)({
|
|
@@ -9,18 +9,21 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _table = require("@atlaskit/editor-common/table");
|
|
11
11
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
13
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
14
|
+
return {
|
|
15
|
+
mode: mode
|
|
16
|
+
};
|
|
17
|
+
}, function (api) {
|
|
18
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
|
|
17
19
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
20
|
+
return {
|
|
21
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
var SortingIconWrapper = exports.SortingIconWrapper = function SortingIconWrapper(props) {
|
|
25
|
+
var _useSharedState = useSharedState(props.api),
|
|
26
|
+
mode = _useSharedState.mode;
|
|
24
27
|
if (mode === 'edit') {
|
|
25
28
|
return null;
|
|
26
29
|
}
|