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.
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/selection/border/border.js +19 -3
- package/3rdparty/walkontable/src/selection/border/border.mjs +19 -3
- package/CHANGELOG.md +39 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/coordsMapper/index.js +11 -0
- package/core/coordsMapper/index.mjs +1 -0
- package/core/hooks/bucket.js +7 -1
- package/core/hooks/bucket.mjs +7 -1
- package/core/hooks/constants.js +54 -0
- package/core/hooks/constants.mjs +54 -0
- package/core/hooks/index.d.ts +6 -0
- package/core/index.js +10 -4
- package/core/index.mjs +2 -1
- package/core.d.ts +3 -2
- package/core.js +67 -26
- package/core.mjs +56 -15
- package/dataMap/metaManager/metaSchema.js +197 -20
- package/dataMap/metaManager/metaSchema.mjs +197 -20
- package/dist/handsontable.css +175 -3
- package/dist/handsontable.full.css +175 -3
- package/dist/handsontable.full.js +10864 -8426
- package/dist/handsontable.full.min.css +5 -4
- package/dist/handsontable.full.min.js +194 -193
- package/dist/handsontable.js +7126 -4827
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +43 -42
- package/dist/languages/all.js +168 -21
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.js +8 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.js +8 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.js +8 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.js +8 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.js +8 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.js +8 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fa-IR.js +8 -1
- package/dist/languages/fa-IR.min.js +1 -1
- package/dist/languages/fr-FR.js +8 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.js +8 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.js +8 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.js +8 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.js +8 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.js +8 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.js +8 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.js +8 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.js +8 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.js +8 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.js +8 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.js +8 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.js +8 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.js +8 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.js +21 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +22 -2
- package/focusManager/constants.js +25 -0
- package/focusManager/constants.mjs +22 -0
- package/focusManager/eventListener.js +107 -0
- package/focusManager/eventListener.mjs +103 -0
- package/{focusManager.d.ts → focusManager/grid.d.ts} +1 -1
- package/{focusManager.js → focusManager/grid.js} +48 -17
- package/{focusManager.mjs → focusManager/grid.mjs} +47 -16
- package/focusManager/index.d.ts +2 -0
- package/focusManager/index.js +20 -0
- package/focusManager/index.mjs +20 -0
- package/focusManager/scope.js +133 -0
- package/focusManager/scope.mjs +129 -0
- package/focusManager/scopeManager.d.ts +19 -0
- package/focusManager/scopeManager.js +268 -0
- package/focusManager/scopeManager.mjs +263 -0
- package/focusManager/scopes/grid.js +120 -0
- package/focusManager/scopes/grid.mjs +116 -0
- package/focusManager/scopes/index.js +13 -0
- package/focusManager/scopes/index.mjs +9 -0
- package/{utils → focusManager/utils}/focusDetector.js +21 -31
- package/{utils → focusManager/utils}/focusDetector.mjs +21 -31
- package/focusManager/utils/utils.js +95 -0
- package/focusManager/utils/utils.mjs +89 -0
- package/helpers/dom/element.js +1 -1
- package/helpers/dom/element.mjs +2 -2
- package/helpers/dom/event.js +1 -1
- package/helpers/dom/event.mjs +1 -1
- package/helpers/mixed.js +2 -65
- package/helpers/mixed.mjs +2 -63
- package/i18n/constants.js +10 -1
- package/i18n/constants.mjs +10 -1
- package/i18n/languages/ar-AR.js +8 -1
- package/i18n/languages/ar-AR.mjs +8 -1
- package/i18n/languages/cs-CZ.js +8 -1
- package/i18n/languages/cs-CZ.mjs +8 -1
- package/i18n/languages/de-CH.js +8 -1
- package/i18n/languages/de-CH.mjs +8 -1
- package/i18n/languages/de-DE.js +8 -1
- package/i18n/languages/de-DE.mjs +8 -1
- package/i18n/languages/en-US.js +8 -1
- package/i18n/languages/en-US.mjs +8 -1
- package/i18n/languages/es-MX.js +8 -1
- package/i18n/languages/es-MX.mjs +8 -1
- package/i18n/languages/fa-IR.js +8 -1
- package/i18n/languages/fa-IR.mjs +8 -1
- package/i18n/languages/fr-FR.js +8 -1
- package/i18n/languages/fr-FR.mjs +8 -1
- package/i18n/languages/hr-HR.js +8 -1
- package/i18n/languages/hr-HR.mjs +8 -1
- package/i18n/languages/it-IT.js +8 -1
- package/i18n/languages/it-IT.mjs +8 -1
- package/i18n/languages/ja-JP.js +8 -1
- package/i18n/languages/ja-JP.mjs +8 -1
- package/i18n/languages/ko-KR.js +8 -1
- package/i18n/languages/ko-KR.mjs +8 -1
- package/i18n/languages/lv-LV.js +8 -1
- package/i18n/languages/lv-LV.mjs +8 -1
- package/i18n/languages/nb-NO.js +8 -1
- package/i18n/languages/nb-NO.mjs +8 -1
- package/i18n/languages/nl-NL.js +8 -1
- package/i18n/languages/nl-NL.mjs +8 -1
- package/i18n/languages/pl-PL.js +8 -1
- package/i18n/languages/pl-PL.mjs +8 -1
- package/i18n/languages/pt-BR.js +8 -1
- package/i18n/languages/pt-BR.mjs +8 -1
- package/i18n/languages/ru-RU.js +8 -1
- package/i18n/languages/ru-RU.mjs +8 -1
- package/i18n/languages/sr-SP.js +8 -1
- package/i18n/languages/sr-SP.mjs +8 -1
- package/i18n/languages/zh-CN.js +8 -1
- package/i18n/languages/zh-CN.mjs +8 -1
- package/i18n/languages/zh-TW.js +8 -1
- package/i18n/languages/zh-TW.mjs +8 -1
- package/index.d.ts +9 -0
- package/languages/all.js +168 -21
- package/languages/ar-AR.js +8 -1
- package/languages/ar-AR.mjs +8 -1
- package/languages/cs-CZ.js +8 -1
- package/languages/cs-CZ.mjs +8 -1
- package/languages/de-CH.js +8 -1
- package/languages/de-CH.mjs +8 -1
- package/languages/de-DE.js +8 -1
- package/languages/de-DE.mjs +8 -1
- package/languages/en-US.js +8 -1
- package/languages/en-US.mjs +8 -1
- package/languages/es-MX.js +8 -1
- package/languages/es-MX.mjs +8 -1
- package/languages/fa-IR.js +8 -1
- package/languages/fa-IR.mjs +8 -1
- package/languages/fr-FR.js +8 -1
- package/languages/fr-FR.mjs +8 -1
- package/languages/hr-HR.js +8 -1
- package/languages/hr-HR.mjs +8 -1
- package/languages/index.js +168 -21
- package/languages/it-IT.js +8 -1
- package/languages/it-IT.mjs +8 -1
- package/languages/ja-JP.js +8 -1
- package/languages/ja-JP.mjs +8 -1
- package/languages/ko-KR.js +8 -1
- package/languages/ko-KR.mjs +8 -1
- package/languages/lv-LV.js +8 -1
- package/languages/lv-LV.mjs +8 -1
- package/languages/nb-NO.js +8 -1
- package/languages/nb-NO.mjs +8 -1
- package/languages/nl-NL.js +8 -1
- package/languages/nl-NL.mjs +8 -1
- package/languages/pl-PL.js +8 -1
- package/languages/pl-PL.mjs +8 -1
- package/languages/pt-BR.js +8 -1
- package/languages/pt-BR.mjs +8 -1
- package/languages/ru-RU.js +8 -1
- package/languages/ru-RU.mjs +8 -1
- package/languages/sr-SP.js +8 -1
- package/languages/sr-SP.mjs +8 -1
- package/languages/zh-CN.js +8 -1
- package/languages/zh-CN.mjs +8 -1
- package/languages/zh-TW.js +8 -1
- package/languages/zh-TW.mjs +8 -1
- package/package.json +25 -7
- package/plugins/autoRowSize/autoRowSize.js +8 -1
- package/plugins/autoRowSize/autoRowSize.mjs +8 -1
- package/plugins/base/base.js +36 -10
- package/plugins/base/base.mjs +36 -10
- package/plugins/columnSummary/endpoints.js +13 -3
- package/plugins/columnSummary/endpoints.mjs +13 -3
- package/plugins/customBorders/customBorders.d.ts +1 -0
- package/plugins/customBorders/customBorders.js +32 -2
- package/plugins/customBorders/customBorders.mjs +32 -2
- package/plugins/dialog/constants.js +7 -0
- package/plugins/dialog/constants.mjs +4 -0
- package/plugins/dialog/dialog.d.ts +22 -2
- package/plugins/dialog/dialog.js +197 -81
- package/plugins/dialog/dialog.mjs +196 -81
- package/plugins/dialog/templates/base.js +60 -0
- package/plugins/dialog/templates/base.mjs +56 -0
- package/plugins/dialog/templates/confirm.js +106 -0
- package/plugins/dialog/templates/confirm.mjs +102 -0
- package/plugins/dialog/templates/index.js +6 -0
- package/plugins/dialog/templates/index.mjs +4 -0
- package/plugins/dialog/ui.js +125 -41
- package/plugins/dialog/ui.mjs +119 -35
- package/plugins/emptyDataState/emptyDataState.d.ts +24 -0
- package/plugins/emptyDataState/emptyDataState.js +526 -0
- package/plugins/emptyDataState/emptyDataState.mjs +521 -0
- package/plugins/emptyDataState/index.d.ts +1 -0
- package/plugins/emptyDataState/index.js +7 -0
- package/plugins/emptyDataState/index.mjs +1 -0
- package/plugins/emptyDataState/ui.js +282 -0
- package/plugins/emptyDataState/ui.mjs +278 -0
- package/plugins/filters/component/value.js +16 -1
- package/plugins/filters/component/value.mjs +16 -1
- package/plugins/filters/filters.d.ts +5 -1
- package/plugins/filters/filters.js +22 -1
- package/plugins/filters/filters.mjs +22 -1
- package/plugins/filters/ui/multipleSelect.js +90 -79
- package/plugins/filters/ui/multipleSelect.mjs +90 -79
- package/plugins/index.d.ts +3 -0
- package/plugins/index.js +3 -0
- package/plugins/index.mjs +3 -1
- package/plugins/mergeCells/utils.js +1 -5
- package/plugins/mergeCells/utils.mjs +1 -5
- package/plugins/pagination/pagination.js +37 -175
- package/plugins/pagination/pagination.mjs +37 -175
- package/plugins/pagination/strategies/autoPageSize.js +2 -2
- package/plugins/pagination/strategies/autoPageSize.mjs +2 -2
- package/plugins/pagination/ui.js +6 -10
- package/plugins/pagination/ui.mjs +7 -11
- package/plugins/stretchColumns/calculator.js +3 -1
- package/plugins/stretchColumns/calculator.mjs +3 -1
- package/plugins/undoRedo/undoRedo.js +16 -6
- package/plugins/undoRedo/undoRedo.mjs +16 -5
- package/renderers/checkboxRenderer/checkboxRenderer.js +12 -15
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +12 -15
- package/selection/selection.js +1 -1
- package/selection/selection.mjs +1 -1
- package/settings.d.ts +3 -0
- package/shortcutContexts/commands/index.js +2 -1
- package/shortcutContexts/commands/index.mjs +2 -1
- package/shortcutContexts/commands/tabNavigation.js +51 -0
- package/shortcutContexts/commands/tabNavigation.mjs +48 -0
- package/shortcutContexts/constants.js +16 -1
- package/shortcutContexts/constants.mjs +16 -1
- package/shortcutContexts/editor.js +2 -2
- package/shortcutContexts/editor.mjs +3 -3
- package/shortcutContexts/grid.js +19 -3
- package/shortcutContexts/grid.mjs +20 -4
- package/shortcuts/manager.d.ts +1 -0
- package/shortcuts/manager.js +17 -2
- package/shortcuts/manager.mjs +17 -2
- package/styles/handsontable.css +192 -35
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-icons-horizon.css +233 -0
- package/styles/ht-icons-horizon.min.css +30 -0
- package/styles/ht-icons-main.css +233 -0
- package/styles/ht-icons-main.min.css +30 -0
- package/styles/ht-theme-classic-no-icons.css +399 -0
- package/styles/ht-theme-classic-no-icons.min.css +30 -0
- package/styles/ht-theme-classic.css +308 -556
- package/styles/ht-theme-classic.min.css +3 -3
- package/styles/ht-theme-horizon-no-icons.css +405 -0
- package/styles/ht-theme-horizon-no-icons.min.css +30 -0
- package/styles/ht-theme-horizon.css +312 -556
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main-no-icons.css +396 -0
- package/styles/ht-theme-main-no-icons.min.css +30 -0
- package/styles/ht-theme-main.css +303 -556
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +23 -5
- package/tableView.mjs +23 -5
- package/utils/dataStructures/uniqueMap.js +10 -0
- package/utils/dataStructures/uniqueMap.mjs +10 -0
- package/utils/ghostTable.js +0 -3
- package/utils/ghostTable.mjs +0 -3
- package/utils/stylesHandler.js +19 -4
- package/utils/stylesHandler.mjs +19 -4
- package/core/focusCatcher/index.js +0 -131
- package/core/focusCatcher/index.mjs +0 -127
- package/core/focusCatcher/utils.js +0 -31
- package/core/focusCatcher/utils.mjs +0 -27
- package/plugins/pagination/focusController.js +0 -27
- package/plugins/pagination/focusController.mjs +0 -23
package/plugins/dialog/dialog.js
CHANGED
|
@@ -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
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
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
|
-
|
|
242
|
-
this.addHook('afterViewRender', () => _assertClassBrand(_Dialog_brand, 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
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
377
|
-
|
|
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
|
-
*
|
|
455
|
+
* Displays the confirm dialog with the specified content and options.
|
|
382
456
|
*
|
|
383
|
-
* @param {
|
|
384
|
-
*
|
|
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
|
|
392
|
-
(
|
|
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
|
-
}
|
|
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
|
-
*
|
|
556
|
+
* Registers the focus scope for the dialog plugin.
|
|
451
557
|
*/
|
|
452
|
-
function
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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
|
-
*
|
|
582
|
+
* Unregisters the focus scope for the dialog plugin.
|
|
467
583
|
*/
|
|
468
|
-
function
|
|
469
|
-
|
|
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
|
|
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
|
}
|