handsontable 0.0.0-next-51c871a-20230412 → 0.0.0-next-931651e-20230412
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/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1417 -1240
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +97 -97
- package/dist/handsontable.js +772 -595
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/formulas/engine/register.js +9 -0
- package/plugins/formulas/engine/register.mjs +13 -4
- package/plugins/formulas/engine/settings.js +4 -3
- package/plugins/formulas/engine/settings.mjs +3 -3
- package/plugins/formulas/formulas.js +118 -31
- package/plugins/formulas/formulas.mjs +119 -32
- package/plugins/formulas/utils.js +81 -0
- package/plugins/formulas/utils.mjs +74 -0
package/helpers/mixed.js
CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
|
|
152
152
|
function _injectProductInfo(key, element) {
|
153
153
|
var hasValidType = !isEmpty(key);
|
154
154
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
155
|
-
var hotVersion = "0.0.0-next-
|
155
|
+
var hotVersion = "0.0.0-next-931651e-20230412";
|
156
156
|
var keyValidityDate;
|
157
157
|
var consoleMessageState = 'invalid';
|
158
158
|
var domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
|
|
142
142
|
export function _injectProductInfo(key, element) {
|
143
143
|
var hasValidType = !isEmpty(key);
|
144
144
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
145
|
-
var hotVersion = "0.0.0-next-
|
145
|
+
var hotVersion = "0.0.0-next-931651e-20230412";
|
146
146
|
var keyValidityDate;
|
147
147
|
var consoleMessageState = 'invalid';
|
148
148
|
var 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-931651e-20230412",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require("core-js/modules/es.symbol.js");
|
4
4
|
require("core-js/modules/es.symbol.description.js");
|
5
5
|
require("core-js/modules/es.symbol.iterator.js");
|
6
|
+
require("core-js/modules/es.array.slice.js");
|
7
|
+
require("core-js/modules/es.object.freeze.js");
|
6
8
|
exports.__esModule = true;
|
7
9
|
exports.getRegisteredHotInstances = getRegisteredHotInstances;
|
8
10
|
exports.registerCustomFunctions = registerCustomFunctions;
|
@@ -27,10 +29,14 @@ require("core-js/modules/web.dom-collections.for-each.js");
|
|
27
29
|
require("core-js/modules/es.function.name.js");
|
28
30
|
var _staticRegister = _interopRequireDefault(require("../../../utils/staticRegister"));
|
29
31
|
var _mixed = require("../../../helpers/mixed");
|
32
|
+
var _templateLiteralTag = require("../../../helpers/templateLiteralTag");
|
30
33
|
var _console = require("../../../helpers/console");
|
34
|
+
var _object = require("../../../helpers/object");
|
31
35
|
var _formulas = require("../formulas");
|
32
36
|
var _settings = require("./settings");
|
37
|
+
var _templateObject;
|
33
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
39
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
34
40
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
35
41
|
/**
|
36
42
|
* Prepares and returns the collection for the engine relationship with the HoT instances.
|
@@ -99,6 +105,9 @@ function setupEngine(hotInstance) {
|
|
99
105
|
licenseKey: _settings.DEFAULT_LICENSE_KEY
|
100
106
|
});
|
101
107
|
}
|
108
|
+
if (engineConfigItem.getConfig().leapYear1900 !== _settings.DEFAULT_SETTINGS.leapYear1900 || (0, _object.isObjectEqual)(engineConfigItem.getConfig().nullDate, _settings.DEFAULT_SETTINGS.nullDate) === false) {
|
109
|
+
(0, _console.warn)((0, _templateLiteralTag.toSingleLine)(_templateObject || (_templateObject = _taggedTemplateLiteral(["If you use HyperFormula with Handsontable, keep the default `leapYear1900` and `nullDate` \n settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates."], ["If you use HyperFormula with Handsontable, keep the default \\`leapYear1900\\` and \\`nullDate\\` \n settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates."]))));
|
110
|
+
}
|
102
111
|
return engineConfigItem;
|
103
112
|
}
|
104
113
|
return null;
|
@@ -1,3 +1,10 @@
|
|
1
|
+
import "core-js/modules/es.symbol.js";
|
2
|
+
import "core-js/modules/es.symbol.description.js";
|
3
|
+
import "core-js/modules/es.symbol.iterator.js";
|
4
|
+
import "core-js/modules/es.array.slice.js";
|
5
|
+
import "core-js/modules/es.object.freeze.js";
|
6
|
+
var _templateObject;
|
7
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
1
8
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
9
|
import "core-js/modules/es.array.iterator.js";
|
3
10
|
import "core-js/modules/es.map.js";
|
@@ -12,14 +19,13 @@ import "core-js/modules/es.array.splice.js";
|
|
12
19
|
import "core-js/modules/es.array.index-of.js";
|
13
20
|
import "core-js/modules/web.dom-collections.for-each.js";
|
14
21
|
import "core-js/modules/es.function.name.js";
|
15
|
-
import "core-js/modules/es.symbol.js";
|
16
|
-
import "core-js/modules/es.symbol.description.js";
|
17
|
-
import "core-js/modules/es.symbol.iterator.js";
|
18
22
|
import staticRegister from "../../../utils/staticRegister.mjs";
|
19
23
|
import { isUndefined } from "../../../helpers/mixed.mjs";
|
24
|
+
import { toSingleLine } from "../../../helpers/templateLiteralTag.mjs";
|
20
25
|
import { warn } from "../../../helpers/console.mjs";
|
26
|
+
import { isObjectEqual } from "../../../helpers/object.mjs";
|
21
27
|
import { PLUGIN_KEY } from "../formulas.mjs";
|
22
|
-
import { DEFAULT_LICENSE_KEY, getEngineSettingsWithDefaultsAndOverrides } from "./settings.mjs";
|
28
|
+
import { DEFAULT_LICENSE_KEY, DEFAULT_SETTINGS, getEngineSettingsWithDefaultsAndOverrides } from "./settings.mjs";
|
23
29
|
/**
|
24
30
|
* Prepares and returns the collection for the engine relationship with the HoT instances.
|
25
31
|
*
|
@@ -87,6 +93,9 @@ export function setupEngine(hotInstance) {
|
|
87
93
|
licenseKey: DEFAULT_LICENSE_KEY
|
88
94
|
});
|
89
95
|
}
|
96
|
+
if (engineConfigItem.getConfig().leapYear1900 !== DEFAULT_SETTINGS.leapYear1900 || isObjectEqual(engineConfigItem.getConfig().nullDate, DEFAULT_SETTINGS.nullDate) === false) {
|
97
|
+
warn(toSingleLine(_templateObject || (_templateObject = _taggedTemplateLiteral(["If you use HyperFormula with Handsontable, keep the default `leapYear1900` and `nullDate` \n settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates."], ["If you use HyperFormula with Handsontable, keep the default \\`leapYear1900\\` and \\`nullDate\\` \n settings. Otherwise, HyperFormula's dates may not sync correctly with Handsontable's dates."]))));
|
98
|
+
}
|
90
99
|
return engineConfigItem;
|
91
100
|
}
|
92
101
|
return null;
|
@@ -15,7 +15,7 @@ require("core-js/modules/es.string.iterator.js");
|
|
15
15
|
require("core-js/modules/web.dom-collections.iterator.js");
|
16
16
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
17
17
|
exports.__esModule = true;
|
18
|
-
exports.DEFAULT_LICENSE_KEY = void 0;
|
18
|
+
exports.DEFAULT_SETTINGS = exports.DEFAULT_LICENSE_KEY = void 0;
|
19
19
|
exports.getEngineSettingsOverrides = getEngineSettingsOverrides;
|
20
20
|
exports.getEngineSettingsWithDefaultsAndOverrides = getEngineSettingsWithDefaultsAndOverrides;
|
21
21
|
exports.getEngineSettingsWithOverrides = getEngineSettingsWithOverrides;
|
@@ -39,11 +39,11 @@ var DEFAULT_SETTINGS = {
|
|
39
39
|
precisionEpsilon: 1e-13,
|
40
40
|
precisionRounding: 14,
|
41
41
|
smartRounding: true,
|
42
|
-
leapYear1900:
|
42
|
+
leapYear1900: false,
|
43
43
|
nullDate: {
|
44
44
|
year: 1899,
|
45
45
|
month: 12,
|
46
|
-
day:
|
46
|
+
day: 30
|
47
47
|
},
|
48
48
|
nullYear: 30,
|
49
49
|
dateFormats: ['DD/MM/YYYY', 'DD/MM/YY'],
|
@@ -63,6 +63,7 @@ var DEFAULT_SETTINGS = {
|
|
63
63
|
* @param {object} hotSettings Handsontable settings object.
|
64
64
|
* @returns {object} Object containing the overriding options.
|
65
65
|
*/
|
66
|
+
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
66
67
|
function getEngineSettingsOverrides(hotSettings) {
|
67
68
|
var _hotSettings$PLUGIN_K, _hotSettings$PLUGIN_K2;
|
68
69
|
return {
|
@@ -22,7 +22,7 @@ import "core-js/modules/es.string.iterator.js";
|
|
22
22
|
import "core-js/modules/web.dom-collections.iterator.js";
|
23
23
|
import { PLUGIN_KEY } from "../formulas.mjs";
|
24
24
|
export var DEFAULT_LICENSE_KEY = 'internal-use-in-handsontable';
|
25
|
-
var DEFAULT_SETTINGS = {
|
25
|
+
export var DEFAULT_SETTINGS = {
|
26
26
|
licenseKey: DEFAULT_LICENSE_KEY,
|
27
27
|
useArrayArithmetic: true,
|
28
28
|
useColumnIndex: false,
|
@@ -31,11 +31,11 @@ var DEFAULT_SETTINGS = {
|
|
31
31
|
precisionEpsilon: 1e-13,
|
32
32
|
precisionRounding: 14,
|
33
33
|
smartRounding: true,
|
34
|
-
leapYear1900:
|
34
|
+
leapYear1900: false,
|
35
35
|
nullDate: {
|
36
36
|
year: 1899,
|
37
37
|
month: 12,
|
38
|
-
day:
|
38
|
+
day: 30
|
39
39
|
},
|
40
40
|
nullYear: 30,
|
41
41
|
dateFormats: ['DD/MM/YYYY', 'DD/MM/YY'],
|
@@ -11,7 +11,6 @@ require("core-js/modules/es.reflect.construct.js");
|
|
11
11
|
require("core-js/modules/es.reflect.get.js");
|
12
12
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
13
13
|
require("core-js/modules/es.symbol.iterator.js");
|
14
|
-
require("core-js/modules/es.array.slice.js");
|
15
14
|
require("core-js/modules/es.function.name.js");
|
16
15
|
require("core-js/modules/es.array.from.js");
|
17
16
|
require("core-js/modules/es.regexp.exec.js");
|
@@ -28,6 +27,8 @@ require("core-js/modules/es.set.js");
|
|
28
27
|
require("core-js/modules/es.string.iterator.js");
|
29
28
|
require("core-js/modules/web.dom-collections.iterator.js");
|
30
29
|
require("core-js/modules/es.array.map.js");
|
30
|
+
require("core-js/modules/es.string.starts-with.js");
|
31
|
+
require("core-js/modules/es.array.slice.js");
|
31
32
|
require("core-js/modules/es.array.includes.js");
|
32
33
|
require("core-js/modules/es.string.includes.js");
|
33
34
|
require("core-js/modules/es.array.reverse.js");
|
@@ -298,6 +299,13 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
298
299
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
299
300
|
});
|
300
301
|
|
302
|
+
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
303
|
+
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
304
|
+
// Another hooks are triggered to late for setting HF's engine data needed for some actions.
|
305
|
+
this.addHook('afterCellMetaReset', function () {
|
306
|
+
return _this8.onAfterCellMetaReset.apply(_this8, arguments);
|
307
|
+
});
|
308
|
+
|
301
309
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
302
310
|
this.addHook('beforeUndo', function (action) {
|
303
311
|
// TODO: Move action isn't handled by HyperFormula.
|
@@ -666,6 +674,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
666
674
|
(0, _console.warn)("Not possible to set cell data at ".concat(JSON.stringify(address)));
|
667
675
|
return;
|
668
676
|
}
|
677
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
678
|
+
if ((0, _utils.isDate)(newValue, cellMeta.type)) {
|
679
|
+
if ((0, _utils.isDateValid)(newValue, cellMeta.dateFormat)) {
|
680
|
+
// Rewriting date in HOT format to HF format.
|
681
|
+
newValue = (0, _utils.getDateInHfFormat)(newValue, cellMeta.dateFormat);
|
682
|
+
} else if ((0, _utils.isFormula)(newValue) === false) {
|
683
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
684
|
+
newValue = "'".concat(newValue);
|
685
|
+
}
|
686
|
+
}
|
669
687
|
return this.engine.setCellContents(address, newValue);
|
670
688
|
}
|
671
689
|
|
@@ -689,7 +707,12 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
689
707
|
col: this.hot.toPhysicalColumn(visualColumn),
|
690
708
|
sheet: this.sheetId
|
691
709
|
};
|
692
|
-
var
|
710
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
711
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
712
|
+
|
713
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
714
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
715
|
+
}
|
693
716
|
|
694
717
|
// If `cellValue` is an object it is expected to be an error
|
695
718
|
return _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -730,7 +753,33 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
730
753
|
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
731
754
|
return false;
|
732
755
|
}
|
733
|
-
|
756
|
+
var fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
|
757
|
+
var _engineSourceRange$st = engineSourceRange.start,
|
758
|
+
sourceStartRow = _engineSourceRange$st.row,
|
759
|
+
sourceStartColumn = _engineSourceRange$st.col;
|
760
|
+
var _engineSourceRange$en = engineSourceRange.end,
|
761
|
+
sourceEndRow = _engineSourceRange$en.row,
|
762
|
+
sourceEndColumn = _engineSourceRange$en.col;
|
763
|
+
var populationRowLength = sourceEndRow - sourceStartRow + 1;
|
764
|
+
var populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
|
765
|
+
for (var populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
|
766
|
+
for (var populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
|
767
|
+
var populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
|
768
|
+
var sourceRow = populatedRowIndex % populationRowLength;
|
769
|
+
var sourceColumn = populatedColumnIndex % populationColumnLength;
|
770
|
+
var sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
|
771
|
+
if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
|
772
|
+
if (populatedValue.startsWith('\'')) {
|
773
|
+
// Populating values on HOT side without apostrophe.
|
774
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
|
775
|
+
} else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
|
776
|
+
// Populating date in proper format, coming from the source cell.
|
777
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
|
778
|
+
}
|
779
|
+
}
|
780
|
+
}
|
781
|
+
}
|
782
|
+
return fillRangeData;
|
734
783
|
}
|
735
784
|
|
736
785
|
/**
|
@@ -754,6 +803,40 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
754
803
|
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
|
755
804
|
}
|
756
805
|
|
806
|
+
/**
|
807
|
+
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
808
|
+
*
|
809
|
+
* @private
|
810
|
+
*/
|
811
|
+
}, {
|
812
|
+
key: "onAfterCellMetaReset",
|
813
|
+
value: function onAfterCellMetaReset() {
|
814
|
+
var _this14 = this;
|
815
|
+
var sourceDataArray = this.hot.getSourceDataArray();
|
816
|
+
var valueChanged = false;
|
817
|
+
sourceDataArray.forEach(function (rowData, rowIndex) {
|
818
|
+
rowData.forEach(function (cellValue, columnIndex) {
|
819
|
+
var cellMeta = _this14.hot.getCellMeta(rowIndex, columnIndex);
|
820
|
+
var dateFormat = cellMeta.dateFormat;
|
821
|
+
if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
|
822
|
+
valueChanged = true;
|
823
|
+
if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
|
824
|
+
// Rewriting date in HOT format to HF format.
|
825
|
+
sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
|
826
|
+
} else if (_this14.isFormulaCellType(rowIndex, columnIndex) === false) {
|
827
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
828
|
+
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
829
|
+
}
|
830
|
+
}
|
831
|
+
});
|
832
|
+
});
|
833
|
+
if (valueChanged === true) {
|
834
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
835
|
+
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
836
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
837
|
+
}
|
838
|
+
}
|
839
|
+
|
757
840
|
/**
|
758
841
|
* `afterLoadData` hook callback.
|
759
842
|
*
|
@@ -774,7 +857,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
774
857
|
var sourceDataArray = this.hot.getSourceDataArray();
|
775
858
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
776
859
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
777
|
-
var dependentCells = this.engine.setSheetContent(this.sheetId,
|
860
|
+
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
778
861
|
this.renderDependentSheets(dependentCells);
|
779
862
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
780
863
|
}
|
@@ -819,7 +902,11 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
819
902
|
col: this.toPhysicalColumnPosition(column),
|
820
903
|
sheet: this.sheetId
|
821
904
|
};
|
822
|
-
var cellValue = this.engine.getCellValue(address);
|
905
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
906
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
907
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
908
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
909
|
+
}
|
823
910
|
|
824
911
|
// If `cellValue` is an object it is expected to be an error
|
825
912
|
var value = _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -882,7 +969,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
882
969
|
}, {
|
883
970
|
key: "onAfterSetDataAtCell",
|
884
971
|
value: function onAfterSetDataAtCell(changes, source) {
|
885
|
-
var
|
972
|
+
var _this15 = this;
|
886
973
|
if (isBlockedSource(source)) {
|
887
974
|
return;
|
888
975
|
}
|
@@ -894,16 +981,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
894
981
|
row = _ref10[0],
|
895
982
|
prop = _ref10[1],
|
896
983
|
newValue = _ref10[3];
|
897
|
-
var column =
|
898
|
-
var physicalRow =
|
899
|
-
var physicalColumn =
|
984
|
+
var column = _this15.hot.propToCol(prop);
|
985
|
+
var physicalRow = _this15.hot.toPhysicalRow(row);
|
986
|
+
var physicalColumn = _this15.hot.toPhysicalColumn(column);
|
900
987
|
var address = {
|
901
988
|
row: physicalRow,
|
902
989
|
col: physicalColumn,
|
903
|
-
sheet:
|
990
|
+
sheet: _this15.sheetId
|
904
991
|
};
|
905
992
|
if (physicalRow !== null && physicalColumn !== null) {
|
906
|
-
|
993
|
+
_this15.syncChangeWithEngine(row, column, newValue);
|
907
994
|
} else {
|
908
995
|
outOfBoundsChanges.push([row, column, newValue]);
|
909
996
|
}
|
@@ -916,16 +1003,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
916
1003
|
// Workaround for rows/columns being created two times (by HOT and the engine).
|
917
1004
|
// (unfortunately, this requires an extra re-render)
|
918
1005
|
this.hot.addHookOnce('afterChange', function () {
|
919
|
-
var outOfBoundsDependentCells =
|
1006
|
+
var outOfBoundsDependentCells = _this15.engine.batch(function () {
|
920
1007
|
outOfBoundsChanges.forEach(function (_ref11) {
|
921
1008
|
var _ref12 = _slicedToArray(_ref11, 3),
|
922
1009
|
row = _ref12[0],
|
923
1010
|
column = _ref12[1],
|
924
1011
|
newValue = _ref12[2];
|
925
|
-
|
1012
|
+
_this15.syncChangeWithEngine(row, column, newValue);
|
926
1013
|
});
|
927
1014
|
});
|
928
|
-
|
1015
|
+
_this15.renderDependentSheets(outOfBoundsDependentCells, true);
|
929
1016
|
});
|
930
1017
|
}
|
931
1018
|
this.renderDependentSheets(dependentCells);
|
@@ -943,7 +1030,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
943
1030
|
}, {
|
944
1031
|
key: "onAfterSetSourceDataAtCell",
|
945
1032
|
value: function onAfterSetSourceDataAtCell(changes, source) {
|
946
|
-
var
|
1033
|
+
var _this16 = this;
|
947
1034
|
if (isBlockedSource(source)) {
|
948
1035
|
return;
|
949
1036
|
}
|
@@ -954,23 +1041,23 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
954
1041
|
row = _ref14[0],
|
955
1042
|
prop = _ref14[1],
|
956
1043
|
newValue = _ref14[3];
|
957
|
-
var column =
|
1044
|
+
var column = _this16.hot.propToCol(prop);
|
958
1045
|
if (!(0, _number.isNumeric)(column)) {
|
959
1046
|
return;
|
960
1047
|
}
|
961
1048
|
var address = {
|
962
1049
|
row: row,
|
963
|
-
col:
|
964
|
-
sheet:
|
1050
|
+
col: _this16.toPhysicalColumnPosition(column),
|
1051
|
+
sheet: _this16.sheetId
|
965
1052
|
};
|
966
|
-
if (!
|
1053
|
+
if (!_this16.engine.isItPossibleToSetCellContents(address)) {
|
967
1054
|
(0, _console.warn)("Not possible to set source cell data at ".concat(JSON.stringify(address)));
|
968
1055
|
return;
|
969
1056
|
}
|
970
1057
|
changedCells.push({
|
971
1058
|
address: address
|
972
1059
|
});
|
973
|
-
dependentCells.push.apply(dependentCells, _toConsumableArray(
|
1060
|
+
dependentCells.push.apply(dependentCells, _toConsumableArray(_this16.engine.setCellContents(address, newValue)));
|
974
1061
|
});
|
975
1062
|
this.renderDependentSheets(dependentCells);
|
976
1063
|
this.validateDependentCells(dependentCells, changedCells);
|
@@ -1020,9 +1107,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1020
1107
|
}, {
|
1021
1108
|
key: "onBeforeRemoveRow",
|
1022
1109
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
1023
|
-
var
|
1110
|
+
var _this17 = this;
|
1024
1111
|
var possible = physicalRows.every(function (physicalRow) {
|
1025
|
-
return
|
1112
|
+
return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
|
1026
1113
|
});
|
1027
1114
|
return possible === false ? false : void 0;
|
1028
1115
|
}
|
@@ -1039,9 +1126,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1039
1126
|
}, {
|
1040
1127
|
key: "onBeforeRemoveCol",
|
1041
1128
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1042
|
-
var
|
1129
|
+
var _this18 = this;
|
1043
1130
|
var possible = physicalColumns.every(function (physicalColumn) {
|
1044
|
-
return
|
1131
|
+
return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
|
1045
1132
|
});
|
1046
1133
|
return possible === false ? false : void 0;
|
1047
1134
|
}
|
@@ -1097,14 +1184,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1097
1184
|
}, {
|
1098
1185
|
key: "onAfterRemoveRow",
|
1099
1186
|
value: function onAfterRemoveRow(row, amount, physicalRows, source) {
|
1100
|
-
var
|
1187
|
+
var _this19 = this;
|
1101
1188
|
if (isBlockedSource(source)) {
|
1102
1189
|
return;
|
1103
1190
|
}
|
1104
1191
|
var descendingPhysicalRows = physicalRows.sort().reverse();
|
1105
1192
|
var changes = this.engine.batch(function () {
|
1106
1193
|
descendingPhysicalRows.forEach(function (physicalRow) {
|
1107
|
-
|
1194
|
+
_this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
|
1108
1195
|
});
|
1109
1196
|
});
|
1110
1197
|
this.renderDependentSheets(changes);
|
@@ -1123,14 +1210,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1123
1210
|
}, {
|
1124
1211
|
key: "onAfterRemoveCol",
|
1125
1212
|
value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
|
1126
|
-
var
|
1213
|
+
var _this20 = this;
|
1127
1214
|
if (isBlockedSource(source)) {
|
1128
1215
|
return;
|
1129
1216
|
}
|
1130
1217
|
var descendingPhysicalColumns = physicalColumns.sort().reverse();
|
1131
1218
|
var changes = this.engine.batch(function () {
|
1132
1219
|
descendingPhysicalColumns.forEach(function (physicalColumn) {
|
1133
|
-
|
1220
|
+
_this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
|
1134
1221
|
});
|
1135
1222
|
});
|
1136
1223
|
this.renderDependentSheets(changes);
|
@@ -1149,16 +1236,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1149
1236
|
key: "onAfterDetachChild",
|
1150
1237
|
value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
|
1151
1238
|
var _element$__children,
|
1152
|
-
|
1239
|
+
_this21 = this;
|
1153
1240
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1154
1241
|
var rowsData = this.hot.getSourceDataArray(finalElementRowIndex, 0, finalElementRowIndex + (((_element$__children = element.__children) === null || _element$__children === void 0 ? void 0 : _element$__children.length) || 0), this.hot.countSourceCols());
|
1155
1242
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1156
1243
|
rowsData.forEach(function (row, relativeRowIndex) {
|
1157
1244
|
row.forEach(function (value, colIndex) {
|
1158
|
-
|
1245
|
+
_this21.engine.setCellContents({
|
1159
1246
|
col: colIndex,
|
1160
1247
|
row: finalElementRowIndex + relativeRowIndex,
|
1161
|
-
sheet:
|
1248
|
+
sheet: _this21.sheetId
|
1162
1249
|
}, [[value]]);
|
1163
1250
|
});
|
1164
1251
|
});
|