handsontable 0.0.0-next-5e7f0fe-20230504 → 0.0.0-next-48677e7-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/cell/coords.js +40 -13
  2. package/3rdparty/walkontable/src/cell/coords.mjs +40 -13
  3. package/3rdparty/walkontable/src/cell/range.js +29 -25
  4. package/3rdparty/walkontable/src/cell/range.mjs +28 -24
  5. package/3rdparty/walkontable/src/core/_base.js +9 -3
  6. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  7. package/3rdparty/walkontable/src/core/clone.js +2 -2
  8. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  9. package/3rdparty/walkontable/src/core/core.js +3 -2
  10. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  11. package/3rdparty/walkontable/src/event.js +12 -10
  12. package/3rdparty/walkontable/src/event.mjs +12 -10
  13. package/3rdparty/walkontable/src/facade/core.js +2 -2
  14. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  15. package/3rdparty/walkontable/src/index.js +10 -2
  16. package/3rdparty/walkontable/src/index.mjs +2 -2
  17. package/3rdparty/walkontable/src/overlay/_base.js +8 -7
  18. package/3rdparty/walkontable/src/overlay/_base.mjs +8 -7
  19. package/3rdparty/walkontable/src/overlay/bottom.js +7 -6
  20. package/3rdparty/walkontable/src/overlay/bottom.mjs +7 -6
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +9 -10
  24. package/3rdparty/walkontable/src/overlay/top.mjs +9 -10
  25. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +12 -10
  26. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +12 -10
  27. package/3rdparty/walkontable/src/overlays.js +64 -55
  28. package/3rdparty/walkontable/src/overlays.mjs +64 -55
  29. package/3rdparty/walkontable/src/renderer/table.js +2 -0
  30. package/3rdparty/walkontable/src/renderer/table.mjs +2 -0
  31. package/3rdparty/walkontable/src/scroll.js +23 -20
  32. package/3rdparty/walkontable/src/scroll.mjs +23 -20
  33. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  34. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  35. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  36. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  37. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  38. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  39. package/3rdparty/walkontable/src/selection/index.js +30 -0
  40. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  41. package/3rdparty/walkontable/src/selection/manager.js +334 -0
  42. package/3rdparty/walkontable/src/selection/manager.mjs +328 -0
  43. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  44. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  45. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  46. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  47. package/3rdparty/walkontable/src/settings.js +15 -13
  48. package/3rdparty/walkontable/src/settings.mjs +15 -13
  49. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  50. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  51. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  52. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  53. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  54. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  55. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  56. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  57. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  58. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  59. package/3rdparty/walkontable/src/table.js +33 -101
  60. package/3rdparty/walkontable/src/table.mjs +34 -102
  61. package/base.js +4 -2
  62. package/base.mjs +2 -2
  63. package/core.d.ts +4 -0
  64. package/core.js +49 -8
  65. package/core.mjs +49 -8
  66. package/dataMap/dataSource.js +5 -5
  67. package/dataMap/dataSource.mjs +5 -5
  68. package/dataMap/metaManager/metaSchema.js +7 -0
  69. package/dataMap/metaManager/metaSchema.mjs +7 -0
  70. package/dist/handsontable.css +7 -2
  71. package/dist/handsontable.full.css +7 -2
  72. package/dist/handsontable.full.js +9409 -9084
  73. package/dist/handsontable.full.min.css +3 -3
  74. package/dist/handsontable.full.min.js +115 -123
  75. package/dist/handsontable.js +9497 -9171
  76. package/dist/handsontable.min.css +3 -3
  77. package/dist/handsontable.min.js +3 -11
  78. package/dist/languages/all.js +0 -133
  79. package/dist/languages/ar-AR.js +0 -7
  80. package/dist/languages/cs-CZ.js +0 -7
  81. package/dist/languages/de-CH.js +0 -7
  82. package/dist/languages/de-DE.js +0 -7
  83. package/dist/languages/en-US.js +0 -7
  84. package/dist/languages/es-MX.js +0 -7
  85. package/dist/languages/fr-FR.js +0 -7
  86. package/dist/languages/it-IT.js +0 -7
  87. package/dist/languages/ja-JP.js +0 -7
  88. package/dist/languages/ko-KR.js +0 -7
  89. package/dist/languages/lv-LV.js +0 -7
  90. package/dist/languages/nb-NO.js +0 -7
  91. package/dist/languages/nl-NL.js +0 -7
  92. package/dist/languages/pl-PL.js +0 -7
  93. package/dist/languages/pt-BR.js +0 -7
  94. package/dist/languages/ru-RU.js +0 -7
  95. package/dist/languages/sr-SP.js +0 -7
  96. package/dist/languages/zh-CN.js +0 -7
  97. package/dist/languages/zh-TW.js +0 -7
  98. package/editorManager.js +7 -3
  99. package/editorManager.mjs +7 -3
  100. package/editors/textEditor/textEditor.js +3 -16
  101. package/editors/textEditor/textEditor.mjs +4 -17
  102. package/focusManager.d.ts +12 -0
  103. package/focusManager.js +249 -0
  104. package/focusManager.mjs +245 -0
  105. package/helpers/dom/element.js +11 -0
  106. package/helpers/dom/element.mjs +10 -0
  107. package/helpers/mixed.js +1 -1
  108. package/helpers/mixed.mjs +1 -1
  109. package/i18n/languages/ar-AR.js +1 -7
  110. package/i18n/languages/cs-CZ.js +1 -7
  111. package/i18n/languages/de-CH.js +1 -7
  112. package/i18n/languages/de-DE.js +1 -7
  113. package/i18n/languages/en-US.js +1 -7
  114. package/i18n/languages/es-MX.js +1 -7
  115. package/i18n/languages/fr-FR.js +1 -7
  116. package/i18n/languages/it-IT.js +1 -7
  117. package/i18n/languages/ja-JP.js +1 -7
  118. package/i18n/languages/ko-KR.js +1 -7
  119. package/i18n/languages/lv-LV.js +1 -7
  120. package/i18n/languages/nb-NO.js +1 -7
  121. package/i18n/languages/nl-NL.js +1 -7
  122. package/i18n/languages/pl-PL.js +1 -7
  123. package/i18n/languages/pt-BR.js +1 -7
  124. package/i18n/languages/ru-RU.js +1 -7
  125. package/i18n/languages/sr-SP.js +1 -7
  126. package/i18n/languages/zh-CN.js +1 -7
  127. package/i18n/languages/zh-TW.js +1 -7
  128. package/languages/all.js +0 -133
  129. package/languages/ar-AR.js +0 -7
  130. package/languages/cs-CZ.js +0 -7
  131. package/languages/de-CH.js +0 -7
  132. package/languages/de-DE.js +0 -7
  133. package/languages/en-US.js +0 -7
  134. package/languages/es-MX.js +0 -7
  135. package/languages/fr-FR.js +0 -7
  136. package/languages/index.js +0 -133
  137. package/languages/it-IT.js +0 -7
  138. package/languages/ja-JP.js +0 -7
  139. package/languages/ko-KR.js +0 -7
  140. package/languages/lv-LV.js +0 -7
  141. package/languages/nb-NO.js +0 -7
  142. package/languages/nl-NL.js +0 -7
  143. package/languages/pl-PL.js +0 -7
  144. package/languages/pt-BR.js +0 -7
  145. package/languages/ru-RU.js +0 -7
  146. package/languages/sr-SP.js +0 -7
  147. package/languages/zh-CN.js +0 -7
  148. package/languages/zh-TW.js +0 -7
  149. package/package.json +2 -3
  150. package/pluginHooks.js +7 -17
  151. package/pluginHooks.mjs +4 -16
  152. package/plugins/autoRowSize/autoRowSize.js +2 -2
  153. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  154. package/plugins/copyPaste/copyPaste.js +12 -93
  155. package/plugins/copyPaste/copyPaste.mjs +12 -93
  156. package/plugins/copyPaste/copyableRanges.js +31 -25
  157. package/plugins/copyPaste/copyableRanges.mjs +24 -18
  158. package/plugins/customBorders/customBorders.js +6 -2
  159. package/plugins/customBorders/customBorders.mjs +7 -3
  160. package/plugins/filters/filters.js +0 -5
  161. package/plugins/filters/filters.mjs +0 -5
  162. package/plugins/formulas/formulas.js +168 -190
  163. package/plugins/formulas/formulas.mjs +168 -190
  164. package/plugins/mergeCells/mergeCells.js +0 -16
  165. package/plugins/mergeCells/mergeCells.mjs +0 -16
  166. package/plugins/nestedHeaders/nestedHeaders.js +3 -4
  167. package/plugins/nestedHeaders/nestedHeaders.mjs +3 -4
  168. package/plugins/nestedHeaders/stateManager/headersTree.js +26 -23
  169. package/plugins/nestedHeaders/stateManager/headersTree.mjs +23 -20
  170. package/plugins/nestedHeaders/stateManager/index.js +3 -3
  171. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +0 -1
  172. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
  173. package/plugins/nestedHeaders/utils/ghostTable.js +35 -30
  174. package/plugins/nestedHeaders/utils/ghostTable.mjs +35 -30
  175. package/plugins/registry.js +1 -3
  176. package/plugins/undoRedo/undoRedo.js +1 -0
  177. package/plugins/undoRedo/undoRedo.mjs +1 -0
  178. package/renderers/baseRenderer/baseRenderer.js +3 -0
  179. package/renderers/baseRenderer/baseRenderer.mjs +3 -0
  180. package/selection/highlight/highlight.js +335 -133
  181. package/selection/highlight/highlight.mjs +325 -129
  182. package/selection/highlight/types/activeHeader.js +10 -9
  183. package/selection/highlight/types/activeHeader.mjs +10 -8
  184. package/selection/highlight/types/area.js +12 -27
  185. package/selection/highlight/types/area.mjs +16 -30
  186. package/selection/highlight/types/areaLayered.js +54 -0
  187. package/selection/highlight/types/areaLayered.mjs +49 -0
  188. package/selection/highlight/types/column.js +50 -0
  189. package/selection/highlight/types/column.mjs +45 -0
  190. package/selection/highlight/types/customSelection.js +7 -10
  191. package/selection/highlight/types/customSelection.mjs +7 -9
  192. package/selection/highlight/types/fill.js +5 -8
  193. package/selection/highlight/types/fill.mjs +5 -7
  194. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  195. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  196. package/selection/highlight/types/header.js +10 -20
  197. package/selection/highlight/types/header.mjs +10 -19
  198. package/selection/highlight/types/{index.js → row.js} +27 -31
  199. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  200. package/selection/highlight/visualSelection.js +12 -21
  201. package/selection/highlight/visualSelection.mjs +12 -21
  202. package/selection/index.js +4 -7
  203. package/selection/index.mjs +2 -3
  204. package/selection/selection.js +88 -46
  205. package/selection/selection.mjs +82 -44
  206. package/settings.d.ts +1 -0
  207. package/tableView.js +94 -66
  208. package/tableView.mjs +94 -66
  209. package/translations/changesObservable/observable.js +46 -41
  210. package/translations/changesObservable/observable.mjs +41 -36
  211. package/translations/changesObservable/observer.js +1 -1
  212. package/translations/indexMapper.js +0 -21
  213. package/translations/indexMapper.mjs +0 -21
  214. package/utils/dataStructures/tree.js +18 -15
  215. package/utils/dataStructures/tree.mjs +18 -15
  216. package/utils/parseTable.js +1 -5
  217. package/utils/parseTable.mjs +1 -5
  218. package/3rdparty/walkontable/src/selection.js +0 -354
  219. package/3rdparty/walkontable/src/selection.mjs +0 -348
  220. package/plugins/copyPaste/focusableElement.js +0 -219
  221. package/plugins/copyPaste/focusableElement.mjs +0 -213
  222. package/plugins/formulas/indexSyncer/axisSyncer.js +0 -379
  223. package/plugins/formulas/indexSyncer/axisSyncer.mjs +0 -374
  224. package/plugins/formulas/indexSyncer/index.js +0 -225
  225. package/plugins/formulas/indexSyncer/index.mjs +0 -219
  226. package/selection/highlight/constants.js +0 -16
  227. package/selection/highlight/constants.mjs +0 -6
@@ -2,6 +2,8 @@ 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; }
5
7
  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); }
6
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
9
  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."); }
@@ -38,6 +40,9 @@ import "core-js/modules/es.symbol.iterator.js";
38
40
  import "core-js/modules/es.function.name.js";
39
41
  import "core-js/modules/es.array.from.js";
40
42
  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";
41
46
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42
47
  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); } }
43
48
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -71,10 +76,10 @@ import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./eng
71
76
  import { isArrayOfArrays } from "../../helpers/data.mjs";
72
77
  import { toUpperCaseFirst } from "../../helpers/string.mjs";
73
78
  import Hooks from "../../pluginHooks.mjs";
74
- import IndexSyncer from "./indexSyncer/index.mjs";
75
79
  export var PLUGIN_KEY = 'formulas';
76
80
  export var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
77
81
  export var PLUGIN_PRIORITY = 260;
82
+ var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
78
83
  Hooks.getSingleton().register('afterNamedExpressionAdded');
79
84
  Hooks.getSingleton().register('afterNamedExpressionRemoved');
80
85
  Hooks.getSingleton().register('afterSheetAdded');
@@ -180,24 +185,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
180
185
  * @type {string|null}
181
186
  */
182
187
  _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);
201
188
  return _this;
202
189
  }
203
190
  _createClass(Formulas, [{
@@ -305,41 +292,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
305
292
  this.addHook('afterRemoveCol', function () {
306
293
  return _this8.onAfterRemoveCol.apply(_this8, arguments);
307
294
  });
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
- });
343
295
 
344
296
  // TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
345
297
  // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
@@ -349,22 +301,22 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
349
301
  });
350
302
 
351
303
  // Handling undo actions on data just using HyperFormula's UndoRedo mechanism
352
- this.addHook('beforeUndo', function () {
353
- _this8.indexSyncer.setPerformUndo(true);
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
+ }
354
309
  _this8.engine.undo();
355
310
  });
356
311
 
357
312
  // Handling redo actions on data just using HyperFormula's UndoRedo mechanism
358
- this.addHook('beforeRedo', function () {
359
- _this8.indexSyncer.setPerformRedo(true);
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
+ }
360
318
  _this8.engine.redo();
361
319
  });
362
- this.addHook('afterUndo', function () {
363
- _this8.indexSyncer.setPerformUndo(false);
364
- });
365
- this.addHook('afterUndo', function () {
366
- _this8.indexSyncer.setPerformRedo(false);
367
- });
368
320
  this.addHook('afterDetachChild', function () {
369
321
  return _this8.onAfterDetachChild.apply(_this8, arguments);
370
322
  });
@@ -449,6 +401,63 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
449
401
  _get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
450
402
  }
451
403
 
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
+
452
461
  /**
453
462
  * Add a sheet to the shared HyperFormula instance.
454
463
  *
@@ -519,8 +528,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
519
528
  if (physicalRow !== null && physicalColumn !== null) {
520
529
  return this.engine.getCellType({
521
530
  sheet: sheet,
522
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
523
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
531
+ row: physicalRow,
532
+ col: physicalColumn
524
533
  });
525
534
  } else {
526
535
  // Should return `EMPTY` when out of bounds (according to the test cases).
@@ -540,10 +549,15 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
540
549
  key: "isFormulaCellType",
541
550
  value: function isFormulaCellType(row, column) {
542
551
  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
+ }
543
557
  return this.engine.doesCellHaveFormula({
544
558
  sheet: sheet,
545
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
546
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
559
+ row: physicalRow,
560
+ col: physicalColumn
547
561
  });
548
562
  }
549
563
 
@@ -608,9 +622,11 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
608
622
  var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
609
623
  row = _ref8.row,
610
624
  col = _ref8.col;
625
+ var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
626
+ var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
611
627
 
612
628
  // Don't try to validate cells outside of the visual part of the table.
613
- if (isDefined(row) === false || isDefined(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
629
+ if (visualRow === null || visualColumn === null) {
614
630
  return;
615
631
  }
616
632
 
@@ -629,7 +645,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
629
645
  }
630
646
 
631
647
  // It will just re-render certain cell when necessary.
632
- boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
648
+ boundHot.validateCell(boundHot.getDataAtCell(visualRow, visualColumn), boundHot.getCellMeta(visualRow, visualColumn), function () {});
633
649
  }
634
650
  });
635
651
  }
@@ -647,8 +663,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
647
663
  key: "syncChangeWithEngine",
648
664
  value: function syncChangeWithEngine(row, column, newValue) {
649
665
  var address = {
650
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
651
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
666
+ row: this.toPhysicalRowPosition(row),
667
+ col: this.toPhysicalColumnPosition(column),
652
668
  sheet: this.sheetId
653
669
  };
654
670
  if (!this.engine.isItPossibleToSetCellContents(address)) {
@@ -684,8 +700,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
684
700
  var visualColumn = this.hot.propToCol(prop);
685
701
  if (this.isFormulaCellType(visualRow, visualColumn)) {
686
702
  var address = {
687
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
688
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
703
+ row: this.hot.toPhysicalRow(visualRow),
704
+ col: this.hot.toPhysicalColumn(visualColumn),
689
705
  sheet: this.sheetId
690
706
  };
691
707
  var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
@@ -714,41 +730,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
714
730
  }, {
715
731
  key: "onBeforeAutofill",
716
732
  value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
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;
733
+ var _this13 = this;
734
+ var withSheetId = function withSheetId(range) {
735
+ return _objectSpread(_objectSpread({}, range), {}, {
736
+ sheet: _this13.sheetId
737
+ });
738
+ };
729
739
  var engineSourceRange = {
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
- }
740
+ start: withSheetId(sourceRange.getTopStartCorner()),
741
+ end: withSheetId(sourceRange.getBottomEndCorner())
740
742
  };
741
743
  var engineTargetRange = {
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
- }
744
+ start: withSheetId(targetRange.getTopStartCorner()),
745
+ end: withSheetId(targetRange.getBottomEndCorner())
752
746
  };
753
747
 
754
748
  // Blocks the autofill operation if HyperFormula says that at least one of
@@ -814,19 +808,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
814
808
  }, {
815
809
  key: "onAfterCellMetaReset",
816
810
  value: function onAfterCellMetaReset() {
817
- var _this13 = this;
811
+ var _this14 = this;
818
812
  var sourceDataArray = this.hot.getSourceDataArray();
819
813
  var valueChanged = false;
820
814
  sourceDataArray.forEach(function (rowData, rowIndex) {
821
815
  rowData.forEach(function (cellValue, columnIndex) {
822
- var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
816
+ var cellMeta = _this14.hot.getCellMeta(rowIndex, columnIndex);
823
817
  var dateFormat = cellMeta.dateFormat;
824
818
  if (isDate(cellValue, cellMeta.type)) {
825
819
  valueChanged = true;
826
820
  if (isDateValid(cellValue, dateFormat)) {
827
821
  // Rewriting date in HOT format to HF format.
828
822
  sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);
829
- } else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
823
+ } else if (_this14.isFormulaCellType(rowIndex, columnIndex) === false) {
830
824
  // Escaping value from date parsing using "'" sign (HF feature).
831
825
  sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
832
826
  }
@@ -861,7 +855,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
861
855
  if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
862
856
  _classPrivateFieldSet(this, _internalOperationPending, true);
863
857
  var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
864
- this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
865
858
  this.renderDependentSheets(dependentCells);
866
859
  _classPrivateFieldSet(this, _internalOperationPending, false);
867
860
  }
@@ -874,27 +867,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
874
867
  * `modifyData` hook callback.
875
868
  *
876
869
  * @private
877
- * @param {number} physicalRow Physical row index.
878
- * @param {number} visualColumn Visual column index.
870
+ * @param {number} row Physical row height.
871
+ * @param {number} column Physical column index.
879
872
  * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
880
873
  * property.
881
874
  * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
882
875
  */
883
876
  }, {
884
877
  key: "onModifyData",
885
- value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
878
+ value: function onModifyData(row, column, valueHolder, ioMode) {
886
879
  if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
887
880
  return;
888
881
  }
889
- var visualRow = this.hot.toVisualRow(physicalRow);
890
- if (visualRow === null || visualColumn === null) {
891
- return;
892
- }
882
+ var visualRow = this.hot.toVisualRow(row);
893
883
 
894
884
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
895
- var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
885
+ var isFormulaCellType = this.isFormulaCellType(visualRow, column);
896
886
  if (!isFormulaCellType) {
897
- var cellType = this.getCellType(visualRow, visualColumn);
887
+ var cellType = this.getCellType(visualRow, column);
898
888
  if (cellType !== 'ARRAY') {
899
889
  if (isEscapedFormulaExpression(valueHolder.value)) {
900
890
  valueHolder.value = unescapeFormulaExpression(valueHolder.value);
@@ -902,13 +892,15 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
902
892
  return;
903
893
  }
904
894
  }
895
+
896
+ // `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
905
897
  var address = {
906
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
907
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
898
+ row: row,
899
+ col: this.toPhysicalColumnPosition(column),
908
900
  sheet: this.sheetId
909
901
  };
910
902
  var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
911
- var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
903
+ var cellMeta = this.hot.getCellMeta(row, column);
912
904
  if (cellMeta.type === 'date' && isNumeric(cellValue)) {
913
905
  cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
914
906
  }
@@ -936,9 +928,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
936
928
  }
937
929
  var visualRow = this.hot.toVisualRow(row);
938
930
  var visualColumn = this.hot.propToCol(columnOrProp);
939
- if (visualRow === null || visualColumn === null) {
940
- return;
941
- }
942
931
 
943
932
  // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
944
933
  var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
@@ -958,8 +947,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
958
947
  return;
959
948
  }
960
949
  var address = {
961
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
962
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
950
+ row: row,
951
+ // Workaround for inconsistencies in `src/dataSource.js`
952
+ col: this.toPhysicalColumnPosition(visualColumn),
963
953
  sheet: this.sheetId
964
954
  };
965
955
  valueHolder.value = this.engine.getCellSerialized(address);
@@ -976,7 +966,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
976
966
  }, {
977
967
  key: "onAfterSetDataAtCell",
978
968
  value: function onAfterSetDataAtCell(changes, source) {
979
- var _this14 = this;
969
+ var _this15 = this;
980
970
  if (isBlockedSource(source)) {
981
971
  return;
982
972
  }
@@ -985,21 +975,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
985
975
  var dependentCells = this.engine.batch(function () {
986
976
  changes.forEach(function (_ref9) {
987
977
  var _ref10 = _slicedToArray(_ref9, 4),
988
- visualRow = _ref10[0],
978
+ row = _ref10[0],
989
979
  prop = _ref10[1],
990
980
  newValue = _ref10[3];
991
- var visualColumn = _this14.hot.propToCol(prop);
992
- var physicalRow = _this14.hot.toPhysicalRow(visualRow);
993
- var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
981
+ var column = _this15.hot.propToCol(prop);
982
+ var physicalRow = _this15.hot.toPhysicalRow(row);
983
+ var physicalColumn = _this15.hot.toPhysicalColumn(column);
994
984
  var address = {
995
- row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
996
- col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
997
- sheet: _this14.sheetId
985
+ row: physicalRow,
986
+ col: physicalColumn,
987
+ sheet: _this15.sheetId
998
988
  };
999
989
  if (physicalRow !== null && physicalColumn !== null) {
1000
- _this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
990
+ _this15.syncChangeWithEngine(row, column, newValue);
1001
991
  } else {
1002
- outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
992
+ outOfBoundsChanges.push([row, column, newValue]);
1003
993
  }
1004
994
  changedCells.push({
1005
995
  address: address
@@ -1010,16 +1000,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1010
1000
  // Workaround for rows/columns being created two times (by HOT and the engine).
1011
1001
  // (unfortunately, this requires an extra re-render)
1012
1002
  this.hot.addHookOnce('afterChange', function () {
1013
- var outOfBoundsDependentCells = _this14.engine.batch(function () {
1003
+ var outOfBoundsDependentCells = _this15.engine.batch(function () {
1014
1004
  outOfBoundsChanges.forEach(function (_ref11) {
1015
1005
  var _ref12 = _slicedToArray(_ref11, 3),
1016
1006
  row = _ref12[0],
1017
1007
  column = _ref12[1],
1018
1008
  newValue = _ref12[2];
1019
- _this14.syncChangeWithEngine(row, column, newValue);
1009
+ _this15.syncChangeWithEngine(row, column, newValue);
1020
1010
  });
1021
1011
  });
1022
- _this14.renderDependentSheets(outOfBoundsDependentCells, true);
1012
+ _this15.renderDependentSheets(outOfBoundsDependentCells, true);
1023
1013
  });
1024
1014
  }
1025
1015
  this.renderDependentSheets(dependentCells);
@@ -1037,7 +1027,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1037
1027
  }, {
1038
1028
  key: "onAfterSetSourceDataAtCell",
1039
1029
  value: function onAfterSetSourceDataAtCell(changes, source) {
1040
- var _this15 = this;
1030
+ var _this16 = this;
1041
1031
  if (isBlockedSource(source)) {
1042
1032
  return;
1043
1033
  }
@@ -1045,26 +1035,26 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1045
1035
  var changedCells = [];
1046
1036
  changes.forEach(function (_ref13) {
1047
1037
  var _ref14 = _slicedToArray(_ref13, 4),
1048
- visualRow = _ref14[0],
1038
+ row = _ref14[0],
1049
1039
  prop = _ref14[1],
1050
1040
  newValue = _ref14[3];
1051
- var visualColumn = _this15.hot.propToCol(prop);
1052
- if (!isNumeric(visualColumn)) {
1041
+ var column = _this16.hot.propToCol(prop);
1042
+ if (!isNumeric(column)) {
1053
1043
  return;
1054
1044
  }
1055
1045
  var address = {
1056
- row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1057
- col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1058
- sheet: _this15.sheetId
1046
+ row: row,
1047
+ col: _this16.toPhysicalColumnPosition(column),
1048
+ sheet: _this16.sheetId
1059
1049
  };
1060
- if (!_this15.engine.isItPossibleToSetCellContents(address)) {
1050
+ if (!_this16.engine.isItPossibleToSetCellContents(address)) {
1061
1051
  warn("Not possible to set source cell data at ".concat(JSON.stringify(address)));
1062
1052
  return;
1063
1053
  }
1064
1054
  changedCells.push({
1065
1055
  address: address
1066
1056
  });
1067
- dependentCells.push.apply(dependentCells, _toConsumableArray(_this15.engine.setCellContents(address, newValue)));
1057
+ dependentCells.push.apply(dependentCells, _toConsumableArray(_this16.engine.setCellContents(address, newValue)));
1068
1058
  });
1069
1059
  this.renderDependentSheets(dependentCells);
1070
1060
  this.validateDependentCells(dependentCells, changedCells);
@@ -1074,19 +1064,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1074
1064
  * `beforeCreateRow` hook callback.
1075
1065
  *
1076
1066
  * @private
1077
- * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1067
+ * @param {number} row Represents the visual index of first newly created row in the data source array.
1078
1068
  * @param {number} amount Number of newly created rows in the data source array.
1079
1069
  * @returns {*|boolean} If false is returned the action is canceled.
1080
1070
  */
1081
1071
  }, {
1082
1072
  key: "onBeforeCreateRow",
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])) {
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])) {
1090
1075
  return false;
1091
1076
  }
1092
1077
  }
@@ -1095,19 +1080,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1095
1080
  * `beforeCreateCol` hook callback.
1096
1081
  *
1097
1082
  * @private
1098
- * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1083
+ * @param {number} col Represents the visual index of first newly created column in the data source.
1099
1084
  * @param {number} amount Number of newly created columns in the data source.
1100
1085
  * @returns {*|boolean} If false is returned the action is canceled.
1101
1086
  */
1102
1087
  }, {
1103
1088
  key: "onBeforeCreateCol",
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])) {
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])) {
1111
1091
  return false;
1112
1092
  }
1113
1093
  }
@@ -1124,10 +1104,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1124
1104
  }, {
1125
1105
  key: "onBeforeRemoveRow",
1126
1106
  value: function onBeforeRemoveRow(row, amount, physicalRows) {
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]);
1107
+ var _this17 = this;
1108
+ var possible = physicalRows.every(function (physicalRow) {
1109
+ return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
1131
1110
  });
1132
1111
  return possible === false ? false : void 0;
1133
1112
  }
@@ -1144,10 +1123,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1144
1123
  }, {
1145
1124
  key: "onBeforeRemoveCol",
1146
1125
  value: function onBeforeRemoveCol(col, amount, physicalColumns) {
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]);
1126
+ var _this18 = this;
1127
+ var possible = physicalColumns.every(function (physicalColumn) {
1128
+ return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
1151
1129
  });
1152
1130
  return possible === false ? false : void 0;
1153
1131
  }
@@ -1156,18 +1134,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1156
1134
  * `afterCreateRow` hook callback.
1157
1135
  *
1158
1136
  * @private
1159
- * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1137
+ * @param {number} row Represents the visual index of first newly created row in the data source array.
1160
1138
  * @param {number} amount Number of newly created rows in the data source array.
1161
1139
  * @param {string} [source] String that identifies source of hook call
1162
1140
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1163
1141
  */
1164
1142
  }, {
1165
1143
  key: "onAfterCreateRow",
1166
- value: function onAfterCreateRow(visualRow, amount, source) {
1144
+ value: function onAfterCreateRow(row, amount, source) {
1167
1145
  if (isBlockedSource(source)) {
1168
1146
  return;
1169
1147
  }
1170
- var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1148
+ var changes = this.engine.addRows(this.sheetId, [this.toPhysicalRowPosition(row), amount]);
1171
1149
  this.renderDependentSheets(changes);
1172
1150
  }
1173
1151
 
@@ -1175,18 +1153,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1175
1153
  * `afterCreateCol` hook callback.
1176
1154
  *
1177
1155
  * @private
1178
- * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1156
+ * @param {number} col Represents the visual index of first newly created column in the data source.
1179
1157
  * @param {number} amount Number of newly created columns in the data source.
1180
1158
  * @param {string} [source] String that identifies source of hook call
1181
1159
  * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1182
1160
  */
1183
1161
  }, {
1184
1162
  key: "onAfterCreateCol",
1185
- value: function onAfterCreateCol(visualColumn, amount, source) {
1163
+ value: function onAfterCreateCol(col, amount, source) {
1186
1164
  if (isBlockedSource(source)) {
1187
1165
  return;
1188
1166
  }
1189
- var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1167
+ var changes = this.engine.addColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount]);
1190
1168
  this.renderDependentSheets(changes);
1191
1169
  }
1192
1170
 
@@ -1203,14 +1181,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1203
1181
  }, {
1204
1182
  key: "onAfterRemoveRow",
1205
1183
  value: function onAfterRemoveRow(row, amount, physicalRows, source) {
1206
- var _this18 = this;
1184
+ var _this19 = this;
1207
1185
  if (isBlockedSource(source)) {
1208
1186
  return;
1209
1187
  }
1210
- var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1188
+ var descendingPhysicalRows = physicalRows.sort().reverse();
1211
1189
  var changes = this.engine.batch(function () {
1212
- descendingHfRows.forEach(function (hfRow) {
1213
- _this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
1190
+ descendingPhysicalRows.forEach(function (physicalRow) {
1191
+ _this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
1214
1192
  });
1215
1193
  });
1216
1194
  this.renderDependentSheets(changes);
@@ -1229,14 +1207,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1229
1207
  }, {
1230
1208
  key: "onAfterRemoveCol",
1231
1209
  value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
1232
- var _this19 = this;
1210
+ var _this20 = this;
1233
1211
  if (isBlockedSource(source)) {
1234
1212
  return;
1235
1213
  }
1236
- var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1214
+ var descendingPhysicalColumns = physicalColumns.sort().reverse();
1237
1215
  var changes = this.engine.batch(function () {
1238
- descendingHfColumns.forEach(function (hfColumn) {
1239
- _this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
1216
+ descendingPhysicalColumns.forEach(function (physicalColumn) {
1217
+ _this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
1240
1218
  });
1241
1219
  });
1242
1220
  this.renderDependentSheets(changes);
@@ -1255,16 +1233,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
1255
1233
  key: "onAfterDetachChild",
1256
1234
  value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
1257
1235
  var _element$__children,
1258
- _this20 = this;
1236
+ _this21 = this;
1259
1237
  _classPrivateFieldSet(this, _internalOperationPending, true);
1260
1238
  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());
1261
1239
  _classPrivateFieldSet(this, _internalOperationPending, false);
1262
1240
  rowsData.forEach(function (row, relativeRowIndex) {
1263
1241
  row.forEach(function (value, colIndex) {
1264
- _this20.engine.setCellContents({
1242
+ _this21.engine.setCellContents({
1265
1243
  col: colIndex,
1266
1244
  row: finalElementRowIndex + relativeRowIndex,
1267
- sheet: _this20.sheetId
1245
+ sheet: _this21.sheetId
1268
1246
  }, [[value]]);
1269
1247
  });
1270
1248
  });