@atlaskit/editor-plugin-table 5.6.7 → 5.7.0

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/types.js +1 -0
  3. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +238 -99
  4. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  5. package/dist/cjs/ui/icons/MergeCellsIcon.js +34 -0
  6. package/dist/cjs/ui/icons/SplitCellIcon.js +41 -0
  7. package/dist/cjs/ui/icons/index.js +14 -0
  8. package/dist/es2019/types.js +1 -0
  9. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +248 -71
  10. package/dist/es2019/ui/FloatingContextualMenu/styles.js +20 -0
  11. package/dist/es2019/ui/icons/MergeCellsIcon.js +25 -0
  12. package/dist/es2019/ui/icons/SplitCellIcon.js +32 -0
  13. package/dist/es2019/ui/icons/index.js +2 -0
  14. package/dist/esm/types.js +1 -0
  15. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +238 -98
  16. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  17. package/dist/esm/ui/icons/MergeCellsIcon.js +27 -0
  18. package/dist/esm/ui/icons/SplitCellIcon.js +34 -0
  19. package/dist/esm/ui/icons/index.js +2 -0
  20. package/dist/types/types.d.ts +1 -0
  21. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +12 -2
  22. package/dist/types/ui/icons/MergeCellsIcon.d.ts +2 -0
  23. package/dist/types/ui/icons/SplitCellIcon.d.ts +2 -0
  24. package/dist/types/ui/icons/index.d.ts +2 -0
  25. package/dist/types-ts4.5/types.d.ts +1 -0
  26. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +12 -2
  27. package/dist/types-ts4.5/ui/icons/MergeCellsIcon.d.ts +2 -0
  28. package/dist/types-ts4.5/ui/icons/SplitCellIcon.d.ts +2 -0
  29. package/dist/types-ts4.5/ui/icons/index.d.ts +2 -0
  30. package/package.json +11 -4
  31. package/src/types.ts +1 -0
  32. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +316 -68
  33. package/src/ui/FloatingContextualMenu/styles.ts +20 -0
  34. package/src/ui/icons/MergeCellsIcon.tsx +32 -0
  35. package/src/ui/icons/SplitCellIcon.tsx +40 -0
  36. package/src/ui/icons/index.ts +2 -0
@@ -28,9 +28,19 @@ export declare class ContextualMenu extends Component<Props & WrappedComponentPr
28
28
  static defaultProps: {
29
29
  boundariesElement: HTMLElement | undefined;
30
30
  };
31
- render(): jsx.JSX.Element | null;
31
+ render(): jsx.JSX.Element;
32
32
  private handleSubMenuRef;
33
- private createItems;
33
+ private createBackgroundColorItem;
34
+ private createMergeSplitCellItems;
35
+ private createInsertColumnItem;
36
+ private createInsertRowItem;
37
+ private createClearCellsItem;
38
+ private createDeleteColumnItem;
39
+ private createDeleteRowItem;
40
+ private createDistributeColumnsItem;
41
+ private createSortColumnItems;
42
+ private createOriginalContextMenuItems;
43
+ private createNewContextMenuItems;
34
44
  private onMenuItemActivated;
35
45
  private toggleOpen;
36
46
  private handleOpenChange;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const MergeCellsIcon: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SplitCellIcon: () => JSX.Element;
@@ -2,6 +2,8 @@ export { DragHandleIcon } from './DragHandleIcon';
2
2
  export { DragInMotionIcon } from './DragInMotionIcon';
3
3
  export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
4
4
  export { MinimisedHandleIcon } from './MinimisedHandle';
5
+ export { MergeCellsIcon } from './MergeCellsIcon';
6
+ export { SplitCellIcon } from './SplitCellIcon';
5
7
  export { AddRowAboveIcon } from './AddRowAboveIcon';
6
8
  export { AddRowBelowIcon } from './AddRowBelowIcon';
7
9
  export { AddColLeftIcon } from './AddColLeftIcon';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.6.7",
3
+ "version": "5.7.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,12 +24,13 @@
24
24
  "atlassian": {
25
25
  "team": "Editor: Jenga",
26
26
  "singleton": true,
27
- "releaseModel": "continuous"
27
+ "releaseModel": "continuous",
28
+ "runReact18": false
28
29
  },
29
30
  "dependencies": {
30
31
  "@atlaskit/adf-schema": "^35.2.0",
31
32
  "@atlaskit/custom-steps": "^0.0.10",
32
- "@atlaskit/editor-common": "^76.27.0",
33
+ "@atlaskit/editor-common": "^76.29.0",
33
34
  "@atlaskit/editor-palette": "1.5.2",
34
35
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
35
36
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
@@ -46,7 +47,7 @@
46
47
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
47
48
  "@atlaskit/primitives": "^1.15.0",
48
49
  "@atlaskit/theme": "^12.6.0",
49
- "@atlaskit/tokens": "^1.30.0",
50
+ "@atlaskit/tokens": "^1.31.0",
50
51
  "@atlaskit/tooltip": "^18.1.0",
51
52
  "@babel/runtime": "^7.0.0",
52
53
  "@emotion/react": "^11.7.1",
@@ -141,6 +142,12 @@
141
142
  },
142
143
  "platform.editor.a11y.table-selection_9uv33": {
143
144
  "type": "boolean"
145
+ },
146
+ "platform.editor.table.new-cell-context-menu-styling": {
147
+ "type": "boolean"
148
+ },
149
+ "platform.editor.menu.group-items": {
150
+ "type": "boolean"
144
151
  }
145
152
  }
146
153
  }
package/src/types.ts CHANGED
@@ -368,6 +368,7 @@ export const TableCssClassName = {
368
368
  CONTEXTUAL_MENU_BUTTON: `${tablePrefixSelector}-contextual-menu-button`,
369
369
  CONTEXTUAL_MENU_BUTTON_FIXED: `${tablePrefixSelector}-contextual-menu-button-fixed`,
370
370
  CONTEXTUAL_MENU_ICON: `${tablePrefixSelector}-contextual-submenu-icon`,
371
+ CONTEXTUAL_MENU_ICON_SMALL: `${tablePrefixSelector}-contextual-submenu-icon-small`,
371
372
 
372
373
  // come from prosemirror-table
373
374
  SELECTED_CELL: 'selectedCell',
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @atlaskit/design-system/prefer-primitives */
1
2
  /** @jsx jsx */
2
3
  import { Component } from 'react';
3
4
 
@@ -39,6 +40,10 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
39
40
  import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
40
41
  import type { Rect } from '@atlaskit/editor-tables/table-map';
41
42
  import { splitCell } from '@atlaskit/editor-tables/utils';
43
+ import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
44
+ import EditorBackgroundColorIcon from '@atlaskit/icon/glyph/editor/background-color';
45
+ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
46
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
42
47
 
43
48
  import {
44
49
  clearHoverSelection,
@@ -69,6 +74,12 @@ import {
69
74
  getSelectedRowIndexes,
70
75
  } from '../../utils';
71
76
  import { contextualMenuDropdownWidth } from '../consts';
77
+ import {
78
+ AddColRightIcon,
79
+ AddRowBelowIcon,
80
+ MergeCellsIcon,
81
+ SplitCellIcon,
82
+ } from '../icons';
72
83
 
73
84
  import { cellColourPreviewStyles } from './styles';
74
85
 
@@ -105,11 +116,14 @@ export class ContextualMenu extends Component<
105
116
  };
106
117
 
107
118
  render() {
108
- const { isOpen, mountPoint, offset, boundariesElement } = this.props;
109
- const items = this.createItems();
110
- if (!items) {
111
- return null;
112
- }
119
+ const { isOpen, mountPoint, offset, boundariesElement, editorView } =
120
+ this.props;
121
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
122
+ const items =
123
+ isDragAndDropEnabled &&
124
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling')
125
+ ? this.createNewContextMenuItems()
126
+ : this.createOriginalContextMenuItems();
113
127
 
114
128
  return (
115
129
  <div
@@ -134,6 +148,15 @@ export class ContextualMenu extends Component<
134
148
  fitWidth={contextualMenuDropdownWidth}
135
149
  boundariesElement={boundariesElement}
136
150
  offset={offset}
151
+ section={
152
+ isDragAndDropEnabled &&
153
+ getBooleanFF(
154
+ 'platform.editor.table.new-cell-context-menu-styling',
155
+ ) &&
156
+ getBooleanFF('platform.editor.menu.group-items')
157
+ ? { hasSeparator: true }
158
+ : undefined
159
+ }
137
160
  />
138
161
  </div>
139
162
  );
@@ -154,24 +177,19 @@ export class ContextualMenu extends Component<
154
177
  }
155
178
  };
156
179
 
157
- private createItems = () => {
180
+ private createBackgroundColorItem = () => {
158
181
  const {
159
- allowMergeCells,
160
- allowColumnSorting,
161
182
  allowBackgroundColor,
162
183
  editorView: { state },
163
184
  isOpen,
164
- selectionRect,
165
185
  intl: { formatMessage },
166
186
  editorView,
167
187
  } = this.props;
168
- const items: any[] = [];
169
188
  const { isSubmenuOpen } = this.state;
170
- // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
171
- const {
172
- targetCellPosition,
173
- pluginConfig: { allowDistributeColumns },
174
- } = getPluginState(editorView.state);
189
+ const { targetCellPosition, isDragAndDropEnabled } = getPluginState(
190
+ editorView.state,
191
+ );
192
+
175
193
  if (allowBackgroundColor) {
176
194
  const node =
177
195
  isOpen && targetCellPosition
@@ -180,14 +198,35 @@ export class ContextualMenu extends Component<
180
198
  const background = hexToEditorBackgroundPaletteColor(
181
199
  node?.attrs?.background || '#ffffff',
182
200
  );
183
- items.push({
184
- content: formatMessage(messages.cellBackground),
201
+ return {
202
+ content:
203
+ isDragAndDropEnabled &&
204
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling')
205
+ ? formatMessage(messages.backgroundColor)
206
+ : formatMessage(messages.cellBackground),
185
207
  value: { name: 'background' },
208
+ elemBefore:
209
+ isDragAndDropEnabled &&
210
+ getBooleanFF(
211
+ 'platform.editor.table.new-cell-context-menu-styling',
212
+ ) ? (
213
+ <EditorBackgroundColorIcon
214
+ label={formatMessage(messages.backgroundColor)}
215
+ size="medium"
216
+ />
217
+ ) : undefined,
186
218
  elemAfter: (
187
219
  <div className={DropdownMenuSharedCssClassName.SUBMENU}>
188
220
  <div
189
221
  css={cellColourPreviewStyles(background)}
190
- className={ClassName.CONTEXTUAL_MENU_ICON}
222
+ className={
223
+ isDragAndDropEnabled &&
224
+ getBooleanFF(
225
+ 'platform.editor.table.new-cell-context-menu-styling',
226
+ )
227
+ ? ClassName.CONTEXTUAL_MENU_ICON_SMALL
228
+ : ClassName.CONTEXTUAL_MENU_ICON
229
+ }
191
230
  />
192
231
  {isSubmenuOpen && (
193
232
  <div
@@ -209,72 +248,232 @@ export class ContextualMenu extends Component<
209
248
  )}
210
249
  </div>
211
250
  ),
212
- });
251
+ } as MenuItem;
213
252
  }
253
+ };
254
+
255
+ private createMergeSplitCellItems = () => {
256
+ const {
257
+ allowMergeCells,
258
+ editorView: { state },
259
+ intl: { formatMessage },
260
+ editorView,
261
+ } = this.props;
262
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
214
263
 
215
- items.push({
216
- content: formatMessage(messages.insertColumn),
264
+ if (allowMergeCells) {
265
+ return [
266
+ {
267
+ content: formatMessage(messages.mergeCells),
268
+ value: { name: 'merge' },
269
+ isDisabled: !canMergeCells(state.tr),
270
+ elemBefore:
271
+ isDragAndDropEnabled &&
272
+ getBooleanFF(
273
+ 'platform.editor.table.new-cell-context-menu-styling',
274
+ ) ? (
275
+ <MergeCellsIcon />
276
+ ) : undefined,
277
+ },
278
+ {
279
+ content: formatMessage(messages.splitCell),
280
+ value: { name: 'split' },
281
+ isDisabled: !splitCell(state),
282
+ elemBefore:
283
+ isDragAndDropEnabled &&
284
+ getBooleanFF(
285
+ 'platform.editor.table.new-cell-context-menu-styling',
286
+ ) ? (
287
+ <SplitCellIcon />
288
+ ) : undefined,
289
+ },
290
+ ] as MenuItem[];
291
+ }
292
+ return [];
293
+ };
294
+
295
+ private createInsertColumnItem = () => {
296
+ const {
297
+ intl: { formatMessage },
298
+ editorView,
299
+ } = this.props;
300
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
301
+
302
+ return {
303
+ content: formatMessage(
304
+ isDragAndDropEnabled &&
305
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling')
306
+ ? messages.addColumn
307
+ : messages.insertColumn,
308
+ ),
217
309
  value: { name: 'insert_column' },
218
310
  elemAfter: <div css={shortcutStyle}>{tooltip(addColumnAfter)}</div>,
219
- });
311
+ elemBefore:
312
+ isDragAndDropEnabled &&
313
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
314
+ <AddColRightIcon />
315
+ ) : undefined,
316
+ } as MenuItem;
317
+ };
220
318
 
221
- items.push({
222
- content: formatMessage(messages.insertRow),
319
+ private createInsertRowItem = () => {
320
+ const {
321
+ intl: { formatMessage },
322
+ editorView,
323
+ } = this.props;
324
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
325
+
326
+ return {
327
+ content: formatMessage(
328
+ isDragAndDropEnabled &&
329
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling')
330
+ ? messages.addRow
331
+ : messages.insertRow,
332
+ ),
223
333
  value: { name: 'insert_row' },
224
334
  elemAfter: <div css={shortcutStyle}>{tooltip(addRowAfter)}</div>,
225
- });
335
+ elemBefore:
336
+ isDragAndDropEnabled &&
337
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
338
+ <AddRowBelowIcon />
339
+ ) : undefined,
340
+ } as MenuItem;
341
+ };
226
342
 
343
+ private createClearCellsItem = () => {
344
+ const {
345
+ selectionRect,
346
+ intl: { formatMessage },
347
+ editorView,
348
+ } = this.props;
349
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
227
350
  const { top, bottom, right, left } = selectionRect;
228
351
  const noOfColumns = right - left;
229
352
  const noOfRows = bottom - top;
230
353
 
231
- items.push({
354
+ return {
355
+ content: formatMessage(messages.clearCells, {
356
+ 0: Math.max(noOfColumns, noOfRows),
357
+ }),
358
+ value: { name: 'clear' },
359
+ elemAfter: <div css={shortcutStyle}>{tooltip(backspace)}</div>,
360
+ elemBefore:
361
+ isDragAndDropEnabled &&
362
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
363
+ <CrossCircleIcon
364
+ label={formatMessage(messages.clearCells, {
365
+ 0: Math.max(noOfColumns, noOfRows),
366
+ })}
367
+ />
368
+ ) : undefined,
369
+ } as MenuItem;
370
+ };
371
+
372
+ private createDeleteColumnItem = () => {
373
+ const {
374
+ selectionRect,
375
+ intl: { formatMessage },
376
+ editorView,
377
+ } = this.props;
378
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
379
+
380
+ const { right, left } = selectionRect;
381
+ const noOfColumns = right - left;
382
+
383
+ return {
232
384
  content: formatMessage(messages.removeColumns, {
233
385
  0: noOfColumns,
234
386
  }),
235
387
  value: { name: 'delete_column' },
236
- });
388
+ elemBefore:
389
+ isDragAndDropEnabled &&
390
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
391
+ <RemoveIcon
392
+ label={formatMessage(messages.removeColumns, {
393
+ 0: noOfColumns,
394
+ })}
395
+ />
396
+ ) : undefined,
397
+ } as MenuItem;
398
+ };
399
+
400
+ private createDeleteRowItem = () => {
401
+ const {
402
+ selectionRect,
403
+ intl: { formatMessage },
404
+ editorView,
405
+ } = this.props;
406
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
237
407
 
238
- items.push({
408
+ const { bottom, top } = selectionRect;
409
+ const noOfRows = bottom - top;
410
+
411
+ return {
239
412
  content: formatMessage(messages.removeRows, {
240
413
  0: noOfRows,
241
414
  }),
242
415
  value: { name: 'delete_row' },
243
- });
244
-
245
- if (allowMergeCells) {
246
- items.push({
247
- content: formatMessage(messages.mergeCells),
248
- value: { name: 'merge' },
249
- isDisabled: !canMergeCells(state.tr),
250
- });
251
- items.push({
252
- content: formatMessage(messages.splitCell),
253
- value: { name: 'split' },
254
- isDisabled: !splitCell(state),
255
- });
256
- }
416
+ elemBefore:
417
+ isDragAndDropEnabled &&
418
+ getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
419
+ <RemoveIcon
420
+ label={formatMessage(messages.removeRows, {
421
+ 0: noOfRows,
422
+ })}
423
+ />
424
+ ) : undefined,
425
+ } as MenuItem;
426
+ };
257
427
 
258
- if (allowDistributeColumns) {
428
+ private createDistributeColumnsItem = () => {
429
+ const {
430
+ selectionRect,
431
+ intl: { formatMessage },
432
+ editorView,
433
+ getEditorContainerWidth,
434
+ } = this.props;
435
+ const {
436
+ isDragAndDropEnabled,
437
+ pluginConfig: { allowDistributeColumns },
438
+ } = getPluginState(editorView.state);
439
+ if (
440
+ allowDistributeColumns &&
441
+ (!isDragAndDropEnabled ||
442
+ !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))
443
+ ) {
259
444
  const newResizeState = getNewResizeStateFromSelectedColumns(
260
445
  selectionRect,
261
- state,
446
+ editorView.state,
262
447
  editorView.domAtPos.bind(editorView),
263
- this.props.getEditorContainerWidth,
448
+ getEditorContainerWidth,
264
449
  );
265
450
 
266
451
  const wouldChange = newResizeState?.changed ?? false;
267
452
 
268
- items.push({
453
+ return {
269
454
  content: formatMessage(messages.distributeColumns),
270
455
  value: { name: 'distribute_columns' },
271
456
  isDisabled: !wouldChange,
272
- });
457
+ } as MenuItem;
273
458
  }
459
+ return null;
460
+ };
274
461
 
275
- if (allowColumnSorting) {
462
+ private createSortColumnItems = () => {
463
+ const {
464
+ intl: { formatMessage },
465
+ editorView,
466
+ allowColumnSorting,
467
+ } = this.props;
468
+ const { isDragAndDropEnabled } = getPluginState(editorView.state);
469
+
470
+ if (
471
+ allowColumnSorting &&
472
+ (!isDragAndDropEnabled ||
473
+ !getBooleanFF('platform.editor.table.new-cell-context-menu-styling'))
474
+ ) {
276
475
  const hasMergedCellsInTable =
277
- getMergedCellsPositions(state.tr).length > 0;
476
+ getMergedCellsPositions(editorView.state.tr).length > 0;
278
477
  const warning = hasMergedCellsInTable
279
478
  ? {
280
479
  tooltipDescription: formatMessage(messages.canNotSortTable),
@@ -282,28 +481,77 @@ export class ContextualMenu extends Component<
282
481
  }
283
482
  : {};
284
483
 
285
- items.push({
286
- content: formatMessage(messages.sortColumnASC),
287
- value: { name: 'sort_column_asc' },
288
- ...warning,
289
- });
290
-
291
- items.push({
292
- content: formatMessage(messages.sortColumnDESC),
293
- value: { name: 'sort_column_desc' },
294
- ...warning,
295
- });
484
+ return [
485
+ {
486
+ content: formatMessage(messages.sortColumnASC),
487
+ value: { name: 'sort_column_asc' },
488
+ ...warning,
489
+ },
490
+ {
491
+ content: formatMessage(messages.sortColumnDESC),
492
+ value: { name: 'sort_column_desc' },
493
+ ...warning,
494
+ },
495
+ ] as MenuItem[];
296
496
  }
297
497
 
298
- items.push({
299
- content: formatMessage(messages.clearCells, {
300
- 0: Math.max(noOfColumns, noOfRows),
301
- }),
302
- value: { name: 'clear' },
303
- elemAfter: <div css={shortcutStyle}>{tooltip(backspace)}</div>,
304
- });
498
+ return null;
499
+ };
500
+
501
+ private createOriginalContextMenuItems = () => {
502
+ let items: MenuItem[] = [];
503
+ const backgroundColorItem = this.createBackgroundColorItem();
504
+ backgroundColorItem && items.push(backgroundColorItem);
505
+
506
+ items.push(this.createInsertColumnItem());
507
+
508
+ items.push(this.createInsertRowItem());
509
+
510
+ items.push(this.createDeleteColumnItem());
511
+
512
+ items.push(this.createDeleteRowItem());
513
+
514
+ items.push(...this.createMergeSplitCellItems());
515
+
516
+ const distributeColumnsItem = this.createDistributeColumnsItem();
517
+ distributeColumnsItem && items.push(distributeColumnsItem);
518
+
519
+ const sortColumnItems = this.createSortColumnItems();
520
+ sortColumnItems && items.push(...sortColumnItems);
521
+
522
+ items.push(this.createClearCellsItem());
523
+
524
+ return [{ items }];
525
+ };
305
526
 
306
- return items.length ? [{ items }] : null;
527
+ private createNewContextMenuItems = () => {
528
+ const backgroundColorItem = this.createBackgroundColorItem();
529
+ const mergeSplitCellItems = this.createMergeSplitCellItems();
530
+ const insertColumnItem = this.createInsertColumnItem();
531
+ const insertRowItem = this.createInsertRowItem();
532
+ const clearCellsItem = this.createClearCellsItem();
533
+ const deleteColumnItem = this.createDeleteColumnItem();
534
+ const deleteRowItem = this.createDeleteRowItem();
535
+
536
+ // Group items so when table.menu.group-items FF is enabled, a divider shows under split cell, above add column
537
+ let items: { items: MenuItem[] }[] = [
538
+ {
539
+ items: [],
540
+ },
541
+ {
542
+ items: [],
543
+ },
544
+ ];
545
+
546
+ backgroundColorItem && items[0].items.push(backgroundColorItem);
547
+ items[0].items.push(...mergeSplitCellItems);
548
+ items[1].items.push(insertColumnItem);
549
+ items[1].items.push(insertRowItem);
550
+ items[1].items.push(clearCellsItem);
551
+ items[1].items.push(deleteColumnItem);
552
+ items[1].items.push(deleteRowItem);
553
+
554
+ return items;
307
555
  };
308
556
 
309
557
  private onMenuItemActivated = ({ item }: { item: DropdownItem }) => {
@@ -53,4 +53,24 @@ export const tablePopupStyles = css`
53
53
  color: ${token('color.icon', N90)};
54
54
  }
55
55
  }
56
+
57
+ .${ClassName.CONTEXTUAL_MENU_ICON_SMALL} {
58
+ display: flex;
59
+
60
+ &::before {
61
+ content: '';
62
+ display: block;
63
+ border: 1px solid ${tableBackgroundBorderColor};
64
+ border-radius: ${token('border.radius', '3px')};
65
+ width: 14px;
66
+ height: 14px;
67
+ }
68
+
69
+ &::after {
70
+ content: '›';
71
+ margin-left: ${token('space.050', '4px')};
72
+ line-height: 14px;
73
+ color: ${token('color.icon', N90)};
74
+ }
75
+ }
56
76
  `;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+
3
+ export const MergeCellsIcon = () => (
4
+ <svg
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ fillRule="evenodd"
13
+ clipRule="evenodd"
14
+ d="M10 19C10.5523 19 11 18.5523 11 18C11 17.4477 10.5523 17 10 17H6V7L10 7C10.5523 7 11 6.55228 11 6C11 5.44771 10.5523 5 10 5H6C4.89543 5 4 5.89543 4 7V17C4 18.1046 4.89543 19 6 19H10ZM14 5C13.4477 5 13 5.44772 13 6C13 6.55228 13.4477 7 14 7H18V17L14 17C13.4477 17 13 17.4477 13 18C13 18.5523 13.4477 19 14 19H18C19.1046 19 20 18.1046 20 17V7C20 5.89543 19.1046 5 18 5H14Z"
15
+ fill="currentColor"
16
+ />
17
+ <path
18
+ d="M15.75 10L13.75 12L15.75 14"
19
+ stroke="currentColor"
20
+ strokeWidth="1.5"
21
+ strokeLinecap="round"
22
+ strokeLinejoin="round"
23
+ />
24
+ <path
25
+ d="M8.25 14L10.25 12L8.25 10"
26
+ stroke="currentColor"
27
+ strokeWidth="1.5"
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ </svg>
32
+ );
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+
3
+ export const SplitCellIcon = () => (
4
+ <svg
5
+ width="24"
6
+ height="24"
7
+ viewBox="0 0 24 24"
8
+ fill="none"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ >
11
+ <path
12
+ d="M19 18L14 18L14 6L19 6"
13
+ stroke="currentColor"
14
+ strokeWidth="2"
15
+ strokeLinecap="round"
16
+ strokeLinejoin="round"
17
+ />
18
+ <path
19
+ d="M5 6L10 6L9.99999 18L5 18"
20
+ stroke="currentColor"
21
+ strokeWidth="2"
22
+ strokeLinecap="round"
23
+ strokeLinejoin="round"
24
+ />
25
+ <path
26
+ d="M7 10L5 12L7 14"
27
+ stroke="currentColor"
28
+ strokeWidth="1.5"
29
+ strokeLinecap="round"
30
+ strokeLinejoin="round"
31
+ />
32
+ <path
33
+ d="M17 14L19 12L17 10"
34
+ stroke="currentColor"
35
+ strokeWidth="1.5"
36
+ strokeLinecap="round"
37
+ strokeLinejoin="round"
38
+ />
39
+ </svg>
40
+ );