handsontable 15.2.0 → 15.3.0-next-6f5f494-20250424
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/cell/range.js +14 -0
- package/3rdparty/walkontable/src/cell/range.mjs +14 -0
- package/3rdparty/walkontable/src/core/_base.js +2 -2
- package/3rdparty/walkontable/src/core/_base.mjs +3 -3
- package/3rdparty/walkontable/src/overlay/_base.js +0 -2
- package/3rdparty/walkontable/src/overlay/_base.mjs +0 -2
- package/3rdparty/walkontable/src/overlay/bottom.js +9 -6
- package/3rdparty/walkontable/src/overlay/bottom.mjs +9 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.js +8 -5
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +8 -5
- package/3rdparty/walkontable/src/overlay/top.js +11 -6
- package/3rdparty/walkontable/src/overlay/top.mjs +11 -6
- package/3rdparty/walkontable/src/overlays.js +15 -11
- package/3rdparty/walkontable/src/overlays.mjs +15 -11
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +4 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -1
- package/3rdparty/walkontable/src/selection/border/border.js +5 -0
- package/3rdparty/walkontable/src/selection/border/border.mjs +5 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +8 -10
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +8 -10
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +3 -4
- package/3rdparty/walkontable/src/table.js +5 -2
- package/3rdparty/walkontable/src/table.mjs +5 -2
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +0 -2
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +0 -2
- package/CHANGELOG.md +45 -1
- package/README.md +1 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/focusDetector.js +1 -1
- package/core/focusCatcher/focusDetector.mjs +2 -2
- package/core/hooks/constants.js +8 -0
- package/core/hooks/constants.mjs +8 -0
- package/core/hooks/index.d.ts +1 -0
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +7 -5
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +7 -5
- package/core/viewportScroll/scrollStrategies/focusScroll.js +8 -1
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +8 -1
- package/core/viewportScroll/scrollStrategies/multipleScroll.js +13 -1
- package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +13 -1
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +13 -1
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +13 -1
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +7 -5
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +7 -5
- package/core/viewportScroll/scrollStrategies/singleScroll.js +8 -4
- package/core/viewportScroll/scrollStrategies/singleScroll.mjs +8 -4
- package/core/viewportScroll/utils.js +111 -0
- package/core/viewportScroll/utils.mjs +106 -0
- package/core.d.ts +2 -3
- package/core.js +125 -71
- package/core.mjs +126 -72
- package/dataMap/dataMap.js +0 -7
- package/dataMap/dataMap.mjs +0 -7
- package/dataMap/metaManager/index.js +8 -9
- package/dataMap/metaManager/index.mjs +8 -9
- package/dataMap/metaManager/mods/dynamicCellMeta.js +4 -1
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +4 -1
- package/dist/handsontable.css +4 -15
- package/dist/handsontable.full.css +4 -17
- package/dist/handsontable.full.js +4573 -4013
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +4287 -3730
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +1 -7
- package/editorManager.mjs +1 -7
- package/editors/autocompleteEditor/autocompleteEditor.js +31 -7
- package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -7
- package/focusManager.js +4 -2
- package/focusManager.mjs +4 -2
- package/helpers/browser.js +1 -1
- package/helpers/browser.mjs +1 -1
- package/helpers/dom/element.d.ts +1 -0
- package/helpers/dom/element.js +20 -0
- package/helpers/dom/element.mjs +19 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/object.js +3 -0
- package/helpers/object.mjs +3 -0
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +38 -17
- package/plugins/autoColumnSize/autoColumnSize.mjs +38 -17
- package/plugins/autoRowSize/autoRowSize.js +12 -6
- package/plugins/autoRowSize/autoRowSize.mjs +12 -6
- package/plugins/columnSorting/columnSorting.js +0 -4
- package/plugins/columnSorting/columnSorting.mjs +0 -4
- package/plugins/comments/comments.js +1 -0
- package/plugins/comments/comments.mjs +1 -0
- package/plugins/contextMenu/menu/defaultShortcutsList.js +2 -2
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +2 -2
- package/plugins/contextMenu/menu/menu.js +1 -0
- package/plugins/contextMenu/menu/menu.mjs +1 -0
- package/plugins/contextMenu/menu/positioner.js +10 -2
- package/plugins/contextMenu/menu/positioner.mjs +10 -2
- package/plugins/contextMenu/predefinedItems/redo.js +3 -3
- package/plugins/contextMenu/predefinedItems/redo.mjs +3 -3
- package/plugins/contextMenu/predefinedItems/undo.js +3 -3
- package/plugins/contextMenu/predefinedItems/undo.mjs +3 -3
- package/plugins/copyPaste/copyPaste.js +12 -9
- package/plugins/copyPaste/copyPaste.mjs +12 -9
- package/plugins/copyPaste/pasteEvent.js +3 -0
- package/plugins/copyPaste/pasteEvent.mjs +3 -0
- package/plugins/exportFile/exportFile.d.ts +1 -0
- package/plugins/exportFile/exportFile.js +2 -1
- package/plugins/exportFile/exportFile.mjs +2 -1
- package/plugins/exportFile/types/csv.js +76 -11
- package/plugins/exportFile/types/csv.mjs +76 -11
- package/plugins/filters/filters.js +24 -23
- package/plugins/filters/filters.mjs +24 -23
- package/plugins/filters/ui/multipleSelect.js +7 -1
- package/plugins/filters/ui/multipleSelect.mjs +7 -1
- package/plugins/formulas/formulas.d.ts +1 -1
- package/plugins/formulas/formulas.js +57 -60
- package/plugins/formulas/formulas.mjs +59 -62
- package/plugins/formulas/indexSyncer/axisSyncer.js +5 -1
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +5 -1
- package/plugins/hiddenColumns/hiddenColumns.js +1 -1
- package/plugins/hiddenColumns/hiddenColumns.mjs +1 -1
- package/plugins/hiddenRows/hiddenRows.js +1 -1
- package/plugins/hiddenRows/hiddenRows.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +4 -6
- package/plugins/manualColumnResize/manualColumnResize.mjs +4 -6
- package/plugins/manualRowResize/manualRowResize.js +4 -6
- package/plugins/manualRowResize/manualRowResize.mjs +4 -6
- package/plugins/mergeCells/mergeCells.js +10 -30
- package/plugins/mergeCells/mergeCells.mjs +10 -30
- package/plugins/mergeCells/renderer.js +15 -0
- package/plugins/mergeCells/renderer.mjs +15 -0
- package/plugins/mergeCells/utils.js +31 -0
- package/plugins/mergeCells/utils.mjs +27 -0
- package/plugins/nestedRows/data/dataManager.js +2 -2
- package/plugins/nestedRows/data/dataManager.mjs +2 -2
- package/plugins/undoRedo/actions/index.js +0 -2
- package/plugins/undoRedo/actions/index.mjs +0 -2
- package/plugins/undoRedo/actions/removeColumn.js +19 -14
- package/plugins/undoRedo/actions/removeColumn.mjs +19 -14
- package/plugins/undoRedo/actions/removeRow.js +12 -4
- package/plugins/undoRedo/actions/removeRow.mjs +12 -4
- package/selection/selection.js +3 -1
- package/selection/selection.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/down.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +8 -2
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +8 -2
- package/shortcutContexts/commands/extendCellsSelection/left.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/right.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +3 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/up.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +8 -2
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +8 -2
- package/shortcutContexts/commands/index.js +0 -2
- package/shortcutContexts/commands/index.mjs +0 -2
- package/shortcutContexts/commands/moveCellSelection/down.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +8 -3
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -3
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +8 -3
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -3
- package/shortcutContexts/commands/moveCellSelection/left.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/right.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +4 -1
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +4 -1
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +6 -1
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +2 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +2 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +6 -1
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -1
- package/shortcutContexts/commands/selectAllCells.js +7 -2
- package/shortcutContexts/commands/selectAllCells.mjs +7 -2
- package/shortcutContexts/commands/selectAllCellsAndHeaders.js +7 -2
- package/shortcutContexts/commands/selectAllCellsAndHeaders.mjs +7 -2
- package/shortcutContexts/index.js +2 -2
- package/shortcutContexts/index.mjs +0 -2
- package/styles/handsontable.css +15 -17
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +2 -2
- package/styles/ht-theme-horizon.min.css +2 -2
- package/styles/ht-theme-main.css +2 -2
- package/styles/ht-theme-main.min.css +2 -2
- package/tableView.js +5 -8
- package/tableView.mjs +5 -8
- package/translations/indexMapper.js +0 -1
- package/translations/indexMapper.mjs +0 -1
- package/utils/ghostTable.js +3 -0
- package/utils/ghostTable.mjs +3 -0
package/editorManager.js
CHANGED
@@ -80,13 +80,7 @@ class EditorManager {
|
|
80
80
|
this.selection = _selection;
|
81
81
|
this.eventManager = new _eventManager.default(hotInstance);
|
82
82
|
this.hot.addHook('afterDocumentKeyDown', event => _assertClassBrand(_EditorManager_brand, this, _onAfterDocumentKeyDown).call(this, event));
|
83
|
-
|
84
|
-
// Open editor when text composition is started (IME editor)
|
85
|
-
this.eventManager.addEventListener(this.hot.rootDocument.documentElement, 'compositionstart', event => {
|
86
|
-
if (!this.destroyed && this.hot.isListening()) {
|
87
|
-
this.openEditor('', event);
|
88
|
-
}
|
89
|
-
});
|
83
|
+
this.hot.addHook('beforeCompositionStart', event => _assertClassBrand(_EditorManager_brand, this, _onAfterDocumentKeyDown).call(this, event));
|
90
84
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
91
85
|
}
|
92
86
|
|
package/editorManager.mjs
CHANGED
@@ -76,13 +76,7 @@ class EditorManager {
|
|
76
76
|
this.selection = _selection;
|
77
77
|
this.eventManager = new EventManager(hotInstance);
|
78
78
|
this.hot.addHook('afterDocumentKeyDown', event => _assertClassBrand(_EditorManager_brand, this, _onAfterDocumentKeyDown).call(this, event));
|
79
|
-
|
80
|
-
// Open editor when text composition is started (IME editor)
|
81
|
-
this.eventManager.addEventListener(this.hot.rootDocument.documentElement, 'compositionstart', event => {
|
82
|
-
if (!this.destroyed && this.hot.isListening()) {
|
83
|
-
this.openEditor('', event);
|
84
|
-
}
|
85
|
-
});
|
79
|
+
this.hot.addHook('beforeCompositionStart', event => _assertClassBrand(_EditorManager_brand, this, _onAfterDocumentKeyDown).call(this, event));
|
86
80
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
87
81
|
}
|
88
82
|
|
@@ -15,6 +15,7 @@ var _string = require("../../helpers/string");
|
|
15
15
|
var _unicode = require("../../helpers/unicode");
|
16
16
|
var _textRenderer = require("../../renderers/textRenderer");
|
17
17
|
var _a11y = require("../../helpers/a11y");
|
18
|
+
var _function = require("../../helpers/function");
|
18
19
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
19
20
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
20
21
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
@@ -30,6 +31,7 @@ const EDITOR_TYPE = exports.EDITOR_TYPE = 'autocomplete';
|
|
30
31
|
* @class AutocompleteEditor
|
31
32
|
*/
|
32
33
|
var _idPrefix = /*#__PURE__*/new WeakMap();
|
34
|
+
var _focusDebounced = /*#__PURE__*/new WeakMap();
|
33
35
|
var _AutocompleteEditor_brand = /*#__PURE__*/new WeakSet();
|
34
36
|
class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
35
37
|
constructor() {
|
@@ -62,6 +64,12 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
62
64
|
* @type {string}
|
63
65
|
*/
|
64
66
|
_classPrivateFieldInitSpec(this, _idPrefix, this.hot.guid.slice(0, 9));
|
67
|
+
/**
|
68
|
+
* Runs focus method after debounce.
|
69
|
+
*/
|
70
|
+
_classPrivateFieldInitSpec(this, _focusDebounced, (0, _function.debounce)(() => {
|
71
|
+
this.focus();
|
72
|
+
}, 100));
|
65
73
|
/**
|
66
74
|
* Filters and sorts by relevance.
|
67
75
|
*
|
@@ -147,7 +155,6 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
147
155
|
}
|
148
156
|
return this.TEXTAREA.value;
|
149
157
|
}
|
150
|
-
|
151
158
|
/**
|
152
159
|
* Creates an editor's elements and adds necessary CSS classnames.
|
153
160
|
*/
|
@@ -193,10 +200,10 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
193
200
|
this.showEditableElement();
|
194
201
|
this.focus();
|
195
202
|
this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
|
203
|
+
this.htEditor.addHook('afterScroll', _classPrivateFieldGet(_focusDebounced, this));
|
196
204
|
this.htEditor.updateSettings({
|
197
205
|
colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : undefined,
|
198
206
|
autoColumnSize: true,
|
199
|
-
autoRowSize: true,
|
200
207
|
renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
|
201
208
|
(0, _textRenderer.textRenderer)(hotInstance, TD, row, col, prop, value, cellProperties);
|
202
209
|
const {
|
@@ -224,9 +231,21 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
224
231
|
},
|
225
232
|
afterSelectionEnd: (startRow, startCol) => {
|
226
233
|
if (rootInstanceAriaTagsEnabled) {
|
234
|
+
const setA11yAttributes = TD => {
|
235
|
+
(0, _element.setAttribute)(TD, [(0, _a11y.A11Y_SELECTED)()]);
|
236
|
+
(0, _element.setAttribute)(this.TEXTAREA, ...(0, _a11y.A11Y_ACTIVEDESCENDANT)(TD.id));
|
237
|
+
};
|
227
238
|
const TD = this.htEditor.getCell(startRow, startCol, true);
|
228
|
-
|
229
|
-
|
239
|
+
if (TD !== null) {
|
240
|
+
setA11yAttributes(TD);
|
241
|
+
} else {
|
242
|
+
// If TD is null, it means that the cell is not (yet) in the viewport.
|
243
|
+
// Moving the logic to after it's been scrolled to the requested cell.
|
244
|
+
this.htEditor.addHookOnce('afterScrollVertically', () => {
|
245
|
+
const renderedTD = this.htEditor.getCell(startRow, startCol, true);
|
246
|
+
setA11yAttributes(renderedTD);
|
247
|
+
});
|
248
|
+
}
|
230
249
|
}
|
231
250
|
}
|
232
251
|
});
|
@@ -304,7 +323,9 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
304
323
|
}
|
305
324
|
const orderByRelevanceLength = Array.isArray(orderByRelevance) ? orderByRelevance.length : 0;
|
306
325
|
if (filterSetting === false) {
|
307
|
-
|
326
|
+
if (orderByRelevanceLength) {
|
327
|
+
highlightIndex = orderByRelevance[0];
|
328
|
+
}
|
308
329
|
} else {
|
309
330
|
const sorted = [];
|
310
331
|
for (let i = 0, choicesCount = choices.length; i < choicesCount; i++) {
|
@@ -468,7 +489,10 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
468
489
|
const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
|
469
490
|
const height = Array.from({
|
470
491
|
length: maxItems
|
471
|
-
}, (_, i) => i).reduce((
|
492
|
+
}, (_, i) => i).reduce((totalHeight, index) => {
|
493
|
+
const rowHeight = this.htEditor.getRowHeight(index) || this.htEditor.view.getDefaultRowHeight();
|
494
|
+
return totalHeight + rowHeight;
|
495
|
+
}, 0);
|
472
496
|
return height + borderVerticalCompensation + 1;
|
473
497
|
}
|
474
498
|
|
@@ -566,7 +590,7 @@ exports.AutocompleteEditor = AutocompleteEditor;
|
|
566
590
|
function _fixDropdownWidth() {
|
567
591
|
if (this.htEditor.view.hasVerticalScroll()) {
|
568
592
|
this.htEditor.updateSettings({
|
569
|
-
width: this.
|
593
|
+
width: this.getWidth() + (0, _element.getScrollbarWidth)(this.hot.rootDocument)
|
570
594
|
});
|
571
595
|
}
|
572
596
|
}
|
@@ -20,6 +20,7 @@ import { stripTags } from "../../helpers/string.mjs";
|
|
20
20
|
import { KEY_CODES, isPrintableChar } from "../../helpers/unicode.mjs";
|
21
21
|
import { textRenderer } from "../../renderers/textRenderer/index.mjs";
|
22
22
|
import { A11Y_ACTIVEDESCENDANT, A11Y_AUTOCOMPLETE, A11Y_COMBOBOX, A11Y_CONTROLS, A11Y_EXPANDED, A11Y_HASPOPUP, A11Y_LISTBOX, A11Y_LIVE, A11Y_OPTION, A11Y_POSINSET, A11Y_PRESENTATION, A11Y_RELEVANT, A11Y_SELECTED, A11Y_SETSIZE, A11Y_TEXT } from "../../helpers/a11y.mjs";
|
23
|
+
import { debounce } from "../../helpers/function.mjs";
|
23
24
|
export const EDITOR_TYPE = 'autocomplete';
|
24
25
|
|
25
26
|
/**
|
@@ -27,6 +28,7 @@ export const EDITOR_TYPE = 'autocomplete';
|
|
27
28
|
* @class AutocompleteEditor
|
28
29
|
*/
|
29
30
|
var _idPrefix = /*#__PURE__*/new WeakMap();
|
31
|
+
var _focusDebounced = /*#__PURE__*/new WeakMap();
|
30
32
|
var _AutocompleteEditor_brand = /*#__PURE__*/new WeakSet();
|
31
33
|
export class AutocompleteEditor extends HandsontableEditor {
|
32
34
|
constructor() {
|
@@ -59,6 +61,12 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
59
61
|
* @type {string}
|
60
62
|
*/
|
61
63
|
_classPrivateFieldInitSpec(this, _idPrefix, this.hot.guid.slice(0, 9));
|
64
|
+
/**
|
65
|
+
* Runs focus method after debounce.
|
66
|
+
*/
|
67
|
+
_classPrivateFieldInitSpec(this, _focusDebounced, debounce(() => {
|
68
|
+
this.focus();
|
69
|
+
}, 100));
|
62
70
|
/**
|
63
71
|
* Filters and sorts by relevance.
|
64
72
|
*
|
@@ -144,7 +152,6 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
144
152
|
}
|
145
153
|
return this.TEXTAREA.value;
|
146
154
|
}
|
147
|
-
|
148
155
|
/**
|
149
156
|
* Creates an editor's elements and adds necessary CSS classnames.
|
150
157
|
*/
|
@@ -190,10 +197,10 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
190
197
|
this.showEditableElement();
|
191
198
|
this.focus();
|
192
199
|
this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
|
200
|
+
this.htEditor.addHook('afterScroll', _classPrivateFieldGet(_focusDebounced, this));
|
193
201
|
this.htEditor.updateSettings({
|
194
202
|
colWidths: trimDropdown ? [outerWidth(this.TEXTAREA) - 2] : undefined,
|
195
203
|
autoColumnSize: true,
|
196
|
-
autoRowSize: true,
|
197
204
|
renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
|
198
205
|
textRenderer(hotInstance, TD, row, col, prop, value, cellProperties);
|
199
206
|
const {
|
@@ -221,9 +228,21 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
221
228
|
},
|
222
229
|
afterSelectionEnd: (startRow, startCol) => {
|
223
230
|
if (rootInstanceAriaTagsEnabled) {
|
231
|
+
const setA11yAttributes = TD => {
|
232
|
+
setAttribute(TD, [A11Y_SELECTED()]);
|
233
|
+
setAttribute(this.TEXTAREA, ...A11Y_ACTIVEDESCENDANT(TD.id));
|
234
|
+
};
|
224
235
|
const TD = this.htEditor.getCell(startRow, startCol, true);
|
225
|
-
|
226
|
-
|
236
|
+
if (TD !== null) {
|
237
|
+
setA11yAttributes(TD);
|
238
|
+
} else {
|
239
|
+
// If TD is null, it means that the cell is not (yet) in the viewport.
|
240
|
+
// Moving the logic to after it's been scrolled to the requested cell.
|
241
|
+
this.htEditor.addHookOnce('afterScrollVertically', () => {
|
242
|
+
const renderedTD = this.htEditor.getCell(startRow, startCol, true);
|
243
|
+
setA11yAttributes(renderedTD);
|
244
|
+
});
|
245
|
+
}
|
227
246
|
}
|
228
247
|
}
|
229
248
|
});
|
@@ -301,7 +320,9 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
301
320
|
}
|
302
321
|
const orderByRelevanceLength = Array.isArray(orderByRelevance) ? orderByRelevance.length : 0;
|
303
322
|
if (filterSetting === false) {
|
304
|
-
|
323
|
+
if (orderByRelevanceLength) {
|
324
|
+
highlightIndex = orderByRelevance[0];
|
325
|
+
}
|
305
326
|
} else {
|
306
327
|
const sorted = [];
|
307
328
|
for (let i = 0, choicesCount = choices.length; i < choicesCount; i++) {
|
@@ -465,7 +486,10 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
465
486
|
const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
|
466
487
|
const height = Array.from({
|
467
488
|
length: maxItems
|
468
|
-
}, (_, i) => i).reduce((
|
489
|
+
}, (_, i) => i).reduce((totalHeight, index) => {
|
490
|
+
const rowHeight = this.htEditor.getRowHeight(index) || this.htEditor.view.getDefaultRowHeight();
|
491
|
+
return totalHeight + rowHeight;
|
492
|
+
}, 0);
|
469
493
|
return height + borderVerticalCompensation + 1;
|
470
494
|
}
|
471
495
|
|
@@ -562,7 +586,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
562
586
|
function _fixDropdownWidth() {
|
563
587
|
if (this.htEditor.view.hasVerticalScroll()) {
|
564
588
|
this.htEditor.updateSettings({
|
565
|
-
width: this.
|
589
|
+
width: this.getWidth() + getScrollbarWidth(this.hot.rootDocument)
|
566
590
|
});
|
567
591
|
}
|
568
592
|
}
|
package/focusManager.js
CHANGED
@@ -214,8 +214,10 @@ class FocusManager {
|
|
214
214
|
(_classPrivateFieldGet6 = _classPrivateFieldGet(_hot, this).getActiveEditor()) === null || _classPrivateFieldGet6 === void 0 || (_classPrivateFieldGet7 = _classPrivateFieldGet6.refreshValue) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call(_classPrivateFieldGet6);
|
215
215
|
if (!_classPrivateFieldGet(_debouncedSelect, this).has(delay)) {
|
216
216
|
_classPrivateFieldGet(_debouncedSelect, this).set(delay, (0, _function.debounce)(() => {
|
217
|
-
|
218
|
-
|
217
|
+
if (!_classPrivateFieldGet(_hot, this).isDestroyed) {
|
218
|
+
var _this$getRefocusEleme;
|
219
|
+
(_this$getRefocusEleme = this.getRefocusElement()) === null || _this$getRefocusEleme === void 0 || _this$getRefocusEleme.select();
|
220
|
+
}
|
219
221
|
}, delay));
|
220
222
|
}
|
221
223
|
_classPrivateFieldGet(_debouncedSelect, this).get(delay)();
|
package/focusManager.mjs
CHANGED
@@ -211,8 +211,10 @@ export class FocusManager {
|
|
211
211
|
(_classPrivateFieldGet6 = _classPrivateFieldGet(_hot, this).getActiveEditor()) === null || _classPrivateFieldGet6 === void 0 || (_classPrivateFieldGet7 = _classPrivateFieldGet6.refreshValue) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call(_classPrivateFieldGet6);
|
212
212
|
if (!_classPrivateFieldGet(_debouncedSelect, this).has(delay)) {
|
213
213
|
_classPrivateFieldGet(_debouncedSelect, this).set(delay, debounce(() => {
|
214
|
-
|
215
|
-
|
214
|
+
if (!_classPrivateFieldGet(_hot, this).isDestroyed) {
|
215
|
+
var _this$getRefocusEleme;
|
216
|
+
(_this$getRefocusEleme = this.getRefocusElement()) === null || _this$getRefocusEleme === void 0 || _this$getRefocusEleme.select();
|
217
|
+
}
|
216
218
|
}, delay));
|
217
219
|
}
|
218
220
|
_classPrivateFieldGet(_debouncedSelect, this).get(delay)();
|
package/helpers/browser.js
CHANGED
@@ -41,7 +41,7 @@ const platforms = {
|
|
41
41
|
mac: tester(platform => /^Mac/.test(platform)),
|
42
42
|
win: tester(platform => /^Win/.test(platform)),
|
43
43
|
linux: tester(platform => /^Linux/.test(platform)),
|
44
|
-
ios: tester(
|
44
|
+
ios: tester(platform => /iPhone|iPad|iPod/i.test(platform))
|
45
45
|
};
|
46
46
|
|
47
47
|
/**
|
package/helpers/browser.mjs
CHANGED
@@ -23,7 +23,7 @@ const platforms = {
|
|
23
23
|
mac: tester(platform => /^Mac/.test(platform)),
|
24
24
|
win: tester(platform => /^Win/.test(platform)),
|
25
25
|
linux: tester(platform => /^Linux/.test(platform)),
|
26
|
-
ios: tester(
|
26
|
+
ios: tester(platform => /iPhone|iPad|iPod/i.test(platform))
|
27
27
|
};
|
28
28
|
|
29
29
|
/**
|
package/helpers/dom/element.d.ts
CHANGED
@@ -38,6 +38,7 @@ export function setCaretPosition(element: Element, pos: number, endPos: number):
|
|
38
38
|
export function getScrollbarWidth(rootDocument?: Document): number;
|
39
39
|
export function hasVerticalScrollbar(element: HTMLElement): boolean;
|
40
40
|
export function hasHorizontalScrollbar(element: HTMLElement): boolean;
|
41
|
+
export function hasZeroHeight(element: HTMLElement): boolean;
|
41
42
|
export function setOverlayPosition(overlayElem: HTMLElement, left: string | number, top: string | number): void;
|
42
43
|
export function getCssTransform(element: HTMLElement): number;
|
43
44
|
export function resetCssTransform(element: HTMLElement): void;
|
package/helpers/dom/element.js
CHANGED
@@ -31,6 +31,7 @@ exports.hasAccessToParentWindow = hasAccessToParentWindow;
|
|
31
31
|
exports.hasClass = hasClass;
|
32
32
|
exports.hasHorizontalScrollbar = hasHorizontalScrollbar;
|
33
33
|
exports.hasVerticalScrollbar = hasVerticalScrollbar;
|
34
|
+
exports.hasZeroHeight = hasZeroHeight;
|
34
35
|
exports.index = index;
|
35
36
|
exports.innerHeight = innerHeight;
|
36
37
|
exports.innerWidth = innerWidth;
|
@@ -553,6 +554,25 @@ function isVisible(element) {
|
|
553
554
|
return true;
|
554
555
|
}
|
555
556
|
|
557
|
+
/**
|
558
|
+
* Returns true if the element has the height set to `0` or `0px` and overflow to `hidden` (height deliberately set to be 0).
|
559
|
+
*
|
560
|
+
* @param {HTMLElement} element The element to check.
|
561
|
+
* @returns {boolean} `true` if the element has height set to `0` or `0px` and overflow is set to `hidden`, `false` otherwise.
|
562
|
+
*/
|
563
|
+
function hasZeroHeight(element) {
|
564
|
+
const rootDocument = element.ownerDocument;
|
565
|
+
const rootWindow = rootDocument.defaultView;
|
566
|
+
let currentElement = element;
|
567
|
+
while (currentElement.parentNode) {
|
568
|
+
if (currentElement.style.height === '0px' || currentElement.style.height === '0') {
|
569
|
+
return rootWindow.getComputedStyle(currentElement).overflow === 'hidden';
|
570
|
+
}
|
571
|
+
currentElement = currentElement.parentNode;
|
572
|
+
}
|
573
|
+
return false;
|
574
|
+
}
|
575
|
+
|
556
576
|
/**
|
557
577
|
* Returns elements top and left offset relative to the document. Function is not compatible with jQuery offset.
|
558
578
|
*
|
package/helpers/dom/element.mjs
CHANGED
@@ -492,6 +492,25 @@ export function isVisible(element) {
|
|
492
492
|
return true;
|
493
493
|
}
|
494
494
|
|
495
|
+
/**
|
496
|
+
* Returns true if the element has the height set to `0` or `0px` and overflow to `hidden` (height deliberately set to be 0).
|
497
|
+
*
|
498
|
+
* @param {HTMLElement} element The element to check.
|
499
|
+
* @returns {boolean} `true` if the element has height set to `0` or `0px` and overflow is set to `hidden`, `false` otherwise.
|
500
|
+
*/
|
501
|
+
export function hasZeroHeight(element) {
|
502
|
+
const rootDocument = element.ownerDocument;
|
503
|
+
const rootWindow = rootDocument.defaultView;
|
504
|
+
let currentElement = element;
|
505
|
+
while (currentElement.parentNode) {
|
506
|
+
if (currentElement.style.height === '0px' || currentElement.style.height === '0') {
|
507
|
+
return rootWindow.getComputedStyle(currentElement).overflow === 'hidden';
|
508
|
+
}
|
509
|
+
currentElement = currentElement.parentNode;
|
510
|
+
}
|
511
|
+
return false;
|
512
|
+
}
|
513
|
+
|
495
514
|
/**
|
496
515
|
* Returns elements top and left offset relative to the document. Function is not compatible with jQuery offset.
|
497
516
|
*
|
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "15.
|
137
|
+
const hotVersion = "15.3.0-next-6f5f494-20250424";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
@@ -142,7 +142,7 @@ function _injectProductInfo(key, element) {
|
|
142
142
|
const schemaValidity = _checkKeySchema(key);
|
143
143
|
if (hasValidType || isNonCommercial || schemaValidity) {
|
144
144
|
if (schemaValidity) {
|
145
|
-
const releaseDate = (0, _moment.default)("
|
145
|
+
const releaseDate = (0, _moment.default)("29/04/2025", 'DD/MM/YYYY');
|
146
146
|
const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
|
147
147
|
const keyValidityDays = _extractTime(key);
|
148
148
|
keyValidityDate = (0, _moment.default)((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "15.
|
127
|
+
const hotVersion = "15.3.0-next-6f5f494-20250424";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
@@ -132,7 +132,7 @@ export function _injectProductInfo(key, element) {
|
|
132
132
|
const schemaValidity = _checkKeySchema(key);
|
133
133
|
if (hasValidType || isNonCommercial || schemaValidity) {
|
134
134
|
if (schemaValidity) {
|
135
|
-
const releaseDate = moment("
|
135
|
+
const releaseDate = moment("29/04/2025", 'DD/MM/YYYY');
|
136
136
|
const releaseDays = Math.floor(releaseDate.toDate().getTime() / 8.64e7);
|
137
137
|
const keyValidityDays = _extractTime(key);
|
138
138
|
keyValidityDate = moment((keyValidityDays + 1) * 8.64e7, 'x').format('MMMM DD, YYYY');
|
package/helpers/object.js
CHANGED
@@ -281,6 +281,9 @@ function getProperty(object, name) {
|
|
281
281
|
* @param {*} value Value to be assigned at the provided property.
|
282
282
|
*/
|
283
283
|
function setProperty(object, name, value) {
|
284
|
+
if (typeof name !== 'string') {
|
285
|
+
return;
|
286
|
+
}
|
284
287
|
const names = name.split('.');
|
285
288
|
let workingObject = object;
|
286
289
|
names.forEach((propName, index) => {
|
package/helpers/object.mjs
CHANGED
@@ -262,6 +262,9 @@ export function getProperty(object, name) {
|
|
262
262
|
* @param {*} value Value to be assigned at the provided property.
|
263
263
|
*/
|
264
264
|
export function setProperty(object, name, value) {
|
265
|
+
if (typeof name !== 'string') {
|
266
|
+
return;
|
267
|
+
}
|
265
268
|
const names = name.split('.');
|
266
269
|
let workingObject = object;
|
267
270
|
names.forEach((propName, index) => {
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "15.
|
13
|
+
"version": "15.3.0-next-6f5f494-20250424",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -129,6 +129,7 @@ const COLUMN_SIZE_MAP_NAME = 'autoColumnSize';
|
|
129
129
|
* :::
|
130
130
|
*/
|
131
131
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
132
|
+
var _isInitialized = /*#__PURE__*/new WeakMap();
|
132
133
|
var _cachedColumnHeaders = /*#__PURE__*/new WeakMap();
|
133
134
|
var _visualColumnsToRefresh = /*#__PURE__*/new WeakMap();
|
134
135
|
var _AutoColumnSize_brand = /*#__PURE__*/new WeakSet();
|
@@ -218,6 +219,12 @@ class AutoColumnSize extends _base.BasePlugin {
|
|
218
219
|
* @type {PhysicalIndexToValueMap}
|
219
220
|
*/
|
220
221
|
_defineProperty(this, "columnWidthsMap", new _translations.PhysicalIndexToValueMap());
|
222
|
+
/**
|
223
|
+
* `true` value indicates that the #onInit() function has been already called.
|
224
|
+
*
|
225
|
+
* @type {boolean}
|
226
|
+
*/
|
227
|
+
_classPrivateFieldInitSpec(this, _isInitialized, false);
|
221
228
|
/**
|
222
229
|
* Cached column header names. It is used to diff current column headers with previous state and detect which
|
223
230
|
* columns width should be updated.
|
@@ -318,7 +325,7 @@ class AutoColumnSize extends _base.BasePlugin {
|
|
318
325
|
if (firstVisibleColumn === -1 || lastVisibleColumn === -1) {
|
319
326
|
return;
|
320
327
|
}
|
321
|
-
const overwriteCache = this.hot.
|
328
|
+
const overwriteCache = this.hot.forceFullRender;
|
322
329
|
this.calculateColumnsWidth({
|
323
330
|
from: firstVisibleColumn,
|
324
331
|
to: lastVisibleColumn
|
@@ -356,17 +363,11 @@ class AutoColumnSize extends _base.BasePlugin {
|
|
356
363
|
physicalColumn = visualColumn;
|
357
364
|
}
|
358
365
|
if (overwriteCache || this.columnWidthsMap.getValueAtIndex(physicalColumn) === null && !this.hot._getColWidthFromSettings(physicalColumn)) {
|
359
|
-
|
360
|
-
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
366
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
|
361
367
|
}
|
362
368
|
});
|
363
369
|
if (this.ghostTable.columns.length) {
|
364
|
-
this.
|
365
|
-
this.ghostTable.getWidths((visualColumn, width) => {
|
366
|
-
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
367
|
-
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
368
|
-
});
|
369
|
-
}, true);
|
370
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
|
370
371
|
this.measuredColumns = columnsRange.to + 1;
|
371
372
|
this.ghostTable.clean();
|
372
373
|
}
|
@@ -577,20 +578,36 @@ function _calculateSpecificColumnsWidth(visualColumns) {
|
|
577
578
|
return;
|
578
579
|
}
|
579
580
|
if (!this.hot._getColWidthFromSettings(physicalColumn)) {
|
580
|
-
|
581
|
-
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
581
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
|
582
582
|
}
|
583
583
|
});
|
584
584
|
if (this.ghostTable.columns.length) {
|
585
|
-
this.
|
586
|
-
this.ghostTable.getWidths((visualColumn, width) => {
|
587
|
-
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
588
|
-
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
589
|
-
});
|
590
|
-
}, true);
|
585
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
|
591
586
|
this.ghostTable.clean();
|
592
587
|
}
|
593
588
|
}
|
589
|
+
/**
|
590
|
+
* Processes a single column for width calculation.
|
591
|
+
*
|
592
|
+
* @param {number} visualColumn Visual column index.
|
593
|
+
* @param {object} rowsRange Range of rows to process.
|
594
|
+
*/
|
595
|
+
function _fillGhostTableWithSamples(visualColumn, rowsRange) {
|
596
|
+
const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
|
597
|
+
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
598
|
+
}
|
599
|
+
/**
|
600
|
+
* Updates the column widths map with calculated widths from the ghost table.
|
601
|
+
*
|
602
|
+
*/
|
603
|
+
function _updateColumnWidthsMapBasedOnGhostTable() {
|
604
|
+
this.hot.batchExecution(() => {
|
605
|
+
this.ghostTable.getWidths((visualColumn, width) => {
|
606
|
+
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
607
|
+
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
608
|
+
});
|
609
|
+
}, true);
|
610
|
+
}
|
594
611
|
function _onBeforeRender() {
|
595
612
|
this.calculateVisibleColumnsWidth();
|
596
613
|
if (!this.inProgress) {
|
@@ -647,6 +664,7 @@ function _onBeforeColumnResize(size, column, isDblClick) {
|
|
647
664
|
function _onInit() {
|
648
665
|
_classPrivateFieldSet(_cachedColumnHeaders, this, this.hot.getColHeader());
|
649
666
|
this.recalculateAllColumnsWidth();
|
667
|
+
_classPrivateFieldSet(_isInitialized, this, true);
|
650
668
|
}
|
651
669
|
/**
|
652
670
|
* After formulas values updated listener.
|
@@ -654,6 +672,9 @@ function _onInit() {
|
|
654
672
|
* @param {Array} changes An array of modified data.
|
655
673
|
*/
|
656
674
|
function _onAfterFormulasValuesUpdate(changes) {
|
675
|
+
if (!_classPrivateFieldGet(_isInitialized, this)) {
|
676
|
+
return;
|
677
|
+
}
|
657
678
|
const changedColumns = changes.reduce((acc, change) => {
|
658
679
|
var _change$address;
|
659
680
|
const physicalColumn = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.col;
|
@@ -125,6 +125,7 @@ const COLUMN_SIZE_MAP_NAME = 'autoColumnSize';
|
|
125
125
|
* :::
|
126
126
|
*/
|
127
127
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
128
|
+
var _isInitialized = /*#__PURE__*/new WeakMap();
|
128
129
|
var _cachedColumnHeaders = /*#__PURE__*/new WeakMap();
|
129
130
|
var _visualColumnsToRefresh = /*#__PURE__*/new WeakMap();
|
130
131
|
var _AutoColumnSize_brand = /*#__PURE__*/new WeakSet();
|
@@ -214,6 +215,12 @@ export class AutoColumnSize extends BasePlugin {
|
|
214
215
|
* @type {PhysicalIndexToValueMap}
|
215
216
|
*/
|
216
217
|
_defineProperty(this, "columnWidthsMap", new IndexToValueMap());
|
218
|
+
/**
|
219
|
+
* `true` value indicates that the #onInit() function has been already called.
|
220
|
+
*
|
221
|
+
* @type {boolean}
|
222
|
+
*/
|
223
|
+
_classPrivateFieldInitSpec(this, _isInitialized, false);
|
217
224
|
/**
|
218
225
|
* Cached column header names. It is used to diff current column headers with previous state and detect which
|
219
226
|
* columns width should be updated.
|
@@ -314,7 +321,7 @@ export class AutoColumnSize extends BasePlugin {
|
|
314
321
|
if (firstVisibleColumn === -1 || lastVisibleColumn === -1) {
|
315
322
|
return;
|
316
323
|
}
|
317
|
-
const overwriteCache = this.hot.
|
324
|
+
const overwriteCache = this.hot.forceFullRender;
|
318
325
|
this.calculateColumnsWidth({
|
319
326
|
from: firstVisibleColumn,
|
320
327
|
to: lastVisibleColumn
|
@@ -352,17 +359,11 @@ export class AutoColumnSize extends BasePlugin {
|
|
352
359
|
physicalColumn = visualColumn;
|
353
360
|
}
|
354
361
|
if (overwriteCache || this.columnWidthsMap.getValueAtIndex(physicalColumn) === null && !this.hot._getColWidthFromSettings(physicalColumn)) {
|
355
|
-
|
356
|
-
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
362
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
|
357
363
|
}
|
358
364
|
});
|
359
365
|
if (this.ghostTable.columns.length) {
|
360
|
-
this.
|
361
|
-
this.ghostTable.getWidths((visualColumn, width) => {
|
362
|
-
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
363
|
-
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
364
|
-
});
|
365
|
-
}, true);
|
366
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
|
366
367
|
this.measuredColumns = columnsRange.to + 1;
|
367
368
|
this.ghostTable.clean();
|
368
369
|
}
|
@@ -572,20 +573,36 @@ function _calculateSpecificColumnsWidth(visualColumns) {
|
|
572
573
|
return;
|
573
574
|
}
|
574
575
|
if (!this.hot._getColWidthFromSettings(physicalColumn)) {
|
575
|
-
|
576
|
-
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
576
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _fillGhostTableWithSamples).call(this, visualColumn, rowsRange);
|
577
577
|
}
|
578
578
|
});
|
579
579
|
if (this.ghostTable.columns.length) {
|
580
|
-
this.
|
581
|
-
this.ghostTable.getWidths((visualColumn, width) => {
|
582
|
-
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
583
|
-
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
584
|
-
});
|
585
|
-
}, true);
|
580
|
+
_assertClassBrand(_AutoColumnSize_brand, this, _updateColumnWidthsMapBasedOnGhostTable).call(this);
|
586
581
|
this.ghostTable.clean();
|
587
582
|
}
|
588
583
|
}
|
584
|
+
/**
|
585
|
+
* Processes a single column for width calculation.
|
586
|
+
*
|
587
|
+
* @param {number} visualColumn Visual column index.
|
588
|
+
* @param {object} rowsRange Range of rows to process.
|
589
|
+
*/
|
590
|
+
function _fillGhostTableWithSamples(visualColumn, rowsRange) {
|
591
|
+
const samples = this.samplesGenerator.generateColumnSamples(visualColumn, rowsRange);
|
592
|
+
samples.forEach((sample, column) => this.ghostTable.addColumn(column, sample));
|
593
|
+
}
|
594
|
+
/**
|
595
|
+
* Updates the column widths map with calculated widths from the ghost table.
|
596
|
+
*
|
597
|
+
*/
|
598
|
+
function _updateColumnWidthsMapBasedOnGhostTable() {
|
599
|
+
this.hot.batchExecution(() => {
|
600
|
+
this.ghostTable.getWidths((visualColumn, width) => {
|
601
|
+
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
602
|
+
this.columnWidthsMap.setValueAtIndex(physicalColumn, width);
|
603
|
+
});
|
604
|
+
}, true);
|
605
|
+
}
|
589
606
|
function _onBeforeRender() {
|
590
607
|
this.calculateVisibleColumnsWidth();
|
591
608
|
if (!this.inProgress) {
|
@@ -642,6 +659,7 @@ function _onBeforeColumnResize(size, column, isDblClick) {
|
|
642
659
|
function _onInit() {
|
643
660
|
_classPrivateFieldSet(_cachedColumnHeaders, this, this.hot.getColHeader());
|
644
661
|
this.recalculateAllColumnsWidth();
|
662
|
+
_classPrivateFieldSet(_isInitialized, this, true);
|
645
663
|
}
|
646
664
|
/**
|
647
665
|
* After formulas values updated listener.
|
@@ -649,6 +667,9 @@ function _onInit() {
|
|
649
667
|
* @param {Array} changes An array of modified data.
|
650
668
|
*/
|
651
669
|
function _onAfterFormulasValuesUpdate(changes) {
|
670
|
+
if (!_classPrivateFieldGet(_isInitialized, this)) {
|
671
|
+
return;
|
672
|
+
}
|
652
673
|
const changedColumns = changes.reduce((acc, change) => {
|
653
674
|
var _change$address;
|
654
675
|
const physicalColumn = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.col;
|