@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,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { jsx } from '@emotion/react';
|
|
5
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
6
7
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { Component } from 'react';
|
|
4
4
|
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
6
|
import { jsx } from '@emotion/react';
|
|
6
7
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
8
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -460,14 +461,12 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
460
461
|
private createOriginalContextMenuItems = () => {
|
|
461
462
|
let items: MenuItem[] = [];
|
|
462
463
|
const { getEditorFeatureFlags } = this.props;
|
|
463
|
-
const {
|
|
464
|
-
? getEditorFeatureFlags()
|
|
465
|
-
: {};
|
|
464
|
+
const { tableSortColumnReorder = false } = getEditorFeatureFlags ? getEditorFeatureFlags() : {};
|
|
466
465
|
const sortColumnItems = this.createSortColumnItems();
|
|
467
466
|
const backgroundColorItem = this.createBackgroundColorItem();
|
|
468
467
|
const distributeColumnsItem = this.createDistributeColumnsItem();
|
|
469
468
|
|
|
470
|
-
|
|
469
|
+
tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
471
470
|
|
|
472
471
|
backgroundColorItem && items.push(backgroundColorItem);
|
|
473
472
|
|
|
@@ -483,7 +482,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
|
|
|
483
482
|
|
|
484
483
|
distributeColumnsItem && items.push(distributeColumnsItem);
|
|
485
484
|
|
|
486
|
-
!
|
|
485
|
+
!tableSortColumnReorder && sortColumnItems && items.push(...sortColumnItems);
|
|
487
486
|
|
|
488
487
|
items.push(this.createClearCellsItem());
|
|
489
488
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/** @jsxFrag */
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
5
|
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
7
|
import { jsx } from '@emotion/react';
|
|
7
8
|
import type { IntlShape, MessageDescriptor, WrappedComponentProps } from 'react-intl-next';
|
|
8
9
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -95,7 +96,7 @@ type DragMenuProps = {
|
|
|
95
96
|
tableDuplicateCellColouring?: boolean;
|
|
96
97
|
shouldUseIncreasedScalingPercent?: boolean;
|
|
97
98
|
isTableFixedColumnWidthsOptionEnabled?: boolean;
|
|
98
|
-
|
|
99
|
+
tableSortColumnReorder?: boolean;
|
|
99
100
|
};
|
|
100
101
|
|
|
101
102
|
type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
|
|
@@ -163,7 +164,7 @@ const MapDragMenuOptionIdToMessage: Record<DragMenuOptionIdType, MessageType> =
|
|
|
163
164
|
},
|
|
164
165
|
};
|
|
165
166
|
|
|
166
|
-
const getGroupedDragMenuConfig = (
|
|
167
|
+
const getGroupedDragMenuConfig = (tableSortColumnReorder: boolean) => {
|
|
167
168
|
let groupedDragMenuConfig: DragMenuOptionIdType[][] = [
|
|
168
169
|
[
|
|
169
170
|
'add_row_above',
|
|
@@ -178,7 +179,7 @@ const getGroupedDragMenuConfig = (tableSortColumnDiscoverability: boolean) => {
|
|
|
178
179
|
['move_column_left', 'move_column_right', 'move_row_up', 'move_row_down'],
|
|
179
180
|
];
|
|
180
181
|
const sortColumnItems: DragMenuOptionIdType[] = ['sort_column_asc', 'sort_column_desc'];
|
|
181
|
-
|
|
182
|
+
tableSortColumnReorder
|
|
182
183
|
? groupedDragMenuConfig.unshift(sortColumnItems)
|
|
183
184
|
: groupedDragMenuConfig.push(sortColumnItems);
|
|
184
185
|
|
|
@@ -188,10 +189,10 @@ const getGroupedDragMenuConfig = (tableSortColumnDiscoverability: boolean) => {
|
|
|
188
189
|
const convertToDropdownItems = (
|
|
189
190
|
dragMenuConfig: DragMenuConfig[],
|
|
190
191
|
formatMessage: IntlShape['formatMessage'],
|
|
191
|
-
|
|
192
|
+
tableSortColumnReorder: boolean = false,
|
|
192
193
|
selectionRect?: Rect,
|
|
193
194
|
) => {
|
|
194
|
-
const groupedDragMenuConfig = getGroupedDragMenuConfig(
|
|
195
|
+
const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
195
196
|
let menuItemsArr: MenuItem[][] = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
196
197
|
let menuCallback: { [key: string]: Command } = {};
|
|
197
198
|
dragMenuConfig.forEach((item) => {
|
|
@@ -277,7 +278,7 @@ export const DragMenu = React.memo(
|
|
|
277
278
|
tableDuplicateCellColouring,
|
|
278
279
|
shouldUseIncreasedScalingPercent,
|
|
279
280
|
isTableFixedColumnWidthsOptionEnabled,
|
|
280
|
-
|
|
281
|
+
tableSortColumnReorder,
|
|
281
282
|
}: DragMenuProps & WrappedComponentProps) => {
|
|
282
283
|
const { state, dispatch } = editorView;
|
|
283
284
|
const { selection } = state;
|
|
@@ -320,13 +321,13 @@ export const DragMenu = React.memo(
|
|
|
320
321
|
tableDuplicateCellColouring,
|
|
321
322
|
isTableFixedColumnWidthsOptionEnabled,
|
|
322
323
|
shouldUseIncreasedScalingPercent,
|
|
323
|
-
|
|
324
|
+
tableSortColumnReorder,
|
|
324
325
|
);
|
|
325
326
|
|
|
326
327
|
const { menuItems, menuCallback } = convertToDropdownItems(
|
|
327
328
|
dragMenuConfig,
|
|
328
329
|
formatMessage,
|
|
329
|
-
|
|
330
|
+
tableSortColumnReorder,
|
|
330
331
|
selectionRect,
|
|
331
332
|
);
|
|
332
333
|
|
|
@@ -386,7 +387,7 @@ export const DragMenu = React.memo(
|
|
|
386
387
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
387
388
|
className={DropdownMenuSharedCssClassName.SUBMENU}
|
|
388
389
|
// 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(
|
|
390
|
+
css={dragMenuBackgroundColorStyles(tableSortColumnReorder)}
|
|
390
391
|
>
|
|
391
392
|
<div
|
|
392
393
|
// 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 +614,7 @@ export const DragMenu = React.memo(
|
|
|
613
614
|
}
|
|
614
615
|
|
|
615
616
|
if (allowBackgroundColor) {
|
|
616
|
-
|
|
617
|
+
tableSortColumnReorder
|
|
617
618
|
? menuItems[1].items.unshift(createBackgroundColorMenuItem())
|
|
618
619
|
: menuItems[0].items.unshift(createBackgroundColorMenuItem());
|
|
619
620
|
}
|
|
@@ -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
|
);
|
|
@@ -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
|
|
|
3
4
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
@@ -27,16 +28,14 @@ export const elementBeforeIconStyles = css({
|
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
// 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`
|
|
31
|
+
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder: boolean = false) => css`
|
|
33
32
|
.${ClassName.DRAG_SUBMENU} {
|
|
34
33
|
border-radius: ${token('border.radius', '3px')};
|
|
35
34
|
background: ${token('elevation.surface.overlay', 'white')};
|
|
36
35
|
box-shadow: ${token('elevation.shadow.overlay', `0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`)};
|
|
37
36
|
display: block;
|
|
38
37
|
position: absolute;
|
|
39
|
-
top: ${
|
|
38
|
+
top: ${tableSortColumnReorder
|
|
40
39
|
? TABLE_DRAG_MENU_PADDING_TOP +
|
|
41
40
|
TABLE_DRAG_MENU_SORT_GROUP_HEIGHT +
|
|
42
41
|
TABLE_DRAG_MENU_MENU_GROUP_BEFORE_HEIGHT
|
|
@@ -10,7 +10,6 @@ import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
12
12
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
13
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
14
|
import { token } from '@atlaskit/tokens';
|
|
16
15
|
|
|
@@ -128,30 +127,16 @@ const DragControlsComponent = ({
|
|
|
128
127
|
|
|
129
128
|
const handleMouseMove = useCallback(
|
|
130
129
|
(e: MouseEvent) => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const rowIndex = target?.getAttribute('data-start-index');
|
|
130
|
+
const target = e.nativeEvent.target instanceof Element ? e.nativeEvent.target : null;
|
|
131
|
+
const isParentDragControls = target?.closest(`.${ClassName.DRAG_ROW_CONTROLS}`);
|
|
132
|
+
const rowIndex = target?.getAttribute('data-start-index');
|
|
135
133
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
142
|
-
} else {
|
|
143
|
-
const isParentDragControls = (e.nativeEvent.target as Element).closest(
|
|
144
|
-
`.${ClassName.DRAG_ROW_CONTROLS}`,
|
|
145
|
-
);
|
|
146
|
-
const rowIndex = (e.nativeEvent.target as Element).getAttribute('data-start-index');
|
|
147
|
-
|
|
148
|
-
// avoid updating if event target is not related
|
|
149
|
-
if (!isParentDragControls || !rowIndex) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
updateCellHoverLocation(Number(rowIndex));
|
|
134
|
+
// avoid updating if event target is not related
|
|
135
|
+
if (!isParentDragControls || !rowIndex) {
|
|
136
|
+
return;
|
|
154
137
|
}
|
|
138
|
+
|
|
139
|
+
updateCellHoverLocation(Number(rowIndex));
|
|
155
140
|
},
|
|
156
141
|
[updateCellHoverLocation],
|
|
157
142
|
);
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -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
|
|
|
5
6
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
package/src/ui/ui-styles.ts
CHANGED
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
|
};
|