handsontable 12.1.3 → 12.2.0

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