handsontable 0.0.0-next-03bda88-20230622 → 0.0.0-next-c3d199b-20230626

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (284) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +329 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +323 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +364 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +360 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/CHANGELOG.md +0 -31
  52. package/base.js +2 -2
  53. package/base.mjs +2 -2
  54. package/core.d.ts +5 -3
  55. package/core.js +127 -309
  56. package/core.mjs +127 -309
  57. package/dataMap/metaManager/metaSchema.js +19 -0
  58. package/dataMap/metaManager/metaSchema.mjs +19 -0
  59. package/dist/handsontable.css +8 -3
  60. package/dist/handsontable.full.css +8 -3
  61. package/dist/handsontable.full.js +15283 -12109
  62. package/dist/handsontable.full.min.css +3 -3
  63. package/dist/handsontable.full.min.js +115 -115
  64. package/dist/handsontable.js +23364 -20190
  65. package/dist/handsontable.min.css +3 -3
  66. package/dist/handsontable.min.js +4 -4
  67. package/editorManager.js +21 -94
  68. package/editorManager.mjs +26 -98
  69. package/editors/textEditor/textEditor.js +3 -11
  70. package/editors/textEditor/textEditor.mjs +4 -12
  71. package/helpers/mixed.js +2 -2
  72. package/helpers/mixed.mjs +2 -2
  73. package/helpers/number.d.ts +1 -0
  74. package/helpers/number.js +18 -0
  75. package/helpers/number.mjs +17 -0
  76. package/package.json +1 -1
  77. package/pluginHooks.d.ts +5 -1
  78. package/pluginHooks.js +89 -1
  79. package/pluginHooks.mjs +89 -1
  80. package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
  81. package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
  82. package/plugins/columnSorting/columnSorting.js +50 -8
  83. package/plugins/columnSorting/columnSorting.mjs +49 -9
  84. package/plugins/columnSorting/index.js +4 -2
  85. package/plugins/columnSorting/index.mjs +1 -1
  86. package/plugins/comments/commentEditor.js +1 -0
  87. package/plugins/comments/commentEditor.mjs +1 -0
  88. package/plugins/comments/comments.js +263 -224
  89. package/plugins/comments/comments.mjs +271 -234
  90. package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
  91. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  92. package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
  93. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
  94. package/plugins/comments/contextMenuItem/removeComment.js +48 -0
  95. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  96. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  97. package/plugins/contextMenu/contextMenu.js +80 -29
  98. package/plugins/contextMenu/contextMenu.mjs +81 -30
  99. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  100. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  101. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  102. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  103. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  104. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  105. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  106. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  107. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  108. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  109. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  110. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  111. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  112. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  113. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  114. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  115. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  116. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  117. package/plugins/contextMenu/utils.js +25 -16
  118. package/plugins/contextMenu/utils.mjs +24 -15
  119. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  120. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  121. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  122. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  123. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  124. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  125. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  126. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  127. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  128. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  129. package/plugins/copyPaste/copyPaste.js +6 -2
  130. package/plugins/copyPaste/copyPaste.mjs +6 -2
  131. package/plugins/customBorders/customBorders.js +25 -53
  132. package/plugins/customBorders/customBorders.mjs +26 -54
  133. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  134. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  135. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  136. package/plugins/mergeCells/mergeCells.js +5 -18
  137. package/plugins/mergeCells/mergeCells.mjs +5 -18
  138. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  139. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  140. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  141. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  142. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  143. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  144. package/plugins/nestedRows/nestedRows.js +52 -7
  145. package/plugins/nestedRows/nestedRows.mjs +52 -7
  146. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  147. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  148. package/selection/highlight/highlight.js +312 -89
  149. package/selection/highlight/highlight.mjs +302 -85
  150. package/selection/highlight/types/activeHeader.js +10 -9
  151. package/selection/highlight/types/activeHeader.mjs +10 -8
  152. package/selection/highlight/types/area.js +12 -27
  153. package/selection/highlight/types/area.mjs +16 -30
  154. package/selection/highlight/types/areaLayered.js +54 -0
  155. package/selection/highlight/types/areaLayered.mjs +49 -0
  156. package/selection/highlight/types/column.js +50 -0
  157. package/selection/highlight/types/column.mjs +45 -0
  158. package/selection/highlight/types/customSelection.js +7 -10
  159. package/selection/highlight/types/customSelection.mjs +7 -9
  160. package/selection/highlight/types/fill.js +5 -8
  161. package/selection/highlight/types/fill.mjs +5 -7
  162. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  163. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  164. package/selection/highlight/types/header.js +10 -20
  165. package/selection/highlight/types/header.mjs +10 -19
  166. package/selection/highlight/types/{index.js → row.js} +27 -31
  167. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  168. package/selection/highlight/visualSelection.js +31 -27
  169. package/selection/highlight/visualSelection.mjs +31 -27
  170. package/selection/index.js +4 -7
  171. package/selection/index.mjs +2 -3
  172. package/selection/mouseEventHandler.js +1 -1
  173. package/selection/mouseEventHandler.mjs +1 -1
  174. package/selection/range.js +8 -8
  175. package/selection/range.mjs +8 -8
  176. package/selection/selection.js +315 -181
  177. package/selection/selection.mjs +310 -180
  178. package/selection/transformation.js +233 -96
  179. package/selection/transformation.mjs +230 -93
  180. package/selection/utils.js +12 -36
  181. package/selection/utils.mjs +13 -36
  182. package/settings.d.ts +1 -0
  183. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  184. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  185. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  186. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  187. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  188. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  189. package/shortcutContexts/commands/editor/index.js +16 -0
  190. package/shortcutContexts/commands/editor/index.mjs +12 -0
  191. package/shortcutContexts/commands/editor/open.js +29 -0
  192. package/shortcutContexts/commands/editor/open.mjs +24 -0
  193. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  194. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  195. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  196. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  197. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  198. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  199. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  200. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  201. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  202. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  203. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  204. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  205. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  206. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  207. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  208. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  209. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  210. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  211. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  212. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  213. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  214. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  215. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  216. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  217. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  218. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  219. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  220. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  221. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  222. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  223. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  224. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  225. package/shortcutContexts/commands/index.js +52 -0
  226. package/shortcutContexts/commands/index.mjs +48 -0
  227. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  228. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  229. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  230. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  231. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  232. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  233. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  234. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  235. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  236. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  237. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  238. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  239. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  240. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  241. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  242. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  243. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  244. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  245. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  246. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  247. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  248. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  249. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  250. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  251. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  252. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  253. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  254. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  255. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  256. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  257. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  258. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  259. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  260. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  261. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  262. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  263. package/shortcutContexts/commands/selectAll.js +11 -0
  264. package/shortcutContexts/commands/selectAll.mjs +6 -0
  265. package/shortcutContexts/constants.js +19 -0
  266. package/shortcutContexts/constants.mjs +12 -0
  267. package/shortcutContexts/editor.js +29 -0
  268. package/shortcutContexts/editor.mjs +25 -0
  269. package/shortcutContexts/grid.js +247 -0
  270. package/shortcutContexts/grid.mjs +243 -0
  271. package/shortcutContexts/index.js +29 -0
  272. package/shortcutContexts/index.mjs +15 -0
  273. package/shortcuts/manager.js +2 -0
  274. package/shortcuts/manager.mjs +2 -0
  275. package/shortcuts/recorder.js +2 -2
  276. package/shortcuts/recorder.mjs +2 -2
  277. package/shortcuts/utils.js +21 -5
  278. package/shortcuts/utils.mjs +20 -4
  279. package/tableView.js +63 -11
  280. package/tableView.mjs +63 -11
  281. package/3rdparty/walkontable/src/selection.js +0 -355
  282. package/3rdparty/walkontable/src/selection.mjs +0 -349
  283. package/selection/highlight/constants.js +0 -16
  284. package/selection/highlight/constants.mjs +0 -6
@@ -35,6 +35,13 @@ function alignmentItem() {
35
35
  if (this.countRows() === 0 || this.countCols() === 0) {
36
36
  return true;
37
37
  }
38
+ var range = this.getSelectedRangeLast();
39
+ if (!range) {
40
+ return true;
41
+ }
42
+ if (range.isSingleHeader()) {
43
+ return true;
44
+ }
38
45
  return !(this.getSelectedRange() && !this.selection.isSelectedByCorner());
39
46
  },
40
47
  submenu: {
@@ -17,6 +17,13 @@ export default function alignmentItem() {
17
17
  if (this.countRows() === 0 || this.countCols() === 0) {
18
18
  return true;
19
19
  }
20
+ var range = this.getSelectedRangeLast();
21
+ if (!range) {
22
+ return true;
23
+ }
24
+ if (range.isSingleHeader()) {
25
+ return true;
26
+ }
20
27
  return !(this.getSelectedRange() && !this.selection.isSelectedByCorner());
21
28
  },
22
29
  submenu: {
@@ -13,7 +13,6 @@ require("core-js/modules/es.symbol.iterator.js");
13
13
  exports.__esModule = true;
14
14
  exports.KEY = void 0;
15
15
  exports.default = clearColumnItem;
16
- var _utils = require("../utils");
17
16
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
18
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -37,8 +36,11 @@ function clearColumnItem() {
37
36
  }
38
37
  },
39
38
  disabled: function disabled() {
40
- var selected = (0, _utils.getValidSelection)(this);
41
- if (!selected) {
39
+ var range = this.getSelectedRangeLast();
40
+ if (!range) {
41
+ return true;
42
+ }
43
+ if (range.isSingleHeader() && range.highlight.col < 0) {
42
44
  return true;
43
45
  }
44
46
  return !this.selection.isSelectedByColumnHeader();
@@ -1,4 +1,3 @@
1
- import { getValidSelection } from "../utils.mjs";
2
1
  import * as C from "../../../i18n/constants.mjs";
3
2
  export var KEY = 'clear_column';
4
3
 
@@ -19,8 +18,11 @@ export default function clearColumnItem() {
19
18
  }
20
19
  },
21
20
  disabled: function disabled() {
22
- var selected = getValidSelection(this);
23
- if (!selected) {
21
+ var range = this.getSelectedRangeLast();
22
+ if (!range) {
23
+ return true;
24
+ }
25
+ if (range.isSingleHeader() && range.highlight.col < 0) {
24
26
  return true;
25
27
  }
26
28
  return !this.selection.isSelectedByColumnHeader();
@@ -13,7 +13,6 @@ require("core-js/modules/es.symbol.iterator.js");
13
13
  exports.__esModule = true;
14
14
  exports.KEY = void 0;
15
15
  exports.default = columnLeftItem;
16
- var _utils = require("../utils");
17
16
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
18
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -38,8 +37,11 @@ function columnLeftItem() {
38
37
  if (!this.isColumnModificationAllowed()) {
39
38
  return true;
40
39
  }
41
- var selected = (0, _utils.getValidSelection)(this);
42
- if (!selected) {
40
+ var range = this.getSelectedRangeLast();
41
+ if (!range) {
42
+ return true;
43
+ }
44
+ if (range.isSingleHeader() && range.highlight.col < 0) {
43
45
  return true;
44
46
  }
45
47
  if (this.selection.isSelectedByCorner()) {
@@ -1,4 +1,3 @@
1
- import { getValidSelection } from "../utils.mjs";
2
1
  import * as C from "../../../i18n/constants.mjs";
3
2
  export var KEY = 'col_left';
4
3
 
@@ -20,8 +19,11 @@ export default function columnLeftItem() {
20
19
  if (!this.isColumnModificationAllowed()) {
21
20
  return true;
22
21
  }
23
- var selected = getValidSelection(this);
24
- if (!selected) {
22
+ var range = this.getSelectedRangeLast();
23
+ if (!range) {
24
+ return true;
25
+ }
26
+ if (range.isSingleHeader() && range.highlight.col < 0) {
25
27
  return true;
26
28
  }
27
29
  if (this.selection.isSelectedByCorner()) {
@@ -13,7 +13,6 @@ require("core-js/modules/es.symbol.iterator.js");
13
13
  exports.__esModule = true;
14
14
  exports.KEY = void 0;
15
15
  exports.default = columnRightItem;
16
- var _utils = require("../utils");
17
16
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
18
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -38,8 +37,11 @@ function columnRightItem() {
38
37
  if (!this.isColumnModificationAllowed()) {
39
38
  return true;
40
39
  }
41
- var selected = (0, _utils.getValidSelection)(this);
42
- if (!selected) {
40
+ var range = this.getSelectedRangeLast();
41
+ if (!range) {
42
+ return true;
43
+ }
44
+ if (range.isSingleHeader() && range.highlight.col < 0) {
43
45
  return true;
44
46
  }
45
47
  if (this.selection.isSelectedByCorner()) {
@@ -1,4 +1,3 @@
1
- import { getValidSelection } from "../utils.mjs";
2
1
  import * as C from "../../../i18n/constants.mjs";
3
2
  export var KEY = 'col_right';
4
3
 
@@ -20,8 +19,11 @@ export default function columnRightItem() {
20
19
  if (!this.isColumnModificationAllowed()) {
21
20
  return true;
22
21
  }
23
- var selected = getValidSelection(this);
24
- if (!selected) {
22
+ var range = this.getSelectedRangeLast();
23
+ if (!range) {
24
+ return true;
25
+ }
26
+ if (range.isSingleHeader() && range.highlight.col < 0) {
25
27
  return true;
26
28
  }
27
29
  if (this.selection.isSelectedByCorner()) {
@@ -54,6 +54,13 @@ function readOnlyItem() {
54
54
  this.render();
55
55
  },
56
56
  disabled: function disabled() {
57
+ var range = this.getSelectedRangeLast();
58
+ if (!range) {
59
+ return true;
60
+ }
61
+ if (range.isSingleHeader()) {
62
+ return true;
63
+ }
57
64
  if (this.selection.isSelectedByCorner()) {
58
65
  return true;
59
66
  }
@@ -36,6 +36,13 @@ export default function readOnlyItem() {
36
36
  this.render();
37
37
  },
38
38
  disabled: function disabled() {
39
+ var range = this.getSelectedRangeLast();
40
+ if (!range) {
41
+ return true;
42
+ }
43
+ if (range.isSingleHeader()) {
44
+ return true;
45
+ }
39
46
  if (this.selection.isSelectedByCorner()) {
40
47
  return true;
41
48
  }
@@ -18,8 +18,7 @@ require("core-js/modules/es.object.get-own-property-descriptor.js");
18
18
  exports.__esModule = true;
19
19
  exports.KEY = void 0;
20
20
  exports.default = removeColumnItem;
21
- var _utils = require("../utils");
22
- var _utils2 = require("../../../selection/utils");
21
+ var _utils = require("../../../selection/utils");
23
22
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
24
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -56,14 +55,17 @@ function removeColumnItem() {
56
55
  return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COLUMN, pluralForm);
57
56
  },
58
57
  callback: function callback() {
59
- this.alter('remove_col', (0, _utils2.transformSelectionToColumnDistance)(this.getSelected()), null, 'ContextMenu.removeColumn');
58
+ this.alter('remove_col', (0, _utils.transformSelectionToColumnDistance)(this.getSelected()), null, 'ContextMenu.removeColumn');
60
59
  },
61
60
  disabled: function disabled() {
62
61
  if (!this.isColumnModificationAllowed()) {
63
62
  return true;
64
63
  }
65
- var selected = (0, _utils.getValidSelection)(this);
66
- if (!selected) {
64
+ var range = this.getSelectedRangeLast();
65
+ if (!range) {
66
+ return true;
67
+ }
68
+ if (range.isSingleHeader() && range.highlight.col < 0) {
67
69
  return true;
68
70
  }
69
71
  var totalColumns = this.countCols();
@@ -16,7 +16,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
16
16
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
17
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
18
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- import { getValidSelection } from "../utils.mjs";
20
19
  import { transformSelectionToColumnDistance } from "../../../selection/utils.mjs";
21
20
  import * as C from "../../../i18n/constants.mjs";
22
21
  export var KEY = 'remove_col';
@@ -51,8 +50,11 @@ export default function removeColumnItem() {
51
50
  if (!this.isColumnModificationAllowed()) {
52
51
  return true;
53
52
  }
54
- var selected = getValidSelection(this);
55
- if (!selected) {
53
+ var range = this.getSelectedRangeLast();
54
+ if (!range) {
55
+ return true;
56
+ }
57
+ if (range.isSingleHeader() && range.highlight.col < 0) {
56
58
  return true;
57
59
  }
58
60
  var totalColumns = this.countCols();
@@ -18,8 +18,7 @@ require("core-js/modules/es.object.get-own-property-descriptor.js");
18
18
  exports.__esModule = true;
19
19
  exports.KEY = void 0;
20
20
  exports.default = removeRowItem;
21
- var _utils = require("../utils");
22
- var _utils2 = require("../../../selection/utils");
21
+ var _utils = require("../../../selection/utils");
23
22
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
24
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -58,11 +57,14 @@ function removeRowItem() {
58
57
  callback: function callback() {
59
58
  // TODO: Please keep in mind that below `1` may be improper. The table's way of work, before change `f1747b3912ea3b21fe423fd102ca94c87db81379` was restored.
60
59
  // There is still problem when removing more than one row.
61
- this.alter('remove_row', (0, _utils2.transformSelectionToRowDistance)(this.getSelected()), 1, 'ContextMenu.removeRow');
60
+ this.alter('remove_row', (0, _utils.transformSelectionToRowDistance)(this.getSelected()), 1, 'ContextMenu.removeRow');
62
61
  },
63
62
  disabled: function disabled() {
64
- var selected = (0, _utils.getValidSelection)(this);
65
- if (!selected) {
63
+ var range = this.getSelectedRangeLast();
64
+ if (!range) {
65
+ return true;
66
+ }
67
+ if (range.isSingleHeader() && range.highlight.row < 0) {
66
68
  return true;
67
69
  }
68
70
  var totalRows = this.countRows();
@@ -16,7 +16,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
16
16
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
17
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
18
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- import { getValidSelection } from "../utils.mjs";
20
19
  import { transformSelectionToRowDistance } from "../../../selection/utils.mjs";
21
20
  import * as C from "../../../i18n/constants.mjs";
22
21
  export var KEY = 'remove_row';
@@ -50,8 +49,11 @@ export default function removeRowItem() {
50
49
  this.alter('remove_row', transformSelectionToRowDistance(this.getSelected()), 1, 'ContextMenu.removeRow');
51
50
  },
52
51
  disabled: function disabled() {
53
- var selected = getValidSelection(this);
54
- if (!selected) {
52
+ var range = this.getSelectedRangeLast();
53
+ if (!range) {
54
+ return true;
55
+ }
56
+ if (range.isSingleHeader() && range.highlight.row < 0) {
55
57
  return true;
56
58
  }
57
59
  var totalRows = this.countRows();
@@ -13,7 +13,6 @@ require("core-js/modules/es.symbol.iterator.js");
13
13
  exports.__esModule = true;
14
14
  exports.KEY = void 0;
15
15
  exports.default = rowAboveItem;
16
- var _utils = require("../utils");
17
16
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
18
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -34,8 +33,11 @@ function rowAboveItem() {
34
33
  this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
35
34
  },
36
35
  disabled: function disabled() {
37
- var selected = (0, _utils.getValidSelection)(this);
38
- if (!selected) {
36
+ var range = this.getSelectedRangeLast();
37
+ if (!range) {
38
+ return true;
39
+ }
40
+ if (range.isSingleHeader() && range.highlight.row < 0) {
39
41
  return true;
40
42
  }
41
43
  if (this.selection.isSelectedByCorner()) {
@@ -1,4 +1,3 @@
1
- import { getValidSelection } from "../utils.mjs";
2
1
  import * as C from "../../../i18n/constants.mjs";
3
2
  export var KEY = 'row_above';
4
3
 
@@ -16,8 +15,11 @@ export default function rowAboveItem() {
16
15
  this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
17
16
  },
18
17
  disabled: function disabled() {
19
- var selected = getValidSelection(this);
20
- if (!selected) {
18
+ var range = this.getSelectedRangeLast();
19
+ if (!range) {
20
+ return true;
21
+ }
22
+ if (range.isSingleHeader() && range.highlight.row < 0) {
21
23
  return true;
22
24
  }
23
25
  if (this.selection.isSelectedByCorner()) {
@@ -13,7 +13,6 @@ require("core-js/modules/es.symbol.iterator.js");
13
13
  exports.__esModule = true;
14
14
  exports.KEY = void 0;
15
15
  exports.default = rowBelowItem;
16
- var _utils = require("../utils");
17
16
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
18
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -34,8 +33,11 @@ function rowBelowItem() {
34
33
  this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
35
34
  },
36
35
  disabled: function disabled() {
37
- var selected = (0, _utils.getValidSelection)(this);
38
- if (!selected) {
36
+ var range = this.getSelectedRangeLast();
37
+ if (!range) {
38
+ return true;
39
+ }
40
+ if (range.isSingleHeader() && range.highlight.row < 0) {
39
41
  return true;
40
42
  }
41
43
  if (this.selection.isSelectedByCorner()) {
@@ -1,4 +1,3 @@
1
- import { getValidSelection } from "../utils.mjs";
2
1
  import * as C from "../../../i18n/constants.mjs";
3
2
  export var KEY = 'row_below';
4
3
 
@@ -16,8 +15,11 @@ export default function rowBelowItem() {
16
15
  this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
17
16
  },
18
17
  disabled: function disabled() {
19
- var selected = getValidSelection(this);
20
- if (!selected) {
18
+ var range = this.getSelectedRangeLast();
19
+ if (!range) {
20
+ return true;
21
+ }
22
+ if (range.isSingleHeader() && range.highlight.row < 0) {
21
23
  return true;
22
24
  }
23
25
  if (this.selection.isSelectedByCorner()) {
@@ -5,7 +5,7 @@ exports.align = align;
5
5
  exports.checkSelectionConsistency = checkSelectionConsistency;
6
6
  exports.filterSeparators = filterSeparators;
7
7
  exports.getAlignmentClasses = getAlignmentClasses;
8
- exports.getValidSelection = getValidSelection;
8
+ exports.getDocumentOffsetByElement = getDocumentOffsetByElement;
9
9
  exports.hasSubMenu = hasSubMenu;
10
10
  exports.isDisabled = isDisabled;
11
11
  exports.isItemHidden = isItemHidden;
@@ -70,21 +70,6 @@ function isSelectionDisabled(cell) {
70
70
  return (0, _element.hasClass)(cell, 'htSelectionDisabled');
71
71
  }
72
72
 
73
- /**
74
- * @param {Core} hot The Handsontable instance.
75
- * @returns {Array[]|null}
76
- */
77
- function getValidSelection(hot) {
78
- var selected = hot.getSelected();
79
- if (!selected) {
80
- return null;
81
- }
82
- if (selected[0] < 0) {
83
- return null;
84
- }
85
- return selected;
86
- }
87
-
88
73
  /**
89
74
  * @param {string} className The full element class name to process.
90
75
  * @param {string} alignment The slignment class name to compare with.
@@ -275,4 +260,28 @@ function filterSeparators(items) {
275
260
  result = popSeparators(result, separator);
276
261
  result = removeDuplicatedSeparators(result);
277
262
  return result;
263
+ }
264
+
265
+ /**
266
+ * Returns document offset based on the passed element. If the document objects between element and the
267
+ * base document are not the same the offset as top and left properties will be returned.
268
+ *
269
+ * @param {Element} elementToCheck The element to compare with Document object.
270
+ * @param {Document} baseDocument The base Document object.
271
+ * @returns {{ top: number, left: number }}
272
+ */
273
+ function getDocumentOffsetByElement(elementToCheck, baseDocument) {
274
+ var offset = {
275
+ top: 0,
276
+ left: 0
277
+ };
278
+ if (baseDocument !== elementToCheck.ownerDocument) {
279
+ var frameElement = baseDocument.defaultView.frameElement;
280
+ var _frameElement$getBoun = frameElement.getBoundingClientRect(),
281
+ top = _frameElement$getBoun.top,
282
+ left = _frameElement$getBoun.left;
283
+ offset.top = top;
284
+ offset.left = left;
285
+ }
286
+ return offset;
278
287
  }
@@ -53,21 +53,6 @@ export function isSelectionDisabled(cell) {
53
53
  return hasClass(cell, 'htSelectionDisabled');
54
54
  }
55
55
 
56
- /**
57
- * @param {Core} hot The Handsontable instance.
58
- * @returns {Array[]|null}
59
- */
60
- export function getValidSelection(hot) {
61
- var selected = hot.getSelected();
62
- if (!selected) {
63
- return null;
64
- }
65
- if (selected[0] < 0) {
66
- return null;
67
- }
68
- return selected;
69
- }
70
-
71
56
  /**
72
57
  * @param {string} className The full element class name to process.
73
58
  * @param {string} alignment The slignment class name to compare with.
@@ -258,4 +243,28 @@ export function filterSeparators(items) {
258
243
  result = popSeparators(result, separator);
259
244
  result = removeDuplicatedSeparators(result);
260
245
  return result;
246
+ }
247
+
248
+ /**
249
+ * Returns document offset based on the passed element. If the document objects between element and the
250
+ * base document are not the same the offset as top and left properties will be returned.
251
+ *
252
+ * @param {Element} elementToCheck The element to compare with Document object.
253
+ * @param {Document} baseDocument The base Document object.
254
+ * @returns {{ top: number, left: number }}
255
+ */
256
+ export function getDocumentOffsetByElement(elementToCheck, baseDocument) {
257
+ var offset = {
258
+ top: 0,
259
+ left: 0
260
+ };
261
+ if (baseDocument !== elementToCheck.ownerDocument) {
262
+ var frameElement = baseDocument.defaultView.frameElement;
263
+ var _frameElement$getBoun = frameElement.getBoundingClientRect(),
264
+ top = _frameElement$getBoun.top,
265
+ left = _frameElement$getBoun.left;
266
+ offset.top = top;
267
+ offset.left = left;
268
+ }
269
+ return offset;
261
270
  }
@@ -20,6 +20,13 @@ function copyItem(copyPastePlugin) {
20
20
  if (this.countRows() === 0 || this.countCols() === 0) {
21
21
  return true;
22
22
  }
23
+ var range = this.getSelectedRangeLast();
24
+ if (!range) {
25
+ return true;
26
+ }
27
+ if (range.isSingleHeader()) {
28
+ return true;
29
+ }
23
30
  var selected = this.getSelected();
24
31
 
25
32
  // Disable for no selection or for non-contiguous selection.
@@ -16,6 +16,13 @@ export default function copyItem(copyPastePlugin) {
16
16
  if (this.countRows() === 0 || this.countCols() === 0) {
17
17
  return true;
18
18
  }
19
+ var range = this.getSelectedRangeLast();
20
+ if (!range) {
21
+ return true;
22
+ }
23
+ if (range.isSingleHeader()) {
24
+ return true;
25
+ }
19
26
  var selected = this.getSelected();
20
27
 
21
28
  // Disable for no selection or for non-contiguous selection.
@@ -3,6 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = copyColumnHeadersOnlyItem;
5
5
  var _constants = require("../../../i18n/constants");
6
+ var _number = require("../../../helpers/number");
6
7
  /**
7
8
  * @param {CopyPaste} copyPastePlugin The plugin instance.
8
9
  * @returns {object}
@@ -12,7 +13,7 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
12
13
  key: 'copy_column_headers_only',
13
14
  name: function name() {
14
15
  var selectedRange = this.getSelectedRangeLast();
15
- var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
16
+ var nounForm = selectedRange ? (0, _number.clamp)(selectedRange.getWidth() - 1, 0, 1) : 0;
16
17
  return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
17
18
  },
18
19
  callback: function callback() {
@@ -22,6 +23,13 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
22
23
  if (!this.hasColHeaders()) {
23
24
  return true;
24
25
  }
26
+ var range = this.getSelectedRangeLast();
27
+ if (!range) {
28
+ return true;
29
+ }
30
+ if (range.isSingleHeader()) {
31
+ return true;
32
+ }
25
33
  var selected = this.getSelected();
26
34
 
27
35
  // Disable for no selection or for non-contiguous selection.
@@ -1,4 +1,5 @@
1
1
  import { CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY } from "../../../i18n/constants.mjs";
2
+ import { clamp } from "../../../helpers/number.mjs";
2
3
  /**
3
4
  * @param {CopyPaste} copyPastePlugin The plugin instance.
4
5
  * @returns {object}
@@ -8,7 +9,7 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
8
9
  key: 'copy_column_headers_only',
9
10
  name: function name() {
10
11
  var selectedRange = this.getSelectedRangeLast();
11
- var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
12
+ var nounForm = selectedRange ? clamp(selectedRange.getWidth() - 1, 0, 1) : 0;
12
13
  return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
13
14
  },
14
15
  callback: function callback() {
@@ -18,6 +19,13 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
18
19
  if (!this.hasColHeaders()) {
19
20
  return true;
20
21
  }
22
+ var range = this.getSelectedRangeLast();
23
+ if (!range) {
24
+ return true;
25
+ }
26
+ if (range.isSingleHeader()) {
27
+ return true;
28
+ }
21
29
  var selected = this.getSelected();
22
30
 
23
31
  // Disable for no selection or for non-contiguous selection.
@@ -3,6 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = copyWithColumnGroupHeadersItem;
5
5
  var _constants = require("../../../i18n/constants");
6
+ var _number = require("../../../helpers/number");
6
7
  /**
7
8
  * @param {CopyPaste} copyPastePlugin The plugin instance.
8
9
  * @returns {object}
@@ -12,7 +13,7 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
12
13
  key: 'copy_with_column_group_headers',
13
14
  name: function name() {
14
15
  var selectedRange = this.getSelectedRangeLast();
15
- var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
16
+ var nounForm = selectedRange ? (0, _number.clamp)(selectedRange.getWidth() - 1, 0, 1) : 0;
16
17
  return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
17
18
  },
18
19
  callback: function callback() {
@@ -22,6 +23,13 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
22
23
  if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
23
24
  return true;
24
25
  }
26
+ var range = this.getSelectedRangeLast();
27
+ if (!range) {
28
+ return true;
29
+ }
30
+ if (range.isSingleHeader()) {
31
+ return true;
32
+ }
25
33
  var selected = this.getSelected();
26
34
 
27
35
  // Disable for no selection or for non-contiguous selection.
@@ -1,4 +1,5 @@
1
1
  import { CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS } from "../../../i18n/constants.mjs";
2
+ import { clamp } from "../../../helpers/number.mjs";
2
3
  /**
3
4
  * @param {CopyPaste} copyPastePlugin The plugin instance.
4
5
  * @returns {object}
@@ -8,7 +9,7 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
8
9
  key: 'copy_with_column_group_headers',
9
10
  name: function name() {
10
11
  var selectedRange = this.getSelectedRangeLast();
11
- var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
12
+ var nounForm = selectedRange ? clamp(selectedRange.getWidth() - 1, 0, 1) : 0;
12
13
  return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
13
14
  },
14
15
  callback: function callback() {
@@ -18,6 +19,13 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
18
19
  if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
19
20
  return true;
20
21
  }
22
+ var range = this.getSelectedRangeLast();
23
+ if (!range) {
24
+ return true;
25
+ }
26
+ if (range.isSingleHeader()) {
27
+ return true;
28
+ }
21
29
  var selected = this.getSelected();
22
30
 
23
31
  // Disable for no selection or for non-contiguous selection.