handsontable 12.3.3 → 12.4.0-next-ddbea0c-20230512
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/coords.js +13 -16
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -16
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- package/3rdparty/walkontable/src/core/_base.js +16 -20
- package/3rdparty/walkontable/src/core/_base.mjs +16 -20
- package/3rdparty/walkontable/src/event.js +4 -0
- package/3rdparty/walkontable/src/event.mjs +4 -0
- package/3rdparty/walkontable/src/overlay/_base.js +6 -7
- package/3rdparty/walkontable/src/overlay/_base.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/top.js +6 -7
- package/3rdparty/walkontable/src/overlay/top.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
- package/3rdparty/walkontable/src/overlays.js +55 -64
- package/3rdparty/walkontable/src/overlays.mjs +55 -64
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table.js +22 -26
- package/3rdparty/walkontable/src/table.mjs +22 -26
- package/CHANGELOG.md +14 -0
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.js +23 -6
- package/core.mjs +23 -6
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +9 -7
- package/dataMap/metaManager/metaSchema.mjs +9 -7
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7364 -5992
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +256 -234
- package/dist/handsontable.js +4326 -3275
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +11 -3
- package/dist/languages/all.js +133 -0
- package/dist/languages/ar-AR.js +7 -0
- package/dist/languages/cs-CZ.js +7 -0
- package/dist/languages/de-CH.js +7 -0
- package/dist/languages/de-DE.js +7 -0
- package/dist/languages/en-US.js +7 -0
- package/dist/languages/es-MX.js +7 -0
- package/dist/languages/fr-FR.js +7 -0
- package/dist/languages/it-IT.js +7 -0
- package/dist/languages/ja-JP.js +7 -0
- package/dist/languages/ko-KR.js +7 -0
- package/dist/languages/lv-LV.js +7 -0
- package/dist/languages/nb-NO.js +7 -0
- package/dist/languages/nl-NL.js +7 -0
- package/dist/languages/pl-PL.js +7 -0
- package/dist/languages/pt-BR.js +7 -0
- package/dist/languages/ru-RU.js +7 -0
- package/dist/languages/sr-SP.js +7 -0
- package/dist/languages/zh-CN.js +7 -0
- package/dist/languages/zh-TW.js +7 -0
- package/editors/autocompleteEditor/autocompleteEditor.js +8 -9
- package/editors/autocompleteEditor/autocompleteEditor.mjs +8 -9
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/i18n/languages/ar-AR.js +7 -1
- package/i18n/languages/cs-CZ.js +7 -1
- package/i18n/languages/de-CH.js +7 -1
- package/i18n/languages/de-DE.js +7 -1
- package/i18n/languages/en-US.js +7 -1
- package/i18n/languages/es-MX.js +7 -1
- package/i18n/languages/fr-FR.js +7 -1
- package/i18n/languages/it-IT.js +7 -1
- package/i18n/languages/ja-JP.js +7 -1
- package/i18n/languages/ko-KR.js +7 -1
- package/i18n/languages/lv-LV.js +7 -1
- package/i18n/languages/nb-NO.js +7 -1
- package/i18n/languages/nl-NL.js +7 -1
- package/i18n/languages/pl-PL.js +7 -1
- package/i18n/languages/pt-BR.js +7 -1
- package/i18n/languages/ru-RU.js +7 -1
- package/i18n/languages/sr-SP.js +7 -1
- package/i18n/languages/zh-CN.js +7 -1
- package/i18n/languages/zh-TW.js +7 -1
- package/languages/all.js +133 -0
- package/languages/ar-AR.js +7 -0
- package/languages/cs-CZ.js +7 -0
- package/languages/de-CH.js +7 -0
- package/languages/de-DE.js +7 -0
- package/languages/en-US.js +7 -0
- package/languages/es-MX.js +7 -0
- package/languages/fr-FR.js +7 -0
- package/languages/index.js +133 -0
- package/languages/it-IT.js +7 -0
- package/languages/ja-JP.js +7 -0
- package/languages/ko-KR.js +7 -0
- package/languages/lv-LV.js +7 -0
- package/languages/nb-NO.js +7 -0
- package/languages/nl-NL.js +7 -0
- package/languages/pl-PL.js +7 -0
- package/languages/pt-BR.js +7 -0
- package/languages/ru-RU.js +7 -0
- package/languages/sr-SP.js +7 -0
- package/languages/zh-CN.js +7 -0
- package/languages/zh-TW.js +7 -0
- package/package.json +3 -2
- package/pluginHooks.js +16 -6
- package/pluginHooks.mjs +15 -3
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/base/base.js +9 -10
- package/plugins/base/base.mjs +9 -10
- package/plugins/collapsibleColumns/collapsibleColumns.js +24 -7
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -7
- package/plugins/copyPaste/copyPaste.js +92 -16
- package/plugins/copyPaste/copyPaste.mjs +92 -16
- package/plugins/copyPaste/copyableRanges.js +39 -39
- package/plugins/copyPaste/copyableRanges.mjs +32 -32
- package/plugins/customBorders/customBorders.d.ts +2 -0
- package/plugins/customBorders/customBorders.js +6 -7
- package/plugins/customBorders/customBorders.mjs +6 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/engine/register.js +9 -0
- package/plugins/formulas/engine/register.mjs +13 -4
- package/plugins/formulas/engine/settings.js +18 -3
- package/plugins/formulas/engine/settings.mjs +16 -3
- package/plugins/formulas/formulas.js +308 -162
- package/plugins/formulas/formulas.mjs +308 -163
- package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
- package/plugins/formulas/indexSyncer/index.js +225 -0
- package/plugins/formulas/indexSyncer/index.mjs +219 -0
- package/plugins/formulas/utils.js +81 -0
- package/plugins/formulas/utils.mjs +74 -0
- package/plugins/hiddenColumns/hiddenColumns.js +12 -7
- package/plugins/hiddenColumns/hiddenColumns.mjs +12 -7
- package/plugins/hiddenRows/hiddenRows.js +12 -7
- package/plugins/hiddenRows/hiddenRows.mjs +12 -7
- package/plugins/manualRowMove/manualRowMove.js +26 -11
- package/plugins/manualRowMove/manualRowMove.mjs +27 -12
- package/plugins/nestedHeaders/nestedHeaders.js +26 -7
- package/plugins/nestedHeaders/nestedHeaders.mjs +26 -7
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +21 -3
- package/plugins/nestedHeaders/stateManager/index.mjs +18 -0
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -0
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -0
- package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
- package/plugins/registry.js +3 -1
- package/plugins/undoRedo/undoRedo.js +0 -1
- package/plugins/undoRedo/undoRedo.mjs +0 -1
- package/selection/highlight/visualSelection.js +5 -6
- package/selection/highlight/visualSelection.mjs +5 -6
- package/tableView.js +62 -72
- package/tableView.mjs +62 -72
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +8 -1
- package/translations/changesObservable/observer.mjs +7 -0
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.js +6 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +6 -0
- package/utils/dataStructures/tree.js +15 -18
- package/utils/dataStructures/tree.mjs +15 -18
- package/utils/parseTable.js +5 -1
- package/utils/parseTable.mjs +5 -1
@@ -2,8 +2,6 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
2
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
4
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
5
|
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); }
|
8
6
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
9
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -19,6 +17,8 @@ import "core-js/modules/es.set.js";
|
|
19
17
|
import "core-js/modules/es.string.iterator.js";
|
20
18
|
import "core-js/modules/web.dom-collections.iterator.js";
|
21
19
|
import "core-js/modules/es.array.map.js";
|
20
|
+
import "core-js/modules/es.string.starts-with.js";
|
21
|
+
import "core-js/modules/es.array.slice.js";
|
22
22
|
import "core-js/modules/es.array.includes.js";
|
23
23
|
import "core-js/modules/es.string.includes.js";
|
24
24
|
import "core-js/modules/es.array.reverse.js";
|
@@ -35,13 +35,9 @@ import "core-js/modules/es.reflect.construct.js";
|
|
35
35
|
import "core-js/modules/es.reflect.get.js";
|
36
36
|
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
37
37
|
import "core-js/modules/es.symbol.iterator.js";
|
38
|
-
import "core-js/modules/es.array.slice.js";
|
39
38
|
import "core-js/modules/es.function.name.js";
|
40
39
|
import "core-js/modules/es.array.from.js";
|
41
40
|
import "core-js/modules/es.regexp.exec.js";
|
42
|
-
import "core-js/modules/es.object.keys.js";
|
43
|
-
import "core-js/modules/es.array.filter.js";
|
44
|
-
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
45
41
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46
42
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
47
43
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -70,14 +66,15 @@ import { error, warn } from "../../helpers/console.mjs";
|
|
70
66
|
import { isNumeric } from "../../helpers/number.mjs";
|
71
67
|
import { isDefined, isUndefined } from "../../helpers/mixed.mjs";
|
72
68
|
import { setupEngine, setupSheet, unregisterEngine, getRegisteredHotInstances } from "./engine/register.mjs";
|
73
|
-
import { isEscapedFormulaExpression, unescapeFormulaExpression } from "./utils.mjs";
|
74
|
-
import { getEngineSettingsWithOverrides } from "./engine/settings.mjs";
|
69
|
+
import { isEscapedFormulaExpression, unescapeFormulaExpression, isDate, isDateValid, getDateInHfFormat, getDateFromExcelDate, getDateInHotFormat, isFormula } from "./utils.mjs";
|
70
|
+
import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./engine/settings.mjs";
|
75
71
|
import { isArrayOfArrays } from "../../helpers/data.mjs";
|
76
72
|
import { toUpperCaseFirst } from "../../helpers/string.mjs";
|
77
73
|
import Hooks from "../../pluginHooks.mjs";
|
74
|
+
import IndexSyncer from "./indexSyncer/index.mjs";
|
78
75
|
export var PLUGIN_KEY = 'formulas';
|
76
|
+
export var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
79
77
|
export var PLUGIN_PRIORITY = 260;
|
80
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
81
78
|
Hooks.getSingleton().register('afterNamedExpressionAdded');
|
82
79
|
Hooks.getSingleton().register('afterNamedExpressionRemoved');
|
83
80
|
Hooks.getSingleton().register('afterSheetAdded');
|
@@ -116,14 +113,31 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
116
113
|
_args[_key] = arguments[_key];
|
117
114
|
}
|
118
115
|
_this = _super.call.apply(_super, [this].concat(_args));
|
116
|
+
/**
|
117
|
+
* Flag used to bypass hooks in internal operations.
|
118
|
+
*
|
119
|
+
* @private
|
120
|
+
* @type {boolean}
|
121
|
+
*/
|
119
122
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _internalOperationPending, {
|
120
123
|
writable: true,
|
121
124
|
value: false
|
122
125
|
});
|
126
|
+
/**
|
127
|
+
* Flag needed to mark if Handsontable was initialized with no data.
|
128
|
+
* (Required to work around the fact, that Handsontable auto-generates sample data, when no data is provided).
|
129
|
+
*
|
130
|
+
* @type {boolean}
|
131
|
+
*/
|
123
132
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hotWasInitializedWithEmptyData, {
|
124
133
|
writable: true,
|
125
134
|
value: false
|
126
135
|
});
|
136
|
+
/**
|
137
|
+
* The list of the HyperFormula listeners.
|
138
|
+
*
|
139
|
+
* @type {Array}
|
140
|
+
*/
|
127
141
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _engineListeners, {
|
128
142
|
writable: true,
|
129
143
|
value: [['valuesUpdated', function () {
|
@@ -146,9 +160,44 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
146
160
|
return (_this7 = _this).onEngineSheetRemoved.apply(_this7, arguments);
|
147
161
|
}]]
|
148
162
|
});
|
163
|
+
/**
|
164
|
+
* Static register used to set up one global HyperFormula instance.
|
165
|
+
* TODO: currently used in tests, might be removed later.
|
166
|
+
*
|
167
|
+
* @private
|
168
|
+
* @type {object}
|
169
|
+
*/
|
149
170
|
_defineProperty(_assertThisInitialized(_this), "staticRegister", staticRegister('formulas'));
|
171
|
+
/**
|
172
|
+
* The engine instance that will be used for this instance of Handsontable.
|
173
|
+
*
|
174
|
+
* @type {HyperFormula|null}
|
175
|
+
*/
|
150
176
|
_defineProperty(_assertThisInitialized(_this), "engine", null);
|
177
|
+
/**
|
178
|
+
* HyperFormula's sheet name.
|
179
|
+
*
|
180
|
+
* @type {string|null}
|
181
|
+
*/
|
151
182
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
183
|
+
/**
|
184
|
+
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
185
|
+
*
|
186
|
+
* @type {IndexSyncer|null}
|
187
|
+
*/
|
188
|
+
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
189
|
+
/**
|
190
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
191
|
+
*
|
192
|
+
* @type {AxisSyncer|null}
|
193
|
+
*/
|
194
|
+
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
195
|
+
/**
|
196
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
197
|
+
*
|
198
|
+
* @type {AxisSyncer|null}
|
199
|
+
*/
|
200
|
+
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
152
201
|
return _this;
|
153
202
|
}
|
154
203
|
_createClass(Formulas, [{
|
@@ -256,24 +305,66 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
256
305
|
this.addHook('afterRemoveCol', function () {
|
257
306
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
258
307
|
});
|
308
|
+
this.indexSyncer = new IndexSyncer(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
309
|
+
_this8.hot.addHookOnce('init', function () {
|
310
|
+
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
311
|
+
// be postponed.
|
312
|
+
postponedAction();
|
313
|
+
});
|
314
|
+
});
|
315
|
+
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
316
|
+
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
317
|
+
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
318
|
+
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
319
|
+
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
320
|
+
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
321
|
+
});
|
322
|
+
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
323
|
+
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
324
|
+
});
|
325
|
+
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
326
|
+
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
327
|
+
});
|
328
|
+
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
329
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
330
|
+
});
|
331
|
+
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
332
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
333
|
+
});
|
334
|
+
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
335
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
336
|
+
});
|
337
|
+
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
338
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
339
|
+
});
|
340
|
+
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
341
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
342
|
+
});
|
343
|
+
|
344
|
+
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
345
|
+
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
346
|
+
// Another hooks are triggered to late for setting HF's engine data needed for some actions.
|
347
|
+
this.addHook('afterCellMetaReset', function () {
|
348
|
+
return _this8.onAfterCellMetaReset.apply(_this8, arguments);
|
349
|
+
});
|
259
350
|
|
260
351
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
261
|
-
this.addHook('beforeUndo', function (
|
262
|
-
|
263
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
264
|
-
return;
|
265
|
-
}
|
352
|
+
this.addHook('beforeUndo', function () {
|
353
|
+
_this8.indexSyncer.setPerformUndo(true);
|
266
354
|
_this8.engine.undo();
|
267
355
|
});
|
268
356
|
|
269
357
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
270
|
-
this.addHook('beforeRedo', function (
|
271
|
-
|
272
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
273
|
-
return;
|
274
|
-
}
|
358
|
+
this.addHook('beforeRedo', function () {
|
359
|
+
_this8.indexSyncer.setPerformRedo(true);
|
275
360
|
_this8.engine.redo();
|
276
361
|
});
|
362
|
+
this.addHook('afterUndo', function () {
|
363
|
+
_this8.indexSyncer.setPerformUndo(false);
|
364
|
+
});
|
365
|
+
this.addHook('afterUndo', function () {
|
366
|
+
_this8.indexSyncer.setPerformRedo(false);
|
367
|
+
});
|
277
368
|
this.addHook('afterDetachChild', function () {
|
278
369
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
279
370
|
});
|
@@ -316,7 +407,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
316
407
|
}, {
|
317
408
|
key: "updatePlugin",
|
318
409
|
value: function updatePlugin(newSettings) {
|
319
|
-
|
410
|
+
var newEngineSettings = getEngineSettingsWithOverrides(this.hot.getSettings());
|
411
|
+
if (haveEngineSettingsChanged(this.engine.getConfig(), newEngineSettings)) {
|
412
|
+
this.engine.updateConfig(newEngineSettings);
|
413
|
+
}
|
320
414
|
var pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
321
415
|
if (isDefined(pluginSettings) && isDefined(pluginSettings.sheetName) && pluginSettings.sheetName !== this.sheetName) {
|
322
416
|
this.switchSheet(pluginSettings.sheetName);
|
@@ -355,63 +449,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
355
449
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
356
450
|
}
|
357
451
|
|
358
|
-
/**
|
359
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
360
|
-
*
|
361
|
-
* @private
|
362
|
-
* @param {number} visualIndex Visual entry index.
|
363
|
-
* @param {number} physicalIndex Physical entry index.
|
364
|
-
* @param {number} entriesCount Visual entries count.
|
365
|
-
* @param {number} sourceEntriesCount Source entries count.
|
366
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
367
|
-
* `toPhysical` alias.
|
368
|
-
* @returns {*}
|
369
|
-
*/
|
370
|
-
}, {
|
371
|
-
key: "getPhysicalIndexPosition",
|
372
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
373
|
-
if (!contained) {
|
374
|
-
if (visualIndex >= entriesCount) {
|
375
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
376
|
-
}
|
377
|
-
}
|
378
|
-
return physicalIndex;
|
379
|
-
}
|
380
|
-
|
381
|
-
/**
|
382
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
383
|
-
* `null` on rows with indexes higher than the number of rows.
|
384
|
-
*
|
385
|
-
* @private
|
386
|
-
* @param {number} row Visual row index.
|
387
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
388
|
-
* `toPhysical` alias.
|
389
|
-
* @returns {number} The physical row index.
|
390
|
-
*/
|
391
|
-
}, {
|
392
|
-
key: "toPhysicalRowPosition",
|
393
|
-
value: function toPhysicalRowPosition(row) {
|
394
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
395
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
396
|
-
}
|
397
|
-
|
398
|
-
/**
|
399
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
400
|
-
* `null` on columns with indexes higher than the number of columns.
|
401
|
-
*
|
402
|
-
* @private
|
403
|
-
* @param {number} column Visual column index.
|
404
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
405
|
-
* `toPhysical` alias.
|
406
|
-
* @returns {number} The physical column index.
|
407
|
-
*/
|
408
|
-
}, {
|
409
|
-
key: "toPhysicalColumnPosition",
|
410
|
-
value: function toPhysicalColumnPosition(column) {
|
411
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
412
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
413
|
-
}
|
414
|
-
|
415
452
|
/**
|
416
453
|
* Add a sheet to the shared HyperFormula instance.
|
417
454
|
*
|
@@ -482,8 +519,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
482
519
|
if (physicalRow !== null && physicalColumn !== null) {
|
483
520
|
return this.engine.getCellType({
|
484
521
|
sheet: sheet,
|
485
|
-
row:
|
486
|
-
col:
|
522
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
523
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
487
524
|
});
|
488
525
|
} else {
|
489
526
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -503,15 +540,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
503
540
|
key: "isFormulaCellType",
|
504
541
|
value: function isFormulaCellType(row, column) {
|
505
542
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
506
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
507
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
508
|
-
if (physicalRow === null || physicalColumn === null) {
|
509
|
-
return false;
|
510
|
-
}
|
511
543
|
return this.engine.doesCellHaveFormula({
|
512
544
|
sheet: sheet,
|
513
|
-
row:
|
514
|
-
col:
|
545
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
546
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
515
547
|
});
|
516
548
|
}
|
517
549
|
|
@@ -576,11 +608,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
576
608
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
577
609
|
row = _ref8.row,
|
578
610
|
col = _ref8.col;
|
579
|
-
var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
|
580
|
-
var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
|
581
611
|
|
582
612
|
// Don't try to validate cells outside of the visual part of the table.
|
583
|
-
if (
|
613
|
+
if (isDefined(row) === false || isDefined(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
584
614
|
return;
|
585
615
|
}
|
586
616
|
|
@@ -599,7 +629,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
599
629
|
}
|
600
630
|
|
601
631
|
// It will just re-render certain cell when necessary.
|
602
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
632
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
603
633
|
}
|
604
634
|
});
|
605
635
|
}
|
@@ -617,14 +647,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
617
647
|
key: "syncChangeWithEngine",
|
618
648
|
value: function syncChangeWithEngine(row, column, newValue) {
|
619
649
|
var address = {
|
620
|
-
row: this.
|
621
|
-
col: this.
|
650
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
651
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
622
652
|
sheet: this.sheetId
|
623
653
|
};
|
624
654
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
625
655
|
warn("Not possible to set cell data at ".concat(JSON.stringify(address)));
|
626
656
|
return;
|
627
657
|
}
|
658
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
659
|
+
if (isDate(newValue, cellMeta.type)) {
|
660
|
+
if (isDateValid(newValue, cellMeta.dateFormat)) {
|
661
|
+
// Rewriting date in HOT format to HF format.
|
662
|
+
newValue = getDateInHfFormat(newValue, cellMeta.dateFormat);
|
663
|
+
} else if (isFormula(newValue) === false) {
|
664
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
665
|
+
newValue = "'".concat(newValue);
|
666
|
+
}
|
667
|
+
}
|
628
668
|
return this.engine.setCellContents(address, newValue);
|
629
669
|
}
|
630
670
|
|
@@ -644,11 +684,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
644
684
|
var visualColumn = this.hot.propToCol(prop);
|
645
685
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
646
686
|
var address = {
|
647
|
-
row: this.
|
648
|
-
col: this.
|
687
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
688
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
649
689
|
sheet: this.sheetId
|
650
690
|
};
|
651
|
-
var
|
691
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
692
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
693
|
+
|
694
|
+
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
695
|
+
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
696
|
+
}
|
652
697
|
|
653
698
|
// If `cellValue` is an object it is expected to be an error
|
654
699
|
return _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -669,19 +714,41 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
669
714
|
}, {
|
670
715
|
key: "onBeforeAutofill",
|
671
716
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
672
|
-
var
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
717
|
+
var _sourceRange$getTopSt = sourceRange.getTopStartCorner(),
|
718
|
+
sourceTopStartRow = _sourceRange$getTopSt.row,
|
719
|
+
sourceTopStartColumn = _sourceRange$getTopSt.col;
|
720
|
+
var _sourceRange$getBotto = sourceRange.getBottomEndCorner(),
|
721
|
+
sourceBottomEndRow = _sourceRange$getBotto.row,
|
722
|
+
sourceBottomEndColumn = _sourceRange$getBotto.col;
|
723
|
+
var _targetRange$getTopSt = targetRange.getTopStartCorner(),
|
724
|
+
targetTopStartRow = _targetRange$getTopSt.row,
|
725
|
+
targetTopStartColumn = _targetRange$getTopSt.col;
|
726
|
+
var _targetRange$getBotto = targetRange.getBottomEndCorner(),
|
727
|
+
targetBottomEndRow = _targetRange$getBotto.row,
|
728
|
+
targetBottomEndColumn = _targetRange$getBotto.col;
|
678
729
|
var engineSourceRange = {
|
679
|
-
start:
|
680
|
-
|
730
|
+
start: {
|
731
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
|
732
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
733
|
+
sheet: this.sheetId
|
734
|
+
},
|
735
|
+
end: {
|
736
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
737
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
738
|
+
sheet: this.sheetId
|
739
|
+
}
|
681
740
|
};
|
682
741
|
var engineTargetRange = {
|
683
|
-
start:
|
684
|
-
|
742
|
+
start: {
|
743
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
|
744
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
745
|
+
sheet: this.sheetId
|
746
|
+
},
|
747
|
+
end: {
|
748
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
749
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
750
|
+
sheet: this.sheetId
|
751
|
+
}
|
685
752
|
};
|
686
753
|
|
687
754
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -689,7 +756,33 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
689
756
|
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
690
757
|
return false;
|
691
758
|
}
|
692
|
-
|
759
|
+
var fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
|
760
|
+
var _engineSourceRange$st = engineSourceRange.start,
|
761
|
+
sourceStartRow = _engineSourceRange$st.row,
|
762
|
+
sourceStartColumn = _engineSourceRange$st.col;
|
763
|
+
var _engineSourceRange$en = engineSourceRange.end,
|
764
|
+
sourceEndRow = _engineSourceRange$en.row,
|
765
|
+
sourceEndColumn = _engineSourceRange$en.col;
|
766
|
+
var populationRowLength = sourceEndRow - sourceStartRow + 1;
|
767
|
+
var populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
|
768
|
+
for (var populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
|
769
|
+
for (var populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
|
770
|
+
var populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
|
771
|
+
var sourceRow = populatedRowIndex % populationRowLength;
|
772
|
+
var sourceColumn = populatedColumnIndex % populationColumnLength;
|
773
|
+
var sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
|
774
|
+
if (isDate(populatedValue, sourceCellMeta.type)) {
|
775
|
+
if (populatedValue.startsWith('\'')) {
|
776
|
+
// Populating values on HOT side without apostrophe.
|
777
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
|
778
|
+
} else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
|
779
|
+
// Populating date in proper format, coming from the source cell.
|
780
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = getDateInHotFormat(populatedValue, sourceCellMeta.dateFormat);
|
781
|
+
}
|
782
|
+
}
|
783
|
+
}
|
784
|
+
}
|
785
|
+
return fillRangeData;
|
693
786
|
}
|
694
787
|
|
695
788
|
/**
|
@@ -713,6 +806,40 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
713
806
|
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, isUndefined(this.hot.getSettings().data));
|
714
807
|
}
|
715
808
|
|
809
|
+
/**
|
810
|
+
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
811
|
+
*
|
812
|
+
* @private
|
813
|
+
*/
|
814
|
+
}, {
|
815
|
+
key: "onAfterCellMetaReset",
|
816
|
+
value: function onAfterCellMetaReset() {
|
817
|
+
var _this13 = this;
|
818
|
+
var sourceDataArray = this.hot.getSourceDataArray();
|
819
|
+
var valueChanged = false;
|
820
|
+
sourceDataArray.forEach(function (rowData, rowIndex) {
|
821
|
+
rowData.forEach(function (cellValue, columnIndex) {
|
822
|
+
var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
|
823
|
+
var dateFormat = cellMeta.dateFormat;
|
824
|
+
if (isDate(cellValue, cellMeta.type)) {
|
825
|
+
valueChanged = true;
|
826
|
+
if (isDateValid(cellValue, dateFormat)) {
|
827
|
+
// Rewriting date in HOT format to HF format.
|
828
|
+
sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);
|
829
|
+
} else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
|
830
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
831
|
+
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
832
|
+
}
|
833
|
+
}
|
834
|
+
});
|
835
|
+
});
|
836
|
+
if (valueChanged === true) {
|
837
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
838
|
+
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
839
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
840
|
+
}
|
841
|
+
}
|
842
|
+
|
716
843
|
/**
|
717
844
|
* `afterLoadData` hook callback.
|
718
845
|
*
|
@@ -733,7 +860,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
733
860
|
var sourceDataArray = this.hot.getSourceDataArray();
|
734
861
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
735
862
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
736
|
-
var dependentCells = this.engine.setSheetContent(this.sheetId,
|
863
|
+
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
864
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
737
865
|
this.renderDependentSheets(dependentCells);
|
738
866
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
739
867
|
}
|
@@ -746,24 +874,27 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
746
874
|
* `modifyData` hook callback.
|
747
875
|
*
|
748
876
|
* @private
|
749
|
-
* @param {number}
|
750
|
-
* @param {number}
|
877
|
+
* @param {number} physicalRow Physical row index.
|
878
|
+
* @param {number} visualColumn Visual column index.
|
751
879
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
752
880
|
* property.
|
753
881
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
754
882
|
*/
|
755
883
|
}, {
|
756
884
|
key: "onModifyData",
|
757
|
-
value: function onModifyData(
|
885
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
758
886
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
759
887
|
return;
|
760
888
|
}
|
761
|
-
var visualRow = this.hot.toVisualRow(
|
889
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
890
|
+
if (visualRow === null || visualColumn === null) {
|
891
|
+
return;
|
892
|
+
}
|
762
893
|
|
763
894
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
764
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
895
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
765
896
|
if (!isFormulaCellType) {
|
766
|
-
var cellType = this.getCellType(visualRow,
|
897
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
767
898
|
if (cellType !== 'ARRAY') {
|
768
899
|
if (isEscapedFormulaExpression(valueHolder.value)) {
|
769
900
|
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
@@ -771,14 +902,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
771
902
|
return;
|
772
903
|
}
|
773
904
|
}
|
774
|
-
|
775
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
776
905
|
var address = {
|
777
|
-
row:
|
778
|
-
col: this.
|
906
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
907
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
779
908
|
sheet: this.sheetId
|
780
909
|
};
|
781
|
-
var cellValue = this.engine.getCellValue(address);
|
910
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
911
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
912
|
+
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
913
|
+
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
914
|
+
}
|
782
915
|
|
783
916
|
// If `cellValue` is an object it is expected to be an error
|
784
917
|
var value = _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -803,6 +936,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
803
936
|
}
|
804
937
|
var visualRow = this.hot.toVisualRow(row);
|
805
938
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
939
|
+
if (visualRow === null || visualColumn === null) {
|
940
|
+
return;
|
941
|
+
}
|
806
942
|
|
807
943
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
808
944
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -822,9 +958,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
822
958
|
return;
|
823
959
|
}
|
824
960
|
var address = {
|
825
|
-
row:
|
826
|
-
|
827
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
961
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
962
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
828
963
|
sheet: this.sheetId
|
829
964
|
};
|
830
965
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -850,21 +985,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
850
985
|
var dependentCells = this.engine.batch(function () {
|
851
986
|
changes.forEach(function (_ref9) {
|
852
987
|
var _ref10 = _slicedToArray(_ref9, 4),
|
853
|
-
|
988
|
+
visualRow = _ref10[0],
|
854
989
|
prop = _ref10[1],
|
855
990
|
newValue = _ref10[3];
|
856
|
-
var
|
857
|
-
var physicalRow = _this14.hot.toPhysicalRow(
|
858
|
-
var physicalColumn = _this14.hot.toPhysicalColumn(
|
991
|
+
var visualColumn = _this14.hot.propToCol(prop);
|
992
|
+
var physicalRow = _this14.hot.toPhysicalRow(visualRow);
|
993
|
+
var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
|
859
994
|
var address = {
|
860
|
-
row:
|
861
|
-
col:
|
995
|
+
row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
996
|
+
col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
862
997
|
sheet: _this14.sheetId
|
863
998
|
};
|
864
999
|
if (physicalRow !== null && physicalColumn !== null) {
|
865
|
-
_this14.syncChangeWithEngine(
|
1000
|
+
_this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
866
1001
|
} else {
|
867
|
-
outOfBoundsChanges.push([
|
1002
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
868
1003
|
}
|
869
1004
|
changedCells.push({
|
870
1005
|
address: address
|
@@ -910,16 +1045,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
910
1045
|
var changedCells = [];
|
911
1046
|
changes.forEach(function (_ref13) {
|
912
1047
|
var _ref14 = _slicedToArray(_ref13, 4),
|
913
|
-
|
1048
|
+
visualRow = _ref14[0],
|
914
1049
|
prop = _ref14[1],
|
915
1050
|
newValue = _ref14[3];
|
916
|
-
var
|
917
|
-
if (!isNumeric(
|
1051
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
1052
|
+
if (!isNumeric(visualColumn)) {
|
918
1053
|
return;
|
919
1054
|
}
|
920
1055
|
var address = {
|
921
|
-
row:
|
922
|
-
col: _this15.
|
1056
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1057
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
923
1058
|
sheet: _this15.sheetId
|
924
1059
|
};
|
925
1060
|
if (!_this15.engine.isItPossibleToSetCellContents(address)) {
|
@@ -939,14 +1074,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
939
1074
|
* `beforeCreateRow` hook callback.
|
940
1075
|
*
|
941
1076
|
* @private
|
942
|
-
* @param {number}
|
1077
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
943
1078
|
* @param {number} amount Number of newly created rows in the data source array.
|
944
1079
|
* @returns {*|boolean} If false is returned the action is canceled.
|
945
1080
|
*/
|
946
1081
|
}, {
|
947
1082
|
key: "onBeforeCreateRow",
|
948
|
-
value: function onBeforeCreateRow(
|
949
|
-
|
1083
|
+
value: function onBeforeCreateRow(visualRow, amount) {
|
1084
|
+
var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
1085
|
+
if (visualRow >= this.hot.countRows()) {
|
1086
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
950
1090
|
return false;
|
951
1091
|
}
|
952
1092
|
}
|
@@ -955,14 +1095,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
955
1095
|
* `beforeCreateCol` hook callback.
|
956
1096
|
*
|
957
1097
|
* @private
|
958
|
-
* @param {number}
|
1098
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
959
1099
|
* @param {number} amount Number of newly created columns in the data source.
|
960
1100
|
* @returns {*|boolean} If false is returned the action is canceled.
|
961
1101
|
*/
|
962
1102
|
}, {
|
963
1103
|
key: "onBeforeCreateCol",
|
964
|
-
value: function onBeforeCreateCol(
|
965
|
-
|
1104
|
+
value: function onBeforeCreateCol(visualColumn, amount) {
|
1105
|
+
var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
1106
|
+
if (visualColumn >= this.hot.countCols()) {
|
1107
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
966
1111
|
return false;
|
967
1112
|
}
|
968
1113
|
}
|
@@ -980,8 +1125,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
980
1125
|
key: "onBeforeRemoveRow",
|
981
1126
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
982
1127
|
var _this16 = this;
|
983
|
-
var
|
984
|
-
|
1128
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1129
|
+
var possible = hfRows.every(function (hfRow) {
|
1130
|
+
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
985
1131
|
});
|
986
1132
|
return possible === false ? false : void 0;
|
987
1133
|
}
|
@@ -999,8 +1145,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
999
1145
|
key: "onBeforeRemoveCol",
|
1000
1146
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1001
1147
|
var _this17 = this;
|
1002
|
-
var
|
1003
|
-
|
1148
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1149
|
+
var possible = hfColumns.every(function (hfColumn) {
|
1150
|
+
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1004
1151
|
});
|
1005
1152
|
return possible === false ? false : void 0;
|
1006
1153
|
}
|
@@ -1009,18 +1156,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1009
1156
|
* `afterCreateRow` hook callback.
|
1010
1157
|
*
|
1011
1158
|
* @private
|
1012
|
-
* @param {number}
|
1159
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1013
1160
|
* @param {number} amount Number of newly created rows in the data source array.
|
1014
1161
|
* @param {string} [source] String that identifies source of hook call
|
1015
1162
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1016
1163
|
*/
|
1017
1164
|
}, {
|
1018
1165
|
key: "onAfterCreateRow",
|
1019
|
-
value: function onAfterCreateRow(
|
1166
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
1020
1167
|
if (isBlockedSource(source)) {
|
1021
1168
|
return;
|
1022
1169
|
}
|
1023
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1170
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1024
1171
|
this.renderDependentSheets(changes);
|
1025
1172
|
}
|
1026
1173
|
|
@@ -1028,18 +1175,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1028
1175
|
* `afterCreateCol` hook callback.
|
1029
1176
|
*
|
1030
1177
|
* @private
|
1031
|
-
* @param {number}
|
1178
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1032
1179
|
* @param {number} amount Number of newly created columns in the data source.
|
1033
1180
|
* @param {string} [source] String that identifies source of hook call
|
1034
1181
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1035
1182
|
*/
|
1036
1183
|
}, {
|
1037
1184
|
key: "onAfterCreateCol",
|
1038
|
-
value: function onAfterCreateCol(
|
1185
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
1039
1186
|
if (isBlockedSource(source)) {
|
1040
1187
|
return;
|
1041
1188
|
}
|
1042
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1189
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1043
1190
|
this.renderDependentSheets(changes);
|
1044
1191
|
}
|
1045
1192
|
|
@@ -1060,10 +1207,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1060
1207
|
if (isBlockedSource(source)) {
|
1061
1208
|
return;
|
1062
1209
|
}
|
1063
|
-
var
|
1210
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1064
1211
|
var changes = this.engine.batch(function () {
|
1065
|
-
|
1066
|
-
_this18.engine.removeRows(_this18.sheetId, [
|
1212
|
+
descendingHfRows.forEach(function (hfRow) {
|
1213
|
+
_this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
|
1067
1214
|
});
|
1068
1215
|
});
|
1069
1216
|
this.renderDependentSheets(changes);
|
@@ -1086,10 +1233,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1086
1233
|
if (isBlockedSource(source)) {
|
1087
1234
|
return;
|
1088
1235
|
}
|
1089
|
-
var
|
1236
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1090
1237
|
var changes = this.engine.batch(function () {
|
1091
|
-
|
1092
|
-
_this19.engine.removeColumns(_this19.sheetId, [
|
1238
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
1239
|
+
_this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
|
1093
1240
|
});
|
1094
1241
|
});
|
1095
1242
|
this.renderDependentSheets(changes);
|
@@ -1214,13 +1361,11 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1214
1361
|
get: function get() {
|
1215
1362
|
return PLUGIN_PRIORITY;
|
1216
1363
|
}
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
* @type {boolean}
|
1223
|
-
*/
|
1364
|
+
}, {
|
1365
|
+
key: "SETTING_KEYS",
|
1366
|
+
get: function get() {
|
1367
|
+
return [PLUGIN_KEY].concat(SETTING_KEYS);
|
1368
|
+
}
|
1224
1369
|
}]);
|
1225
1370
|
return Formulas;
|
1226
1371
|
}(BasePlugin);
|