handsontable 0.0.0-next-b7cca45-20230605 → 0.0.0-next-aa25cac-20230607

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 (223) 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 +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -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/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +123 -308
  55. package/core.mjs +123 -308
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12578 -10028
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +18881 -16331
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +21 -82
  67. package/editorManager.mjs +26 -86
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.d.ts +5 -1
  77. package/pluginHooks.js +89 -1
  78. package/pluginHooks.mjs +89 -1
  79. package/plugins/copyPaste/copyPaste.js +5 -1
  80. package/plugins/copyPaste/copyPaste.mjs +5 -1
  81. package/plugins/customBorders/customBorders.js +18 -52
  82. package/plugins/customBorders/customBorders.mjs +19 -53
  83. package/plugins/mergeCells/mergeCells.js +5 -18
  84. package/plugins/mergeCells/mergeCells.mjs +5 -18
  85. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  86. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  87. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  88. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  89. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  90. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  91. package/selection/highlight/highlight.js +311 -88
  92. package/selection/highlight/highlight.mjs +301 -84
  93. package/selection/highlight/types/activeHeader.js +10 -9
  94. package/selection/highlight/types/activeHeader.mjs +10 -8
  95. package/selection/highlight/types/area.js +12 -27
  96. package/selection/highlight/types/area.mjs +16 -30
  97. package/selection/highlight/types/areaLayered.js +54 -0
  98. package/selection/highlight/types/areaLayered.mjs +49 -0
  99. package/selection/highlight/types/column.js +50 -0
  100. package/selection/highlight/types/column.mjs +45 -0
  101. package/selection/highlight/types/customSelection.js +7 -10
  102. package/selection/highlight/types/customSelection.mjs +7 -9
  103. package/selection/highlight/types/fill.js +5 -8
  104. package/selection/highlight/types/fill.mjs +5 -7
  105. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  106. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  107. package/selection/highlight/types/header.js +10 -20
  108. package/selection/highlight/types/header.mjs +10 -19
  109. package/selection/highlight/types/{index.js → row.js} +27 -31
  110. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  111. package/selection/highlight/visualSelection.js +31 -27
  112. package/selection/highlight/visualSelection.mjs +31 -27
  113. package/selection/index.js +4 -7
  114. package/selection/index.mjs +2 -3
  115. package/selection/mouseEventHandler.js +1 -1
  116. package/selection/mouseEventHandler.mjs +1 -1
  117. package/selection/range.js +8 -8
  118. package/selection/range.mjs +8 -8
  119. package/selection/selection.js +315 -180
  120. package/selection/selection.mjs +310 -179
  121. package/selection/transformation.js +233 -96
  122. package/selection/transformation.mjs +230 -93
  123. package/selection/utils.js +12 -35
  124. package/selection/utils.mjs +13 -35
  125. package/settings.d.ts +1 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  127. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  129. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  130. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  131. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  132. package/shortcutContexts/commands/editor/index.js +16 -0
  133. package/shortcutContexts/commands/editor/index.mjs +12 -0
  134. package/shortcutContexts/commands/editor/open.js +29 -0
  135. package/shortcutContexts/commands/editor/open.mjs +24 -0
  136. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  137. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  139. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  141. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  143. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  145. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  147. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  159. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  160. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  161. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  162. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  163. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  164. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  165. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  166. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  167. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  168. package/shortcutContexts/commands/index.js +51 -0
  169. package/shortcutContexts/commands/index.mjs +47 -0
  170. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  171. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  172. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  173. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  174. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  175. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  176. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  177. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  178. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  179. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  180. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  182. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  183. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  195. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  196. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  197. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  199. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  200. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  201. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  202. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  203. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  204. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  205. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  206. package/shortcutContexts/commands/selectAll.js +11 -0
  207. package/shortcutContexts/commands/selectAll.mjs +6 -0
  208. package/shortcutContexts/constants.js +19 -0
  209. package/shortcutContexts/constants.mjs +12 -0
  210. package/shortcutContexts/editor.js +29 -0
  211. package/shortcutContexts/editor.mjs +25 -0
  212. package/shortcutContexts/grid.js +244 -0
  213. package/shortcutContexts/grid.mjs +240 -0
  214. package/shortcutContexts/index.js +29 -0
  215. package/shortcutContexts/index.mjs +15 -0
  216. package/shortcuts/manager.js +2 -0
  217. package/shortcuts/manager.mjs +2 -0
  218. package/tableView.js +58 -9
  219. package/tableView.mjs +58 -9
  220. package/3rdparty/walkontable/src/selection.js +0 -354
  221. package/3rdparty/walkontable/src/selection.mjs +0 -348
  222. package/selection/highlight/constants.js +0 -16
  223. package/selection/highlight/constants.mjs +0 -6
@@ -1,132 +1,217 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol.iterator.js");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.string.iterator.js");
6
- require("core-js/modules/web.dom-collections.iterator.js");
7
- exports.__esModule = true;
8
- exports.default = void 0;
9
3
  require("core-js/modules/es.symbol.to-primitive.js");
10
4
  require("core-js/modules/es.date.to-primitive.js");
11
5
  require("core-js/modules/es.symbol.js");
12
6
  require("core-js/modules/es.symbol.description.js");
13
- require("core-js/modules/es.object.to-string.js");
14
7
  require("core-js/modules/es.number.constructor.js");
8
+ require("core-js/modules/es.symbol.iterator.js");
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+ exports.__esModule = true;
11
+ exports.default = void 0;
12
+ require("core-js/modules/es.array.iterator.js");
13
+ require("core-js/modules/es.object.to-string.js");
14
+ require("core-js/modules/es.string.iterator.js");
15
+ require("core-js/modules/es.weak-map.js");
16
+ require("core-js/modules/web.dom-collections.iterator.js");
17
+ require("core-js/modules/es.weak-set.js");
15
18
  var _object = require("../helpers/object");
16
19
  var _localHooks = _interopRequireDefault(require("./../mixins/localHooks"));
17
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
19
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
22
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
21
23
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
24
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
25
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
26
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
27
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
28
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
29
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
30
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
31
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
32
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
33
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
34
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
24
35
  /**
25
36
  * The Transformation class implements algorithms for transforming coordinates based on current settings
26
- * passed to the Handsontable.
37
+ * passed to the Handsontable. The class performs the calculations based on the renderable indexes.
27
38
  *
28
39
  * Transformation is always applied relative to the current selection.
29
40
  *
41
+ * The class operates on a table size defined by the renderable indexes. If the `navigableHeaders`
42
+ * option is enabled, the table size is increased by the number of row and/or column headers.
43
+ * Because the headers are treated as cells as part of the table size (indexes always go from 0 to N),
44
+ * the algorithm can be written as simply as possible (without new if's that distinguish the headers
45
+ * logic).
46
+ *
30
47
  * @class Transformation
31
48
  * @util
32
49
  */
50
+ var _range = /*#__PURE__*/new WeakMap();
51
+ var _options = /*#__PURE__*/new WeakMap();
52
+ var _offset = /*#__PURE__*/new WeakMap();
53
+ var _setOffsetSize = /*#__PURE__*/new WeakSet();
54
+ var _clampCoords = /*#__PURE__*/new WeakSet();
55
+ var _getTableSize = /*#__PURE__*/new WeakSet();
56
+ var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
57
+ var _zeroBasedToVisualCoords = /*#__PURE__*/new WeakSet();
33
58
  var Transformation = /*#__PURE__*/function () {
34
59
  function Transformation(range, options) {
35
60
  _classCallCheck(this, Transformation);
61
+ /**
62
+ * Translates the zero-based coordinates to visual ones.
63
+ *
64
+ * @param {CellCoords} zeroBasedCoords The coordinates to process.
65
+ * @returns {CellCoords}
66
+ */
67
+ _classPrivateMethodInitSpec(this, _zeroBasedToVisualCoords);
68
+ /**
69
+ * Translates the visual coordinates to zero-based ones.
70
+ *
71
+ * @param {CellCoords} visualCoords The visual coords to process.
72
+ * @returns {{x: number, y: number}}
73
+ */
74
+ _classPrivateMethodInitSpec(this, _visualToZeroBasedCoords);
75
+ /**
76
+ * Gets the table size in number of rows with headers as "height" and number of columns with
77
+ * headers as "width".
78
+ *
79
+ * @returns {{width: number, height: number}}
80
+ */
81
+ _classPrivateMethodInitSpec(this, _getTableSize);
82
+ /**
83
+ * Clamps the coords to make sure they points to the cell (or header) in the table range.
84
+ *
85
+ * @param {CellCoords} zeroBasedCoords The coords object to clamp.
86
+ * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
87
+ */
88
+ _classPrivateMethodInitSpec(this, _clampCoords);
89
+ /**
90
+ * Sets the additional offset in table size that may occur when the `navigableHeaders` option
91
+ * is enabled.
92
+ *
93
+ * @param {{x: number, y: number}} offset Offset as x and y properties.
94
+ */
95
+ _classPrivateMethodInitSpec(this, _setOffsetSize);
36
96
  /**
37
97
  * Instance of the SelectionRange, holder for visual coordinates applied to the table.
38
98
  *
39
99
  * @type {SelectionRange}
40
100
  */
41
- this.range = range;
101
+ _classPrivateFieldInitSpec(this, _range, {
102
+ writable: true,
103
+ value: void 0
104
+ });
42
105
  /**
43
106
  * Additional options which define the state of the settings which can infer transformation and
44
107
  * give the possibility to translate indexes.
45
108
  *
46
109
  * @type {object}
47
110
  */
48
- this.options = options;
111
+ _classPrivateFieldInitSpec(this, _options, {
112
+ writable: true,
113
+ value: void 0
114
+ });
115
+ /**
116
+ * Increases the table size by applying the offsets. The option is used by the `navigableHeaders`
117
+ * option.
118
+ *
119
+ * @type {{ x: number, y: number }}
120
+ */
121
+ _classPrivateFieldInitSpec(this, _offset, {
122
+ writable: true,
123
+ value: {
124
+ x: 0,
125
+ y: 0
126
+ }
127
+ });
128
+ _classPrivateFieldSet(this, _range, range);
129
+ _classPrivateFieldSet(this, _options, options);
49
130
  }
50
131
 
51
132
  /**
52
- * Selects cell relative to current cell (if possible).
133
+ * Selects cell relative to the current cell (if possible).
53
134
  *
54
135
  * @param {number} rowDelta Rows number to move, value can be passed as negative number.
55
136
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
56
- * @param {boolean} [force=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
137
+ * @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
57
138
  * be created according to `minSpareRows/minSpareCols` settings of Handsontable.
58
139
  * @returns {CellCoords} Visual coordinates after transformation.
59
140
  */
60
141
  _createClass(Transformation, [{
61
142
  key: "transformStart",
62
143
  value: function transformStart(rowDelta, colDelta) {
63
- var force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
64
- var delta = this.options.createCellCoords(rowDelta, colDelta);
65
- var highlightCoords = this.range.current().highlight;
66
- var _this$options$visualT = this.options.visualToRenderableCoords(highlightCoords),
67
- renderableRow = _this$options$visualT.row,
68
- renderableColumn = _this$options$visualT.col;
69
- var visualCoords = highlightCoords;
144
+ var createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
145
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
146
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
147
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
148
+ });
149
+ var delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
150
+ var visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
151
+ var highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
70
152
  var rowTransformDir = 0;
71
153
  var colTransformDir = 0;
72
154
  this.runLocalHooks('beforeTransformStart', delta);
73
- if (renderableRow !== null && renderableColumn !== null) {
74
- var totalRows = this.options.countRows();
75
- var totalCols = this.options.countCols();
76
- var fixedRowsBottom = this.options.fixedRowsBottom();
77
- var minSpareRows = this.options.minSpareRows();
78
- var minSpareCols = this.options.minSpareCols();
79
- var autoWrapRow = this.options.autoWrapRow();
80
- var autoWrapCol = this.options.autoWrapCol();
81
- if (renderableRow + rowDelta > totalRows - 1) {
82
- if (force && minSpareRows > 0 && !(fixedRowsBottom && renderableRow >= totalRows - fixedRowsBottom - 1)) {
83
- this.runLocalHooks('insertRowRequire', totalRows);
84
- totalRows = this.options.countRows();
155
+ if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
156
+ var _classPrivateMethodGe = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this),
157
+ width = _classPrivateMethodGe.width,
158
+ height = _classPrivateMethodGe.height;
159
+ var _classPrivateMethodGe2 = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, visualCoords),
160
+ x = _classPrivateMethodGe2.x,
161
+ y = _classPrivateMethodGe2.y;
162
+ var fixedRowsBottom = _classPrivateFieldGet(this, _options).fixedRowsBottom();
163
+ var minSpareRows = _classPrivateFieldGet(this, _options).minSpareRows();
164
+ var minSpareCols = _classPrivateFieldGet(this, _options).minSpareCols();
165
+ var autoWrapRow = _classPrivateFieldGet(this, _options).autoWrapRow();
166
+ var autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
167
+ var rawCoords = {
168
+ row: y + delta.row,
169
+ col: x + delta.col
170
+ };
171
+ if (rawCoords.row >= height) {
172
+ if (createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0) {
173
+ this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
85
174
  } else if (autoWrapCol) {
86
- delta.row = 1 - totalRows;
87
- delta.col = renderableColumn + delta.col === totalCols - 1 ? 1 - totalCols : 1;
175
+ var nextColumn = rawCoords.col + 1;
176
+ rawCoords.row = rawCoords.row - height;
177
+ rawCoords.col = nextColumn >= width ? nextColumn - width : nextColumn;
178
+ }
179
+ } else if (rawCoords.row < 0) {
180
+ if (autoWrapCol) {
181
+ var previousColumn = rawCoords.col - 1;
182
+ rawCoords.row = height + rawCoords.row;
183
+ rawCoords.col = previousColumn < 0 ? width + previousColumn : previousColumn;
88
184
  }
89
- } else if (autoWrapCol && renderableRow + delta.row < 0 && renderableColumn + delta.col >= 0) {
90
- delta.row = totalRows - 1;
91
- delta.col = renderableColumn + delta.col === 0 ? totalCols - 1 : -1;
92
185
  }
93
- if (renderableColumn + delta.col > totalCols - 1) {
94
- if (force && minSpareCols > 0) {
95
- this.runLocalHooks('insertColRequire', totalCols);
96
- totalCols = this.options.countCols();
186
+ if (rawCoords.col >= width) {
187
+ if (createMissingRecords && minSpareCols > 0) {
188
+ this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
97
189
  } else if (autoWrapRow) {
98
- delta.row = renderableRow + delta.row === totalRows - 1 ? 1 - totalRows : 1;
99
- delta.col = 1 - totalCols;
190
+ var nextRow = rawCoords.row + 1;
191
+ rawCoords.row = nextRow >= height ? nextRow - height : nextRow;
192
+ rawCoords.col = rawCoords.col - width;
193
+ }
194
+ } else if (rawCoords.col < 0) {
195
+ if (autoWrapRow) {
196
+ var previousRow = rawCoords.row - 1;
197
+ rawCoords.row = previousRow < 0 ? height + previousRow : previousRow;
198
+ rawCoords.col = width + rawCoords.col;
100
199
  }
101
- } else if (autoWrapRow && renderableColumn + delta.col < 0 && renderableRow + delta.row >= 0) {
102
- delta.row = renderableRow + delta.row === 0 ? totalRows - 1 : -1;
103
- delta.col = totalCols - 1;
104
- }
105
- var coords = this.options.createCellCoords(renderableRow + delta.row, renderableColumn + delta.col);
106
- rowTransformDir = 0;
107
- colTransformDir = 0;
108
- if (coords.row < 0) {
109
- rowTransformDir = -1;
110
- coords.row = 0;
111
- } else if (coords.row > 0 && coords.row >= totalRows) {
112
- rowTransformDir = 1;
113
- coords.row = totalRows - 1;
114
- }
115
- if (coords.col < 0) {
116
- colTransformDir = -1;
117
- coords.col = 0;
118
- } else if (coords.col > 0 && coords.col >= totalCols) {
119
- colTransformDir = 1;
120
- coords.col = totalCols - 1;
121
200
  }
122
- visualCoords = this.options.renderableToVisualCoords(coords);
201
+ var coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
202
+ var _classPrivateMethodGe3 = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, coords),
203
+ rowDir = _classPrivateMethodGe3.rowDir,
204
+ colDir = _classPrivateMethodGe3.colDir;
205
+ rowTransformDir = rowDir;
206
+ colTransformDir = colDir;
207
+ visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, coords);
123
208
  }
124
209
  this.runLocalHooks('afterTransformStart', visualCoords, rowTransformDir, colTransformDir);
125
210
  return visualCoords;
126
211
  }
127
212
 
128
213
  /**
129
- * Sets selection end cell relative to current selection end cell (if possible).
214
+ * Sets selection end cell relative to the current selection end cell (if possible).
130
215
  *
131
216
  * @param {number} rowDelta Rows number to move, value can be passed as negative number.
132
217
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
@@ -135,41 +220,40 @@ var Transformation = /*#__PURE__*/function () {
135
220
  }, {
136
221
  key: "transformEnd",
137
222
  value: function transformEnd(rowDelta, colDelta) {
138
- var delta = this.options.createCellCoords(rowDelta, colDelta);
139
- var cellRange = this.range.current();
140
- var visualCoords = cellRange.to;
223
+ _classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
224
+ x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
225
+ y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
226
+ });
227
+ var delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
228
+ var cellRange = _classPrivateFieldGet(this, _range).current();
229
+ var highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
230
+ var visualCoords = cellRange.to.clone();
141
231
  var rowTransformDir = 0;
142
232
  var colTransformDir = 0;
143
233
  this.runLocalHooks('beforeTransformEnd', delta);
144
- var _this$options$visualT2 = this.options.visualToRenderableCoords(cellRange.highlight),
145
- rowHighlight = _this$options$visualT2.row,
146
- colHighlight = _this$options$visualT2.col;
147
-
148
- // We have highlight (start point for the selection).
149
- if (rowHighlight !== null && colHighlight !== null) {
150
- var totalRows = this.options.countRows();
151
- var totalCols = this.options.countCols();
152
- var _this$options$visualT3 = this.options.visualToRenderableCoords(cellRange.to),
153
- rowTo = _this$options$visualT3.row,
154
- colTo = _this$options$visualT3.col;
155
- var coords = this.options.createCellCoords(rowTo + delta.row, colTo + delta.col);
156
- rowTransformDir = 0;
157
- colTransformDir = 0;
158
- if (coords.row < 0) {
159
- rowTransformDir = -1;
160
- coords.row = 0;
161
- } else if (coords.row > 0 && coords.row >= totalRows) {
162
- rowTransformDir = 1;
163
- coords.row = totalRows - 1;
164
- }
165
- if (coords.col < 0) {
166
- colTransformDir = -1;
167
- coords.col = 0;
168
- } else if (coords.col > 0 && coords.col >= totalCols) {
169
- colTransformDir = 1;
170
- coords.col = totalCols - 1;
234
+ if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
235
+ var _classPrivateMethodGe4 = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to),
236
+ x = _classPrivateMethodGe4.x,
237
+ y = _classPrivateMethodGe4.y;
238
+ var rawCoords = {
239
+ row: y + delta.row,
240
+ col: x + delta.col
241
+ };
242
+ var coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
243
+ var _classPrivateMethodGe5 = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, coords),
244
+ rowDir = _classPrivateMethodGe5.rowDir,
245
+ colDir = _classPrivateMethodGe5.colDir;
246
+ rowTransformDir = rowDir;
247
+ colTransformDir = colDir;
248
+ var newVisualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, coords);
249
+ if (delta.row === 0 && delta.col !== 0) {
250
+ visualCoords.col = newVisualCoords.col;
251
+ } else if (delta.row !== 0 && delta.col === 0) {
252
+ visualCoords.row = newVisualCoords.row;
253
+ } else {
254
+ visualCoords.row = newVisualCoords.row;
255
+ visualCoords.col = newVisualCoords.col;
171
256
  }
172
- visualCoords = this.options.renderableToVisualCoords(coords);
173
257
  }
174
258
  this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
175
259
  return visualCoords;
@@ -177,6 +261,59 @@ var Transformation = /*#__PURE__*/function () {
177
261
  }]);
178
262
  return Transformation;
179
263
  }();
264
+ function _setOffsetSize2(_ref) {
265
+ var x = _ref.x,
266
+ y = _ref.y;
267
+ _classPrivateFieldSet(this, _offset, {
268
+ x: x,
269
+ y: y
270
+ });
271
+ }
272
+ function _clampCoords2(zeroBasedCoords) {
273
+ var _classPrivateMethodGe6 = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this),
274
+ width = _classPrivateMethodGe6.width,
275
+ height = _classPrivateMethodGe6.height;
276
+ var rowDir = 0;
277
+ var colDir = 0;
278
+ if (zeroBasedCoords.row < 0) {
279
+ rowDir = -1;
280
+ zeroBasedCoords.row = 0;
281
+ } else if (zeroBasedCoords.row > 0 && zeroBasedCoords.row >= height) {
282
+ rowDir = 1;
283
+ zeroBasedCoords.row = height - 1;
284
+ }
285
+ if (zeroBasedCoords.col < 0) {
286
+ colDir = -1;
287
+ zeroBasedCoords.col = 0;
288
+ } else if (zeroBasedCoords.col > 0 && zeroBasedCoords.col >= width) {
289
+ colDir = 1;
290
+ zeroBasedCoords.col = width - 1;
291
+ }
292
+ return {
293
+ rowDir: rowDir,
294
+ colDir: colDir
295
+ };
296
+ }
297
+ function _getTableSize2() {
298
+ return {
299
+ width: _classPrivateFieldGet(this, _offset).x + _classPrivateFieldGet(this, _options).countRenderableColumns(),
300
+ height: _classPrivateFieldGet(this, _offset).y + _classPrivateFieldGet(this, _options).countRenderableRows()
301
+ };
302
+ }
303
+ function _visualToZeroBasedCoords2(visualCoords) {
304
+ var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords),
305
+ row = _classPrivateFieldGet2.row,
306
+ col = _classPrivateFieldGet2.col;
307
+ return {
308
+ x: _classPrivateFieldGet(this, _offset).x + col,
309
+ y: _classPrivateFieldGet(this, _offset).y + row
310
+ };
311
+ }
312
+ function _zeroBasedToVisualCoords2(zeroBasedCoords) {
313
+ zeroBasedCoords.col = zeroBasedCoords.col - _classPrivateFieldGet(this, _offset).x;
314
+ zeroBasedCoords.row = zeroBasedCoords.row - _classPrivateFieldGet(this, _offset).y;
315
+ return _classPrivateFieldGet(this, _options).renderableToVisualCoords(zeroBasedCoords);
316
+ }
180
317
  (0, _object.mixin)(Transformation, _localHooks.default);
181
318
  var _default = Transformation;
182
319
  exports.default = _default;