handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-834f47e-20230509

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 (227) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.js +13 -40
  4. package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
  5. package/3rdparty/walkontable/src/cell/range.js +25 -29
  6. package/3rdparty/walkontable/src/cell/range.mjs +24 -28
  7. package/3rdparty/walkontable/src/core/_base.js +3 -9
  8. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  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 +2 -3
  12. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  13. package/3rdparty/walkontable/src/event.js +10 -12
  14. package/3rdparty/walkontable/src/event.mjs +10 -12
  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 +2 -10
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +7 -8
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
  21. package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
  22. package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +10 -9
  26. package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
  27. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
  28. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
  29. package/3rdparty/walkontable/src/overlays.js +55 -64
  30. package/3rdparty/walkontable/src/overlays.mjs +55 -64
  31. package/3rdparty/walkontable/src/renderer/table.js +0 -2
  32. package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
  33. package/3rdparty/walkontable/src/scroll.js +20 -23
  34. package/3rdparty/walkontable/src/scroll.mjs +20 -23
  35. package/3rdparty/walkontable/src/selection.js +354 -0
  36. package/3rdparty/walkontable/src/selection.mjs +348 -0
  37. package/3rdparty/walkontable/src/settings.js +13 -15
  38. package/3rdparty/walkontable/src/settings.mjs +13 -15
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  49. package/3rdparty/walkontable/src/table.js +101 -33
  50. package/3rdparty/walkontable/src/table.mjs +102 -34
  51. package/base.js +2 -4
  52. package/base.mjs +2 -2
  53. package/core.d.ts +0 -4
  54. package/core.js +19 -52
  55. package/core.mjs +19 -52
  56. package/dataMap/dataSource.js +5 -5
  57. package/dataMap/dataSource.mjs +5 -5
  58. package/dataMap/metaManager/metaSchema.js +1 -8
  59. package/dataMap/metaManager/metaSchema.mjs +1 -8
  60. package/dist/handsontable.css +2 -7
  61. package/dist/handsontable.full.css +2 -7
  62. package/dist/handsontable.full.js +9162 -9474
  63. package/dist/handsontable.full.min.css +3 -3
  64. package/dist/handsontable.full.min.js +123 -115
  65. package/dist/handsontable.js +8763 -9076
  66. package/dist/handsontable.min.css +3 -3
  67. package/dist/handsontable.min.js +11 -3
  68. package/dist/languages/all.js +133 -0
  69. package/dist/languages/ar-AR.js +7 -0
  70. package/dist/languages/cs-CZ.js +7 -0
  71. package/dist/languages/de-CH.js +7 -0
  72. package/dist/languages/de-DE.js +7 -0
  73. package/dist/languages/en-US.js +7 -0
  74. package/dist/languages/es-MX.js +7 -0
  75. package/dist/languages/fr-FR.js +7 -0
  76. package/dist/languages/it-IT.js +7 -0
  77. package/dist/languages/ja-JP.js +7 -0
  78. package/dist/languages/ko-KR.js +7 -0
  79. package/dist/languages/lv-LV.js +7 -0
  80. package/dist/languages/nb-NO.js +7 -0
  81. package/dist/languages/nl-NL.js +7 -0
  82. package/dist/languages/pl-PL.js +7 -0
  83. package/dist/languages/pt-BR.js +7 -0
  84. package/dist/languages/ru-RU.js +7 -0
  85. package/dist/languages/sr-SP.js +7 -0
  86. package/dist/languages/zh-CN.js +7 -0
  87. package/dist/languages/zh-TW.js +7 -0
  88. package/editorManager.js +3 -7
  89. package/editorManager.mjs +3 -7
  90. package/editors/textEditor/textEditor.js +16 -3
  91. package/editors/textEditor/textEditor.mjs +17 -4
  92. package/helpers/dom/element.js +0 -11
  93. package/helpers/dom/element.mjs +0 -10
  94. package/helpers/mixed.js +1 -1
  95. package/helpers/mixed.mjs +1 -1
  96. package/i18n/languages/ar-AR.js +7 -1
  97. package/i18n/languages/cs-CZ.js +7 -1
  98. package/i18n/languages/de-CH.js +7 -1
  99. package/i18n/languages/de-DE.js +7 -1
  100. package/i18n/languages/en-US.js +7 -1
  101. package/i18n/languages/es-MX.js +7 -1
  102. package/i18n/languages/fr-FR.js +7 -1
  103. package/i18n/languages/it-IT.js +7 -1
  104. package/i18n/languages/ja-JP.js +7 -1
  105. package/i18n/languages/ko-KR.js +7 -1
  106. package/i18n/languages/lv-LV.js +7 -1
  107. package/i18n/languages/nb-NO.js +7 -1
  108. package/i18n/languages/nl-NL.js +7 -1
  109. package/i18n/languages/pl-PL.js +7 -1
  110. package/i18n/languages/pt-BR.js +7 -1
  111. package/i18n/languages/ru-RU.js +7 -1
  112. package/i18n/languages/sr-SP.js +7 -1
  113. package/i18n/languages/zh-CN.js +7 -1
  114. package/i18n/languages/zh-TW.js +7 -1
  115. package/languages/all.js +133 -0
  116. package/languages/ar-AR.js +7 -0
  117. package/languages/cs-CZ.js +7 -0
  118. package/languages/de-CH.js +7 -0
  119. package/languages/de-DE.js +7 -0
  120. package/languages/en-US.js +7 -0
  121. package/languages/es-MX.js +7 -0
  122. package/languages/fr-FR.js +7 -0
  123. package/languages/index.js +133 -0
  124. package/languages/it-IT.js +7 -0
  125. package/languages/ja-JP.js +7 -0
  126. package/languages/ko-KR.js +7 -0
  127. package/languages/lv-LV.js +7 -0
  128. package/languages/nb-NO.js +7 -0
  129. package/languages/nl-NL.js +7 -0
  130. package/languages/pl-PL.js +7 -0
  131. package/languages/pt-BR.js +7 -0
  132. package/languages/ru-RU.js +7 -0
  133. package/languages/sr-SP.js +7 -0
  134. package/languages/zh-CN.js +7 -0
  135. package/languages/zh-TW.js +7 -0
  136. package/package.json +3 -2
  137. package/pluginHooks.js +17 -7
  138. package/pluginHooks.mjs +16 -4
  139. package/plugins/autoRowSize/autoRowSize.js +2 -2
  140. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  141. package/plugins/copyPaste/copyPaste.js +93 -12
  142. package/plugins/copyPaste/copyPaste.mjs +93 -12
  143. package/plugins/copyPaste/copyableRanges.js +25 -31
  144. package/plugins/copyPaste/copyableRanges.mjs +18 -24
  145. package/plugins/copyPaste/focusableElement.js +219 -0
  146. package/plugins/copyPaste/focusableElement.mjs +213 -0
  147. package/plugins/customBorders/customBorders.js +2 -6
  148. package/plugins/customBorders/customBorders.mjs +3 -7
  149. package/plugins/filters/filters.js +5 -0
  150. package/plugins/filters/filters.mjs +5 -0
  151. package/plugins/formulas/formulas.js +190 -168
  152. package/plugins/formulas/formulas.mjs +190 -168
  153. package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
  154. package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
  155. package/plugins/formulas/indexSyncer/index.js +225 -0
  156. package/plugins/formulas/indexSyncer/index.mjs +219 -0
  157. package/plugins/mergeCells/mergeCells.js +16 -0
  158. package/plugins/mergeCells/mergeCells.mjs +16 -0
  159. package/plugins/nestedHeaders/nestedHeaders.js +4 -3
  160. package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
  161. package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
  162. package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
  163. package/plugins/nestedHeaders/stateManager/index.js +3 -3
  164. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
  165. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
  166. package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
  167. package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
  168. package/plugins/registry.js +3 -1
  169. package/plugins/undoRedo/undoRedo.js +0 -1
  170. package/plugins/undoRedo/undoRedo.mjs +0 -1
  171. package/renderers/baseRenderer/baseRenderer.js +0 -3
  172. package/renderers/baseRenderer/baseRenderer.mjs +0 -3
  173. package/selection/highlight/constants.js +16 -0
  174. package/selection/highlight/constants.mjs +6 -0
  175. package/selection/highlight/highlight.js +133 -335
  176. package/selection/highlight/highlight.mjs +129 -325
  177. package/selection/highlight/types/activeHeader.js +9 -10
  178. package/selection/highlight/types/activeHeader.mjs +8 -10
  179. package/selection/highlight/types/area.js +27 -12
  180. package/selection/highlight/types/area.mjs +30 -16
  181. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  182. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  183. package/selection/highlight/types/customSelection.js +10 -7
  184. package/selection/highlight/types/customSelection.mjs +9 -7
  185. package/selection/highlight/types/fill.js +8 -5
  186. package/selection/highlight/types/fill.mjs +7 -5
  187. package/selection/highlight/types/header.js +20 -10
  188. package/selection/highlight/types/header.mjs +19 -10
  189. package/selection/highlight/types/{row.js → index.js} +31 -27
  190. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  191. package/selection/highlight/visualSelection.js +21 -12
  192. package/selection/highlight/visualSelection.mjs +21 -12
  193. package/selection/index.js +7 -4
  194. package/selection/index.mjs +3 -2
  195. package/selection/selection.js +46 -88
  196. package/selection/selection.mjs +44 -82
  197. package/settings.d.ts +0 -1
  198. package/tableView.js +66 -94
  199. package/tableView.mjs +66 -94
  200. package/translations/changesObservable/observable.js +41 -46
  201. package/translations/changesObservable/observable.mjs +36 -41
  202. package/translations/changesObservable/observer.js +1 -1
  203. package/translations/indexMapper.js +21 -0
  204. package/translations/indexMapper.mjs +21 -0
  205. package/utils/dataStructures/tree.js +15 -18
  206. package/utils/dataStructures/tree.mjs +15 -18
  207. package/utils/parseTable.js +5 -1
  208. package/utils/parseTable.mjs +5 -1
  209. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  210. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  211. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  212. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  213. package/3rdparty/walkontable/src/selection/index.js +0 -30
  214. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  215. package/3rdparty/walkontable/src/selection/manager.js +0 -334
  216. package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
  217. package/3rdparty/walkontable/src/selection/scanner.js +0 -363
  218. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
  219. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  220. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  221. package/focusManager.d.ts +0 -12
  222. package/focusManager.js +0 -249
  223. package/focusManager.mjs +0 -245
  224. package/selection/highlight/types/areaLayered.js +0 -54
  225. package/selection/highlight/types/areaLayered.mjs +0 -49
  226. package/selection/highlight/types/column.js +0 -50
  227. package/selection/highlight/types/column.mjs +0 -45
@@ -14,9 +14,6 @@ require("core-js/modules/es.symbol.iterator.js");
14
14
  require("core-js/modules/es.function.name.js");
15
15
  require("core-js/modules/es.array.from.js");
16
16
  require("core-js/modules/es.regexp.exec.js");
17
- require("core-js/modules/es.object.keys.js");
18
- require("core-js/modules/es.array.filter.js");
19
- require("core-js/modules/es.object.get-own-property-descriptors.js");
20
17
  exports.__esModule = true;
21
18
  exports.SETTING_KEYS = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
22
19
  require("core-js/modules/es.array.concat.js");
@@ -45,13 +42,12 @@ var _settings = require("./engine/settings");
45
42
  var _data = require("../../helpers/data");
46
43
  var _string = require("../../helpers/string");
47
44
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
45
+ var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
48
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
47
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
50
48
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
51
49
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
52
50
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
53
- 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; }
54
- 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; }
55
51
  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); }
56
52
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
57
53
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -87,7 +83,6 @@ var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
87
83
  exports.SETTING_KEYS = SETTING_KEYS;
88
84
  var PLUGIN_PRIORITY = 260;
89
85
  exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
90
- var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
91
86
  _pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
92
87
  _pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
93
88
  _pluginHooks.default.getSingleton().register('afterSheetAdded');
@@ -193,6 +188,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
193
188
  * @type {string|null}
194
189
  */
195
190
  _defineProperty(_assertThisInitialized(_this), "sheetName", null);
191
+ /**
192
+ * Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
193
+ *
194
+ * @type {IndexSyncer|null}
195
+ */
196
+ _defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
197
+ /**
198
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
199
+ *
200
+ * @type {AxisSyncer|null}
201
+ */
202
+ _defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
203
+ /**
204
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
205
+ *
206
+ * @type {AxisSyncer|null}
207
+ */
208
+ _defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
196
209
  return _this;
197
210
  }
198
211
  _createClass(Formulas, [{
@@ -300,6 +313,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
300
313
  this.addHook('afterRemoveCol', function () {
301
314
  return _this8.onAfterRemoveCol.apply(_this8, arguments);
302
315
  });
316
+ this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
317
+ _this8.hot.addHookOnce('init', function () {
318
+ // Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
319
+ // be postponed.
320
+ postponedAction();
321
+ });
322
+ });
323
+ this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
324
+ this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
325
+ this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
326
+ this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
327
+ this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
328
+ _this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
329
+ });
330
+ this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
331
+ _this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
332
+ });
333
+ this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
334
+ _this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
335
+ });
336
+ this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
337
+ _this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
338
+ });
339
+ this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
340
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
341
+ });
342
+ this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
343
+ _this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
344
+ });
345
+ this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
346
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
347
+ });
348
+ this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
349
+ _this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
350
+ });
303
351
 
304
352
  // TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
305
353
  // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
@@ -309,22 +357,22 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
309
357
  });
310
358
 
311
359
  // Handling undo actions on data just using HyperFormula's UndoRedo mechanism
312
- this.addHook('beforeUndo', function (action) {
313
- // TODO: Move action isn't handled by HyperFormula.
314
- if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
315
- return;
316
- }
360
+ this.addHook('beforeUndo', function () {
361
+ _this8.indexSyncer.setPerformUndo(true);
317
362
  _this8.engine.undo();
318
363
  });
319
364
 
320
365
  // Handling redo actions on data just using HyperFormula's UndoRedo mechanism
321
- this.addHook('beforeRedo', function (action) {
322
- // TODO: Move action isn't handled by HyperFormula.
323
- if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
324
- return;
325
- }
366
+ this.addHook('beforeRedo', function () {
367
+ _this8.indexSyncer.setPerformRedo(true);
326
368
  _this8.engine.redo();
327
369
  });
370
+ this.addHook('afterUndo', function () {
371
+ _this8.indexSyncer.setPerformUndo(false);
372
+ });
373
+ this.addHook('afterUndo', function () {
374
+ _this8.indexSyncer.setPerformRedo(false);
375
+ });
328
376
  this.addHook('afterDetachChild', function () {
329
377
  return _this8.onAfterDetachChild.apply(_this8, arguments);
330
378
  });
@@ -409,63 +457,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
409
457
  _get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
410
458
  }
411
459
 
412
- /**
413
- * Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
414
- *
415
- * @private
416
- * @param {number} visualIndex Visual entry index.
417
- * @param {number} physicalIndex Physical entry index.
418
- * @param {number} entriesCount Visual entries count.
419
- * @param {number} sourceEntriesCount Source entries count.
420
- * @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
421
- * `toPhysical` alias.
422
- * @returns {*}
423
- */
424
- }, {
425
- key: "getPhysicalIndexPosition",
426
- value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
427
- if (!contained) {
428
- if (visualIndex >= entriesCount) {
429
- return sourceEntriesCount + (visualIndex - entriesCount);
430
- }
431
- }
432
- return physicalIndex;
433
- }
434
-
435
- /**
436
- * Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
437
- * `null` on rows with indexes higher than the number of rows.
438
- *
439
- * @private
440
- * @param {number} row Visual row index.
441
- * @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
442
- * `toPhysical` alias.
443
- * @returns {number} The physical row index.
444
- */
445
- }, {
446
- key: "toPhysicalRowPosition",
447
- value: function toPhysicalRowPosition(row) {
448
- var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
449
- return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
450
- }
451
-
452
- /**
453
- * Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
454
- * `null` on columns with indexes higher than the number of columns.
455
- *
456
- * @private
457
- * @param {number} column Visual column index.
458
- * @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
459
- * `toPhysical` alias.
460
- * @returns {number} The physical column index.
461
- */
462
- }, {
463
- key: "toPhysicalColumnPosition",
464
- value: function toPhysicalColumnPosition(column) {
465
- var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
466
- return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
467
- }
468
-
469
460
  /**
470
461
  * Add a sheet to the shared HyperFormula instance.
471
462
  *
@@ -536,8 +527,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
536
527
  if (physicalRow !== null && physicalColumn !== null) {
537
528
  return this.engine.getCellType({
538
529
  sheet: sheet,
539
- row: physicalRow,
540
- col: physicalColumn
530
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
531
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
541
532
  });
542
533
  } else {
543
534
  // Should return `EMPTY` when out of bounds (according to the test cases).
@@ -557,15 +548,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
557
548
  key: "isFormulaCellType",
558
549
  value: function isFormulaCellType(row, column) {
559
550
  var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
560
- var physicalRow = this.hot.toPhysicalRow(row);
561
- var physicalColumn = this.hot.toPhysicalColumn(column);
562
- if (physicalRow === null || physicalColumn === null) {
563
- return false;
564
- }
565
551
  return this.engine.doesCellHaveFormula({
566
552
  sheet: sheet,
567
- row: physicalRow,
568
- col: physicalColumn
553
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
554
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
569
555
  });
570
556
  }
571
557
 
@@ -630,11 +616,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
630
616
  var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
631
617
  row = _ref8.row,
632
618
  col = _ref8.col;
633
- var visualRow = (0, _mixed.isDefined)(row) ? _this12.hot.toVisualRow(row) : null;
634
- var visualColumn = (0, _mixed.isDefined)(col) ? _this12.hot.toVisualColumn(col) : null;
635
619
 
636
620
  // Don't try to validate cells outside of the visual part of the table.
637
- if (visualRow === null || visualColumn === null) {
621
+ if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
638
622
  return;
639
623
  }
640
624
 
@@ -653,7 +637,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
653
637
  }
654
638
 
655
639
  // It will just re-render certain cell when necessary.
656
- boundHot.validateCell(boundHot.getDataAtCell(visualRow, visualColumn), boundHot.getCellMeta(visualRow, visualColumn), function () {});
640
+ boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
657
641
  }
658
642
  });
659
643
  }
@@ -671,8 +655,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
671
655
  key: "syncChangeWithEngine",
672
656
  value: function syncChangeWithEngine(row, column, newValue) {
673
657
  var address = {
674
- row: this.toPhysicalRowPosition(row),
675
- col: this.toPhysicalColumnPosition(column),
658
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
659
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
676
660
  sheet: this.sheetId
677
661
  };
678
662
  if (!this.engine.isItPossibleToSetCellContents(address)) {
@@ -708,8 +692,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
708
692
  var visualColumn = this.hot.propToCol(prop);
709
693
  if (this.isFormulaCellType(visualRow, visualColumn)) {
710
694
  var address = {
711
- row: this.hot.toPhysicalRow(visualRow),
712
- col: this.hot.toPhysicalColumn(visualColumn),
695
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
696
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
713
697
  sheet: this.sheetId
714
698
  };
715
699
  var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
@@ -738,19 +722,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
738
722
  }, {
739
723
  key: "onBeforeAutofill",
740
724
  value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
741
- var _this13 = this;
742
- var withSheetId = function withSheetId(range) {
743
- return _objectSpread(_objectSpread({}, range), {}, {
744
- sheet: _this13.sheetId
745
- });
746
- };
725
+ var _sourceRange$getTopSt = sourceRange.getTopStartCorner(),
726
+ sourceTopStartRow = _sourceRange$getTopSt.row,
727
+ sourceTopStartColumn = _sourceRange$getTopSt.col;
728
+ var _sourceRange$getBotto = sourceRange.getBottomEndCorner(),
729
+ sourceBottomEndRow = _sourceRange$getBotto.row,
730
+ sourceBottomEndColumn = _sourceRange$getBotto.col;
731
+ var _targetRange$getTopSt = targetRange.getTopStartCorner(),
732
+ targetTopStartRow = _targetRange$getTopSt.row,
733
+ targetTopStartColumn = _targetRange$getTopSt.col;
734
+ var _targetRange$getBotto = targetRange.getBottomEndCorner(),
735
+ targetBottomEndRow = _targetRange$getBotto.row,
736
+ targetBottomEndColumn = _targetRange$getBotto.col;
747
737
  var engineSourceRange = {
748
- start: withSheetId(sourceRange.getTopStartCorner()),
749
- end: withSheetId(sourceRange.getBottomEndCorner())
738
+ start: {
739
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
740
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
741
+ sheet: this.sheetId
742
+ },
743
+ end: {
744
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
745
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
746
+ sheet: this.sheetId
747
+ }
750
748
  };
751
749
  var engineTargetRange = {
752
- start: withSheetId(targetRange.getTopStartCorner()),
753
- end: withSheetId(targetRange.getBottomEndCorner())
750
+ start: {
751
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
752
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
753
+ sheet: this.sheetId
754
+ },
755
+ end: {
756
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
757
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
758
+ sheet: this.sheetId
759
+ }
754
760
  };
755
761
 
756
762
  // Blocks the autofill operation if HyperFormula says that at least one of
@@ -816,19 +822,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
816
822
  }, {
817
823
  key: "onAfterCellMetaReset",
818
824
  value: function onAfterCellMetaReset() {
819
- var _this14 = this;
825
+ var _this13 = this;
820
826
  var sourceDataArray = this.hot.getSourceDataArray();
821
827
  var valueChanged = false;
822
828
  sourceDataArray.forEach(function (rowData, rowIndex) {
823
829
  rowData.forEach(function (cellValue, columnIndex) {
824
- var cellMeta = _this14.hot.getCellMeta(rowIndex, columnIndex);
830
+ var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
825
831
  var dateFormat = cellMeta.dateFormat;
826
832
  if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
827
833
  valueChanged = true;
828
834
  if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
829
835
  // Rewriting date in HOT format to HF format.
830
836
  sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
831
- } else if (_this14.isFormulaCellType(rowIndex, columnIndex) === false) {
837
+ } else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
832
838
  // Escaping value from date parsing using "'" sign (HF feature).
833
839
  sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
834
840
  }
@@ -863,6 +869,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
863
869
  if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
864
870
  _classPrivateFieldSet(this, _internalOperationPending, true);
865
871
  var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
872
+ this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
866
873
  this.renderDependentSheets(dependentCells);
867
874
  _classPrivateFieldSet(this, _internalOperationPending, false);
868
875
  }
@@ -875,24 +882,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
875
882
  * `modifyData` hook callback.
876
883
  *
877
884
  * @private
878
- * @param {number} row Physical row height.
879
- * @param {number} column Physical column index.
885
+ * @param {number} physicalRow Physical row index.
886
+ * @param {number} visualColumn Visual column index.
880
887
  * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
881
888
  * property.
882
889
  * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
883
890
  */
884
891
  }, {
885
892
  key: "onModifyData",
886
- value: function onModifyData(row, column, valueHolder, ioMode) {
893
+ value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
887
894
  if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
888
895
  return;
889
896
  }
890
- var visualRow = this.hot.toVisualRow(row);
897
+ var visualRow = this.hot.toVisualRow(physicalRow);
898
+ if (visualRow === null || visualColumn === null) {
899
+ return;
900
+ }
891
901
 
892
902
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
893
- var isFormulaCellType = this.isFormulaCellType(visualRow, column);
903
+ var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
894
904
  if (!isFormulaCellType) {
895
- var cellType = this.getCellType(visualRow, column);
905
+ var cellType = this.getCellType(visualRow, visualColumn);
896
906
  if (cellType !== 'ARRAY') {
897
907
  if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
898
908
  valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
@@ -900,15 +910,13 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
900
910
  return;
901
911
  }
902
912
  }
903
-
904
- // `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
905
913
  var address = {
906
- row: row,
907
- col: this.toPhysicalColumnPosition(column),
914
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
915
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
908
916
  sheet: this.sheetId
909
917
  };
910
918
  var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
911
- var cellMeta = this.hot.getCellMeta(row, column);
919
+ var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
912
920
  if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
913
921
  cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
914
922
  }
@@ -936,6 +944,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
936
944
  }
937
945
  var visualRow = this.hot.toVisualRow(row);
938
946
  var visualColumn = this.hot.propToCol(columnOrProp);
947
+ if (visualRow === null || visualColumn === null) {
948
+ return;
949
+ }
939
950
 
940
951
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
941
952
  var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
@@ -955,9 +966,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
955
966
  return;
956
967
  }
957
968
  var address = {
958
- row: row,
959
- // Workaround for inconsistencies in `src/dataSource.js`
960
- col: this.toPhysicalColumnPosition(visualColumn),
969
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
970
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
961
971
  sheet: this.sheetId
962
972
  };
963
973
  valueHolder.value = this.engine.getCellSerialized(address);
@@ -974,7 +984,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
974
984
  }, {
975
985
  key: "onAfterSetDataAtCell",
976
986
  value: function onAfterSetDataAtCell(changes, source) {
977
- var _this15 = this;
987
+ var _this14 = this;
978
988
  if (isBlockedSource(source)) {
979
989
  return;
980
990
  }
@@ -983,21 +993,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
983
993
  var dependentCells = this.engine.batch(function () {
984
994
  changes.forEach(function (_ref9) {
985
995
  var _ref10 = _slicedToArray(_ref9, 4),
986
- row = _ref10[0],
996
+ visualRow = _ref10[0],
987
997
  prop = _ref10[1],
988
998
  newValue = _ref10[3];
989
- var column = _this15.hot.propToCol(prop);
990
- var physicalRow = _this15.hot.toPhysicalRow(row);
991
- var physicalColumn = _this15.hot.toPhysicalColumn(column);
999
+ var visualColumn = _this14.hot.propToCol(prop);
1000
+ var physicalRow = _this14.hot.toPhysicalRow(visualRow);
1001
+ var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
992
1002
  var address = {
993
- row: physicalRow,
994
- col: physicalColumn,
995
- sheet: _this15.sheetId
1003
+ row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1004
+ col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1005
+ sheet: _this14.sheetId
996
1006
  };
997
1007
  if (physicalRow !== null && physicalColumn !== null) {
998
- _this15.syncChangeWithEngine(row, column, newValue);
1008
+ _this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
999
1009
  } else {
1000
- outOfBoundsChanges.push([row, column, newValue]);
1010
+ outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
1001
1011
  }
1002
1012
  changedCells.push({
1003
1013
  address: address
@@ -1008,16 +1018,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1008
1018
  // Workaround for rows/columns being created two times (by HOT and the engine).
1009
1019
  // (unfortunately, this requires an extra re-render)
1010
1020
  this.hot.addHookOnce('afterChange', function () {
1011
- var outOfBoundsDependentCells = _this15.engine.batch(function () {
1021
+ var outOfBoundsDependentCells = _this14.engine.batch(function () {
1012
1022
  outOfBoundsChanges.forEach(function (_ref11) {
1013
1023
  var _ref12 = _slicedToArray(_ref11, 3),
1014
1024
  row = _ref12[0],
1015
1025
  column = _ref12[1],
1016
1026
  newValue = _ref12[2];
1017
- _this15.syncChangeWithEngine(row, column, newValue);
1027
+ _this14.syncChangeWithEngine(row, column, newValue);
1018
1028
  });
1019
1029
  });
1020
- _this15.renderDependentSheets(outOfBoundsDependentCells, true);
1030
+ _this14.renderDependentSheets(outOfBoundsDependentCells, true);
1021
1031
  });
1022
1032
  }
1023
1033
  this.renderDependentSheets(dependentCells);
@@ -1035,7 +1045,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1035
1045
  }, {
1036
1046
  key: "onAfterSetSourceDataAtCell",
1037
1047
  value: function onAfterSetSourceDataAtCell(changes, source) {
1038
- var _this16 = this;
1048
+ var _this15 = this;
1039
1049
  if (isBlockedSource(source)) {
1040
1050
  return;
1041
1051
  }
@@ -1043,26 +1053,26 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1043
1053
  var changedCells = [];
1044
1054
  changes.forEach(function (_ref13) {
1045
1055
  var _ref14 = _slicedToArray(_ref13, 4),
1046
- row = _ref14[0],
1056
+ visualRow = _ref14[0],
1047
1057
  prop = _ref14[1],
1048
1058
  newValue = _ref14[3];
1049
- var column = _this16.hot.propToCol(prop);
1050
- if (!(0, _number.isNumeric)(column)) {
1059
+ var visualColumn = _this15.hot.propToCol(prop);
1060
+ if (!(0, _number.isNumeric)(visualColumn)) {
1051
1061
  return;
1052
1062
  }
1053
1063
  var address = {
1054
- row: row,
1055
- col: _this16.toPhysicalColumnPosition(column),
1056
- sheet: _this16.sheetId
1064
+ row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1065
+ col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1066
+ sheet: _this15.sheetId
1057
1067
  };
1058
- if (!_this16.engine.isItPossibleToSetCellContents(address)) {
1068
+ if (!_this15.engine.isItPossibleToSetCellContents(address)) {
1059
1069
  (0, _console.warn)("Not possible to set source cell data at ".concat(JSON.stringify(address)));
1060
1070
  return;
1061
1071
  }
1062
1072
  changedCells.push({
1063
1073
  address: address
1064
1074
  });
1065
- dependentCells.push.apply(dependentCells, _toConsumableArray(_this16.engine.setCellContents(address, newValue)));
1075
+ dependentCells.push.apply(dependentCells, _toConsumableArray(_this15.engine.setCellContents(address, newValue)));
1066
1076
  });
1067
1077
  this.renderDependentSheets(dependentCells);
1068
1078
  this.validateDependentCells(dependentCells, changedCells);
@@ -1072,14 +1082,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1072
1082
  * `beforeCreateRow` hook callback.
1073
1083
  *
1074
1084
  * @private
1075
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1085
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1076
1086
  * @param {number} amount Number of newly created rows in the data source array.
1077
1087
  * @returns {*|boolean} If false is returned the action is canceled.
1078
1088
  */
1079
1089
  }, {
1080
1090
  key: "onBeforeCreateRow",
1081
- value: function onBeforeCreateRow(row, amount) {
1082
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [this.toPhysicalRowPosition(row), amount])) {
1091
+ value: function onBeforeCreateRow(visualRow, amount) {
1092
+ var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
1093
+ if (visualRow >= this.hot.countRows()) {
1094
+ hfRowIndex = visualRow; // Row beyond the table boundaries.
1095
+ }
1096
+
1097
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
1083
1098
  return false;
1084
1099
  }
1085
1100
  }
@@ -1088,14 +1103,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1088
1103
  * `beforeCreateCol` hook callback.
1089
1104
  *
1090
1105
  * @private
1091
- * @param {number} col Represents the visual index of first newly created column in the data source.
1106
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1092
1107
  * @param {number} amount Number of newly created columns in the data source.
1093
1108
  * @returns {*|boolean} If false is returned the action is canceled.
1094
1109
  */
1095
1110
  }, {
1096
1111
  key: "onBeforeCreateCol",
1097
- value: function onBeforeCreateCol(col, amount) {
1098
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount])) {
1112
+ value: function onBeforeCreateCol(visualColumn, amount) {
1113
+ var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
1114
+ if (visualColumn >= this.hot.countCols()) {
1115
+ hfColumnIndex = visualColumn; // Column beyond the table boundaries.
1116
+ }
1117
+
1118
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
1099
1119
  return false;
1100
1120
  }
1101
1121
  }
@@ -1112,9 +1132,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1112
1132
  }, {
1113
1133
  key: "onBeforeRemoveRow",
1114
1134
  value: function onBeforeRemoveRow(row, amount, physicalRows) {
1115
- var _this17 = this;
1116
- var possible = physicalRows.every(function (physicalRow) {
1117
- return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
1135
+ var _this16 = this;
1136
+ var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
1137
+ var possible = hfRows.every(function (hfRow) {
1138
+ return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
1118
1139
  });
1119
1140
  return possible === false ? false : void 0;
1120
1141
  }
@@ -1131,9 +1152,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1131
1152
  }, {
1132
1153
  key: "onBeforeRemoveCol",
1133
1154
  value: function onBeforeRemoveCol(col, amount, physicalColumns) {
1134
- var _this18 = this;
1135
- var possible = physicalColumns.every(function (physicalColumn) {
1136
- return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
1155
+ var _this17 = this;
1156
+ var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
1157
+ var possible = hfColumns.every(function (hfColumn) {
1158
+ return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
1137
1159
  });
1138
1160
  return possible === false ? false : void 0;
1139
1161
  }
@@ -1142,18 +1164,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1142
1164
  * `afterCreateRow` hook callback.
1143
1165
  *
1144
1166
  * @private
1145
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1167
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1146
1168
  * @param {number} amount Number of newly created rows in the data source array.
1147
1169
  * @param {string} [source] String that identifies source of hook call
1148
1170
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1149
1171
  */
1150
1172
  }, {
1151
1173
  key: "onAfterCreateRow",
1152
- value: function onAfterCreateRow(row, amount, source) {
1174
+ value: function onAfterCreateRow(visualRow, amount, source) {
1153
1175
  if (isBlockedSource(source)) {
1154
1176
  return;
1155
1177
  }
1156
- var changes = this.engine.addRows(this.sheetId, [this.toPhysicalRowPosition(row), amount]);
1178
+ var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1157
1179
  this.renderDependentSheets(changes);
1158
1180
  }
1159
1181
 
@@ -1161,18 +1183,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1161
1183
  * `afterCreateCol` hook callback.
1162
1184
  *
1163
1185
  * @private
1164
- * @param {number} col Represents the visual index of first newly created column in the data source.
1186
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1165
1187
  * @param {number} amount Number of newly created columns in the data source.
1166
1188
  * @param {string} [source] String that identifies source of hook call
1167
1189
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1168
1190
  */
1169
1191
  }, {
1170
1192
  key: "onAfterCreateCol",
1171
- value: function onAfterCreateCol(col, amount, source) {
1193
+ value: function onAfterCreateCol(visualColumn, amount, source) {
1172
1194
  if (isBlockedSource(source)) {
1173
1195
  return;
1174
1196
  }
1175
- var changes = this.engine.addColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount]);
1197
+ var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1176
1198
  this.renderDependentSheets(changes);
1177
1199
  }
1178
1200
 
@@ -1189,14 +1211,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1189
1211
  }, {
1190
1212
  key: "onAfterRemoveRow",
1191
1213
  value: function onAfterRemoveRow(row, amount, physicalRows, source) {
1192
- var _this19 = this;
1214
+ var _this18 = this;
1193
1215
  if (isBlockedSource(source)) {
1194
1216
  return;
1195
1217
  }
1196
- var descendingPhysicalRows = physicalRows.sort().reverse();
1218
+ var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1197
1219
  var changes = this.engine.batch(function () {
1198
- descendingPhysicalRows.forEach(function (physicalRow) {
1199
- _this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
1220
+ descendingHfRows.forEach(function (hfRow) {
1221
+ _this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
1200
1222
  });
1201
1223
  });
1202
1224
  this.renderDependentSheets(changes);
@@ -1215,14 +1237,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1215
1237
  }, {
1216
1238
  key: "onAfterRemoveCol",
1217
1239
  value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
1218
- var _this20 = this;
1240
+ var _this19 = this;
1219
1241
  if (isBlockedSource(source)) {
1220
1242
  return;
1221
1243
  }
1222
- var descendingPhysicalColumns = physicalColumns.sort().reverse();
1244
+ var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1223
1245
  var changes = this.engine.batch(function () {
1224
- descendingPhysicalColumns.forEach(function (physicalColumn) {
1225
- _this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
1246
+ descendingHfColumns.forEach(function (hfColumn) {
1247
+ _this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
1226
1248
  });
1227
1249
  });
1228
1250
  this.renderDependentSheets(changes);
@@ -1241,16 +1263,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1241
1263
  key: "onAfterDetachChild",
1242
1264
  value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
1243
1265
  var _element$__children,
1244
- _this21 = this;
1266
+ _this20 = this;
1245
1267
  _classPrivateFieldSet(this, _internalOperationPending, true);
1246
1268
  var rowsData = this.hot.getSourceDataArray(finalElementRowIndex, 0, finalElementRowIndex + (((_element$__children = element.__children) === null || _element$__children === void 0 ? void 0 : _element$__children.length) || 0), this.hot.countSourceCols());
1247
1269
  _classPrivateFieldSet(this, _internalOperationPending, false);
1248
1270
  rowsData.forEach(function (row, relativeRowIndex) {
1249
1271
  row.forEach(function (value, colIndex) {
1250
- _this21.engine.setCellContents({
1272
+ _this20.engine.setCellContents({
1251
1273
  col: colIndex,
1252
1274
  row: finalElementRowIndex + relativeRowIndex,
1253
- sheet: _this21.sheetId
1275
+ sheet: _this20.sheetId
1254
1276
  }, [[value]]);
1255
1277
  });
1256
1278
  });