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
@@ -0,0 +1,1034 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/esnext.iterator.constructor.js");
6
+ require("core-js/modules/esnext.iterator.for-each.js");
7
+ require("core-js/modules/esnext.iterator.map.js");
8
+ var _base = require("../base");
9
+ var _number = require("../../helpers/number");
10
+ var _element = require("../../helpers/dom/element");
11
+ var _ui2 = require("./ui");
12
+ var _utils = require("./utils");
13
+ var _a11yAnnouncer = require("../../utils/a11yAnnouncer");
14
+ var _strategies = require("./strategies");
15
+ var _templateLiteralTag = require("../../helpers/templateLiteralTag");
16
+ var _console = require("../../helpers/console");
17
+ var _focusController2 = require("./focusController");
18
+ var _focusDetector2 = require("../../utils/focusDetector");
19
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
20
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
21
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
22
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
23
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
24
+ 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"); }
25
+ const PLUGIN_KEY = exports.PLUGIN_KEY = 'pagination';
26
+ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 900;
27
+ const SHORTCUTS_GROUP = PLUGIN_KEY;
28
+ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
29
+ const AUTO_PAGE_SIZE_WARNING = (0, _templateLiteralTag.toSingleLine)`The \`auto\` page size setting requires the \`autoRowSize\`\x20
30
+ plugin to be enabled. Set the \`autoRowSize: true\` in the configuration to ensure correct behavior.`;
31
+
32
+ /* eslint-disable jsdoc/require-description-complete-sentence */
33
+ /**
34
+ * @plugin Pagination
35
+ * @class Pagination
36
+ *
37
+ * @description
38
+ * The plugin adds full-featured pagination capabilities to a table component.
39
+ * It manages splitting rows into pages, rendering navigation controls, and exposing
40
+ * methods and configuration for initializing and updating pagination state.
41
+ *
42
+ * Core responsibilities:
43
+ * - Calculate which rows should be visible based on current `page` and `pageSize`.
44
+ * - Render a toolbar area containing:
45
+ * - a page size dropdown section (if `showPageSize` = `true`)
46
+ * - a row counter section ("1 - 10 of 50", if `showCounter` = `true`)
47
+ * - page navigation section (if `showNavigation` = `true`)
48
+ * - Emit hooks when:
49
+ * - the user navigates to a different page
50
+ * - the user changes the number of rows per page
51
+ * - the user changes the visibility of any sections
52
+ * - Allow external code to programmatically:
53
+ * - jump to a specific page
54
+ * - change the page size
55
+ * - change the visibility of UI sections
56
+ *
57
+ * @example
58
+ *
59
+ * ::: only-for javascript
60
+ * ```js
61
+ * const hot = new Handsontable(document.getElementById('example'), {
62
+ * data: getData(),
63
+ * pagination: {
64
+ * pageSize: 10,
65
+ * pageSizeList: ['auto', 5, 10, 20, 50, 100],
66
+ * initialPage: 1,
67
+ * showPageSize: true,
68
+ * showCounter: true,
69
+ * showNavigation: true,
70
+ * },
71
+ * });
72
+ * ```
73
+ * :::
74
+ *
75
+ * ::: only-for react
76
+ * ```jsx
77
+ * <HotTable
78
+ * data={getData()}
79
+ * pagination={{
80
+ * pageSize: 10,
81
+ * pageSizeList: ['auto', 5, 10, 20, 50, 100],
82
+ * initialPage: 1,
83
+ * showPageSize: true,
84
+ * showCounter: true,
85
+ * showNavigation: true,
86
+ * }}
87
+ * />
88
+ * ```
89
+ * :::
90
+ *
91
+ * ::: only-for angular
92
+ * ```ts
93
+ * settings = {
94
+ * pagination: {
95
+ * pageSize: 10,
96
+ * pageSizeList: ['auto', 5, 10, 20, 50, 100],
97
+ * initialPage: 1,
98
+ * showPageSize: true,
99
+ * showCounter: true,
100
+ * showNavigation: true,
101
+ * },
102
+ * };
103
+ * ```
104
+ * :::
105
+ */
106
+ var _pagedRowsMap = /*#__PURE__*/new WeakMap();
107
+ var _currentPage = /*#__PURE__*/new WeakMap();
108
+ var _pageSize = /*#__PURE__*/new WeakMap();
109
+ var _ui = /*#__PURE__*/new WeakMap();
110
+ var _calcStrategy = /*#__PURE__*/new WeakMap();
111
+ var _internalExecutionCall = /*#__PURE__*/new WeakMap();
112
+ var _internalRenderCall = /*#__PURE__*/new WeakMap();
113
+ var _focusController = /*#__PURE__*/new WeakMap();
114
+ var _focusDetector = /*#__PURE__*/new WeakMap();
115
+ var _Pagination_brand = /*#__PURE__*/new WeakSet();
116
+ var _onIndexCacheUpdate = /*#__PURE__*/new WeakMap();
117
+ class Pagination extends _base.BasePlugin {
118
+ constructor() {
119
+ super(...arguments);
120
+ /**
121
+ * Bind the events used by the plugin.
122
+ */
123
+ _classPrivateMethodInitSpec(this, _Pagination_brand);
124
+ /**
125
+ * Map of hidden rows controlled by the pagination plugin.
126
+ *
127
+ * @type {HiddenMap | null}
128
+ */
129
+ _classPrivateFieldInitSpec(this, _pagedRowsMap, null);
130
+ /**
131
+ * Current page number.
132
+ *
133
+ * @type {number}
134
+ */
135
+ _classPrivateFieldInitSpec(this, _currentPage, 1);
136
+ /**
137
+ * Page size setup by the user. It can be a number or 'auto' (in which case the plugin will
138
+ * calculate the page size based on the viewport size and row heights).
139
+ *
140
+ * @type {number | 'auto'}
141
+ */
142
+ _classPrivateFieldInitSpec(this, _pageSize, 10);
143
+ /**
144
+ * UI instance of the pagination plugin.
145
+ *
146
+ * @type {PaginationUI}
147
+ */
148
+ _classPrivateFieldInitSpec(this, _ui, null);
149
+ /**
150
+ * Pagination calculation strategy instance. It is used to calculate the pagination state
151
+ * based on the user-defined settings. The result of the state is used to update the
152
+ * pagination index mapper.
153
+ *
154
+ * @type {AutoPageSizeStrategy | FixedPageSizeStrategy | null}
155
+ */
156
+ _classPrivateFieldInitSpec(this, _calcStrategy, null);
157
+ /**
158
+ * Flag indicating if the plugin is in the process of updating the index cache (execution operation).
159
+ * Prevents circular calls when the index cache is updated.
160
+ *
161
+ * @type {boolean}
162
+ */
163
+ _classPrivateFieldInitSpec(this, _internalExecutionCall, false);
164
+ /**
165
+ * Flag indicating if the plugin is in the process of updating the internal state (render operation).
166
+ * Prevents circular calls when the render call is triggered by the pagination plugin itself.
167
+ *
168
+ * @type {boolean}
169
+ */
170
+ _classPrivateFieldInitSpec(this, _internalRenderCall, false);
171
+ /**
172
+ * Pagination focus controller instance.
173
+ *
174
+ * @type {PaginationController}
175
+ */
176
+ _classPrivateFieldInitSpec(this, _focusController, null);
177
+ /**
178
+ * Pagination focus detector instance.
179
+ *
180
+ * @type {object}
181
+ */
182
+ _classPrivateFieldInitSpec(this, _focusDetector, null);
183
+ /**
184
+ * IndexMapper cache update listener. Once the cache is updated, we need to recompute
185
+ * the pagination state.
186
+ *
187
+ * The method uses arrow function to keep the reference to the class method. Necessary for
188
+ * the `removeLocalHook` method of the row index mapper.
189
+ */
190
+ _classPrivateFieldInitSpec(this, _onIndexCacheUpdate, () => {
191
+ var _this$hot;
192
+ if (!_classPrivateFieldGet(_internalExecutionCall, this) && (_this$hot = this.hot) !== null && _this$hot !== void 0 && _this$hot.view) {
193
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
194
+ }
195
+ });
196
+ }
197
+ static get PLUGIN_KEY() {
198
+ return PLUGIN_KEY;
199
+ }
200
+ static get PLUGIN_PRIORITY() {
201
+ return PLUGIN_PRIORITY;
202
+ }
203
+ static get DEFAULT_SETTINGS() {
204
+ return {
205
+ pageSize: 10,
206
+ pageSizeList: ['auto', 5, 10, 20, 50, 100],
207
+ initialPage: 1,
208
+ showPageSize: true,
209
+ showCounter: true,
210
+ showNavigation: true,
211
+ uiContainer: null
212
+ };
213
+ }
214
+ /**
215
+ * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
216
+ * hook and if it returns `true` than the {@link Pagination#enablePlugin} method is called.
217
+ *
218
+ * @returns {boolean}
219
+ */
220
+ isEnabled() {
221
+ return !!this.hot.getSettings()[PLUGIN_KEY];
222
+ }
223
+
224
+ /**
225
+ * Enables the plugin functionality for this Handsontable instance.
226
+ */
227
+ enablePlugin() {
228
+ var _this$hot$getPlugin,
229
+ _this = this;
230
+ if ((0, _utils.checkPluginSettingsConflict)(this.hot.getSettings())) {
231
+ this.hot.getSettings()[PLUGIN_KEY] = false;
232
+ return;
233
+ }
234
+ if (this.enabled) {
235
+ return;
236
+ }
237
+ const settings = this.hot.getSettings()[PLUGIN_KEY];
238
+ if ((settings === null || settings === void 0 ? void 0 : settings.initialPage) !== undefined) {
239
+ _classPrivateFieldSet(_currentPage, this, this.getSetting('initialPage'));
240
+ }
241
+ if ((settings === null || settings === void 0 ? void 0 : settings.pageSize) !== undefined) {
242
+ _classPrivateFieldSet(_pageSize, this, this.getSetting('pageSize'));
243
+ }
244
+ _classPrivateFieldSet(_pagedRowsMap, this, this.hot.rowIndexMapper.createAndRegisterIndexMap(this.pluginName, 'hiding', false));
245
+ if (_classPrivateFieldGet(_pageSize, this) === 'auto' && !((_this$hot$getPlugin = this.hot.getPlugin('autoRowSize')) !== null && _this$hot$getPlugin !== void 0 && _this$hot$getPlugin.enabled)) {
246
+ (0, _console.warn)(AUTO_PAGE_SIZE_WARNING);
247
+ }
248
+ _classPrivateFieldSet(_calcStrategy, this, (0, _strategies.createPaginatorStrategy)(_classPrivateFieldGet(_pageSize, this) === 'auto' ? 'auto' : 'fixed'));
249
+ if (!_classPrivateFieldGet(_ui, this)) {
250
+ _classPrivateFieldSet(_ui, this, new _ui2.PaginationUI({
251
+ rootElement: this.hot.rootGridElement,
252
+ uiContainer: this.getSetting('uiContainer'),
253
+ isRtl: this.hot.isRtl(),
254
+ themeName: this.hot.getSettings().themeName,
255
+ phraseTranslator: function () {
256
+ return _this.hot.getTranslatedPhrase(...arguments);
257
+ },
258
+ shouldHaveBorder: () => _assertClassBrand(_Pagination_brand, this, _computeNeedsBorder).call(this),
259
+ a11yAnnouncer: message => (0, _a11yAnnouncer.announce)(message)
260
+ }));
261
+ _assertClassBrand(_Pagination_brand, this, _updateSectionsVisibilityState).call(this);
262
+ _classPrivateFieldGet(_ui, this).addLocalHook('firstPageClick', () => this.firstPage()).addLocalHook('prevPageClick', () => this.prevPage()).addLocalHook('nextPageClick', () => this.nextPage()).addLocalHook('lastPageClick', () => this.lastPage()).addLocalHook('pageSizeChange', pageSize => this.setPageSize(pageSize)).addLocalHook('focus', element => {
263
+ _classPrivateFieldGet(_focusController, this).setCurrentPage(_classPrivateFieldGet(_ui, this).getFocusableElements().indexOf(element));
264
+ this.hot.unlisten();
265
+ this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
266
+ this.hot.listen();
267
+ _classPrivateFieldGet(_focusDetector, this).deactivate();
268
+ });
269
+ }
270
+ if (!_classPrivateFieldGet(_focusController, this)) {
271
+ _classPrivateFieldSet(_focusController, this, (0, _focusController2.createPaginationFocusController)({
272
+ focusableElements: () => _classPrivateFieldGet(_ui, this).getFocusableElements()
273
+ }));
274
+ }
275
+ if (!_classPrivateFieldGet(_focusDetector, this)) {
276
+ _classPrivateFieldSet(_focusDetector, this, (0, _focusDetector2.installFocusDetector)(this.hot, _classPrivateFieldGet(_ui, this).getContainer(), {
277
+ onFocus: from => {
278
+ this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
279
+ this.hot.listen();
280
+ if (from === 'from_above') {
281
+ _classPrivateFieldGet(_focusController, this).toFirstItem();
282
+ } else {
283
+ _classPrivateFieldGet(_focusController, this).toLastItem();
284
+ }
285
+ _classPrivateFieldGet(_focusDetector, this).deactivate();
286
+ }
287
+ }));
288
+ }
289
+ _assertClassBrand(_Pagination_brand, this, _registerEvents).call(this);
290
+ _assertClassBrand(_Pagination_brand, this, _registerShortcuts).call(this);
291
+
292
+ // Place the onInit hook before others to make sure that the pagination state is computed
293
+ // and applied to the index mapper before AutoColumnSize plugin begins calculate the column sizes.
294
+ this.addHook('init', function () {
295
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
296
+ args[_key] = arguments[_key];
297
+ }
298
+ return _assertClassBrand(_Pagination_brand, _this, _onInit).call(_this, ...args);
299
+ }, -1);
300
+ this.addHook('beforeSelectAll', function () {
301
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
302
+ args[_key2] = arguments[_key2];
303
+ }
304
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforeSelectAllRows).call(_this, ...args);
305
+ });
306
+ this.addHook('beforeSelectColumns', function () {
307
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
308
+ args[_key3] = arguments[_key3];
309
+ }
310
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforeSelectAllRows).call(_this, ...args);
311
+ });
312
+ this.addHook('beforeSetRangeEnd', function () {
313
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
314
+ args[_key4] = arguments[_key4];
315
+ }
316
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforeSetRangeEnd).call(_this, ...args);
317
+ });
318
+ this.addHook('beforeSelectionHighlightSet', function () {
319
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
320
+ args[_key5] = arguments[_key5];
321
+ }
322
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforeSelectionHighlightSet).call(_this, ...args);
323
+ });
324
+ this.addHook('beforePaste', function () {
325
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
326
+ args[_key6] = arguments[_key6];
327
+ }
328
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforePaste).call(_this, ...args);
329
+ });
330
+ this.addHook('afterViewRender', function () {
331
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
332
+ args[_key7] = arguments[_key7];
333
+ }
334
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterViewRender).call(_this, ...args);
335
+ });
336
+ this.addHook('afterRender', function () {
337
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
338
+ args[_key8] = arguments[_key8];
339
+ }
340
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterRender).call(_this, ...args);
341
+ });
342
+ this.addHook('afterScrollVertically', function () {
343
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
344
+ args[_key9] = arguments[_key9];
345
+ }
346
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterScrollVertically).call(_this, ...args);
347
+ });
348
+ this.addHook('afterLanguageChange', function () {
349
+ for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
350
+ args[_key0] = arguments[_key0];
351
+ }
352
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterLanguageChange).call(_this, ...args);
353
+ });
354
+ this.addHook('modifyRowHeight', function () {
355
+ for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
356
+ args[_key1] = arguments[_key1];
357
+ }
358
+ return _assertClassBrand(_Pagination_brand, _this, _onModifyRowHeight).call(_this, ...args);
359
+ });
360
+ this.addHook('beforeHeightChange', function () {
361
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
362
+ args[_key10] = arguments[_key10];
363
+ }
364
+ return _assertClassBrand(_Pagination_brand, _this, _onBeforeHeightChange).call(_this, ...args);
365
+ });
366
+ this.addHook('afterSetTheme', function () {
367
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
368
+ args[_key11] = arguments[_key11];
369
+ }
370
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterSetTheme).call(_this, ...args);
371
+ });
372
+ this.addHook('afterDialogShow', function () {
373
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
374
+ args[_key12] = arguments[_key12];
375
+ }
376
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogShow).call(_this, ...args);
377
+ });
378
+ this.addHook('beforeDialogHide', function () {
379
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
380
+ args[_key13] = arguments[_key13];
381
+ }
382
+ return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogHide).call(_this, ...args);
383
+ });
384
+ this.hot.rowIndexMapper.addLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this));
385
+ super.enablePlugin();
386
+ }
387
+
388
+ /**
389
+ * Updates the plugin state. This method is executed when {@link Core#updateSettings} is invoked.
390
+ */
391
+ updatePlugin() {
392
+ this.disablePlugin();
393
+ this.enablePlugin();
394
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
395
+ super.updatePlugin();
396
+ }
397
+
398
+ /**
399
+ * Disables the plugin functionality for this Handsontable instance.
400
+ */
401
+ disablePlugin() {
402
+ this.hot.rowIndexMapper.removeLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this)).unregisterMap(this.pluginName);
403
+ _classPrivateFieldGet(_ui, this).destroy();
404
+ _classPrivateFieldSet(_ui, this, null);
405
+ _assertClassBrand(_Pagination_brand, this, _unregisterShortcuts).call(this);
406
+ super.disablePlugin();
407
+ }
408
+ /**
409
+ * Gets the pagination current state. Returns an object with the following properties:
410
+ * - `currentPage`: The current page number.
411
+ * - `totalPages`: The total number of pages.
412
+ * - `pageSize`: The page size.
413
+ * - `pageSizeList`: The list of page sizes.
414
+ * - `autoPageSize`: Whether the page size is calculated automatically.
415
+ * - `numberOfRenderedRows`: The number of rendered rows.
416
+ * - `firstVisibleRowIndex`: The index of the first visible row.
417
+ * - `lastVisibleRowIndex`: The index of the last visible row.
418
+ *
419
+ * @returns {{
420
+ * currentPage: number,
421
+ * totalPages: number,
422
+ * pageSize: number,
423
+ * pageSizeList: Array<number | 'auto'>,
424
+ * autoPageSize: boolean,
425
+ * numberOfRenderedRows: number,
426
+ * firstVisibleRowIndex: number,
427
+ * lastVisibleRowIndex: number
428
+ * }}
429
+ */
430
+ getPaginationData() {
431
+ const totalPages = _classPrivateFieldGet(_calcStrategy, this).getTotalPages();
432
+ let firstVisibleRowIndex = -1;
433
+ let lastVisibleRowIndex = -1;
434
+ const {
435
+ pageSize,
436
+ startIndex
437
+ } = _classPrivateFieldGet(_calcStrategy, this).getState(_classPrivateFieldGet(_currentPage, this));
438
+ const countRows = this.hot.countRows();
439
+ let visibleCount = 0;
440
+ for (let rowIndex = startIndex; visibleCount < pageSize; rowIndex++) {
441
+ if (rowIndex >= countRows) {
442
+ break;
443
+ }
444
+ if (this.hot.rowIndexMapper.isHidden(this.hot.toPhysicalRow(rowIndex))) {
445
+ // eslint-disable-next-line no-continue
446
+ continue;
447
+ }
448
+ if (firstVisibleRowIndex === -1) {
449
+ firstVisibleRowIndex = rowIndex;
450
+ }
451
+ lastVisibleRowIndex = rowIndex;
452
+ visibleCount += 1;
453
+ }
454
+ return {
455
+ currentPage: _classPrivateFieldGet(_currentPage, this),
456
+ totalPages,
457
+ pageSize,
458
+ pageSizeList: [...this.getSetting('pageSizeList')],
459
+ autoPageSize: _classPrivateFieldGet(_pageSize, this) === 'auto',
460
+ numberOfRenderedRows: this.hot.rowIndexMapper.getRenderableIndexesLength(),
461
+ firstVisibleRowIndex,
462
+ lastVisibleRowIndex
463
+ };
464
+ }
465
+
466
+ /**
467
+ * Allows changing the page for specified page number.
468
+ *
469
+ * @param {number} pageNumber The page number to set (from 1 to N). If `0` is passed, it
470
+ * will be transformed to `1`.
471
+ * @fires Hooks#beforePageChange
472
+ * @fires Hooks#afterPageChange
473
+ */
474
+ setPage(pageNumber) {
475
+ const oldPage = _classPrivateFieldGet(_currentPage, this);
476
+ const shouldProceed = this.hot.runHooks('beforePageChange', oldPage, pageNumber);
477
+ if (shouldProceed === false) {
478
+ return;
479
+ }
480
+ _classPrivateFieldSet(_currentPage, this, pageNumber);
481
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
482
+ this.hot.scrollViewportTo({
483
+ row: 0
484
+ });
485
+ this.hot.runHooks('afterPageChange', oldPage, _classPrivateFieldGet(_currentPage, this));
486
+ this.hot.view.adjustElementsSize();
487
+ this.hot.render();
488
+ }
489
+
490
+ /**
491
+ * Resets the current page to the initial page (`initialValue`) defined in the settings.
492
+ */
493
+ resetPage() {
494
+ this.setPage(this.getSetting('initialPage'));
495
+ }
496
+
497
+ /**
498
+ * Changes the page size for the pagination. The method recalculates the state based
499
+ * on the new page size and re-renders the table. If `'auto'` is passed, the plugin will
500
+ * calculate the page size based on the viewport size and row heights to make sure
501
+ * that there will be no vertical scrollbar in the table.
502
+ *
503
+ * @param {number | 'auto'} pageSize The page size to set.
504
+ * @fires Hooks#beforePageSizeChange
505
+ * @fires Hooks#afterPageSizeChange
506
+ */
507
+ setPageSize(pageSize) {
508
+ var _this$hot$getPlugin2;
509
+ const oldPageSize = _classPrivateFieldGet(_pageSize, this);
510
+ const shouldProceed = this.hot.runHooks('beforePageSizeChange', oldPageSize, pageSize);
511
+ if (shouldProceed === false) {
512
+ return;
513
+ }
514
+ if (pageSize === 'auto' && !((_this$hot$getPlugin2 = this.hot.getPlugin('autoRowSize')) !== null && _this$hot$getPlugin2 !== void 0 && _this$hot$getPlugin2.enabled)) {
515
+ (0, _console.warn)(AUTO_PAGE_SIZE_WARNING);
516
+ }
517
+ _classPrivateFieldSet(_calcStrategy, this, (0, _strategies.createPaginatorStrategy)(pageSize === 'auto' ? 'auto' : 'fixed'));
518
+ _classPrivateFieldSet(_pageSize, this, pageSize);
519
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
520
+ this.hot.runHooks('afterPageSizeChange', oldPageSize, _classPrivateFieldGet(_pageSize, this));
521
+ this.hot.view.adjustElementsSize();
522
+ this.hot.render();
523
+ }
524
+
525
+ /**
526
+ * Resets the page size to the initial value (`pageSize`) defined in the settings.
527
+ */
528
+ resetPageSize() {
529
+ this.setPageSize(this.getSetting('pageSize'));
530
+ }
531
+
532
+ /**
533
+ * Resets the pagination state to the initial values defined in the settings.
534
+ */
535
+ resetPagination() {
536
+ this.resetPage();
537
+ this.resetPageSize();
538
+ _assertClassBrand(_Pagination_brand, this, _updateSectionsVisibilityState).call(this);
539
+ }
540
+
541
+ /**
542
+ * Switches the page to the next one.
543
+ */
544
+ nextPage() {
545
+ this.setPage(_classPrivateFieldGet(_currentPage, this) + 1);
546
+ }
547
+
548
+ /**
549
+ * Switches the page to the previous one.
550
+ */
551
+ prevPage() {
552
+ this.setPage(_classPrivateFieldGet(_currentPage, this) - 1);
553
+ }
554
+
555
+ /**
556
+ * Switches the page to the first one.
557
+ */
558
+ firstPage() {
559
+ this.setPage(1);
560
+ }
561
+
562
+ /**
563
+ * Switches the page to the last one.
564
+ */
565
+ lastPage() {
566
+ this.setPage(_classPrivateFieldGet(_calcStrategy, this).getTotalPages());
567
+ }
568
+
569
+ /**
570
+ * Checks, based on the current internal state, if there is a previous page.
571
+ *
572
+ * @returns {boolean}
573
+ */
574
+ hasPreviousPage() {
575
+ return _classPrivateFieldGet(_currentPage, this) > 1;
576
+ }
577
+
578
+ /**
579
+ * Checks, based on the current internal state, if there is a next page.
580
+ *
581
+ * @returns {boolean}
582
+ */
583
+ hasNextPage() {
584
+ return _classPrivateFieldGet(_currentPage, this) < _classPrivateFieldGet(_calcStrategy, this).getTotalPages();
585
+ }
586
+
587
+ /**
588
+ * Gets the visual data for the current page. The returned data may be longer than the defined
589
+ * page size as the data may contain hidden rows (rows that are not rendered in the table).
590
+ *
591
+ * @returns {Array<Array>} Returns the data for the current page.
592
+ */
593
+ getCurrentPageData() {
594
+ const {
595
+ firstVisibleRowIndex,
596
+ lastVisibleRowIndex
597
+ } = this.getPaginationData();
598
+ if (firstVisibleRowIndex === -1 || lastVisibleRowIndex === -1) {
599
+ return [];
600
+ }
601
+ return this.hot.getData(firstVisibleRowIndex, 0, lastVisibleRowIndex, this.hot.countCols() - 1);
602
+ }
603
+
604
+ /**
605
+ * Shows the page size section in the pagination UI.
606
+ *
607
+ * @fires Hooks#afterPageSizeVisibilityChange
608
+ */
609
+ showPageSizeSection() {
610
+ _classPrivateFieldGet(_ui, this).setPageSizeSectionVisibility(true);
611
+ this.hot.runHooks('afterPageSizeVisibilityChange', true);
612
+ }
613
+
614
+ /**
615
+ * Hides the page size section in the pagination UI.
616
+ *
617
+ * @fires Hooks#afterPageSizeVisibilityChange
618
+ */
619
+ hidePageSizeSection() {
620
+ _classPrivateFieldGet(_ui, this).setPageSizeSectionVisibility(false);
621
+ this.hot.runHooks('afterPageSizeVisibilityChange', false);
622
+ }
623
+
624
+ /**
625
+ * Shows the page counter section in the pagination UI.
626
+ *
627
+ * @fires Hooks#afterPageCounterVisibilityChange
628
+ */
629
+ showPageCounterSection() {
630
+ _classPrivateFieldGet(_ui, this).setCounterSectionVisibility(true);
631
+ this.hot.runHooks('afterPageCounterVisibilityChange', true);
632
+ }
633
+
634
+ /**
635
+ * Hides the page counter section in the pagination UI.
636
+ *
637
+ * @fires Hooks#afterPageCounterVisibilityChange
638
+ */
639
+ hidePageCounterSection() {
640
+ _classPrivateFieldGet(_ui, this).setCounterSectionVisibility(false);
641
+ this.hot.runHooks('afterPageCounterVisibilityChange', false);
642
+ }
643
+
644
+ /**
645
+ * Shows the page navigation section in the pagination UI.
646
+ *
647
+ * @fires Hooks#afterPageNavigationVisibilityChange
648
+ */
649
+ showPageNavigationSection() {
650
+ _classPrivateFieldGet(_ui, this).setNavigationSectionVisibility(true);
651
+ this.hot.runHooks('afterPageNavigationVisibilityChange', true);
652
+ }
653
+
654
+ /**
655
+ * Hides the page navigation section in the pagination UI.
656
+ *
657
+ * @fires Hooks#afterPageNavigationVisibilityChange
658
+ */
659
+ hidePageNavigationSection() {
660
+ _classPrivateFieldGet(_ui, this).setNavigationSectionVisibility(false);
661
+ this.hot.runHooks('afterPageNavigationVisibilityChange', false);
662
+ }
663
+
664
+ /**
665
+ * Updates the visibility state of the pagination sections based on the current settings.
666
+ */
667
+
668
+ /**
669
+ * Destroys the plugin instance.
670
+ */
671
+ destroy() {
672
+ var _classPrivateFieldGet2;
673
+ _classPrivateFieldSet(_pagedRowsMap, this, null);
674
+ _classPrivateFieldSet(_calcStrategy, this, null);
675
+ (_classPrivateFieldGet2 = _classPrivateFieldGet(_ui, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.destroy();
676
+ _classPrivateFieldSet(_ui, this, null);
677
+ super.destroy();
678
+ }
679
+ }
680
+ exports.Pagination = Pagination;
681
+ function _registerEvents() {
682
+ // TODO: move to general focus manager module
683
+ this.eventManager.addEventListener(this.hot.rootDocument, 'mouseup', event => {
684
+ const container = _classPrivateFieldGet(_ui, this).getContainer();
685
+ if (!container.contains(event.target) && this.hot.getShortcutManager().getActiveContextName() === SHORTCUTS_CONTEXT_NAME) {
686
+ _classPrivateFieldGet(_focusDetector, this).activate();
687
+ _classPrivateFieldGet(_focusController, this).clear();
688
+ this.hot.getShortcutManager().setActiveContextName('grid');
689
+ }
690
+ });
691
+ }
692
+ /**
693
+ * Register shortcuts responsible for navigating through the pagination.
694
+ */
695
+ function _registerShortcuts() {
696
+ var _manager$getContext;
697
+ const manager = this.hot.getShortcutManager();
698
+ const pluginContext = (_manager$getContext = manager.getContext(SHORTCUTS_CONTEXT_NAME)) !== null && _manager$getContext !== void 0 ? _manager$getContext : manager.addContext(SHORTCUTS_CONTEXT_NAME, 'global');
699
+ pluginContext.addShortcut({
700
+ keys: [['Shift', 'Tab'], ['Tab']],
701
+ preventDefault: false,
702
+ callback: event => {
703
+ let previousIndex = _classPrivateFieldGet(_focusController, this).getCurrentPage();
704
+ if (event.shiftKey) {
705
+ _classPrivateFieldGet(_focusController, this).toPreviousItem();
706
+ const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
707
+ if (currentPage >= previousIndex) {
708
+ _assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
709
+ return;
710
+ }
711
+ previousIndex = currentPage;
712
+ } else {
713
+ _classPrivateFieldGet(_focusController, this).toNextItem();
714
+ const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
715
+ if (currentPage <= previousIndex) {
716
+ _assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
717
+ return;
718
+ }
719
+ previousIndex = currentPage;
720
+ }
721
+ event.preventDefault();
722
+ },
723
+ group: SHORTCUTS_GROUP
724
+ });
725
+ }
726
+ /**
727
+ * Unregister shortcuts responsible for navigating through the pagination.
728
+ */
729
+ function _unregisterShortcuts() {
730
+ const shortcutManager = this.hot.getShortcutManager();
731
+ const pluginContext = shortcutManager.getContext(SHORTCUTS_CONTEXT_NAME);
732
+ pluginContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
733
+ }
734
+ function _updateSectionsVisibilityState() {
735
+ if (this.getSetting('showPageSize')) {
736
+ this.showPageSizeSection();
737
+ } else {
738
+ this.hidePageSizeSection();
739
+ }
740
+ if (this.getSetting('showCounter')) {
741
+ this.showPageCounterSection();
742
+ } else {
743
+ this.hidePageCounterSection();
744
+ }
745
+ if (this.getSetting('showNavigation')) {
746
+ this.showPageNavigationSection();
747
+ } else {
748
+ this.hidePageNavigationSection();
749
+ }
750
+ }
751
+ /**
752
+ * Applies the current pagination state to the internal index mapper and updates the UI.
753
+ */
754
+ function _computeAndApplyState() {
755
+ _classPrivateFieldSet(_internalExecutionCall, this, true);
756
+ _classPrivateFieldGet(_pagedRowsMap, this).clear();
757
+ const renderableIndexes = this.hot.rowIndexMapper.getRenderableIndexes();
758
+ const renderableRowsLength = renderableIndexes.length;
759
+ const {
760
+ stylesHandler
761
+ } = this.hot;
762
+ _classPrivateFieldGet(_calcStrategy, this).calculate({
763
+ pageSize: _classPrivateFieldGet(_pageSize, this),
764
+ totalItems: renderableRowsLength,
765
+ viewportSizeProvider: () => {
766
+ const {
767
+ view
768
+ } = this.hot;
769
+ if (view.isVerticallyScrollableByWindow()) {
770
+ const bodyStyle = getComputedStyle(this.hot.rootDocument.body);
771
+ const margin = Number.parseInt(bodyStyle.marginTop, 10) + Number.parseInt(bodyStyle.marginBottom, 10);
772
+ const columnHeaderHeight = this.hot.hasColHeaders() ? view._wt.wtTable.getColumnHeaderHeight() : 0;
773
+ const paginationContainerHeight = _classPrivateFieldGet(_ui, this).getHeight();
774
+ const workspaceHeight = view.getWorkspaceHeight();
775
+ return workspaceHeight - paginationContainerHeight - columnHeaderHeight - margin;
776
+ }
777
+ const scrollbarWidth = view.hasHorizontalScroll() ? (0, _element.getScrollbarWidth)() : 0;
778
+ return view.getViewportHeight() - scrollbarWidth;
779
+ },
780
+ itemsSizeProvider: () => {
781
+ const defaultRowHeight = stylesHandler.getDefaultRowHeight();
782
+ const rowHeights = this.hot.rowIndexMapper.getRenderableIndexes().map(physicalIndex => {
783
+ var _this$hot$getRowHeigh;
784
+ return (_this$hot$getRowHeigh = this.hot.getRowHeight(this.hot.toVisualRow(physicalIndex))) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultRowHeight;
785
+ });
786
+ return rowHeights;
787
+ }
788
+ });
789
+ const totalPages = _classPrivateFieldGet(_calcStrategy, this).getTotalPages();
790
+ _classPrivateFieldSet(_currentPage, this, (0, _number.clamp)(_classPrivateFieldGet(_currentPage, this), 1, totalPages));
791
+ if (renderableIndexes.length > 0) {
792
+ const {
793
+ startIndex,
794
+ pageSize
795
+ } = _classPrivateFieldGet(_calcStrategy, this).getState(_classPrivateFieldGet(_currentPage, this));
796
+ renderableIndexes.splice(startIndex, pageSize);
797
+ }
798
+ if (renderableIndexes.length > 0) {
799
+ this.hot.batchExecution(() => {
800
+ renderableIndexes.forEach(index => _classPrivateFieldGet(_pagedRowsMap, this).setValueAtIndex(index, true));
801
+ }, true);
802
+ } else {
803
+ this.hot.rowIndexMapper.updateCache(true);
804
+ }
805
+ _classPrivateFieldSet(_internalExecutionCall, this, false);
806
+ const paginationData = this.getPaginationData();
807
+ _classPrivateFieldGet(_ui, this).updateState({
808
+ ...paginationData,
809
+ totalRenderedRows: renderableRowsLength
810
+ });
811
+ if ((this.getSetting('showPageSize') || this.getSetting('showNavigation')) && paginationData.totalPages > 1) {
812
+ _classPrivateFieldGet(_focusDetector, this).activate();
813
+ } else {
814
+ _classPrivateFieldGet(_focusDetector, this).deactivate();
815
+ }
816
+ }
817
+ /**
818
+ * Based on the external factors (like the scroll position of the table, size etc.) it computes
819
+ * the need for the top border of the pagination UI container.
820
+ *
821
+ * @returns {boolean} Returns `true` if the pagination UI should have a top border, `false` otherwise.
822
+ */
823
+ function _computeNeedsBorder() {
824
+ if (!this.hot.view) {
825
+ return true;
826
+ }
827
+ const {
828
+ view
829
+ } = this.hot;
830
+ if (view.isVerticallyScrollableByWindow()) {
831
+ return false;
832
+ }
833
+ if (view.hasHorizontalScroll() || view.getTableHeight() < view.getWorkspaceHeight()) {
834
+ return true;
835
+ }
836
+ const {
837
+ lastVisibleRowIndex
838
+ } = this.getPaginationData();
839
+ return view.getLastFullyVisibleRow() !== lastVisibleRowIndex;
840
+ }
841
+ /**
842
+ * Called before the selection of columns or all table is made. It modifies the selection rows range
843
+ * to the range of the current page.
844
+ *
845
+ * @param {CellCoords} from Starting cell coordinates.
846
+ * @param {CellCoords} to Ending cell coordinates.
847
+ */
848
+ function _onBeforeSelectAllRows(from, to) {
849
+ const {
850
+ firstVisibleRowIndex,
851
+ lastVisibleRowIndex
852
+ } = this.getPaginationData();
853
+ if (_classPrivateFieldGet(_currentPage, this) > 1 || from.row >= 0) {
854
+ from.row = firstVisibleRowIndex;
855
+ }
856
+ to.row = lastVisibleRowIndex;
857
+ }
858
+ /**
859
+ * Called before the selection end is fired. It modifies the selection to the range of
860
+ * the current page.
861
+ *
862
+ * @param {CellCoords} coords Ending cell coordinates.
863
+ */
864
+ function _onBeforeSetRangeEnd(coords) {
865
+ if (this.hot.selection.isSelectedByColumnHeader()) {
866
+ const {
867
+ lastVisibleRowIndex
868
+ } = this.getPaginationData();
869
+ coords.row = lastVisibleRowIndex;
870
+ }
871
+ }
872
+ /**
873
+ * The hook corrects the focus position (before drawing it) after the selection was made
874
+ * (the visual coordinates was collected).
875
+ */
876
+ function _onBeforeSelectionHighlightSet() {
877
+ if (!this.hot.getSettings().navigableHeaders) {
878
+ return;
879
+ }
880
+ const selectedRange = this.hot.getSelectedRangeLast();
881
+ if (!selectedRange.isSingle()) {
882
+ const {
883
+ highlight
884
+ } = selectedRange;
885
+ highlight.row = (0, _number.clamp)(highlight.row, selectedRange.getTopStartCorner().row, selectedRange.getBottomEndCorner().row);
886
+ }
887
+ }
888
+ /**
889
+ * Called before the paste operation is performed. It removes the rows that are not visible
890
+ * from the pasted data.
891
+ *
892
+ * @param {Array} pastedData The data that was pasted.
893
+ * @param {Array<{startRow: number, endRow: number}>} ranges The ranges of the pasted data.
894
+ * @returns {boolean} Returns `false` to prevent the paste operation.
895
+ */
896
+ function _onBeforePaste(pastedData, ranges) {
897
+ const {
898
+ firstVisibleRowIndex,
899
+ lastVisibleRowIndex
900
+ } = this.getPaginationData();
901
+ if (firstVisibleRowIndex === -1 || lastVisibleRowIndex === -1) {
902
+ return false;
903
+ }
904
+ ranges.forEach(_ref => {
905
+ let {
906
+ startRow
907
+ } = _ref;
908
+ if (pastedData.length === 0) {
909
+ return;
910
+ }
911
+ const rowsToRemove = Math.min(pastedData.length - (lastVisibleRowIndex - startRow + 1), pastedData.length);
912
+ pastedData.splice(0, rowsToRemove);
913
+ });
914
+ }
915
+ /**
916
+ * Called when the row height is modified. It adds 1px border top compensation for
917
+ * the first row of the each page to make sure that the table's hider element
918
+ * height is correctly calculated.
919
+ *
920
+ * @param {number | undefined} height Row height.
921
+ * @param {number} row Visual row index.
922
+ * @returns {number}
923
+ */
924
+ function _onModifyRowHeight(height, row) {
925
+ if (height === undefined || !_classPrivateFieldGet(_calcStrategy, this).getState(_classPrivateFieldGet(_currentPage, this))) {
926
+ return;
927
+ }
928
+ const {
929
+ firstVisibleRowIndex
930
+ } = this.getPaginationData();
931
+ if (row !== 0 && row === firstVisibleRowIndex) {
932
+ height += 1; // 1px border top compensation for the first row of the page.
933
+ }
934
+ return height;
935
+ }
936
+ /**
937
+ * Called after the view is rendered. It recalculates the pagination state only when
938
+ * the `pageSize` is set to `'auto'`. In this case, the plugin will compute the
939
+ * page size based on the viewport size and row heights for each render cycle to make sure
940
+ * that each row resize, multiline cell value, or other factors that may affect the
941
+ * rows height will be taken into account.
942
+ */
943
+ function _onAfterViewRender() {
944
+ if (_classPrivateFieldGet(_pageSize, this) !== 'auto' || _classPrivateFieldGet(_internalRenderCall, this)) {
945
+ _classPrivateFieldSet(_internalRenderCall, this, false);
946
+ return;
947
+ }
948
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
949
+ _classPrivateFieldSet(_internalRenderCall, this, true);
950
+ // there is need to re-render the table as on the initial the engine returns incorrect
951
+ // values about table and column header sizes.
952
+ this.hot.view.adjustElementsSize();
953
+ this.hot.render();
954
+ }
955
+ /**
956
+ * Called after the rendering of the table is completed. It updates the width of
957
+ * the pagination container to the same size as the table.
958
+ */
959
+ function _onAfterRender() {
960
+ const {
961
+ view
962
+ } = this.hot;
963
+ const width = view.isHorizontallyScrollableByWindow() ? view.getTotalTableWidth() : view.getWorkspaceWidth();
964
+ _classPrivateFieldGet(_ui, this).updateWidth(width).refreshBorderState();
965
+ }
966
+ /**
967
+ * Called before the height of the table is changed. It adjusts the table height to fit the pagination container
968
+ * in declared height.
969
+ *
970
+ * @param {number|string} height Table height.
971
+ * @returns {string} Returns the new table height.
972
+ */
973
+ function _onBeforeHeightChange(height) {
974
+ if (this.getSetting('uiContainer')) {
975
+ return height;
976
+ }
977
+ const isPixelValue = typeof height === 'number' || typeof height === 'string' && /^\d+$/.test(height) || typeof height === 'string' && height.endsWith('px');
978
+ if (!isPixelValue) {
979
+ return height;
980
+ }
981
+ const heightValue = typeof height === 'string' && height.endsWith('px') ? height : `${height}px`;
982
+ return `calc(${heightValue} - ${_classPrivateFieldGet(_ui, this).getHeight()}px)`;
983
+ }
984
+ /**
985
+ * Called after the initialization of the plugin. It computes the initial state of the pagination.
986
+ */
987
+ function _onInit() {
988
+ if (_classPrivateFieldGet(_pageSize, this) === 'auto') {
989
+ return;
990
+ }
991
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
992
+ }
993
+ /**
994
+ * Called after the vertical scrolling of the table is completed. It refreshes
995
+ * the border state of the pagination UI.
996
+ */
997
+ function _onAfterScrollVertically() {
998
+ _classPrivateFieldGet(_ui, this).refreshBorderState();
999
+ }
1000
+ /**
1001
+ * Called after the language change. It recomputes the pagination state which updates the UI.
1002
+ */
1003
+ function _onAfterLanguageChange() {
1004
+ _assertClassBrand(_Pagination_brand, this, _computeAndApplyState).call(this);
1005
+ }
1006
+ /**
1007
+ * Called after the theme is set. It updates the theme of the pagination container.
1008
+ *
1009
+ * @param {string | undefined} themeName The name of the theme to use.
1010
+ */
1011
+ function _onAfterSetTheme(themeName) {
1012
+ _classPrivateFieldGet(_ui, this).updateTheme(themeName);
1013
+ }
1014
+ /**
1015
+ * Unfocuses the pagination and sets the active context for the shortcuts.
1016
+ */
1017
+ function _unFocusPagination() {
1018
+ _classPrivateFieldGet(_focusDetector, this).activate();
1019
+ _classPrivateFieldGet(_focusController, this).clear();
1020
+ this.hot.unlisten();
1021
+ this.hot.getShortcutManager().setActiveContextName('grid');
1022
+ }
1023
+ /**
1024
+ * Called after the dialog is shown. It sets the active context for the shortcuts.
1025
+ */
1026
+ function _onAfterDialogShow() {
1027
+ _classPrivateFieldGet(_focusDetector, this).deactivate();
1028
+ }
1029
+ /**
1030
+ * Called after the dialog is hidden. It sets the active context for the shortcuts.
1031
+ */
1032
+ function _onAfterDialogHide() {
1033
+ _classPrivateFieldGet(_focusDetector, this).activate();
1034
+ }