handsontable 12.3.3-next-e19badf-20230328 → 12.4.0-next-ddbea0c-20230512
Sign up to get free protection for your applications and to get access to all the features.
- 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/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 +5047 -4193
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +86 -78
- package/dist/handsontable.js +4023 -3170
- 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/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/copyPaste/copyableRanges.js +25 -31
- package/plugins/copyPaste/copyableRanges.mjs +18 -24
- package/plugins/customBorders/customBorders.d.ts +2 -0
- 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 +274 -155
- package/plugins/formulas/formulas.mjs +274 -156
- 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/manualRowMove/manualRowMove.js +26 -11
- package/plugins/manualRowMove/manualRowMove.mjs +27 -12
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +3 -3
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- 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 +1 -1
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -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');
|
@@ -183,6 +180,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
183
180
|
* @type {string|null}
|
184
181
|
*/
|
185
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);
|
186
201
|
return _this;
|
187
202
|
}
|
188
203
|
_createClass(Formulas, [{
|
@@ -290,24 +305,66 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
290
305
|
this.addHook('afterRemoveCol', function () {
|
291
306
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
292
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
|
+
});
|
293
350
|
|
294
351
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
295
|
-
this.addHook('beforeUndo', function (
|
296
|
-
|
297
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
298
|
-
return;
|
299
|
-
}
|
352
|
+
this.addHook('beforeUndo', function () {
|
353
|
+
_this8.indexSyncer.setPerformUndo(true);
|
300
354
|
_this8.engine.undo();
|
301
355
|
});
|
302
356
|
|
303
357
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
304
|
-
this.addHook('beforeRedo', function (
|
305
|
-
|
306
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
307
|
-
return;
|
308
|
-
}
|
358
|
+
this.addHook('beforeRedo', function () {
|
359
|
+
_this8.indexSyncer.setPerformRedo(true);
|
309
360
|
_this8.engine.redo();
|
310
361
|
});
|
362
|
+
this.addHook('afterUndo', function () {
|
363
|
+
_this8.indexSyncer.setPerformUndo(false);
|
364
|
+
});
|
365
|
+
this.addHook('afterUndo', function () {
|
366
|
+
_this8.indexSyncer.setPerformRedo(false);
|
367
|
+
});
|
311
368
|
this.addHook('afterDetachChild', function () {
|
312
369
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
313
370
|
});
|
@@ -350,7 +407,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
350
407
|
}, {
|
351
408
|
key: "updatePlugin",
|
352
409
|
value: function updatePlugin(newSettings) {
|
353
|
-
|
410
|
+
var newEngineSettings = getEngineSettingsWithOverrides(this.hot.getSettings());
|
411
|
+
if (haveEngineSettingsChanged(this.engine.getConfig(), newEngineSettings)) {
|
412
|
+
this.engine.updateConfig(newEngineSettings);
|
413
|
+
}
|
354
414
|
var pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
355
415
|
if (isDefined(pluginSettings) && isDefined(pluginSettings.sheetName) && pluginSettings.sheetName !== this.sheetName) {
|
356
416
|
this.switchSheet(pluginSettings.sheetName);
|
@@ -389,63 +449,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
389
449
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
390
450
|
}
|
391
451
|
|
392
|
-
/**
|
393
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
394
|
-
*
|
395
|
-
* @private
|
396
|
-
* @param {number} visualIndex Visual entry index.
|
397
|
-
* @param {number} physicalIndex Physical entry index.
|
398
|
-
* @param {number} entriesCount Visual entries count.
|
399
|
-
* @param {number} sourceEntriesCount Source entries count.
|
400
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
401
|
-
* `toPhysical` alias.
|
402
|
-
* @returns {*}
|
403
|
-
*/
|
404
|
-
}, {
|
405
|
-
key: "getPhysicalIndexPosition",
|
406
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
407
|
-
if (!contained) {
|
408
|
-
if (visualIndex >= entriesCount) {
|
409
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
410
|
-
}
|
411
|
-
}
|
412
|
-
return physicalIndex;
|
413
|
-
}
|
414
|
-
|
415
|
-
/**
|
416
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
417
|
-
* `null` on rows with indexes higher than the number of rows.
|
418
|
-
*
|
419
|
-
* @private
|
420
|
-
* @param {number} row Visual row index.
|
421
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
422
|
-
* `toPhysical` alias.
|
423
|
-
* @returns {number} The physical row index.
|
424
|
-
*/
|
425
|
-
}, {
|
426
|
-
key: "toPhysicalRowPosition",
|
427
|
-
value: function toPhysicalRowPosition(row) {
|
428
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
429
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
430
|
-
}
|
431
|
-
|
432
|
-
/**
|
433
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
434
|
-
* `null` on columns with indexes higher than the number of columns.
|
435
|
-
*
|
436
|
-
* @private
|
437
|
-
* @param {number} column Visual column index.
|
438
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
439
|
-
* `toPhysical` alias.
|
440
|
-
* @returns {number} The physical column index.
|
441
|
-
*/
|
442
|
-
}, {
|
443
|
-
key: "toPhysicalColumnPosition",
|
444
|
-
value: function toPhysicalColumnPosition(column) {
|
445
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
446
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
447
|
-
}
|
448
|
-
|
449
452
|
/**
|
450
453
|
* Add a sheet to the shared HyperFormula instance.
|
451
454
|
*
|
@@ -516,8 +519,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
516
519
|
if (physicalRow !== null && physicalColumn !== null) {
|
517
520
|
return this.engine.getCellType({
|
518
521
|
sheet: sheet,
|
519
|
-
row:
|
520
|
-
col:
|
522
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
523
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
521
524
|
});
|
522
525
|
} else {
|
523
526
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -537,15 +540,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
537
540
|
key: "isFormulaCellType",
|
538
541
|
value: function isFormulaCellType(row, column) {
|
539
542
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
540
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
541
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
542
|
-
if (physicalRow === null || physicalColumn === null) {
|
543
|
-
return false;
|
544
|
-
}
|
545
543
|
return this.engine.doesCellHaveFormula({
|
546
544
|
sheet: sheet,
|
547
|
-
row:
|
548
|
-
col:
|
545
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
546
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
549
547
|
});
|
550
548
|
}
|
551
549
|
|
@@ -610,11 +608,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
610
608
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
611
609
|
row = _ref8.row,
|
612
610
|
col = _ref8.col;
|
613
|
-
var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
|
614
|
-
var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
|
615
611
|
|
616
612
|
// Don't try to validate cells outside of the visual part of the table.
|
617
|
-
if (
|
613
|
+
if (isDefined(row) === false || isDefined(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
618
614
|
return;
|
619
615
|
}
|
620
616
|
|
@@ -633,7 +629,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
633
629
|
}
|
634
630
|
|
635
631
|
// It will just re-render certain cell when necessary.
|
636
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
632
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
637
633
|
}
|
638
634
|
});
|
639
635
|
}
|
@@ -651,14 +647,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
651
647
|
key: "syncChangeWithEngine",
|
652
648
|
value: function syncChangeWithEngine(row, column, newValue) {
|
653
649
|
var address = {
|
654
|
-
row: this.
|
655
|
-
col: this.
|
650
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
651
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
656
652
|
sheet: this.sheetId
|
657
653
|
};
|
658
654
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
659
655
|
warn("Not possible to set cell data at ".concat(JSON.stringify(address)));
|
660
656
|
return;
|
661
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
|
+
}
|
662
668
|
return this.engine.setCellContents(address, newValue);
|
663
669
|
}
|
664
670
|
|
@@ -678,11 +684,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
678
684
|
var visualColumn = this.hot.propToCol(prop);
|
679
685
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
680
686
|
var address = {
|
681
|
-
row: this.
|
682
|
-
col: this.
|
687
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
688
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
683
689
|
sheet: this.sheetId
|
684
690
|
};
|
685
|
-
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
|
+
}
|
686
697
|
|
687
698
|
// If `cellValue` is an object it is expected to be an error
|
688
699
|
return _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -703,19 +714,41 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
703
714
|
}, {
|
704
715
|
key: "onBeforeAutofill",
|
705
716
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
706
|
-
var
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
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;
|
712
729
|
var engineSourceRange = {
|
713
|
-
start:
|
714
|
-
|
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
|
+
}
|
715
740
|
};
|
716
741
|
var engineTargetRange = {
|
717
|
-
start:
|
718
|
-
|
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
|
+
}
|
719
752
|
};
|
720
753
|
|
721
754
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -723,7 +756,33 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
723
756
|
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
724
757
|
return false;
|
725
758
|
}
|
726
|
-
|
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;
|
727
786
|
}
|
728
787
|
|
729
788
|
/**
|
@@ -747,6 +806,40 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
747
806
|
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, isUndefined(this.hot.getSettings().data));
|
748
807
|
}
|
749
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
|
+
|
750
843
|
/**
|
751
844
|
* `afterLoadData` hook callback.
|
752
845
|
*
|
@@ -767,7 +860,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
767
860
|
var sourceDataArray = this.hot.getSourceDataArray();
|
768
861
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
769
862
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
770
|
-
var dependentCells = this.engine.setSheetContent(this.sheetId,
|
863
|
+
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
864
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
771
865
|
this.renderDependentSheets(dependentCells);
|
772
866
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
773
867
|
}
|
@@ -780,24 +874,27 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
780
874
|
* `modifyData` hook callback.
|
781
875
|
*
|
782
876
|
* @private
|
783
|
-
* @param {number}
|
784
|
-
* @param {number}
|
877
|
+
* @param {number} physicalRow Physical row index.
|
878
|
+
* @param {number} visualColumn Visual column index.
|
785
879
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
786
880
|
* property.
|
787
881
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
788
882
|
*/
|
789
883
|
}, {
|
790
884
|
key: "onModifyData",
|
791
|
-
value: function onModifyData(
|
885
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
792
886
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
793
887
|
return;
|
794
888
|
}
|
795
|
-
var visualRow = this.hot.toVisualRow(
|
889
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
890
|
+
if (visualRow === null || visualColumn === null) {
|
891
|
+
return;
|
892
|
+
}
|
796
893
|
|
797
894
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
798
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
895
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
799
896
|
if (!isFormulaCellType) {
|
800
|
-
var cellType = this.getCellType(visualRow,
|
897
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
801
898
|
if (cellType !== 'ARRAY') {
|
802
899
|
if (isEscapedFormulaExpression(valueHolder.value)) {
|
803
900
|
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
@@ -805,14 +902,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
805
902
|
return;
|
806
903
|
}
|
807
904
|
}
|
808
|
-
|
809
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
810
905
|
var address = {
|
811
|
-
row:
|
812
|
-
col: this.
|
906
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
907
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
813
908
|
sheet: this.sheetId
|
814
909
|
};
|
815
|
-
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
|
+
}
|
816
915
|
|
817
916
|
// If `cellValue` is an object it is expected to be an error
|
818
917
|
var value = _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -837,6 +936,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
837
936
|
}
|
838
937
|
var visualRow = this.hot.toVisualRow(row);
|
839
938
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
939
|
+
if (visualRow === null || visualColumn === null) {
|
940
|
+
return;
|
941
|
+
}
|
840
942
|
|
841
943
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
842
944
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -856,9 +958,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
856
958
|
return;
|
857
959
|
}
|
858
960
|
var address = {
|
859
|
-
row:
|
860
|
-
|
861
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
961
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
962
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
862
963
|
sheet: this.sheetId
|
863
964
|
};
|
864
965
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -884,21 +985,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
884
985
|
var dependentCells = this.engine.batch(function () {
|
885
986
|
changes.forEach(function (_ref9) {
|
886
987
|
var _ref10 = _slicedToArray(_ref9, 4),
|
887
|
-
|
988
|
+
visualRow = _ref10[0],
|
888
989
|
prop = _ref10[1],
|
889
990
|
newValue = _ref10[3];
|
890
|
-
var
|
891
|
-
var physicalRow = _this14.hot.toPhysicalRow(
|
892
|
-
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);
|
893
994
|
var address = {
|
894
|
-
row:
|
895
|
-
col:
|
995
|
+
row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
996
|
+
col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
896
997
|
sheet: _this14.sheetId
|
897
998
|
};
|
898
999
|
if (physicalRow !== null && physicalColumn !== null) {
|
899
|
-
_this14.syncChangeWithEngine(
|
1000
|
+
_this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
900
1001
|
} else {
|
901
|
-
outOfBoundsChanges.push([
|
1002
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
902
1003
|
}
|
903
1004
|
changedCells.push({
|
904
1005
|
address: address
|
@@ -944,16 +1045,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
944
1045
|
var changedCells = [];
|
945
1046
|
changes.forEach(function (_ref13) {
|
946
1047
|
var _ref14 = _slicedToArray(_ref13, 4),
|
947
|
-
|
1048
|
+
visualRow = _ref14[0],
|
948
1049
|
prop = _ref14[1],
|
949
1050
|
newValue = _ref14[3];
|
950
|
-
var
|
951
|
-
if (!isNumeric(
|
1051
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
1052
|
+
if (!isNumeric(visualColumn)) {
|
952
1053
|
return;
|
953
1054
|
}
|
954
1055
|
var address = {
|
955
|
-
row:
|
956
|
-
col: _this15.
|
1056
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1057
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
957
1058
|
sheet: _this15.sheetId
|
958
1059
|
};
|
959
1060
|
if (!_this15.engine.isItPossibleToSetCellContents(address)) {
|
@@ -973,14 +1074,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
973
1074
|
* `beforeCreateRow` hook callback.
|
974
1075
|
*
|
975
1076
|
* @private
|
976
|
-
* @param {number}
|
1077
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
977
1078
|
* @param {number} amount Number of newly created rows in the data source array.
|
978
1079
|
* @returns {*|boolean} If false is returned the action is canceled.
|
979
1080
|
*/
|
980
1081
|
}, {
|
981
1082
|
key: "onBeforeCreateRow",
|
982
|
-
value: function onBeforeCreateRow(
|
983
|
-
|
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])) {
|
984
1090
|
return false;
|
985
1091
|
}
|
986
1092
|
}
|
@@ -989,14 +1095,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
989
1095
|
* `beforeCreateCol` hook callback.
|
990
1096
|
*
|
991
1097
|
* @private
|
992
|
-
* @param {number}
|
1098
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
993
1099
|
* @param {number} amount Number of newly created columns in the data source.
|
994
1100
|
* @returns {*|boolean} If false is returned the action is canceled.
|
995
1101
|
*/
|
996
1102
|
}, {
|
997
1103
|
key: "onBeforeCreateCol",
|
998
|
-
value: function onBeforeCreateCol(
|
999
|
-
|
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])) {
|
1000
1111
|
return false;
|
1001
1112
|
}
|
1002
1113
|
}
|
@@ -1014,8 +1125,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1014
1125
|
key: "onBeforeRemoveRow",
|
1015
1126
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
1016
1127
|
var _this16 = this;
|
1017
|
-
var
|
1018
|
-
|
1128
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1129
|
+
var possible = hfRows.every(function (hfRow) {
|
1130
|
+
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
1019
1131
|
});
|
1020
1132
|
return possible === false ? false : void 0;
|
1021
1133
|
}
|
@@ -1033,8 +1145,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1033
1145
|
key: "onBeforeRemoveCol",
|
1034
1146
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1035
1147
|
var _this17 = this;
|
1036
|
-
var
|
1037
|
-
|
1148
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1149
|
+
var possible = hfColumns.every(function (hfColumn) {
|
1150
|
+
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1038
1151
|
});
|
1039
1152
|
return possible === false ? false : void 0;
|
1040
1153
|
}
|
@@ -1043,18 +1156,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1043
1156
|
* `afterCreateRow` hook callback.
|
1044
1157
|
*
|
1045
1158
|
* @private
|
1046
|
-
* @param {number}
|
1159
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1047
1160
|
* @param {number} amount Number of newly created rows in the data source array.
|
1048
1161
|
* @param {string} [source] String that identifies source of hook call
|
1049
1162
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1050
1163
|
*/
|
1051
1164
|
}, {
|
1052
1165
|
key: "onAfterCreateRow",
|
1053
|
-
value: function onAfterCreateRow(
|
1166
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
1054
1167
|
if (isBlockedSource(source)) {
|
1055
1168
|
return;
|
1056
1169
|
}
|
1057
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1170
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1058
1171
|
this.renderDependentSheets(changes);
|
1059
1172
|
}
|
1060
1173
|
|
@@ -1062,18 +1175,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1062
1175
|
* `afterCreateCol` hook callback.
|
1063
1176
|
*
|
1064
1177
|
* @private
|
1065
|
-
* @param {number}
|
1178
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1066
1179
|
* @param {number} amount Number of newly created columns in the data source.
|
1067
1180
|
* @param {string} [source] String that identifies source of hook call
|
1068
1181
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1069
1182
|
*/
|
1070
1183
|
}, {
|
1071
1184
|
key: "onAfterCreateCol",
|
1072
|
-
value: function onAfterCreateCol(
|
1185
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
1073
1186
|
if (isBlockedSource(source)) {
|
1074
1187
|
return;
|
1075
1188
|
}
|
1076
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1189
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1077
1190
|
this.renderDependentSheets(changes);
|
1078
1191
|
}
|
1079
1192
|
|
@@ -1094,10 +1207,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1094
1207
|
if (isBlockedSource(source)) {
|
1095
1208
|
return;
|
1096
1209
|
}
|
1097
|
-
var
|
1210
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1098
1211
|
var changes = this.engine.batch(function () {
|
1099
|
-
|
1100
|
-
_this18.engine.removeRows(_this18.sheetId, [
|
1212
|
+
descendingHfRows.forEach(function (hfRow) {
|
1213
|
+
_this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
|
1101
1214
|
});
|
1102
1215
|
});
|
1103
1216
|
this.renderDependentSheets(changes);
|
@@ -1120,10 +1233,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1120
1233
|
if (isBlockedSource(source)) {
|
1121
1234
|
return;
|
1122
1235
|
}
|
1123
|
-
var
|
1236
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1124
1237
|
var changes = this.engine.batch(function () {
|
1125
|
-
|
1126
|
-
_this19.engine.removeColumns(_this19.sheetId, [
|
1238
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
1239
|
+
_this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
|
1127
1240
|
});
|
1128
1241
|
});
|
1129
1242
|
this.renderDependentSheets(changes);
|
@@ -1248,6 +1361,11 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1248
1361
|
get: function get() {
|
1249
1362
|
return PLUGIN_PRIORITY;
|
1250
1363
|
}
|
1364
|
+
}, {
|
1365
|
+
key: "SETTING_KEYS",
|
1366
|
+
get: function get() {
|
1367
|
+
return [PLUGIN_KEY].concat(SETTING_KEYS);
|
1368
|
+
}
|
1251
1369
|
}]);
|
1252
1370
|
return Formulas;
|
1253
1371
|
}(BasePlugin);
|