@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
|
@@ -19,10 +19,19 @@ import { closestElement } from '@atlaskit/editor-common/utils';
|
|
|
19
19
|
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
20
20
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
21
21
|
import { splitCell } from '@atlaskit/editor-tables/utils';
|
|
22
|
-
import CrossCircleIcon from '@atlaskit/icon/
|
|
23
|
-
import
|
|
24
|
-
import
|
|
22
|
+
import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
|
|
23
|
+
import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
|
|
24
|
+
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
25
|
+
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
26
|
+
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
27
|
+
import TableCellMergeIcon from '@atlaskit/icon/core/table-cell-merge';
|
|
28
|
+
import TableCellSplitIcon from '@atlaskit/icon/core/table-cell-split';
|
|
29
|
+
import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
|
|
30
|
+
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
31
|
+
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
32
|
+
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
25
33
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
34
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
26
35
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, setFocusToCellMenu, toggleContextualMenu } from '../../commands';
|
|
27
36
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics } from '../../commands-with-analytics';
|
|
28
37
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
@@ -33,8 +42,13 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
33
42
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
34
43
|
import { colorPalletteColumns, contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD } from '../consts';
|
|
35
44
|
import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
|
|
36
|
-
import { cellColourPreviewStyles
|
|
45
|
+
import { cellColourPreviewStyles } from './styles';
|
|
37
46
|
const arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
|
|
47
|
+
const elementBeforeIconStyles = xcss({
|
|
48
|
+
marginRight: 'space.negative.075',
|
|
49
|
+
display: 'flex'
|
|
50
|
+
});
|
|
51
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
38
52
|
export class ContextualMenu extends Component {
|
|
39
53
|
constructor(...args) {
|
|
40
54
|
super(...args);
|
|
@@ -90,13 +104,13 @@ export class ContextualMenu extends Component {
|
|
|
90
104
|
value: {
|
|
91
105
|
name: 'background'
|
|
92
106
|
},
|
|
93
|
-
elemBefore: isDragAndDropEnabled ?
|
|
94
|
-
|
|
95
|
-
jsx(
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
108
|
+
xcss: elementBeforeIconStyles
|
|
109
|
+
}, jsx(PaintBucketIcon, {
|
|
110
|
+
color: "currentColor",
|
|
111
|
+
spacing: "spacious",
|
|
98
112
|
label: formatMessage(messages.backgroundColor),
|
|
99
|
-
|
|
113
|
+
LEGACY_fallbackIcon: EditorBackgroundColorIcon
|
|
100
114
|
})) : undefined,
|
|
101
115
|
elemAfter:
|
|
102
116
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -178,22 +192,28 @@ export class ContextualMenu extends Component {
|
|
|
178
192
|
name: 'merge'
|
|
179
193
|
},
|
|
180
194
|
isDisabled: !canMergeCells(state.tr),
|
|
181
|
-
elemBefore: isDragAndDropEnabled ?
|
|
182
|
-
|
|
183
|
-
jsx(
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
196
|
+
xcss: elementBeforeIconStyles
|
|
197
|
+
}, jsx(TableCellMergeIcon, {
|
|
198
|
+
color: "currentColor",
|
|
199
|
+
spacing: "spacious",
|
|
200
|
+
label: formatMessage(messages.mergeCells),
|
|
201
|
+
LEGACY_fallbackIcon: MergeCellsIcon
|
|
202
|
+
})) : undefined
|
|
186
203
|
}, {
|
|
187
204
|
content: formatMessage(messages.splitCell),
|
|
188
205
|
value: {
|
|
189
206
|
name: 'split'
|
|
190
207
|
},
|
|
191
208
|
isDisabled: !splitCell(state),
|
|
192
|
-
elemBefore: isDragAndDropEnabled ?
|
|
193
|
-
|
|
194
|
-
jsx(
|
|
195
|
-
|
|
196
|
-
|
|
209
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
210
|
+
xcss: elementBeforeIconStyles
|
|
211
|
+
}, jsx(TableCellSplitIcon, {
|
|
212
|
+
color: "currentColor",
|
|
213
|
+
spacing: "spacious",
|
|
214
|
+
label: formatMessage(messages.splitCell),
|
|
215
|
+
LEGACY_fallbackIcon: SplitCellIcon
|
|
216
|
+
})) : undefined
|
|
197
217
|
}];
|
|
198
218
|
}
|
|
199
219
|
return [];
|
|
@@ -220,9 +240,14 @@ export class ContextualMenu extends 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
|
});
|
|
@@ -246,11 +271,14 @@ export class ContextualMenu extends Component {
|
|
|
246
271
|
elemAfter: jsx("div", {
|
|
247
272
|
css: shortcutStyle
|
|
248
273
|
}, tooltip(addRowAfter)),
|
|
249
|
-
elemBefore: isDragAndDropEnabled ?
|
|
250
|
-
|
|
251
|
-
jsx(
|
|
252
|
-
|
|
253
|
-
|
|
274
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
275
|
+
xcss: elementBeforeIconStyles
|
|
276
|
+
}, jsx(TableRowAddBelowIcon, {
|
|
277
|
+
color: "currentColor",
|
|
278
|
+
spacing: "spacious",
|
|
279
|
+
label: formatMessage(messages.addRowBelow),
|
|
280
|
+
LEGACY_fallbackIcon: AddRowBelowIcon
|
|
281
|
+
})) : undefined,
|
|
254
282
|
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(addRowAfter, String(content)) : undefined
|
|
255
283
|
};
|
|
256
284
|
});
|
|
@@ -285,14 +313,15 @@ export class ContextualMenu extends Component {
|
|
|
285
313
|
elemAfter: jsx("div", {
|
|
286
314
|
css: shortcutStyle
|
|
287
315
|
}, tooltip(backspace)),
|
|
288
|
-
elemBefore: isDragAndDropEnabled ?
|
|
289
|
-
|
|
290
|
-
jsx(
|
|
291
|
-
|
|
292
|
-
|
|
316
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
317
|
+
xcss: elementBeforeIconStyles
|
|
318
|
+
}, jsx(TableCellClearIcon, {
|
|
319
|
+
color: "currentColor",
|
|
320
|
+
spacing: "spacious",
|
|
293
321
|
label: formatMessage(messages.clearCells, {
|
|
294
322
|
0: Math.max(noOfColumns, noOfRows)
|
|
295
|
-
})
|
|
323
|
+
}),
|
|
324
|
+
LEGACY_fallbackIcon: CrossCircleIcon
|
|
296
325
|
})) : undefined,
|
|
297
326
|
'aria-label': fg('platform_editor_announce_cell_options_hotkeys') ? tooltip(backspace, String(content)) : undefined
|
|
298
327
|
};
|
|
@@ -320,14 +349,15 @@ export class ContextualMenu extends Component {
|
|
|
320
349
|
value: {
|
|
321
350
|
name: 'delete_column'
|
|
322
351
|
},
|
|
323
|
-
elemBefore: isDragAndDropEnabled ?
|
|
324
|
-
|
|
325
|
-
jsx(
|
|
326
|
-
|
|
327
|
-
|
|
352
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
353
|
+
xcss: elementBeforeIconStyles
|
|
354
|
+
}, jsx(TableColumnDeleteIcon, {
|
|
355
|
+
color: "currentColor",
|
|
356
|
+
spacing: "spacious",
|
|
328
357
|
label: formatMessage(messages.removeColumns, {
|
|
329
358
|
0: noOfColumns
|
|
330
|
-
})
|
|
359
|
+
}),
|
|
360
|
+
LEGACY_fallbackIcon: RemoveIcon
|
|
331
361
|
})) : undefined
|
|
332
362
|
};
|
|
333
363
|
});
|
|
@@ -354,14 +384,15 @@ export class ContextualMenu extends Component {
|
|
|
354
384
|
value: {
|
|
355
385
|
name: 'delete_row'
|
|
356
386
|
},
|
|
357
|
-
elemBefore: isDragAndDropEnabled ?
|
|
358
|
-
|
|
359
|
-
jsx(
|
|
360
|
-
|
|
361
|
-
|
|
387
|
+
elemBefore: isDragAndDropEnabled ? jsx(Box, {
|
|
388
|
+
xcss: elementBeforeIconStyles
|
|
389
|
+
}, jsx(TableRowDeleteIcon, {
|
|
390
|
+
color: "currentColor",
|
|
391
|
+
spacing: "spacious",
|
|
362
392
|
label: formatMessage(messages.removeRows, {
|
|
363
393
|
0: noOfRows
|
|
364
|
-
})
|
|
394
|
+
}),
|
|
395
|
+
LEGACY_fallbackIcon: RemoveIcon
|
|
365
396
|
})) : undefined
|
|
366
397
|
};
|
|
367
398
|
});
|
|
@@ -10,15 +10,6 @@ export const cellColourPreviewStyles = selectedColor => css({
|
|
|
10
10
|
background: selectedColor
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
15
|
-
export const elementBeforeIconStyles = css({
|
|
16
|
-
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
17
|
-
display: 'flex'
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
21
|
-
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
22
13
|
export const tablePopupStyles = (isDragAndDropEnabled
|
|
23
14
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
24
15
|
) => css`
|
|
@@ -20,7 +20,9 @@ import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
|
20
20
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
21
21
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
22
22
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
23
|
-
import EditorBackgroundColorIcon from '@atlaskit/icon/
|
|
23
|
+
import EditorBackgroundColorIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
|
|
24
|
+
import PaintBucketIcon from '@atlaskit/icon/core/paint-bucket';
|
|
25
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
24
26
|
import Toggle from '@atlaskit/toggle';
|
|
25
27
|
import { clearHoverSelection, hoverColumns, hoverRows } from '../../commands';
|
|
26
28
|
import { setColorWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics } from '../../commands-with-analytics';
|
|
@@ -32,7 +34,7 @@ import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColum
|
|
|
32
34
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
33
35
|
import { colorPalletteColumns } from '../consts';
|
|
34
36
|
import { DropdownMenu } from './DropdownMenu';
|
|
35
|
-
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles,
|
|
37
|
+
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
|
|
36
38
|
const MapDragMenuOptionIdToMessage = {
|
|
37
39
|
add_row_above: {
|
|
38
40
|
message: messages.addRowAbove,
|
|
@@ -97,6 +99,10 @@ const getGroupedDragMenuConfig = tableSortColumnReorder => {
|
|
|
97
99
|
tableSortColumnReorder ? groupedDragMenuConfig.unshift(sortColumnItems) : groupedDragMenuConfig.push(sortColumnItems);
|
|
98
100
|
return groupedDragMenuConfig;
|
|
99
101
|
};
|
|
102
|
+
const elementBeforeIconStyles = xcss({
|
|
103
|
+
marginRight: 'space.negative.075',
|
|
104
|
+
display: 'flex'
|
|
105
|
+
});
|
|
100
106
|
const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnReorder = false, selectionRect) => {
|
|
101
107
|
const groupedDragMenuConfig = getGroupedDragMenuConfig(tableSortColumnReorder);
|
|
102
108
|
let menuItemsArr = [...Array(groupedDragMenuConfig.length)].map(() => []);
|
|
@@ -144,12 +150,13 @@ const convertToDropdownItems = (dragMenuConfig, formatMessage, tableSortColumnRe
|
|
|
144
150
|
name: item.id
|
|
145
151
|
},
|
|
146
152
|
isDisabled: item.disabled,
|
|
147
|
-
elemBefore: item.icon ?
|
|
148
|
-
|
|
149
|
-
jsx("span", {
|
|
150
|
-
css: elementBeforeIconStyles
|
|
153
|
+
elemBefore: item.icon ? jsx(Box, {
|
|
154
|
+
xcss: elementBeforeIconStyles
|
|
151
155
|
}, jsx(item.icon, {
|
|
152
|
-
|
|
156
|
+
color: "currentColor",
|
|
157
|
+
spacing: "spacious",
|
|
158
|
+
label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options),
|
|
159
|
+
LEGACY_fallbackIcon: item.iconFallback ? item.iconFallback : undefined
|
|
153
160
|
})) : undefined,
|
|
154
161
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
155
162
|
elemAfter: item.keymap ? jsx("div", {
|
|
@@ -256,13 +263,13 @@ const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
256
263
|
value: {
|
|
257
264
|
name: 'background'
|
|
258
265
|
},
|
|
259
|
-
elemBefore:
|
|
260
|
-
|
|
261
|
-
jsx(
|
|
262
|
-
|
|
263
|
-
|
|
266
|
+
elemBefore: jsx(Box, {
|
|
267
|
+
xcss: elementBeforeIconStyles
|
|
268
|
+
}, jsx(PaintBucketIcon, {
|
|
269
|
+
color: "currentColor",
|
|
270
|
+
spacing: "spacious",
|
|
264
271
|
label: formatMessage(messages.backgroundColor),
|
|
265
|
-
|
|
272
|
+
LEGACY_fallbackIcon: EditorBackgroundColorIcon
|
|
266
273
|
})),
|
|
267
274
|
elemAfter: jsx("div", {
|
|
268
275
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -11,12 +11,6 @@ export const cellColourPreviewStyles = selectedColor => css({
|
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
|
|
15
|
-
export const elementBeforeIconStyles = css({
|
|
16
|
-
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
17
|
-
display: 'flex'
|
|
18
|
-
});
|
|
19
|
-
|
|
20
14
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
21
15
|
export const dragMenuBackgroundColorStyles = (tableSortColumnReorder = false) => css`
|
|
22
16
|
.${ClassName.DRAG_SUBMENU} {
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, deleteColumn, deleteRow, moveColumnLeft, moveColumnRight, moveRowDown, moveRowUp, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
|
+
import SortAscendingIcon from '@atlaskit/icon/core/sort-ascending';
|
|
5
|
+
import SortDescendingIcon from '@atlaskit/icon/core/sort-descending';
|
|
6
|
+
import TableCellClearIcon from '@atlaskit/icon/core/table-cell-clear';
|
|
7
|
+
import TableColumnAddLeftIcon from '@atlaskit/icon/core/table-column-add-left';
|
|
8
|
+
import TableColumnAddRightIcon from '@atlaskit/icon/core/table-column-add-right';
|
|
9
|
+
import TableColumnDeleteIcon from '@atlaskit/icon/core/table-column-delete';
|
|
10
|
+
import TableColumnMoveLeftIcon from '@atlaskit/icon/core/table-column-move-left';
|
|
11
|
+
import TableColumnMoveRightIcon from '@atlaskit/icon/core/table-column-move-right';
|
|
12
|
+
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
13
|
+
import TableRowAddAboveIcon from '@atlaskit/icon/core/table-row-add-above';
|
|
14
|
+
import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
|
|
15
|
+
import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
|
|
16
|
+
import TableRowMoveDownIcon from '@atlaskit/icon/core/table-row-move-down';
|
|
17
|
+
import TableRowMoveUpIcon from '@atlaskit/icon/core/table-row-move-up';
|
|
4
18
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
5
19
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
6
20
|
import ArrowRightIcon from '@atlaskit/icon/glyph/arrow-right';
|
|
@@ -69,48 +83,56 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
69
83
|
const addOptions = direction === 'row' ? [{
|
|
70
84
|
label: 'above',
|
|
71
85
|
offset: 0,
|
|
72
|
-
icon:
|
|
86
|
+
icon: TableRowAddAboveIcon,
|
|
87
|
+
iconFallback: AddRowAboveIcon,
|
|
73
88
|
keymap: addRowBefore
|
|
74
89
|
}, {
|
|
75
90
|
label: 'below',
|
|
76
91
|
offset: 1,
|
|
77
|
-
icon:
|
|
92
|
+
icon: TableRowAddBelowIcon,
|
|
93
|
+
iconFallback: AddRowBelowIcon,
|
|
78
94
|
keymap: addRowAfter
|
|
79
95
|
}] : [{
|
|
80
96
|
label: 'left',
|
|
81
97
|
offset: 0,
|
|
82
|
-
icon:
|
|
98
|
+
icon: TableColumnAddLeftIcon,
|
|
99
|
+
iconFallback: AddColLeftIcon,
|
|
83
100
|
keymap: addColumnBefore
|
|
84
101
|
}, {
|
|
85
102
|
label: 'right',
|
|
86
103
|
offset: 1,
|
|
87
|
-
icon:
|
|
104
|
+
icon: TableColumnAddRightIcon,
|
|
105
|
+
iconFallback: AddColRightIcon,
|
|
88
106
|
keymap: addColumnAfter
|
|
89
107
|
}];
|
|
90
108
|
const moveOptions = direction === 'row' ? [{
|
|
91
109
|
label: 'up',
|
|
92
|
-
icon:
|
|
110
|
+
icon: TableRowMoveUpIcon,
|
|
111
|
+
iconFallback: ArrowUpIcon,
|
|
93
112
|
keymap: moveRowUp,
|
|
94
113
|
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),
|
|
95
114
|
getOriginIndexes: getSelectedRowIndexes,
|
|
96
115
|
getTargetIndex: selectionRect => selectionRect.top - 1
|
|
97
116
|
}, {
|
|
98
117
|
label: 'down',
|
|
99
|
-
icon:
|
|
118
|
+
icon: TableRowMoveDownIcon,
|
|
119
|
+
iconFallback: ArrowDownIcon,
|
|
100
120
|
keymap: moveRowDown,
|
|
101
121
|
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),
|
|
102
122
|
getOriginIndexes: getSelectedRowIndexes,
|
|
103
123
|
getTargetIndex: selectionRect => selectionRect.bottom
|
|
104
124
|
}] : [{
|
|
105
125
|
label: 'left',
|
|
106
|
-
icon:
|
|
126
|
+
icon: TableColumnMoveLeftIcon,
|
|
127
|
+
iconFallback: ArrowLeftIcon,
|
|
107
128
|
keymap: moveColumnLeft,
|
|
108
129
|
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),
|
|
109
130
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
110
131
|
getTargetIndex: selectionRect => selectionRect.left - 1
|
|
111
132
|
}, {
|
|
112
133
|
label: 'right',
|
|
113
|
-
icon:
|
|
134
|
+
icon: TableColumnMoveRightIcon,
|
|
135
|
+
iconFallback: ArrowRightIcon,
|
|
114
136
|
keymap: moveColumnRight,
|
|
115
137
|
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),
|
|
116
138
|
getOriginIndexes: getSelectedColumnIndexes,
|
|
@@ -119,21 +141,25 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
119
141
|
const sortOptions = direction === 'column' ? [{
|
|
120
142
|
label: 'increasing',
|
|
121
143
|
order: SortOrder.ASC,
|
|
122
|
-
icon:
|
|
144
|
+
icon: SortAscendingIcon,
|
|
145
|
+
iconFallback: HipchatChevronDoubleUpIcon
|
|
123
146
|
}, {
|
|
124
147
|
label: 'decreasing',
|
|
125
148
|
order: SortOrder.DESC,
|
|
126
|
-
icon:
|
|
149
|
+
icon: SortDescendingIcon,
|
|
150
|
+
iconFallback: HipchatChevronDoubleDownIcon
|
|
127
151
|
}] : [];
|
|
128
152
|
const sortConfigs = [...sortOptions.map(({
|
|
129
153
|
label,
|
|
130
154
|
order,
|
|
131
|
-
icon
|
|
155
|
+
icon,
|
|
156
|
+
iconFallback
|
|
132
157
|
}) => ({
|
|
133
158
|
id: `sort_column_${order}`,
|
|
134
159
|
title: `Sort ${label}`,
|
|
135
160
|
disabled: hasMergedCellsInTable,
|
|
136
|
-
icon,
|
|
161
|
+
icon: icon,
|
|
162
|
+
iconFallback: iconFallback,
|
|
137
163
|
onClick: (state, dispatch) => {
|
|
138
164
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, index !== null && index !== void 0 ? index : 0, order)(state, dispatch);
|
|
139
165
|
return true;
|
|
@@ -143,11 +169,13 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
143
169
|
label,
|
|
144
170
|
offset,
|
|
145
171
|
icon,
|
|
172
|
+
iconFallback,
|
|
146
173
|
keymap
|
|
147
174
|
}) => ({
|
|
148
175
|
id: `add_${direction}_${label}`,
|
|
149
176
|
title: `Add ${direction} ${label}`,
|
|
150
|
-
icon,
|
|
177
|
+
icon: icon,
|
|
178
|
+
iconFallback: iconFallback,
|
|
151
179
|
onClick: (state, dispatch) => {
|
|
152
180
|
if (direction === 'row') {
|
|
153
181
|
insertRowWithAnalytics(editorAnalyticsAPI, tableDuplicateCellColouring)(INPUT_METHOD.TABLE_CONTEXT_MENU, {
|
|
@@ -176,7 +204,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
176
204
|
}
|
|
177
205
|
return false;
|
|
178
206
|
},
|
|
179
|
-
icon:
|
|
207
|
+
icon: TableColumnsDistributeIcon,
|
|
208
|
+
iconFallback: EditorLayoutThreeEqualIcon
|
|
180
209
|
} : undefined, {
|
|
181
210
|
id: 'clear_cells',
|
|
182
211
|
title: 'Clear cells',
|
|
@@ -184,7 +213,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
184
213
|
emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, targetCellPosition)(state, dispatch);
|
|
185
214
|
return true;
|
|
186
215
|
},
|
|
187
|
-
icon:
|
|
216
|
+
icon: TableCellClearIcon,
|
|
217
|
+
iconFallback: CrossCircleIcon,
|
|
188
218
|
keymap: tooltip(backspace)
|
|
189
219
|
}, {
|
|
190
220
|
id: `delete_${direction}`,
|
|
@@ -197,12 +227,14 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
197
227
|
}
|
|
198
228
|
return true;
|
|
199
229
|
},
|
|
200
|
-
icon:
|
|
230
|
+
icon: direction === 'row' ? TableRowDeleteIcon : TableColumnDeleteIcon,
|
|
231
|
+
iconFallback: RemoveIcon,
|
|
201
232
|
keymap: direction === 'row' ? tooltip(deleteRow) : tooltip(deleteColumn)
|
|
202
233
|
}, ...moveOptions.map(({
|
|
203
234
|
label,
|
|
204
235
|
canMove,
|
|
205
236
|
icon,
|
|
237
|
+
iconFallback,
|
|
206
238
|
keymap,
|
|
207
239
|
getOriginIndexes,
|
|
208
240
|
getTargetIndex
|
|
@@ -210,7 +242,8 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, hasMergedC
|
|
|
210
242
|
id: `move_${direction}_${label}`,
|
|
211
243
|
title: `Move ${direction} ${label}`,
|
|
212
244
|
disabled: !canMove,
|
|
213
|
-
icon,
|
|
245
|
+
icon: icon,
|
|
246
|
+
iconFallback: iconFallback,
|
|
214
247
|
onClick: (state, dispatch) => {
|
|
215
248
|
if (canMove) {
|
|
216
249
|
requestAnimationFrame(() => {
|
|
@@ -15,7 +15,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
|
|
|
15
15
|
import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
16
16
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
17
17
|
import { akEditorSmallZIndex } from '@atlaskit/editor-shared-styles';
|
|
18
|
-
import ExpandIcon from '@atlaskit/icon/
|
|
18
|
+
import ExpandIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import { toggleContextualMenu } from '../../commands';
|
|
21
21
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -78,6 +78,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
78
78
|
onClick: handleClick,
|
|
79
79
|
iconBefore: jsx(ExpandIcon, {
|
|
80
80
|
label: "",
|
|
81
|
+
color: "currentColor",
|
|
81
82
|
isFacadeDisabled: true
|
|
82
83
|
}),
|
|
83
84
|
"aria-label": labelCellOptions,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
1
4
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
5
|
import { css } from '@emotion/react';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
7
|
import { N0, N20, N30A, N700 } from '@atlaskit/theme/colors';
|
|
4
8
|
import { contextualMenuTriggerSize } from '../consts';
|
|
5
9
|
export var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles() {
|
|
6
10
|
return css({
|
|
7
11
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
8
|
-
'> div': {
|
|
12
|
+
'> div': _objectSpread({
|
|
9
13
|
// Sits behind button to provide surface-color background
|
|
10
14
|
background: "var(--ds-surface, ".concat(N20, ")"),
|
|
11
15
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -13,7 +17,9 @@ export var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyle
|
|
|
13
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
14
18
|
height: "".concat(contextualMenuTriggerSize + 2, "px"),
|
|
15
19
|
flexDirection: 'column'
|
|
16
|
-
},
|
|
20
|
+
}, fg('platform-visual-refresh-icons') && {
|
|
21
|
+
width: "var(--ds-space-250, 20px)"
|
|
22
|
+
}),
|
|
17
23
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
18
24
|
'&& button': {
|
|
19
25
|
background: "var(--ds-background-neutral, none)",
|