@atlaskit/editor-plugin-table 1.1.0 → 1.1.2

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 (284) hide show
  1. package/CHANGELOG.md +12 -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 +82 -188
  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 +12 -42
  46. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -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 +0 -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 +15 -36
  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 +15 -71
  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 +12 -45
  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 +6 -19
  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 +27 -100
  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 +7 -15
  144. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -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 +0 -4
  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 +10 -18
  153. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
  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 +16 -28
  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 +6 -5
  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 +82 -181
  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 +12 -24
  230. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -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 +0 -4
  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 +15 -23
  239. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
  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 +12 -32
  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 +6 -7
  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/package.json +2 -2
  284. package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
@@ -1,42 +1,29 @@
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.updateDecorations = exports.findControlsHoverDecoration = exports.findColumnControlSelectedDecoration = exports.createResizeHandleDecoration = exports.createControlsHoverDecoration = exports.createColumnSelectedDecoration = exports.createColumnLineResize = exports.createColumnControlsDecoration = exports.createCellHoverDecoration = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _tableMap = require("@atlaskit/editor-tables/table-map");
13
-
14
10
  var _utils = require("@atlaskit/editor-tables/utils");
15
-
16
11
  var _prosemirrorView = require("prosemirror-view");
17
-
18
12
  var _utils2 = require("@atlaskit/editor-common/utils");
19
-
20
13
  var _types = require("../types");
21
-
22
14
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
23
15
  return decorationSet.find(undefined, undefined, function (spec) {
24
16
  return spec.key.indexOf(key) > -1;
25
17
  });
26
18
  };
27
-
28
19
  var findColumnControlSelectedDecoration = function findColumnControlSelectedDecoration(decorationSet) {
29
20
  return filterDecorationByKey(_types.TableDecorations.COLUMN_SELECTED, decorationSet);
30
21
  };
31
-
32
22
  exports.findColumnControlSelectedDecoration = findColumnControlSelectedDecoration;
33
-
34
23
  var findControlsHoverDecoration = function findControlsHoverDecoration(decorationSet) {
35
24
  return filterDecorationByKey(_types.TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
36
25
  };
37
-
38
26
  exports.findControlsHoverDecoration = findControlsHoverDecoration;
39
-
40
27
  var createCellHoverDecoration = function createCellHoverDecoration(cells, type) {
41
28
  return cells.map(function (cell) {
42
29
  return _prosemirrorView.Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
@@ -46,44 +33,36 @@ var createCellHoverDecoration = function createCellHoverDecoration(cells, type)
46
33
  });
47
34
  });
48
35
  };
49
-
50
36
  exports.createCellHoverDecoration = createCellHoverDecoration;
51
-
52
37
  var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, danger, selected) {
53
38
  var table = (0, _utils.findTable)(tr.selection);
54
-
55
39
  if (!table) {
56
40
  return [];
57
41
  }
58
-
59
42
  var map = _tableMap.TableMap.get(table.node);
60
-
61
43
  var _cells$reduce = cells.reduce(function (_ref, cell) {
62
- var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
44
+ var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
63
45
  min = _ref2[0],
64
46
  max = _ref2[1];
65
-
66
- if (min === null || cell.pos < min) {
67
- min = cell.pos;
68
- }
69
-
70
- if (max === null || cell.pos > max) {
71
- max = cell.pos;
72
- }
73
-
74
- return [min, max];
75
- }, [null, null]),
76
- _cells$reduce2 = (0, _slicedToArray2.default)(_cells$reduce, 2),
77
- min = _cells$reduce2[0],
78
- max = _cells$reduce2[1];
79
-
47
+ if (min === null || cell.pos < min) {
48
+ min = cell.pos;
49
+ }
50
+ if (max === null || cell.pos > max) {
51
+ max = cell.pos;
52
+ }
53
+ return [min, max];
54
+ }, [null, null]),
55
+ _cells$reduce2 = (0, _slicedToArray2.default)(_cells$reduce, 2),
56
+ min = _cells$reduce2[0],
57
+ max = _cells$reduce2[1];
80
58
  if (min === null || max === null) {
81
59
  return [];
82
60
  }
83
-
84
61
  var updatedCells = cells.map(function (x) {
85
62
  return x.pos;
86
- }); // ED-15246 fixed trello card table overflow issue
63
+ });
64
+
65
+ // ED-15246 fixed trello card table overflow issue
87
66
  // If columns / rows have been merged the hovered selection is different to the actual selection
88
67
  // So If the table cells are in danger we want to create a "rectangle" selection
89
68
  // to match the "clicked" selection
@@ -92,68 +71,59 @@ var createControlsHoverDecoration = function createControlsHoverDecoration(cells
92
71
  // Find the bounding rectangle of all the given cells, also considering
93
72
  // merged cells.
94
73
  var _cells$reduce3 = cells.reduce(function (acc, cell) {
95
- var _map$findCell = map.findCell(cell.pos - table.start),
74
+ var _map$findCell = map.findCell(cell.pos - table.start),
96
75
  left = _map$findCell.left,
97
76
  right = _map$findCell.right,
98
77
  bottom = _map$findCell.bottom,
99
- top = _map$findCell.top; // Finding the bounding rect requires finding the min left and top positions,
100
- // and the max right and bottom positions of the cells
101
-
102
-
103
- return {
104
- recLeft: Math.min(acc.recLeft, left),
105
- recTop: Math.min(acc.recTop, top),
106
- recRight: Math.max(acc.recRight, right),
107
- recBottom: Math.max(acc.recBottom, bottom)
108
- };
109
- }, // +-Infinity as initialisation vars which will always be overwritten
110
- // by smaller/larger values respectively
111
- {
112
- recLeft: Infinity,
113
- recTop: Infinity,
114
- recRight: -Infinity,
115
- recBottom: -Infinity
116
- }),
117
- recLeft = _cells$reduce3.recLeft,
118
- recTop = _cells$reduce3.recTop,
119
- recRight = _cells$reduce3.recRight,
120
- recBottom = _cells$reduce3.recBottom;
121
-
78
+ top = _map$findCell.top;
79
+ // Finding the bounding rect requires finding the min left and top positions,
80
+ // and the max right and bottom positions of the cells
81
+ return {
82
+ recLeft: Math.min(acc.recLeft, left),
83
+ recTop: Math.min(acc.recTop, top),
84
+ recRight: Math.max(acc.recRight, right),
85
+ recBottom: Math.max(acc.recBottom, bottom)
86
+ };
87
+ },
88
+ // +-Infinity as initialisation vars which will always be overwritten
89
+ // by smaller/larger values respectively
90
+ {
91
+ recLeft: Infinity,
92
+ recTop: Infinity,
93
+ recRight: -Infinity,
94
+ recBottom: -Infinity
95
+ }),
96
+ recLeft = _cells$reduce3.recLeft,
97
+ recTop = _cells$reduce3.recTop,
98
+ recRight = _cells$reduce3.recRight,
99
+ recBottom = _cells$reduce3.recBottom;
122
100
  var rect = new _tableMap.Rect(recLeft, recTop, recRight, recBottom);
123
101
  updatedCells = map.cellsInRect(rect).map(function (x) {
124
102
  return x + table.start;
125
103
  });
126
104
  }
127
-
128
105
  return updatedCells.map(function (pos) {
129
106
  var cell = tr.doc.nodeAt(pos);
130
107
  var classes = [_types.TableCssClassName.HOVERED_CELL];
131
-
132
108
  if (danger) {
133
109
  classes.push(_types.TableCssClassName.HOVERED_CELL_IN_DANGER);
134
110
  }
135
-
136
111
  if (selected) {
137
112
  classes.push(_types.TableCssClassName.SELECTED_CELL);
138
113
  }
139
-
140
114
  classes.push(type === 'column' ? _types.TableCssClassName.HOVERED_COLUMN : type === 'row' ? _types.TableCssClassName.HOVERED_ROW : _types.TableCssClassName.HOVERED_TABLE);
141
115
  var key;
142
-
143
116
  switch (type) {
144
117
  case 'row':
145
118
  key = _types.TableDecorations.ROW_CONTROLS_HOVER;
146
119
  break;
147
-
148
120
  case 'column':
149
121
  key = _types.TableDecorations.COLUMN_CONTROLS_HOVER;
150
122
  break;
151
-
152
123
  default:
153
124
  key = _types.TableDecorations.TABLE_CONTROLS_HOVER;
154
125
  break;
155
126
  }
156
-
157
127
  return _prosemirrorView.Decoration.node(pos, pos + cell.nodeSize, {
158
128
  class: classes.join(' ')
159
129
  }, {
@@ -161,21 +131,16 @@ var createControlsHoverDecoration = function createControlsHoverDecoration(cells
161
131
  });
162
132
  });
163
133
  };
164
-
165
134
  exports.createControlsHoverDecoration = createControlsHoverDecoration;
166
-
167
135
  var createColumnSelectedDecoration = function createColumnSelectedDecoration(tr) {
168
136
  var selection = tr.selection,
169
- doc = tr.doc;
137
+ doc = tr.doc;
170
138
  var table = (0, _utils.findTable)(selection);
171
139
  var rect = (0, _utils.getSelectionRect)(selection);
172
-
173
140
  if (!table || !rect) {
174
141
  return [];
175
142
  }
176
-
177
143
  var map = _tableMap.TableMap.get(table.node);
178
-
179
144
  var cellPositions = map.cellsInRect(rect);
180
145
  return cellPositions.map(function (pos, index) {
181
146
  var cell = doc.nodeAt(pos + table.start);
@@ -186,19 +151,18 @@ var createColumnSelectedDecoration = function createColumnSelectedDecoration(tr)
186
151
  });
187
152
  });
188
153
  };
189
-
190
154
  exports.createColumnSelectedDecoration = createColumnSelectedDecoration;
191
-
192
155
  var createColumnControlsDecoration = function createColumnControlsDecoration(selection) {
193
156
  var cells = (0, _utils.getCellsInRow)(0)(selection) || [];
194
157
  var index = 0;
195
158
  return cells.map(function (cell) {
196
- var colspan = cell.node.attrs.colspan || 1; // It's important these values are scoped locally as the widget callback could be executed anytime in the future
159
+ var colspan = cell.node.attrs.colspan || 1;
160
+ // It's important these values are scoped locally as the widget callback could be executed anytime in the future
197
161
  // and we want to avoid value leak
198
-
199
162
  var startIndex = index;
200
- var endIndex = startIndex + colspan; // The next cell start index will commence from the current cell end index.
163
+ var endIndex = startIndex + colspan;
201
164
 
165
+ // The next cell start index will commence from the current cell end index.
202
166
  index = endIndex;
203
167
  return _prosemirrorView.Decoration.widget(cell.pos + 1, function () {
204
168
  var element = document.createElement('div');
@@ -213,20 +177,17 @@ var createColumnControlsDecoration = function createColumnControlsDecoration(sel
213
177
  });
214
178
  });
215
179
  };
216
-
217
180
  exports.createColumnControlsDecoration = createColumnControlsDecoration;
218
-
219
181
  var updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
220
182
  var filteredDecorations = filterDecorationByKey(key, decorationSet);
221
183
  var decorationSetFiltered = decorationSet.remove(filteredDecorations);
222
184
  return decorationSetFiltered.add(node, decorations);
223
185
  };
224
-
225
186
  exports.updateDecorations = updateDecorations;
226
-
227
187
  var makeArray = function makeArray(n) {
228
188
  return Array.from(Array(n).keys());
229
189
  };
190
+
230
191
  /*
231
192
  * This function will create two specific decorations for each cell in a column index target,
232
193
  * for example given that table:
@@ -306,22 +267,16 @@ var makeArray = function makeArray(n) {
306
267
  * we will add a new class on the last item for each cell,
307
268
  * hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
308
269
  */
309
-
310
-
311
270
  var createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
312
271
  var emptyResult = [[], []];
313
272
  var table = (0, _utils.findTable)(tr.selection);
314
-
315
273
  if (!table || !table.node) {
316
274
  return emptyResult;
317
275
  }
318
-
319
276
  var map = _tableMap.TableMap.get(table.node);
320
-
321
277
  if (!map.width) {
322
278
  return emptyResult;
323
279
  }
324
-
325
280
  var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) {
326
281
  var position = cellPos + cellNode.nodeSize - 1;
327
282
  return _prosemirrorView.Decoration.widget(position, function () {
@@ -334,7 +289,6 @@ var createResizeHandleDecoration = function createResizeHandleDecoration(tr, row
334
289
  key: "".concat(_types.TableDecorations.COLUMN_RESIZING_HANDLE, "_").concat(rowIndex, "_").concat(columnIndex)
335
290
  });
336
291
  };
337
-
338
292
  var createLastCellElementDecoration = function createLastCellElementDecoration(cellColumnPositioning, cellPos, cellNode) {
339
293
  var lastItemPositions;
340
294
  cellNode.forEach(function (childNode, offset, index) {
@@ -346,51 +300,39 @@ var createResizeHandleDecoration = function createResizeHandleDecoration(tr, row
346
300
  };
347
301
  }
348
302
  });
349
-
350
303
  if (!lastItemPositions) {
351
304
  return null;
352
305
  }
353
-
354
306
  return _prosemirrorView.Decoration.node(lastItemPositions.from, lastItemPositions.to, {
355
307
  class: _types.TableCssClassName.LAST_ITEM_IN_CELL
356
308
  }, {
357
309
  key: "".concat(_types.TableDecorations.LAST_CELL_ELEMENT, "_").concat(cellColumnPositioning.left, "_").concat(cellColumnPositioning.right)
358
310
  });
359
311
  };
360
-
361
312
  var resizeHandleCellDecorations = [];
362
313
  var lastCellElementsDecorations = [];
363
-
364
314
  for (var rowIndex = 0; rowIndex < map.height; rowIndex++) {
365
315
  var seen = {};
366
-
367
316
  if (rowIndex !== rowIndexTarget) {
368
317
  continue;
369
318
  }
370
-
371
319
  for (var columnIndex = 0; columnIndex < map.width; columnIndex++) {
372
320
  var cellPosition = map.map[map.width * rowIndex + columnIndex];
373
-
374
321
  if (seen[cellPosition]) {
375
322
  continue;
376
323
  }
377
-
378
324
  seen[cellPosition] = true;
379
325
  var cellPos = table.start + cellPosition;
380
326
  var cell = tr.doc.nodeAt(cellPos);
381
-
382
327
  if (!cell) {
383
328
  continue;
384
329
  }
385
-
386
330
  var colspan = cell.attrs.colspan || 1;
387
331
  var startIndex = columnIndex;
388
332
  var endIndex = colspan + startIndex;
389
-
390
333
  if (endIndex !== columnEndIndexTarget.right) {
391
334
  continue;
392
335
  }
393
-
394
336
  var resizerHandleDec = createResizerHandleDecoration({
395
337
  left: startIndex,
396
338
  right: endIndex
@@ -403,9 +345,9 @@ var createResizeHandleDecoration = function createResizeHandleDecoration(tr, row
403
345
  lastCellElementsDecorations.push(lastCellDec);
404
346
  }
405
347
  }
406
-
407
348
  return [resizeHandleCellDecorations, lastCellElementsDecorations.filter(_utils2.nonNullable)];
408
349
  };
350
+
409
351
  /*
410
352
  * This function will create a decoration for each cell using the right position on the CellColumnPositioning
411
353
  * for example given that table:
@@ -448,27 +390,18 @@ var createResizeHandleDecoration = function createResizeHandleDecoration(tr, row
448
390
  * this function will return two decorations applying a new class `ClassName.WITH_RESIZE_LINE`
449
391
  * only on the cells: `C1` and `D1`.
450
392
  */
451
-
452
-
453
393
  exports.createResizeHandleDecoration = createResizeHandleDecoration;
454
-
455
394
  var createColumnLineResize = function createColumnLineResize(selection, cellColumnPositioning) {
456
395
  var table = (0, _utils.findTable)(selection);
457
-
458
396
  if (!table || cellColumnPositioning.right === null) {
459
397
  return [];
460
398
  }
461
-
462
399
  var columnIndex = cellColumnPositioning.right;
463
-
464
400
  var map = _tableMap.TableMap.get(table.node);
465
-
466
401
  var isLastColumn = columnIndex === map.width;
467
-
468
402
  if (isLastColumn) {
469
403
  columnIndex -= 1;
470
404
  }
471
-
472
405
  var decorationClassName = isLastColumn ? _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN : _types.TableCssClassName.WITH_RESIZE_LINE;
473
406
  var cellPositions = makeArray(map.height).map(function (rowIndex) {
474
407
  return map.map[map.width * rowIndex + columnIndex];
@@ -480,6 +413,7 @@ var createColumnLineResize = function createColumnLineResize(selection, cellColu
480
413
  var nextPosition = map.map[map.width * rowIndex + columnIndex - 1];
481
414
  return cellPosition !== nextPosition; // Removed it if next position is merged
482
415
  });
416
+
483
417
  var cells = cellPositions.map(function (pos) {
484
418
  return {
485
419
  pos: pos + table.start,
@@ -490,7 +424,6 @@ var createColumnLineResize = function createColumnLineResize(selection, cellColu
490
424
  if (!cell || !cell.node) {
491
425
  return;
492
426
  }
493
-
494
427
  return _prosemirrorView.Decoration.node(cell.pos, cell.pos + cell.node.nodeSize, {
495
428
  class: decorationClassName
496
429
  }, {
@@ -498,5 +431,4 @@ var createColumnLineResize = function createColumnLineResize(selection, cellColu
498
431
  });
499
432
  }).filter(_utils2.nonNullable);
500
433
  };
501
-
502
434
  exports.createColumnLineResize = createColumnLineResize;
@@ -4,66 +4,46 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
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;
7
-
8
7
  var _utils = require("@atlaskit/editor-common/utils");
9
-
10
8
  var _types = require("../types");
11
-
12
9
  var _consts = require("../ui/consts");
13
-
14
10
  var SELECTOR_TABLE_LEAFS = ".".concat(_types.TableCssClassName.TABLE_CELL, ", .").concat(_types.TableCssClassName.TABLE_HEADER_CELL);
15
-
16
11
  var isCell = function isCell(node) {
17
12
  return Boolean(node && (['TH', 'TD'].indexOf(node.tagName) > -1 || !!(0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.TABLE_HEADER_CELL)) || !!(0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.TABLE_CELL))));
18
13
  };
19
-
20
14
  exports.isCell = isCell;
21
-
22
15
  var isCornerButton = function isCornerButton(node) {
23
16
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.CONTROLS_CORNER_BUTTON);
24
17
  };
25
-
26
18
  exports.isCornerButton = isCornerButton;
27
-
28
19
  var isInsertRowButton = function isInsertRowButton(node) {
29
20
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.CONTROLS_INSERT_ROW) || (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.CONTROLS_INSERT_ROW)) || (0, _utils.containsClassName)(node, _types.TableCssClassName.CONTROLS_BUTTON_OVERLAY) && (0, _utils.closestElement)(node, ".".concat(_types.TableCssClassName.ROW_CONTROLS));
30
21
  };
31
-
32
22
  exports.isInsertRowButton = isInsertRowButton;
33
-
34
23
  var getColumnOrRowIndex = function getColumnOrRowIndex(target) {
35
24
  return [parseInt(target.getAttribute('data-start-index') || '-1', 10), parseInt(target.getAttribute('data-end-index') || '-1', 10)];
36
25
  };
37
-
38
26
  exports.getColumnOrRowIndex = getColumnOrRowIndex;
39
-
40
27
  var isColumnControlsDecorations = function isColumnControlsDecorations(node) {
41
28
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
42
29
  };
43
-
44
30
  exports.isColumnControlsDecorations = isColumnControlsDecorations;
45
-
46
31
  var isRowControlsButton = function isRowControlsButton(node) {
47
32
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_BUTTON) || (0, _utils.containsClassName)(node, _types.TableCssClassName.NUMBERED_COLUMN_BUTTON);
48
33
  };
49
-
50
34
  exports.isRowControlsButton = isRowControlsButton;
51
-
52
35
  var isResizeHandleDecoration = function isResizeHandleDecoration(node) {
53
36
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.RESIZE_HANDLE_DECORATION);
54
37
  };
55
-
56
38
  exports.isResizeHandleDecoration = isResizeHandleDecoration;
57
-
58
39
  var isTableControlsButton = function isTableControlsButton(node) {
59
40
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.CONTROLS_BUTTON) || (0, _utils.containsClassName)(node, _types.TableCssClassName.ROW_CONTROLS_BUTTON_WRAP);
60
41
  };
61
-
62
42
  exports.isTableControlsButton = isTableControlsButton;
63
-
64
43
  var isTableContainerOrWrapper = function isTableContainerOrWrapper(node) {
65
44
  return (0, _utils.containsClassName)(node, _types.TableCssClassName.TABLE_CONTAINER) || (0, _utils.containsClassName)(node, _types.TableCssClassName.TABLE_NODE_WRAPPER);
66
45
  };
46
+
67
47
  /*
68
48
  * This function returns which side of a given element the mouse cursor is,
69
49
  * using as a base the half of the width by default, for example:
@@ -117,20 +97,14 @@ var isTableContainerOrWrapper = function isTableContainerOrWrapper(node) {
117
97
  *
118
98
  * the same is valid to the right side.
119
99
  */
120
-
121
-
122
100
  exports.isTableContainerOrWrapper = isTableContainerOrWrapper;
123
-
124
101
  var getMousePositionHorizontalRelativeByElement = function getMousePositionHorizontalRelativeByElement(mouseEvent, mouseMoveOptimization, elementContentRects, gapInPixels) {
125
102
  var element = mouseEvent.target;
126
-
127
103
  if (element instanceof HTMLElement) {
128
104
  var width, x;
129
105
  var closestCell = element.closest(SELECTOR_TABLE_LEAFS);
130
-
131
106
  if (mouseMoveOptimization) {
132
107
  var _closestCell$id, _elementContentRects$, _elementContentRects$2;
133
-
134
108
  var id = (_closestCell$id = closestCell === null || closestCell === void 0 ? void 0 : closestCell.id) !== null && _closestCell$id !== void 0 ? _closestCell$id : '';
135
109
  width = (_elementContentRects$ = elementContentRects === null || elementContentRects === void 0 ? void 0 : (_elementContentRects$2 = elementContentRects[id]) === null || _elementContentRects$2 === void 0 ? void 0 : _elementContentRects$2.width) !== null && _elementContentRects$ !== void 0 ? _elementContentRects$ : 0;
136
110
  x = mouseEvent.offsetX;
@@ -140,11 +114,9 @@ var getMousePositionHorizontalRelativeByElement = function getMousePositionHoriz
140
114
  var left = elementRect.left;
141
115
  x = mouseEvent.clientX - left;
142
116
  }
143
-
144
117
  if (width <= 0) {
145
118
  return null;
146
119
  }
147
-
148
120
  if (!gapInPixels) {
149
121
  return x / width > 0.5 ? 'right' : 'left';
150
122
  } else {
@@ -155,68 +127,49 @@ var getMousePositionHorizontalRelativeByElement = function getMousePositionHoriz
155
127
  }
156
128
  }
157
129
  }
158
-
159
130
  return null;
160
131
  };
161
-
162
132
  exports.getMousePositionHorizontalRelativeByElement = getMousePositionHorizontalRelativeByElement;
163
-
164
133
  var getMousePositionVerticalRelativeByElement = function getMousePositionVerticalRelativeByElement(mouseEvent) {
165
134
  var element = mouseEvent.target;
166
-
167
135
  if (element instanceof HTMLElement) {
168
136
  var elementRect = element.getBoundingClientRect();
169
-
170
137
  if (elementRect.height <= 0) {
171
138
  return null;
172
139
  }
173
-
174
140
  var y = mouseEvent.clientY - elementRect.top;
175
141
  return y / elementRect.height > 0.5 ? 'bottom' : 'top';
176
142
  }
177
-
178
143
  return null;
179
144
  };
180
-
181
145
  exports.getMousePositionVerticalRelativeByElement = getMousePositionVerticalRelativeByElement;
182
-
183
146
  var updateResizeHandles = function updateResizeHandles(tableRef) {
184
147
  if (!tableRef) {
185
148
  return;
186
149
  }
187
-
188
- var height = tableRef.offsetHeight + _consts.tableToolbarSize; // see ED-7600
189
-
150
+ var height = tableRef.offsetHeight + _consts.tableToolbarSize;
151
+ // see ED-7600
190
152
  var nodes = Array.from(tableRef.querySelectorAll(".".concat(_types.TableCssClassName.RESIZE_HANDLE)));
191
-
192
153
  if (!nodes || !nodes.length) {
193
154
  return;
194
155
  }
195
-
196
156
  nodes.forEach(function (node) {
197
157
  node.style.height = "".concat(height, "px");
198
158
  });
199
159
  };
200
-
201
160
  exports.updateResizeHandles = updateResizeHandles;
202
-
203
161
  var hasResizeHandler = function hasResizeHandler(_ref) {
204
162
  var columnEndIndexTarget = _ref.columnEndIndexTarget,
205
- target = _ref.target;
163
+ target = _ref.target;
206
164
  var tableElement = (0, _utils.closestElement)(target, 'table');
207
-
208
165
  if (!tableElement) {
209
166
  return false;
210
167
  }
211
-
212
168
  var query = [".".concat(_types.TableCssClassName.RESIZE_HANDLE_DECORATION), "[data-end-index=\"".concat(columnEndIndexTarget, "\"]")];
213
169
  var decorationElement = tableElement.querySelectorAll(query.join(''));
214
-
215
170
  if (!decorationElement || decorationElement.length === 0) {
216
171
  return false;
217
172
  }
218
-
219
173
  return true;
220
174
  };
221
-
222
175
  exports.hasResizeHandler = hasResizeHandler;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getAllowAddColumnCustomStep = getAllowAddColumnCustomStep;
7
-
8
7
  var _pluginFactory = require("../pm-plugins/plugin-factory");
9
-
10
8
  function getAllowAddColumnCustomStep(state) {
11
9
  var tablePluginState = (0, _pluginFactory.getPluginState)(state);
12
10
  return Boolean(tablePluginState) && Boolean(tablePluginState.pluginConfig.allowAddColumnWithCustomStep);
@@ -333,23 +333,13 @@ Object.defineProperty(exports, "updateResizeHandles", {
333
333
  return _dom.updateResizeHandles;
334
334
  }
335
335
  });
336
-
337
336
  var _selection = require("./selection");
338
-
339
337
  var _decoration = require("./decoration");
340
-
341
338
  var _nodes = require("./nodes");
342
-
343
339
  var _paste = require("./paste");
344
-
345
340
  var _dom = require("./dom");
346
-
347
341
  var _columnControls = require("./column-controls");
348
-
349
342
  var _rowControls = require("./row-controls");
350
-
351
343
  var _analytics = require("./analytics");
352
-
353
344
  var _table = require("./table");
354
-
355
345
  var _updatePluginStateDecorations = require("./update-plugin-state-decorations");