handsontable 15.3.0 → 16.0.0-next-f486b48-20250702
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/core/_base.js +0 -3
- package/3rdparty/walkontable/src/core/_base.mjs +0 -3
- package/3rdparty/walkontable/src/core/clone.js +0 -1
- package/3rdparty/walkontable/src/core/clone.mjs +0 -1
- package/3rdparty/walkontable/src/core/core.js +0 -2
- package/3rdparty/walkontable/src/core/core.mjs +0 -2
- package/3rdparty/walkontable/src/facade/core.js +0 -3
- package/3rdparty/walkontable/src/facade/core.mjs +0 -3
- package/3rdparty/walkontable/src/index.js +1 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +1 -1
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +17 -11
- package/3rdparty/walkontable/src/selection/border/border.mjs +17 -11
- package/3rdparty/walkontable/src/selection/border/utils.js +1 -1
- package/3rdparty/walkontable/src/selection/border/utils.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +3 -1
- package/3rdparty/walkontable/src/settings.mjs +3 -1
- package/3rdparty/walkontable/src/table.js +9 -6
- package/3rdparty/walkontable/src/table.mjs +9 -6
- package/3rdparty/walkontable/src/types.js +0 -1
- package/3rdparty/walkontable/src/types.mjs +0 -1
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/viewport.js +1 -1
- package/3rdparty/walkontable/src/viewport.mjs +1 -1
- package/CHANGELOG.md +53 -31
- package/README.md +10 -4
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/registry.js +2 -3
- package/cellTypes/registry.mjs +1 -1
- package/core/coordsMapper/rangeToRenderableMapper.js +124 -0
- package/core/coordsMapper/rangeToRenderableMapper.mjs +120 -0
- package/core/focusCatcher/focusDetector.js +2 -2
- package/core/focusCatcher/focusDetector.mjs +2 -2
- package/core/hooks/constants.js +259 -1
- package/core/hooks/constants.mjs +259 -1
- package/core.d.ts +2 -0
- package/core.js +202 -58
- package/core.mjs +202 -58
- package/dataMap/dataMap.js +16 -30
- package/dataMap/dataMap.mjs +16 -30
- package/dataMap/metaManager/metaSchema.js +58 -0
- package/dataMap/metaManager/metaSchema.mjs +58 -0
- package/dist/handsontable.css +30 -4
- package/dist/handsontable.full.css +30 -4
- package/dist/handsontable.full.js +6073 -4352
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +206 -206
- package/dist/handsontable.js +5751 -4037
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +41 -41
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fa-IR.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +5 -1
- package/editorManager.mjs +5 -1
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +0 -12
- package/editors/autocompleteEditor/autocompleteEditor.js +42 -69
- package/editors/autocompleteEditor/autocompleteEditor.mjs +43 -70
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +2 -8
- package/editors/dateEditor/dateEditor.mjs +3 -9
- package/editors/handsontableEditor/handsontableEditor.d.ts +8 -0
- package/editors/handsontableEditor/handsontableEditor.js +173 -17
- package/editors/handsontableEditor/handsontableEditor.mjs +173 -17
- package/editors/passwordEditor/passwordEditor.js +2 -0
- package/editors/passwordEditor/passwordEditor.mjs +2 -0
- package/editors/registry.js +2 -3
- package/editors/registry.mjs +1 -1
- package/editors/textEditor/textEditor.js +2 -0
- package/editors/textEditor/textEditor.mjs +2 -0
- package/helpers/a11y.js +2 -0
- package/helpers/a11y.mjs +1 -0
- package/helpers/dom/element.d.ts +1 -0
- package/helpers/dom/element.js +26 -1
- package/helpers/dom/element.mjs +25 -1
- package/helpers/mixed.js +4 -4
- package/helpers/mixed.mjs +4 -4
- package/i18n/languages/ar-AR.js +1 -2
- package/i18n/languages/cs-CZ.js +1 -2
- package/i18n/languages/de-CH.js +1 -2
- package/i18n/languages/de-DE.js +1 -2
- package/i18n/languages/en-US.js +1 -2
- package/i18n/languages/es-MX.js +1 -2
- package/i18n/languages/fa-IR.js +1 -2
- package/i18n/languages/fr-FR.js +1 -2
- package/i18n/languages/hr-HR.js +1 -2
- package/i18n/languages/it-IT.js +1 -2
- package/i18n/languages/ja-JP.js +1 -2
- package/i18n/languages/ko-KR.js +1 -2
- package/i18n/languages/lv-LV.js +1 -2
- package/i18n/languages/nb-NO.js +1 -2
- package/i18n/languages/nl-NL.js +1 -2
- package/i18n/languages/pl-PL.js +1 -2
- package/i18n/languages/pt-BR.js +1 -2
- package/i18n/languages/ru-RU.js +1 -2
- package/i18n/languages/sr-SP.js +1 -2
- package/i18n/languages/zh-CN.js +1 -2
- package/i18n/languages/zh-TW.js +1 -2
- package/i18n/phraseFormatters/index.js +2 -2
- package/i18n/phraseFormatters/index.mjs +1 -1
- package/i18n/registry.js +3 -4
- package/i18n/registry.mjs +1 -1
- package/index.js +1 -2
- package/package.json +10 -4
- package/plugins/autoColumnSize/autoColumnSize.js +47 -0
- package/plugins/autoColumnSize/autoColumnSize.mjs +47 -0
- package/plugins/autoRowSize/autoRowSize.js +45 -0
- package/plugins/autoRowSize/autoRowSize.mjs +45 -0
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +13 -0
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +13 -0
- package/plugins/collapsibleColumns/collapsibleColumns.js +31 -0
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +31 -0
- package/plugins/columnSorting/sortService/registry.js +3 -4
- package/plugins/columnSorting/sortService/registry.mjs +1 -1
- package/plugins/columnSummary/columnSummary.js +33 -0
- package/plugins/columnSummary/columnSummary.mjs +33 -0
- package/plugins/comments/commentEditor.js +8 -2
- package/plugins/comments/commentEditor.mjs +8 -2
- package/plugins/comments/comments.js +59 -15
- package/plugins/comments/comments.mjs +60 -16
- package/plugins/comments/contextMenuItem/addEditComment.js +1 -2
- package/plugins/comments/contextMenuItem/readOnlyComment.js +1 -2
- package/plugins/comments/contextMenuItem/removeComment.js +1 -2
- package/plugins/contextMenu/contextMenu.js +1 -1
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/plugins/contextMenu/menu/menu.js +12 -6
- package/plugins/contextMenu/menu/menu.mjs +13 -7
- package/plugins/contextMenu/predefinedItems/alignment.js +1 -2
- package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -2
- package/plugins/contextMenu/predefinedItems/columnLeft.js +1 -2
- package/plugins/contextMenu/predefinedItems/columnRight.js +1 -2
- package/plugins/contextMenu/predefinedItems/index.js +1 -2
- package/plugins/contextMenu/predefinedItems/readOnly.js +1 -2
- package/plugins/contextMenu/predefinedItems/redo.js +1 -2
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -2
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -2
- package/plugins/contextMenu/predefinedItems/rowAbove.js +1 -2
- package/plugins/contextMenu/predefinedItems/rowBelow.js +1 -2
- package/plugins/contextMenu/predefinedItems/undo.js +1 -2
- package/plugins/copyPaste/contextMenuItem/cut.js +1 -2
- package/plugins/customBorders/contextMenuItem/bottom.js +1 -2
- package/plugins/customBorders/contextMenuItem/left.js +1 -2
- package/plugins/customBorders/contextMenuItem/noBorders.js +1 -2
- package/plugins/customBorders/contextMenuItem/right.js +1 -2
- package/plugins/customBorders/contextMenuItem/top.js +1 -2
- package/plugins/customBorders/customBorders.js +1 -2
- package/plugins/dropdownMenu/dropdownMenu.js +16 -1
- package/plugins/dropdownMenu/dropdownMenu.mjs +16 -1
- package/plugins/exportFile/exportFile.js +59 -2
- package/plugins/exportFile/exportFile.mjs +58 -0
- package/plugins/filters/component/actionBar.js +1 -2
- package/plugins/filters/component/condition.js +1 -2
- package/plugins/filters/component/value.js +1 -2
- package/plugins/filters/condition/beginsWith.js +1 -2
- package/plugins/filters/condition/between.js +1 -2
- package/plugins/filters/condition/contains.js +1 -2
- package/plugins/filters/condition/date/after.js +1 -2
- package/plugins/filters/condition/date/before.js +1 -2
- package/plugins/filters/condition/date/today.js +1 -2
- package/plugins/filters/condition/date/tomorrow.js +1 -2
- package/plugins/filters/condition/date/yesterday.js +1 -2
- package/plugins/filters/condition/empty.js +1 -2
- package/plugins/filters/condition/endsWith.js +1 -2
- package/plugins/filters/condition/equal.js +1 -2
- package/plugins/filters/condition/greaterThan.js +1 -2
- package/plugins/filters/condition/greaterThanOrEqual.js +1 -2
- package/plugins/filters/condition/lessThan.js +1 -2
- package/plugins/filters/condition/lessThanOrEqual.js +1 -2
- package/plugins/filters/condition/none.js +1 -2
- package/plugins/filters/condition/notBetween.js +1 -2
- package/plugins/filters/condition/notContains.js +1 -2
- package/plugins/filters/condition/notEmpty.js +1 -2
- package/plugins/filters/condition/notEqual.js +1 -2
- package/plugins/filters/filters.js +76 -3
- package/plugins/filters/filters.mjs +75 -1
- package/plugins/filters/logicalOperations/conjunction.js +1 -2
- package/plugins/filters/logicalOperations/disjunction.js +1 -2
- package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +1 -2
- package/plugins/filters/ui/_base.js +1 -2
- package/plugins/filters/ui/multipleSelect.js +1 -7
- package/plugins/filters/ui/multipleSelect.mjs +0 -5
- package/plugins/filters/ui/select.js +1 -2
- package/plugins/formulas/engine/register.js +3 -4
- package/plugins/formulas/engine/register.mjs +1 -1
- package/plugins/formulas/formulas.js +40 -41
- package/plugins/formulas/formulas.mjs +39 -40
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -2
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -2
- package/plugins/hiddenColumns/hiddenColumns.js +64 -0
- package/plugins/hiddenColumns/hiddenColumns.mjs +64 -0
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -2
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -2
- package/plugins/hiddenRows/hiddenRows.js +64 -0
- package/plugins/hiddenRows/hiddenRows.mjs +64 -0
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -2
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -2
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +1 -1
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -2
- package/plugins/mergeCells/mergeCells.js +56 -38
- package/plugins/mergeCells/mergeCells.mjs +56 -38
- package/plugins/mergeCells/utils.js +3 -4
- package/plugins/mergeCells/utils.mjs +3 -4
- package/plugins/nestedHeaders/nestedHeaders.js +37 -12
- package/plugins/nestedHeaders/nestedHeaders.mjs +37 -12
- package/plugins/nestedRows/nestedRows.js +12 -12
- package/plugins/nestedRows/nestedRows.mjs +12 -12
- package/plugins/nestedRows/ui/contextMenu.js +1 -2
- package/plugins/nestedRows/ui/headers.js +2 -3
- package/plugins/nestedRows/ui/headers.mjs +2 -3
- package/plugins/persistentState/persistentState.js +1 -1
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/stretchColumns/calculator.js +3 -2
- package/plugins/stretchColumns/calculator.mjs +3 -2
- package/plugins/stretchColumns/stretchColumns.js +13 -0
- package/plugins/stretchColumns/stretchColumns.mjs +13 -0
- package/plugins/trimRows/trimRows.js +61 -0
- package/plugins/trimRows/trimRows.mjs +61 -0
- package/renderers/baseRenderer/baseRenderer.js +4 -0
- package/renderers/baseRenderer/baseRenderer.mjs +4 -0
- package/renderers/registry.js +2 -3
- package/renderers/registry.mjs +1 -1
- package/selection/mouseEventHandler.js +48 -13
- package/selection/mouseEventHandler.mjs +47 -13
- package/selection/range.js +73 -6
- package/selection/range.mjs +73 -6
- package/selection/selection.js +46 -32
- package/selection/selection.mjs +45 -30
- package/settings.d.ts +1 -0
- package/styles/handsontable.css +131 -55
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +296 -181
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main.css +314 -205
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +9 -20
- package/tableView.mjs +9 -20
- package/translations/indexMapper.js +9 -5
- package/translations/indexMapper.mjs +9 -5
- package/utils/paginator.js +13 -0
- package/utils/paginator.mjs +13 -0
- package/utils/staticRegister.js +24 -2
- package/utils/staticRegister.mjs +23 -2
- package/{3rdparty/walkontable/src/utils → utils}/stylesHandler.js +16 -30
- package/{3rdparty/walkontable/src/utils → utils}/stylesHandler.mjs +16 -30
- package/validators/registry.js +2 -3
- package/validators/registry.mjs +1 -1
@@ -1,11 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
4
5
|
var _textEditor = require("../textEditor");
|
5
6
|
var _element = require("../../helpers/dom/element");
|
6
7
|
var _event = require("../../helpers/dom/event");
|
7
8
|
var _object = require("../../helpers/object");
|
8
9
|
var _shortcutContexts = require("../../shortcutContexts");
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
9
13
|
const SHORTCUTS_GROUP = 'handsontableEditor';
|
10
14
|
const EDITOR_TYPE = exports.EDITOR_TYPE = 'handsontable';
|
11
15
|
|
@@ -14,10 +18,26 @@ const EDITOR_TYPE = exports.EDITOR_TYPE = 'handsontable';
|
|
14
18
|
* @class HandsontableEditor
|
15
19
|
*/
|
16
20
|
class HandsontableEditor extends _textEditor.TextEditor {
|
21
|
+
constructor() {
|
22
|
+
super(...arguments);
|
23
|
+
/**
|
24
|
+
* The flag determining if the editor is flipped vertically (rendered on
|
25
|
+
* the top of the edited cell) or not.
|
26
|
+
*
|
27
|
+
* @type {boolean}
|
28
|
+
*/
|
29
|
+
_defineProperty(this, "isFlippedVertically", false);
|
30
|
+
/**
|
31
|
+
* The flag determining if the editor is flipped horizontally (rendered on
|
32
|
+
* the inline start of the edited cell) or not.
|
33
|
+
*
|
34
|
+
* @type {boolean}
|
35
|
+
*/
|
36
|
+
_defineProperty(this, "isFlippedHorizontally", false);
|
37
|
+
}
|
17
38
|
static get EDITOR_TYPE() {
|
18
39
|
return EDITOR_TYPE;
|
19
40
|
}
|
20
|
-
|
21
41
|
/**
|
22
42
|
* Opens the editor and adjust its size.
|
23
43
|
*/
|
@@ -45,10 +65,12 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
45
65
|
}
|
46
66
|
(0, _element.setCaretPosition)(this.TEXTAREA, 0, this.TEXTAREA.value.length);
|
47
67
|
this.htEditor.updateSettings({
|
48
|
-
width: this.
|
49
|
-
height: this.
|
68
|
+
width: this.getTargetDropdownWidth(),
|
69
|
+
height: this.getTargetDropdownHeight()
|
50
70
|
});
|
51
71
|
this.refreshDimensions();
|
72
|
+
this.flipDropdownVerticallyIfNeeded();
|
73
|
+
this.flipDropdownHorizontallyIfNeeded();
|
52
74
|
}
|
53
75
|
|
54
76
|
/**
|
@@ -157,25 +179,160 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
157
179
|
}
|
158
180
|
|
159
181
|
/**
|
160
|
-
* Calculates and
|
182
|
+
* Calculates the space above and below the editor and flips it vertically if needed.
|
161
183
|
*
|
162
184
|
* @private
|
163
|
-
* @returns {number}
|
185
|
+
* @returns {{ isFlipped: boolean, spaceAbove: number, spaceBelow: number}}
|
164
186
|
*/
|
165
|
-
|
166
|
-
|
187
|
+
flipDropdownVerticallyIfNeeded() {
|
188
|
+
const {
|
189
|
+
view
|
190
|
+
} = this.hot;
|
191
|
+
const cellRect = this.getEditedCellRect();
|
192
|
+
let spaceAbove = cellRect.top;
|
193
|
+
if (view.isVerticallyScrollableByWindow()) {
|
194
|
+
const topOffset = view.getTableOffset().top - this.hot.rootWindow.scrollY;
|
195
|
+
spaceAbove = Math.max(spaceAbove + topOffset, 0);
|
196
|
+
}
|
197
|
+
const dropdownTargetHeight = this.getDropdownHeight();
|
198
|
+
const spaceBelow = view.getWorkspaceHeight() - spaceAbove - cellRect.height;
|
199
|
+
const flipNeeded = dropdownTargetHeight > spaceBelow && spaceAbove > spaceBelow + cellRect.height;
|
200
|
+
if (flipNeeded) {
|
201
|
+
this.flipDropdownVertically();
|
202
|
+
} else {
|
203
|
+
this.unflipDropdownVertically();
|
204
|
+
}
|
205
|
+
return {
|
206
|
+
isFlipped: flipNeeded,
|
207
|
+
spaceAbove,
|
208
|
+
spaceBelow
|
209
|
+
};
|
210
|
+
}
|
211
|
+
|
212
|
+
/**
|
213
|
+
* Adjusts the editor's container to flip vertically, positioning it from
|
214
|
+
* the bottom to the top of the edited cell.
|
215
|
+
*
|
216
|
+
* @private
|
217
|
+
*/
|
218
|
+
flipDropdownVertically() {
|
219
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
220
|
+
dropdownStyle.position = 'absolute';
|
221
|
+
dropdownStyle.top = `${-this.getDropdownHeight()}px`;
|
222
|
+
this.isFlippedVertically = true;
|
223
|
+
}
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Adjusts the editor's container to unflip vertically, positioning it from
|
227
|
+
* the top to the bottom of the edited cell.
|
228
|
+
*
|
229
|
+
* @private
|
230
|
+
*/
|
231
|
+
unflipDropdownVertically() {
|
232
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
233
|
+
dropdownStyle.position = 'absolute';
|
234
|
+
dropdownStyle.top = '';
|
235
|
+
this.isFlippedVertically = false;
|
236
|
+
}
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Calculates the space above and below the editor and flips it vertically if needed.
|
240
|
+
*
|
241
|
+
* @private
|
242
|
+
* @returns {{ isFlipped: boolean, spaceInlineStart: number, spaceInlineEnd: number}}
|
243
|
+
*/
|
244
|
+
flipDropdownHorizontallyIfNeeded() {
|
245
|
+
const {
|
246
|
+
view
|
247
|
+
} = this.hot;
|
248
|
+
const cellRect = this.getEditedCellRect();
|
249
|
+
let spaceInlineStart = cellRect.start + cellRect.width;
|
250
|
+
if (view.isHorizontallyScrollableByWindow()) {
|
251
|
+
const inlineStartOffset = view.getTableOffset().left - this.hot.rootWindow.scrollX;
|
252
|
+
spaceInlineStart = Math.max(spaceInlineStart + inlineStartOffset, 0);
|
253
|
+
}
|
254
|
+
const dropdownTargetWidth = this.getDropdownWidth();
|
255
|
+
const spaceInlineEnd = view.getWorkspaceWidth() - spaceInlineStart + cellRect.width;
|
256
|
+
const flipNeeded = dropdownTargetWidth > spaceInlineEnd && spaceInlineStart > spaceInlineEnd;
|
257
|
+
if (flipNeeded) {
|
258
|
+
this.flipDropdownHorizontally();
|
259
|
+
} else {
|
260
|
+
this.unflipDropdownHorizontally();
|
261
|
+
}
|
262
|
+
return {
|
263
|
+
isFlipped: flipNeeded,
|
264
|
+
spaceInlineStart,
|
265
|
+
spaceInlineEnd
|
266
|
+
};
|
167
267
|
}
|
168
268
|
|
169
269
|
/**
|
170
|
-
*
|
270
|
+
* Adjusts the editor's container to flip horizontally, positioning it from
|
271
|
+
* the inline end (right) to the inline start (left) of the edited cell.
|
171
272
|
*
|
172
273
|
* @private
|
274
|
+
*/
|
275
|
+
flipDropdownHorizontally() {
|
276
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
277
|
+
const {
|
278
|
+
width
|
279
|
+
} = this.getEditedCellRect();
|
280
|
+
dropdownStyle.position = 'absolute';
|
281
|
+
dropdownStyle[this.hot.isRtl() ? 'right' : 'left'] = `${-(this.getDropdownWidth() - width)}px`;
|
282
|
+
this.isFlippedHorizontally = true;
|
283
|
+
}
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Adjusts the editor's container to unflip horizontally, positioning it from
|
287
|
+
* the inline start (left) to the inline end (right) of the edited cell.
|
288
|
+
*
|
289
|
+
* @private
|
290
|
+
*/
|
291
|
+
unflipDropdownHorizontally() {
|
292
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
293
|
+
dropdownStyle.position = 'absolute';
|
294
|
+
dropdownStyle[this.hot.isRtl() ? 'right' : 'left'] = '';
|
295
|
+
this.isFlippedHorizontally = false;
|
296
|
+
}
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Return the DOM height of the editor's container.
|
300
|
+
*
|
301
|
+
* @returns {number}
|
302
|
+
*/
|
303
|
+
getDropdownHeight() {
|
304
|
+
return this.htEditor.getTableHeight();
|
305
|
+
}
|
306
|
+
|
307
|
+
/**
|
308
|
+
* Return the DOM width of the editor's container.
|
309
|
+
*
|
310
|
+
* @returns {number}
|
311
|
+
*/
|
312
|
+
getDropdownWidth() {
|
313
|
+
return this.htEditor.getTableWidth();
|
314
|
+
}
|
315
|
+
|
316
|
+
/**
|
317
|
+
* Calculates the proposed/target editor width that should be set once the editor is opened.
|
318
|
+
* The method may be overwritten in the child class to provide a custom size logic.
|
319
|
+
*
|
173
320
|
* @returns {number}
|
174
321
|
*/
|
175
|
-
|
322
|
+
getTargetDropdownWidth() {
|
176
323
|
return this.htEditor.view.getTableWidth();
|
177
324
|
}
|
178
325
|
|
326
|
+
/**
|
327
|
+
* Calculates the proposed/target editor height that should be set once the editor is opened.
|
328
|
+
* The method may be overwritten in the child class to provide a custom size logic.
|
329
|
+
*
|
330
|
+
* @returns {number}
|
331
|
+
*/
|
332
|
+
getTargetDropdownHeight() {
|
333
|
+
return this.htEditor.view.getTableHeight() + 1;
|
334
|
+
}
|
335
|
+
|
179
336
|
/**
|
180
337
|
* Assigns afterDestroy callback to prevent memory leaks.
|
181
338
|
*
|
@@ -188,8 +345,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
188
345
|
});
|
189
346
|
this.hot.addHook('afterSetTheme', (themeName, firstRun) => {
|
190
347
|
if (!firstRun) {
|
191
|
-
|
192
|
-
(_this$htEditor2 = this.htEditor) === null || _this$htEditor2 === void 0 || _this$htEditor2.useTheme(themeName);
|
348
|
+
this.close();
|
193
349
|
}
|
194
350
|
});
|
195
351
|
}
|
@@ -211,7 +367,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
211
367
|
const action = (rowToSelect, event) => {
|
212
368
|
const innerHOT = this.htEditor;
|
213
369
|
if (rowToSelect !== undefined) {
|
214
|
-
if (rowToSelect < 0 ||
|
370
|
+
if (rowToSelect < 0 || this.isFlippedVertically && rowToSelect > innerHOT.countRows() - 1) {
|
215
371
|
innerHOT.deselectCell();
|
216
372
|
} else {
|
217
373
|
innerHOT.selectCell(rowToSelect, 0);
|
@@ -231,10 +387,10 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
231
387
|
const innerHOT = this.htEditor;
|
232
388
|
let rowToSelect;
|
233
389
|
let selectedRow;
|
234
|
-
if (!innerHOT.getSelectedLast() &&
|
390
|
+
if (!innerHOT.getSelectedLast() && this.isFlippedVertically) {
|
235
391
|
rowToSelect = innerHOT.countRows() - 1;
|
236
392
|
} else if (innerHOT.getSelectedLast()) {
|
237
|
-
if (
|
393
|
+
if (this.isFlippedVertically) {
|
238
394
|
selectedRow = innerHOT.getSelectedLast()[0];
|
239
395
|
rowToSelect = Math.max(0, selectedRow - 1);
|
240
396
|
} else {
|
@@ -251,12 +407,12 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
251
407
|
const innerHOT = this.htEditor;
|
252
408
|
let rowToSelect;
|
253
409
|
let selectedRow;
|
254
|
-
if (!innerHOT.getSelectedLast() && !
|
410
|
+
if (!innerHOT.getSelectedLast() && !this.isFlippedVertically) {
|
255
411
|
rowToSelect = 0;
|
256
412
|
} else if (innerHOT.getSelectedLast()) {
|
257
|
-
if (
|
413
|
+
if (this.isFlippedVertically) {
|
258
414
|
rowToSelect = innerHOT.getSelectedLast()[0] + 1;
|
259
|
-
} else if (!
|
415
|
+
} else if (!this.isFlippedVertically) {
|
260
416
|
const lastRow = innerHOT.countRows() - 1;
|
261
417
|
selectedRow = innerHOT.getSelectedLast()[0];
|
262
418
|
rowToSelect = Math.min(lastRow, selectedRow + 1);
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
1
5
|
import { TextEditor } from "../textEditor/index.mjs";
|
2
6
|
import { setCaretPosition } from "../../helpers/dom/element.mjs";
|
3
7
|
import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
|
@@ -11,10 +15,26 @@ export const EDITOR_TYPE = 'handsontable';
|
|
11
15
|
* @class HandsontableEditor
|
12
16
|
*/
|
13
17
|
export class HandsontableEditor extends TextEditor {
|
18
|
+
constructor() {
|
19
|
+
super(...arguments);
|
20
|
+
/**
|
21
|
+
* The flag determining if the editor is flipped vertically (rendered on
|
22
|
+
* the top of the edited cell) or not.
|
23
|
+
*
|
24
|
+
* @type {boolean}
|
25
|
+
*/
|
26
|
+
_defineProperty(this, "isFlippedVertically", false);
|
27
|
+
/**
|
28
|
+
* The flag determining if the editor is flipped horizontally (rendered on
|
29
|
+
* the inline start of the edited cell) or not.
|
30
|
+
*
|
31
|
+
* @type {boolean}
|
32
|
+
*/
|
33
|
+
_defineProperty(this, "isFlippedHorizontally", false);
|
34
|
+
}
|
14
35
|
static get EDITOR_TYPE() {
|
15
36
|
return EDITOR_TYPE;
|
16
37
|
}
|
17
|
-
|
18
38
|
/**
|
19
39
|
* Opens the editor and adjust its size.
|
20
40
|
*/
|
@@ -42,10 +62,12 @@ export class HandsontableEditor extends TextEditor {
|
|
42
62
|
}
|
43
63
|
setCaretPosition(this.TEXTAREA, 0, this.TEXTAREA.value.length);
|
44
64
|
this.htEditor.updateSettings({
|
45
|
-
width: this.
|
46
|
-
height: this.
|
65
|
+
width: this.getTargetDropdownWidth(),
|
66
|
+
height: this.getTargetDropdownHeight()
|
47
67
|
});
|
48
68
|
this.refreshDimensions();
|
69
|
+
this.flipDropdownVerticallyIfNeeded();
|
70
|
+
this.flipDropdownHorizontallyIfNeeded();
|
49
71
|
}
|
50
72
|
|
51
73
|
/**
|
@@ -154,25 +176,160 @@ export class HandsontableEditor extends TextEditor {
|
|
154
176
|
}
|
155
177
|
|
156
178
|
/**
|
157
|
-
* Calculates and
|
179
|
+
* Calculates the space above and below the editor and flips it vertically if needed.
|
158
180
|
*
|
159
181
|
* @private
|
160
|
-
* @returns {number}
|
182
|
+
* @returns {{ isFlipped: boolean, spaceAbove: number, spaceBelow: number}}
|
161
183
|
*/
|
162
|
-
|
163
|
-
|
184
|
+
flipDropdownVerticallyIfNeeded() {
|
185
|
+
const {
|
186
|
+
view
|
187
|
+
} = this.hot;
|
188
|
+
const cellRect = this.getEditedCellRect();
|
189
|
+
let spaceAbove = cellRect.top;
|
190
|
+
if (view.isVerticallyScrollableByWindow()) {
|
191
|
+
const topOffset = view.getTableOffset().top - this.hot.rootWindow.scrollY;
|
192
|
+
spaceAbove = Math.max(spaceAbove + topOffset, 0);
|
193
|
+
}
|
194
|
+
const dropdownTargetHeight = this.getDropdownHeight();
|
195
|
+
const spaceBelow = view.getWorkspaceHeight() - spaceAbove - cellRect.height;
|
196
|
+
const flipNeeded = dropdownTargetHeight > spaceBelow && spaceAbove > spaceBelow + cellRect.height;
|
197
|
+
if (flipNeeded) {
|
198
|
+
this.flipDropdownVertically();
|
199
|
+
} else {
|
200
|
+
this.unflipDropdownVertically();
|
201
|
+
}
|
202
|
+
return {
|
203
|
+
isFlipped: flipNeeded,
|
204
|
+
spaceAbove,
|
205
|
+
spaceBelow
|
206
|
+
};
|
207
|
+
}
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Adjusts the editor's container to flip vertically, positioning it from
|
211
|
+
* the bottom to the top of the edited cell.
|
212
|
+
*
|
213
|
+
* @private
|
214
|
+
*/
|
215
|
+
flipDropdownVertically() {
|
216
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
217
|
+
dropdownStyle.position = 'absolute';
|
218
|
+
dropdownStyle.top = `${-this.getDropdownHeight()}px`;
|
219
|
+
this.isFlippedVertically = true;
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Adjusts the editor's container to unflip vertically, positioning it from
|
224
|
+
* the top to the bottom of the edited cell.
|
225
|
+
*
|
226
|
+
* @private
|
227
|
+
*/
|
228
|
+
unflipDropdownVertically() {
|
229
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
230
|
+
dropdownStyle.position = 'absolute';
|
231
|
+
dropdownStyle.top = '';
|
232
|
+
this.isFlippedVertically = false;
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Calculates the space above and below the editor and flips it vertically if needed.
|
237
|
+
*
|
238
|
+
* @private
|
239
|
+
* @returns {{ isFlipped: boolean, spaceInlineStart: number, spaceInlineEnd: number}}
|
240
|
+
*/
|
241
|
+
flipDropdownHorizontallyIfNeeded() {
|
242
|
+
const {
|
243
|
+
view
|
244
|
+
} = this.hot;
|
245
|
+
const cellRect = this.getEditedCellRect();
|
246
|
+
let spaceInlineStart = cellRect.start + cellRect.width;
|
247
|
+
if (view.isHorizontallyScrollableByWindow()) {
|
248
|
+
const inlineStartOffset = view.getTableOffset().left - this.hot.rootWindow.scrollX;
|
249
|
+
spaceInlineStart = Math.max(spaceInlineStart + inlineStartOffset, 0);
|
250
|
+
}
|
251
|
+
const dropdownTargetWidth = this.getDropdownWidth();
|
252
|
+
const spaceInlineEnd = view.getWorkspaceWidth() - spaceInlineStart + cellRect.width;
|
253
|
+
const flipNeeded = dropdownTargetWidth > spaceInlineEnd && spaceInlineStart > spaceInlineEnd;
|
254
|
+
if (flipNeeded) {
|
255
|
+
this.flipDropdownHorizontally();
|
256
|
+
} else {
|
257
|
+
this.unflipDropdownHorizontally();
|
258
|
+
}
|
259
|
+
return {
|
260
|
+
isFlipped: flipNeeded,
|
261
|
+
spaceInlineStart,
|
262
|
+
spaceInlineEnd
|
263
|
+
};
|
164
264
|
}
|
165
265
|
|
166
266
|
/**
|
167
|
-
*
|
267
|
+
* Adjusts the editor's container to flip horizontally, positioning it from
|
268
|
+
* the inline end (right) to the inline start (left) of the edited cell.
|
168
269
|
*
|
169
270
|
* @private
|
271
|
+
*/
|
272
|
+
flipDropdownHorizontally() {
|
273
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
274
|
+
const {
|
275
|
+
width
|
276
|
+
} = this.getEditedCellRect();
|
277
|
+
dropdownStyle.position = 'absolute';
|
278
|
+
dropdownStyle[this.hot.isRtl() ? 'right' : 'left'] = `${-(this.getDropdownWidth() - width)}px`;
|
279
|
+
this.isFlippedHorizontally = true;
|
280
|
+
}
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Adjusts the editor's container to unflip horizontally, positioning it from
|
284
|
+
* the inline start (left) to the inline end (right) of the edited cell.
|
285
|
+
*
|
286
|
+
* @private
|
287
|
+
*/
|
288
|
+
unflipDropdownHorizontally() {
|
289
|
+
const dropdownStyle = this.htEditor.rootElement.style;
|
290
|
+
dropdownStyle.position = 'absolute';
|
291
|
+
dropdownStyle[this.hot.isRtl() ? 'right' : 'left'] = '';
|
292
|
+
this.isFlippedHorizontally = false;
|
293
|
+
}
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Return the DOM height of the editor's container.
|
297
|
+
*
|
298
|
+
* @returns {number}
|
299
|
+
*/
|
300
|
+
getDropdownHeight() {
|
301
|
+
return this.htEditor.getTableHeight();
|
302
|
+
}
|
303
|
+
|
304
|
+
/**
|
305
|
+
* Return the DOM width of the editor's container.
|
306
|
+
*
|
307
|
+
* @returns {number}
|
308
|
+
*/
|
309
|
+
getDropdownWidth() {
|
310
|
+
return this.htEditor.getTableWidth();
|
311
|
+
}
|
312
|
+
|
313
|
+
/**
|
314
|
+
* Calculates the proposed/target editor width that should be set once the editor is opened.
|
315
|
+
* The method may be overwritten in the child class to provide a custom size logic.
|
316
|
+
*
|
170
317
|
* @returns {number}
|
171
318
|
*/
|
172
|
-
|
319
|
+
getTargetDropdownWidth() {
|
173
320
|
return this.htEditor.view.getTableWidth();
|
174
321
|
}
|
175
322
|
|
323
|
+
/**
|
324
|
+
* Calculates the proposed/target editor height that should be set once the editor is opened.
|
325
|
+
* The method may be overwritten in the child class to provide a custom size logic.
|
326
|
+
*
|
327
|
+
* @returns {number}
|
328
|
+
*/
|
329
|
+
getTargetDropdownHeight() {
|
330
|
+
return this.htEditor.view.getTableHeight() + 1;
|
331
|
+
}
|
332
|
+
|
176
333
|
/**
|
177
334
|
* Assigns afterDestroy callback to prevent memory leaks.
|
178
335
|
*
|
@@ -185,8 +342,7 @@ export class HandsontableEditor extends TextEditor {
|
|
185
342
|
});
|
186
343
|
this.hot.addHook('afterSetTheme', (themeName, firstRun) => {
|
187
344
|
if (!firstRun) {
|
188
|
-
|
189
|
-
(_this$htEditor2 = this.htEditor) === null || _this$htEditor2 === void 0 || _this$htEditor2.useTheme(themeName);
|
345
|
+
this.close();
|
190
346
|
}
|
191
347
|
});
|
192
348
|
}
|
@@ -208,7 +364,7 @@ export class HandsontableEditor extends TextEditor {
|
|
208
364
|
const action = (rowToSelect, event) => {
|
209
365
|
const innerHOT = this.htEditor;
|
210
366
|
if (rowToSelect !== undefined) {
|
211
|
-
if (rowToSelect < 0 ||
|
367
|
+
if (rowToSelect < 0 || this.isFlippedVertically && rowToSelect > innerHOT.countRows() - 1) {
|
212
368
|
innerHOT.deselectCell();
|
213
369
|
} else {
|
214
370
|
innerHOT.selectCell(rowToSelect, 0);
|
@@ -228,10 +384,10 @@ export class HandsontableEditor extends TextEditor {
|
|
228
384
|
const innerHOT = this.htEditor;
|
229
385
|
let rowToSelect;
|
230
386
|
let selectedRow;
|
231
|
-
if (!innerHOT.getSelectedLast() &&
|
387
|
+
if (!innerHOT.getSelectedLast() && this.isFlippedVertically) {
|
232
388
|
rowToSelect = innerHOT.countRows() - 1;
|
233
389
|
} else if (innerHOT.getSelectedLast()) {
|
234
|
-
if (
|
390
|
+
if (this.isFlippedVertically) {
|
235
391
|
selectedRow = innerHOT.getSelectedLast()[0];
|
236
392
|
rowToSelect = Math.max(0, selectedRow - 1);
|
237
393
|
} else {
|
@@ -248,12 +404,12 @@ export class HandsontableEditor extends TextEditor {
|
|
248
404
|
const innerHOT = this.htEditor;
|
249
405
|
let rowToSelect;
|
250
406
|
let selectedRow;
|
251
|
-
if (!innerHOT.getSelectedLast() && !
|
407
|
+
if (!innerHOT.getSelectedLast() && !this.isFlippedVertically) {
|
252
408
|
rowToSelect = 0;
|
253
409
|
} else if (innerHOT.getSelectedLast()) {
|
254
|
-
if (
|
410
|
+
if (this.isFlippedVertically) {
|
255
411
|
rowToSelect = innerHOT.getSelectedLast()[0] + 1;
|
256
|
-
} else if (!
|
412
|
+
} else if (!this.isFlippedVertically) {
|
257
413
|
const lastRow = innerHOT.countRows() - 1;
|
258
414
|
selectedRow = innerHOT.getSelectedLast()[0];
|
259
415
|
rowToSelect = Math.min(lastRow, selectedRow + 1);
|
@@ -5,6 +5,7 @@ require("core-js/modules/es.error.cause.js");
|
|
5
5
|
var _textEditor = require("../textEditor");
|
6
6
|
var _autoResize = require("../../utils/autoResize");
|
7
7
|
var _element = require("../../helpers/dom/element");
|
8
|
+
var _a11y = require("../../helpers/a11y");
|
8
9
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
9
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
10
11
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
@@ -41,6 +42,7 @@ class PasswordEditor extends _textEditor.TextEditor {
|
|
41
42
|
this.textareaStyle.width = 0;
|
42
43
|
this.textareaStyle.height = 0;
|
43
44
|
(0, _element.empty)(this.TEXTAREA_PARENT);
|
45
|
+
this.TEXTAREA.setAttribute(...(0, _a11y.A11Y_TABINDEX)(-1));
|
44
46
|
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
|
45
47
|
}
|
46
48
|
}
|
@@ -5,6 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
5
5
|
import { TextEditor } from "../textEditor/index.mjs";
|
6
6
|
import { createInputElementResizer } from "../../utils/autoResize.mjs";
|
7
7
|
import { empty } from "../../helpers/dom/element.mjs";
|
8
|
+
import { A11Y_TABINDEX } from "../../helpers/a11y.mjs";
|
8
9
|
export const EDITOR_TYPE = 'password';
|
9
10
|
|
10
11
|
/**
|
@@ -38,6 +39,7 @@ export class PasswordEditor extends TextEditor {
|
|
38
39
|
this.textareaStyle.width = 0;
|
39
40
|
this.textareaStyle.height = 0;
|
40
41
|
empty(this.TEXTAREA_PARENT);
|
42
|
+
this.TEXTAREA.setAttribute(...A11Y_TABINDEX(-1));
|
41
43
|
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
|
42
44
|
}
|
43
45
|
}
|
package/editors/registry.js
CHANGED
@@ -7,8 +7,7 @@ exports.getEditor = _getItem;
|
|
7
7
|
exports.registerEditor = _register;
|
8
8
|
require("core-js/modules/es.error.cause.js");
|
9
9
|
var _hooks = require("../core/hooks");
|
10
|
-
var _staticRegister =
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
var _staticRegister = require("../utils/staticRegister");
|
12
11
|
/**
|
13
12
|
* Utility to register editors and common namespace for keeping reference to all editor classes.
|
14
13
|
*/
|
@@ -20,7 +19,7 @@ const {
|
|
20
19
|
hasItem,
|
21
20
|
getNames,
|
22
21
|
getValues
|
23
|
-
} = (0, _staticRegister.
|
22
|
+
} = (0, _staticRegister.staticRegister)('editors');
|
24
23
|
|
25
24
|
/**
|
26
25
|
* @param {BaseEditor} editorClass The editor constructor.
|
package/editors/registry.mjs
CHANGED
@@ -3,7 +3,7 @@ import "core-js/modules/es.error.cause.js";
|
|
3
3
|
* Utility to register editors and common namespace for keeping reference to all editor classes.
|
4
4
|
*/
|
5
5
|
import { Hooks } from "../core/hooks/index.mjs";
|
6
|
-
import staticRegister from "../utils/staticRegister.mjs";
|
6
|
+
import { staticRegister } from "../utils/staticRegister.mjs";
|
7
7
|
const registeredEditorClasses = new WeakMap();
|
8
8
|
const {
|
9
9
|
register,
|
@@ -112,6 +112,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
112
112
|
* Opens the editor and adjust its size.
|
113
113
|
*/
|
114
114
|
open() {
|
115
|
+
this._opened = true;
|
115
116
|
this.refreshDimensions(); // need it instantly, to prevent https://github.com/handsontable/handsontable/issues/348
|
116
117
|
this.showEditableElement();
|
117
118
|
this.hot.getShortcutManager().setActiveContextName('editor');
|
@@ -122,6 +123,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
122
123
|
* Closes the editor.
|
123
124
|
*/
|
124
125
|
close() {
|
126
|
+
this._opened = false;
|
125
127
|
this.autoResize.unObserve();
|
126
128
|
if ((0, _element.isInternalElement)(this.hot.rootDocument.activeElement, this.hot.rootElement)) {
|
127
129
|
this.hot.listen(); // don't refocus the table if user focused some cell outside of HT on purpose
|
@@ -108,6 +108,7 @@ export class TextEditor extends BaseEditor {
|
|
108
108
|
* Opens the editor and adjust its size.
|
109
109
|
*/
|
110
110
|
open() {
|
111
|
+
this._opened = true;
|
111
112
|
this.refreshDimensions(); // need it instantly, to prevent https://github.com/handsontable/handsontable/issues/348
|
112
113
|
this.showEditableElement();
|
113
114
|
this.hot.getShortcutManager().setActiveContextName('editor');
|
@@ -118,6 +119,7 @@ export class TextEditor extends BaseEditor {
|
|
118
119
|
* Closes the editor.
|
119
120
|
*/
|
120
121
|
close() {
|
122
|
+
this._opened = false;
|
121
123
|
this.autoResize.unObserve();
|
122
124
|
if (isInternalElement(this.hot.rootDocument.activeElement, this.hot.rootElement)) {
|
123
125
|
this.hot.listen(); // don't refocus the table if user focused some cell outside of HT on purpose
|
package/helpers/a11y.js
CHANGED
@@ -9,6 +9,8 @@ const A11Y_PRESENTATION = () => ['role', 'presentation'];
|
|
9
9
|
exports.A11Y_PRESENTATION = A11Y_PRESENTATION;
|
10
10
|
const A11Y_GRIDCELL = () => ['role', 'gridcell'];
|
11
11
|
exports.A11Y_GRIDCELL = A11Y_GRIDCELL;
|
12
|
+
const A11Y_GRIDCELL_BUTTON = () => ['role', 'gridcell button'];
|
13
|
+
exports.A11Y_GRIDCELL_BUTTON = A11Y_GRIDCELL_BUTTON;
|
12
14
|
const A11Y_ROWHEADER = () => ['role', 'rowheader'];
|
13
15
|
exports.A11Y_ROWHEADER = A11Y_ROWHEADER;
|
14
16
|
const A11Y_ROWGROUP = () => ['role', 'rowgroup'];
|
package/helpers/a11y.mjs
CHANGED
@@ -2,6 +2,7 @@ export const A11Y_TABINDEX = val => ['tabindex', val];
|
|
2
2
|
export const A11Y_TREEGRID = () => ['role', 'treegrid'];
|
3
3
|
export const A11Y_PRESENTATION = () => ['role', 'presentation'];
|
4
4
|
export const A11Y_GRIDCELL = () => ['role', 'gridcell'];
|
5
|
+
export const A11Y_GRIDCELL_BUTTON = () => ['role', 'gridcell button'];
|
5
6
|
export const A11Y_ROWHEADER = () => ['role', 'rowheader'];
|
6
7
|
export const A11Y_ROWGROUP = () => ['role', 'rowgroup'];
|
7
8
|
export const A11Y_COLUMNHEADER = () => ['role', 'columnheader'];
|
package/helpers/dom/element.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export function getParent(element: HTMLElement, level?: number): HTMLElement;
|
2
2
|
export function getFrameElement(frame: Window): HTMLIFrameElement;
|
3
3
|
export function getParentWindow(frame: Window): Window;
|
4
|
+
export function getFractionalScalingCompensation(rootDocument?: Document): number;
|
4
5
|
export function hasAccessToParentWindow(frame: Window): boolean;
|
5
6
|
export function closest(element: HTMLElement, nodes?: Array<string | HTMLElement>, until?: HTMLElement): HTMLElement;
|
6
7
|
export function closestDown(element: HTMLElement, nodes: HTMLElement[], until?: HTMLElement): HTMLElement;
|