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