handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-c73b24c-20230510

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 +24 -52
  55. package/core.mjs +24 -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 +9101 -9413
  63. package/dist/handsontable.full.min.css +3 -3
  64. package/dist/handsontable.full.min.js +123 -115
  65. package/dist/handsontable.js +8761 -9074
  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
@@ -2,8 +2,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
2
2
  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."); }
3
3
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
4
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
- 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; }
6
- 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; }
7
5
  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); }
8
6
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
7
  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."); }
@@ -40,9 +38,6 @@ import "core-js/modules/es.symbol.iterator.js";
40
38
  import "core-js/modules/es.function.name.js";
41
39
  import "core-js/modules/es.array.from.js";
42
40
  import "core-js/modules/es.regexp.exec.js";
43
- import "core-js/modules/es.object.keys.js";
44
- import "core-js/modules/es.array.filter.js";
45
- import "core-js/modules/es.object.get-own-property-descriptors.js";
46
41
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47
42
  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); } }
48
43
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -76,10 +71,10 @@ import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./eng
76
71
  import { isArrayOfArrays } from "../../helpers/data.mjs";
77
72
  import { toUpperCaseFirst } from "../../helpers/string.mjs";
78
73
  import Hooks from "../../pluginHooks.mjs";
74
+ import IndexSyncer from "./indexSyncer/index.mjs";
79
75
  export var PLUGIN_KEY = 'formulas';
80
76
  export var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
81
77
  export var PLUGIN_PRIORITY = 260;
82
- var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
83
78
  Hooks.getSingleton().register('afterNamedExpressionAdded');
84
79
  Hooks.getSingleton().register('afterNamedExpressionRemoved');
85
80
  Hooks.getSingleton().register('afterSheetAdded');
@@ -185,6 +180,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
185
180
  * @type {string|null}
186
181
  */
187
182
  _defineProperty(_assertThisInitialized(_this), "sheetName", null);
183
+ /**
184
+ * Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
185
+ *
186
+ * @type {IndexSyncer|null}
187
+ */
188
+ _defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
189
+ /**
190
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
191
+ *
192
+ * @type {AxisSyncer|null}
193
+ */
194
+ _defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
195
+ /**
196
+ * Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
197
+ *
198
+ * @type {AxisSyncer|null}
199
+ */
200
+ _defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
188
201
  return _this;
189
202
  }
190
203
  _createClass(Formulas, [{
@@ -292,6 +305,41 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
292
305
  this.addHook('afterRemoveCol', function () {
293
306
  return _this8.onAfterRemoveCol.apply(_this8, arguments);
294
307
  });
308
+ this.indexSyncer = new IndexSyncer(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
309
+ _this8.hot.addHookOnce('init', function () {
310
+ // Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
311
+ // be postponed.
312
+ postponedAction();
313
+ });
314
+ });
315
+ this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
316
+ this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
317
+ this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
318
+ this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
319
+ this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
320
+ _this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
321
+ });
322
+ this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
323
+ _this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
324
+ });
325
+ this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
326
+ _this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
327
+ });
328
+ this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
329
+ _this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
330
+ });
331
+ this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
332
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
333
+ });
334
+ this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
335
+ _this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
336
+ });
337
+ this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
338
+ _this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
339
+ });
340
+ this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
341
+ _this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
342
+ });
295
343
 
296
344
  // TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
297
345
  // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
@@ -301,22 +349,22 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
301
349
  });
302
350
 
303
351
  // Handling undo actions on data just using HyperFormula's UndoRedo mechanism
304
- this.addHook('beforeUndo', function (action) {
305
- // TODO: Move action isn't handled by HyperFormula.
306
- if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
307
- return;
308
- }
352
+ this.addHook('beforeUndo', function () {
353
+ _this8.indexSyncer.setPerformUndo(true);
309
354
  _this8.engine.undo();
310
355
  });
311
356
 
312
357
  // Handling redo actions on data just using HyperFormula's UndoRedo mechanism
313
- this.addHook('beforeRedo', function (action) {
314
- // TODO: Move action isn't handled by HyperFormula.
315
- if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
316
- return;
317
- }
358
+ this.addHook('beforeRedo', function () {
359
+ _this8.indexSyncer.setPerformRedo(true);
318
360
  _this8.engine.redo();
319
361
  });
362
+ this.addHook('afterUndo', function () {
363
+ _this8.indexSyncer.setPerformUndo(false);
364
+ });
365
+ this.addHook('afterUndo', function () {
366
+ _this8.indexSyncer.setPerformRedo(false);
367
+ });
320
368
  this.addHook('afterDetachChild', function () {
321
369
  return _this8.onAfterDetachChild.apply(_this8, arguments);
322
370
  });
@@ -401,63 +449,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
401
449
  _get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
402
450
  }
403
451
 
404
- /**
405
- * Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
406
- *
407
- * @private
408
- * @param {number} visualIndex Visual entry index.
409
- * @param {number} physicalIndex Physical entry index.
410
- * @param {number} entriesCount Visual entries count.
411
- * @param {number} sourceEntriesCount Source entries count.
412
- * @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
413
- * `toPhysical` alias.
414
- * @returns {*}
415
- */
416
- }, {
417
- key: "getPhysicalIndexPosition",
418
- value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
419
- if (!contained) {
420
- if (visualIndex >= entriesCount) {
421
- return sourceEntriesCount + (visualIndex - entriesCount);
422
- }
423
- }
424
- return physicalIndex;
425
- }
426
-
427
- /**
428
- * Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
429
- * `null` on rows with indexes higher than the number of rows.
430
- *
431
- * @private
432
- * @param {number} row Visual row index.
433
- * @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
434
- * `toPhysical` alias.
435
- * @returns {number} The physical row index.
436
- */
437
- }, {
438
- key: "toPhysicalRowPosition",
439
- value: function toPhysicalRowPosition(row) {
440
- var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
441
- return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
442
- }
443
-
444
- /**
445
- * Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
446
- * `null` on columns with indexes higher than the number of columns.
447
- *
448
- * @private
449
- * @param {number} column Visual column index.
450
- * @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
451
- * `toPhysical` alias.
452
- * @returns {number} The physical column index.
453
- */
454
- }, {
455
- key: "toPhysicalColumnPosition",
456
- value: function toPhysicalColumnPosition(column) {
457
- var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
458
- return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
459
- }
460
-
461
452
  /**
462
453
  * Add a sheet to the shared HyperFormula instance.
463
454
  *
@@ -528,8 +519,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
528
519
  if (physicalRow !== null && physicalColumn !== null) {
529
520
  return this.engine.getCellType({
530
521
  sheet: sheet,
531
- row: physicalRow,
532
- col: physicalColumn
522
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
523
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
533
524
  });
534
525
  } else {
535
526
  // Should return `EMPTY` when out of bounds (according to the test cases).
@@ -549,15 +540,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
549
540
  key: "isFormulaCellType",
550
541
  value: function isFormulaCellType(row, column) {
551
542
  var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
552
- var physicalRow = this.hot.toPhysicalRow(row);
553
- var physicalColumn = this.hot.toPhysicalColumn(column);
554
- if (physicalRow === null || physicalColumn === null) {
555
- return false;
556
- }
557
543
  return this.engine.doesCellHaveFormula({
558
544
  sheet: sheet,
559
- row: physicalRow,
560
- col: physicalColumn
545
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
546
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
561
547
  });
562
548
  }
563
549
 
@@ -622,11 +608,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
622
608
  var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
623
609
  row = _ref8.row,
624
610
  col = _ref8.col;
625
- var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
626
- var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
627
611
 
628
612
  // Don't try to validate cells outside of the visual part of the table.
629
- if (visualRow === null || visualColumn === null) {
613
+ if (isDefined(row) === false || isDefined(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
630
614
  return;
631
615
  }
632
616
 
@@ -645,7 +629,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
645
629
  }
646
630
 
647
631
  // It will just re-render certain cell when necessary.
648
- boundHot.validateCell(boundHot.getDataAtCell(visualRow, visualColumn), boundHot.getCellMeta(visualRow, visualColumn), function () {});
632
+ boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
649
633
  }
650
634
  });
651
635
  }
@@ -663,8 +647,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
663
647
  key: "syncChangeWithEngine",
664
648
  value: function syncChangeWithEngine(row, column, newValue) {
665
649
  var address = {
666
- row: this.toPhysicalRowPosition(row),
667
- col: this.toPhysicalColumnPosition(column),
650
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
651
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
668
652
  sheet: this.sheetId
669
653
  };
670
654
  if (!this.engine.isItPossibleToSetCellContents(address)) {
@@ -700,8 +684,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
700
684
  var visualColumn = this.hot.propToCol(prop);
701
685
  if (this.isFormulaCellType(visualRow, visualColumn)) {
702
686
  var address = {
703
- row: this.hot.toPhysicalRow(visualRow),
704
- col: this.hot.toPhysicalColumn(visualColumn),
687
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
688
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
705
689
  sheet: this.sheetId
706
690
  };
707
691
  var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
@@ -730,19 +714,41 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
730
714
  }, {
731
715
  key: "onBeforeAutofill",
732
716
  value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
733
- var _this13 = this;
734
- var withSheetId = function withSheetId(range) {
735
- return _objectSpread(_objectSpread({}, range), {}, {
736
- sheet: _this13.sheetId
737
- });
738
- };
717
+ var _sourceRange$getTopSt = sourceRange.getTopStartCorner(),
718
+ sourceTopStartRow = _sourceRange$getTopSt.row,
719
+ sourceTopStartColumn = _sourceRange$getTopSt.col;
720
+ var _sourceRange$getBotto = sourceRange.getBottomEndCorner(),
721
+ sourceBottomEndRow = _sourceRange$getBotto.row,
722
+ sourceBottomEndColumn = _sourceRange$getBotto.col;
723
+ var _targetRange$getTopSt = targetRange.getTopStartCorner(),
724
+ targetTopStartRow = _targetRange$getTopSt.row,
725
+ targetTopStartColumn = _targetRange$getTopSt.col;
726
+ var _targetRange$getBotto = targetRange.getBottomEndCorner(),
727
+ targetBottomEndRow = _targetRange$getBotto.row,
728
+ targetBottomEndColumn = _targetRange$getBotto.col;
739
729
  var engineSourceRange = {
740
- start: withSheetId(sourceRange.getTopStartCorner()),
741
- end: withSheetId(sourceRange.getBottomEndCorner())
730
+ start: {
731
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
732
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
733
+ sheet: this.sheetId
734
+ },
735
+ end: {
736
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
737
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
738
+ sheet: this.sheetId
739
+ }
742
740
  };
743
741
  var engineTargetRange = {
744
- start: withSheetId(targetRange.getTopStartCorner()),
745
- end: withSheetId(targetRange.getBottomEndCorner())
742
+ start: {
743
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
744
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
745
+ sheet: this.sheetId
746
+ },
747
+ end: {
748
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
749
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
750
+ sheet: this.sheetId
751
+ }
746
752
  };
747
753
 
748
754
  // Blocks the autofill operation if HyperFormula says that at least one of
@@ -808,19 +814,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
808
814
  }, {
809
815
  key: "onAfterCellMetaReset",
810
816
  value: function onAfterCellMetaReset() {
811
- var _this14 = this;
817
+ var _this13 = this;
812
818
  var sourceDataArray = this.hot.getSourceDataArray();
813
819
  var valueChanged = false;
814
820
  sourceDataArray.forEach(function (rowData, rowIndex) {
815
821
  rowData.forEach(function (cellValue, columnIndex) {
816
- var cellMeta = _this14.hot.getCellMeta(rowIndex, columnIndex);
822
+ var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
817
823
  var dateFormat = cellMeta.dateFormat;
818
824
  if (isDate(cellValue, cellMeta.type)) {
819
825
  valueChanged = true;
820
826
  if (isDateValid(cellValue, dateFormat)) {
821
827
  // Rewriting date in HOT format to HF format.
822
828
  sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);
823
- } else if (_this14.isFormulaCellType(rowIndex, columnIndex) === false) {
829
+ } else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
824
830
  // Escaping value from date parsing using "'" sign (HF feature).
825
831
  sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
826
832
  }
@@ -855,6 +861,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
855
861
  if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
856
862
  _classPrivateFieldSet(this, _internalOperationPending, true);
857
863
  var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
864
+ this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
858
865
  this.renderDependentSheets(dependentCells);
859
866
  _classPrivateFieldSet(this, _internalOperationPending, false);
860
867
  }
@@ -867,24 +874,27 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
867
874
  * `modifyData` hook callback.
868
875
  *
869
876
  * @private
870
- * @param {number} row Physical row height.
871
- * @param {number} column Physical column index.
877
+ * @param {number} physicalRow Physical row index.
878
+ * @param {number} visualColumn Visual column index.
872
879
  * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
873
880
  * property.
874
881
  * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
875
882
  */
876
883
  }, {
877
884
  key: "onModifyData",
878
- value: function onModifyData(row, column, valueHolder, ioMode) {
885
+ value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
879
886
  if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
880
887
  return;
881
888
  }
882
- var visualRow = this.hot.toVisualRow(row);
889
+ var visualRow = this.hot.toVisualRow(physicalRow);
890
+ if (visualRow === null || visualColumn === null) {
891
+ return;
892
+ }
883
893
 
884
894
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
885
- var isFormulaCellType = this.isFormulaCellType(visualRow, column);
895
+ var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
886
896
  if (!isFormulaCellType) {
887
- var cellType = this.getCellType(visualRow, column);
897
+ var cellType = this.getCellType(visualRow, visualColumn);
888
898
  if (cellType !== 'ARRAY') {
889
899
  if (isEscapedFormulaExpression(valueHolder.value)) {
890
900
  valueHolder.value = unescapeFormulaExpression(valueHolder.value);
@@ -892,15 +902,13 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
892
902
  return;
893
903
  }
894
904
  }
895
-
896
- // `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
897
905
  var address = {
898
- row: row,
899
- col: this.toPhysicalColumnPosition(column),
906
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
907
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
900
908
  sheet: this.sheetId
901
909
  };
902
910
  var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
903
- var cellMeta = this.hot.getCellMeta(row, column);
911
+ var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
904
912
  if (cellMeta.type === 'date' && isNumeric(cellValue)) {
905
913
  cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
906
914
  }
@@ -928,6 +936,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
928
936
  }
929
937
  var visualRow = this.hot.toVisualRow(row);
930
938
  var visualColumn = this.hot.propToCol(columnOrProp);
939
+ if (visualRow === null || visualColumn === null) {
940
+ return;
941
+ }
931
942
 
932
943
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
933
944
  var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
@@ -947,9 +958,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
947
958
  return;
948
959
  }
949
960
  var address = {
950
- row: row,
951
- // Workaround for inconsistencies in `src/dataSource.js`
952
- col: this.toPhysicalColumnPosition(visualColumn),
961
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
962
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
953
963
  sheet: this.sheetId
954
964
  };
955
965
  valueHolder.value = this.engine.getCellSerialized(address);
@@ -966,7 +976,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
966
976
  }, {
967
977
  key: "onAfterSetDataAtCell",
968
978
  value: function onAfterSetDataAtCell(changes, source) {
969
- var _this15 = this;
979
+ var _this14 = this;
970
980
  if (isBlockedSource(source)) {
971
981
  return;
972
982
  }
@@ -975,21 +985,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
975
985
  var dependentCells = this.engine.batch(function () {
976
986
  changes.forEach(function (_ref9) {
977
987
  var _ref10 = _slicedToArray(_ref9, 4),
978
- row = _ref10[0],
988
+ visualRow = _ref10[0],
979
989
  prop = _ref10[1],
980
990
  newValue = _ref10[3];
981
- var column = _this15.hot.propToCol(prop);
982
- var physicalRow = _this15.hot.toPhysicalRow(row);
983
- var physicalColumn = _this15.hot.toPhysicalColumn(column);
991
+ var visualColumn = _this14.hot.propToCol(prop);
992
+ var physicalRow = _this14.hot.toPhysicalRow(visualRow);
993
+ var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
984
994
  var address = {
985
- row: physicalRow,
986
- col: physicalColumn,
987
- sheet: _this15.sheetId
995
+ row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
996
+ col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
997
+ sheet: _this14.sheetId
988
998
  };
989
999
  if (physicalRow !== null && physicalColumn !== null) {
990
- _this15.syncChangeWithEngine(row, column, newValue);
1000
+ _this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
991
1001
  } else {
992
- outOfBoundsChanges.push([row, column, newValue]);
1002
+ outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
993
1003
  }
994
1004
  changedCells.push({
995
1005
  address: address
@@ -1000,16 +1010,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1000
1010
  // Workaround for rows/columns being created two times (by HOT and the engine).
1001
1011
  // (unfortunately, this requires an extra re-render)
1002
1012
  this.hot.addHookOnce('afterChange', function () {
1003
- var outOfBoundsDependentCells = _this15.engine.batch(function () {
1013
+ var outOfBoundsDependentCells = _this14.engine.batch(function () {
1004
1014
  outOfBoundsChanges.forEach(function (_ref11) {
1005
1015
  var _ref12 = _slicedToArray(_ref11, 3),
1006
1016
  row = _ref12[0],
1007
1017
  column = _ref12[1],
1008
1018
  newValue = _ref12[2];
1009
- _this15.syncChangeWithEngine(row, column, newValue);
1019
+ _this14.syncChangeWithEngine(row, column, newValue);
1010
1020
  });
1011
1021
  });
1012
- _this15.renderDependentSheets(outOfBoundsDependentCells, true);
1022
+ _this14.renderDependentSheets(outOfBoundsDependentCells, true);
1013
1023
  });
1014
1024
  }
1015
1025
  this.renderDependentSheets(dependentCells);
@@ -1027,7 +1037,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1027
1037
  }, {
1028
1038
  key: "onAfterSetSourceDataAtCell",
1029
1039
  value: function onAfterSetSourceDataAtCell(changes, source) {
1030
- var _this16 = this;
1040
+ var _this15 = this;
1031
1041
  if (isBlockedSource(source)) {
1032
1042
  return;
1033
1043
  }
@@ -1035,26 +1045,26 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1035
1045
  var changedCells = [];
1036
1046
  changes.forEach(function (_ref13) {
1037
1047
  var _ref14 = _slicedToArray(_ref13, 4),
1038
- row = _ref14[0],
1048
+ visualRow = _ref14[0],
1039
1049
  prop = _ref14[1],
1040
1050
  newValue = _ref14[3];
1041
- var column = _this16.hot.propToCol(prop);
1042
- if (!isNumeric(column)) {
1051
+ var visualColumn = _this15.hot.propToCol(prop);
1052
+ if (!isNumeric(visualColumn)) {
1043
1053
  return;
1044
1054
  }
1045
1055
  var address = {
1046
- row: row,
1047
- col: _this16.toPhysicalColumnPosition(column),
1048
- sheet: _this16.sheetId
1056
+ row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1057
+ col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1058
+ sheet: _this15.sheetId
1049
1059
  };
1050
- if (!_this16.engine.isItPossibleToSetCellContents(address)) {
1060
+ if (!_this15.engine.isItPossibleToSetCellContents(address)) {
1051
1061
  warn("Not possible to set source cell data at ".concat(JSON.stringify(address)));
1052
1062
  return;
1053
1063
  }
1054
1064
  changedCells.push({
1055
1065
  address: address
1056
1066
  });
1057
- dependentCells.push.apply(dependentCells, _toConsumableArray(_this16.engine.setCellContents(address, newValue)));
1067
+ dependentCells.push.apply(dependentCells, _toConsumableArray(_this15.engine.setCellContents(address, newValue)));
1058
1068
  });
1059
1069
  this.renderDependentSheets(dependentCells);
1060
1070
  this.validateDependentCells(dependentCells, changedCells);
@@ -1064,14 +1074,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1064
1074
  * `beforeCreateRow` hook callback.
1065
1075
  *
1066
1076
  * @private
1067
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1077
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1068
1078
  * @param {number} amount Number of newly created rows in the data source array.
1069
1079
  * @returns {*|boolean} If false is returned the action is canceled.
1070
1080
  */
1071
1081
  }, {
1072
1082
  key: "onBeforeCreateRow",
1073
- value: function onBeforeCreateRow(row, amount) {
1074
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [this.toPhysicalRowPosition(row), amount])) {
1083
+ value: function onBeforeCreateRow(visualRow, amount) {
1084
+ var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
1085
+ if (visualRow >= this.hot.countRows()) {
1086
+ hfRowIndex = visualRow; // Row beyond the table boundaries.
1087
+ }
1088
+
1089
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
1075
1090
  return false;
1076
1091
  }
1077
1092
  }
@@ -1080,14 +1095,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1080
1095
  * `beforeCreateCol` hook callback.
1081
1096
  *
1082
1097
  * @private
1083
- * @param {number} col Represents the visual index of first newly created column in the data source.
1098
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1084
1099
  * @param {number} amount Number of newly created columns in the data source.
1085
1100
  * @returns {*|boolean} If false is returned the action is canceled.
1086
1101
  */
1087
1102
  }, {
1088
1103
  key: "onBeforeCreateCol",
1089
- value: function onBeforeCreateCol(col, amount) {
1090
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount])) {
1104
+ value: function onBeforeCreateCol(visualColumn, amount) {
1105
+ var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
1106
+ if (visualColumn >= this.hot.countCols()) {
1107
+ hfColumnIndex = visualColumn; // Column beyond the table boundaries.
1108
+ }
1109
+
1110
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
1091
1111
  return false;
1092
1112
  }
1093
1113
  }
@@ -1104,9 +1124,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1104
1124
  }, {
1105
1125
  key: "onBeforeRemoveRow",
1106
1126
  value: function onBeforeRemoveRow(row, amount, physicalRows) {
1107
- var _this17 = this;
1108
- var possible = physicalRows.every(function (physicalRow) {
1109
- return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
1127
+ var _this16 = this;
1128
+ var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
1129
+ var possible = hfRows.every(function (hfRow) {
1130
+ return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
1110
1131
  });
1111
1132
  return possible === false ? false : void 0;
1112
1133
  }
@@ -1123,9 +1144,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1123
1144
  }, {
1124
1145
  key: "onBeforeRemoveCol",
1125
1146
  value: function onBeforeRemoveCol(col, amount, physicalColumns) {
1126
- var _this18 = this;
1127
- var possible = physicalColumns.every(function (physicalColumn) {
1128
- return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
1147
+ var _this17 = this;
1148
+ var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
1149
+ var possible = hfColumns.every(function (hfColumn) {
1150
+ return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
1129
1151
  });
1130
1152
  return possible === false ? false : void 0;
1131
1153
  }
@@ -1134,18 +1156,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1134
1156
  * `afterCreateRow` hook callback.
1135
1157
  *
1136
1158
  * @private
1137
- * @param {number} row Represents the visual index of first newly created row in the data source array.
1159
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1138
1160
  * @param {number} amount Number of newly created rows in the data source array.
1139
1161
  * @param {string} [source] String that identifies source of hook call
1140
1162
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1141
1163
  */
1142
1164
  }, {
1143
1165
  key: "onAfterCreateRow",
1144
- value: function onAfterCreateRow(row, amount, source) {
1166
+ value: function onAfterCreateRow(visualRow, amount, source) {
1145
1167
  if (isBlockedSource(source)) {
1146
1168
  return;
1147
1169
  }
1148
- var changes = this.engine.addRows(this.sheetId, [this.toPhysicalRowPosition(row), amount]);
1170
+ var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1149
1171
  this.renderDependentSheets(changes);
1150
1172
  }
1151
1173
 
@@ -1153,18 +1175,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1153
1175
  * `afterCreateCol` hook callback.
1154
1176
  *
1155
1177
  * @private
1156
- * @param {number} col Represents the visual index of first newly created column in the data source.
1178
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1157
1179
  * @param {number} amount Number of newly created columns in the data source.
1158
1180
  * @param {string} [source] String that identifies source of hook call
1159
1181
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1160
1182
  */
1161
1183
  }, {
1162
1184
  key: "onAfterCreateCol",
1163
- value: function onAfterCreateCol(col, amount, source) {
1185
+ value: function onAfterCreateCol(visualColumn, amount, source) {
1164
1186
  if (isBlockedSource(source)) {
1165
1187
  return;
1166
1188
  }
1167
- var changes = this.engine.addColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount]);
1189
+ var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1168
1190
  this.renderDependentSheets(changes);
1169
1191
  }
1170
1192
 
@@ -1181,14 +1203,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1181
1203
  }, {
1182
1204
  key: "onAfterRemoveRow",
1183
1205
  value: function onAfterRemoveRow(row, amount, physicalRows, source) {
1184
- var _this19 = this;
1206
+ var _this18 = this;
1185
1207
  if (isBlockedSource(source)) {
1186
1208
  return;
1187
1209
  }
1188
- var descendingPhysicalRows = physicalRows.sort().reverse();
1210
+ var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1189
1211
  var changes = this.engine.batch(function () {
1190
- descendingPhysicalRows.forEach(function (physicalRow) {
1191
- _this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
1212
+ descendingHfRows.forEach(function (hfRow) {
1213
+ _this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
1192
1214
  });
1193
1215
  });
1194
1216
  this.renderDependentSheets(changes);
@@ -1207,14 +1229,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1207
1229
  }, {
1208
1230
  key: "onAfterRemoveCol",
1209
1231
  value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
1210
- var _this20 = this;
1232
+ var _this19 = this;
1211
1233
  if (isBlockedSource(source)) {
1212
1234
  return;
1213
1235
  }
1214
- var descendingPhysicalColumns = physicalColumns.sort().reverse();
1236
+ var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1215
1237
  var changes = this.engine.batch(function () {
1216
- descendingPhysicalColumns.forEach(function (physicalColumn) {
1217
- _this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
1238
+ descendingHfColumns.forEach(function (hfColumn) {
1239
+ _this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
1218
1240
  });
1219
1241
  });
1220
1242
  this.renderDependentSheets(changes);
@@ -1233,16 +1255,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1233
1255
  key: "onAfterDetachChild",
1234
1256
  value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
1235
1257
  var _element$__children,
1236
- _this21 = this;
1258
+ _this20 = this;
1237
1259
  _classPrivateFieldSet(this, _internalOperationPending, true);
1238
1260
  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());
1239
1261
  _classPrivateFieldSet(this, _internalOperationPending, false);
1240
1262
  rowsData.forEach(function (row, relativeRowIndex) {
1241
1263
  row.forEach(function (value, colIndex) {
1242
- _this21.engine.setCellContents({
1264
+ _this20.engine.setCellContents({
1243
1265
  col: colIndex,
1244
1266
  row: finalElementRowIndex + relativeRowIndex,
1245
- sheet: _this21.sheetId
1267
+ sheet: _this20.sheetId
1246
1268
  }, [[value]]);
1247
1269
  });
1248
1270
  });