@atlaskit/editor-plugin-table 7.17.3 → 7.17.4
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 +8 -0
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +4 -4
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +9 -9
- package/dist/cjs/ui/FloatingDragMenu/index.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/cjs/utils/drag-menu.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +9 -9
- package/dist/es2019/ui/FloatingDragMenu/index.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/es2019/utils/drag-menu.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +4 -4
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +9 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/styles.js +2 -2
- package/dist/esm/utils/drag-menu.js +2 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types/utils/drag-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
- package/package.json +2 -2
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +3 -5
- package/src/ui/FloatingDragMenu/DragMenu.tsx +10 -10
- package/src/ui/FloatingDragMenu/index.tsx +2 -2
- package/src/ui/FloatingDragMenu/styles.ts +2 -4
- package/src/utils/drag-menu.ts +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.17.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#111851](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111851)
|
|
8
|
+
[`4aefbe38ee8e2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4aefbe38ee8e2) -
|
|
9
|
+
ED-23129: Updated experiment ID and corresponding editor FF
|
|
10
|
+
|
|
3
11
|
## 7.17.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -355,12 +355,12 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
355
355
|
var items = [];
|
|
356
356
|
var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
|
|
357
357
|
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
358
|
-
_ref2$tableSortColumn = _ref2.
|
|
359
|
-
|
|
358
|
+
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
359
|
+
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
360
360
|
var sortColumnItems = _this.createSortColumnItems();
|
|
361
361
|
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
362
362
|
var distributeColumnsItem = _this.createDistributeColumnsItem();
|
|
363
|
-
|
|
363
|
+
tableSortColumnReorder && sortColumnItems && items.push.apply(items, (0, _toConsumableArray2.default)(sortColumnItems));
|
|
364
364
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
365
365
|
items.push(_this.createInsertColumnItem());
|
|
366
366
|
items.push(_this.createInsertRowItem());
|
|
@@ -368,7 +368,7 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
368
368
|
items.push(_this.createDeleteRowItem());
|
|
369
369
|
items.push.apply(items, (0, _toConsumableArray2.default)(_this.createMergeSplitCellItems()));
|
|
370
370
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
371
|
-
!
|
|
371
|
+
!tableSortColumnReorder && sortColumnItems && items.push.apply(items, (0, _toConsumableArray2.default)(sortColumnItems));
|
|
372
372
|
items.push(_this.createClearCellsItem());
|
|
373
373
|
return [{
|
|
374
374
|
items: items
|
|
@@ -100,16 +100,16 @@ var MapDragMenuOptionIdToMessage = {
|
|
|
100
100
|
plural: null
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(
|
|
103
|
+
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumnReorder) {
|
|
104
104
|
var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
|
|
105
105
|
var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
106
|
-
|
|
106
|
+
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
107
107
|
return groupedDragMenuConfig;
|
|
108
108
|
};
|
|
109
109
|
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
|
|
110
|
-
var
|
|
110
|
+
var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
111
111
|
var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
|
|
112
|
-
var groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
112
|
+
var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
113
113
|
var menuItemsArr = (0, _toConsumableArray2.default)(Array(groupedDragMenuConfig.length)).map(function () {
|
|
114
114
|
return [];
|
|
115
115
|
});
|
|
@@ -206,7 +206,7 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
206
206
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
207
207
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
208
208
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
209
|
-
|
|
209
|
+
tableSortColumnReorder = _ref.tableSortColumnReorder;
|
|
210
210
|
var state = editorView.state,
|
|
211
211
|
dispatch = editorView.dispatch;
|
|
212
212
|
var selection = state.selection;
|
|
@@ -230,8 +230,8 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
230
230
|
hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
|
|
231
231
|
}
|
|
232
232
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
233
|
-
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent,
|
|
234
|
-
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage,
|
|
233
|
+
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
|
|
234
|
+
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
|
|
235
235
|
menuItems = _convertToDropdownIte.menuItems,
|
|
236
236
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
237
237
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
@@ -282,7 +282,7 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
282
282
|
className: _styles.DropdownMenuSharedCssClassName.SUBMENU
|
|
283
283
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
284
284
|
,
|
|
285
|
-
css: (0, _styles2.dragMenuBackgroundColorStyles)(
|
|
285
|
+
css: (0, _styles2.dragMenuBackgroundColorStyles)(tableSortColumnReorder)
|
|
286
286
|
}, (0, _react2.jsx)("div", {
|
|
287
287
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
288
288
|
css: (0, _styles2.cellColourPreviewStyles)(background)
|
|
@@ -480,7 +480,7 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
480
480
|
return null;
|
|
481
481
|
}
|
|
482
482
|
if (allowBackgroundColor) {
|
|
483
|
-
|
|
483
|
+
tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
// If first row, add toggle for Header row, default is true
|
|
@@ -42,8 +42,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
42
42
|
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
|
|
43
43
|
_ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
|
|
44
44
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
|
|
45
|
-
_ref2$tableSortColumn = _ref2.
|
|
46
|
-
|
|
45
|
+
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
46
|
+
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
47
47
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.use-increased-scaling-percent');
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_ui.Popup, {
|
|
49
49
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
@@ -82,7 +82,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
82
82
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
83
83
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
84
84
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
85
|
-
|
|
85
|
+
tableSortColumnReorder: tableSortColumnReorder
|
|
86
86
|
}));
|
|
87
87
|
};
|
|
88
88
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -29,8 +29,8 @@ var elementBeforeIconStyles = exports.elementBeforeIconStyles = (0, _react.css)(
|
|
|
29
29
|
|
|
30
30
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
31
31
|
var dragMenuBackgroundColorStyles = exports.dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
|
|
32
|
-
var
|
|
33
|
-
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), _types.TableCssClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"),
|
|
32
|
+
var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
33
|
+
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), _types.TableCssClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), tableSortColumnReorder ? _consts.TABLE_DRAG_MENU_PADDING_TOP + _consts.TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + _consts.TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0, _consts.dragMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.DRAG_SUBMENU_ICON, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
@@ -81,7 +81,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
81
81
|
var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
82
82
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
|
|
83
83
|
var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
|
|
84
|
-
var
|
|
84
|
+
var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
|
|
85
85
|
var selection = editorView.state.selection;
|
|
86
86
|
var addOptions = direction === 'row' ? [{
|
|
87
87
|
label: 'above',
|
|
@@ -251,6 +251,6 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
251
251
|
};
|
|
252
252
|
})));
|
|
253
253
|
var allConfigs = (0, _toConsumableArray2.default)(restConfigs);
|
|
254
|
-
|
|
254
|
+
tableSortColumnReorder ? allConfigs.unshift.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs)) : allConfigs.push.apply(allConfigs, (0, _toConsumableArray2.default)(sortConfigs));
|
|
255
255
|
return allConfigs.filter(Boolean);
|
|
256
256
|
};
|
|
@@ -386,12 +386,12 @@ export class ContextualMenu extends Component {
|
|
|
386
386
|
getEditorFeatureFlags
|
|
387
387
|
} = this.props;
|
|
388
388
|
const {
|
|
389
|
-
|
|
389
|
+
tableSortColumnReorder = false
|
|
390
390
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
391
391
|
const sortColumnItems = this.createSortColumnItems();
|
|
392
392
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
393
393
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
394
|
-
|
|
394
|
+
tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
395
395
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
396
396
|
items.push(this.createInsertColumnItem());
|
|
397
397
|
items.push(this.createInsertRowItem());
|
|
@@ -399,7 +399,7 @@ export class ContextualMenu extends Component {
|
|
|
399
399
|
items.push(this.createDeleteRowItem());
|
|
400
400
|
items.push(...this.createMergeSplitCellItems());
|
|
401
401
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
402
|
-
!
|
|
402
|
+
!tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
403
403
|
items.push(this.createClearCellsItem());
|
|
404
404
|
return [{
|
|
405
405
|
items
|
|
@@ -87,14 +87,14 @@ const MapDragMenuOptionIdToMessage = {
|
|
|
87
87
|
plural: null
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
const getGroupedDragMenuConfig =
|
|
90
|
+
const getGroupedDragMenuConfig = tableSortColumnReorder => {
|
|
91
91
|
let groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
|
|
92
92
|
const sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
93
|
-
|
|
93
|
+
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
94
94
|
return groupedDragMenuConfig;
|
|
95
95
|
};
|
|
96
|
-
const convertToDropdownItems = (dragMenuConfig, formatMessage,
|
|
97
|
-
const groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
96
|
+
const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnReorder = false, selectionRect) => {
|
|
97
|
+
const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
98
98
|
let menuItemsArr = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
99
99
|
let menuCallback = {};
|
|
100
100
|
dragMenuConfig.forEach(item => {
|
|
@@ -189,7 +189,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
189
189
|
tableDuplicateCellColouring,
|
|
190
190
|
shouldUseIncreasedScalingPercent,
|
|
191
191
|
isTableFixedColumnWidthsOptionEnabled,
|
|
192
|
-
|
|
192
|
+
tableSortColumnReorder
|
|
193
193
|
}) => {
|
|
194
194
|
var _pluginConfig$allowBa;
|
|
195
195
|
const {
|
|
@@ -217,11 +217,11 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
217
217
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
218
218
|
}
|
|
219
219
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
220
|
-
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent,
|
|
220
|
+
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
|
|
221
221
|
const {
|
|
222
222
|
menuItems,
|
|
223
223
|
menuCallback
|
|
224
|
-
} = convertToDropdownItems(dragMenuConfig, formatMessage,
|
|
224
|
+
} = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect);
|
|
225
225
|
const handleSubMenuRef = ref => {
|
|
226
226
|
const parent = closestElement(editorView.dom, '.fabric-editor-popup-scroll-parent');
|
|
227
227
|
if (!(parent && ref)) {
|
|
@@ -275,7 +275,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
275
275
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
276
276
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
277
277
|
,
|
|
278
|
-
css: dragMenuBackgroundColorStyles(
|
|
278
|
+
css: dragMenuBackgroundColorStyles(tableSortColumnReorder)
|
|
279
279
|
}, jsx("div", {
|
|
280
280
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
281
281
|
css: cellColourPreviewStyles(background)
|
|
@@ -478,7 +478,7 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
478
478
|
return null;
|
|
479
479
|
}
|
|
480
480
|
if (allowBackgroundColor) {
|
|
481
|
-
|
|
481
|
+
tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
// If first row, add toggle for Header row, default is true
|
|
@@ -34,7 +34,7 @@ const FloatingDragMenu = ({
|
|
|
34
34
|
const {
|
|
35
35
|
tableDuplicateCellColouring = false,
|
|
36
36
|
tableWithFixedColumnWidthsOption = false,
|
|
37
|
-
|
|
37
|
+
tableSortColumnReorder = false
|
|
38
38
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
39
39
|
const shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
40
40
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
@@ -74,7 +74,7 @@ const FloatingDragMenu = ({
|
|
|
74
74
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
75
75
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
76
76
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
77
|
-
|
|
77
|
+
tableSortColumnReorder: tableSortColumnReorder
|
|
78
78
|
}));
|
|
79
79
|
};
|
|
80
80
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -17,14 +17,14 @@ export const elementBeforeIconStyles = css({
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
20
|
-
export const dragMenuBackgroundColorStyles = (
|
|
20
|
+
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder = false) => css`
|
|
21
21
|
.${ClassName.DRAG_SUBMENU} {
|
|
22
22
|
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
23
23
|
background: ${"var(--ds-surface-overlay, white)"};
|
|
24
24
|
box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
|
|
25
25
|
display: block;
|
|
26
26
|
position: absolute;
|
|
27
|
-
top: ${
|
|
27
|
+
top: ${tableSortColumnReorder ? TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0}px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker
|
|
28
28
|
left: ${dragMenuDropdownWidth}px;
|
|
29
29
|
padding: ${"var(--ds-space-100, 8px)"};
|
|
30
30
|
|
|
@@ -65,7 +65,7 @@ const defaultSelectionRect = {
|
|
|
65
65
|
right: 0,
|
|
66
66
|
bottom: 0
|
|
67
67
|
};
|
|
68
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false,
|
|
68
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, isHeaderRowRequired, isTableScalingEnabled = false, tableDuplicateCellColouring = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false, tableSortColumnReorder = false) => {
|
|
69
69
|
var _tableMap$height, _tableMap$height2, _tableMap$width, _tableMap$width2;
|
|
70
70
|
const {
|
|
71
71
|
selection
|
|
@@ -227,6 +227,6 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
227
227
|
keymap: keymap && tooltip(keymap)
|
|
228
228
|
}))];
|
|
229
229
|
let allConfigs = [...restConfigs];
|
|
230
|
-
|
|
230
|
+
tableSortColumnReorder ? allConfigs.unshift(...sortConfigs) : allConfigs.push(...sortConfigs);
|
|
231
231
|
return allConfigs.filter(Boolean);
|
|
232
232
|
};
|
|
@@ -350,12 +350,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
350
350
|
var items = [];
|
|
351
351
|
var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
|
|
352
352
|
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
353
|
-
_ref2$tableSortColumn = _ref2.
|
|
354
|
-
|
|
353
|
+
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
354
|
+
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
355
355
|
var sortColumnItems = _this.createSortColumnItems();
|
|
356
356
|
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
357
357
|
var distributeColumnsItem = _this.createDistributeColumnsItem();
|
|
358
|
-
|
|
358
|
+
tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
359
359
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
360
360
|
items.push(_this.createInsertColumnItem());
|
|
361
361
|
items.push(_this.createInsertRowItem());
|
|
@@ -363,7 +363,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
363
363
|
items.push(_this.createDeleteRowItem());
|
|
364
364
|
items.push.apply(items, _toConsumableArray(_this.createMergeSplitCellItems()));
|
|
365
365
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
366
|
-
!
|
|
366
|
+
!tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
367
367
|
items.push(_this.createClearCellsItem());
|
|
368
368
|
return [{
|
|
369
369
|
items: items
|
|
@@ -89,16 +89,16 @@ var MapDragMenuOptionIdToMessage = {
|
|
|
89
89
|
plural: null
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(
|
|
92
|
+
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumnReorder) {
|
|
93
93
|
var groupedDragMenuConfig = [['add_row_above', 'add_row_below', 'add_column_left', 'add_column_right', 'distribute_columns', 'clear_cells', 'delete_row', 'delete_column'], ['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down']];
|
|
94
94
|
var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
95
|
-
|
|
95
|
+
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
96
96
|
return groupedDragMenuConfig;
|
|
97
97
|
};
|
|
98
98
|
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
|
|
99
|
-
var
|
|
99
|
+
var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
100
100
|
var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
|
|
101
|
-
var groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
101
|
+
var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
102
102
|
var menuItemsArr = _toConsumableArray(Array(groupedDragMenuConfig.length)).map(function () {
|
|
103
103
|
return [];
|
|
104
104
|
});
|
|
@@ -195,7 +195,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
195
195
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
196
196
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
197
197
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
198
|
-
|
|
198
|
+
tableSortColumnReorder = _ref.tableSortColumnReorder;
|
|
199
199
|
var state = editorView.state,
|
|
200
200
|
dispatch = editorView.dispatch;
|
|
201
201
|
var selection = state.selection;
|
|
@@ -219,8 +219,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
219
219
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
220
220
|
}
|
|
221
221
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
222
|
-
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent,
|
|
223
|
-
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage,
|
|
222
|
+
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled, tableDuplicateCellColouring, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, tableSortColumnReorder);
|
|
223
|
+
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
|
|
224
224
|
menuItems = _convertToDropdownIte.menuItems,
|
|
225
225
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
226
226
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
@@ -271,7 +271,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
271
271
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
272
272
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
273
273
|
,
|
|
274
|
-
css: dragMenuBackgroundColorStyles(
|
|
274
|
+
css: dragMenuBackgroundColorStyles(tableSortColumnReorder)
|
|
275
275
|
}, jsx("div", {
|
|
276
276
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
277
277
|
css: cellColourPreviewStyles(background)
|
|
@@ -469,7 +469,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
469
469
|
return null;
|
|
470
470
|
}
|
|
471
471
|
if (allowBackgroundColor) {
|
|
472
|
-
|
|
472
|
+
tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// If first row, add toggle for Header row, default is true
|
|
@@ -35,8 +35,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
35
35
|
tableDuplicateCellColouring = _ref2$tableDuplicateC === void 0 ? false : _ref2$tableDuplicateC,
|
|
36
36
|
_ref2$tableWithFixedC = _ref2.tableWithFixedColumnWidthsOption,
|
|
37
37
|
tableWithFixedColumnWidthsOption = _ref2$tableWithFixedC === void 0 ? false : _ref2$tableWithFixedC,
|
|
38
|
-
_ref2$tableSortColumn = _ref2.
|
|
39
|
-
|
|
38
|
+
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
39
|
+
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
40
40
|
var shouldUseIncreasedScalingPercent = isTableScalingEnabled && tableWithFixedColumnWidthsOption && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
41
41
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
42
42
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
@@ -75,7 +75,7 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
75
75
|
tableDuplicateCellColouring: tableDuplicateCellColouring,
|
|
76
76
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
77
77
|
isTableFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
78
|
-
|
|
78
|
+
tableSortColumnReorder: tableSortColumnReorder
|
|
79
79
|
}));
|
|
80
80
|
};
|
|
81
81
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -22,8 +22,8 @@ export var elementBeforeIconStyles = css({
|
|
|
22
22
|
|
|
23
23
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
24
24
|
export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
|
|
25
|
-
var
|
|
26
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"),
|
|
25
|
+
var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
26
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t.", " {\n\t\tborder-radius: ", ";\n\t\tbackground: ", ";\n\t\tbox-shadow: ", ";\n\t\tdisplay: block;\n\t\tposition: absolute;\n\t\ttop: ", "px; // move the submenu down when 'sort increasing/decreasing' appear before background color picker\n\t\tleft: ", "px;\n\t\tpadding: ", ";\n\n\t\t> div {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\n\t\t&::before {\n\t\t\tcontent: '';\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid ", ";\n\t\t\tborder-radius: ", ";\n\t\t\twidth: 14px;\n\t\t\theight: 14px;\n\t\t}\n\n\t\t&::after {\n\t\t\tcontent: '\u203A';\n\t\t\tmargin-left: ", ";\n\t\t\tline-height: 14px;\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), tableSortColumnReorder ? TABLE_DRAG_MENU_PADDING_TOP + TABLE_DRAG_MENU_SORT_GROUP_HEIGHT + TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT : 0, dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
@@ -74,7 +74,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
74
74
|
var tableDuplicateCellColouring = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : false;
|
|
75
75
|
var isTableFixedColumnWidthsOptionEnabled = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : false;
|
|
76
76
|
var shouldUseIncreasedScalingPercent = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : false;
|
|
77
|
-
var
|
|
77
|
+
var tableSortColumnReorder = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : false;
|
|
78
78
|
var selection = editorView.state.selection;
|
|
79
79
|
var addOptions = direction === 'row' ? [{
|
|
80
80
|
label: 'above',
|
|
@@ -244,6 +244,6 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
244
244
|
};
|
|
245
245
|
})));
|
|
246
246
|
var allConfigs = _toConsumableArray(restConfigs);
|
|
247
|
-
|
|
247
|
+
tableSortColumnReorder ? allConfigs.unshift.apply(allConfigs, _toConsumableArray(sortConfigs)) : allConfigs.push.apply(allConfigs, _toConsumableArray(sortConfigs));
|
|
248
248
|
return allConfigs.filter(Boolean);
|
|
249
249
|
};
|
|
@@ -28,9 +28,9 @@ type DragMenuProps = {
|
|
|
28
28
|
tableDuplicateCellColouring?: boolean;
|
|
29
29
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
30
30
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
31
|
-
|
|
31
|
+
tableSortColumnReorder?: boolean;
|
|
32
32
|
};
|
|
33
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled,
|
|
33
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
34
34
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
35
35
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
36
36
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
-
export declare const dragMenuBackgroundColorStyles: (
|
|
3
|
+
export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean,
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
|
|
@@ -28,9 +28,9 @@ type DragMenuProps = {
|
|
|
28
28
|
tableDuplicateCellColouring?: boolean;
|
|
29
29
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
30
30
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
31
|
-
|
|
31
|
+
tableSortColumnReorder?: boolean;
|
|
32
32
|
};
|
|
33
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled,
|
|
33
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, isTableScalingEnabled, tableDuplicateCellColouring, shouldUseIncreasedScalingPercent, isTableFixedColumnWidthsOptionEnabled, tableSortColumnReorder, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
34
34
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps>> & {
|
|
35
35
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps>;
|
|
36
36
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
2
|
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
|
-
export declare const dragMenuBackgroundColorStyles: (
|
|
3
|
+
export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
|
|
4
4
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
|
|
|
13
13
|
icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
|
|
14
14
|
keymap?: string;
|
|
15
15
|
}
|
|
16
|
-
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean,
|
|
16
|
+
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.17.
|
|
3
|
+
"version": "7.17.4",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
32
32
|
"@atlaskit/button": "^17.17.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^82.
|
|
34
|
+
"@atlaskit/editor-common": "^82.8.0",
|
|
35
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
@@ -460,14 +460,12 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
460
460
|
private createOriginalContextMenuItems = () => {
|
|
461
461
|
let items: MenuItem[] = [];
|
|
462
462
|
const { getEditorFeatureFlags } = this.props;
|
|
463
|
-
const {
|
|
464
|
-
? getEditorFeatureFlags()
|
|
465
|
-
: {};
|
|
463
|
+
const { tableSortColumnReorder = false } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
466
464
|
const sortColumnItems = this.createSortColumnItems();
|
|
467
465
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
468
466
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
469
467
|
|
|
470
|
-
|
|
468
|
+
tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
471
469
|
|
|
472
470
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
473
471
|
|
|
@@ -483,7 +481,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
483
481
|
|
|
484
482
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
485
483
|
|
|
486
|
-
!
|
|
484
|
+
!tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
487
485
|
|
|
488
486
|
items.push(this.createClearCellsItem());
|
|
489
487
|
|
|
@@ -95,7 +95,7 @@ type DragMenuProps = {
|
|
|
95
95
|
tableDuplicateCellColouring?: boolean;
|
|
96
96
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
97
97
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
98
|
-
|
|
98
|
+
tableSortColumnReorder?: boolean;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
|
|
@@ -163,7 +163,7 @@ const MapDragMenuOptionIdToMessage: Record<DragMenuOptionIdType, MessageType> =
|
|
|
163
163
|
},
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
const getGroupedDragMenuConfig = (
|
|
166
|
+
const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
|
|
167
167
|
let groupedDragMenuConfig: DragMenuOptionIdType[][] = [
|
|
168
168
|
[
|
|
169
169
|
'add_row_above',
|
|
@@ -178,7 +178,7 @@ const getGroupedDragMenuConfig = (tableSortColumnDiscoverability: boolean) => {
|
|
|
178
178
|
['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down'],
|
|
179
179
|
];
|
|
180
180
|
const sortColumnItems: DragMenuOptionIdType[] = ['sort_column_asc', 'sort_column_desc'];
|
|
181
|
-
|
|
181
|
+
tableSortColumnReorder
|
|
182
182
|
? groupedDragMenuConfig.unshift(sortColumnItems)
|
|
183
183
|
: groupedDragMenuConfig.push(sortColumnItems);
|
|
184
184
|
|
|
@@ -188,10 +188,10 @@ const getGroupedDragMenuConfig = (tableSortColumnDiscoverability: boolean) => {
|
|
|
188
188
|
const convertToDropdownItems = (
|
|
189
189
|
dragMenuConfig: DragMenuConfig[],
|
|
190
190
|
formatMessage: IntlShape['formatMessage'],
|
|
191
|
-
|
|
191
|
+
tableSortColumnReorder: boolean = false,
|
|
192
192
|
selectionRect?: Rect,
|
|
193
193
|
) => {
|
|
194
|
-
const groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
194
|
+
const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
195
195
|
let menuItemsArr: MenuItem[][] = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
196
196
|
let menuCallback: { [key: string]: Command } = {};
|
|
197
197
|
dragMenuConfig.forEach((item) => {
|
|
@@ -277,7 +277,7 @@ export const DragMenu = React.memo(
|
|
|
277
277
|
tableDuplicateCellColouring,
|
|
278
278
|
shouldUseIncreasedScalingPercent,
|
|
279
279
|
isTableFixedColumnWidthsOptionEnabled,
|
|
280
|
-
|
|
280
|
+
tableSortColumnReorder,
|
|
281
281
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
282
282
|
const { state, dispatch } = editorView;
|
|
283
283
|
const { selection } = state;
|
|
@@ -320,13 +320,13 @@ export const DragMenu = React.memo(
|
|
|
320
320
|
tableDuplicateCellColouring,
|
|
321
321
|
isTableFixedColumnWidthsOptionEnabled,
|
|
322
322
|
shouldUseIncreasedScalingPercent,
|
|
323
|
-
|
|
323
|
+
tableSortColumnReorder,
|
|
324
324
|
);
|
|
325
325
|
|
|
326
326
|
const { menuItems, menuCallback } = convertToDropdownItems(
|
|
327
327
|
dragMenuConfig,
|
|
328
328
|
formatMessage,
|
|
329
|
-
|
|
329
|
+
tableSortColumnReorder,
|
|
330
330
|
selectionRect,
|
|
331
331
|
);
|
|
332
332
|
|
|
@@ -386,7 +386,7 @@ export const DragMenu = React.memo(
|
|
|
386
386
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
387
387
|
className={DropdownMenuSharedCssClassName.SUBMENU}
|
|
388
388
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
389
|
-
css={dragMenuBackgroundColorStyles(
|
|
389
|
+
css={dragMenuBackgroundColorStyles(tableSortColumnReorder)}
|
|
390
390
|
>
|
|
391
391
|
<div
|
|
392
392
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
@@ -613,7 +613,7 @@ export const DragMenu = React.memo(
|
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
if (allowBackgroundColor) {
|
|
616
|
-
|
|
616
|
+
tableSortColumnReorder
|
|
617
617
|
? menuItems[1].items.unshift(createBackgroundColorMenuItem())
|
|
618
618
|
: menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
619
619
|
}
|
|
@@ -73,7 +73,7 @@ const FloatingDragMenu = ({
|
|
|
73
73
|
const {
|
|
74
74
|
tableDuplicateCellColouring = false,
|
|
75
75
|
tableWithFixedColumnWidthsOption = false,
|
|
76
|
-
|
|
76
|
+
tableSortColumnReorder = false,
|
|
77
77
|
} = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
78
78
|
|
|
79
79
|
const shouldUseIncreasedScalingPercent =
|
|
@@ -119,7 +119,7 @@ const FloatingDragMenu = ({
|
|
|
119
119
|
tableDuplicateCellColouring={tableDuplicateCellColouring}
|
|
120
120
|
shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
|
|
121
121
|
isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
|
|
122
|
-
|
|
122
|
+
tableSortColumnReorder={tableSortColumnReorder}
|
|
123
123
|
/>
|
|
124
124
|
</Popup>
|
|
125
125
|
);
|
|
@@ -27,16 +27,14 @@ export const elementBeforeIconStyles = css({
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
30
|
-
export const dragMenuBackgroundColorStyles = (
|
|
31
|
-
tableSortColumnDiscoverability: boolean = false,
|
|
32
|
-
) => css`
|
|
30
|
+
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder: boolean = false) => css`
|
|
33
31
|
.${ClassName.DRAG_SUBMENU} {
|
|
34
32
|
border-radius: ${token('border.radius', '3px')};
|
|
35
33
|
background: ${token('elevation.surface.overlay', 'white')};
|
|
36
34
|
box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
|
|
37
35
|
display: block;
|
|
38
36
|
position: absolute;
|
|
39
|
-
top: ${
|
|
37
|
+
top: ${tableSortColumnReorder
|
|
40
38
|
? TABLE_DRAG_MENU_PADDING_TOP +
|
|
41
39
|
TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
|
|
42
40
|
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT
|
package/src/utils/drag-menu.ts
CHANGED
|
@@ -162,7 +162,7 @@ export const getDragMenuConfig = (
|
|
|
162
162
|
tableDuplicateCellColouring = false,
|
|
163
163
|
isTableFixedColumnWidthsOptionEnabled = false,
|
|
164
164
|
shouldUseIncreasedScalingPercent = false,
|
|
165
|
-
|
|
165
|
+
tableSortColumnReorder = false,
|
|
166
166
|
): DragMenuConfig[] => {
|
|
167
167
|
const { selection } = editorView.state;
|
|
168
168
|
const addOptions =
|
|
@@ -394,9 +394,7 @@ export const getDragMenuConfig = (
|
|
|
394
394
|
];
|
|
395
395
|
|
|
396
396
|
let allConfigs = [...restConfigs];
|
|
397
|
-
|
|
398
|
-
? allConfigs.unshift(...sortConfigs)
|
|
399
|
-
: allConfigs.push(...sortConfigs);
|
|
397
|
+
tableSortColumnReorder ? allConfigs.unshift(...sortConfigs) : allConfigs.push(...sortConfigs);
|
|
400
398
|
|
|
401
399
|
return allConfigs.filter(Boolean) as DragMenuConfig[];
|
|
402
400
|
};
|