handsontable 12.1.3 → 12.3.0-next-bb1a7c2-20221208

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 (948) hide show
  1. package/3rdparty/SheetClip/SheetClip.js +3 -32
  2. package/3rdparty/SheetClip/SheetClip.mjs +3 -23
  3. package/3rdparty/SheetClip/index.js +0 -2
  4. package/3rdparty/autoResize/autoResize.js +119 -145
  5. package/3rdparty/autoResize/autoResize.mjs +119 -143
  6. package/3rdparty/autoResize/index.js +0 -2
  7. package/3rdparty/walkontable/src/border.js +44 -154
  8. package/3rdparty/walkontable/src/border.mjs +41 -136
  9. package/3rdparty/walkontable/src/calculator/constants.js +0 -3
  10. package/3rdparty/walkontable/src/calculator/constants.mjs +0 -2
  11. package/3rdparty/walkontable/src/calculator/index.js +0 -10
  12. package/3rdparty/walkontable/src/calculator/viewportColumns.js +36 -77
  13. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +36 -70
  14. package/3rdparty/walkontable/src/calculator/viewportRows.js +30 -49
  15. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +30 -42
  16. package/3rdparty/walkontable/src/cell/coords.d.ts +1 -1
  17. package/3rdparty/walkontable/src/cell/coords.js +73 -65
  18. package/3rdparty/walkontable/src/cell/coords.mjs +73 -60
  19. package/3rdparty/walkontable/src/cell/range.d.ts +19 -16
  20. package/3rdparty/walkontable/src/cell/range.js +251 -231
  21. package/3rdparty/walkontable/src/cell/range.mjs +251 -222
  22. package/3rdparty/walkontable/src/core/_base.js +30 -74
  23. package/3rdparty/walkontable/src/core/_base.mjs +30 -67
  24. package/3rdparty/walkontable/src/core/clone.js +11 -44
  25. package/3rdparty/walkontable/src/core/clone.mjs +11 -32
  26. package/3rdparty/walkontable/src/core/core.js +8 -56
  27. package/3rdparty/walkontable/src/core/core.mjs +8 -38
  28. package/3rdparty/walkontable/src/event.js +41 -79
  29. package/3rdparty/walkontable/src/event.mjs +41 -66
  30. package/3rdparty/walkontable/src/facade/core.js +14 -16
  31. package/3rdparty/walkontable/src/facade/core.mjs +14 -13
  32. package/3rdparty/walkontable/src/filter/column.js +22 -17
  33. package/3rdparty/walkontable/src/filter/column.mjs +22 -16
  34. package/3rdparty/walkontable/src/filter/row.js +22 -17
  35. package/3rdparty/walkontable/src/filter/row.mjs +22 -16
  36. package/3rdparty/walkontable/src/index.js +0 -31
  37. package/3rdparty/walkontable/src/overlay/_base.js +38 -69
  38. package/3rdparty/walkontable/src/overlay/_base.mjs +38 -61
  39. package/3rdparty/walkontable/src/overlay/bottom.js +38 -103
  40. package/3rdparty/walkontable/src/overlay/bottom.mjs +38 -88
  41. package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.js +12 -52
  42. package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.mjs +12 -37
  43. package/3rdparty/walkontable/src/overlay/constants.js +0 -6
  44. package/3rdparty/walkontable/src/overlay/constants.mjs +0 -1
  45. package/3rdparty/walkontable/src/overlay/index.js +0 -17
  46. package/3rdparty/walkontable/src/overlay/inlineStart.js +26 -90
  47. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +26 -75
  48. package/3rdparty/walkontable/src/overlay/top.js +37 -104
  49. package/3rdparty/walkontable/src/overlay/top.mjs +37 -89
  50. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +14 -55
  51. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +14 -40
  52. package/3rdparty/walkontable/src/overlays.js +124 -145
  53. package/3rdparty/walkontable/src/overlays.mjs +124 -135
  54. package/3rdparty/walkontable/src/renderer/_base.js +17 -19
  55. package/3rdparty/walkontable/src/renderer/_base.mjs +17 -17
  56. package/3rdparty/walkontable/src/renderer/cells.js +15 -53
  57. package/3rdparty/walkontable/src/renderer/cells.mjs +15 -39
  58. package/3rdparty/walkontable/src/renderer/colGroup.js +15 -46
  59. package/3rdparty/walkontable/src/renderer/colGroup.mjs +15 -34
  60. package/3rdparty/walkontable/src/renderer/columnHeaders.js +13 -49
  61. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +13 -37
  62. package/3rdparty/walkontable/src/renderer/index.js +26 -35
  63. package/3rdparty/walkontable/src/renderer/index.mjs +26 -22
  64. package/3rdparty/walkontable/src/renderer/rowHeaders.js +13 -49
  65. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +13 -36
  66. package/3rdparty/walkontable/src/renderer/rows.js +11 -49
  67. package/3rdparty/walkontable/src/renderer/rows.mjs +11 -32
  68. package/3rdparty/walkontable/src/renderer/table.js +35 -48
  69. package/3rdparty/walkontable/src/renderer/table.mjs +35 -47
  70. package/3rdparty/walkontable/src/scroll.js +69 -86
  71. package/3rdparty/walkontable/src/scroll.mjs +69 -84
  72. package/3rdparty/walkontable/src/selection.js +28 -103
  73. package/3rdparty/walkontable/src/selection.mjs +26 -83
  74. package/3rdparty/walkontable/src/settings.js +25 -31
  75. package/3rdparty/walkontable/src/settings.mjs +25 -29
  76. package/3rdparty/walkontable/src/table/bottom.js +6 -34
  77. package/3rdparty/walkontable/src/table/bottom.mjs +6 -19
  78. package/3rdparty/walkontable/src/table/bottomInlineStartCorner.js +6 -34
  79. package/3rdparty/walkontable/src/table/bottomInlineStartCorner.mjs +6 -19
  80. package/3rdparty/walkontable/src/table/inlineStart.js +6 -34
  81. package/3rdparty/walkontable/src/table/inlineStart.mjs +6 -19
  82. package/3rdparty/walkontable/src/table/master.js +15 -54
  83. package/3rdparty/walkontable/src/table/master.mjs +15 -38
  84. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +1 -16
  85. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +1 -14
  86. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +1 -16
  87. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +1 -14
  88. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +1 -10
  89. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +1 -8
  90. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +1 -11
  91. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +1 -9
  92. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +1 -10
  93. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +1 -8
  94. package/3rdparty/walkontable/src/table/top.js +6 -34
  95. package/3rdparty/walkontable/src/table/top.mjs +6 -19
  96. package/3rdparty/walkontable/src/table/topInlineStartCorner.js +6 -34
  97. package/3rdparty/walkontable/src/table/topInlineStartCorner.mjs +6 -19
  98. package/3rdparty/walkontable/src/table.js +73 -233
  99. package/3rdparty/walkontable/src/table.mjs +71 -210
  100. package/3rdparty/walkontable/src/types.js +0 -5
  101. package/3rdparty/walkontable/src/types.mjs +0 -5
  102. package/3rdparty/walkontable/src/utils/column.js +18 -30
  103. package/3rdparty/walkontable/src/utils/column.mjs +18 -25
  104. package/3rdparty/walkontable/src/utils/nodesPool.js +16 -11
  105. package/3rdparty/walkontable/src/utils/nodesPool.mjs +16 -10
  106. package/3rdparty/walkontable/src/utils/orderView/constants.js +0 -3
  107. package/3rdparty/walkontable/src/utils/orderView/constants.mjs +0 -2
  108. package/3rdparty/walkontable/src/utils/orderView/index.js +0 -5
  109. package/3rdparty/walkontable/src/utils/orderView/sharedView.js +7 -32
  110. package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +7 -21
  111. package/3rdparty/walkontable/src/utils/orderView/view.js +27 -45
  112. package/3rdparty/walkontable/src/utils/orderView/view.mjs +27 -42
  113. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +16 -14
  114. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +16 -13
  115. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +21 -21
  116. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +21 -18
  117. package/3rdparty/walkontable/src/utils/row.js +15 -12
  118. package/3rdparty/walkontable/src/utils/row.mjs +15 -11
  119. package/3rdparty/walkontable/src/viewport.js +51 -99
  120. package/3rdparty/walkontable/src/viewport.mjs +51 -96
  121. package/CHANGELOG.md +99 -1
  122. package/base.d.ts +1 -0
  123. package/base.js +11 -17
  124. package/base.mjs +10 -11
  125. package/cellTypes/autocompleteType/autocompleteType.js +0 -4
  126. package/cellTypes/autocompleteType/index.js +0 -2
  127. package/cellTypes/checkboxType/checkboxType.js +0 -3
  128. package/cellTypes/checkboxType/index.js +0 -2
  129. package/cellTypes/dateType/dateType.js +0 -4
  130. package/cellTypes/dateType/index.js +0 -2
  131. package/cellTypes/dropdownType/dropdownType.js +0 -4
  132. package/cellTypes/dropdownType/index.js +0 -2
  133. package/cellTypes/handsontableType/handsontableType.js +0 -3
  134. package/cellTypes/handsontableType/index.js +0 -2
  135. package/cellTypes/index.js +0 -21
  136. package/cellTypes/index.mjs +0 -1
  137. package/cellTypes/numericType/index.js +0 -2
  138. package/cellTypes/numericType/numericType.js +0 -4
  139. package/cellTypes/passwordType/index.js +0 -2
  140. package/cellTypes/passwordType/passwordType.js +0 -3
  141. package/cellTypes/registry.js +10 -25
  142. package/cellTypes/registry.mjs +10 -20
  143. package/cellTypes/textType/index.js +0 -2
  144. package/cellTypes/textType/textType.js +0 -3
  145. package/cellTypes/timeType/index.js +0 -2
  146. package/cellTypes/timeType/timeType.js +0 -4
  147. package/core.d.ts +6 -2
  148. package/core.js +714 -1070
  149. package/core.mjs +717 -1015
  150. package/dataMap/dataMap.js +202 -236
  151. package/dataMap/dataMap.mjs +201 -209
  152. package/{dataSource.js → dataMap/dataSource.js} +29 -65
  153. package/{dataSource.mjs → dataMap/dataSource.mjs} +29 -57
  154. package/dataMap/index.js +0 -13
  155. package/dataMap/metaManager/index.js +33 -45
  156. package/dataMap/metaManager/index.mjs +33 -37
  157. package/dataMap/metaManager/lazyFactoryMap.js +17 -62
  158. package/dataMap/metaManager/lazyFactoryMap.mjs +17 -46
  159. package/dataMap/metaManager/metaLayers/cellMeta.js +26 -57
  160. package/dataMap/metaManager/metaLayers/cellMeta.mjs +25 -41
  161. package/dataMap/metaManager/metaLayers/columnMeta.js +23 -24
  162. package/dataMap/metaManager/metaLayers/columnMeta.mjs +24 -21
  163. package/dataMap/metaManager/metaLayers/globalMeta.js +30 -21
  164. package/dataMap/metaManager/metaLayers/globalMeta.mjs +31 -18
  165. package/dataMap/metaManager/metaLayers/tableMeta.js +18 -15
  166. package/dataMap/metaManager/metaLayers/tableMeta.mjs +19 -14
  167. package/dataMap/metaManager/metaSchema.js +173 -213
  168. package/dataMap/metaManager/metaSchema.mjs +173 -204
  169. package/dataMap/metaManager/mods/dynamicCellMeta.js +15 -35
  170. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +15 -24
  171. package/dataMap/metaManager/mods/extendMetaProperties.js +14 -27
  172. package/dataMap/metaManager/mods/extendMetaProperties.mjs +14 -19
  173. package/dataMap/metaManager/utils.js +49 -28
  174. package/dataMap/metaManager/utils.mjs +50 -21
  175. package/dataMap/replaceData.js +15 -35
  176. package/dataMap/replaceData.mjs +15 -23
  177. package/dist/handsontable.css +9 -9
  178. package/dist/handsontable.full.css +9 -9
  179. package/dist/handsontable.full.js +13065 -28165
  180. package/dist/handsontable.full.min.css +2 -2
  181. package/dist/handsontable.full.min.js +108 -114
  182. package/dist/handsontable.js +11528 -21792
  183. package/dist/handsontable.min.css +2 -2
  184. package/dist/handsontable.min.js +3 -3
  185. package/dist/languages/all.js +111 -240
  186. package/dist/languages/all.min.js +1 -1
  187. package/dist/languages/ar-AR.js +50 -14
  188. package/dist/languages/ar-AR.min.js +1 -1
  189. package/dist/languages/cs-CZ.js +52 -16
  190. package/dist/languages/cs-CZ.min.js +1 -1
  191. package/dist/languages/de-CH.js +52 -16
  192. package/dist/languages/de-CH.min.js +1 -1
  193. package/dist/languages/de-DE.js +53 -17
  194. package/dist/languages/de-DE.min.js +1 -1
  195. package/dist/languages/en-US.js +56 -20
  196. package/dist/languages/en-US.min.js +1 -1
  197. package/dist/languages/es-MX.js +56 -20
  198. package/dist/languages/es-MX.min.js +1 -1
  199. package/dist/languages/fr-FR.js +55 -19
  200. package/dist/languages/fr-FR.min.js +1 -1
  201. package/dist/languages/it-IT.js +55 -19
  202. package/dist/languages/it-IT.min.js +1 -1
  203. package/dist/languages/ja-JP.js +83 -43
  204. package/dist/languages/ja-JP.min.js +1 -1
  205. package/dist/languages/ko-KR.js +84 -43
  206. package/dist/languages/ko-KR.min.js +1 -1
  207. package/dist/languages/lv-LV.js +85 -43
  208. package/dist/languages/lv-LV.min.js +1 -1
  209. package/dist/languages/nb-NO.js +86 -43
  210. package/dist/languages/nb-NO.min.js +1 -1
  211. package/dist/languages/nl-NL.js +87 -43
  212. package/dist/languages/nl-NL.min.js +1 -1
  213. package/dist/languages/pl-PL.js +88 -43
  214. package/dist/languages/pl-PL.min.js +1 -1
  215. package/dist/languages/pt-BR.js +67 -28
  216. package/dist/languages/pt-BR.min.js +1 -1
  217. package/dist/languages/ru-RU.js +67 -28
  218. package/dist/languages/ru-RU.min.js +1 -1
  219. package/dist/languages/sr-SP.js +55 -16
  220. package/dist/languages/sr-SP.min.js +1 -1
  221. package/dist/languages/zh-CN.js +55 -16
  222. package/dist/languages/zh-CN.min.js +1 -1
  223. package/dist/languages/zh-TW.js +55 -16
  224. package/dist/languages/zh-TW.min.js +1 -1
  225. package/editorManager.js +53 -113
  226. package/editorManager.mjs +50 -90
  227. package/editors/autocompleteEditor/autocompleteEditor.js +36 -138
  228. package/editors/autocompleteEditor/autocompleteEditor.mjs +35 -108
  229. package/editors/autocompleteEditor/index.js +0 -2
  230. package/editors/baseEditor/baseEditor.js +55 -160
  231. package/editors/baseEditor/baseEditor.mjs +54 -133
  232. package/editors/baseEditor/index.js +0 -2
  233. package/editors/checkboxEditor/checkboxEditor.js +8 -34
  234. package/editors/checkboxEditor/checkboxEditor.mjs +8 -20
  235. package/editors/checkboxEditor/index.js +0 -2
  236. package/editors/dateEditor/dateEditor.js +26 -97
  237. package/editors/dateEditor/dateEditor.mjs +26 -76
  238. package/editors/dateEditor/index.js +0 -2
  239. package/editors/dropdownEditor/dropdownEditor.js +7 -42
  240. package/editors/dropdownEditor/dropdownEditor.mjs +7 -23
  241. package/editors/dropdownEditor/index.js +0 -2
  242. package/editors/handsontableEditor/handsontableEditor.js +19 -86
  243. package/editors/handsontableEditor/handsontableEditor.mjs +19 -67
  244. package/editors/handsontableEditor/index.js +0 -2
  245. package/editors/index.js +0 -25
  246. package/editors/index.mjs +0 -1
  247. package/editors/numericEditor/index.js +0 -2
  248. package/editors/numericEditor/numericEditor.js +7 -32
  249. package/editors/numericEditor/numericEditor.mjs +7 -19
  250. package/editors/passwordEditor/index.js +0 -2
  251. package/editors/passwordEditor/passwordEditor.js +7 -39
  252. package/editors/passwordEditor/passwordEditor.mjs +7 -23
  253. package/editors/registry.js +13 -36
  254. package/editors/registry.mjs +12 -26
  255. package/editors/selectEditor/index.js +0 -2
  256. package/editors/selectEditor/selectEditor.js +27 -74
  257. package/editors/selectEditor/selectEditor.mjs +27 -57
  258. package/editors/textEditor/caretPositioner.js +0 -8
  259. package/editors/textEditor/caretPositioner.mjs +0 -7
  260. package/editors/textEditor/index.js +0 -2
  261. package/editors/textEditor/textEditor.js +45 -139
  262. package/editors/textEditor/textEditor.mjs +45 -108
  263. package/editors/timeEditor/index.js +0 -2
  264. package/editors/timeEditor/timeEditor.js +7 -37
  265. package/editors/timeEditor/timeEditor.mjs +7 -22
  266. package/eventManager.js +26 -47
  267. package/eventManager.mjs +27 -45
  268. package/helpers/array.js +22 -88
  269. package/helpers/array.mjs +22 -58
  270. package/helpers/browser.js +25 -51
  271. package/helpers/browser.mjs +25 -32
  272. package/helpers/console.js +3 -13
  273. package/helpers/console.mjs +3 -10
  274. package/helpers/data.d.ts +0 -2
  275. package/helpers/data.js +8 -102
  276. package/helpers/data.mjs +9 -80
  277. package/helpers/date.js +2 -3
  278. package/helpers/date.mjs +2 -2
  279. package/helpers/dom/element.js +89 -256
  280. package/helpers/dom/element.mjs +88 -184
  281. package/helpers/dom/event.js +3 -7
  282. package/helpers/dom/event.mjs +3 -3
  283. package/helpers/feature.js +21 -82
  284. package/helpers/feature.mjs +15 -60
  285. package/helpers/function.js +14 -59
  286. package/helpers/function.mjs +14 -45
  287. package/helpers/mixed.js +9 -64
  288. package/helpers/mixed.mjs +9 -43
  289. package/helpers/number.js +4 -46
  290. package/helpers/number.mjs +4 -23
  291. package/helpers/object.js +30 -77
  292. package/helpers/object.mjs +25 -47
  293. package/helpers/string.js +6 -28
  294. package/helpers/string.mjs +6 -14
  295. package/helpers/templateLiteralTag.js +0 -6
  296. package/helpers/templateLiteralTag.mjs +0 -2
  297. package/helpers/unicode.js +17 -22
  298. package/helpers/unicode.mjs +17 -13
  299. package/helpers/wrappers/jquery.js +4 -14
  300. package/helpers/wrappers/jquery.mjs +4 -13
  301. package/i18n/constants.js +50 -45
  302. package/i18n/constants.mjs +46 -42
  303. package/i18n/index.js +0 -7
  304. package/i18n/languages/ar-AR.js +12 -23
  305. package/i18n/languages/ar-AR.mjs +14 -3
  306. package/i18n/languages/cs-CZ.js +12 -23
  307. package/i18n/languages/cs-CZ.mjs +14 -3
  308. package/i18n/languages/de-CH.js +12 -23
  309. package/i18n/languages/de-CH.mjs +14 -3
  310. package/i18n/languages/de-DE.js +12 -23
  311. package/i18n/languages/de-DE.mjs +14 -3
  312. package/i18n/languages/en-US.js +13 -24
  313. package/i18n/languages/en-US.mjs +15 -4
  314. package/i18n/languages/es-MX.js +13 -24
  315. package/i18n/languages/es-MX.mjs +17 -5
  316. package/i18n/languages/fr-FR.js +12 -23
  317. package/i18n/languages/fr-FR.mjs +14 -3
  318. package/i18n/languages/index.js +0 -39
  319. package/i18n/languages/it-IT.js +12 -23
  320. package/i18n/languages/it-IT.mjs +14 -3
  321. package/i18n/languages/ja-JP.js +12 -23
  322. package/i18n/languages/ja-JP.mjs +14 -3
  323. package/i18n/languages/ko-KR.js +12 -23
  324. package/i18n/languages/ko-KR.mjs +14 -3
  325. package/i18n/languages/lv-LV.js +13 -24
  326. package/i18n/languages/lv-LV.mjs +17 -6
  327. package/i18n/languages/nb-NO.js +12 -23
  328. package/i18n/languages/nb-NO.mjs +14 -3
  329. package/i18n/languages/nl-NL.js +13 -24
  330. package/i18n/languages/nl-NL.mjs +17 -6
  331. package/i18n/languages/pl-PL.js +13 -24
  332. package/i18n/languages/pl-PL.mjs +16 -5
  333. package/i18n/languages/pt-BR.js +12 -23
  334. package/i18n/languages/pt-BR.mjs +14 -3
  335. package/i18n/languages/ru-RU.js +12 -23
  336. package/i18n/languages/ru-RU.mjs +14 -3
  337. package/i18n/languages/sr-SP.js +12 -23
  338. package/i18n/languages/sr-SP.mjs +14 -3
  339. package/i18n/languages/zh-CN.js +12 -23
  340. package/i18n/languages/zh-CN.mjs +14 -3
  341. package/i18n/languages/zh-TW.js +12 -23
  342. package/i18n/languages/zh-TW.mjs +14 -3
  343. package/i18n/phraseFormatters/index.js +4 -11
  344. package/i18n/phraseFormatters/index.mjs +4 -6
  345. package/i18n/phraseFormatters/pluralize.js +0 -5
  346. package/i18n/phraseFormatters/pluralize.mjs +0 -3
  347. package/i18n/phraseFormatters/substituteVariables.js +0 -4
  348. package/i18n/phraseFormatters/substituteVariables.mjs +0 -2
  349. package/i18n/registry.js +18 -59
  350. package/i18n/registry.mjs +18 -30
  351. package/i18n/utils.js +4 -22
  352. package/i18n/utils.mjs +4 -11
  353. package/index.d.ts +9 -0
  354. package/index.js +23 -58
  355. package/index.mjs +21 -16
  356. package/languages/all.js +111 -240
  357. package/languages/ar-AR.js +50 -14
  358. package/languages/ar-AR.mjs +14 -3
  359. package/languages/cs-CZ.js +52 -16
  360. package/languages/cs-CZ.mjs +14 -3
  361. package/languages/de-CH.js +52 -16
  362. package/languages/de-CH.mjs +14 -3
  363. package/languages/de-DE.js +53 -17
  364. package/languages/de-DE.mjs +14 -3
  365. package/languages/en-US.js +56 -20
  366. package/languages/en-US.mjs +15 -4
  367. package/languages/es-MX.js +56 -20
  368. package/languages/es-MX.mjs +17 -5
  369. package/languages/fr-FR.js +55 -19
  370. package/languages/fr-FR.mjs +14 -3
  371. package/languages/index.js +111 -240
  372. package/languages/it-IT.js +55 -19
  373. package/languages/it-IT.mjs +14 -3
  374. package/languages/ja-JP.js +83 -43
  375. package/languages/ja-JP.mjs +14 -3
  376. package/languages/ko-KR.js +84 -43
  377. package/languages/ko-KR.mjs +14 -3
  378. package/languages/lv-LV.js +85 -43
  379. package/languages/lv-LV.mjs +17 -6
  380. package/languages/nb-NO.js +86 -43
  381. package/languages/nb-NO.mjs +14 -3
  382. package/languages/nl-NL.js +87 -43
  383. package/languages/nl-NL.mjs +17 -6
  384. package/languages/pl-PL.js +88 -43
  385. package/languages/pl-PL.mjs +16 -5
  386. package/languages/pt-BR.js +67 -28
  387. package/languages/pt-BR.mjs +14 -3
  388. package/languages/ru-RU.js +67 -28
  389. package/languages/ru-RU.mjs +14 -3
  390. package/languages/sr-SP.js +55 -16
  391. package/languages/sr-SP.mjs +14 -3
  392. package/languages/zh-CN.js +55 -16
  393. package/languages/zh-CN.mjs +14 -3
  394. package/languages/zh-TW.js +55 -16
  395. package/languages/zh-TW.mjs +14 -3
  396. package/mixins/hooksRefRegisterer.js +1 -12
  397. package/mixins/hooksRefRegisterer.mjs +1 -9
  398. package/mixins/localHooks.js +4 -11
  399. package/mixins/localHooks.mjs +4 -8
  400. package/package.json +2 -2
  401. package/pluginHooks.d.ts +10 -5
  402. package/pluginHooks.js +376 -116
  403. package/pluginHooks.mjs +375 -103
  404. package/plugins/autoColumnSize/autoColumnSize.js +81 -174
  405. package/plugins/autoColumnSize/autoColumnSize.mjs +81 -139
  406. package/plugins/autoColumnSize/index.js +0 -2
  407. package/plugins/autoRowSize/autoRowSize.js +89 -160
  408. package/plugins/autoRowSize/autoRowSize.mjs +89 -131
  409. package/plugins/autoRowSize/index.js +0 -2
  410. package/plugins/autofill/autofill.js +53 -165
  411. package/plugins/autofill/autofill.mjs +53 -133
  412. package/plugins/autofill/index.js +0 -2
  413. package/plugins/autofill/utils.js +4 -26
  414. package/plugins/autofill/utils.mjs +4 -18
  415. package/plugins/base/base.js +28 -91
  416. package/plugins/base/base.mjs +28 -63
  417. package/plugins/base/index.js +0 -2
  418. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +25 -53
  419. package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +25 -34
  420. package/plugins/bindRowsWithHeaders/index.js +0 -2
  421. package/plugins/bindRowsWithHeaders/maps/looseBindsMap.js +11 -42
  422. package/plugins/bindRowsWithHeaders/maps/looseBindsMap.mjs +11 -30
  423. package/plugins/bindRowsWithHeaders/maps/strictBindsMap.js +12 -54
  424. package/plugins/bindRowsWithHeaders/maps/strictBindsMap.mjs +12 -38
  425. package/plugins/collapsibleColumns/collapsibleColumns.js +106 -193
  426. package/plugins/collapsibleColumns/collapsibleColumns.mjs +106 -162
  427. package/plugins/collapsibleColumns/index.js +0 -2
  428. package/plugins/columnSorting/columnSorting.js +58 -192
  429. package/plugins/columnSorting/columnSorting.mjs +58 -147
  430. package/plugins/columnSorting/columnStatesManager.js +27 -77
  431. package/plugins/columnSorting/columnStatesManager.mjs +24 -51
  432. package/plugins/columnSorting/domHelpers.js +2 -18
  433. package/plugins/columnSorting/domHelpers.mjs +2 -7
  434. package/plugins/columnSorting/index.js +0 -2
  435. package/plugins/columnSorting/rootComparator.js +5 -24
  436. package/plugins/columnSorting/rootComparator.mjs +5 -13
  437. package/plugins/columnSorting/sortFunction/checkbox.js +8 -16
  438. package/plugins/columnSorting/sortFunction/checkbox.mjs +8 -12
  439. package/plugins/columnSorting/sortFunction/date.js +2 -19
  440. package/plugins/columnSorting/sortFunction/date.mjs +2 -14
  441. package/plugins/columnSorting/sortFunction/default.js +2 -17
  442. package/plugins/columnSorting/sortFunction/default.mjs +2 -14
  443. package/plugins/columnSorting/sortFunction/numeric.js +2 -11
  444. package/plugins/columnSorting/sortFunction/numeric.mjs +2 -8
  445. package/plugins/columnSorting/sortService/engine.js +1 -7
  446. package/plugins/columnSorting/sortService/engine.mjs +1 -3
  447. package/plugins/columnSorting/sortService/index.js +0 -5
  448. package/plugins/columnSorting/sortService/registry.js +6 -18
  449. package/plugins/columnSorting/sortService/registry.mjs +6 -10
  450. package/plugins/columnSorting/utils.js +9 -34
  451. package/plugins/columnSorting/utils.mjs +9 -15
  452. package/plugins/columnSummary/columnSummary.js +65 -126
  453. package/plugins/columnSummary/columnSummary.mjs +65 -101
  454. package/plugins/columnSummary/endpoints.js +33 -109
  455. package/plugins/columnSummary/endpoints.mjs +33 -105
  456. package/plugins/columnSummary/index.js +0 -2
  457. package/plugins/columnSummary/utils.js +0 -1
  458. package/plugins/comments/commentEditor.js +29 -27
  459. package/plugins/comments/commentEditor.mjs +29 -26
  460. package/plugins/comments/comments.js +106 -178
  461. package/plugins/comments/comments.mjs +106 -152
  462. package/plugins/comments/displaySwitch.js +20 -24
  463. package/plugins/comments/displaySwitch.mjs +20 -19
  464. package/plugins/comments/index.js +0 -2
  465. package/plugins/contextMenu/commandExecutor.js +17 -29
  466. package/plugins/contextMenu/commandExecutor.mjs +17 -27
  467. package/plugins/contextMenu/contextMenu.d.ts +4 -3
  468. package/plugins/contextMenu/contextMenu.js +28 -121
  469. package/plugins/contextMenu/contextMenu.mjs +28 -91
  470. package/plugins/contextMenu/cursor.js +19 -19
  471. package/plugins/contextMenu/cursor.mjs +19 -18
  472. package/plugins/contextMenu/index.js +0 -2
  473. package/plugins/contextMenu/itemsFactory.js +21 -35
  474. package/plugins/contextMenu/itemsFactory.mjs +21 -31
  475. package/plugins/contextMenu/menu.js +71 -180
  476. package/plugins/contextMenu/menu.mjs +70 -151
  477. package/plugins/contextMenu/predefinedItems/alignment.js +1 -55
  478. package/plugins/contextMenu/predefinedItems/alignment.mjs +1 -37
  479. package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -20
  480. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +1 -4
  481. package/plugins/contextMenu/predefinedItems/columnLeft.js +6 -43
  482. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +6 -26
  483. package/plugins/contextMenu/predefinedItems/columnRight.js +4 -42
  484. package/plugins/contextMenu/predefinedItems/columnRight.mjs +4 -25
  485. package/plugins/contextMenu/predefinedItems/noItems.js +1 -4
  486. package/plugins/contextMenu/predefinedItems/noItems.mjs +1 -1
  487. package/plugins/contextMenu/predefinedItems/readOnly.js +1 -25
  488. package/plugins/contextMenu/predefinedItems/readOnly.mjs +1 -8
  489. package/plugins/contextMenu/predefinedItems/redo.js +1 -16
  490. package/plugins/contextMenu/predefinedItems/redo.mjs +1 -1
  491. package/plugins/contextMenu/predefinedItems/removeColumn.js +4 -39
  492. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +4 -19
  493. package/plugins/contextMenu/predefinedItems/removeRow.js +4 -38
  494. package/plugins/contextMenu/predefinedItems/removeRow.mjs +4 -18
  495. package/plugins/contextMenu/predefinedItems/rowAbove.js +6 -35
  496. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +6 -19
  497. package/plugins/contextMenu/predefinedItems/rowBelow.js +4 -42
  498. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +4 -25
  499. package/plugins/contextMenu/predefinedItems/separator.js +1 -2
  500. package/plugins/contextMenu/predefinedItems/separator.mjs +1 -1
  501. package/plugins/contextMenu/predefinedItems/undo.js +1 -16
  502. package/plugins/contextMenu/predefinedItems/undo.mjs +1 -1
  503. package/plugins/contextMenu/predefinedItems.js +14 -55
  504. package/plugins/contextMenu/predefinedItems.mjs +16 -8
  505. package/plugins/contextMenu/utils.js +17 -57
  506. package/plugins/contextMenu/utils.mjs +17 -34
  507. package/plugins/copyPaste/clipboardData.js +14 -9
  508. package/plugins/copyPaste/clipboardData.mjs +14 -8
  509. package/plugins/copyPaste/contextMenuItem/copy.js +5 -32
  510. package/plugins/copyPaste/contextMenuItem/copy.mjs +5 -7
  511. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +35 -0
  512. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +31 -0
  513. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +35 -0
  514. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +31 -0
  515. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +35 -0
  516. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +31 -0
  517. package/plugins/copyPaste/contextMenuItem/cut.js +2 -17
  518. package/plugins/copyPaste/contextMenuItem/cut.mjs +2 -4
  519. package/plugins/copyPaste/copyPaste.d.ts +10 -2
  520. package/plugins/copyPaste/copyPaste.js +339 -372
  521. package/plugins/copyPaste/copyPaste.mjs +339 -331
  522. package/plugins/copyPaste/copyableRanges.js +269 -0
  523. package/plugins/copyPaste/copyableRanges.mjs +264 -0
  524. package/plugins/copyPaste/focusableElement.js +21 -55
  525. package/plugins/copyPaste/focusableElement.mjs +21 -45
  526. package/plugins/copyPaste/index.js +0 -2
  527. package/plugins/copyPaste/pasteEvent.js +14 -9
  528. package/plugins/copyPaste/pasteEvent.mjs +14 -7
  529. package/plugins/customBorders/contextMenuItem/bottom.js +0 -17
  530. package/plugins/customBorders/contextMenuItem/bottom.mjs +0 -3
  531. package/plugins/customBorders/contextMenuItem/index.js +0 -11
  532. package/plugins/customBorders/contextMenuItem/left.js +0 -17
  533. package/plugins/customBorders/contextMenuItem/left.mjs +0 -3
  534. package/plugins/customBorders/contextMenuItem/noBorders.js +0 -15
  535. package/plugins/customBorders/contextMenuItem/noBorders.mjs +0 -1
  536. package/plugins/customBorders/contextMenuItem/right.js +0 -17
  537. package/plugins/customBorders/contextMenuItem/right.mjs +0 -3
  538. package/plugins/customBorders/contextMenuItem/top.js +0 -17
  539. package/plugins/customBorders/contextMenuItem/top.mjs +0 -3
  540. package/plugins/customBorders/customBorders.js +64 -188
  541. package/plugins/customBorders/customBorders.mjs +63 -153
  542. package/plugins/customBorders/index.js +0 -2
  543. package/plugins/customBorders/utils.js +13 -52
  544. package/plugins/customBorders/utils.mjs +13 -31
  545. package/plugins/dragToScroll/dragToScroll.js +23 -75
  546. package/plugins/dragToScroll/dragToScroll.mjs +23 -56
  547. package/plugins/dragToScroll/index.js +0 -2
  548. package/plugins/dropdownMenu/dropdownMenu.js +49 -127
  549. package/plugins/dropdownMenu/dropdownMenu.mjs +49 -96
  550. package/plugins/dropdownMenu/index.js +0 -2
  551. package/plugins/exportFile/dataProvider.js +34 -72
  552. package/plugins/exportFile/dataProvider.mjs +31 -58
  553. package/plugins/exportFile/exportFile.js +56 -61
  554. package/plugins/exportFile/exportFile.mjs +54 -37
  555. package/plugins/exportFile/index.js +0 -2
  556. package/plugins/exportFile/typeFactory.js +15 -12
  557. package/plugins/exportFile/typeFactory.mjs +15 -5
  558. package/plugins/exportFile/types/_base.js +15 -15
  559. package/plugins/exportFile/types/_base.mjs +15 -13
  560. package/plugins/exportFile/types/csv.js +8 -51
  561. package/plugins/exportFile/types/csv.mjs +8 -30
  562. package/plugins/filters/component/_base.js +25 -31
  563. package/plugins/filters/component/_base.mjs +25 -26
  564. package/plugins/filters/component/actionBar.js +13 -56
  565. package/plugins/filters/component/actionBar.mjs +11 -34
  566. package/plugins/filters/component/condition.js +22 -95
  567. package/plugins/filters/component/condition.mjs +20 -63
  568. package/plugins/filters/component/operators.js +18 -71
  569. package/plugins/filters/component/operators.mjs +18 -48
  570. package/plugins/filters/component/value.js +22 -97
  571. package/plugins/filters/component/value.mjs +22 -67
  572. package/plugins/filters/condition/beginsWith.js +3 -33
  573. package/plugins/filters/condition/beginsWith.mjs +3 -11
  574. package/plugins/filters/condition/between.js +4 -38
  575. package/plugins/filters/condition/between.mjs +4 -16
  576. package/plugins/filters/condition/byValue.js +4 -28
  577. package/plugins/filters/condition/byValue.mjs +4 -13
  578. package/plugins/filters/condition/contains.js +3 -33
  579. package/plugins/filters/condition/contains.mjs +3 -11
  580. package/plugins/filters/condition/date/after.js +3 -35
  581. package/plugins/filters/condition/date/after.mjs +3 -13
  582. package/plugins/filters/condition/date/before.js +3 -35
  583. package/plugins/filters/condition/date/before.mjs +3 -13
  584. package/plugins/filters/condition/date/today.js +1 -22
  585. package/plugins/filters/condition/date/today.mjs +1 -3
  586. package/plugins/filters/condition/date/tomorrow.js +1 -22
  587. package/plugins/filters/condition/date/tomorrow.mjs +1 -3
  588. package/plugins/filters/condition/date/yesterday.js +1 -22
  589. package/plugins/filters/condition/date/yesterday.mjs +1 -3
  590. package/plugins/filters/condition/empty.js +1 -19
  591. package/plugins/filters/condition/empty.mjs +1 -1
  592. package/plugins/filters/condition/endsWith.js +3 -33
  593. package/plugins/filters/condition/endsWith.mjs +3 -11
  594. package/plugins/filters/condition/equal.js +3 -32
  595. package/plugins/filters/condition/equal.mjs +3 -11
  596. package/plugins/filters/condition/false.js +1 -5
  597. package/plugins/filters/condition/false.mjs +1 -1
  598. package/plugins/filters/condition/greaterThan.js +3 -33
  599. package/plugins/filters/condition/greaterThan.mjs +3 -13
  600. package/plugins/filters/condition/greaterThanOrEqual.js +3 -33
  601. package/plugins/filters/condition/greaterThanOrEqual.mjs +3 -13
  602. package/plugins/filters/condition/lessThan.js +3 -33
  603. package/plugins/filters/condition/lessThan.mjs +3 -13
  604. package/plugins/filters/condition/lessThanOrEqual.js +3 -33
  605. package/plugins/filters/condition/lessThanOrEqual.mjs +3 -13
  606. package/plugins/filters/condition/none.js +1 -18
  607. package/plugins/filters/condition/none.mjs +1 -1
  608. package/plugins/filters/condition/notBetween.js +1 -19
  609. package/plugins/filters/condition/notBetween.mjs +1 -1
  610. package/plugins/filters/condition/notContains.js +1 -19
  611. package/plugins/filters/condition/notContains.mjs +1 -1
  612. package/plugins/filters/condition/notEmpty.js +1 -19
  613. package/plugins/filters/condition/notEmpty.mjs +1 -1
  614. package/plugins/filters/condition/notEqual.js +1 -19
  615. package/plugins/filters/condition/notEqual.mjs +1 -1
  616. package/plugins/filters/condition/true.js +1 -5
  617. package/plugins/filters/condition/true.mjs +1 -1
  618. package/plugins/filters/conditionCollection.js +31 -84
  619. package/plugins/filters/conditionCollection.mjs +39 -69
  620. package/plugins/filters/conditionRegisterer.js +5 -14
  621. package/plugins/filters/conditionRegisterer.mjs +5 -9
  622. package/plugins/filters/conditionUpdateObserver.js +29 -56
  623. package/plugins/filters/conditionUpdateObserver.mjs +29 -44
  624. package/plugins/filters/constants.js +15 -67
  625. package/plugins/filters/constants.mjs +15 -9
  626. package/plugins/filters/dataFilter.js +17 -20
  627. package/plugins/filters/dataFilter.mjs +17 -19
  628. package/plugins/filters/filters.js +110 -210
  629. package/plugins/filters/filters.mjs +110 -165
  630. package/plugins/filters/index.js +0 -2
  631. package/plugins/filters/logicalOperationRegisterer.js +3 -9
  632. package/plugins/filters/logicalOperationRegisterer.mjs +3 -4
  633. package/plugins/filters/logicalOperations/conjunction.js +2 -19
  634. package/plugins/filters/logicalOperations/conjunction.mjs +2 -2
  635. package/plugins/filters/logicalOperations/disjunction.js +2 -19
  636. package/plugins/filters/logicalOperations/disjunction.mjs +2 -2
  637. package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +2 -21
  638. package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.mjs +2 -3
  639. package/plugins/filters/ui/_base.js +24 -62
  640. package/plugins/filters/ui/_base.mjs +26 -36
  641. package/plugins/filters/ui/input.js +13 -53
  642. package/plugins/filters/ui/input.mjs +13 -35
  643. package/plugins/filters/ui/link.js +9 -44
  644. package/plugins/filters/ui/link.mjs +9 -26
  645. package/plugins/filters/ui/multipleSelect.js +25 -113
  646. package/plugins/filters/ui/multipleSelect.mjs +26 -77
  647. package/plugins/filters/ui/radioInput.js +12 -48
  648. package/plugins/filters/ui/radioInput.mjs +12 -31
  649. package/plugins/filters/ui/select.js +20 -77
  650. package/plugins/filters/ui/select.mjs +20 -53
  651. package/plugins/filters/utils.js +6 -39
  652. package/plugins/filters/utils.mjs +6 -23
  653. package/plugins/formulas/engine/register.js +24 -74
  654. package/plugins/formulas/engine/register.mjs +24 -45
  655. package/plugins/formulas/engine/settings.js +16 -25
  656. package/plugins/formulas/engine/settings.mjs +16 -13
  657. package/plugins/formulas/formulas.js +127 -306
  658. package/plugins/formulas/formulas.mjs +128 -259
  659. package/plugins/formulas/index.js +0 -2
  660. package/plugins/formulas/utils.js +1 -3
  661. package/plugins/formulas/utils.mjs +1 -1
  662. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +5 -39
  663. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +5 -21
  664. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +17 -45
  665. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +17 -24
  666. package/plugins/hiddenColumns/hiddenColumns.js +77 -150
  667. package/plugins/hiddenColumns/hiddenColumns.mjs +77 -109
  668. package/plugins/hiddenColumns/index.js +0 -2
  669. package/plugins/hiddenRows/contextMenuItem/hideRow.js +5 -39
  670. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +5 -21
  671. package/plugins/hiddenRows/contextMenuItem/showRow.js +17 -45
  672. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +17 -24
  673. package/plugins/hiddenRows/hiddenRows.js +75 -149
  674. package/plugins/hiddenRows/hiddenRows.mjs +75 -108
  675. package/plugins/hiddenRows/index.js +0 -2
  676. package/plugins/index.js +0 -71
  677. package/plugins/index.mjs +0 -1
  678. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +2 -29
  679. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +2 -13
  680. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +2 -29
  681. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +2 -13
  682. package/plugins/manualColumnFreeze/index.js +0 -2
  683. package/plugins/manualColumnFreeze/manualColumnFreeze.js +27 -79
  684. package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +27 -55
  685. package/plugins/manualColumnMove/index.js +0 -2
  686. package/plugins/manualColumnMove/manualColumnMove.js +51 -135
  687. package/plugins/manualColumnMove/manualColumnMove.mjs +51 -107
  688. package/plugins/manualColumnMove/ui/_base.js +26 -31
  689. package/plugins/manualColumnMove/ui/_base.mjs +26 -28
  690. package/plugins/manualColumnMove/ui/backlight.js +7 -38
  691. package/plugins/manualColumnMove/ui/backlight.mjs +7 -23
  692. package/plugins/manualColumnMove/ui/guideline.js +7 -38
  693. package/plugins/manualColumnMove/ui/guideline.mjs +7 -23
  694. package/plugins/manualColumnResize/index.js +0 -2
  695. package/plugins/manualColumnResize/manualColumnResize.js +50 -144
  696. package/plugins/manualColumnResize/manualColumnResize.mjs +49 -119
  697. package/plugins/manualRowMove/index.js +0 -2
  698. package/plugins/manualRowMove/manualRowMove.js +51 -138
  699. package/plugins/manualRowMove/manualRowMove.mjs +51 -110
  700. package/plugins/manualRowMove/ui/_base.js +26 -28
  701. package/plugins/manualRowMove/ui/_base.mjs +26 -27
  702. package/plugins/manualRowMove/ui/backlight.js +7 -38
  703. package/plugins/manualRowMove/ui/backlight.mjs +7 -23
  704. package/plugins/manualRowMove/ui/guideline.js +7 -38
  705. package/plugins/manualRowMove/ui/guideline.mjs +7 -23
  706. package/plugins/manualRowResize/index.js +0 -2
  707. package/plugins/manualRowResize/manualRowResize.js +48 -139
  708. package/plugins/manualRowResize/manualRowResize.mjs +47 -113
  709. package/plugins/mergeCells/calculations/autofill.js +49 -133
  710. package/plugins/mergeCells/calculations/autofill.mjs +46 -117
  711. package/plugins/mergeCells/calculations/selection.js +22 -39
  712. package/plugins/mergeCells/calculations/selection.mjs +22 -36
  713. package/plugins/mergeCells/cellCoords.js +43 -50
  714. package/plugins/mergeCells/cellCoords.mjs +43 -48
  715. package/plugins/mergeCells/cellsCollection.js +22 -86
  716. package/plugins/mergeCells/cellsCollection.mjs +19 -63
  717. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +0 -22
  718. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +0 -6
  719. package/plugins/mergeCells/index.js +0 -2
  720. package/plugins/mergeCells/mergeCells.js +136 -334
  721. package/plugins/mergeCells/mergeCells.mjs +136 -293
  722. package/plugins/mergeCells/utils.js +0 -3
  723. package/plugins/mergeCells/utils.mjs +0 -1
  724. package/plugins/multiColumnSorting/domHelpers.js +2 -12
  725. package/plugins/multiColumnSorting/domHelpers.mjs +2 -5
  726. package/plugins/multiColumnSorting/index.js +0 -2
  727. package/plugins/multiColumnSorting/multiColumnSorting.js +20 -67
  728. package/plugins/multiColumnSorting/multiColumnSorting.mjs +20 -45
  729. package/plugins/multiColumnSorting/rootComparator.js +2 -26
  730. package/plugins/multiColumnSorting/rootComparator.mjs +2 -15
  731. package/plugins/multiColumnSorting/utils.js +0 -7
  732. package/plugins/multiColumnSorting/utils.mjs +0 -4
  733. package/plugins/multipleSelectionHandles/index.js +0 -2
  734. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +12 -110
  735. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +12 -88
  736. package/plugins/nestedHeaders/index.js +0 -2
  737. package/plugins/nestedHeaders/nestedHeaders.js +198 -211
  738. package/plugins/nestedHeaders/nestedHeaders.mjs +206 -191
  739. package/plugins/nestedHeaders/stateManager/headersTree.js +26 -96
  740. package/plugins/nestedHeaders/stateManager/headersTree.mjs +26 -76
  741. package/plugins/nestedHeaders/stateManager/index.js +55 -118
  742. package/plugins/nestedHeaders/stateManager/index.mjs +61 -105
  743. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +7 -25
  744. package/plugins/nestedHeaders/stateManager/matrixGenerator.mjs +7 -18
  745. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +12 -27
  746. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +12 -17
  747. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +10 -25
  748. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +10 -15
  749. package/plugins/nestedHeaders/stateManager/nodeModifiers/hideColumn.js +3 -19
  750. package/plugins/nestedHeaders/stateManager/nodeModifiers/hideColumn.mjs +3 -13
  751. package/plugins/nestedHeaders/stateManager/nodeModifiers/index.js +2 -12
  752. package/plugins/nestedHeaders/stateManager/nodeModifiers/index.mjs +1 -3
  753. package/plugins/nestedHeaders/stateManager/nodeModifiers/showColumn.js +3 -22
  754. package/plugins/nestedHeaders/stateManager/nodeModifiers/showColumn.mjs +3 -14
  755. package/plugins/nestedHeaders/stateManager/nodeModifiers/utils/tree.js +3 -10
  756. package/plugins/nestedHeaders/stateManager/nodeModifiers/utils/tree.mjs +3 -7
  757. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +5 -36
  758. package/plugins/nestedHeaders/stateManager/settingsNormalizer.mjs +5 -20
  759. package/plugins/nestedHeaders/stateManager/sourceSettings.js +27 -81
  760. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +33 -71
  761. package/plugins/nestedHeaders/stateManager/utils.js +19 -22
  762. package/plugins/nestedHeaders/stateManager/utils.mjs +19 -20
  763. package/plugins/nestedHeaders/utils/ghostTable.js +23 -37
  764. package/plugins/nestedHeaders/utils/ghostTable.mjs +23 -36
  765. package/plugins/nestedRows/data/dataManager.js +47 -162
  766. package/plugins/nestedRows/data/dataManager.mjs +45 -143
  767. package/plugins/nestedRows/index.js +0 -2
  768. package/plugins/nestedRows/nestedRows.js +46 -119
  769. package/plugins/nestedRows/nestedRows.mjs +46 -86
  770. package/plugins/nestedRows/ui/_base.js +14 -8
  771. package/plugins/nestedRows/ui/_base.mjs +14 -7
  772. package/plugins/nestedRows/ui/collapsing.js +33 -133
  773. package/plugins/nestedRows/ui/collapsing.mjs +33 -111
  774. package/plugins/nestedRows/ui/contextMenu.js +9 -55
  775. package/plugins/nestedRows/ui/contextMenu.mjs +8 -33
  776. package/plugins/nestedRows/ui/headers.js +10 -49
  777. package/plugins/nestedRows/ui/headers.mjs +10 -34
  778. package/plugins/nestedRows/utils/rowMoveController.js +36 -79
  779. package/plugins/nestedRows/utils/rowMoveController.mjs +45 -71
  780. package/plugins/persistentState/index.js +0 -2
  781. package/plugins/persistentState/persistentState.js +16 -59
  782. package/plugins/persistentState/persistentState.mjs +16 -38
  783. package/plugins/persistentState/storage.js +22 -24
  784. package/plugins/persistentState/storage.mjs +22 -22
  785. package/plugins/registry.js +8 -52
  786. package/plugins/registry.mjs +8 -33
  787. package/plugins/search/index.js +0 -2
  788. package/plugins/search/search.js +22 -97
  789. package/plugins/search/search.mjs +22 -68
  790. package/plugins/touchScroll/index.js +0 -2
  791. package/plugins/touchScroll/touchScroll.js +21 -77
  792. package/plugins/touchScroll/touchScroll.mjs +21 -59
  793. package/plugins/trimRows/index.js +0 -2
  794. package/plugins/trimRows/trimRows.js +64 -86
  795. package/plugins/trimRows/trimRows.mjs +64 -63
  796. package/plugins/undoRedo/index.js +0 -14
  797. package/plugins/undoRedo/undoRedo.js +98 -250
  798. package/plugins/undoRedo/undoRedo.mjs +98 -220
  799. package/registry.js +0 -11
  800. package/registry.mjs +1 -2
  801. package/renderers/autocompleteRenderer/autocompleteRenderer.js +5 -14
  802. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +5 -6
  803. package/renderers/autocompleteRenderer/index.js +0 -2
  804. package/renderers/baseRenderer/baseRenderer.js +2 -11
  805. package/renderers/baseRenderer/baseRenderer.mjs +1 -7
  806. package/renderers/baseRenderer/index.js +0 -2
  807. package/renderers/checkboxRenderer/checkboxRenderer.js +22 -103
  808. package/renderers/checkboxRenderer/checkboxRenderer.mjs +22 -81
  809. package/renderers/checkboxRenderer/index.js +0 -2
  810. package/renderers/htmlRenderer/htmlRenderer.js +1 -7
  811. package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
  812. package/renderers/htmlRenderer/index.js +0 -2
  813. package/renderers/index.js +0 -19
  814. package/renderers/index.mjs +0 -1
  815. package/renderers/numericRenderer/index.js +0 -2
  816. package/renderers/numericRenderer/numericRenderer.js +1 -21
  817. package/renderers/numericRenderer/numericRenderer.mjs +1 -9
  818. package/renderers/passwordRenderer/index.js +0 -2
  819. package/renderers/passwordRenderer/passwordRenderer.js +1 -8
  820. package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
  821. package/renderers/registry.js +7 -16
  822. package/renderers/registry.mjs +7 -14
  823. package/renderers/textRenderer/index.js +0 -2
  824. package/renderers/textRenderer/textRenderer.js +1 -13
  825. package/renderers/textRenderer/textRenderer.mjs +1 -5
  826. package/renderers/timeRenderer/index.js +0 -2
  827. package/renderers/timeRenderer/timeRenderer.js +1 -6
  828. package/renderers/timeRenderer/timeRenderer.mjs +1 -1
  829. package/selection/highlight/highlight.js +24 -73
  830. package/selection/highlight/highlight.mjs +24 -50
  831. package/selection/highlight/types/activeHeader.js +14 -23
  832. package/selection/highlight/types/activeHeader.mjs +14 -12
  833. package/selection/highlight/types/area.js +15 -24
  834. package/selection/highlight/types/area.mjs +15 -13
  835. package/selection/highlight/types/cell.js +14 -23
  836. package/selection/highlight/types/cell.mjs +14 -12
  837. package/selection/highlight/types/customSelection.js +15 -24
  838. package/selection/highlight/types/customSelection.mjs +15 -13
  839. package/selection/highlight/types/fill.js +16 -20
  840. package/selection/highlight/types/fill.mjs +16 -9
  841. package/selection/highlight/types/header.js +16 -25
  842. package/selection/highlight/types/header.mjs +16 -14
  843. package/selection/highlight/types/index.js +17 -27
  844. package/selection/highlight/types/index.mjs +17 -13
  845. package/selection/highlight/visualSelection.js +35 -80
  846. package/selection/highlight/visualSelection.mjs +35 -68
  847. package/selection/index.js +0 -14
  848. package/selection/mouseEventHandler.js +19 -30
  849. package/selection/mouseEventHandler.mjs +19 -22
  850. package/selection/range.js +17 -30
  851. package/selection/range.mjs +17 -21
  852. package/selection/selection.js +72 -160
  853. package/selection/selection.mjs +77 -137
  854. package/selection/transformation.js +23 -39
  855. package/selection/transformation.mjs +23 -36
  856. package/selection/utils.js +23 -71
  857. package/selection/utils.mjs +23 -48
  858. package/shortcuts/context.js +24 -79
  859. package/shortcuts/context.mjs +24 -56
  860. package/shortcuts/index.js +0 -2
  861. package/shortcuts/keyObserver.js +0 -9
  862. package/shortcuts/keyObserver.mjs +0 -4
  863. package/shortcuts/manager.js +17 -37
  864. package/shortcuts/manager.mjs +17 -34
  865. package/shortcuts/recorder.js +9 -40
  866. package/shortcuts/recorder.mjs +9 -31
  867. package/shortcuts/utils.js +5 -20
  868. package/shortcuts/utils.mjs +5 -6
  869. package/tableView.js +239 -330
  870. package/tableView.mjs +239 -308
  871. package/translations/changesObservable/observable.js +14 -53
  872. package/translations/changesObservable/observable.mjs +14 -43
  873. package/translations/changesObservable/observer.js +13 -31
  874. package/translations/changesObservable/observer.mjs +13 -23
  875. package/translations/changesObservable/utils.js +1 -5
  876. package/translations/changesObservable/utils.mjs +1 -4
  877. package/translations/index.js +0 -11
  878. package/translations/indexMapper.js +80 -162
  879. package/translations/indexMapper.mjs +85 -134
  880. package/translations/mapCollections/aggregatedCollection.js +14 -50
  881. package/translations/mapCollections/aggregatedCollection.mjs +14 -37
  882. package/translations/mapCollections/index.js +0 -7
  883. package/translations/mapCollections/mapCollection.js +20 -34
  884. package/translations/mapCollections/mapCollection.mjs +20 -23
  885. package/translations/maps/hidingMap.js +7 -34
  886. package/translations/maps/hidingMap.mjs +7 -22
  887. package/translations/maps/index.js +1 -24
  888. package/translations/maps/index.mjs +1 -3
  889. package/translations/maps/indexMap.js +25 -33
  890. package/translations/maps/indexMap.mjs +25 -27
  891. package/translations/maps/indexesSequence.js +8 -40
  892. package/translations/maps/indexesSequence.mjs +8 -25
  893. package/translations/maps/linkedPhysicalIndexToValueMap.js +18 -81
  894. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +17 -54
  895. package/translations/maps/physicalIndexToValueMap.js +7 -38
  896. package/translations/maps/physicalIndexToValueMap.mjs +7 -24
  897. package/translations/maps/trimmingMap.js +7 -34
  898. package/translations/maps/trimmingMap.mjs +7 -22
  899. package/translations/maps/utils/actionsOnIndexes.js +1 -7
  900. package/translations/maps/utils/actionsOnIndexes.mjs +1 -3
  901. package/translations/maps/utils/index.js +0 -13
  902. package/translations/maps/utils/index.mjs +0 -3
  903. package/translations/maps/utils/indexesSequence.js +1 -24
  904. package/translations/maps/utils/indexesSequence.mjs +1 -9
  905. package/translations/maps/utils/physicallyIndexed.js +1 -27
  906. package/translations/maps/utils/physicallyIndexed.mjs +1 -10
  907. package/utils/dataStructures/linkedList.js +23 -50
  908. package/utils/dataStructures/linkedList.mjs +23 -48
  909. package/utils/dataStructures/priorityMap.js +9 -47
  910. package/utils/dataStructures/priorityMap.mjs +9 -30
  911. package/utils/dataStructures/queue.js +19 -16
  912. package/utils/dataStructures/queue.mjs +19 -15
  913. package/utils/dataStructures/stack.js +19 -16
  914. package/utils/dataStructures/stack.mjs +19 -15
  915. package/utils/dataStructures/tree.js +19 -77
  916. package/utils/dataStructures/tree.mjs +19 -56
  917. package/utils/dataStructures/uniqueMap.js +18 -57
  918. package/utils/dataStructures/uniqueMap.mjs +18 -43
  919. package/utils/dataStructures/uniqueSet.js +5 -32
  920. package/utils/dataStructures/uniqueSet.mjs +5 -19
  921. package/utils/ghostTable.js +42 -106
  922. package/utils/ghostTable.mjs +40 -90
  923. package/utils/interval.js +17 -29
  924. package/utils/interval.mjs +18 -26
  925. package/utils/parseTable.js +11 -92
  926. package/utils/parseTable.mjs +11 -62
  927. package/utils/rootInstance.js +3 -14
  928. package/utils/rootInstance.mjs +3 -3
  929. package/utils/samplesGenerator.js +25 -51
  930. package/utils/samplesGenerator.mjs +25 -42
  931. package/utils/staticRegister.js +6 -33
  932. package/utils/staticRegister.mjs +6 -19
  933. package/validators/autocompleteValidator/autocompleteValidator.js +2 -10
  934. package/validators/autocompleteValidator/autocompleteValidator.mjs +2 -8
  935. package/validators/autocompleteValidator/index.js +0 -2
  936. package/validators/dateValidator/dateValidator.js +2 -21
  937. package/validators/dateValidator/dateValidator.mjs +2 -11
  938. package/validators/dateValidator/index.js +0 -2
  939. package/validators/index.js +0 -11
  940. package/validators/index.mjs +0 -1
  941. package/validators/numericValidator/index.js +0 -2
  942. package/validators/numericValidator/numericValidator.js +1 -7
  943. package/validators/numericValidator/numericValidator.mjs +1 -3
  944. package/validators/registry.js +7 -16
  945. package/validators/registry.mjs +7 -14
  946. package/validators/timeValidator/index.js +0 -2
  947. package/validators/timeValidator/timeValidator.js +6 -18
  948. package/validators/timeValidator/timeValidator.mjs +8 -13
package/core.js CHANGED
@@ -1,142 +1,84 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.symbol.js");
4
-
5
4
  require("core-js/modules/es.symbol.description.js");
6
-
7
5
  require("core-js/modules/es.symbol.iterator.js");
8
-
9
6
  require("core-js/modules/es.function.name.js");
10
-
7
+ require("core-js/modules/es.object.freeze.js");
11
8
  exports.__esModule = true;
12
9
  exports.default = Core;
13
-
10
+ require("core-js/modules/es.array.iterator.js");
11
+ require("core-js/modules/es.object.to-string.js");
12
+ require("core-js/modules/es.set.js");
13
+ require("core-js/modules/es.string.iterator.js");
14
+ require("core-js/modules/web.dom-collections.iterator.js");
14
15
  require("core-js/modules/es.array.includes.js");
15
-
16
16
  require("core-js/modules/es.array.sort.js");
17
-
18
17
  require("core-js/modules/es.array.splice.js");
19
-
20
18
  require("core-js/modules/es.number.is-integer.js");
21
-
22
19
  require("core-js/modules/es.number.constructor.js");
23
-
24
20
  require("core-js/modules/es.array.slice.js");
25
-
26
21
  require("core-js/modules/es.array.concat.js");
27
-
28
22
  require("core-js/modules/es.array.fill.js");
29
-
30
23
  require("core-js/modules/es.array.map.js");
31
-
32
24
  require("core-js/modules/es.regexp.exec.js");
33
-
34
25
  require("core-js/modules/es.string.replace.js");
35
-
36
26
  require("core-js/modules/es.array.from.js");
37
-
38
- require("core-js/modules/es.string.iterator.js");
39
-
40
27
  require("core-js/modules/es.array.index-of.js");
41
-
42
28
  require("core-js/modules/es.array.reverse.js");
43
-
44
- require("core-js/modules/es.object.to-string.js");
45
-
46
29
  require("core-js/modules/web.dom-collections.for-each.js");
47
-
48
30
  require("core-js/modules/web.timers.js");
49
-
50
31
  require("core-js/modules/web.immediate.js");
51
-
52
- require("core-js/modules/es.array.iterator.js");
53
-
54
32
  require("core-js/modules/es.map.js");
55
-
56
- require("core-js/modules/web.dom-collections.iterator.js");
57
-
58
33
  var _element = require("./helpers/dom/element");
59
-
60
34
  var _function = require("./helpers/function");
61
-
62
35
  var _mixed = require("./helpers/mixed");
63
-
64
36
  var _browser = require("./helpers/browser");
65
-
37
+ var _console = require("./helpers/console");
38
+ var _templateLiteralTag = require("./helpers/templateLiteralTag");
66
39
  var _editorManager = _interopRequireDefault(require("./editorManager"));
67
-
68
40
  var _eventManager = _interopRequireDefault(require("./eventManager"));
69
-
70
41
  var _object = require("./helpers/object");
71
-
72
42
  var _array = require("./helpers/array");
73
-
74
43
  var _parseTable = require("./utils/parseTable");
75
-
76
44
  var _registry = require("./plugins/registry");
77
-
78
45
  var _registry2 = require("./renderers/registry");
79
-
80
- var _registry3 = require("./validators/registry");
81
-
46
+ var _registry3 = require("./editors/registry");
47
+ var _registry4 = require("./validators/registry");
82
48
  var _string = require("./helpers/string");
83
-
84
49
  var _number = require("./helpers/number");
85
-
86
50
  var _tableView = _interopRequireDefault(require("./tableView"));
87
-
88
- var _dataSource = _interopRequireDefault(require("./dataSource"));
89
-
51
+ var _dataSource = _interopRequireDefault(require("./dataMap/dataSource"));
90
52
  var _data = require("./helpers/data");
91
-
92
53
  var _translations = require("./translations");
93
-
94
54
  var _rootInstance = require("./utils/rootInstance");
95
-
96
55
  var _src = require("./3rdparty/walkontable/src");
97
-
98
56
  var _pluginHooks = _interopRequireDefault(require("./pluginHooks"));
99
-
100
- var _registry4 = require("./i18n/registry");
101
-
57
+ var _registry5 = require("./i18n/registry");
102
58
  var _utils = require("./i18n/utils");
103
-
104
59
  var _selection = require("./selection");
105
-
106
60
  var _dataMap = require("./dataMap");
107
-
108
61
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
109
-
110
62
  var _shortcuts = require("./shortcuts");
111
-
63
+ var _templateObject, _templateObject2;
112
64
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
113
-
114
65
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
115
-
66
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
116
67
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
117
-
118
68
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
119
-
120
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
121
-
69
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
122
70
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
123
-
124
71
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
125
-
126
72
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
127
-
128
73
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
129
-
130
74
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
131
-
132
75
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
133
-
134
76
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
135
-
136
77
  var SHORTCUTS_GROUP = 'gridDefault';
137
78
  var activeGuid = null;
138
- /* eslint-disable jsdoc/require-description-complete-sentence */
79
+ var deprecationWarns = new Set();
139
80
 
81
+ /* eslint-disable jsdoc/require-description-complete-sentence */
140
82
  /**
141
83
  * Handsontable constructor.
142
84
  *
@@ -144,27 +86,51 @@ var activeGuid = null;
144
86
  * @class Core
145
87
  * @description
146
88
  *
147
- * The `Handsontable` class to which we refer as to `Core`, allows you to modify the grid's behavior by using one of the available public methods.
89
+ * The `Handsontable` class (known as the `Core`) lets you modify the grid's behavior by using Handsontable's public API methods.
90
+ *
91
+ * ::: only-for react
92
+ * To use these methods, associate a Handsontable instance with your instance
93
+ * of the [`HotTable` component](@/guides/getting-started/installation.md#use-the-hottable-component),
94
+ * by using React's `ref` feature (read more on the [Instance methods](@/guides/getting-started/react-methods.md) page).
95
+ * :::
148
96
  *
149
97
  * ## How to call a method
150
98
  *
99
+ * ::: only-for javascript
151
100
  * ```js
152
- * // First, let's contruct Handsontable
101
+ * // create a Handsontable instance
153
102
  * const hot = new Handsontable(document.getElementById('example'), options);
154
103
  *
155
- * // Then, let's use the setDataAtCell method
104
+ * // call a method
156
105
  * hot.setDataAtCell(0, 0, 'new value');
157
106
  * ```
107
+ * :::
108
+ *
109
+ * ::: only-for react
110
+ * ```jsx{3,7,13}
111
+ * import { useRef } from 'react';
112
+ *
113
+ * const hotTableComponent = useRef(null);
114
+ *
115
+ * <HotTable
116
+ * // associate your `HotTable` component with a Handsontable instance
117
+ * ref={hotTableComponent}
118
+ * settings={options}
119
+ * />
120
+ *
121
+ * // access the Handsontable instance, under the `.current.hotInstance` property
122
+ * // call a method
123
+ * hotTableComponent.current.hotInstance.setDataAtCell(0, 0, 'new value');
124
+ * ```
125
+ * :::
158
126
  *
159
127
  * @param {HTMLElement} rootElement The element to which the Handsontable instance is injected.
160
128
  * @param {object} userSettings The user defined options.
161
129
  * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
162
130
  */
163
-
164
131
  function Core(rootElement, userSettings) {
165
132
  var _userSettings$layoutD,
166
- _this = this;
167
-
133
+ _this = this;
168
134
  var rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
169
135
  var preventScrollingToCell = false;
170
136
  var instance = this;
@@ -174,19 +140,17 @@ function Core(rootElement, userSettings) {
174
140
  var grid;
175
141
  var editorManager;
176
142
  var firstRun = true;
177
-
178
143
  if ((0, _rootInstance.hasValidParameter)(rootInstanceSymbol)) {
179
144
  (0, _rootInstance.registerAsRootInstance)(this);
180
- } // TODO: check if references to DOM elements should be move to UI layer (Walkontable)
145
+ }
181
146
 
147
+ // TODO: check if references to DOM elements should be move to UI layer (Walkontable)
182
148
  /**
183
149
  * Reference to the container element.
184
150
  *
185
151
  * @private
186
152
  * @type {HTMLElement}
187
153
  */
188
-
189
-
190
154
  this.rootElement = rootElement;
191
155
  /**
192
156
  * The nearest document over container.
@@ -194,7 +158,6 @@ function Core(rootElement, userSettings) {
194
158
  * @private
195
159
  * @type {Document}
196
160
  */
197
-
198
161
  this.rootDocument = rootElement.ownerDocument;
199
162
  /**
200
163
  * Window object over container's document.
@@ -202,7 +165,6 @@ function Core(rootElement, userSettings) {
202
165
  * @private
203
166
  * @type {Window}
204
167
  */
205
-
206
168
  this.rootWindow = this.rootDocument.defaultView;
207
169
  /**
208
170
  * A boolean to tell if the Handsontable has been fully destroyed. This is set to `true`
@@ -212,7 +174,6 @@ function Core(rootElement, userSettings) {
212
174
  * @member isDestroyed
213
175
  * @type {boolean}
214
176
  */
215
-
216
177
  this.isDestroyed = false;
217
178
  /**
218
179
  * The counter determines how many times the render suspending was called. It allows
@@ -223,7 +184,6 @@ function Core(rootElement, userSettings) {
223
184
  * @private
224
185
  * @type {number}
225
186
  */
226
-
227
187
  this.renderSuspendedCounter = 0;
228
188
  /**
229
189
  * The counter determines how many times the execution suspending was called. It allows
@@ -234,11 +194,11 @@ function Core(rootElement, userSettings) {
234
194
  * @private
235
195
  * @type {number}
236
196
  */
237
-
238
197
  this.executionSuspendedCounter = 0;
239
198
  var layoutDirection = (_userSettings$layoutD = userSettings === null || userSettings === void 0 ? void 0 : userSettings.layoutDirection) !== null && _userSettings$layoutD !== void 0 ? _userSettings$layoutD : 'inherit';
240
199
  var rootElementDirection = ['rtl', 'ltr'].includes(layoutDirection) ? layoutDirection : this.rootWindow.getComputedStyle(this.rootElement).direction;
241
200
  this.rootElement.setAttribute('dir', rootElementDirection);
201
+
242
202
  /**
243
203
  * Checks if the grid is rendered using the right-to-left layout direction.
244
204
  *
@@ -247,10 +207,10 @@ function Core(rootElement, userSettings) {
247
207
  * @function isRtl
248
208
  * @returns {boolean} True if RTL.
249
209
  */
250
-
251
210
  this.isRtl = function () {
252
211
  return rootElementDirection === 'rtl';
253
212
  };
213
+
254
214
  /**
255
215
  * Checks if the grid is rendered using the left-to-right layout direction.
256
216
  *
@@ -259,11 +219,10 @@ function Core(rootElement, userSettings) {
259
219
  * @function isLtr
260
220
  * @returns {boolean} True if LTR.
261
221
  */
262
-
263
-
264
222
  this.isLtr = function () {
265
223
  return !instance.isRtl();
266
224
  };
225
+
267
226
  /**
268
227
  * Returns 1 for LTR; -1 for RTL. Useful for calculations.
269
228
  *
@@ -272,13 +231,10 @@ function Core(rootElement, userSettings) {
272
231
  * @function getDirectionFactor
273
232
  * @returns {number} Returns 1 for LTR; -1 for RTL.
274
233
  */
275
-
276
-
277
234
  this.getDirectionFactor = function () {
278
235
  return instance.isLtr() ? 1 : -1;
279
236
  };
280
-
281
- userSettings.language = (0, _registry4.getValidLanguageCode)(userSettings.language);
237
+ userSettings.language = (0, _registry5.getValidLanguageCode)(userSettings.language);
282
238
  var metaManager = new _dataMap.MetaManager(instance, userSettings, [_dataMap.DynamicCellMetaMod, _dataMap.ExtendMetaPropertiesMod]);
283
239
  var tableMeta = metaManager.getTableMeta();
284
240
  var globalMeta = metaManager.getGlobalMeta();
@@ -286,11 +242,9 @@ function Core(rootElement, userSettings) {
286
242
  this.container = this.rootDocument.createElement('div');
287
243
  this.renderCall = false;
288
244
  rootElement.insertBefore(this.container, rootElement.firstChild);
289
-
290
245
  if ((0, _rootInstance.isRootInstance)(this)) {
291
246
  (0, _mixed._injectProductInfo)(userSettings.licenseKey, rootElement);
292
247
  }
293
-
294
248
  this.guid = "ht_".concat((0, _string.randomString)()); // this is the namespace for global events
295
249
 
296
250
  /**
@@ -300,7 +254,6 @@ function Core(rootElement, userSettings) {
300
254
  * @member columnIndexMapper
301
255
  * @type {IndexMapper}
302
256
  */
303
-
304
257
  this.columnIndexMapper = new _translations.IndexMapper();
305
258
  /**
306
259
  * Instance of index mapper which is responsible for managing the row indexes.
@@ -309,25 +262,24 @@ function Core(rootElement, userSettings) {
309
262
  * @member rowIndexMapper
310
263
  * @type {IndexMapper}
311
264
  */
312
-
313
265
  this.rowIndexMapper = new _translations.IndexMapper();
314
266
  dataSource = new _dataSource.default(instance);
315
-
316
267
  if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') {
317
268
  this.rootElement.id = this.guid; // if root element does not have an id, assign a random id
318
269
  }
319
270
 
320
271
  var visualToRenderableCoords = function visualToRenderableCoords(coords) {
321
272
  var visualRow = coords.row,
322
- visualColumn = coords.col;
323
- return instance._createCellCoords( // We just store indexes for rows and columns without headers.
273
+ visualColumn = coords.col;
274
+ return instance._createCellCoords(
275
+ // We just store indexes for rows and columns without headers.
324
276
  visualRow >= 0 ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRow) : visualRow, visualColumn >= 0 ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumn) : visualColumn);
325
277
  };
326
-
327
278
  var renderableToVisualCoords = function renderableToVisualCoords(coords) {
328
279
  var renderableRow = coords.row,
329
- renderableColumn = coords.col;
330
- return instance._createCellCoords( // We just store indexes for rows and columns without headers.
280
+ renderableColumn = coords.col;
281
+ return instance._createCellCoords(
282
+ // We just store indexes for rows and columns without headers.
331
283
  renderableRow >= 0 ? instance.rowIndexMapper.getVisualFromRenderableIndex(renderableRow) : renderableRow, renderableColumn >= 0 ? instance.columnIndexMapper.getVisualFromRenderableIndex(renderableColumn) : renderableColumn // eslint-disable-line max-len
332
284
  );
333
285
  };
@@ -373,15 +325,12 @@ function Core(rootElement, userSettings) {
373
325
  }
374
326
  });
375
327
  this.selection = selection;
376
-
377
328
  var onIndexMapperCacheUpdate = function onIndexMapperCacheUpdate(_ref) {
378
329
  var hiddenIndexesChanged = _ref.hiddenIndexesChanged;
379
-
380
330
  if (hiddenIndexesChanged) {
381
331
  _this.selection.refresh();
382
332
  }
383
333
  };
384
-
385
334
  this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
386
335
  this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
387
336
  this.selection.addLocalHook('beforeSetRangeStart', function (cellCoords) {
@@ -392,49 +341,34 @@ function Core(rootElement, userSettings) {
392
341
  });
393
342
  this.selection.addLocalHook('beforeSetRangeEnd', function (cellCoords) {
394
343
  _this.runHooks('beforeSetRangeEnd', cellCoords);
395
-
396
344
  if (cellCoords.row < 0) {
397
345
  cellCoords.row = _this.view._wt.wtTable.getFirstVisibleRow();
398
346
  }
399
-
400
347
  if (cellCoords.col < 0) {
401
348
  cellCoords.col = _this.view._wt.wtTable.getFirstVisibleColumn();
402
349
  }
403
350
  });
404
351
  this.selection.addLocalHook('afterSetRangeEnd', function (cellCoords) {
405
352
  var preventScrolling = (0, _object.createObjectPropListener)(false);
406
-
407
353
  var selectionRange = _this.selection.getSelectedRange();
408
-
409
354
  var _selectionRange$curre = selectionRange.current(),
410
- from = _selectionRange$curre.from,
411
- to = _selectionRange$curre.to;
412
-
355
+ from = _selectionRange$curre.from,
356
+ to = _selectionRange$curre.to;
413
357
  var selectionLayerLevel = selectionRange.size() - 1;
414
-
415
358
  _this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
416
-
417
359
  _this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
418
360
 
419
-
420
361
  var isSelectedByAnyHeader = _this.selection.isSelectedByAnyHeader();
421
-
422
362
  var currentSelectedRange = _this.selection.selectedRange.current();
423
-
424
363
  var scrollToCell = true;
425
-
426
364
  if (preventScrollingToCell) {
427
365
  scrollToCell = false;
428
366
  }
429
-
430
367
  if (preventScrolling.isTouched()) {
431
368
  scrollToCell = !preventScrolling.value;
432
369
  }
433
-
434
370
  var isSelectedByRowHeader = _this.selection.isSelectedByRowHeader();
435
-
436
371
  var isSelectedByColumnHeader = _this.selection.isSelectedByColumnHeader();
437
-
438
372
  if (scrollToCell !== false) {
439
373
  if (!isSelectedByAnyHeader) {
440
374
  if (currentSelectedRange && !_this.selection.isMultiple()) {
@@ -447,11 +381,11 @@ function Core(rootElement, userSettings) {
447
381
  } else if (isSelectedByColumnHeader) {
448
382
  _this.view.scrollViewportHorizontally(instance.columnIndexMapper.getRenderableFromVisualIndex(cellCoords.col));
449
383
  }
450
- } // @TODO: These CSS classes are no longer needed anymore. They are used only as a indicator of the selected
384
+ }
385
+
386
+ // @TODO: These CSS classes are no longer needed anymore. They are used only as a indicator of the selected
451
387
  // rows/columns in the MergedCells plugin (via border.js#L520 in the walkontable module). After fixing
452
388
  // the Border class this should be removed.
453
-
454
-
455
389
  if (isSelectedByRowHeader && isSelectedByColumnHeader) {
456
390
  (0, _element.addClass)(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
457
391
  } else if (isSelectedByRowHeader) {
@@ -463,22 +397,18 @@ function Core(rootElement, userSettings) {
463
397
  } else {
464
398
  (0, _element.removeClass)(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
465
399
  }
466
-
467
400
  _this._refreshBorders(null);
468
401
  });
469
402
  this.selection.addLocalHook('afterSelectionFinished', function (cellRanges) {
470
403
  var selectionLayerLevel = cellRanges.length - 1;
471
404
  var _cellRanges$selection = cellRanges[selectionLayerLevel],
472
- from = _cellRanges$selection.from,
473
- to = _cellRanges$selection.to;
474
-
405
+ from = _cellRanges$selection.from,
406
+ to = _cellRanges$selection.to;
475
407
  _this.runHooks('afterSelectionEnd', from.row, from.col, to.row, to.col, selectionLayerLevel);
476
-
477
408
  _this.runHooks('afterSelectionEndByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), selectionLayerLevel);
478
409
  });
479
410
  this.selection.addLocalHook('afterIsMultipleSelection', function (isMultiple) {
480
411
  var changedIsMultiple = _this.runHooks('afterIsMultipleSelection', isMultiple.value);
481
-
482
412
  if (isMultiple.value) {
483
413
  isMultiple.value = changedIsMultiple;
484
414
  }
@@ -497,299 +427,297 @@ function Core(rootElement, userSettings) {
497
427
  });
498
428
  this.selection.addLocalHook('afterDeselect', function () {
499
429
  editorManager.destroyEditor();
500
-
501
430
  _this._refreshBorders();
502
-
503
431
  (0, _element.removeClass)(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
504
-
505
432
  _this.runHooks('afterDeselect');
506
433
  });
507
434
  this.selection.addLocalHook('insertRowRequire', function (totalRows) {
508
- _this.alter('insert_row', totalRows, 1, 'auto');
435
+ _this.alter('insert_row_above', totalRows, 1, 'auto');
509
436
  });
510
437
  this.selection.addLocalHook('insertColRequire', function (totalCols) {
511
- _this.alter('insert_col', totalCols, 1, 'auto');
438
+ _this.alter('insert_col_start', totalCols, 1, 'auto');
512
439
  });
513
440
  grid = {
514
441
  /**
515
442
  * Inserts or removes rows and columns.
516
443
  *
517
444
  * @private
518
- * @param {string} action Possible values: "insert_row", "insert_col", "remove_row", "remove_col".
445
+ * @param {string} action Possible values: "insert_row_above", "insert_row_below", "insert_col_start", "insert_col_end",
446
+ * "remove_row", "remove_col".
519
447
  * @param {number|Array} index Row or column visual index which from the alter action will be triggered.
520
448
  * Alter actions such as "remove_row" and "remove_col" support array indexes in the
521
449
  * format `[[index, amount], [index, amount]...]` this can be used to remove
522
450
  * non-consecutive columns or rows in one call.
523
- * @param {number} [amount=1] Ammount rows or columns to remove.
451
+ * @param {number} [amount=1] Amount of rows or columns to remove.
524
452
  * @param {string} [source] Optional. Source of hook runner.
525
453
  * @param {boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows.
526
454
  */
527
455
  alter: function alter(action, index) {
456
+ var _index, _index2;
528
457
  var amount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
529
458
  var source = arguments.length > 3 ? arguments[3] : undefined;
530
459
  var keepEmptyRows = arguments.length > 4 ? arguments[4] : undefined;
531
- var delta;
532
-
533
460
  var normalizeIndexesGroup = function normalizeIndexesGroup(indexes) {
534
461
  if (indexes.length === 0) {
535
462
  return [];
536
463
  }
464
+ var sortedIndexes = _toConsumableArray(indexes);
537
465
 
538
- var sortedIndexes = _toConsumableArray(indexes); // Sort the indexes in ascending order.
539
-
540
-
466
+ // Sort the indexes in ascending order.
541
467
  sortedIndexes.sort(function (_ref2, _ref3) {
542
468
  var _ref4 = _slicedToArray(_ref2, 1),
543
- indexA = _ref4[0];
544
-
469
+ indexA = _ref4[0];
545
470
  var _ref5 = _slicedToArray(_ref3, 1),
546
- indexB = _ref5[0];
547
-
471
+ indexB = _ref5[0];
548
472
  if (indexA === indexB) {
549
473
  return 0;
550
474
  }
551
-
552
475
  return indexA > indexB ? 1 : -1;
553
- }); // Normalize the {index, amount} groups into bigger groups.
476
+ });
554
477
 
478
+ // Normalize the {index, amount} groups into bigger groups.
555
479
  var normalizedIndexes = (0, _array.arrayReduce)(sortedIndexes, function (acc, _ref6) {
556
480
  var _ref7 = _slicedToArray(_ref6, 2),
557
- groupIndex = _ref7[0],
558
- groupAmount = _ref7[1];
559
-
481
+ groupIndex = _ref7[0],
482
+ groupAmount = _ref7[1];
560
483
  var previousItem = acc[acc.length - 1];
561
-
562
484
  var _previousItem = _slicedToArray(previousItem, 2),
563
- prevIndex = _previousItem[0],
564
- prevAmount = _previousItem[1];
565
-
485
+ prevIndex = _previousItem[0],
486
+ prevAmount = _previousItem[1];
566
487
  var prevLastIndex = prevIndex + prevAmount;
567
-
568
488
  if (groupIndex <= prevLastIndex) {
569
489
  var amountToAdd = Math.max(groupAmount - (prevLastIndex - groupIndex), 0);
570
490
  previousItem[1] += amountToAdd;
571
491
  } else {
572
492
  acc.push([groupIndex, groupAmount]);
573
493
  }
574
-
575
494
  return acc;
576
495
  }, [sortedIndexes[0]]);
577
496
  return normalizedIndexes;
578
497
  };
579
- /* eslint-disable no-case-declarations */
580
-
581
498
 
499
+ /* eslint-disable no-case-declarations */
582
500
  switch (action) {
583
501
  case 'insert_row':
502
+ // backward compatibility
503
+ if (!deprecationWarns.has(action)) {
504
+ deprecationWarns.add(action);
505
+ (0, _console.warn)((0, _templateLiteralTag.toSingleLine)(_templateObject || (_templateObject = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_row_above` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_row_above\\` action instead."])), action));
506
+ }
507
+ // falls through
508
+ case 'insert_row_below':
509
+ case 'insert_row_above':
584
510
  var numberOfSourceRows = instance.countSourceRows();
585
-
586
511
  if (tableMeta.maxRows === numberOfSourceRows) {
587
512
  return;
588
- } // eslint-disable-next-line no-param-reassign
589
-
590
-
591
- index = (0, _mixed.isDefined)(index) ? index : numberOfSourceRows;
592
- delta = datamap.createRow(index, amount, source);
513
+ }
593
514
 
594
- if (delta) {
595
- metaManager.createRow(instance.toPhysicalRow(index), amount);
515
+ // `above` is the default behavior for creating new rows
516
+ var insertRowMode = action === 'insert_row_below' ? 'below' : 'above';
517
+
518
+ // The line below ensures backward compatibility of the `alter()` method's `insert_row` action.
519
+ // Calling the `insert_row` action with no arguments adds a new row at the end of the data set.
520
+ // Calling the `insert_row_above` action adds a new row at the beginning of the data set.
521
+ // eslint-disable-next-line no-param-reassign
522
+ index = (_index = index) !== null && _index !== void 0 ? _index : action === 'insert_row' || insertRowMode === 'below' ? numberOfSourceRows : 0;
523
+ var _datamap$createRow = datamap.createRow(index, amount, {
524
+ source: source,
525
+ mode: insertRowMode
526
+ }),
527
+ rowDelta = _datamap$createRow.delta,
528
+ startRowPhysicalIndex = _datamap$createRow.startPhysicalIndex;
529
+ if (rowDelta) {
596
530
  var currentSelectedRange = selection.selectedRange.current();
597
531
  var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
598
- var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row; // Moving down the selection (when it exist). It should be present on the "old" row.
599
- // TODO: The logic here should be handled by selection module.
600
-
601
- if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= index) {
532
+ var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
533
+ var startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
534
+ if (selection.isSelectedByCorner()) {
535
+ instance.selectAll();
536
+ } else if ((0, _mixed.isDefined)(currentFromRow) && currentFromRow >= startVisualRowIndex) {
537
+ // Moving the selection (if it exists) downward – it should be applied to the "old" row.
538
+ // TODO: The logic here should be handled by selection module.
602
539
  var _currentSelectedRange = currentSelectedRange.to,
603
- currentToRow = _currentSelectedRange.row,
604
- currentToColumn = _currentSelectedRange.col;
605
- var currentFromColumn = currentFromRange.col; // Workaround: headers are not stored inside selection.
540
+ currentToRow = _currentSelectedRange.row,
541
+ currentToColumn = _currentSelectedRange.col;
542
+ var currentFromColumn = currentFromRange.col;
606
543
 
544
+ // Workaround: headers are not stored inside selection.
607
545
  if (selection.isSelectedByRowHeader()) {
608
546
  currentFromColumn = -1;
609
- } // Remove from the stack the last added selection as that selection below will be
610
- // replaced by new transformed selection.
611
-
612
-
613
- selection.getSelectedRange().pop(); // I can't use transforms as they don't work in negative indexes.
547
+ }
614
548
 
615
- selection.setRangeStartOnly(instance._createCellCoords(currentFromRow + delta, currentFromColumn), true);
616
- selection.setRangeEnd(instance._createCellCoords(currentToRow + delta, currentToColumn)); // will call render() internally
549
+ // Remove from the stack the last added selection as that selection below will be
550
+ // replaced by new transformed selection.
551
+ selection.getSelectedRange().pop();
552
+ // I can't use transforms as they don't work in negative indexes.
553
+ selection.setRangeStartOnly(instance._createCellCoords(currentFromRow + rowDelta, currentFromColumn), true);
554
+ selection.setRangeEnd(instance._createCellCoords(currentToRow + rowDelta, currentToColumn)); // will call render() internally
617
555
  } else {
618
556
  instance._refreshBorders(); // it will call render and prepare methods
619
-
620
557
  }
621
558
  }
622
559
 
623
560
  break;
624
-
625
561
  case 'insert_col':
626
- delta = datamap.createCol(index, amount, source);
627
-
628
- if (delta) {
629
- metaManager.createColumn(instance.toPhysicalColumn(index), amount);
630
-
562
+ // backward compatibility
563
+ if (!deprecationWarns.has(action)) {
564
+ deprecationWarns.add(action);
565
+ (0, _console.warn)((0, _templateLiteralTag.toSingleLine)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_col_start` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_col_start\\` action instead."])), action));
566
+ }
567
+ // falls through
568
+ case 'insert_col_start':
569
+ case 'insert_col_end':
570
+ // "start" is a default behavior for creating new columns
571
+ var insertColumnMode = action === 'insert_col_end' ? 'end' : 'start';
572
+
573
+ // The line below ensures backward compatibility of the `alter()` method's `insert_col` action.
574
+ // Calling the `insert_col` action with no arguments adds a new column to the right of the data set.
575
+ // Calling the `insert_col_start` action adds a new column to the left of the data set.
576
+ // eslint-disable-next-line no-param-reassign
577
+ index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : action === 'insert_col' || insertColumnMode === 'end' ? instance.countSourceCols() : 0;
578
+ var _datamap$createCol = datamap.createCol(index, amount, {
579
+ source: source,
580
+ mode: insertColumnMode
581
+ }),
582
+ colDelta = _datamap$createCol.delta,
583
+ startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
584
+ if (colDelta) {
631
585
  if (Array.isArray(tableMeta.colHeaders)) {
632
- var spliceArray = [index, 0];
633
- spliceArray.length += delta; // inserts empty (undefined) elements at the end of an array
634
-
586
+ var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
587
+ spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
635
588
  Array.prototype.splice.apply(tableMeta.colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array
636
589
  }
637
590
 
638
591
  var _currentSelectedRange2 = selection.selectedRange.current();
639
-
640
592
  var _currentFromRange = _currentSelectedRange2 === null || _currentSelectedRange2 === void 0 ? void 0 : _currentSelectedRange2.from;
641
-
642
- var _currentFromColumn = _currentFromRange === null || _currentFromRange === void 0 ? void 0 : _currentFromRange.col; // Moving right the selection (when it exist). It should be present on the "old" row.
643
- // TODO: The logic here should be handled by selection module.
644
-
645
-
646
- if ((0, _mixed.isDefined)(_currentFromColumn) && _currentFromColumn >= index) {
593
+ var _currentFromColumn = _currentFromRange === null || _currentFromRange === void 0 ? void 0 : _currentFromRange.col;
594
+ var startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
595
+ if (selection.isSelectedByCorner()) {
596
+ instance.selectAll();
597
+ } else if ((0, _mixed.isDefined)(_currentFromColumn) && _currentFromColumn >= startVisualColumnIndex) {
598
+ // Moving the selection (if it exists) rightward it should be applied to the "old" column.
599
+ // TODO: The logic here should be handled by selection module.
647
600
  var _currentSelectedRange3 = _currentSelectedRange2.to,
648
- _currentToRow = _currentSelectedRange3.row,
649
- _currentToColumn = _currentSelectedRange3.col;
650
- var _currentFromRow = _currentFromRange.row; // Workaround: headers are not stored inside selection.
601
+ _currentToRow = _currentSelectedRange3.row,
602
+ _currentToColumn = _currentSelectedRange3.col;
603
+ var _currentFromRow = _currentFromRange.row;
651
604
 
605
+ // Workaround: headers are not stored inside selection.
652
606
  if (selection.isSelectedByColumnHeader()) {
653
607
  _currentFromRow = -1;
654
- } // Remove from the stack the last added selection as that selection below will be
655
- // replaced by new transformed selection.
656
-
608
+ }
657
609
 
658
- selection.getSelectedRange().pop(); // I can't use transforms as they don't work in negative indexes.
610
+ // Remove from the stack the last added selection as that selection below will be
611
+ // replaced by new transformed selection.
612
+ selection.getSelectedRange().pop();
659
613
 
660
- selection.setRangeStartOnly(instance._createCellCoords(_currentFromRow, _currentFromColumn + delta), true);
661
- selection.setRangeEnd(instance._createCellCoords(_currentToRow, _currentToColumn + delta)); // will call render() internally
614
+ // I can't use transforms as they don't work in negative indexes.
615
+ selection.setRangeStartOnly(instance._createCellCoords(_currentFromRow, _currentFromColumn + colDelta), true);
616
+ selection.setRangeEnd(instance._createCellCoords(_currentToRow, _currentToColumn + colDelta)); // will call render() internally
662
617
  } else {
663
618
  instance._refreshBorders(); // it will call render and prepare methods
664
-
665
619
  }
666
620
  }
667
621
 
668
622
  break;
669
-
670
623
  case 'remove_row':
671
624
  var removeRow = function removeRow(indexes) {
672
- var offset = 0; // Normalize the {index, amount} groups into bigger groups.
625
+ var offset = 0;
673
626
 
627
+ // Normalize the {index, amount} groups into bigger groups.
674
628
  (0, _array.arrayEach)(indexes, function (_ref8) {
675
629
  var _ref9 = _slicedToArray(_ref8, 2),
676
- groupIndex = _ref9[0],
677
- groupAmount = _ref9[1];
630
+ groupIndex = _ref9[0],
631
+ groupAmount = _ref9[1];
632
+ var calcIndex = (0, _mixed.isEmpty)(groupIndex) ? instance.countRows() - 1 : Math.max(groupIndex - offset, 0);
678
633
 
679
- var calcIndex = (0, _mixed.isEmpty)(groupIndex) ? instance.countRows() - 1 : Math.max(groupIndex - offset, 0); // If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
634
+ // If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
680
635
  // compatible with datamap.removeCol method.
681
-
682
636
  if (Number.isInteger(groupIndex)) {
683
637
  // eslint-disable-next-line no-param-reassign
684
638
  groupIndex = Math.max(groupIndex - offset, 0);
685
- } // TODO: for datamap.removeRow index should be passed as it is (with undefined and null values). If not, the logic
686
- // inside the datamap.removeRow breaks the removing functionality.
687
-
639
+ }
688
640
 
641
+ // TODO: for datamap.removeRow index should be passed as it is (with undefined and null values). If not, the logic
642
+ // inside the datamap.removeRow breaks the removing functionality.
689
643
  var wasRemoved = datamap.removeRow(groupIndex, groupAmount, source);
690
-
691
644
  if (!wasRemoved) {
692
645
  return;
693
646
  }
694
-
695
- metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
696
647
  var totalRows = instance.countRows();
697
648
  var fixedRowsTop = tableMeta.fixedRowsTop;
698
-
699
649
  if (fixedRowsTop >= calcIndex + 1) {
700
650
  tableMeta.fixedRowsTop -= Math.min(groupAmount, fixedRowsTop - calcIndex);
701
651
  }
702
-
703
652
  var fixedRowsBottom = tableMeta.fixedRowsBottom;
704
-
705
653
  if (fixedRowsBottom && calcIndex >= totalRows - fixedRowsBottom) {
706
654
  tableMeta.fixedRowsBottom -= Math.min(groupAmount, fixedRowsBottom);
707
655
  }
708
-
709
656
  offset += groupAmount;
710
657
  });
711
658
  };
712
-
713
659
  if (Array.isArray(index)) {
714
660
  removeRow(normalizeIndexesGroup(index));
715
661
  } else {
716
662
  removeRow([[index, amount]]);
717
663
  }
718
-
719
664
  grid.adjustRowsAndCols();
720
-
721
665
  instance._refreshBorders(); // it will call render and prepare methods
722
-
723
-
724
666
  break;
725
-
726
667
  case 'remove_col':
727
668
  var removeCol = function removeCol(indexes) {
728
- var offset = 0; // Normalize the {index, amount} groups into bigger groups.
669
+ var offset = 0;
729
670
 
671
+ // Normalize the {index, amount} groups into bigger groups.
730
672
  (0, _array.arrayEach)(indexes, function (_ref10) {
731
673
  var _ref11 = _slicedToArray(_ref10, 2),
732
- groupIndex = _ref11[0],
733
- groupAmount = _ref11[1];
734
-
674
+ groupIndex = _ref11[0],
675
+ groupAmount = _ref11[1];
735
676
  var calcIndex = (0, _mixed.isEmpty)(groupIndex) ? instance.countCols() - 1 : Math.max(groupIndex - offset, 0);
736
- var physicalColumnIndex = instance.toPhysicalColumn(calcIndex); // If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
737
- // compatible with datamap.removeCol method.
677
+ var physicalColumnIndex = instance.toPhysicalColumn(calcIndex);
738
678
 
679
+ // If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
680
+ // compatible with datamap.removeCol method.
739
681
  if (Number.isInteger(groupIndex)) {
740
682
  // eslint-disable-next-line no-param-reassign
741
683
  groupIndex = Math.max(groupIndex - offset, 0);
742
- } // TODO: for datamap.removeCol index should be passed as it is (with undefined and null values). If not, the logic
743
- // inside the datamap.removeCol breaks the removing functionality.
744
-
684
+ }
745
685
 
686
+ // TODO: for datamap.removeCol index should be passed as it is (with undefined and null values). If not, the logic
687
+ // inside the datamap.removeCol breaks the removing functionality.
746
688
  var wasRemoved = datamap.removeCol(groupIndex, groupAmount, source);
747
-
748
689
  if (!wasRemoved) {
749
690
  return;
750
691
  }
751
-
752
- metaManager.removeColumn(physicalColumnIndex, groupAmount);
753
692
  var fixedColumnsStart = tableMeta.fixedColumnsStart;
754
-
755
693
  if (fixedColumnsStart >= calcIndex + 1) {
756
694
  tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
757
695
  }
758
-
759
696
  if (Array.isArray(tableMeta.colHeaders)) {
760
697
  if (typeof physicalColumnIndex === 'undefined') {
761
698
  physicalColumnIndex = -1;
762
699
  }
763
-
764
700
  tableMeta.colHeaders.splice(physicalColumnIndex, groupAmount);
765
701
  }
766
-
767
702
  offset += groupAmount;
768
703
  });
769
704
  };
770
-
771
705
  if (Array.isArray(index)) {
772
706
  removeCol(normalizeIndexesGroup(index));
773
707
  } else {
774
708
  removeCol([[index, amount]]);
775
709
  }
776
-
777
710
  grid.adjustRowsAndCols();
778
-
779
711
  instance._refreshBorders(); // it will call render and prepare methods
780
712
 
781
-
782
713
  break;
783
-
784
714
  default:
785
715
  throw new Error("There is no such action \"".concat(action, "\""));
786
716
  }
787
-
788
717
  if (!keepEmptyRows) {
789
718
  grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh
790
719
  }
791
720
  },
792
-
793
721
  /**
794
722
  * Makes sure there are empty rows at the bottom of the table.
795
723
  *
@@ -800,118 +728,114 @@ function Core(rootElement, userSettings) {
800
728
  var minSpareRows = tableMeta.minSpareRows;
801
729
  var minCols = tableMeta.minCols;
802
730
  var minSpareCols = tableMeta.minSpareCols;
803
-
731
+ if (instance.countRows() === 0 && instance.countCols() === 0) {
732
+ selection.deselect();
733
+ }
804
734
  if (minRows) {
805
735
  // should I add empty rows to data source to meet minRows?
806
736
  var nrOfRows = instance.countRows();
807
-
808
737
  if (nrOfRows < minRows) {
809
738
  // The synchronization with cell meta is not desired here. For `minRows` option,
810
739
  // we don't want to touch/shift cell meta objects.
811
- datamap.createRow(nrOfRows, minRows - nrOfRows, 'auto');
740
+ datamap.createRow(nrOfRows, minRows - nrOfRows, {
741
+ source: 'auto'
742
+ });
812
743
  }
813
744
  }
814
-
815
745
  if (minSpareRows) {
816
- var emptyRows = instance.countEmptyRows(true); // should I add empty rows to meet minSpareRows?
746
+ var emptyRows = instance.countEmptyRows(true);
817
747
 
748
+ // should I add empty rows to meet minSpareRows?
818
749
  if (emptyRows < minSpareRows) {
819
750
  var emptyRowsMissing = minSpareRows - emptyRows;
820
- var rowsToCreate = Math.min(emptyRowsMissing, tableMeta.maxRows - instance.countSourceRows()); // The synchronization with cell meta is not desired here. For `minSpareRows` option,
821
- // we don't want to touch/shift cell meta objects.
751
+ var rowsToCreate = Math.min(emptyRowsMissing, tableMeta.maxRows - instance.countSourceRows());
822
752
 
823
- datamap.createRow(instance.countRows(), rowsToCreate, 'auto');
753
+ // The synchronization with cell meta is not desired here. For `minSpareRows` option,
754
+ // we don't want to touch/shift cell meta objects.
755
+ datamap.createRow(instance.countRows(), rowsToCreate, {
756
+ source: 'auto'
757
+ });
824
758
  }
825
759
  }
826
-
827
760
  {
828
- var emptyCols; // count currently empty cols
761
+ var emptyCols;
829
762
 
763
+ // count currently empty cols
830
764
  if (minCols || minSpareCols) {
831
765
  emptyCols = instance.countEmptyCols(true);
832
766
  }
767
+ var nrOfColumns = instance.countCols();
833
768
 
834
- var nrOfColumns = instance.countCols(); // should I add empty cols to meet minCols?
835
-
769
+ // should I add empty cols to meet minCols?
836
770
  if (minCols && !tableMeta.columns && nrOfColumns < minCols) {
837
771
  // The synchronization with cell meta is not desired here. For `minSpareRows` option,
838
772
  // we don't want to touch/shift cell meta objects.
839
773
  var colsToCreate = minCols - nrOfColumns;
840
774
  emptyCols += colsToCreate;
841
- datamap.createCol(nrOfColumns, colsToCreate, 'auto');
842
- } // should I add empty cols to meet minSpareCols?
843
-
844
-
775
+ datamap.createCol(nrOfColumns, colsToCreate, {
776
+ source: 'auto'
777
+ });
778
+ }
779
+ // should I add empty cols to meet minSpareCols?
845
780
  if (minSpareCols && !tableMeta.columns && instance.dataType === 'array' && emptyCols < minSpareCols) {
846
781
  nrOfColumns = instance.countCols();
847
782
  var emptyColsMissing = minSpareCols - emptyCols;
783
+ var _colsToCreate = Math.min(emptyColsMissing, tableMeta.maxCols - nrOfColumns);
848
784
 
849
- var _colsToCreate = Math.min(emptyColsMissing, tableMeta.maxCols - nrOfColumns); // The synchronization with cell meta is not desired here. For `minSpareRows` option,
785
+ // The synchronization with cell meta is not desired here. For `minSpareRows` option,
850
786
  // we don't want to touch/shift cell meta objects.
851
-
852
-
853
- datamap.createCol(nrOfColumns, _colsToCreate, 'auto');
787
+ datamap.createCol(nrOfColumns, _colsToCreate, {
788
+ source: 'auto'
789
+ });
854
790
  }
855
791
  }
856
- var rowCount = instance.countRows();
857
- var colCount = instance.countCols();
858
-
859
- if (rowCount === 0 || colCount === 0) {
860
- selection.deselect();
861
- }
862
-
863
792
  if (selection.isSelected()) {
793
+ var rowCount = instance.countRows();
794
+ var colCount = instance.countCols();
864
795
  (0, _array.arrayEach)(selection.selectedRange, function (range) {
865
796
  var selectionChanged = false;
866
797
  var fromRow = range.from.row;
867
798
  var fromCol = range.from.col;
868
799
  var toRow = range.to.row;
869
- var toCol = range.to.col; // if selection is outside, move selection to last row
800
+ var toCol = range.to.col;
870
801
 
802
+ // if selection is outside, move selection to last row
871
803
  if (fromRow > rowCount - 1) {
872
804
  fromRow = rowCount - 1;
873
805
  selectionChanged = true;
874
-
875
806
  if (toRow > fromRow) {
876
807
  toRow = fromRow;
877
808
  }
878
809
  } else if (toRow > rowCount - 1) {
879
810
  toRow = rowCount - 1;
880
811
  selectionChanged = true;
881
-
882
812
  if (fromRow > toRow) {
883
813
  fromRow = toRow;
884
814
  }
885
- } // if selection is outside, move selection to last row
886
-
887
-
815
+ }
816
+ // if selection is outside, move selection to last row
888
817
  if (fromCol > colCount - 1) {
889
818
  fromCol = colCount - 1;
890
819
  selectionChanged = true;
891
-
892
820
  if (toCol > fromCol) {
893
821
  toCol = fromCol;
894
822
  }
895
823
  } else if (toCol > colCount - 1) {
896
824
  toCol = colCount - 1;
897
825
  selectionChanged = true;
898
-
899
826
  if (fromCol > toCol) {
900
827
  fromCol = toCol;
901
828
  }
902
829
  }
903
-
904
830
  if (selectionChanged) {
905
831
  instance.selectCell(fromRow, fromCol, toRow, toCol);
906
832
  }
907
833
  });
908
834
  }
909
-
910
835
  if (instance.view) {
911
836
  instance.view.adjustElementsSize();
912
837
  }
913
838
  },
914
-
915
839
  /**
916
840
  * Populate the data from the provided 2d array from the given cell coordinates.
917
841
  *
@@ -938,38 +862,34 @@ function Core(rootElement, userSettings) {
938
862
  var startRow = start.row;
939
863
  var startColumn = start.col;
940
864
  rlen = input.length;
941
-
942
865
  if (rlen === 0) {
943
866
  return false;
944
867
  }
945
-
946
868
  var columnsPopulationEnd = 0;
947
869
  var rowsPopulationEnd = 0;
948
-
949
870
  if ((0, _object.isObject)(end)) {
950
871
  columnsPopulationEnd = end.col - startColumn + 1;
951
872
  rowsPopulationEnd = end.row - startRow + 1;
952
- } // insert data with specified pasteMode method
953
-
873
+ }
954
874
 
875
+ // insert data with specified pasteMode method
955
876
  switch (method) {
956
877
  case 'shift_down':
957
878
  // translate data from a list of rows to a list of columns
958
879
  var populatedDataByColumns = (0, _array.pivot)(input);
959
- var numberOfDataColumns = populatedDataByColumns.length; // method's argument can extend the range of data population (data would be repeated)
960
-
880
+ var numberOfDataColumns = populatedDataByColumns.length;
881
+ // method's argument can extend the range of data population (data would be repeated)
961
882
  var numberOfColumnsToPopulate = Math.max(numberOfDataColumns, columnsPopulationEnd);
962
- var pushedDownDataByRows = instance.getData().slice(startRow); // translate data from a list of rows to a list of columns
883
+ var pushedDownDataByRows = instance.getData().slice(startRow);
963
884
 
885
+ // translate data from a list of rows to a list of columns
964
886
  var pushedDownDataByColumns = (0, _array.pivot)(pushedDownDataByRows).slice(startColumn, startColumn + numberOfColumnsToPopulate);
965
-
966
887
  for (c = 0; c < numberOfColumnsToPopulate; c += 1) {
967
888
  if (c < numberOfDataColumns) {
968
889
  for (r = 0, rlen = populatedDataByColumns[c].length; r < rowsPopulationEnd - rlen; r += 1) {
969
890
  // repeating data for rows
970
891
  populatedDataByColumns[c].push(populatedDataByColumns[c][r % rlen]);
971
892
  }
972
-
973
893
  if (c < pushedDownDataByColumns.length) {
974
894
  newDataByColumns.push(populatedDataByColumns[c].concat(pushedDownDataByColumns[c]));
975
895
  } else {
@@ -982,32 +902,27 @@ function Core(rootElement, userSettings) {
982
902
  newDataByColumns.push(populatedDataByColumns[c % numberOfDataColumns].concat(pushedDownDataByColumns[c]));
983
903
  }
984
904
  }
985
-
986
905
  instance.populateFromArray(startRow, startColumn, (0, _array.pivot)(newDataByColumns));
987
906
  break;
988
-
989
907
  case 'shift_right':
990
- var numberOfDataRows = input.length; // method's argument can extend the range of data population (data would be repeated)
991
-
908
+ var numberOfDataRows = input.length;
909
+ // method's argument can extend the range of data population (data would be repeated)
992
910
  var numberOfRowsToPopulate = Math.max(numberOfDataRows, rowsPopulationEnd);
993
911
  var pushedRightDataByRows = instance.getData().slice(startRow).map(function (rowData) {
994
912
  return rowData.slice(startColumn);
995
913
  });
996
-
997
914
  for (r = 0; r < numberOfRowsToPopulate; r += 1) {
998
915
  if (r < numberOfDataRows) {
999
916
  for (c = 0, clen = input[r].length; c < columnsPopulationEnd - clen; c += 1) {
1000
917
  // repeating data for rows
1001
918
  input[r].push(input[r][c % clen]);
1002
919
  }
1003
-
1004
920
  if (r < pushedRightDataByRows.length) {
1005
921
  for (var i = 0; i < pushedRightDataByRows[r].length; i += 1) {
1006
922
  input[r].push(pushedRightDataByRows[r][i]);
1007
923
  }
1008
924
  } else {
1009
925
  var _input$r;
1010
-
1011
926
  // if before data population, there was no data in the row
1012
927
  // we fill the required columns' newly-created cells with `null` values
1013
928
  (_input$r = input[r]).push.apply(_input$r, _toConsumableArray(new Array(pushedRightDataByRows[0].length).fill(null)));
@@ -1017,10 +932,8 @@ function Core(rootElement, userSettings) {
1017
932
  input.push(input[r % rlen].slice(0, numberOfRowsToPopulate).concat(pushedRightDataByRows[r]));
1018
933
  }
1019
934
  }
1020
-
1021
935
  instance.populateFromArray(startRow, startColumn, input);
1022
936
  break;
1023
-
1024
937
  case 'overwrite':
1025
938
  default:
1026
939
  // overwrite and other not specified options
@@ -1035,77 +948,59 @@ function Core(rootElement, userSettings) {
1035
948
  var skippedColumn = 0;
1036
949
  var pushData = true;
1037
950
  var cellMeta;
1038
-
1039
951
  var getInputValue = function getInputValue(row) {
1040
952
  var col = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1041
953
  var rowValue = input[row % input.length];
1042
-
1043
954
  if (col !== null) {
1044
955
  return rowValue[col % rowValue.length];
1045
956
  }
1046
-
1047
957
  return rowValue;
1048
958
  };
1049
-
1050
959
  var rowInputLength = input.length;
1051
960
  var rowSelectionLength = end ? end.row - start.row + 1 : 0;
1052
-
1053
961
  if (end) {
1054
962
  rlen = rowSelectionLength;
1055
963
  } else {
1056
964
  rlen = Math.max(rowInputLength, rowSelectionLength);
1057
965
  }
1058
-
1059
966
  for (r = 0; r < rlen; r++) {
1060
967
  if (end && current.row > end.row && rowSelectionLength > rowInputLength || !tableMeta.allowInsertRow && current.row > instance.countRows() - 1 || current.row >= tableMeta.maxRows) {
1061
968
  break;
1062
969
  }
1063
-
1064
970
  var visualRow = r - skippedRow;
1065
971
  var colInputLength = getInputValue(visualRow).length;
1066
972
  var colSelectionLength = end ? end.col - start.col + 1 : 0;
1067
-
1068
973
  if (end) {
1069
974
  clen = colSelectionLength;
1070
975
  } else {
1071
976
  clen = Math.max(colInputLength, colSelectionLength);
1072
977
  }
1073
-
1074
978
  current.col = start.col;
1075
979
  cellMeta = instance.getCellMeta(current.row, current.col);
1076
-
1077
980
  if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipRowOnPaste) {
1078
981
  skippedRow += 1;
1079
982
  current.row += 1;
1080
983
  rlen += 1;
1081
984
  /* eslint-disable no-continue */
1082
-
1083
985
  continue;
1084
986
  }
1085
-
1086
987
  skippedColumn = 0;
1087
-
1088
988
  for (c = 0; c < clen; c++) {
1089
989
  if (end && current.col > end.col && colSelectionLength > colInputLength || !tableMeta.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= tableMeta.maxCols) {
1090
990
  break;
1091
991
  }
1092
-
1093
992
  cellMeta = instance.getCellMeta(current.row, current.col);
1094
-
1095
993
  if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipColumnOnPaste) {
1096
994
  skippedColumn += 1;
1097
995
  current.col += 1;
1098
996
  clen += 1;
1099
997
  continue;
1100
998
  }
1101
-
1102
999
  if (cellMeta.readOnly && source !== 'UndoRedo.undo') {
1103
1000
  current.col += 1;
1104
1001
  /* eslint-disable no-continue */
1105
-
1106
1002
  continue;
1107
1003
  }
1108
-
1109
1004
  var visualColumn = c - skippedColumn;
1110
1005
  var value = getInputValue(visualRow, visualColumn);
1111
1006
  var orgValue = instance.getDataAtCell(current.row, current.col);
@@ -1113,29 +1008,25 @@ function Core(rootElement, userSettings) {
1113
1008
  row: visualRow,
1114
1009
  col: visualColumn
1115
1010
  };
1116
-
1117
1011
  if (source === 'Autofill.fill') {
1118
1012
  var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected);
1119
-
1120
1013
  if (result) {
1121
1014
  value = (0, _mixed.isUndefined)(result.value) ? value : result.value;
1122
1015
  }
1123
1016
  }
1124
-
1125
1017
  if (value !== null && _typeof(value) === 'object') {
1126
1018
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
1127
1019
  // an empty array so that the null value can be compared to 'value'
1128
1020
  // as an empty value for the array context
1129
1021
  if (Array.isArray(value) && orgValue === null) orgValue = [];
1130
-
1131
1022
  if (orgValue === null || _typeof(orgValue) !== 'object') {
1132
1023
  pushData = false;
1133
1024
  } else {
1134
1025
  var orgValueSchema = (0, _object.duckSchema)(Array.isArray(orgValue) ? orgValue : orgValue[0] || orgValue);
1135
1026
  var valueSchema = (0, _object.duckSchema)(Array.isArray(value) ? value : value[0] || value);
1136
- /* eslint-disable max-depth */
1137
1027
 
1138
- if ((0, _object.isObjectEqual)(orgValueSchema, valueSchema)) {
1028
+ // Allow overwriting values with the same object-based schema or any array-based schema.
1029
+ if ((0, _object.isObjectEqual)(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
1139
1030
  value = (0, _object.deepClone)(value);
1140
1031
  } else {
1141
1032
  pushData = false;
@@ -1144,23 +1035,20 @@ function Core(rootElement, userSettings) {
1144
1035
  } else if (orgValue !== null && _typeof(orgValue) === 'object') {
1145
1036
  pushData = false;
1146
1037
  }
1147
-
1148
1038
  if (pushData) {
1149
1039
  setData.push([current.row, current.col, value]);
1150
1040
  }
1151
-
1152
1041
  pushData = true;
1153
1042
  current.col += 1;
1154
1043
  }
1155
-
1156
1044
  current.row += 1;
1157
1045
  }
1158
-
1159
1046
  instance.setDataAtCell(setData, null, null, source || 'populateFromArray');
1160
1047
  break;
1161
1048
  }
1162
1049
  }
1163
1050
  };
1051
+
1164
1052
  /**
1165
1053
  * Internal function to set `language` key of settings.
1166
1054
  *
@@ -1168,11 +1056,9 @@ function Core(rootElement, userSettings) {
1168
1056
  * @param {string} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
1169
1057
  * @fires Hooks#afterLanguageChange
1170
1058
  */
1171
-
1172
1059
  function setLanguage(languageCode) {
1173
1060
  var normalizedLanguageCode = (0, _utils.normalizeLanguageCode)(languageCode);
1174
-
1175
- if ((0, _registry4.hasLanguageDictionary)(normalizedLanguageCode)) {
1061
+ if ((0, _registry5.hasLanguageDictionary)(normalizedLanguageCode)) {
1176
1062
  instance.runHooks('beforeLanguageChange', normalizedLanguageCode);
1177
1063
  globalMeta.language = normalizedLanguageCode;
1178
1064
  instance.runHooks('afterLanguageChange', normalizedLanguageCode);
@@ -1180,6 +1066,7 @@ function Core(rootElement, userSettings) {
1180
1066
  (0, _utils.warnUserAboutLanguageRegistration)(languageCode);
1181
1067
  }
1182
1068
  }
1069
+
1183
1070
  /**
1184
1071
  * Internal function to set `className` or `tableClassName`, depending on the key from the settings object.
1185
1072
  *
@@ -1187,69 +1074,63 @@ function Core(rootElement, userSettings) {
1187
1074
  * @param {string} className `className` or `tableClassName` from the key in the settings object.
1188
1075
  * @param {string|string[]} classSettings String or array of strings. Contains class name(s) from settings object.
1189
1076
  */
1190
-
1191
-
1192
1077
  function setClassName(className, classSettings) {
1193
1078
  var element = className === 'className' ? instance.rootElement : instance.table;
1194
-
1195
1079
  if (firstRun) {
1196
1080
  (0, _element.addClass)(element, classSettings);
1197
1081
  } else {
1198
1082
  var globalMetaSettingsArray = [];
1199
1083
  var settingsArray = [];
1200
-
1201
1084
  if (globalMeta[className]) {
1202
1085
  globalMetaSettingsArray = Array.isArray(globalMeta[className]) ? globalMeta[className] : (0, _array.stringToArray)(globalMeta[className]);
1203
1086
  }
1204
-
1205
1087
  if (classSettings) {
1206
1088
  settingsArray = Array.isArray(classSettings) ? classSettings : (0, _array.stringToArray)(classSettings);
1207
1089
  }
1208
-
1209
1090
  var classNameToRemove = (0, _array.getDifferenceOfArrays)(globalMetaSettingsArray, settingsArray);
1210
1091
  var classNameToAdd = (0, _array.getDifferenceOfArrays)(settingsArray, globalMetaSettingsArray);
1211
-
1212
1092
  if (classNameToRemove.length) {
1213
1093
  (0, _element.removeClass)(element, classNameToRemove);
1214
1094
  }
1215
-
1216
1095
  if (classNameToAdd.length) {
1217
1096
  (0, _element.addClass)(element, classNameToAdd);
1218
1097
  }
1219
1098
  }
1220
-
1221
1099
  globalMeta[className] = classSettings;
1222
1100
  }
1223
-
1224
1101
  this.init = function () {
1225
1102
  dataSource.setData(tableMeta.data);
1226
1103
  instance.runHooks('beforeInit');
1227
-
1228
1104
  if ((0, _browser.isMobileBrowser)() || (0, _browser.isIpadOS)()) {
1229
1105
  (0, _element.addClass)(instance.rootElement, 'mobile');
1230
1106
  }
1231
-
1232
1107
  this.updateSettings(tableMeta, true);
1233
1108
  this.view = new _tableView.default(this);
1234
1109
  editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
1235
1110
  instance.runHooks('init');
1236
1111
  this.forceFullRender = true; // used when data was changed
1237
-
1238
1112
  this.view.render();
1239
1113
 
1114
+ // Run the logic only if it's the table's initialization and the root element is not visible.
1115
+ if (!!firstRun && instance.rootElement.offsetParent === null) {
1116
+ (0, _element.observeVisibilityChangeOnce)(instance.rootElement, function () {
1117
+ // Update the spreader size cache before rendering.
1118
+ instance.view._wt.wtOverlays.updateLastSpreaderSize();
1119
+ instance.render();
1120
+ instance.view.adjustElementsSize();
1121
+ });
1122
+ }
1240
1123
  if (_typeof(firstRun) === 'object') {
1241
1124
  instance.runHooks('afterChange', firstRun[0], firstRun[1]);
1242
1125
  firstRun = false;
1243
1126
  }
1244
-
1245
1127
  instance.runHooks('afterInit');
1246
1128
  };
1129
+
1247
1130
  /**
1248
1131
  * @ignore
1249
1132
  * @returns {object}
1250
1133
  */
1251
-
1252
-
1253
1134
  function ValidatorsQueue() {
1254
1135
  // moved this one level up so it can be used in any function here. Probably this should be moved to a separate file
1255
1136
  var resolved = false;
@@ -1273,6 +1154,7 @@ function Core(rootElement, userSettings) {
1273
1154
  }
1274
1155
  };
1275
1156
  }
1157
+
1276
1158
  /**
1277
1159
  * Get parsed number from numeric string.
1278
1160
  *
@@ -1280,51 +1162,40 @@ function Core(rootElement, userSettings) {
1280
1162
  * @param {string} numericData Float (separated by a dot or a comma) or integer.
1281
1163
  * @returns {number} Number if we get data in parsable format, not changed value otherwise.
1282
1164
  */
1283
-
1284
-
1285
1165
  function getParsedNumber(numericData) {
1286
1166
  // Unifying "float like" string. Change from value with comma determiner to value with dot determiner,
1287
1167
  // for example from `450,65` to `450.65`.
1288
1168
  var unifiedNumericData = numericData.replace(',', '.');
1289
-
1290
1169
  if (isNaN(parseFloat(unifiedNumericData)) === false) {
1291
1170
  return parseFloat(unifiedNumericData);
1292
1171
  }
1293
-
1294
1172
  return numericData;
1295
1173
  }
1174
+
1296
1175
  /**
1297
1176
  * @ignore
1298
1177
  * @param {Array} changes The 2D array containing information about each of the edited cells.
1299
1178
  * @param {string} source The string that identifies source of validation.
1300
1179
  * @param {Function} callback The callback function fot async validation.
1301
1180
  */
1302
-
1303
-
1304
1181
  function validateChanges(changes, source, callback) {
1305
1182
  if (!changes.length) {
1306
1183
  return;
1307
1184
  }
1308
-
1309
1185
  var activeEditor = instance.getActiveEditor();
1310
1186
  var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
1311
1187
  var shouldBeCanceled = true;
1312
-
1313
1188
  if (beforeChangeResult === false) {
1314
1189
  if (activeEditor) {
1315
1190
  activeEditor.cancelChanges();
1316
1191
  }
1317
-
1318
1192
  return;
1319
1193
  }
1320
-
1321
1194
  var waitingForValidator = new ValidatorsQueue();
1322
-
1323
1195
  waitingForValidator.onQueueEmpty = function (isValid) {
1324
1196
  if (activeEditor && shouldBeCanceled) {
1325
1197
  activeEditor.cancelChanges();
1326
1198
  }
1327
-
1328
1199
  callback(isValid); // called when async validators are resolved and beforeChange was not async
1329
1200
  };
1330
1201
 
@@ -1333,19 +1204,16 @@ function Core(rootElement, userSettings) {
1333
1204
  changes.splice(i, 1);
1334
1205
  } else {
1335
1206
  var _changes$i = _slicedToArray(changes[i], 4),
1336
- row = _changes$i[0],
1337
- prop = _changes$i[1],
1338
- newValue = _changes$i[3];
1339
-
1207
+ row = _changes$i[0],
1208
+ prop = _changes$i[1],
1209
+ newValue = _changes$i[3];
1340
1210
  var col = datamap.propToCol(prop);
1341
1211
  var cellProperties = instance.getCellMeta(row, col);
1342
-
1343
1212
  if (cellProperties.type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
1344
1213
  changes[i][3] = getParsedNumber(newValue);
1345
1214
  }
1346
- /* eslint-disable no-loop-func */
1347
-
1348
1215
 
1216
+ /* eslint-disable no-loop-func */
1349
1217
  if (instance.getCellValidator(cellProperties)) {
1350
1218
  waitingForValidator.addValidatorToQueue();
1351
1219
  instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
@@ -1353,19 +1221,16 @@ function Core(rootElement, userSettings) {
1353
1221
  if (typeof result !== 'boolean') {
1354
1222
  throw new Error('Validation error: result is not boolean');
1355
1223
  }
1356
-
1357
1224
  if (result === false && cellPropertiesReference.allowInvalid === false) {
1358
1225
  shouldBeCanceled = false;
1359
1226
  changes.splice(index, 1); // cancel the change
1360
-
1361
1227
  cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
1362
1228
 
1363
1229
  var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
1364
-
1365
1230
  if (cell !== null) {
1366
1231
  (0, _element.removeClass)(cell, tableMeta.invalidCellClassName);
1367
- } // index -= 1;
1368
-
1232
+ }
1233
+ // index -= 1;
1369
1234
  }
1370
1235
 
1371
1236
  waitingForValidator.removeValidatorFormQueue();
@@ -1374,9 +1239,9 @@ function Core(rootElement, userSettings) {
1374
1239
  }
1375
1240
  }
1376
1241
  }
1377
-
1378
1242
  waitingForValidator.checkIfQueueIsEmpty();
1379
1243
  }
1244
+
1380
1245
  /**
1381
1246
  * Internal function to apply changes. Called after validateChanges.
1382
1247
  *
@@ -1386,81 +1251,66 @@ function Core(rootElement, userSettings) {
1386
1251
  * @fires Hooks#beforeChangeRender
1387
1252
  * @fires Hooks#afterChange
1388
1253
  */
1389
-
1390
-
1391
1254
  function applyChanges(changes, source) {
1392
1255
  var i = changes.length - 1;
1393
-
1394
1256
  if (i < 0) {
1395
1257
  return;
1396
1258
  }
1397
-
1398
1259
  for (; i >= 0; i--) {
1399
1260
  var skipThisChange = false;
1400
-
1401
1261
  if (changes[i] === null) {
1402
1262
  changes.splice(i, 1);
1403
1263
  /* eslint-disable no-continue */
1404
-
1405
1264
  continue;
1406
1265
  }
1407
-
1408
1266
  if ((changes[i][2] === null || changes[i][2] === void 0) && (changes[i][3] === null || changes[i][3] === void 0)) {
1409
1267
  /* eslint-disable no-continue */
1410
1268
  continue;
1411
1269
  }
1412
-
1413
1270
  if (tableMeta.allowInsertRow) {
1414
1271
  while (changes[i][0] > instance.countRows() - 1) {
1415
- var numberOfCreatedRows = datamap.createRow(void 0, void 0, source);
1416
-
1417
- if (numberOfCreatedRows >= 1) {
1418
- metaManager.createRow(null, numberOfCreatedRows);
1419
- } else {
1272
+ var _datamap$createRow2 = datamap.createRow(void 0, void 0, {
1273
+ source: source
1274
+ }),
1275
+ numberOfCreatedRows = _datamap$createRow2.delta;
1276
+ if (numberOfCreatedRows === 0) {
1420
1277
  skipThisChange = true;
1421
1278
  break;
1422
1279
  }
1423
1280
  }
1424
1281
  }
1425
-
1426
1282
  if (instance.dataType === 'array' && (!tableMeta.columns || tableMeta.columns.length === 0) && tableMeta.allowInsertColumn) {
1427
1283
  while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) {
1428
- var numberOfCreatedColumns = datamap.createCol(void 0, void 0, source);
1429
-
1430
- if (numberOfCreatedColumns >= 1) {
1431
- metaManager.createColumn(null, numberOfCreatedColumns);
1432
- } else {
1284
+ var _datamap$createCol2 = datamap.createCol(void 0, void 0, {
1285
+ source: source
1286
+ }),
1287
+ numberOfCreatedColumns = _datamap$createCol2.delta;
1288
+ if (numberOfCreatedColumns === 0) {
1433
1289
  skipThisChange = true;
1434
1290
  break;
1435
1291
  }
1436
1292
  }
1437
1293
  }
1438
-
1439
1294
  if (skipThisChange) {
1440
1295
  /* eslint-disable no-continue */
1441
1296
  continue;
1442
1297
  }
1443
-
1444
1298
  datamap.set(changes[i][0], changes[i][1], changes[i][3]);
1445
1299
  }
1446
-
1447
1300
  instance.forceFullRender = true; // used when data was changed
1448
-
1449
1301
  grid.adjustRowsAndCols();
1450
1302
  instance.runHooks('beforeChangeRender', changes, source);
1451
1303
  editorManager.lockEditor();
1452
-
1453
1304
  instance._refreshBorders(null);
1454
-
1455
1305
  editorManager.unlockEditor();
1456
1306
  instance.view.adjustElementsSize();
1457
1307
  instance.runHooks('afterChange', changes, source || 'edit');
1458
1308
  var activeEditor = instance.getActiveEditor();
1459
-
1460
1309
  if (activeEditor && (0, _mixed.isDefined)(activeEditor.refreshValue)) {
1461
1310
  activeEditor.refreshValue();
1462
1311
  }
1463
1312
  }
1313
+
1464
1314
  /**
1465
1315
  * Creates and returns the CellCoords object.
1466
1316
  *
@@ -1471,11 +1321,10 @@ function Core(rootElement, userSettings) {
1471
1321
  * @param {number} column The column index.
1472
1322
  * @returns {CellCoords}
1473
1323
  */
1474
-
1475
-
1476
1324
  this._createCellCoords = function (row, column) {
1477
1325
  return instance.view._wt.createCellCoords(row, column);
1478
1326
  };
1327
+
1479
1328
  /**
1480
1329
  * Creates and returns the CellRange object.
1481
1330
  *
@@ -1488,11 +1337,10 @@ function Core(rootElement, userSettings) {
1488
1337
  * @param {CellCoords} to Final coordinates.
1489
1338
  * @returns {CellRange}
1490
1339
  */
1491
-
1492
-
1493
1340
  this._createCellRange = function (highlight, from, to) {
1494
1341
  return instance.view._wt.createCellRange(highlight, from, to);
1495
1342
  };
1343
+
1496
1344
  /**
1497
1345
  * Validate a single cell.
1498
1346
  *
@@ -1503,41 +1351,33 @@ function Core(rootElement, userSettings) {
1503
1351
  * @param {Function} callback The callback function.
1504
1352
  * @param {string} source The string that identifies source of the validation.
1505
1353
  */
1506
-
1507
-
1508
1354
  this.validateCell = function (value, cellProperties, callback, source) {
1509
- var validator = instance.getCellValidator(cellProperties); // the `canBeValidated = false` argument suggests, that the cell passes validation by default.
1355
+ var validator = instance.getCellValidator(cellProperties);
1510
1356
 
1357
+ // the `canBeValidated = false` argument suggests, that the cell passes validation by default.
1511
1358
  /**
1512
1359
  * @private
1513
1360
  * @function done
1514
1361
  * @param {boolean} valid Indicates if the validation was successful.
1515
1362
  * @param {boolean} [canBeValidated=true] Flag which controls the validation process.
1516
1363
  */
1517
-
1518
1364
  function done(valid) {
1519
1365
  var canBeValidated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1520
-
1521
1366
  // Fixes GH#3903
1522
1367
  if (!canBeValidated || cellProperties.hidden === true) {
1523
1368
  callback(valid);
1524
1369
  return;
1525
1370
  }
1526
-
1527
1371
  var col = cellProperties.visualCol;
1528
1372
  var row = cellProperties.visualRow;
1529
1373
  var td = instance.getCell(row, col, true);
1530
-
1531
1374
  if (td && td.nodeName !== 'TH') {
1532
1375
  var renderableRow = instance.rowIndexMapper.getRenderableFromVisualIndex(row);
1533
1376
  var renderableColumn = instance.columnIndexMapper.getRenderableFromVisualIndex(col);
1534
-
1535
1377
  instance.view._wt.getSetting('cellRenderer', renderableRow, renderableColumn, td);
1536
1378
  }
1537
-
1538
1379
  callback(valid);
1539
1380
  }
1540
-
1541
1381
  if ((0, _mixed.isRegExp)(validator)) {
1542
1382
  validator = function (expression) {
1543
1383
  return function (cellValue, validatorCallback) {
@@ -1545,18 +1385,17 @@ function Core(rootElement, userSettings) {
1545
1385
  };
1546
1386
  }(validator);
1547
1387
  }
1548
-
1549
1388
  if ((0, _function.isFunction)(validator)) {
1550
1389
  // eslint-disable-next-line no-param-reassign
1551
- value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source); // To provide consistent behaviour, validation should be always asynchronous
1390
+ value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source);
1552
1391
 
1392
+ // To provide consistent behaviour, validation should be always asynchronous
1553
1393
  instance._registerImmediate(function () {
1554
1394
  validator.call(cellProperties, value, function (valid) {
1555
1395
  if (!instance) {
1556
1396
  return;
1557
- } // eslint-disable-next-line no-param-reassign
1558
-
1559
-
1397
+ }
1398
+ // eslint-disable-next-line no-param-reassign
1560
1399
  valid = instance.runHooks('afterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source);
1561
1400
  cellProperties.valid = valid;
1562
1401
  done(valid);
@@ -1571,6 +1410,7 @@ function Core(rootElement, userSettings) {
1571
1410
  });
1572
1411
  }
1573
1412
  };
1413
+
1574
1414
  /**
1575
1415
  * @ignore
1576
1416
  * @param {number} row The visual row index.
@@ -1578,16 +1418,14 @@ function Core(rootElement, userSettings) {
1578
1418
  * @param {*} value The cell value.
1579
1419
  * @returns {Array}
1580
1420
  */
1581
-
1582
-
1583
1421
  function setDataInputToArray(row, propOrCol, value) {
1584
1422
  if (Array.isArray(row)) {
1585
1423
  // it's an array of changes
1586
1424
  return row;
1587
1425
  }
1588
-
1589
1426
  return [[row, propOrCol, value]];
1590
1427
  }
1428
+
1591
1429
  /**
1592
1430
  * @description
1593
1431
  * Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
@@ -1600,8 +1438,6 @@ function Core(rootElement, userSettings) {
1600
1438
  * @param {string} [value] New value.
1601
1439
  * @param {string} [source] String that identifies how this change will be described in the changes array (useful in afterChange or beforeChange callback). Set to 'edit' if left empty.
1602
1440
  */
1603
-
1604
-
1605
1441
  this.setDataAtCell = function (row, column, value, source) {
1606
1442
  var input = setDataInputToArray(row, column, value);
1607
1443
  var changes = [];
@@ -1609,12 +1445,10 @@ function Core(rootElement, userSettings) {
1609
1445
  var i;
1610
1446
  var ilen;
1611
1447
  var prop;
1612
-
1613
1448
  for (i = 0, ilen = input.length; i < ilen; i++) {
1614
1449
  if (_typeof(input[i]) !== 'object') {
1615
1450
  throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
1616
1451
  }
1617
-
1618
1452
  if (typeof input[i][1] !== 'number') {
1619
1453
  throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); // eslint-disable-line max-len
1620
1454
  }
@@ -1624,19 +1458,17 @@ function Core(rootElement, userSettings) {
1624
1458
  } else {
1625
1459
  prop = datamap.colToProp(input[i][1]);
1626
1460
  }
1627
-
1628
1461
  changes.push([input[i][0], prop, dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1629
1462
  }
1630
-
1631
1463
  if (!changeSource && _typeof(row) === 'object') {
1632
1464
  changeSource = column;
1633
1465
  }
1634
-
1635
1466
  instance.runHooks('afterSetDataAtCell', changes, changeSource);
1636
1467
  validateChanges(changes, changeSource, function () {
1637
1468
  applyChanges(changes, changeSource);
1638
1469
  });
1639
1470
  };
1471
+
1640
1472
  /**
1641
1473
  * @description
1642
1474
  * Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
@@ -1649,28 +1481,24 @@ function Core(rootElement, userSettings) {
1649
1481
  * @param {string} value Value to be set.
1650
1482
  * @param {string} [source] String that identifies how this change will be described in changes array (useful in onChange callback).
1651
1483
  */
1652
-
1653
-
1654
1484
  this.setDataAtRowProp = function (row, prop, value, source) {
1655
1485
  var input = setDataInputToArray(row, prop, value);
1656
1486
  var changes = [];
1657
1487
  var changeSource = source;
1658
1488
  var i;
1659
1489
  var ilen;
1660
-
1661
1490
  for (i = 0, ilen = input.length; i < ilen; i++) {
1662
1491
  changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1663
1492
  }
1664
-
1665
1493
  if (!changeSource && _typeof(row) === 'object') {
1666
1494
  changeSource = prop;
1667
1495
  }
1668
-
1669
1496
  instance.runHooks('afterSetDataAtRowProp', changes, changeSource);
1670
1497
  validateChanges(changes, changeSource, function () {
1671
1498
  applyChanges(changes, changeSource);
1672
1499
  });
1673
1500
  };
1501
+
1674
1502
  /**
1675
1503
  * Listen to the keyboard input on document body. This allows Handsontable to capture keyboard events and respond
1676
1504
  * in the right way.
@@ -1679,14 +1507,13 @@ function Core(rootElement, userSettings) {
1679
1507
  * @function listen
1680
1508
  * @fires Hooks#afterListen
1681
1509
  */
1682
-
1683
-
1684
1510
  this.listen = function () {
1685
1511
  if (instance && !instance.isListening()) {
1686
1512
  activeGuid = instance.guid;
1687
1513
  instance.runHooks('afterListen');
1688
1514
  }
1689
1515
  };
1516
+
1690
1517
  /**
1691
1518
  * Stop listening to keyboard input on the document body. Calling this method makes the Handsontable inactive for
1692
1519
  * any keyboard events.
@@ -1694,14 +1521,13 @@ function Core(rootElement, userSettings) {
1694
1521
  * @memberof Core#
1695
1522
  * @function unlisten
1696
1523
  */
1697
-
1698
-
1699
1524
  this.unlisten = function () {
1700
1525
  if (this.isListening()) {
1701
1526
  activeGuid = null;
1702
1527
  instance.runHooks('afterUnlisten');
1703
1528
  }
1704
1529
  };
1530
+
1705
1531
  /**
1706
1532
  * Returns `true` if the current Handsontable instance is listening to keyboard input on document body.
1707
1533
  *
@@ -1709,11 +1535,10 @@ function Core(rootElement, userSettings) {
1709
1535
  * @function isListening
1710
1536
  * @returns {boolean} `true` if the instance is listening, `false` otherwise.
1711
1537
  */
1712
-
1713
-
1714
1538
  this.isListening = function () {
1715
1539
  return activeGuid === instance.guid;
1716
1540
  };
1541
+
1717
1542
  /**
1718
1543
  * Destroys the current editor, render the table and prepares the editor of the newly selected cell.
1719
1544
  *
@@ -1722,14 +1547,12 @@ function Core(rootElement, userSettings) {
1722
1547
  * @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
1723
1548
  * @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
1724
1549
  */
1725
-
1726
-
1727
1550
  this.destroyEditor = function () {
1728
1551
  var revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1729
1552
  var prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1730
-
1731
1553
  instance._refreshBorders(revertOriginal, prepareEditorIfNeeded);
1732
1554
  };
1555
+
1733
1556
  /**
1734
1557
  * Populates cells at position with 2D input array (e.g. `[[1, 2], [3, 4]]`). Use `endRow`, `endCol` when you
1735
1558
  * want to cut input when a certain row is reached.
@@ -1752,8 +1575,6 @@ function Core(rootElement, userSettings) {
1752
1575
  * Useful **only** when the type of handled cells is `numeric`.
1753
1576
  * @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
1754
1577
  */
1755
-
1756
-
1757
1578
  this.populateFromArray = function (row, column, input, endRow, endCol, source, method, direction, deltas) {
1758
1579
  if (!(_typeof(input) === 'object' && _typeof(input[0]) === 'object')) {
1759
1580
  throw new Error('populateFromArray parameter `input` must be an array of arrays'); // API changed in 0.9-beta2, let's check if you use it correctly
@@ -1762,6 +1583,7 @@ function Core(rootElement, userSettings) {
1762
1583
  var c = typeof endRow === 'number' ? instance._createCellCoords(endRow, endCol) : null;
1763
1584
  return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method, direction, deltas);
1764
1585
  };
1586
+
1765
1587
  /**
1766
1588
  * Adds/removes data from the column. This method works the same as Array.splice for arrays.
1767
1589
  *
@@ -1773,17 +1595,14 @@ function Core(rootElement, userSettings) {
1773
1595
  * @param {...number} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array.
1774
1596
  * @returns {Array} Returns removed portion of columns.
1775
1597
  */
1776
-
1777
-
1778
1598
  this.spliceCol = function (column, index, amount) {
1779
1599
  var _datamap;
1780
-
1781
1600
  for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
1782
1601
  elements[_key - 3] = arguments[_key];
1783
1602
  }
1784
-
1785
1603
  return (_datamap = datamap).spliceCol.apply(_datamap, [column, index, amount].concat(elements));
1786
1604
  };
1605
+
1787
1606
  /**
1788
1607
  * Adds/removes data from the row. This method works the same as Array.splice for arrays.
1789
1608
  *
@@ -1795,17 +1614,14 @@ function Core(rootElement, userSettings) {
1795
1614
  * @param {...number} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array.
1796
1615
  * @returns {Array} Returns removed portion of rows.
1797
1616
  */
1798
-
1799
-
1800
1617
  this.spliceRow = function (row, index, amount) {
1801
1618
  var _datamap2;
1802
-
1803
1619
  for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
1804
1620
  elements[_key2 - 3] = arguments[_key2];
1805
1621
  }
1806
-
1807
1622
  return (_datamap2 = datamap).spliceRow.apply(_datamap2, [row, index, amount].concat(elements));
1808
1623
  };
1624
+
1809
1625
  /**
1810
1626
  * Returns indexes of the currently selected cells as an array of arrays `[[startRow, startCol, endRow, endCol],...]`.
1811
1627
  *
@@ -1819,18 +1635,17 @@ function Core(rootElement, userSettings) {
1819
1635
  * @function getSelected
1820
1636
  * @returns {Array[]|undefined} An array of arrays of the selection's coordinates.
1821
1637
  */
1822
-
1823
-
1824
1638
  this.getSelected = function () {
1825
1639
  // https://github.com/handsontable/handsontable/issues/44 //cjl
1826
1640
  if (selection.isSelected()) {
1827
1641
  return (0, _array.arrayMap)(selection.getSelectedRange(), function (_ref12) {
1828
1642
  var from = _ref12.from,
1829
- to = _ref12.to;
1643
+ to = _ref12.to;
1830
1644
  return [from.row, from.col, to.row, to.col];
1831
1645
  });
1832
1646
  }
1833
1647
  };
1648
+
1834
1649
  /**
1835
1650
  * Returns the last coordinates applied to the table as a an array `[startRow, startCol, endRow, endCol]`.
1836
1651
  *
@@ -1839,18 +1654,15 @@ function Core(rootElement, userSettings) {
1839
1654
  * @function getSelectedLast
1840
1655
  * @returns {Array|undefined} An array of the selection's coordinates.
1841
1656
  */
1842
-
1843
-
1844
1657
  this.getSelectedLast = function () {
1845
1658
  var selected = this.getSelected();
1846
1659
  var result;
1847
-
1848
1660
  if (selected && selected.length > 0) {
1849
1661
  result = selected[selected.length - 1];
1850
1662
  }
1851
-
1852
1663
  return result;
1853
1664
  };
1665
+
1854
1666
  /**
1855
1667
  * Returns the current selection as an array of CellRange objects.
1856
1668
  *
@@ -1862,14 +1674,13 @@ function Core(rootElement, userSettings) {
1862
1674
  * @function getSelectedRange
1863
1675
  * @returns {CellRange[]|undefined} Selected range object or undefined if there is no selection.
1864
1676
  */
1865
-
1866
-
1867
1677
  this.getSelectedRange = function () {
1868
1678
  // https://github.com/handsontable/handsontable/issues/44 //cjl
1869
1679
  if (selection.isSelected()) {
1870
1680
  return Array.from(selection.getSelectedRange());
1871
1681
  }
1872
1682
  };
1683
+
1873
1684
  /**
1874
1685
  * Returns the last coordinates applied to the table as a CellRange object.
1875
1686
  *
@@ -1878,18 +1689,15 @@ function Core(rootElement, userSettings) {
1878
1689
  * @since 0.36.0
1879
1690
  * @returns {CellRange|undefined} Selected range object or undefined` if there is no selection.
1880
1691
  */
1881
-
1882
-
1883
1692
  this.getSelectedRangeLast = function () {
1884
1693
  var selectedRange = this.getSelectedRange();
1885
1694
  var result;
1886
-
1887
1695
  if (selectedRange && selectedRange.length > 0) {
1888
1696
  result = selectedRange[selectedRange.length - 1];
1889
1697
  }
1890
-
1891
1698
  return result;
1892
1699
  };
1700
+
1893
1701
  /**
1894
1702
  * Erases content from cells that have been selected in the table.
1895
1703
  *
@@ -1898,15 +1706,11 @@ function Core(rootElement, userSettings) {
1898
1706
  * @param {string} [source] String that identifies how this change will be described in the changes array (useful in afterChange or beforeChange callback). Set to 'edit' if left empty.
1899
1707
  * @since 0.36.0
1900
1708
  */
1901
-
1902
-
1903
1709
  this.emptySelectedCells = function (source) {
1904
1710
  var _this2 = this;
1905
-
1906
1711
  if (!selection.isSelected() || this.countRows() === 0 || this.countCols() === 0) {
1907
1712
  return;
1908
1713
  }
1909
-
1910
1714
  var changes = [];
1911
1715
  (0, _array.arrayEach)(selection.getSelectedRange(), function (cellRange) {
1912
1716
  var topStart = cellRange.getTopStartCorner();
@@ -1919,11 +1723,11 @@ function Core(rootElement, userSettings) {
1919
1723
  });
1920
1724
  });
1921
1725
  });
1922
-
1923
1726
  if (changes.length > 0) {
1924
1727
  this.setDataAtCell(changes, source);
1925
1728
  }
1926
1729
  };
1730
+
1927
1731
  /**
1928
1732
  * Checks if the table rendering process was suspended. See explanation in {@link Core#suspendRender}.
1929
1733
  *
@@ -1932,11 +1736,10 @@ function Core(rootElement, userSettings) {
1932
1736
  * @since 8.3.0
1933
1737
  * @returns {boolean}
1934
1738
  */
1935
-
1936
-
1937
1739
  this.isRenderSuspended = function () {
1938
1740
  return this.renderSuspendedCounter > 0;
1939
1741
  };
1742
+
1940
1743
  /**
1941
1744
  * Suspends the rendering process. It's helpful to wrap the table render
1942
1745
  * cycles triggered by API calls or UI actions (or both) and call the "render"
@@ -1960,8 +1763,8 @@ function Core(rootElement, userSettings) {
1960
1763
  * @example
1961
1764
  * ```js
1962
1765
  * hot.suspendRender();
1963
- * hot.alter('insert_row', 5, 45);
1964
- * hot.alter('insert_col', 10, 40);
1766
+ * hot.alter('insert_row_above', 5, 45);
1767
+ * hot.alter('insert_col_start', 10, 40);
1965
1768
  * hot.setDataAtCell(1, 1, 'John');
1966
1769
  * hot.setDataAtCell(2, 2, 'Mark');
1967
1770
  * hot.setDataAtCell(3, 3, 'Ann');
@@ -1971,11 +1774,10 @@ function Core(rootElement, userSettings) {
1971
1774
  * hot.resumeRender(); // It re-renders the table internally
1972
1775
  * ```
1973
1776
  */
1974
-
1975
-
1976
1777
  this.suspendRender = function () {
1977
1778
  this.renderSuspendedCounter += 1;
1978
1779
  };
1780
+
1979
1781
  /**
1980
1782
  * Resumes the rendering process. In combination with the {@link Core#suspendRender}
1981
1783
  * method it allows aggregating the table render cycles triggered by API calls or UI
@@ -1995,8 +1797,8 @@ function Core(rootElement, userSettings) {
1995
1797
  * @example
1996
1798
  * ```js
1997
1799
  * hot.suspendRender();
1998
- * hot.alter('insert_row', 5, 45);
1999
- * hot.alter('insert_col', 10, 40);
1800
+ * hot.alter('insert_row_above', 5, 45);
1801
+ * hot.alter('insert_col_start', 10, 40);
2000
1802
  * hot.setDataAtCell(1, 1, 'John');
2001
1803
  * hot.setDataAtCell(2, 2, 'Mark');
2002
1804
  * hot.setDataAtCell(3, 3, 'Ann');
@@ -2006,12 +1808,9 @@ function Core(rootElement, userSettings) {
2006
1808
  * hot.resumeRender(); // It re-renders the table internally
2007
1809
  * ```
2008
1810
  */
2009
-
2010
-
2011
1811
  this.resumeRender = function () {
2012
1812
  var nextValue = this.renderSuspendedCounter - 1;
2013
1813
  this.renderSuspendedCounter = Math.max(nextValue, 0);
2014
-
2015
1814
  if (!this.isRenderSuspended() && nextValue === this.renderSuspendedCounter) {
2016
1815
  if (this.renderCall) {
2017
1816
  this.render();
@@ -2020,6 +1819,7 @@ function Core(rootElement, userSettings) {
2020
1819
  }
2021
1820
  }
2022
1821
  };
1822
+
2023
1823
  /**
2024
1824
  * Rerender the table. Calling this method starts the process of recalculating, redrawing and applying the changes
2025
1825
  * to the DOM. While rendering the table all cell renderers are recalled.
@@ -2030,8 +1830,6 @@ function Core(rootElement, userSettings) {
2030
1830
  * @memberof Core#
2031
1831
  * @function render
2032
1832
  */
2033
-
2034
-
2035
1833
  this.render = function () {
2036
1834
  if (this.view) {
2037
1835
  this.renderCall = true;
@@ -2039,13 +1837,12 @@ function Core(rootElement, userSettings) {
2039
1837
 
2040
1838
  if (!this.isRenderSuspended()) {
2041
1839
  editorManager.lockEditor();
2042
-
2043
1840
  this._refreshBorders(null);
2044
-
2045
1841
  editorManager.unlockEditor();
2046
1842
  }
2047
1843
  }
2048
1844
  };
1845
+
2049
1846
  /**
2050
1847
  * The method aggregates multi-line API calls into a callback and postpones the
2051
1848
  * table rendering process. After the execution of the operations, the table is
@@ -2060,8 +1857,8 @@ function Core(rootElement, userSettings) {
2060
1857
  * @example
2061
1858
  * ```js
2062
1859
  * hot.batchRender(() => {
2063
- * hot.alter('insert_row', 5, 45);
2064
- * hot.alter('insert_col', 10, 40);
1860
+ * hot.alter('insert_row_above', 5, 45);
1861
+ * hot.alter('insert_col_start', 10, 40);
2065
1862
  * hot.setDataAtCell(1, 1, 'John');
2066
1863
  * hot.setDataAtCell(2, 2, 'Mark');
2067
1864
  * hot.setDataAtCell(3, 3, 'Ann');
@@ -2072,14 +1869,13 @@ function Core(rootElement, userSettings) {
2072
1869
  * });
2073
1870
  * ```
2074
1871
  */
2075
-
2076
-
2077
1872
  this.batchRender = function (wrappedOperations) {
2078
1873
  this.suspendRender();
2079
1874
  var result = wrappedOperations();
2080
1875
  this.resumeRender();
2081
1876
  return result;
2082
1877
  };
1878
+
2083
1879
  /**
2084
1880
  * Checks if the table indexes recalculation process was suspended. See explanation
2085
1881
  * in {@link Core#suspendExecution}.
@@ -2089,11 +1885,10 @@ function Core(rootElement, userSettings) {
2089
1885
  * @since 8.3.0
2090
1886
  * @returns {boolean}
2091
1887
  */
2092
-
2093
-
2094
1888
  this.isExecutionSuspended = function () {
2095
1889
  return this.executionSuspendedCounter > 0;
2096
1890
  };
1891
+
2097
1892
  /**
2098
1893
  * Suspends the execution process. It's helpful to wrap the table logic changes
2099
1894
  * such as index changes into one call after which the cache is updated. As a result,
@@ -2116,13 +1911,12 @@ function Core(rootElement, userSettings) {
2116
1911
  * hot.resumeExecution(); // It updates the cache internally
2117
1912
  * ```
2118
1913
  */
2119
-
2120
-
2121
1914
  this.suspendExecution = function () {
2122
1915
  this.executionSuspendedCounter += 1;
2123
1916
  this.columnIndexMapper.suspendOperations();
2124
1917
  this.rowIndexMapper.suspendOperations();
2125
1918
  };
1919
+
2126
1920
  /**
2127
1921
  * Resumes the execution process. In combination with the {@link Core#suspendExecution}
2128
1922
  * method it allows aggregating the table logic changes after which the cache is
@@ -2149,18 +1943,16 @@ function Core(rootElement, userSettings) {
2149
1943
  * hot.resumeExecution(); // It updates the cache internally
2150
1944
  * ```
2151
1945
  */
2152
-
2153
-
2154
1946
  this.resumeExecution = function () {
2155
1947
  var forceFlushChanges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2156
1948
  var nextValue = this.executionSuspendedCounter - 1;
2157
1949
  this.executionSuspendedCounter = Math.max(nextValue, 0);
2158
-
2159
1950
  if (!this.isExecutionSuspended() && nextValue === this.executionSuspendedCounter || forceFlushChanges) {
2160
1951
  this.columnIndexMapper.resumeOperations();
2161
1952
  this.rowIndexMapper.resumeOperations();
2162
1953
  }
2163
1954
  };
1955
+
2164
1956
  /**
2165
1957
  * The method aggregates multi-line API calls into a callback and postpones the
2166
1958
  * table execution process. After the execution of the operations, the internal table
@@ -2187,8 +1979,6 @@ function Core(rootElement, userSettings) {
2187
1979
  * });
2188
1980
  * ```
2189
1981
  */
2190
-
2191
-
2192
1982
  this.batchExecution = function (wrappedOperations) {
2193
1983
  var forceFlushChanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2194
1984
  this.suspendExecution();
@@ -2196,6 +1986,7 @@ function Core(rootElement, userSettings) {
2196
1986
  this.resumeExecution(forceFlushChanges);
2197
1987
  return result;
2198
1988
  };
1989
+
2199
1990
  /**
2200
1991
  * It batches the rendering process and index recalculations. The method aggregates
2201
1992
  * multi-line API calls into a callback and postpones the table rendering process
@@ -2212,8 +2003,8 @@ function Core(rootElement, userSettings) {
2212
2003
  * @example
2213
2004
  * ```js
2214
2005
  * hot.batch(() => {
2215
- * hot.alter('insert_row', 5, 45);
2216
- * hot.alter('insert_col', 10, 40);
2006
+ * hot.alter('insert_row_above', 5, 45);
2007
+ * hot.alter('insert_col_start', 10, 40);
2217
2008
  * hot.setDataAtCell(1, 1, 'x');
2218
2009
  * hot.setDataAtCell(2, 2, 'c');
2219
2010
  * hot.setDataAtCell(3, 3, 'v');
@@ -2230,8 +2021,6 @@ function Core(rootElement, userSettings) {
2230
2021
  * });
2231
2022
  * ```
2232
2023
  */
2233
-
2234
-
2235
2024
  this.batch = function (wrappedOperations) {
2236
2025
  this.suspendRender();
2237
2026
  this.suspendExecution();
@@ -2240,6 +2029,7 @@ function Core(rootElement, userSettings) {
2240
2029
  this.resumeRender();
2241
2030
  return result;
2242
2031
  };
2032
+
2243
2033
  /**
2244
2034
  * Updates dimensions of the table. The method compares previous dimensions with the current ones and updates accordingly.
2245
2035
  *
@@ -2248,21 +2038,16 @@ function Core(rootElement, userSettings) {
2248
2038
  * @fires Hooks#beforeRefreshDimensions
2249
2039
  * @fires Hooks#afterRefreshDimensions
2250
2040
  */
2251
-
2252
-
2253
2041
  this.refreshDimensions = function () {
2254
2042
  if (!instance.view) {
2255
2043
  return;
2256
2044
  }
2257
-
2258
2045
  var _instance$view$getLas = instance.view.getLastSize(),
2259
- lastWidth = _instance$view$getLas.width,
2260
- lastHeight = _instance$view$getLas.height;
2261
-
2046
+ lastWidth = _instance$view$getLas.width,
2047
+ lastHeight = _instance$view$getLas.height;
2262
2048
  var _instance$rootElement = instance.rootElement.getBoundingClientRect(),
2263
- width = _instance$rootElement.width,
2264
- height = _instance$rootElement.height;
2265
-
2049
+ width = _instance$rootElement.width,
2050
+ height = _instance$rootElement.height;
2266
2051
  var isSizeChanged = width !== lastWidth || height !== lastHeight;
2267
2052
  var isResizeBlocked = instance.runHooks('beforeRefreshDimensions', {
2268
2053
  width: lastWidth,
@@ -2271,16 +2056,13 @@ function Core(rootElement, userSettings) {
2271
2056
  width: width,
2272
2057
  height: height
2273
2058
  }, isSizeChanged) === false;
2274
-
2275
2059
  if (isResizeBlocked) {
2276
2060
  return;
2277
2061
  }
2278
-
2279
2062
  if (isSizeChanged || instance.view._wt.wtOverlays.scrollableElement === instance.rootWindow) {
2280
2063
  instance.view.setLastSize(width, height);
2281
2064
  instance.render();
2282
2065
  }
2283
-
2284
2066
  instance.runHooks('afterRefreshDimensions', {
2285
2067
  width: lastWidth,
2286
2068
  height: lastHeight
@@ -2289,6 +2071,7 @@ function Core(rootElement, userSettings) {
2289
2071
  height: height
2290
2072
  }, isSizeChanged);
2291
2073
  };
2074
+
2292
2075
  /**
2293
2076
  * The `updateData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
2294
2077
  *
@@ -2312,11 +2095,8 @@ function Core(rootElement, userSettings) {
2312
2095
  * @fires Hooks#afterUpdateData
2313
2096
  * @fires Hooks#afterChange
2314
2097
  */
2315
-
2316
-
2317
2098
  this.updateData = function (data, source) {
2318
2099
  var _this3 = this;
2319
-
2320
2100
  (0, _dataMap.replaceData)(data, function (newDataMap) {
2321
2101
  datamap = newDataMap;
2322
2102
  }, function (newDataMap) {
@@ -2330,9 +2110,11 @@ function Core(rootElement, userSettings) {
2330
2110
  dataSource: dataSource,
2331
2111
  internalSource: 'updateData',
2332
2112
  source: source,
2113
+ metaManager: metaManager,
2333
2114
  firstRun: firstRun
2334
2115
  });
2335
2116
  };
2117
+
2336
2118
  /**
2337
2119
  * The `loadData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
2338
2120
  *
@@ -2355,8 +2137,6 @@ function Core(rootElement, userSettings) {
2355
2137
  * @fires Hooks#afterLoadData
2356
2138
  * @fires Hooks#afterChange
2357
2139
  */
2358
-
2359
-
2360
2140
  this.loadData = function (data, source) {
2361
2141
  (0, _dataMap.replaceData)(data, function (newDataMap) {
2362
2142
  datamap = newDataMap;
@@ -2364,7 +2144,6 @@ function Core(rootElement, userSettings) {
2364
2144
  metaManager.clearCellsCache();
2365
2145
  instance.initIndexMappers();
2366
2146
  grid.adjustRowsAndCols();
2367
-
2368
2147
  if (firstRun) {
2369
2148
  firstRun = [null, 'loadData'];
2370
2149
  }
@@ -2374,60 +2153,62 @@ function Core(rootElement, userSettings) {
2374
2153
  dataSource: dataSource,
2375
2154
  internalSource: 'loadData',
2376
2155
  source: source,
2156
+ metaManager: metaManager,
2377
2157
  firstRun: firstRun
2378
2158
  });
2379
2159
  };
2160
+
2380
2161
  /**
2381
2162
  * Gets the initial column count, calculated based on the `columns` setting.
2382
2163
  *
2383
2164
  * @private
2384
2165
  * @returns {number} The calculated number of columns.
2385
2166
  */
2386
-
2387
-
2388
2167
  this.getInitialColumnCount = function () {
2389
2168
  var columnsSettings = tableMeta.columns;
2390
- var finalNrOfColumns = 0; // We will check number of columns when the `columns` property was defined as an array. Columns option may
2391
- // narrow down or expand displayed dataset in that case.
2169
+ var finalNrOfColumns = 0;
2392
2170
 
2171
+ // We will check number of columns when the `columns` property was defined as an array. Columns option may
2172
+ // narrow down or expand displayed dataset in that case.
2393
2173
  if (Array.isArray(columnsSettings)) {
2394
2174
  finalNrOfColumns = columnsSettings.length;
2395
2175
  } else if ((0, _function.isFunction)(columnsSettings)) {
2396
2176
  if (instance.dataType === 'array') {
2397
2177
  var nrOfSourceColumns = this.countSourceCols();
2398
-
2399
2178
  for (var columnIndex = 0; columnIndex < nrOfSourceColumns; columnIndex += 1) {
2400
2179
  if (columnsSettings(columnIndex)) {
2401
2180
  finalNrOfColumns += 1;
2402
2181
  }
2403
- } // Extended dataset by the `columns` property? Moved code right from the refactored `countCols` method.
2182
+ }
2404
2183
 
2184
+ // Extended dataset by the `columns` property? Moved code right from the refactored `countCols` method.
2405
2185
  } else if (instance.dataType === 'object' || instance.dataType === 'function') {
2406
2186
  finalNrOfColumns = datamap.colToPropCache.length;
2407
- } // In some cases we need to check columns length from the schema, i.e. `data` may be empty.
2187
+ }
2408
2188
 
2189
+ // In some cases we need to check columns length from the schema, i.e. `data` may be empty.
2409
2190
  } else if ((0, _mixed.isDefined)(tableMeta.dataSchema)) {
2410
- var schema = datamap.getSchema(); // Schema may be defined as an array of objects. Each object will define column.
2191
+ var schema = datamap.getSchema();
2411
2192
 
2193
+ // Schema may be defined as an array of objects. Each object will define column.
2412
2194
  finalNrOfColumns = Array.isArray(schema) ? schema.length : (0, _object.deepObjectSize)(schema);
2413
2195
  } else {
2414
2196
  // We init index mappers by length of source data to provide indexes also for skipped indexes.
2415
2197
  finalNrOfColumns = this.countSourceCols();
2416
2198
  }
2417
-
2418
2199
  return finalNrOfColumns;
2419
2200
  };
2201
+
2420
2202
  /**
2421
2203
  * Init index mapper which manage indexes assigned to the data.
2422
2204
  *
2423
2205
  * @private
2424
2206
  */
2425
-
2426
-
2427
2207
  this.initIndexMappers = function () {
2428
2208
  this.columnIndexMapper.initToLength(this.getInitialColumnCount());
2429
2209
  this.rowIndexMapper.initToLength(this.countSourceRows());
2430
2210
  };
2211
+
2431
2212
  /**
2432
2213
  * Returns the current data object (the same one that was passed by `data` configuration option or `loadData` method,
2433
2214
  * unless some modifications have been applied (i.e. Sequence of rows/columns was changed, some row/column was skipped).
@@ -2452,15 +2233,13 @@ function Core(rootElement, userSettings) {
2452
2233
  * hot.getData(2, 1, 3, 3);
2453
2234
  * ```
2454
2235
  */
2455
-
2456
-
2457
2236
  this.getData = function (row, column, row2, column2) {
2458
2237
  if ((0, _mixed.isUndefined)(row)) {
2459
2238
  return datamap.getAll();
2460
2239
  }
2461
-
2462
2240
  return datamap.getRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), datamap.DESTINATION_RENDERER);
2463
2241
  };
2242
+
2464
2243
  /**
2465
2244
  * Returns a string value of the selected range. Each column is separated by tab, each row is separated by a new
2466
2245
  * line character.
@@ -2473,11 +2252,10 @@ function Core(rootElement, userSettings) {
2473
2252
  * @param {number} endCol To visual column index.
2474
2253
  * @returns {string}
2475
2254
  */
2476
-
2477
-
2478
2255
  this.getCopyableText = function (startRow, startCol, endRow, endCol) {
2479
2256
  return datamap.getCopyableText(instance._createCellCoords(startRow, startCol), instance._createCellCoords(endRow, endCol));
2480
2257
  };
2258
+
2481
2259
  /**
2482
2260
  * Returns the data's copyable value at specified `row` and `column` index.
2483
2261
  *
@@ -2487,11 +2265,10 @@ function Core(rootElement, userSettings) {
2487
2265
  * @param {number} column Visual column index.
2488
2266
  * @returns {string}
2489
2267
  */
2490
-
2491
-
2492
2268
  this.getCopyableData = function (row, column) {
2493
2269
  return datamap.getCopyable(row, datamap.colToProp(column));
2494
2270
  };
2271
+
2495
2272
  /**
2496
2273
  * Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
2497
2274
  * structure in the first row.
@@ -2500,11 +2277,10 @@ function Core(rootElement, userSettings) {
2500
2277
  * @function getSchema
2501
2278
  * @returns {object} Schema object.
2502
2279
  */
2503
-
2504
-
2505
2280
  this.getSchema = function () {
2506
2281
  return datamap.getSchema();
2507
2282
  };
2283
+
2508
2284
  /**
2509
2285
  * Use it if you need to change configuration after initialization. The `settings` argument is an object containing the changed
2510
2286
  * settings, declared the same way as in the initial settings object.
@@ -2533,37 +2309,32 @@ function Core(rootElement, userSettings) {
2533
2309
  * @fires Hooks#afterCellMetaReset
2534
2310
  * @fires Hooks#afterUpdateSettings
2535
2311
  */
2536
-
2537
-
2538
2312
  this.updateSettings = function (settings) {
2539
2313
  var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2540
2314
  var dataUpdateFunction = (firstRun ? instance.loadData : instance.updateData).bind(this);
2541
2315
  var columnsAsFunc = false;
2542
2316
  var i;
2543
2317
  var j;
2544
-
2545
2318
  if ((0, _mixed.isDefined)(settings.rows)) {
2546
2319
  throw new Error('The "rows" setting is no longer supported. Do you mean startRows, minRows or maxRows?');
2547
2320
  }
2548
-
2549
2321
  if ((0, _mixed.isDefined)(settings.cols)) {
2550
2322
  throw new Error('The "cols" setting is no longer supported. Do you mean startCols, minCols or maxCols?');
2551
2323
  }
2552
-
2553
2324
  if ((0, _mixed.isDefined)(settings.ganttChart)) {
2554
2325
  throw new Error('Since 8.0.0 the "ganttChart" setting is no longer supported.');
2555
- } // eslint-disable-next-line no-restricted-syntax
2556
-
2326
+ }
2557
2327
 
2328
+ // eslint-disable-next-line no-restricted-syntax
2558
2329
  for (i in settings) {
2559
- if (i === 'data') {// Do nothing. loadData will be triggered later
2330
+ if (i === 'data') {
2331
+ // Do nothing. loadData will be triggered later
2560
2332
  } else if (i === 'language') {
2561
2333
  setLanguage(settings.language);
2562
2334
  } else if (i === 'className') {
2563
2335
  setClassName('className', settings.className);
2564
2336
  } else if (i === 'tableClassName' && instance.table) {
2565
2337
  setClassName('tableClassName', settings.tableClassName);
2566
-
2567
2338
  instance.view._wt.wtOverlays.syncOverlayTableClassNames();
2568
2339
  } else if (_pluginHooks.default.getSingleton().isRegistered(i) || _pluginHooks.default.getSingleton().isDeprecated(i)) {
2569
2340
  if ((0, _function.isFunction)(settings[i]) || Array.isArray(settings[i])) {
@@ -2574,76 +2345,65 @@ function Core(rootElement, userSettings) {
2574
2345
  // Update settings
2575
2346
  globalMeta[i] = settings[i];
2576
2347
  }
2577
- } // Load data or create data map
2578
-
2348
+ }
2579
2349
 
2350
+ // Load data or create data map
2580
2351
  if (settings.data === void 0 && tableMeta.data === void 0) {
2581
2352
  dataUpdateFunction(null, 'updateSettings'); // data source created just now
2582
2353
  } else if (settings.data !== void 0) {
2583
2354
  dataUpdateFunction(settings.data, 'updateSettings'); // data source given as option
2584
2355
  } else if (settings.columns !== void 0) {
2585
- datamap.createMap(); // The `column` property has changed - dataset may be expanded or narrowed down. The `loadData` do the same.
2356
+ datamap.createMap();
2586
2357
 
2358
+ // The `column` property has changed - dataset may be expanded or narrowed down. The `loadData` do the same.
2587
2359
  instance.initIndexMappers();
2588
2360
  }
2589
-
2590
2361
  var clen = instance.countCols();
2591
- var columnSetting = tableMeta.columns; // Init columns constructors configuration
2362
+ var columnSetting = tableMeta.columns;
2592
2363
 
2364
+ // Init columns constructors configuration
2593
2365
  if (columnSetting && (0, _function.isFunction)(columnSetting)) {
2594
2366
  columnsAsFunc = true;
2595
- } // Clear cell meta cache
2596
-
2367
+ }
2597
2368
 
2369
+ // Clear cell meta cache
2598
2370
  if (settings.cell !== void 0 || settings.cells !== void 0 || settings.columns !== void 0) {
2599
2371
  metaManager.clearCache();
2600
2372
  }
2601
-
2602
2373
  if (clen > 0) {
2603
2374
  for (i = 0, j = 0; i < clen; i++) {
2604
2375
  // Use settings provided by user
2605
2376
  if (columnSetting) {
2606
2377
  var column = columnsAsFunc ? columnSetting(i) : columnSetting[j];
2607
-
2608
2378
  if (column) {
2609
2379
  metaManager.updateColumnMeta(j, column);
2610
2380
  }
2611
2381
  }
2612
-
2613
2382
  j += 1;
2614
2383
  }
2615
2384
  }
2616
-
2617
2385
  if ((0, _mixed.isDefined)(settings.cell)) {
2618
2386
  (0, _object.objectEach)(settings.cell, function (cell) {
2619
2387
  instance.setCellMetaObject(cell.row, cell.col, cell);
2620
2388
  });
2621
2389
  }
2622
-
2623
2390
  instance.runHooks('afterCellMetaReset');
2624
2391
  var currentHeight = instance.rootElement.style.height;
2625
-
2626
2392
  if (currentHeight !== '') {
2627
2393
  currentHeight = parseInt(instance.rootElement.style.height, 10);
2628
2394
  }
2629
-
2630
2395
  var height = settings.height;
2631
-
2632
2396
  if ((0, _function.isFunction)(height)) {
2633
2397
  height = height();
2634
2398
  }
2635
-
2636
2399
  if (init) {
2637
2400
  var initialStyle = instance.rootElement.getAttribute('style');
2638
-
2639
2401
  if (initialStyle) {
2640
2402
  instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style'));
2641
2403
  }
2642
2404
  }
2643
-
2644
2405
  if (height === null) {
2645
2406
  var _initialStyle = instance.rootElement.getAttribute('data-initialstyle');
2646
-
2647
2407
  if (_initialStyle && (_initialStyle.indexOf('height') > -1 || _initialStyle.indexOf('overflow') > -1)) {
2648
2408
  instance.rootElement.setAttribute('style', _initialStyle);
2649
2409
  } else {
@@ -2654,45 +2414,33 @@ function Core(rootElement, userSettings) {
2654
2414
  instance.rootElement.style.height = isNaN(height) ? "".concat(height) : "".concat(height, "px");
2655
2415
  instance.rootElement.style.overflow = 'hidden';
2656
2416
  }
2657
-
2658
2417
  if (typeof settings.width !== 'undefined') {
2659
2418
  var width = settings.width;
2660
-
2661
2419
  if ((0, _function.isFunction)(width)) {
2662
2420
  width = width();
2663
2421
  }
2664
-
2665
2422
  instance.rootElement.style.width = isNaN(width) ? "".concat(width) : "".concat(width, "px");
2666
2423
  }
2667
-
2668
2424
  if (!init) {
2669
2425
  if (instance.view) {
2670
2426
  instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
2671
-
2672
2427
  instance.view._wt.exportSettingsAsClassNames();
2673
2428
  }
2674
-
2675
2429
  instance.runHooks('afterUpdateSettings', settings);
2676
2430
  }
2677
-
2678
2431
  grid.adjustRowsAndCols();
2679
-
2680
2432
  if (instance.view && !firstRun) {
2681
2433
  instance.forceFullRender = true; // used when data was changed
2682
-
2683
2434
  editorManager.lockEditor();
2684
-
2685
2435
  instance._refreshBorders(null);
2686
-
2687
2436
  instance.view._wt.wtOverlays.adjustElementsSize();
2688
-
2689
2437
  editorManager.unlockEditor();
2690
2438
  }
2691
-
2692
2439
  if (!init && instance.view && (currentHeight === '' || height === '' || height === void 0) && currentHeight !== height) {
2693
2440
  instance.view._wt.wtOverlays.updateMainScrollableElements();
2694
2441
  }
2695
2442
  };
2443
+
2696
2444
  /**
2697
2445
  * Get value from the selected cell.
2698
2446
  *
@@ -2700,11 +2448,8 @@ function Core(rootElement, userSettings) {
2700
2448
  * @function getValue
2701
2449
  * @returns {*} Value of selected cell.
2702
2450
  */
2703
-
2704
-
2705
2451
  this.getValue = function () {
2706
2452
  var sel = instance.getSelectedLast();
2707
-
2708
2453
  if (tableMeta.getValue) {
2709
2454
  if ((0, _function.isFunction)(tableMeta.getValue)) {
2710
2455
  return tableMeta.getValue.call(instance);
@@ -2715,6 +2460,7 @@ function Core(rootElement, userSettings) {
2715
2460
  return instance.getDataAtCell(sel[0], sel[1]);
2716
2461
  }
2717
2462
  };
2463
+
2718
2464
  /**
2719
2465
  * Returns the object settings.
2720
2466
  *
@@ -2722,58 +2468,94 @@ function Core(rootElement, userSettings) {
2722
2468
  * @function getSettings
2723
2469
  * @returns {TableMeta} Object containing the current table settings.
2724
2470
  */
2725
-
2726
-
2727
2471
  this.getSettings = function () {
2728
2472
  return tableMeta;
2729
2473
  };
2474
+
2730
2475
  /**
2731
2476
  * Clears the data from the table (the table settings remain intact).
2732
2477
  *
2733
2478
  * @memberof Core#
2734
2479
  * @function clear
2735
2480
  */
2736
-
2737
-
2738
2481
  this.clear = function () {
2739
2482
  this.selectAll();
2740
2483
  this.emptySelectedCells();
2741
2484
  };
2485
+
2742
2486
  /**
2743
- * Allows altering the table structure by either inserting/removing rows or columns.
2744
- * This method works with an array data structure only.
2487
+ * The `alter()` method lets you alter the grid's structure
2488
+ * by adding or removing rows and columns at specified positions.
2489
+ *
2490
+ * ::: tip
2491
+ * The `alter()` method works only when your [`data`](@/api/options.md#data)
2492
+ * is an [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays).
2493
+ * :::
2494
+ *
2495
+ * ```js
2496
+ * // above row 10 (by visual index), insert 1 new row
2497
+ * hot.alter('insert_row_above', 10);
2498
+ * ```
2499
+ *
2500
+ * | Action | With `index` | Without `index` |
2501
+ * | -------------------- | ------------ | --------------- |
2502
+ * | `'insert_row_above'` | Inserts rows above the `index` row. | Inserts rows above the first row. |
2503
+ * | `'insert_row_below'` | Inserts rows below the `index` row. | Inserts rows below the last row. |
2504
+ * | `'remove_row'` | Removes rows, starting from the `index` row. | Removes rows, starting from the last row. |
2505
+ * | `'insert_col_start'` | Inserts columns before the `index` column. | Inserts columns before the first column. |
2506
+ * | `'insert_col_end'` | Inserts columns after the `index` column. | Inserts columns after the last column. |
2507
+ * | `'remove_col'` | Removes columns, starting from the `index` column. | Removes columns, starting from the last column. |
2508
+ * | `'insert_row'` (<b>Deprecated</b>) | Inserts rows above the `index` row. | Inserts rows below the last row. |
2509
+ * | `'insert_col'` (<b>Deprecated</b>) | Inserts columns before the `index` column. | Inserts columns after the last column. |
2510
+ *
2511
+ * The behavior of `'insert_col_start'`, `'insert_col_end'`, and `'insert_col'` depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
2745
2512
  *
2746
2513
  * @memberof Core#
2747
2514
  * @function alter
2748
- * @param {string} action Possible alter operations:
2749
- * <ul>
2750
- * <li> `'insert_row'` </li>
2751
- * <li> `'insert_col'` </li>
2752
- * <li> `'remove_row'` </li>
2515
+ * @param {string} action Available operations:
2516
+ * <ul>
2517
+ * <li> `'insert_row_above'` </li>
2518
+ * <li> `'insert_row_below'` </li>
2519
+ * <li> `'remove_row'` </li> </li>
2520
+ * <li> `'insert_col_start'` </li>
2521
+ * <li> `'insert_col_end'` </li>
2753
2522
  * <li> `'remove_col'` </li>
2754
- * </ul>.
2755
- * @param {number|number[]} index Visual index of the row/column before which the new row/column will be
2756
- * inserted/removed or an array of arrays in format `[[index, amount],...]`.
2757
- * @param {number} [amount=1] Amount of rows/columns to be inserted or removed.
2523
+ * <li> `'insert_row'` (<b>Deprecated</b>) </li>
2524
+ * <li> `'insert_col'` (<b>Deprecated</b>) </li>
2525
+ * </ul>
2526
+ * @param {number|number[]} [index] A visual index of the row/column before or after which the new row/column will be
2527
+ * inserted or removed. Can also be an array of arrays, in format `[[index, amount],...]`.
2528
+ * @param {number} [amount] The amount of rows or columns to be inserted or removed (default: `1`).
2758
2529
  * @param {string} [source] Source indicator.
2759
- * @param {boolean} [keepEmptyRows] Flag for preventing deletion of empty rows.
2530
+ * @param {boolean} [keepEmptyRows] If set to `true`: prevents removing empty rows.
2760
2531
  * @example
2761
2532
  * ```js
2762
- * // Insert new row above the row at given visual index.
2763
- * hot.alter('insert_row', 10);
2764
- * // Insert 3 new columns before 10th column.
2765
- * hot.alter('insert_col', 10, 3);
2766
- * // Remove 2 rows starting from 10th row.
2533
+ * // above row 10 (by visual index), insert 1 new row
2534
+ * hot.alter('insert_row_above', 10);
2535
+ *
2536
+ * // below row 10 (by visual index), insert 3 new rows
2537
+ * hot.alter('insert_row_below', 10, 3);
2538
+ *
2539
+ * // in the LTR layout direction: to the left of column 10 (by visual index), insert 3 new columns
2540
+ * // in the RTL layout direction: to the right of column 10 (by visual index), insert 3 new columns
2541
+ * hot.alter('insert_col_start', 10, 3);
2542
+ *
2543
+ * // in the LTR layout direction: to the right of column 10 (by visual index), insert 1 new column
2544
+ * // in the RTL layout direction: to the left of column 10 (by visual index), insert 1 new column
2545
+ * hot.alter('insert_col_end', 10);
2546
+ *
2547
+ * // remove 2 rows, starting from row 10 (by visual index)
2767
2548
  * hot.alter('remove_row', 10, 2);
2768
- * // Remove 5 non-contiquous rows (it removes 3 rows from visual index 1 and 2 rows from visual index 5).
2549
+ *
2550
+ * // remove 3 rows, starting from row 1 (by visual index)
2551
+ * // remove 2 rows, starting from row 5 (by visual index)
2769
2552
  * hot.alter('remove_row', [[1, 3], [5, 2]]);
2770
2553
  * ```
2771
2554
  */
2772
-
2773
-
2774
2555
  this.alter = function (action, index, amount, source, keepEmptyRows) {
2775
2556
  grid.alter(action, index, amount, source, keepEmptyRows);
2776
2557
  };
2558
+
2777
2559
  /**
2778
2560
  * Returns a TD element for the given `row` and `column` arguments, if it is rendered on screen.
2779
2561
  * Returns `null` if the TD is not rendered on screen (probably because that part of the table is not visible).
@@ -2786,36 +2568,29 @@ function Core(rootElement, userSettings) {
2786
2568
  * if the wanted cell is in the range of fixed rows, it will return a TD element from the `top` overlay.
2787
2569
  * @returns {HTMLTableCellElement|null} The cell's TD element.
2788
2570
  */
2789
-
2790
-
2791
2571
  this.getCell = function (row, column) {
2792
2572
  var topmost = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2793
2573
  var renderableColumnIndex = column; // Handling also column headers.
2794
-
2795
2574
  var renderableRowIndex = row; // Handling also row headers.
2796
2575
 
2797
2576
  if (column >= 0) {
2798
2577
  if (this.columnIndexMapper.isHidden(this.toPhysicalColumn(column))) {
2799
2578
  return null;
2800
2579
  }
2801
-
2802
2580
  renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(column);
2803
2581
  }
2804
-
2805
2582
  if (row >= 0) {
2806
2583
  if (this.rowIndexMapper.isHidden(this.toPhysicalRow(row))) {
2807
2584
  return null;
2808
2585
  }
2809
-
2810
2586
  renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(row);
2811
2587
  }
2812
-
2813
2588
  if (renderableRowIndex === null || renderableColumnIndex === null) {
2814
2589
  return null;
2815
2590
  }
2816
-
2817
2591
  return instance.view.getCellAtCoords(instance._createCellCoords(renderableRowIndex, renderableColumnIndex), topmost);
2818
2592
  };
2593
+
2819
2594
  /**
2820
2595
  * Returns the coordinates of the cell, provided as a HTML table cell element.
2821
2596
  *
@@ -2829,30 +2604,24 @@ function Core(rootElement, userSettings) {
2829
2604
  * // it returns CellCoords object instance with props row: 1 and col: 1.
2830
2605
  * ```
2831
2606
  */
2832
-
2833
-
2834
2607
  this.getCoords = function (element) {
2835
2608
  var renderableCoords = this.view._wt.wtTable.getCoords(element);
2836
-
2837
2609
  if (renderableCoords === null) {
2838
2610
  return null;
2839
2611
  }
2840
-
2841
2612
  var renderableRow = renderableCoords.row,
2842
- renderableColumn = renderableCoords.col;
2613
+ renderableColumn = renderableCoords.col;
2843
2614
  var visualRow = renderableRow;
2844
2615
  var visualColumn = renderableColumn;
2845
-
2846
2616
  if (renderableRow >= 0) {
2847
2617
  visualRow = this.rowIndexMapper.getVisualFromRenderableIndex(renderableRow);
2848
2618
  }
2849
-
2850
2619
  if (renderableColumn >= 0) {
2851
2620
  visualColumn = this.columnIndexMapper.getVisualFromRenderableIndex(renderableColumn);
2852
2621
  }
2853
-
2854
2622
  return instance._createCellCoords(visualRow, visualColumn);
2855
2623
  };
2624
+
2856
2625
  /**
2857
2626
  * Returns the property name that corresponds with the given column index.
2858
2627
  * If the data source is an array of arrays, it returns the columns index.
@@ -2862,11 +2631,10 @@ function Core(rootElement, userSettings) {
2862
2631
  * @param {number} column Visual column index.
2863
2632
  * @returns {string|number} Column property or physical column index.
2864
2633
  */
2865
-
2866
-
2867
2634
  this.colToProp = function (column) {
2868
2635
  return datamap.colToProp(column);
2869
2636
  };
2637
+
2870
2638
  /**
2871
2639
  * Returns column index that corresponds with the given property.
2872
2640
  *
@@ -2875,11 +2643,10 @@ function Core(rootElement, userSettings) {
2875
2643
  * @param {string|number} prop Property name or physical column index.
2876
2644
  * @returns {number} Visual column index.
2877
2645
  */
2878
-
2879
-
2880
2646
  this.propToCol = function (prop) {
2881
2647
  return datamap.propToCol(prop);
2882
2648
  };
2649
+
2883
2650
  /**
2884
2651
  * Translate physical row index into visual.
2885
2652
  *
@@ -2891,11 +2658,10 @@ function Core(rootElement, userSettings) {
2891
2658
  * @param {number} row Physical row index.
2892
2659
  * @returns {number} Returns visual row index.
2893
2660
  */
2894
-
2895
-
2896
2661
  this.toVisualRow = function (row) {
2897
2662
  return _this.rowIndexMapper.getVisualFromPhysicalIndex(row);
2898
2663
  };
2664
+
2899
2665
  /**
2900
2666
  * Translate physical column index into visual.
2901
2667
  *
@@ -2907,11 +2673,10 @@ function Core(rootElement, userSettings) {
2907
2673
  * @param {number} column Physical column index.
2908
2674
  * @returns {number} Returns visual column index.
2909
2675
  */
2910
-
2911
-
2912
2676
  this.toVisualColumn = function (column) {
2913
2677
  return _this.columnIndexMapper.getVisualFromPhysicalIndex(column);
2914
2678
  };
2679
+
2915
2680
  /**
2916
2681
  * Translate visual row index into physical.
2917
2682
  *
@@ -2923,11 +2688,10 @@ function Core(rootElement, userSettings) {
2923
2688
  * @param {number} row Visual row index.
2924
2689
  * @returns {number} Returns physical row index.
2925
2690
  */
2926
-
2927
-
2928
2691
  this.toPhysicalRow = function (row) {
2929
2692
  return _this.rowIndexMapper.getPhysicalFromVisualIndex(row);
2930
2693
  };
2694
+
2931
2695
  /**
2932
2696
  * Translate visual column index into physical.
2933
2697
  *
@@ -2939,11 +2703,10 @@ function Core(rootElement, userSettings) {
2939
2703
  * @param {number} column Visual column index.
2940
2704
  * @returns {number} Returns physical column index.
2941
2705
  */
2942
-
2943
-
2944
2706
  this.toPhysicalColumn = function (column) {
2945
2707
  return _this.columnIndexMapper.getPhysicalFromVisualIndex(column);
2946
2708
  };
2709
+
2947
2710
  /**
2948
2711
  * @description
2949
2712
  * Returns the cell value at `row`, `column`.
@@ -2956,11 +2719,10 @@ function Core(rootElement, userSettings) {
2956
2719
  * @param {number} column Visual column index.
2957
2720
  * @returns {*} Data at cell.
2958
2721
  */
2959
-
2960
-
2961
2722
  this.getDataAtCell = function (row, column) {
2962
2723
  return datamap.get(row, datamap.colToProp(column));
2963
2724
  };
2725
+
2964
2726
  /**
2965
2727
  * Returns value at visual `row` and `prop` indexes.
2966
2728
  *
@@ -2972,11 +2734,10 @@ function Core(rootElement, userSettings) {
2972
2734
  * @param {string} prop Property name.
2973
2735
  * @returns {*} Cell value.
2974
2736
  */
2975
-
2976
-
2977
2737
  this.getDataAtRowProp = function (row, prop) {
2978
2738
  return datamap.get(row, prop);
2979
2739
  };
2740
+
2980
2741
  /**
2981
2742
  * @description
2982
2743
  * Returns array of column values from the data source.
@@ -2988,13 +2749,11 @@ function Core(rootElement, userSettings) {
2988
2749
  * @param {number} column Visual column index.
2989
2750
  * @returns {Array} Array of cell values.
2990
2751
  */
2991
-
2992
-
2993
2752
  this.getDataAtCol = function (column) {
2994
2753
  var _ref13;
2995
-
2996
2754
  return (_ref13 = []).concat.apply(_ref13, _toConsumableArray(datamap.getRange(instance._createCellCoords(0, column), instance._createCellCoords(tableMeta.data.length - 1, column), datamap.DESTINATION_RENDERER)));
2997
2755
  };
2756
+
2998
2757
  /**
2999
2758
  * Given the object property name (e.g. `'first.name'` or `'0'`), returns an array of column's values from the table data.
3000
2759
  * You can also provide a column index as the first argument.
@@ -3005,14 +2764,12 @@ function Core(rootElement, userSettings) {
3005
2764
  * @returns {Array} Array of cell values.
3006
2765
  */
3007
2766
  // TODO: Getting data from `datamap` should work on visual indexes.
3008
-
3009
-
3010
2767
  this.getDataAtProp = function (prop) {
3011
2768
  var _ref14;
3012
-
3013
2769
  var range = datamap.getRange(instance._createCellCoords(0, datamap.propToCol(prop)), instance._createCellCoords(tableMeta.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER);
3014
2770
  return (_ref14 = []).concat.apply(_ref14, _toConsumableArray(range));
3015
2771
  };
2772
+
3016
2773
  /**
3017
2774
  * Returns a clone of the source data object.
3018
2775
  * Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
@@ -3029,19 +2786,16 @@ function Core(rootElement, userSettings) {
3029
2786
  * @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
3030
2787
  * @returns {Array[]|object[]} The table data.
3031
2788
  */
3032
-
3033
-
3034
2789
  this.getSourceData = function (row, column, row2, column2) {
3035
2790
  var data;
3036
-
3037
2791
  if (row === void 0) {
3038
2792
  data = dataSource.getData();
3039
2793
  } else {
3040
2794
  data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2));
3041
2795
  }
3042
-
3043
2796
  return data;
3044
2797
  };
2798
+
3045
2799
  /**
3046
2800
  * Returns the source data object as an arrays of arrays format even when source data was provided in another format.
3047
2801
  * Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
@@ -3058,19 +2812,16 @@ function Core(rootElement, userSettings) {
3058
2812
  * @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
3059
2813
  * @returns {Array} An array of arrays.
3060
2814
  */
3061
-
3062
-
3063
2815
  this.getSourceDataArray = function (row, column, row2, column2) {
3064
2816
  var data;
3065
-
3066
2817
  if (row === void 0) {
3067
2818
  data = dataSource.getData(true);
3068
2819
  } else {
3069
2820
  data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), true);
3070
2821
  }
3071
-
3072
2822
  return data;
3073
2823
  };
2824
+
3074
2825
  /**
3075
2826
  * Returns an array of column values from the data source.
3076
2827
  *
@@ -3080,13 +2831,11 @@ function Core(rootElement, userSettings) {
3080
2831
  * @returns {Array} Array of the column's cell values.
3081
2832
  */
3082
2833
  // TODO: Getting data from `sourceData` should work always on physical indexes.
3083
-
3084
-
3085
2834
  this.getSourceDataAtCol = function (column) {
3086
2835
  return dataSource.getAtColumn(column);
3087
2836
  };
3088
- /* eslint-disable jsdoc/require-param */
3089
2837
 
2838
+ /* eslint-disable jsdoc/require-param */
3090
2839
  /**
3091
2840
  * Set the provided value in the source data set at the provided coordinates.
3092
2841
  *
@@ -3097,47 +2846,39 @@ function Core(rootElement, userSettings) {
3097
2846
  * @param {*} value The value to be set at the provided coordinates.
3098
2847
  * @param {string} [source] Source of the change as a string.
3099
2848
  */
3100
-
3101
2849
  /* eslint-enable jsdoc/require-param */
3102
-
3103
-
3104
2850
  this.setSourceDataAtCell = function (row, column, value, source) {
3105
2851
  var input = setDataInputToArray(row, column, value);
3106
2852
  var isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
3107
2853
  var changesForHook = [];
3108
-
3109
2854
  if (isThereAnySetSourceListener) {
3110
2855
  (0, _array.arrayEach)(input, function (_ref15) {
3111
2856
  var _ref16 = _slicedToArray(_ref15, 3),
3112
- changeRow = _ref16[0],
3113
- changeProp = _ref16[1],
3114
- changeValue = _ref16[2];
3115
-
3116
- changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp), // The previous value.
2857
+ changeRow = _ref16[0],
2858
+ changeProp = _ref16[1],
2859
+ changeValue = _ref16[2];
2860
+ changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp),
2861
+ // The previous value.
3117
2862
  changeValue]);
3118
2863
  });
3119
2864
  }
3120
-
3121
2865
  (0, _array.arrayEach)(input, function (_ref17) {
3122
2866
  var _ref18 = _slicedToArray(_ref17, 3),
3123
- changeRow = _ref18[0],
3124
- changeProp = _ref18[1],
3125
- changeValue = _ref18[2];
3126
-
2867
+ changeRow = _ref18[0],
2868
+ changeProp = _ref18[1],
2869
+ changeValue = _ref18[2];
3127
2870
  dataSource.setAtCell(changeRow, changeProp, changeValue);
3128
2871
  });
3129
-
3130
2872
  if (isThereAnySetSourceListener) {
3131
2873
  this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
3132
2874
  }
3133
-
3134
2875
  this.render();
3135
2876
  var activeEditor = instance.getActiveEditor();
3136
-
3137
2877
  if (activeEditor && (0, _mixed.isDefined)(activeEditor.refreshValue)) {
3138
2878
  activeEditor.refreshValue();
3139
2879
  }
3140
2880
  };
2881
+
3141
2882
  /**
3142
2883
  * Returns a single row of the data (array or object, depending on what data format you use).
3143
2884
  *
@@ -3149,11 +2890,10 @@ function Core(rootElement, userSettings) {
3149
2890
  * @param {number} row Physical row index.
3150
2891
  * @returns {Array|object} Single row of data.
3151
2892
  */
3152
-
3153
-
3154
2893
  this.getSourceDataAtRow = function (row) {
3155
2894
  return dataSource.getAtRow(row);
3156
2895
  };
2896
+
3157
2897
  /**
3158
2898
  * Returns a single value from the data source.
3159
2899
  *
@@ -3164,11 +2904,10 @@ function Core(rootElement, userSettings) {
3164
2904
  * @returns {*} Cell data.
3165
2905
  */
3166
2906
  // TODO: Getting data from `sourceData` should work always on physical indexes.
3167
-
3168
-
3169
2907
  this.getSourceDataAtCell = function (row, column) {
3170
2908
  return dataSource.getAtCell(row, column);
3171
2909
  };
2910
+
3172
2911
  /**
3173
2912
  * @description
3174
2913
  * Returns a single row of the data.
@@ -3180,12 +2919,11 @@ function Core(rootElement, userSettings) {
3180
2919
  * @param {number} row Visual row index.
3181
2920
  * @returns {Array} Array of row's cell data.
3182
2921
  */
3183
-
3184
-
3185
2922
  this.getDataAtRow = function (row) {
3186
2923
  var data = datamap.getRange(instance._createCellCoords(row, 0), instance._createCellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER);
3187
2924
  return data[0] || [];
3188
2925
  };
2926
+
3189
2927
  /**
3190
2928
  * @description
3191
2929
  * Returns a data type defined in the Handsontable settings under the `type` key ({@link Options#type}).
@@ -3201,41 +2939,32 @@ function Core(rootElement, userSettings) {
3201
2939
  * @param {number} columnTo To visual column index.
3202
2940
  * @returns {string} Cell type (e.q: `'mixed'`, `'text'`, `'numeric'`, `'autocomplete'`).
3203
2941
  */
3204
-
3205
-
3206
2942
  this.getDataType = function (rowFrom, columnFrom, rowTo, columnTo) {
3207
2943
  var _this4 = this;
3208
-
3209
2944
  var coords = rowFrom === void 0 ? [0, 0, this.countRows(), this.countCols()] : [rowFrom, columnFrom, rowTo, columnTo];
3210
2945
  var rowStart = coords[0],
3211
- columnStart = coords[1];
2946
+ columnStart = coords[1];
3212
2947
  var rowEnd = coords[2],
3213
- columnEnd = coords[3];
2948
+ columnEnd = coords[3];
3214
2949
  var previousType = null;
3215
2950
  var currentType = null;
3216
-
3217
2951
  if (rowEnd === void 0) {
3218
2952
  rowEnd = rowStart;
3219
2953
  }
3220
-
3221
2954
  if (columnEnd === void 0) {
3222
2955
  columnEnd = columnStart;
3223
2956
  }
3224
-
3225
2957
  var type = 'mixed';
3226
2958
  (0, _number.rangeEach)(Math.max(Math.min(rowStart, rowEnd), 0), Math.max(rowStart, rowEnd), function (row) {
3227
2959
  var isTypeEqual = true;
3228
2960
  (0, _number.rangeEach)(Math.max(Math.min(columnStart, columnEnd), 0), Math.max(columnStart, columnEnd), function (column) {
3229
2961
  var cellType = _this4.getCellMeta(row, column);
3230
-
3231
2962
  currentType = cellType.type;
3232
-
3233
2963
  if (previousType) {
3234
2964
  isTypeEqual = previousType === currentType;
3235
2965
  } else {
3236
2966
  previousType = currentType;
3237
2967
  }
3238
-
3239
2968
  return isTypeEqual;
3240
2969
  });
3241
2970
  type = isTypeEqual ? currentType : 'mixed';
@@ -3243,6 +2972,7 @@ function Core(rootElement, userSettings) {
3243
2972
  });
3244
2973
  return type;
3245
2974
  };
2975
+
3246
2976
  /**
3247
2977
  * Remove a property defined by the `key` argument from the cell meta object for the provided `row` and `column` coordinates.
3248
2978
  *
@@ -3254,22 +2984,19 @@ function Core(rootElement, userSettings) {
3254
2984
  * @fires Hooks#beforeRemoveCellMeta
3255
2985
  * @fires Hooks#afterRemoveCellMeta
3256
2986
  */
3257
-
3258
-
3259
2987
  this.removeCellMeta = function (row, column, key) {
3260
2988
  var _ref19 = [this.toPhysicalRow(row), this.toPhysicalColumn(column)],
3261
- physicalRow = _ref19[0],
3262
- physicalColumn = _ref19[1];
2989
+ physicalRow = _ref19[0],
2990
+ physicalColumn = _ref19[1];
3263
2991
  var cachedValue = metaManager.getCellMetaKeyValue(physicalRow, physicalColumn, key);
3264
2992
  var hookResult = instance.runHooks('beforeRemoveCellMeta', row, column, key, cachedValue);
3265
-
3266
2993
  if (hookResult !== false) {
3267
2994
  metaManager.removeCellMeta(physicalRow, physicalColumn, key);
3268
2995
  instance.runHooks('afterRemoveCellMeta', row, column, key, cachedValue);
3269
2996
  }
3270
-
3271
2997
  cachedValue = null;
3272
2998
  };
2999
+
3273
3000
  /**
3274
3001
  * Removes or adds one or more rows of the cell meta objects to the cell meta collections.
3275
3002
  *
@@ -3280,25 +3007,18 @@ function Core(rootElement, userSettings) {
3280
3007
  * @param {number} [deleteAmount=0] The number of items to be removed. If set to 0, no cell meta objects will be removed.
3281
3008
  * @param {...object} [cellMetaRows] The new cell meta row objects to be added to the cell meta collection.
3282
3009
  */
3283
-
3284
-
3285
3010
  this.spliceCellsMeta = function (visualIndex) {
3286
3011
  var _this5 = this;
3287
-
3288
3012
  var deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3289
-
3290
3013
  for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
3291
3014
  cellMetaRows[_key3 - 2] = arguments[_key3];
3292
3015
  }
3293
-
3294
3016
  if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
3295
3017
  throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
3296
3018
  }
3297
-
3298
3019
  if (deleteAmount > 0) {
3299
3020
  metaManager.removeRow(this.toPhysicalRow(visualIndex), deleteAmount);
3300
3021
  }
3301
-
3302
3022
  if (cellMetaRows.length > 0) {
3303
3023
  (0, _array.arrayEach)(cellMetaRows.reverse(), function (cellMetaRow) {
3304
3024
  metaManager.createRow(_this5.toPhysicalRow(visualIndex));
@@ -3307,9 +3027,9 @@ function Core(rootElement, userSettings) {
3307
3027
  });
3308
3028
  });
3309
3029
  }
3310
-
3311
3030
  instance.render();
3312
3031
  };
3032
+
3313
3033
  /**
3314
3034
  * Set cell meta data object defined by `prop` to the corresponding params `row` and `column`.
3315
3035
  *
@@ -3319,17 +3039,15 @@ function Core(rootElement, userSettings) {
3319
3039
  * @param {number} column Visual column index.
3320
3040
  * @param {object} prop Meta object.
3321
3041
  */
3322
-
3323
-
3324
3042
  this.setCellMetaObject = function (row, column, prop) {
3325
3043
  var _this6 = this;
3326
-
3327
3044
  if (_typeof(prop) === 'object') {
3328
3045
  (0, _object.objectEach)(prop, function (value, key) {
3329
3046
  _this6.setCellMeta(row, column, key, value);
3330
3047
  });
3331
3048
  }
3332
3049
  };
3050
+
3333
3051
  /**
3334
3052
  * Sets a property defined by the `key` property to the meta object of a cell corresponding to params `row` and `column`.
3335
3053
  *
@@ -3342,29 +3060,23 @@ function Core(rootElement, userSettings) {
3342
3060
  * @fires Hooks#beforeSetCellMeta
3343
3061
  * @fires Hooks#afterSetCellMeta
3344
3062
  */
3345
-
3346
-
3347
3063
  this.setCellMeta = function (row, column, key, value) {
3348
3064
  var allowSetCellMeta = instance.runHooks('beforeSetCellMeta', row, column, key, value);
3349
-
3350
3065
  if (allowSetCellMeta === false) {
3351
3066
  return;
3352
3067
  }
3353
-
3354
3068
  var physicalRow = row;
3355
3069
  var physicalColumn = column;
3356
-
3357
3070
  if (row < this.countRows()) {
3358
3071
  physicalRow = this.toPhysicalRow(row);
3359
3072
  }
3360
-
3361
3073
  if (column < this.countCols()) {
3362
3074
  physicalColumn = this.toPhysicalColumn(column);
3363
3075
  }
3364
-
3365
3076
  metaManager.setCellMeta(physicalRow, physicalColumn, key, value);
3366
3077
  instance.runHooks('afterSetCellMeta', row, column, key, value);
3367
3078
  };
3079
+
3368
3080
  /**
3369
3081
  * Get all the cells meta settings at least once generated in the table (in order of cell initialization).
3370
3082
  *
@@ -3372,11 +3084,10 @@ function Core(rootElement, userSettings) {
3372
3084
  * @function getCellsMeta
3373
3085
  * @returns {Array} Returns an array of ColumnSettings object instances.
3374
3086
  */
3375
-
3376
-
3377
3087
  this.getCellsMeta = function () {
3378
3088
  return metaManager.getCellsMeta();
3379
3089
  };
3090
+
3380
3091
  /**
3381
3092
  * Returns the cell properties object for the given `row` and `column` coordinates.
3382
3093
  *
@@ -3388,25 +3099,21 @@ function Core(rootElement, userSettings) {
3388
3099
  * @fires Hooks#beforeGetCellMeta
3389
3100
  * @fires Hooks#afterGetCellMeta
3390
3101
  */
3391
-
3392
-
3393
3102
  this.getCellMeta = function (row, column) {
3394
3103
  var physicalRow = this.toPhysicalRow(row);
3395
3104
  var physicalColumn = this.toPhysicalColumn(column);
3396
-
3397
3105
  if (physicalRow === null) {
3398
3106
  physicalRow = row;
3399
3107
  }
3400
-
3401
3108
  if (physicalColumn === null) {
3402
3109
  physicalColumn = column;
3403
3110
  }
3404
-
3405
3111
  return metaManager.getCellMeta(physicalRow, physicalColumn, {
3406
3112
  visualRow: row,
3407
3113
  visualColumn: column
3408
3114
  });
3409
3115
  };
3116
+
3410
3117
  /**
3411
3118
  * Returns an array of cell meta objects for specified physical row index.
3412
3119
  *
@@ -3415,11 +3122,10 @@ function Core(rootElement, userSettings) {
3415
3122
  * @param {number} row Physical row index.
3416
3123
  * @returns {Array}
3417
3124
  */
3418
-
3419
-
3420
3125
  this.getCellMetaAtRow = function (row) {
3421
3126
  return metaManager.getCellsMetaAtRow(row);
3422
3127
  };
3128
+
3423
3129
  /**
3424
3130
  * Checks if the data format and config allows user to modify the column structure.
3425
3131
  *
@@ -3427,21 +3133,18 @@ function Core(rootElement, userSettings) {
3427
3133
  * @function isColumnModificationAllowed
3428
3134
  * @returns {boolean}
3429
3135
  */
3430
-
3431
-
3432
3136
  this.isColumnModificationAllowed = function () {
3433
3137
  return !(instance.dataType === 'object' || tableMeta.columns);
3434
3138
  };
3435
3139
 
3436
- var rendererLookup = (0, _data.cellMethodLookupFactory)('renderer');
3437
3140
  /**
3438
3141
  * Returns the cell renderer function by given `row` and `column` arguments.
3439
3142
  *
3440
3143
  * @memberof Core#
3441
3144
  * @function getCellRenderer
3442
- * @param {number|object} row Visual row index or cell meta object (see {@link Core#getCellMeta}).
3145
+ * @param {number|object} rowOrMeta Visual row index or cell meta object (see {@link Core#getCellMeta}).
3443
3146
  * @param {number} column Visual column index.
3444
- * @returns {Function} The renderer function.
3147
+ * @returns {Function} Returns the renderer function.
3445
3148
  * @example
3446
3149
  * ```js
3447
3150
  * // Get cell renderer using `row` and `column` coordinates.
@@ -3450,18 +3153,22 @@ function Core(rootElement, userSettings) {
3450
3153
  * hot.getCellRenderer(hot.getCellMeta(1, 1));
3451
3154
  * ```
3452
3155
  */
3453
-
3454
- this.getCellRenderer = function (row, column) {
3455
- return (0, _registry2.getRenderer)(rendererLookup.call(this, row, column));
3156
+ this.getCellRenderer = function (rowOrMeta, column) {
3157
+ var cellRenderer = typeof rowOrMeta === 'number' ? instance.getCellMeta(rowOrMeta, column).renderer : rowOrMeta.renderer;
3158
+ if (typeof cellRenderer === 'string') {
3159
+ return (0, _registry2.getRenderer)(cellRenderer);
3160
+ }
3161
+ return (0, _mixed.isUndefined)(cellRenderer) ? (0, _registry2.getRenderer)('text') : cellRenderer;
3456
3162
  };
3163
+
3457
3164
  /**
3458
3165
  * Returns the cell editor class by the provided `row` and `column` arguments.
3459
3166
  *
3460
3167
  * @memberof Core#
3461
3168
  * @function getCellEditor
3462
- * @param {number} row Visual row index or cell meta object (see {@link Core#getCellMeta}).
3169
+ * @param {number} rowOrMeta Visual row index or cell meta object (see {@link Core#getCellMeta}).
3463
3170
  * @param {number} column Visual column index.
3464
- * @returns {Function} The editor class.
3171
+ * @returns {Function|boolean} Returns the editor class or `false` is cell editor is disabled.
3465
3172
  * @example
3466
3173
  * ```js
3467
3174
  * // Get cell editor class using `row` and `column` coordinates.
@@ -3470,36 +3177,38 @@ function Core(rootElement, userSettings) {
3470
3177
  * hot.getCellEditor(hot.getCellMeta(1, 1));
3471
3178
  * ```
3472
3179
  */
3180
+ this.getCellEditor = function (rowOrMeta, column) {
3181
+ var cellEditor = typeof rowOrMeta === 'number' ? instance.getCellMeta(rowOrMeta, column).editor : rowOrMeta.editor;
3182
+ if (typeof cellEditor === 'string') {
3183
+ return (0, _registry3.getEditor)(cellEditor);
3184
+ }
3185
+ return (0, _mixed.isUndefined)(cellEditor) ? (0, _registry3.getEditor)('text') : cellEditor;
3186
+ };
3473
3187
 
3474
-
3475
- this.getCellEditor = (0, _data.cellMethodLookupFactory)('editor');
3476
- var validatorLookup = (0, _data.cellMethodLookupFactory)('validator');
3477
3188
  /**
3478
3189
  * Returns the cell validator by `row` and `column`.
3479
3190
  *
3480
3191
  * @memberof Core#
3481
3192
  * @function getCellValidator
3482
- * @param {number|object} row Visual row index or cell meta object (see {@link Core#getCellMeta}).
3193
+ * @param {number|object} rowOrMeta Visual row index or cell meta object (see {@link Core#getCellMeta}).
3483
3194
  * @param {number} column Visual column index.
3484
3195
  * @returns {Function|RegExp|undefined} The validator function.
3485
3196
  * @example
3486
3197
  * ```js
3487
- * // Get cell valiator using `row` and `column` coordinates.
3198
+ * // Get cell validator using `row` and `column` coordinates.
3488
3199
  * hot.getCellValidator(1, 1);
3489
- * // Get cell valiator using cell meta object.
3200
+ * // Get cell validator using cell meta object.
3490
3201
  * hot.getCellValidator(hot.getCellMeta(1, 1));
3491
3202
  * ```
3492
3203
  */
3493
-
3494
- this.getCellValidator = function (row, column) {
3495
- var validator = validatorLookup.call(this, row, column);
3496
-
3497
- if (typeof validator === 'string') {
3498
- validator = (0, _registry3.getValidator)(validator);
3204
+ this.getCellValidator = function (rowOrMeta, column) {
3205
+ var cellValidator = typeof rowOrMeta === 'number' ? instance.getCellMeta(rowOrMeta, column).validator : rowOrMeta.validator;
3206
+ if (typeof cellValidator === 'string') {
3207
+ return (0, _registry4.getValidator)(cellValidator);
3499
3208
  }
3500
-
3501
- return validator;
3209
+ return cellValidator;
3502
3210
  };
3211
+
3503
3212
  /**
3504
3213
  * Validates all cells using their validator functions and calls callback when finished.
3505
3214
  *
@@ -3518,11 +3227,10 @@ function Core(rootElement, userSettings) {
3518
3227
  * })
3519
3228
  * ```
3520
3229
  */
3521
-
3522
-
3523
3230
  this.validateCells = function (callback) {
3524
3231
  this._validateCells(callback);
3525
3232
  };
3233
+
3526
3234
  /**
3527
3235
  * Validates rows using their validator functions and calls callback when finished.
3528
3236
  *
@@ -3542,15 +3250,13 @@ function Core(rootElement, userSettings) {
3542
3250
  * })
3543
3251
  * ```
3544
3252
  */
3545
-
3546
-
3547
3253
  this.validateRows = function (rows, callback) {
3548
3254
  if (!Array.isArray(rows)) {
3549
3255
  throw new Error('validateRows parameter `rows` must be an array');
3550
3256
  }
3551
-
3552
3257
  this._validateCells(callback, rows);
3553
3258
  };
3259
+
3554
3260
  /**
3555
3261
  * Validates columns using their validator functions and calls callback when finished.
3556
3262
  *
@@ -3570,15 +3276,13 @@ function Core(rootElement, userSettings) {
3570
3276
  * })
3571
3277
  * ```
3572
3278
  */
3573
-
3574
-
3575
3279
  this.validateColumns = function (columns, callback) {
3576
3280
  if (!Array.isArray(columns)) {
3577
3281
  throw new Error('validateColumns parameter `columns` must be an array');
3578
3282
  }
3579
-
3580
3283
  this._validateCells(callback, undefined, columns);
3581
3284
  };
3285
+
3582
3286
  /**
3583
3287
  * Validates all cells using their validator functions and calls callback when finished.
3584
3288
  *
@@ -3593,51 +3297,40 @@ function Core(rootElement, userSettings) {
3593
3297
  * @param {Array} [rows] An array of validation target visual row indexes.
3594
3298
  * @param {Array} [columns] An array of validation target visual column indexes.
3595
3299
  */
3596
-
3597
-
3598
3300
  this._validateCells = function (callback, rows, columns) {
3599
3301
  var waitingForValidator = new ValidatorsQueue();
3600
-
3601
3302
  if (callback) {
3602
3303
  waitingForValidator.onQueueEmpty = callback;
3603
3304
  }
3604
-
3605
3305
  var i = instance.countRows() - 1;
3606
-
3607
3306
  while (i >= 0) {
3608
3307
  if (rows !== undefined && rows.indexOf(i) === -1) {
3609
3308
  i -= 1;
3610
3309
  continue;
3611
3310
  }
3612
-
3613
3311
  var j = instance.countCols() - 1;
3614
-
3615
3312
  while (j >= 0) {
3616
3313
  if (columns !== undefined && columns.indexOf(j) === -1) {
3617
3314
  j -= 1;
3618
3315
  continue;
3619
3316
  }
3620
-
3621
3317
  waitingForValidator.addValidatorToQueue();
3622
3318
  instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function (result) {
3623
3319
  if (typeof result !== 'boolean') {
3624
3320
  throw new Error('Validation error: result is not boolean');
3625
3321
  }
3626
-
3627
3322
  if (result === false) {
3628
3323
  waitingForValidator.valid = false;
3629
3324
  }
3630
-
3631
3325
  waitingForValidator.removeValidatorFormQueue();
3632
3326
  }, 'validateCells');
3633
3327
  j -= 1;
3634
3328
  }
3635
-
3636
3329
  i -= 1;
3637
3330
  }
3638
-
3639
3331
  waitingForValidator.checkIfQueueIsEmpty();
3640
3332
  };
3333
+
3641
3334
  /**
3642
3335
  * Returns an array of row headers' values (if they are enabled). If param `row` was given, it returns the header of the given row as a string.
3643
3336
  *
@@ -3647,16 +3340,12 @@ function Core(rootElement, userSettings) {
3647
3340
  * @fires Hooks#modifyRowHeader
3648
3341
  * @returns {Array|string|number} Array of header values / single header value.
3649
3342
  */
3650
-
3651
-
3652
3343
  this.getRowHeader = function (row) {
3653
3344
  var rowHeader = tableMeta.rowHeaders;
3654
3345
  var physicalRow = row;
3655
-
3656
3346
  if (physicalRow !== void 0) {
3657
3347
  physicalRow = instance.runHooks('modifyRowHeader', physicalRow);
3658
3348
  }
3659
-
3660
3349
  if (physicalRow === void 0) {
3661
3350
  rowHeader = [];
3662
3351
  (0, _number.rangeEach)(instance.countRows() - 1, function (i) {
@@ -3669,9 +3358,9 @@ function Core(rootElement, userSettings) {
3669
3358
  } else if (rowHeader && typeof rowHeader !== 'string' && typeof rowHeader !== 'number') {
3670
3359
  rowHeader = physicalRow + 1;
3671
3360
  }
3672
-
3673
3361
  return rowHeader;
3674
3362
  };
3363
+
3675
3364
  /**
3676
3365
  * Returns information about if this table is configured to display row headers.
3677
3366
  *
@@ -3679,11 +3368,10 @@ function Core(rootElement, userSettings) {
3679
3368
  * @function hasRowHeaders
3680
3369
  * @returns {boolean} `true` if the instance has the row headers enabled, `false` otherwise.
3681
3370
  */
3682
-
3683
-
3684
3371
  this.hasRowHeaders = function () {
3685
3372
  return !!tableMeta.rowHeaders;
3686
3373
  };
3374
+
3687
3375
  /**
3688
3376
  * Returns information about if this table is configured to display column headers.
3689
3377
  *
@@ -3691,82 +3379,101 @@ function Core(rootElement, userSettings) {
3691
3379
  * @function hasColHeaders
3692
3380
  * @returns {boolean} `true` if the instance has the column headers enabled, `false` otherwise.
3693
3381
  */
3694
-
3695
-
3696
3382
  this.hasColHeaders = function () {
3697
3383
  if (tableMeta.colHeaders !== void 0 && tableMeta.colHeaders !== null) {
3698
3384
  // Polymer has empty value = null
3699
3385
  return !!tableMeta.colHeaders;
3700
3386
  }
3701
-
3702
3387
  for (var i = 0, ilen = instance.countCols(); i < ilen; i++) {
3703
3388
  if (instance.getColHeader(i)) {
3704
3389
  return true;
3705
3390
  }
3706
3391
  }
3707
-
3708
3392
  return false;
3709
3393
  };
3394
+
3710
3395
  /**
3711
- * Returns an array of column headers (in string format, if they are enabled). If param `column` is given, it
3712
- * returns the header at the given column.
3396
+ * Gets the values of column headers (if column headers are [enabled](@/api/options.md#colheaders)).
3397
+ *
3398
+ * To get an array with the values of all
3399
+ * [bottom-most](@/guides/cell-features/clipboard.md#copy-with-headers) column headers,
3400
+ * call `getColHeader()` with no arguments.
3401
+ *
3402
+ * To get the value of the bottom-most header of a specific column, use the `column` parameter.
3403
+ *
3404
+ * To get the value of a [specific-level](@/guides/columns/column-groups.md) header
3405
+ * of a specific column, use the `column` and `headerLevel` parameters.
3406
+ *
3407
+ * Read more:
3408
+ * - [Guides: Column groups](@/guides/columns/column-groups.md)
3409
+ * - [Options: `colHeaders`](@/api/options.md#colheaders)
3410
+ * - [Guides: Copy with headers](@/guides/cell-features/clipboard.md#copy-with-headers)
3411
+ *
3412
+ * ```js
3413
+ * // get the contents of all bottom-most column headers
3414
+ * hot.getColHeader();
3415
+ *
3416
+ * // get the contents of the bottom-most header of a specific column
3417
+ * hot.getColHeader(5);
3418
+ *
3419
+ * // get the contents of a specific column header at a specific level
3420
+ * hot.getColHeader(5, -2);
3421
+ * ```
3713
3422
  *
3714
3423
  * @memberof Core#
3715
3424
  * @function getColHeader
3716
- * @param {number} [column] Visual column index.
3425
+ * @param {number} [column] A visual column index.
3426
+ * @param {number} [headerLevel=-1] (Since 12.3.0) Header level index. Accepts positive (0 to n)
3427
+ * and negative (-1 to -n) values. For positive values, 0 points to the
3428
+ * topmost header. For negative values, -1 points to the bottom-most
3429
+ * header (the header closest to the cells).
3717
3430
  * @fires Hooks#modifyColHeader
3718
- * @returns {Array|string|number} The column header(s).
3431
+ * @fires Hooks#modifyColumnHeaderValue
3432
+ * @returns {Array|string|number} Column header values.
3719
3433
  */
3720
-
3721
-
3722
3434
  this.getColHeader = function (column) {
3435
+ var headerLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
3723
3436
  var columnIndex = instance.runHooks('modifyColHeader', column);
3724
- var result = tableMeta.colHeaders;
3725
-
3726
3437
  if (columnIndex === void 0) {
3727
3438
  var out = [];
3728
3439
  var ilen = instance.countCols();
3729
-
3730
3440
  for (var i = 0; i < ilen; i++) {
3731
3441
  out.push(instance.getColHeader(i));
3732
3442
  }
3733
-
3734
- result = out;
3735
- } else {
3736
- var translateVisualIndexToColumns = function translateVisualIndexToColumns(visualColumnIndex) {
3737
- var arr = [];
3738
- var columnsLen = instance.countCols();
3739
- var index = 0;
3740
-
3741
- for (; index < columnsLen; index++) {
3742
- if ((0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(index)) {
3743
- arr.push(index);
3744
- }
3745
- }
3746
-
3747
- return arr[visualColumnIndex];
3748
- };
3749
-
3750
- var physicalColumn = instance.toPhysicalColumn(columnIndex);
3751
- var prop = translateVisualIndexToColumns(physicalColumn);
3752
-
3753
- if (tableMeta.colHeaders === false) {
3754
- result = null;
3755
- } else if (tableMeta.columns && (0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(prop) && tableMeta.columns(prop).title) {
3756
- result = tableMeta.columns(prop).title;
3757
- } else if (tableMeta.columns && tableMeta.columns[physicalColumn] && tableMeta.columns[physicalColumn].title) {
3758
- result = tableMeta.columns[physicalColumn].title;
3759
- } else if (Array.isArray(tableMeta.colHeaders) && tableMeta.colHeaders[physicalColumn] !== void 0) {
3760
- result = tableMeta.colHeaders[physicalColumn];
3761
- } else if ((0, _function.isFunction)(tableMeta.colHeaders)) {
3762
- result = tableMeta.colHeaders(physicalColumn);
3763
- } else if (tableMeta.colHeaders && typeof tableMeta.colHeaders !== 'string' && typeof tableMeta.colHeaders !== 'number') {
3764
- result = (0, _data.spreadsheetColumnLabel)(columnIndex); // see #1458
3443
+ return out;
3444
+ }
3445
+ var result = tableMeta.colHeaders;
3446
+ var translateVisualIndexToColumns = function translateVisualIndexToColumns(visualColumnIndex) {
3447
+ var arr = [];
3448
+ var columnsLen = instance.countCols();
3449
+ var index = 0;
3450
+ for (; index < columnsLen; index++) {
3451
+ if ((0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(index)) {
3452
+ arr.push(index);
3453
+ }
3765
3454
  }
3766
- }
3767
-
3455
+ return arr[visualColumnIndex];
3456
+ };
3457
+ var physicalColumn = instance.toPhysicalColumn(columnIndex);
3458
+ var prop = translateVisualIndexToColumns(physicalColumn);
3459
+ if (tableMeta.colHeaders === false) {
3460
+ result = null;
3461
+ } else if (tableMeta.columns && (0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(prop) && tableMeta.columns(prop).title) {
3462
+ result = tableMeta.columns(prop).title;
3463
+ } else if (tableMeta.columns && tableMeta.columns[physicalColumn] && tableMeta.columns[physicalColumn].title) {
3464
+ result = tableMeta.columns[physicalColumn].title;
3465
+ } else if (Array.isArray(tableMeta.colHeaders) && tableMeta.colHeaders[physicalColumn] !== void 0) {
3466
+ result = tableMeta.colHeaders[physicalColumn];
3467
+ } else if ((0, _function.isFunction)(tableMeta.colHeaders)) {
3468
+ result = tableMeta.colHeaders(physicalColumn);
3469
+ } else if (tableMeta.colHeaders && typeof tableMeta.colHeaders !== 'string' && typeof tableMeta.colHeaders !== 'number') {
3470
+ result = (0, _data.spreadsheetColumnLabel)(columnIndex); // see #1458
3471
+ }
3472
+
3473
+ result = instance.runHooks('modifyColumnHeaderValue', result, column, headerLevel);
3768
3474
  return result;
3769
3475
  };
3476
+
3770
3477
  /**
3771
3478
  * Return column width from settings (no guessing). Private use intended.
3772
3479
  *
@@ -3776,42 +3483,36 @@ function Core(rootElement, userSettings) {
3776
3483
  * @param {number} col Visual col index.
3777
3484
  * @returns {number}
3778
3485
  */
3779
-
3780
-
3781
3486
  this._getColWidthFromSettings = function (col) {
3782
- var width; // We currently don't support cell meta objects for headers (negative values)
3487
+ var width;
3783
3488
 
3489
+ // We currently don't support cell meta objects for headers (negative values)
3784
3490
  if (col >= 0) {
3785
3491
  var cellProperties = instance.getCellMeta(0, col);
3786
3492
  width = cellProperties.width;
3787
3493
  }
3788
-
3789
3494
  if (width === void 0 || width === tableMeta.width) {
3790
3495
  width = tableMeta.colWidths;
3791
3496
  }
3792
-
3793
3497
  if (width !== void 0 && width !== null) {
3794
3498
  switch (_typeof(width)) {
3795
3499
  case 'object':
3796
3500
  // array
3797
3501
  width = width[col];
3798
3502
  break;
3799
-
3800
3503
  case 'function':
3801
3504
  width = width(col);
3802
3505
  break;
3803
-
3804
3506
  default:
3805
3507
  break;
3806
3508
  }
3807
-
3808
3509
  if (typeof width === 'string') {
3809
3510
  width = parseInt(width, 10);
3810
3511
  }
3811
3512
  }
3812
-
3813
3513
  return width;
3814
3514
  };
3515
+
3815
3516
  /**
3816
3517
  * Returns the width of the requested column.
3817
3518
  *
@@ -3821,19 +3522,15 @@ function Core(rootElement, userSettings) {
3821
3522
  * @returns {number} Column width.
3822
3523
  * @fires Hooks#modifyColWidth
3823
3524
  */
3824
-
3825
-
3826
3525
  this.getColWidth = function (column) {
3827
3526
  var width = instance._getColWidthFromSettings(column);
3828
-
3829
3527
  width = instance.runHooks('modifyColWidth', width, column);
3830
-
3831
3528
  if (width === void 0) {
3832
3529
  width = _src.ViewportColumnsCalculator.DEFAULT_WIDTH;
3833
3530
  }
3834
-
3835
3531
  return width;
3836
3532
  };
3533
+
3837
3534
  /**
3838
3535
  * Return row height from settings (no guessing). Private use intended.
3839
3536
  *
@@ -3843,8 +3540,6 @@ function Core(rootElement, userSettings) {
3843
3540
  * @param {number} row Visual row index.
3844
3541
  * @returns {number}
3845
3542
  */
3846
-
3847
-
3848
3543
  this._getRowHeightFromSettings = function (row) {
3849
3544
  // let cellProperties = instance.getCellMeta(row, 0);
3850
3545
  // let height = cellProperties.height;
@@ -3853,48 +3548,57 @@ function Core(rootElement, userSettings) {
3853
3548
  // height = cellProperties.rowHeights;
3854
3549
  // }
3855
3550
  var height = tableMeta.rowHeights;
3856
-
3857
3551
  if (height !== void 0 && height !== null) {
3858
3552
  switch (_typeof(height)) {
3859
3553
  case 'object':
3860
3554
  // array
3861
3555
  height = height[row];
3862
3556
  break;
3863
-
3864
3557
  case 'function':
3865
3558
  height = height(row);
3866
3559
  break;
3867
-
3868
3560
  default:
3869
3561
  break;
3870
3562
  }
3871
-
3872
3563
  if (typeof height === 'string') {
3873
3564
  height = parseInt(height, 10);
3874
3565
  }
3875
3566
  }
3876
-
3877
3567
  return height;
3878
3568
  };
3569
+
3879
3570
  /**
3880
- * Returns the row height.
3571
+ * Returns a row's height, as recognized by Handsontable.
3881
3572
  *
3882
- * Mind that this method is different from the [AutoRowSize](@/api/autoRowSize.md) plugin's [`getRowHeight()`](@/api/autoRowSize.md#getrowheight) method.
3573
+ * Depending on your configuration, the method returns (in order of priority):
3574
+ * 1. The row height set by the [`ManualRowResize`](@/api/manualRowResize.md) plugin
3575
+ * (if the plugin is enabled).
3576
+ * 2. The row height set by the [`rowHeights`](@/api/options.md#rowheights) configuration option
3577
+ * (if the option is set).
3578
+ * 3. The row height as measured in the DOM by the [`AutoRowSize`](@/api/autoRowSize.md) plugin
3579
+ * (if the plugin is enabled).
3580
+ * 4. `undefined`, if neither [`ManualRowResize`](@/api/manualRowResize.md),
3581
+ * nor [`rowHeights`](@/api/options.md#rowheights),
3582
+ * nor [`AutoRowSize`](@/api/autoRowSize.md) is used.
3583
+ *
3584
+ * The height returned includes 1 px of the row's bottom border.
3585
+ *
3586
+ * Mind that this method is different from the
3587
+ * [`getRowHeight()`](@/api/autoRowSize.md#getrowheight) method
3588
+ * of the [`AutoRowSize`](@/api/autoRowSize.md) plugin.
3883
3589
  *
3884
3590
  * @memberof Core#
3885
3591
  * @function getRowHeight
3886
- * @param {number} row Visual row index.
3887
- * @returns {number} The given row's height.
3592
+ * @param {number} row A visual row index.
3593
+ * @returns {number|undefined} The height of the specified row, in pixels.
3888
3594
  * @fires Hooks#modifyRowHeight
3889
3595
  */
3890
-
3891
-
3892
3596
  this.getRowHeight = function (row) {
3893
3597
  var height = instance._getRowHeightFromSettings(row);
3894
-
3895
3598
  height = instance.runHooks('modifyRowHeight', height, row);
3896
3599
  return height;
3897
3600
  };
3601
+
3898
3602
  /**
3899
3603
  * Returns the total number of rows in the data source.
3900
3604
  *
@@ -3902,11 +3606,10 @@ function Core(rootElement, userSettings) {
3902
3606
  * @function countSourceRows
3903
3607
  * @returns {number} Total number of rows.
3904
3608
  */
3905
-
3906
-
3907
3609
  this.countSourceRows = function () {
3908
3610
  return dataSource.countRows();
3909
3611
  };
3612
+
3910
3613
  /**
3911
3614
  * Returns the total number of columns in the data source.
3912
3615
  *
@@ -3914,11 +3617,10 @@ function Core(rootElement, userSettings) {
3914
3617
  * @function countSourceCols
3915
3618
  * @returns {number} Total number of columns.
3916
3619
  */
3917
-
3918
-
3919
3620
  this.countSourceCols = function () {
3920
3621
  return dataSource.countFirstRowKeys();
3921
3622
  };
3623
+
3922
3624
  /**
3923
3625
  * Returns the total number of visual rows in the table.
3924
3626
  *
@@ -3926,11 +3628,10 @@ function Core(rootElement, userSettings) {
3926
3628
  * @function countRows
3927
3629
  * @returns {number} Total number of rows.
3928
3630
  */
3929
-
3930
-
3931
3631
  this.countRows = function () {
3932
3632
  return datamap.getLength();
3933
3633
  };
3634
+
3934
3635
  /**
3935
3636
  * Returns the total number of visible columns in the table.
3936
3637
  *
@@ -3938,13 +3639,12 @@ function Core(rootElement, userSettings) {
3938
3639
  * @function countCols
3939
3640
  * @returns {number} Total number of columns.
3940
3641
  */
3941
-
3942
-
3943
3642
  this.countCols = function () {
3944
3643
  var maxCols = tableMeta.maxCols;
3945
3644
  var dataLen = this.columnIndexMapper.getNotTrimmedIndexesLength();
3946
3645
  return Math.min(maxCols, dataLen);
3947
3646
  };
3647
+
3948
3648
  /**
3949
3649
  * Returns the number of rendered rows including rows that are partially or fully rendered
3950
3650
  * outside the table viewport.
@@ -3953,11 +3653,10 @@ function Core(rootElement, userSettings) {
3953
3653
  * @function countRenderedRows
3954
3654
  * @returns {number} Returns -1 if table is not visible.
3955
3655
  */
3956
-
3957
-
3958
3656
  this.countRenderedRows = function () {
3959
3657
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedRowsCount() : -1;
3960
3658
  };
3659
+
3961
3660
  /**
3962
3661
  * Returns the number of rendered rows that are only visible in the table viewport.
3963
3662
  * The rows that are partially visible are not counted.
@@ -3966,11 +3665,10 @@ function Core(rootElement, userSettings) {
3966
3665
  * @function countVisibleRows
3967
3666
  * @returns {number} Number of visible rows or -1.
3968
3667
  */
3969
-
3970
-
3971
3668
  this.countVisibleRows = function () {
3972
3669
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleRowsCount() : -1;
3973
3670
  };
3671
+
3974
3672
  /**
3975
3673
  * Returns the number of rendered rows including columns that are partially or fully rendered
3976
3674
  * outside the table viewport.
@@ -3979,11 +3677,10 @@ function Core(rootElement, userSettings) {
3979
3677
  * @function countRenderedCols
3980
3678
  * @returns {number} Returns -1 if table is not visible.
3981
3679
  */
3982
-
3983
-
3984
3680
  this.countRenderedCols = function () {
3985
3681
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedColumnsCount() : -1;
3986
3682
  };
3683
+
3987
3684
  /**
3988
3685
  * Returns the number of rendered columns that are only visible in the table viewport.
3989
3686
  * The columns that are partially visible are not counted.
@@ -3992,11 +3689,10 @@ function Core(rootElement, userSettings) {
3992
3689
  * @function countVisibleCols
3993
3690
  * @returns {number} Number of visible columns or -1.
3994
3691
  */
3995
-
3996
-
3997
3692
  this.countVisibleCols = function () {
3998
3693
  return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
3999
3694
  };
3695
+
4000
3696
  /**
4001
3697
  * Returns the number of empty rows. If the optional ending parameter is `true`, returns the
4002
3698
  * number of empty rows at the bottom of the table.
@@ -4006,8 +3702,6 @@ function Core(rootElement, userSettings) {
4006
3702
  * @param {boolean} [ending=false] If `true`, will only count empty rows at the end of the data source.
4007
3703
  * @returns {number} Count empty rows.
4008
3704
  */
4009
-
4010
-
4011
3705
  this.countEmptyRows = function () {
4012
3706
  var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4013
3707
  var emptyRows = 0;
@@ -4020,6 +3714,7 @@ function Core(rootElement, userSettings) {
4020
3714
  });
4021
3715
  return emptyRows;
4022
3716
  };
3717
+
4023
3718
  /**
4024
3719
  * Returns the number of empty columns. If the optional ending parameter is `true`, returns the number of empty
4025
3720
  * columns at right hand edge of the table.
@@ -4029,15 +3724,8 @@ function Core(rootElement, userSettings) {
4029
3724
  * @param {boolean} [ending=false] If `true`, will only count empty columns at the end of the data source row.
4030
3725
  * @returns {number} Count empty cols.
4031
3726
  */
4032
-
4033
-
4034
3727
  this.countEmptyCols = function () {
4035
3728
  var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4036
-
4037
- if (instance.countRows() < 1) {
4038
- return 0;
4039
- }
4040
-
4041
3729
  var emptyColumns = 0;
4042
3730
  (0, _number.rangeEachReverse)(instance.countCols() - 1, function (visualIndex) {
4043
3731
  if (instance.isEmptyCol(visualIndex)) {
@@ -4048,6 +3736,7 @@ function Core(rootElement, userSettings) {
4048
3736
  });
4049
3737
  return emptyColumns;
4050
3738
  };
3739
+
4051
3740
  /**
4052
3741
  * Check if all cells in the row declared by the `row` argument are empty.
4053
3742
  *
@@ -4056,11 +3745,10 @@ function Core(rootElement, userSettings) {
4056
3745
  * @param {number} row Visual row index.
4057
3746
  * @returns {boolean} `true` if the row at the given `row` is empty, `false` otherwise.
4058
3747
  */
4059
-
4060
-
4061
3748
  this.isEmptyRow = function (row) {
4062
3749
  return tableMeta.isEmptyRow.call(instance, row);
4063
3750
  };
3751
+
4064
3752
  /**
4065
3753
  * Check if all cells in the the column declared by the `column` argument are empty.
4066
3754
  *
@@ -4069,73 +3757,106 @@ function Core(rootElement, userSettings) {
4069
3757
  * @param {number} column Column index.
4070
3758
  * @returns {boolean} `true` if the column at the given `col` is empty, `false` otherwise.
4071
3759
  */
4072
-
4073
-
4074
3760
  this.isEmptyCol = function (column) {
4075
3761
  return tableMeta.isEmptyCol.call(instance, column);
4076
3762
  };
3763
+
4077
3764
  /**
4078
- * Select cell specified by `row` and `column` values or a range of cells finishing at `endRow`, `endCol`. If the table
4079
- * was configured to support data column properties that properties can be used to making a selection.
3765
+ * Select a single cell, or a single range of adjacent cells.
3766
+ *
3767
+ * To select a cell, pass its visual row and column indexes, for example: `selectCell(2, 4)`.
3768
+ *
3769
+ * To select a range, pass the visual indexes of the first and last cell in the range, for example: `selectCell(2, 4, 3, 5)`.
4080
3770
  *
4081
- * By default, viewport will be scrolled to the selection. After the `selectCell` method had finished, the instance
4082
- * will be listening to keyboard input on the document.
3771
+ * If your columns have properties, you can pass those properties' values instead of column indexes, for example: `selectCell(2, 'first_name')`.
3772
+ *
3773
+ * By default, `selectCell()` also:
3774
+ * - Scrolls the viewport to the newly-selected cells.
3775
+ * - Switches the keyboard focus to Handsontable (by calling Handsontable's [`listen()`](#listen) method).
4083
3776
  *
4084
3777
  * @example
4085
3778
  * ```js
4086
3779
  * // select a single cell
4087
3780
  * hot.selectCell(2, 4);
4088
- * // select a single cell using column property
4089
- * hot.selectCell(2, 'address');
3781
+ *
4090
3782
  * // select a range of cells
4091
3783
  * hot.selectCell(2, 4, 3, 5);
4092
- * // select a range of cells using column properties
4093
- * hot.selectCell(2, 'address', 3, 'phone_number');
4094
- * // select a range of cells without scrolling to them
4095
- * hot.selectCell(2, 'address', 3, 'phone_number', false);
3784
+ *
3785
+ * // select a single cell, using a column property
3786
+ * hot.selectCell(2, 'first_name');
3787
+ *
3788
+ * // select a range of cells, using column properties
3789
+ * hot.selectCell(2, 'first_name', 3, 'last_name');
3790
+ *
3791
+ * // select a range of cells, without scrolling to them
3792
+ * hot.selectCell(2, 4, 3, 5, false);
3793
+ *
3794
+ * // select a range of cells, without switching the keyboard focus to Handsontable
3795
+ * hot.selectCell(2, 4, 3, 5, null, false);
4096
3796
  * ```
4097
3797
  *
4098
3798
  * @memberof Core#
4099
3799
  * @function selectCell
4100
- * @param {number} row Visual row index.
4101
- * @param {number|string} column Visual column index or column property.
4102
- * @param {number} [endRow] Visual end row index (if selecting a range).
4103
- * @param {number|string} [endColumn] Visual end column index or column property (if selecting a range).
4104
- * @param {boolean} [scrollToCell=true] If `true`, the viewport will be scrolled to the selection.
4105
- * @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
4106
- * @returns {boolean} `true` if selection was successful, `false` otherwise.
3800
+ * @param {number} row A visual row index.
3801
+ * @param {number|string} column A visual column index (`number`), or a column property's value (`string`).
3802
+ * @param {number} [endRow] If selecting a range: the visual row index of the last cell in the range.
3803
+ * @param {number|string} [endColumn] If selecting a range: the visual column index (or a column property's value) of the last cell in the range.
3804
+ * @param {boolean} [scrollToCell=true] `true`: scroll the viewport to the newly-selected cells. `false`: keep the previous viewport.
3805
+ * @param {boolean} [changeListener=true] `true`: switch the keyboard focus to Handsontable. `false`: keep the previous keyboard focus.
3806
+ * @returns {boolean} `true`: the selection was successful, `false`: the selection failed.
4107
3807
  */
4108
-
4109
-
4110
3808
  this.selectCell = function (row, column, endRow, endColumn) {
4111
3809
  var scrollToCell = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
4112
3810
  var changeListener = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
4113
-
4114
3811
  if ((0, _mixed.isUndefined)(row) || (0, _mixed.isUndefined)(column)) {
4115
3812
  return false;
4116
3813
  }
4117
-
4118
3814
  return this.selectCells([[row, column, endRow, endColumn]], scrollToCell, changeListener);
4119
3815
  };
3816
+
4120
3817
  /**
4121
- * Make multiple, non-contiguous selection specified by `row` and `column` values or a range of cells
4122
- * finishing at `endRow`, `endColumn`. The method supports two input formats which are the same as that
4123
- * produces by `getSelected` and `getSelectedRange` methods.
3818
+ * Select multiple cells or ranges of cells, adjacent or non-adjacent.
3819
+ *
3820
+ * You can pass one of the below:
3821
+ * - An array of arrays (which matches the output of Handsontable's [`getSelected()`](#getselected) method).
3822
+ * - An array of [`CellRange`](@/api/cellRange.md) objects (which matches the output of Handsontable's [`getSelectedRange()`](#getselectedrange) method).
3823
+ *
3824
+ * To select multiple cells, pass the visual row and column indexes of each cell, for example: `hot.selectCells([[1, 1], [5, 5]])`.
3825
+ *
3826
+ * To select multiple ranges, pass the visual indexes of the first and last cell in each range, for example: `hot.selectCells([[1, 1, 2, 2], [6, 2, 0, 2]])`.
4124
3827
  *
4125
- * By default, viewport will be scrolled to selection. After the `selectCells` method had finished, the instance
4126
- * will be listening to keyboard input on the document.
3828
+ * If your columns have properties, you can pass those properties' values instead of column indexes, for example: `hot.selectCells([[1, 'first_name'], [5, 'last_name']])`.
3829
+ *
3830
+ * By default, `selectCell()` also:
3831
+ * - Scrolls the viewport to the newly-selected cells.
3832
+ * - Switches the keyboard focus to Handsontable (by calling Handsontable's [`listen()`](#listen) method).
4127
3833
  *
4128
3834
  * @example
4129
3835
  * ```js
4130
- * // Using an array of arrays.
3836
+ * // select non-adjacent cells
3837
+ * hot.selectCells([[1, 1], [5, 5], [10, 10]]);
3838
+ *
3839
+ * // select non-adjacent ranges of cells
3840
+ * hot.selectCells([[1, 1, 2, 2], [10, 10, 20, 20]]);
3841
+ *
3842
+ * // select cells and ranges of cells
4131
3843
  * hot.selectCells([[1, 1, 2, 2], [3, 3], [6, 2, 0, 2]]);
4132
- * // Using an array of arrays with defined columns as props.
3844
+ *
3845
+ * // select cells, using column properties
4133
3846
  * hot.selectCells([[1, 'id', 2, 'first_name'], [3, 'full_name'], [6, 'last_name', 0, 'first_name']]);
4134
- * // Using an array of CellRange objects (produced by `.getSelectedRange()` method).
3847
+ *
3848
+ * // select multiple ranges, using an array of `CellRange` objects
4135
3849
  * const selected = hot.getSelectedRange();
4136
3850
  *
4137
3851
  * selected[0].from.row = 0;
4138
3852
  * selected[0].from.col = 0;
3853
+ * selected[0].to.row = 5;
3854
+ * selected[0].to.col = 5;
3855
+ *
3856
+ * selected[1].from.row = 10;
3857
+ * selected[1].from.col = 10;
3858
+ * selected[1].to.row = 20;
3859
+ * selected[1].to.col = 20;
4139
3860
  *
4140
3861
  * hot.selectCells(selected);
4141
3862
  * ```
@@ -4143,33 +3864,28 @@ function Core(rootElement, userSettings) {
4143
3864
  * @memberof Core#
4144
3865
  * @since 0.38.0
4145
3866
  * @function selectCells
4146
- * @param {Array[]|CellRange[]} coords Visual coords passed as an array of array (`[[rowStart, columnStart, rowEnd, columnEnd], ...]`)
4147
- * the same format as `getSelected` method returns or as an CellRange objects
4148
- * which is the same format what `getSelectedRange` method returns.
4149
- * @param {boolean} [scrollToCell=true] If `true`, the viewport will be scrolled to the selection.
4150
- * @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
4151
- * @returns {boolean} `true` if selection was successful, `false` otherwise.
3867
+ * @param {Array[]|CellRange[]} coords Visual coordinates,
3868
+ * passed either as an array of arrays (`[[rowStart, columnStart, rowEnd, columnEnd], ...]`)
3869
+ * or as an array of [`CellRange`](@/api/cellRange.md) objects.
3870
+ * @param {boolean} [scrollToCell=true] `true`: scroll the viewport to the newly-selected cells. `false`: keep the previous viewport.
3871
+ * @param {boolean} [changeListener=true] `true`: switch the keyboard focus to Handsontable. `false`: keep the previous keyboard focus.
3872
+ * @returns {boolean} `true`: the selection was successful, `false`: the selection failed.
4152
3873
  */
4153
-
4154
-
4155
3874
  this.selectCells = function () {
4156
3875
  var coords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [[]];
4157
3876
  var scrollToCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4158
3877
  var changeListener = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
4159
-
4160
3878
  if (scrollToCell === false) {
4161
3879
  preventScrollingToCell = true;
4162
3880
  }
4163
-
4164
3881
  var wasSelected = selection.selectCells(coords);
4165
-
4166
3882
  if (wasSelected && changeListener) {
4167
3883
  instance.listen();
4168
3884
  }
4169
-
4170
3885
  preventScrollingToCell = false;
4171
3886
  return wasSelected;
4172
3887
  };
3888
+
4173
3889
  /**
4174
3890
  * Select column specified by `startColumn` visual index, column property or a range of columns finishing at `endColumn`.
4175
3891
  *
@@ -4193,12 +3909,11 @@ function Core(rootElement, userSettings) {
4193
3909
  * is not defined the column defined by `startColumn` will be selected.
4194
3910
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
4195
3911
  */
4196
-
4197
-
4198
3912
  this.selectColumns = function (startColumn) {
4199
3913
  var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
4200
3914
  return selection.selectColumns(startColumn, endColumn);
4201
3915
  };
3916
+
4202
3917
  /**
4203
3918
  * Select row specified by `startRow` visual index or a range of rows finishing at `endRow`.
4204
3919
  *
@@ -4218,34 +3933,40 @@ function Core(rootElement, userSettings) {
4218
3933
  * is not defined the row defined by `startRow` will be selected.
4219
3934
  * @returns {boolean} `true` if selection was successful, `false` otherwise.
4220
3935
  */
4221
-
4222
-
4223
3936
  this.selectRows = function (startRow) {
4224
3937
  var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
4225
3938
  return selection.selectRows(startRow, endRow);
4226
3939
  };
3940
+
4227
3941
  /**
4228
3942
  * Deselects the current cell selection on the table.
4229
3943
  *
4230
3944
  * @memberof Core#
4231
3945
  * @function deselectCell
4232
3946
  */
4233
-
4234
-
4235
3947
  this.deselectCell = function () {
4236
3948
  selection.deselect();
4237
3949
  };
3950
+
4238
3951
  /**
4239
- * Select the whole table. The previous selection will be overwritten.
3952
+ * Select the whole table.
3953
+ *
3954
+ * The previous selection is overwritten.
3955
+ *
3956
+ * ```js
3957
+ * // select all cells in the table, including all headers
3958
+ * hot.selectAll();
3959
+ *
3960
+ * // select all cells in the table, without headers
3961
+ * hot.selectAll(false);
3962
+ * ```
4240
3963
  *
4241
3964
  * @since 0.38.2
4242
3965
  * @memberof Core#
4243
3966
  * @function selectAll
4244
- * @param {boolean} [includeHeaders=true] `true` If the selection should include the row, column and corner headers,
4245
- * `false` otherwise.
3967
+ * @param {boolean} [includeHeaders=true] `true`: include all row, column and corner headers.
3968
+ * `false`: don't include any headers.
4246
3969
  */
4247
-
4248
-
4249
3970
  this.selectAll = function () {
4250
3971
  var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
4251
3972
  var includeRowHeaders = includeHeaders && this.hasRowHeaders();
@@ -4254,11 +3975,11 @@ function Core(rootElement, userSettings) {
4254
3975
  selection.selectAll(includeRowHeaders, includeColumnHeaders);
4255
3976
  preventScrollingToCell = false;
4256
3977
  };
4257
-
4258
3978
  var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
4259
3979
  // Looking for a visual index on the right and then (when not found) on the left.
4260
3980
  return indexMapper.getNearestNotHiddenIndex(visualIndex, 1, true);
4261
3981
  };
3982
+
4262
3983
  /**
4263
3984
  * Scroll viewport to coordinates specified by the `row` and `column` arguments.
4264
3985
  *
@@ -4276,8 +3997,6 @@ function Core(rootElement, userSettings) {
4276
3997
  * may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
4277
3998
  * @returns {boolean} `true` if scroll was successful, `false` otherwise.
4278
3999
  */
4279
-
4280
-
4281
4000
  this.scrollViewportTo = function (row, column) {
4282
4001
  var snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4283
4002
  var snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -4286,40 +4005,31 @@ function Core(rootElement, userSettings) {
4286
4005
  var snapToLeft = !snapToRight;
4287
4006
  var renderableRow = row;
4288
4007
  var renderableColumn = column;
4289
-
4290
4008
  if (considerHiddenIndexes) {
4291
4009
  var _isRowInteger = Number.isInteger(row);
4292
-
4293
4010
  var _isColumnInteger = Number.isInteger(column);
4294
-
4295
4011
  var visualRowToScroll = _isRowInteger ? getIndexToScroll(this.rowIndexMapper, row) : void 0;
4296
4012
  var visualColumnToScroll = _isColumnInteger ? getIndexToScroll(this.columnIndexMapper, column) : void 0;
4297
-
4298
4013
  if (visualRowToScroll === null || visualColumnToScroll === null) {
4299
4014
  return false;
4300
4015
  }
4301
-
4302
4016
  renderableRow = _isRowInteger ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : void 0;
4303
4017
  renderableColumn = _isColumnInteger ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : void 0;
4304
4018
  }
4305
-
4306
4019
  var isRowInteger = Number.isInteger(renderableRow);
4307
4020
  var isColumnInteger = Number.isInteger(renderableColumn);
4308
-
4309
4021
  if (isRowInteger && isColumnInteger) {
4310
4022
  return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToRight, snapToBottom, snapToLeft);
4311
4023
  }
4312
-
4313
4024
  if (isRowInteger && isColumnInteger === false) {
4314
4025
  return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
4315
4026
  }
4316
-
4317
4027
  if (isColumnInteger && isRowInteger === false) {
4318
4028
  return instance.view.scrollViewportHorizontally(renderableColumn, snapToRight, snapToLeft);
4319
4029
  }
4320
-
4321
4030
  return false;
4322
4031
  };
4032
+
4323
4033
  /**
4324
4034
  * Removes the table from the DOM and destroys the instance of the Handsontable.
4325
4035
  *
@@ -4327,58 +4037,45 @@ function Core(rootElement, userSettings) {
4327
4037
  * @function destroy
4328
4038
  * @fires Hooks#afterDestroy
4329
4039
  */
4330
-
4331
-
4332
4040
  this.destroy = function () {
4333
4041
  instance._clearTimeouts();
4334
-
4335
4042
  instance._clearImmediates();
4336
-
4337
4043
  if (instance.view) {
4338
4044
  // in case HT is destroyed before initialization has finished
4339
4045
  instance.view.destroy();
4340
4046
  }
4341
-
4342
4047
  if (dataSource) {
4343
4048
  dataSource.destroy();
4344
4049
  }
4345
-
4346
4050
  dataSource = null;
4347
4051
  this.getShortcutManager().destroy();
4348
4052
  metaManager.clearCache();
4349
-
4350
4053
  if ((0, _rootInstance.isRootInstance)(instance)) {
4351
4054
  var licenseInfo = this.rootDocument.querySelector('#hot-display-license-info');
4352
-
4353
4055
  if (licenseInfo) {
4354
4056
  licenseInfo.parentNode.removeChild(licenseInfo);
4355
4057
  }
4356
4058
  }
4357
-
4358
4059
  (0, _element.empty)(instance.rootElement);
4359
4060
  eventManager.destroy();
4360
-
4361
4061
  if (editorManager) {
4362
4062
  editorManager.destroy();
4363
- } // The plugin's `destroy` method is called as a consequence and it should handle
4364
- // unregistration of plugin's maps. Some unregistered maps reset the cache.
4365
-
4063
+ }
4366
4064
 
4065
+ // The plugin's `destroy` method is called as a consequence and it should handle
4066
+ // unregistration of plugin's maps. Some unregistered maps reset the cache.
4367
4067
  instance.batchExecution(function () {
4368
4068
  instance.rowIndexMapper.unregisterAll();
4369
4069
  instance.columnIndexMapper.unregisterAll();
4370
4070
  pluginsRegistry.getItems().forEach(function (_ref20) {
4371
4071
  var _ref21 = _slicedToArray(_ref20, 2),
4372
- plugin = _ref21[1];
4373
-
4072
+ plugin = _ref21[1];
4374
4073
  plugin.destroy();
4375
4074
  });
4376
4075
  pluginsRegistry.clear();
4377
4076
  instance.runHooks('afterDestroy');
4378
4077
  }, true);
4379
-
4380
4078
  _pluginHooks.default.getSingleton().destroy(instance);
4381
-
4382
4079
  (0, _object.objectEach)(instance, function (property, key, obj) {
4383
4080
  // replace instance methods with post mortem
4384
4081
  if ((0, _function.isFunction)(property)) {
@@ -4389,13 +4086,13 @@ function Core(rootElement, userSettings) {
4389
4086
  obj[key] = null;
4390
4087
  }
4391
4088
  });
4392
- instance.isDestroyed = true; // replace private properties with null (restores memory)
4393
- // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests
4089
+ instance.isDestroyed = true;
4394
4090
 
4091
+ // replace private properties with null (restores memory)
4092
+ // it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests
4395
4093
  if (datamap) {
4396
4094
  datamap.destroy();
4397
4095
  }
4398
-
4399
4096
  instance.rowIndexMapper = null;
4400
4097
  instance.columnIndexMapper = null;
4401
4098
  datamap = null;
@@ -4404,6 +4101,7 @@ function Core(rootElement, userSettings) {
4404
4101
  editorManager = null;
4405
4102
  instance = null;
4406
4103
  };
4104
+
4407
4105
  /**
4408
4106
  * Replacement for all methods after the Handsontable was destroyed.
4409
4107
  *
@@ -4411,13 +4109,12 @@ function Core(rootElement, userSettings) {
4411
4109
  * @param {string} method The method name.
4412
4110
  * @returns {Function}
4413
4111
  */
4414
-
4415
-
4416
4112
  function postMortem(method) {
4417
4113
  return function () {
4418
4114
  throw new Error("The \"".concat(method, "\" method cannot be called because this Handsontable instance has been destroyed"));
4419
4115
  };
4420
4116
  }
4117
+
4421
4118
  /**
4422
4119
  * Returns the active editor class instance.
4423
4120
  *
@@ -4425,11 +4122,10 @@ function Core(rootElement, userSettings) {
4425
4122
  * @function getActiveEditor
4426
4123
  * @returns {BaseEditor} The active editor instance.
4427
4124
  */
4428
-
4429
-
4430
4125
  this.getActiveEditor = function () {
4431
4126
  return editorManager.getActiveEditor();
4432
4127
  };
4128
+
4433
4129
  /**
4434
4130
  * Returns plugin instance by provided its name.
4435
4131
  *
@@ -4438,17 +4134,16 @@ function Core(rootElement, userSettings) {
4438
4134
  * @param {string} pluginName The plugin name.
4439
4135
  * @returns {BasePlugin|undefined} The plugin instance or undefined if there is no plugin.
4440
4136
  */
4441
-
4442
-
4443
4137
  this.getPlugin = function (pluginName) {
4444
- var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName); // Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
4138
+ var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName);
4445
4139
 
4140
+ // Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
4446
4141
  if (unifiedPluginName === 'UndoRedo') {
4447
4142
  return this.undoRedo;
4448
4143
  }
4449
-
4450
4144
  return pluginsRegistry.getItem(unifiedPluginName);
4451
4145
  };
4146
+
4452
4147
  /**
4453
4148
  * Returns name of the passed plugin.
4454
4149
  *
@@ -4457,16 +4152,14 @@ function Core(rootElement, userSettings) {
4457
4152
  * @param {BasePlugin} plugin The plugin instance.
4458
4153
  * @returns {string}
4459
4154
  */
4460
-
4461
-
4462
4155
  this.getPluginName = function (plugin) {
4463
4156
  // Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
4464
4157
  if (plugin === this.undoRedo) {
4465
4158
  return this.undoRedo.constructor.PLUGIN_KEY;
4466
4159
  }
4467
-
4468
4160
  return pluginsRegistry.getId(plugin);
4469
4161
  };
4162
+
4470
4163
  /**
4471
4164
  * Returns the Handsontable instance.
4472
4165
  *
@@ -4474,11 +4167,10 @@ function Core(rootElement, userSettings) {
4474
4167
  * @function getInstance
4475
4168
  * @returns {Handsontable} The Handsontable instance.
4476
4169
  */
4477
-
4478
-
4479
4170
  this.getInstance = function () {
4480
4171
  return instance;
4481
4172
  };
4173
+
4482
4174
  /**
4483
4175
  * Adds listener to the specified hook name (only for this Handsontable instance).
4484
4176
  *
@@ -4492,11 +4184,10 @@ function Core(rootElement, userSettings) {
4492
4184
  * hot.addHook('beforeInit', myCallback);
4493
4185
  * ```
4494
4186
  */
4495
-
4496
-
4497
4187
  this.addHook = function (key, callback) {
4498
4188
  _pluginHooks.default.getSingleton().add(key, callback, instance);
4499
4189
  };
4190
+
4500
4191
  /**
4501
4192
  * Check if for a specified hook name there are added listeners (only for this Handsontable instance). All available
4502
4193
  * hooks you will find {@link Hooks}.
@@ -4512,11 +4203,10 @@ function Core(rootElement, userSettings) {
4512
4203
  * const hasBeforeInitListeners = hot.hasHook('beforeInit');
4513
4204
  * ```
4514
4205
  */
4515
-
4516
-
4517
4206
  this.hasHook = function (key) {
4518
4207
  return _pluginHooks.default.getSingleton().has(key, instance) || _pluginHooks.default.getSingleton().has(key);
4519
4208
  };
4209
+
4520
4210
  /**
4521
4211
  * Adds listener to specified hook name (only for this Handsontable instance). After the listener is triggered,
4522
4212
  * it will be automatically removed.
@@ -4531,11 +4221,10 @@ function Core(rootElement, userSettings) {
4531
4221
  * hot.addHookOnce('beforeInit', myCallback);
4532
4222
  * ```
4533
4223
  */
4534
-
4535
-
4536
4224
  this.addHookOnce = function (key, callback) {
4537
4225
  _pluginHooks.default.getSingleton().once(key, callback, instance);
4538
4226
  };
4227
+
4539
4228
  /**
4540
4229
  * Removes the hook listener previously registered with {@link Core#addHook}.
4541
4230
  *
@@ -4550,11 +4239,10 @@ function Core(rootElement, userSettings) {
4550
4239
  * hot.removeHook('beforeInit', myCallback);
4551
4240
  * ```
4552
4241
  */
4553
-
4554
-
4555
4242
  this.removeHook = function (key, callback) {
4556
4243
  _pluginHooks.default.getSingleton().remove(key, callback, instance);
4557
4244
  };
4245
+
4558
4246
  /**
4559
4247
  * Run the callbacks for the hook provided in the `key` argument using the parameters given in the other arguments.
4560
4248
  *
@@ -4578,11 +4266,10 @@ function Core(rootElement, userSettings) {
4578
4266
  * hot.runHooks('customAction', 10, 'foo');
4579
4267
  * ```
4580
4268
  */
4581
-
4582
-
4583
4269
  this.runHooks = function (key, p1, p2, p3, p4, p5, p6) {
4584
4270
  return _pluginHooks.default.getSingleton().run(instance, key, p1, p2, p3, p4, p5, p6);
4585
4271
  };
4272
+
4586
4273
  /**
4587
4274
  * Get language phrase for specified dictionary key.
4588
4275
  *
@@ -4593,11 +4280,10 @@ function Core(rootElement, userSettings) {
4593
4280
  * @param {*} extraArguments Arguments which will be handled by formatters.
4594
4281
  * @returns {string}
4595
4282
  */
4596
-
4597
-
4598
4283
  this.getTranslatedPhrase = function (dictionaryKey, extraArguments) {
4599
- return (0, _registry4.getTranslatedPhrase)(tableMeta.language, dictionaryKey, extraArguments);
4284
+ return (0, _registry5.getTranslatedPhrase)(tableMeta.language, dictionaryKey, extraArguments);
4600
4285
  };
4286
+
4601
4287
  /**
4602
4288
  * Converts instance into outerHTML of HTMLTableElement.
4603
4289
  *
@@ -4606,11 +4292,10 @@ function Core(rootElement, userSettings) {
4606
4292
  * @since 7.1.0
4607
4293
  * @returns {string}
4608
4294
  */
4609
-
4610
-
4611
4295
  this.toHTML = function () {
4612
4296
  return (0, _parseTable.instanceToHTML)(_this);
4613
4297
  };
4298
+
4614
4299
  /**
4615
4300
  * Converts instance into HTMLTableElement.
4616
4301
  *
@@ -4619,16 +4304,13 @@ function Core(rootElement, userSettings) {
4619
4304
  * @since 7.1.0
4620
4305
  * @returns {HTMLTableElement}
4621
4306
  */
4622
-
4623
-
4624
4307
  this.toTableElement = function () {
4625
4308
  var tempElement = _this.rootDocument.createElement('div');
4626
-
4627
4309
  tempElement.insertAdjacentHTML('afterbegin', (0, _parseTable.instanceToHTML)(_this));
4628
4310
  return tempElement.firstElementChild;
4629
4311
  };
4630
-
4631
4312
  this.timeouts = [];
4313
+
4632
4314
  /**
4633
4315
  * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
4634
4316
  *
@@ -4637,53 +4319,48 @@ function Core(rootElement, userSettings) {
4637
4319
  * @param {number} [delay=0] If first argument is passed as a function this argument set delay of the execution of that function.
4638
4320
  * @private
4639
4321
  */
4640
-
4641
4322
  this._registerTimeout = function (handle) {
4642
4323
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4643
4324
  var handleFunc = handle;
4644
-
4645
4325
  if (typeof handleFunc === 'function') {
4646
4326
  handleFunc = setTimeout(handleFunc, delay);
4647
4327
  }
4648
-
4649
4328
  this.timeouts.push(handleFunc);
4650
4329
  };
4330
+
4651
4331
  /**
4652
4332
  * Clears all known timeouts.
4653
4333
  *
4654
4334
  * @private
4655
4335
  */
4656
-
4657
-
4658
4336
  this._clearTimeouts = function () {
4659
4337
  (0, _array.arrayEach)(this.timeouts, function (handler) {
4660
4338
  clearTimeout(handler);
4661
4339
  });
4662
4340
  };
4663
-
4664
4341
  this.immediates = [];
4342
+
4665
4343
  /**
4666
4344
  * Execute function execution to the next event loop cycle. Purpose of this method is to clear all known timeouts when `destroy` method is called.
4667
4345
  *
4668
4346
  * @param {Function} callback Function to be delayed in execution.
4669
4347
  * @private
4670
4348
  */
4671
-
4672
4349
  this._registerImmediate = function (callback) {
4673
4350
  this.immediates.push(setImmediate(callback));
4674
4351
  };
4352
+
4675
4353
  /**
4676
4354
  * Clears all known timeouts.
4677
4355
  *
4678
4356
  * @private
4679
4357
  */
4680
-
4681
-
4682
4358
  this._clearImmediates = function () {
4683
4359
  (0, _array.arrayEach)(this.immediates, function (handler) {
4684
4360
  clearImmediate(handler);
4685
4361
  });
4686
4362
  };
4363
+
4687
4364
  /**
4688
4365
  * Refresh selection borders. This is temporary method relic after selection rewrite.
4689
4366
  *
@@ -4691,18 +4368,16 @@ function Core(rootElement, userSettings) {
4691
4368
  * @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
4692
4369
  * @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
4693
4370
  */
4694
-
4695
-
4696
4371
  this._refreshBorders = function () {
4697
4372
  var revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
4698
4373
  var prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4699
4374
  editorManager.destroyEditor(revertOriginal);
4700
4375
  instance.view.render();
4701
-
4702
4376
  if (prepareEditorIfNeeded && selection.isSelected()) {
4703
4377
  editorManager.prepareEditor();
4704
4378
  }
4705
4379
  };
4380
+
4706
4381
  /**
4707
4382
  * Check if currently it is RTL direction.
4708
4383
  *
@@ -4711,11 +4386,10 @@ function Core(rootElement, userSettings) {
4711
4386
  * @function isRtl
4712
4387
  * @returns {boolean} True if RTL.
4713
4388
  */
4714
-
4715
-
4716
4389
  this.isRtl = function () {
4717
4390
  return instance.rootWindow.getComputedStyle(instance.rootElement).direction === 'rtl';
4718
4391
  };
4392
+
4719
4393
  /**
4720
4394
  * Check if currently it is LTR direction.
4721
4395
  *
@@ -4724,11 +4398,10 @@ function Core(rootElement, userSettings) {
4724
4398
  * @function isLtr
4725
4399
  * @returns {boolean} True if LTR.
4726
4400
  */
4727
-
4728
-
4729
4401
  this.isLtr = function () {
4730
4402
  return !instance.isRtl();
4731
4403
  };
4404
+
4732
4405
  /**
4733
4406
  * Returns 1 for LTR; -1 for RTL. Useful for calculations.
4734
4407
  *
@@ -4737,12 +4410,9 @@ function Core(rootElement, userSettings) {
4737
4410
  * @function getDirectionFactor
4738
4411
  * @returns {number} Returns 1 for LTR; -1 for RTL.
4739
4412
  */
4740
-
4741
-
4742
4413
  this.getDirectionFactor = function () {
4743
4414
  return instance.isLtr() ? 1 : -1;
4744
4415
  };
4745
-
4746
4416
  var shortcutManager = (0, _shortcuts.createShortcutManager)({
4747
4417
  handleEvent: function handleEvent(event) {
4748
4418
  var isListening = instance.isListening();
@@ -4757,11 +4427,11 @@ function Core(rootElement, userSettings) {
4757
4427
  // Handsontable could be destroyed after performing action (executing a callback).
4758
4428
  return;
4759
4429
  }
4760
-
4761
4430
  instance.runHooks('afterDocumentKeyDown', event);
4762
4431
  },
4763
4432
  ownerWindow: this.rootWindow
4764
4433
  });
4434
+
4765
4435
  /**
4766
4436
  * Returns instance of a manager responsible for handling shortcuts stored in some contexts. It run actions after
4767
4437
  * pressing key combination in active Handsontable instance.
@@ -4771,11 +4441,9 @@ function Core(rootElement, userSettings) {
4771
4441
  * @function getShortcutManager
4772
4442
  * @returns {ShortcutManager} Instance of {@link ShortcutManager}
4773
4443
  */
4774
-
4775
4444
  this.getShortcutManager = function () {
4776
4445
  return shortcutManager;
4777
4446
  };
4778
-
4779
4447
  var gridContext = shortcutManager.addContext('grid');
4780
4448
  var gridConfig = {
4781
4449
  runOnlyIf: function runOnlyIf() {
@@ -4794,24 +4462,21 @@ function Core(rootElement, userSettings) {
4794
4462
  callback: function callback() {
4795
4463
  var selectedRange = instance.getSelectedRange();
4796
4464
  var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
4797
- highlightRow = _selectedRange$highli.row,
4798
- highlightColumn = _selectedRange$highli.col;
4465
+ highlightRow = _selectedRange$highli.row,
4466
+ highlightColumn = _selectedRange$highli.col;
4799
4467
  var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
4800
4468
  var cellValues = new Map();
4801
-
4802
4469
  for (var i = 0; i < selectedRange.length; i++) {
4803
4470
  selectedRange[i].forAll(function (row, column) {
4804
4471
  if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
4805
4472
  var _instance$getCellMeta = instance.getCellMeta(row, column),
4806
- readOnly = _instance$getCellMeta.readOnly;
4807
-
4473
+ readOnly = _instance$getCellMeta.readOnly;
4808
4474
  if (!readOnly) {
4809
4475
  cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
4810
4476
  }
4811
4477
  }
4812
4478
  });
4813
4479
  }
4814
-
4815
4480
  instance.setDataAtCell(Array.from(cellValues.values()));
4816
4481
  },
4817
4482
  runOnlyIf: function runOnlyIf() {
@@ -4838,9 +4503,8 @@ function Core(rootElement, userSettings) {
4838
4503
  captureCtrl: true,
4839
4504
  callback: function callback() {
4840
4505
  var _instance$getSelected = instance.getSelectedRangeLast(),
4841
- from = _instance$getSelected.from,
4842
- to = _instance$getSelected.to;
4843
-
4506
+ from = _instance$getSelected.from,
4507
+ to = _instance$getSelected.to;
4844
4508
  var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
4845
4509
  selection.setRangeStart(from.clone());
4846
4510
  selection.setRangeEnd(instance._createCellCoords(row, to.col));
@@ -4869,9 +4533,8 @@ function Core(rootElement, userSettings) {
4869
4533
  captureCtrl: true,
4870
4534
  callback: function callback() {
4871
4535
  var _instance$getSelected2 = instance.getSelectedRangeLast(),
4872
- from = _instance$getSelected2.from,
4873
- to = _instance$getSelected2.to;
4874
-
4536
+ from = _instance$getSelected2.from,
4537
+ to = _instance$getSelected2.to;
4875
4538
  var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
4876
4539
  selection.setRangeStart(from.clone());
4877
4540
  selection.setRangeEnd(instance._createCellCoords(row, to.col));
@@ -4889,11 +4552,8 @@ function Core(rootElement, userSettings) {
4889
4552
  captureCtrl: true,
4890
4553
  callback: function callback() {
4891
4554
  var _instance$columnIndex;
4892
-
4893
4555
  var row = instance.getSelectedRangeLast().highlight.row;
4894
-
4895
4556
  var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4896
-
4897
4557
  selection.setRangeStart(instance._createCellCoords(row, column));
4898
4558
  }
4899
4559
  }, {
@@ -4906,13 +4566,10 @@ function Core(rootElement, userSettings) {
4906
4566
  captureCtrl: true,
4907
4567
  callback: function callback() {
4908
4568
  var _instance$columnIndex2;
4909
-
4910
4569
  var _instance$getSelected3 = instance.getSelectedRangeLast(),
4911
- from = _instance$getSelected3.from,
4912
- to = _instance$getSelected3.to;
4913
-
4570
+ from = _instance$getSelected3.from,
4571
+ to = _instance$getSelected3.to;
4914
4572
  var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
4915
-
4916
4573
  selection.setRangeStart(from.clone());
4917
4574
  selection.setRangeEnd(instance._createCellCoords(to.row, column));
4918
4575
  },
@@ -4929,11 +4586,8 @@ function Core(rootElement, userSettings) {
4929
4586
  captureCtrl: true,
4930
4587
  callback: function callback() {
4931
4588
  var _instance$columnIndex3;
4932
-
4933
4589
  var row = instance.getSelectedRangeLast().highlight.row;
4934
-
4935
4590
  var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4936
-
4937
4591
  selection.setRangeStart(instance._createCellCoords(row, column));
4938
4592
  }
4939
4593
  }, {
@@ -4946,13 +4600,10 @@ function Core(rootElement, userSettings) {
4946
4600
  captureCtrl: true,
4947
4601
  callback: function callback() {
4948
4602
  var _instance$columnIndex4;
4949
-
4950
4603
  var _instance$getSelected4 = instance.getSelectedRangeLast(),
4951
- from = _instance$getSelected4.from,
4952
- to = _instance$getSelected4.to;
4953
-
4604
+ from = _instance$getSelected4.from,
4605
+ to = _instance$getSelected4.to;
4954
4606
  var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
4955
-
4956
4607
  selection.setRangeStart(from.clone());
4957
4608
  selection.setRangeEnd(instance._createCellCoords(to.row, column));
4958
4609
  },
@@ -5024,14 +4675,11 @@ function Core(rootElement, userSettings) {
5024
4675
  keys: [['PageUp', 'Shift']],
5025
4676
  callback: function callback() {
5026
4677
  var _instance$getSelected5 = instance.getSelectedRangeLast(),
5027
- to = _instance$getSelected5.to;
5028
-
4678
+ to = _instance$getSelected5.to;
5029
4679
  var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
5030
4680
  var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
5031
-
5032
4681
  if (row !== null) {
5033
4682
  var coords = instance._createCellCoords(row, to.col);
5034
-
5035
4683
  var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
5036
4684
  var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
5037
4685
  selection.setRangeEnd(coords);
@@ -5047,14 +4695,11 @@ function Core(rootElement, userSettings) {
5047
4695
  keys: [['PageDown', 'Shift']],
5048
4696
  callback: function callback() {
5049
4697
  var _instance$getSelected6 = instance.getSelectedRangeLast(),
5050
- to = _instance$getSelected6.to;
5051
-
4698
+ to = _instance$getSelected6.to;
5052
4699
  var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
5053
4700
  var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
5054
-
5055
4701
  if (row !== null) {
5056
4702
  var coords = instance._createCellCoords(row, to.col);
5057
-
5058
4703
  var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
5059
4704
  var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
5060
4705
  selection.setRangeEnd(coords);
@@ -5078,6 +4723,5 @@ function Core(rootElement, userSettings) {
5078
4723
  var PluginClass = (0, _registry.getPlugin)(pluginName);
5079
4724
  pluginsRegistry.addItem(pluginName, new PluginClass(_this));
5080
4725
  });
5081
-
5082
4726
  _pluginHooks.default.getSingleton().run(instance, 'construct');
5083
4727
  }