handsontable 16.0.1 → 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 +37 -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
@@ -0,0 +1,443 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
7
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
8
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
9
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
10
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
11
+ import { mixin, createObjectPropListener } from "../../helpers/object.mjs";
12
+ import localHooks from "../../mixins/localHooks.mjs";
13
+ /**
14
+ * The BaseTransformation class implements algorithms for transforming coordinates based on current settings
15
+ * passed to the Handsontable. The class performs the calculations based on the renderable indexes.
16
+ *
17
+ * Transformation is always applied relative to the currently active selection layer.
18
+ *
19
+ * The class operates on a table size defined by the renderable indexes. If the `navigableHeaders`
20
+ * option is enabled, the table size is increased by the number of row and/or column headers.
21
+ * Because the headers are treated as cells as part of the table size (indexes always go from 0 to N),
22
+ * the algorithm can be written as simply as possible (without new if's that distinguish the headers
23
+ * logic).
24
+ *
25
+ * @class BaseTransformation
26
+ * @private
27
+ */
28
+ var _range = /*#__PURE__*/new WeakMap();
29
+ var _activeLayerIndex = /*#__PURE__*/new WeakMap();
30
+ var _offset = /*#__PURE__*/new WeakMap();
31
+ var _BaseTransformation_brand = /*#__PURE__*/new WeakSet();
32
+ export class BaseTransformation {
33
+ constructor(range, tableApi) {
34
+ /**
35
+ * Chooses the next selection layer as active one.
36
+ */
37
+ _classPrivateMethodInitSpec(this, _BaseTransformation_brand);
38
+ /**
39
+ * Instance of the SelectionRange, holder for visual coordinates applied to the table.
40
+ *
41
+ * @type {SelectionRange}
42
+ */
43
+ _classPrivateFieldInitSpec(this, _range, void 0);
44
+ /**
45
+ * Index of the currently active selection layer.
46
+ *
47
+ * @type {number}
48
+ */
49
+ _classPrivateFieldInitSpec(this, _activeLayerIndex, 0);
50
+ /**
51
+ * Increases the table size by applying the offsets. The option is used by the `navigableHeaders`
52
+ * option.
53
+ *
54
+ * @type {{ x: number, y: number }}
55
+ */
56
+ _classPrivateFieldInitSpec(this, _offset, {
57
+ x: 0,
58
+ y: 0
59
+ });
60
+ /**
61
+ * An object containing the table API methods and settings.
62
+ *
63
+ * @type {object}
64
+ */
65
+ _defineProperty(this, "tableApi", void 0);
66
+ _classPrivateFieldSet(_range, this, range);
67
+ this.tableApi = tableApi;
68
+ }
69
+
70
+ /**
71
+ * Sets the currently active selection layer index.
72
+ *
73
+ * @param {number} layerIndex The layer index to set as active.
74
+ */
75
+ setActiveLayerIndex(layerIndex) {
76
+ _classPrivateFieldSet(_activeLayerIndex, this, layerIndex);
77
+ }
78
+
79
+ /**
80
+ * Gets the currently active selection layer range.
81
+ *
82
+ * @returns {CellRange}
83
+ */
84
+ getCurrentSelection() {
85
+ return _classPrivateFieldGet(_range, this).peekByIndex(_classPrivateFieldGet(_activeLayerIndex, this));
86
+ }
87
+
88
+ /**
89
+ * Selects cell relative to the current cell (if possible).
90
+ *
91
+ * @param {number} rowDelta Rows number to move, value can be passed as negative number.
92
+ * @param {number} colDelta Columns number to move, value can be passed as negative number.
93
+ * @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
94
+ * be created according to `minSpareRows/minSpareCols` settings of Handsontable.
95
+ * @returns {{selectionLayer: number, visualCoords: CellCoords}} Visual coordinates with selection layer after transformation.
96
+ */
97
+ transformStart(rowDelta, colDelta) {
98
+ let createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
99
+ _classPrivateFieldSet(_offset, this, this.calculateOffset());
100
+ const delta = this.tableApi.createCellCoords(rowDelta, colDelta);
101
+ let visualCoords = this.getCurrentSelection().highlight;
102
+ const highlightRenderableCoords = this.tableApi.visualToRenderableCoords(visualCoords);
103
+ let rowTransformDir = 0;
104
+ let colTransformDir = 0;
105
+ this.runLocalHooks('beforeTransformStart', delta);
106
+ if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
107
+ let {
108
+ width,
109
+ height
110
+ } = _assertClassBrand(_BaseTransformation_brand, this, _getTableSize).call(this);
111
+ const {
112
+ row,
113
+ col
114
+ } = _assertClassBrand(_BaseTransformation_brand, this, _visualToZeroBasedCoords).call(this, visualCoords);
115
+ const fixedRowsBottom = this.tableApi.fixedRowsBottom();
116
+ const minSpareRows = this.tableApi.minSpareRows();
117
+ const minSpareCols = this.tableApi.minSpareCols();
118
+ const autoWrapRow = this.tableApi.autoWrapRow();
119
+ const autoWrapCol = this.tableApi.autoWrapCol();
120
+ const zeroBasedCoords = this.tableApi.createCellCoords(row + delta.row, col + delta.col);
121
+ if (zeroBasedCoords.row >= height) {
122
+ const isActionInterrupted = createObjectPropListener(createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0);
123
+ const nextColumn = zeroBasedCoords.col + 1;
124
+ const isColumnOutOfRange = nextColumn >= width;
125
+ const newCoords = this.tableApi.createCellCoords(zeroBasedCoords.row - height, isColumnOutOfRange ? nextColumn - width : nextColumn);
126
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, newCoords), isColumnOutOfRange);
127
+ if (isActionInterrupted.value) {
128
+ this.runLocalHooks('insertRowRequire', this.countRenderableRows());
129
+ } else if (autoWrapCol) {
130
+ if (this.shouldSwitchSelectionLayer() && isColumnOutOfRange && _classPrivateFieldGet(_range, this).size() > 1) {
131
+ _assertClassBrand(_BaseTransformation_brand, this, _chooseNextSelectionLayer).call(this);
132
+ const nextLayerCoords = _assertClassBrand(_BaseTransformation_brand, this, _findNonHiddenZeroBasedCoordsInSelection).call(this, 'forward');
133
+ if (nextLayerCoords !== null) {
134
+ newCoords.assign(nextLayerCoords);
135
+ }
136
+ }
137
+ zeroBasedCoords.assign(newCoords);
138
+ }
139
+ } else if (zeroBasedCoords.row < 0) {
140
+ const isActionInterrupted = createObjectPropListener(autoWrapCol);
141
+ const previousColumn = zeroBasedCoords.col - 1;
142
+ const isColumnOutOfRange = previousColumn < 0;
143
+ const newCoords = this.tableApi.createCellCoords(height + zeroBasedCoords.row, isColumnOutOfRange ? width + previousColumn : previousColumn);
144
+ this.runLocalHooks('beforeColumnWrap', isActionInterrupted, _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, newCoords), isColumnOutOfRange);
145
+ if (autoWrapCol) {
146
+ if (this.shouldSwitchSelectionLayer() && isColumnOutOfRange && _classPrivateFieldGet(_range, this).size() > 1) {
147
+ _assertClassBrand(_BaseTransformation_brand, this, _choosePreviousSelectionLayer).call(this);
148
+ const nextLayerCoords = _assertClassBrand(_BaseTransformation_brand, this, _findNonHiddenZeroBasedCoordsInSelection).call(this, 'backward');
149
+ if (nextLayerCoords !== null) {
150
+ newCoords.assign(nextLayerCoords);
151
+ }
152
+ }
153
+ zeroBasedCoords.assign(newCoords);
154
+ }
155
+ }
156
+
157
+ // the range size may be changed after the column wrap, so we need to recalculate it for row wrap
158
+ ({
159
+ width,
160
+ height
161
+ } = _assertClassBrand(_BaseTransformation_brand, this, _getTableSize).call(this));
162
+ if (zeroBasedCoords.col >= width) {
163
+ const isActionInterrupted = createObjectPropListener(createMissingRecords && minSpareCols > 0);
164
+ const nextRow = zeroBasedCoords.row + 1;
165
+ const isRowOutOfRange = nextRow >= height;
166
+ const newCoords = this.tableApi.createCellCoords(isRowOutOfRange ? nextRow - height : nextRow, zeroBasedCoords.col - width);
167
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, newCoords), isRowOutOfRange);
168
+ if (isActionInterrupted.value) {
169
+ this.runLocalHooks('insertColRequire', this.countRenderableColumns());
170
+ } else if (autoWrapRow) {
171
+ if (this.shouldSwitchSelectionLayer() && isRowOutOfRange && _classPrivateFieldGet(_range, this).size() > 1) {
172
+ _assertClassBrand(_BaseTransformation_brand, this, _chooseNextSelectionLayer).call(this);
173
+ const nextLayerCoords = _assertClassBrand(_BaseTransformation_brand, this, _findNonHiddenZeroBasedCoordsInSelection).call(this, 'forward');
174
+ if (nextLayerCoords !== null) {
175
+ newCoords.assign(nextLayerCoords);
176
+ }
177
+ }
178
+ zeroBasedCoords.assign(newCoords);
179
+ }
180
+ } else if (zeroBasedCoords.col < 0) {
181
+ const isActionInterrupted = createObjectPropListener(autoWrapRow);
182
+ const previousRow = zeroBasedCoords.row - 1;
183
+ const isRowOutOfRange = previousRow < 0;
184
+ const newCoords = this.tableApi.createCellCoords(isRowOutOfRange ? height + previousRow : previousRow, width + zeroBasedCoords.col);
185
+ this.runLocalHooks('beforeRowWrap', isActionInterrupted, _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, newCoords), isRowOutOfRange);
186
+ if (autoWrapRow) {
187
+ if (this.shouldSwitchSelectionLayer() && isRowOutOfRange && _classPrivateFieldGet(_range, this).size() > 1) {
188
+ _assertClassBrand(_BaseTransformation_brand, this, _choosePreviousSelectionLayer).call(this);
189
+ const nextLayerCoords = _assertClassBrand(_BaseTransformation_brand, this, _findNonHiddenZeroBasedCoordsInSelection).call(this, 'backward');
190
+ if (nextLayerCoords !== null) {
191
+ newCoords.assign(nextLayerCoords);
192
+ }
193
+ }
194
+ zeroBasedCoords.assign(newCoords);
195
+ }
196
+ }
197
+ const {
198
+ rowDir,
199
+ colDir
200
+ } = _assertClassBrand(_BaseTransformation_brand, this, _clampCoords).call(this, zeroBasedCoords);
201
+ rowTransformDir = rowDir;
202
+ colTransformDir = colDir;
203
+ visualCoords = _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, zeroBasedCoords);
204
+ }
205
+ this.runLocalHooks('afterTransformStart', visualCoords, rowTransformDir, colTransformDir);
206
+ return {
207
+ selectionLayer: _classPrivateFieldGet(_activeLayerIndex, this),
208
+ visualCoords
209
+ };
210
+ }
211
+
212
+ /**
213
+ * Sets selection end cell relative to the current selection end cell (if possible).
214
+ *
215
+ * @param {number} rowDelta Rows number to move, value can be passed as negative number.
216
+ * @param {number} colDelta Columns number to move, value can be passed as negative number.
217
+ * @returns {{selectionLayer: number, visualCoords: CellCoords}} Visual coordinates with selection layer after transformation.
218
+ */
219
+ transformEnd(rowDelta, colDelta) {
220
+ _classPrivateFieldSet(_offset, this, this.calculateOffset());
221
+ const delta = this.tableApi.createCellCoords(rowDelta, colDelta);
222
+ const cellRange = this.getCurrentSelection();
223
+ const highlightRenderableCoords = this.tableApi.visualToRenderableCoords(cellRange.highlight);
224
+ const toRow = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, cellRange.to.row, cellRange.from.row);
225
+ const toColumn = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, cellRange.to.col, cellRange.from.col);
226
+ const visualCoords = cellRange.to.clone();
227
+ let rowTransformDir = 0;
228
+ let colTransformDir = 0;
229
+ this.runLocalHooks('beforeTransformEnd', delta);
230
+ if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null && toRow !== null && toColumn !== null) {
231
+ const {
232
+ row: highlightRow,
233
+ col: highlightColumn
234
+ } = _assertClassBrand(_BaseTransformation_brand, this, _visualToZeroBasedCoords).call(this, cellRange.highlight);
235
+ const coords = this.tableApi.createCellCoords(toRow + delta.row, toColumn + delta.col);
236
+ const topStartCorner = cellRange.getTopStartCorner();
237
+ const topEndCorner = cellRange.getTopEndCorner();
238
+ const bottomEndCorner = cellRange.getBottomEndCorner();
239
+ if (delta.col < 0 && toColumn >= highlightColumn && coords.col < highlightColumn) {
240
+ const columnRestDelta = coords.col - highlightColumn;
241
+ coords.col = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, topStartCorner.col, topEndCorner.col) + columnRestDelta;
242
+ } else if (delta.col > 0 && toColumn <= highlightColumn && coords.col > highlightColumn) {
243
+ const endColumnIndex = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, topEndCorner.col, topStartCorner.col);
244
+ const columnRestDelta = Math.max(coords.col - endColumnIndex, 1);
245
+ coords.col = endColumnIndex + columnRestDelta;
246
+ }
247
+ if (delta.row < 0 && toRow >= highlightRow && coords.row < highlightRow) {
248
+ const rowRestDelta = coords.row - highlightRow;
249
+ coords.row = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, topStartCorner.row, bottomEndCorner.row) + rowRestDelta;
250
+ } else if (delta.row > 0 && toRow <= highlightRow && coords.row > highlightRow) {
251
+ const bottomRowIndex = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, bottomEndCorner.row, topStartCorner.row);
252
+ const rowRestDelta = Math.max(coords.row - bottomRowIndex, 1);
253
+ coords.row = bottomRowIndex + rowRestDelta;
254
+ }
255
+ const {
256
+ rowDir,
257
+ colDir
258
+ } = _assertClassBrand(_BaseTransformation_brand, this, _clampCoords).call(this, coords);
259
+ rowTransformDir = rowDir;
260
+ colTransformDir = colDir;
261
+ const newVisualCoords = _assertClassBrand(_BaseTransformation_brand, this, _zeroBasedToVisualCoords).call(this, coords);
262
+ if (delta.row === 0 && delta.col !== 0) {
263
+ visualCoords.col = newVisualCoords.col;
264
+ } else if (delta.row !== 0 && delta.col === 0) {
265
+ visualCoords.row = newVisualCoords.row;
266
+ } else {
267
+ visualCoords.row = newVisualCoords.row;
268
+ visualCoords.col = newVisualCoords.col;
269
+ }
270
+ }
271
+ this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
272
+ return {
273
+ selectionLayer: _classPrivateFieldGet(_activeLayerIndex, this),
274
+ visualCoords
275
+ };
276
+ }
277
+
278
+ /**
279
+ * Abstract method that child classes must implement to calculate offset coordinates based on
280
+ * the current processed selection layer.
281
+ */
282
+ calculateOffset() {
283
+ throw new Error('`calculateOffset` is not implemented');
284
+ }
285
+
286
+ /**
287
+ * Abstract method that child classes must implement to provide the count of renderable rows
288
+ * based on their specific transformation logic.
289
+ */
290
+ countRenderableRows() {
291
+ throw new Error('`countRenderableRows` is not implemented');
292
+ }
293
+
294
+ /**
295
+ * Abstract method that child classes must implement to provide the count of renderable columns
296
+ * based on their specific transformation logic.
297
+ */
298
+ countRenderableColumns() {
299
+ throw new Error('`countRenderableColumns` is not implemented');
300
+ }
301
+
302
+ /**
303
+ * Determines whether selection layer switching should occur during transformation.
304
+ * Child classes can override this method to control the behavior.
305
+ */
306
+ shouldSwitchSelectionLayer() {
307
+ throw new Error('`shouldSwitchSelectionLayer` is not implemented');
308
+ }
309
+ }
310
+ function _chooseNextSelectionLayer() {
311
+ const layerIndex = _classPrivateFieldGet(_activeLayerIndex, this) + 1;
312
+ this.setActiveLayerIndex(layerIndex >= _classPrivateFieldGet(_range, this).size() ? 0 : layerIndex);
313
+ _classPrivateFieldSet(_offset, this, this.calculateOffset());
314
+ }
315
+ /**
316
+ * Chooses the previous selection layer as active one.
317
+ */
318
+ function _choosePreviousSelectionLayer() {
319
+ const layerIndex = _classPrivateFieldGet(_activeLayerIndex, this) - 1;
320
+ this.setActiveLayerIndex(layerIndex < 0 ? _classPrivateFieldGet(_range, this).size() - 1 : layerIndex);
321
+ _classPrivateFieldSet(_offset, this, this.calculateOffset());
322
+ }
323
+ /**
324
+ * Clamps the coords to make sure they points to the cell (or header) in the table range.
325
+ *
326
+ * @param {CellCoords} zeroBasedCoords The coords object to clamp.
327
+ * @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
328
+ */
329
+ function _clampCoords(zeroBasedCoords) {
330
+ const {
331
+ width,
332
+ height
333
+ } = _assertClassBrand(_BaseTransformation_brand, this, _getTableSize).call(this);
334
+ let rowDir = 0;
335
+ let colDir = 0;
336
+ if (zeroBasedCoords.row < 0) {
337
+ rowDir = -1;
338
+ zeroBasedCoords.row = 0;
339
+ } else if (zeroBasedCoords.row > 0 && zeroBasedCoords.row >= height) {
340
+ rowDir = 1;
341
+ zeroBasedCoords.row = height - 1;
342
+ }
343
+ if (zeroBasedCoords.col < 0) {
344
+ colDir = -1;
345
+ zeroBasedCoords.col = 0;
346
+ } else if (zeroBasedCoords.col > 0 && zeroBasedCoords.col >= width) {
347
+ colDir = 1;
348
+ zeroBasedCoords.col = width - 1;
349
+ }
350
+ return {
351
+ rowDir,
352
+ colDir
353
+ };
354
+ }
355
+ /**
356
+ * Gets the table size in number of rows with headers as "height" and number of columns with
357
+ * headers as "width".
358
+ *
359
+ * @returns {{width: number, height: number}}
360
+ */
361
+ function _getTableSize() {
362
+ return {
363
+ width: _classPrivateFieldGet(_offset, this).x + this.countRenderableColumns(),
364
+ height: _classPrivateFieldGet(_offset, this).y + this.countRenderableRows()
365
+ };
366
+ }
367
+ /**
368
+ * Finds non-hidden zero-based coordinates in the current selection range.
369
+ *
370
+ * @param {'forward' | 'backward'} direction The direction to search within the selection.
371
+ * @returns {CellCoords | null} Zero-based coordinates or null if not found.
372
+ */
373
+ function _findNonHiddenZeroBasedCoordsInSelection(direction) {
374
+ if (!['forward', 'backward'].includes(direction)) {
375
+ return null;
376
+ }
377
+ const topStartCoords = this.getCurrentSelection().getTopStartCorner();
378
+ const bottomEndCoords = this.getCurrentSelection().getBottomEndCorner();
379
+ const [visualRowFrom, visualRowTo, visualColumnFrom, visualColumnTo] = direction === 'forward' ? [topStartCoords.row, bottomEndCoords.row, topStartCoords.col, bottomEndCoords.col] : [bottomEndCoords.row, topStartCoords.row, bottomEndCoords.col, topStartCoords.col];
380
+ const zeroBasedRow = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedRow).call(this, visualRowFrom, visualRowTo);
381
+ const zeroBasedCol = _assertClassBrand(_BaseTransformation_brand, this, _findFirstNonHiddenZeroBasedColumn).call(this, visualColumnFrom, visualColumnTo);
382
+ if (zeroBasedRow === null || zeroBasedCol === null) {
383
+ return null;
384
+ }
385
+ return this.tableApi.createCellCoords(zeroBasedRow, zeroBasedCol);
386
+ }
387
+ /**
388
+ * Finds the first non-hidden zero-based row in the table range.
389
+ *
390
+ * @param {number} visualRowFrom The visual row from which the search should start.
391
+ * @param {number} visualRowTo The visual row to which the search should end.
392
+ * @returns {number | null}
393
+ */
394
+ function _findFirstNonHiddenZeroBasedRow(visualRowFrom, visualRowTo) {
395
+ const row = this.tableApi.findFirstNonHiddenRenderableRow(visualRowFrom, visualRowTo);
396
+ if (row === null) {
397
+ return null;
398
+ }
399
+ return _classPrivateFieldGet(_offset, this).y + row;
400
+ }
401
+ /**
402
+ * Finds the first non-hidden zero-based column in the table range.
403
+ *
404
+ * @param {number} visualColumnFrom The visual column from which the search should start.
405
+ * @param {number} visualColumnTo The visual column to which the search should end.
406
+ * @returns {number | null}
407
+ */
408
+ function _findFirstNonHiddenZeroBasedColumn(visualColumnFrom, visualColumnTo) {
409
+ const column = this.tableApi.findFirstNonHiddenRenderableColumn(visualColumnFrom, visualColumnTo);
410
+ if (column === null) {
411
+ return null;
412
+ }
413
+ return _classPrivateFieldGet(_offset, this).x + column;
414
+ }
415
+ /**
416
+ * Translates the visual coordinates to zero-based ones.
417
+ *
418
+ * @param {CellCoords} visualCoords The visual coords to process.
419
+ * @returns {CellCoords}
420
+ */
421
+ function _visualToZeroBasedCoords(visualCoords) {
422
+ const {
423
+ row,
424
+ col
425
+ } = this.tableApi.visualToRenderableCoords(visualCoords);
426
+ if (row === null || col === null) {
427
+ throw new Error('Renderable coords are not visible.');
428
+ }
429
+ return this.tableApi.createCellCoords(_classPrivateFieldGet(_offset, this).y + row, _classPrivateFieldGet(_offset, this).x + col);
430
+ }
431
+ /**
432
+ * Translates the zero-based coordinates to visual ones.
433
+ *
434
+ * @param {CellCoords} zeroBasedCoords The coordinates to process.
435
+ * @returns {CellCoords}
436
+ */
437
+ function _zeroBasedToVisualCoords(zeroBasedCoords) {
438
+ const coords = zeroBasedCoords.clone();
439
+ coords.col = zeroBasedCoords.col - _classPrivateFieldGet(_offset, this).x;
440
+ coords.row = zeroBasedCoords.row - _classPrivateFieldGet(_offset, this).y;
441
+ return this.tableApi.renderableToVisualCoords(coords);
442
+ }
443
+ mixin(BaseTransformation, localHooks);
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _base = require("./_base");
5
+ /**
6
+ * The ExtenderTransformation class implements algorithms for transforming coordinates while the
7
+ * selection is being extended or shrunk. Table size defines the bounds for the selection extent.
8
+ *
9
+ * @class ExtenderTransformation
10
+ * @private
11
+ */
12
+ class ExtenderTransformation extends _base.BaseTransformation {
13
+ /**
14
+ * Calculates offset coordinates for extender selection.
15
+ *
16
+ * @returns {{x: number, y: number}}
17
+ */
18
+ calculateOffset() {
19
+ return {
20
+ x: this.tableApi.navigableHeaders() ? this.tableApi.countRowHeaders() : 0,
21
+ y: this.tableApi.navigableHeaders() ? this.tableApi.countColHeaders() : 0
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Gets the count of renderable rows for extender transformation.
27
+ * Extender transformation operates on the full table size.
28
+ *
29
+ * @returns {number}
30
+ */
31
+ countRenderableRows() {
32
+ return this.tableApi.countRenderableRows();
33
+ }
34
+
35
+ /**
36
+ * Gets the count of renderable columns for extender transformation.
37
+ * Extender transformation operates on the full table size.
38
+ *
39
+ * @returns {number}
40
+ */
41
+ countRenderableColumns() {
42
+ return this.tableApi.countRenderableColumns();
43
+ }
44
+
45
+ /**
46
+ * Changes the behavior of the transformation logic by not switching the selection layer
47
+ * when the selection is out of range.
48
+ *
49
+ * @returns {boolean}
50
+ */
51
+ shouldSwitchSelectionLayer() {
52
+ return false;
53
+ }
54
+ }
55
+ exports.ExtenderTransformation = ExtenderTransformation;
@@ -0,0 +1,51 @@
1
+ import { BaseTransformation } from "./_base.mjs";
2
+ /**
3
+ * The ExtenderTransformation class implements algorithms for transforming coordinates while the
4
+ * selection is being extended or shrunk. Table size defines the bounds for the selection extent.
5
+ *
6
+ * @class ExtenderTransformation
7
+ * @private
8
+ */
9
+ export class ExtenderTransformation extends BaseTransformation {
10
+ /**
11
+ * Calculates offset coordinates for extender selection.
12
+ *
13
+ * @returns {{x: number, y: number}}
14
+ */
15
+ calculateOffset() {
16
+ return {
17
+ x: this.tableApi.navigableHeaders() ? this.tableApi.countRowHeaders() : 0,
18
+ y: this.tableApi.navigableHeaders() ? this.tableApi.countColHeaders() : 0
19
+ };
20
+ }
21
+
22
+ /**
23
+ * Gets the count of renderable rows for extender transformation.
24
+ * Extender transformation operates on the full table size.
25
+ *
26
+ * @returns {number}
27
+ */
28
+ countRenderableRows() {
29
+ return this.tableApi.countRenderableRows();
30
+ }
31
+
32
+ /**
33
+ * Gets the count of renderable columns for extender transformation.
34
+ * Extender transformation operates on the full table size.
35
+ *
36
+ * @returns {number}
37
+ */
38
+ countRenderableColumns() {
39
+ return this.tableApi.countRenderableColumns();
40
+ }
41
+
42
+ /**
43
+ * Changes the behavior of the transformation logic by not switching the selection layer
44
+ * when the selection is out of range.
45
+ *
46
+ * @returns {boolean}
47
+ */
48
+ shouldSwitchSelectionLayer() {
49
+ return false;
50
+ }
51
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ var _base = require("./_base");
6
+ /**
7
+ * The FocusTransformation class implements algorithms for transforming coordinates while the
8
+ * focus is being moved. The currently selection layer range defines the bounds for the focus movement.
9
+ *
10
+ * @class FocusTransformation
11
+ * @private
12
+ */
13
+ class FocusTransformation extends _base.BaseTransformation {
14
+ /**
15
+ * Calculates offset coordinates for focus selection based on the current selection state.
16
+ * For header focus selection, calculates offset including headers.
17
+ * For cell focus selection, calculates offset only for selected cells.
18
+ *
19
+ * @returns {{x: number, y: number}}
20
+ */
21
+ calculateOffset() {
22
+ const range = this.getCurrentSelection();
23
+ const {
24
+ row,
25
+ col
26
+ } = range.getOuterTopStartCorner();
27
+ const columnsInRange = this.tableApi.countRenderableColumnsInRange(0, col - 1);
28
+ const rowsInRange = this.tableApi.countRenderableRowsInRange(0, row - 1);
29
+ const isHeaderSelection = range.highlight.isHeader();
30
+ const headerX = isHeaderSelection ? Math.abs(col) : 0;
31
+ const headerY = isHeaderSelection ? Math.abs(row) : 0;
32
+ return {
33
+ x: col < 0 ? headerX : -columnsInRange,
34
+ y: row < 0 ? headerY : -rowsInRange
35
+ };
36
+ }
37
+
38
+ /**
39
+ * Gets the count of renderable rows for focus transformation.
40
+ * Focus transformation operates on the current selection range.
41
+ *
42
+ * @returns {number}
43
+ */
44
+ countRenderableRows() {
45
+ const range = this.getCurrentSelection();
46
+ return this.tableApi.countRenderableRowsInRange(0, range.getOuterBottomEndCorner().row);
47
+ }
48
+
49
+ /**
50
+ * Gets the count of renderable columns for focus transformation.
51
+ * Focus transformation operates on the current selection range.
52
+ *
53
+ * @returns {number}
54
+ */
55
+ countRenderableColumns() {
56
+ const range = this.getCurrentSelection();
57
+ return this.tableApi.countRenderableColumnsInRange(0, range.getOuterBottomEndCorner().col);
58
+ }
59
+
60
+ /**
61
+ * Throws an error because focus transformation doesn't support `transformEnd`.
62
+ */
63
+ transformEnd() {
64
+ throw new Error('`transformEnd` is not valid for focus selection use `transformStart` instead');
65
+ }
66
+
67
+ /**
68
+ * Changes the behavior of the transformation logic by switching the selection layer
69
+ * when the selection is out of range.
70
+ *
71
+ * @returns {boolean}
72
+ */
73
+ shouldSwitchSelectionLayer() {
74
+ return true;
75
+ }
76
+ }
77
+ exports.FocusTransformation = FocusTransformation;