handsontable 0.0.0-next-3be5fb5-20230427 → 0.0.0-next-aad186f-20230428

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (130) hide show
  1. package/3rdparty/walkontable/src/cell/coords.js +13 -16
  2. package/3rdparty/walkontable/src/cell/coords.mjs +13 -16
  3. package/3rdparty/walkontable/src/cell/range.js +25 -29
  4. package/3rdparty/walkontable/src/cell/range.mjs +24 -28
  5. package/3rdparty/walkontable/src/overlay/_base.js +6 -7
  6. package/3rdparty/walkontable/src/overlay/_base.mjs +6 -7
  7. package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
  8. package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
  9. package/3rdparty/walkontable/src/overlay/top.js +6 -7
  10. package/3rdparty/walkontable/src/overlay/top.mjs +6 -7
  11. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
  12. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
  13. package/3rdparty/walkontable/src/overlays.js +55 -64
  14. package/3rdparty/walkontable/src/overlays.mjs +55 -64
  15. package/3rdparty/walkontable/src/scroll.js +20 -23
  16. package/3rdparty/walkontable/src/scroll.mjs +20 -23
  17. package/3rdparty/walkontable/src/settings.js +13 -15
  18. package/3rdparty/walkontable/src/settings.mjs +13 -15
  19. package/3rdparty/walkontable/src/table.js +22 -26
  20. package/3rdparty/walkontable/src/table.mjs +22 -26
  21. package/base.js +2 -4
  22. package/base.mjs +2 -2
  23. package/core.js +7 -3
  24. package/core.mjs +7 -3
  25. package/dataMap/dataSource.js +5 -5
  26. package/dataMap/dataSource.mjs +5 -5
  27. package/dist/handsontable.css +2 -2
  28. package/dist/handsontable.full.css +2 -2
  29. package/dist/handsontable.full.js +2453 -1877
  30. package/dist/handsontable.full.min.css +2 -2
  31. package/dist/handsontable.full.min.js +113 -105
  32. package/dist/handsontable.js +2215 -1640
  33. package/dist/handsontable.min.css +2 -2
  34. package/dist/handsontable.min.js +11 -3
  35. package/dist/languages/all.js +133 -0
  36. package/dist/languages/ar-AR.js +7 -0
  37. package/dist/languages/cs-CZ.js +7 -0
  38. package/dist/languages/de-CH.js +7 -0
  39. package/dist/languages/de-DE.js +7 -0
  40. package/dist/languages/en-US.js +7 -0
  41. package/dist/languages/es-MX.js +7 -0
  42. package/dist/languages/fr-FR.js +7 -0
  43. package/dist/languages/it-IT.js +7 -0
  44. package/dist/languages/ja-JP.js +7 -0
  45. package/dist/languages/ko-KR.js +7 -0
  46. package/dist/languages/lv-LV.js +7 -0
  47. package/dist/languages/nb-NO.js +7 -0
  48. package/dist/languages/nl-NL.js +7 -0
  49. package/dist/languages/pl-PL.js +7 -0
  50. package/dist/languages/pt-BR.js +7 -0
  51. package/dist/languages/ru-RU.js +7 -0
  52. package/dist/languages/sr-SP.js +7 -0
  53. package/dist/languages/zh-CN.js +7 -0
  54. package/dist/languages/zh-TW.js +7 -0
  55. package/helpers/mixed.js +1 -1
  56. package/helpers/mixed.mjs +1 -1
  57. package/i18n/languages/ar-AR.js +7 -1
  58. package/i18n/languages/cs-CZ.js +7 -1
  59. package/i18n/languages/de-CH.js +7 -1
  60. package/i18n/languages/de-DE.js +7 -1
  61. package/i18n/languages/en-US.js +7 -1
  62. package/i18n/languages/es-MX.js +7 -1
  63. package/i18n/languages/fr-FR.js +7 -1
  64. package/i18n/languages/it-IT.js +7 -1
  65. package/i18n/languages/ja-JP.js +7 -1
  66. package/i18n/languages/ko-KR.js +7 -1
  67. package/i18n/languages/lv-LV.js +7 -1
  68. package/i18n/languages/nb-NO.js +7 -1
  69. package/i18n/languages/nl-NL.js +7 -1
  70. package/i18n/languages/pl-PL.js +7 -1
  71. package/i18n/languages/pt-BR.js +7 -1
  72. package/i18n/languages/ru-RU.js +7 -1
  73. package/i18n/languages/sr-SP.js +7 -1
  74. package/i18n/languages/zh-CN.js +7 -1
  75. package/i18n/languages/zh-TW.js +7 -1
  76. package/languages/all.js +133 -0
  77. package/languages/ar-AR.js +7 -0
  78. package/languages/cs-CZ.js +7 -0
  79. package/languages/de-CH.js +7 -0
  80. package/languages/de-DE.js +7 -0
  81. package/languages/en-US.js +7 -0
  82. package/languages/es-MX.js +7 -0
  83. package/languages/fr-FR.js +7 -0
  84. package/languages/index.js +133 -0
  85. package/languages/it-IT.js +7 -0
  86. package/languages/ja-JP.js +7 -0
  87. package/languages/ko-KR.js +7 -0
  88. package/languages/lv-LV.js +7 -0
  89. package/languages/nb-NO.js +7 -0
  90. package/languages/nl-NL.js +7 -0
  91. package/languages/pl-PL.js +7 -0
  92. package/languages/pt-BR.js +7 -0
  93. package/languages/ru-RU.js +7 -0
  94. package/languages/sr-SP.js +7 -0
  95. package/languages/zh-CN.js +7 -0
  96. package/languages/zh-TW.js +7 -0
  97. package/package.json +3 -2
  98. package/pluginHooks.js +16 -6
  99. package/pluginHooks.mjs +15 -3
  100. package/plugins/autoRowSize/autoRowSize.js +2 -2
  101. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  102. package/plugins/copyPaste/copyableRanges.js +25 -31
  103. package/plugins/copyPaste/copyableRanges.mjs +18 -24
  104. package/plugins/formulas/formulas.js +139 -134
  105. package/plugins/formulas/formulas.mjs +139 -134
  106. package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
  107. package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
  108. package/plugins/formulas/indexSyncer/index.js +225 -0
  109. package/plugins/formulas/indexSyncer/index.mjs +219 -0
  110. package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
  111. package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
  112. package/plugins/nestedHeaders/stateManager/index.js +3 -3
  113. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
  114. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
  115. package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
  116. package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
  117. package/plugins/registry.js +3 -1
  118. package/plugins/undoRedo/undoRedo.js +0 -1
  119. package/plugins/undoRedo/undoRedo.mjs +0 -1
  120. package/selection/highlight/visualSelection.js +5 -6
  121. package/selection/highlight/visualSelection.mjs +5 -6
  122. package/tableView.js +62 -72
  123. package/tableView.mjs +62 -72
  124. package/translations/changesObservable/observable.js +41 -46
  125. package/translations/changesObservable/observable.mjs +36 -41
  126. package/translations/changesObservable/observer.js +1 -1
  127. package/translations/indexMapper.js +21 -0
  128. package/translations/indexMapper.mjs +21 -0
  129. package/utils/dataStructures/tree.js +15 -18
  130. package/utils/dataStructures/tree.mjs +15 -18
@@ -45,6 +45,7 @@ var _settings = require("./engine/settings");
45
45
  var _data = require("../../helpers/data");
46
46
  var _string = require("../../helpers/string");
47
47
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
48
+ var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
48
49
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
50
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
50
51
  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."); }
@@ -87,7 +88,6 @@ var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
87
88
  exports.SETTING_KEYS = SETTING_KEYS;
88
89
  var PLUGIN_PRIORITY = 260;
89
90
  exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
90
- var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
91
91
  _pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
92
92
  _pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
93
93
  _pluginHooks.default.getSingleton().register('afterSheetAdded');
@@ -193,6 +193,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
193
193
  * @type {string|null}
194
194
  */
195
195
  _defineProperty(_assertThisInitialized(_this), "sheetName", null);
196
+ /**
197
+ * Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
198
+ *
199
+ * @type {IndexSyncer|null}
200
+ */
201
+ _defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
202
+ /**
203
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
204
+ *
205
+ * @type {AxisSyncer|null}
206
+ */
207
+ _defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
208
+ /**
209
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
210
+ *
211
+ * @type {AxisSyncer|null}
212
+ */
213
+ _defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
196
214
  return _this;
197
215
  }
198
216
  _createClass(Formulas, [{
@@ -300,6 +318,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
300
318
  this.addHook('afterRemoveCol', function () {
301
319
  return _this8.onAfterRemoveCol.apply(_this8, arguments);
302
320
  });
321
+ this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
322
+ _this8.hot.addHookOnce('init', function () {
323
+ // Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
324
+ // be postponed.
325
+ postponedAction();
326
+ });
327
+ });
328
+ this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
329
+ this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
330
+ this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
331
+ this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
332
+ this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
333
+ _this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
334
+ });
335
+ this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
336
+ _this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
337
+ });
338
+ this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
339
+ _this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
340
+ });
341
+ this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
342
+ _this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
343
+ });
344
+ this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
345
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
346
+ });
347
+ this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
348
+ _this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
349
+ });
350
+ this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
351
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
352
+ });
353
+ this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
354
+ _this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
355
+ });
303
356
 
304
357
  // TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
305
358
  // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
@@ -309,22 +362,22 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
309
362
  });
310
363
 
311
364
  // 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
- }
365
+ this.addHook('beforeUndo', function () {
366
+ _this8.indexSyncer.setPerformUndo(true);
317
367
  _this8.engine.undo();
318
368
  });
319
369
 
320
370
  // 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
- }
371
+ this.addHook('beforeRedo', function () {
372
+ _this8.indexSyncer.setPerformRedo(true);
326
373
  _this8.engine.redo();
327
374
  });
375
+ this.addHook('afterUndo', function () {
376
+ _this8.indexSyncer.setPerformUndo(false);
377
+ });
378
+ this.addHook('afterUndo', function () {
379
+ _this8.indexSyncer.setPerformRedo(false);
380
+ });
328
381
  this.addHook('afterDetachChild', function () {
329
382
  return _this8.onAfterDetachChild.apply(_this8, arguments);
330
383
  });
@@ -409,63 +462,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
409
462
  _get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
410
463
  }
411
464
 
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
465
  /**
470
466
  * Add a sheet to the shared HyperFormula instance.
471
467
  *
@@ -536,8 +532,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
536
532
  if (physicalRow !== null && physicalColumn !== null) {
537
533
  return this.engine.getCellType({
538
534
  sheet: sheet,
539
- row: physicalRow,
540
- col: physicalColumn
535
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
536
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
541
537
  });
542
538
  } else {
543
539
  // Should return `EMPTY` when out of bounds (according to the test cases).
@@ -557,15 +553,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
557
553
  key: "isFormulaCellType",
558
554
  value: function isFormulaCellType(row, column) {
559
555
  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
556
  return this.engine.doesCellHaveFormula({
566
557
  sheet: sheet,
567
- row: physicalRow,
568
- col: physicalColumn
558
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
559
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
569
560
  });
570
561
  }
571
562
 
@@ -630,11 +621,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
630
621
  var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
631
622
  row = _ref8.row,
632
623
  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
624
 
636
625
  // Don't try to validate cells outside of the visual part of the table.
637
- if (visualRow === null || visualColumn === null) {
626
+ if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
638
627
  return;
639
628
  }
640
629
 
@@ -653,7 +642,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
653
642
  }
654
643
 
655
644
  // It will just re-render certain cell when necessary.
656
- boundHot.validateCell(boundHot.getDataAtCell(visualRow, visualColumn), boundHot.getCellMeta(visualRow, visualColumn), function () {});
645
+ boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
657
646
  }
658
647
  });
659
648
  }
@@ -671,8 +660,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
671
660
  key: "syncChangeWithEngine",
672
661
  value: function syncChangeWithEngine(row, column, newValue) {
673
662
  var address = {
674
- row: this.toPhysicalRowPosition(row),
675
- col: this.toPhysicalColumnPosition(column),
663
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
664
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
676
665
  sheet: this.sheetId
677
666
  };
678
667
  if (!this.engine.isItPossibleToSetCellContents(address)) {
@@ -708,8 +697,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
708
697
  var visualColumn = this.hot.propToCol(prop);
709
698
  if (this.isFormulaCellType(visualRow, visualColumn)) {
710
699
  var address = {
711
- row: this.hot.toPhysicalRow(visualRow),
712
- col: this.hot.toPhysicalColumn(visualColumn),
700
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
701
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
713
702
  sheet: this.sheetId
714
703
  };
715
704
  var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
@@ -863,6 +852,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
863
852
  if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
864
853
  _classPrivateFieldSet(this, _internalOperationPending, true);
865
854
  var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
855
+ this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
866
856
  this.renderDependentSheets(dependentCells);
867
857
  _classPrivateFieldSet(this, _internalOperationPending, false);
868
858
  }
@@ -875,24 +865,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
875
865
  * `modifyData` hook callback.
876
866
  *
877
867
  * @private
878
- * @param {number} row Physical row height.
879
- * @param {number} column Physical column index.
868
+ * @param {number} physicalRow Physical row index.
869
+ * @param {number} visualColumn Visual column index.
880
870
  * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
881
871
  * property.
882
872
  * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
883
873
  */
884
874
  }, {
885
875
  key: "onModifyData",
886
- value: function onModifyData(row, column, valueHolder, ioMode) {
876
+ value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
887
877
  if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
888
878
  return;
889
879
  }
890
- var visualRow = this.hot.toVisualRow(row);
880
+ var visualRow = this.hot.toVisualRow(physicalRow);
881
+ if (visualRow === null || visualColumn === null) {
882
+ return;
883
+ }
891
884
 
892
885
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
893
- var isFormulaCellType = this.isFormulaCellType(visualRow, column);
886
+ var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
894
887
  if (!isFormulaCellType) {
895
- var cellType = this.getCellType(visualRow, column);
888
+ var cellType = this.getCellType(visualRow, visualColumn);
896
889
  if (cellType !== 'ARRAY') {
897
890
  if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
898
891
  valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
@@ -900,15 +893,13 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
900
893
  return;
901
894
  }
902
895
  }
903
-
904
- // `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
905
896
  var address = {
906
- row: row,
907
- col: this.toPhysicalColumnPosition(column),
897
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
898
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
908
899
  sheet: this.sheetId
909
900
  };
910
901
  var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
911
- var cellMeta = this.hot.getCellMeta(row, column);
902
+ var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
912
903
  if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
913
904
  cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
914
905
  }
@@ -936,6 +927,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
936
927
  }
937
928
  var visualRow = this.hot.toVisualRow(row);
938
929
  var visualColumn = this.hot.propToCol(columnOrProp);
930
+ if (visualRow === null || visualColumn === null) {
931
+ return;
932
+ }
939
933
 
940
934
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
941
935
  var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
@@ -955,9 +949,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
955
949
  return;
956
950
  }
957
951
  var address = {
958
- row: row,
959
- // Workaround for inconsistencies in `src/dataSource.js`
960
- col: this.toPhysicalColumnPosition(visualColumn),
952
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
953
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
961
954
  sheet: this.sheetId
962
955
  };
963
956
  valueHolder.value = this.engine.getCellSerialized(address);
@@ -983,21 +976,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
983
976
  var dependentCells = this.engine.batch(function () {
984
977
  changes.forEach(function (_ref9) {
985
978
  var _ref10 = _slicedToArray(_ref9, 4),
986
- row = _ref10[0],
979
+ visualRow = _ref10[0],
987
980
  prop = _ref10[1],
988
981
  newValue = _ref10[3];
989
- var column = _this15.hot.propToCol(prop);
990
- var physicalRow = _this15.hot.toPhysicalRow(row);
991
- var physicalColumn = _this15.hot.toPhysicalColumn(column);
982
+ var visualColumn = _this15.hot.propToCol(prop);
983
+ var physicalRow = _this15.hot.toPhysicalRow(visualRow);
984
+ var physicalColumn = _this15.hot.toPhysicalColumn(visualColumn);
992
985
  var address = {
993
- row: physicalRow,
994
- col: physicalColumn,
986
+ row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
987
+ col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
995
988
  sheet: _this15.sheetId
996
989
  };
997
990
  if (physicalRow !== null && physicalColumn !== null) {
998
- _this15.syncChangeWithEngine(row, column, newValue);
991
+ _this15.syncChangeWithEngine(visualRow, visualColumn, newValue);
999
992
  } else {
1000
- outOfBoundsChanges.push([row, column, newValue]);
993
+ outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
1001
994
  }
1002
995
  changedCells.push({
1003
996
  address: address
@@ -1043,16 +1036,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1043
1036
  var changedCells = [];
1044
1037
  changes.forEach(function (_ref13) {
1045
1038
  var _ref14 = _slicedToArray(_ref13, 4),
1046
- row = _ref14[0],
1039
+ visualRow = _ref14[0],
1047
1040
  prop = _ref14[1],
1048
1041
  newValue = _ref14[3];
1049
- var column = _this16.hot.propToCol(prop);
1050
- if (!(0, _number.isNumeric)(column)) {
1042
+ var visualColumn = _this16.hot.propToCol(prop);
1043
+ if (!(0, _number.isNumeric)(visualColumn)) {
1051
1044
  return;
1052
1045
  }
1053
1046
  var address = {
1054
- row: row,
1055
- col: _this16.toPhysicalColumnPosition(column),
1047
+ row: _this16.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1048
+ col: _this16.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1056
1049
  sheet: _this16.sheetId
1057
1050
  };
1058
1051
  if (!_this16.engine.isItPossibleToSetCellContents(address)) {
@@ -1072,14 +1065,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1072
1065
  * `beforeCreateRow` hook callback.
1073
1066
  *
1074
1067
  * @private
1075
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1068
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1076
1069
  * @param {number} amount Number of newly created rows in the data source array.
1077
1070
  * @returns {*|boolean} If false is returned the action is canceled.
1078
1071
  */
1079
1072
  }, {
1080
1073
  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])) {
1074
+ value: function onBeforeCreateRow(visualRow, amount) {
1075
+ var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
1076
+ if (visualRow >= this.hot.countRows()) {
1077
+ hfRowIndex = visualRow; // Row beyond the table boundaries.
1078
+ }
1079
+
1080
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
1083
1081
  return false;
1084
1082
  }
1085
1083
  }
@@ -1088,14 +1086,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1088
1086
  * `beforeCreateCol` hook callback.
1089
1087
  *
1090
1088
  * @private
1091
- * @param {number} col Represents the visual index of first newly created column in the data source.
1089
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1092
1090
  * @param {number} amount Number of newly created columns in the data source.
1093
1091
  * @returns {*|boolean} If false is returned the action is canceled.
1094
1092
  */
1095
1093
  }, {
1096
1094
  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])) {
1095
+ value: function onBeforeCreateCol(visualColumn, amount) {
1096
+ var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
1097
+ if (visualColumn >= this.hot.countCols()) {
1098
+ hfColumnIndex = visualColumn; // Column beyond the table boundaries.
1099
+ }
1100
+
1101
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
1099
1102
  return false;
1100
1103
  }
1101
1104
  }
@@ -1113,8 +1116,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1113
1116
  key: "onBeforeRemoveRow",
1114
1117
  value: function onBeforeRemoveRow(row, amount, physicalRows) {
1115
1118
  var _this17 = this;
1116
- var possible = physicalRows.every(function (physicalRow) {
1117
- return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
1119
+ var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
1120
+ var possible = hfRows.every(function (hfRow) {
1121
+ return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [hfRow, 1]);
1118
1122
  });
1119
1123
  return possible === false ? false : void 0;
1120
1124
  }
@@ -1132,8 +1136,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1132
1136
  key: "onBeforeRemoveCol",
1133
1137
  value: function onBeforeRemoveCol(col, amount, physicalColumns) {
1134
1138
  var _this18 = this;
1135
- var possible = physicalColumns.every(function (physicalColumn) {
1136
- return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
1139
+ var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
1140
+ var possible = hfColumns.every(function (hfColumn) {
1141
+ return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [hfColumn, 1]);
1137
1142
  });
1138
1143
  return possible === false ? false : void 0;
1139
1144
  }
@@ -1142,18 +1147,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1142
1147
  * `afterCreateRow` hook callback.
1143
1148
  *
1144
1149
  * @private
1145
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1150
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1146
1151
  * @param {number} amount Number of newly created rows in the data source array.
1147
1152
  * @param {string} [source] String that identifies source of hook call
1148
1153
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1149
1154
  */
1150
1155
  }, {
1151
1156
  key: "onAfterCreateRow",
1152
- value: function onAfterCreateRow(row, amount, source) {
1157
+ value: function onAfterCreateRow(visualRow, amount, source) {
1153
1158
  if (isBlockedSource(source)) {
1154
1159
  return;
1155
1160
  }
1156
- var changes = this.engine.addRows(this.sheetId, [this.toPhysicalRowPosition(row), amount]);
1161
+ var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1157
1162
  this.renderDependentSheets(changes);
1158
1163
  }
1159
1164
 
@@ -1161,18 +1166,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1161
1166
  * `afterCreateCol` hook callback.
1162
1167
  *
1163
1168
  * @private
1164
- * @param {number} col Represents the visual index of first newly created column in the data source.
1169
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1165
1170
  * @param {number} amount Number of newly created columns in the data source.
1166
1171
  * @param {string} [source] String that identifies source of hook call
1167
1172
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1168
1173
  */
1169
1174
  }, {
1170
1175
  key: "onAfterCreateCol",
1171
- value: function onAfterCreateCol(col, amount, source) {
1176
+ value: function onAfterCreateCol(visualColumn, amount, source) {
1172
1177
  if (isBlockedSource(source)) {
1173
1178
  return;
1174
1179
  }
1175
- var changes = this.engine.addColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount]);
1180
+ var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1176
1181
  this.renderDependentSheets(changes);
1177
1182
  }
1178
1183
 
@@ -1193,10 +1198,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1193
1198
  if (isBlockedSource(source)) {
1194
1199
  return;
1195
1200
  }
1196
- var descendingPhysicalRows = physicalRows.sort().reverse();
1201
+ var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1197
1202
  var changes = this.engine.batch(function () {
1198
- descendingPhysicalRows.forEach(function (physicalRow) {
1199
- _this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
1203
+ descendingHfRows.forEach(function (hfRow) {
1204
+ _this19.engine.removeRows(_this19.sheetId, [hfRow, 1]);
1200
1205
  });
1201
1206
  });
1202
1207
  this.renderDependentSheets(changes);
@@ -1219,10 +1224,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
1219
1224
  if (isBlockedSource(source)) {
1220
1225
  return;
1221
1226
  }
1222
- var descendingPhysicalColumns = physicalColumns.sort().reverse();
1227
+ var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1223
1228
  var changes = this.engine.batch(function () {
1224
- descendingPhysicalColumns.forEach(function (physicalColumn) {
1225
- _this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
1229
+ descendingHfColumns.forEach(function (hfColumn) {
1230
+ _this20.engine.removeColumns(_this20.sheetId, [hfColumn, 1]);
1226
1231
  });
1227
1232
  });
1228
1233
  this.renderDependentSheets(changes);