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
@@ -10,7 +10,6 @@ import "core-js/modules/es.set.symmetric-difference.v2.js";
|
|
10
10
|
import "core-js/modules/es.set.union.v2.js";
|
11
11
|
import "core-js/modules/esnext.iterator.constructor.js";
|
12
12
|
import "core-js/modules/esnext.iterator.every.js";
|
13
|
-
import "core-js/modules/esnext.iterator.find.js";
|
14
13
|
import "core-js/modules/esnext.iterator.for-each.js";
|
15
14
|
import "core-js/modules/esnext.iterator.map.js";
|
16
15
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
@@ -27,8 +26,8 @@ import staticRegister from "../../utils/staticRegister.mjs";
|
|
27
26
|
import { error, warn } from "../../helpers/console.mjs";
|
28
27
|
import { isNumeric } from "../../helpers/number.mjs";
|
29
28
|
import { isDefined, isUndefined } from "../../helpers/mixed.mjs";
|
30
|
-
import { setupEngine, setupSheet, unregisterEngine
|
31
|
-
import {
|
29
|
+
import { getRegisteredHotInstances, setupEngine, setupSheet, unregisterEngine } from "./engine/register.mjs";
|
30
|
+
import { getDateFromExcelDate, getDateInHfFormat, getDateInHotFormat, isDate, isDateValid, isFormula, unescapeFormulaExpression } from "./utils.mjs";
|
32
31
|
import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./engine/settings.mjs";
|
33
32
|
import { isArrayOfArrays } from "../../helpers/data.mjs";
|
34
33
|
import { toUpperCaseFirst } from "../../helpers/string.mjs";
|
@@ -70,13 +69,9 @@ export class Formulas extends BasePlugin {
|
|
70
69
|
super(...arguments);
|
71
70
|
_this = this;
|
72
71
|
/**
|
73
|
-
*
|
74
|
-
* validator function.
|
72
|
+
* Update sheetName and sheetId properties.
|
75
73
|
*
|
76
|
-
* @param {
|
77
|
-
* @param {number} visualRow The visual row index.
|
78
|
-
* @param {number|string} prop The visual column index or property name of the column.
|
79
|
-
* @returns {*} Returns value to validate.
|
74
|
+
* @param {string} [sheetName] The new sheet name.
|
80
75
|
*/
|
81
76
|
_classPrivateMethodInitSpec(this, _Formulas_brand);
|
82
77
|
/**
|
@@ -143,6 +138,12 @@ export class Formulas extends BasePlugin {
|
|
143
138
|
* @type {HyperFormula|null}
|
144
139
|
*/
|
145
140
|
_defineProperty(this, "engine", null);
|
141
|
+
/**
|
142
|
+
* HyperFormula's sheet id.
|
143
|
+
*
|
144
|
+
* @type {number|null}
|
145
|
+
*/
|
146
|
+
_defineProperty(this, "sheetId", null);
|
146
147
|
/**
|
147
148
|
* HyperFormula's sheet name.
|
148
149
|
*
|
@@ -177,15 +178,6 @@ export class Formulas extends BasePlugin {
|
|
177
178
|
static get SETTING_KEYS() {
|
178
179
|
return [PLUGIN_KEY, ...SETTING_KEYS];
|
179
180
|
}
|
180
|
-
/**
|
181
|
-
* HyperFormula's sheet id.
|
182
|
-
*
|
183
|
-
* @type {number|null}
|
184
|
-
*/
|
185
|
-
get sheetId() {
|
186
|
-
return this.sheetName === null ? null : this.engine.getSheetId(this.sheetName);
|
187
|
-
}
|
188
|
-
|
189
181
|
/**
|
190
182
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
191
183
|
* hook and if it returns `true` then the {@link Formulas#enablePlugin} method is called.
|
@@ -216,7 +208,7 @@ export class Formulas extends BasePlugin {
|
|
216
208
|
if (this.sheetName !== null && !this.engine.doesSheetExist(this.sheetName)) {
|
217
209
|
const newSheetName = this.addSheet(this.sheetName, this.hot.getSourceDataArray());
|
218
210
|
if (newSheetName !== false) {
|
219
|
-
this.
|
211
|
+
_assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newSheetName);
|
220
212
|
}
|
221
213
|
}
|
222
214
|
this.addHook('beforeLoadData', function () {
|
@@ -447,7 +439,8 @@ export class Formulas extends BasePlugin {
|
|
447
439
|
if (sheetName && this.engine.doesSheetExist(sheetName)) {
|
448
440
|
this.switchSheet(this.sheetName);
|
449
441
|
} else {
|
450
|
-
|
442
|
+
const newSheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());
|
443
|
+
_assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newSheetName);
|
451
444
|
}
|
452
445
|
}
|
453
446
|
super.updatePlugin(newSettings);
|
@@ -467,7 +460,6 @@ export class Formulas extends BasePlugin {
|
|
467
460
|
this.engine = null;
|
468
461
|
super.destroy();
|
469
462
|
}
|
470
|
-
|
471
463
|
/**
|
472
464
|
* Add a sheet to the shared HyperFormula instance.
|
473
465
|
*
|
@@ -510,7 +502,7 @@ export class Formulas extends BasePlugin {
|
|
510
502
|
error(`The sheet named \`${sheetName}\` does not exist, switch aborted.`);
|
511
503
|
return;
|
512
504
|
}
|
513
|
-
this.
|
505
|
+
_assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, sheetName);
|
514
506
|
const serialized = this.engine.getSheetSerialized(this.sheetId);
|
515
507
|
if (serialized.length > 0) {
|
516
508
|
this.hot.loadData(serialized, `${toUpperCaseFirst(PLUGIN_KEY)}.switchSheet`);
|
@@ -670,6 +662,20 @@ export class Formulas extends BasePlugin {
|
|
670
662
|
}
|
671
663
|
return this.engine.setCellContents(address, newValue);
|
672
664
|
}
|
665
|
+
|
666
|
+
/**
|
667
|
+
* The hook allows to translate the formula value to calculated value before it goes to the
|
668
|
+
* validator function.
|
669
|
+
*
|
670
|
+
* @param {*} value The cell value to validate.
|
671
|
+
* @param {number} visualRow The visual row index.
|
672
|
+
* @param {number|string} prop The visual column index or property name of the column.
|
673
|
+
* @returns {*} Returns value to validate.
|
674
|
+
*/
|
675
|
+
}
|
676
|
+
function _updateSheetNameAndSheetId(sheetName) {
|
677
|
+
this.sheetName = sheetName;
|
678
|
+
this.sheetId = this.engine.getSheetId(this.sheetName);
|
673
679
|
}
|
674
680
|
function _onBeforeValidate(value, visualRow, prop) {
|
675
681
|
const visualColumn = this.hot.propToCol(prop);
|
@@ -798,29 +804,33 @@ function _onBeforeLoadData(sourceData, initialLoad) {
|
|
798
804
|
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
799
805
|
*/
|
800
806
|
function _onAfterCellMetaReset() {
|
807
|
+
if (_classPrivateFieldGet(_hotWasInitializedWithEmptyData, this)) {
|
808
|
+
this.switchSheet(this.sheetName);
|
809
|
+
return;
|
810
|
+
}
|
801
811
|
const sourceDataArray = this.hot.getSourceDataArray();
|
802
|
-
let valueChanged = false;
|
803
812
|
sourceDataArray.forEach((rowData, rowIndex) => {
|
804
813
|
rowData.forEach((cellValue, columnIndex) => {
|
805
|
-
const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex
|
814
|
+
const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex, {
|
815
|
+
skipMetaExtension: true
|
816
|
+
});
|
806
817
|
const dateFormat = cellMeta.dateFormat;
|
807
818
|
if (isDate(cellValue, cellMeta.type)) {
|
808
|
-
valueChanged = true;
|
809
819
|
if (isDateValid(cellValue, dateFormat)) {
|
810
820
|
// Rewriting date in HOT format to HF format.
|
811
821
|
sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);
|
812
|
-
} else if (
|
822
|
+
} else if (!cellValue.startsWith('=')) {
|
813
823
|
// Escaping value from date parsing using "'" sign (HF feature).
|
814
824
|
sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
|
815
825
|
}
|
816
826
|
}
|
817
827
|
});
|
818
828
|
});
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
829
|
+
_classPrivateFieldSet(_internalOperationPending, this, true);
|
830
|
+
const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
831
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
832
|
+
this.renderDependentSheets(dependentCells);
|
833
|
+
_classPrivateFieldSet(_internalOperationPending, this, false);
|
824
834
|
}
|
825
835
|
/**
|
826
836
|
* `afterLoadData` hook callback.
|
@@ -834,7 +844,12 @@ function _onAfterLoadData(sourceData, initialLoad) {
|
|
834
844
|
if (source.includes(toUpperCaseFirst(PLUGIN_KEY))) {
|
835
845
|
return;
|
836
846
|
}
|
837
|
-
|
847
|
+
const sheetName = setupSheet(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
|
848
|
+
_assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, sheetName);
|
849
|
+
if (source === 'updateSettings') {
|
850
|
+
// For performance reasons, the initialization will be done in afterCellMetaReset hook
|
851
|
+
return;
|
852
|
+
}
|
838
853
|
if (!_classPrivateFieldGet(_hotWasInitializedWithEmptyData, this)) {
|
839
854
|
const sourceDataArray = this.hot.getSourceDataArray();
|
840
855
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
@@ -865,17 +880,10 @@ function _onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
865
880
|
if (visualRow === null || visualColumn === null) {
|
866
881
|
return;
|
867
882
|
}
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
const cellType = this.getCellType(visualRow, visualColumn);
|
873
|
-
if (cellType !== 'ARRAY') {
|
874
|
-
if (isEscapedFormulaExpression(valueHolder.value)) {
|
875
|
-
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
876
|
-
}
|
877
|
-
return;
|
878
|
-
}
|
883
|
+
const cellType = this.getCellType(visualRow, visualColumn);
|
884
|
+
if (cellType === 'VALUE' || cellType === 'EMPTY') {
|
885
|
+
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
886
|
+
return;
|
879
887
|
}
|
880
888
|
const address = {
|
881
889
|
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
@@ -884,21 +892,15 @@ function _onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
884
892
|
};
|
885
893
|
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
886
894
|
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
// is executed once again and it cause creation of an infinite loop.
|
891
|
-
let cellMeta = this.hot.getCellsMeta().find(singleCellMeta => singleCellMeta.visualRow === visualRow && singleCellMeta.visualCol === visualColumn);
|
892
|
-
if (cellMeta === undefined) {
|
893
|
-
cellMeta = {};
|
894
|
-
}
|
895
|
+
const cellMeta = this.hot.getCellMeta(visualRow, visualColumn, {
|
896
|
+
skipMetaExtension: true
|
897
|
+
});
|
895
898
|
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
896
899
|
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
897
900
|
}
|
898
901
|
|
899
902
|
// If `cellValue` is an object it is expected to be an error
|
900
|
-
|
901
|
-
valueHolder.value = value;
|
903
|
+
valueHolder.value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
902
904
|
}
|
903
905
|
/**
|
904
906
|
* `modifySourceData` hook callback.
|
@@ -918,14 +920,9 @@ function _onModifySourceData(row, columnOrProp, valueHolder, ioMode) {
|
|
918
920
|
if (visualRow === null || visualColumn === null) {
|
919
921
|
return;
|
920
922
|
}
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
if (!isFormulaCellType) {
|
925
|
-
const cellType = this.getCellType(visualRow, visualColumn);
|
926
|
-
if (cellType !== 'ARRAY') {
|
927
|
-
return;
|
928
|
-
}
|
923
|
+
const cellType = this.getCellType(visualRow, visualColumn);
|
924
|
+
if (cellType === 'VALUE' || cellType === 'EMPTY') {
|
925
|
+
return;
|
929
926
|
}
|
930
927
|
const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
|
931
928
|
|
@@ -1234,7 +1231,7 @@ function _onEngineSheetAdded(addedSheetDisplayName) {
|
|
1234
1231
|
* @param {string} newDisplayName The new name of the sheet.
|
1235
1232
|
*/
|
1236
1233
|
function _onEngineSheetRenamed(oldDisplayName, newDisplayName) {
|
1237
|
-
this.
|
1234
|
+
_assertClassBrand(_Formulas_brand, this, _updateSheetNameAndSheetId).call(this, newDisplayName);
|
1238
1235
|
this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
|
1239
1236
|
}
|
1240
1237
|
/**
|
@@ -118,7 +118,11 @@ class AxisSyncer {
|
|
118
118
|
getHfIndexFromVisualIndex(visualIndex) {
|
119
119
|
const indexesSequence = _classPrivateFieldGet(_indexMapper, this).getIndexesSequence();
|
120
120
|
const notTrimmedIndexes = _classPrivateFieldGet(_indexMapper, this).getNotTrimmedIndexes();
|
121
|
-
|
121
|
+
|
122
|
+
// Optimization:
|
123
|
+
// notTrimmedIndexes is a subset of indexesSequence,
|
124
|
+
// so for every x indexesSequence.indexOf(x) is always >= notTrimmedIndexes.indexOf(x)
|
125
|
+
return indexesSequence.indexOf(notTrimmedIndexes[visualIndex], visualIndex);
|
122
126
|
}
|
123
127
|
|
124
128
|
/**
|
@@ -115,7 +115,11 @@ class AxisSyncer {
|
|
115
115
|
getHfIndexFromVisualIndex(visualIndex) {
|
116
116
|
const indexesSequence = _classPrivateFieldGet(_indexMapper, this).getIndexesSequence();
|
117
117
|
const notTrimmedIndexes = _classPrivateFieldGet(_indexMapper, this).getNotTrimmedIndexes();
|
118
|
-
|
118
|
+
|
119
|
+
// Optimization:
|
120
|
+
// notTrimmedIndexes is a subset of indexesSequence,
|
121
|
+
// so for every x indexesSequence.indexOf(x) is always >= notTrimmedIndexes.indexOf(x)
|
122
|
+
return indexesSequence.indexOf(notTrimmedIndexes[visualIndex], visualIndex);
|
119
123
|
}
|
120
124
|
|
121
125
|
/**
|
@@ -231,8 +231,8 @@ class HiddenColumns extends _base.BasePlugin {
|
|
231
231
|
* Disables the plugin functionality for this Handsontable instance.
|
232
232
|
*/
|
233
233
|
disablePlugin() {
|
234
|
-
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
235
234
|
super.disablePlugin();
|
235
|
+
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
236
236
|
this.resetCellsMeta();
|
237
237
|
}
|
238
238
|
|
@@ -227,8 +227,8 @@ export class HiddenColumns extends BasePlugin {
|
|
227
227
|
* Disables the plugin functionality for this Handsontable instance.
|
228
228
|
*/
|
229
229
|
disablePlugin() {
|
230
|
-
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
231
230
|
super.disablePlugin();
|
231
|
+
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
232
232
|
this.resetCellsMeta();
|
233
233
|
}
|
234
234
|
|
@@ -231,8 +231,8 @@ class HiddenRows extends _base.BasePlugin {
|
|
231
231
|
* Disables the plugin functionality for this Handsontable instance.
|
232
232
|
*/
|
233
233
|
disablePlugin() {
|
234
|
-
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
235
234
|
super.disablePlugin();
|
235
|
+
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
236
236
|
this.resetCellsMeta();
|
237
237
|
}
|
238
238
|
|
@@ -227,8 +227,8 @@ export class HiddenRows extends BasePlugin {
|
|
227
227
|
* Disables the plugin functionality for this Handsontable instance.
|
228
228
|
*/
|
229
229
|
disablePlugin() {
|
230
|
-
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
231
230
|
super.disablePlugin();
|
231
|
+
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
232
232
|
this.resetCellsMeta();
|
233
233
|
}
|
234
234
|
|
@@ -341,12 +341,12 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
341
341
|
setupGuidePosition() {
|
342
342
|
const handleHeight = parseInt((0, _element.outerHeight)(_classPrivateFieldGet(_handle, this)), 10);
|
343
343
|
const handleBottomPosition = parseInt(_classPrivateFieldGet(_handle, this).style.top, 10) + handleHeight;
|
344
|
-
const
|
344
|
+
const tableHeight = this.hot.view.getTableHeight();
|
345
345
|
(0, _element.addClass)(_classPrivateFieldGet(_handle, this), 'active');
|
346
346
|
(0, _element.addClass)(_classPrivateFieldGet(_guide, this), 'active');
|
347
347
|
_classPrivateFieldGet(_guide, this).style.top = `${handleBottomPosition}px`;
|
348
348
|
this.refreshGuidePosition();
|
349
|
-
_classPrivateFieldGet(_guide, this).style.height = `${
|
349
|
+
_classPrivateFieldGet(_guide, this).style.height = `${tableHeight - handleHeight}px`;
|
350
350
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
351
351
|
}
|
352
352
|
|
@@ -417,8 +417,7 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
417
417
|
*/
|
418
418
|
afterMouseDownTimeout() {
|
419
419
|
const render = () => {
|
420
|
-
this.hot.
|
421
|
-
this.hot.view.render(); // updates all
|
420
|
+
this.hot.render();
|
422
421
|
this.hot.view.adjustElementsSize();
|
423
422
|
};
|
424
423
|
const resize = (column, forceRender) => {
|
@@ -578,8 +577,7 @@ function _onMouseMove(event) {
|
|
578
577
|
*/
|
579
578
|
function _onMouseUp() {
|
580
579
|
const render = () => {
|
581
|
-
this.hot.
|
582
|
-
this.hot.view.render(); // updates all
|
580
|
+
this.hot.render();
|
583
581
|
this.hot.view.adjustElementsSize();
|
584
582
|
};
|
585
583
|
const resize = (column, forceRender) => {
|
@@ -336,12 +336,12 @@ export class ManualColumnResize extends BasePlugin {
|
|
336
336
|
setupGuidePosition() {
|
337
337
|
const handleHeight = parseInt(outerHeight(_classPrivateFieldGet(_handle, this)), 10);
|
338
338
|
const handleBottomPosition = parseInt(_classPrivateFieldGet(_handle, this).style.top, 10) + handleHeight;
|
339
|
-
const
|
339
|
+
const tableHeight = this.hot.view.getTableHeight();
|
340
340
|
addClass(_classPrivateFieldGet(_handle, this), 'active');
|
341
341
|
addClass(_classPrivateFieldGet(_guide, this), 'active');
|
342
342
|
_classPrivateFieldGet(_guide, this).style.top = `${handleBottomPosition}px`;
|
343
343
|
this.refreshGuidePosition();
|
344
|
-
_classPrivateFieldGet(_guide, this).style.height = `${
|
344
|
+
_classPrivateFieldGet(_guide, this).style.height = `${tableHeight - handleHeight}px`;
|
345
345
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
346
346
|
}
|
347
347
|
|
@@ -412,8 +412,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
412
412
|
*/
|
413
413
|
afterMouseDownTimeout() {
|
414
414
|
const render = () => {
|
415
|
-
this.hot.
|
416
|
-
this.hot.view.render(); // updates all
|
415
|
+
this.hot.render();
|
417
416
|
this.hot.view.adjustElementsSize();
|
418
417
|
};
|
419
418
|
const resize = (column, forceRender) => {
|
@@ -572,8 +571,7 @@ function _onMouseMove(event) {
|
|
572
571
|
*/
|
573
572
|
function _onMouseUp() {
|
574
573
|
const render = () => {
|
575
|
-
this.hot.
|
576
|
-
this.hot.view.render(); // updates all
|
574
|
+
this.hot.render();
|
577
575
|
this.hot.view.adjustElementsSize();
|
578
576
|
};
|
579
577
|
const resize = (column, forceRender) => {
|
@@ -328,12 +328,12 @@ class ManualRowResize extends _base.BasePlugin {
|
|
328
328
|
setupGuidePosition() {
|
329
329
|
const handleWidth = parseInt((0, _element.outerWidth)(_classPrivateFieldGet(_handle, this)), 10);
|
330
330
|
const handleEndPosition = parseInt(_classPrivateFieldGet(_handle, this).style[this.inlineDir], 10) + handleWidth;
|
331
|
-
const
|
331
|
+
const tableWidth = this.hot.view.getTableWidth();
|
332
332
|
(0, _element.addClass)(_classPrivateFieldGet(_handle, this), 'active');
|
333
333
|
(0, _element.addClass)(_classPrivateFieldGet(_guide, this), 'active');
|
334
334
|
_classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;
|
335
335
|
_classPrivateFieldGet(_guide, this).style[this.inlineDir] = `${handleEndPosition}px`;
|
336
|
-
_classPrivateFieldGet(_guide, this).style.width = `${
|
336
|
+
_classPrivateFieldGet(_guide, this).style.width = `${tableWidth - handleWidth}px`;
|
337
337
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
338
338
|
}
|
339
339
|
|
@@ -414,8 +414,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
414
414
|
*/
|
415
415
|
afterMouseDownTimeout() {
|
416
416
|
const render = () => {
|
417
|
-
this.hot.
|
418
|
-
this.hot.view.render(); // updates all
|
417
|
+
this.hot.render();
|
419
418
|
this.hot.view.adjustElementsSize();
|
420
419
|
};
|
421
420
|
const resize = (row, forceRender) => {
|
@@ -543,8 +542,7 @@ function _onMouseMove(event) {
|
|
543
542
|
*/
|
544
543
|
function _onMouseUp() {
|
545
544
|
const render = () => {
|
546
|
-
this.hot.
|
547
|
-
this.hot.view.render(); // updates all
|
545
|
+
this.hot.render();
|
548
546
|
this.hot.view.adjustElementsSize();
|
549
547
|
};
|
550
548
|
const runHooks = (row, forceRender) => {
|
@@ -323,12 +323,12 @@ export class ManualRowResize extends BasePlugin {
|
|
323
323
|
setupGuidePosition() {
|
324
324
|
const handleWidth = parseInt(outerWidth(_classPrivateFieldGet(_handle, this)), 10);
|
325
325
|
const handleEndPosition = parseInt(_classPrivateFieldGet(_handle, this).style[this.inlineDir], 10) + handleWidth;
|
326
|
-
const
|
326
|
+
const tableWidth = this.hot.view.getTableWidth();
|
327
327
|
addClass(_classPrivateFieldGet(_handle, this), 'active');
|
328
328
|
addClass(_classPrivateFieldGet(_guide, this), 'active');
|
329
329
|
_classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;
|
330
330
|
_classPrivateFieldGet(_guide, this).style[this.inlineDir] = `${handleEndPosition}px`;
|
331
|
-
_classPrivateFieldGet(_guide, this).style.width = `${
|
331
|
+
_classPrivateFieldGet(_guide, this).style.width = `${tableWidth - handleWidth}px`;
|
332
332
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
333
333
|
}
|
334
334
|
|
@@ -409,8 +409,7 @@ export class ManualRowResize extends BasePlugin {
|
|
409
409
|
*/
|
410
410
|
afterMouseDownTimeout() {
|
411
411
|
const render = () => {
|
412
|
-
this.hot.
|
413
|
-
this.hot.view.render(); // updates all
|
412
|
+
this.hot.render();
|
414
413
|
this.hot.view.adjustElementsSize();
|
415
414
|
};
|
416
415
|
const resize = (row, forceRender) => {
|
@@ -537,8 +536,7 @@ function _onMouseMove(event) {
|
|
537
536
|
*/
|
538
537
|
function _onMouseUp() {
|
539
538
|
const render = () => {
|
540
|
-
this.hot.
|
541
|
-
this.hot.view.render(); // updates all
|
539
|
+
this.hot.render();
|
542
540
|
this.hot.view.adjustElementsSize();
|
543
541
|
};
|
544
542
|
const runHooks = (row, forceRender) => {
|
@@ -30,6 +30,7 @@ var _element = require("../../helpers/dom/element");
|
|
30
30
|
var _browser = require("../../helpers/browser");
|
31
31
|
var _focusOrder2 = require("./focusOrder");
|
32
32
|
var _renderer = require("./renderer");
|
33
|
+
var _utils = require("./utils");
|
33
34
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
34
35
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
35
36
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
@@ -432,7 +433,8 @@ class MergeCells extends _base.BasePlugin {
|
|
432
433
|
// Asynchronously revert the TRs' `background` property to force a fresh repaint.
|
433
434
|
this.hot._registerTimeout(() => {
|
434
435
|
rowsToRefresh.forEach(rowElement => {
|
435
|
-
|
436
|
+
var _getStyle;
|
437
|
+
rowElement.style.background = (_getStyle = (0, _element.getStyle)(rowElement, 'backgroundColor')) === null || _getStyle === void 0 ? void 0 : _getStyle.replace(', 0.99)', ')');
|
436
438
|
});
|
437
439
|
}, 1);
|
438
440
|
}
|
@@ -666,8 +668,12 @@ class MergeCells extends _base.BasePlugin {
|
|
666
668
|
* @param {CellRange} cellRange The cell range to merge or unmerged.
|
667
669
|
*/
|
668
670
|
toggleMerge(cellRange) {
|
669
|
-
const
|
670
|
-
|
671
|
+
const {
|
672
|
+
from,
|
673
|
+
to
|
674
|
+
} = cellRange.clone().normalize();
|
675
|
+
const mergedCell = this.mergedCellsCollection.get(from.row, from.col);
|
676
|
+
const mergedCellCoversWholeRange = mergedCell.row === from.row && mergedCell.col === from.col && mergedCell.row + mergedCell.rowspan - 1 === to.row && mergedCell.col + mergedCell.colspan - 1 === to.col;
|
671
677
|
if (mergedCellCoversWholeRange) {
|
672
678
|
this.unmergeRange(cellRange);
|
673
679
|
} else {
|
@@ -1479,33 +1485,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1479
1485
|
} else {
|
1480
1486
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
1481
1487
|
}
|
1482
|
-
height = Math.max(height !== null && height !== void 0 ? height : 0,
|
1488
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, (0, _utils.sumCellsHeights)(this.hot, row, rowspanAfterCorrection));
|
1483
1489
|
});
|
1484
1490
|
return height;
|
1485
|
-
}
|
1486
|
-
/**
|
1487
|
-
* Sums the heights of the all cells that the merge cell consists of.
|
1488
|
-
*
|
1489
|
-
* @param {number} row The visual row index of the merged cell.
|
1490
|
-
* @param {number} rowspan The rowspan value of the merged cell.
|
1491
|
-
* @returns {number}
|
1492
|
-
*/
|
1493
|
-
function _sumCellsHeights(row, rowspan) {
|
1494
|
-
const {
|
1495
|
-
view,
|
1496
|
-
rowIndexMapper
|
1497
|
-
} = this.hot;
|
1498
|
-
const stylesHandler = view.getStylesHandler();
|
1499
|
-
const defaultHeight = view.getDefaultRowHeight();
|
1500
|
-
let height = 0;
|
1501
|
-
for (let i = row; i < row + rowspan; i++) {
|
1502
|
-
if (!rowIndexMapper.isHidden(i)) {
|
1503
|
-
var _this$hot$getRowHeigh;
|
1504
|
-
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
1505
|
-
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1506
|
-
height += 1; // border-top-width
|
1507
|
-
}
|
1508
|
-
}
|
1509
|
-
}
|
1510
|
-
return height;
|
1511
1491
|
}
|
@@ -36,6 +36,7 @@ import { getStyle } from "../../helpers/dom/element.mjs";
|
|
36
36
|
import { isChrome } from "../../helpers/browser.mjs";
|
37
37
|
import { FocusOrder } from "./focusOrder.mjs";
|
38
38
|
import { createMergeCellRenderer } from "./renderer.mjs";
|
39
|
+
import { sumCellsHeights } from "./utils.mjs";
|
39
40
|
Hooks.getSingleton().register('beforeMergeCells');
|
40
41
|
Hooks.getSingleton().register('afterMergeCells');
|
41
42
|
Hooks.getSingleton().register('beforeUnmergeCells');
|
@@ -428,7 +429,8 @@ export class MergeCells extends BasePlugin {
|
|
428
429
|
// Asynchronously revert the TRs' `background` property to force a fresh repaint.
|
429
430
|
this.hot._registerTimeout(() => {
|
430
431
|
rowsToRefresh.forEach(rowElement => {
|
431
|
-
|
432
|
+
var _getStyle;
|
433
|
+
rowElement.style.background = (_getStyle = getStyle(rowElement, 'backgroundColor')) === null || _getStyle === void 0 ? void 0 : _getStyle.replace(', 0.99)', ')');
|
432
434
|
});
|
433
435
|
}, 1);
|
434
436
|
}
|
@@ -662,8 +664,12 @@ export class MergeCells extends BasePlugin {
|
|
662
664
|
* @param {CellRange} cellRange The cell range to merge or unmerged.
|
663
665
|
*/
|
664
666
|
toggleMerge(cellRange) {
|
665
|
-
const
|
666
|
-
|
667
|
+
const {
|
668
|
+
from,
|
669
|
+
to
|
670
|
+
} = cellRange.clone().normalize();
|
671
|
+
const mergedCell = this.mergedCellsCollection.get(from.row, from.col);
|
672
|
+
const mergedCellCoversWholeRange = mergedCell.row === from.row && mergedCell.col === from.col && mergedCell.row + mergedCell.rowspan - 1 === to.row && mergedCell.col + mergedCell.colspan - 1 === to.col;
|
667
673
|
if (mergedCellCoversWholeRange) {
|
668
674
|
this.unmergeRange(cellRange);
|
669
675
|
} else {
|
@@ -1474,33 +1480,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1474
1480
|
} else {
|
1475
1481
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
1476
1482
|
}
|
1477
|
-
height = Math.max(height !== null && height !== void 0 ? height : 0,
|
1483
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, sumCellsHeights(this.hot, row, rowspanAfterCorrection));
|
1478
1484
|
});
|
1479
1485
|
return height;
|
1480
|
-
}
|
1481
|
-
/**
|
1482
|
-
* Sums the heights of the all cells that the merge cell consists of.
|
1483
|
-
*
|
1484
|
-
* @param {number} row The visual row index of the merged cell.
|
1485
|
-
* @param {number} rowspan The rowspan value of the merged cell.
|
1486
|
-
* @returns {number}
|
1487
|
-
*/
|
1488
|
-
function _sumCellsHeights(row, rowspan) {
|
1489
|
-
const {
|
1490
|
-
view,
|
1491
|
-
rowIndexMapper
|
1492
|
-
} = this.hot;
|
1493
|
-
const stylesHandler = view.getStylesHandler();
|
1494
|
-
const defaultHeight = view.getDefaultRowHeight();
|
1495
|
-
let height = 0;
|
1496
|
-
for (let i = row; i < row + rowspan; i++) {
|
1497
|
-
if (!rowIndexMapper.isHidden(i)) {
|
1498
|
-
var _this$hot$getRowHeigh;
|
1499
|
-
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
1500
|
-
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1501
|
-
height += 1; // border-top-width
|
1502
|
-
}
|
1503
|
-
}
|
1504
|
-
}
|
1505
|
-
return height;
|
1506
1486
|
}
|
@@ -3,6 +3,8 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.createMergeCellRenderer = createMergeCellRenderer;
|
5
5
|
var _object = require("../../helpers/object");
|
6
|
+
var _browser = require("../../helpers/browser");
|
7
|
+
var _utils = require("./utils");
|
6
8
|
/**
|
7
9
|
* Creates a renderer object for the `MergeCells` plugin.
|
8
10
|
*
|
@@ -18,6 +20,7 @@ function createMergeCellRenderer(plugin) {
|
|
18
20
|
rowIndexMapper: rowMapper,
|
19
21
|
columnIndexMapper: columnMapper
|
20
22
|
} = hot;
|
23
|
+
const updateNextCellsHeight = new Map();
|
21
24
|
|
22
25
|
/**
|
23
26
|
* Runs before the cell is rendered.
|
@@ -39,6 +42,10 @@ function createMergeCellRenderer(plugin) {
|
|
39
42
|
if (!(0, _object.isObject)(mergedCell)) {
|
40
43
|
TD.removeAttribute('rowspan');
|
41
44
|
TD.removeAttribute('colspan');
|
45
|
+
if ((0, _browser.isSafari)() && updateNextCellsHeight.has(row) && !hot.getSettings().rowHeaders) {
|
46
|
+
TD.style.height = `${updateNextCellsHeight.get(row)}px`;
|
47
|
+
updateNextCellsHeight.delete(row);
|
48
|
+
}
|
42
49
|
TD.style.display = '';
|
43
50
|
return;
|
44
51
|
}
|
@@ -50,6 +57,14 @@ function createMergeCellRenderer(plugin) {
|
|
50
57
|
} = mergedCell;
|
51
58
|
const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
|
52
59
|
const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
|
60
|
+
|
61
|
+
// Safari bug fix - the height of the cells next to the merged cell must be defined
|
62
|
+
// so that their height is proportional to the height of the merged cell
|
63
|
+
// (this emulates default behavior in Chrome, FF etc.)
|
64
|
+
if ((0, _browser.isSafari)() && origColumn === 0 && !hot.getSettings().rowHeaders) {
|
65
|
+
const height = (0, _utils.sumCellsHeights)(hot, origRow, origRowspan);
|
66
|
+
updateNextCellsHeight.set(row, height / origRowspan);
|
67
|
+
}
|
53
68
|
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
54
69
|
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
55
70
|
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|