@atlaskit/editor-plugin-table 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/index.js +47 -37
  3. package/dist/cjs/plugins/table/nodeviews/TableCell.js +111 -0
  4. package/dist/cjs/plugins/table/nodeviews/TableNodeViewBase.js +30 -0
  5. package/dist/cjs/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +313 -307
  6. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/actions.js +12 -0
  7. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands.js +27 -0
  8. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/consts.js +11 -0
  9. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/index.js +32 -0
  10. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +13 -0
  11. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +8 -0
  12. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +28 -0
  13. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/reducer.js +28 -0
  14. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/types.js +5 -0
  15. package/dist/cjs/plugins/table/pm-plugins/main.js +16 -13
  16. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +1 -8
  17. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  18. package/dist/cjs/plugins/table/utils/dom.js +31 -1
  19. package/dist/cjs/plugins/table/utils/index.js +12 -0
  20. package/dist/cjs/plugins/table/utils/nodes.js +31 -7
  21. package/dist/es2019/plugins/table/index.js +12 -3
  22. package/dist/es2019/plugins/table/nodeviews/{tableCell.js → TableCell.js} +28 -24
  23. package/dist/es2019/plugins/table/nodeviews/TableNodeViewBase.js +22 -0
  24. package/dist/es2019/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +273 -284
  25. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  26. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands.js +14 -0
  27. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  28. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  29. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +8 -0
  30. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  31. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  32. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/reducer.js +20 -0
  33. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  34. package/dist/es2019/plugins/table/pm-plugins/main.js +8 -8
  35. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
  36. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  37. package/dist/es2019/plugins/table/utils/dom.js +30 -0
  38. package/dist/es2019/plugins/table/utils/index.js +1 -1
  39. package/dist/es2019/plugins/table/utils/nodes.js +16 -0
  40. package/dist/esm/plugins/table/index.js +47 -37
  41. package/dist/esm/plugins/table/nodeviews/TableCell.js +105 -0
  42. package/dist/esm/plugins/table/nodeviews/TableNodeViewBase.js +24 -0
  43. package/dist/esm/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.js → nodeviews/TableRow.js} +314 -307
  44. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/actions.js +6 -0
  45. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands.js +22 -0
  46. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/consts.js +5 -0
  47. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/index.js +3 -0
  48. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-factory.js +7 -0
  49. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin-key.js +2 -0
  50. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +22 -0
  51. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/reducer.js +21 -0
  52. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/types.js +1 -0
  53. package/dist/esm/plugins/table/pm-plugins/main.js +16 -13
  54. package/dist/esm/plugins/table/pm-plugins/sticky-headers/index.js +1 -2
  55. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -9
  56. package/dist/esm/plugins/table/utils/dom.js +30 -0
  57. package/dist/esm/plugins/table/utils/index.js +1 -1
  58. package/dist/esm/plugins/table/utils/nodes.js +24 -0
  59. package/dist/types/plugins/table/nodeviews/TableCell.d.ts +13 -0
  60. package/dist/types/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
  61. package/dist/types/plugins/table/nodeviews/TableRow.d.ts +60 -0
  62. package/dist/types/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  63. package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  64. package/dist/types/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  65. package/dist/types/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  66. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  67. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  68. package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  69. package/dist/types/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  70. package/dist/types/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  71. package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
  72. package/dist/types/plugins/table/pm-plugins/sticky-headers/index.d.ts +0 -1
  73. package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
  74. package/dist/types/plugins/table/types.d.ts +1 -0
  75. package/dist/types/plugins/table/utils/dom.d.ts +6 -0
  76. package/dist/types/plugins/table/utils/index.d.ts +1 -1
  77. package/dist/types/plugins/table/utils/nodes.d.ts +12 -2
  78. package/dist/types-ts4.5/i18n/cs.d.ts +37 -0
  79. package/dist/types-ts4.5/i18n/da.d.ts +35 -0
  80. package/dist/types-ts4.5/i18n/de.d.ts +35 -0
  81. package/dist/types-ts4.5/i18n/en.d.ts +37 -0
  82. package/dist/types-ts4.5/i18n/en_GB.d.ts +37 -0
  83. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +37 -0
  84. package/dist/types-ts4.5/i18n/es.d.ts +35 -0
  85. package/dist/types-ts4.5/i18n/fi.d.ts +35 -0
  86. package/dist/types-ts4.5/i18n/fr.d.ts +37 -0
  87. package/dist/types-ts4.5/i18n/hu.d.ts +37 -0
  88. package/dist/types-ts4.5/i18n/it.d.ts +37 -0
  89. package/dist/types-ts4.5/i18n/ja.d.ts +37 -0
  90. package/dist/types-ts4.5/i18n/ko.d.ts +35 -0
  91. package/dist/types-ts4.5/i18n/nb.d.ts +35 -0
  92. package/dist/types-ts4.5/i18n/nl.d.ts +37 -0
  93. package/dist/types-ts4.5/i18n/pl.d.ts +37 -0
  94. package/dist/types-ts4.5/i18n/pt_BR.d.ts +37 -0
  95. package/dist/types-ts4.5/i18n/ru.d.ts +37 -0
  96. package/dist/types-ts4.5/i18n/sv.d.ts +35 -0
  97. package/dist/types-ts4.5/i18n/th.d.ts +35 -0
  98. package/dist/types-ts4.5/i18n/tr.d.ts +37 -0
  99. package/dist/types-ts4.5/i18n/uk.d.ts +37 -0
  100. package/dist/types-ts4.5/i18n/vi.d.ts +35 -0
  101. package/dist/types-ts4.5/i18n/zh.d.ts +37 -0
  102. package/dist/types-ts4.5/i18n/zh_TW.d.ts +37 -0
  103. package/dist/types-ts4.5/index.d.ts +2 -0
  104. package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
  105. package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
  106. package/dist/types-ts4.5/plugins/table/commands/delete.d.ts +3 -0
  107. package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
  108. package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
  109. package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
  110. package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +9 -0
  111. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +29 -0
  112. package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
  113. package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
  114. package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
  115. package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
  116. package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
  117. package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +25 -0
  118. package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
  119. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +15 -0
  120. package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
  121. package/dist/types-ts4.5/plugins/table/index.d.ts +38 -0
  122. package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +24 -0
  123. package/dist/types-ts4.5/plugins/table/nodeviews/TableCell.d.ts +13 -0
  124. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
  125. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +44 -0
  126. package/dist/types-ts4.5/plugins/table/nodeviews/TableNodeViewBase.d.ts +18 -0
  127. package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +25 -0
  128. package/dist/types-ts4.5/plugins/table/nodeviews/TableRow.d.ts +60 -0
  129. package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +24 -0
  130. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
  131. package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
  132. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +33 -0
  133. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +26 -0
  134. package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +1 -0
  135. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
  136. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
  137. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -0
  138. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
  139. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
  140. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
  141. package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
  142. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/actions.d.ts +15 -0
  143. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands.d.ts +4 -0
  144. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/consts.d.ts +6 -0
  145. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/index.d.ts +4 -0
  146. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-factory.d.ts +2 -0
  147. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin-key.d.ts +3 -0
  148. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +3 -0
  149. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/reducer.d.ts +4 -0
  150. package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/types.d.ts +5 -0
  151. package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
  152. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
  153. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
  154. package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
  155. package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
  156. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
  157. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +5 -0
  158. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
  159. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
  160. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
  161. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
  162. package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
  163. package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
  164. package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +10 -0
  165. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +23 -0
  166. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
  167. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
  168. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
  169. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
  170. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
  171. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
  172. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +23 -0
  173. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
  174. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/consts.d.ts +2 -0
  175. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
  176. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +12 -0
  177. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +13 -0
  178. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +20 -0
  179. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
  180. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
  181. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
  182. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +21 -0
  183. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
  184. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
  185. package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +5 -0
  186. package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +17 -0
  187. package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
  188. package/dist/types-ts4.5/plugins/table/toolbar.d.ts +36 -0
  189. package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +37 -0
  190. package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +4 -0
  191. package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
  192. package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
  193. package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
  194. package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
  195. package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
  196. package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
  197. package/dist/types-ts4.5/plugins/table/types.d.ts +343 -0
  198. package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
  199. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/FixedButton.d.ts +23 -0
  200. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +21 -0
  201. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
  202. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
  203. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
  204. package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
  205. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +13 -0
  206. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
  207. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
  208. package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
  209. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +13 -0
  210. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
  211. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
  212. package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
  213. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
  214. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
  215. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
  216. package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +39 -0
  217. package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +9 -0
  218. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +50 -0
  219. package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +63 -0
  220. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
  221. package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +45 -0
  222. package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
  223. package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
  224. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +19 -0
  225. package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +26 -0
  226. package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
  227. package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +2 -0
  228. package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
  229. package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +23 -0
  230. package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
  231. package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
  232. package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
  233. package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +10 -0
  234. package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
  235. package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
  236. package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
  237. package/dist/types-ts4.5/types/i18n.d.ts +5 -0
  238. package/package.json +3 -3
  239. package/report.api.md +2 -17
  240. package/src/__tests__/unit/nodeviews/cell.ts +2 -2
  241. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +25 -148
  242. package/src/plugins/table/index.tsx +14 -0
  243. package/src/plugins/table/nodeviews/{tableCell.tsx → TableCell.ts} +41 -46
  244. package/src/plugins/table/nodeviews/TableNodeViewBase.ts +32 -0
  245. package/src/plugins/table/{pm-plugins/sticky-headers/nodeviews/tableRow.ts → nodeviews/TableRow.ts} +193 -246
  246. package/src/plugins/table/pm-plugins/drag-and-drop/actions.ts +29 -0
  247. package/src/plugins/table/pm-plugins/drag-and-drop/commands.ts +32 -0
  248. package/src/plugins/table/pm-plugins/drag-and-drop/consts.ts +8 -0
  249. package/src/plugins/table/pm-plugins/drag-and-drop/index.ts +5 -0
  250. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-factory.ts +8 -0
  251. package/src/plugins/table/pm-plugins/drag-and-drop/plugin-key.ts +7 -0
  252. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +32 -0
  253. package/src/plugins/table/pm-plugins/drag-and-drop/reducer.ts +26 -0
  254. package/src/plugins/table/pm-plugins/drag-and-drop/types.ts +6 -0
  255. package/src/plugins/table/pm-plugins/main.ts +10 -19
  256. package/src/plugins/table/pm-plugins/sticky-headers/index.ts +0 -1
  257. package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -9
  258. package/src/plugins/table/types.ts +2 -0
  259. package/src/plugins/table/utils/dom.ts +38 -0
  260. package/src/plugins/table/utils/index.ts +2 -0
  261. package/src/plugins/table/utils/nodes.ts +30 -2
  262. package/tmp/api-report-tmp.d.ts +100 -0
  263. package/dist/cjs/plugins/table/nodeviews/tableCell.js +0 -99
  264. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -35
  265. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
  266. package/dist/esm/plugins/table/nodeviews/tableCell.js +0 -93
  267. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +0 -29
  268. package/dist/types/plugins/table/nodeviews/tableCell.d.ts +0 -17
  269. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +0 -6
  270. package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +0 -73
  271. package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.ts +0 -37
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DragAndDropActionType = void 0;
7
+ var DragAndDropActionType = exports.DragAndDropActionType = {
8
+ SET_DROP_TARGET: 'SET_DROP_TARGET',
9
+ CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET'
10
+ };
11
+
12
+ // NOTE: This should be a Union of all possible actions
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setDropTarget = exports.clearDropTarget = void 0;
7
+ var _actions = require("./actions");
8
+ var _pluginFactory = require("./plugin-factory");
9
+ // TODO: This command is a placeholder example. Please replace this if required.
10
+ var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, tr) {
11
+ return (0, _pluginFactory.createCommand)({
12
+ type: _actions.DragAndDropActionType.SET_DROP_TARGET,
13
+ data: {
14
+ type: type,
15
+ index: index
16
+ }
17
+ }, function (originalTr) {
18
+ return (tr || originalTr).setMeta('addToHistory', false);
19
+ });
20
+ };
21
+ var clearDropTarget = exports.clearDropTarget = function clearDropTarget(tr) {
22
+ return (0, _pluginFactory.createCommand)({
23
+ type: _actions.DragAndDropActionType.CLEAR_DROP_TARGET
24
+ }, function (originalTr) {
25
+ return (tr || originalTr).setMeta('addToHistory', false);
26
+ });
27
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DropTargetType = void 0;
7
+ var DropTargetType = exports.DropTargetType = {
8
+ NONE: 'none',
9
+ ROW: 'row',
10
+ COLUMN: 'column'
11
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "clearDropTarget", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _commands.clearDropTarget;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "createPlugin", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _plugin.createPlugin;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "pluginKey", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _pluginKey.pluginKey;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "setDropTarget", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _commands.setDropTarget;
28
+ }
29
+ });
30
+ var _plugin = require("./plugin");
31
+ var _pluginKey = require("./plugin-key");
32
+ var _commands = require("./commands");
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createPluginState = exports.createCommand = void 0;
8
+ var _utils = require("@atlaskit/editor-common/utils");
9
+ var _pluginKey = require("./plugin-key");
10
+ var _reducer = _interopRequireDefault(require("./reducer"));
11
+ var _pluginFactory = (0, _utils.pluginFactory)(_pluginKey.pluginKey, _reducer.default),
12
+ createPluginState = exports.createPluginState = _pluginFactory.createPluginState,
13
+ createCommand = exports.createCommand = _pluginFactory.createCommand;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = void 0;
7
+ var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var pluginKey = exports.pluginKey = new _state.PluginKey('dragAndDropPlugin');
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPlugin = void 0;
7
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _consts = require("./consts");
9
+ var _pluginFactory = require("./plugin-factory");
10
+ var _pluginKey = require("./plugin-key");
11
+ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher) {
12
+ return new _safePlugin.SafePlugin({
13
+ state: (0, _pluginFactory.createPluginState)(dispatch, {
14
+ // TODO: This is example placeholder state. We could use this to track which row/col is currently set as the drop target
15
+ // This would result in a blue highlight being displayed on the corrisponding row/column to single the drop target location.
16
+ dropTargetType: _consts.DropTargetType.NONE,
17
+ dropTargetIndex: 0
18
+ }),
19
+ key: _pluginKey.pluginKey,
20
+ view: function view(editorView) {
21
+ // TODO: Add Pragmatic DnD monitor when the view is constructed.
22
+ return {
23
+ // TODO: Cleanup monitor instance
24
+ // destroy: cleanup,
25
+ };
26
+ }
27
+ });
28
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _actions = require("./actions");
10
+ var _consts = require("./consts");
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ var _default = exports.default = function _default(pluginState, action) {
14
+ switch (action.type) {
15
+ case _actions.DragAndDropActionType.SET_DROP_TARGET:
16
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
17
+ dropTargetType: action.data.type,
18
+ dropTargetIndex: action.data.index
19
+ });
20
+ case _actions.DragAndDropActionType.CLEAR_DROP_TARGET:
21
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
22
+ dropTargetType: _consts.DropTargetType.NONE,
23
+ dropTargetIndex: 0
24
+ });
25
+ default:
26
+ return pluginState;
27
+ }
28
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -18,7 +18,8 @@ var _commands = require("../commands");
18
18
  var _misc = require("../commands/misc");
19
19
  var _eventHandlers = require("../event-handlers");
20
20
  var _table = require("../nodeviews/table");
21
- var _tableCell = _interopRequireDefault(require("../nodeviews/tableCell"));
21
+ var _TableCell = _interopRequireDefault(require("../nodeviews/TableCell"));
22
+ var _TableRow = _interopRequireDefault(require("../nodeviews/TableRow"));
22
23
  var _plugin = require("../pm-plugins/decorations/plugin");
23
24
  var _transforms2 = require("../transforms");
24
25
  var _types = require("../types");
@@ -29,7 +30,7 @@ var _pluginFactory = require("./plugin-factory");
29
30
  var _pluginKey = require("./plugin-key");
30
31
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
32
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32
- var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
33
+ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi) {
33
34
  var _window;
34
35
  var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread({
35
36
  pluginConfig: pluginConfig,
@@ -40,7 +41,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
40
41
  wasFullWidthModeEnabled: previousFullWidthModeEnabled,
41
42
  isTableResizingEnabled: tableResizingEnabled,
42
43
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
43
- isHeaderColumnEnabled: false
44
+ isHeaderColumnEnabled: false,
45
+ isDragAndDropEnabled: dragAndDropEnabled
44
46
  }, _defaultTableSelection.defaultTableSelection), {}, {
45
47
  getIntl: getIntl
46
48
  }));
@@ -53,14 +55,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
53
55
  elementContentRects[entry.target.id] = entry.contentRect;
54
56
  });
55
57
  }) : undefined;
56
- var tableCellNodeview = {
57
- tableCell: function tableCell(node, view, getPos) {
58
- return new _tableCell.default(node, view, getPos, observer);
59
- },
60
- tableHeader: function tableHeader(node, view, getPos) {
61
- return new _tableCell.default(node, view, getPos, observer);
62
- }
63
- };
64
58
 
65
59
  // Used to prevent invalid table cell spans being reported more than once per editor/document
66
60
  var invalidTableIds = [];
@@ -236,11 +230,20 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
236
230
  }
237
231
  return false;
238
232
  },
239
- nodeViews: _objectSpread(_objectSpread({}, tableCellNodeview), {}, {
233
+ nodeViews: {
240
234
  table: function table(node, view, getPos) {
241
235
  return (0, _table.createTableView)(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
236
+ },
237
+ tableRow: function tableRow(node, view, getPos) {
238
+ return new _TableRow.default(node, view, getPos, eventDispatcher);
239
+ },
240
+ tableCell: function tableCell(node, view, getPos) {
241
+ return new _TableCell.default(node, view, getPos, eventDispatcher, observer);
242
+ },
243
+ tableHeader: function tableHeader(node, view, getPos) {
244
+ return new _TableCell.default(node, view, getPos, eventDispatcher, observer);
242
245
  }
243
- }),
246
+ },
244
247
  handleDOMEvents: {
245
248
  focus: _eventHandlers.handleFocus,
246
249
  blur: _eventHandlers.handleBlur,
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "TableRowNodeView", {
7
- enumerable: true,
8
- get: function get() {
9
- return _tableRow.TableRowNodeView;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "createPlugin", {
13
7
  enumerable: true,
14
8
  get: function get() {
@@ -42,5 +36,4 @@ Object.defineProperty(exports, "updateStickyState", {
42
36
  var _plugin = require("./plugin");
43
37
  var _pluginKey = require("./plugin-key");
44
38
  var _util = require("./util");
45
- var _commands = require("./commands");
46
- var _tableRow = require("./nodeviews/tableRow");
39
+ var _commands = require("./commands");
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createPlugin = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
- var _tableRow = require("./nodeviews/tableRow");
9
8
  var _pluginKey = require("./plugin-key");
10
9
  var _pluginState = require("./plugin-state");
11
10
  var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher) {
@@ -15,13 +14,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
15
14
  var getEditorFeatureFlags = arguments.length > 3 ? arguments[3] : undefined;
16
15
  return new _safePlugin.SafePlugin({
17
16
  state: (0, _pluginState.createPluginState)(dispatch, initialState),
18
- key: _pluginKey.pluginKey,
19
- props: {
20
- nodeViews: {
21
- tableRow: function tableRow(node, view, getPos) {
22
- return new _tableRow.TableRowNodeView(node, view, getPos, eventDispatcher);
23
- }
24
- }
25
- }
17
+ key: _pluginKey.pluginKey
26
18
  });
27
19
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateResizeHandles = exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = void 0;
6
+ exports.updateResizeHandles = exports.isTableControlsButton = exports.isTableContainerOrWrapper = exports.isRowControlsButton = exports.isResizeHandleDecoration = exports.isInsertRowButton = exports.isCornerButton = exports.isColumnControlsDecorations = exports.isCell = exports.hasResizeHandler = exports.getTree = exports.getTop = exports.getMousePositionVerticalRelativeByElement = exports.getMousePositionHorizontalRelativeByElement = exports.getColumnOrRowIndex = void 0;
7
7
  var _utils = require("@atlaskit/editor-common/utils");
8
8
  var _types = require("../types");
9
9
  var _consts = require("../ui/consts");
@@ -156,4 +156,34 @@ var hasResizeHandler = exports.hasResizeHandler = function hasResizeHandler(_ref
156
156
  return false;
157
157
  }
158
158
  return true;
159
+ };
160
+ var getTree = exports.getTree = function getTree(tr) {
161
+ // pm renders into tbody, owned by react
162
+ var tbody = tr.parentElement;
163
+ if (!tbody) {
164
+ return null;
165
+ }
166
+
167
+ // rendered by react
168
+ var table = tbody.parentElement;
169
+ if (!table) {
170
+ return null;
171
+ }
172
+
173
+ // rendered by react
174
+ var wrapper = table.parentElement;
175
+ if (!wrapper) {
176
+ return null;
177
+ }
178
+ return {
179
+ wrapper: wrapper,
180
+ table: table
181
+ };
182
+ };
183
+ var getTop = exports.getTop = function getTop(element) {
184
+ var _element$getBoundingC, _element$getBoundingC2;
185
+ if (!element || element instanceof Window) {
186
+ return 0;
187
+ }
188
+ return (_element$getBoundingC = element === null || element === void 0 || (_element$getBoundingC2 = element.getBoundingClientRect) === null || _element$getBoundingC2 === void 0 || (_element$getBoundingC2 = _element$getBoundingC2.call(element)) === null || _element$getBoundingC2 === void 0 ? void 0 : _element$getBoundingC2.top) !== null && _element$getBoundingC !== void 0 ? _element$getBoundingC : 0;
159
189
  };
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "anyChildCellMergedAcrossRow", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _nodes.anyChildCellMergedAcrossRow;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "checkIfHeaderColumnEnabled", {
7
13
  enumerable: true,
8
14
  get: function get() {
@@ -285,6 +291,12 @@ Object.defineProperty(exports, "removeTableFromLastChild", {
285
291
  return _paste.removeTableFromLastChild;
286
292
  }
287
293
  });
294
+ Object.defineProperty(exports, "supportedHeaderRow", {
295
+ enumerable: true,
296
+ get: function get() {
297
+ return _nodes.supportedHeaderRow;
298
+ }
299
+ });
288
300
  Object.defineProperty(exports, "tablesHaveDifferentColumnWidths", {
289
301
  enumerable: true,
290
302
  get: function get() {
@@ -4,11 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.tablesHaveDifferentNoOfColumns = exports.tablesHaveDifferentColumnWidths = exports.isTableNested = exports.isLayoutSupported = exports.isIsolating = exports.getTableWidth = exports.containsHeaderRow = exports.containsHeaderColumn = exports.checkIfNumberColumnEnabled = exports.checkIfHeaderRowEnabled = exports.checkIfHeaderColumnEnabled = void 0;
7
+ exports.tablesHaveDifferentNoOfColumns = exports.tablesHaveDifferentColumnWidths = exports.supportedHeaderRow = exports.isTableNested = exports.isLayoutSupported = exports.isIsolating = exports.getTableWidth = exports.containsHeaderRow = exports.containsHeaderColumn = exports.checkIfNumberColumnEnabled = exports.checkIfHeaderRowEnabled = exports.checkIfHeaderColumnEnabled = exports.anyChildCellMergedAcrossRow = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _utils = require("@atlaskit/editor-prosemirror/utils");
9
+ var _utils = require("@atlaskit/editor-common/utils");
10
+ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
10
11
  var _tableMap = require("@atlaskit/editor-tables/table-map");
11
- var _utils2 = require("@atlaskit/editor-tables/utils");
12
+ var _utils3 = require("@atlaskit/editor-tables/utils");
12
13
  var _pluginKey = require("../pm-plugins/plugin-key");
13
14
  var isIsolating = exports.isIsolating = function isIsolating(node) {
14
15
  return !!node.type.spec.isolating;
@@ -45,13 +46,13 @@ var containsHeaderRow = exports.containsHeaderRow = function containsHeaderRow(t
45
46
  return true;
46
47
  };
47
48
  var checkIfHeaderColumnEnabled = exports.checkIfHeaderColumnEnabled = function checkIfHeaderColumnEnabled(selection) {
48
- return filterNearSelection(selection, _utils2.findTable, containsHeaderColumn, false);
49
+ return filterNearSelection(selection, _utils3.findTable, containsHeaderColumn, false);
49
50
  };
50
51
  var checkIfHeaderRowEnabled = exports.checkIfHeaderRowEnabled = function checkIfHeaderRowEnabled(selection) {
51
- return filterNearSelection(selection, _utils2.findTable, containsHeaderRow, false);
52
+ return filterNearSelection(selection, _utils3.findTable, containsHeaderRow, false);
52
53
  };
53
54
  var checkIfNumberColumnEnabled = exports.checkIfNumberColumnEnabled = function checkIfNumberColumnEnabled(selection) {
54
- return filterNearSelection(selection, _utils2.findTable, function (table) {
55
+ return filterNearSelection(selection, _utils3.findTable, function (table) {
55
56
  return !!table.attrs.isNumberColumnEnabled;
56
57
  }, false);
57
58
  };
@@ -63,7 +64,7 @@ var isLayoutSupported = exports.isLayoutSupported = function isLayoutSupported(s
63
64
  bodiedExtension = _state$schema$nodes.bodiedExtension,
64
65
  layoutSection = _state$schema$nodes.layoutSection,
65
66
  expand = _state$schema$nodes.expand;
66
- return !(0, _utils.hasParentNodeOfType)([expand, layoutSection, bodiedExtension])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
67
+ return !(0, _utils2.hasParentNodeOfType)([expand, layoutSection, bodiedExtension])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
67
68
  };
68
69
  var getTableWidth = exports.getTableWidth = function getTableWidth(node) {
69
70
  return getTableWidths(node).reduce(function (acc, current) {
@@ -111,4 +112,27 @@ var isTableNested = exports.isTableNested = function isTableNested(state) {
111
112
  var parent = state.doc.resolve(tablePos).parent;
112
113
  var nodeTypes = state.schema.nodes;
113
114
  return parent.type === nodeTypes.layoutColumn || parent.type === nodeTypes.expand || parent.type === nodeTypes.bodiedExtension;
115
+ };
116
+ var anyChildCellMergedAcrossRow = exports.anyChildCellMergedAcrossRow = function anyChildCellMergedAcrossRow(node) {
117
+ return (0, _utils.mapChildren)(node, function (child) {
118
+ return child.attrs.rowspan || 0;
119
+ }).some(function (rowspan) {
120
+ return rowspan > 1;
121
+ });
122
+ };
123
+
124
+ /**
125
+ * Check if a given node is a header row with this definition:
126
+ * - all children are tableHeader cells
127
+ * - no table cells have been have merged with other table row cells
128
+ *
129
+ * @param node ProseMirror node
130
+ * @return boolean if it meets definition
131
+ */
132
+ var supportedHeaderRow = exports.supportedHeaderRow = function supportedHeaderRow(node) {
133
+ var allHeaders = (0, _utils.mapChildren)(node, function (child) {
134
+ return child.type.name === 'tableHeader';
135
+ }).every(Boolean);
136
+ var someMerged = anyChildCellMergedAcrossRow(node);
137
+ return allHeaders && !someMerged;
114
138
  };
@@ -13,6 +13,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { pluginConfig } from './create-plugin-config';
15
15
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
16
+ import { createPlugin as createDragAndDropPlugin, pluginKey as dragAndDropPluginKey } from './pm-plugins/drag-and-drop';
16
17
  import { keymapPlugin } from './pm-plugins/keymap';
17
18
  import { createPlugin } from './pm-plugins/main';
18
19
  import { pluginKey } from './pm-plugins/plugin-key';
@@ -102,9 +103,10 @@ const tablesPlugin = ({
102
103
  tableResizingEnabled,
103
104
  breakoutEnabled,
104
105
  tableOptions,
105
- getEditorFeatureFlags
106
+ getEditorFeatureFlags,
107
+ dragAndDropEnabled
106
108
  } = options || {};
107
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
109
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api);
108
110
  }
109
111
  }, {
110
112
  name: 'tablePMColResizing',
@@ -159,6 +161,12 @@ const tablesPlugin = ({
159
161
  dispatch,
160
162
  eventDispatcher
161
163
  }) => options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, () => [], (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined
164
+ }, {
165
+ name: 'tableDragAndDrop',
166
+ plugin: ({
167
+ dispatch,
168
+ eventDispatcher
169
+ }) => options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher) : undefined
162
170
  }, {
163
171
  name: 'tableLocalId',
164
172
  plugin: ({
@@ -227,7 +235,8 @@ const tablesPlugin = ({
227
235
  tablePluginState: pluginKey,
228
236
  tableWidthPluginState: tableWidthPluginKey,
229
237
  tableResizingPluginState: tableResizingPluginKey,
230
- stickyHeadersState: stickyHeadersPluginKey
238
+ stickyHeadersState: stickyHeadersPluginKey,
239
+ dragAndDropState: dragAndDropPluginKey
231
240
  },
232
241
  render: ({
233
242
  tableResizingPluginState: resizingPluginState,
@@ -1,25 +1,41 @@
1
1
  import uuid from 'uuid';
2
2
  import { getCellAttrs, getCellDomAttrs } from '@atlaskit/adf-schema';
3
- import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
3
+ import { getPluginState } from '../pm-plugins/plugin-factory';
4
+ import TableNodeView from './TableNodeViewBase';
4
5
  const DEFAULT_COL_SPAN = 1;
5
6
  const DEFAULT_ROW_SPAN = 1;
6
- export default class TableCellNodeView {
7
- constructor(node, view, getPos, observer) {
8
- this.view = view;
9
- this.node = node;
7
+ export default class TableCell extends TableNodeView {
8
+ constructor(node, view, getPos, eventDispatcher, observer) {
9
+ super(node, view, getPos, eventDispatcher);
10
+ this.observer = observer;
10
11
  const {
11
- dom,
12
- contentDOM
13
- } = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
14
- this.getPos = getPos;
15
- this.dom = dom;
16
- this.contentDOM = contentDOM;
12
+ pluginConfig,
13
+ isDragAndDropEnabled
14
+ } = getPluginState(view.state);
15
+ this.isStickyHeaderEnabled = !!pluginConfig.stickyHeaders;
16
+ this.isDragAndDropEnabled = !!isDragAndDropEnabled;
17
17
  if (observer) {
18
18
  this.contentDOM.id = uuid();
19
- this.observer = observer;
20
19
  observer.observe(this.contentDOM);
21
20
  }
22
21
  }
22
+
23
+ // @ts-ignore
24
+
25
+ // @ts-ignore
26
+
27
+ update(node) {
28
+ const didUpdate = this.updateNodeView(node);
29
+ if (didUpdate) {
30
+ this.node = node;
31
+ }
32
+ return didUpdate;
33
+ }
34
+ destroy() {
35
+ if (this.observer) {
36
+ this.observer.unobserve(this.contentDOM);
37
+ }
38
+ }
23
39
  updateNodeView(node) {
24
40
  if (this.node.type !== node.type) {
25
41
  return false;
@@ -52,16 +68,4 @@ export default class TableCellNodeView {
52
68
  }
53
69
  return false;
54
70
  }
55
- update(node) {
56
- const didUpdate = this.updateNodeView(node);
57
- if (didUpdate) {
58
- this.node = node;
59
- }
60
- return didUpdate;
61
- }
62
- destroy() {
63
- if (this.observer) {
64
- this.observer.unobserve(this.contentDOM);
65
- }
66
- }
67
71
  }
@@ -0,0 +1,22 @@
1
+ import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
2
+ export default class TableNodeView {
3
+ /**
4
+ * @constructor
5
+ */
6
+ constructor(node, view, getPos, eventDispatcher) {
7
+ this.node = node;
8
+ this.view = view;
9
+ this.getPos = getPos;
10
+ this.eventDispatcher = eventDispatcher;
11
+ const {
12
+ dom,
13
+ contentDOM
14
+ } = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node));
15
+ this.dom = dom;
16
+ this.contentDOM = contentDOM;
17
+ }
18
+
19
+ /**
20
+ * Variables
21
+ */
22
+ }