@atlaskit/editor-plugin-table 7.16.11 → 7.16.12

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 (242) hide show
  1. package/.eslintrc.js +3 -3
  2. package/CHANGELOG.md +8 -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 +41 -6
  6. package/dist/cjs/nodeviews/TableResizer.js +7 -7
  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/merged-cells.js +3 -3
  16. package/dist/es2019/commands/misc.js +3 -3
  17. package/dist/es2019/nodeviews/TableContainer.js +43 -5
  18. package/dist/es2019/nodeviews/TableResizer.js +7 -7
  19. package/dist/es2019/nodeviews/TableRow.js +21 -21
  20. package/dist/es2019/pm-plugins/table-resizing/plugin.js +3 -3
  21. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  22. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  23. package/dist/es2019/ui/FloatingContextualMenu/styles.js +47 -47
  24. package/dist/es2019/ui/FloatingDragMenu/styles.js +30 -30
  25. package/dist/es2019/ui/common-styles.js +802 -816
  26. package/dist/es2019/ui/ui-styles.js +665 -678
  27. package/dist/es2019/utils/merged-cells.js +3 -3
  28. package/dist/esm/commands/misc.js +3 -3
  29. package/dist/esm/nodeviews/TableCell.js +10 -10
  30. package/dist/esm/nodeviews/TableContainer.js +42 -7
  31. package/dist/esm/nodeviews/TableResizer.js +7 -7
  32. package/dist/esm/nodeviews/TableRow.js +23 -23
  33. package/dist/esm/pm-plugins/table-resizing/plugin.js +3 -3
  34. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  35. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +3 -3
  36. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  37. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  38. package/dist/esm/ui/common-styles.js +13 -13
  39. package/dist/esm/ui/ui-styles.js +25 -25
  40. package/dist/esm/utils/merged-cells.js +3 -3
  41. package/dist/types/pm-plugins/decorations/utils/index.d.ts +1 -1
  42. package/dist/types/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  43. package/dist/types/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  44. package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  45. package/dist/types/ui/ColumnResizeWidget/index.d.ts +1 -1
  46. package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  47. package/dist/types/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  48. package/dist/types/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  49. package/dist/types/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  50. package/dist/types/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  51. package/dist/types-ts4.5/pm-plugins/decorations/utils/index.d.ts +1 -1
  52. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/autoscrollers.d.ts +1 -1
  53. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/getDragBehaviour.d.ts +1 -1
  54. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
  55. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +1 -1
  56. package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +1 -1
  57. package/dist/types-ts4.5/ui/FloatingToolbarLabel/FloatingToolbarLabel.d.ts +1 -1
  58. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.d.ts +1 -1
  59. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/index.d.ts +1 -1
  60. package/dist/types-ts4.5/ui/icons/DragHandleDisabledIcon.d.ts +1 -1
  61. package/docs/0-intro.tsx +9 -7
  62. package/package.json +2 -2
  63. package/report.api.md +67 -66
  64. package/src/commands/clear.ts +36 -44
  65. package/src/commands/collapse.ts +8 -8
  66. package/src/commands/column-resize.ts +412 -452
  67. package/src/commands/delete.ts +14 -14
  68. package/src/commands/display-mode.ts +10 -11
  69. package/src/commands/go-to-next-cell.ts +48 -54
  70. package/src/commands/hover.ts +210 -227
  71. package/src/commands/index.ts +35 -35
  72. package/src/commands/insert.ts +208 -235
  73. package/src/commands/misc.ts +655 -748
  74. package/src/commands/referentiality.ts +9 -9
  75. package/src/commands/selection.ts +433 -563
  76. package/src/commands/sort.ts +68 -86
  77. package/src/commands/split-cell.ts +14 -14
  78. package/src/commands/toggle.ts +69 -67
  79. package/src/commands-with-analytics.ts +570 -639
  80. package/src/create-plugin-config.ts +13 -13
  81. package/src/event-handlers.ts +513 -612
  82. package/src/handlers.ts +120 -133
  83. package/src/nodeviews/ExternalDropTargets.tsx +68 -73
  84. package/src/nodeviews/OverflowShadowsObserver.ts +148 -157
  85. package/src/nodeviews/TableCell.ts +47 -54
  86. package/src/nodeviews/TableComponent.tsx +1018 -1112
  87. package/src/nodeviews/TableComponentWithSharedState.tsx +91 -94
  88. package/src/nodeviews/TableContainer.tsx +363 -339
  89. package/src/nodeviews/TableNodeViewBase.ts +19 -24
  90. package/src/nodeviews/TableResizer.tsx +565 -657
  91. package/src/nodeviews/TableRow.ts +580 -629
  92. package/src/nodeviews/TableStickyScrollbar.ts +173 -190
  93. package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +8 -8
  94. package/src/nodeviews/__mocks__/OverridableMock.ts +14 -15
  95. package/src/nodeviews/table.tsx +345 -375
  96. package/src/nodeviews/types.ts +21 -24
  97. package/src/nodeviews/update-overflow-shadows.ts +8 -14
  98. package/src/plugin.tsx +578 -603
  99. package/src/pm-plugins/analytics/actions.ts +10 -12
  100. package/src/pm-plugins/analytics/commands.ts +31 -37
  101. package/src/pm-plugins/analytics/plugin-factory.ts +4 -2
  102. package/src/pm-plugins/analytics/plugin-key.ts +1 -3
  103. package/src/pm-plugins/analytics/plugin.ts +60 -70
  104. package/src/pm-plugins/analytics/reducer.ts +19 -19
  105. package/src/pm-plugins/analytics/types.ts +10 -10
  106. package/src/pm-plugins/analytics/utils/moved-event.ts +38 -38
  107. package/src/pm-plugins/decorations/plugin.ts +58 -77
  108. package/src/pm-plugins/decorations/utils/column-controls.ts +59 -71
  109. package/src/pm-plugins/decorations/utils/column-resizing.ts +50 -57
  110. package/src/pm-plugins/decorations/utils/compose-decorations.ts +6 -6
  111. package/src/pm-plugins/decorations/utils/index.ts +3 -6
  112. package/src/pm-plugins/decorations/utils/types.ts +7 -12
  113. package/src/pm-plugins/default-table-selection.ts +3 -3
  114. package/src/pm-plugins/drag-and-drop/actions.ts +25 -25
  115. package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +158 -190
  116. package/src/pm-plugins/drag-and-drop/commands.ts +154 -170
  117. package/src/pm-plugins/drag-and-drop/consts.ts +4 -5
  118. package/src/pm-plugins/drag-and-drop/plugin-factory.ts +23 -20
  119. package/src/pm-plugins/drag-and-drop/plugin-key.ts +1 -3
  120. package/src/pm-plugins/drag-and-drop/plugin.ts +329 -383
  121. package/src/pm-plugins/drag-and-drop/reducer.ts +30 -30
  122. package/src/pm-plugins/drag-and-drop/types.ts +8 -8
  123. package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +38 -41
  124. package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +3 -6
  125. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +57 -70
  126. package/src/pm-plugins/keymap.ts +208 -220
  127. package/src/pm-plugins/main.ts +348 -400
  128. package/src/pm-plugins/plugin-factory.ts +32 -34
  129. package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -97
  130. package/src/pm-plugins/sticky-headers/commands.ts +2 -6
  131. package/src/pm-plugins/sticky-headers/plugin-key.ts +1 -3
  132. package/src/pm-plugins/sticky-headers/plugin-state.ts +41 -44
  133. package/src/pm-plugins/sticky-headers/plugin.ts +4 -4
  134. package/src/pm-plugins/sticky-headers/types.ts +8 -8
  135. package/src/pm-plugins/sticky-headers/util.ts +10 -10
  136. package/src/pm-plugins/table-analytics.ts +70 -72
  137. package/src/pm-plugins/table-local-id.ts +180 -184
  138. package/src/pm-plugins/table-resizing/commands.ts +72 -85
  139. package/src/pm-plugins/table-resizing/event-handlers.ts +298 -317
  140. package/src/pm-plugins/table-resizing/plugin-factory.ts +10 -10
  141. package/src/pm-plugins/table-resizing/plugin-key.ts +1 -3
  142. package/src/pm-plugins/table-resizing/plugin.ts +61 -68
  143. package/src/pm-plugins/table-resizing/reducer.ts +30 -33
  144. package/src/pm-plugins/table-resizing/utils/colgroup.ts +84 -84
  145. package/src/pm-plugins/table-resizing/utils/column-state.ts +78 -81
  146. package/src/pm-plugins/table-resizing/utils/content-width.ts +94 -114
  147. package/src/pm-plugins/table-resizing/utils/dom.ts +93 -110
  148. package/src/pm-plugins/table-resizing/utils/index.ts +29 -34
  149. package/src/pm-plugins/table-resizing/utils/misc.ts +94 -119
  150. package/src/pm-plugins/table-resizing/utils/resize-column.ts +93 -106
  151. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +240 -257
  152. package/src/pm-plugins/table-resizing/utils/resize-state.ts +343 -372
  153. package/src/pm-plugins/table-resizing/utils/scale-table.ts +202 -207
  154. package/src/pm-plugins/table-resizing/utils/types.ts +17 -17
  155. package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +1 -2
  156. package/src/pm-plugins/table-selection-keymap.ts +25 -51
  157. package/src/pm-plugins/table-width.ts +191 -204
  158. package/src/pm-plugins/view-mode-sort/index.ts +223 -227
  159. package/src/pm-plugins/view-mode-sort/plugin-key.ts +3 -2
  160. package/src/pm-plugins/view-mode-sort/types.ts +12 -12
  161. package/src/pm-plugins/view-mode-sort/utils.ts +108 -117
  162. package/src/reducer.ts +139 -155
  163. package/src/toolbar.tsx +815 -905
  164. package/src/transforms/column-width.ts +186 -213
  165. package/src/transforms/delete-columns.ts +208 -222
  166. package/src/transforms/delete-rows.ts +117 -121
  167. package/src/transforms/fix-tables.ts +190 -215
  168. package/src/transforms/merge.ts +263 -269
  169. package/src/transforms/replace-table.ts +27 -43
  170. package/src/transforms/split.ts +65 -75
  171. package/src/types.ts +421 -427
  172. package/src/ui/ColumnResizeWidget/index.tsx +40 -47
  173. package/src/ui/DragHandle/HandleIconComponent.tsx +9 -13
  174. package/src/ui/DragHandle/index.tsx +221 -250
  175. package/src/ui/DragPreview/index.tsx +35 -35
  176. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +33 -41
  177. package/src/ui/FloatingContextualButton/FixedButton.tsx +154 -157
  178. package/src/ui/FloatingContextualButton/index.tsx +109 -115
  179. package/src/ui/FloatingContextualButton/styles.ts +43 -46
  180. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +634 -694
  181. package/src/ui/FloatingContextualMenu/index.tsx +83 -101
  182. package/src/ui/FloatingContextualMenu/styles.ts +57 -65
  183. package/src/ui/FloatingDeleteButton/DeleteButton.tsx +37 -37
  184. package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +47 -57
  185. package/src/ui/FloatingDeleteButton/index.tsx +319 -350
  186. package/src/ui/FloatingDragMenu/DragMenu.tsx +555 -596
  187. package/src/ui/FloatingDragMenu/DropdownMenu.tsx +152 -162
  188. package/src/ui/FloatingDragMenu/index.tsx +88 -102
  189. package/src/ui/FloatingDragMenu/styles.ts +51 -54
  190. package/src/ui/FloatingInsertButton/InsertButton.tsx +204 -217
  191. package/src/ui/FloatingInsertButton/getPopupOptions.ts +100 -115
  192. package/src/ui/FloatingInsertButton/index.tsx +248 -292
  193. package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +24 -29
  194. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +308 -329
  195. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +85 -94
  196. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +46 -46
  197. package/src/ui/TableFloatingColumnControls/index.tsx +116 -136
  198. package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +79 -91
  199. package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +95 -102
  200. package/src/ui/TableFloatingControls/CornerControls/index.tsx +1 -4
  201. package/src/ui/TableFloatingControls/CornerControls/types.ts +8 -8
  202. package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +50 -50
  203. package/src/ui/TableFloatingControls/NumberColumn/index.tsx +111 -124
  204. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +86 -105
  205. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +305 -341
  206. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +72 -75
  207. package/src/ui/TableFloatingControls/index.tsx +191 -193
  208. package/src/ui/TableFullWidthLabel/index.tsx +20 -20
  209. package/src/ui/common-styles.ts +880 -912
  210. package/src/ui/consts.ts +29 -74
  211. package/src/ui/icons/AddColLeftIcon.tsx +33 -39
  212. package/src/ui/icons/AddColRightIcon.tsx +33 -39
  213. package/src/ui/icons/AddRowAboveIcon.tsx +16 -22
  214. package/src/ui/icons/AddRowBelowIcon.tsx +33 -39
  215. package/src/ui/icons/DisplayModeIcon.tsx +31 -31
  216. package/src/ui/icons/DragHandleDisabledIcon.tsx +19 -21
  217. package/src/ui/icons/DragHandleIcon.tsx +12 -12
  218. package/src/ui/icons/DragInMotionIcon.tsx +45 -52
  219. package/src/ui/icons/MergeCellsIcon.tsx +22 -28
  220. package/src/ui/icons/MinimisedHandle.tsx +9 -9
  221. package/src/ui/icons/SplitCellIcon.tsx +30 -36
  222. package/src/ui/ui-styles.ts +769 -798
  223. package/src/utils/alignment.ts +1 -1
  224. package/src/utils/analytics.ts +192 -208
  225. package/src/utils/collapse.ts +55 -64
  226. package/src/utils/column-controls.ts +237 -254
  227. package/src/utils/create.ts +30 -30
  228. package/src/utils/decoration.ts +482 -502
  229. package/src/utils/dom.ts +127 -134
  230. package/src/utils/drag-menu.ts +322 -373
  231. package/src/utils/get-allow-add-column-custom-step.ts +4 -5
  232. package/src/utils/guidelines.ts +10 -21
  233. package/src/utils/index.ts +68 -68
  234. package/src/utils/merged-cells.ts +245 -254
  235. package/src/utils/nodes.ts +91 -106
  236. package/src/utils/paste.ts +119 -135
  237. package/src/utils/row-controls.ts +199 -213
  238. package/src/utils/selection.ts +77 -87
  239. package/src/utils/snapping.ts +84 -97
  240. package/src/utils/table.ts +44 -44
  241. package/src/utils/transforms.ts +5 -5
  242. 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
  }