handsontable 16.0.1-next-eee5f08-20250710 → 16.1.0-next-abd8f2e-20250904

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (489) hide show
  1. package/3rdparty/walkontable/src/overlays.js +12 -2
  2. package/3rdparty/walkontable/src/overlays.mjs +12 -2
  3. package/3rdparty/walkontable/src/viewport.js +2 -6
  4. package/3rdparty/walkontable/src/viewport.mjs +2 -6
  5. package/CHANGELOG.md +32 -0
  6. package/base.js +2 -2
  7. package/base.mjs +2 -2
  8. package/cellTypes/autocompleteType/accessors/index.js +7 -0
  9. package/cellTypes/autocompleteType/accessors/index.mjs +2 -0
  10. package/cellTypes/autocompleteType/accessors/valueGetter.js +14 -0
  11. package/cellTypes/autocompleteType/accessors/valueGetter.mjs +10 -0
  12. package/cellTypes/autocompleteType/accessors/valueSetter.js +25 -0
  13. package/cellTypes/autocompleteType/accessors/valueSetter.mjs +21 -0
  14. package/cellTypes/autocompleteType/autocompleteType.js +4 -1
  15. package/cellTypes/autocompleteType/autocompleteType.mjs +4 -1
  16. package/cellTypes/checkboxType/accessors/index.js +5 -0
  17. package/cellTypes/checkboxType/accessors/index.mjs +1 -0
  18. package/cellTypes/checkboxType/accessors/valueSetter.js +26 -0
  19. package/cellTypes/checkboxType/accessors/valueSetter.mjs +22 -0
  20. package/cellTypes/checkboxType/checkboxType.js +3 -1
  21. package/cellTypes/checkboxType/checkboxType.mjs +3 -1
  22. package/cellTypes/dropdownType/accessors/index.js +7 -0
  23. package/cellTypes/dropdownType/accessors/index.mjs +2 -0
  24. package/cellTypes/dropdownType/accessors/valueGetter.js +14 -0
  25. package/cellTypes/dropdownType/accessors/valueGetter.mjs +10 -0
  26. package/cellTypes/dropdownType/accessors/valueSetter.js +17 -0
  27. package/cellTypes/dropdownType/accessors/valueSetter.mjs +13 -0
  28. package/cellTypes/dropdownType/dropdownType.js +4 -1
  29. package/cellTypes/dropdownType/dropdownType.mjs +4 -1
  30. package/cellTypes/numericType/accessors/index.js +5 -0
  31. package/cellTypes/numericType/accessors/index.mjs +1 -0
  32. package/cellTypes/numericType/accessors/valueSetter.js +19 -0
  33. package/cellTypes/numericType/accessors/valueSetter.mjs +15 -0
  34. package/cellTypes/numericType/numericType.js +3 -1
  35. package/cellTypes/numericType/numericType.mjs +3 -1
  36. package/core/focusCatcher/index.js +37 -112
  37. package/core/focusCatcher/index.mjs +35 -110
  38. package/core/focusCatcher/utils.js +31 -0
  39. package/core/focusCatcher/utils.mjs +27 -0
  40. package/core/hooks/constants.js +242 -0
  41. package/core/hooks/constants.mjs +242 -0
  42. package/core/hooks/index.d.ts +22 -0
  43. package/core/viewportScroll/scrollStrategies/focusScroll.js +5 -1
  44. package/core/viewportScroll/scrollStrategies/focusScroll.mjs +5 -1
  45. package/core/viewportScroll/utils.js +1 -1
  46. package/core/viewportScroll/utils.mjs +1 -1
  47. package/core.d.ts +4 -0
  48. package/core.js +237 -139
  49. package/core.mjs +240 -142
  50. package/dataMap/dataMap.js +13 -3
  51. package/dataMap/dataMap.mjs +14 -4
  52. package/dataMap/dataSource.js +16 -0
  53. package/dataMap/dataSource.mjs +16 -0
  54. package/dataMap/metaManager/lazyFactoryMap.js +4 -3
  55. package/dataMap/metaManager/lazyFactoryMap.mjs +2 -1
  56. package/dataMap/metaManager/metaLayers/cellMeta.js +3 -2
  57. package/dataMap/metaManager/metaLayers/cellMeta.mjs +3 -2
  58. package/dataMap/metaManager/metaSchema.js +289 -4
  59. package/dataMap/metaManager/metaSchema.mjs +289 -4
  60. package/dataMap/metaManager/utils.js +0 -11
  61. package/dataMap/metaManager/utils.mjs +0 -10
  62. package/dataMap/replaceData.js +1 -0
  63. package/dataMap/replaceData.mjs +1 -0
  64. package/dist/handsontable.css +281 -4
  65. package/dist/handsontable.full.css +281 -4
  66. package/dist/handsontable.full.js +7844 -2990
  67. package/dist/handsontable.full.min.css +4 -5
  68. package/dist/handsontable.full.min.js +167 -165
  69. package/dist/handsontable.js +9639 -4806
  70. package/dist/handsontable.min.css +4 -4
  71. package/dist/handsontable.min.js +52 -50
  72. package/dist/languages/all.js +231 -21
  73. package/dist/languages/all.min.js +1 -1
  74. package/dist/languages/ar-AR.js +11 -1
  75. package/dist/languages/ar-AR.min.js +1 -1
  76. package/dist/languages/cs-CZ.js +11 -1
  77. package/dist/languages/cs-CZ.min.js +1 -1
  78. package/dist/languages/de-CH.js +11 -1
  79. package/dist/languages/de-CH.min.js +1 -1
  80. package/dist/languages/de-DE.js +11 -1
  81. package/dist/languages/de-DE.min.js +1 -1
  82. package/dist/languages/en-US.js +11 -1
  83. package/dist/languages/en-US.min.js +1 -1
  84. package/dist/languages/es-MX.js +11 -1
  85. package/dist/languages/es-MX.min.js +1 -1
  86. package/dist/languages/fa-IR.js +11 -1
  87. package/dist/languages/fa-IR.min.js +1 -1
  88. package/dist/languages/fr-FR.js +11 -1
  89. package/dist/languages/fr-FR.min.js +1 -1
  90. package/dist/languages/hr-HR.js +11 -1
  91. package/dist/languages/hr-HR.min.js +1 -1
  92. package/dist/languages/it-IT.js +11 -1
  93. package/dist/languages/it-IT.min.js +1 -1
  94. package/dist/languages/ja-JP.js +11 -1
  95. package/dist/languages/ja-JP.min.js +1 -1
  96. package/dist/languages/ko-KR.js +11 -1
  97. package/dist/languages/ko-KR.min.js +1 -1
  98. package/dist/languages/lv-LV.js +11 -1
  99. package/dist/languages/lv-LV.min.js +1 -1
  100. package/dist/languages/nb-NO.js +11 -1
  101. package/dist/languages/nb-NO.min.js +1 -1
  102. package/dist/languages/nl-NL.js +11 -1
  103. package/dist/languages/nl-NL.min.js +1 -1
  104. package/dist/languages/pl-PL.js +11 -1
  105. package/dist/languages/pl-PL.min.js +1 -1
  106. package/dist/languages/pt-BR.js +11 -1
  107. package/dist/languages/pt-BR.min.js +1 -1
  108. package/dist/languages/ru-RU.js +11 -1
  109. package/dist/languages/ru-RU.min.js +1 -1
  110. package/dist/languages/sr-SP.js +11 -1
  111. package/dist/languages/sr-SP.min.js +1 -1
  112. package/dist/languages/zh-CN.js +11 -1
  113. package/dist/languages/zh-CN.min.js +1 -1
  114. package/dist/languages/zh-TW.js +11 -1
  115. package/dist/languages/zh-TW.min.js +1 -1
  116. package/editorManager.js +4 -4
  117. package/editorManager.mjs +4 -4
  118. package/editors/autocompleteEditor/autocompleteEditor.js +50 -112
  119. package/editors/autocompleteEditor/autocompleteEditor.mjs +51 -113
  120. package/editors/baseEditor/baseEditor.js +10 -6
  121. package/editors/baseEditor/baseEditor.mjs +10 -6
  122. package/editors/handsontableEditor/handsontableEditor.js +9 -9
  123. package/editors/handsontableEditor/handsontableEditor.mjs +9 -9
  124. package/editors/textEditor/textEditor.js +0 -7
  125. package/editors/textEditor/textEditor.mjs +0 -7
  126. package/focusManager.js +2 -2
  127. package/focusManager.mjs +2 -2
  128. package/helpers/a11y.js +15 -2
  129. package/helpers/a11y.mjs +10 -2
  130. package/helpers/console.js +12 -0
  131. package/helpers/console.mjs +11 -0
  132. package/helpers/dom/element.js +4 -4
  133. package/helpers/dom/element.mjs +4 -4
  134. package/helpers/mixed.js +65 -2
  135. package/helpers/mixed.mjs +63 -2
  136. package/helpers/number.js +28 -0
  137. package/helpers/number.mjs +26 -0
  138. package/helpers/object.js +35 -0
  139. package/helpers/object.mjs +34 -0
  140. package/helpers/string.js +19 -0
  141. package/helpers/string.mjs +18 -0
  142. package/helpers/templateLiteralTag.js +57 -1
  143. package/helpers/templateLiteralTag.mjs +56 -1
  144. package/i18n/constants.js +13 -1
  145. package/i18n/constants.mjs +13 -1
  146. package/i18n/languages/ar-AR.js +11 -1
  147. package/i18n/languages/ar-AR.mjs +11 -1
  148. package/i18n/languages/cs-CZ.js +11 -1
  149. package/i18n/languages/cs-CZ.mjs +11 -1
  150. package/i18n/languages/de-CH.js +11 -1
  151. package/i18n/languages/de-CH.mjs +11 -1
  152. package/i18n/languages/de-DE.js +11 -1
  153. package/i18n/languages/de-DE.mjs +11 -1
  154. package/i18n/languages/en-US.js +11 -1
  155. package/i18n/languages/en-US.mjs +11 -1
  156. package/i18n/languages/es-MX.js +11 -1
  157. package/i18n/languages/es-MX.mjs +11 -1
  158. package/i18n/languages/fa-IR.js +11 -1
  159. package/i18n/languages/fa-IR.mjs +11 -1
  160. package/i18n/languages/fr-FR.js +11 -1
  161. package/i18n/languages/fr-FR.mjs +11 -1
  162. package/i18n/languages/hr-HR.js +11 -1
  163. package/i18n/languages/hr-HR.mjs +11 -1
  164. package/i18n/languages/it-IT.js +11 -1
  165. package/i18n/languages/it-IT.mjs +11 -1
  166. package/i18n/languages/ja-JP.js +11 -1
  167. package/i18n/languages/ja-JP.mjs +11 -1
  168. package/i18n/languages/ko-KR.js +11 -1
  169. package/i18n/languages/ko-KR.mjs +11 -1
  170. package/i18n/languages/lv-LV.js +11 -1
  171. package/i18n/languages/lv-LV.mjs +11 -1
  172. package/i18n/languages/nb-NO.js +11 -1
  173. package/i18n/languages/nb-NO.mjs +11 -1
  174. package/i18n/languages/nl-NL.js +11 -1
  175. package/i18n/languages/nl-NL.mjs +11 -1
  176. package/i18n/languages/pl-PL.js +11 -1
  177. package/i18n/languages/pl-PL.mjs +11 -1
  178. package/i18n/languages/pt-BR.js +11 -1
  179. package/i18n/languages/pt-BR.mjs +11 -1
  180. package/i18n/languages/ru-RU.js +11 -1
  181. package/i18n/languages/ru-RU.mjs +11 -1
  182. package/i18n/languages/sr-SP.js +11 -1
  183. package/i18n/languages/sr-SP.mjs +11 -1
  184. package/i18n/languages/zh-CN.js +11 -1
  185. package/i18n/languages/zh-CN.mjs +11 -1
  186. package/i18n/languages/zh-TW.js +11 -1
  187. package/i18n/languages/zh-TW.mjs +11 -1
  188. package/i18n/phraseFormatters/index.js +3 -1
  189. package/i18n/phraseFormatters/index.mjs +3 -1
  190. package/i18n/registry.js +5 -6
  191. package/i18n/registry.mjs +5 -6
  192. package/index.d.ts +27 -0
  193. package/languages/all.js +231 -21
  194. package/languages/ar-AR.js +11 -1
  195. package/languages/ar-AR.mjs +11 -1
  196. package/languages/cs-CZ.js +11 -1
  197. package/languages/cs-CZ.mjs +11 -1
  198. package/languages/de-CH.js +11 -1
  199. package/languages/de-CH.mjs +11 -1
  200. package/languages/de-DE.js +11 -1
  201. package/languages/de-DE.mjs +11 -1
  202. package/languages/en-US.js +11 -1
  203. package/languages/en-US.mjs +11 -1
  204. package/languages/es-MX.js +11 -1
  205. package/languages/es-MX.mjs +11 -1
  206. package/languages/fa-IR.js +11 -1
  207. package/languages/fa-IR.mjs +11 -1
  208. package/languages/fr-FR.js +11 -1
  209. package/languages/fr-FR.mjs +11 -1
  210. package/languages/hr-HR.js +11 -1
  211. package/languages/hr-HR.mjs +11 -1
  212. package/languages/index.js +231 -21
  213. package/languages/it-IT.js +11 -1
  214. package/languages/it-IT.mjs +11 -1
  215. package/languages/ja-JP.js +11 -1
  216. package/languages/ja-JP.mjs +11 -1
  217. package/languages/ko-KR.js +11 -1
  218. package/languages/ko-KR.mjs +11 -1
  219. package/languages/lv-LV.js +11 -1
  220. package/languages/lv-LV.mjs +11 -1
  221. package/languages/nb-NO.js +11 -1
  222. package/languages/nb-NO.mjs +11 -1
  223. package/languages/nl-NL.js +11 -1
  224. package/languages/nl-NL.mjs +11 -1
  225. package/languages/pl-PL.js +11 -1
  226. package/languages/pl-PL.mjs +11 -1
  227. package/languages/pt-BR.js +11 -1
  228. package/languages/pt-BR.mjs +11 -1
  229. package/languages/ru-RU.js +11 -1
  230. package/languages/ru-RU.mjs +11 -1
  231. package/languages/sr-SP.js +11 -1
  232. package/languages/sr-SP.mjs +11 -1
  233. package/languages/zh-CN.js +11 -1
  234. package/languages/zh-CN.mjs +11 -1
  235. package/languages/zh-TW.js +11 -1
  236. package/languages/zh-TW.mjs +11 -1
  237. package/mixins/localHooks.js +16 -0
  238. package/mixins/localHooks.mjs +16 -0
  239. package/package.json +19 -1
  240. package/plugins/autoRowSize/autoRowSize.js +43 -6
  241. package/plugins/autoRowSize/autoRowSize.mjs +43 -6
  242. package/plugins/autofill/autofill.js +50 -3
  243. package/plugins/autofill/autofill.mjs +50 -3
  244. package/plugins/base/base.js +86 -15
  245. package/plugins/base/base.mjs +87 -16
  246. package/plugins/collapsibleColumns/collapsibleColumns.js +4 -4
  247. package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -4
  248. package/plugins/columnSorting/columnSorting.js +3 -3
  249. package/plugins/columnSorting/columnSorting.mjs +3 -3
  250. package/plugins/comments/comments.js +52 -22
  251. package/plugins/comments/comments.mjs +52 -22
  252. package/plugins/comments/contextMenuItem/addEditComment.js +3 -3
  253. package/plugins/comments/contextMenuItem/addEditComment.mjs +3 -3
  254. package/plugins/comments/contextMenuItem/readOnlyComment.js +2 -2
  255. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +2 -2
  256. package/plugins/comments/contextMenuItem/removeComment.js +2 -2
  257. package/plugins/comments/contextMenuItem/removeComment.mjs +2 -2
  258. package/plugins/contextMenu/contextMenu.js +4 -5
  259. package/plugins/contextMenu/contextMenu.mjs +4 -5
  260. package/plugins/contextMenu/menu/cursor.js +1 -1
  261. package/plugins/contextMenu/menu/cursor.mjs +1 -1
  262. package/plugins/contextMenu/menu/defaultShortcutsList.js +5 -5
  263. package/plugins/contextMenu/menu/defaultShortcutsList.mjs +5 -5
  264. package/plugins/contextMenu/menu/menu.js +3 -3
  265. package/plugins/contextMenu/menu/menu.mjs +3 -3
  266. package/plugins/contextMenu/menu/positioner.js +1 -1
  267. package/plugins/contextMenu/menu/positioner.mjs +1 -1
  268. package/plugins/contextMenu/predefinedItems/alignment.js +1 -1
  269. package/plugins/contextMenu/predefinedItems/alignment.mjs +1 -1
  270. package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -1
  271. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +1 -1
  272. package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -3
  273. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -3
  274. package/plugins/contextMenu/predefinedItems/columnRight.js +3 -3
  275. package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -3
  276. package/plugins/contextMenu/predefinedItems/readOnly.js +1 -1
  277. package/plugins/contextMenu/predefinedItems/readOnly.mjs +1 -1
  278. package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
  279. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
  280. package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
  281. package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
  282. package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -3
  283. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -3
  284. package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -3
  285. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -3
  286. package/plugins/copyPaste/contextMenuItem/copy.js +1 -1
  287. package/plugins/copyPaste/contextMenuItem/copy.mjs +1 -1
  288. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +3 -3
  289. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +3 -3
  290. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +3 -3
  291. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +3 -3
  292. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +3 -3
  293. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +3 -3
  294. package/plugins/copyPaste/contextMenuItem/cut.js +1 -1
  295. package/plugins/copyPaste/contextMenuItem/cut.mjs +1 -1
  296. package/plugins/copyPaste/copyPaste.js +75 -40
  297. package/plugins/copyPaste/copyPaste.mjs +76 -41
  298. package/plugins/customBorders/customBorders.js +1 -1
  299. package/plugins/customBorders/customBorders.mjs +1 -1
  300. package/plugins/dialog/dialog.d.ts +23 -0
  301. package/plugins/dialog/dialog.js +489 -0
  302. package/plugins/dialog/dialog.mjs +485 -0
  303. package/plugins/dialog/index.d.ts +1 -0
  304. package/plugins/dialog/index.js +7 -0
  305. package/plugins/dialog/index.mjs +1 -0
  306. package/plugins/dialog/ui.js +264 -0
  307. package/plugins/dialog/ui.mjs +259 -0
  308. package/plugins/dropdownMenu/dropdownMenu.js +5 -4
  309. package/plugins/dropdownMenu/dropdownMenu.mjs +5 -4
  310. package/plugins/filters/filters.js +2 -2
  311. package/plugins/filters/filters.mjs +2 -2
  312. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +3 -3
  313. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +3 -3
  314. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +4 -4
  315. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +4 -4
  316. package/plugins/hiddenRows/contextMenuItem/hideRow.js +3 -3
  317. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +3 -3
  318. package/plugins/hiddenRows/contextMenuItem/showRow.js +4 -4
  319. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +4 -4
  320. package/plugins/index.d.ts +9 -0
  321. package/plugins/index.js +9 -0
  322. package/plugins/index.mjs +7 -1
  323. package/plugins/loading/content.js +36 -0
  324. package/plugins/loading/content.mjs +31 -0
  325. package/plugins/loading/index.d.ts +1 -0
  326. package/plugins/loading/index.js +7 -0
  327. package/plugins/loading/index.mjs +1 -0
  328. package/plugins/loading/loading.d.ts +19 -0
  329. package/plugins/loading/loading.js +292 -0
  330. package/plugins/loading/loading.mjs +287 -0
  331. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  332. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  333. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  334. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  335. package/plugins/manualColumnMove/manualColumnMove.js +3 -3
  336. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -3
  337. package/plugins/manualColumnResize/manualColumnResize.js +3 -3
  338. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
  339. package/plugins/manualRowMove/manualRowMove.js +4 -4
  340. package/plugins/manualRowMove/manualRowMove.mjs +4 -4
  341. package/plugins/manualRowResize/manualRowResize.js +5 -2
  342. package/plugins/manualRowResize/manualRowResize.mjs +5 -2
  343. package/plugins/mergeCells/contextMenuItem/toggleMerge.js +15 -15
  344. package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +15 -15
  345. package/plugins/mergeCells/focusOrder.js +75 -39
  346. package/plugins/mergeCells/focusOrder.mjs +75 -39
  347. package/plugins/mergeCells/mergeCells.js +26 -19
  348. package/plugins/mergeCells/mergeCells.mjs +26 -19
  349. package/plugins/mergeCells/renderer.js +14 -8
  350. package/plugins/mergeCells/renderer.mjs +14 -8
  351. package/plugins/multiColumnSorting/multiColumnSorting.js +3 -3
  352. package/plugins/multiColumnSorting/multiColumnSorting.mjs +3 -3
  353. package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +3 -3
  354. package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +3 -3
  355. package/plugins/nestedHeaders/nestedHeaders.js +47 -41
  356. package/plugins/nestedHeaders/nestedHeaders.mjs +47 -41
  357. package/plugins/nestedRows/nestedRows.js +3 -3
  358. package/plugins/nestedRows/nestedRows.mjs +3 -3
  359. package/plugins/nestedRows/ui/collapsing.js +1 -2
  360. package/plugins/nestedRows/ui/collapsing.mjs +1 -2
  361. package/plugins/nestedRows/ui/contextMenu.js +4 -4
  362. package/plugins/nestedRows/ui/contextMenu.mjs +4 -4
  363. package/plugins/nestedRows/ui/headers.js +4 -1
  364. package/plugins/nestedRows/ui/headers.mjs +4 -1
  365. package/plugins/pagination/focusController.js +27 -0
  366. package/plugins/pagination/focusController.mjs +23 -0
  367. package/plugins/pagination/index.d.ts +1 -0
  368. package/plugins/pagination/index.js +7 -0
  369. package/plugins/pagination/index.mjs +1 -0
  370. package/plugins/pagination/pagination.d.ts +52 -0
  371. package/plugins/pagination/pagination.js +1034 -0
  372. package/plugins/pagination/pagination.mjs +1030 -0
  373. package/plugins/pagination/strategies/autoPageSize.js +96 -0
  374. package/plugins/pagination/strategies/autoPageSize.mjs +92 -0
  375. package/plugins/pagination/strategies/fixedPageSize.js +88 -0
  376. package/plugins/pagination/strategies/fixedPageSize.mjs +84 -0
  377. package/plugins/pagination/strategies/index.js +22 -0
  378. package/plugins/pagination/strategies/index.mjs +18 -0
  379. package/plugins/pagination/ui.js +449 -0
  380. package/plugins/pagination/ui.mjs +443 -0
  381. package/plugins/pagination/utils.js +28 -0
  382. package/plugins/pagination/utils.mjs +24 -0
  383. package/plugins/stretchColumns/calculator.js +4 -0
  384. package/plugins/stretchColumns/calculator.mjs +4 -0
  385. package/plugins/stretchColumns/stretchColumns.js +1 -1
  386. package/plugins/stretchColumns/stretchColumns.mjs +1 -1
  387. package/plugins/undoRedo/actions/dataChange.js +17 -15
  388. package/plugins/undoRedo/actions/dataChange.mjs +17 -15
  389. package/renderers/checkboxRenderer/checkboxRenderer.js +3 -3
  390. package/renderers/checkboxRenderer/checkboxRenderer.mjs +3 -3
  391. package/selection/range.js +11 -0
  392. package/selection/range.mjs +11 -0
  393. package/selection/selection.js +163 -124
  394. package/selection/selection.mjs +163 -124
  395. package/selection/transformation/_base.js +448 -0
  396. package/selection/transformation/_base.mjs +443 -0
  397. package/selection/transformation/extender.js +55 -0
  398. package/selection/transformation/extender.mjs +51 -0
  399. package/selection/transformation/focus.js +77 -0
  400. package/selection/transformation/focus.mjs +73 -0
  401. package/selection/transformation/index.js +7 -0
  402. package/selection/transformation/index.mjs +2 -0
  403. package/selection/utils.js +2 -1
  404. package/selection/utils.mjs +2 -1
  405. package/settings.d.ts +10 -1
  406. package/shortcutContexts/commands/editor/fastOpen.js +1 -1
  407. package/shortcutContexts/commands/editor/fastOpen.mjs +1 -1
  408. package/shortcutContexts/commands/editor/open.js +10 -4
  409. package/shortcutContexts/commands/editor/open.mjs +10 -4
  410. package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
  411. package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
  412. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +2 -2
  413. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +2 -2
  414. package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
  415. package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
  416. package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
  417. package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
  418. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
  419. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
  420. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -1
  421. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -1
  422. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +1 -1
  423. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +1 -1
  424. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +1 -1
  425. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +1 -1
  426. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -1
  427. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -1
  428. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -1
  429. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -1
  430. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -1
  431. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -1
  432. package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
  433. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
  434. package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
  435. package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
  436. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +2 -2
  437. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +2 -2
  438. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +2 -2
  439. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +2 -2
  440. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +5 -2
  441. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +5 -2
  442. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +5 -2
  443. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +5 -2
  444. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +1 -1
  445. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +1 -1
  446. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +1 -1
  447. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +1 -1
  448. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +1 -1
  449. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +1 -1
  450. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +1 -1
  451. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +1 -1
  452. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +1 -1
  453. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +1 -1
  454. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +1 -1
  455. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +1 -1
  456. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -2
  457. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -2
  458. package/shortcutContexts/commands/scrollToFocusedCell.js +1 -1
  459. package/shortcutContexts/commands/scrollToFocusedCell.mjs +1 -1
  460. package/shortcutContexts/grid.js +3 -3
  461. package/shortcutContexts/grid.mjs +3 -3
  462. package/shortcuts/context.js +4 -1
  463. package/shortcuts/context.mjs +4 -1
  464. package/shortcuts/manager.js +17 -3
  465. package/shortcuts/manager.mjs +17 -3
  466. package/styles/handsontable.css +288 -22
  467. package/styles/handsontable.min.css +3 -3
  468. package/styles/ht-theme-classic.css +828 -0
  469. package/styles/ht-theme-classic.min.css +30 -0
  470. package/styles/ht-theme-horizon.css +122 -26
  471. package/styles/ht-theme-horizon.min.css +3 -3
  472. package/styles/ht-theme-main.css +124 -28
  473. package/styles/ht-theme-main.min.css +3 -3
  474. package/tableView.js +61 -25
  475. package/tableView.mjs +61 -25
  476. package/utils/a11yAnnouncer.js +70 -0
  477. package/utils/a11yAnnouncer.mjs +64 -0
  478. package/{core/focusCatcher → utils}/focusDetector.js +30 -12
  479. package/{core/focusCatcher → utils}/focusDetector.mjs +30 -12
  480. package/utils/samplesGenerator.js +17 -1
  481. package/utils/samplesGenerator.mjs +17 -1
  482. package/utils/stylesHandler.js +23 -8
  483. package/utils/stylesHandler.mjs +23 -8
  484. package/utils/valueAccessors.js +45 -0
  485. package/utils/valueAccessors.mjs +40 -0
  486. package/validators/autocompleteValidator/autocompleteValidator.js +2 -1
  487. package/validators/autocompleteValidator/autocompleteValidator.mjs +2 -1
  488. package/selection/transformation.js +0 -335
  489. package/selection/transformation.mjs +0 -331
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.push.js";
2
3
  import "core-js/modules/es.set.difference.v2.js";
3
4
  import "core-js/modules/es.set.intersection.v2.js";
4
5
  import "core-js/modules/es.set.is-disjoint-from.v2.js";
@@ -25,20 +26,30 @@ import { isUndefined } from "./../helpers/mixed.mjs";
25
26
  import { clamp } from "./../helpers/number.mjs";
26
27
  import { arrayEach } from "./../helpers/array.mjs";
27
28
  import localHooks from "./../mixins/localHooks.mjs";
28
- import Transformation from "./transformation.mjs";
29
+ import { ExtenderTransformation, FocusTransformation } from "./transformation/index.mjs";
29
30
  import { detectSelectionType, normalizeSelectionFactory, SELECTION_TYPE_EMPTY, SELECTION_TYPE_UNRECOGNIZED } from "./utils.mjs";
30
31
  import { toSingleLine } from "./../helpers/templateLiteralTag.mjs";
31
32
  import { A11Y_SELECTED } from "../helpers/a11y.mjs";
33
+ /**
34
+ * @typedef {object} SelectionState
35
+ * @property {CellRange[]} ranges The array of all ranges.
36
+ * @property {CellRange} activeRange The active range.
37
+ * @property {number} activeSelectionLayer The active selection layer.
38
+ * @property {number[]} selectedByRowHeader The state of the selected row headers.
39
+ * @property {number[]} selectedByColumnHeader The state of the selected column headers.
40
+ * @property {boolean} disableHeadersHighlight The state of the disable headers highlight.
41
+ */
32
42
  /**
33
43
  * @class Selection
34
44
  * @util
35
45
  */
36
- var _transformation = /*#__PURE__*/new WeakMap();
46
+ var _extenderTransformation = /*#__PURE__*/new WeakMap();
37
47
  var _focusTransformation = /*#__PURE__*/new WeakMap();
38
48
  var _isFocusSelectionChanged = /*#__PURE__*/new WeakMap();
39
49
  var _disableHeadersHighlight = /*#__PURE__*/new WeakMap();
40
50
  var _selectionSource = /*#__PURE__*/new WeakMap();
41
51
  var _expectedLayersCount = /*#__PURE__*/new WeakMap();
52
+ var _activeSelectionLayer = /*#__PURE__*/new WeakMap();
42
53
  class Selection {
43
54
  constructor(settings, tableProps) {
44
55
  var _this = this;
@@ -77,13 +88,13 @@ class Selection {
77
88
  /**
78
89
  * The module for modifying coordinates of the start and end selection.
79
90
  *
80
- * @type {Transformation}
91
+ * @type {ExtenderTransformation}
81
92
  */
82
- _classPrivateFieldInitSpec(this, _transformation, void 0);
93
+ _classPrivateFieldInitSpec(this, _extenderTransformation, void 0);
83
94
  /**
84
95
  * The module for modifying coordinates of the focus selection.
85
96
  *
86
- * @type {Transformation}
97
+ * @type {FocusTransformation}
87
98
  */
88
99
  _classPrivateFieldInitSpec(this, _focusTransformation, void 0);
89
100
  /**
@@ -125,6 +136,13 @@ class Selection {
125
136
  * @param {number}
126
137
  */
127
138
  _classPrivateFieldInitSpec(this, _expectedLayersCount, -1);
139
+ /**
140
+ * The index of the active range layer. Active range layer is the layer that has visible focus highlight.
141
+ * Focus highlight may jump between selection range layers.
142
+ *
143
+ * @type {number}
144
+ */
145
+ _classPrivateFieldInitSpec(this, _activeSelectionLayer, 0);
128
146
  this.settings = settings;
129
147
  this.tableProps = tableProps;
130
148
  this.highlight = new Highlight({
@@ -147,95 +165,67 @@ class Selection {
147
165
  createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
148
166
  createCellRange: (highlight, from, to) => this.tableProps.createCellRange(highlight, from, to)
149
167
  });
150
- _classPrivateFieldSet(_transformation, this, new Transformation(this.selectedRange, {
151
- rowIndexMapper: this.tableProps.rowIndexMapper,
152
- columnIndexMapper: this.tableProps.columnIndexMapper,
153
- countRenderableRows: () => this.tableProps.countRenderableRows(),
154
- countRenderableColumns: () => this.tableProps.countRenderableColumns(),
155
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
156
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
157
- findFirstNonHiddenRenderableRow: function () {
158
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
159
- },
160
- findFirstNonHiddenRenderableColumn: function () {
161
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
162
- },
163
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
168
+ _classPrivateFieldSet(_extenderTransformation, this, new ExtenderTransformation(this.selectedRange, {
169
+ ...this.tableProps,
170
+ navigableHeaders: () => settings.navigableHeaders,
164
171
  fixedRowsBottom: () => settings.fixedRowsBottom,
165
172
  minSpareRows: () => settings.minSpareRows,
166
173
  minSpareCols: () => settings.minSpareCols,
167
174
  autoWrapRow: () => settings.autoWrapRow,
168
175
  autoWrapCol: () => settings.autoWrapCol
169
176
  }));
170
- _classPrivateFieldSet(_focusTransformation, this, new Transformation(this.selectedRange, {
171
- rowIndexMapper: this.tableProps.rowIndexMapper,
172
- columnIndexMapper: this.tableProps.columnIndexMapper,
173
- countRenderableRows: () => {
174
- const range = this.selectedRange.current();
175
- return this.tableProps.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
176
- },
177
- countRenderableColumns: () => {
178
- const range = this.selectedRange.current();
179
- return this.tableProps.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
180
- },
181
- visualToRenderableCoords: coords => this.tableProps.visualToRenderableCoords(coords),
182
- renderableToVisualCoords: coords => this.tableProps.renderableToVisualCoords(coords),
183
- findFirstNonHiddenRenderableRow: function () {
184
- return _this.tableProps.findFirstNonHiddenRenderableRow(...arguments);
185
- },
186
- findFirstNonHiddenRenderableColumn: function () {
187
- return _this.tableProps.findFirstNonHiddenRenderableColumn(...arguments);
188
- },
189
- createCellCoords: (row, column) => this.tableProps.createCellCoords(row, column),
177
+ _classPrivateFieldSet(_focusTransformation, this, new FocusTransformation(this.selectedRange, {
178
+ ...this.tableProps,
179
+ navigableHeaders: () => settings.navigableHeaders,
190
180
  fixedRowsBottom: () => 0,
191
181
  minSpareRows: () => 0,
192
182
  minSpareCols: () => 0,
193
183
  autoWrapRow: () => true,
194
184
  autoWrapCol: () => true
195
185
  }));
196
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformStart', function () {
186
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('beforeTransformStart', function () {
197
187
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
198
188
  args[_key] = arguments[_key];
199
189
  }
200
190
  return _this.runLocalHooks('beforeModifyTransformStart', ...args);
201
191
  });
202
- _classPrivateFieldGet(_transformation, this).addLocalHook('afterTransformStart', function () {
192
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('afterTransformStart', function () {
203
193
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
204
194
  args[_key2] = arguments[_key2];
205
195
  }
206
196
  return _this.runLocalHooks('afterModifyTransformStart', ...args);
207
197
  });
208
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeTransformEnd', function () {
198
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('beforeTransformEnd', function () {
209
199
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
210
200
  args[_key3] = arguments[_key3];
211
201
  }
212
202
  return _this.runLocalHooks('beforeModifyTransformEnd', ...args);
213
203
  });
214
- _classPrivateFieldGet(_transformation, this).addLocalHook('afterTransformEnd', function () {
204
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('afterTransformEnd', function () {
215
205
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
216
206
  args[_key4] = arguments[_key4];
217
207
  }
218
208
  return _this.runLocalHooks('afterModifyTransformEnd', ...args);
219
209
  });
220
- _classPrivateFieldGet(_transformation, this).addLocalHook('insertRowRequire', function () {
210
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('insertRowRequire', function () {
221
211
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
222
212
  args[_key5] = arguments[_key5];
223
213
  }
224
214
  return _this.runLocalHooks('insertRowRequire', ...args);
225
215
  });
226
- _classPrivateFieldGet(_transformation, this).addLocalHook('insertColRequire', function () {
216
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('insertColRequire', function () {
227
217
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
228
218
  args[_key6] = arguments[_key6];
229
219
  }
230
220
  return _this.runLocalHooks('insertColRequire', ...args);
231
221
  });
232
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeRowWrap', function () {
222
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('beforeRowWrap', function () {
233
223
  for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
234
224
  args[_key7] = arguments[_key7];
235
225
  }
236
226
  return _this.runLocalHooks('beforeRowWrap', ...args);
237
227
  });
238
- _classPrivateFieldGet(_transformation, this).addLocalHook('beforeColumnWrap', function () {
228
+ _classPrivateFieldGet(_extenderTransformation, this).addLocalHook('beforeColumnWrap', function () {
239
229
  for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
240
230
  args[_key8] = arguments[_key8];
241
231
  }
@@ -256,7 +246,7 @@ class Selection {
256
246
  }
257
247
 
258
248
  /**
259
- * Get data layer for current selection.
249
+ * Gets all selection range layers of the selection.
260
250
  *
261
251
  * @returns {SelectionRange}
262
252
  */
@@ -264,6 +254,33 @@ class Selection {
264
254
  return this.selectedRange;
265
255
  }
266
256
 
257
+ /**
258
+ * Gets the active selection range layer.
259
+ *
260
+ * @returns {CellRange}
261
+ */
262
+ getActiveSelectedRange() {
263
+ return this.selectedRange.peekByIndex(_classPrivateFieldGet(_activeSelectionLayer, this));
264
+ }
265
+
266
+ /**
267
+ * Gets the index of the active selection range layer.
268
+ *
269
+ * @returns {number}
270
+ */
271
+ getActiveSelectionLayerIndex() {
272
+ return _classPrivateFieldGet(_activeSelectionLayer, this);
273
+ }
274
+
275
+ /**
276
+ * Sets the index of the active selection range layer.
277
+ *
278
+ * @param {number} layerIndex The index of the active selection range layer.
279
+ */
280
+ setActiveSelectionLayerIndex(layerIndex) {
281
+ _classPrivateFieldSet(_activeSelectionLayer, this, layerIndex);
282
+ }
283
+
267
284
  /**
268
285
  * Marks the source of the selection. It can be one of the following values: `mouse`, or any other string.
269
286
  *
@@ -343,10 +360,20 @@ class Selection {
343
360
  // We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
344
361
  // should be handled by next methods.
345
362
  const coordsClone = coords.clone();
363
+ _classPrivateFieldSet(_disableHeadersHighlight, this, false);
346
364
  _classPrivateFieldSet(_isFocusSelectionChanged, this, false);
347
365
  this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
348
366
  if (!isMultipleMode || isMultipleMode && !isMultipleSelection && isUndefined(multipleSelection)) {
349
367
  this.selectedRange.clear();
368
+ arrayEach(this.highlight.getAreas(), highlight => void highlight.clear());
369
+ arrayEach(this.highlight.getLayeredAreas(), highlight => void highlight.clear());
370
+ arrayEach(this.highlight.getRowHeaders(), highlight => void highlight.clear());
371
+ arrayEach(this.highlight.getColumnHeaders(), highlight => void highlight.clear());
372
+ arrayEach(this.highlight.getActiveRowHeaders(), highlight => void highlight.clear());
373
+ arrayEach(this.highlight.getActiveColumnHeaders(), highlight => void highlight.clear());
374
+ arrayEach(this.highlight.getActiveCornerHeaders(), highlight => void highlight.clear());
375
+ arrayEach(this.highlight.getRowHighlights(), highlight => void highlight.clear());
376
+ arrayEach(this.highlight.getColumnHighlights(), highlight => void highlight.clear());
350
377
  }
351
378
  this.selectedRange.add(coordsClone).current().setHighlight(highlightCoords.clone());
352
379
  if (this.getLayerLevel() === 0) {
@@ -376,15 +403,18 @@ class Selection {
376
403
  * Ends selection range on given coordinate object.
377
404
  *
378
405
  * @param {CellCoords} coords Visual coords.
406
+ * @param {number} [layerIndex] The layer index to set the end on. If not provided, the current layer level is used.
379
407
  */
380
408
  setRangeEnd(coords) {
409
+ let layerIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLayerLevel();
381
410
  if (this.selectedRange.isEmpty()) {
382
411
  return;
383
412
  }
413
+ this.setActiveSelectionLayerIndex(layerIndex);
384
414
  const coordsClone = coords.clone();
385
415
  const countRows = this.tableProps.countRows();
386
416
  const countCols = this.tableProps.countCols();
387
- const isSingle = this.selectedRange.current().clone().setTo(coords).isSingleHeader();
417
+ const isSingle = this.getActiveSelectedRange().clone().setTo(coords).isSingleHeader();
388
418
 
389
419
  // Ignore processing the end range when the header selection starts overlapping the corner and
390
420
  // the selection is not a single header highlight.
@@ -393,7 +423,7 @@ class Selection {
393
423
  }
394
424
  this.runLocalHooks('beforeSetRangeEnd', coordsClone);
395
425
  this.begin();
396
- const cellRange = this.selectedRange.current();
426
+ const cellRange = this.getActiveSelectedRange();
397
427
  if (!this.settings.navigableHeaders) {
398
428
  cellRange.highlight.normalize();
399
429
  }
@@ -424,8 +454,8 @@ class Selection {
424
454
  }
425
455
  }
426
456
  this.runLocalHooks('beforeHighlightSet');
427
- this.setRangeFocus(this.selectedRange.current().highlight);
428
- this.applyAndCommit();
457
+ this.setRangeFocus(this.getActiveSelectedRange().highlight, layerIndex);
458
+ this.applyAndCommit(this.getActiveSelectedRange(), layerIndex);
429
459
  const isLastLayer = _classPrivateFieldGet(_expectedLayersCount, this) === -1 || this.selectedRange.size() === _classPrivateFieldGet(_expectedLayersCount, this);
430
460
  this.runLocalHooks('afterSetRangeEnd', coords, isLastLayer);
431
461
  }
@@ -438,24 +468,10 @@ class Selection {
438
468
  * @param {number} [layerLevel] The layer level to apply. If not provided, the current layer level is used.
439
469
  */
440
470
  applyAndCommit() {
441
- let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.selectedRange.current();
471
+ let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getActiveSelectedRange();
442
472
  let layerLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLayerLevel();
443
473
  const countRows = this.tableProps.countRows();
444
474
  const countCols = this.tableProps.countCols();
445
-
446
- // If the next layer level is lower than previous then clear all area and header highlights. This is the
447
- // indication that the new selection is performing.
448
- if (layerLevel < this.highlight.layerLevel) {
449
- arrayEach(this.highlight.getAreas(), highlight => void highlight.clear());
450
- arrayEach(this.highlight.getLayeredAreas(), highlight => void highlight.clear());
451
- arrayEach(this.highlight.getRowHeaders(), highlight => void highlight.clear());
452
- arrayEach(this.highlight.getColumnHeaders(), highlight => void highlight.clear());
453
- arrayEach(this.highlight.getActiveRowHeaders(), highlight => void highlight.clear());
454
- arrayEach(this.highlight.getActiveColumnHeaders(), highlight => void highlight.clear());
455
- arrayEach(this.highlight.getActiveCornerHeaders(), highlight => void highlight.clear());
456
- arrayEach(this.highlight.getRowHighlights(), highlight => void highlight.clear());
457
- arrayEach(this.highlight.getColumnHighlights(), highlight => void highlight.clear());
458
- }
459
475
  this.highlight.useLayerLevel(layerLevel);
460
476
  const areaHighlight = this.highlight.createArea();
461
477
  const layeredAreaHighlight = this.highlight.createLayeredArea();
@@ -482,7 +498,7 @@ class Selection {
482
498
  // For single cell selection in the same layer, we do not create area selection to prevent blue background.
483
499
  // When non-consecutive selection is performed we have to add that missing area selection to the previous layer
484
500
  // based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
485
- const previousRange = this.selectedRange.previous();
501
+ const previousRange = this.selectedRange.peekByIndex(layerLevel - 1);
486
502
  this.highlight.useLayerLevel(layerLevel - 1);
487
503
  this.highlight.createArea().add(previousRange.from).commit()
488
504
  // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
@@ -529,12 +545,17 @@ class Selection {
529
545
  * Sets the selection focus position at the specified coordinates.
530
546
  *
531
547
  * @param {CellCoords} coords The CellCoords instance with defined visual coordinates.
548
+ * @param {number} [layerIndex] The layer index to set the focus on.
532
549
  */
533
550
  setRangeFocus(coords) {
551
+ let layerIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLayerLevel();
534
552
  if (this.selectedRange.isEmpty()) {
535
553
  return;
536
554
  }
537
- const cellRange = this.selectedRange.current();
555
+ this.setActiveSelectionLayerIndex(layerIndex);
556
+ _classPrivateFieldGet(_extenderTransformation, this).setActiveLayerIndex(layerIndex);
557
+ _classPrivateFieldGet(_focusTransformation, this).setActiveLayerIndex(layerIndex);
558
+ const cellRange = this.getActiveSelectedRange();
538
559
  if (!this.inProgress) {
539
560
  this.runLocalHooks('beforeSetFocus', coords);
540
561
  }
@@ -563,15 +584,10 @@ class Selection {
563
584
  */
564
585
  transformStart(rowDelta, colDelta) {
565
586
  let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
566
- if (this.settings.navigableHeaders) {
567
- _classPrivateFieldGet(_transformation, this).setOffsetSize({
568
- x: this.tableProps.countRowHeaders(),
569
- y: this.tableProps.countColHeaders()
570
- });
571
- } else {
572
- _classPrivateFieldGet(_transformation, this).resetOffsetSize();
573
- }
574
- this.setRangeStart(_classPrivateFieldGet(_transformation, this).transformStart(rowDelta, colDelta, createMissingRecords));
587
+ const {
588
+ visualCoords
589
+ } = _classPrivateFieldGet(_extenderTransformation, this).transformStart(rowDelta, colDelta, createMissingRecords);
590
+ this.setRangeStart(visualCoords);
575
591
  }
576
592
 
577
593
  /**
@@ -581,15 +597,11 @@ class Selection {
581
597
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
582
598
  */
583
599
  transformEnd(rowDelta, colDelta) {
584
- if (this.settings.navigableHeaders) {
585
- _classPrivateFieldGet(_transformation, this).setOffsetSize({
586
- x: this.tableProps.countRowHeaders(),
587
- y: this.tableProps.countColHeaders()
588
- });
589
- } else {
590
- _classPrivateFieldGet(_transformation, this).resetOffsetSize();
591
- }
592
- this.setRangeEnd(_classPrivateFieldGet(_transformation, this).transformEnd(rowDelta, colDelta));
600
+ const {
601
+ visualCoords,
602
+ selectionLayer
603
+ } = _classPrivateFieldGet(_extenderTransformation, this).transformEnd(rowDelta, colDelta);
604
+ this.setRangeEnd(visualCoords, selectionLayer);
593
605
  }
594
606
 
595
607
  /**
@@ -599,28 +611,11 @@ class Selection {
599
611
  * @param {number} colDelta Columns number to move, value can be passed as negative number.
600
612
  */
601
613
  transformFocus(rowDelta, colDelta) {
602
- const range = this.selectedRange.current();
603
614
  const {
604
- row,
605
- col
606
- } = range.getOuterTopStartCorner();
607
- const columnsInRange = this.tableProps.countRenderableColumnsInRange(0, col - 1);
608
- const rowsInRange = this.tableProps.countRenderableRowsInRange(0, row - 1);
609
- if (range.highlight.isHeader()) {
610
- // for header focus selection calculate the new coords based on the selection including headers
611
- _classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
612
- x: col < 0 ? Math.abs(col) : -columnsInRange,
613
- y: row < 0 ? Math.abs(row) : -rowsInRange
614
- });
615
- } else {
616
- // for focus selection in cells calculate the new coords only based on the selected cells
617
- _classPrivateFieldGet(_focusTransformation, this).setOffsetSize({
618
- x: col < 0 ? 0 : -columnsInRange,
619
- y: row < 0 ? 0 : -rowsInRange
620
- });
621
- }
622
- const focusCoords = _classPrivateFieldGet(_focusTransformation, this).transformStart(rowDelta, colDelta);
623
- this.setRangeFocus(focusCoords.normalize());
615
+ selectionLayer,
616
+ visualCoords
617
+ } = _classPrivateFieldGet(_focusTransformation, this).transformStart(rowDelta, colDelta);
618
+ this.setRangeFocus(visualCoords.normalize(), selectionLayer);
624
619
  }
625
620
 
626
621
  /**
@@ -633,7 +628,7 @@ class Selection {
633
628
  if (!this.isSelected()) {
634
629
  return;
635
630
  }
636
- const range = this.selectedRange.current();
631
+ const range = this.getActiveSelectedRange();
637
632
  if (this.isSelectedByCorner()) {
638
633
  this.selectAll(true, true, {
639
634
  disableHeadersHighlight: true
@@ -682,7 +677,7 @@ class Selection {
682
677
  if (!this.isSelected()) {
683
678
  return;
684
679
  }
685
- const range = this.selectedRange.current();
680
+ const range = this.getActiveSelectedRange();
686
681
  if (this.isSelectedByCorner()) {
687
682
  this.selectAll(true, true, {
688
683
  disableHeadersHighlight: true
@@ -747,7 +742,7 @@ class Selection {
747
742
  * @returns {boolean}
748
743
  */
749
744
  isMultiple() {
750
- let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.selectedRange.current();
745
+ let cellRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getActiveSelectedRange();
751
746
  if (!this.isSelected()) {
752
747
  return false;
753
748
  }
@@ -940,7 +935,7 @@ class Selection {
940
935
  * the logical coordinates points on them.
941
936
  */
942
937
  selectAll() {
943
- var _this$getSelectedRang;
938
+ var _this$getActiveSelect;
944
939
  let includeRowHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
945
940
  let includeColumnHeaders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
946
941
  let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
@@ -958,19 +953,20 @@ class Selection {
958
953
  if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
959
954
  return;
960
955
  }
961
- let highlight = (_this$getSelectedRang = this.getSelectedRange().current()) === null || _this$getSelectedRang === void 0 ? void 0 : _this$getSelectedRang.highlight;
956
+ let highlight = (_this$getActiveSelect = this.getActiveSelectedRange()) === null || _this$getActiveSelect === void 0 ? void 0 : _this$getActiveSelect.highlight;
962
957
  const {
963
958
  focusPosition,
964
959
  disableHeadersHighlight
965
960
  } = options;
966
- _classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
967
961
  if (focusPosition && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
968
962
  highlight = this.tableProps.createCellCoords(clamp(focusPosition.row, rowFrom, nrOfRows - 1), clamp(focusPosition.col, columnFrom, nrOfColumns - 1));
969
963
  }
970
964
  const startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
971
965
  const endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
972
966
  this.clear();
967
+ this.runLocalHooks('beforeSelectAll', startCoords, endCoords, highlight);
973
968
  this.setRangeStartOnly(startCoords, undefined, highlight);
969
+ _classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
974
970
  if (columnFrom < 0) {
975
971
  this.selectedByRowHeader.add(this.getLayerLevel());
976
972
  }
@@ -978,8 +974,8 @@ class Selection {
978
974
  this.selectedByColumnHeader.add(this.getLayerLevel());
979
975
  }
980
976
  this.setRangeEnd(endCoords);
977
+ this.runLocalHooks('afterSelectAll', startCoords, endCoords, highlight);
981
978
  this.finish();
982
- _classPrivateFieldSet(_disableHeadersHighlight, this, false);
983
979
  }
984
980
 
985
981
  /**
@@ -1086,10 +1082,6 @@ class Selection {
1086
1082
  const from = this.tableProps.createCellCoords(fromRow, start);
1087
1083
  const to = this.tableProps.createCellCoords(toRow, end);
1088
1084
  this.runLocalHooks('beforeSelectColumns', from, to, highlight);
1089
-
1090
- // disallow modifying row axis for that hooks
1091
- from.row = fromRow;
1092
- to.row = toRow;
1093
1085
  this.setRangeStartOnly(from, undefined, highlight);
1094
1086
  this.selectedByColumnHeader.add(this.getLayerLevel());
1095
1087
  this.setRangeEnd(to);
@@ -1141,10 +1133,6 @@ class Selection {
1141
1133
  const from = this.tableProps.createCellCoords(startRow, fromColumn);
1142
1134
  const to = this.tableProps.createCellCoords(endRow, toColumn);
1143
1135
  this.runLocalHooks('beforeSelectRows', from, to, highlight);
1144
-
1145
- // disallow modifying column axis for that hooks
1146
- from.col = fromColumn;
1147
- to.col = toColumn;
1148
1136
  this.setRangeStartOnly(from, undefined, highlight);
1149
1137
  this.selectedByRowHeader.add(this.getLayerLevel());
1150
1138
  this.setRangeEnd(to);
@@ -1154,6 +1142,57 @@ class Selection {
1154
1142
  return isValid;
1155
1143
  }
1156
1144
 
1145
+ /**
1146
+ * Allows importing the selection for all layers from the provided array of CellRange objects.
1147
+ * The method clears the current selection and sets the new one without triggering any
1148
+ * selection related hooks.
1149
+ *
1150
+ * @param {SelectionState} selectionState The selection state to import.
1151
+ */
1152
+ importSelection(_ref) {
1153
+ let {
1154
+ ranges,
1155
+ activeRange,
1156
+ activeSelectionLayer,
1157
+ selectedByRowHeader,
1158
+ selectedByColumnHeader,
1159
+ disableHeadersHighlight
1160
+ } = _ref;
1161
+ if (ranges.length === 0) {
1162
+ return;
1163
+ }
1164
+ this.selectedRange.clear();
1165
+ this.highlight.clear();
1166
+ this.inProgress = true;
1167
+ _classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
1168
+ this.selectedByRowHeader = new Set(selectedByRowHeader);
1169
+ this.selectedByColumnHeader = new Set(selectedByColumnHeader);
1170
+ this.setActiveSelectionLayerIndex(0);
1171
+ ranges.forEach((cellRange, selectionLayerIndex) => {
1172
+ this.selectedRange.push(cellRange);
1173
+ this.applyAndCommit(cellRange, selectionLayerIndex);
1174
+ });
1175
+ this.setRangeFocus(activeRange.highlight, activeSelectionLayer);
1176
+ _classPrivateFieldSet(_disableHeadersHighlight, this, false);
1177
+ this.inProgress = false;
1178
+ }
1179
+
1180
+ /**
1181
+ * Exports all selection layers with other properties related to the selection state.
1182
+ *
1183
+ * @returns {SelectionState}
1184
+ */
1185
+ exportSelection() {
1186
+ return {
1187
+ ranges: Array.from(this.selectedRange).map(range => range.clone()),
1188
+ activeRange: this.getActiveSelectedRange(),
1189
+ activeSelectionLayer: this.getActiveSelectionLayerIndex(),
1190
+ selectedByRowHeader: Array.from(this.selectedByRowHeader),
1191
+ selectedByColumnHeader: Array.from(this.selectedByColumnHeader),
1192
+ disableHeadersHighlight: _classPrivateFieldGet(_disableHeadersHighlight, this)
1193
+ };
1194
+ }
1195
+
1157
1196
  /**
1158
1197
  * Refreshes the whole selection by clearing, reapplying and committing (calculating visual to renderable indexes)
1159
1198
  * the selection by using already added visual ranges. The method can be useful when underneath some indexes
@@ -1220,7 +1259,7 @@ class Selection {
1220
1259
  return;
1221
1260
  }
1222
1261
  const currentLayer = this.getLayerLevel();
1223
- const cellRange = this.selectedRange.current();
1262
+ const cellRange = this.getActiveSelectedRange();
1224
1263
  if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
1225
1264
  this.highlight.getFocus().commit().syncWith(cellRange);
1226
1265
  }