@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
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  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; } }
12
-
13
10
  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; }
14
-
15
11
  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) { _defineProperty(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; }
16
-
17
12
  import React, { createRef } from 'react';
18
13
  import classnames from 'classnames';
19
14
  import { injectIntl } from 'react-intl-next';
@@ -25,7 +20,6 @@ import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
25
20
  import { toggleTableLayoutWithAnalytics } from '../../commands-with-analytics';
26
21
  import { TableCssClassName as ClassName } from '../../types';
27
22
  import { findDomRefAtPos } from 'prosemirror-utils';
28
-
29
23
  var addPopupOffset = function addPopupOffset(pos) {
30
24
  return _objectSpread(_objectSpread({}, pos), {}, {
31
25
  // add 12 pixels to align y position with
@@ -33,76 +27,61 @@ var addPopupOffset = function addPopupOffset(pos) {
33
27
  top: pos.top ? pos.top + 12 : undefined
34
28
  });
35
29
  };
36
-
37
30
  var getMessage = function getMessage(layout) {
38
31
  switch (layout) {
39
32
  case 'default':
40
33
  return commonMessages.layoutWide;
41
-
42
34
  case 'wide':
43
35
  return commonMessages.layoutFullWidth;
44
-
45
36
  default:
46
37
  return commonMessages.layoutFixedWidth;
47
38
  }
48
39
  };
49
-
50
40
  var LayoutButton = /*#__PURE__*/function (_React$Component) {
51
41
  _inherits(LayoutButton, _React$Component);
52
-
53
42
  var _super = _createSuper(LayoutButton);
54
-
55
43
  function LayoutButton() {
56
44
  var _this;
57
-
58
45
  _classCallCheck(this, LayoutButton);
59
-
60
46
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
47
  args[_key] = arguments[_key];
62
48
  }
63
-
64
49
  _this = _super.call.apply(_super, [this].concat(args));
65
-
66
50
  _defineProperty(_assertThisInitialized(_this), "stickyButtonRef", /*#__PURE__*/createRef());
67
-
68
51
  _defineProperty(_assertThisInitialized(_this), "resizeObserver", new ResizeObserver(function (entries) {
69
52
  entries.forEach(function (entry) {
70
53
  var resizeButton = _this.stickyButtonRef.current;
71
54
  var tableWrapper = _this.props.targetRef;
72
-
73
55
  if (resizeButton && tableWrapper) {
74
56
  var clientRect = tableWrapper.getBoundingClientRect();
75
57
  resizeButton.style.left = "".concat(clientRect.right, "px");
76
58
  }
77
59
  });
78
60
  }));
79
-
80
61
  _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
81
62
  var _this$props$editorVie = _this.props.editorView,
82
- state = _this$props$editorVie.state,
83
- dispatch = _this$props$editorVie.dispatch;
63
+ state = _this$props$editorVie.state,
64
+ dispatch = _this$props$editorVie.dispatch;
84
65
  toggleTableLayoutWithAnalytics(_this.props.editorAnalyticsAPI)(state, dispatch);
85
66
  });
86
-
87
67
  return _this;
88
68
  }
89
-
90
69
  _createClass(LayoutButton, [{
91
70
  key: "getTitle",
92
71
  value: function getTitle() {
93
72
  var _this$props = this.props,
94
- formatMessage = _this$props.intl.formatMessage,
95
- _this$props$layout = _this$props.layout,
96
- layout = _this$props$layout === void 0 ? 'default' : _this$props$layout;
73
+ formatMessage = _this$props.intl.formatMessage,
74
+ _this$props$layout = _this$props.layout,
75
+ layout = _this$props$layout === void 0 ? 'default' : _this$props$layout;
97
76
  return formatMessage(getMessage(layout));
98
77
  }
99
78
  }, {
100
79
  key: "toolbarButton",
101
80
  value: function toolbarButton() {
102
81
  var _this$props2 = this.props,
103
- isResizing = _this$props2.isResizing,
104
- _this$props2$layout = _this$props2.layout,
105
- layout = _this$props2$layout === void 0 ? 'default' : _this$props2$layout;
82
+ isResizing = _this$props2.isResizing,
83
+ _this$props2$layout = _this$props2.layout,
84
+ layout = _this$props2$layout === void 0 ? 'default' : _this$props2$layout;
106
85
  var title = this.getTitle();
107
86
  return /*#__PURE__*/React.createElement("div", {
108
87
  className: classnames(ClassName.LAYOUT_BUTTON, _defineProperty({}, ClassName.IS_RESIZING, isResizing))
@@ -128,11 +107,9 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
128
107
  key: "renderSticky",
129
108
  value: function renderSticky(button, targetRef, tableRef) {
130
109
  var title = this.getTitle();
131
-
132
110
  if (!(targetRef instanceof HTMLElement) || !(tableRef instanceof HTMLElement)) {
133
111
  return null;
134
112
  }
135
-
136
113
  var pos = targetRef.getBoundingClientRect();
137
114
  var tablePos = tableRef.getBoundingClientRect();
138
115
  return /*#__PURE__*/React.createElement("div", {
@@ -149,15 +126,13 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
149
126
  key: "renderPopup",
150
127
  value: function renderPopup(button) {
151
128
  var _this$props3 = this.props,
152
- mountPoint = _this$props3.mountPoint,
153
- boundariesElement = _this$props3.boundariesElement,
154
- scrollableElement = _this$props3.scrollableElement,
155
- targetRef = _this$props3.targetRef;
156
-
129
+ mountPoint = _this$props3.mountPoint,
130
+ boundariesElement = _this$props3.boundariesElement,
131
+ scrollableElement = _this$props3.scrollableElement,
132
+ targetRef = _this$props3.targetRef;
157
133
  if (!targetRef) {
158
134
  return null;
159
135
  }
160
-
161
136
  var title = this.getTitle();
162
137
  return /*#__PURE__*/React.createElement(Popup, {
163
138
  ariaLabel: title,
@@ -178,7 +153,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
178
153
  var stickyHeader = this.props.stickyHeader;
179
154
  var button = this.toolbarButton();
180
155
  var stickyTargetRef = stickyHeader && stickyHeader.sticky && stickyHeader.pos ? this.getStickyTargetRef(stickyHeader.pos) : null;
181
-
182
156
  if (stickyTargetRef && this.props.targetRef) {
183
157
  return this.renderSticky(button, stickyTargetRef, this.props.targetRef);
184
158
  } else {
@@ -190,7 +164,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
190
164
  value: function componentDidMount() {
191
165
  var dom = this.props.editorView.dom;
192
166
  var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
193
-
194
167
  if (scrollPanel instanceof HTMLElement) {
195
168
  this.resizeObserver.observe(scrollPanel);
196
169
  }
@@ -200,7 +173,6 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
200
173
  value: function componentWillUnmount() {
201
174
  var dom = this.props.editorView.dom;
202
175
  var scrollPanel = dom.closest('.fabric-editor-popup-scroll-parent');
203
-
204
176
  if (scrollPanel instanceof HTMLElement) {
205
177
  this.resizeObserver.unobserve(scrollPanel);
206
178
  }
@@ -209,17 +181,14 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
209
181
  key: "shouldComponentUpdate",
210
182
  value: function shouldComponentUpdate(nextProps) {
211
183
  var _this$props4 = this.props,
212
- targetRef = _this$props4.targetRef,
213
- layout = _this$props4.layout,
214
- isResizing = _this$props4.isResizing,
215
- stickyHeader = _this$props4.stickyHeader;
184
+ targetRef = _this$props4.targetRef,
185
+ layout = _this$props4.layout,
186
+ isResizing = _this$props4.isResizing,
187
+ stickyHeader = _this$props4.stickyHeader;
216
188
  return stickyHeader !== nextProps.stickyHeader || targetRef !== nextProps.targetRef || layout !== nextProps.layout || isResizing !== nextProps.isResizing;
217
189
  }
218
190
  }]);
219
-
220
191
  return LayoutButton;
221
192
  }(React.Component);
222
-
223
193
  _defineProperty(LayoutButton, "displayName", 'LayoutButton');
224
-
225
194
  export default injectIntl(LayoutButton);
@@ -5,11 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  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; } }
12
-
13
10
  import React, { Component } from 'react';
14
11
  import { defineMessages, injectIntl } from 'react-intl-next';
15
12
  import classnames from 'classnames';
@@ -24,76 +21,60 @@ var messages = defineMessages({
24
21
  description: 'A button on the upper left corner of the table that shows up when the table is in focus. Clicking on it will select the entire table.'
25
22
  }
26
23
  });
27
-
28
24
  var CornerControlComponent = /*#__PURE__*/function (_Component) {
29
25
  _inherits(CornerControlComponent, _Component);
30
-
31
26
  var _super = _createSuper(CornerControlComponent);
32
-
33
27
  function CornerControlComponent() {
34
28
  var _this;
35
-
36
29
  _classCallCheck(this, CornerControlComponent);
37
-
38
30
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
31
  args[_key] = arguments[_key];
40
32
  }
41
-
42
33
  _this = _super.call.apply(_super, [this].concat(args));
43
-
44
34
  _defineProperty(_assertThisInitialized(_this), "isActive", function () {
45
35
  var _this$props = _this.props,
46
- editorView = _this$props.editorView,
47
- hoveredRows = _this$props.hoveredRows,
48
- isResizing = _this$props.isResizing;
36
+ editorView = _this$props.editorView,
37
+ hoveredRows = _this$props.hoveredRows,
38
+ isResizing = _this$props.isResizing;
49
39
  var selection = editorView.state.selection;
50
40
  var table = findTable(selection);
51
-
52
41
  if (!table) {
53
42
  return false;
54
43
  }
55
-
56
44
  return isTableSelected(selection) || hoveredRows && hoveredRows.length === TableMap.get(table.node).height && !isResizing;
57
45
  });
58
-
59
46
  _defineProperty(_assertThisInitialized(_this), "clearHoverSelection", function () {
60
47
  var _this$props$editorVie = _this.props.editorView,
61
- state = _this$props$editorVie.state,
62
- dispatch = _this$props$editorVie.dispatch;
48
+ state = _this$props$editorVie.state,
49
+ dispatch = _this$props$editorVie.dispatch;
63
50
  clearHoverSelection()(state, dispatch);
64
51
  });
65
-
66
52
  _defineProperty(_assertThisInitialized(_this), "selectTable", function () {
67
53
  var _this$props$editorVie2 = _this.props.editorView,
68
- state = _this$props$editorVie2.state,
69
- dispatch = _this$props$editorVie2.dispatch;
54
+ state = _this$props$editorVie2.state,
55
+ dispatch = _this$props$editorVie2.dispatch;
70
56
  dispatch(selectTable(state.tr).setMeta('addToHistory', false));
71
57
  });
72
-
73
58
  _defineProperty(_assertThisInitialized(_this), "hoverTable", function () {
74
59
  var _this$props$editorVie3 = _this.props.editorView,
75
- state = _this$props$editorVie3.state,
76
- dispatch = _this$props$editorVie3.dispatch;
60
+ state = _this$props$editorVie3.state,
61
+ dispatch = _this$props$editorVie3.dispatch;
77
62
  hoverTable()(state, dispatch);
78
63
  });
79
-
80
64
  return _this;
81
65
  }
82
-
83
66
  _createClass(CornerControlComponent, [{
84
67
  key: "render",
85
68
  value: function render() {
86
69
  var _this$props2 = this.props,
87
- isInDanger = _this$props2.isInDanger,
88
- tableRef = _this$props2.tableRef,
89
- isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
90
- isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
91
- formatMessage = _this$props2.intl.formatMessage;
92
-
70
+ isInDanger = _this$props2.isInDanger,
71
+ tableRef = _this$props2.tableRef,
72
+ isHeaderColumnEnabled = _this$props2.isHeaderColumnEnabled,
73
+ isHeaderRowEnabled = _this$props2.isHeaderRowEnabled,
74
+ formatMessage = _this$props2.intl.formatMessage;
93
75
  if (!tableRef) {
94
76
  return null;
95
77
  }
96
-
97
78
  var isActive = this.isActive();
98
79
  return /*#__PURE__*/React.createElement("div", {
99
80
  className: classnames(ClassName.CORNER_CONTROLS, {
@@ -124,8 +105,6 @@ var CornerControlComponent = /*#__PURE__*/function (_Component) {
124
105
  })));
125
106
  }
126
107
  }]);
127
-
128
108
  return CornerControlComponent;
129
109
  }(Component);
130
-
131
110
  export var CornerControls = injectIntl(CornerControlComponent);
@@ -5,94 +5,78 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  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; } }
12
-
13
10
  import React, { Component } from 'react';
14
11
  import { Selection } from 'prosemirror-state';
15
12
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
16
13
  import { clearHoverSelection } from '../../../commands';
17
14
  import { TableCssClassName as ClassName } from '../../../types';
18
15
  import { getRowHeights } from '../../../utils';
19
-
20
16
  var NumberColumn = /*#__PURE__*/function (_Component) {
21
17
  _inherits(NumberColumn, _Component);
22
-
23
18
  var _super = _createSuper(NumberColumn);
24
-
25
19
  function NumberColumn() {
26
20
  var _this;
27
-
28
21
  _classCallCheck(this, NumberColumn);
29
-
30
22
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
23
  args[_key] = arguments[_key];
32
24
  }
33
-
34
25
  _this = _super.call.apply(_super, [this].concat(args));
35
-
36
26
  _defineProperty(_assertThisInitialized(_this), "hoverRows", function (index) {
37
27
  return _this.props.tableActive ? _this.props.hoverRows([index]) : null;
38
28
  });
39
-
40
29
  _defineProperty(_assertThisInitialized(_this), "selectRow", function (index, event) {
41
30
  var _this$props = _this.props,
42
- tableActive = _this$props.tableActive,
43
- editorView = _this$props.editorView,
44
- selectRow = _this$props.selectRow; // If selection is outside the table then first reset the selection inside table
45
-
31
+ tableActive = _this$props.tableActive,
32
+ editorView = _this$props.editorView,
33
+ selectRow = _this$props.selectRow;
34
+ // If selection is outside the table then first reset the selection inside table
46
35
  if (!tableActive && event.target && event.target instanceof Node) {
47
36
  var _editorView$state = editorView.state,
48
- doc = _editorView$state.doc,
49
- selection = _editorView$state.selection,
50
- tr = _editorView$state.tr;
37
+ doc = _editorView$state.doc,
38
+ selection = _editorView$state.selection,
39
+ tr = _editorView$state.tr;
51
40
  var pos = editorView.posAtDOM(event.target, 1);
52
41
  var $pos = doc.resolve(pos);
53
- var newPos = selection.head > pos ? // Selection is after table
42
+ var newPos = selection.head > pos ?
43
+ // Selection is after table
54
44
  // nodeSize - 3 will move the position inside last table cell
55
- Selection.near(doc.resolve(pos + ($pos.parent.nodeSize - 3)), -1) : // Selection is before table
45
+ Selection.near(doc.resolve(pos + ($pos.parent.nodeSize - 3)), -1) :
46
+ // Selection is before table
56
47
  Selection.near($pos);
57
48
  editorView.dispatch(tr.setSelection(newPos));
58
49
  }
59
-
60
50
  selectRow(index, event.shiftKey);
61
51
  });
62
-
63
52
  _defineProperty(_assertThisInitialized(_this), "clearHoverSelection", function () {
64
53
  var _this$props2 = _this.props,
65
- tableActive = _this$props2.tableActive,
66
- editorView = _this$props2.editorView;
67
-
54
+ tableActive = _this$props2.tableActive,
55
+ editorView = _this$props2.editorView;
68
56
  if (tableActive) {
69
57
  var state = editorView.state,
70
- dispatch = editorView.dispatch;
58
+ dispatch = editorView.dispatch;
71
59
  clearHoverSelection()(state, dispatch);
72
60
  }
73
61
  });
74
-
75
62
  _defineProperty(_assertThisInitialized(_this), "getClassNames", function (index) {
76
63
  var _this$props3 = _this.props,
77
- hoveredRows = _this$props3.hoveredRows,
78
- editorView = _this$props3.editorView,
79
- isInDanger = _this$props3.isInDanger,
80
- isResizing = _this$props3.isResizing;
64
+ hoveredRows = _this$props3.hoveredRows,
65
+ editorView = _this$props3.editorView,
66
+ isInDanger = _this$props3.isInDanger,
67
+ isResizing = _this$props3.isResizing;
81
68
  var isActive = isRowSelected(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
82
69
  return [ClassName.NUMBERED_COLUMN_BUTTON, isActive ? ClassName.HOVERED_CELL_ACTIVE : '', isActive && isInDanger ? ClassName.HOVERED_CELL_IN_DANGER : ''].join(' ');
83
70
  });
84
-
85
71
  return _this;
86
72
  }
87
-
88
73
  _createClass(NumberColumn, [{
89
74
  key: "render",
90
75
  value: function render() {
91
76
  var _this2 = this;
92
-
93
77
  var _this$props4 = this.props,
94
- tableRef = _this$props4.tableRef,
95
- hasHeaderRow = _this$props4.hasHeaderRow;
78
+ tableRef = _this$props4.tableRef,
79
+ hasHeaderRow = _this$props4.hasHeaderRow;
96
80
  var rowHeights = getRowHeights(tableRef);
97
81
  return /*#__PURE__*/React.createElement("div", {
98
82
  className: ClassName.NUMBERED_COLUMN,
@@ -120,8 +104,6 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
120
104
  }));
121
105
  }
122
106
  }]);
123
-
124
107
  return NumberColumn;
125
108
  }(Component);
126
-
127
109
  export { NumberColumn as default };
@@ -5,11 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
-
11
9
  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; } }
12
-
13
10
  import React, { Component } from 'react';
14
11
  import { defineMessages, injectIntl } from 'react-intl-next';
15
12
  import { clearHoverSelection } from '../../../commands';
@@ -23,50 +20,38 @@ var messages = defineMessages({
23
20
  description: 'A button on the left of each row that shows up when the table is in focus. Clicking on it will select the entire row.'
24
21
  }
25
22
  });
26
-
27
23
  var RowControlsComponent = /*#__PURE__*/function (_Component) {
28
24
  _inherits(RowControlsComponent, _Component);
29
-
30
25
  var _super = _createSuper(RowControlsComponent);
31
-
32
26
  function RowControlsComponent() {
33
27
  var _this;
34
-
35
28
  _classCallCheck(this, RowControlsComponent);
36
-
37
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
30
  args[_key] = arguments[_key];
39
31
  }
40
-
41
32
  _this = _super.call.apply(_super, [this].concat(args));
42
-
43
33
  _defineProperty(_assertThisInitialized(_this), "clearHoverSelection", function () {
44
34
  var _this$props$editorVie = _this.props.editorView,
45
- state = _this$props$editorVie.state,
46
- dispatch = _this$props$editorVie.dispatch;
35
+ state = _this$props$editorVie.state,
36
+ dispatch = _this$props$editorVie.dispatch;
47
37
  clearHoverSelection()(state, dispatch);
48
38
  });
49
-
50
39
  return _this;
51
40
  }
52
-
53
41
  _createClass(RowControlsComponent, [{
54
42
  key: "render",
55
43
  value: function render() {
56
44
  var _this2 = this;
57
-
58
45
  var _this$props = this.props,
59
- editorView = _this$props.editorView,
60
- tableRef = _this$props.tableRef,
61
- hoveredRows = _this$props.hoveredRows,
62
- isInDanger = _this$props.isInDanger,
63
- isResizing = _this$props.isResizing,
64
- formatMessage = _this$props.intl.formatMessage;
65
-
46
+ editorView = _this$props.editorView,
47
+ tableRef = _this$props.tableRef,
48
+ hoveredRows = _this$props.hoveredRows,
49
+ isInDanger = _this$props.isInDanger,
50
+ isResizing = _this$props.isResizing,
51
+ formatMessage = _this$props.intl.formatMessage;
66
52
  if (!tableRef) {
67
53
  return null;
68
54
  }
69
-
70
55
  var selection = editorView.state.selection;
71
56
  var rowHeights = getRowHeights(tableRef);
72
57
  var rowsParams = getRowsParams(rowHeights);
@@ -78,15 +63,13 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
78
63
  className: ClassName.ROW_CONTROLS_INNER
79
64
  }, rowsParams.map(function (_ref, index) {
80
65
  var startIndex = _ref.startIndex,
81
- endIndex = _ref.endIndex,
82
- height = _ref.height;
66
+ endIndex = _ref.endIndex,
67
+ height = _ref.height;
83
68
  // if previous row was header row, add its height to our margin
84
69
  var marginTop = -1;
85
-
86
70
  if (index === 1 && hasHeaderRow && _this2.props.stickyTop !== undefined) {
87
71
  marginTop += rowHeights[index - 1] + tableToolbarSize;
88
72
  }
89
-
90
73
  var thisRowSticky = _this2.props.stickyTop !== undefined && index === 0 && hasHeaderRow;
91
74
  return /*#__PURE__*/React.createElement("div", {
92
75
  className: "".concat(ClassName.ROW_CONTROLS_BUTTON_WRAP, " ").concat(getRowClassNames(startIndex, selection, hoveredRows, isInDanger, isResizing), " ").concat(thisRowSticky ? 'sticky' : ''),
@@ -116,8 +99,6 @@ var RowControlsComponent = /*#__PURE__*/function (_Component) {
116
99
  })));
117
100
  }
118
101
  }]);
119
-
120
102
  return RowControlsComponent;
121
103
  }(Component);
122
-
123
104
  export var RowControls = injectIntl(RowControlsComponent);