handsontable 0.0.0-next-88f4ae4-20250313 → 0.0.0-next-a1cc3b8-20250314
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -1
- package/core.js +7 -1
- package/core.mjs +7 -1
- 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 +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +143 -108
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +12 -12
- package/dist/handsontable.js +143 -108
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +13 -13
- package/editors/textEditor/textEditor.js +1 -1
- package/editors/textEditor/textEditor.mjs +2 -2
- package/helpers/dom/element.js +2 -2
- package/helpers/dom/element.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +37 -16
- package/plugins/autoColumnSize/autoColumnSize.mjs +37 -16
- package/plugins/autoRowSize/autoRowSize.js +11 -0
- package/plugins/autoRowSize/autoRowSize.mjs +11 -0
- package/plugins/copyPaste/copyPaste.js +6 -12
- package/plugins/copyPaste/copyPaste.mjs +7 -13
- 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/styles/handsontable.css +2 -2
- package/styles/handsontable.min.css +2 -2
- 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
|
@@ -123,7 +123,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
|
123
123
|
*/
|
|
124
124
|
close() {
|
|
125
125
|
this.autoResize.unObserve();
|
|
126
|
-
if ((0, _element.
|
|
126
|
+
if ((0, _element.isInternalElement)(this.hot.rootDocument.activeElement, this.hot.rootElement)) {
|
|
127
127
|
this.hot.listen(); // don't refocus the table if user focused some cell outside of HT on purpose
|
|
128
128
|
}
|
|
129
129
|
this.hideEditableElement();
|
|
@@ -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, isInternalElement, 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";
|
|
@@ -119,7 +119,7 @@ export class TextEditor extends BaseEditor {
|
|
|
119
119
|
*/
|
|
120
120
|
close() {
|
|
121
121
|
this.autoResize.unObserve();
|
|
122
|
-
if (
|
|
122
|
+
if (isInternalElement(this.hot.rootDocument.activeElement, this.hot.rootElement)) {
|
|
123
123
|
this.hot.listen(); // don't refocus the table if user focused some cell outside of HT on purpose
|
|
124
124
|
}
|
|
125
125
|
this.hideEditableElement();
|
package/helpers/dom/element.js
CHANGED
|
@@ -38,8 +38,8 @@ exports.isChildOf = isChildOf;
|
|
|
38
38
|
exports.isDetached = isDetached;
|
|
39
39
|
exports.isHTMLElement = isHTMLElement;
|
|
40
40
|
exports.isInput = isInput;
|
|
41
|
+
exports.isInternalElement = isInternalElement;
|
|
41
42
|
exports.isOutsideInput = isOutsideInput;
|
|
42
|
-
exports.isThisHotChild = isThisHotChild;
|
|
43
43
|
exports.isVisible = isVisible;
|
|
44
44
|
exports.makeElementContentEditableAndSelectItsContent = makeElementContentEditableAndSelectItsContent;
|
|
45
45
|
exports.matchesCSSRules = matchesCSSRules;
|
|
@@ -100,7 +100,7 @@ function getParent(element) {
|
|
|
100
100
|
* @param {HTMLElement} thisHotContainer The Handsontable container.
|
|
101
101
|
* @returns {boolean}
|
|
102
102
|
*/
|
|
103
|
-
function
|
|
103
|
+
function isInternalElement(element, thisHotContainer) {
|
|
104
104
|
const closestHandsontableContainer = element.closest('.handsontable');
|
|
105
105
|
return !!closestHandsontableContainer && (closestHandsontableContainer.parentNode === thisHotContainer || closestHandsontableContainer === thisHotContainer);
|
|
106
106
|
}
|
package/helpers/dom/element.mjs
CHANGED
|
@@ -39,7 +39,7 @@ export function getParent(element) {
|
|
|
39
39
|
* @param {HTMLElement} thisHotContainer The Handsontable container.
|
|
40
40
|
* @returns {boolean}
|
|
41
41
|
*/
|
|
42
|
-
export function
|
|
42
|
+
export function isInternalElement(element, thisHotContainer) {
|
|
43
43
|
const closestHandsontableContainer = element.closest('.handsontable');
|
|
44
44
|
return !!closestHandsontableContainer && (closestHandsontableContainer.parentNode === thisHotContainer || closestHandsontableContainer === thisHotContainer);
|
|
45
45
|
}
|
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-a1cc3b8-20250314";
|
|
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-a1cc3b8-20250314";
|
|
128
128
|
let keyValidityDate;
|
|
129
129
|
let consoleMessageState = 'invalid';
|
|
130
130
|
let domMessageState = 'invalid';
|
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": "0.0.0-next-
|
|
13
|
+
"version": "0.0.0-next-a1cc3b8-20250314",
|
|
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.
|
|
@@ -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.
|
|
@@ -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;
|
|
@@ -113,6 +113,7 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
|
|
|
113
113
|
*/
|
|
114
114
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
|
115
115
|
var _visualRowsToRefresh = /*#__PURE__*/new WeakMap();
|
|
116
|
+
var _isInitialized = /*#__PURE__*/new WeakMap();
|
|
116
117
|
var _AutoRowSize_brand = /*#__PURE__*/new WeakSet();
|
|
117
118
|
class AutoRowSize extends _base.BasePlugin {
|
|
118
119
|
static get PLUGIN_KEY() {
|
|
@@ -215,6 +216,12 @@ class AutoRowSize extends _base.BasePlugin {
|
|
|
215
216
|
* @type {number[]}
|
|
216
217
|
*/
|
|
217
218
|
_classPrivateFieldInitSpec(this, _visualRowsToRefresh, []);
|
|
219
|
+
/**
|
|
220
|
+
* `true` value indicates that the #onInit() function has been already called.
|
|
221
|
+
*
|
|
222
|
+
* @type {boolean}
|
|
223
|
+
*/
|
|
224
|
+
_classPrivateFieldInitSpec(this, _isInitialized, false);
|
|
218
225
|
this.hot.rowIndexMapper.registerMap(ROW_WIDTHS_MAP_NAME, this.rowHeightsMap);
|
|
219
226
|
|
|
220
227
|
// Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
|
|
@@ -645,6 +652,7 @@ function _onBeforeChange(changes) {
|
|
|
645
652
|
*/
|
|
646
653
|
function _onInit() {
|
|
647
654
|
this.recalculateAllRowsHeight();
|
|
655
|
+
_classPrivateFieldSet(_isInitialized, this, true);
|
|
648
656
|
}
|
|
649
657
|
/**
|
|
650
658
|
* After formulas values updated listener.
|
|
@@ -652,6 +660,9 @@ function _onInit() {
|
|
|
652
660
|
* @param {Array} changes An array of modified data.
|
|
653
661
|
*/
|
|
654
662
|
function _onAfterFormulasValuesUpdate(changes) {
|
|
663
|
+
if (!_classPrivateFieldGet(_isInitialized, this)) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
655
666
|
const changedRows = changes.reduce((acc, change) => {
|
|
656
667
|
var _change$address;
|
|
657
668
|
const physicalRow = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.row;
|
|
@@ -109,6 +109,7 @@ const ROW_WIDTHS_MAP_NAME = 'autoRowSize';
|
|
|
109
109
|
*/
|
|
110
110
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
|
111
111
|
var _visualRowsToRefresh = /*#__PURE__*/new WeakMap();
|
|
112
|
+
var _isInitialized = /*#__PURE__*/new WeakMap();
|
|
112
113
|
var _AutoRowSize_brand = /*#__PURE__*/new WeakSet();
|
|
113
114
|
export class AutoRowSize extends BasePlugin {
|
|
114
115
|
static get PLUGIN_KEY() {
|
|
@@ -211,6 +212,12 @@ export class AutoRowSize extends BasePlugin {
|
|
|
211
212
|
* @type {number[]}
|
|
212
213
|
*/
|
|
213
214
|
_classPrivateFieldInitSpec(this, _visualRowsToRefresh, []);
|
|
215
|
+
/**
|
|
216
|
+
* `true` value indicates that the #onInit() function has been already called.
|
|
217
|
+
*
|
|
218
|
+
* @type {boolean}
|
|
219
|
+
*/
|
|
220
|
+
_classPrivateFieldInitSpec(this, _isInitialized, false);
|
|
214
221
|
this.hot.rowIndexMapper.registerMap(ROW_WIDTHS_MAP_NAME, this.rowHeightsMap);
|
|
215
222
|
|
|
216
223
|
// Leave the listener active to allow auto-sizing the rows when the plugin is disabled.
|
|
@@ -640,6 +647,7 @@ function _onBeforeChange(changes) {
|
|
|
640
647
|
*/
|
|
641
648
|
function _onInit() {
|
|
642
649
|
this.recalculateAllRowsHeight();
|
|
650
|
+
_classPrivateFieldSet(_isInitialized, this, true);
|
|
643
651
|
}
|
|
644
652
|
/**
|
|
645
653
|
* After formulas values updated listener.
|
|
@@ -647,6 +655,9 @@ function _onInit() {
|
|
|
647
655
|
* @param {Array} changes An array of modified data.
|
|
648
656
|
*/
|
|
649
657
|
function _onAfterFormulasValuesUpdate(changes) {
|
|
658
|
+
if (!_classPrivateFieldGet(_isInitialized, this)) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
650
661
|
const changedRows = changes.reduce((acc, change) => {
|
|
651
662
|
var _change$address;
|
|
652
663
|
const physicalRow = (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.row;
|
|
@@ -562,12 +562,10 @@ class CopyPaste extends _base.BasePlugin {
|
|
|
562
562
|
* @private
|
|
563
563
|
*/
|
|
564
564
|
onCopy(event) {
|
|
565
|
-
var _event$target
|
|
565
|
+
var _event$target;
|
|
566
566
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
567
567
|
const isHotInput = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.hasAttribute('data-hot-input');
|
|
568
|
-
|
|
569
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
570
|
-
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
568
|
+
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !(0, _element.isInternalElement)(event.target, this.hot.rootElement))) {
|
|
571
569
|
return;
|
|
572
570
|
}
|
|
573
571
|
event.preventDefault();
|
|
@@ -597,12 +595,10 @@ class CopyPaste extends _base.BasePlugin {
|
|
|
597
595
|
* @private
|
|
598
596
|
*/
|
|
599
597
|
onCut(event) {
|
|
600
|
-
var _event$target2
|
|
598
|
+
var _event$target2;
|
|
601
599
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
602
600
|
const isHotInput = (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.hasAttribute('data-hot-input');
|
|
603
|
-
|
|
604
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
605
|
-
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
601
|
+
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !(0, _element.isInternalElement)(event.target, this.hot.rootElement))) {
|
|
606
602
|
return;
|
|
607
603
|
}
|
|
608
604
|
event.preventDefault();
|
|
@@ -631,12 +627,10 @@ class CopyPaste extends _base.BasePlugin {
|
|
|
631
627
|
* @private
|
|
632
628
|
*/
|
|
633
629
|
onPaste(event) {
|
|
634
|
-
var _event$target3
|
|
630
|
+
var _event$target3;
|
|
635
631
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
636
632
|
const isHotInput = (_event$target3 = event.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.hasAttribute('data-hot-input');
|
|
637
|
-
|
|
638
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
639
|
-
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
633
|
+
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || (0, _element.isHTMLElement)(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !(0, _element.isInternalElement)(event.target, this.hot.rootElement))) {
|
|
640
634
|
return;
|
|
641
635
|
}
|
|
642
636
|
event.preventDefault();
|
|
@@ -17,7 +17,7 @@ import { Hooks } from "../../core/hooks/index.mjs";
|
|
|
17
17
|
import { stringify, parse } from "../../3rdparty/SheetClip/index.mjs";
|
|
18
18
|
import { arrayEach } from "../../helpers/array.mjs";
|
|
19
19
|
import { sanitize } from "../../helpers/string.mjs";
|
|
20
|
-
import { removeContentEditableFromElementAndDeselect, runWithSelectedContendEditableElement, makeElementContentEditableAndSelectItsContent, isHTMLElement } from "../../helpers/dom/element.mjs";
|
|
20
|
+
import { removeContentEditableFromElementAndDeselect, runWithSelectedContendEditableElement, makeElementContentEditableAndSelectItsContent, isHTMLElement, isInternalElement } from "../../helpers/dom/element.mjs";
|
|
21
21
|
import { isSafari } from "../../helpers/browser.mjs";
|
|
22
22
|
import copyItem from "./contextMenuItem/copy.mjs";
|
|
23
23
|
import copyColumnHeadersOnlyItem from "./contextMenuItem/copyColumnHeadersOnly.mjs";
|
|
@@ -558,12 +558,10 @@ export class CopyPaste extends BasePlugin {
|
|
|
558
558
|
* @private
|
|
559
559
|
*/
|
|
560
560
|
onCopy(event) {
|
|
561
|
-
var _event$target
|
|
561
|
+
var _event$target;
|
|
562
562
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
563
563
|
const isHotInput = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.hasAttribute('data-hot-input');
|
|
564
|
-
|
|
565
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
566
|
-
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
564
|
+
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {
|
|
567
565
|
return;
|
|
568
566
|
}
|
|
569
567
|
event.preventDefault();
|
|
@@ -593,12 +591,10 @@ export class CopyPaste extends BasePlugin {
|
|
|
593
591
|
* @private
|
|
594
592
|
*/
|
|
595
593
|
onCut(event) {
|
|
596
|
-
var _event$target2
|
|
594
|
+
var _event$target2;
|
|
597
595
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
598
596
|
const isHotInput = (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.hasAttribute('data-hot-input');
|
|
599
|
-
|
|
600
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
601
|
-
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
597
|
+
if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {
|
|
602
598
|
return;
|
|
603
599
|
}
|
|
604
600
|
event.preventDefault();
|
|
@@ -627,12 +623,10 @@ export class CopyPaste extends BasePlugin {
|
|
|
627
623
|
* @private
|
|
628
624
|
*/
|
|
629
625
|
onPaste(event) {
|
|
630
|
-
var _event$target3
|
|
626
|
+
var _event$target3;
|
|
631
627
|
const focusedElement = this.hot.getFocusManager().getRefocusElement();
|
|
632
628
|
const isHotInput = (_event$target3 = event.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.hasAttribute('data-hot-input');
|
|
633
|
-
|
|
634
|
-
const TD = selectedCell ? this.hot.getCell(selectedCell.row, selectedCell.col, true) : null;
|
|
635
|
-
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && TD !== event.target)) {
|
|
629
|
+
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || isHTMLElement(event.target) && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body && !isInternalElement(event.target, this.hot.rootElement))) {
|
|
636
630
|
return;
|
|
637
631
|
}
|
|
638
632
|
event.preventDefault();
|
|
@@ -32,7 +32,7 @@ export class Formulas extends BasePlugin {
|
|
|
32
32
|
|
|
33
33
|
engine: HyperFormula | null;
|
|
34
34
|
sheetName: string | null;
|
|
35
|
-
|
|
35
|
+
sheetId: number | null;
|
|
36
36
|
|
|
37
37
|
isEnabled(): boolean;
|
|
38
38
|
addSheet(sheetName?: string | null, sheetData?: CellValue[][]): string | boolean;
|