handsontable 14.0.0-next-c080457-20231107 → 14.0.0-next-7ee54cb-20231108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) 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 +7330 -6389
  84. package/dist/handsontable.full.min.css +2 -2
  85. package/dist/handsontable.full.min.js +154 -154
  86. package/dist/handsontable.js +7329 -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.js +98 -102
  126. package/plugins/autofill/autofill.mjs +97 -101
  127. package/plugins/base/base.js +61 -28
  128. package/plugins/base/base.mjs +60 -28
  129. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
  130. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
  131. package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
  132. package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
  133. package/plugins/columnSorting/columnSorting.js +107 -99
  134. package/plugins/columnSorting/columnSorting.mjs +106 -98
  135. package/plugins/columnSorting/columnStatesManager.js +12 -6
  136. package/plugins/columnSorting/columnStatesManager.mjs +12 -6
  137. package/plugins/columnSummary/columnSummary.js +71 -58
  138. package/plugins/columnSummary/columnSummary.mjs +70 -57
  139. package/plugins/columnSummary/endpoints.js +20 -14
  140. package/plugins/columnSummary/endpoints.mjs +20 -14
  141. package/plugins/comments/commentEditor.js +30 -2
  142. package/plugins/comments/commentEditor.mjs +30 -2
  143. package/plugins/comments/comments.js +158 -169
  144. package/plugins/comments/comments.mjs +157 -168
  145. package/plugins/comments/displaySwitch.js +7 -3
  146. package/plugins/comments/displaySwitch.mjs +7 -3
  147. package/plugins/contextMenu/commandExecutor.js +15 -2
  148. package/plugins/contextMenu/commandExecutor.mjs +15 -2
  149. package/plugins/contextMenu/contextMenu.js +96 -102
  150. package/plugins/contextMenu/contextMenu.mjs +95 -101
  151. package/plugins/contextMenu/itemsFactory.js +19 -4
  152. package/plugins/contextMenu/itemsFactory.mjs +19 -4
  153. package/plugins/contextMenu/menu/cursor.js +36 -0
  154. package/plugins/contextMenu/menu/cursor.mjs +36 -0
  155. package/plugins/contextMenu/menu/menu.js +57 -5
  156. package/plugins/contextMenu/menu/menu.mjs +57 -5
  157. package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
  158. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
  159. package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
  160. package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
  161. package/plugins/copyPaste/copyPaste.js +74 -75
  162. package/plugins/copyPaste/copyPaste.mjs +74 -75
  163. package/plugins/customBorders/customBorders.js +57 -50
  164. package/plugins/customBorders/customBorders.mjs +56 -49
  165. package/plugins/dragToScroll/dragToScroll.js +50 -54
  166. package/plugins/dragToScroll/dragToScroll.mjs +49 -52
  167. package/plugins/dropdownMenu/dropdownMenu.js +136 -131
  168. package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
  169. package/plugins/exportFile/dataProvider.js +7 -2
  170. package/plugins/exportFile/dataProvider.mjs +7 -2
  171. package/plugins/exportFile/exportFile.js +1 -1
  172. package/plugins/exportFile/exportFile.mjs +1 -1
  173. package/plugins/exportFile/types/_base.js +14 -6
  174. package/plugins/exportFile/types/_base.mjs +14 -6
  175. package/plugins/filters/component/actionBar.js +9 -0
  176. package/plugins/filters/component/actionBar.mjs +9 -0
  177. package/plugins/filters/component/condition.js +13 -0
  178. package/plugins/filters/component/condition.mjs +13 -0
  179. package/plugins/filters/component/operators.js +9 -0
  180. package/plugins/filters/component/operators.mjs +9 -0
  181. package/plugins/filters/component/value.js +9 -0
  182. package/plugins/filters/component/value.mjs +9 -0
  183. package/plugins/filters/conditionCollection.js +9 -4
  184. package/plugins/filters/conditionCollection.mjs +9 -4
  185. package/plugins/filters/conditionUpdateObserver.js +53 -42
  186. package/plugins/filters/conditionUpdateObserver.mjs +53 -42
  187. package/plugins/filters/dataFilter.js +9 -3
  188. package/plugins/filters/dataFilter.mjs +9 -3
  189. package/plugins/filters/filters.js +184 -189
  190. package/plugins/filters/filters.mjs +182 -187
  191. package/plugins/filters/ui/_base.js +1 -1
  192. package/plugins/filters/ui/_base.mjs +1 -1
  193. package/plugins/filters/utils.js +1 -1
  194. package/plugins/filters/utils.mjs +1 -1
  195. package/plugins/formulas/engine/settings.js +1 -1
  196. package/plugins/formulas/engine/settings.mjs +1 -1
  197. package/plugins/formulas/formulas.js +684 -602
  198. package/plugins/formulas/formulas.mjs +682 -600
  199. package/plugins/hiddenColumns/hiddenColumns.js +174 -169
  200. package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
  201. package/plugins/hiddenRows/hiddenRows.js +170 -165
  202. package/plugins/hiddenRows/hiddenRows.mjs +169 -164
  203. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  204. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  205. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  206. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  207. package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
  208. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
  209. package/plugins/manualColumnMove/manualColumnMove.js +287 -232
  210. package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
  211. package/plugins/manualColumnMove/ui/_base.js +9 -3
  212. package/plugins/manualColumnMove/ui/_base.mjs +9 -3
  213. package/plugins/manualColumnResize/manualColumnResize.js +291 -246
  214. package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
  215. package/plugins/manualRowMove/manualRowMove.js +223 -208
  216. package/plugins/manualRowMove/manualRowMove.mjs +222 -207
  217. package/plugins/manualRowMove/ui/_base.js +10 -5
  218. package/plugins/manualRowMove/ui/_base.mjs +10 -5
  219. package/plugins/manualRowResize/manualRowResize.js +254 -209
  220. package/plugins/manualRowResize/manualRowResize.mjs +253 -207
  221. package/plugins/mergeCells/calculations/autofill.js +9 -3
  222. package/plugins/mergeCells/calculations/autofill.mjs +9 -3
  223. package/plugins/mergeCells/calculations/selection.js +10 -4
  224. package/plugins/mergeCells/calculations/selection.mjs +10 -4
  225. package/plugins/mergeCells/cellCoords.js +16 -6
  226. package/plugins/mergeCells/cellCoords.mjs +16 -6
  227. package/plugins/mergeCells/cellsCollection.js +10 -4
  228. package/plugins/mergeCells/cellsCollection.mjs +10 -4
  229. package/plugins/mergeCells/mergeCells.js +582 -502
  230. package/plugins/mergeCells/mergeCells.mjs +580 -500
  231. package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
  232. package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
  233. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
  234. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
  235. package/plugins/nestedHeaders/nestedHeaders.js +542 -499
  236. package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
  237. package/plugins/nestedHeaders/stateManager/index.js +1 -1
  238. package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
  239. package/plugins/nestedRows/data/dataManager.js +21 -15
  240. package/plugins/nestedRows/data/dataManager.mjs +21 -15
  241. package/plugins/nestedRows/nestedRows.js +328 -279
  242. package/plugins/nestedRows/nestedRows.mjs +327 -278
  243. package/plugins/nestedRows/ui/_base.js +7 -1
  244. package/plugins/nestedRows/ui/_base.mjs +7 -1
  245. package/plugins/nestedRows/ui/collapsing.js +2 -2
  246. package/plugins/nestedRows/ui/collapsing.mjs +2 -2
  247. package/plugins/nestedRows/ui/contextMenu.js +28 -18
  248. package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
  249. package/plugins/nestedRows/utils/rowMoveController.js +12 -4
  250. package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
  251. package/plugins/persistentState/persistentState.js +14 -11
  252. package/plugins/persistentState/persistentState.mjs +14 -11
  253. package/plugins/persistentState/storage.js +11 -6
  254. package/plugins/persistentState/storage.mjs +11 -6
  255. package/plugins/registry.js +2 -2
  256. package/plugins/registry.mjs +2 -2
  257. package/plugins/search/search.js +57 -46
  258. package/plugins/search/search.mjs +56 -45
  259. package/plugins/touchScroll/touchScroll.js +102 -100
  260. package/plugins/touchScroll/touchScroll.mjs +100 -98
  261. package/plugins/trimRows/trimRows.js +33 -28
  262. package/plugins/trimRows/trimRows.mjs +32 -27
  263. package/plugins/undoRedo/undoRedo.js +2 -2
  264. package/plugins/undoRedo/undoRedo.mjs +2 -2
  265. package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
  266. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
  267. package/renderers/baseRenderer/baseRenderer.js +2 -2
  268. package/renderers/baseRenderer/baseRenderer.mjs +2 -2
  269. package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
  270. package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
  271. package/renderers/dateRenderer/dateRenderer.js +4 -4
  272. package/renderers/dateRenderer/dateRenderer.mjs +4 -4
  273. package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
  274. package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
  275. package/renderers/htmlRenderer/htmlRenderer.js +4 -4
  276. package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
  277. package/renderers/numericRenderer/numericRenderer.js +3 -3
  278. package/renderers/numericRenderer/numericRenderer.mjs +3 -3
  279. package/renderers/passwordRenderer/passwordRenderer.js +3 -3
  280. package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
  281. package/renderers/selectRenderer/selectRenderer.js +4 -4
  282. package/renderers/selectRenderer/selectRenderer.mjs +4 -4
  283. package/renderers/textRenderer/textRenderer.js +5 -5
  284. package/renderers/textRenderer/textRenderer.mjs +5 -5
  285. package/renderers/timeRenderer/timeRenderer.js +3 -3
  286. package/renderers/timeRenderer/timeRenderer.mjs +3 -3
  287. package/selection/range.js +12 -2
  288. package/selection/range.mjs +12 -2
  289. package/selection/selection.js +28 -10
  290. package/selection/selection.mjs +28 -10
  291. package/selection/utils.js +24 -14
  292. package/selection/utils.mjs +25 -15
  293. package/shortcuts/manager.js +1 -1
  294. package/shortcuts/manager.mjs +1 -1
  295. package/tableView.js +208 -200
  296. package/tableView.mjs +208 -200
  297. package/translations/changesObservable/utils.js +2 -2
  298. package/translations/changesObservable/utils.mjs +2 -2
  299. package/translations/indexMapper.js +25 -22
  300. package/translations/indexMapper.mjs +25 -22
  301. package/translations/mapCollections/aggregatedCollection.js +8 -2
  302. package/translations/mapCollections/aggregatedCollection.mjs +8 -2
  303. package/translations/mapCollections/mapCollection.js +5 -2
  304. package/translations/mapCollections/mapCollection.mjs +5 -2
  305. package/translations/maps/indexMap.js +6 -1
  306. package/translations/maps/indexMap.mjs +6 -1
  307. package/translations/maps/utils/physicallyIndexed.js +2 -2
  308. package/translations/maps/utils/physicallyIndexed.mjs +2 -2
  309. package/utils/dataStructures/linkedList.js +10 -6
  310. package/utils/dataStructures/linkedList.mjs +10 -6
  311. package/utils/dataStructures/queue.js +1 -1
  312. package/utils/dataStructures/queue.mjs +1 -1
  313. package/utils/dataStructures/stack.js +1 -1
  314. package/utils/dataStructures/stack.mjs +1 -1
  315. package/utils/ghostTable.js +2 -2
  316. package/utils/ghostTable.mjs +2 -2
  317. package/utils/interval.js +73 -36
  318. package/utils/interval.mjs +73 -36
  319. package/utils/parseTable.js +1 -1
  320. package/utils/parseTable.mjs +1 -1
  321. package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
  322. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
  323. package/validators/dateValidator/dateValidator.js +1 -1
  324. package/validators/dateValidator/dateValidator.mjs +1 -1
  325. package/validators/numericValidator/numericValidator.js +1 -1
  326. package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,9 +1,15 @@
1
1
  import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/es.error.cause.js";
3
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
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); }
8
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
2
9
  import { BasePlugin } from "../base/index.mjs";
3
10
  import Hooks from "../../pluginHooks.mjs";
4
11
  import { offset, outerHeight, outerWidth } from "../../helpers/dom/element.mjs";
5
12
  import { arrayEach, arrayMap } from "../../helpers/array.mjs";
6
- import EventManager from "../../eventManager.mjs";
7
13
  import { getDragDirectionAndRange, DIRECTIONS, getMappedFillHandleSetting } from "./utils.mjs";
8
14
  Hooks.getSingleton().register('modifyAutofillRange');
9
15
  Hooks.getSingleton().register('beforeAutofill');
@@ -28,69 +34,92 @@ const INTERVAL_FOR_ADDING_ROW = 200;
28
34
  * @class Autofill
29
35
  * @plugin Autofill
30
36
  */
31
-
37
+ var _onCellCornerDblClick = /*#__PURE__*/new WeakSet();
38
+ var _onAfterCellCornerMouseDown = /*#__PURE__*/new WeakSet();
39
+ var _onBeforeCellMouseOver = /*#__PURE__*/new WeakSet();
40
+ var _onMouseUp = /*#__PURE__*/new WeakSet();
41
+ var _onMouseMove = /*#__PURE__*/new WeakSet();
32
42
  export class Autofill extends BasePlugin {
33
- static get PLUGIN_KEY() {
34
- return PLUGIN_KEY;
35
- }
36
- static get PLUGIN_PRIORITY() {
37
- return PLUGIN_PRIORITY;
38
- }
39
- static get SETTING_KEYS() {
40
- return [PLUGIN_KEY, ...SETTING_KEYS];
41
- }
42
- constructor(hotInstance) {
43
- super(hotInstance);
43
+ constructor() {
44
+ super(...arguments);
45
+ /**
46
+ * On mouse move listener.
47
+ *
48
+ * @param {MouseEvent} event `mousemove` event properties.
49
+ */
50
+ _classPrivateMethodInitSpec(this, _onMouseMove);
51
+ /**
52
+ * On mouse up listener.
53
+ */
54
+ _classPrivateMethodInitSpec(this, _onMouseUp);
44
55
  /**
45
- * Event manager instance.
56
+ * On before cell mouse over listener.
57
+ *
58
+ * @param {CellCoords} coords `CellCoords` coord object.
59
+ */
60
+ _classPrivateMethodInitSpec(this, _onBeforeCellMouseOver);
61
+ /**
62
+ * On after cell corner mouse down listener.
63
+ */
64
+ _classPrivateMethodInitSpec(this, _onAfterCellCornerMouseDown);
65
+ /**
66
+ * On cell corner double click callback.
46
67
  *
47
68
  * @private
48
- * @type {EventManager}
49
69
  */
50
- this.eventManager = new EventManager(this);
70
+ _classPrivateMethodInitSpec(this, _onCellCornerDblClick);
51
71
  /**
52
72
  * Specifies if adding new row started.
53
73
  *
54
74
  * @private
55
75
  * @type {boolean}
56
76
  */
57
- this.addingStarted = false;
77
+ _defineProperty(this, "addingStarted", false);
58
78
  /**
59
79
  * Specifies if there was mouse down on the cell corner.
60
80
  *
61
81
  * @private
62
82
  * @type {boolean}
63
83
  */
64
- this.mouseDownOnCellCorner = false;
84
+ _defineProperty(this, "mouseDownOnCellCorner", false);
65
85
  /**
66
86
  * Specifies if mouse was dragged outside Handsontable.
67
87
  *
68
88
  * @private
69
89
  * @type {boolean}
70
90
  */
71
- this.mouseDragOutside = false;
91
+ _defineProperty(this, "mouseDragOutside", false);
72
92
  /**
73
93
  * Specifies how many cell levels were dragged using the handle.
74
94
  *
75
95
  * @private
76
96
  * @type {boolean}
77
97
  */
78
- this.handleDraggedCells = 0;
98
+ _defineProperty(this, "handleDraggedCells", 0);
79
99
  /**
80
100
  * Specifies allowed directions of drag (`'horizontal'` or '`vertical`').
81
101
  *
82
102
  * @private
83
103
  * @type {string[]}
84
104
  */
85
- this.directions = [];
105
+ _defineProperty(this, "directions", []);
86
106
  /**
87
107
  * Specifies if can insert new rows if needed.
88
108
  *
109
+ * @private
89
110
  * @type {boolean}
90
111
  */
91
- this.autoInsertRow = false;
112
+ _defineProperty(this, "autoInsertRow", false);
113
+ }
114
+ static get PLUGIN_KEY() {
115
+ return PLUGIN_KEY;
116
+ }
117
+ static get PLUGIN_PRIORITY() {
118
+ return PLUGIN_PRIORITY;
119
+ }
120
+ static get SETTING_KEYS() {
121
+ return [PLUGIN_KEY, ...SETTING_KEYS];
92
122
  }
93
-
94
123
  /**
95
124
  * Checks if the plugin is enabled in the Handsontable settings.
96
125
  *
@@ -109,9 +138,9 @@ export class Autofill extends BasePlugin {
109
138
  }
110
139
  this.mapSettings();
111
140
  this.registerEvents();
112
- this.addHook('afterOnCellCornerMouseDown', event => this.onAfterCellCornerMouseDown(event));
113
- this.addHook('afterOnCellCornerDblClick', event => this.onCellCornerDblClick(event));
114
- this.addHook('beforeOnCellMouseOver', (_, coords) => this.onBeforeCellMouseOver(coords));
141
+ this.addHook('afterOnCellCornerMouseDown', event => _classPrivateMethodGet(this, _onAfterCellCornerMouseDown, _onAfterCellCornerMouseDown2).call(this, event));
142
+ this.addHook('afterOnCellCornerDblClick', event => _classPrivateMethodGet(this, _onCellCornerDblClick, _onCellCornerDblClick2).call(this, event));
143
+ this.addHook('beforeOnCellMouseOver', (_, coords) => _classPrivateMethodGet(this, _onBeforeCellMouseOver, _onBeforeCellMouseOver2).call(this, coords));
115
144
  super.enablePlugin();
116
145
  }
117
146
 
@@ -322,7 +351,7 @@ export class Autofill extends BasePlugin {
322
351
  */
323
352
  addRow() {
324
353
  this.hot._registerTimeout(() => {
325
- this.hot.alter(INSERT_ROW_ALTER_ACTION_NAME, void 0, 1, `${this.pluginName}.fill`);
354
+ this.hot.alter(INSERT_ROW_ALTER_ACTION_NAME, undefined, 1, `${this.pluginName}.fill`);
326
355
  this.addingStarted = false;
327
356
  }, INTERVAL_FOR_ADDING_ROW);
328
357
  }
@@ -402,7 +431,7 @@ export class Autofill extends BasePlugin {
402
431
  selectAdjacent() {
403
432
  const cornersOfSelectedCells = this.hot.getSelectedLast();
404
433
  const lastFilledInRowIndex = this.getIndexOfLastAdjacentFilledInRow(cornersOfSelectedCells);
405
- if (lastFilledInRowIndex === -1 || lastFilledInRowIndex === void 0) {
434
+ if (lastFilledInRowIndex === -1 || lastFilledInRowIndex === undefined) {
406
435
  return false;
407
436
  }
408
437
  this.addSelectionFromStartAreaToSpecificRowIndex(cornersOfSelectedCells, lastFilledInRowIndex);
@@ -455,80 +484,9 @@ export class Autofill extends BasePlugin {
455
484
  const {
456
485
  documentElement
457
486
  } = this.hot.rootDocument;
458
- this.eventManager.addEventListener(documentElement, 'mouseup', () => this.onMouseUp());
459
- this.eventManager.addEventListener(documentElement, 'mousemove', event => this.onMouseMove(event));
460
- }
461
-
462
- /**
463
- * On cell corner double click callback.
464
- *
465
- * @private
466
- */
467
- onCellCornerDblClick() {
468
- const selectionApplied = this.selectAdjacent();
469
- if (selectionApplied) {
470
- this.fillIn();
471
- }
487
+ this.eventManager.addEventListener(documentElement, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
488
+ this.eventManager.addEventListener(documentElement, 'mousemove', event => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, event));
472
489
  }
473
-
474
- /**
475
- * On after cell corner mouse down listener.
476
- *
477
- * @private
478
- */
479
- onAfterCellCornerMouseDown() {
480
- this.handleDraggedCells = 1;
481
- this.mouseDownOnCellCorner = true;
482
- }
483
-
484
- /**
485
- * On before cell mouse over listener.
486
- *
487
- * @private
488
- * @param {CellCoords} coords `CellCoords` coord object.
489
- */
490
- onBeforeCellMouseOver(coords) {
491
- if (this.mouseDownOnCellCorner && !this.hot.view.isMouseDown() && this.handleDraggedCells) {
492
- this.handleDraggedCells += 1;
493
- this.showBorder(coords);
494
- this.addNewRowIfNeeded();
495
- }
496
- }
497
-
498
- /**
499
- * On mouse up listener.
500
- *
501
- * @private
502
- */
503
- onMouseUp() {
504
- if (this.handleDraggedCells) {
505
- if (this.handleDraggedCells > 1) {
506
- this.fillIn();
507
- }
508
- this.handleDraggedCells = 0;
509
- this.mouseDownOnCellCorner = false;
510
- }
511
- }
512
-
513
- /**
514
- * On mouse move listener.
515
- *
516
- * @private
517
- * @param {MouseEvent} event `mousemove` event properties.
518
- */
519
- onMouseMove(event) {
520
- const mouseWasDraggedOutside = this.getIfMouseWasDraggedOutside(event);
521
- if (this.addingStarted === false && this.handleDraggedCells > 0 && mouseWasDraggedOutside) {
522
- this.mouseDragOutside = true;
523
- this.addingStarted = true;
524
- } else {
525
- this.mouseDragOutside = false;
526
- }
527
- if (this.mouseDragOutside && this.autoInsertRow) {
528
- this.addRow();
529
- }
530
- }
531
-
532
490
  /**
533
491
  * Clears mapped settings.
534
492
  *
@@ -556,4 +514,42 @@ export class Autofill extends BasePlugin {
556
514
  destroy() {
557
515
  super.destroy();
558
516
  }
517
+ }
518
+ function _onCellCornerDblClick2() {
519
+ const selectionApplied = this.selectAdjacent();
520
+ if (selectionApplied) {
521
+ this.fillIn();
522
+ }
523
+ }
524
+ function _onAfterCellCornerMouseDown2() {
525
+ this.handleDraggedCells = 1;
526
+ this.mouseDownOnCellCorner = true;
527
+ }
528
+ function _onBeforeCellMouseOver2(coords) {
529
+ if (this.mouseDownOnCellCorner && !this.hot.view.isMouseDown() && this.handleDraggedCells) {
530
+ this.handleDraggedCells += 1;
531
+ this.showBorder(coords);
532
+ this.addNewRowIfNeeded();
533
+ }
534
+ }
535
+ function _onMouseUp2() {
536
+ if (this.handleDraggedCells) {
537
+ if (this.handleDraggedCells > 1) {
538
+ this.fillIn();
539
+ }
540
+ this.handleDraggedCells = 0;
541
+ this.mouseDownOnCellCorner = false;
542
+ }
543
+ }
544
+ function _onMouseMove2(event) {
545
+ const mouseWasDraggedOutside = this.getIfMouseWasDraggedOutside(event);
546
+ if (this.addingStarted === false && this.handleDraggedCells > 0 && mouseWasDraggedOutside) {
547
+ this.mouseDragOutside = true;
548
+ this.addingStarted = true;
549
+ } else {
550
+ this.mouseDragOutside = false;
551
+ }
552
+ if (this.mouseDragOutside && this.autoInsertRow) {
553
+ this.addRow();
554
+ }
559
555
  }
@@ -10,19 +10,28 @@ var _registry2 = require("../../cellTypes/registry");
10
10
  var _registry3 = require("../../editors/registry");
11
11
  var _registry4 = require("../../renderers/registry");
12
12
  var _registry5 = require("../../validators/registry");
13
+ var _eventManager = _interopRequireDefault(require("../../eventManager"));
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
16
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
14
17
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
18
+ 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; }
19
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20
+ 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); }
15
21
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
22
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
23
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
24
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
16
25
  const DEPS_TYPE_CHECKERS = new Map([['plugin', _registry.hasPlugin], ['cell-type', _registry2.hasCellType], ['editor', _registry3.hasEditor], ['renderer', _registry4.hasRenderer], ['validator', _registry5.hasValidator]]);
17
26
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'base';
18
- const privatePool = new WeakMap();
19
- const missingDependeciesMsgs = [];
27
+ const missingDepsMsgs = [];
20
28
  let initializedPlugins = null;
21
29
 
22
30
  /**
23
31
  * @util
24
32
  * @property {Core} hot Handsontable instance.
25
33
  */
34
+ var _hooks = /*#__PURE__*/new WeakMap();
26
35
  var _isRelevantToSettings = /*#__PURE__*/new WeakSet();
27
36
  class BasePlugin {
28
37
  static get PLUGIN_KEY() {
@@ -42,6 +51,12 @@ class BasePlugin {
42
51
  return [this.PLUGIN_KEY];
43
52
  }
44
53
 
54
+ /**
55
+ * The instance of the {@link EventManager} class.
56
+ *
57
+ * @type {EventManager}
58
+ */
59
+
45
60
  /**
46
61
  * @param {object} hotInstance Handsontable instance.
47
62
  */
@@ -56,6 +71,34 @@ class BasePlugin {
56
71
  * @returns {boolean}
57
72
  */
58
73
  _classPrivateMethodInitSpec(this, _isRelevantToSettings);
74
+ _defineProperty(this, "eventManager", new _eventManager.default(this));
75
+ /**
76
+ * @type {string}
77
+ */
78
+ _defineProperty(this, "pluginName", null);
79
+ /**
80
+ * @type {Function[]}
81
+ */
82
+ _defineProperty(this, "pluginsInitializedCallbacks", []);
83
+ /**
84
+ * @type {boolean}
85
+ */
86
+ _defineProperty(this, "isPluginsReady", false);
87
+ /**
88
+ * @type {boolean}
89
+ */
90
+ _defineProperty(this, "enabled", false);
91
+ /**
92
+ * @type {boolean}
93
+ */
94
+ _defineProperty(this, "initialized", false);
95
+ /**
96
+ * Collection of the reference to the plugins hooks.
97
+ */
98
+ _classPrivateFieldInitSpec(this, _hooks, {
99
+ writable: true,
100
+ value: {}
101
+ });
59
102
  /**
60
103
  * Handsontable instance.
61
104
  *
@@ -64,15 +107,7 @@ class BasePlugin {
64
107
  (0, _object.defineGetter)(this, 'hot', hotInstance, {
65
108
  writable: false
66
109
  });
67
- privatePool.set(this, {
68
- hooks: {}
69
- });
70
110
  initializedPlugins = null;
71
- this.pluginName = null;
72
- this.pluginsInitializedCallbacks = [];
73
- this.isPluginsReady = false;
74
- this.enabled = false;
75
- this.initialized = false;
76
111
  this.hot.addHook('afterPluginsInitialized', () => this.onAfterPluginsInitialized());
77
112
  this.hot.addHook('afterUpdateSettings', newSettings => this.onUpdateSettings(newSettings));
78
113
  this.hot.addHook('beforeInit', () => this.init());
@@ -80,10 +115,10 @@ class BasePlugin {
80
115
  init() {
81
116
  this.pluginName = this.hot.getPluginName(this);
82
117
  const pluginDeps = this.constructor.PLUGIN_DEPS;
83
- const dependecies = Array.isArray(pluginDeps) ? pluginDeps : [];
84
- if (dependecies.length > 0) {
118
+ const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
119
+ if (deps.length > 0) {
85
120
  const missingDependencies = [];
86
- dependecies.forEach(dependency => {
121
+ deps.forEach(dependency => {
87
122
  const [type, moduleName] = dependency.split(':');
88
123
  if (!DEPS_TYPE_CHECKERS.has(type)) {
89
124
  throw new Error(`Unknown plugin dependency type "${type}" was found.`);
@@ -94,7 +129,7 @@ class BasePlugin {
94
129
  });
95
130
  if (missingDependencies.length > 0) {
96
131
  const errorMsg = [`The ${this.pluginName} plugin requires the following modules:\n`, `${missingDependencies.join('\n')}\n`].join('');
97
- missingDependeciesMsgs.push(errorMsg);
132
+ missingDepsMsgs.push(errorMsg);
98
133
  }
99
134
  }
100
135
  if (!initializedPlugins) {
@@ -117,8 +152,8 @@ class BasePlugin {
117
152
  });
118
153
  const isAllPluginsAreInitialized = initializedPlugins.length === 0;
119
154
  if (isAllPluginsAreInitialized) {
120
- if (missingDependeciesMsgs.length > 0) {
121
- const errorMsg = [`${missingDependeciesMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
155
+ if (missingDepsMsgs.length > 0) {
156
+ const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
122
157
  throw new Error(errorMsg);
123
158
  }
124
159
  this.hot.runHooks('afterPluginsInitialized');
@@ -137,9 +172,8 @@ class BasePlugin {
137
172
  * Disable plugin for this Handsontable instance.
138
173
  */
139
174
  disablePlugin() {
140
- if (this.eventManager) {
141
- this.eventManager.clear();
142
- }
175
+ var _this$eventManager;
176
+ (_this$eventManager = this.eventManager) === null || _this$eventManager === void 0 || _this$eventManager.clear();
143
177
  this.clearHooks();
144
178
  this.enabled = false;
145
179
  }
@@ -151,11 +185,11 @@ class BasePlugin {
151
185
  * @param {Function} callback The listener function to add.
152
186
  */
153
187
  addHook(name, callback) {
154
- privatePool.get(this).hooks[name] = privatePool.get(this).hooks[name] || [];
155
- const hooks = privatePool.get(this).hooks[name];
188
+ _classPrivateFieldGet(this, _hooks)[name] = _classPrivateFieldGet(this, _hooks)[name] || [];
189
+ const hooks = _classPrivateFieldGet(this, _hooks)[name];
156
190
  this.hot.addHook(name, callback);
157
191
  hooks.push(callback);
158
- privatePool.get(this).hooks[name] = hooks;
192
+ _classPrivateFieldGet(this, _hooks)[name] = hooks;
159
193
  }
160
194
 
161
195
  /**
@@ -164,7 +198,7 @@ class BasePlugin {
164
198
  * @param {string} name The hook name.
165
199
  */
166
200
  removeHooks(name) {
167
- (0, _array.arrayEach)(privatePool.get(this).hooks[name] || [], callback => {
201
+ (0, _array.arrayEach)(_classPrivateFieldGet(this, _hooks)[name] || [], callback => {
168
202
  this.hot.removeHook(name, callback);
169
203
  });
170
204
  }
@@ -173,7 +207,7 @@ class BasePlugin {
173
207
  * Clear all hooks.
174
208
  */
175
209
  clearHooks() {
176
- const hooks = privatePool.get(this).hooks;
210
+ const hooks = _classPrivateFieldGet(this, _hooks);
177
211
  (0, _object.objectEach)(hooks, (callbacks, name) => this.removeHooks(name));
178
212
  hooks.length = 0;
179
213
  }
@@ -233,9 +267,8 @@ class BasePlugin {
233
267
  * Destroy plugin.
234
268
  */
235
269
  destroy() {
236
- if (this.eventManager) {
237
- this.eventManager.destroy();
238
- }
270
+ var _this$eventManager2;
271
+ (_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
239
272
  this.clearHooks();
240
273
  (0, _object.objectEach)(this, (value, property) => {
241
274
  if (property !== 'hot') {
@@ -261,7 +294,7 @@ function _isRelevantToSettings2(settings) {
261
294
  return settingKeys;
262
295
  }
263
296
  for (let i = 0; i < settingKeys.length; i++) {
264
- if (settings[settingKeys[i]] !== void 0) {
297
+ if (settings[settingKeys[i]] !== undefined) {
265
298
  return true;
266
299
  }
267
300
  }
@@ -1,8 +1,15 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
3
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
+ 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; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
+ 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); }
5
9
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
10
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
11
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
12
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
6
13
  import { defineGetter, objectEach } from "../../helpers/object.mjs";
7
14
  import { arrayEach } from "../../helpers/array.mjs";
8
15
  import { getPluginsNames, hasPlugin } from "../registry.mjs";
@@ -10,16 +17,17 @@ import { hasCellType } from "../../cellTypes/registry.mjs";
10
17
  import { hasEditor } from "../../editors/registry.mjs";
11
18
  import { hasRenderer } from "../../renderers/registry.mjs";
12
19
  import { hasValidator } from "../../validators/registry.mjs";
20
+ import EventManager from "../../eventManager.mjs";
13
21
  const DEPS_TYPE_CHECKERS = new Map([['plugin', hasPlugin], ['cell-type', hasCellType], ['editor', hasEditor], ['renderer', hasRenderer], ['validator', hasValidator]]);
14
22
  export const PLUGIN_KEY = 'base';
15
- const privatePool = new WeakMap();
16
- const missingDependeciesMsgs = [];
23
+ const missingDepsMsgs = [];
17
24
  let initializedPlugins = null;
18
25
 
19
26
  /**
20
27
  * @util
21
28
  * @property {Core} hot Handsontable instance.
22
29
  */
30
+ var _hooks = /*#__PURE__*/new WeakMap();
23
31
  var _isRelevantToSettings = /*#__PURE__*/new WeakSet();
24
32
  export class BasePlugin {
25
33
  static get PLUGIN_KEY() {
@@ -39,6 +47,12 @@ export class BasePlugin {
39
47
  return [this.PLUGIN_KEY];
40
48
  }
41
49
 
50
+ /**
51
+ * The instance of the {@link EventManager} class.
52
+ *
53
+ * @type {EventManager}
54
+ */
55
+
42
56
  /**
43
57
  * @param {object} hotInstance Handsontable instance.
44
58
  */
@@ -53,6 +67,34 @@ export class BasePlugin {
53
67
  * @returns {boolean}
54
68
  */
55
69
  _classPrivateMethodInitSpec(this, _isRelevantToSettings);
70
+ _defineProperty(this, "eventManager", new EventManager(this));
71
+ /**
72
+ * @type {string}
73
+ */
74
+ _defineProperty(this, "pluginName", null);
75
+ /**
76
+ * @type {Function[]}
77
+ */
78
+ _defineProperty(this, "pluginsInitializedCallbacks", []);
79
+ /**
80
+ * @type {boolean}
81
+ */
82
+ _defineProperty(this, "isPluginsReady", false);
83
+ /**
84
+ * @type {boolean}
85
+ */
86
+ _defineProperty(this, "enabled", false);
87
+ /**
88
+ * @type {boolean}
89
+ */
90
+ _defineProperty(this, "initialized", false);
91
+ /**
92
+ * Collection of the reference to the plugins hooks.
93
+ */
94
+ _classPrivateFieldInitSpec(this, _hooks, {
95
+ writable: true,
96
+ value: {}
97
+ });
56
98
  /**
57
99
  * Handsontable instance.
58
100
  *
@@ -61,15 +103,7 @@ export class BasePlugin {
61
103
  defineGetter(this, 'hot', hotInstance, {
62
104
  writable: false
63
105
  });
64
- privatePool.set(this, {
65
- hooks: {}
66
- });
67
106
  initializedPlugins = null;
68
- this.pluginName = null;
69
- this.pluginsInitializedCallbacks = [];
70
- this.isPluginsReady = false;
71
- this.enabled = false;
72
- this.initialized = false;
73
107
  this.hot.addHook('afterPluginsInitialized', () => this.onAfterPluginsInitialized());
74
108
  this.hot.addHook('afterUpdateSettings', newSettings => this.onUpdateSettings(newSettings));
75
109
  this.hot.addHook('beforeInit', () => this.init());
@@ -77,10 +111,10 @@ export class BasePlugin {
77
111
  init() {
78
112
  this.pluginName = this.hot.getPluginName(this);
79
113
  const pluginDeps = this.constructor.PLUGIN_DEPS;
80
- const dependecies = Array.isArray(pluginDeps) ? pluginDeps : [];
81
- if (dependecies.length > 0) {
114
+ const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
115
+ if (deps.length > 0) {
82
116
  const missingDependencies = [];
83
- dependecies.forEach(dependency => {
117
+ deps.forEach(dependency => {
84
118
  const [type, moduleName] = dependency.split(':');
85
119
  if (!DEPS_TYPE_CHECKERS.has(type)) {
86
120
  throw new Error(`Unknown plugin dependency type "${type}" was found.`);
@@ -91,7 +125,7 @@ export class BasePlugin {
91
125
  });
92
126
  if (missingDependencies.length > 0) {
93
127
  const errorMsg = [`The ${this.pluginName} plugin requires the following modules:\n`, `${missingDependencies.join('\n')}\n`].join('');
94
- missingDependeciesMsgs.push(errorMsg);
128
+ missingDepsMsgs.push(errorMsg);
95
129
  }
96
130
  }
97
131
  if (!initializedPlugins) {
@@ -114,8 +148,8 @@ export class BasePlugin {
114
148
  });
115
149
  const isAllPluginsAreInitialized = initializedPlugins.length === 0;
116
150
  if (isAllPluginsAreInitialized) {
117
- if (missingDependeciesMsgs.length > 0) {
118
- const errorMsg = [`${missingDependeciesMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
151
+ if (missingDepsMsgs.length > 0) {
152
+ const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
119
153
  throw new Error(errorMsg);
120
154
  }
121
155
  this.hot.runHooks('afterPluginsInitialized');
@@ -134,9 +168,8 @@ export class BasePlugin {
134
168
  * Disable plugin for this Handsontable instance.
135
169
  */
136
170
  disablePlugin() {
137
- if (this.eventManager) {
138
- this.eventManager.clear();
139
- }
171
+ var _this$eventManager;
172
+ (_this$eventManager = this.eventManager) === null || _this$eventManager === void 0 || _this$eventManager.clear();
140
173
  this.clearHooks();
141
174
  this.enabled = false;
142
175
  }
@@ -148,11 +181,11 @@ export class BasePlugin {
148
181
  * @param {Function} callback The listener function to add.
149
182
  */
150
183
  addHook(name, callback) {
151
- privatePool.get(this).hooks[name] = privatePool.get(this).hooks[name] || [];
152
- const hooks = privatePool.get(this).hooks[name];
184
+ _classPrivateFieldGet(this, _hooks)[name] = _classPrivateFieldGet(this, _hooks)[name] || [];
185
+ const hooks = _classPrivateFieldGet(this, _hooks)[name];
153
186
  this.hot.addHook(name, callback);
154
187
  hooks.push(callback);
155
- privatePool.get(this).hooks[name] = hooks;
188
+ _classPrivateFieldGet(this, _hooks)[name] = hooks;
156
189
  }
157
190
 
158
191
  /**
@@ -161,7 +194,7 @@ export class BasePlugin {
161
194
  * @param {string} name The hook name.
162
195
  */
163
196
  removeHooks(name) {
164
- arrayEach(privatePool.get(this).hooks[name] || [], callback => {
197
+ arrayEach(_classPrivateFieldGet(this, _hooks)[name] || [], callback => {
165
198
  this.hot.removeHook(name, callback);
166
199
  });
167
200
  }
@@ -170,7 +203,7 @@ export class BasePlugin {
170
203
  * Clear all hooks.
171
204
  */
172
205
  clearHooks() {
173
- const hooks = privatePool.get(this).hooks;
206
+ const hooks = _classPrivateFieldGet(this, _hooks);
174
207
  objectEach(hooks, (callbacks, name) => this.removeHooks(name));
175
208
  hooks.length = 0;
176
209
  }
@@ -230,9 +263,8 @@ export class BasePlugin {
230
263
  * Destroy plugin.
231
264
  */
232
265
  destroy() {
233
- if (this.eventManager) {
234
- this.eventManager.destroy();
235
- }
266
+ var _this$eventManager2;
267
+ (_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
236
268
  this.clearHooks();
237
269
  objectEach(this, (value, property) => {
238
270
  if (property !== 'hot') {
@@ -257,7 +289,7 @@ function _isRelevantToSettings2(settings) {
257
289
  return settingKeys;
258
290
  }
259
291
  for (let i = 0; i < settingKeys.length; i++) {
260
- if (settings[settingKeys[i]] !== void 0) {
292
+ if (settings[settingKeys[i]] !== undefined) {
261
293
  return true;
262
294
  }
263
295
  }