handsontable 16.1.1 → 16.2.0-next-90d1117-20251117

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 (296) hide show
  1. package/3rdparty/walkontable/src/overlays.js +1 -1
  2. package/3rdparty/walkontable/src/overlays.mjs +1 -1
  3. package/3rdparty/walkontable/src/selection/border/border.js +19 -3
  4. package/3rdparty/walkontable/src/selection/border/border.mjs +19 -3
  5. package/CHANGELOG.md +39 -0
  6. package/base.js +2 -2
  7. package/base.mjs +2 -2
  8. package/core/coordsMapper/index.js +11 -0
  9. package/core/coordsMapper/index.mjs +1 -0
  10. package/core/hooks/bucket.js +7 -1
  11. package/core/hooks/bucket.mjs +7 -1
  12. package/core/hooks/constants.js +54 -0
  13. package/core/hooks/constants.mjs +54 -0
  14. package/core/hooks/index.d.ts +6 -0
  15. package/core/index.js +10 -4
  16. package/core/index.mjs +2 -1
  17. package/core.d.ts +3 -2
  18. package/core.js +67 -26
  19. package/core.mjs +56 -15
  20. package/dataMap/metaManager/metaSchema.js +197 -20
  21. package/dataMap/metaManager/metaSchema.mjs +197 -20
  22. package/dist/handsontable.css +175 -3
  23. package/dist/handsontable.full.css +175 -3
  24. package/dist/handsontable.full.js +10864 -8426
  25. package/dist/handsontable.full.min.css +5 -4
  26. package/dist/handsontable.full.min.js +194 -193
  27. package/dist/handsontable.js +7126 -4827
  28. package/dist/handsontable.min.css +4 -4
  29. package/dist/handsontable.min.js +43 -42
  30. package/dist/languages/all.js +168 -21
  31. package/dist/languages/all.min.js +1 -1
  32. package/dist/languages/ar-AR.js +8 -1
  33. package/dist/languages/ar-AR.min.js +1 -1
  34. package/dist/languages/cs-CZ.js +8 -1
  35. package/dist/languages/cs-CZ.min.js +1 -1
  36. package/dist/languages/de-CH.js +8 -1
  37. package/dist/languages/de-CH.min.js +1 -1
  38. package/dist/languages/de-DE.js +8 -1
  39. package/dist/languages/de-DE.min.js +1 -1
  40. package/dist/languages/en-US.js +8 -1
  41. package/dist/languages/en-US.min.js +1 -1
  42. package/dist/languages/es-MX.js +8 -1
  43. package/dist/languages/es-MX.min.js +1 -1
  44. package/dist/languages/fa-IR.js +8 -1
  45. package/dist/languages/fa-IR.min.js +1 -1
  46. package/dist/languages/fr-FR.js +8 -1
  47. package/dist/languages/fr-FR.min.js +1 -1
  48. package/dist/languages/hr-HR.js +8 -1
  49. package/dist/languages/hr-HR.min.js +1 -1
  50. package/dist/languages/it-IT.js +8 -1
  51. package/dist/languages/it-IT.min.js +1 -1
  52. package/dist/languages/ja-JP.js +8 -1
  53. package/dist/languages/ja-JP.min.js +1 -1
  54. package/dist/languages/ko-KR.js +8 -1
  55. package/dist/languages/ko-KR.min.js +1 -1
  56. package/dist/languages/lv-LV.js +8 -1
  57. package/dist/languages/lv-LV.min.js +1 -1
  58. package/dist/languages/nb-NO.js +8 -1
  59. package/dist/languages/nb-NO.min.js +1 -1
  60. package/dist/languages/nl-NL.js +8 -1
  61. package/dist/languages/nl-NL.min.js +1 -1
  62. package/dist/languages/pl-PL.js +8 -1
  63. package/dist/languages/pl-PL.min.js +1 -1
  64. package/dist/languages/pt-BR.js +8 -1
  65. package/dist/languages/pt-BR.min.js +1 -1
  66. package/dist/languages/ru-RU.js +8 -1
  67. package/dist/languages/ru-RU.min.js +1 -1
  68. package/dist/languages/sr-SP.js +8 -1
  69. package/dist/languages/sr-SP.min.js +1 -1
  70. package/dist/languages/zh-CN.js +8 -1
  71. package/dist/languages/zh-CN.min.js +1 -1
  72. package/dist/languages/zh-TW.js +8 -1
  73. package/dist/languages/zh-TW.min.js +1 -1
  74. package/editors/autocompleteEditor/autocompleteEditor.js +21 -1
  75. package/editors/autocompleteEditor/autocompleteEditor.mjs +22 -2
  76. package/focusManager/constants.js +25 -0
  77. package/focusManager/constants.mjs +22 -0
  78. package/focusManager/eventListener.js +107 -0
  79. package/focusManager/eventListener.mjs +103 -0
  80. package/{focusManager.d.ts → focusManager/grid.d.ts} +1 -1
  81. package/{focusManager.js → focusManager/grid.js} +48 -17
  82. package/{focusManager.mjs → focusManager/grid.mjs} +47 -16
  83. package/focusManager/index.d.ts +2 -0
  84. package/focusManager/index.js +20 -0
  85. package/focusManager/index.mjs +20 -0
  86. package/focusManager/scope.js +133 -0
  87. package/focusManager/scope.mjs +129 -0
  88. package/focusManager/scopeManager.d.ts +19 -0
  89. package/focusManager/scopeManager.js +268 -0
  90. package/focusManager/scopeManager.mjs +263 -0
  91. package/focusManager/scopes/grid.js +120 -0
  92. package/focusManager/scopes/grid.mjs +116 -0
  93. package/focusManager/scopes/index.js +13 -0
  94. package/focusManager/scopes/index.mjs +9 -0
  95. package/{utils → focusManager/utils}/focusDetector.js +21 -31
  96. package/{utils → focusManager/utils}/focusDetector.mjs +21 -31
  97. package/focusManager/utils/utils.js +95 -0
  98. package/focusManager/utils/utils.mjs +89 -0
  99. package/helpers/dom/element.js +1 -1
  100. package/helpers/dom/element.mjs +2 -2
  101. package/helpers/dom/event.js +1 -1
  102. package/helpers/dom/event.mjs +1 -1
  103. package/helpers/mixed.js +2 -65
  104. package/helpers/mixed.mjs +2 -63
  105. package/i18n/constants.js +10 -1
  106. package/i18n/constants.mjs +10 -1
  107. package/i18n/languages/ar-AR.js +8 -1
  108. package/i18n/languages/ar-AR.mjs +8 -1
  109. package/i18n/languages/cs-CZ.js +8 -1
  110. package/i18n/languages/cs-CZ.mjs +8 -1
  111. package/i18n/languages/de-CH.js +8 -1
  112. package/i18n/languages/de-CH.mjs +8 -1
  113. package/i18n/languages/de-DE.js +8 -1
  114. package/i18n/languages/de-DE.mjs +8 -1
  115. package/i18n/languages/en-US.js +8 -1
  116. package/i18n/languages/en-US.mjs +8 -1
  117. package/i18n/languages/es-MX.js +8 -1
  118. package/i18n/languages/es-MX.mjs +8 -1
  119. package/i18n/languages/fa-IR.js +8 -1
  120. package/i18n/languages/fa-IR.mjs +8 -1
  121. package/i18n/languages/fr-FR.js +8 -1
  122. package/i18n/languages/fr-FR.mjs +8 -1
  123. package/i18n/languages/hr-HR.js +8 -1
  124. package/i18n/languages/hr-HR.mjs +8 -1
  125. package/i18n/languages/it-IT.js +8 -1
  126. package/i18n/languages/it-IT.mjs +8 -1
  127. package/i18n/languages/ja-JP.js +8 -1
  128. package/i18n/languages/ja-JP.mjs +8 -1
  129. package/i18n/languages/ko-KR.js +8 -1
  130. package/i18n/languages/ko-KR.mjs +8 -1
  131. package/i18n/languages/lv-LV.js +8 -1
  132. package/i18n/languages/lv-LV.mjs +8 -1
  133. package/i18n/languages/nb-NO.js +8 -1
  134. package/i18n/languages/nb-NO.mjs +8 -1
  135. package/i18n/languages/nl-NL.js +8 -1
  136. package/i18n/languages/nl-NL.mjs +8 -1
  137. package/i18n/languages/pl-PL.js +8 -1
  138. package/i18n/languages/pl-PL.mjs +8 -1
  139. package/i18n/languages/pt-BR.js +8 -1
  140. package/i18n/languages/pt-BR.mjs +8 -1
  141. package/i18n/languages/ru-RU.js +8 -1
  142. package/i18n/languages/ru-RU.mjs +8 -1
  143. package/i18n/languages/sr-SP.js +8 -1
  144. package/i18n/languages/sr-SP.mjs +8 -1
  145. package/i18n/languages/zh-CN.js +8 -1
  146. package/i18n/languages/zh-CN.mjs +8 -1
  147. package/i18n/languages/zh-TW.js +8 -1
  148. package/i18n/languages/zh-TW.mjs +8 -1
  149. package/index.d.ts +9 -0
  150. package/languages/all.js +168 -21
  151. package/languages/ar-AR.js +8 -1
  152. package/languages/ar-AR.mjs +8 -1
  153. package/languages/cs-CZ.js +8 -1
  154. package/languages/cs-CZ.mjs +8 -1
  155. package/languages/de-CH.js +8 -1
  156. package/languages/de-CH.mjs +8 -1
  157. package/languages/de-DE.js +8 -1
  158. package/languages/de-DE.mjs +8 -1
  159. package/languages/en-US.js +8 -1
  160. package/languages/en-US.mjs +8 -1
  161. package/languages/es-MX.js +8 -1
  162. package/languages/es-MX.mjs +8 -1
  163. package/languages/fa-IR.js +8 -1
  164. package/languages/fa-IR.mjs +8 -1
  165. package/languages/fr-FR.js +8 -1
  166. package/languages/fr-FR.mjs +8 -1
  167. package/languages/hr-HR.js +8 -1
  168. package/languages/hr-HR.mjs +8 -1
  169. package/languages/index.js +168 -21
  170. package/languages/it-IT.js +8 -1
  171. package/languages/it-IT.mjs +8 -1
  172. package/languages/ja-JP.js +8 -1
  173. package/languages/ja-JP.mjs +8 -1
  174. package/languages/ko-KR.js +8 -1
  175. package/languages/ko-KR.mjs +8 -1
  176. package/languages/lv-LV.js +8 -1
  177. package/languages/lv-LV.mjs +8 -1
  178. package/languages/nb-NO.js +8 -1
  179. package/languages/nb-NO.mjs +8 -1
  180. package/languages/nl-NL.js +8 -1
  181. package/languages/nl-NL.mjs +8 -1
  182. package/languages/pl-PL.js +8 -1
  183. package/languages/pl-PL.mjs +8 -1
  184. package/languages/pt-BR.js +8 -1
  185. package/languages/pt-BR.mjs +8 -1
  186. package/languages/ru-RU.js +8 -1
  187. package/languages/ru-RU.mjs +8 -1
  188. package/languages/sr-SP.js +8 -1
  189. package/languages/sr-SP.mjs +8 -1
  190. package/languages/zh-CN.js +8 -1
  191. package/languages/zh-CN.mjs +8 -1
  192. package/languages/zh-TW.js +8 -1
  193. package/languages/zh-TW.mjs +8 -1
  194. package/package.json +25 -7
  195. package/plugins/autoRowSize/autoRowSize.js +8 -1
  196. package/plugins/autoRowSize/autoRowSize.mjs +8 -1
  197. package/plugins/base/base.js +36 -10
  198. package/plugins/base/base.mjs +36 -10
  199. package/plugins/columnSummary/endpoints.js +13 -3
  200. package/plugins/columnSummary/endpoints.mjs +13 -3
  201. package/plugins/customBorders/customBorders.d.ts +1 -0
  202. package/plugins/customBorders/customBorders.js +32 -2
  203. package/plugins/customBorders/customBorders.mjs +32 -2
  204. package/plugins/dialog/constants.js +7 -0
  205. package/plugins/dialog/constants.mjs +4 -0
  206. package/plugins/dialog/dialog.d.ts +22 -2
  207. package/plugins/dialog/dialog.js +197 -81
  208. package/plugins/dialog/dialog.mjs +196 -81
  209. package/plugins/dialog/templates/base.js +60 -0
  210. package/plugins/dialog/templates/base.mjs +56 -0
  211. package/plugins/dialog/templates/confirm.js +106 -0
  212. package/plugins/dialog/templates/confirm.mjs +102 -0
  213. package/plugins/dialog/templates/index.js +6 -0
  214. package/plugins/dialog/templates/index.mjs +4 -0
  215. package/plugins/dialog/ui.js +125 -41
  216. package/plugins/dialog/ui.mjs +119 -35
  217. package/plugins/emptyDataState/emptyDataState.d.ts +24 -0
  218. package/plugins/emptyDataState/emptyDataState.js +526 -0
  219. package/plugins/emptyDataState/emptyDataState.mjs +521 -0
  220. package/plugins/emptyDataState/index.d.ts +1 -0
  221. package/plugins/emptyDataState/index.js +7 -0
  222. package/plugins/emptyDataState/index.mjs +1 -0
  223. package/plugins/emptyDataState/ui.js +282 -0
  224. package/plugins/emptyDataState/ui.mjs +278 -0
  225. package/plugins/filters/component/value.js +16 -1
  226. package/plugins/filters/component/value.mjs +16 -1
  227. package/plugins/filters/filters.d.ts +5 -1
  228. package/plugins/filters/filters.js +22 -1
  229. package/plugins/filters/filters.mjs +22 -1
  230. package/plugins/filters/ui/multipleSelect.js +90 -79
  231. package/plugins/filters/ui/multipleSelect.mjs +90 -79
  232. package/plugins/index.d.ts +3 -0
  233. package/plugins/index.js +3 -0
  234. package/plugins/index.mjs +3 -1
  235. package/plugins/mergeCells/utils.js +1 -5
  236. package/plugins/mergeCells/utils.mjs +1 -5
  237. package/plugins/pagination/pagination.js +37 -175
  238. package/plugins/pagination/pagination.mjs +37 -175
  239. package/plugins/pagination/strategies/autoPageSize.js +2 -2
  240. package/plugins/pagination/strategies/autoPageSize.mjs +2 -2
  241. package/plugins/pagination/ui.js +6 -10
  242. package/plugins/pagination/ui.mjs +7 -11
  243. package/plugins/stretchColumns/calculator.js +3 -1
  244. package/plugins/stretchColumns/calculator.mjs +3 -1
  245. package/plugins/undoRedo/undoRedo.js +16 -6
  246. package/plugins/undoRedo/undoRedo.mjs +16 -5
  247. package/renderers/checkboxRenderer/checkboxRenderer.js +12 -15
  248. package/renderers/checkboxRenderer/checkboxRenderer.mjs +12 -15
  249. package/selection/selection.js +1 -1
  250. package/selection/selection.mjs +1 -1
  251. package/settings.d.ts +3 -0
  252. package/shortcutContexts/commands/index.js +2 -1
  253. package/shortcutContexts/commands/index.mjs +2 -1
  254. package/shortcutContexts/commands/tabNavigation.js +51 -0
  255. package/shortcutContexts/commands/tabNavigation.mjs +48 -0
  256. package/shortcutContexts/constants.js +16 -1
  257. package/shortcutContexts/constants.mjs +16 -1
  258. package/shortcutContexts/editor.js +2 -2
  259. package/shortcutContexts/editor.mjs +3 -3
  260. package/shortcutContexts/grid.js +19 -3
  261. package/shortcutContexts/grid.mjs +20 -4
  262. package/shortcuts/manager.d.ts +1 -0
  263. package/shortcuts/manager.js +17 -2
  264. package/shortcuts/manager.mjs +17 -2
  265. package/styles/handsontable.css +192 -35
  266. package/styles/handsontable.min.css +3 -3
  267. package/styles/ht-icons-horizon.css +233 -0
  268. package/styles/ht-icons-horizon.min.css +30 -0
  269. package/styles/ht-icons-main.css +233 -0
  270. package/styles/ht-icons-main.min.css +30 -0
  271. package/styles/ht-theme-classic-no-icons.css +399 -0
  272. package/styles/ht-theme-classic-no-icons.min.css +30 -0
  273. package/styles/ht-theme-classic.css +308 -556
  274. package/styles/ht-theme-classic.min.css +3 -3
  275. package/styles/ht-theme-horizon-no-icons.css +405 -0
  276. package/styles/ht-theme-horizon-no-icons.min.css +30 -0
  277. package/styles/ht-theme-horizon.css +312 -556
  278. package/styles/ht-theme-horizon.min.css +3 -3
  279. package/styles/ht-theme-main-no-icons.css +396 -0
  280. package/styles/ht-theme-main-no-icons.min.css +30 -0
  281. package/styles/ht-theme-main.css +303 -556
  282. package/styles/ht-theme-main.min.css +3 -3
  283. package/tableView.js +23 -5
  284. package/tableView.mjs +23 -5
  285. package/utils/dataStructures/uniqueMap.js +10 -0
  286. package/utils/dataStructures/uniqueMap.mjs +10 -0
  287. package/utils/ghostTable.js +0 -3
  288. package/utils/ghostTable.mjs +0 -3
  289. package/utils/stylesHandler.js +19 -4
  290. package/utils/stylesHandler.mjs +19 -4
  291. package/core/focusCatcher/index.js +0 -131
  292. package/core/focusCatcher/index.mjs +0 -127
  293. package/core/focusCatcher/utils.js +0 -31
  294. package/core/focusCatcher/utils.mjs +0 -27
  295. package/plugins/pagination/focusController.js +0 -27
  296. package/plugins/pagination/focusController.mjs +0 -23
@@ -2,10 +2,15 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/es.array.at.js");
6
+ require("core-js/modules/es.string.at-alternative.js");
7
+ require("core-js/modules/esnext.iterator.constructor.js");
8
+ require("core-js/modules/esnext.iterator.every.js");
5
9
  var _base = require("../base");
6
10
  var _ui2 = require("./ui");
7
- var _focusDetector2 = require("../../utils/focusDetector");
8
11
  var _object = require("../../helpers/object");
12
+ var C = _interopRequireWildcard(require("../../i18n/constants"));
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
14
  function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
10
15
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
11
16
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -29,6 +34,15 @@ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
29
34
  * In order to enable the dialog mechanism, {@link Options#dialog} option must be set to `true`.
30
35
  *
31
36
  * The plugin provides several configuration options to customize the dialog behavior and appearance:
37
+ * - `template`: The template to use for the dialog (default: `null`). The error will be thrown when
38
+ * the template is provided together with the `content` option.
39
+ * - `type`: The type of the template ('confirm')
40
+ * - `title`: The title of the dialog
41
+ * - `description`: The description of the dialog (default: '')
42
+ * - `buttons`: The buttons to display in the dialog (default: [])
43
+ * - `text`: The text of the button
44
+ * - `type`: The type of the button ('primary' | 'secondary')
45
+ * - `callback`: The callback to trigger when the button is clicked
32
46
  * - `content`: The string or HTMLElement content to display in the dialog (default: '')
33
47
  * - `customClassName`: Custom class name to apply to the dialog (default: '')
34
48
  * - `background`: Dialog background variant 'solid' | 'semi-transparent' (default: 'solid')
@@ -36,14 +50,10 @@ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
36
50
  * - `animation`: Whether to enable animations (default: true)
37
51
  * - `closable`: Whether the dialog can be closed (default: false)
38
52
  * - `a11y`: Object with accessibility options (default object below)
39
- * ```js
40
- * {
41
- * role: 'dialog', // Role of the dialog 'dialog' | 'alertdialog' (default: 'dialog')
42
- * ariaLabel: 'Dialog', // Label for the dialog (default: 'Dialog')
43
- * ariaLabelledby: '', // ID of the element that labels the dialog (default: '')
44
- * ariaDescribedby: '', // ID of the element that describes the dialog (default: ''),
45
- * }
46
- * ```
53
+ * - `role`: The role of the dialog ('dialog' | 'alertdialog') (default: 'dialog')
54
+ * - `ariaLabel`: The label of the dialog (default: 'Dialog')
55
+ * - `ariaLabelledby`: The ID of the element that labels the dialog (default: '')
56
+ * - `ariaDescribedby`: The ID of the element that describes the dialog (default: ''),
47
57
  *
48
58
  * @example
49
59
  *
@@ -68,6 +78,31 @@ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
68
78
  * }
69
79
  * }
70
80
  *
81
+ * // Enable dialog plugin using prebuild templates
82
+ * dialog: {
83
+ * template: {
84
+ * type: 'confirm',
85
+ * title: 'Confirm',
86
+ * description: 'This is a confirm',
87
+ * buttons: [
88
+ * {
89
+ * text: 'Ok',
90
+ * type: 'primary',
91
+ * callback: () => {
92
+ * console.log('Ok');
93
+ * }
94
+ * },
95
+ * {
96
+ * text: 'Cancel',
97
+ * type: 'secondary',
98
+ * callback: () => {
99
+ * console.log('Cancel');
100
+ * }
101
+ * },
102
+ * ],
103
+ * },
104
+ * }
105
+ *
71
106
  * // Access to dialog plugin instance:
72
107
  * const dialogPlugin = hot.getPlugin('dialog');
73
108
  *
@@ -139,7 +174,6 @@ const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
139
174
  */
140
175
  var _ui = /*#__PURE__*/new WeakMap();
141
176
  var _isVisible = /*#__PURE__*/new WeakMap();
142
- var _focusDetector = /*#__PURE__*/new WeakMap();
143
177
  var _selectionState = /*#__PURE__*/new WeakMap();
144
178
  var _Dialog_brand = /*#__PURE__*/new WeakSet();
145
179
  class Dialog extends _base.BasePlugin {
@@ -161,12 +195,6 @@ class Dialog extends _base.BasePlugin {
161
195
  * @type {boolean}
162
196
  */
163
197
  _classPrivateFieldInitSpec(this, _isVisible, false);
164
- /**
165
- * Focus detector instance.
166
- *
167
- * @type {FocusDetector}
168
- */
169
- _classPrivateFieldInitSpec(this, _focusDetector, null);
170
198
  /**
171
199
  * Keeps the selection state that will be restored after the dialog is closed.
172
200
  *
@@ -182,6 +210,7 @@ class Dialog extends _base.BasePlugin {
182
210
  }
183
211
  static get DEFAULT_SETTINGS() {
184
212
  return {
213
+ template: null,
185
214
  content: '',
186
215
  customClassName: '',
187
216
  background: 'solid',
@@ -198,6 +227,7 @@ class Dialog extends _base.BasePlugin {
198
227
  }
199
228
  static get SETTINGS_VALIDATORS() {
200
229
  return {
230
+ template: value => (0, _object.isObject)(value) && typeof ['alert', 'confirm'].includes(value.type) && typeof value.title === 'string' && (typeof (value === null || value === void 0 ? void 0 : value.description) === 'undefined' || typeof (value === null || value === void 0 ? void 0 : value.description) === 'string') && (typeof (value === null || value === void 0 ? void 0 : value.buttons) === 'undefined' || Array.isArray(value === null || value === void 0 ? void 0 : value.buttons) && value.buttons.every(item => typeof item === 'object' && typeof item.text === 'string' && ['primary', 'secondary'].includes(item.type) && (typeof item.callback === 'undefined' || typeof item.callback === 'function'))),
201
231
  content: value => typeof value === 'string' || typeof HTMLElement !== 'undefined' && value instanceof HTMLElement || typeof DocumentFragment !== 'undefined' && value instanceof DocumentFragment,
202
232
  customClassName: value => typeof value === 'string',
203
233
  background: value => ['solid', 'semi-transparent'].includes(value),
@@ -228,20 +258,10 @@ class Dialog extends _base.BasePlugin {
228
258
  rootElement: this.hot.rootGridElement,
229
259
  isRtl: this.hot.isRtl()
230
260
  }));
231
- _classPrivateFieldGet(_ui, this).addLocalHook('clickDialogElement', () => _assertClassBrand(_Dialog_brand, this, _onDialogClick).call(this));
232
- _classPrivateFieldSet(_focusDetector, this, (0, _focusDetector2.installFocusDetector)(this.hot, _classPrivateFieldGet(_ui, this).getDialogElement(), {
233
- onFocus: from => {
234
- this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
235
- this.hot.listen();
236
- this.hot.runHooks('afterDialogFocus', `tab_${from}`);
237
- }
238
- }));
239
261
  }
240
262
  _assertClassBrand(_Dialog_brand, this, _registerShortcuts).call(this);
241
- this.addHook('modifyFocusOnTabNavigation', from => _assertClassBrand(_Dialog_brand, this, _onFocusTabNavigation).call(this, from), 1);
242
- this.addHook('afterViewRender', () => _assertClassBrand(_Dialog_brand, this, _onAfterRender).call(this));
243
- this.addHook('afterListen', () => _assertClassBrand(_Dialog_brand, this, _onAfterListen).call(this));
244
- this.addHook('afterUnlisten', () => _assertClassBrand(_Dialog_brand, this, _onAfterUnlisten).call(this));
263
+ _assertClassBrand(_Dialog_brand, this, _registerFocusScope).call(this);
264
+ this.addHook('afterViewRender', () => _assertClassBrand(_Dialog_brand, this, _onAfterViewRender).call(this));
245
265
  super.enablePlugin();
246
266
  }
247
267
 
@@ -260,8 +280,10 @@ class Dialog extends _base.BasePlugin {
260
280
  disablePlugin() {
261
281
  this.hide();
262
282
  _assertClassBrand(_Dialog_brand, this, _unregisterShortcuts).call(this);
283
+ _assertClassBrand(_Dialog_brand, this, _unregisterFocusScope).call(this);
263
284
  super.disablePlugin();
264
285
  }
286
+
265
287
  /**
266
288
  * Check if the dialog is currently visible.
267
289
  *
@@ -276,6 +298,15 @@ class Dialog extends _base.BasePlugin {
276
298
  * Displays the dialog with the specified content and options.
277
299
  *
278
300
  * @param {object} options Dialog configuration object containing content and display options.
301
+ * @param {object} options.template The template to use for the dialog (default: `null`). The error will be thrown when
302
+ * the template is provided together with the `content` option.
303
+ * @param {'confirm'} options.template.type The type of the template ('confirm').
304
+ * @param {string} options.template.title The title of the dialog.
305
+ * @param {string} options.template.description The description of the dialog. Default: ''.
306
+ * @param {object[]} options.template.buttons The buttons to display in the dialog. Default: [].
307
+ * @param {string} options.template.buttons.text The text of the button.
308
+ * @param {'primary' | 'secondary'} options.template.buttons.type The type of the button.
309
+ * @param {function(MouseEvent)} options.template.buttons.callback The callback to trigger when the button is clicked.
279
310
  * @param {string|HTMLElement|DocumentFragment} options.content The content to display in the dialog. Can be a string, HTMLElement, or DocumentFragment. Default: ''
280
311
  * @param {string} options.customClassName Custom CSS class name to apply to the dialog container. Default: ''
281
312
  * @param {'solid'|'semi-transparent'} options.background Dialog background variant. Default: 'solid'.
@@ -301,19 +332,10 @@ class Dialog extends _base.BasePlugin {
301
332
  this.update(options);
302
333
  _classPrivateFieldGet(_ui, this).showDialog(this.getSetting('animation'));
303
334
  _classPrivateFieldSet(_isVisible, this, true);
335
+ this.hot.getFocusScopeManager().activateScope(PLUGIN_KEY);
304
336
  _classPrivateFieldSet(_selectionState, this, this.hot.selection.exportSelection());
305
337
  this.hot.deselectCell();
306
338
  this.hot.runHooks('afterDialogShow');
307
- const {
308
- activeElement
309
- } = this.hot.rootDocument;
310
- if (this.hot.rootWrapperElement.contains(activeElement) || this.hot.rootPortalElement.contains(activeElement)) {
311
- this.hot.unlisten();
312
- this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
313
- this.hot.listen();
314
- _classPrivateFieldGet(_ui, this).focusDialog();
315
- this.hot.runHooks('afterDialogFocus', 'show');
316
- }
317
339
  }
318
340
 
319
341
  /**
@@ -321,14 +343,15 @@ class Dialog extends _base.BasePlugin {
321
343
  * Closes the dialog and restores the focus to the table.
322
344
  */
323
345
  hide() {
346
+ var _classPrivateFieldGet2;
324
347
  if (!this.isVisible()) {
325
348
  return;
326
349
  }
327
350
  this.hot.runHooks('beforeDialogHide');
328
351
  _classPrivateFieldGet(_ui, this).hideDialog(this.getSetting('animation'));
329
- this.hot.getShortcutManager().setActiveContextName('grid');
330
352
  _classPrivateFieldSet(_isVisible, this, false);
331
- if (_classPrivateFieldGet(_selectionState, this)) {
353
+ this.hot.getFocusScopeManager().deactivateScope(PLUGIN_KEY);
354
+ if (((_classPrivateFieldGet2 = _classPrivateFieldGet(_selectionState, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.ranges.length) > 0) {
332
355
  this.hot.selection.importSelection(_classPrivateFieldGet(_selectionState, this));
333
356
  this.hot.view.render();
334
357
  _classPrivateFieldSet(_selectionState, this, null);
@@ -342,6 +365,15 @@ class Dialog extends _base.BasePlugin {
342
365
  * Update the dialog configuration.
343
366
  *
344
367
  * @param {object} options Dialog configuration object containing content and display options.
368
+ * @param {object} options.template The template to use for the dialog (default: `null`). The error will be thrown when
369
+ * the template is provided together with the `content` option.
370
+ * @param {'confirm'} options.template.type The type of the template ('confirm').
371
+ * @param {string} options.template.title The title of the dialog.
372
+ * @param {string} options.template.description The description of the dialog. Default: ''.
373
+ * @param {object[]} options.template.buttons The buttons to display in the dialog. Default: [].
374
+ * @param {string} options.template.buttons.text The text of the button.
375
+ * @param {'primary' | 'secondary'} options.template.buttons.type The type of the button.
376
+ * @param {function(MouseEvent)} options.template.buttons.callback The callback to trigger when the button is clicked.
345
377
  * @param {string|HTMLElement|DocumentFragment} options.content The content to display in the dialog. Can be a string, HTMLElement, or DocumentFragment. Default: ''
346
378
  * @param {string} options.customClassName Custom CSS class name to apply to the dialog container. Default: ''
347
379
  * @param {'solid'|'semi-transparent'} options.background Dialog background variant. Default: 'solid'.
@@ -359,6 +391,18 @@ class Dialog extends _base.BasePlugin {
359
391
  return;
360
392
  }
361
393
  this.updatePluginSettings(options);
394
+ const templateValue = this.getSetting('template');
395
+ if (templateValue !== Dialog.DEFAULT_SETTINGS.template && this.getSetting('content') !== Dialog.DEFAULT_SETTINGS.content) {
396
+ throw new Error('The `template` option cannot be used together with the `content` option.');
397
+ }
398
+ if (templateValue) {
399
+ _classPrivateFieldGet(_ui, this).useTemplate(templateValue.type, {
400
+ id: this.hot.guid,
401
+ ...templateValue
402
+ });
403
+ } else {
404
+ _classPrivateFieldGet(_ui, this).useDefaultTemplate();
405
+ }
362
406
  _classPrivateFieldGet(_ui, this).updateDialog({
363
407
  isVisible: this.isVisible(),
364
408
  content: this.getSetting('content'),
@@ -371,28 +415,103 @@ class Dialog extends _base.BasePlugin {
371
415
  }
372
416
 
373
417
  /**
374
- * Focus the dialog.
418
+ * Displays the alert dialog with the specified content.
419
+ *
420
+ * @param {string | { title: string, description: string }} message The message to display in the dialog.
421
+ * Can be a string or an object with `title` and `description` properties.
422
+ * @param {function(MouseEvent): void} [callback] The callback to trigger when the button is clicked.
375
423
  */
376
- focus() {
377
- _classPrivateFieldGet(_ui, this).focusDialog();
424
+ showAlert(message, callback) {
425
+ const {
426
+ title = 'Alert',
427
+ description
428
+ } = (0, _object.isObject)(message) ? message : {
429
+ title: message
430
+ };
431
+ this.show({
432
+ template: {
433
+ type: 'confirm',
434
+ title,
435
+ description,
436
+ buttons: [{
437
+ text: this.hot.getTranslatedPhrase(C.OK),
438
+ type: 'primary',
439
+ callback: function () {
440
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
441
+ args[_key] = arguments[_key];
442
+ }
443
+ return callback === null || callback === void 0 ? void 0 : callback(...args);
444
+ }
445
+ }]
446
+ },
447
+ contentBackground: false,
448
+ background: 'solid',
449
+ animation: true,
450
+ closable: false
451
+ });
378
452
  }
379
453
 
380
454
  /**
381
- * Handle focus tab navigation event.
455
+ * Displays the confirm dialog with the specified content and options.
382
456
  *
383
- * @param {'from_above' | 'from_below'} from The direction from which the focus was modified.
384
- * @returns {boolean} Returns `false` to prevent the default focus behavior.
457
+ * @param {string | { title: string, description: string }} message The message to display in the dialog.
458
+ * Can be a string or an object with `title` and `description` properties.
459
+ * @param {function(MouseEvent): void} [onOk] The callback to trigger when the OK button is clicked.
460
+ * @param {function(MouseEvent): void} [onCancel] The callback to trigger when the Cancel button is clicked.
385
461
  */
462
+ showConfirm(message, onOk, onCancel) {
463
+ const {
464
+ title = 'Confirm',
465
+ description
466
+ } = (0, _object.isObject)(message) ? message : {
467
+ title: message
468
+ };
469
+ this.show({
470
+ template: {
471
+ type: 'confirm',
472
+ title,
473
+ description,
474
+ buttons: [{
475
+ text: this.hot.getTranslatedPhrase(C.CANCEL),
476
+ type: 'secondary',
477
+ callback: function () {
478
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
479
+ args[_key2] = arguments[_key2];
480
+ }
481
+ return onCancel === null || onCancel === void 0 ? void 0 : onCancel(...args);
482
+ }
483
+ }, {
484
+ text: this.hot.getTranslatedPhrase(C.OK),
485
+ type: 'primary',
486
+ callback: function () {
487
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
488
+ args[_key3] = arguments[_key3];
489
+ }
490
+ return onOk === null || onOk === void 0 ? void 0 : onOk(...args);
491
+ }
492
+ }]
493
+ },
494
+ contentBackground: true,
495
+ background: 'semi-transparent',
496
+ animation: true,
497
+ closable: false
498
+ });
499
+ }
386
500
 
501
+ /**
502
+ * Focus the dialog.
503
+ */
504
+ focus() {
505
+ _classPrivateFieldGet(_ui, this).focusDialog();
506
+ }
387
507
  /**
388
508
  * Destroy dialog and reset plugin state.
389
509
  */
390
510
  destroy() {
391
- var _classPrivateFieldGet2;
392
- (_classPrivateFieldGet2 = _classPrivateFieldGet(_ui, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.destroyDialog();
511
+ var _classPrivateFieldGet3;
512
+ (_classPrivateFieldGet3 = _classPrivateFieldGet(_ui, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroyDialog();
393
513
  _classPrivateFieldSet(_ui, this, null);
394
514
  _classPrivateFieldSet(_isVisible, this, false);
395
- _classPrivateFieldSet(_focusDetector, this, null);
396
515
  _classPrivateFieldSet(_selectionState, this, null);
397
516
  super.destroy();
398
517
  }
@@ -415,19 +534,12 @@ function _registerShortcuts() {
415
534
  preventDefault: false,
416
535
  callback: event => {
417
536
  this.hot._registerTimeout(() => {
418
- const {
419
- activeElement
420
- } = this.hot.rootDocument;
421
- if (!_classPrivateFieldGet(_ui, this).isInsideDialog(activeElement)) {
422
- this.hot.unlisten();
423
- return;
424
- }
425
537
  if (event.shiftKey) {
426
538
  this.hot.runHooks('dialogFocusPreviousElement');
427
539
  } else {
428
540
  this.hot.runHooks('dialogFocusNextElement');
429
541
  }
430
- }, 0);
542
+ });
431
543
  },
432
544
  group: SHORTCUTS_GROUP
433
545
  });
@@ -440,39 +552,43 @@ function _unregisterShortcuts() {
440
552
  const pluginContext = shortcutManager.getContext(SHORTCUTS_CONTEXT_NAME);
441
553
  pluginContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
442
554
  }
443
- function _onFocusTabNavigation(from) {
444
- if (this.isVisible()) {
445
- _classPrivateFieldGet(_focusDetector, this).focus(from);
446
- return false;
447
- }
448
- }
449
555
  /**
450
- * Handle dialog click event.
556
+ * Registers the focus scope for the dialog plugin.
451
557
  */
452
- function _onDialogClick() {
453
- if (this.isVisible() && !this.hot.isListening()) {
454
- this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
455
- this.hot.runHooks('afterDialogFocus', 'click');
456
- }
457
- this.hot.listen();
458
- }
459
- /**
460
- * Called after the table is listened.
461
- */
462
- function _onAfterListen() {
463
- _classPrivateFieldGet(_focusDetector, this).deactivate();
558
+ function _registerFocusScope() {
559
+ this.hot.getFocusScopeManager().registerScope(PLUGIN_KEY, _classPrivateFieldGet(_ui, this).getContainer(), {
560
+ shortcutsContextName: SHORTCUTS_CONTEXT_NAME,
561
+ type: 'modal',
562
+ runOnlyIf: () => this.isVisible(),
563
+ onActivate: focusSource => {
564
+ const isListening = this.hot.isListening();
565
+ const focusableElements = _classPrivateFieldGet(_ui, this).getFocusableElements();
566
+ if (focusableElements.length > 0) {
567
+ if (focusSource === 'tab_from_above') {
568
+ focusableElements.at(0).focus();
569
+ } else if (focusSource === 'tab_from_below') {
570
+ focusableElements.at(-1).focus();
571
+ }
572
+ } else if (focusSource !== 'tab_from_above' && focusSource !== 'tab_from_below' && isListening && !_classPrivateFieldGet(_ui, this).getContainer().contains(this.hot.rootDocument.activeElement)) {
573
+ _classPrivateFieldGet(_ui, this).getContainer().focus();
574
+ }
575
+ if (isListening) {
576
+ this.hot.runHooks('afterDialogFocus', focusSource === 'unknown' ? 'show' : focusSource);
577
+ }
578
+ }
579
+ });
464
580
  }
465
581
  /**
466
- * Called after the table is unlistened.
582
+ * Unregisters the focus scope for the dialog plugin.
467
583
  */
468
- function _onAfterUnlisten() {
469
- _classPrivateFieldGet(_focusDetector, this).activate();
584
+ function _unregisterFocusScope() {
585
+ this.hot.getFocusScopeManager().unregisterScope(PLUGIN_KEY);
470
586
  }
471
587
  /**
472
588
  * Called after the rendering of the table is completed. It updates the width and
473
589
  * height of the dialog container to the same size as the table.
474
590
  */
475
- function _onAfterRender() {
591
+ function _onAfterViewRender() {
476
592
  const {
477
593
  view,
478
594
  rootWrapperElement,
@@ -483,7 +599,7 @@ function _onAfterRender() {
483
599
  const dialogInfo = rootWrapperElement.querySelector('.hot-display-license-info');
484
600
  if (dialogInfo) {
485
601
  const height = dialogInfo.offsetHeight;
486
- const marginTop = parseFloat(rootWindow.getComputedStyle(dialogInfo).marginTop);
602
+ const marginTop = Number.parseFloat(rootWindow.getComputedStyle(dialogInfo).marginTop);
487
603
  _classPrivateFieldGet(_ui, this).updateHeight(height + marginTop);
488
604
  }
489
605
  }