handsontable 14.0.0-next-c080457-20231107 → 14.0.0-next-bfad250-20231108

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. package/3rdparty/SheetClip/SheetClip.js +2 -2
  2. package/3rdparty/SheetClip/SheetClip.mjs +2 -2
  3. package/3rdparty/autoResize/autoResize.js +2 -2
  4. package/3rdparty/autoResize/autoResize.mjs +2 -2
  5. package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
  6. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
  7. package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
  8. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
  9. package/3rdparty/walkontable/src/cell/coords.js +7 -5
  10. package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
  11. package/3rdparty/walkontable/src/core/clone.js +6 -0
  12. package/3rdparty/walkontable/src/core/clone.mjs +6 -0
  13. package/3rdparty/walkontable/src/event.js +125 -74
  14. package/3rdparty/walkontable/src/event.mjs +125 -74
  15. package/3rdparty/walkontable/src/filter/column.js +16 -0
  16. package/3rdparty/walkontable/src/filter/column.mjs +16 -0
  17. package/3rdparty/walkontable/src/filter/row.js +16 -0
  18. package/3rdparty/walkontable/src/filter/row.mjs +16 -0
  19. package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/top.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
  23. package/3rdparty/walkontable/src/renderer/_base.js +12 -5
  24. package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
  25. package/3rdparty/walkontable/src/renderer/cells.js +6 -2
  26. package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
  27. package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
  28. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
  29. package/3rdparty/walkontable/src/renderer/rows.js +5 -0
  30. package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
  31. package/3rdparty/walkontable/src/renderer/table.js +24 -17
  32. package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
  33. package/3rdparty/walkontable/src/scroll.js +2 -2
  34. package/3rdparty/walkontable/src/scroll.mjs +2 -2
  35. package/3rdparty/walkontable/src/selection/border/border.js +1 -1
  36. package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
  37. package/3rdparty/walkontable/src/settings.js +10 -10
  38. package/3rdparty/walkontable/src/settings.mjs +10 -10
  39. package/3rdparty/walkontable/src/table.js +3 -3
  40. package/3rdparty/walkontable/src/table.mjs +3 -3
  41. package/3rdparty/walkontable/src/utils/column.js +19 -4
  42. package/3rdparty/walkontable/src/utils/column.mjs +19 -4
  43. package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
  44. package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
  45. package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
  46. package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
  47. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
  48. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
  49. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
  50. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
  51. package/3rdparty/walkontable/src/utils/row.js +14 -2
  52. package/3rdparty/walkontable/src/utils/row.mjs +14 -2
  53. package/3rdparty/walkontable/src/viewport.js +9 -9
  54. package/3rdparty/walkontable/src/viewport.mjs +9 -9
  55. package/base.js +2 -2
  56. package/base.mjs +2 -2
  57. package/core.js +25 -25
  58. package/core.mjs +25 -25
  59. package/dataMap/dataMap.js +99 -90
  60. package/dataMap/dataMap.mjs +99 -90
  61. package/dataMap/dataSource.js +14 -8
  62. package/dataMap/dataSource.mjs +14 -8
  63. package/dataMap/metaManager/lazyFactoryMap.js +19 -7
  64. package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
  65. package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
  66. package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
  67. package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
  68. package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
  69. package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
  70. package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
  71. package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
  72. package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
  73. package/dataMap/metaManager/metaSchema.js +55 -55
  74. package/dataMap/metaManager/metaSchema.mjs +55 -55
  75. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
  76. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
  77. package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
  78. package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
  79. package/dataMap/metaManager/utils.js +2 -2
  80. package/dataMap/metaManager/utils.mjs +2 -2
  81. package/dist/handsontable.css +2 -2
  82. package/dist/handsontable.full.css +2 -2
  83. package/dist/handsontable.full.js +7337 -6389
  84. package/dist/handsontable.full.min.css +2 -2
  85. package/dist/handsontable.full.min.js +154 -154
  86. package/dist/handsontable.js +7336 -6388
  87. package/dist/handsontable.min.css +2 -2
  88. package/dist/handsontable.min.js +28 -28
  89. package/editorManager.js +105 -95
  90. package/editorManager.mjs +105 -95
  91. package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
  92. package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
  93. package/editors/baseEditor/baseEditor.js +23 -26
  94. package/editors/baseEditor/baseEditor.mjs +23 -26
  95. package/editors/dateEditor/dateEditor.js +24 -15
  96. package/editors/dateEditor/dateEditor.mjs +24 -15
  97. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  98. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  99. package/editors/handsontableEditor/handsontableEditor.js +4 -4
  100. package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
  101. package/editors/textEditor/textEditor.js +23 -17
  102. package/editors/textEditor/textEditor.mjs +24 -18
  103. package/eventManager.js +8 -0
  104. package/eventManager.mjs +8 -0
  105. package/helpers/array.js +2 -2
  106. package/helpers/array.mjs +2 -2
  107. package/helpers/dom/element.js +7 -7
  108. package/helpers/dom/element.mjs +7 -7
  109. package/helpers/function.js +1 -1
  110. package/helpers/function.mjs +1 -1
  111. package/helpers/mixed.js +1 -1
  112. package/helpers/mixed.mjs +1 -1
  113. package/helpers/object.js +4 -4
  114. package/helpers/object.mjs +4 -4
  115. package/helpers/string.js +1 -1
  116. package/helpers/string.mjs +1 -1
  117. package/package.json +1 -1
  118. package/pluginHooks.d.ts +0 -2
  119. package/pluginHooks.js +12 -3
  120. package/pluginHooks.mjs +12 -3
  121. package/plugins/autoColumnSize/autoColumnSize.js +141 -130
  122. package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
  123. package/plugins/autoRowSize/autoRowSize.js +112 -125
  124. package/plugins/autoRowSize/autoRowSize.mjs +110 -123
  125. package/plugins/autofill/autofill.d.ts +0 -1
  126. package/plugins/autofill/autofill.js +98 -102
  127. package/plugins/autofill/autofill.mjs +97 -101
  128. package/plugins/base/base.js +61 -28
  129. package/plugins/base/base.mjs +60 -28
  130. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
  131. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
  132. package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
  133. package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
  134. package/plugins/columnSorting/columnSorting.js +107 -99
  135. package/plugins/columnSorting/columnSorting.mjs +106 -98
  136. package/plugins/columnSorting/columnStatesManager.js +12 -6
  137. package/plugins/columnSorting/columnStatesManager.mjs +12 -6
  138. package/plugins/columnSummary/columnSummary.js +71 -58
  139. package/plugins/columnSummary/columnSummary.mjs +70 -57
  140. package/plugins/columnSummary/endpoints.js +20 -14
  141. package/plugins/columnSummary/endpoints.mjs +20 -14
  142. package/plugins/comments/commentEditor.js +30 -2
  143. package/plugins/comments/commentEditor.mjs +30 -2
  144. package/plugins/comments/comments.js +158 -169
  145. package/plugins/comments/comments.mjs +157 -168
  146. package/plugins/comments/displaySwitch.js +7 -3
  147. package/plugins/comments/displaySwitch.mjs +7 -3
  148. package/plugins/contextMenu/commandExecutor.js +15 -2
  149. package/plugins/contextMenu/commandExecutor.mjs +15 -2
  150. package/plugins/contextMenu/contextMenu.js +96 -102
  151. package/plugins/contextMenu/contextMenu.mjs +95 -101
  152. package/plugins/contextMenu/itemsFactory.js +19 -4
  153. package/plugins/contextMenu/itemsFactory.mjs +19 -4
  154. package/plugins/contextMenu/menu/cursor.js +36 -0
  155. package/plugins/contextMenu/menu/cursor.mjs +36 -0
  156. package/plugins/contextMenu/menu/menu.js +57 -5
  157. package/plugins/contextMenu/menu/menu.mjs +57 -5
  158. package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
  159. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
  160. package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
  161. package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
  162. package/plugins/copyPaste/copyPaste.js +74 -75
  163. package/plugins/copyPaste/copyPaste.mjs +74 -75
  164. package/plugins/customBorders/customBorders.js +57 -50
  165. package/plugins/customBorders/customBorders.mjs +56 -49
  166. package/plugins/dragToScroll/dragToScroll.js +50 -54
  167. package/plugins/dragToScroll/dragToScroll.mjs +49 -52
  168. package/plugins/dropdownMenu/dropdownMenu.js +136 -131
  169. package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
  170. package/plugins/exportFile/dataProvider.js +7 -2
  171. package/plugins/exportFile/dataProvider.mjs +7 -2
  172. package/plugins/exportFile/exportFile.js +1 -1
  173. package/plugins/exportFile/exportFile.mjs +1 -1
  174. package/plugins/exportFile/types/_base.js +14 -6
  175. package/plugins/exportFile/types/_base.mjs +14 -6
  176. package/plugins/filters/component/actionBar.js +9 -0
  177. package/plugins/filters/component/actionBar.mjs +9 -0
  178. package/plugins/filters/component/condition.js +13 -0
  179. package/plugins/filters/component/condition.mjs +13 -0
  180. package/plugins/filters/component/operators.js +9 -0
  181. package/plugins/filters/component/operators.mjs +9 -0
  182. package/plugins/filters/component/value.js +9 -0
  183. package/plugins/filters/component/value.mjs +9 -0
  184. package/plugins/filters/conditionCollection.js +9 -4
  185. package/plugins/filters/conditionCollection.mjs +9 -4
  186. package/plugins/filters/conditionUpdateObserver.js +53 -42
  187. package/plugins/filters/conditionUpdateObserver.mjs +53 -42
  188. package/plugins/filters/dataFilter.js +9 -3
  189. package/plugins/filters/dataFilter.mjs +9 -3
  190. package/plugins/filters/filters.js +184 -189
  191. package/plugins/filters/filters.mjs +182 -187
  192. package/plugins/filters/ui/_base.js +1 -1
  193. package/plugins/filters/ui/_base.mjs +1 -1
  194. package/plugins/filters/utils.js +1 -1
  195. package/plugins/filters/utils.mjs +1 -1
  196. package/plugins/formulas/engine/settings.js +1 -1
  197. package/plugins/formulas/engine/settings.mjs +1 -1
  198. package/plugins/formulas/formulas.js +684 -602
  199. package/plugins/formulas/formulas.mjs +682 -600
  200. package/plugins/hiddenColumns/hiddenColumns.js +174 -169
  201. package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
  202. package/plugins/hiddenRows/hiddenRows.js +170 -165
  203. package/plugins/hiddenRows/hiddenRows.mjs +169 -164
  204. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  205. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  206. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  207. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  208. package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
  209. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
  210. package/plugins/manualColumnMove/manualColumnMove.js +287 -232
  211. package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
  212. package/plugins/manualColumnMove/ui/_base.js +9 -3
  213. package/plugins/manualColumnMove/ui/_base.mjs +9 -3
  214. package/plugins/manualColumnResize/manualColumnResize.js +291 -246
  215. package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
  216. package/plugins/manualRowMove/manualRowMove.js +223 -208
  217. package/plugins/manualRowMove/manualRowMove.mjs +222 -207
  218. package/plugins/manualRowMove/ui/_base.js +10 -5
  219. package/plugins/manualRowMove/ui/_base.mjs +10 -5
  220. package/plugins/manualRowResize/manualRowResize.js +254 -209
  221. package/plugins/manualRowResize/manualRowResize.mjs +253 -207
  222. package/plugins/mergeCells/calculations/autofill.js +9 -3
  223. package/plugins/mergeCells/calculations/autofill.mjs +9 -3
  224. package/plugins/mergeCells/calculations/selection.js +10 -4
  225. package/plugins/mergeCells/calculations/selection.mjs +10 -4
  226. package/plugins/mergeCells/cellCoords.js +16 -6
  227. package/plugins/mergeCells/cellCoords.mjs +16 -6
  228. package/plugins/mergeCells/cellsCollection.js +10 -4
  229. package/plugins/mergeCells/cellsCollection.mjs +10 -4
  230. package/plugins/mergeCells/mergeCells.js +582 -502
  231. package/plugins/mergeCells/mergeCells.mjs +580 -500
  232. package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
  233. package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
  234. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
  235. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
  236. package/plugins/nestedHeaders/nestedHeaders.js +542 -499
  237. package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
  238. package/plugins/nestedHeaders/stateManager/index.js +1 -1
  239. package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
  240. package/plugins/nestedRows/data/dataManager.js +21 -15
  241. package/plugins/nestedRows/data/dataManager.mjs +21 -15
  242. package/plugins/nestedRows/nestedRows.js +335 -279
  243. package/plugins/nestedRows/nestedRows.mjs +334 -278
  244. package/plugins/nestedRows/ui/_base.js +7 -1
  245. package/plugins/nestedRows/ui/_base.mjs +7 -1
  246. package/plugins/nestedRows/ui/collapsing.js +2 -2
  247. package/plugins/nestedRows/ui/collapsing.mjs +2 -2
  248. package/plugins/nestedRows/ui/contextMenu.js +28 -18
  249. package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
  250. package/plugins/nestedRows/utils/rowMoveController.js +12 -4
  251. package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
  252. package/plugins/persistentState/persistentState.js +14 -11
  253. package/plugins/persistentState/persistentState.mjs +14 -11
  254. package/plugins/persistentState/storage.js +11 -6
  255. package/plugins/persistentState/storage.mjs +11 -6
  256. package/plugins/registry.js +2 -2
  257. package/plugins/registry.mjs +2 -2
  258. package/plugins/search/search.js +57 -46
  259. package/plugins/search/search.mjs +56 -45
  260. package/plugins/touchScroll/touchScroll.js +102 -100
  261. package/plugins/touchScroll/touchScroll.mjs +100 -98
  262. package/plugins/trimRows/trimRows.js +33 -28
  263. package/plugins/trimRows/trimRows.mjs +32 -27
  264. package/plugins/undoRedo/undoRedo.js +2 -2
  265. package/plugins/undoRedo/undoRedo.mjs +2 -2
  266. package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
  267. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
  268. package/renderers/baseRenderer/baseRenderer.js +2 -2
  269. package/renderers/baseRenderer/baseRenderer.mjs +2 -2
  270. package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
  271. package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
  272. package/renderers/dateRenderer/dateRenderer.js +4 -4
  273. package/renderers/dateRenderer/dateRenderer.mjs +4 -4
  274. package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
  275. package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
  276. package/renderers/htmlRenderer/htmlRenderer.js +4 -4
  277. package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
  278. package/renderers/numericRenderer/numericRenderer.js +3 -3
  279. package/renderers/numericRenderer/numericRenderer.mjs +3 -3
  280. package/renderers/passwordRenderer/passwordRenderer.js +3 -3
  281. package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
  282. package/renderers/selectRenderer/selectRenderer.js +4 -4
  283. package/renderers/selectRenderer/selectRenderer.mjs +4 -4
  284. package/renderers/textRenderer/textRenderer.js +5 -5
  285. package/renderers/textRenderer/textRenderer.mjs +5 -5
  286. package/renderers/timeRenderer/timeRenderer.js +3 -3
  287. package/renderers/timeRenderer/timeRenderer.mjs +3 -3
  288. package/selection/range.js +12 -2
  289. package/selection/range.mjs +12 -2
  290. package/selection/selection.js +28 -10
  291. package/selection/selection.mjs +28 -10
  292. package/selection/utils.js +24 -14
  293. package/selection/utils.mjs +25 -15
  294. package/shortcuts/manager.js +1 -1
  295. package/shortcuts/manager.mjs +1 -1
  296. package/tableView.js +208 -200
  297. package/tableView.mjs +208 -200
  298. package/translations/changesObservable/utils.js +2 -2
  299. package/translations/changesObservable/utils.mjs +2 -2
  300. package/translations/indexMapper.js +25 -22
  301. package/translations/indexMapper.mjs +25 -22
  302. package/translations/mapCollections/aggregatedCollection.js +8 -2
  303. package/translations/mapCollections/aggregatedCollection.mjs +8 -2
  304. package/translations/mapCollections/mapCollection.js +5 -2
  305. package/translations/mapCollections/mapCollection.mjs +5 -2
  306. package/translations/maps/indexMap.js +6 -1
  307. package/translations/maps/indexMap.mjs +6 -1
  308. package/translations/maps/utils/physicallyIndexed.js +2 -2
  309. package/translations/maps/utils/physicallyIndexed.mjs +2 -2
  310. package/utils/dataStructures/linkedList.js +10 -6
  311. package/utils/dataStructures/linkedList.mjs +10 -6
  312. package/utils/dataStructures/queue.js +1 -1
  313. package/utils/dataStructures/queue.mjs +1 -1
  314. package/utils/dataStructures/stack.js +1 -1
  315. package/utils/dataStructures/stack.mjs +1 -1
  316. package/utils/ghostTable.js +2 -2
  317. package/utils/ghostTable.mjs +2 -2
  318. package/utils/interval.js +73 -36
  319. package/utils/interval.mjs +73 -36
  320. package/utils/parseTable.js +1 -1
  321. package/utils/parseTable.mjs +1 -1
  322. package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
  323. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
  324. package/validators/dateValidator/dateValidator.js +1 -1
  325. package/validators/dateValidator/dateValidator.mjs +1 -1
  326. package/validators/numericValidator/numericValidator.js +1 -1
  327. package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.error.cause.js");
4
3
  exports.__esModule = true;
5
4
  require("core-js/modules/es.json.stringify.js");
5
+ require("core-js/modules/es.error.cause.js");
6
6
  require("core-js/modules/es.array.push.js");
7
7
  var _base = require("../base");
8
8
  var _staticRegister = _interopRequireDefault(require("../../utils/staticRegister"));
@@ -17,6 +17,7 @@ var _string = require("../../helpers/string");
17
17
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
18
18
  var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
20
21
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
22
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
22
23
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
@@ -27,6 +28,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
27
28
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
28
29
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
29
30
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
31
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
30
32
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'formulas';
31
33
  const SETTING_KEYS = exports.SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
32
34
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 260;
@@ -56,11 +58,238 @@ const isBlockedSource = source => source === 'UndoRedo.undo' || source === 'Undo
56
58
  var _internalOperationPending = /*#__PURE__*/new WeakMap();
57
59
  var _hotWasInitializedWithEmptyData = /*#__PURE__*/new WeakMap();
58
60
  var _engineListeners = /*#__PURE__*/new WeakMap();
61
+ var _onBeforeValidate = /*#__PURE__*/new WeakSet();
62
+ var _onBeforeAutofill = /*#__PURE__*/new WeakSet();
63
+ var _onBeforeLoadData = /*#__PURE__*/new WeakSet();
64
+ var _onAfterCellMetaReset = /*#__PURE__*/new WeakSet();
65
+ var _onAfterLoadData = /*#__PURE__*/new WeakSet();
66
+ var _onModifyData = /*#__PURE__*/new WeakSet();
67
+ var _onModifySourceData = /*#__PURE__*/new WeakSet();
68
+ var _onAfterSetDataAtCell = /*#__PURE__*/new WeakSet();
69
+ var _onAfterSetSourceDataAtCell = /*#__PURE__*/new WeakSet();
70
+ var _onBeforeCreateRow = /*#__PURE__*/new WeakSet();
71
+ var _onBeforeCreateCol = /*#__PURE__*/new WeakSet();
72
+ var _onBeforeRemoveRow = /*#__PURE__*/new WeakSet();
73
+ var _onBeforeRemoveCol = /*#__PURE__*/new WeakSet();
74
+ var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
75
+ var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
76
+ var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
77
+ var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
78
+ var _onAfterDetachChild = /*#__PURE__*/new WeakSet();
79
+ var _onEngineValuesUpdated = /*#__PURE__*/new WeakSet();
80
+ var _onEngineNamedExpressionsAdded = /*#__PURE__*/new WeakSet();
81
+ var _onEngineNamedExpressionsRemoved = /*#__PURE__*/new WeakSet();
82
+ var _onEngineSheetAdded = /*#__PURE__*/new WeakSet();
83
+ var _onEngineSheetRenamed = /*#__PURE__*/new WeakSet();
84
+ var _onEngineSheetRemoved = /*#__PURE__*/new WeakSet();
59
85
  class Formulas extends _base.BasePlugin {
60
86
  constructor() {
61
87
  var _this;
62
88
  super(...arguments);
63
89
  _this = this;
90
+ /**
91
+ * Called when a sheet is removed from the engine instance.
92
+ *
93
+ * @fires Hooks#afterSheetRemoved
94
+ * @param {string} removedSheetDisplayName The removed sheet name.
95
+ * @param {Array} changes The values and location of applied changes.
96
+ */
97
+ _classPrivateMethodInitSpec(this, _onEngineSheetRemoved);
98
+ /**
99
+ * Called when a sheet in the engine instance is renamed.
100
+ *
101
+ * @fires Hooks#afterSheetRenamed
102
+ * @param {string} oldDisplayName The old name of the sheet.
103
+ * @param {string} newDisplayName The new name of the sheet.
104
+ */
105
+ _classPrivateMethodInitSpec(this, _onEngineSheetRenamed);
106
+ /**
107
+ * Called when a new sheet is added to the engine instance.
108
+ *
109
+ * @fires Hooks#afterSheetAdded
110
+ * @param {string} addedSheetDisplayName The name of the added sheet.
111
+ */
112
+ _classPrivateMethodInitSpec(this, _onEngineSheetAdded);
113
+ /**
114
+ * Called when a named expression is removed from the engine instance.
115
+ *
116
+ * @fires Hooks#afterNamedExpressionRemoved
117
+ * @param {string} namedExpressionName The name of the removed expression.
118
+ * @param {Array} changes The values and location of applied changes.
119
+ */
120
+ _classPrivateMethodInitSpec(this, _onEngineNamedExpressionsRemoved);
121
+ /**
122
+ * Called when a named expression is added to the engine instance.
123
+ *
124
+ * @fires Hooks#afterNamedExpressionAdded
125
+ * @param {string} namedExpressionName The name of the added expression.
126
+ * @param {Array} changes The values and location of applied changes.
127
+ */
128
+ _classPrivateMethodInitSpec(this, _onEngineNamedExpressionsAdded);
129
+ /**
130
+ * Called when a value is updated in the engine.
131
+ *
132
+ * @fires Hooks#afterFormulasValuesUpdate
133
+ * @param {Array} changes The values and location of applied changes.
134
+ */
135
+ _classPrivateMethodInitSpec(this, _onEngineValuesUpdated);
136
+ /**
137
+ * `afterDetachChild` hook callback.
138
+ * Used to sync the data of the rows detached in the Nested Rows plugin with the engine's dataset.
139
+ *
140
+ * @param {object} parent An object representing the parent from which the element was detached.
141
+ * @param {object} element The detached element.
142
+ * @param {number} finalElementRowIndex The final row index of the detached element.
143
+ */
144
+ _classPrivateMethodInitSpec(this, _onAfterDetachChild);
145
+ /**
146
+ * `afterRemoveCol` hook callback.
147
+ *
148
+ * @param {number} col Visual index of starter column.
149
+ * @param {number} amount An amount of removed columns.
150
+ * @param {number[]} physicalColumns An array of physical columns removed from the data source.
151
+ * @param {string} [source] String that identifies source of hook call
152
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
153
+ */
154
+ _classPrivateMethodInitSpec(this, _onAfterRemoveCol);
155
+ /**
156
+ * `afterRemoveRow` hook callback.
157
+ *
158
+ * @param {number} row Visual index of starter row.
159
+ * @param {number} amount An amount of removed rows.
160
+ * @param {number[]} physicalRows An array of physical rows removed from the data source.
161
+ * @param {string} [source] String that identifies source of hook call
162
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
163
+ */
164
+ _classPrivateMethodInitSpec(this, _onAfterRemoveRow);
165
+ /**
166
+ * `afterCreateCol` hook callback.
167
+ *
168
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
169
+ * @param {number} amount Number of newly created columns in the data source.
170
+ * @param {string} [source] String that identifies source of hook call
171
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
172
+ */
173
+ _classPrivateMethodInitSpec(this, _onAfterCreateCol);
174
+ /**
175
+ * `afterCreateRow` hook callback.
176
+ *
177
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
178
+ * @param {number} amount Number of newly created rows in the data source array.
179
+ * @param {string} [source] String that identifies source of hook call
180
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
181
+ */
182
+ _classPrivateMethodInitSpec(this, _onAfterCreateRow);
183
+ /**
184
+ * `beforeRemoveCol` hook callback.
185
+ *
186
+ * @param {number} col Visual index of starter column.
187
+ * @param {number} amount Amount of columns to be removed.
188
+ * @param {number[]} physicalColumns An array of physical columns removed from the data source.
189
+ * @returns {*|boolean} If false is returned the action is canceled.
190
+ */
191
+ _classPrivateMethodInitSpec(this, _onBeforeRemoveCol);
192
+ /**
193
+ * `beforeRemoveRow` hook callback.
194
+ *
195
+ * @param {number} row Visual index of starter row.
196
+ * @param {number} amount Amount of rows to be removed.
197
+ * @param {number[]} physicalRows An array of physical rows removed from the data source.
198
+ * @returns {*|boolean} If false is returned the action is canceled.
199
+ */
200
+ _classPrivateMethodInitSpec(this, _onBeforeRemoveRow);
201
+ /**
202
+ * `beforeCreateCol` hook callback.
203
+ *
204
+ * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
205
+ * @param {number} amount Number of newly created columns in the data source.
206
+ * @returns {*|boolean} If false is returned the action is canceled.
207
+ */
208
+ _classPrivateMethodInitSpec(this, _onBeforeCreateCol);
209
+ /**
210
+ * `beforeCreateRow` hook callback.
211
+ *
212
+ * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
213
+ * @param {number} amount Number of newly created rows in the data source array.
214
+ * @returns {*|boolean} If false is returned the action is canceled.
215
+ */
216
+ _classPrivateMethodInitSpec(this, _onBeforeCreateRow);
217
+ /**
218
+ * `onAfterSetSourceDataAtCell` hook callback.
219
+ *
220
+ * @param {Array[]} changes An array of changes in format [[row, column, oldValue, value], ...].
221
+ * @param {string} [source] String that identifies source of hook call
222
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
223
+ */
224
+ _classPrivateMethodInitSpec(this, _onAfterSetSourceDataAtCell);
225
+ /**
226
+ * `onAfterSetDataAtCell` hook callback.
227
+ *
228
+ * @param {Array[]} changes An array of changes in format [[row, prop, oldValue, value], ...].
229
+ * @param {string} [source] String that identifies source of hook call
230
+ * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
231
+ */
232
+ _classPrivateMethodInitSpec(this, _onAfterSetDataAtCell);
233
+ /**
234
+ * `modifySourceData` hook callback.
235
+ *
236
+ * @param {number} row Physical row index.
237
+ * @param {number|string} columnOrProp Physical column index or prop.
238
+ * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
239
+ * property.
240
+ * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
241
+ */
242
+ _classPrivateMethodInitSpec(this, _onModifySourceData);
243
+ /**
244
+ * `modifyData` hook callback.
245
+ *
246
+ * @param {number} physicalRow Physical row index.
247
+ * @param {number} visualColumn Visual column index.
248
+ * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
249
+ * property.
250
+ * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
251
+ */
252
+ _classPrivateMethodInitSpec(this, _onModifyData);
253
+ /**
254
+ * `afterLoadData` hook callback.
255
+ *
256
+ * @param {Array} sourceData Array of arrays or array of objects containing data.
257
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
258
+ * @param {string} [source] Source of the call.
259
+ */
260
+ _classPrivateMethodInitSpec(this, _onAfterLoadData);
261
+ /**
262
+ * Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
263
+ */
264
+ _classPrivateMethodInitSpec(this, _onAfterCellMetaReset);
265
+ /**
266
+ * `beforeLoadData` hook callback.
267
+ *
268
+ * @param {Array} sourceData Array of arrays or array of objects containing data.
269
+ * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
270
+ * @param {string} [source] Source of the call.
271
+ */
272
+ _classPrivateMethodInitSpec(this, _onBeforeLoadData);
273
+ /**
274
+ * `onBeforeAutofill` hook callback.
275
+ *
276
+ * @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used
277
+ * and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`.
278
+ * @param {CellRange} sourceRange The range values will be filled from.
279
+ * @param {CellRange} targetRange The range new values will be filled into.
280
+ * @returns {boolean|*}
281
+ */
282
+ _classPrivateMethodInitSpec(this, _onBeforeAutofill);
283
+ /**
284
+ * The hook allows to translate the formula value to calculated value before it goes to the
285
+ * validator function.
286
+ *
287
+ * @param {*} value The cell value to validate.
288
+ * @param {number} visualRow The visual row index.
289
+ * @param {number|string} prop The visual column index or property name of the column.
290
+ * @returns {*} Returns value to validate.
291
+ */
292
+ _classPrivateMethodInitSpec(this, _onBeforeValidate);
64
293
  /**
65
294
  * Flag used to bypass hooks in internal operations.
66
295
  *
@@ -89,17 +318,35 @@ class Formulas extends _base.BasePlugin {
89
318
  _classPrivateFieldInitSpec(this, _engineListeners, {
90
319
  writable: true,
91
320
  value: [['valuesUpdated', function () {
92
- return _this.onEngineValuesUpdated(...arguments);
321
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
322
+ args[_key] = arguments[_key];
323
+ }
324
+ return _classPrivateMethodGet(_this, _onEngineValuesUpdated, _onEngineValuesUpdated2).call(_this, ...args);
93
325
  }], ['namedExpressionAdded', function () {
94
- return _this.onEngineNamedExpressionsAdded(...arguments);
326
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
327
+ args[_key2] = arguments[_key2];
328
+ }
329
+ return _classPrivateMethodGet(_this, _onEngineNamedExpressionsAdded, _onEngineNamedExpressionsAdded2).call(_this, ...args);
95
330
  }], ['namedExpressionRemoved', function () {
96
- return _this.onEngineNamedExpressionsRemoved(...arguments);
331
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
332
+ args[_key3] = arguments[_key3];
333
+ }
334
+ return _classPrivateMethodGet(_this, _onEngineNamedExpressionsRemoved, _onEngineNamedExpressionsRemoved2).call(_this, ...args);
97
335
  }], ['sheetAdded', function () {
98
- return _this.onEngineSheetAdded(...arguments);
336
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
337
+ args[_key4] = arguments[_key4];
338
+ }
339
+ return _classPrivateMethodGet(_this, _onEngineSheetAdded, _onEngineSheetAdded2).call(_this, ...args);
99
340
  }], ['sheetRenamed', function () {
100
- return _this.onEngineSheetRenamed(...arguments);
341
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
342
+ args[_key5] = arguments[_key5];
343
+ }
344
+ return _classPrivateMethodGet(_this, _onEngineSheetRenamed, _onEngineSheetRenamed2).call(_this, ...args);
101
345
  }], ['sheetRemoved', function () {
102
- return _this.onEngineSheetRemoved(...arguments);
346
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
347
+ args[_key6] = arguments[_key6];
348
+ }
349
+ return _classPrivateMethodGet(_this, _onEngineSheetRemoved, _onEngineSheetRemoved2).call(_this, ...args);
103
350
  }]]
104
351
  });
105
352
  /**
@@ -193,60 +440,114 @@ class Formulas extends _base.BasePlugin {
193
440
  }
194
441
  }
195
442
  this.addHook('beforeLoadData', function () {
196
- return _this2.onBeforeLoadData(...arguments);
443
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
444
+ args[_key7] = arguments[_key7];
445
+ }
446
+ return _classPrivateMethodGet(_this2, _onBeforeLoadData, _onBeforeLoadData2).call(_this2, ...args);
197
447
  });
198
448
  this.addHook('afterLoadData', function () {
199
- return _this2.onAfterLoadData(...arguments);
449
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
450
+ args[_key8] = arguments[_key8];
451
+ }
452
+ return _classPrivateMethodGet(_this2, _onAfterLoadData, _onAfterLoadData2).call(_this2, ...args);
200
453
  });
201
454
 
202
455
  // The `updateData` hooks utilize the same logic as the `loadData` hooks.
203
456
  this.addHook('beforeUpdateData', function () {
204
- return _this2.onBeforeLoadData(...arguments);
457
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
458
+ args[_key9] = arguments[_key9];
459
+ }
460
+ return _classPrivateMethodGet(_this2, _onBeforeLoadData, _onBeforeLoadData2).call(_this2, ...args);
205
461
  });
206
462
  this.addHook('afterUpdateData', function () {
207
- return _this2.onAfterLoadData(...arguments);
463
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
464
+ args[_key10] = arguments[_key10];
465
+ }
466
+ return _classPrivateMethodGet(_this2, _onAfterLoadData, _onAfterLoadData2).call(_this2, ...args);
208
467
  });
209
468
  this.addHook('modifyData', function () {
210
- return _this2.onModifyData(...arguments);
469
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
470
+ args[_key11] = arguments[_key11];
471
+ }
472
+ return _classPrivateMethodGet(_this2, _onModifyData, _onModifyData2).call(_this2, ...args);
211
473
  });
212
474
  this.addHook('modifySourceData', function () {
213
- return _this2.onModifySourceData(...arguments);
475
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
476
+ args[_key12] = arguments[_key12];
477
+ }
478
+ return _classPrivateMethodGet(_this2, _onModifySourceData, _onModifySourceData2).call(_this2, ...args);
214
479
  });
215
480
  this.addHook('beforeValidate', function () {
216
- return _this2.onBeforeValidate(...arguments);
481
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
482
+ args[_key13] = arguments[_key13];
483
+ }
484
+ return _classPrivateMethodGet(_this2, _onBeforeValidate, _onBeforeValidate2).call(_this2, ...args);
217
485
  });
218
486
  this.addHook('afterSetSourceDataAtCell', function () {
219
- return _this2.onAfterSetSourceDataAtCell(...arguments);
487
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
488
+ args[_key14] = arguments[_key14];
489
+ }
490
+ return _classPrivateMethodGet(_this2, _onAfterSetSourceDataAtCell, _onAfterSetSourceDataAtCell2).call(_this2, ...args);
220
491
  });
221
492
  this.addHook('afterSetDataAtCell', function () {
222
- return _this2.onAfterSetDataAtCell(...arguments);
493
+ for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
494
+ args[_key15] = arguments[_key15];
495
+ }
496
+ return _classPrivateMethodGet(_this2, _onAfterSetDataAtCell, _onAfterSetDataAtCell2).call(_this2, ...args);
223
497
  });
224
498
  this.addHook('afterSetDataAtRowProp', function () {
225
- return _this2.onAfterSetDataAtCell(...arguments);
499
+ for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
500
+ args[_key16] = arguments[_key16];
501
+ }
502
+ return _classPrivateMethodGet(_this2, _onAfterSetDataAtCell, _onAfterSetDataAtCell2).call(_this2, ...args);
226
503
  });
227
504
  this.addHook('beforeCreateRow', function () {
228
- return _this2.onBeforeCreateRow(...arguments);
505
+ for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
506
+ args[_key17] = arguments[_key17];
507
+ }
508
+ return _classPrivateMethodGet(_this2, _onBeforeCreateRow, _onBeforeCreateRow2).call(_this2, ...args);
229
509
  });
230
510
  this.addHook('beforeCreateCol', function () {
231
- return _this2.onBeforeCreateCol(...arguments);
511
+ for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
512
+ args[_key18] = arguments[_key18];
513
+ }
514
+ return _classPrivateMethodGet(_this2, _onBeforeCreateCol, _onBeforeCreateCol2).call(_this2, ...args);
232
515
  });
233
516
  this.addHook('afterCreateRow', function () {
234
- return _this2.onAfterCreateRow(...arguments);
517
+ for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
518
+ args[_key19] = arguments[_key19];
519
+ }
520
+ return _classPrivateMethodGet(_this2, _onAfterCreateRow, _onAfterCreateRow2).call(_this2, ...args);
235
521
  });
236
522
  this.addHook('afterCreateCol', function () {
237
- return _this2.onAfterCreateCol(...arguments);
523
+ for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
524
+ args[_key20] = arguments[_key20];
525
+ }
526
+ return _classPrivateMethodGet(_this2, _onAfterCreateCol, _onAfterCreateCol2).call(_this2, ...args);
238
527
  });
239
528
  this.addHook('beforeRemoveRow', function () {
240
- return _this2.onBeforeRemoveRow(...arguments);
529
+ for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
530
+ args[_key21] = arguments[_key21];
531
+ }
532
+ return _classPrivateMethodGet(_this2, _onBeforeRemoveRow, _onBeforeRemoveRow2).call(_this2, ...args);
241
533
  });
242
534
  this.addHook('beforeRemoveCol', function () {
243
- return _this2.onBeforeRemoveCol(...arguments);
535
+ for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
536
+ args[_key22] = arguments[_key22];
537
+ }
538
+ return _classPrivateMethodGet(_this2, _onBeforeRemoveCol, _onBeforeRemoveCol2).call(_this2, ...args);
244
539
  });
245
540
  this.addHook('afterRemoveRow', function () {
246
- return _this2.onAfterRemoveRow(...arguments);
541
+ for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
542
+ args[_key23] = arguments[_key23];
543
+ }
544
+ return _classPrivateMethodGet(_this2, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this2, ...args);
247
545
  });
248
546
  this.addHook('afterRemoveCol', function () {
249
- return _this2.onAfterRemoveCol(...arguments);
547
+ for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
548
+ args[_key24] = arguments[_key24];
549
+ }
550
+ return _classPrivateMethodGet(_this2, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this2, ...args);
250
551
  });
251
552
  this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, postponedAction => {
252
553
  this.hot.addHookOnce('init', () => {
@@ -288,7 +589,10 @@ class Formulas extends _base.BasePlugin {
288
589
  // hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
289
590
  // Another hooks are triggered to late for setting HF's engine data needed for some actions.
290
591
  this.addHook('afterCellMetaReset', function () {
291
- return _this2.onAfterCellMetaReset(...arguments);
592
+ for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
593
+ args[_key25] = arguments[_key25];
594
+ }
595
+ return _classPrivateMethodGet(_this2, _onAfterCellMetaReset, _onAfterCellMetaReset2).call(_this2, ...args);
292
596
  });
293
597
 
294
598
  // Handling undo actions on data just using HyperFormula's UndoRedo mechanism
@@ -309,10 +613,16 @@ class Formulas extends _base.BasePlugin {
309
613
  this.indexSyncer.setPerformRedo(false);
310
614
  });
311
615
  this.addHook('afterDetachChild', function () {
312
- return _this2.onAfterDetachChild(...arguments);
616
+ for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
617
+ args[_key26] = arguments[_key26];
618
+ }
619
+ return _classPrivateMethodGet(_this2, _onAfterDetachChild, _onAfterDetachChild2).call(_this2, ...args);
313
620
  });
314
621
  this.addHook('beforeAutofill', function () {
315
- return _this2.onBeforeAutofill(...arguments);
622
+ for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
623
+ args[_key27] = arguments[_key27];
624
+ }
625
+ return _classPrivateMethodGet(_this2, _onBeforeAutofill, _onBeforeAutofill2).call(_this2, ...args);
316
626
  });
317
627
  _classPrivateFieldGet(this, _engineListeners).forEach(_ref => {
318
628
  let [eventName, listener] = _ref;
@@ -357,7 +667,7 @@ class Formulas extends _base.BasePlugin {
357
667
  if (sheetName && this.engine.doesSheetExist(sheetName)) {
358
668
  this.switchSheet(this.sheetName);
359
669
  } else {
360
- this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : void 0, this.hot.getSourceDataArray());
670
+ this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());
361
671
  }
362
672
  }
363
673
  super.updatePlugin(newSettings);
@@ -393,12 +703,12 @@ class Formulas extends _base.BasePlugin {
393
703
  (0, _console.warn)('The provided data should be an array of arrays.');
394
704
  return false;
395
705
  }
396
- if (sheetName !== void 0 && sheetName !== null && this.engine.doesSheetExist(sheetName)) {
706
+ if (sheetName !== undefined && sheetName !== null && this.engine.doesSheetExist(sheetName)) {
397
707
  (0, _console.warn)('Sheet with the provided name already exists.');
398
708
  return false;
399
709
  }
400
710
  try {
401
- const actualSheetName = this.engine.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : void 0);
711
+ const actualSheetName = this.engine.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined);
402
712
  if (sheetData) {
403
713
  this.engine.setSheetContent(this.engine.getSheetId(actualSheetName), sheetData);
404
714
  }
@@ -483,7 +793,7 @@ class Formulas extends _base.BasePlugin {
483
793
  var _change$address;
484
794
  // For the Named expression the address is empty, hence the `sheetId` is undefined.
485
795
  const sheetId = change === null || change === void 0 || (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.sheet;
486
- if (sheetId !== void 0) {
796
+ if (sheetId !== undefined) {
487
797
  if (!affectedSheetIds.has(sheetId)) {
488
798
  affectedSheetIds.add(sheetId);
489
799
  }
@@ -535,7 +845,7 @@ class Formulas extends _base.BasePlugin {
535
845
 
536
846
  // Validate the cells that depend on the calculated formulas. Skip that cells
537
847
  // where the user directly changes the values - the Core triggers those validators.
538
- if (sheetId !== void 0 && !changedCellsSet.has(addressId)) {
848
+ if (sheetId !== undefined && !changedCellsSet.has(addressId)) {
539
849
  const boundHot = (0, _register.getRegisteredHotInstances)(this.engine).get(sheetId);
540
850
 
541
851
  // if `sheetId` is not bound to any Handsontable instance, skip the validation process
@@ -580,630 +890,402 @@ class Formulas extends _base.BasePlugin {
580
890
  }
581
891
  return this.engine.setCellContents(address, newValue);
582
892
  }
893
+ }
894
+ exports.Formulas = Formulas;
895
+ function _onBeforeValidate2(value, visualRow, prop) {
896
+ const visualColumn = this.hot.propToCol(prop);
897
+ if (this.isFormulaCellType(visualRow, visualColumn)) {
898
+ const address = {
899
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
900
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
901
+ sheet: this.sheetId
902
+ };
903
+ const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
904
+ let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
583
905
 
584
- /**
585
- * The hook allows to translate the formula value to calculated value before it goes to the
586
- * validator function.
587
- *
588
- * @private
589
- * @param {*} value The cell value to validate.
590
- * @param {number} visualRow The visual row index.
591
- * @param {number|string} prop The visual column index or property name of the column.
592
- * @returns {*} Returns value to validate.
593
- */
594
- onBeforeValidate(value, visualRow, prop) {
595
- const visualColumn = this.hot.propToCol(prop);
596
- if (this.isFormulaCellType(visualRow, visualColumn)) {
597
- const address = {
598
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
599
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
600
- sheet: this.sheetId
601
- };
602
- const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
603
- let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
604
-
605
- if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
606
- cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
607
- }
608
-
609
- // If `cellValue` is an object it is expected to be an error
610
- return typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
906
+ if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
907
+ cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
611
908
  }
612
- return value;
613
- }
614
-
615
- /**
616
- * `onBeforeAutofill` hook callback.
617
- *
618
- * @private
619
- * @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used
620
- * and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`.
621
- * @param {CellRange} sourceRange The range values will be filled from.
622
- * @param {CellRange} targetRange The range new values will be filled into.
623
- * @returns {boolean|*}
624
- */
625
- onBeforeAutofill(fillData, sourceRange, targetRange) {
626
- const {
627
- row: sourceTopStartRow,
628
- col: sourceTopStartColumn
629
- } = sourceRange.getTopStartCorner();
630
- const {
631
- row: sourceBottomEndRow,
632
- col: sourceBottomEndColumn
633
- } = sourceRange.getBottomEndCorner();
634
- const {
635
- row: targetTopStartRow,
636
- col: targetTopStartColumn
637
- } = targetRange.getTopStartCorner();
638
- const {
639
- row: targetBottomEndRow,
640
- col: targetBottomEndColumn
641
- } = targetRange.getBottomEndCorner();
642
- const engineSourceRange = {
643
- start: {
644
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
645
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
646
- sheet: this.sheetId
647
- },
648
- end: {
649
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
650
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
651
- sheet: this.sheetId
652
- }
653
- };
654
- const engineTargetRange = {
655
- start: {
656
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
657
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
658
- sheet: this.sheetId
659
- },
660
- end: {
661
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
662
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
663
- sheet: this.sheetId
664
- }
665
- };
666
909
 
667
- // Blocks the autofill operation if HyperFormula says that at least one of
668
- // the underlying cell's contents cannot be set.
669
- if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
670
- return false;
910
+ // If `cellValue` is an object it is expected to be an error
911
+ return typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
912
+ }
913
+ return value;
914
+ }
915
+ function _onBeforeAutofill2(fillData, sourceRange, targetRange) {
916
+ const {
917
+ row: sourceTopStartRow,
918
+ col: sourceTopStartColumn
919
+ } = sourceRange.getTopStartCorner();
920
+ const {
921
+ row: sourceBottomEndRow,
922
+ col: sourceBottomEndColumn
923
+ } = sourceRange.getBottomEndCorner();
924
+ const {
925
+ row: targetTopStartRow,
926
+ col: targetTopStartColumn
927
+ } = targetRange.getTopStartCorner();
928
+ const {
929
+ row: targetBottomEndRow,
930
+ col: targetBottomEndColumn
931
+ } = targetRange.getBottomEndCorner();
932
+ const engineSourceRange = {
933
+ start: {
934
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
935
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
936
+ sheet: this.sheetId
937
+ },
938
+ end: {
939
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
940
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
941
+ sheet: this.sheetId
671
942
  }
672
- const fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
673
- const {
674
- row: sourceStartRow,
675
- col: sourceStartColumn
676
- } = engineSourceRange.start;
677
- const {
678
- row: sourceEndRow,
679
- col: sourceEndColumn
680
- } = engineSourceRange.end;
681
- const populationRowLength = sourceEndRow - sourceStartRow + 1;
682
- const populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
683
- for (let populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
684
- for (let populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
685
- const populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
686
- const sourceRow = populatedRowIndex % populationRowLength;
687
- const sourceColumn = populatedColumnIndex % populationColumnLength;
688
- const sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
689
- if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
690
- if (populatedValue.startsWith('\'')) {
691
- // Populating values on HOT side without apostrophe.
692
- fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
693
- } else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
694
- // Populating date in proper format, coming from the source cell.
695
- fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
696
- }
943
+ };
944
+ const engineTargetRange = {
945
+ start: {
946
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
947
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
948
+ sheet: this.sheetId
949
+ },
950
+ end: {
951
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
952
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
953
+ sheet: this.sheetId
954
+ }
955
+ };
956
+
957
+ // Blocks the autofill operation if HyperFormula says that at least one of
958
+ // the underlying cell's contents cannot be set.
959
+ if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
960
+ return false;
961
+ }
962
+ const fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
963
+ const {
964
+ row: sourceStartRow,
965
+ col: sourceStartColumn
966
+ } = engineSourceRange.start;
967
+ const {
968
+ row: sourceEndRow,
969
+ col: sourceEndColumn
970
+ } = engineSourceRange.end;
971
+ const populationRowLength = sourceEndRow - sourceStartRow + 1;
972
+ const populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
973
+ for (let populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
974
+ for (let populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
975
+ const populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
976
+ const sourceRow = populatedRowIndex % populationRowLength;
977
+ const sourceColumn = populatedColumnIndex % populationColumnLength;
978
+ const sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
979
+ if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
980
+ if (populatedValue.startsWith('\'')) {
981
+ // Populating values on HOT side without apostrophe.
982
+ fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
983
+ } else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
984
+ // Populating date in proper format, coming from the source cell.
985
+ fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
697
986
  }
698
987
  }
699
988
  }
700
- return fillRangeData;
701
989
  }
702
-
703
- /**
704
- * `beforeLoadData` hook callback.
705
- *
706
- * @param {Array} sourceData Array of arrays or array of objects containing data.
707
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
708
- * @param {string} [source] Source of the call.
709
- * @private
710
- */
711
- onBeforeLoadData(sourceData, initialLoad) {
712
- let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
713
- if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
714
- return;
715
- }
716
-
717
- // This flag needs to be defined, because not passing data to HOT results in HOT auto-generating a `null`-filled
718
- // initial dataset.
719
- _classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
990
+ return fillRangeData;
991
+ }
992
+ function _onBeforeLoadData2(sourceData, initialLoad) {
993
+ let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
994
+ if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
995
+ return;
720
996
  }
721
997
 
722
- /**
723
- * Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
724
- *
725
- * @private
726
- */
727
- onAfterCellMetaReset() {
728
- const sourceDataArray = this.hot.getSourceDataArray();
729
- let valueChanged = false;
730
- sourceDataArray.forEach((rowData, rowIndex) => {
731
- rowData.forEach((cellValue, columnIndex) => {
732
- const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex);
733
- const dateFormat = cellMeta.dateFormat;
734
- if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
735
- valueChanged = true;
736
- if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
737
- // Rewriting date in HOT format to HF format.
738
- sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
739
- } else if (this.isFormulaCellType(rowIndex, columnIndex) === false) {
740
- // Escaping value from date parsing using "'" sign (HF feature).
741
- sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
742
- }
998
+ // This flag needs to be defined, because not passing data to HOT results in HOT auto-generating a `null`-filled
999
+ // initial dataset.
1000
+ _classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
1001
+ }
1002
+ function _onAfterCellMetaReset2() {
1003
+ const sourceDataArray = this.hot.getSourceDataArray();
1004
+ let valueChanged = false;
1005
+ sourceDataArray.forEach((rowData, rowIndex) => {
1006
+ rowData.forEach((cellValue, columnIndex) => {
1007
+ const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex);
1008
+ const dateFormat = cellMeta.dateFormat;
1009
+ if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
1010
+ valueChanged = true;
1011
+ if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
1012
+ // Rewriting date in HOT format to HF format.
1013
+ sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
1014
+ } else if (this.isFormulaCellType(rowIndex, columnIndex) === false) {
1015
+ // Escaping value from date parsing using "'" sign (HF feature).
1016
+ sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
743
1017
  }
744
- });
1018
+ }
745
1019
  });
746
- if (valueChanged === true) {
1020
+ });
1021
+ if (valueChanged === true) {
1022
+ _classPrivateFieldSet(this, _internalOperationPending, true);
1023
+ this.engine.setSheetContent(this.sheetId, sourceDataArray);
1024
+ _classPrivateFieldSet(this, _internalOperationPending, false);
1025
+ }
1026
+ }
1027
+ function _onAfterLoadData2(sourceData, initialLoad) {
1028
+ let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1029
+ if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
1030
+ return;
1031
+ }
1032
+ this.sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
1033
+ if (!_classPrivateFieldGet(this, _hotWasInitializedWithEmptyData)) {
1034
+ const sourceDataArray = this.hot.getSourceDataArray();
1035
+ if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
747
1036
  _classPrivateFieldSet(this, _internalOperationPending, true);
748
- this.engine.setSheetContent(this.sheetId, sourceDataArray);
1037
+ const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
1038
+ this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
1039
+ this.renderDependentSheets(dependentCells);
749
1040
  _classPrivateFieldSet(this, _internalOperationPending, false);
750
1041
  }
1042
+ } else {
1043
+ this.switchSheet(this.sheetName);
751
1044
  }
752
-
753
- /**
754
- * `afterLoadData` hook callback.
755
- *
756
- * @param {Array} sourceData Array of arrays or array of objects containing data.
757
- * @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
758
- * @param {string} [source] Source of the call.
759
- * @private
760
- */
761
- onAfterLoadData(sourceData, initialLoad) {
762
- let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
763
- if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
764
- return;
765
- }
766
- this.sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
767
- if (!_classPrivateFieldGet(this, _hotWasInitializedWithEmptyData)) {
768
- const sourceDataArray = this.hot.getSourceDataArray();
769
- if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
770
- _classPrivateFieldSet(this, _internalOperationPending, true);
771
- const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
772
- this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
773
- this.renderDependentSheets(dependentCells);
774
- _classPrivateFieldSet(this, _internalOperationPending, false);
775
- }
776
- } else {
777
- this.switchSheet(this.sheetName);
778
- }
1045
+ }
1046
+ function _onModifyData2(physicalRow, visualColumn, valueHolder, ioMode) {
1047
+ if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
1048
+ return;
779
1049
  }
780
-
781
- /**
782
- * `modifyData` hook callback.
783
- *
784
- * @private
785
- * @param {number} physicalRow Physical row index.
786
- * @param {number} visualColumn Visual column index.
787
- * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
788
- * property.
789
- * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
790
- */
791
- onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
792
- if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
793
- return;
794
- }
795
- const visualRow = this.hot.toVisualRow(physicalRow);
796
- if (visualRow === null || visualColumn === null) {
797
- return;
798
- }
799
-
800
- // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
801
- const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
802
- if (!isFormulaCellType) {
803
- const cellType = this.getCellType(visualRow, visualColumn);
804
- if (cellType !== 'ARRAY') {
805
- if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
806
- valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
807
- }
808
- return;
809
- }
810
- }
811
- const address = {
812
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
813
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
814
- sheet: this.sheetId
815
- };
816
- let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
817
- const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
818
- if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
819
- cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
820
- }
821
-
822
- // If `cellValue` is an object it is expected to be an error
823
- const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
824
- valueHolder.value = value;
1050
+ const visualRow = this.hot.toVisualRow(physicalRow);
1051
+ if (visualRow === null || visualColumn === null) {
1052
+ return;
825
1053
  }
826
1054
 
827
- /**
828
- * `modifySourceData` hook callback.
829
- *
830
- * @private
831
- * @param {number} row Physical row index.
832
- * @param {number|string} columnOrProp Physical column index or prop.
833
- * @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
834
- * property.
835
- * @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
836
- */
837
- onModifySourceData(row, columnOrProp, valueHolder, ioMode) {
838
- if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
839
- return;
840
- }
841
- const visualRow = this.hot.toVisualRow(row);
842
- const visualColumn = this.hot.propToCol(columnOrProp);
843
- if (visualRow === null || visualColumn === null) {
844
- return;
845
- }
846
-
847
- // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
848
- const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
849
- if (!isFormulaCellType) {
850
- const cellType = this.getCellType(visualRow, visualColumn);
851
- if (cellType !== 'ARRAY') {
852
- return;
1055
+ // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
1056
+ const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
1057
+ if (!isFormulaCellType) {
1058
+ const cellType = this.getCellType(visualRow, visualColumn);
1059
+ if (cellType !== 'ARRAY') {
1060
+ if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
1061
+ valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
853
1062
  }
854
- }
855
- const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
856
-
857
- // Don't actually change the source data if HyperFormula is not
858
- // initialized yet. This is done to allow the `afterLoadData` hook to
859
- // load the existing source data with `Handsontable#getSourceDataArray`
860
- // properly.
861
- if (dimensions.width === 0 && dimensions.height === 0) {
862
1063
  return;
863
1064
  }
864
- const address = {
865
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
866
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
867
- sheet: this.sheetId
868
- };
869
- valueHolder.value = this.engine.getCellSerialized(address);
1065
+ }
1066
+ const address = {
1067
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1068
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1069
+ sheet: this.sheetId
1070
+ };
1071
+ let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
1072
+ const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
1073
+ if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
1074
+ cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
870
1075
  }
871
1076
 
872
- /**
873
- * `onAfterSetDataAtCell` hook callback.
874
- *
875
- * @private
876
- * @param {Array[]} changes An array of changes in format [[row, prop, oldValue, value], ...].
877
- * @param {string} [source] String that identifies source of hook call
878
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
879
- */
880
- onAfterSetDataAtCell(changes, source) {
881
- if (isBlockedSource(source)) {
882
- return;
883
- }
884
- const outOfBoundsChanges = [];
885
- const changedCells = [];
886
- const dependentCells = this.engine.batch(() => {
887
- changes.forEach(_ref4 => {
888
- let [visualRow, prop,, newValue] = _ref4;
889
- const visualColumn = this.hot.propToCol(prop);
890
- const physicalRow = this.hot.toPhysicalRow(visualRow);
891
- const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
892
- const address = {
893
- row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
894
- col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
895
- sheet: this.sheetId
896
- };
897
- if (physicalRow !== null && physicalColumn !== null) {
898
- this.syncChangeWithEngine(visualRow, visualColumn, newValue);
899
- } else {
900
- outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
901
- }
902
- changedCells.push({
903
- address
904
- });
905
- });
906
- });
907
- if (outOfBoundsChanges.length) {
908
- // Workaround for rows/columns being created two times (by HOT and the engine).
909
- // (unfortunately, this requires an extra re-render)
910
- this.hot.addHookOnce('afterChange', () => {
911
- const outOfBoundsDependentCells = this.engine.batch(() => {
912
- outOfBoundsChanges.forEach(_ref5 => {
913
- let [row, column, newValue] = _ref5;
914
- this.syncChangeWithEngine(row, column, newValue);
915
- });
916
- });
917
- this.renderDependentSheets(outOfBoundsDependentCells, true);
918
- });
919
- }
920
- this.renderDependentSheets(dependentCells);
921
- this.validateDependentCells(dependentCells, changedCells);
1077
+ // If `cellValue` is an object it is expected to be an error
1078
+ const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
1079
+ valueHolder.value = value;
1080
+ }
1081
+ function _onModifySourceData2(row, columnOrProp, valueHolder, ioMode) {
1082
+ if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
1083
+ return;
1084
+ }
1085
+ const visualRow = this.hot.toVisualRow(row);
1086
+ const visualColumn = this.hot.propToCol(columnOrProp);
1087
+ if (visualRow === null || visualColumn === null) {
1088
+ return;
922
1089
  }
923
1090
 
924
- /**
925
- * `onAfterSetSourceDataAtCell` hook callback.
926
- *
927
- * @private
928
- * @param {Array[]} changes An array of changes in format [[row, column, oldValue, value], ...].
929
- * @param {string} [source] String that identifies source of hook call
930
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
931
- */
932
- onAfterSetSourceDataAtCell(changes, source) {
933
- if (isBlockedSource(source)) {
1091
+ // `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
1092
+ const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
1093
+ if (!isFormulaCellType) {
1094
+ const cellType = this.getCellType(visualRow, visualColumn);
1095
+ if (cellType !== 'ARRAY') {
934
1096
  return;
935
1097
  }
936
- const dependentCells = [];
937
- const changedCells = [];
938
- changes.forEach(_ref6 => {
939
- let [visualRow, prop,, newValue] = _ref6;
1098
+ }
1099
+ const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
1100
+
1101
+ // Don't actually change the source data if HyperFormula is not
1102
+ // initialized yet. This is done to allow the `afterLoadData` hook to
1103
+ // load the existing source data with `Handsontable#getSourceDataArray`
1104
+ // properly.
1105
+ if (dimensions.width === 0 && dimensions.height === 0) {
1106
+ return;
1107
+ }
1108
+ const address = {
1109
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1110
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1111
+ sheet: this.sheetId
1112
+ };
1113
+ valueHolder.value = this.engine.getCellSerialized(address);
1114
+ }
1115
+ function _onAfterSetDataAtCell2(changes, source) {
1116
+ if (isBlockedSource(source)) {
1117
+ return;
1118
+ }
1119
+ const outOfBoundsChanges = [];
1120
+ const changedCells = [];
1121
+ const dependentCells = this.engine.batch(() => {
1122
+ changes.forEach(_ref4 => {
1123
+ let [visualRow, prop,, newValue] = _ref4;
940
1124
  const visualColumn = this.hot.propToCol(prop);
941
- if (!(0, _number.isNumeric)(visualColumn)) {
942
- return;
943
- }
1125
+ const physicalRow = this.hot.toPhysicalRow(visualRow);
1126
+ const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
944
1127
  const address = {
945
1128
  row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
946
1129
  col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
947
1130
  sheet: this.sheetId
948
1131
  };
949
- if (!this.engine.isItPossibleToSetCellContents(address)) {
950
- (0, _console.warn)(`Not possible to set source cell data at ${JSON.stringify(address)}`);
951
- return;
1132
+ if (physicalRow !== null && physicalColumn !== null) {
1133
+ this.syncChangeWithEngine(visualRow, visualColumn, newValue);
1134
+ } else {
1135
+ outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
952
1136
  }
953
1137
  changedCells.push({
954
1138
  address
955
1139
  });
956
- dependentCells.push(...this.engine.setCellContents(address, newValue));
957
1140
  });
958
- this.renderDependentSheets(dependentCells);
959
- this.validateDependentCells(dependentCells, changedCells);
960
- }
961
-
962
- /**
963
- * `beforeCreateRow` hook callback.
964
- *
965
- * @private
966
- * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
967
- * @param {number} amount Number of newly created rows in the data source array.
968
- * @returns {*|boolean} If false is returned the action is canceled.
969
- */
970
- onBeforeCreateRow(visualRow, amount) {
971
- let hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
972
- if (visualRow >= this.hot.countRows()) {
973
- hfRowIndex = visualRow; // Row beyond the table boundaries.
974
- }
975
-
976
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
977
- return false;
978
- }
979
- }
980
-
981
- /**
982
- * `beforeCreateCol` hook callback.
983
- *
984
- * @private
985
- * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
986
- * @param {number} amount Number of newly created columns in the data source.
987
- * @returns {*|boolean} If false is returned the action is canceled.
988
- */
989
- onBeforeCreateCol(visualColumn, amount) {
990
- let hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
991
- if (visualColumn >= this.hot.countCols()) {
992
- hfColumnIndex = visualColumn; // Column beyond the table boundaries.
993
- }
994
-
995
- if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
996
- return false;
997
- }
998
- }
999
-
1000
- /**
1001
- * `beforeRemoveRow` hook callback.
1002
- *
1003
- * @private
1004
- * @param {number} row Visual index of starter row.
1005
- * @param {number} amount Amount of rows to be removed.
1006
- * @param {number[]} physicalRows An array of physical rows removed from the data source.
1007
- * @returns {*|boolean} If false is returned the action is canceled.
1008
- */
1009
- onBeforeRemoveRow(row, amount, physicalRows) {
1010
- const hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
1011
- const possible = hfRows.every(hfRow => {
1012
- return this.engine.isItPossibleToRemoveRows(this.sheetId, [hfRow, 1]);
1013
- });
1014
- return possible === false ? false : void 0;
1015
- }
1016
-
1017
- /**
1018
- * `beforeRemoveCol` hook callback.
1019
- *
1020
- * @private
1021
- * @param {number} col Visual index of starter column.
1022
- * @param {number} amount Amount of columns to be removed.
1023
- * @param {number[]} physicalColumns An array of physical columns removed from the data source.
1024
- * @returns {*|boolean} If false is returned the action is canceled.
1025
- */
1026
- onBeforeRemoveCol(col, amount, physicalColumns) {
1027
- const hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
1028
- const possible = hfColumns.every(hfColumn => {
1029
- return this.engine.isItPossibleToRemoveColumns(this.sheetId, [hfColumn, 1]);
1141
+ });
1142
+ if (outOfBoundsChanges.length) {
1143
+ // Workaround for rows/columns being created two times (by HOT and the engine).
1144
+ // (unfortunately, this requires an extra re-render)
1145
+ this.hot.addHookOnce('afterChange', () => {
1146
+ const outOfBoundsDependentCells = this.engine.batch(() => {
1147
+ outOfBoundsChanges.forEach(_ref5 => {
1148
+ let [row, column, newValue] = _ref5;
1149
+ this.syncChangeWithEngine(row, column, newValue);
1150
+ });
1151
+ });
1152
+ this.renderDependentSheets(outOfBoundsDependentCells, true);
1030
1153
  });
1031
- return possible === false ? false : void 0;
1032
- }
1033
-
1034
- /**
1035
- * `afterCreateRow` hook callback.
1036
- *
1037
- * @private
1038
- * @param {number} visualRow Represents the visual index of first newly created row in the data source array.
1039
- * @param {number} amount Number of newly created rows in the data source array.
1040
- * @param {string} [source] String that identifies source of hook call
1041
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1042
- */
1043
- onAfterCreateRow(visualRow, amount, source) {
1044
- if (isBlockedSource(source)) {
1045
- return;
1046
- }
1047
- const changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1048
- this.renderDependentSheets(changes);
1049
1154
  }
1050
-
1051
- /**
1052
- * `afterCreateCol` hook callback.
1053
- *
1054
- * @private
1055
- * @param {number} visualColumn Represents the visual index of first newly created column in the data source.
1056
- * @param {number} amount Number of newly created columns in the data source.
1057
- * @param {string} [source] String that identifies source of hook call
1058
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1059
- */
1060
- onAfterCreateCol(visualColumn, amount, source) {
1061
- if (isBlockedSource(source)) {
1062
- return;
1063
- }
1064
- const changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1065
- this.renderDependentSheets(changes);
1155
+ this.renderDependentSheets(dependentCells);
1156
+ this.validateDependentCells(dependentCells, changedCells);
1157
+ }
1158
+ function _onAfterSetSourceDataAtCell2(changes, source) {
1159
+ if (isBlockedSource(source)) {
1160
+ return;
1066
1161
  }
1067
-
1068
- /**
1069
- * `afterRemoveRow` hook callback.
1070
- *
1071
- * @private
1072
- * @param {number} row Visual index of starter row.
1073
- * @param {number} amount An amount of removed rows.
1074
- * @param {number[]} physicalRows An array of physical rows removed from the data source.
1075
- * @param {string} [source] String that identifies source of hook call
1076
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1077
- */
1078
- onAfterRemoveRow(row, amount, physicalRows, source) {
1079
- if (isBlockedSource(source)) {
1162
+ const dependentCells = [];
1163
+ const changedCells = [];
1164
+ changes.forEach(_ref6 => {
1165
+ let [visualRow, prop,, newValue] = _ref6;
1166
+ const visualColumn = this.hot.propToCol(prop);
1167
+ if (!(0, _number.isNumeric)(visualColumn)) {
1080
1168
  return;
1081
1169
  }
1082
- const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1083
- const changes = this.engine.batch(() => {
1084
- descendingHfRows.forEach(hfRow => {
1085
- this.engine.removeRows(this.sheetId, [hfRow, 1]);
1086
- });
1087
- });
1088
- this.renderDependentSheets(changes);
1089
- }
1090
-
1091
- /**
1092
- * `afterRemoveCol` hook callback.
1093
- *
1094
- * @private
1095
- * @param {number} col Visual index of starter column.
1096
- * @param {number} amount An amount of removed columns.
1097
- * @param {number[]} physicalColumns An array of physical columns removed from the data source.
1098
- * @param {string} [source] String that identifies source of hook call
1099
- * ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
1100
- */
1101
- onAfterRemoveCol(col, amount, physicalColumns, source) {
1102
- if (isBlockedSource(source)) {
1170
+ const address = {
1171
+ row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
1172
+ col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
1173
+ sheet: this.sheetId
1174
+ };
1175
+ if (!this.engine.isItPossibleToSetCellContents(address)) {
1176
+ (0, _console.warn)(`Not possible to set source cell data at ${JSON.stringify(address)}`);
1103
1177
  return;
1104
1178
  }
1105
- const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1106
- const changes = this.engine.batch(() => {
1107
- descendingHfColumns.forEach(hfColumn => {
1108
- this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
1109
- });
1179
+ changedCells.push({
1180
+ address
1110
1181
  });
1111
- this.renderDependentSheets(changes);
1182
+ dependentCells.push(...this.engine.setCellContents(address, newValue));
1183
+ });
1184
+ this.renderDependentSheets(dependentCells);
1185
+ this.validateDependentCells(dependentCells, changedCells);
1186
+ }
1187
+ function _onBeforeCreateRow2(visualRow, amount) {
1188
+ let hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
1189
+ if (visualRow >= this.hot.countRows()) {
1190
+ hfRowIndex = visualRow; // Row beyond the table boundaries.
1112
1191
  }
1113
1192
 
1114
- /**
1115
- * `afterDetachChild` hook callback.
1116
- * Used to sync the data of the rows detached in the Nested Rows plugin with the engine's dataset.
1117
- *
1118
- * @private
1119
- * @param {object} parent An object representing the parent from which the element was detached.
1120
- * @param {object} element The detached element.
1121
- * @param {number} finalElementRowIndex The final row index of the detached element.
1122
- */
1123
- onAfterDetachChild(parent, element, finalElementRowIndex) {
1124
- var _element$__children;
1125
- _classPrivateFieldSet(this, _internalOperationPending, true);
1126
- const 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());
1127
- _classPrivateFieldSet(this, _internalOperationPending, false);
1128
- rowsData.forEach((row, relativeRowIndex) => {
1129
- row.forEach((value, colIndex) => {
1130
- this.engine.setCellContents({
1131
- col: colIndex,
1132
- row: finalElementRowIndex + relativeRowIndex,
1133
- sheet: this.sheetId
1134
- }, [[value]]);
1135
- });
1136
- });
1193
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
1194
+ return false;
1137
1195
  }
1138
-
1139
- /**
1140
- * Called when a value is updated in the engine.
1141
- *
1142
- * @private
1143
- * @fires Hooks#afterFormulasValuesUpdate
1144
- * @param {Array} changes The values and location of applied changes.
1145
- */
1146
- onEngineValuesUpdated(changes) {
1147
- this.hot.runHooks('afterFormulasValuesUpdate', changes);
1196
+ }
1197
+ function _onBeforeCreateCol2(visualColumn, amount) {
1198
+ let hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
1199
+ if (visualColumn >= this.hot.countCols()) {
1200
+ hfColumnIndex = visualColumn; // Column beyond the table boundaries.
1148
1201
  }
1149
1202
 
1150
- /**
1151
- * Called when a named expression is added to the engine instance.
1152
- *
1153
- * @private
1154
- * @fires Hooks#afterNamedExpressionAdded
1155
- * @param {string} namedExpressionName The name of the added expression.
1156
- * @param {Array} changes The values and location of applied changes.
1157
- */
1158
- onEngineNamedExpressionsAdded(namedExpressionName, changes) {
1159
- this.hot.runHooks('afterNamedExpressionAdded', namedExpressionName, changes);
1203
+ if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
1204
+ return false;
1160
1205
  }
1161
-
1162
- /**
1163
- * Called when a named expression is removed from the engine instance.
1164
- *
1165
- * @private
1166
- * @fires Hooks#afterNamedExpressionRemoved
1167
- * @param {string} namedExpressionName The name of the removed expression.
1168
- * @param {Array} changes The values and location of applied changes.
1169
- */
1170
- onEngineNamedExpressionsRemoved(namedExpressionName, changes) {
1171
- this.hot.runHooks('afterNamedExpressionRemoved', namedExpressionName, changes);
1206
+ }
1207
+ function _onBeforeRemoveRow2(row, amount, physicalRows) {
1208
+ const hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
1209
+ const possible = hfRows.every(hfRow => {
1210
+ return this.engine.isItPossibleToRemoveRows(this.sheetId, [hfRow, 1]);
1211
+ });
1212
+ return possible === false ? false : undefined;
1213
+ }
1214
+ function _onBeforeRemoveCol2(col, amount, physicalColumns) {
1215
+ const hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
1216
+ const possible = hfColumns.every(hfColumn => {
1217
+ return this.engine.isItPossibleToRemoveColumns(this.sheetId, [hfColumn, 1]);
1218
+ });
1219
+ return possible === false ? false : undefined;
1220
+ }
1221
+ function _onAfterCreateRow2(visualRow, amount, source) {
1222
+ if (isBlockedSource(source)) {
1223
+ return;
1172
1224
  }
1173
-
1174
- /**
1175
- * Called when a new sheet is added to the engine instance.
1176
- *
1177
- * @private
1178
- * @fires Hooks#afterSheetAdded
1179
- * @param {string} addedSheetDisplayName The name of the added sheet.
1180
- */
1181
- onEngineSheetAdded(addedSheetDisplayName) {
1182
- this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
1225
+ const changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
1226
+ this.renderDependentSheets(changes);
1227
+ }
1228
+ function _onAfterCreateCol2(visualColumn, amount, source) {
1229
+ if (isBlockedSource(source)) {
1230
+ return;
1183
1231
  }
1184
-
1185
- /**
1186
- * Called when a sheet in the engine instance is renamed.
1187
- *
1188
- * @private
1189
- * @fires Hooks#afterSheetRenamed
1190
- * @param {string} oldDisplayName The old name of the sheet.
1191
- * @param {string} newDisplayName The new name of the sheet.
1192
- */
1193
- onEngineSheetRenamed(oldDisplayName, newDisplayName) {
1194
- this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
1232
+ const changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
1233
+ this.renderDependentSheets(changes);
1234
+ }
1235
+ function _onAfterRemoveRow2(row, amount, physicalRows, source) {
1236
+ if (isBlockedSource(source)) {
1237
+ return;
1195
1238
  }
1196
-
1197
- /**
1198
- * Called when a sheet is removed from the engine instance.
1199
- *
1200
- * @private
1201
- * @fires Hooks#afterSheetRemoved
1202
- * @param {string} removedSheetDisplayName The removed sheet name.
1203
- * @param {Array} changes The values and location of applied changes.
1204
- */
1205
- onEngineSheetRemoved(removedSheetDisplayName, changes) {
1206
- this.hot.runHooks('afterSheetRemoved', removedSheetDisplayName, changes);
1239
+ const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1240
+ const changes = this.engine.batch(() => {
1241
+ descendingHfRows.forEach(hfRow => {
1242
+ this.engine.removeRows(this.sheetId, [hfRow, 1]);
1243
+ });
1244
+ });
1245
+ this.renderDependentSheets(changes);
1246
+ }
1247
+ function _onAfterRemoveCol2(col, amount, physicalColumns, source) {
1248
+ if (isBlockedSource(source)) {
1249
+ return;
1207
1250
  }
1251
+ const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1252
+ const changes = this.engine.batch(() => {
1253
+ descendingHfColumns.forEach(hfColumn => {
1254
+ this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
1255
+ });
1256
+ });
1257
+ this.renderDependentSheets(changes);
1258
+ }
1259
+ function _onAfterDetachChild2(parent, element, finalElementRowIndex) {
1260
+ var _element$__children;
1261
+ _classPrivateFieldSet(this, _internalOperationPending, true);
1262
+ const 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());
1263
+ _classPrivateFieldSet(this, _internalOperationPending, false);
1264
+ rowsData.forEach((row, relativeRowIndex) => {
1265
+ row.forEach((value, colIndex) => {
1266
+ this.engine.setCellContents({
1267
+ col: colIndex,
1268
+ row: finalElementRowIndex + relativeRowIndex,
1269
+ sheet: this.sheetId
1270
+ }, [[value]]);
1271
+ });
1272
+ });
1273
+ }
1274
+ function _onEngineValuesUpdated2(changes) {
1275
+ this.hot.runHooks('afterFormulasValuesUpdate', changes);
1276
+ }
1277
+ function _onEngineNamedExpressionsAdded2(namedExpressionName, changes) {
1278
+ this.hot.runHooks('afterNamedExpressionAdded', namedExpressionName, changes);
1279
+ }
1280
+ function _onEngineNamedExpressionsRemoved2(namedExpressionName, changes) {
1281
+ this.hot.runHooks('afterNamedExpressionRemoved', namedExpressionName, changes);
1282
+ }
1283
+ function _onEngineSheetAdded2(addedSheetDisplayName) {
1284
+ this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
1285
+ }
1286
+ function _onEngineSheetRenamed2(oldDisplayName, newDisplayName) {
1287
+ this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
1208
1288
  }
1209
- exports.Formulas = Formulas;
1289
+ function _onEngineSheetRemoved2(removedSheetDisplayName, changes) {
1290
+ this.hot.runHooks('afterSheetRemoved', removedSheetDisplayName, changes);
1291
+ }