@atlaskit/editor-plugin-table 7.28.9 → 7.28.10
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/FloatingContextualButton/index.js +2 -1
- package/dist/cjs/ui/FloatingContextualButton/styles.js +9 -4
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +76 -45
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -10
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +19 -12
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -7
- package/dist/cjs/utils/drag-menu.js +47 -14
- package/dist/es2019/ui/FloatingContextualButton/index.js +2 -1
- package/dist/es2019/ui/FloatingContextualButton/styles.js +6 -1
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +0 -9
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +20 -13
- package/dist/es2019/ui/FloatingDragMenu/styles.js +0 -6
- package/dist/es2019/utils/drag-menu.js +50 -17
- package/dist/esm/ui/FloatingContextualButton/index.js +2 -1
- package/dist/esm/ui/FloatingContextualButton/styles.js +8 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +77 -46
- package/dist/esm/ui/FloatingContextualMenu/styles.js +0 -9
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +20 -13
- package/dist/esm/ui/FloatingDragMenu/styles.js +0 -6
- package/dist/esm/utils/drag-menu.js +47 -14
- package/dist/types/ui/FloatingContextualMenu/styles.d.ts +0 -1
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +0 -1
- package/dist/types/utils/drag-menu.d.ts +4 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +0 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +0 -1
- package/dist/types-ts4.5/utils/drag-menu.d.ts +4 -2
- package/package.json +5 -2
- package/src/ui/FloatingContextualButton/index.tsx +2 -2
- package/src/ui/FloatingContextualButton/styles.ts +5 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +75 -36
- package/src/ui/FloatingContextualMenu/styles.ts +0 -8
- package/src/ui/FloatingDragMenu/DragMenu.tsx +20 -15
- package/src/ui/FloatingDragMenu/styles.ts +0 -6
- package/src/utils/drag-menu.ts +73 -43
|
@@ -30,10 +30,19 @@ import { closestElement } from '@atlaskit/editor-common/utils';
|
|
|
30
30
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
31
31
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
32
32
|
import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
33
|
-
import CrossCircleIcon from '@atlaskit/icon/
|
|
34
|
-
import
|
|
35
|
-
import
|
|
33
|
+
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
34
|
+
import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
35
|
+
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
36
|
+
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
37
|
+
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
38
|
+
import TableCellMergeIcon from '@atlaskit/icon/core/table-cell-merge';
|
|
39
|
+
import TableCellSplitIcon from '@atlaskit/icon/core/table-cell-split';
|
|
40
|
+
import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
|
|
41
|
+
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
42
|
+
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
43
|
+
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
36
44
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
45
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
37
46
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../commands';
|
|
38
47
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
|
|
39
48
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -44,8 +53,13 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
44
53
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
45
54
|
import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
|
|
46
55
|
import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
|
|
47
|
-
import { cellColourPreviewStyles
|
|
56
|
+
import { cellColourPreviewStyles } from './styles';
|
|
48
57
|
var arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
|
|
58
|
+
var elementBeforeIconStyles = xcss({
|
|
59
|
+
marginRight: 'space.negative.075',
|
|
60
|
+
display: 'flex'
|
|
61
|
+
});
|
|
62
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
49
63
|
export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
50
64
|
_inherits(ContextualMenu, _Component);
|
|
51
65
|
var _super = _createSuper(ContextualMenu);
|
|
@@ -100,13 +114,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
100
114
|
value: {
|
|
101
115
|
name: 'background'
|
|
102
116
|
},
|
|
103
|
-
elemBefore: isDragAndDropEnabled ?
|
|
104
|
-
|
|
105
|
-
jsx(
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
118
|
+
xcss: elementBeforeIconStyles
|
|
119
|
+
}, jsx(PaintBucketIcon, {
|
|
120
|
+
color: "currentColor",
|
|
121
|
+
spacing: "spacious",
|
|
108
122
|
label: formatMessage(messages.backgroundColor),
|
|
109
|
-
|
|
123
|
+
LEGACY_fallbackIcon: EditorBackgroundColorIcon
|
|
110
124
|
})) : undefined,
|
|
111
125
|
elemAfter:
|
|
112
126
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -182,22 +196,28 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
182
196
|
name: 'merge'
|
|
183
197
|
},
|
|
184
198
|
isDisabled: !canMergeCells(state.tr),
|
|
185
|
-
elemBefore: isDragAndDropEnabled ?
|
|
186
|
-
|
|
187
|
-
jsx(
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
200
|
+
xcss: elementBeforeIconStyles
|
|
201
|
+
}, jsx(TableCellMergeIcon, {
|
|
202
|
+
color: "currentColor",
|
|
203
|
+
spacing: "spacious",
|
|
204
|
+
label: formatMessage(messages.mergeCells),
|
|
205
|
+
LEGACY_fallbackIcon: MergeCellsIcon
|
|
206
|
+
})) : undefined
|
|
190
207
|
}, {
|
|
191
208
|
content: formatMessage(messages.splitCell),
|
|
192
209
|
value: {
|
|
193
210
|
name: 'split'
|
|
194
211
|
},
|
|
195
212
|
isDisabled: !splitCell(state),
|
|
196
|
-
elemBefore: isDragAndDropEnabled ?
|
|
197
|
-
|
|
198
|
-
jsx(
|
|
199
|
-
|
|
200
|
-
|
|
213
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
214
|
+
xcss: elementBeforeIconStyles
|
|
215
|
+
}, jsx(TableCellSplitIcon, {
|
|
216
|
+
color: "currentColor",
|
|
217
|
+
spacing: "spacious",
|
|
218
|
+
label: formatMessage(messages.splitCell),
|
|
219
|
+
LEGACY_fallbackIcon: SplitCellIcon
|
|
220
|
+
})) : undefined
|
|
201
221
|
}];
|
|
202
222
|
}
|
|
203
223
|
return [];
|
|
@@ -220,9 +240,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
220
240
|
}, tooltip(addColumnAfter)),
|
|
221
241
|
elemBefore: isDragAndDropEnabled ?
|
|
222
242
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
223
|
-
jsx(
|
|
224
|
-
|
|
225
|
-
}, jsx(
|
|
243
|
+
jsx(Box, {
|
|
244
|
+
xcss: elementBeforeIconStyles
|
|
245
|
+
}, jsx(TableColumnAddRightIcon, {
|
|
246
|
+
color: "currentColor",
|
|
247
|
+
spacing: "spacious",
|
|
248
|
+
label: formatMessage(messages.addColumnRight),
|
|
249
|
+
LEGACY_fallbackIcon: AddColRightIcon
|
|
250
|
+
})) : undefined,
|
|
226
251
|
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addColumnAfter, String(content)) : undefined
|
|
227
252
|
};
|
|
228
253
|
});
|
|
@@ -242,11 +267,14 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
242
267
|
elemAfter: jsx("div", {
|
|
243
268
|
css: shortcutStyle
|
|
244
269
|
}, tooltip(addRowAfter)),
|
|
245
|
-
elemBefore: isDragAndDropEnabled ?
|
|
246
|
-
|
|
247
|
-
jsx(
|
|
248
|
-
|
|
249
|
-
|
|
270
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
271
|
+
xcss: elementBeforeIconStyles
|
|
272
|
+
}, jsx(TableRowAddBelowIcon, {
|
|
273
|
+
color: "currentColor",
|
|
274
|
+
spacing: "spacious",
|
|
275
|
+
label: formatMessage(messages.addRowBelow),
|
|
276
|
+
LEGACY_fallbackIcon: AddRowBelowIcon
|
|
277
|
+
})) : undefined,
|
|
250
278
|
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addRowAfter, String(content)) : undefined
|
|
251
279
|
};
|
|
252
280
|
});
|
|
@@ -275,14 +303,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
275
303
|
elemAfter: jsx("div", {
|
|
276
304
|
css: shortcutStyle
|
|
277
305
|
}, tooltip(backspace)),
|
|
278
|
-
elemBefore: isDragAndDropEnabled ?
|
|
279
|
-
|
|
280
|
-
jsx(
|
|
281
|
-
|
|
282
|
-
|
|
306
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
307
|
+
xcss: elementBeforeIconStyles
|
|
308
|
+
}, jsx(TableCellClearIcon, {
|
|
309
|
+
color: "currentColor",
|
|
310
|
+
spacing: "spacious",
|
|
283
311
|
label: formatMessage(messages.clearCells, {
|
|
284
312
|
0: Math.max(noOfColumns, noOfRows)
|
|
285
|
-
})
|
|
313
|
+
}),
|
|
314
|
+
LEGACY_fallbackIcon: CrossCircleIcon
|
|
286
315
|
})) : undefined,
|
|
287
316
|
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(backspace, String(content)) : undefined
|
|
288
317
|
};
|
|
@@ -304,14 +333,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
304
333
|
value: {
|
|
305
334
|
name: 'delete_column'
|
|
306
335
|
},
|
|
307
|
-
elemBefore: isDragAndDropEnabled ?
|
|
308
|
-
|
|
309
|
-
jsx(
|
|
310
|
-
|
|
311
|
-
|
|
336
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
337
|
+
xcss: elementBeforeIconStyles
|
|
338
|
+
}, jsx(TableColumnDeleteIcon, {
|
|
339
|
+
color: "currentColor",
|
|
340
|
+
spacing: "spacious",
|
|
312
341
|
label: formatMessage(messages.removeColumns, {
|
|
313
342
|
0: noOfColumns
|
|
314
|
-
})
|
|
343
|
+
}),
|
|
344
|
+
LEGACY_fallbackIcon: RemoveIcon
|
|
315
345
|
})) : undefined
|
|
316
346
|
};
|
|
317
347
|
});
|
|
@@ -332,14 +362,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
332
362
|
value: {
|
|
333
363
|
name: 'delete_row'
|
|
334
364
|
},
|
|
335
|
-
elemBefore: isDragAndDropEnabled ?
|
|
336
|
-
|
|
337
|
-
jsx(
|
|
338
|
-
|
|
339
|
-
|
|
365
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
366
|
+
xcss: elementBeforeIconStyles
|
|
367
|
+
}, jsx(TableRowDeleteIcon, {
|
|
368
|
+
color: "currentColor",
|
|
369
|
+
spacing: "spacious",
|
|
340
370
|
label: formatMessage(messages.removeRows, {
|
|
341
371
|
0: noOfRows
|
|
342
|
-
})
|
|
372
|
+
}),
|
|
373
|
+
LEGACY_fallbackIcon: RemoveIcon
|
|
343
374
|
})) : undefined
|
|
344
375
|
};
|
|
345
376
|
});
|
|
@@ -14,15 +14,6 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
19
|
-
export var elementBeforeIconStyles = css({
|
|
20
|
-
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
21
|
-
display: 'flex'
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
25
|
-
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
26
17
|
export var tablePopupStyles = function tablePopupStyles(isDragAndDropEnabled
|
|
27
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
28
19
|
) {
|
|
@@ -22,7 +22,9 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
|
22
22
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
23
23
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
24
24
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
25
|
-
import EditorBackgroundColorIcon from '@atlaskit/icon/
|
|
25
|
+
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
26
|
+
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
27
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
26
28
|
import Toggle from '@atlaskit/toggle';
|
|
27
29
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
28
30
|
import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
|
|
@@ -34,7 +36,7 @@ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColum
|
|
|
34
36
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
35
37
|
import { colorPalletteColumns } from '../consts';
|
|
36
38
|
import { DropdownMenu } from './DropdownMenu';
|
|
37
|
-
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles,
|
|
39
|
+
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
|
|
38
40
|
var MapDragMenuOptionIdToMessage = {
|
|
39
41
|
add_row_above: {
|
|
40
42
|
message: messages.addRowAbove,
|
|
@@ -99,6 +101,10 @@ var getGroupedDragMenuConfig = function getGroupedDragMenuConfig(tableSortColumn
|
|
|
99
101
|
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
100
102
|
return groupedDragMenuConfig;
|
|
101
103
|
};
|
|
104
|
+
var elementBeforeIconStyles = xcss({
|
|
105
|
+
marginRight: 'space.negative.075',
|
|
106
|
+
display: 'flex'
|
|
107
|
+
});
|
|
102
108
|
var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, formatMessage) {
|
|
103
109
|
var tableSortColumnReorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
104
110
|
var selectionRect = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -150,12 +156,13 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
|
|
|
150
156
|
name: item.id
|
|
151
157
|
},
|
|
152
158
|
isDisabled: item.disabled,
|
|
153
|
-
elemBefore: item.icon ?
|
|
154
|
-
|
|
155
|
-
jsx("span", {
|
|
156
|
-
css: elementBeforeIconStyles
|
|
159
|
+
elemBefore: item.icon ? jsx(Box, {
|
|
160
|
+
xcss: elementBeforeIconStyles
|
|
157
161
|
}, jsx(item.icon, {
|
|
158
|
-
|
|
162
|
+
color: "currentColor",
|
|
163
|
+
spacing: "spacious",
|
|
164
|
+
label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options),
|
|
165
|
+
LEGACY_fallbackIcon: item.iconFallback ? item.iconFallback : undefined
|
|
159
166
|
})) : undefined,
|
|
160
167
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
161
168
|
elemAfter: item.keymap ? jsx("div", {
|
|
@@ -253,13 +260,13 @@ var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
253
260
|
value: {
|
|
254
261
|
name: 'background'
|
|
255
262
|
},
|
|
256
|
-
elemBefore:
|
|
257
|
-
|
|
258
|
-
jsx(
|
|
259
|
-
|
|
260
|
-
|
|
263
|
+
elemBefore: jsx(Box, {
|
|
264
|
+
xcss: elementBeforeIconStyles
|
|
265
|
+
}, jsx(PaintBucketIcon, {
|
|
266
|
+
color: "currentColor",
|
|
267
|
+
spacing: "spacious",
|
|
261
268
|
label: formatMessage(messages.backgroundColor),
|
|
262
|
-
|
|
269
|
+
LEGACY_fallbackIcon: EditorBackgroundColorIcon
|
|
263
270
|
})),
|
|
264
271
|
elemAfter: jsx("div", {
|
|
265
272
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -15,12 +15,6 @@ export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedCo
|
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
19
|
-
export var elementBeforeIconStyles = css({
|
|
20
|
-
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
21
|
-
display: 'flex'
|
|
22
|
-
});
|
|
23
|
-
|
|
24
18
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
25
19
|
export var dragMenuBackgroundColorStyles = function dragMenuBackgroundColorStyles() {
|
|
26
20
|
var tableSortColumnReorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -2,6 +2,20 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
|
+
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
6
|
+
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
7
|
+
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
8
|
+
import TableColumnAddLeftIcon from '@atlaskit/icon/core/table-column-add-left';
|
|
9
|
+
import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
|
|
10
|
+
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
11
|
+
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
12
|
+
import TableColumnMoveRightIcon from '@atlaskit/icon/core/table-column-move-right';
|
|
13
|
+
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
14
|
+
import TableRowAddAboveIcon from '@atlaskit/icon/core/table-row-add-above';
|
|
15
|
+
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
16
|
+
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
17
|
+
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
18
|
+
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
5
19
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
6
20
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
7
21
|
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
@@ -76,27 +90,32 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
76
90
|
var addOptions = direction === 'row' ? [{
|
|
77
91
|
label: 'above',
|
|
78
92
|
offset: 0,
|
|
79
|
-
icon:
|
|
93
|
+
icon: TableRowAddAboveIcon,
|
|
94
|
+
iconFallback: AddRowAboveIcon,
|
|
80
95
|
keymap: addRowBefore
|
|
81
96
|
}, {
|
|
82
97
|
label: 'below',
|
|
83
98
|
offset: 1,
|
|
84
|
-
icon:
|
|
99
|
+
icon: TableRowAddBelowIcon,
|
|
100
|
+
iconFallback: AddRowBelowIcon,
|
|
85
101
|
keymap: addRowAfter
|
|
86
102
|
}] : [{
|
|
87
103
|
label: 'left',
|
|
88
104
|
offset: 0,
|
|
89
|
-
icon:
|
|
105
|
+
icon: TableColumnAddLeftIcon,
|
|
106
|
+
iconFallback: AddColLeftIcon,
|
|
90
107
|
keymap: addColumnBefore
|
|
91
108
|
}, {
|
|
92
109
|
label: 'right',
|
|
93
110
|
offset: 1,
|
|
94
|
-
icon:
|
|
111
|
+
icon: TableColumnAddRightIcon,
|
|
112
|
+
iconFallback: AddColRightIcon,
|
|
95
113
|
keymap: addColumnAfter
|
|
96
114
|
}];
|
|
97
115
|
var moveOptions = direction === 'row' ? [{
|
|
98
116
|
label: 'up',
|
|
99
|
-
icon:
|
|
117
|
+
icon: TableRowMoveUpIcon,
|
|
118
|
+
iconFallback: ArrowUpIcon,
|
|
100
119
|
keymap: moveRowUp,
|
|
101
120
|
canMove: canMove('table-row', -1, (_tableMap$height = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height !== void 0 ? _tableMap$height : 0, selection, selectionRect),
|
|
102
121
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -105,7 +124,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
105
124
|
}
|
|
106
125
|
}, {
|
|
107
126
|
label: 'down',
|
|
108
|
-
icon:
|
|
127
|
+
icon: TableRowMoveDownIcon,
|
|
128
|
+
iconFallback: ArrowDownIcon,
|
|
109
129
|
keymap: moveRowDown,
|
|
110
130
|
canMove: canMove('table-row', 1, (_tableMap$height2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.height) !== null && _tableMap$height2 !== void 0 ? _tableMap$height2 : 0, selection, selectionRect),
|
|
111
131
|
getOriginIndexes: getSelectedRowIndexes,
|
|
@@ -114,7 +134,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
114
134
|
}
|
|
115
135
|
}] : [{
|
|
116
136
|
label: 'left',
|
|
117
|
-
icon:
|
|
137
|
+
icon: TableColumnMoveLeftIcon,
|
|
138
|
+
iconFallback: ArrowLeftIcon,
|
|
118
139
|
keymap: moveColumnLeft,
|
|
119
140
|
canMove: canMove('table-column', -1, (_tableMap$width = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width !== void 0 ? _tableMap$width : 0, selection, selectionRect),
|
|
120
141
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -123,7 +144,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
123
144
|
}
|
|
124
145
|
}, {
|
|
125
146
|
label: 'right',
|
|
126
|
-
icon:
|
|
147
|
+
icon: TableColumnMoveRightIcon,
|
|
148
|
+
iconFallback: ArrowRightIcon,
|
|
127
149
|
keymap: moveColumnRight,
|
|
128
150
|
canMove: canMove('table-column', 1, (_tableMap$width2 = tableMap === null || tableMap === void 0 ? void 0 : tableMap.width) !== null && _tableMap$width2 !== void 0 ? _tableMap$width2 : 0, selection, selectionRect),
|
|
129
151
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -134,21 +156,25 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
134
156
|
var sortOptions = direction === 'column' ? [{
|
|
135
157
|
label: 'increasing',
|
|
136
158
|
order: SortOrder.ASC,
|
|
137
|
-
icon:
|
|
159
|
+
icon: SortAscendingIcon,
|
|
160
|
+
iconFallback: HipchatChevronDoubleUpIcon
|
|
138
161
|
}, {
|
|
139
162
|
label: 'decreasing',
|
|
140
163
|
order: SortOrder.DESC,
|
|
141
|
-
icon:
|
|
164
|
+
icon: SortDescendingIcon,
|
|
165
|
+
iconFallback: HipchatChevronDoubleDownIcon
|
|
142
166
|
}] : [];
|
|
143
167
|
var sortConfigs = _toConsumableArray(sortOptions.map(function (_ref) {
|
|
144
168
|
var label = _ref.label,
|
|
145
169
|
order = _ref.order,
|
|
146
|
-
icon = _ref.icon
|
|
170
|
+
icon = _ref.icon,
|
|
171
|
+
iconFallback = _ref.iconFallback;
|
|
147
172
|
return {
|
|
148
173
|
id: "sort_column_".concat(order),
|
|
149
174
|
title: "Sort ".concat(label),
|
|
150
175
|
disabled: hasMergedCellsInTable,
|
|
151
176
|
icon: icon,
|
|
177
|
+
iconFallback: iconFallback,
|
|
152
178
|
onClick: function onClick(state, dispatch) {
|
|
153
179
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
|
|
154
180
|
return true;
|
|
@@ -159,11 +185,13 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
159
185
|
var label = _ref2.label,
|
|
160
186
|
offset = _ref2.offset,
|
|
161
187
|
icon = _ref2.icon,
|
|
188
|
+
iconFallback = _ref2.iconFallback,
|
|
162
189
|
keymap = _ref2.keymap;
|
|
163
190
|
return {
|
|
164
191
|
id: "add_".concat(direction, "_").concat(label),
|
|
165
192
|
title: "Add ".concat(direction, " ").concat(label),
|
|
166
193
|
icon: icon,
|
|
194
|
+
iconFallback: iconFallback,
|
|
167
195
|
onClick: function onClick(state, dispatch) {
|
|
168
196
|
if (direction === 'row') {
|
|
169
197
|
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
@@ -193,7 +221,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
193
221
|
}
|
|
194
222
|
return false;
|
|
195
223
|
},
|
|
196
|
-
icon:
|
|
224
|
+
icon: TableColumnsDistributeIcon,
|
|
225
|
+
iconFallback: EditorLayoutThreeEqualIcon
|
|
197
226
|
} : undefined, {
|
|
198
227
|
id: 'clear_cells',
|
|
199
228
|
title: 'Clear cells',
|
|
@@ -201,7 +230,8 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
201
230
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
202
231
|
return true;
|
|
203
232
|
},
|
|
204
|
-
icon:
|
|
233
|
+
icon: TableCellClearIcon,
|
|
234
|
+
iconFallback: CrossCircleIcon,
|
|
205
235
|
keymap: tooltip(backspace)
|
|
206
236
|
}, {
|
|
207
237
|
id: "delete_".concat(direction),
|
|
@@ -214,12 +244,14 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
214
244
|
}
|
|
215
245
|
return true;
|
|
216
246
|
},
|
|
217
|
-
icon:
|
|
247
|
+
icon: direction === 'row' ? TableRowDeleteIcon : TableColumnDeleteIcon,
|
|
248
|
+
iconFallback: RemoveIcon,
|
|
218
249
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
219
250
|
}], _toConsumableArray(moveOptions.map(function (_ref3) {
|
|
220
251
|
var label = _ref3.label,
|
|
221
252
|
canMove = _ref3.canMove,
|
|
222
253
|
icon = _ref3.icon,
|
|
254
|
+
iconFallback = _ref3.iconFallback,
|
|
223
255
|
keymap = _ref3.keymap,
|
|
224
256
|
getOriginIndexes = _ref3.getOriginIndexes,
|
|
225
257
|
getTargetIndex = _ref3.getTargetIndex;
|
|
@@ -228,6 +260,7 @@ export var getDragMenuConfig = function getDragMenuConfig(direction, getEditorCo
|
|
|
228
260
|
title: "Move ".concat(direction, " ").concat(label),
|
|
229
261
|
disabled: !canMove,
|
|
230
262
|
icon: icon,
|
|
263
|
+
iconFallback: iconFallback,
|
|
231
264
|
onClick: function onClick(state, dispatch) {
|
|
232
265
|
if (canMove) {
|
|
233
266
|
requestAnimationFrame(function () {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
-
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
2
|
export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
-
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
2
|
export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
|
|
4
3
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { Command, DropdownOptionT, GetEditorContainerWidth
|
|
3
|
+
import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
5
5
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
|
+
import type { UNSAFE_NewIconProps } from '@atlaskit/icon/types';
|
|
8
9
|
import type { DraggableData, DraggableType, PluginInjectionAPI, TableDirection } from '../types';
|
|
9
10
|
export declare const getTargetIndex: (selectedIndexes: number[], direction: DraggableData['direction']) => number;
|
|
10
11
|
export declare const canMove: (sourceType: DraggableType, direction: DraggableData['direction'], totalItemsOfSourceTypeCount: number, selection: Selection, selectionRect?: Rect) => boolean;
|
|
11
12
|
export type DragMenuOptionIdType = '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' | 'sort_column_asc' | 'sort_column_desc';
|
|
12
13
|
export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
13
14
|
id: DragMenuOptionIdType;
|
|
14
|
-
icon?: React.ComponentType<React.PropsWithChildren<
|
|
15
|
+
icon?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
16
|
+
iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
15
17
|
keymap?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
-
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
2
|
export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
-
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
3
2
|
export declare const dragMenuBackgroundColorStyles: (tableSortColumnReorder?: boolean) => import("@emotion/react").SerializedStyles;
|
|
4
3
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { Command, DropdownOptionT, GetEditorContainerWidth
|
|
3
|
+
import type { Command, DropdownOptionT, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
5
5
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import type { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
|
+
import type { UNSAFE_NewIconProps } from '@atlaskit/icon/types';
|
|
8
9
|
import type { DraggableData, DraggableType, PluginInjectionAPI, TableDirection } from '../types';
|
|
9
10
|
export declare const getTargetIndex: (selectedIndexes: number[], direction: DraggableData['direction']) => number;
|
|
10
11
|
export declare const canMove: (sourceType: DraggableType, direction: DraggableData['direction'], totalItemsOfSourceTypeCount: number, selection: Selection, selectionRect?: Rect) => boolean;
|
|
11
12
|
export type DragMenuOptionIdType = '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' | 'sort_column_asc' | 'sort_column_desc';
|
|
12
13
|
export interface DragMenuConfig extends Omit<DropdownOptionT<Command>, 'icon'> {
|
|
13
14
|
id: DragMenuOptionIdType;
|
|
14
|
-
icon?: React.ComponentType<React.PropsWithChildren<
|
|
15
|
+
icon?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
16
|
+
iconFallback?: React.ComponentType<React.PropsWithChildren<UNSAFE_NewIconProps>>;
|
|
15
17
|
keymap?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, hasMergedCellsInTable: boolean, editorView: EditorView, api: PluginInjectionAPI | undefined | null, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, tableSortColumnReorder?: boolean, ariaNotifyPlugin?: ((message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void) | undefined, isCommentEditor?: boolean) => DragMenuConfig[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.28.
|
|
3
|
+
"version": "7.28.10",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
31
31
|
"@atlaskit/button": "^20.2.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
33
|
-
"@atlaskit/editor-common": "^93.
|
|
33
|
+
"@atlaskit/editor-common": "^93.2.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.1",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
@@ -117,6 +117,9 @@
|
|
|
117
117
|
},
|
|
118
118
|
"platform_editor_breakout_use_css": {
|
|
119
119
|
"type": "boolean"
|
|
120
|
+
},
|
|
121
|
+
"platform-visual-refresh-icons": {
|
|
122
|
+
"type": "boolean"
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
}
|
|
@@ -20,7 +20,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
20
20
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
21
21
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
22
22
|
import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
|
|
23
|
-
import ExpandIcon from '@atlaskit/icon/
|
|
23
|
+
import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
24
24
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
25
|
|
|
26
26
|
import { toggleContextualMenu } from '../../commands';
|
|
@@ -110,7 +110,7 @@ const FloatingContextualButtonInner = React.memo((props: Props & WrappedComponen
|
|
|
110
110
|
fg('platform_editor_a11y_table_context_menu') ? focusToContextMenuTrigger : undefined
|
|
111
111
|
}
|
|
112
112
|
onClick={handleClick}
|
|
113
|
-
iconBefore={<ExpandIcon label="" isFacadeDisabled={true} />}
|
|
113
|
+
iconBefore={<ExpandIcon label="" color="currentColor" isFacadeDisabled={true} />}
|
|
114
114
|
aria-label={labelCellOptions}
|
|
115
115
|
aria-expanded={
|
|
116
116
|
fg('platform_editor_a11y_table_context_menu') ? isContextualMenuOpen : undefined
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
2
|
import { css } from '@emotion/react';
|
|
3
3
|
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { token } from '@atlaskit/tokens';
|
|
6
7
|
|
|
@@ -17,6 +18,10 @@ export const tableFloatingCellButtonStyles = () =>
|
|
|
17
18
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
18
19
|
height: `${contextualMenuTriggerSize + 2}px`,
|
|
19
20
|
flexDirection: 'column',
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
22
|
+
...(fg('platform-visual-refresh-icons') && {
|
|
23
|
+
width: token('space.250', '20px'),
|
|
24
|
+
}),
|
|
20
25
|
},
|
|
21
26
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
22
27
|
'&& button': {
|