handsontable 0.0.0-next-010265d-20231005 → 0.0.0-next-9379dd1-20231020

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (414) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +50 -11
  3. package/3rdparty/walkontable/src/cell/coords.mjs +50 -11
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +38 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +38 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +12 -10
  14. package/3rdparty/walkontable/src/event.mjs +12 -10
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +13 -2
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +14 -3
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -6
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -6
  25. package/3rdparty/walkontable/src/renderer/cells.js +10 -0
  26. package/3rdparty/walkontable/src/renderer/cells.mjs +11 -1
  27. package/3rdparty/walkontable/src/renderer/columnHeaders.js +10 -0
  28. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +11 -1
  29. package/3rdparty/walkontable/src/renderer/rowHeaders.js +5 -0
  30. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -0
  31. package/3rdparty/walkontable/src/renderer/rows.js +13 -0
  32. package/3rdparty/walkontable/src/renderer/rows.mjs +13 -0
  33. package/3rdparty/walkontable/src/renderer/table.js +9 -0
  34. package/3rdparty/walkontable/src/renderer/table.mjs +9 -0
  35. package/3rdparty/walkontable/src/scroll.js +2 -0
  36. package/3rdparty/walkontable/src/scroll.mjs +2 -0
  37. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  38. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  39. package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
  40. package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
  41. package/3rdparty/walkontable/src/selection/constants.js +62 -0
  42. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  43. package/3rdparty/walkontable/src/selection/index.js +26 -0
  44. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  45. package/3rdparty/walkontable/src/selection/manager.js +274 -0
  46. package/3rdparty/walkontable/src/selection/manager.mjs +269 -0
  47. package/3rdparty/walkontable/src/selection/scanner.js +270 -0
  48. package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
  49. package/3rdparty/walkontable/src/selection/selection.js +101 -0
  50. package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
  51. package/3rdparty/walkontable/src/settings.js +13 -4
  52. package/3rdparty/walkontable/src/settings.mjs +13 -4
  53. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  54. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  55. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  56. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  57. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  58. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  59. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  60. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  61. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  62. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  63. package/3rdparty/walkontable/src/table.js +19 -78
  64. package/3rdparty/walkontable/src/table.mjs +20 -79
  65. package/base.js +2 -2
  66. package/base.mjs +2 -2
  67. package/cellTypes/dateType/dateType.d.ts +3 -3
  68. package/cellTypes/dateType/dateType.js +2 -2
  69. package/cellTypes/dateType/dateType.mjs +2 -2
  70. package/cellTypes/handsontableType/handsontableType.d.ts +3 -3
  71. package/cellTypes/handsontableType/handsontableType.js +2 -2
  72. package/cellTypes/handsontableType/handsontableType.mjs +2 -2
  73. package/cellTypes/index.d.ts +3 -0
  74. package/cellTypes/index.js +4 -0
  75. package/cellTypes/index.mjs +3 -1
  76. package/cellTypes/selectType/index.d.ts +1 -0
  77. package/cellTypes/selectType/index.js +6 -0
  78. package/cellTypes/selectType/index.mjs +1 -0
  79. package/cellTypes/selectType/selectType.d.ts +14 -0
  80. package/cellTypes/selectType/selectType.js +13 -0
  81. package/cellTypes/selectType/selectType.mjs +8 -0
  82. package/core/focusCatcher/focusDetector.js +63 -0
  83. package/core/focusCatcher/focusDetector.mjs +59 -0
  84. package/core/focusCatcher/index.js +142 -0
  85. package/core/focusCatcher/index.mjs +138 -0
  86. package/core/index.js +9 -0
  87. package/core/index.mjs +1 -0
  88. package/core.d.ts +9 -4
  89. package/core.js +285 -327
  90. package/core.mjs +285 -327
  91. package/dataMap/metaManager/metaSchema.js +65 -0
  92. package/dataMap/metaManager/metaSchema.mjs +65 -0
  93. package/dataMap/metaManager/mods/extendMetaProperties.js +7 -1
  94. package/dataMap/metaManager/mods/extendMetaProperties.mjs +7 -1
  95. package/dataMap/replaceData.js +5 -0
  96. package/dataMap/replaceData.mjs +5 -0
  97. package/dist/handsontable.css +40 -5
  98. package/dist/handsontable.full.css +40 -5
  99. package/dist/handsontable.full.js +11744 -6945
  100. package/dist/handsontable.full.min.css +4 -4
  101. package/dist/handsontable.full.min.js +141 -141
  102. package/dist/handsontable.js +14036 -9237
  103. package/dist/handsontable.min.css +3 -3
  104. package/dist/handsontable.min.js +21 -21
  105. package/dist/languages/all.js +6 -2
  106. package/dist/languages/all.min.js +1 -1
  107. package/dist/languages/en-US.js +3 -1
  108. package/dist/languages/en-US.min.js +1 -1
  109. package/dist/languages/pl-PL.js +3 -1
  110. package/dist/languages/pl-PL.min.js +1 -1
  111. package/editorManager.js +15 -87
  112. package/editorManager.mjs +16 -87
  113. package/editors/autocompleteEditor/autocompleteEditor.js +53 -2
  114. package/editors/autocompleteEditor/autocompleteEditor.mjs +54 -3
  115. package/editors/dateEditor/dateEditor.js +26 -7
  116. package/editors/dateEditor/dateEditor.mjs +27 -8
  117. package/editors/handsontableEditor/handsontableEditor.js +9 -1
  118. package/editors/handsontableEditor/handsontableEditor.mjs +10 -2
  119. package/editors/textEditor/textEditor.js +19 -27
  120. package/editors/textEditor/textEditor.mjs +22 -30
  121. package/focusManager.d.ts +12 -0
  122. package/focusManager.js +265 -0
  123. package/focusManager.mjs +261 -0
  124. package/helpers/a11y.js +79 -0
  125. package/helpers/a11y.mjs +38 -0
  126. package/helpers/dom/element.js +188 -9
  127. package/helpers/dom/element.mjs +182 -9
  128. package/helpers/mixed.js +1 -1
  129. package/helpers/mixed.mjs +1 -1
  130. package/helpers/number.d.ts +1 -0
  131. package/helpers/number.js +18 -0
  132. package/helpers/number.mjs +17 -0
  133. package/i18n/constants.js +7 -1
  134. package/i18n/constants.mjs +4 -1
  135. package/i18n/languages/en-US.js +3 -1
  136. package/i18n/languages/en-US.mjs +3 -1
  137. package/i18n/languages/pl-PL.js +3 -1
  138. package/i18n/languages/pl-PL.mjs +3 -1
  139. package/languages/all.js +6 -2
  140. package/languages/en-US.js +3 -1
  141. package/languages/en-US.mjs +3 -1
  142. package/languages/index.js +6 -2
  143. package/languages/pl-PL.js +3 -1
  144. package/languages/pl-PL.mjs +3 -1
  145. package/package.json +21 -1
  146. package/pluginHooks.d.ts +12 -1
  147. package/pluginHooks.js +152 -1
  148. package/pluginHooks.mjs +152 -1
  149. package/plugins/collapsibleColumns/collapsibleColumns.js +74 -4
  150. package/plugins/collapsibleColumns/collapsibleColumns.mjs +75 -5
  151. package/plugins/columnSorting/columnSorting.js +43 -0
  152. package/plugins/columnSorting/columnSorting.mjs +44 -3
  153. package/plugins/columnSorting/index.js +3 -1
  154. package/plugins/columnSorting/index.mjs +1 -1
  155. package/plugins/comments/commentEditor.js +1 -0
  156. package/plugins/comments/commentEditor.mjs +1 -0
  157. package/plugins/comments/comments.js +252 -189
  158. package/plugins/comments/comments.mjs +251 -190
  159. package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
  160. package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
  161. package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
  162. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
  163. package/plugins/comments/contextMenuItem/removeComment.js +38 -0
  164. package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
  165. package/plugins/contextMenu/commandExecutor.js +2 -3
  166. package/plugins/contextMenu/commandExecutor.mjs +2 -3
  167. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  168. package/plugins/contextMenu/contextMenu.js +75 -36
  169. package/plugins/contextMenu/contextMenu.mjs +74 -35
  170. package/plugins/contextMenu/itemsFactory.js +2 -3
  171. package/plugins/contextMenu/itemsFactory.mjs +3 -4
  172. package/plugins/contextMenu/{cursor.mjs → menu/cursor.js} +6 -4
  173. package/plugins/contextMenu/{cursor.js → menu/cursor.mjs} +4 -10
  174. package/plugins/contextMenu/menu/index.js +9 -0
  175. package/plugins/contextMenu/menu/index.mjs +1 -0
  176. package/plugins/contextMenu/{menu.js → menu/menu.js} +96 -308
  177. package/plugins/contextMenu/{menu.mjs → menu/menu.mjs} +97 -309
  178. package/plugins/contextMenu/menu/navigator.js +152 -0
  179. package/plugins/contextMenu/menu/navigator.mjs +148 -0
  180. package/plugins/contextMenu/menu/positioner.js +213 -0
  181. package/plugins/contextMenu/menu/positioner.mjs +209 -0
  182. package/plugins/contextMenu/menu/utils.js +177 -0
  183. package/plugins/contextMenu/menu/utils.mjs +163 -0
  184. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  185. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  186. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  187. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  188. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  189. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  190. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  191. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  192. package/plugins/contextMenu/{predefinedItems.js → predefinedItems/index.js} +14 -14
  193. package/plugins/contextMenu/predefinedItems/index.mjs +68 -0
  194. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  195. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  196. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  197. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  198. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  199. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  200. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  201. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  202. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  203. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  204. package/plugins/contextMenu/utils.js +35 -151
  205. package/plugins/contextMenu/utils.mjs +35 -144
  206. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  207. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  208. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  209. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  210. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  211. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  212. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  213. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  214. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  215. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  216. package/plugins/copyPaste/copyPaste.js +127 -78
  217. package/plugins/copyPaste/copyPaste.mjs +128 -79
  218. package/plugins/customBorders/customBorders.js +23 -20
  219. package/plugins/customBorders/customBorders.mjs +24 -21
  220. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  221. package/plugins/dropdownMenu/dropdownMenu.js +97 -38
  222. package/plugins/dropdownMenu/dropdownMenu.mjs +96 -37
  223. package/plugins/filters/constants.mjs +1 -1
  224. package/plugins/filters/filters.js +31 -14
  225. package/plugins/filters/filters.mjs +31 -14
  226. package/plugins/filters/ui/select.js +3 -3
  227. package/plugins/filters/ui/select.mjs +2 -2
  228. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
  229. package/plugins/hiddenRows/hiddenRows.mjs +1 -1
  230. package/plugins/manualColumnMove/manualColumnMove.js +3 -1
  231. package/plugins/manualColumnMove/manualColumnMove.mjs +3 -1
  232. package/plugins/mergeCells/mergeCells.js +5 -16
  233. package/plugins/mergeCells/mergeCells.mjs +5 -16
  234. package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
  235. package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
  236. package/plugins/nestedHeaders/nestedHeaders.js +240 -10
  237. package/plugins/nestedHeaders/nestedHeaders.mjs +241 -11
  238. package/plugins/nestedHeaders/stateManager/index.js +102 -3
  239. package/plugins/nestedHeaders/stateManager/index.mjs +102 -3
  240. package/plugins/nestedRows/nestedRows.js +41 -0
  241. package/plugins/nestedRows/nestedRows.mjs +41 -0
  242. package/plugins/nestedRows/ui/headers.js +11 -0
  243. package/plugins/nestedRows/ui/headers.mjs +12 -1
  244. package/renderers/autocompleteRenderer/autocompleteRenderer.js +8 -0
  245. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +8 -0
  246. package/renderers/baseRenderer/baseRenderer.js +17 -0
  247. package/renderers/baseRenderer/baseRenderer.mjs +18 -1
  248. package/renderers/checkboxRenderer/checkboxRenderer.js +9 -4
  249. package/renderers/checkboxRenderer/checkboxRenderer.mjs +9 -4
  250. package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
  251. package/renderers/dateRenderer/dateRenderer.js +29 -0
  252. package/renderers/dateRenderer/dateRenderer.mjs +24 -0
  253. package/renderers/dateRenderer/index.d.ts +1 -0
  254. package/renderers/dateRenderer/index.js +6 -0
  255. package/renderers/dateRenderer/index.mjs +1 -0
  256. package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
  257. package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
  258. package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
  259. package/renderers/handsontableRenderer/index.d.ts +1 -0
  260. package/renderers/handsontableRenderer/index.js +6 -0
  261. package/renderers/handsontableRenderer/index.mjs +1 -0
  262. package/renderers/index.d.ts +9 -0
  263. package/renderers/selectRenderer/index.d.ts +1 -0
  264. package/renderers/selectRenderer/index.js +6 -0
  265. package/renderers/selectRenderer/index.mjs +1 -0
  266. package/renderers/selectRenderer/selectRenderer.d.ts +5 -0
  267. package/renderers/selectRenderer/selectRenderer.js +27 -0
  268. package/renderers/selectRenderer/selectRenderer.mjs +22 -0
  269. package/selection/highlight/highlight.js +256 -71
  270. package/selection/highlight/highlight.mjs +250 -71
  271. package/selection/highlight/types/activeHeader.js +10 -8
  272. package/selection/highlight/types/activeHeader.mjs +10 -8
  273. package/selection/highlight/types/area.js +6 -18
  274. package/selection/highlight/types/area.mjs +6 -18
  275. package/selection/highlight/types/areaLayered.js +31 -0
  276. package/selection/highlight/types/areaLayered.mjs +26 -0
  277. package/selection/highlight/types/column.js +27 -0
  278. package/selection/highlight/types/column.mjs +22 -0
  279. package/selection/highlight/types/customSelection.js +7 -9
  280. package/selection/highlight/types/customSelection.mjs +7 -9
  281. package/selection/highlight/types/fill.js +5 -7
  282. package/selection/highlight/types/fill.mjs +5 -7
  283. package/selection/highlight/types/{cell.js → focus.js} +5 -7
  284. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  285. package/selection/highlight/types/header.js +9 -18
  286. package/selection/highlight/types/header.mjs +9 -18
  287. package/selection/highlight/types/row.js +27 -0
  288. package/selection/highlight/types/row.mjs +22 -0
  289. package/selection/highlight/visualSelection.js +31 -27
  290. package/selection/highlight/visualSelection.mjs +31 -27
  291. package/selection/index.js +4 -7
  292. package/selection/index.mjs +2 -3
  293. package/selection/mouseEventHandler.js +7 -1
  294. package/selection/mouseEventHandler.mjs +7 -1
  295. package/selection/range.js +8 -8
  296. package/selection/range.mjs +8 -8
  297. package/selection/selection.js +321 -152
  298. package/selection/selection.mjs +318 -151
  299. package/selection/transformation.js +232 -90
  300. package/selection/transformation.mjs +232 -90
  301. package/selection/utils.js +15 -21
  302. package/selection/utils.mjs +16 -21
  303. package/settings.d.ts +4 -0
  304. package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
  305. package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
  306. package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
  307. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  308. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  309. package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
  310. package/shortcutContexts/commands/editor/index.js +16 -0
  311. package/shortcutContexts/commands/editor/index.mjs +12 -0
  312. package/shortcutContexts/commands/editor/open.js +27 -0
  313. package/shortcutContexts/commands/editor/open.mjs +23 -0
  314. package/shortcutContexts/commands/emptySelectedCells.js +11 -0
  315. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  316. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  317. package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
  318. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +25 -0
  319. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +21 -0
  320. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  321. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  322. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  323. package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
  324. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  325. package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
  326. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  327. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
  328. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
  329. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
  330. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
  331. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
  332. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
  333. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
  334. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
  335. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
  336. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
  337. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
  338. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
  339. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
  340. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  341. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
  342. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  343. package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
  344. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +25 -0
  345. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +21 -0
  346. package/shortcutContexts/commands/index.js +35 -0
  347. package/shortcutContexts/commands/index.mjs +31 -0
  348. package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
  349. package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
  350. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +33 -0
  351. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +29 -0
  352. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  353. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  354. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
  355. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  356. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
  357. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  358. package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
  359. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  360. package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
  361. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  362. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
  363. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
  364. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
  365. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
  366. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
  367. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
  368. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
  369. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
  370. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
  371. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
  372. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
  373. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
  374. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
  375. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
  376. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
  377. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
  378. package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
  379. package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
  380. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +33 -0
  381. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +29 -0
  382. package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
  383. package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
  384. package/shortcutContexts/commands/scrollToFocusedCell.js +35 -0
  385. package/shortcutContexts/commands/scrollToFocusedCell.mjs +31 -0
  386. package/shortcutContexts/commands/selectAll.js +12 -0
  387. package/shortcutContexts/commands/selectAll.mjs +8 -0
  388. package/shortcutContexts/constants.js +13 -0
  389. package/shortcutContexts/constants.mjs +8 -0
  390. package/shortcutContexts/editor.js +25 -0
  391. package/shortcutContexts/editor.mjs +21 -0
  392. package/shortcutContexts/grid.js +163 -0
  393. package/shortcutContexts/grid.mjs +159 -0
  394. package/shortcutContexts/index.js +24 -0
  395. package/shortcutContexts/index.mjs +11 -0
  396. package/shortcuts/context.js +20 -2
  397. package/shortcuts/context.mjs +20 -3
  398. package/shortcuts/manager.js +25 -7
  399. package/shortcuts/manager.mjs +26 -7
  400. package/shortcuts/recorder.js +3 -3
  401. package/shortcuts/recorder.mjs +3 -3
  402. package/shortcuts/utils.js +19 -5
  403. package/shortcuts/utils.mjs +18 -4
  404. package/tableView.js +111 -13
  405. package/tableView.mjs +112 -14
  406. package/3rdparty/walkontable/src/selection.js +0 -295
  407. package/3rdparty/walkontable/src/selection.mjs +0 -290
  408. package/plugins/contextMenu/predefinedItems.mjs +0 -68
  409. package/plugins/copyPaste/focusableElement.js +0 -186
  410. package/plugins/copyPaste/focusableElement.mjs +0 -180
  411. package/selection/highlight/constants.js +0 -15
  412. package/selection/highlight/constants.mjs +0 -6
  413. package/selection/highlight/types/index.js +0 -35
  414. package/selection/highlight/types/index.mjs +0 -31
package/editorManager.js CHANGED
@@ -3,15 +3,12 @@
3
3
  exports.__esModule = true;
4
4
  var _unicode = require("./helpers/unicode");
5
5
  var _event = require("./helpers/dom/event");
6
- var _element = require("./helpers/dom/element");
7
6
  var _registry = require("./editors/registry");
8
7
  var _eventManager = _interopRequireDefault(require("./eventManager"));
9
8
  var _mixed = require("./helpers/mixed");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
12
11
  exports.SHORTCUTS_GROUP_NAVIGATION = SHORTCUTS_GROUP_NAVIGATION;
13
- const SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
14
- exports.SHORTCUTS_GROUP_EDITOR = SHORTCUTS_GROUP_EDITOR;
15
12
  class EditorManager {
16
13
  /**
17
14
  * @param {Core} instance The Handsontable instance.
@@ -74,9 +71,6 @@ class EditorManager {
74
71
  * @type {object}
75
72
  */
76
73
  this.cellProperties = void 0;
77
- const shortcutManager = this.instance.getShortcutManager();
78
- shortcutManager.addContext('editor');
79
- this.registerShortcuts();
80
74
  this.instance.addHook('afterDocumentKeyDown', event => this.onAfterDocumentKeyDown(event));
81
75
 
82
76
  // Open editor when text composition is started (IME editor)
@@ -88,62 +82,6 @@ class EditorManager {
88
82
  this.instance.view._wt.update('onCellDblClick', (event, coords, elem) => this.onCellDblClick(event, coords, elem));
89
83
  }
90
84
 
91
- /**
92
- * Register shortcuts responsible for handling some actions related to an editor.
93
- *
94
- * @private
95
- */
96
- registerShortcuts() {
97
- const shortcutManager = this.instance.getShortcutManager();
98
- const gridContext = shortcutManager.getContext('grid');
99
- const editorContext = shortcutManager.getContext('editor');
100
- const config = {
101
- group: SHORTCUTS_GROUP_EDITOR
102
- };
103
- editorContext.addShortcuts([{
104
- keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
105
- callback: (event, keys) => {
106
- this.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
107
- this.moveSelectionAfterEnter(keys.includes('shift'));
108
- }
109
- }, {
110
- keys: [['Escape'], ['Escape', 'Control/Meta']],
111
- callback: () => {
112
- this.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
113
- this.activeEditor.focus();
114
- }
115
- }], config);
116
- gridContext.addShortcuts([{
117
- keys: [['F2']],
118
- callback: event => {
119
- this.openEditor(null, event, true);
120
- }
121
- }, {
122
- keys: [['Backspace'], ['Delete']],
123
- callback: () => {
124
- this.instance.emptySelectedCells();
125
- this.prepareEditor();
126
- }
127
- }, {
128
- keys: [['Enter'], ['Enter', 'Shift']],
129
- callback: (event, keys) => {
130
- if (this.instance.getSettings().enterBeginsEditing) {
131
- if (this.cellProperties.readOnly) {
132
- this.moveSelectionAfterEnter();
133
- } else {
134
- this.openEditor(null, event, true);
135
- }
136
- } else {
137
- this.moveSelectionAfterEnter(keys.includes('shift'));
138
- }
139
- (0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
140
- }
141
- }], {
142
- ...config,
143
- runOnlyIf: () => (0, _mixed.isDefined)(this.instance.getSelected())
144
- });
145
- }
146
-
147
85
  /**
148
86
  * Lock the editor from being prepared and closed. Locking the editor prevents its closing and
149
87
  * reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
@@ -196,10 +134,16 @@ class EditorManager {
196
134
  });
197
135
  return;
198
136
  }
137
+ const {
138
+ highlight
139
+ } = this.instance.getSelectedRangeLast();
140
+ if (highlight.isHeader()) {
141
+ return;
142
+ }
199
143
  const {
200
144
  row,
201
145
  col
202
- } = this.instance.getSelectedRangeLast().highlight;
146
+ } = highlight;
203
147
  const modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
204
148
  let visualRowToCheck = row;
205
149
  let visualColumnToCheck = col;
@@ -209,17 +153,6 @@ class EditorManager {
209
153
 
210
154
  // Getting values using the modified coordinates.
211
155
  this.cellProperties = this.instance.getCellMeta(visualRowToCheck, visualColumnToCheck);
212
- const {
213
- activeElement
214
- } = this.instance.rootDocument;
215
-
216
- // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
217
- // and resets the `document.activeElement` property. The blurring should happen only when the
218
- // previously selected input element has not belonged to the Handsontable editor. If blurring is
219
- // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
220
- if (activeElement && (0, _element.isOutsideInput)(activeElement)) {
221
- activeElement.blur();
222
- }
223
156
  if (!this.isCellEditable()) {
224
157
  this.clearActiveEditor();
225
158
  return;
@@ -263,14 +196,7 @@ class EditorManager {
263
196
  return;
264
197
  }
265
198
  if (!this.activeEditor) {
266
- const {
267
- row,
268
- col
269
- } = this.instance.getSelectedRangeLast().highlight;
270
- const renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
271
- const renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
272
- this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
273
- this.instance.view.render();
199
+ this.instance.scrollToFocusedCell();
274
200
  this.prepareEditor();
275
201
  }
276
202
  if (this.activeEditor) {
@@ -334,11 +260,15 @@ class EditorManager {
334
260
  * @returns {boolean}
335
261
  */
336
262
  isCellEditable() {
263
+ const selection = this.instance.getSelectedRangeLast();
264
+ if (!selection) {
265
+ return false;
266
+ }
337
267
  const editorClass = this.instance.getCellEditor(this.cellProperties);
338
268
  const {
339
269
  row,
340
270
  col
341
- } = this.instance.getSelectedRangeLast().highlight;
271
+ } = selection.highlight;
342
272
  const {
343
273
  rowIndexMapper,
344
274
  columnIndexMapper
@@ -374,15 +304,13 @@ class EditorManager {
374
304
  * @param {KeyboardEvent} event The keyboard event object.
375
305
  */
376
306
  onAfterDocumentKeyDown(event) {
377
- if (!this.instance.isListening()) {
307
+ const selection = this.instance.getSelectedRangeLast();
308
+ if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
378
309
  return;
379
310
  }
380
311
  const {
381
312
  keyCode
382
313
  } = event;
383
- if (!this.selection.isSelected()) {
384
- return;
385
- }
386
314
 
387
315
  // catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
388
316
  const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
package/editorManager.mjs CHANGED
@@ -1,11 +1,9 @@
1
1
  import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
2
- import { stopImmediatePropagation } from "./helpers/dom/event.mjs";
3
- import { isOutsideInput } from "./helpers/dom/element.mjs";
2
+ import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
4
3
  import { getEditorInstance } from "./editors/registry.mjs";
5
4
  import EventManager from "./eventManager.mjs";
6
5
  import { isDefined } from "./helpers/mixed.mjs";
7
6
  export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
8
- export const SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
9
7
  class EditorManager {
10
8
  /**
11
9
  * @param {Core} instance The Handsontable instance.
@@ -68,9 +66,6 @@ class EditorManager {
68
66
  * @type {object}
69
67
  */
70
68
  this.cellProperties = void 0;
71
- const shortcutManager = this.instance.getShortcutManager();
72
- shortcutManager.addContext('editor');
73
- this.registerShortcuts();
74
69
  this.instance.addHook('afterDocumentKeyDown', event => this.onAfterDocumentKeyDown(event));
75
70
 
76
71
  // Open editor when text composition is started (IME editor)
@@ -82,62 +77,6 @@ class EditorManager {
82
77
  this.instance.view._wt.update('onCellDblClick', (event, coords, elem) => this.onCellDblClick(event, coords, elem));
83
78
  }
84
79
 
85
- /**
86
- * Register shortcuts responsible for handling some actions related to an editor.
87
- *
88
- * @private
89
- */
90
- registerShortcuts() {
91
- const shortcutManager = this.instance.getShortcutManager();
92
- const gridContext = shortcutManager.getContext('grid');
93
- const editorContext = shortcutManager.getContext('editor');
94
- const config = {
95
- group: SHORTCUTS_GROUP_EDITOR
96
- };
97
- editorContext.addShortcuts([{
98
- keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
99
- callback: (event, keys) => {
100
- this.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
101
- this.moveSelectionAfterEnter(keys.includes('shift'));
102
- }
103
- }, {
104
- keys: [['Escape'], ['Escape', 'Control/Meta']],
105
- callback: () => {
106
- this.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
107
- this.activeEditor.focus();
108
- }
109
- }], config);
110
- gridContext.addShortcuts([{
111
- keys: [['F2']],
112
- callback: event => {
113
- this.openEditor(null, event, true);
114
- }
115
- }, {
116
- keys: [['Backspace'], ['Delete']],
117
- callback: () => {
118
- this.instance.emptySelectedCells();
119
- this.prepareEditor();
120
- }
121
- }, {
122
- keys: [['Enter'], ['Enter', 'Shift']],
123
- callback: (event, keys) => {
124
- if (this.instance.getSettings().enterBeginsEditing) {
125
- if (this.cellProperties.readOnly) {
126
- this.moveSelectionAfterEnter();
127
- } else {
128
- this.openEditor(null, event, true);
129
- }
130
- } else {
131
- this.moveSelectionAfterEnter(keys.includes('shift'));
132
- }
133
- stopImmediatePropagation(event); // required by HandsontableEditor
134
- }
135
- }], {
136
- ...config,
137
- runOnlyIf: () => isDefined(this.instance.getSelected())
138
- });
139
- }
140
-
141
80
  /**
142
81
  * Lock the editor from being prepared and closed. Locking the editor prevents its closing and
143
82
  * reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
@@ -190,10 +129,16 @@ class EditorManager {
190
129
  });
191
130
  return;
192
131
  }
132
+ const {
133
+ highlight
134
+ } = this.instance.getSelectedRangeLast();
135
+ if (highlight.isHeader()) {
136
+ return;
137
+ }
193
138
  const {
194
139
  row,
195
140
  col
196
- } = this.instance.getSelectedRangeLast().highlight;
141
+ } = highlight;
197
142
  const modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
198
143
  let visualRowToCheck = row;
199
144
  let visualColumnToCheck = col;
@@ -203,17 +148,6 @@ class EditorManager {
203
148
 
204
149
  // Getting values using the modified coordinates.
205
150
  this.cellProperties = this.instance.getCellMeta(visualRowToCheck, visualColumnToCheck);
206
- const {
207
- activeElement
208
- } = this.instance.rootDocument;
209
-
210
- // Blurring the `activeElement` removes the unwanted border around the focusable element (#6877)
211
- // and resets the `document.activeElement` property. The blurring should happen only when the
212
- // previously selected input element has not belonged to the Handsontable editor. If blurring is
213
- // triggered for all elements, there is a problem with the disappearing IME editor (#9672).
214
- if (activeElement && isOutsideInput(activeElement)) {
215
- activeElement.blur();
216
- }
217
151
  if (!this.isCellEditable()) {
218
152
  this.clearActiveEditor();
219
153
  return;
@@ -257,14 +191,7 @@ class EditorManager {
257
191
  return;
258
192
  }
259
193
  if (!this.activeEditor) {
260
- const {
261
- row,
262
- col
263
- } = this.instance.getSelectedRangeLast().highlight;
264
- const renderableRowIndex = this.instance.rowIndexMapper.getRenderableFromVisualIndex(row);
265
- const renderableColumnIndex = this.instance.columnIndexMapper.getRenderableFromVisualIndex(col);
266
- this.instance.view.scrollViewport(this.instance._createCellCoords(renderableRowIndex, renderableColumnIndex));
267
- this.instance.view.render();
194
+ this.instance.scrollToFocusedCell();
268
195
  this.prepareEditor();
269
196
  }
270
197
  if (this.activeEditor) {
@@ -328,11 +255,15 @@ class EditorManager {
328
255
  * @returns {boolean}
329
256
  */
330
257
  isCellEditable() {
258
+ const selection = this.instance.getSelectedRangeLast();
259
+ if (!selection) {
260
+ return false;
261
+ }
331
262
  const editorClass = this.instance.getCellEditor(this.cellProperties);
332
263
  const {
333
264
  row,
334
265
  col
335
- } = this.instance.getSelectedRangeLast().highlight;
266
+ } = selection.highlight;
336
267
  const {
337
268
  rowIndexMapper,
338
269
  columnIndexMapper
@@ -368,15 +299,13 @@ class EditorManager {
368
299
  * @param {KeyboardEvent} event The keyboard event object.
369
300
  */
370
301
  onAfterDocumentKeyDown(event) {
371
- if (!this.instance.isListening()) {
302
+ const selection = this.instance.getSelectedRangeLast();
303
+ if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
372
304
  return;
373
305
  }
374
306
  const {
375
307
  keyCode
376
308
  } = event;
377
- if (!this.selection.isSelected()) {
378
- return;
379
- }
380
309
 
381
310
  // catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
382
311
  const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
@@ -10,6 +10,7 @@ var _mixed = require("../../helpers/mixed");
10
10
  var _string = require("../../helpers/string");
11
11
  var _unicode = require("../../helpers/unicode");
12
12
  var _textRenderer = require("../../renderers/textRenderer");
13
+ var _a11y = require("../../helpers/a11y");
13
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
15
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
16
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
@@ -113,7 +114,8 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
113
114
  this.rawChoices = [];
114
115
  privatePool.set(this, {
115
116
  skipOne: false,
116
- isMacOS: this.hot.rootWindow.navigator.platform.indexOf('Mac') > -1
117
+ isMacOS: this.hot.rootWindow.navigator.platform.indexOf('Mac') > -1,
118
+ idPrefix: instance.guid.slice(0, 9)
117
119
  });
118
120
  }
119
121
 
@@ -140,6 +142,27 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
140
142
  super.createElements();
141
143
  (0, _element.addClass)(this.htContainer, 'autocompleteEditor');
142
144
  (0, _element.addClass)(this.htContainer, this.hot.rootWindow.navigator.platform.indexOf('Mac') === -1 ? '' : 'htMacScroll');
145
+ if (this.hot.getSettings().ariaTags) {
146
+ (0, _element.setAttribute)(this.TEXTAREA, [(0, _a11y.A11Y_TEXT)(), (0, _a11y.A11Y_COMBOBOX)(), (0, _a11y.A11Y_HASPOPUP)('listbox'), (0, _a11y.A11Y_AUTOCOMPLETE)()]);
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Prepares editor's metadata and configuration of the internal Handsontable's instance.
152
+ *
153
+ * @param {number} row The visual row index.
154
+ * @param {number} col The visual column index.
155
+ * @param {number|string} prop The column property (passed when datasource is an array of objects).
156
+ * @param {HTMLTableCellElement} td The rendered cell element.
157
+ * @param {*} value The rendered value.
158
+ * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
159
+ */
160
+ prepare(row, col, prop, td, value, cellProperties) {
161
+ const priv = privatePool.get(this);
162
+ super.prepare(row, col, prop, td, value, cellProperties);
163
+ if (this.hot.getSettings().ariaTags) {
164
+ (0, _element.setAttribute)(this.TEXTAREA, [(0, _a11y.A11Y_EXPANDED)('false'), (0, _a11y.A11Y_CONTROLS)(`${priv.idPrefix}-listbox-${row}-${col}`)]);
165
+ }
143
166
  }
144
167
 
145
168
  /**
@@ -149,6 +172,13 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
149
172
  const priv = privatePool.get(this);
150
173
  super.open();
151
174
  const trimDropdown = this.cellProperties.trimDropdown === void 0 ? true : this.cellProperties.trimDropdown;
175
+ const rootInstanceAriaTagsEnabled = this.hot.getSettings().ariaTags;
176
+ const sourceArray = Array.isArray(this.cellProperties.source) ? this.cellProperties.source : null;
177
+ const sourceSize = sourceArray === null || sourceArray === void 0 ? void 0 : sourceArray.length;
178
+ const {
179
+ row: rowIndex,
180
+ col: colIndex
181
+ } = this;
152
182
  this.showEditableElement();
153
183
  this.focus();
154
184
  let scrollbarWidth = (0, _element.getScrollbarWidth)();
@@ -160,6 +190,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
160
190
  this.htEditor.updateSettings({
161
191
  colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : void 0,
162
192
  width: trimDropdown ? (0, _element.outerWidth)(this.TEXTAREA) + scrollbarWidth : void 0,
193
+ autoColumnSize: true,
163
194
  renderer: (instance, TD, row, col, prop, value, cellProperties) => {
164
195
  (0, _textRenderer.textRenderer)(instance, TD, row, col, prop, value, cellProperties);
165
196
  const {
@@ -178,10 +209,27 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
178
209
  cellValue = cellValue.replace(match, `<strong>${match}</strong>`);
179
210
  }
180
211
  }
212
+ if (rootInstanceAriaTagsEnabled) {
213
+ (0, _element.setAttribute)(TD, [(0, _a11y.A11Y_OPTION)(),
214
+ // Add `setsize` and `posinset` only if the source is an array.
215
+ ...(sourceArray ? [(0, _a11y.A11Y_SETSIZE)(sourceSize)] : []), ...(sourceArray ? [(0, _a11y.A11Y_POSINSET)(sourceArray.indexOf(value) + 1)] : []), ['id', `${this.htEditor.rootElement.id}_${row}-${col}`]]);
216
+ }
181
217
  TD.innerHTML = cellValue;
182
218
  },
183
- autoColumnSize: true
219
+ afterSelection: (startRow, startCol) => {
220
+ if (rootInstanceAriaTagsEnabled) {
221
+ const TD = this.htEditor.getCell(startRow, startCol, true);
222
+ (0, _element.setAttribute)(TD, [(0, _a11y.A11Y_SELECTED)()]);
223
+ (0, _element.setAttribute)(this.TEXTAREA, ...(0, _a11y.A11Y_ACTIVEDESCENDANT)(TD.id));
224
+ }
225
+ }
184
226
  });
227
+ if (rootInstanceAriaTagsEnabled) {
228
+ // Add `role=presentation` to the main table to prevent the readers from treating the option list as a table.
229
+ (0, _element.setAttribute)(this.htEditor.view._wt.wtOverlays.wtTable.TABLE, ...(0, _a11y.A11Y_PRESENTATION)());
230
+ (0, _element.setAttribute)(this.htEditor.rootElement, [(0, _a11y.A11Y_LISTBOX)(), (0, _a11y.A11Y_LIVE)('polite'), (0, _a11y.A11Y_RELEVANT)('text'), ['id', `${priv.idPrefix}-listbox-${rowIndex}-${colIndex}`]]);
231
+ (0, _element.setAttribute)(this.TEXTAREA, ...(0, _a11y.A11Y_EXPANDED)('true'));
232
+ }
185
233
  if (priv.skipOne) {
186
234
  priv.skipOne = false;
187
235
  }
@@ -196,6 +244,9 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
196
244
  close() {
197
245
  this.removeHooksByKey('beforeKeyDown');
198
246
  super.close();
247
+ if (this.hot.getSettings().ariaTags) {
248
+ (0, _element.setAttribute)(this.TEXTAREA, [(0, _a11y.A11Y_EXPANDED)('false')]);
249
+ }
199
250
  }
200
251
 
201
252
  /**
@@ -5,11 +5,12 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
5
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
6
  import { HandsontableEditor } from "../handsontableEditor/index.mjs";
7
7
  import { arrayMap, pivot } from "../../helpers/array.mjs";
8
- import { addClass, getCaretPosition, getScrollbarWidth, getSelectionEndPosition, getTrimmingContainer, offset, outerHeight, outerWidth, setCaretPosition } from "../../helpers/dom/element.mjs";
8
+ import { addClass, getCaretPosition, getScrollbarWidth, getSelectionEndPosition, getTrimmingContainer, offset, outerHeight, outerWidth, setAttribute, setCaretPosition } from "../../helpers/dom/element.mjs";
9
9
  import { isDefined, stringify } from "../../helpers/mixed.mjs";
10
10
  import { stripTags } from "../../helpers/string.mjs";
11
11
  import { KEY_CODES, isPrintableChar } from "../../helpers/unicode.mjs";
12
12
  import { textRenderer } from "../../renderers/textRenderer/index.mjs";
13
+ import { A11Y_ACTIVEDESCENDANT, A11Y_AUTOCOMPLETE, A11Y_COMBOBOX, A11Y_CONTROLS, A11Y_EXPANDED, A11Y_HASPOPUP, A11Y_LISTBOX, A11Y_LIVE, A11Y_OPTION, A11Y_POSINSET, A11Y_PRESENTATION, A11Y_RELEVANT, A11Y_SELECTED, A11Y_SETSIZE, A11Y_TEXT } from "../../helpers/a11y.mjs";
13
14
  const privatePool = new WeakMap();
14
15
  export const EDITOR_TYPE = 'autocomplete';
15
16
 
@@ -109,7 +110,8 @@ export class AutocompleteEditor extends HandsontableEditor {
109
110
  this.rawChoices = [];
110
111
  privatePool.set(this, {
111
112
  skipOne: false,
112
- isMacOS: this.hot.rootWindow.navigator.platform.indexOf('Mac') > -1
113
+ isMacOS: this.hot.rootWindow.navigator.platform.indexOf('Mac') > -1,
114
+ idPrefix: instance.guid.slice(0, 9)
113
115
  });
114
116
  }
115
117
 
@@ -136,6 +138,27 @@ export class AutocompleteEditor extends HandsontableEditor {
136
138
  super.createElements();
137
139
  addClass(this.htContainer, 'autocompleteEditor');
138
140
  addClass(this.htContainer, this.hot.rootWindow.navigator.platform.indexOf('Mac') === -1 ? '' : 'htMacScroll');
141
+ if (this.hot.getSettings().ariaTags) {
142
+ setAttribute(this.TEXTAREA, [A11Y_TEXT(), A11Y_COMBOBOX(), A11Y_HASPOPUP('listbox'), A11Y_AUTOCOMPLETE()]);
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Prepares editor's metadata and configuration of the internal Handsontable's instance.
148
+ *
149
+ * @param {number} row The visual row index.
150
+ * @param {number} col The visual column index.
151
+ * @param {number|string} prop The column property (passed when datasource is an array of objects).
152
+ * @param {HTMLTableCellElement} td The rendered cell element.
153
+ * @param {*} value The rendered value.
154
+ * @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
155
+ */
156
+ prepare(row, col, prop, td, value, cellProperties) {
157
+ const priv = privatePool.get(this);
158
+ super.prepare(row, col, prop, td, value, cellProperties);
159
+ if (this.hot.getSettings().ariaTags) {
160
+ setAttribute(this.TEXTAREA, [A11Y_EXPANDED('false'), A11Y_CONTROLS(`${priv.idPrefix}-listbox-${row}-${col}`)]);
161
+ }
139
162
  }
140
163
 
141
164
  /**
@@ -145,6 +168,13 @@ export class AutocompleteEditor extends HandsontableEditor {
145
168
  const priv = privatePool.get(this);
146
169
  super.open();
147
170
  const trimDropdown = this.cellProperties.trimDropdown === void 0 ? true : this.cellProperties.trimDropdown;
171
+ const rootInstanceAriaTagsEnabled = this.hot.getSettings().ariaTags;
172
+ const sourceArray = Array.isArray(this.cellProperties.source) ? this.cellProperties.source : null;
173
+ const sourceSize = sourceArray === null || sourceArray === void 0 ? void 0 : sourceArray.length;
174
+ const {
175
+ row: rowIndex,
176
+ col: colIndex
177
+ } = this;
148
178
  this.showEditableElement();
149
179
  this.focus();
150
180
  let scrollbarWidth = getScrollbarWidth();
@@ -156,6 +186,7 @@ export class AutocompleteEditor extends HandsontableEditor {
156
186
  this.htEditor.updateSettings({
157
187
  colWidths: trimDropdown ? [outerWidth(this.TEXTAREA) - 2] : void 0,
158
188
  width: trimDropdown ? outerWidth(this.TEXTAREA) + scrollbarWidth : void 0,
189
+ autoColumnSize: true,
159
190
  renderer: (instance, TD, row, col, prop, value, cellProperties) => {
160
191
  textRenderer(instance, TD, row, col, prop, value, cellProperties);
161
192
  const {
@@ -174,10 +205,27 @@ export class AutocompleteEditor extends HandsontableEditor {
174
205
  cellValue = cellValue.replace(match, `<strong>${match}</strong>`);
175
206
  }
176
207
  }
208
+ if (rootInstanceAriaTagsEnabled) {
209
+ setAttribute(TD, [A11Y_OPTION(),
210
+ // Add `setsize` and `posinset` only if the source is an array.
211
+ ...(sourceArray ? [A11Y_SETSIZE(sourceSize)] : []), ...(sourceArray ? [A11Y_POSINSET(sourceArray.indexOf(value) + 1)] : []), ['id', `${this.htEditor.rootElement.id}_${row}-${col}`]]);
212
+ }
177
213
  TD.innerHTML = cellValue;
178
214
  },
179
- autoColumnSize: true
215
+ afterSelection: (startRow, startCol) => {
216
+ if (rootInstanceAriaTagsEnabled) {
217
+ const TD = this.htEditor.getCell(startRow, startCol, true);
218
+ setAttribute(TD, [A11Y_SELECTED()]);
219
+ setAttribute(this.TEXTAREA, ...A11Y_ACTIVEDESCENDANT(TD.id));
220
+ }
221
+ }
180
222
  });
223
+ if (rootInstanceAriaTagsEnabled) {
224
+ // Add `role=presentation` to the main table to prevent the readers from treating the option list as a table.
225
+ setAttribute(this.htEditor.view._wt.wtOverlays.wtTable.TABLE, ...A11Y_PRESENTATION());
226
+ setAttribute(this.htEditor.rootElement, [A11Y_LISTBOX(), A11Y_LIVE('polite'), A11Y_RELEVANT('text'), ['id', `${priv.idPrefix}-listbox-${rowIndex}-${colIndex}`]]);
227
+ setAttribute(this.TEXTAREA, ...A11Y_EXPANDED('true'));
228
+ }
181
229
  if (priv.skipOne) {
182
230
  priv.skipOne = false;
183
231
  }
@@ -192,6 +240,9 @@ export class AutocompleteEditor extends HandsontableEditor {
192
240
  close() {
193
241
  this.removeHooksByKey('beforeKeyDown');
194
242
  super.close();
243
+ if (this.hot.getSettings().ariaTags) {
244
+ setAttribute(this.TEXTAREA, [A11Y_EXPANDED('false')]);
245
+ }
195
246
  }
196
247
 
197
248
  /**
@@ -7,6 +7,7 @@ var _pikaday = _interopRequireDefault(require("pikaday"));
7
7
  var _textEditor = require("../textEditor");
8
8
  var _eventManager = _interopRequireDefault(require("../../eventManager"));
9
9
  var _element = require("../../helpers/dom/element");
10
+ var _a11y = require("../../helpers/a11y");
10
11
  var _object = require("../../helpers/object");
11
12
  var _unicode = require("../../helpers/unicode");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -44,7 +45,7 @@ class DateEditor extends _textEditor.TextEditor {
44
45
  throw new Error('You need to include Pikaday to your project.');
45
46
  }
46
47
  super.init();
47
- this.instance.addHook('afterDestroy', () => {
48
+ this.hot.addHook('afterDestroy', () => {
48
49
  this.parentDestroyed = true;
49
50
  this.destroyElements();
50
51
  });
@@ -69,7 +70,21 @@ class DateEditor extends _textEditor.TextEditor {
69
70
  /**
70
71
  * Prevent recognizing clicking on datepicker as clicking outside of table.
71
72
  */
72
- eventManager.addEventListener(this.datePicker, 'mousedown', event => event.stopPropagation());
73
+ eventManager.addEventListener(this.datePicker, 'mousedown', event => {
74
+ if ((0, _element.hasClass)(event.target, 'pika-day')) {
75
+ this.hideDatepicker();
76
+ }
77
+ event.stopPropagation();
78
+ });
79
+
80
+ /**
81
+ * Prevent caret movement in the TEXTAREA when navigating over the date picker.
82
+ */
83
+ eventManager.addEventListener(this.TEXTAREA, 'keydown', event => {
84
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(event.code)) {
85
+ event.preventDefault();
86
+ }
87
+ });
73
88
  }
74
89
 
75
90
  /**
@@ -110,6 +125,9 @@ class DateEditor extends _textEditor.TextEditor {
110
125
  const editorContext = shortcutManager.getContext('editor');
111
126
  super.open();
112
127
  this.showDatepicker(event);
128
+ if (this.hot.getSettings().ariaTags) {
129
+ (0, _element.setAttribute)(this.TD, [(0, _a11y.A11Y_EXPANDED)('true')]);
130
+ }
113
131
  editorContext.addShortcut({
114
132
  keys: [['Enter']],
115
133
  callback: keyboardEvent => {
@@ -132,9 +150,12 @@ class DateEditor extends _textEditor.TextEditor {
132
150
  if ((_this$$datePicker = this.$datePicker) !== null && _this$$datePicker !== void 0 && _this$$datePicker.destroy) {
133
151
  this.$datePicker.destroy();
134
152
  }
135
- this.instance._registerTimeout(() => {
136
- this.instance._refreshBorders();
153
+ this.hot._registerTimeout(() => {
154
+ this.hot._refreshBorders();
137
155
  });
156
+ if (this.TD && this.hot.getSettings().ariaTags) {
157
+ (0, _element.setAttribute)(this.TD, [(0, _a11y.A11Y_EXPANDED)('false')]);
158
+ }
138
159
  const shortcutManager = this.hot.getShortcutManager();
139
160
  const editorContext = shortcutManager.getContext('editor');
140
161
  editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
@@ -152,7 +173,6 @@ class DateEditor extends _textEditor.TextEditor {
152
173
  let ctrlDown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
153
174
  if (restoreOriginalValue) {
154
175
  // pressed ESC, restore original value
155
- // var value = this.instance.getDataAtCell(this.row, this.col);
156
176
  const value = this.originalValue;
157
177
  if (value !== void 0) {
158
178
  this.setValue(value);
@@ -169,7 +189,7 @@ class DateEditor extends _textEditor.TextEditor {
169
189
  showDatepicker(event) {
170
190
  const offset = this.TD.getBoundingClientRect();
171
191
  const dateFormat = this.cellProperties.dateFormat || this.defaultDateFormat;
172
- const isMouseDown = this.instance.view.isMouseDown();
192
+ const isMouseDown = this.hot.view.isMouseDown();
173
193
  const isMeta = event ? (0, _unicode.isFunctionKey)(event.keyCode) : false;
174
194
  let dateStr;
175
195
  this.datePicker.style.display = 'block';
@@ -248,7 +268,6 @@ class DateEditor extends _textEditor.TextEditor {
248
268
  dateStr = (0, _moment.default)(dateStr).format(this.cellProperties.dateFormat || this.defaultDateFormat);
249
269
  }
250
270
  this.setValue(dateStr);
251
- this.hideDatepicker();
252
271
  if (origOnSelect) {
253
272
  origOnSelect();
254
273
  }