handsontable 0.0.0-next-fad35d5-20240924 → 0.0.0-next-ffdf116-20240926
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -23
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -23
- package/3rdparty/walkontable/src/core/_base.js +0 -7
- package/3rdparty/walkontable/src/core/_base.mjs +0 -7
- package/3rdparty/walkontable/src/facade/core.js +0 -3
- package/3rdparty/walkontable/src/facade/core.mjs +0 -3
- package/3rdparty/walkontable/src/overlay/_base.js +0 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +0 -3
- package/3rdparty/walkontable/src/selection/border/border.js +45 -33
- package/3rdparty/walkontable/src/selection/border/border.mjs +46 -34
- package/3rdparty/walkontable/src/selection/scanner.js +11 -46
- package/3rdparty/walkontable/src/selection/scanner.mjs +11 -46
- package/3rdparty/walkontable/src/settings.js +0 -8
- package/3rdparty/walkontable/src/settings.mjs +0 -8
- package/3rdparty/walkontable/src/table/master.js +1 -1
- package/3rdparty/walkontable/src/table/master.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +3 -6
- package/3rdparty/walkontable/src/table.mjs +3 -6
- package/3rdparty/walkontable/src/viewport.js +4 -26
- package/3rdparty/walkontable/src/viewport.mjs +4 -26
- package/base.js +4 -4
- package/base.mjs +3 -3
- package/core.d.ts +1 -1
- package/core.js +12 -13
- package/core.mjs +4 -5
- package/dataMap/metaManager/metaSchema.js +2 -68
- package/dataMap/metaManager/metaSchema.mjs +2 -68
- package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2685 -3046
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +60 -60
- package/dist/handsontable.js +2687 -3048
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +18 -18
- package/editorManager.js +2 -2
- package/editorManager.mjs +2 -2
- package/editors/autocompleteEditor/autocompleteEditor.js +31 -14
- package/editors/autocompleteEditor/autocompleteEditor.mjs +31 -14
- package/editors/baseEditor/baseEditor.js +17 -24
- package/editors/baseEditor/baseEditor.mjs +18 -25
- package/editors/dropdownEditor/dropdownEditor.js +3 -2
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +24 -0
- package/editors/handsontableEditor/handsontableEditor.mjs +24 -0
- package/editors/registry.js +2 -2
- package/editors/registry.mjs +1 -1
- package/editors/textEditor/textEditor.js +2 -2
- package/editors/textEditor/textEditor.mjs +3 -3
- package/helpers/dom/element.js +4 -17
- package/helpers/dom/element.mjs +4 -16
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/index.d.ts +1 -2
- package/package.json +1 -1
- package/{core/hooks/index.d.ts → pluginHooks.d.ts} +21 -17
- package/{core/hooks/constants.mjs → pluginHooks.js} +489 -16
- package/{core/hooks/constants.js → pluginHooks.mjs} +486 -20
- package/plugins/autoColumnSize/autoColumnSize.js +27 -18
- package/plugins/autoColumnSize/autoColumnSize.mjs +27 -18
- package/plugins/autoRowSize/autoRowSize.js +22 -16
- package/plugins/autoRowSize/autoRowSize.mjs +23 -17
- package/plugins/autofill/autofill.js +5 -4
- package/plugins/autofill/autofill.mjs +1 -1
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +0 -39
- package/plugins/base/base.mjs +1 -40
- package/plugins/base/index.js +1 -2
- package/plugins/base/index.mjs +1 -1
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -2
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -2
- package/plugins/columnSorting/columnSorting.js +4 -3
- package/plugins/columnSorting/columnSorting.mjs +1 -1
- package/plugins/comments/comments.js +15 -7
- package/plugins/comments/comments.mjs +16 -8
- package/plugins/contextMenu/contextMenu.js +7 -6
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/plugins/contextMenu/menu/menu.js +1 -1
- package/plugins/contextMenu/menu/menu.mjs +2 -2
- package/plugins/contextMenu/menu/positioner.js +4 -2
- package/plugins/contextMenu/menu/positioner.mjs +4 -2
- package/plugins/copyPaste/copyPaste.js +23 -29
- package/plugins/copyPaste/copyPaste.mjs +15 -21
- package/plugins/dropdownMenu/dropdownMenu.js +7 -6
- package/plugins/dropdownMenu/dropdownMenu.mjs +1 -1
- package/plugins/formulas/formulas.js +7 -7
- package/plugins/formulas/formulas.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +30 -19
- package/plugins/hiddenColumns/hiddenColumns.mjs +26 -15
- package/plugins/hiddenRows/hiddenRows.js +29 -18
- package/plugins/hiddenRows/hiddenRows.mjs +25 -14
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +5 -5
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +3 -3
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualRowMove/manualRowMove.js +5 -5
- package/plugins/manualRowMove/manualRowMove.mjs +3 -3
- package/plugins/mergeCells/cellsCollection.js +3 -15
- package/plugins/mergeCells/cellsCollection.mjs +4 -16
- package/plugins/mergeCells/mergeCells.d.ts +2 -6
- package/plugins/mergeCells/mergeCells.js +55 -78
- package/plugins/mergeCells/mergeCells.mjs +53 -76
- package/plugins/mergeCells/renderer.js +3 -13
- package/plugins/mergeCells/renderer.mjs +3 -13
- package/plugins/persistentState/persistentState.js +4 -4
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/undoRedo/undoRedo.js +5 -4
- package/plugins/undoRedo/undoRedo.mjs +3 -3
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/settings.d.ts +1 -3
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/scrollToFocusedCell.js +4 -4
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +4 -4
- package/tableView.js +43 -38
- package/tableView.mjs +43 -38
- package/core/hooks/bucket.js +0 -180
- package/core/hooks/bucket.mjs +0 -176
- package/core/hooks/index.js +0 -385
- package/core/hooks/index.mjs +0 -381
package/editorManager.js
CHANGED
@@ -120,7 +120,7 @@ class EditorManager {
|
|
120
120
|
row,
|
121
121
|
col
|
122
122
|
} = highlight;
|
123
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col
|
123
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
|
124
124
|
let visualRowToCheck = row;
|
125
125
|
let visualColumnToCheck = col;
|
126
126
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -174,7 +174,7 @@ class EditorManager {
|
|
174
174
|
const selection = this.hot.getSelectedRangeLast();
|
175
175
|
let allowOpening = this.hot.runHooks('beforeBeginEditing', selection.highlight.row, selection.highlight.col, newInitialValue, event, enableFullEditMode);
|
176
176
|
|
177
|
-
// If the above hook does not return boolean
|
177
|
+
// If the above hook does not return boolean apply default behavior which disallows opening
|
178
178
|
// an editor after double mouse click for non-contiguous selection (while pressing Ctrl/Cmd) and
|
179
179
|
// for multiple selected cells (while pressing SHIFT).
|
180
180
|
if (event instanceof MouseEvent && typeof allowOpening !== 'boolean') {
|
package/editorManager.mjs
CHANGED
@@ -116,7 +116,7 @@ class EditorManager {
|
|
116
116
|
row,
|
117
117
|
col
|
118
118
|
} = highlight;
|
119
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col
|
119
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
|
120
120
|
let visualRowToCheck = row;
|
121
121
|
let visualColumnToCheck = col;
|
122
122
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -170,7 +170,7 @@ class EditorManager {
|
|
170
170
|
const selection = this.hot.getSelectedRangeLast();
|
171
171
|
let allowOpening = this.hot.runHooks('beforeBeginEditing', selection.highlight.row, selection.highlight.col, newInitialValue, event, enableFullEditMode);
|
172
172
|
|
173
|
-
// If the above hook does not return boolean
|
173
|
+
// If the above hook does not return boolean apply default behavior which disallows opening
|
174
174
|
// an editor after double mouse click for non-contiguous selection (while pressing Ctrl/Cmd) and
|
175
175
|
// for multiple selected cells (while pressing SHIFT).
|
176
176
|
if (event instanceof MouseEvent && typeof allowOpening !== 'boolean') {
|
@@ -9,7 +9,6 @@ var _element = require("../../helpers/dom/element");
|
|
9
9
|
var _mixed = require("../../helpers/mixed");
|
10
10
|
var _string = require("../../helpers/string");
|
11
11
|
var _unicode = require("../../helpers/unicode");
|
12
|
-
var _browser = require("../../helpers/browser");
|
13
12
|
var _textRenderer = require("../../renderers/textRenderer");
|
14
13
|
var _a11y = require("../../helpers/a11y");
|
15
14
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
@@ -183,15 +182,11 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
183
182
|
} = this;
|
184
183
|
this.showEditableElement();
|
185
184
|
this.focus();
|
186
|
-
let scrollbarWidth = (0, _element.getScrollbarWidth)();
|
187
|
-
if (scrollbarWidth === 0 && (0, _browser.isMacOS)()) {
|
188
|
-
scrollbarWidth += 15; // default scroll bar width if scroll bars are visible only when scrolling
|
189
|
-
}
|
190
185
|
this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
|
191
186
|
this.htEditor.updateSettings({
|
192
187
|
colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : undefined,
|
193
|
-
width: trimDropdown ? (0, _element.outerWidth)(this.TEXTAREA) + scrollbarWidth : undefined,
|
194
188
|
autoColumnSize: true,
|
189
|
+
autoRowSize: true,
|
195
190
|
renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
|
196
191
|
(0, _textRenderer.textRenderer)(hotInstance, TD, row, col, prop, value, cellProperties);
|
197
192
|
const {
|
@@ -350,7 +345,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
350
345
|
}
|
351
346
|
const textareaOffset = (0, _element.offset)(this.TEXTAREA);
|
352
347
|
const textareaHeight = (0, _element.outerHeight)(this.TEXTAREA);
|
353
|
-
const dropdownHeight = this.
|
348
|
+
const dropdownHeight = this.getHeight();
|
354
349
|
const trimmingContainerScrollTop = trimmingContainer.scrollTop;
|
355
350
|
const headersHeight = (0, _element.outerHeight)(this.hot.view._wt.wtTable.THEAD);
|
356
351
|
const containerOffset = (0, _element.offset)(trimmingContainer);
|
@@ -423,12 +418,18 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
423
418
|
* @private
|
424
419
|
*/
|
425
420
|
updateDropdownDimensions() {
|
426
|
-
const currentDropdownWidth = this.htEditor.getColWidth(0) + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 2;
|
427
421
|
const trimDropdown = this.cellProperties.trimDropdown;
|
422
|
+
const width = trimDropdown ? this.getWidth() : undefined;
|
423
|
+
const height = this.getHeight();
|
428
424
|
this.htEditor.updateSettings({
|
429
|
-
|
430
|
-
|
425
|
+
width,
|
426
|
+
height
|
431
427
|
});
|
428
|
+
if (trimDropdown && this.htEditor.view.hasVerticalScroll()) {
|
429
|
+
this.htEditor.updateSettings({
|
430
|
+
width: width + (0, _element.getScrollbarWidth)(this.hot.rootDocument)
|
431
|
+
});
|
432
|
+
}
|
432
433
|
this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer();
|
433
434
|
}
|
434
435
|
|
@@ -464,10 +465,26 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
464
465
|
* @private
|
465
466
|
* @returns {number}
|
466
467
|
*/
|
467
|
-
|
468
|
-
const
|
469
|
-
const
|
470
|
-
|
468
|
+
getHeight() {
|
469
|
+
const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
|
470
|
+
const borderVerticalCompensation = parseInt(containerStyle.borderTopWidth, 10) + parseInt(containerStyle.borderBottomWidth, 10);
|
471
|
+
const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
|
472
|
+
const height = Array.from({
|
473
|
+
length: maxItems
|
474
|
+
}, (_, i) => i).reduce((h, index) => h + this.htEditor.getRowHeight(index), 0);
|
475
|
+
return height + borderVerticalCompensation + 1;
|
476
|
+
}
|
477
|
+
|
478
|
+
/**
|
479
|
+
* Calculates and return the internal Handsontable's width.
|
480
|
+
*
|
481
|
+
* @private
|
482
|
+
* @returns {number}
|
483
|
+
*/
|
484
|
+
getWidth() {
|
485
|
+
const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
|
486
|
+
const borderHorizontalCompensation = parseInt(containerStyle.borderInlineStartWidth, 10) + parseInt(containerStyle.borderInlineEndWidth, 10);
|
487
|
+
return this.htEditor.getColWidth(0) + borderHorizontalCompensation;
|
471
488
|
}
|
472
489
|
|
473
490
|
/**
|
@@ -13,7 +13,6 @@ import { addClass, getCaretPosition, getScrollbarWidth, getSelectionEndPosition,
|
|
13
13
|
import { isDefined, stringify } from "../../helpers/mixed.mjs";
|
14
14
|
import { stripTags } from "../../helpers/string.mjs";
|
15
15
|
import { KEY_CODES, isPrintableChar } from "../../helpers/unicode.mjs";
|
16
|
-
import { isMacOS } from "../../helpers/browser.mjs";
|
17
16
|
import { textRenderer } from "../../renderers/textRenderer/index.mjs";
|
18
17
|
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";
|
19
18
|
export const EDITOR_TYPE = 'autocomplete';
|
@@ -180,15 +179,11 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
180
179
|
} = this;
|
181
180
|
this.showEditableElement();
|
182
181
|
this.focus();
|
183
|
-
let scrollbarWidth = getScrollbarWidth();
|
184
|
-
if (scrollbarWidth === 0 && isMacOS()) {
|
185
|
-
scrollbarWidth += 15; // default scroll bar width if scroll bars are visible only when scrolling
|
186
|
-
}
|
187
182
|
this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
|
188
183
|
this.htEditor.updateSettings({
|
189
184
|
colWidths: trimDropdown ? [outerWidth(this.TEXTAREA) - 2] : undefined,
|
190
|
-
width: trimDropdown ? outerWidth(this.TEXTAREA) + scrollbarWidth : undefined,
|
191
185
|
autoColumnSize: true,
|
186
|
+
autoRowSize: true,
|
192
187
|
renderer: (hotInstance, TD, row, col, prop, value, cellProperties) => {
|
193
188
|
textRenderer(hotInstance, TD, row, col, prop, value, cellProperties);
|
194
189
|
const {
|
@@ -347,7 +342,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
347
342
|
}
|
348
343
|
const textareaOffset = offset(this.TEXTAREA);
|
349
344
|
const textareaHeight = outerHeight(this.TEXTAREA);
|
350
|
-
const dropdownHeight = this.
|
345
|
+
const dropdownHeight = this.getHeight();
|
351
346
|
const trimmingContainerScrollTop = trimmingContainer.scrollTop;
|
352
347
|
const headersHeight = outerHeight(this.hot.view._wt.wtTable.THEAD);
|
353
348
|
const containerOffset = offset(trimmingContainer);
|
@@ -420,12 +415,18 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
420
415
|
* @private
|
421
416
|
*/
|
422
417
|
updateDropdownDimensions() {
|
423
|
-
const currentDropdownWidth = this.htEditor.getColWidth(0) + getScrollbarWidth(this.hot.rootDocument) + 2;
|
424
418
|
const trimDropdown = this.cellProperties.trimDropdown;
|
419
|
+
const width = trimDropdown ? this.getWidth() : undefined;
|
420
|
+
const height = this.getHeight();
|
425
421
|
this.htEditor.updateSettings({
|
426
|
-
|
427
|
-
|
422
|
+
width,
|
423
|
+
height
|
428
424
|
});
|
425
|
+
if (trimDropdown && this.htEditor.view.hasVerticalScroll()) {
|
426
|
+
this.htEditor.updateSettings({
|
427
|
+
width: width + getScrollbarWidth(this.hot.rootDocument)
|
428
|
+
});
|
429
|
+
}
|
429
430
|
this.htEditor.view._wt.wtTable.alignOverlaysWithTrimmingContainer();
|
430
431
|
}
|
431
432
|
|
@@ -461,10 +462,26 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
461
462
|
* @private
|
462
463
|
* @returns {number}
|
463
464
|
*/
|
464
|
-
|
465
|
-
const
|
466
|
-
const
|
467
|
-
|
465
|
+
getHeight() {
|
466
|
+
const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
|
467
|
+
const borderVerticalCompensation = parseInt(containerStyle.borderTopWidth, 10) + parseInt(containerStyle.borderBottomWidth, 10);
|
468
|
+
const maxItems = Math.min(this.cellProperties.visibleRows, this.strippedChoices.length);
|
469
|
+
const height = Array.from({
|
470
|
+
length: maxItems
|
471
|
+
}, (_, i) => i).reduce((h, index) => h + this.htEditor.getRowHeight(index), 0);
|
472
|
+
return height + borderVerticalCompensation + 1;
|
473
|
+
}
|
474
|
+
|
475
|
+
/**
|
476
|
+
* Calculates and return the internal Handsontable's width.
|
477
|
+
*
|
478
|
+
* @private
|
479
|
+
* @returns {number}
|
480
|
+
*/
|
481
|
+
getWidth() {
|
482
|
+
const containerStyle = this.hot.rootWindow.getComputedStyle(this.htContainer.querySelector('.htCore'));
|
483
|
+
const borderHorizontalCompensation = parseInt(containerStyle.borderInlineStartWidth, 10) + parseInt(containerStyle.borderInlineEndWidth, 10);
|
484
|
+
return this.htEditor.getColWidth(0) + borderHorizontalCompensation;
|
468
485
|
}
|
469
486
|
|
470
487
|
/**
|
@@ -204,7 +204,7 @@ class BaseEditor {
|
|
204
204
|
} else {
|
205
205
|
[visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
|
206
206
|
}
|
207
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom
|
207
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom);
|
208
208
|
if (Array.isArray(modifiedCellCoords)) {
|
209
209
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
210
210
|
}
|
@@ -228,29 +228,22 @@ class BaseEditor {
|
|
228
228
|
// due to hidden columns don't participate in the rendering process
|
229
229
|
const renderableRowIndex = hotInstance.rowIndexMapper.getRenderableFromVisualIndex(this.row);
|
230
230
|
const renderableColumnIndex = hotInstance.columnIndexMapper.getRenderableFromVisualIndex(this.col);
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
}
|
240
|
-
this.open(event);
|
241
|
-
this._opened = true;
|
242
|
-
this.focus();
|
243
|
-
|
244
|
-
// only rerender the selections (FillHandle should disappear when beginEditing is triggered)
|
245
|
-
hotInstance.view.render();
|
246
|
-
hotInstance.runHooks('afterBeginEditing', this.row, this.col);
|
247
|
-
};
|
248
|
-
this.hot.addHookOnce('afterScroll', openEditor);
|
249
|
-
const wasScroll = hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
250
|
-
if (!wasScroll) {
|
251
|
-
this.hot.removeHook('afterScroll', openEditor);
|
252
|
-
openEditor();
|
231
|
+
hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
232
|
+
this.state = EDITOR_STATE.EDITING;
|
233
|
+
|
234
|
+
// Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
|
235
|
+
// otherwise IME (editor for Asia users) doesn't work.
|
236
|
+
if (this.isInFullEditMode()) {
|
237
|
+
const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : (0, _mixed.stringify)(this.originalValue);
|
238
|
+
this.setValue(stringifiedInitialValue);
|
253
239
|
}
|
240
|
+
this.open(event);
|
241
|
+
this._opened = true;
|
242
|
+
this.focus();
|
243
|
+
|
244
|
+
// only rerender the selections (FillHandle should disappear when beginEditing is triggered)
|
245
|
+
hotInstance.view.render();
|
246
|
+
hotInstance.runHooks('afterBeginEditing', this.row, this.col);
|
254
247
|
}
|
255
248
|
|
256
249
|
/**
|
@@ -483,7 +476,7 @@ class BaseEditor {
|
|
483
476
|
} else if (['top', 'master', 'bottom'].includes(overlayName)) {
|
484
477
|
cellStartOffset += firstColumnOffset - horizontalScrollPosition;
|
485
478
|
}
|
486
|
-
const cellComputedStyle =
|
479
|
+
const cellComputedStyle = rootWindow.getComputedStyle(this.TD);
|
487
480
|
const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
|
488
481
|
const inlineStartBorderCompensation = parseInt(cellComputedStyle[borderPhysicalWidthProp], 10) > 0 ? 0 : 1;
|
489
482
|
const topBorderCompensation = parseInt(cellComputedStyle.borderTopWidth, 10) > 0 ? 0 : 1;
|
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
5
5
|
import { stringify } from "../../helpers/mixed.mjs";
|
6
6
|
import { mixin } from "../../helpers/object.mjs";
|
7
7
|
import hooksRefRegisterer from "../../mixins/hooksRefRegisterer.mjs";
|
8
|
-
import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight
|
8
|
+
import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight } from "../../helpers/dom/element.mjs";
|
9
9
|
export const EDITOR_TYPE = 'base';
|
10
10
|
export const EDITOR_STATE = Object.freeze({
|
11
11
|
VIRGIN: 'STATE_VIRGIN',
|
@@ -200,7 +200,7 @@ export class BaseEditor {
|
|
200
200
|
} else {
|
201
201
|
[visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = [this.row, this.col, null, null];
|
202
202
|
}
|
203
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom
|
203
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowFrom, visualColumnFrom);
|
204
204
|
if (Array.isArray(modifiedCellCoords)) {
|
205
205
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
206
206
|
}
|
@@ -224,29 +224,22 @@ export class BaseEditor {
|
|
224
224
|
// due to hidden columns don't participate in the rendering process
|
225
225
|
const renderableRowIndex = hotInstance.rowIndexMapper.getRenderableFromVisualIndex(this.row);
|
226
226
|
const renderableColumnIndex = hotInstance.columnIndexMapper.getRenderableFromVisualIndex(this.col);
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
this.open(event);
|
237
|
-
this._opened = true;
|
238
|
-
this.focus();
|
239
|
-
|
240
|
-
// only rerender the selections (FillHandle should disappear when beginEditing is triggered)
|
241
|
-
hotInstance.view.render();
|
242
|
-
hotInstance.runHooks('afterBeginEditing', this.row, this.col);
|
243
|
-
};
|
244
|
-
this.hot.addHookOnce('afterScroll', openEditor);
|
245
|
-
const wasScroll = hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
246
|
-
if (!wasScroll) {
|
247
|
-
this.hot.removeHook('afterScroll', openEditor);
|
248
|
-
openEditor();
|
227
|
+
hotInstance.view.scrollViewport(hotInstance._createCellCoords(renderableRowIndex, renderableColumnIndex));
|
228
|
+
this.state = EDITOR_STATE.EDITING;
|
229
|
+
|
230
|
+
// Set the editor value only in the full edit mode. In other mode the focusable element has to be empty,
|
231
|
+
// otherwise IME (editor for Asia users) doesn't work.
|
232
|
+
if (this.isInFullEditMode()) {
|
233
|
+
const stringifiedInitialValue = typeof newInitialValue === 'string' ? newInitialValue : stringify(this.originalValue);
|
234
|
+
this.setValue(stringifiedInitialValue);
|
249
235
|
}
|
236
|
+
this.open(event);
|
237
|
+
this._opened = true;
|
238
|
+
this.focus();
|
239
|
+
|
240
|
+
// only rerender the selections (FillHandle should disappear when beginEditing is triggered)
|
241
|
+
hotInstance.view.render();
|
242
|
+
hotInstance.runHooks('afterBeginEditing', this.row, this.col);
|
250
243
|
}
|
251
244
|
|
252
245
|
/**
|
@@ -479,7 +472,7 @@ export class BaseEditor {
|
|
479
472
|
} else if (['top', 'master', 'bottom'].includes(overlayName)) {
|
480
473
|
cellStartOffset += firstColumnOffset - horizontalScrollPosition;
|
481
474
|
}
|
482
|
-
const cellComputedStyle = getComputedStyle(this.TD
|
475
|
+
const cellComputedStyle = rootWindow.getComputedStyle(this.TD);
|
483
476
|
const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
|
484
477
|
const inlineStartBorderCompensation = parseInt(cellComputedStyle[borderPhysicalWidthProp], 10) > 0 ? 0 : 1;
|
485
478
|
const topBorderCompensation = parseInt(cellComputedStyle.borderTopWidth, 10) > 0 ? 0 : 1;
|
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
var _autocompleteEditor = require("../autocompleteEditor");
|
5
|
-
var
|
5
|
+
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
6
7
|
const EDITOR_TYPE = exports.EDITOR_TYPE = 'dropdown';
|
7
8
|
|
8
9
|
/**
|
@@ -29,7 +30,7 @@ class DropdownEditor extends _autocompleteEditor.AutocompleteEditor {
|
|
29
30
|
}
|
30
31
|
}
|
31
32
|
exports.DropdownEditor = DropdownEditor;
|
32
|
-
|
33
|
+
_pluginHooks.default.getSingleton().add('beforeValidate', function (value, row, col) {
|
33
34
|
const visualColumnIndex = this.propToCol(col);
|
34
35
|
if (Number.isInteger(visualColumnIndex)) {
|
35
36
|
const cellMeta = this.getCellMeta(row, visualColumnIndex);
|
@@ -41,6 +41,10 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
41
41
|
}
|
42
42
|
(0, _element.setCaretPosition)(this.TEXTAREA, 0, this.TEXTAREA.value.length);
|
43
43
|
this.refreshDimensions();
|
44
|
+
this.htEditor.updateSettings({
|
45
|
+
width: this.getWidth(),
|
46
|
+
height: this.getHeight()
|
47
|
+
});
|
44
48
|
}
|
45
49
|
|
46
50
|
/**
|
@@ -147,6 +151,26 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
147
151
|
super.finishEditing(restoreOriginalValue, ctrlDown, callback);
|
148
152
|
}
|
149
153
|
|
154
|
+
/**
|
155
|
+
* Calculates and return the internal Handsontable's height.
|
156
|
+
*
|
157
|
+
* @private
|
158
|
+
* @returns {number}
|
159
|
+
*/
|
160
|
+
getHeight() {
|
161
|
+
return this.htEditor.view.getTableHeight();
|
162
|
+
}
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Calculates and return the internal Handsontable's width.
|
166
|
+
*
|
167
|
+
* @private
|
168
|
+
* @returns {number}
|
169
|
+
*/
|
170
|
+
getWidth() {
|
171
|
+
return this.htEditor.view.getTableWidth();
|
172
|
+
}
|
173
|
+
|
150
174
|
/**
|
151
175
|
* Assigns afterDestroy callback to prevent memory leaks.
|
152
176
|
*
|
@@ -38,6 +38,10 @@ export class HandsontableEditor extends TextEditor {
|
|
38
38
|
}
|
39
39
|
setCaretPosition(this.TEXTAREA, 0, this.TEXTAREA.value.length);
|
40
40
|
this.refreshDimensions();
|
41
|
+
this.htEditor.updateSettings({
|
42
|
+
width: this.getWidth(),
|
43
|
+
height: this.getHeight()
|
44
|
+
});
|
41
45
|
}
|
42
46
|
|
43
47
|
/**
|
@@ -144,6 +148,26 @@ export class HandsontableEditor extends TextEditor {
|
|
144
148
|
super.finishEditing(restoreOriginalValue, ctrlDown, callback);
|
145
149
|
}
|
146
150
|
|
151
|
+
/**
|
152
|
+
* Calculates and return the internal Handsontable's height.
|
153
|
+
*
|
154
|
+
* @private
|
155
|
+
* @returns {number}
|
156
|
+
*/
|
157
|
+
getHeight() {
|
158
|
+
return this.htEditor.view.getTableHeight();
|
159
|
+
}
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Calculates and return the internal Handsontable's width.
|
163
|
+
*
|
164
|
+
* @private
|
165
|
+
* @returns {number}
|
166
|
+
*/
|
167
|
+
getWidth() {
|
168
|
+
return this.htEditor.view.getTableWidth();
|
169
|
+
}
|
170
|
+
|
147
171
|
/**
|
148
172
|
* Assigns afterDestroy callback to prevent memory leaks.
|
149
173
|
*
|
package/editors/registry.js
CHANGED
@@ -6,7 +6,7 @@ exports.getEditorInstance = exports._getEditorInstance = _getEditorInstance;
|
|
6
6
|
exports.getEditor = _getItem;
|
7
7
|
exports.registerEditor = _register;
|
8
8
|
require("core-js/modules/es.error.cause.js");
|
9
|
-
var
|
9
|
+
var _pluginHooks = _interopRequireDefault(require("../pluginHooks"));
|
10
10
|
var _staticRegister = _interopRequireDefault(require("../utils/staticRegister"));
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
12
12
|
/**
|
@@ -40,7 +40,7 @@ function RegisteredEditor(editorClass) {
|
|
40
40
|
}
|
41
41
|
return instances[hotInstance.guid];
|
42
42
|
};
|
43
|
-
|
43
|
+
_pluginHooks.default.getSingleton().add('afterDestroy', function () {
|
44
44
|
instances[this.guid] = null;
|
45
45
|
});
|
46
46
|
}
|
package/editors/registry.mjs
CHANGED
@@ -2,7 +2,7 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
/**
|
3
3
|
* Utility to register editors and common namespace for keeping reference to all editor classes.
|
4
4
|
*/
|
5
|
-
import
|
5
|
+
import Hooks from "../pluginHooks.mjs";
|
6
6
|
import staticRegister from "../utils/staticRegister.mjs";
|
7
7
|
const registeredEditorClasses = new WeakMap();
|
8
8
|
const {
|
@@ -308,11 +308,11 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
308
308
|
this.textareaParentStyle.top = `${top}px`;
|
309
309
|
this.textareaParentStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
|
310
310
|
this.showEditableElement();
|
311
|
-
const cellComputedStyle =
|
311
|
+
const cellComputedStyle = this.hot.rootWindow.getComputedStyle(this.TD);
|
312
312
|
this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
|
313
313
|
this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
|
314
314
|
this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
|
315
|
-
const textareaComputedStyle =
|
315
|
+
const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
|
316
316
|
const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
|
317
317
|
const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
|
318
318
|
const finalWidth = width - horizontalPadding;
|
@@ -5,7 +5,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
5
5
|
import { BaseEditor, EDITOR_STATE } from "../baseEditor/index.mjs";
|
6
6
|
import EventManager from "../../eventManager.mjs";
|
7
7
|
import { isEdge, isIOS } from "../../helpers/browser.mjs";
|
8
|
-
import { addClass,
|
8
|
+
import { addClass, isThisHotChild, setCaretPosition, hasClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
|
9
9
|
import { rangeEach } from "../../helpers/number.mjs";
|
10
10
|
import { createInputElementResizer } from "../../utils/autoResize.mjs";
|
11
11
|
import { isDefined } from "../../helpers/mixed.mjs";
|
@@ -304,11 +304,11 @@ export class TextEditor extends BaseEditor {
|
|
304
304
|
this.textareaParentStyle.top = `${top}px`;
|
305
305
|
this.textareaParentStyle[this.hot.isRtl() ? 'right' : 'left'] = `${start}px`;
|
306
306
|
this.showEditableElement();
|
307
|
-
const cellComputedStyle = getComputedStyle(this.TD
|
307
|
+
const cellComputedStyle = this.hot.rootWindow.getComputedStyle(this.TD);
|
308
308
|
this.TEXTAREA.style.fontSize = cellComputedStyle.fontSize;
|
309
309
|
this.TEXTAREA.style.fontFamily = cellComputedStyle.fontFamily;
|
310
310
|
this.TEXTAREA.style.backgroundColor = this.TD.style.backgroundColor;
|
311
|
-
const textareaComputedStyle = getComputedStyle(this.TEXTAREA);
|
311
|
+
const textareaComputedStyle = this.hot.rootWindow.getComputedStyle(this.TEXTAREA);
|
312
312
|
const horizontalPadding = parseInt(textareaComputedStyle.paddingLeft, 10) + parseInt(textareaComputedStyle.paddingRight, 10);
|
313
313
|
const verticalPadding = parseInt(textareaComputedStyle.paddingTop, 10) + parseInt(textareaComputedStyle.paddingBottom, 10);
|
314
314
|
const finalWidth = width - horizontalPadding;
|
package/helpers/dom/element.js
CHANGED
@@ -10,7 +10,6 @@ exports.empty = empty;
|
|
10
10
|
exports.fastInnerHTML = fastInnerHTML;
|
11
11
|
exports.fastInnerText = fastInnerText;
|
12
12
|
exports.getCaretPosition = getCaretPosition;
|
13
|
-
exports.getComputedStyle = getComputedStyle;
|
14
13
|
exports.getCssTransform = getCssTransform;
|
15
14
|
exports.getFrameElement = getFrameElement;
|
16
15
|
exports.getMaximumScrollLeft = getMaximumScrollLeft;
|
@@ -488,6 +487,7 @@ function fastInnerText(element, content) {
|
|
488
487
|
*/
|
489
488
|
function isVisible(element) {
|
490
489
|
const documentElement = element.ownerDocument.documentElement;
|
490
|
+
const windowElement = element.ownerDocument.defaultView;
|
491
491
|
let next = element;
|
492
492
|
while (next !== documentElement) {
|
493
493
|
// until <html> reached
|
@@ -510,7 +510,7 @@ function isVisible(element) {
|
|
510
510
|
} else {
|
511
511
|
return false; // this is a node detached from document in IE8
|
512
512
|
}
|
513
|
-
} else if (getComputedStyle(next).display === 'none') {
|
513
|
+
} else if (windowElement.getComputedStyle(next).display === 'none') {
|
514
514
|
return false;
|
515
515
|
}
|
516
516
|
next = next.parentNode;
|
@@ -700,7 +700,7 @@ function getTrimmingContainer(base) {
|
|
700
700
|
if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
|
701
701
|
return el;
|
702
702
|
}
|
703
|
-
const computedStyle = getComputedStyle(el
|
703
|
+
const computedStyle = rootWindow.getComputedStyle(el);
|
704
704
|
const allowedProperties = ['scroll', 'hidden', 'auto'];
|
705
705
|
const property = computedStyle.getPropertyValue('overflow');
|
706
706
|
const propertyY = computedStyle.getPropertyValue('overflow-y');
|
@@ -738,7 +738,7 @@ function getStyle(element, prop) {
|
|
738
738
|
if (styleProp !== '' && styleProp !== undefined) {
|
739
739
|
return styleProp;
|
740
740
|
}
|
741
|
-
const computedStyle = getComputedStyle(element
|
741
|
+
const computedStyle = rootWindow.getComputedStyle(element);
|
742
742
|
if (computedStyle[prop] !== '' && computedStyle[prop] !== undefined) {
|
743
743
|
return computedStyle[prop];
|
744
744
|
}
|
@@ -766,19 +766,6 @@ function matchesCSSRules(element, rule) {
|
|
766
766
|
return result;
|
767
767
|
}
|
768
768
|
|
769
|
-
/**
|
770
|
-
* Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet).
|
771
|
-
*
|
772
|
-
* @param {HTMLElement} element An element to get style from.
|
773
|
-
* @param {Window} [rootWindow] The document window owner.
|
774
|
-
* @returns {IEElementStyle|CssStyle} Elements computed style object.
|
775
|
-
*/
|
776
|
-
// eslint-disable-next-line no-restricted-globals
|
777
|
-
function getComputedStyle(element) {
|
778
|
-
let rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
|
779
|
-
return element.currentStyle || rootWindow.getComputedStyle(element);
|
780
|
-
}
|
781
|
-
|
782
769
|
/**
|
783
770
|
* Returns the element's outer width.
|
784
771
|
*
|
package/helpers/dom/element.mjs
CHANGED
@@ -428,6 +428,7 @@ export function fastInnerText(element, content) {
|
|
428
428
|
*/
|
429
429
|
export function isVisible(element) {
|
430
430
|
const documentElement = element.ownerDocument.documentElement;
|
431
|
+
const windowElement = element.ownerDocument.defaultView;
|
431
432
|
let next = element;
|
432
433
|
while (next !== documentElement) {
|
433
434
|
// until <html> reached
|
@@ -450,7 +451,7 @@ export function isVisible(element) {
|
|
450
451
|
} else {
|
451
452
|
return false; // this is a node detached from document in IE8
|
452
453
|
}
|
453
|
-
} else if (getComputedStyle(next).display === 'none') {
|
454
|
+
} else if (windowElement.getComputedStyle(next).display === 'none') {
|
454
455
|
return false;
|
455
456
|
}
|
456
457
|
next = next.parentNode;
|
@@ -640,7 +641,7 @@ export function getTrimmingContainer(base) {
|
|
640
641
|
if (el.style.overflow !== 'visible' && el.style.overflow !== '') {
|
641
642
|
return el;
|
642
643
|
}
|
643
|
-
const computedStyle = getComputedStyle(el
|
644
|
+
const computedStyle = rootWindow.getComputedStyle(el);
|
644
645
|
const allowedProperties = ['scroll', 'hidden', 'auto'];
|
645
646
|
const property = computedStyle.getPropertyValue('overflow');
|
646
647
|
const propertyY = computedStyle.getPropertyValue('overflow-y');
|
@@ -678,7 +679,7 @@ export function getStyle(element, prop) {
|
|
678
679
|
if (styleProp !== '' && styleProp !== undefined) {
|
679
680
|
return styleProp;
|
680
681
|
}
|
681
|
-
const computedStyle = getComputedStyle(element
|
682
|
+
const computedStyle = rootWindow.getComputedStyle(element);
|
682
683
|
if (computedStyle[prop] !== '' && computedStyle[prop] !== undefined) {
|
683
684
|
return computedStyle[prop];
|
684
685
|
}
|
@@ -706,19 +707,6 @@ export function matchesCSSRules(element, rule) {
|
|
706
707
|
return result;
|
707
708
|
}
|
708
709
|
|
709
|
-
/**
|
710
|
-
* Returns a computed style object for the provided element. (Needed if style is declared in external stylesheet).
|
711
|
-
*
|
712
|
-
* @param {HTMLElement} element An element to get style from.
|
713
|
-
* @param {Window} [rootWindow] The document window owner.
|
714
|
-
* @returns {IEElementStyle|CssStyle} Elements computed style object.
|
715
|
-
*/
|
716
|
-
// eslint-disable-next-line no-restricted-globals
|
717
|
-
export function getComputedStyle(element) {
|
718
|
-
let rootWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
|
719
|
-
return element.currentStyle || rootWindow.getComputedStyle(element);
|
720
|
-
}
|
721
|
-
|
722
710
|
/**
|
723
711
|
* Returns the element's outer width.
|
724
712
|
*
|
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 = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-ffdf116-20240926";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
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 = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-ffdf116-20240926";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|