@atlaskit/editor-plugin-table 7.17.3 → 7.17.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 +17 -0
- package/dist/cjs/commands/column-resize.js +2 -6
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/cjs/toolbar.js +1 -1
- package/dist/cjs/transforms/column-width.js +1 -2
- package/dist/cjs/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/cjs/ui/FloatingContextualButton/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/styles.js +2 -0
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +5 -5
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +11 -9
- package/dist/cjs/ui/FloatingDragMenu/index.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/styles.js +3 -3
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/cjs/ui/common-styles.js +1 -0
- package/dist/cjs/ui/ui-styles.js +1 -0
- package/dist/cjs/utils/drag-menu.js +2 -2
- package/dist/es2019/commands/column-resize.js +2 -6
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/es2019/toolbar.js +1 -0
- package/dist/es2019/transforms/column-width.js +1 -2
- package/dist/es2019/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -0
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +5 -3
- package/dist/es2019/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +1 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +11 -9
- package/dist/es2019/ui/FloatingDragMenu/index.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/styles.js +3 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/es2019/ui/common-styles.js +1 -0
- package/dist/es2019/ui/ui-styles.js +1 -0
- package/dist/es2019/utils/drag-menu.js +2 -2
- package/dist/esm/commands/column-resize.js +2 -6
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -1
- package/dist/esm/toolbar.js +1 -0
- package/dist/esm/transforms/column-width.js +1 -2
- package/dist/esm/ui/ColumnResizeWidget/index.js +1 -0
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/styles.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +6 -4
- package/dist/esm/ui/FloatingContextualMenu/index.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +11 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/styles.js +3 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +7 -19
- package/dist/esm/ui/common-styles.js +1 -0
- package/dist/esm/ui/ui-styles.js +1 -0
- 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 +6 -9
- package/src/commands/column-resize.ts +2 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +1 -3
- package/src/toolbar.tsx +1 -0
- package/src/transforms/column-width.ts +1 -6
- package/src/ui/ColumnResizeWidget/index.tsx +1 -0
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +1 -0
- package/src/ui/FloatingContextualButton/index.tsx +1 -0
- package/src/ui/FloatingContextualButton/styles.ts +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +4 -5
- package/src/ui/FloatingContextualMenu/index.tsx +1 -0
- package/src/ui/FloatingContextualMenu/styles.ts +1 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +11 -10
- package/src/ui/FloatingDragMenu/index.tsx +2 -2
- package/src/ui/FloatingDragMenu/styles.ts +3 -4
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +8 -23
- package/src/ui/common-styles.ts +1 -0
- package/src/ui/ui-styles.ts +1 -0
- package/src/utils/drag-menu.ts +2 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
3
4
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -17,14 +18,14 @@ export const elementBeforeIconStyles = css({
|
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
20
|
-
export const dragMenuBackgroundColorStyles = (
|
|
21
|
+
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder = false) => css`
|
|
21
22
|
.${ClassName.DRAG_SUBMENU} {
|
|
22
23
|
border-radius: ${"var(--ds-border-radius, 3px)"};
|
|
23
24
|
background: ${"var(--ds-surface-overlay, white)"};
|
|
24
25
|
box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
|
|
25
26
|
display: block;
|
|
26
27
|
position: absolute;
|
|
27
|
-
top: ${
|
|
28
|
+
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
29
|
left: ${dragMenuDropdownWidth}px;
|
|
29
30
|
padding: ${"var(--ds-space-100, 8px)"};
|
|
30
31
|
|
|
@@ -4,7 +4,6 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
4
4
|
import { injectIntl } from 'react-intl-next';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
6
6
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
9
8
|
import { clearHoverSelection } from '../../../commands';
|
|
10
9
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
@@ -91,26 +90,15 @@ const DragControlsComponent = ({
|
|
|
91
90
|
}
|
|
92
91
|
}, [editorView, tableActive]);
|
|
93
92
|
const handleMouseMove = useCallback(e => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
93
|
+
const target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
94
|
+
const isParentDragControls = target === null || target === void 0 ? void 0 : target.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
95
|
+
const rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
104
|
-
} else {
|
|
105
|
-
const isParentDragControls = e.nativeEvent.target.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
106
|
-
const rowIndex = e.nativeEvent.target.getAttribute('data-start-index');
|
|
107
|
-
|
|
108
|
-
// avoid updating if event target is not related
|
|
109
|
-
if (!isParentDragControls || !rowIndex) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
97
|
+
// avoid updating if event target is not related
|
|
98
|
+
if (!isParentDragControls || !rowIndex) {
|
|
99
|
+
return;
|
|
113
100
|
}
|
|
101
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
114
102
|
}, [updateCellHoverLocation]);
|
|
115
103
|
const rowIndexes = useMemo(() => {
|
|
116
104
|
return [rowIndex];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
5
6
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { css } from '@emotion/react';
|
|
3
4
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
4
5
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -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
|
};
|
|
@@ -178,12 +178,8 @@ export var changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
|
178
178
|
var domAtPos = view.domAtPos.bind(view);
|
|
179
179
|
var colIndex = map.colCount($cell.pos - tableStartPosition) + ($cell.nodeAfter ? $cell.nodeAfter.attrs.colspan : 1) - 1;
|
|
180
180
|
var dom = null;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
184
|
-
} else {
|
|
185
|
-
dom = domAtPos(tableStartPosition).node;
|
|
186
|
-
}
|
|
181
|
+
var domAtPosition = domAtPos(tableStartPosition);
|
|
182
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
187
183
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
188
184
|
dom = dom.closest('table');
|
|
189
185
|
}
|
|
@@ -318,7 +318,7 @@ export var getNewResizeStateFromSelectedColumns = function getNewResizeStateFrom
|
|
|
318
318
|
}
|
|
319
319
|
var maybeTable = domAtPos(table.start).node;
|
|
320
320
|
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
321
|
-
var tableRef =
|
|
321
|
+
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
322
322
|
if (!tableRef) {
|
|
323
323
|
return;
|
|
324
324
|
}
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -4,6 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
/** @jsx jsx */
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
8
|
import { jsx } from '@emotion/react';
|
|
8
9
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
10
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
6
6
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
9
8
|
import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
10
9
|
import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
@@ -102,7 +101,7 @@ export var rescaleColumns = function rescaleColumns() {
|
|
|
102
101
|
var newTable = tr.doc.nodeAt(table.pos);
|
|
103
102
|
var domAtPos = view.domAtPos.bind(view);
|
|
104
103
|
var maybeTable = domAtPos(table.start).node;
|
|
105
|
-
var maybeTableElement =
|
|
104
|
+
var maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
106
105
|
var tableRef = maybeTableElement === null || maybeTableElement === void 0 ? void 0 : maybeTableElement.closest('table');
|
|
107
106
|
if (!tableRef || !newTable) {
|
|
108
107
|
return tr;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { jsx } from '@emotion/react';
|
|
4
5
|
import { useIntl } from 'react-intl-next';
|
|
5
6
|
import { startColumnResizing, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { ButtonGroup } from '@atlaskit/button';
|
|
4
5
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator } from '@atlaskit/editor-common/ui';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
5
|
import { jsx } from '@emotion/react';
|
|
4
6
|
import { injectIntl } from 'react-intl-next';
|
|
5
7
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
@@ -13,6 +13,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import { Component } from 'react';
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
18
|
import { jsx } from '@emotion/react';
|
|
17
19
|
import { injectIntl } from 'react-intl-next';
|
|
18
20
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
@@ -350,12 +352,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
350
352
|
var items = [];
|
|
351
353
|
var getEditorFeatureFlags = _this.props.getEditorFeatureFlags;
|
|
352
354
|
var _ref2 = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
353
|
-
_ref2$tableSortColumn = _ref2.
|
|
354
|
-
|
|
355
|
+
_ref2$tableSortColumn = _ref2.tableSortColumnReorder,
|
|
356
|
+
tableSortColumnReorder = _ref2$tableSortColumn === void 0 ? false : _ref2$tableSortColumn;
|
|
355
357
|
var sortColumnItems = _this.createSortColumnItems();
|
|
356
358
|
var backgroundColorItem = _this.createBackgroundColorItem();
|
|
357
359
|
var distributeColumnsItem = _this.createDistributeColumnsItem();
|
|
358
|
-
|
|
360
|
+
tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
359
361
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
360
362
|
items.push(_this.createInsertColumnItem());
|
|
361
363
|
items.push(_this.createInsertRowItem());
|
|
@@ -363,7 +365,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
363
365
|
items.push(_this.createDeleteRowItem());
|
|
364
366
|
items.push.apply(items, _toConsumableArray(_this.createMergeSplitCellItems()));
|
|
365
367
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
366
|
-
!
|
|
368
|
+
!tableSortColumnReorder && sortColumnItems && items.push.apply(items, _toConsumableArray(sortColumnItems));
|
|
367
369
|
items.push(_this.createClearCellsItem());
|
|
368
370
|
return [{
|
|
369
371
|
items: items
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
5
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
6
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -4,6 +4,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
/** @jsxFrag */
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
9
|
import { jsx } from '@emotion/react';
|
|
8
10
|
import { injectIntl } from 'react-intl-next';
|
|
9
11
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -89,16 +91,16 @@ var MapDragMenuOptionIdToMessage = {
|
|
|
89
91
|
plural: null
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
|
-
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(
|
|
94
|
+
var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumnReorder) {
|
|
93
95
|
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
96
|
var sortColumnItems = ['sort_column_asc', 'sort_column_desc'];
|
|
95
|
-
|
|
97
|
+
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
96
98
|
return groupedDragMenuConfig;
|
|
97
99
|
};
|
|
98
100
|
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
|
|
99
|
-
var
|
|
101
|
+
var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
100
102
|
var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
|
|
101
|
-
var groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
103
|
+
var groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
102
104
|
var menuItemsArr = _toConsumableArray(Array(groupedDragMenuConfig.length)).map(function () {
|
|
103
105
|
return [];
|
|
104
106
|
});
|
|
@@ -195,7 +197,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
195
197
|
tableDuplicateCellColouring = _ref.tableDuplicateCellColouring,
|
|
196
198
|
shouldUseIncreasedScalingPercent = _ref.shouldUseIncreasedScalingPercent,
|
|
197
199
|
isTableFixedColumnWidthsOptionEnabled = _ref.isTableFixedColumnWidthsOptionEnabled,
|
|
198
|
-
|
|
200
|
+
tableSortColumnReorder = _ref.tableSortColumnReorder;
|
|
199
201
|
var state = editorView.state,
|
|
200
202
|
dispatch = editorView.dispatch;
|
|
201
203
|
var selection = state.selection;
|
|
@@ -219,8 +221,8 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
219
221
|
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
220
222
|
}
|
|
221
223
|
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,
|
|
224
|
+
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);
|
|
225
|
+
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, tableSortColumnReorder, selectionRect),
|
|
224
226
|
menuItems = _convertToDropdownIte.menuItems,
|
|
225
227
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
226
228
|
var handleSubMenuRef = function handleSubMenuRef(ref) {
|
|
@@ -271,7 +273,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
271
273
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
272
274
|
// 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
275
|
,
|
|
274
|
-
css: dragMenuBackgroundColorStyles(
|
|
276
|
+
css: dragMenuBackgroundColorStyles(tableSortColumnReorder)
|
|
275
277
|
}, jsx("div", {
|
|
276
278
|
// 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
279
|
css: cellColourPreviewStyles(background)
|
|
@@ -469,7 +471,7 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
469
471
|
return null;
|
|
470
472
|
}
|
|
471
473
|
if (allowBackgroundColor) {
|
|
472
|
-
|
|
474
|
+
tableSortColumnReorder ? menuItems[1].items.unshift(createBackgroundColorMenuItem()) : menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
// 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';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
4
|
import { css } from '@emotion/react';
|
|
4
5
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
6
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -22,8 +23,8 @@ export var elementBeforeIconStyles = css({
|
|
|
22
23
|
|
|
23
24
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
24
25
|
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), ")"),
|
|
26
|
+
var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
27
|
+
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
28
|
};
|
|
28
29
|
|
|
29
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
@@ -5,7 +5,6 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
8
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
9
|
import { clearHoverSelection } from '../../../commands';
|
|
11
10
|
import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
|
|
@@ -91,26 +90,15 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
91
90
|
}
|
|
92
91
|
}, [editorView, tableActive]);
|
|
93
92
|
var handleMouseMove = useCallback(function (e) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
93
|
+
var target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
94
|
+
var isParentDragControls = target === null || target === void 0 ? void 0 : target.closest(".".concat(ClassName.DRAG_ROW_CONTROLS));
|
|
95
|
+
var rowIndex = target === null || target === void 0 ? void 0 : target.getAttribute('data-start-index');
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
updateCellHoverLocation(Number(_rowIndex));
|
|
104
|
-
} else {
|
|
105
|
-
var _isParentDragControls = e.nativeEvent.target.closest(".".concat(ClassName.DRAG_ROW_CONTROLS));
|
|
106
|
-
var _rowIndex2 = e.nativeEvent.target.getAttribute('data-start-index');
|
|
107
|
-
|
|
108
|
-
// avoid updating if event target is not related
|
|
109
|
-
if (!_isParentDragControls || !_rowIndex2) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
updateCellHoverLocation(Number(_rowIndex2));
|
|
97
|
+
// avoid updating if event target is not related
|
|
98
|
+
if (!isParentDragControls || !rowIndex) {
|
|
99
|
+
return;
|
|
113
100
|
}
|
|
101
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
114
102
|
}, [updateCellHoverLocation]);
|
|
115
103
|
var rowIndexes = useMemo(function () {
|
|
116
104
|
return [rowIndex];
|
|
@@ -2,6 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression */
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
6
|
import { css } from '@emotion/react';
|
|
6
7
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
7
8
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
package/dist/esm/ui/ui-styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25;
|
|
3
3
|
/* eslint-disable @atlaskit/design-system/no-css-tagged-template-expression -- needs mahual remediation */
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { css } from '@emotion/react';
|
|
5
6
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
6
7
|
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -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.5",
|
|
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",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
52
|
"@atlaskit/primitives": "^7.3.0",
|
|
53
|
-
"@atlaskit/theme": "^12.
|
|
54
|
-
"@atlaskit/toggle": "^13.
|
|
55
|
-
"@atlaskit/tokens": "^1.
|
|
56
|
-
"@atlaskit/tooltip": "^18.
|
|
53
|
+
"@atlaskit/theme": "^12.10.0",
|
|
54
|
+
"@atlaskit/toggle": "^13.2.0",
|
|
55
|
+
"@atlaskit/tokens": "^1.51.0",
|
|
56
|
+
"@atlaskit/tooltip": "^18.5.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@emotion/react": "^11.7.1",
|
|
59
59
|
"classnames": "^2.2.5",
|
|
@@ -132,9 +132,6 @@
|
|
|
132
132
|
"platform.editor.table.use-increased-scaling-percent": {
|
|
133
133
|
"type": "boolean"
|
|
134
134
|
},
|
|
135
|
-
"platform.editor.explicit-html-element-check": {
|
|
136
|
-
"type": "boolean"
|
|
137
|
-
},
|
|
138
135
|
"platform.editor.table.live-pages-sorting_4malx": {
|
|
139
136
|
"type": "boolean"
|
|
140
137
|
},
|
|
@@ -296,12 +296,8 @@ export const changeColumnWidthByStep =
|
|
|
296
296
|
1;
|
|
297
297
|
|
|
298
298
|
let dom: HTMLTableElement | null = null;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
302
|
-
} else {
|
|
303
|
-
dom = domAtPos(tableStartPosition).node as HTMLTableElement;
|
|
304
|
-
}
|
|
299
|
+
const domAtPosition = domAtPos(tableStartPosition);
|
|
300
|
+
dom = domAtPosition.node instanceof HTMLTableElement ? domAtPosition.node : null;
|
|
305
301
|
|
|
306
302
|
if (dom && dom.nodeName !== 'TABLE') {
|
|
307
303
|
dom = dom.closest('table');
|
|
@@ -347,9 +347,7 @@ export const getNewResizeStateFromSelectedColumns = (
|
|
|
347
347
|
const maybeTable = domAtPos(table.start).node;
|
|
348
348
|
|
|
349
349
|
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
350
|
-
const tableRef =
|
|
351
|
-
? maybeTableElement?.closest('table')
|
|
352
|
-
: (maybeTable as HTMLElement)?.closest('table');
|
|
350
|
+
const tableRef = maybeTableElement?.closest('table');
|
|
353
351
|
|
|
354
352
|
if (!tableRef) {
|
|
355
353
|
return;
|
package/src/toolbar.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
|
|
|
6
6
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
9
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
|
|
11
10
|
import type { ResizeState } from '../pm-plugins/table-resizing/utils';
|
|
12
11
|
import {
|
|
@@ -118,11 +117,7 @@ export const rescaleColumns =
|
|
|
118
117
|
const newTable = tr.doc.nodeAt(table.pos);
|
|
119
118
|
const domAtPos = view.domAtPos.bind(view);
|
|
120
119
|
const maybeTable = domAtPos(table.start).node;
|
|
121
|
-
const maybeTableElement =
|
|
122
|
-
? maybeTable instanceof HTMLElement
|
|
123
|
-
? maybeTable
|
|
124
|
-
: null
|
|
125
|
-
: (maybeTable as HTMLElement | null);
|
|
120
|
+
const maybeTableElement = maybeTable instanceof HTMLElement ? maybeTable : null;
|
|
126
121
|
const tableRef = maybeTableElement?.closest('table');
|
|
127
122
|
|
|
128
123
|
if (!tableRef || !newTable) {
|