@atlaskit/editor-plugin-table 1.1.1 → 1.1.3

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 (305) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/plugins/table/commands/clear.js +4 -16
  4. package/dist/cjs/plugins/table/commands/collapse.js +0 -6
  5. package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
  6. package/dist/cjs/plugins/table/commands/hover.js +7 -37
  7. package/dist/cjs/plugins/table/commands/index.js +0 -8
  8. package/dist/cjs/plugins/table/commands/insert.js +17 -56
  9. package/dist/cjs/plugins/table/commands/misc.js +36 -132
  10. package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
  11. package/dist/cjs/plugins/table/commands/selection.js +21 -87
  12. package/dist/cjs/plugins/table/commands/sort.js +2 -23
  13. package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
  14. package/dist/cjs/plugins/table/commands/toggle.js +8 -34
  15. package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
  16. package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
  17. package/dist/cjs/plugins/table/event-handlers.js +58 -160
  18. package/dist/cjs/plugins/table/handlers.js +10 -39
  19. package/dist/cjs/plugins/table/index.js +47 -91
  20. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
  21. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +95 -191
  22. package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
  23. package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
  24. package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
  25. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
  26. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
  27. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
  28. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
  29. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
  30. package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
  31. package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
  32. package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
  33. package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
  34. package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
  35. package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
  36. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
  37. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
  38. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
  39. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
  40. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
  41. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
  42. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
  43. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
  44. package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
  45. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +18 -43
  46. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -52
  47. package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
  48. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
  49. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
  50. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
  51. package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
  52. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +16 -15
  53. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
  54. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
  55. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
  56. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
  57. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +51 -40
  58. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
  59. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +17 -73
  60. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
  61. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
  62. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
  63. package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
  64. package/dist/cjs/plugins/table/reducer.js +0 -24
  65. package/dist/cjs/plugins/table/toolbar.js +14 -94
  66. package/dist/cjs/plugins/table/transforms/column-width.js +58 -49
  67. package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
  68. package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
  69. package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
  70. package/dist/cjs/plugins/table/transforms/index.js +0 -7
  71. package/dist/cjs/plugins/table/transforms/merge.js +14 -90
  72. package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
  73. package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
  74. package/dist/cjs/plugins/table/transforms/split.js +18 -32
  75. package/dist/cjs/plugins/table/types.js +0 -11
  76. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
  77. package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
  78. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
  79. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
  80. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
  81. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
  82. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
  83. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
  84. package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
  85. package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
  86. package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
  87. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
  88. package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
  89. package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
  90. package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
  91. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
  92. package/dist/cjs/plugins/table/ui/common-styles.js +10 -22
  93. package/dist/cjs/plugins/table/ui/consts.js +3 -8
  94. package/dist/cjs/plugins/table/ui/messages.js +0 -3
  95. package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
  96. package/dist/cjs/plugins/table/utils/analytics.js +4 -19
  97. package/dist/cjs/plugins/table/utils/collapse.js +4 -21
  98. package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
  99. package/dist/cjs/plugins/table/utils/decoration.js +46 -114
  100. package/dist/cjs/plugins/table/utils/dom.js +4 -51
  101. package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
  102. package/dist/cjs/plugins/table/utils/index.js +0 -10
  103. package/dist/cjs/plugins/table/utils/nodes.js +5 -48
  104. package/dist/cjs/plugins/table/utils/paste.js +22 -47
  105. package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
  106. package/dist/cjs/plugins/table/utils/selection.js +3 -36
  107. package/dist/cjs/plugins/table/utils/table.js +0 -11
  108. package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
  109. package/dist/cjs/plugins/table-plugin.js +0 -3
  110. package/dist/cjs/version.json +1 -1
  111. package/dist/es2019/plugins/table/commands/clear.js +3 -8
  112. package/dist/es2019/plugins/table/commands/collapse.js +0 -3
  113. package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
  114. package/dist/es2019/plugins/table/commands/hover.js +7 -17
  115. package/dist/es2019/plugins/table/commands/insert.js +16 -36
  116. package/dist/es2019/plugins/table/commands/misc.js +37 -67
  117. package/dist/es2019/plugins/table/commands/selection.js +7 -62
  118. package/dist/es2019/plugins/table/commands/sort.js +0 -12
  119. package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
  120. package/dist/es2019/plugins/table/commands/toggle.js +13 -15
  121. package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
  122. package/dist/es2019/plugins/table/event-handlers.js +14 -62
  123. package/dist/es2019/plugins/table/handlers.js +16 -26
  124. package/dist/es2019/plugins/table/index.js +12 -25
  125. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
  126. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +40 -103
  127. package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
  128. package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
  129. package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  130. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  131. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
  132. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
  133. package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
  134. package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
  135. package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
  136. package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  137. package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
  138. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  139. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
  140. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
  141. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  142. package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
  143. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +14 -17
  144. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +13 -27
  145. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
  146. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
  147. package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
  148. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +14 -3
  149. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
  150. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
  151. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
  152. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +46 -21
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +31 -61
  154. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
  155. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
  156. package/dist/es2019/plugins/table/reducer.js +26 -30
  157. package/dist/es2019/plugins/table/toolbar.js +5 -48
  158. package/dist/es2019/plugins/table/transforms/column-width.js +60 -32
  159. package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
  160. package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
  161. package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
  162. package/dist/es2019/plugins/table/transforms/merge.js +22 -70
  163. package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
  164. package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
  165. package/dist/es2019/plugins/table/transforms/split.js +16 -19
  166. package/dist/es2019/plugins/table/types.js +2 -4
  167. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
  168. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
  169. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
  170. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
  171. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
  172. package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
  173. package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
  174. package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
  175. package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
  176. package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
  177. package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
  178. package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
  179. package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
  180. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
  181. package/dist/es2019/plugins/table/ui/common-styles.js +11 -7
  182. package/dist/es2019/plugins/table/ui/consts.js +4 -3
  183. package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
  184. package/dist/es2019/plugins/table/utils/analytics.js +0 -8
  185. package/dist/es2019/plugins/table/utils/collapse.js +3 -14
  186. package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
  187. package/dist/es2019/plugins/table/utils/decoration.js +13 -51
  188. package/dist/es2019/plugins/table/utils/dom.js +3 -19
  189. package/dist/es2019/plugins/table/utils/nodes.js +2 -15
  190. package/dist/es2019/plugins/table/utils/paste.js +17 -22
  191. package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
  192. package/dist/es2019/plugins/table/utils/selection.js +0 -21
  193. package/dist/es2019/plugins/table/utils/table.js +0 -2
  194. package/dist/es2019/version.json +1 -1
  195. package/dist/esm/plugins/table/commands/clear.js +3 -8
  196. package/dist/esm/plugins/table/commands/collapse.js +0 -3
  197. package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
  198. package/dist/esm/plugins/table/commands/hover.js +8 -18
  199. package/dist/esm/plugins/table/commands/insert.js +16 -36
  200. package/dist/esm/plugins/table/commands/misc.js +39 -78
  201. package/dist/esm/plugins/table/commands/selection.js +21 -78
  202. package/dist/esm/plugins/table/commands/sort.js +2 -14
  203. package/dist/esm/plugins/table/commands/split-cell.js +3 -8
  204. package/dist/esm/plugins/table/commands/toggle.js +11 -20
  205. package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
  206. package/dist/esm/plugins/table/create-plugin-config.js +0 -3
  207. package/dist/esm/plugins/table/event-handlers.js +58 -123
  208. package/dist/esm/plugins/table/handlers.js +11 -29
  209. package/dist/esm/plugins/table/index.js +47 -60
  210. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
  211. package/dist/esm/plugins/table/nodeviews/TableComponent.js +95 -184
  212. package/dist/esm/plugins/table/nodeviews/table.js +12 -52
  213. package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
  214. package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
  215. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
  216. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
  217. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
  218. package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
  219. package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
  220. package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
  221. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
  222. package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
  223. package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
  224. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
  225. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
  226. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
  227. package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
  228. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
  229. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +18 -25
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -36
  231. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
  232. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
  233. package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
  234. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +14 -3
  235. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
  236. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
  237. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
  238. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +49 -26
  239. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +17 -62
  240. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
  241. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
  242. package/dist/esm/plugins/table/reducer.js +0 -20
  243. package/dist/esm/plugins/table/toolbar.js +13 -63
  244. package/dist/esm/plugins/table/transforms/column-width.js +58 -36
  245. package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
  246. package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
  247. package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
  248. package/dist/esm/plugins/table/transforms/merge.js +16 -75
  249. package/dist/esm/plugins/table/transforms/metadata.js +3 -2
  250. package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
  251. package/dist/esm/plugins/table/transforms/split.js +18 -29
  252. package/dist/esm/plugins/table/types.js +0 -6
  253. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
  254. package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
  255. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
  256. package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
  257. package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
  258. package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
  259. package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
  260. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
  261. package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
  262. package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
  263. package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
  264. package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
  265. package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
  266. package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
  267. package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
  268. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
  269. package/dist/esm/plugins/table/ui/common-styles.js +9 -10
  270. package/dist/esm/plugins/table/ui/consts.js +4 -3
  271. package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
  272. package/dist/esm/plugins/table/utils/analytics.js +4 -13
  273. package/dist/esm/plugins/table/utils/collapse.js +4 -15
  274. package/dist/esm/plugins/table/utils/column-controls.js +25 -41
  275. package/dist/esm/plugins/table/utils/decoration.js +46 -88
  276. package/dist/esm/plugins/table/utils/dom.js +4 -20
  277. package/dist/esm/plugins/table/utils/nodes.js +5 -18
  278. package/dist/esm/plugins/table/utils/paste.js +24 -29
  279. package/dist/esm/plugins/table/utils/row-controls.js +6 -46
  280. package/dist/esm/plugins/table/utils/selection.js +3 -26
  281. package/dist/esm/plugins/table/utils/table.js +0 -2
  282. package/dist/esm/version.json +1 -1
  283. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +7 -0
  284. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +2 -1
  285. package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
  286. package/package.json +8 -6
  287. package/src/__tests__/integration/__fixtures__/empty-layout.ts +35 -0
  288. package/src/__tests__/integration/__fixtures__/nested-in-expand.ts +129 -0
  289. package/src/__tests__/integration/horizontal-scroll.ts +489 -0
  290. package/src/__tests__/unit/commands/insert.ts +3 -3
  291. package/src/__tests__/unit/keymap.ts +3 -1
  292. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +38 -0
  293. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +5 -2
  294. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
  295. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
  296. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
  297. package/src/__tests__/visual-regression/sticky-header.ts +2 -1
  298. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -3
  299. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +6 -2
  300. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +9 -1
  301. package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +19 -1
  302. package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +57 -5
  303. package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +2 -2
  304. package/src/plugins/table/transforms/column-width.ts +60 -6
  305. package/src/plugins/table/ui/common-styles.ts +5 -2
@@ -1,90 +1,52 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
11
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
14
  var _defineProperty3 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
15
  var _react = _interopRequireDefault(require("react"));
25
-
26
16
  var _classnames2 = _interopRequireDefault(require("classnames"));
27
-
28
17
  var _utils = require("@atlaskit/editor-tables/utils");
29
-
30
18
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
31
-
32
19
  var _styles = require("@atlaskit/editor-common/styles");
33
-
34
20
  var _utils2 = require("@atlaskit/editor-common/utils");
35
-
36
21
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
37
-
38
22
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
39
-
40
23
  var _commands = require("../commands");
41
-
42
24
  var _pluginFactory = require("../pm-plugins/plugin-factory");
43
-
44
25
  var _stickyHeaders = require("../pm-plugins/sticky-headers");
45
-
46
26
  var _tableResizing = require("../pm-plugins/table-resizing");
47
-
48
27
  var _utils3 = require("../pm-plugins/table-resizing/utils");
49
-
50
28
  var _dom = require("../pm-plugins/table-resizing/utils/dom");
51
-
52
29
  var _types = require("../types");
53
-
54
30
  var _TableFloatingControls = _interopRequireDefault(require("../ui/TableFloatingControls"));
55
-
56
31
  var _utils4 = require("../utils");
57
-
58
32
  var _updateOverflowShadows = require("./update-overflow-shadows");
59
-
60
33
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
61
-
62
34
  var _OverflowShadowsObserver = require("./OverflowShadowsObserver");
63
-
35
+ var _misc = require("../pm-plugins/table-resizing/utils/misc");
64
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
65
-
66
37
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty3.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
67
-
68
38
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
69
-
70
39
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
71
-
72
40
  var isIE11 = _utils2.browser.ie_version === 11;
73
-
74
41
  var NOOP = function NOOP() {
75
42
  return undefined;
76
43
  };
77
-
78
44
  var TableComponent = /*#__PURE__*/function (_React$Component) {
79
45
  (0, _inherits2.default)(TableComponent, _React$Component);
80
-
81
46
  var _super = _createSuper(TableComponent);
82
-
83
47
  function TableComponent(props) {
84
48
  var _defineProperty2;
85
-
86
49
  var _this;
87
-
88
50
  (0, _classCallCheck2.default)(this, TableComponent);
89
51
  _this = _super.call(this, props);
90
52
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "state", (_defineProperty2 = {
@@ -96,32 +58,25 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
96
58
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateShadowState", function (shadowKey, value) {
97
59
  if (_this.state[shadowKey] === value) {
98
60
  return;
99
- } // need this check to satisfy types for the setState argument
100
-
101
-
61
+ }
62
+ // need this check to satisfy types for the setState argument
102
63
  if (shadowKey === _types.ShadowEvent.SHOW_BEFORE_SHADOW) {
103
64
  return _this.setState((0, _defineProperty3.default)({}, shadowKey, value));
104
65
  }
105
-
106
66
  _this.setState((0, _defineProperty3.default)({}, shadowKey, value));
107
67
  });
108
68
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "onStickyState", function (state) {
109
69
  var _this$props$getEditor = _this.props.getEditorFeatureFlags(),
110
- tableOverflowShadowsOptimization = _this$props$getEditor.tableOverflowShadowsOptimization;
111
-
70
+ tableOverflowShadowsOptimization = _this$props$getEditor.tableOverflowShadowsOptimization;
112
71
  var pos = _this.props.getPos();
113
-
114
72
  if (!(0, _utils2.isValidPosition)(pos, _this.props.view.state)) {
115
73
  return;
116
74
  }
117
-
118
75
  var stickyHeader = (0, _stickyHeaders.findStickyHeaderForTable)(state, pos);
119
-
120
76
  if (stickyHeader !== _this.state.stickyHeader) {
121
77
  _this.setState({
122
78
  stickyHeader: stickyHeader
123
79
  });
124
-
125
80
  if (tableOverflowShadowsOptimization && _this.overflowShadowsObserver) {
126
81
  _this.overflowShadowsObserver.updateStickyShadows();
127
82
  }
@@ -132,65 +87,58 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
132
87
  var containerWidth = _this.props.containerWidth;
133
88
  var lineLength = containerWidth.lineLength;
134
89
  var marginLeft;
135
-
136
90
  if (tableContainerCssWidth !== 'inherit' && lineLength) {
137
91
  var _containerWidth2 = (0, _utils2.parsePx)(tableContainerCssWidth);
138
-
139
92
  if (_containerWidth2) {
140
93
  marginLeft = (lineLength - _containerWidth2) / 2;
141
94
  }
142
95
  }
143
-
144
96
  return marginLeft;
145
97
  });
146
98
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleScroll", function (event) {
147
99
  if (!_this.wrapper || event.target !== _this.wrapper) {
148
100
  return;
149
101
  }
150
-
151
102
  if (_this.table) {
152
103
  // sync sticky header row to table scroll
153
104
  var headers = _this.table.querySelectorAll('tr[data-header-row]');
154
-
155
105
  for (var i = 0; i < headers.length; i++) {
156
106
  var header = headers[i];
157
107
  header.scrollLeft = _this.wrapper.scrollLeft;
158
108
  header.style.marginRight = '2px';
159
109
  }
160
110
  }
161
-
162
111
  var _this$props$getEditor2 = _this.props.getEditorFeatureFlags(),
163
- tableOverflowShadowsOptimization = _this$props$getEditor2.tableOverflowShadowsOptimization;
164
-
112
+ tableOverflowShadowsOptimization = _this$props$getEditor2.tableOverflowShadowsOptimization;
165
113
  if (!tableOverflowShadowsOptimization) {
166
114
  _this.updateShadows();
167
115
  }
168
116
  });
169
117
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleTableResizing", function () {
170
118
  var _this$props = _this.props,
171
- getNode = _this$props.getNode,
172
- containerWidth = _this$props.containerWidth,
173
- options = _this$props.options;
119
+ getNode = _this$props.getNode,
120
+ containerWidth = _this$props.containerWidth,
121
+ options = _this$props.options;
174
122
  var prevNode = _this.node;
175
123
  var node = getNode();
176
- var prevAttrs = prevNode.attrs; // We only consider a layout change valid if it's done outside of an autoSize.
124
+ var prevAttrs = prevNode.attrs;
177
125
 
126
+ // We only consider a layout change valid if it's done outside of an autoSize.
178
127
  var layoutChanged = prevAttrs.layout !== node.attrs.layout && prevAttrs.__autoSize === node.attrs.__autoSize;
179
-
180
128
  var parentWidth = _this.getParentNodeWidth();
181
-
182
129
  var parentWidthChanged = parentWidth && parentWidth !== _this.state.parentWidth;
183
-
184
130
  var layoutSize = _this.tableNodeLayoutSize(node, containerWidth.width, options);
185
-
186
131
  var hasNumberedColumnChanged = prevAttrs.isNumberColumnEnabled !== node.attrs.isNumberColumnEnabled;
187
132
  var noOfColumnsChanged = (0, _utils4.tablesHaveDifferentNoOfColumns)(node, prevNode);
188
-
189
- if ( // Breakout mode/layout changed
190
- layoutChanged || // We need to react if our parent changes
133
+ if (
134
+ // Breakout mode/layout changed
135
+ layoutChanged ||
136
+ // We need to react if our parent changes
191
137
  // Scales the cols widths relative to the new parent width.
192
- parentWidthChanged || // Enabling / disabling this feature reduces or adds size to the table.
193
- hasNumberedColumnChanged || // This last check is also to cater for dynamic text sizing changing the 'default' layout width
138
+ parentWidthChanged ||
139
+ // Enabling / disabling this feature reduces or adds size to the table.
140
+ hasNumberedColumnChanged ||
141
+ // This last check is also to cater for dynamic text sizing changing the 'default' layout width
194
142
  // Usually happens on window resize.
195
143
  layoutSize !== _this.layoutSize || noOfColumnsChanged) {
196
144
  // If column has been inserted/deleted avoid multi dispatch
@@ -200,37 +148,30 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
200
148
  layoutChanged: layoutChanged
201
149
  });
202
150
  }
203
-
204
151
  _this.updateParentWidth(parentWidth);
205
152
  }
206
-
207
153
  _this.updateTableContainerWidth();
208
-
209
154
  _this.node = node;
210
155
  _this.containerWidth = containerWidth;
211
156
  _this.layoutSize = layoutSize;
212
157
  });
213
158
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "scaleTable", function (scaleOptions) {
214
159
  var _this$props2 = _this.props,
215
- view = _this$props2.view,
216
- getNode = _this$props2.getNode,
217
- getPos = _this$props2.getPos,
218
- containerWidth = _this$props2.containerWidth,
219
- options = _this$props2.options;
160
+ view = _this$props2.view,
161
+ getNode = _this$props2.getNode,
162
+ getPos = _this$props2.getPos,
163
+ containerWidth = _this$props2.containerWidth,
164
+ options = _this$props2.options;
220
165
  var node = getNode();
221
166
  var state = view.state,
222
- dispatch = view.dispatch;
167
+ dispatch = view.dispatch;
223
168
  var pos = getPos();
224
-
225
169
  if (!(0, _utils2.isValidPosition)(pos, state)) {
226
170
  return;
227
171
  }
228
-
229
172
  var domAtPos = view.domAtPos.bind(view);
230
173
  var width = containerWidth.width;
231
-
232
174
  _this.scaleTableDebounced.cancel();
233
-
234
175
  (0, _tableResizing.scaleTable)(_this.table, _objectSpread(_objectSpread({}, scaleOptions), {}, {
235
176
  node: node,
236
177
  prevNode: _this.node || node,
@@ -242,63 +183,58 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
242
183
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleAutoSize", function () {
243
184
  if (_this.table) {
244
185
  var _this$props3 = _this.props,
245
- view = _this$props3.view,
246
- getNode = _this$props3.getNode,
247
- getPos = _this$props3.getPos,
248
- containerWidth = _this$props3.containerWidth;
249
-
186
+ view = _this$props3.view,
187
+ getNode = _this$props3.getNode,
188
+ getPos = _this$props3.getPos,
189
+ containerWidth = _this$props3.containerWidth;
250
190
  var _node = getNode();
251
-
252
191
  var pos = getPos();
253
-
254
192
  if (!(0, _utils2.isValidPosition)(pos, view.state)) {
255
193
  return;
256
194
  }
257
-
258
195
  (0, _commands.autoSizeTable)(view, _node, _this.table, pos, {
259
196
  containerWidth: containerWidth.width
260
197
  });
261
198
  }
262
199
  });
263
200
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResize", function () {
201
+ var _node$attrs, _node$attrs2;
264
202
  var _this$props4 = _this.props,
265
- getNode = _this$props4.getNode,
266
- containerWidth = _this$props4.containerWidth;
267
-
268
- var layoutSize = _this.tableNodeLayoutSize(getNode());
269
-
203
+ getNode = _this$props4.getNode,
204
+ containerWidth = _this$props4.containerWidth;
205
+ var node = getNode();
206
+ var prevNode = _this.node;
207
+ var layoutSize = _this.tableNodeLayoutSize(node);
208
+ var prevAttrs = prevNode === null || prevNode === void 0 ? void 0 : prevNode.attrs;
209
+ var layoutChanged = (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.layout) !== (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.layout) && (prevAttrs === null || prevAttrs === void 0 ? void 0 : prevAttrs.__autoSize) === (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.__autoSize);
270
210
  if (containerWidth.width > layoutSize) {
271
211
  return;
272
212
  }
273
-
274
213
  var parentWidth = _this.getParentNodeWidth();
275
-
276
- _this.scaleTableDebounced(parentWidth);
214
+ _this.scaleTableDebounced({
215
+ layoutChanged: layoutChanged,
216
+ parentWidth: parentWidth
217
+ });
277
218
  });
278
219
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateTableContainerWidth", function () {
279
220
  var _this$props5 = _this.props,
280
- getNode = _this$props5.getNode,
281
- containerWidth = _this$props5.containerWidth,
282
- options = _this$props5.options;
221
+ getNode = _this$props5.getNode,
222
+ containerWidth = _this$props5.containerWidth,
223
+ options = _this$props5.options;
283
224
  var node = getNode();
284
-
285
225
  if (options && options.isBreakoutEnabled === false) {
286
226
  return;
287
227
  }
288
-
289
228
  var tableContainerWidth = (0, _styles.calcTableWidth)(node.attrs.layout, containerWidth.width);
290
-
291
229
  if (_this.state.tableContainerWidth === tableContainerWidth) {
292
230
  return null;
293
231
  }
294
-
295
232
  _this.setState(function (prevState) {
296
233
  if (options && options.isBreakoutEnabled === false && prevState.tableContainerWidth !== 'inherit') {
297
234
  return {
298
235
  tableContainerWidth: 'inherit'
299
236
  };
300
237
  }
301
-
302
238
  return {
303
239
  tableContainerWidth: tableContainerWidth
304
240
  };
@@ -306,17 +242,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
306
242
  });
307
243
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "getParentNodeWidth", function () {
308
244
  var _this$props6 = _this.props,
309
- getPos = _this$props6.getPos,
310
- containerWidth = _this$props6.containerWidth,
311
- options = _this$props6.options,
312
- state = _this$props6.view.state;
245
+ getPos = _this$props6.getPos,
246
+ containerWidth = _this$props6.containerWidth,
247
+ options = _this$props6.options,
248
+ state = _this$props6.view.state;
313
249
  var pos = getPos();
314
-
315
250
  if (!(0, _utils2.isValidPosition)(pos, state)) {
316
251
  return;
317
252
  }
318
-
319
- return (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
253
+ var parentNodeWith = (0, _nodeWidth.getParentNodeWidth)(pos, state, containerWidth, options && options.isFullWidthModeEnabled);
254
+ return (0, _misc.getParentWidthWithoutPadding)(parentNodeWith, pos, state);
320
255
  });
321
256
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "updateParentWidth", function (width) {
322
257
  _this.setState({
@@ -332,18 +267,20 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
332
267
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleAutoSizeDebounced", (0, _rafSchd.default)(_this.handleAutoSize));
333
268
  (0, _defineProperty3.default)((0, _assertThisInitialized2.default)(_this), "handleWindowResizeDebounced", (0, _rafSchd.default)(_this.handleWindowResize));
334
269
  var _options = props.options,
335
- _containerWidth = props.containerWidth,
336
- _getNode = props.getNode,
337
- getEditorFeatureFlags = props.getEditorFeatureFlags;
270
+ _containerWidth = props.containerWidth,
271
+ _getNode = props.getNode,
272
+ getEditorFeatureFlags = props.getEditorFeatureFlags;
338
273
  _this.node = _getNode();
339
- _this.containerWidth = _containerWidth; // store table size using previous full-width mode so can detect if it has changed
274
+ _this.containerWidth = _containerWidth;
340
275
 
276
+ // store table size using previous full-width mode so can detect if it has changed
341
277
  var isFullWidthModeEnabled = _options ? _options.wasFullWidthModeEnabled : false;
342
278
  _this.layoutSize = _this.tableNodeLayoutSize(_this.node, _containerWidth.width, {
343
279
  isFullWidthModeEnabled: isFullWidthModeEnabled
344
- }); // Disable inline table editing and resizing controls in Firefox
345
- // https://github.com/ProseMirror/prosemirror/issues/432
280
+ });
346
281
 
282
+ // Disable inline table editing and resizing controls in Firefox
283
+ // https://github.com/ProseMirror/prosemirror/issues/432
347
284
  if ('execCommand' in document) {
348
285
  ['enableObjectResizing', 'enableInlineTableEditing'].forEach(function (cmd) {
349
286
  if (document.queryCommandSupported(cmd)) {
@@ -351,10 +288,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
351
288
  }
352
289
  });
353
290
  }
354
-
355
291
  var _getEditorFeatureFlag = getEditorFeatureFlags(),
356
- initialRenderOptimization = _getEditorFeatureFlag.initialRenderOptimization;
357
-
292
+ initialRenderOptimization = _getEditorFeatureFlag.initialRenderOptimization;
358
293
  if (!initialRenderOptimization) {
359
294
  // @see ED-7945
360
295
  requestAnimationFrame(function () {
@@ -363,21 +298,17 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
363
298
  });
364
299
  });
365
300
  }
366
-
367
301
  return _this;
368
302
  }
369
-
370
303
  (0, _createClass2.default)(TableComponent, [{
371
304
  key: "componentDidMount",
372
305
  value: function componentDidMount() {
373
306
  var _this$props7 = this.props,
374
- allowColumnResizing = _this$props7.allowColumnResizing,
375
- eventDispatcher = _this$props7.eventDispatcher;
376
-
307
+ allowColumnResizing = _this$props7.allowColumnResizing,
308
+ eventDispatcher = _this$props7.eventDispatcher;
377
309
  if (allowColumnResizing && this.wrapper && !isIE11) {
378
310
  this.wrapper.addEventListener('scroll', this.handleScrollDebounced);
379
311
  }
380
-
381
312
  if (allowColumnResizing) {
382
313
  /**
383
314
  * We no longer use `containerWidth` as a variable to determine an update for table resizing (avoids unnecessary updates).
@@ -387,13 +318,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
387
318
  this.updateTableContainerWidth();
388
319
  this.handleTableResizingDebounced();
389
320
  }
390
-
391
321
  var currentStickyState = _stickyHeaders.pluginKey.getState(this.props.view.state);
392
-
393
322
  if (currentStickyState) {
394
323
  this.onStickyState(currentStickyState);
395
324
  }
396
-
397
325
  eventDispatcher.on(_stickyHeaders.pluginKey.key, this.onStickyState);
398
326
  }
399
327
  }, {
@@ -402,78 +330,63 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
402
330
  if (this.wrapper && !isIE11) {
403
331
  this.wrapper.removeEventListener('scroll', this.handleScrollDebounced);
404
332
  }
405
-
406
333
  this.handleScrollDebounced.cancel();
407
334
  this.scaleTableDebounced.cancel();
408
335
  this.handleTableResizingDebounced.cancel();
409
336
  this.handleAutoSizeDebounced.cancel();
410
337
  this.handleWindowResizeDebounced.cancel();
411
-
412
338
  if (this.props.allowColumnResizing) {
413
339
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
414
340
  }
415
-
416
341
  if (this.overflowShadowsObserver) {
417
342
  this.overflowShadowsObserver.dispose();
418
343
  }
419
-
420
344
  this.props.eventDispatcher.off(_stickyHeaders.pluginKey.key, this.onStickyState);
421
345
  }
422
346
  }, {
423
347
  key: "componentDidUpdate",
424
348
  value: function componentDidUpdate(prevProps) {
425
349
  var _this$props8 = this.props,
426
- view = _this$props8.view,
427
- getNode = _this$props8.getNode,
428
- isMediaFullscreen = _this$props8.isMediaFullscreen,
429
- allowColumnResizing = _this$props8.allowColumnResizing;
430
-
350
+ view = _this$props8.view,
351
+ getNode = _this$props8.getNode,
352
+ isMediaFullscreen = _this$props8.isMediaFullscreen,
353
+ allowColumnResizing = _this$props8.allowColumnResizing;
431
354
  var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
432
- isInDanger = _getPluginState.isInDanger;
433
-
355
+ isInDanger = _getPluginState.isInDanger;
434
356
  var table = (0, _utils.findTable)(view.state.selection);
435
-
436
357
  if (isInDanger && !table) {
437
358
  (0, _commands.clearHoverSelection)()(view.state, view.dispatch);
438
359
  }
439
-
440
360
  var _this$props$getEditor3 = this.props.getEditorFeatureFlags(),
441
- tableOverflowShadowsOptimization = _this$props$getEditor3.tableOverflowShadowsOptimization;
442
-
361
+ tableOverflowShadowsOptimization = _this$props$getEditor3.tableOverflowShadowsOptimization;
443
362
  if (!tableOverflowShadowsOptimization) {
444
363
  this.updateShadows();
445
364
  } else {
446
365
  var _this$wrapper;
447
-
448
366
  if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
449
367
  this.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
450
368
  }
451
-
452
369
  if (this.overflowShadowsObserver) {
453
370
  var _this$state$stickyHea;
454
-
455
371
  this.overflowShadowsObserver.observeCells((_this$state$stickyHea = this.state.stickyHeader) === null || _this$state$stickyHea === void 0 ? void 0 : _this$state$stickyHea.sticky, (0, _utils4.containsHeaderRow)(getNode()));
456
372
  }
457
373
  }
458
-
459
374
  var currentTable = getNode();
460
-
461
375
  if (currentTable.attrs.__autoSize) {
462
376
  // Wait for next tick to handle auto sizing, gives the browser time to do layout calc etc.
463
377
  this.handleAutoSizeDebounced();
464
- } // re-drawing will cause media component get unmounted that will exit fullscreen mode if media is in fullscreen mode
378
+ }
379
+ // re-drawing will cause media component get unmounted that will exit fullscreen mode if media is in fullscreen mode
465
380
  // see https://product-fabric.atlassian.net/browse/MEX-1290
466
381
  else if (allowColumnResizing && this.table && !isMediaFullscreen) {
467
382
  // If col widths (e.g. via collab) or number of columns (e.g. delete a column) have changed,
468
383
  // re-draw colgroup.
469
384
  var previousTable = this.node;
470
-
471
385
  if ((0, _utils4.tablesHaveDifferentColumnWidths)(currentTable, previousTable) || (0, _utils4.tablesHaveDifferentNoOfColumns)(currentTable, previousTable)) {
472
386
  var _view = this.props.view;
473
387
  (0, _utils3.insertColgroupFromNode)(this.table, currentTable);
474
388
  (0, _dom.updateControls)(this.props.getEditorFeatureFlags)(_view.state);
475
389
  }
476
-
477
390
  this.handleTableResizingDebounced();
478
391
  }
479
392
  }
@@ -481,9 +394,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
481
394
  key: "updateShadows",
482
395
  value: function updateShadows() {
483
396
  var _this$wrapper2;
484
-
485
397
  var parent = (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : _this$wrapper2.parentElement;
486
-
487
398
  if (this.wrapper && parent) {
488
399
  var rightShadows = parent.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_RIGHT_SHADOW));
489
400
  var leftShadows = parent.querySelectorAll(".".concat(_types.TableCssClassName.TABLE_LEFT_SHADOW));
@@ -494,43 +405,40 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
494
405
  key: "render",
495
406
  value: function render() {
496
407
  var _classnames,
497
- _this2 = this;
498
-
408
+ _this2 = this;
499
409
  var _this$props9 = this.props,
500
- view = _this$props9.view,
501
- getNode = _this$props9.getNode,
502
- tableResizingPluginState = _this$props9.tableResizingPluginState,
503
- _this$props9$allowCon = _this$props9.allowControls,
504
- allowControls = _this$props9$allowCon === void 0 ? true : _this$props9$allowCon,
505
- isHeaderRowEnabled = _this$props9.isHeaderRowEnabled,
506
- ordering = _this$props9.ordering,
507
- isHeaderColumnEnabled = _this$props9.isHeaderColumnEnabled,
508
- tableActive = _this$props9.tableActive,
509
- containerWidth = _this$props9.containerWidth;
410
+ view = _this$props9.view,
411
+ getNode = _this$props9.getNode,
412
+ tableResizingPluginState = _this$props9.tableResizingPluginState,
413
+ _this$props9$allowCon = _this$props9.allowControls,
414
+ allowControls = _this$props9$allowCon === void 0 ? true : _this$props9$allowCon,
415
+ isHeaderRowEnabled = _this$props9.isHeaderRowEnabled,
416
+ ordering = _this$props9.ordering,
417
+ isHeaderColumnEnabled = _this$props9.isHeaderColumnEnabled,
418
+ tableActive = _this$props9.tableActive,
419
+ containerWidth = _this$props9.containerWidth;
510
420
  var _this$state = this.state,
511
- isLoading = _this$state.isLoading,
512
- tableContainerWidth = _this$state.tableContainerWidth,
513
- showBeforeShadow = _this$state.showBeforeShadow,
514
- showAfterShadow = _this$state.showAfterShadow;
515
- var node = getNode(); // doesn't work well with WithPluginState
516
-
421
+ isLoading = _this$state.isLoading,
422
+ tableContainerWidth = _this$state.tableContainerWidth,
423
+ showBeforeShadow = _this$state.showBeforeShadow,
424
+ showAfterShadow = _this$state.showAfterShadow;
425
+ var node = getNode();
426
+ // doesn't work well with WithPluginState
517
427
  var _getPluginState2 = (0, _pluginFactory.getPluginState)(view.state),
518
- isInDanger = _getPluginState2.isInDanger,
519
- hoveredRows = _getPluginState2.hoveredRows;
520
-
428
+ isInDanger = _getPluginState2.isInDanger,
429
+ hoveredRows = _getPluginState2.hoveredRows;
521
430
  var _this$props$getEditor4 = this.props.getEditorFeatureFlags(),
522
- stickyHeadersOptimization = _this$props$getEditor4.stickyHeadersOptimization,
523
- initialRenderOptimization = _this$props$getEditor4.initialRenderOptimization,
524
- tableRenderOptimization = _this$props$getEditor4.tableRenderOptimization,
525
- tableOverflowShadowsOptimization = _this$props$getEditor4.tableOverflowShadowsOptimization;
526
-
431
+ stickyHeadersOptimization = _this$props$getEditor4.stickyHeadersOptimization,
432
+ initialRenderOptimization = _this$props$getEditor4.initialRenderOptimization,
433
+ tableRenderOptimization = _this$props$getEditor4.tableRenderOptimization,
434
+ tableOverflowShadowsOptimization = _this$props$getEditor4.tableOverflowShadowsOptimization;
527
435
  var tableRef = this.table || undefined;
528
436
  var isResizing = !!tableResizingPluginState && !!tableResizingPluginState.dragging;
529
- var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined; //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
437
+ var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
530
438
 
439
+ //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
531
440
  var tableHeight = tableRef && !tableRenderOptimization ? tableRef.offsetHeight : undefined;
532
441
  var hasHeaderRow = (0, _utils4.containsHeaderRow)(node);
533
-
534
442
  var rowControls = /*#__PURE__*/_react.default.createElement("div", {
535
443
  className: _types.TableCssClassName.ROW_CONTROLS_WRAPPER
536
444
  }, /*#__PURE__*/_react.default.createElement(_TableFloatingControls.default, {
@@ -544,7 +452,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
544
452
  isHeaderRowEnabled: isHeaderRowEnabled,
545
453
  ordering: ordering,
546
454
  isHeaderColumnEnabled: isHeaderColumnEnabled,
547
- hasHeaderRow: hasHeaderRow // pass `selection` and `tableHeight` to control re-render
455
+ hasHeaderRow: hasHeaderRow
456
+ // pass `selection` and `tableHeight` to control re-render
548
457
  ,
549
458
  selection: view.state.selection,
550
459
  tableHeight: tableHeight,
@@ -552,7 +461,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
552
461
  stickyHeader: this.state.stickyHeader,
553
462
  getEditorFeatureFlags: this.props.getEditorFeatureFlags
554
463
  }));
555
-
556
464
  var shadowPadding = allowControls && (!isLoading || initialRenderOptimization) && tableActive ? -_editorSharedStyles.akEditorTableToolbarSize : _styles.tableMarginSides;
557
465
  var shadowStyle = tableOverflowShadowsOptimization ? (0, _memoizeOne.default)(function (visible) {
558
466
  return {
@@ -583,12 +491,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
583
491
  className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
584
492
  ref: function ref(elem) {
585
493
  _this2.wrapper = elem;
586
-
587
494
  if (elem) {
588
495
  _this2.props.contentDOM(elem);
589
-
590
496
  var tableElement = elem.querySelector('table');
591
-
592
497
  if (tableElement !== _this2.table) {
593
498
  _this2.table = tableElement;
594
499
  }
@@ -616,7 +521,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
616
521
  }]);
617
522
  return TableComponent;
618
523
  }(_react.default.Component);
619
-
620
524
  (0, _defineProperty3.default)(TableComponent, "displayName", 'TableComponent');
621
525
  var _default = TableComponent;
622
526
  exports.default = _default;