@atlaskit/editor-plugin-table 7.16.11 → 7.16.13

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 (254) hide show
  1. package/.eslintrc.js +3 -3
  2. package/CHANGELOG.md +16 -0
  3. package/dist/cjs/commands/misc.js +3 -3
  4. package/dist/cjs/nodeviews/TableCell.js +10 -10
  5. package/dist/cjs/nodeviews/TableContainer.js +83 -27
  6. package/dist/cjs/nodeviews/TableResizer.js +40 -19
  7. package/dist/cjs/nodeviews/TableRow.js +23 -23
  8. package/dist/cjs/pm-plugins/table-resizing/plugin.js +3 -3
  9. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  10. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  11. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  12. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
  13. package/dist/cjs/ui/common-styles.js +13 -13
  14. package/dist/cjs/ui/ui-styles.js +25 -25
  15. package/dist/cjs/utils/guidelines.js +7 -4
  16. package/dist/cjs/utils/merged-cells.js +3 -3
  17. package/dist/cjs/utils/snapping.js +7 -8
  18. package/dist/es2019/commands/misc.js +3 -3
  19. package/dist/es2019/nodeviews/TableContainer.js +70 -9
  20. package/dist/es2019/nodeviews/TableResizer.js +42 -21
  21. package/dist/es2019/nodeviews/TableRow.js +21 -21
  22. package/dist/es2019/pm-plugins/table-resizing/plugin.js +3 -3
  23. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  24. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  25. package/dist/es2019/ui/FloatingContextualMenu/styles.js +47 -47
  26. package/dist/es2019/ui/FloatingDragMenu/styles.js +30 -30
  27. package/dist/es2019/ui/common-styles.js +802 -816
  28. package/dist/es2019/ui/ui-styles.js +665 -678
  29. package/dist/es2019/utils/guidelines.js +5 -2
  30. package/dist/es2019/utils/merged-cells.js +3 -3
  31. package/dist/es2019/utils/snapping.js +5 -6
  32. package/dist/esm/commands/misc.js +3 -3
  33. package/dist/esm/nodeviews/TableCell.js +10 -10
  34. package/dist/esm/nodeviews/TableContainer.js +85 -29
  35. package/dist/esm/nodeviews/TableResizer.js +42 -21
  36. package/dist/esm/nodeviews/TableRow.js +23 -23
  37. package/dist/esm/pm-plugins/table-resizing/plugin.js +3 -3
  38. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  39. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  40. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  41. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  42. package/dist/esm/ui/common-styles.js +13 -13
  43. package/dist/esm/ui/ui-styles.js +25 -25
  44. package/dist/esm/utils/guidelines.js +6 -3
  45. package/dist/esm/utils/merged-cells.js +3 -3
  46. package/dist/esm/utils/snapping.js +6 -7
  47. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  48. package/dist/types/pm-plugins/decorations/utils/index.d.ts +1 -1
  49. package/dist/types/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  50. package/dist/types/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  51. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  52. package/dist/types/ui/ColumnResizeWidget/index.d.ts +1 -1
  53. package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  54. package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  55. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  56. package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  57. package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  58. package/dist/types/utils/guidelines.d.ts +2 -1
  59. package/dist/types/utils/snapping.d.ts +3 -2
  60. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  61. package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +1 -1
  62. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  63. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  64. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  65. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +1 -1
  66. package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  67. package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  68. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  69. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  70. package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  71. package/dist/types-ts4.5/utils/guidelines.d.ts +2 -1
  72. package/dist/types-ts4.5/utils/snapping.d.ts +3 -2
  73. package/docs/0-intro.tsx +9 -7
  74. package/package.json +3 -3
  75. package/report.api.md +67 -66
  76. package/src/commands/clear.ts +36 -44
  77. package/src/commands/collapse.ts +8 -8
  78. package/src/commands/column-resize.ts +412 -452
  79. package/src/commands/delete.ts +14 -14
  80. package/src/commands/display-mode.ts +10 -11
  81. package/src/commands/go-to-next-cell.ts +48 -54
  82. package/src/commands/hover.ts +210 -227
  83. package/src/commands/index.ts +35 -35
  84. package/src/commands/insert.ts +208 -235
  85. package/src/commands/misc.ts +655 -748
  86. package/src/commands/referentiality.ts +9 -9
  87. package/src/commands/selection.ts +433 -563
  88. package/src/commands/sort.ts +68 -86
  89. package/src/commands/split-cell.ts +14 -14
  90. package/src/commands/toggle.ts +69 -67
  91. package/src/commands-with-analytics.ts +570 -639
  92. package/src/create-plugin-config.ts +13 -13
  93. package/src/event-handlers.ts +513 -612
  94. package/src/handlers.ts +120 -133
  95. package/src/nodeviews/ExternalDropTargets.tsx +68 -73
  96. package/src/nodeviews/OverflowShadowsObserver.ts +148 -157
  97. package/src/nodeviews/TableCell.ts +47 -54
  98. package/src/nodeviews/TableComponent.tsx +1018 -1112
  99. package/src/nodeviews/TableComponentWithSharedState.tsx +91 -94
  100. package/src/nodeviews/TableContainer.tsx +384 -340
  101. package/src/nodeviews/TableNodeViewBase.ts +19 -24
  102. package/src/nodeviews/TableResizer.tsx +642 -653
  103. package/src/nodeviews/TableRow.ts +580 -629
  104. package/src/nodeviews/TableStickyScrollbar.ts +173 -190
  105. package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +8 -8
  106. package/src/nodeviews/__mocks__/OverridableMock.ts +14 -15
  107. package/src/nodeviews/table.tsx +345 -375
  108. package/src/nodeviews/types.ts +21 -24
  109. package/src/nodeviews/update-overflow-shadows.ts +8 -14
  110. package/src/plugin.tsx +578 -603
  111. package/src/pm-plugins/analytics/actions.ts +10 -12
  112. package/src/pm-plugins/analytics/commands.ts +31 -37
  113. package/src/pm-plugins/analytics/plugin-factory.ts +4 -2
  114. package/src/pm-plugins/analytics/plugin-key.ts +1 -3
  115. package/src/pm-plugins/analytics/plugin.ts +60 -70
  116. package/src/pm-plugins/analytics/reducer.ts +19 -19
  117. package/src/pm-plugins/analytics/types.ts +10 -10
  118. package/src/pm-plugins/analytics/utils/moved-event.ts +38 -38
  119. package/src/pm-plugins/decorations/plugin.ts +58 -77
  120. package/src/pm-plugins/decorations/utils/column-controls.ts +59 -71
  121. package/src/pm-plugins/decorations/utils/column-resizing.ts +50 -57
  122. package/src/pm-plugins/decorations/utils/compose-decorations.ts +6 -6
  123. package/src/pm-plugins/decorations/utils/index.ts +3 -6
  124. package/src/pm-plugins/decorations/utils/types.ts +7 -12
  125. package/src/pm-plugins/default-table-selection.ts +3 -3
  126. package/src/pm-plugins/drag-and-drop/actions.ts +25 -25
  127. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +158 -190
  128. package/src/pm-plugins/drag-and-drop/commands.ts +154 -170
  129. package/src/pm-plugins/drag-and-drop/consts.ts +4 -5
  130. package/src/pm-plugins/drag-and-drop/plugin-factory.ts +23 -20
  131. package/src/pm-plugins/drag-and-drop/plugin-key.ts +1 -3
  132. package/src/pm-plugins/drag-and-drop/plugin.ts +329 -383
  133. package/src/pm-plugins/drag-and-drop/reducer.ts +30 -30
  134. package/src/pm-plugins/drag-and-drop/types.ts +8 -8
  135. package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +38 -41
  136. package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +3 -6
  137. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +57 -70
  138. package/src/pm-plugins/keymap.ts +208 -220
  139. package/src/pm-plugins/main.ts +348 -400
  140. package/src/pm-plugins/plugin-factory.ts +32 -34
  141. package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -97
  142. package/src/pm-plugins/sticky-headers/commands.ts +2 -6
  143. package/src/pm-plugins/sticky-headers/plugin-key.ts +1 -3
  144. package/src/pm-plugins/sticky-headers/plugin-state.ts +41 -44
  145. package/src/pm-plugins/sticky-headers/plugin.ts +4 -4
  146. package/src/pm-plugins/sticky-headers/types.ts +8 -8
  147. package/src/pm-plugins/sticky-headers/util.ts +10 -10
  148. package/src/pm-plugins/table-analytics.ts +70 -72
  149. package/src/pm-plugins/table-local-id.ts +180 -184
  150. package/src/pm-plugins/table-resizing/commands.ts +72 -85
  151. package/src/pm-plugins/table-resizing/event-handlers.ts +298 -317
  152. package/src/pm-plugins/table-resizing/plugin-factory.ts +10 -10
  153. package/src/pm-plugins/table-resizing/plugin-key.ts +1 -3
  154. package/src/pm-plugins/table-resizing/plugin.ts +61 -68
  155. package/src/pm-plugins/table-resizing/reducer.ts +30 -33
  156. package/src/pm-plugins/table-resizing/utils/colgroup.ts +84 -84
  157. package/src/pm-plugins/table-resizing/utils/column-state.ts +78 -81
  158. package/src/pm-plugins/table-resizing/utils/content-width.ts +94 -114
  159. package/src/pm-plugins/table-resizing/utils/dom.ts +93 -110
  160. package/src/pm-plugins/table-resizing/utils/index.ts +29 -34
  161. package/src/pm-plugins/table-resizing/utils/misc.ts +94 -119
  162. package/src/pm-plugins/table-resizing/utils/resize-column.ts +93 -106
  163. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +240 -257
  164. package/src/pm-plugins/table-resizing/utils/resize-state.ts +343 -372
  165. package/src/pm-plugins/table-resizing/utils/scale-table.ts +202 -207
  166. package/src/pm-plugins/table-resizing/utils/types.ts +17 -17
  167. package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +1 -2
  168. package/src/pm-plugins/table-selection-keymap.ts +25 -51
  169. package/src/pm-plugins/table-width.ts +191 -204
  170. package/src/pm-plugins/view-mode-sort/index.ts +223 -227
  171. package/src/pm-plugins/view-mode-sort/plugin-key.ts +3 -2
  172. package/src/pm-plugins/view-mode-sort/types.ts +12 -12
  173. package/src/pm-plugins/view-mode-sort/utils.ts +108 -117
  174. package/src/reducer.ts +139 -155
  175. package/src/toolbar.tsx +815 -905
  176. package/src/transforms/column-width.ts +186 -213
  177. package/src/transforms/delete-columns.ts +208 -222
  178. package/src/transforms/delete-rows.ts +117 -121
  179. package/src/transforms/fix-tables.ts +190 -215
  180. package/src/transforms/merge.ts +263 -269
  181. package/src/transforms/replace-table.ts +27 -43
  182. package/src/transforms/split.ts +65 -75
  183. package/src/types.ts +421 -427
  184. package/src/ui/ColumnResizeWidget/index.tsx +40 -47
  185. package/src/ui/DragHandle/HandleIconComponent.tsx +9 -13
  186. package/src/ui/DragHandle/index.tsx +221 -250
  187. package/src/ui/DragPreview/index.tsx +35 -35
  188. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +33 -41
  189. package/src/ui/FloatingContextualButton/FixedButton.tsx +154 -157
  190. package/src/ui/FloatingContextualButton/index.tsx +109 -115
  191. package/src/ui/FloatingContextualButton/styles.ts +43 -46
  192. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +634 -694
  193. package/src/ui/FloatingContextualMenu/index.tsx +83 -101
  194. package/src/ui/FloatingContextualMenu/styles.ts +57 -65
  195. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +37 -37
  196. package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +47 -57
  197. package/src/ui/FloatingDeleteButton/index.tsx +319 -350
  198. package/src/ui/FloatingDragMenu/DragMenu.tsx +555 -596
  199. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +152 -162
  200. package/src/ui/FloatingDragMenu/index.tsx +88 -102
  201. package/src/ui/FloatingDragMenu/styles.ts +51 -54
  202. package/src/ui/FloatingInsertButton/InsertButton.tsx +204 -217
  203. package/src/ui/FloatingInsertButton/getPopupOptions.ts +100 -115
  204. package/src/ui/FloatingInsertButton/index.tsx +248 -292
  205. package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +24 -29
  206. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +308 -329
  207. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +85 -94
  208. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +46 -46
  209. package/src/ui/TableFloatingColumnControls/index.tsx +116 -136
  210. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +79 -91
  211. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +95 -102
  212. package/src/ui/TableFloatingControls/CornerControls/index.tsx +1 -4
  213. package/src/ui/TableFloatingControls/CornerControls/types.ts +8 -8
  214. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +50 -50
  215. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +111 -124
  216. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +86 -105
  217. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +305 -341
  218. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +72 -75
  219. package/src/ui/TableFloatingControls/index.tsx +191 -193
  220. package/src/ui/TableFullWidthLabel/index.tsx +20 -20
  221. package/src/ui/common-styles.ts +880 -912
  222. package/src/ui/consts.ts +29 -74
  223. package/src/ui/icons/AddColLeftIcon.tsx +33 -39
  224. package/src/ui/icons/AddColRightIcon.tsx +33 -39
  225. package/src/ui/icons/AddRowAboveIcon.tsx +16 -22
  226. package/src/ui/icons/AddRowBelowIcon.tsx +33 -39
  227. package/src/ui/icons/DisplayModeIcon.tsx +31 -31
  228. package/src/ui/icons/DragHandleDisabledIcon.tsx +19 -21
  229. package/src/ui/icons/DragHandleIcon.tsx +12 -12
  230. package/src/ui/icons/DragInMotionIcon.tsx +45 -52
  231. package/src/ui/icons/MergeCellsIcon.tsx +22 -28
  232. package/src/ui/icons/MinimisedHandle.tsx +9 -9
  233. package/src/ui/icons/SplitCellIcon.tsx +30 -36
  234. package/src/ui/ui-styles.ts +769 -798
  235. package/src/utils/alignment.ts +1 -1
  236. package/src/utils/analytics.ts +192 -208
  237. package/src/utils/collapse.ts +55 -64
  238. package/src/utils/column-controls.ts +237 -254
  239. package/src/utils/create.ts +30 -30
  240. package/src/utils/decoration.ts +482 -502
  241. package/src/utils/dom.ts +127 -134
  242. package/src/utils/drag-menu.ts +322 -373
  243. package/src/utils/get-allow-add-column-custom-step.ts +4 -5
  244. package/src/utils/guidelines.ts +16 -21
  245. package/src/utils/index.ts +68 -68
  246. package/src/utils/merged-cells.ts +245 -254
  247. package/src/utils/nodes.ts +91 -106
  248. package/src/utils/paste.ts +119 -135
  249. package/src/utils/row-controls.ts +199 -213
  250. package/src/utils/selection.ts +77 -87
  251. package/src/utils/snapping.ts +87 -100
  252. package/src/utils/table.ts +44 -44
  253. package/src/utils/transforms.ts +5 -5
  254. package/src/utils/update-plugin-state-decorations.ts +5 -9
package/src/types.ts CHANGED
@@ -1,11 +1,7 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
 
3
3
  import type { TableLayout } from '@atlaskit/adf-schema';
4
- import {
5
- tableCellSelector,
6
- tableHeaderSelector,
7
- tablePrefixSelector,
8
- } from '@atlaskit/adf-schema';
4
+ import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@atlaskit/adf-schema';
9
5
  import type { TableColumnOrdering } from '@atlaskit/custom-steps';
10
6
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
7
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
@@ -29,76 +25,76 @@ export type Cell = { pos: number; start: number; node: PmNode };
29
25
  export type CellTransform = (cell: Cell) => (tr: Transaction) => Transaction;
30
26
 
31
27
  export interface InsertRowOptions {
32
- index: number;
33
- moveCursorToInsertedRow: boolean;
28
+ index: number;
29
+ moveCursorToInsertedRow: boolean;
34
30
  }
35
31
 
36
32
  export type PluginInjectionAPI = ExtractInjectionAPI<TablePlugin>;
37
33
 
38
34
  export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
39
- accessibilityUtils?: {
40
- actions: {
41
- ariaNotify: (message: string) => void | undefined;
42
- };
43
- };
35
+ accessibilityUtils?: {
36
+ actions: {
37
+ ariaNotify: (message: string) => void | undefined;
38
+ };
39
+ };
44
40
  };
45
41
 
46
42
  // override getPluginState but do not expose publicly as this type is experimental and will change
47
43
  // in the future
48
44
  export type TableSharedStateInternal = Pick<
49
- TablePluginState,
50
- | 'isFullWidthModeEnabled'
51
- | 'wasFullWidthModeEnabled'
52
- | 'isHeaderRowEnabled'
53
- | 'isHeaderColumnEnabled'
54
- | 'ordering'
55
- | 'isInDanger'
56
- | 'hoveredRows'
57
- | 'hoveredCell'
58
- | 'isTableHovered'
59
- | 'tableNode'
60
- | 'widthToWidest'
45
+ TablePluginState,
46
+ | 'isFullWidthModeEnabled'
47
+ | 'wasFullWidthModeEnabled'
48
+ | 'isHeaderRowEnabled'
49
+ | 'isHeaderColumnEnabled'
50
+ | 'ordering'
51
+ | 'isInDanger'
52
+ | 'hoveredRows'
53
+ | 'hoveredCell'
54
+ | 'isTableHovered'
55
+ | 'tableNode'
56
+ | 'widthToWidest'
61
57
  > & {
62
- isResizing: boolean;
63
- isTableResizing?: boolean;
64
- isWholeTableInDanger?: boolean;
58
+ isResizing: boolean;
59
+ isTableResizing?: boolean;
60
+ isWholeTableInDanger?: boolean;
65
61
  };
66
62
 
67
63
  export type TableSharedState = Pick<
68
- TablePluginState,
69
- 'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled'
64
+ TablePluginState,
65
+ 'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled'
70
66
  >;
71
67
 
72
68
  export type AlignmentOptions = 'center' | 'align-start';
73
69
 
74
70
  export type InsertRowMethods =
75
- | INPUT_METHOD.CONTEXT_MENU
76
- | INPUT_METHOD.BUTTON
77
- | INPUT_METHOD.SHORTCUT
78
- | INPUT_METHOD.KEYBOARD
79
- | INPUT_METHOD.FLOATING_TB
80
- | INPUT_METHOD.TABLE_CONTEXT_MENU;
71
+ | INPUT_METHOD.CONTEXT_MENU
72
+ | INPUT_METHOD.BUTTON
73
+ | INPUT_METHOD.SHORTCUT
74
+ | INPUT_METHOD.KEYBOARD
75
+ | INPUT_METHOD.FLOATING_TB
76
+ | INPUT_METHOD.TABLE_CONTEXT_MENU;
81
77
 
82
78
  export interface PluginConfig {
83
- advanced?: boolean;
84
- allowBackgroundColor?: boolean;
85
- allowColumnResizing?: boolean;
86
- allowHeaderColumn?: boolean;
87
- allowHeaderRow?: boolean;
88
- allowMergeCells?: boolean;
89
- allowNumberColumn?: boolean;
90
- allowColumnSorting?: boolean;
91
- allowAddColumnWithCustomStep?: boolean;
92
- allowCollapse?: boolean;
93
- isHeaderRowRequired?: boolean;
94
- /**
95
- * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-6877 Internal documentation for deprecation (no external access)}
96
- **/
97
- permittedLayouts?: PermittedLayoutsDescriptor;
98
- allowControls?: boolean;
99
- stickyHeaders?: boolean;
100
- allowCellOptionsInFloatingToolbar?: boolean;
101
- allowDistributeColumns?: boolean;
79
+ advanced?: boolean;
80
+ allowBackgroundColor?: boolean;
81
+ allowColumnResizing?: boolean;
82
+ allowHeaderColumn?: boolean;
83
+ allowHeaderRow?: boolean;
84
+ allowMergeCells?: boolean;
85
+ allowNumberColumn?: boolean;
86
+ allowColumnSorting?: boolean;
87
+ allowAddColumnWithCustomStep?: boolean;
88
+ allowCollapse?: boolean;
89
+ isHeaderRowRequired?: boolean;
90
+ /**
91
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-6877 Internal documentation for deprecation (no external access)}
92
+ **/
93
+ permittedLayouts?: PermittedLayoutsDescriptor;
94
+ allowControls?: boolean;
95
+ stickyHeaders?: boolean;
96
+ allowCellOptionsInFloatingToolbar?: boolean;
97
+ allowDistributeColumns?: boolean;
102
98
  }
103
99
 
104
100
  export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
@@ -129,382 +125,380 @@ export type { ColumnResizingPluginState } from '@atlaskit/editor-common/types';
129
125
  */
130
126
  export type CellColumnPositioning = Pick<Rect, 'right' | 'left'>;
131
127
  export interface CellHoverMeta {
132
- colIndex?: number;
133
- rowIndex?: number;
128
+ colIndex?: number;
129
+ rowIndex?: number;
134
130
  }
135
131
  export interface WidthToWidest {
136
- [tableLocalId: string]: boolean;
132
+ [tableLocalId: string]: boolean;
137
133
  }
138
134
 
139
135
  export interface TablePluginState {
140
- editorHasFocus?: boolean;
141
- hoveredColumns: number[];
142
- hoveredRows: number[];
143
- hoveredCell: CellHoverMeta;
144
- pluginConfig: PluginConfig;
145
- isHeaderColumnEnabled: boolean;
146
- isHeaderRowEnabled: boolean;
147
- isNumberColumnEnabled?: boolean;
148
- // position of a cell PM node that has cursor
149
- targetCellPosition?: number;
150
- // controls need to be re-rendered when table content changes
151
- // e.g. when pressing enter inside of a cell, it creates a new p and we need to update row controls
152
- tableNode?: PmNode;
153
- tableRef?: HTMLTableElement;
154
- tablePos?: number;
155
- tableWrapperTarget?: HTMLElement;
156
- isContextualMenuOpen?: boolean;
157
- isInDanger?: boolean;
158
- isWholeTableInDanger?: boolean;
159
- insertColumnButtonIndex?: number;
160
- insertRowButtonIndex?: number;
161
- isFullWidthModeEnabled?: boolean;
162
- ordering?: TableColumnOrdering;
163
- isResizeHandleWidgetAdded?: boolean;
164
- resizeHandleRowIndex?: number;
165
- resizeHandleColumnIndex?: number;
166
- resizeHandleIncludeTooltip?: boolean;
167
- isKeyboardResize?: boolean;
168
- // for table wrap/collapse
169
- isTableCollapsed?: boolean; // is the current table already in an expand?
170
- canCollapseTable?: boolean; // enabled/disabled state of collapse option
171
- widthToWidest?: WidthToWidest; // is the current table set to the widest width regarding view port
172
-
173
- getIntl: () => IntlShape;
174
-
175
- wasFullWidthModeEnabled?: boolean;
176
- isTableResizingEnabled?: boolean;
177
- isDragAndDropEnabled?: boolean;
178
- isTableHovered?: boolean;
179
-
180
- // Currently isTableScalingEnabled is the same as options.isTableScalingEnabled from TablePluginOptions.
181
- // However, if you want to learn if tablePlugin is configured to enable Preserve Table Widths feature,
182
- // use options.isTableScalingEnabled and avoid using pluginState.isTableScalingEnabled or
183
- // const { isTableScalingEnabled } = getPluginState(state) for that purpose.
184
- isTableScalingEnabled?: boolean;
136
+ editorHasFocus?: boolean;
137
+ hoveredColumns: number[];
138
+ hoveredRows: number[];
139
+ hoveredCell: CellHoverMeta;
140
+ pluginConfig: PluginConfig;
141
+ isHeaderColumnEnabled: boolean;
142
+ isHeaderRowEnabled: boolean;
143
+ isNumberColumnEnabled?: boolean;
144
+ // position of a cell PM node that has cursor
145
+ targetCellPosition?: number;
146
+ // controls need to be re-rendered when table content changes
147
+ // e.g. when pressing enter inside of a cell, it creates a new p and we need to update row controls
148
+ tableNode?: PmNode;
149
+ tableRef?: HTMLTableElement;
150
+ tablePos?: number;
151
+ tableWrapperTarget?: HTMLElement;
152
+ isContextualMenuOpen?: boolean;
153
+ isInDanger?: boolean;
154
+ isWholeTableInDanger?: boolean;
155
+ insertColumnButtonIndex?: number;
156
+ insertRowButtonIndex?: number;
157
+ isFullWidthModeEnabled?: boolean;
158
+ ordering?: TableColumnOrdering;
159
+ isResizeHandleWidgetAdded?: boolean;
160
+ resizeHandleRowIndex?: number;
161
+ resizeHandleColumnIndex?: number;
162
+ resizeHandleIncludeTooltip?: boolean;
163
+ isKeyboardResize?: boolean;
164
+ // for table wrap/collapse
165
+ isTableCollapsed?: boolean; // is the current table already in an expand?
166
+ canCollapseTable?: boolean; // enabled/disabled state of collapse option
167
+ widthToWidest?: WidthToWidest; // is the current table set to the widest width regarding view port
168
+
169
+ getIntl: () => IntlShape;
170
+
171
+ wasFullWidthModeEnabled?: boolean;
172
+ isTableResizingEnabled?: boolean;
173
+ isDragAndDropEnabled?: boolean;
174
+ isTableHovered?: boolean;
175
+
176
+ // Currently isTableScalingEnabled is the same as options.isTableScalingEnabled from TablePluginOptions.
177
+ // However, if you want to learn if tablePlugin is configured to enable Preserve Table Widths feature,
178
+ // use options.isTableScalingEnabled and avoid using pluginState.isTableScalingEnabled or
179
+ // const { isTableScalingEnabled } = getPluginState(state) for that purpose.
180
+ isTableScalingEnabled?: boolean;
185
181
  }
186
182
 
187
183
  export type TablePluginAction =
188
- | { type: 'SET_EDITOR_FOCUS'; data: { editorHasFocus: boolean } }
189
- | { type: 'TOGGLE_HEADER_ROW' }
190
- | { type: 'TOGGLE_HEADER_COLUMN' }
191
- | { type: 'SORT_TABLE'; data: { ordering: TableColumnOrdering } }
192
- | {
193
- type: 'SET_TABLE_REF';
194
- data: {
195
- tableRef?: HTMLTableElement;
196
- tableNode?: PmNode;
197
- tableWrapperTarget?: HTMLElement;
198
- isHeaderRowEnabled: boolean;
199
- isHeaderColumnEnabled: boolean;
200
- };
201
- }
202
- | {
203
- type: 'HOVER_ROWS';
204
- data: {
205
- decorationSet: DecorationSet;
206
- hoveredRows: number[];
207
- isInDanger?: boolean;
208
- };
209
- }
210
- | {
211
- type: 'HOVER_MERGED_CELLS';
212
- data: {
213
- decorationSet: DecorationSet;
214
- };
215
- }
216
- | {
217
- type: 'HOVER_COLUMNS';
218
- data: {
219
- decorationSet: DecorationSet;
220
- hoveredColumns: number[];
221
- isInDanger?: boolean;
222
- };
223
- }
224
- | {
225
- type: 'HOVER_TABLE';
226
- data: {
227
- decorationSet: DecorationSet;
228
- hoveredRows: number[];
229
- hoveredColumns: number[];
230
- isInDanger?: boolean;
231
- };
232
- }
233
- | {
234
- type: 'START_KEYBOARD_COLUMN_RESIZE';
235
- data: {
236
- decorationSet: DecorationSet;
237
- resizeHandleRowIndex: number;
238
- resizeHandleColumnIndex: number;
239
- resizeHandleIncludeTooltip: boolean;
240
- isKeyboardResize?: boolean;
241
- };
242
- }
243
- | {
244
- type: 'ADD_RESIZE_HANDLE_DECORATIONS';
245
- data: {
246
- decorationSet: DecorationSet;
247
- resizeHandleRowIndex: number;
248
- resizeHandleColumnIndex: number;
249
- resizeHandleIncludeTooltip: boolean;
250
- isKeyboardResize?: boolean;
251
- };
252
- }
253
- | {
254
- type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
255
- data: {
256
- decorationSet: DecorationSet;
257
- resizeHandleRowIndex: number | undefined;
258
- resizeHandleColumnIndex: number | undefined;
259
- resizeHandleIncludeTooltip: boolean | undefined;
260
- };
261
- }
262
- | {
263
- type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
264
- data: {
265
- widthToWidest: WidthToWidest | undefined;
266
- };
267
- }
268
- | {
269
- type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
270
- data: { decorationSet: DecorationSet };
271
- }
272
- | {
273
- type: 'STOP_KEYBOARD_COLUMN_RESIZE';
274
- data: { decorationSet: DecorationSet };
275
- }
276
- | { type: 'CLEAR_HOVER_SELECTION'; data: { decorationSet: DecorationSet } }
277
- | { type: 'SHOW_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
278
- | { type: 'HIDE_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
279
- | {
280
- type: 'HOVER_CELL';
281
- data: {
282
- hoveredCell: CellHoverMeta;
283
- };
284
- }
285
- | {
286
- type: 'TABLE_HOVERED';
287
- data: {
288
- isTableHovered: boolean;
289
- };
290
- }
291
- | { type: 'SET_TARGET_CELL_POSITION'; data: { targetCellPosition?: number } }
292
- | {
293
- type: 'SELECT_COLUMN';
294
- data: { targetCellPosition: number; decorationSet: DecorationSet };
295
- }
296
- | { type: 'SHOW_INSERT_ROW_BUTTON'; data: { insertRowButtonIndex: number } }
297
- | {
298
- type: 'SHOW_INSERT_COLUMN_BUTTON';
299
- data: { insertColumnButtonIndex: number };
300
- }
301
- | {
302
- type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
303
- }
304
- | { type: 'TOGGLE_CONTEXTUAL_MENU' };
184
+ | { type: 'SET_EDITOR_FOCUS'; data: { editorHasFocus: boolean } }
185
+ | { type: 'TOGGLE_HEADER_ROW' }
186
+ | { type: 'TOGGLE_HEADER_COLUMN' }
187
+ | { type: 'SORT_TABLE'; data: { ordering: TableColumnOrdering } }
188
+ | {
189
+ type: 'SET_TABLE_REF';
190
+ data: {
191
+ tableRef?: HTMLTableElement;
192
+ tableNode?: PmNode;
193
+ tableWrapperTarget?: HTMLElement;
194
+ isHeaderRowEnabled: boolean;
195
+ isHeaderColumnEnabled: boolean;
196
+ };
197
+ }
198
+ | {
199
+ type: 'HOVER_ROWS';
200
+ data: {
201
+ decorationSet: DecorationSet;
202
+ hoveredRows: number[];
203
+ isInDanger?: boolean;
204
+ };
205
+ }
206
+ | {
207
+ type: 'HOVER_MERGED_CELLS';
208
+ data: {
209
+ decorationSet: DecorationSet;
210
+ };
211
+ }
212
+ | {
213
+ type: 'HOVER_COLUMNS';
214
+ data: {
215
+ decorationSet: DecorationSet;
216
+ hoveredColumns: number[];
217
+ isInDanger?: boolean;
218
+ };
219
+ }
220
+ | {
221
+ type: 'HOVER_TABLE';
222
+ data: {
223
+ decorationSet: DecorationSet;
224
+ hoveredRows: number[];
225
+ hoveredColumns: number[];
226
+ isInDanger?: boolean;
227
+ };
228
+ }
229
+ | {
230
+ type: 'START_KEYBOARD_COLUMN_RESIZE';
231
+ data: {
232
+ decorationSet: DecorationSet;
233
+ resizeHandleRowIndex: number;
234
+ resizeHandleColumnIndex: number;
235
+ resizeHandleIncludeTooltip: boolean;
236
+ isKeyboardResize?: boolean;
237
+ };
238
+ }
239
+ | {
240
+ type: 'ADD_RESIZE_HANDLE_DECORATIONS';
241
+ data: {
242
+ decorationSet: DecorationSet;
243
+ resizeHandleRowIndex: number;
244
+ resizeHandleColumnIndex: number;
245
+ resizeHandleIncludeTooltip: boolean;
246
+ isKeyboardResize?: boolean;
247
+ };
248
+ }
249
+ | {
250
+ type: 'UPDATE_RESIZE_HANDLE_DECORATIONS';
251
+ data: {
252
+ decorationSet: DecorationSet;
253
+ resizeHandleRowIndex: number | undefined;
254
+ resizeHandleColumnIndex: number | undefined;
255
+ resizeHandleIncludeTooltip: boolean | undefined;
256
+ };
257
+ }
258
+ | {
259
+ type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
260
+ data: {
261
+ widthToWidest: WidthToWidest | undefined;
262
+ };
263
+ }
264
+ | {
265
+ type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
266
+ data: { decorationSet: DecorationSet };
267
+ }
268
+ | {
269
+ type: 'STOP_KEYBOARD_COLUMN_RESIZE';
270
+ data: { decorationSet: DecorationSet };
271
+ }
272
+ | { type: 'CLEAR_HOVER_SELECTION'; data: { decorationSet: DecorationSet } }
273
+ | { type: 'SHOW_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
274
+ | { type: 'HIDE_RESIZE_HANDLE_LINE'; data: { decorationSet: DecorationSet } }
275
+ | {
276
+ type: 'HOVER_CELL';
277
+ data: {
278
+ hoveredCell: CellHoverMeta;
279
+ };
280
+ }
281
+ | {
282
+ type: 'TABLE_HOVERED';
283
+ data: {
284
+ isTableHovered: boolean;
285
+ };
286
+ }
287
+ | { type: 'SET_TARGET_CELL_POSITION'; data: { targetCellPosition?: number } }
288
+ | {
289
+ type: 'SELECT_COLUMN';
290
+ data: { targetCellPosition: number; decorationSet: DecorationSet };
291
+ }
292
+ | { type: 'SHOW_INSERT_ROW_BUTTON'; data: { insertRowButtonIndex: number } }
293
+ | {
294
+ type: 'SHOW_INSERT_COLUMN_BUTTON';
295
+ data: { insertColumnButtonIndex: number };
296
+ }
297
+ | {
298
+ type: 'HIDE_INSERT_COLUMN_OR_ROW_BUTTON';
299
+ }
300
+ | { type: 'TOGGLE_CONTEXTUAL_MENU' };
305
301
 
306
302
  export type ColumnResizingPluginAction =
307
- | {
308
- type: 'SET_RESIZE_HANDLE_POSITION';
309
- data: { resizeHandlePos: number | null };
310
- }
311
- | { type: 'STOP_RESIZING' }
312
- | {
313
- type: 'SET_DRAGGING';
314
- data: { dragging: { startX: number; startWidth: number } | null };
315
- }
316
- | {
317
- type: 'SET_LAST_CLICK';
318
- data: { lastClick: { x: number; y: number; time: number } | null };
319
- };
303
+ | {
304
+ type: 'SET_RESIZE_HANDLE_POSITION';
305
+ data: { resizeHandlePos: number | null };
306
+ }
307
+ | { type: 'STOP_RESIZING' }
308
+ | {
309
+ type: 'SET_DRAGGING';
310
+ data: { dragging: { startX: number; startWidth: number } | null };
311
+ }
312
+ | {
313
+ type: 'SET_LAST_CLICK';
314
+ data: { lastClick: { x: number; y: number; time: number } | null };
315
+ };
320
316
 
321
317
  export enum TableDecorations {
322
- /** Classic controls */
323
- ALL_CONTROLS_HOVER = 'CONTROLS_HOVER',
324
- ROW_CONTROLS_HOVER = 'ROW_CONTROLS_HOVER',
325
- COLUMN_CONTROLS_HOVER = 'COLUMN_CONTROLS_HOVER',
326
- TABLE_CONTROLS_HOVER = 'TABLE_CONTROLS_HOVER',
327
- CELL_CONTROLS_HOVER = 'CELL_CONTROLS_HOVER',
328
-
329
- COLUMN_CONTROLS_DECORATIONS = 'COLUMN_CONTROLS_DECORATIONS',
330
- COLUMN_DROP_TARGET_DECORATIONS = 'COLUMN_DROP_TARGET_DECORATIONS',
331
- COLUMN_SELECTED = 'COLUMN_SELECTED',
332
- COLUMN_RESIZING_HANDLE = 'COLUMN_RESIZING_HANDLE',
333
- COLUMN_RESIZING_HANDLE_WIDGET = 'COLUMN_RESIZING_HANDLE_WIDGET',
334
- COLUMN_RESIZING_HANDLE_LINE = 'COLUMN_RESIZING_HANDLE_LINE',
335
-
336
- COLUMN_INSERT_LINE = 'COLUMN_INSERT_LINE',
337
- ROW_INSERT_LINE = 'ROW_INSERT_LINE',
338
-
339
- LAST_CELL_ELEMENT = 'LAST_CELL_ELEMENT',
318
+ /** Classic controls */
319
+ ALL_CONTROLS_HOVER = 'CONTROLS_HOVER',
320
+ ROW_CONTROLS_HOVER = 'ROW_CONTROLS_HOVER',
321
+ COLUMN_CONTROLS_HOVER = 'COLUMN_CONTROLS_HOVER',
322
+ TABLE_CONTROLS_HOVER = 'TABLE_CONTROLS_HOVER',
323
+ CELL_CONTROLS_HOVER = 'CELL_CONTROLS_HOVER',
324
+
325
+ COLUMN_CONTROLS_DECORATIONS = 'COLUMN_CONTROLS_DECORATIONS',
326
+ COLUMN_DROP_TARGET_DECORATIONS = 'COLUMN_DROP_TARGET_DECORATIONS',
327
+ COLUMN_SELECTED = 'COLUMN_SELECTED',
328
+ COLUMN_RESIZING_HANDLE = 'COLUMN_RESIZING_HANDLE',
329
+ COLUMN_RESIZING_HANDLE_WIDGET = 'COLUMN_RESIZING_HANDLE_WIDGET',
330
+ COLUMN_RESIZING_HANDLE_LINE = 'COLUMN_RESIZING_HANDLE_LINE',
331
+
332
+ COLUMN_INSERT_LINE = 'COLUMN_INSERT_LINE',
333
+ ROW_INSERT_LINE = 'ROW_INSERT_LINE',
334
+
335
+ LAST_CELL_ELEMENT = 'LAST_CELL_ELEMENT',
340
336
  }
341
337
 
342
338
  export const TableCssClassName = {
343
- ...TableSharedCssClassName,
344
-
345
- /** Classic controls */
346
- COLUMN_CONTROLS: `${tablePrefixSelector}-column-controls`,
347
- COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`,
348
- COLUMN_SELECTED: `${tablePrefixSelector}-column__selected`,
349
-
350
- ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
351
- ROW_CONTROLS: `${tablePrefixSelector}-row-controls`,
352
- ROW_CONTROLS_INNER: `${tablePrefixSelector}-row-controls__inner`,
353
- ROW_CONTROLS_BUTTON_WRAP: `${tablePrefixSelector}-row-controls__button-wrap`,
354
- ROW_CONTROLS_BUTTON: `${tablePrefixSelector}-row-controls__button`,
355
-
356
- CONTROLS_BUTTON: `${tablePrefixSelector}-controls__button`,
357
- CONTROLS_BUTTON_ICON: `${tablePrefixSelector}-controls__button-icon`,
358
-
359
- CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__insert-button`,
360
- CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__insert-button-inner`,
361
- CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__insert-button-wrap`,
362
- CONTROLS_INSERT_LINE: `${tablePrefixSelector}-controls__insert-line`,
363
- CONTROLS_BUTTON_OVERLAY: `${tablePrefixSelector}-controls__button-overlay`,
364
-
365
- DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
366
- DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
367
- DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
368
- DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: `${tablePrefixSelector}-controls__drag-insert-button-inner-row`,
369
- DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
370
-
371
- CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
372
- CONTROLS_INSERT_COLUMN: `${tablePrefixSelector}-controls__insert-column`,
373
- CONTROLS_INSERT_ROW: `${tablePrefixSelector}-controls__insert-row`,
374
- CONTROLS_DELETE_BUTTON_WRAP: `${tablePrefixSelector}-controls__delete-button-wrap`,
375
- CONTROLS_DELETE_BUTTON: `${tablePrefixSelector}-controls__delete-button`,
376
-
377
- CONTROLS_FLOATING_BUTTON_COLUMN: `${tablePrefixSelector}-controls-floating__button-column`,
378
- CONTROLS_FLOATING_BUTTON_ROW: `${tablePrefixSelector}-controls-floating__button-row`,
379
-
380
- CORNER_CONTROLS: `${tablePrefixSelector}-corner-controls`,
381
- CORNER_CONTROLS_INSERT_ROW_MARKER: `${tablePrefixSelector}-corner-controls__insert-row-marker`,
382
- CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
383
- CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
384
-
385
- /** drag and drop controls */
386
- DRAG_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-drag-row-controls-wrapper`,
387
- DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
388
- DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
389
- DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
390
-
391
- DRAG_COLUMN_CONTROLS: `${tablePrefixSelector}-drag-column-controls`,
392
- DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-columns-floating-insert-dot-wrapper`,
393
- DRAG_COLUMN_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-columns-floating-insert-dot`,
394
-
395
- DRAG_COLUMN_CONTROLS_WRAPPER: `${tablePrefixSelector}-col-controls-wrapper`,
396
- DRAG_COLUMN_DROP_TARGET_CONTROLS: `${tablePrefixSelector}-col-drop-target-controls`,
397
- DRAG_COLUMN_CONTROLS_INNER: `${tablePrefixSelector}-col-controls__inner`,
398
-
399
- DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
400
- DRAG_HANDLE_BUTTON_CLICKABLE_ZONE: `${tablePrefixSelector}-drag-handle-button-clickable-zone`,
401
-
402
- DRAG_CORNER_BUTTON: `${tablePrefixSelector}-drag-corner-button`,
403
- DRAG_CORNER_BUTTON_INNER: `${tablePrefixSelector}-drag-corner-button-inner`,
404
-
405
- /** disabled classes */
406
- DRAG_HANDLE_DISABLED: `${tablePrefixSelector}-drag-handle-disabled`,
407
-
408
- /** minimised handle class */
409
- DRAG_HANDLE_MINIMISED: `${tablePrefixSelector}-drag-handle-minimised`,
410
-
411
- DRAG_SUBMENU: `${tablePrefixSelector}-drag-submenu`,
412
- DRAG_SUBMENU_ICON: `${tablePrefixSelector}-drag-submenu-icon`,
413
-
414
- /** Other classes */
415
- NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
416
- NUMBERED_COLUMN_BUTTON: `${tablePrefixSelector}-numbered-column__button`,
417
- NUMBERED_COLUMN_BUTTON_DISABLED: `${tablePrefixSelector}-numbered-column__button-disabled`,
418
-
419
- HOVERED_COLUMN: `${tablePrefixSelector}-hovered-column`,
420
- HOVERED_ROW: `${tablePrefixSelector}-hovered-row`,
421
- HOVERED_TABLE: `${tablePrefixSelector}-hovered-table`,
422
- HOVERED_NO_HIGHLIGHT: `${tablePrefixSelector}-hovered-no-highlight`,
423
- HOVERED_CELL: `${tablePrefixSelector}-hovered-cell`,
424
- HOVERED_CELL_IN_DANGER: 'danger',
425
- HOVERED_CELL_ACTIVE: 'active',
426
- HOVERED_CELL_WARNING: `${tablePrefixSelector}-hovered-cell__warning`,
427
- HOVERED_DELETE_BUTTON: `${tablePrefixSelector}-hovered-delete-button`,
428
- WITH_CONTROLS: `${tablePrefixSelector}-with-controls`,
429
- RESIZING_PLUGIN: `${tablePrefixSelector}-resizing-plugin`,
430
- RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
431
- IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
432
-
433
- RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
434
-
435
- CONTEXTUAL_SUBMENU: `${tablePrefixSelector}-contextual-submenu`,
436
- CONTEXTUAL_MENU_BUTTON_WRAP: `${tablePrefixSelector}-contextual-menu-button-wrap`,
437
- CONTEXTUAL_MENU_BUTTON: `${tablePrefixSelector}-contextual-menu-button`,
438
- CONTEXTUAL_MENU_BUTTON_FIXED: `${tablePrefixSelector}-contextual-menu-button-fixed`,
439
- CONTEXTUAL_MENU_ICON: `${tablePrefixSelector}-contextual-submenu-icon`,
440
- CONTEXTUAL_MENU_ICON_SMALL: `${tablePrefixSelector}-contextual-submenu-icon-small`,
441
-
442
- // come from prosemirror-table
443
- SELECTED_CELL: 'selectedCell',
444
-
445
- // defined in ReactNodeView based on PM node name
446
- NODEVIEW_WRAPPER: 'tableView-content-wrap',
447
-
448
- TABLE_SELECTED: `${tablePrefixSelector}-table__selected`,
449
- TABLE_CELL: tableCellSelector,
450
- TABLE_HEADER_CELL: tableHeaderSelector,
451
- TABLE_STICKY: `${tablePrefixSelector}-sticky`,
452
-
453
- TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
454
- LAST_ITEM_IN_CELL: `${tablePrefixSelector}-last-item-in-cell`,
455
-
456
- WITH_COLUMN_INSERT_LINE: `${tablePrefixSelector}-column-insert-line`,
457
- WITH_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-column-insert-line__inactive`,
458
- WITH_FIRST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-first-column-insert-line`,
459
- WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-first-column-insert-line__inactive`,
460
-
461
- WITH_LAST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-last-column-insert-line`,
462
- WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-column-insert-line__inactive`,
463
-
464
- WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
465
- WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
466
-
467
- WITH_ROW_INSERT_LINE: `${tablePrefixSelector}-row-insert-line`,
468
- WITH_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-row-insert-line__inactive`,
469
- WITH_LAST_ROW_INSERT_LINE: `${tablePrefixSelector}-last-row-insert-line`,
470
- WITH_LAST_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-row-insert-line__inactive`,
339
+ ...TableSharedCssClassName,
340
+
341
+ /** Classic controls */
342
+ COLUMN_CONTROLS: `${tablePrefixSelector}-column-controls`,
343
+ COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`,
344
+ COLUMN_SELECTED: `${tablePrefixSelector}-column__selected`,
345
+
346
+ ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-row-controls-wrapper`,
347
+ ROW_CONTROLS: `${tablePrefixSelector}-row-controls`,
348
+ ROW_CONTROLS_INNER: `${tablePrefixSelector}-row-controls__inner`,
349
+ ROW_CONTROLS_BUTTON_WRAP: `${tablePrefixSelector}-row-controls__button-wrap`,
350
+ ROW_CONTROLS_BUTTON: `${tablePrefixSelector}-row-controls__button`,
351
+
352
+ CONTROLS_BUTTON: `${tablePrefixSelector}-controls__button`,
353
+ CONTROLS_BUTTON_ICON: `${tablePrefixSelector}-controls__button-icon`,
354
+
355
+ CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__insert-button`,
356
+ CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__insert-button-inner`,
357
+ CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__insert-button-wrap`,
358
+ CONTROLS_INSERT_LINE: `${tablePrefixSelector}-controls__insert-line`,
359
+ CONTROLS_BUTTON_OVERLAY: `${tablePrefixSelector}-controls__button-overlay`,
360
+
361
+ DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
362
+ DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
363
+ DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
364
+ DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: `${tablePrefixSelector}-controls__drag-insert-button-inner-row`,
365
+ DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
366
+
367
+ CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
368
+ CONTROLS_INSERT_COLUMN: `${tablePrefixSelector}-controls__insert-column`,
369
+ CONTROLS_INSERT_ROW: `${tablePrefixSelector}-controls__insert-row`,
370
+ CONTROLS_DELETE_BUTTON_WRAP: `${tablePrefixSelector}-controls__delete-button-wrap`,
371
+ CONTROLS_DELETE_BUTTON: `${tablePrefixSelector}-controls__delete-button`,
372
+
373
+ CONTROLS_FLOATING_BUTTON_COLUMN: `${tablePrefixSelector}-controls-floating__button-column`,
374
+ CONTROLS_FLOATING_BUTTON_ROW: `${tablePrefixSelector}-controls-floating__button-row`,
375
+
376
+ CORNER_CONTROLS: `${tablePrefixSelector}-corner-controls`,
377
+ CORNER_CONTROLS_INSERT_ROW_MARKER: `${tablePrefixSelector}-corner-controls__insert-row-marker`,
378
+ CORNER_CONTROLS_INSERT_COLUMN_MARKER: `${tablePrefixSelector}-corner-controls__insert-column-marker`,
379
+ CONTROLS_CORNER_BUTTON: `${tablePrefixSelector}-corner-button`,
380
+
381
+ /** drag and drop controls */
382
+ DRAG_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-drag-row-controls-wrapper`,
383
+ DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
384
+ DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
385
+ DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
386
+
387
+ DRAG_COLUMN_CONTROLS: `${tablePrefixSelector}-drag-column-controls`,
388
+ DRAG_COLUMN_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-columns-floating-insert-dot-wrapper`,
389
+ DRAG_COLUMN_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-columns-floating-insert-dot`,
390
+
391
+ DRAG_COLUMN_CONTROLS_WRAPPER: `${tablePrefixSelector}-col-controls-wrapper`,
392
+ DRAG_COLUMN_DROP_TARGET_CONTROLS: `${tablePrefixSelector}-col-drop-target-controls`,
393
+ DRAG_COLUMN_CONTROLS_INNER: `${tablePrefixSelector}-col-controls__inner`,
394
+
395
+ DRAG_HANDLE_BUTTON_CONTAINER: `${tablePrefixSelector}-drag-handle-button-container`,
396
+ DRAG_HANDLE_BUTTON_CLICKABLE_ZONE: `${tablePrefixSelector}-drag-handle-button-clickable-zone`,
397
+
398
+ DRAG_CORNER_BUTTON: `${tablePrefixSelector}-drag-corner-button`,
399
+ DRAG_CORNER_BUTTON_INNER: `${tablePrefixSelector}-drag-corner-button-inner`,
400
+
401
+ /** disabled classes */
402
+ DRAG_HANDLE_DISABLED: `${tablePrefixSelector}-drag-handle-disabled`,
403
+
404
+ /** minimised handle class */
405
+ DRAG_HANDLE_MINIMISED: `${tablePrefixSelector}-drag-handle-minimised`,
406
+
407
+ DRAG_SUBMENU: `${tablePrefixSelector}-drag-submenu`,
408
+ DRAG_SUBMENU_ICON: `${tablePrefixSelector}-drag-submenu-icon`,
409
+
410
+ /** Other classes */
411
+ NUMBERED_COLUMN: `${tablePrefixSelector}-numbered-column`,
412
+ NUMBERED_COLUMN_BUTTON: `${tablePrefixSelector}-numbered-column__button`,
413
+ NUMBERED_COLUMN_BUTTON_DISABLED: `${tablePrefixSelector}-numbered-column__button-disabled`,
414
+
415
+ HOVERED_COLUMN: `${tablePrefixSelector}-hovered-column`,
416
+ HOVERED_ROW: `${tablePrefixSelector}-hovered-row`,
417
+ HOVERED_TABLE: `${tablePrefixSelector}-hovered-table`,
418
+ HOVERED_NO_HIGHLIGHT: `${tablePrefixSelector}-hovered-no-highlight`,
419
+ HOVERED_CELL: `${tablePrefixSelector}-hovered-cell`,
420
+ HOVERED_CELL_IN_DANGER: 'danger',
421
+ HOVERED_CELL_ACTIVE: 'active',
422
+ HOVERED_CELL_WARNING: `${tablePrefixSelector}-hovered-cell__warning`,
423
+ HOVERED_DELETE_BUTTON: `${tablePrefixSelector}-hovered-delete-button`,
424
+ WITH_CONTROLS: `${tablePrefixSelector}-with-controls`,
425
+ RESIZING_PLUGIN: `${tablePrefixSelector}-resizing-plugin`,
426
+ RESIZE_CURSOR: `${tablePrefixSelector}-resize-cursor`,
427
+ IS_RESIZING: `${tablePrefixSelector}-is-resizing`,
428
+
429
+ RESIZE_HANDLE_DECORATION: `${tablePrefixSelector}-resize-decoration`,
430
+
431
+ CONTEXTUAL_SUBMENU: `${tablePrefixSelector}-contextual-submenu`,
432
+ CONTEXTUAL_MENU_BUTTON_WRAP: `${tablePrefixSelector}-contextual-menu-button-wrap`,
433
+ CONTEXTUAL_MENU_BUTTON: `${tablePrefixSelector}-contextual-menu-button`,
434
+ CONTEXTUAL_MENU_BUTTON_FIXED: `${tablePrefixSelector}-contextual-menu-button-fixed`,
435
+ CONTEXTUAL_MENU_ICON: `${tablePrefixSelector}-contextual-submenu-icon`,
436
+ CONTEXTUAL_MENU_ICON_SMALL: `${tablePrefixSelector}-contextual-submenu-icon-small`,
437
+
438
+ // come from prosemirror-table
439
+ SELECTED_CELL: 'selectedCell',
440
+
441
+ // defined in ReactNodeView based on PM node name
442
+ NODEVIEW_WRAPPER: 'tableView-content-wrap',
443
+
444
+ TABLE_SELECTED: `${tablePrefixSelector}-table__selected`,
445
+ TABLE_CELL: tableCellSelector,
446
+ TABLE_HEADER_CELL: tableHeaderSelector,
447
+ TABLE_STICKY: `${tablePrefixSelector}-sticky`,
448
+
449
+ TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
450
+ LAST_ITEM_IN_CELL: `${tablePrefixSelector}-last-item-in-cell`,
451
+
452
+ WITH_COLUMN_INSERT_LINE: `${tablePrefixSelector}-column-insert-line`,
453
+ WITH_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-column-insert-line__inactive`,
454
+ WITH_FIRST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-first-column-insert-line`,
455
+ WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-first-column-insert-line__inactive`,
456
+
457
+ WITH_LAST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-last-column-insert-line`,
458
+ WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-column-insert-line__inactive`,
459
+
460
+ WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
461
+ WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
462
+
463
+ WITH_ROW_INSERT_LINE: `${tablePrefixSelector}-row-insert-line`,
464
+ WITH_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-row-insert-line__inactive`,
465
+ WITH_LAST_ROW_INSERT_LINE: `${tablePrefixSelector}-last-row-insert-line`,
466
+ WITH_LAST_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-row-insert-line__inactive`,
471
467
  };
472
468
 
473
469
  export interface ToolbarMenuConfig {
474
- allowHeaderRow?: boolean;
475
- allowHeaderColumn?: boolean;
476
- allowNumberColumn?: boolean;
477
- allowCollapse?: boolean;
470
+ allowHeaderRow?: boolean;
471
+ allowHeaderColumn?: boolean;
472
+ allowNumberColumn?: boolean;
473
+ allowCollapse?: boolean;
478
474
  }
479
475
 
480
476
  export interface ToolbarMenuState {
481
- isHeaderRowEnabled?: boolean;
482
- isHeaderColumnEnabled?: boolean;
483
- isNumberColumnEnabled?: boolean;
484
- isTableCollapsed?: boolean;
485
- canCollapseTable?: boolean;
486
- isDragAndDropEnabled?: boolean;
477
+ isHeaderRowEnabled?: boolean;
478
+ isHeaderColumnEnabled?: boolean;
479
+ isNumberColumnEnabled?: boolean;
480
+ isTableCollapsed?: boolean;
481
+ canCollapseTable?: boolean;
482
+ isDragAndDropEnabled?: boolean;
487
483
  }
488
484
 
489
485
  export interface ToolbarMenuContext {
490
- formatMessage: IntlShape['formatMessage'];
486
+ formatMessage: IntlShape['formatMessage'];
491
487
  }
492
488
 
493
489
  export enum ShadowEvent {
494
- SHOW_BEFORE_SHADOW = 'showBeforeShadow',
495
- SHOW_AFTER_SHADOW = 'showAfterShadow',
490
+ SHOW_BEFORE_SHADOW = 'showBeforeShadow',
491
+ SHOW_AFTER_SHADOW = 'showAfterShadow',
496
492
  }
497
493
 
498
- export type ReportInvalidNodeAttrs = (
499
- invalidNodeAttrs: InvalidNodeAttr,
500
- ) => void;
494
+ export type ReportInvalidNodeAttrs = (invalidNodeAttrs: InvalidNodeAttr) => void;
501
495
 
502
496
  export type InvalidNodeAttr = {
503
- nodeType: string;
504
- attribute: string;
505
- reason: string;
506
- spanValue: number;
507
- tableLocalId: string;
497
+ nodeType: string;
498
+ attribute: string;
499
+ reason: string;
500
+ spanValue: number;
501
+ tableLocalId: string;
508
502
  };
509
503
 
510
504
  export type TableDirection = 'row' | 'column';
@@ -516,43 +510,43 @@ export type DraggableType = 'table-row' | 'table-column';
516
510
  export type DraggableBehaviour = 'move' | 'clone';
517
511
 
518
512
  export interface DraggableSourceData extends Record<string, unknown> {
519
- type: DraggableType;
520
- localId: string;
521
- indexes: number[];
513
+ type: DraggableType;
514
+ localId: string;
515
+ indexes: number[];
522
516
  }
523
517
 
524
518
  export interface DraggableTargetData extends Record<string | symbol, unknown> {
525
- type: DraggableType;
526
- localId: string;
527
- targetIndex: number;
519
+ type: DraggableType;
520
+ localId: string;
521
+ targetIndex: number;
528
522
  }
529
523
 
530
524
  export interface DraggableData {
531
- sourceType: DraggableType;
532
- sourceLocalId: string;
533
- sourceIndexes: number[];
534
- targetType: DraggableType;
535
- targetLocalId: string;
536
- targetIndex: number;
537
- targetAdjustedIndex: number;
538
- targetClosestEdge: Edge;
539
- /**
540
- * The target direction identifies where relative to the target index is the item being dropped. A value of 'start' would
541
- * mean that the item is being inserted before the index, and 'end would be after.
542
- */
543
- targetDirection: 'start' | 'end';
544
- /**
545
- * This represents a hollistic movement direction; a value of 1 means the source->target index would shift in a positive direction.
546
- * A value of 0 indicates that the target index is inside the the source indexes.
547
- */
548
- direction: 1 | -1 | 0;
549
- behaviour: DraggableBehaviour;
525
+ sourceType: DraggableType;
526
+ sourceLocalId: string;
527
+ sourceIndexes: number[];
528
+ targetType: DraggableType;
529
+ targetLocalId: string;
530
+ targetIndex: number;
531
+ targetAdjustedIndex: number;
532
+ targetClosestEdge: Edge;
533
+ /**
534
+ * The target direction identifies where relative to the target index is the item being dropped. A value of 'start' would
535
+ * mean that the item is being inserted before the index, and 'end would be after.
536
+ */
537
+ targetDirection: 'start' | 'end';
538
+ /**
539
+ * This represents a hollistic movement direction; a value of 1 means the source->target index would shift in a positive direction.
540
+ * A value of 0 indicates that the target index is inside the the source indexes.
541
+ */
542
+ direction: 1 | -1 | 0;
543
+ behaviour: DraggableBehaviour;
550
544
  }
551
545
 
552
546
  export type HandleTypes = 'hover' | 'selected';
553
547
 
554
548
  export interface MessageDescriptor {
555
- id: string;
556
- description: string;
557
- defaultMessage: string;
549
+ id: string;
550
+ description: string;
551
+ defaultMessage: string;
558
552
  }