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
|
@@ -5,9 +5,9 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
|
|
|
5
5
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
6
6
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
7
7
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
|
8
|
-
import { warn } from "
|
|
9
|
-
import { isHTMLElement, isOutsideInput } from "
|
|
10
|
-
import { debounce } from "
|
|
8
|
+
import { warn } from "../helpers/console.mjs";
|
|
9
|
+
import { isHTMLElement, isOutsideInput } from "../helpers/dom/element.mjs";
|
|
10
|
+
import { debounce } from "../helpers/function.mjs";
|
|
11
11
|
/**
|
|
12
12
|
* Possible focus modes.
|
|
13
13
|
* - CELL - The browser's focus stays on the lastly selected cell element.
|
|
@@ -22,23 +22,24 @@ const FOCUS_MODES = Object.freeze({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Manages the browser's focus in the table
|
|
25
|
+
* Manages the browser's focus in the table to achieve correct behavior for screen readers and
|
|
26
|
+
* IME editors.
|
|
26
27
|
*/
|
|
27
28
|
var _hot = /*#__PURE__*/new WeakMap();
|
|
28
29
|
var _focusMode = /*#__PURE__*/new WeakMap();
|
|
29
30
|
var _refocusDelay = /*#__PURE__*/new WeakMap();
|
|
30
31
|
var _refocusElementGetter = /*#__PURE__*/new WeakMap();
|
|
31
32
|
var _debouncedSelect = /*#__PURE__*/new WeakMap();
|
|
32
|
-
var
|
|
33
|
-
|
|
33
|
+
var _hasSelectionChange = /*#__PURE__*/new WeakMap();
|
|
34
|
+
var _FocusGridManager_brand = /*#__PURE__*/new WeakSet();
|
|
35
|
+
export class FocusGridManager {
|
|
34
36
|
constructor(hotInstance) {
|
|
35
|
-
var _this = this;
|
|
36
37
|
/**
|
|
37
38
|
* Get and return the currently selected and highlighted cell/header element.
|
|
38
39
|
*
|
|
39
40
|
* @param {Function} callback Callback function to be called after the cell element is retrieved.
|
|
40
41
|
*/
|
|
41
|
-
_classPrivateMethodInitSpec(this,
|
|
42
|
+
_classPrivateMethodInitSpec(this, _FocusGridManager_brand);
|
|
42
43
|
/**
|
|
43
44
|
* The Handsontable instance.
|
|
44
45
|
*/
|
|
@@ -74,32 +75,47 @@ export class FocusManager {
|
|
|
74
75
|
* @type {Map<number, Function>}
|
|
75
76
|
*/
|
|
76
77
|
_classPrivateFieldInitSpec(this, _debouncedSelect, new Map());
|
|
77
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Flag to indicate if the selection has changed.
|
|
80
|
+
*
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
*/
|
|
83
|
+
_classPrivateFieldInitSpec(this, _hasSelectionChange, false);
|
|
78
84
|
_classPrivateFieldSet(_hot, this, hotInstance);
|
|
85
|
+
}
|
|
86
|
+
init() {
|
|
87
|
+
var _this = this;
|
|
88
|
+
const hotSettings = _classPrivateFieldGet(_hot, this).getSettings();
|
|
79
89
|
_classPrivateFieldSet(_focusMode, this, hotSettings.imeFastEdit ? FOCUS_MODES.MIXED : FOCUS_MODES.CELL);
|
|
80
90
|
_classPrivateFieldGet(_hot, this).addHook('afterUpdateSettings', function () {
|
|
81
91
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
82
92
|
args[_key] = arguments[_key];
|
|
83
93
|
}
|
|
84
|
-
return _assertClassBrand(
|
|
94
|
+
return _assertClassBrand(_FocusGridManager_brand, _this, _onUpdateSettings).call(_this, ...args);
|
|
85
95
|
});
|
|
86
96
|
_classPrivateFieldGet(_hot, this).addHook('afterSelection', function () {
|
|
87
97
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
88
98
|
args[_key2] = arguments[_key2];
|
|
89
99
|
}
|
|
90
|
-
return _assertClassBrand(
|
|
100
|
+
return _assertClassBrand(_FocusGridManager_brand, _this, _onAfterSelectionChange).call(_this, ...args);
|
|
91
101
|
});
|
|
92
102
|
_classPrivateFieldGet(_hot, this).addHook('afterSelectionFocusSet', function () {
|
|
93
103
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
94
104
|
args[_key3] = arguments[_key3];
|
|
95
105
|
}
|
|
96
|
-
return _assertClassBrand(
|
|
106
|
+
return _assertClassBrand(_FocusGridManager_brand, _this, _onAfterSelectionChange).call(_this, ...args);
|
|
97
107
|
});
|
|
98
108
|
_classPrivateFieldGet(_hot, this).addHook('afterSelectionEnd', function () {
|
|
99
109
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
100
110
|
args[_key4] = arguments[_key4];
|
|
101
111
|
}
|
|
102
|
-
return _assertClassBrand(
|
|
112
|
+
return _assertClassBrand(_FocusGridManager_brand, _this, _focusEditorElement).call(_this, ...args);
|
|
113
|
+
});
|
|
114
|
+
_classPrivateFieldGet(_hot, this).addHook('afterRender', function () {
|
|
115
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
116
|
+
args[_key5] = arguments[_key5];
|
|
117
|
+
}
|
|
118
|
+
return _assertClassBrand(_FocusGridManager_brand, _this, _onAfterRender).call(_this, ...args);
|
|
103
119
|
});
|
|
104
120
|
}
|
|
105
121
|
|
|
@@ -192,7 +208,7 @@ export class FocusManager {
|
|
|
192
208
|
if (selectedCell) {
|
|
193
209
|
focusElement(selectedCell);
|
|
194
210
|
} else {
|
|
195
|
-
_assertClassBrand(
|
|
211
|
+
_assertClassBrand(_FocusGridManager_brand, this, _getSelectedCell).call(this, element => focusElement(element));
|
|
196
212
|
}
|
|
197
213
|
}
|
|
198
214
|
|
|
@@ -241,7 +257,7 @@ function _getSelectedCell(callback) {
|
|
|
241
257
|
* Manage the browser's focus after each cell selection change.
|
|
242
258
|
*/
|
|
243
259
|
function _focusCell() {
|
|
244
|
-
_assertClassBrand(
|
|
260
|
+
_assertClassBrand(_FocusGridManager_brand, this, _getSelectedCell).call(this, selectedCell => {
|
|
245
261
|
const {
|
|
246
262
|
activeElement
|
|
247
263
|
} = _classPrivateFieldGet(_hot, this).rootDocument;
|
|
@@ -260,12 +276,27 @@ function _focusCell() {
|
|
|
260
276
|
* Manage the browser's focus after cell selection end.
|
|
261
277
|
*/
|
|
262
278
|
function _focusEditorElement() {
|
|
263
|
-
_assertClassBrand(
|
|
279
|
+
_assertClassBrand(_FocusGridManager_brand, this, _getSelectedCell).call(this, selectedCell => {
|
|
264
280
|
if (this.getFocusMode() === FOCUS_MODES.MIXED && (selectedCell === null || selectedCell === void 0 ? void 0 : selectedCell.nodeName) === 'TD') {
|
|
265
281
|
this.refocusToEditorTextarea();
|
|
266
282
|
}
|
|
267
283
|
});
|
|
268
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* Handle the after selection change event.
|
|
287
|
+
*/
|
|
288
|
+
function _onAfterSelectionChange() {
|
|
289
|
+
_classPrivateFieldSet(_hasSelectionChange, this, true);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Focuses the cell after the render event when the selection has changed.
|
|
293
|
+
*/
|
|
294
|
+
function _onAfterRender() {
|
|
295
|
+
if (_classPrivateFieldGet(_hasSelectionChange, this)) {
|
|
296
|
+
_classPrivateFieldSet(_hasSelectionChange, this, false);
|
|
297
|
+
_assertClassBrand(_FocusGridManager_brand, this, _focusCell).call(this);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
269
300
|
/**
|
|
270
301
|
* Update the manager configuration after calling `updateSettings`.
|
|
271
302
|
*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
4
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
createFocusScopeManager: true,
|
|
8
|
+
FocusGridManager: true
|
|
9
|
+
};
|
|
10
|
+
var _scopeManager = require("./scopeManager");
|
|
11
|
+
exports.createFocusScopeManager = _scopeManager.createFocusScopeManager;
|
|
12
|
+
var _grid = require("./grid");
|
|
13
|
+
exports.FocusGridManager = _grid.FocusGridManager;
|
|
14
|
+
var _scopes = require("./scopes");
|
|
15
|
+
Object.keys(_scopes).forEach(function (key) {
|
|
16
|
+
if (key === "default" || key === "__esModule") return;
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
+
if (key in exports && exports[key] === _scopes[key]) return;
|
|
19
|
+
exports[key] = _scopes[key];
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createFocusScopeManager } from "./scopeManager.mjs";
|
|
2
|
+
import { FocusGridManager } from "./grid.mjs";
|
|
3
|
+
export * from "./scopes/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} FocusScopeManager
|
|
6
|
+
* @property {function(): string | null} getActiveScopeId Returns the ID of the active scope.
|
|
7
|
+
* @property {function(string, HTMLElement, object): void} registerScope Registers a new focus scope.
|
|
8
|
+
* @property {function(string): void} unregisterScope Unregisters a scope by its ID.
|
|
9
|
+
* @property {function(string): void} activateScope Activates a focus scope by its ID.
|
|
10
|
+
* @property {function(string): void} deactivateScope Deactivates a scope by its ID.
|
|
11
|
+
* @property {function(): void} destroy Destroys the focus scope manager.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Creates a focus scope manager instance for a Handsontable instance.
|
|
15
|
+
*
|
|
16
|
+
* @param {Core} hotInstance The Handsontable instance.
|
|
17
|
+
* @returns {FocusScopeManager} Focus scope manager object.
|
|
18
|
+
*/
|
|
19
|
+
export { createFocusScopeManager };
|
|
20
|
+
export { FocusGridManager };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.createFocusScope = createFocusScope;
|
|
5
|
+
var _focusDetector = require("./utils/focusDetector");
|
|
6
|
+
var _constants = require("./constants");
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {object} FocusScope
|
|
9
|
+
* @property {function(): string} getType The type of the scope.
|
|
10
|
+
* @property {function(): boolean} hasContainerDetached Whether the container is detached from the root Handsontable wrapper element.
|
|
11
|
+
* @property {function(): string} getShortcutsContextName The name of the shortcuts context to switch to when the scope is activated.
|
|
12
|
+
* @property {function(): boolean} runOnlyIf Whether the scope is enabled or not depends on the custom logic.
|
|
13
|
+
* @property {function(): boolean} contains Whether the target element is within the scope.
|
|
14
|
+
* @property {function(): void} activate Activates the scope.
|
|
15
|
+
* @property {function(): void} deactivate Deactivates the scope.
|
|
16
|
+
* @property {function(): void} activateFocusCatchers Activates the focus catchers.
|
|
17
|
+
* @property {function(): void} deactivateFocusCatchers Deactivates the focus catchers.
|
|
18
|
+
* @property {function(): void} enable Enables the scope.
|
|
19
|
+
* @property {function(): void} disable Disables the scope.
|
|
20
|
+
* @property {function(): void} destroy Destroys the scope.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Creates a focus scope with its own boundaries.
|
|
24
|
+
*
|
|
25
|
+
* @param {Core} hotInstance The Handsontable instance.
|
|
26
|
+
* @param {HTMLElement} container Container element for the scope.
|
|
27
|
+
* @param {object} [options] Configuration options.
|
|
28
|
+
* @param {string} [options.shortcutsContextName='grid'] The name of the shortcuts context to switch to when
|
|
29
|
+
* the scope is activated.
|
|
30
|
+
* @param {'modal' | 'inline'} [options.type='inline'] The type of the scope:<br/>
|
|
31
|
+
* - `modal`: The scope is modal and blocks the rest of the grid from receiving focus.<br/>
|
|
32
|
+
* - `inline`: The scope is inline and allows the rest of the grid to receive focus in the order of the rendered elements in the DOM.
|
|
33
|
+
* @param {function(): boolean} [options.runOnlyIf] Whether the scope is enabled or not depends on the custom logic.
|
|
34
|
+
* @param {function(HTMLElement): boolean} [options.contains] Whether the target element is within the scope. If the option is not
|
|
35
|
+
* provided, the scope will be activated if the target element is within the container element.
|
|
36
|
+
* @param {function(): void} [options.onActivate] Callback function to be called when the scope is activated.
|
|
37
|
+
* The first argument is the source of the activation:<br/>
|
|
38
|
+
* - `unknown`: The scope is activated by an unknown source.<br/>
|
|
39
|
+
* - `click`: The scope is activated by a click event.<br/>
|
|
40
|
+
* - `tab_from_above`: The scope is activated by a tab key press.<br/>
|
|
41
|
+
* - `tab_from_below`: The scope is activated by a shift+tab key press.
|
|
42
|
+
* @param {function(): void} [options.onDeactivate] Callback function to be called when the scope is deactivated.
|
|
43
|
+
* @returns {FocusScope} Focus scope object with methods.
|
|
44
|
+
*/
|
|
45
|
+
function createFocusScope(hotInstance, container) {
|
|
46
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
47
|
+
const mergedOptions = {
|
|
48
|
+
shortcutsContextName: _constants.DEFAULT_SHORTCUTS_CONTEXT,
|
|
49
|
+
type: _constants.SCOPE_TYPES.INLINE,
|
|
50
|
+
contains: target => target === container || container.contains(target),
|
|
51
|
+
runOnlyIf: () => true,
|
|
52
|
+
...options
|
|
53
|
+
};
|
|
54
|
+
const focusCatchers = (0, _focusDetector.installFocusDetector)(hotInstance, container);
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the target element is within the scope boundaries.
|
|
58
|
+
*
|
|
59
|
+
* @param {HTMLElement} target The target element to check.
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
62
|
+
const contains = target => {
|
|
63
|
+
return mergedOptions.contains(target);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Disables the focus catchers.
|
|
68
|
+
*/
|
|
69
|
+
const deactivateFocusCatchers = () => {
|
|
70
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.deactivate();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Enables the focus catchers.
|
|
75
|
+
*/
|
|
76
|
+
const activateFocusCatchers = () => {
|
|
77
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.activate();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Activates the scope.
|
|
82
|
+
*
|
|
83
|
+
* @param {'unknown' | 'click' | 'tab_from_above' | 'tab_from_below'} activationSource The source of the activation.
|
|
84
|
+
*/
|
|
85
|
+
const activate = function () {
|
|
86
|
+
var _mergedOptions$onActi;
|
|
87
|
+
let activationSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants.FOCUS_SOURCES.UNKNOWN;
|
|
88
|
+
(_mergedOptions$onActi = mergedOptions.onActivate) === null || _mergedOptions$onActi === void 0 || _mergedOptions$onActi.call(mergedOptions, activationSource);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deactivates the scope.
|
|
93
|
+
*/
|
|
94
|
+
const deactivate = () => {
|
|
95
|
+
var _mergedOptions$onDeac;
|
|
96
|
+
(_mergedOptions$onDeac = mergedOptions.onDeactivate) === null || _mergedOptions$onDeac === void 0 || _mergedOptions$onDeac.call(mergedOptions);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Enables the scope so the scope container can be focused.
|
|
101
|
+
*/
|
|
102
|
+
const enable = () => {
|
|
103
|
+
container.removeAttribute('inert');
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Disables the scope so the scope container can't be focused.
|
|
108
|
+
*/
|
|
109
|
+
const disable = () => {
|
|
110
|
+
container.setAttribute('inert', 'true');
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Destroys the scope.
|
|
115
|
+
*/
|
|
116
|
+
const destroy = () => {
|
|
117
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.destroy();
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
getType: () => mergedOptions.type,
|
|
121
|
+
hasContainerDetached: () => !hotInstance.rootWrapperElement.contains(container),
|
|
122
|
+
getShortcutsContextName: () => mergedOptions.shortcutsContextName,
|
|
123
|
+
runOnlyIf: () => mergedOptions.runOnlyIf(),
|
|
124
|
+
contains,
|
|
125
|
+
activate,
|
|
126
|
+
deactivate,
|
|
127
|
+
activateFocusCatchers,
|
|
128
|
+
deactivateFocusCatchers,
|
|
129
|
+
enable,
|
|
130
|
+
disable,
|
|
131
|
+
destroy
|
|
132
|
+
};
|
|
133
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { installFocusDetector } from "./utils/focusDetector.mjs";
|
|
2
|
+
import { SCOPE_TYPES, FOCUS_SOURCES, DEFAULT_SHORTCUTS_CONTEXT } from "./constants.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {object} FocusScope
|
|
5
|
+
* @property {function(): string} getType The type of the scope.
|
|
6
|
+
* @property {function(): boolean} hasContainerDetached Whether the container is detached from the root Handsontable wrapper element.
|
|
7
|
+
* @property {function(): string} getShortcutsContextName The name of the shortcuts context to switch to when the scope is activated.
|
|
8
|
+
* @property {function(): boolean} runOnlyIf Whether the scope is enabled or not depends on the custom logic.
|
|
9
|
+
* @property {function(): boolean} contains Whether the target element is within the scope.
|
|
10
|
+
* @property {function(): void} activate Activates the scope.
|
|
11
|
+
* @property {function(): void} deactivate Deactivates the scope.
|
|
12
|
+
* @property {function(): void} activateFocusCatchers Activates the focus catchers.
|
|
13
|
+
* @property {function(): void} deactivateFocusCatchers Deactivates the focus catchers.
|
|
14
|
+
* @property {function(): void} enable Enables the scope.
|
|
15
|
+
* @property {function(): void} disable Disables the scope.
|
|
16
|
+
* @property {function(): void} destroy Destroys the scope.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Creates a focus scope with its own boundaries.
|
|
20
|
+
*
|
|
21
|
+
* @param {Core} hotInstance The Handsontable instance.
|
|
22
|
+
* @param {HTMLElement} container Container element for the scope.
|
|
23
|
+
* @param {object} [options] Configuration options.
|
|
24
|
+
* @param {string} [options.shortcutsContextName='grid'] The name of the shortcuts context to switch to when
|
|
25
|
+
* the scope is activated.
|
|
26
|
+
* @param {'modal' | 'inline'} [options.type='inline'] The type of the scope:<br/>
|
|
27
|
+
* - `modal`: The scope is modal and blocks the rest of the grid from receiving focus.<br/>
|
|
28
|
+
* - `inline`: The scope is inline and allows the rest of the grid to receive focus in the order of the rendered elements in the DOM.
|
|
29
|
+
* @param {function(): boolean} [options.runOnlyIf] Whether the scope is enabled or not depends on the custom logic.
|
|
30
|
+
* @param {function(HTMLElement): boolean} [options.contains] Whether the target element is within the scope. If the option is not
|
|
31
|
+
* provided, the scope will be activated if the target element is within the container element.
|
|
32
|
+
* @param {function(): void} [options.onActivate] Callback function to be called when the scope is activated.
|
|
33
|
+
* The first argument is the source of the activation:<br/>
|
|
34
|
+
* - `unknown`: The scope is activated by an unknown source.<br/>
|
|
35
|
+
* - `click`: The scope is activated by a click event.<br/>
|
|
36
|
+
* - `tab_from_above`: The scope is activated by a tab key press.<br/>
|
|
37
|
+
* - `tab_from_below`: The scope is activated by a shift+tab key press.
|
|
38
|
+
* @param {function(): void} [options.onDeactivate] Callback function to be called when the scope is deactivated.
|
|
39
|
+
* @returns {FocusScope} Focus scope object with methods.
|
|
40
|
+
*/
|
|
41
|
+
export function createFocusScope(hotInstance, container) {
|
|
42
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
43
|
+
const mergedOptions = {
|
|
44
|
+
shortcutsContextName: DEFAULT_SHORTCUTS_CONTEXT,
|
|
45
|
+
type: SCOPE_TYPES.INLINE,
|
|
46
|
+
contains: target => target === container || container.contains(target),
|
|
47
|
+
runOnlyIf: () => true,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
50
|
+
const focusCatchers = installFocusDetector(hotInstance, container);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Checks if the target element is within the scope boundaries.
|
|
54
|
+
*
|
|
55
|
+
* @param {HTMLElement} target The target element to check.
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
const contains = target => {
|
|
59
|
+
return mergedOptions.contains(target);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Disables the focus catchers.
|
|
64
|
+
*/
|
|
65
|
+
const deactivateFocusCatchers = () => {
|
|
66
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.deactivate();
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Enables the focus catchers.
|
|
71
|
+
*/
|
|
72
|
+
const activateFocusCatchers = () => {
|
|
73
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.activate();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Activates the scope.
|
|
78
|
+
*
|
|
79
|
+
* @param {'unknown' | 'click' | 'tab_from_above' | 'tab_from_below'} activationSource The source of the activation.
|
|
80
|
+
*/
|
|
81
|
+
const activate = function () {
|
|
82
|
+
var _mergedOptions$onActi;
|
|
83
|
+
let activationSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : FOCUS_SOURCES.UNKNOWN;
|
|
84
|
+
(_mergedOptions$onActi = mergedOptions.onActivate) === null || _mergedOptions$onActi === void 0 || _mergedOptions$onActi.call(mergedOptions, activationSource);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Deactivates the scope.
|
|
89
|
+
*/
|
|
90
|
+
const deactivate = () => {
|
|
91
|
+
var _mergedOptions$onDeac;
|
|
92
|
+
(_mergedOptions$onDeac = mergedOptions.onDeactivate) === null || _mergedOptions$onDeac === void 0 || _mergedOptions$onDeac.call(mergedOptions);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Enables the scope so the scope container can be focused.
|
|
97
|
+
*/
|
|
98
|
+
const enable = () => {
|
|
99
|
+
container.removeAttribute('inert');
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Disables the scope so the scope container can't be focused.
|
|
104
|
+
*/
|
|
105
|
+
const disable = () => {
|
|
106
|
+
container.setAttribute('inert', 'true');
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Destroys the scope.
|
|
111
|
+
*/
|
|
112
|
+
const destroy = () => {
|
|
113
|
+
focusCatchers === null || focusCatchers === void 0 || focusCatchers.destroy();
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
getType: () => mergedOptions.type,
|
|
117
|
+
hasContainerDetached: () => !hotInstance.rootWrapperElement.contains(container),
|
|
118
|
+
getShortcutsContextName: () => mergedOptions.shortcutsContextName,
|
|
119
|
+
runOnlyIf: () => mergedOptions.runOnlyIf(),
|
|
120
|
+
contains,
|
|
121
|
+
activate,
|
|
122
|
+
deactivate,
|
|
123
|
+
activateFocusCatchers,
|
|
124
|
+
deactivateFocusCatchers,
|
|
125
|
+
enable,
|
|
126
|
+
disable,
|
|
127
|
+
destroy
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type FocusScopeType = 'modal' | 'inline';
|
|
2
|
+
type FocusScopeActivationSource = 'unknown' | 'click' | 'tab_from_above' | 'tab_from_below';
|
|
3
|
+
|
|
4
|
+
type FocusScopeOptions = {
|
|
5
|
+
shortcutsContextName?: string;
|
|
6
|
+
type?: FocusScopeType;
|
|
7
|
+
contains?: (target: HTMLElement) => boolean;
|
|
8
|
+
runOnlyIf?: () => boolean;
|
|
9
|
+
onActivate?: (focusSource: FocusScopeActivationSource) => void;
|
|
10
|
+
onDeactivate?: () => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface FocusScopeManager {
|
|
14
|
+
getActiveScopeId(): string | null;
|
|
15
|
+
registerScope(scopeId: string, container: HTMLElement, options?: FocusScopeOptions): void;
|
|
16
|
+
unregisterScope(scopeId: string): void;
|
|
17
|
+
activateScope(scopeId: string): void;
|
|
18
|
+
deactivateScope(scopeId: string): void;
|
|
19
|
+
}
|