handsontable 0.0.0-next-9ec04ce-20221121

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.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

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