handsontable 12.3.3-next-e19badf-20230328 → 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/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
@@ -11,15 +11,11 @@ require("core-js/modules/es.reflect.construct.js");
|
|
11
11
|
require("core-js/modules/es.reflect.get.js");
|
12
12
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
13
13
|
require("core-js/modules/es.symbol.iterator.js");
|
14
|
-
require("core-js/modules/es.array.slice.js");
|
15
14
|
require("core-js/modules/es.function.name.js");
|
16
15
|
require("core-js/modules/es.array.from.js");
|
17
16
|
require("core-js/modules/es.regexp.exec.js");
|
18
|
-
require("core-js/modules/es.object.keys.js");
|
19
|
-
require("core-js/modules/es.array.filter.js");
|
20
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
21
17
|
exports.__esModule = true;
|
22
|
-
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
|
18
|
+
exports.SETTING_KEYS = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
|
23
19
|
require("core-js/modules/es.array.concat.js");
|
24
20
|
require("core-js/modules/es.object.to-string.js");
|
25
21
|
require("core-js/modules/web.dom-collections.for-each.js");
|
@@ -28,6 +24,8 @@ require("core-js/modules/es.set.js");
|
|
28
24
|
require("core-js/modules/es.string.iterator.js");
|
29
25
|
require("core-js/modules/web.dom-collections.iterator.js");
|
30
26
|
require("core-js/modules/es.array.map.js");
|
27
|
+
require("core-js/modules/es.string.starts-with.js");
|
28
|
+
require("core-js/modules/es.array.slice.js");
|
31
29
|
require("core-js/modules/es.array.includes.js");
|
32
30
|
require("core-js/modules/es.string.includes.js");
|
33
31
|
require("core-js/modules/es.array.reverse.js");
|
@@ -44,13 +42,12 @@ var _settings = require("./engine/settings");
|
|
44
42
|
var _data = require("../../helpers/data");
|
45
43
|
var _string = require("../../helpers/string");
|
46
44
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
45
|
+
var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
|
47
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
48
47
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
49
48
|
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."); }
|
50
49
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
51
50
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
52
|
-
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; }
|
53
|
-
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; }
|
54
51
|
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); }
|
55
52
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
56
53
|
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."); }
|
@@ -82,9 +79,10 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
82
79
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
83
80
|
var PLUGIN_KEY = 'formulas';
|
84
81
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
82
|
+
var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
83
|
+
exports.SETTING_KEYS = SETTING_KEYS;
|
85
84
|
var PLUGIN_PRIORITY = 260;
|
86
85
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
87
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
88
86
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
|
89
87
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
|
90
88
|
_pluginHooks.default.getSingleton().register('afterSheetAdded');
|
@@ -190,6 +188,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
190
188
|
* @type {string|null}
|
191
189
|
*/
|
192
190
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
191
|
+
/**
|
192
|
+
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
193
|
+
*
|
194
|
+
* @type {IndexSyncer|null}
|
195
|
+
*/
|
196
|
+
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
197
|
+
/**
|
198
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
199
|
+
*
|
200
|
+
* @type {AxisSyncer|null}
|
201
|
+
*/
|
202
|
+
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
203
|
+
/**
|
204
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
205
|
+
*
|
206
|
+
* @type {AxisSyncer|null}
|
207
|
+
*/
|
208
|
+
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
193
209
|
return _this;
|
194
210
|
}
|
195
211
|
_createClass(Formulas, [{
|
@@ -297,24 +313,66 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
297
313
|
this.addHook('afterRemoveCol', function () {
|
298
314
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
299
315
|
});
|
316
|
+
this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
317
|
+
_this8.hot.addHookOnce('init', function () {
|
318
|
+
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
319
|
+
// be postponed.
|
320
|
+
postponedAction();
|
321
|
+
});
|
322
|
+
});
|
323
|
+
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
324
|
+
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
325
|
+
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
326
|
+
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
327
|
+
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
328
|
+
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
329
|
+
});
|
330
|
+
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
331
|
+
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
332
|
+
});
|
333
|
+
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
334
|
+
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
335
|
+
});
|
336
|
+
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
337
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
338
|
+
});
|
339
|
+
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
340
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
341
|
+
});
|
342
|
+
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
343
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
344
|
+
});
|
345
|
+
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
346
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
347
|
+
});
|
348
|
+
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
349
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
350
|
+
});
|
351
|
+
|
352
|
+
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
353
|
+
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
354
|
+
// Another hooks are triggered to late for setting HF's engine data needed for some actions.
|
355
|
+
this.addHook('afterCellMetaReset', function () {
|
356
|
+
return _this8.onAfterCellMetaReset.apply(_this8, arguments);
|
357
|
+
});
|
300
358
|
|
301
359
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
302
|
-
this.addHook('beforeUndo', function (
|
303
|
-
|
304
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
305
|
-
return;
|
306
|
-
}
|
360
|
+
this.addHook('beforeUndo', function () {
|
361
|
+
_this8.indexSyncer.setPerformUndo(true);
|
307
362
|
_this8.engine.undo();
|
308
363
|
});
|
309
364
|
|
310
365
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
311
|
-
this.addHook('beforeRedo', function (
|
312
|
-
|
313
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
314
|
-
return;
|
315
|
-
}
|
366
|
+
this.addHook('beforeRedo', function () {
|
367
|
+
_this8.indexSyncer.setPerformRedo(true);
|
316
368
|
_this8.engine.redo();
|
317
369
|
});
|
370
|
+
this.addHook('afterUndo', function () {
|
371
|
+
_this8.indexSyncer.setPerformUndo(false);
|
372
|
+
});
|
373
|
+
this.addHook('afterUndo', function () {
|
374
|
+
_this8.indexSyncer.setPerformRedo(false);
|
375
|
+
});
|
318
376
|
this.addHook('afterDetachChild', function () {
|
319
377
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
320
378
|
});
|
@@ -357,7 +415,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
357
415
|
}, {
|
358
416
|
key: "updatePlugin",
|
359
417
|
value: function updatePlugin(newSettings) {
|
360
|
-
|
418
|
+
var newEngineSettings = (0, _settings.getEngineSettingsWithOverrides)(this.hot.getSettings());
|
419
|
+
if ((0, _settings.haveEngineSettingsChanged)(this.engine.getConfig(), newEngineSettings)) {
|
420
|
+
this.engine.updateConfig(newEngineSettings);
|
421
|
+
}
|
361
422
|
var pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
362
423
|
if ((0, _mixed.isDefined)(pluginSettings) && (0, _mixed.isDefined)(pluginSettings.sheetName) && pluginSettings.sheetName !== this.sheetName) {
|
363
424
|
this.switchSheet(pluginSettings.sheetName);
|
@@ -396,63 +457,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
396
457
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
397
458
|
}
|
398
459
|
|
399
|
-
/**
|
400
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
401
|
-
*
|
402
|
-
* @private
|
403
|
-
* @param {number} visualIndex Visual entry index.
|
404
|
-
* @param {number} physicalIndex Physical entry index.
|
405
|
-
* @param {number} entriesCount Visual entries count.
|
406
|
-
* @param {number} sourceEntriesCount Source entries count.
|
407
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
408
|
-
* `toPhysical` alias.
|
409
|
-
* @returns {*}
|
410
|
-
*/
|
411
|
-
}, {
|
412
|
-
key: "getPhysicalIndexPosition",
|
413
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
414
|
-
if (!contained) {
|
415
|
-
if (visualIndex >= entriesCount) {
|
416
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
417
|
-
}
|
418
|
-
}
|
419
|
-
return physicalIndex;
|
420
|
-
}
|
421
|
-
|
422
|
-
/**
|
423
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
424
|
-
* `null` on rows with indexes higher than the number of rows.
|
425
|
-
*
|
426
|
-
* @private
|
427
|
-
* @param {number} row Visual row index.
|
428
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
429
|
-
* `toPhysical` alias.
|
430
|
-
* @returns {number} The physical row index.
|
431
|
-
*/
|
432
|
-
}, {
|
433
|
-
key: "toPhysicalRowPosition",
|
434
|
-
value: function toPhysicalRowPosition(row) {
|
435
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
436
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
437
|
-
}
|
438
|
-
|
439
|
-
/**
|
440
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
441
|
-
* `null` on columns with indexes higher than the number of columns.
|
442
|
-
*
|
443
|
-
* @private
|
444
|
-
* @param {number} column Visual column index.
|
445
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
446
|
-
* `toPhysical` alias.
|
447
|
-
* @returns {number} The physical column index.
|
448
|
-
*/
|
449
|
-
}, {
|
450
|
-
key: "toPhysicalColumnPosition",
|
451
|
-
value: function toPhysicalColumnPosition(column) {
|
452
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
453
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
454
|
-
}
|
455
|
-
|
456
460
|
/**
|
457
461
|
* Add a sheet to the shared HyperFormula instance.
|
458
462
|
*
|
@@ -523,8 +527,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
523
527
|
if (physicalRow !== null && physicalColumn !== null) {
|
524
528
|
return this.engine.getCellType({
|
525
529
|
sheet: sheet,
|
526
|
-
row:
|
527
|
-
col:
|
530
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
531
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
528
532
|
});
|
529
533
|
} else {
|
530
534
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -544,15 +548,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
544
548
|
key: "isFormulaCellType",
|
545
549
|
value: function isFormulaCellType(row, column) {
|
546
550
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
547
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
548
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
549
|
-
if (physicalRow === null || physicalColumn === null) {
|
550
|
-
return false;
|
551
|
-
}
|
552
551
|
return this.engine.doesCellHaveFormula({
|
553
552
|
sheet: sheet,
|
554
|
-
row:
|
555
|
-
col:
|
553
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
554
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
556
555
|
});
|
557
556
|
}
|
558
557
|
|
@@ -617,11 +616,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
617
616
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
618
617
|
row = _ref8.row,
|
619
618
|
col = _ref8.col;
|
620
|
-
var visualRow = (0, _mixed.isDefined)(row) ? _this12.hot.toVisualRow(row) : null;
|
621
|
-
var visualColumn = (0, _mixed.isDefined)(col) ? _this12.hot.toVisualColumn(col) : null;
|
622
619
|
|
623
620
|
// Don't try to validate cells outside of the visual part of the table.
|
624
|
-
if (
|
621
|
+
if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
625
622
|
return;
|
626
623
|
}
|
627
624
|
|
@@ -640,7 +637,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
640
637
|
}
|
641
638
|
|
642
639
|
// It will just re-render certain cell when necessary.
|
643
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
640
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
644
641
|
}
|
645
642
|
});
|
646
643
|
}
|
@@ -658,14 +655,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
658
655
|
key: "syncChangeWithEngine",
|
659
656
|
value: function syncChangeWithEngine(row, column, newValue) {
|
660
657
|
var address = {
|
661
|
-
row: this.
|
662
|
-
col: this.
|
658
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
659
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
663
660
|
sheet: this.sheetId
|
664
661
|
};
|
665
662
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
666
663
|
(0, _console.warn)("Not possible to set cell data at ".concat(JSON.stringify(address)));
|
667
664
|
return;
|
668
665
|
}
|
666
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
667
|
+
if ((0, _utils.isDate)(newValue, cellMeta.type)) {
|
668
|
+
if ((0, _utils.isDateValid)(newValue, cellMeta.dateFormat)) {
|
669
|
+
// Rewriting date in HOT format to HF format.
|
670
|
+
newValue = (0, _utils.getDateInHfFormat)(newValue, cellMeta.dateFormat);
|
671
|
+
} else if ((0, _utils.isFormula)(newValue) === false) {
|
672
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
673
|
+
newValue = "'".concat(newValue);
|
674
|
+
}
|
675
|
+
}
|
669
676
|
return this.engine.setCellContents(address, newValue);
|
670
677
|
}
|
671
678
|
|
@@ -685,11 +692,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
685
692
|
var visualColumn = this.hot.propToCol(prop);
|
686
693
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
687
694
|
var address = {
|
688
|
-
row: this.
|
689
|
-
col: this.
|
695
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
696
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
690
697
|
sheet: this.sheetId
|
691
698
|
};
|
692
|
-
var
|
699
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
700
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
701
|
+
|
702
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
703
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
704
|
+
}
|
693
705
|
|
694
706
|
// If `cellValue` is an object it is expected to be an error
|
695
707
|
return _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -710,19 +722,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
710
722
|
}, {
|
711
723
|
key: "onBeforeAutofill",
|
712
724
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
713
|
-
var
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
725
|
+
var _sourceRange$getTopSt = sourceRange.getTopStartCorner(),
|
726
|
+
sourceTopStartRow = _sourceRange$getTopSt.row,
|
727
|
+
sourceTopStartColumn = _sourceRange$getTopSt.col;
|
728
|
+
var _sourceRange$getBotto = sourceRange.getBottomEndCorner(),
|
729
|
+
sourceBottomEndRow = _sourceRange$getBotto.row,
|
730
|
+
sourceBottomEndColumn = _sourceRange$getBotto.col;
|
731
|
+
var _targetRange$getTopSt = targetRange.getTopStartCorner(),
|
732
|
+
targetTopStartRow = _targetRange$getTopSt.row,
|
733
|
+
targetTopStartColumn = _targetRange$getTopSt.col;
|
734
|
+
var _targetRange$getBotto = targetRange.getBottomEndCorner(),
|
735
|
+
targetBottomEndRow = _targetRange$getBotto.row,
|
736
|
+
targetBottomEndColumn = _targetRange$getBotto.col;
|
719
737
|
var engineSourceRange = {
|
720
|
-
start:
|
721
|
-
|
738
|
+
start: {
|
739
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
|
740
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
741
|
+
sheet: this.sheetId
|
742
|
+
},
|
743
|
+
end: {
|
744
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
745
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
746
|
+
sheet: this.sheetId
|
747
|
+
}
|
722
748
|
};
|
723
749
|
var engineTargetRange = {
|
724
|
-
start:
|
725
|
-
|
750
|
+
start: {
|
751
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
|
752
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
753
|
+
sheet: this.sheetId
|
754
|
+
},
|
755
|
+
end: {
|
756
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
757
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
758
|
+
sheet: this.sheetId
|
759
|
+
}
|
726
760
|
};
|
727
761
|
|
728
762
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -730,7 +764,33 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
730
764
|
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
731
765
|
return false;
|
732
766
|
}
|
733
|
-
|
767
|
+
var fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
|
768
|
+
var _engineSourceRange$st = engineSourceRange.start,
|
769
|
+
sourceStartRow = _engineSourceRange$st.row,
|
770
|
+
sourceStartColumn = _engineSourceRange$st.col;
|
771
|
+
var _engineSourceRange$en = engineSourceRange.end,
|
772
|
+
sourceEndRow = _engineSourceRange$en.row,
|
773
|
+
sourceEndColumn = _engineSourceRange$en.col;
|
774
|
+
var populationRowLength = sourceEndRow - sourceStartRow + 1;
|
775
|
+
var populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
|
776
|
+
for (var populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
|
777
|
+
for (var populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
|
778
|
+
var populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
|
779
|
+
var sourceRow = populatedRowIndex % populationRowLength;
|
780
|
+
var sourceColumn = populatedColumnIndex % populationColumnLength;
|
781
|
+
var sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
|
782
|
+
if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
|
783
|
+
if (populatedValue.startsWith('\'')) {
|
784
|
+
// Populating values on HOT side without apostrophe.
|
785
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
|
786
|
+
} else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
|
787
|
+
// Populating date in proper format, coming from the source cell.
|
788
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
}
|
793
|
+
return fillRangeData;
|
734
794
|
}
|
735
795
|
|
736
796
|
/**
|
@@ -754,6 +814,40 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
754
814
|
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
|
755
815
|
}
|
756
816
|
|
817
|
+
/**
|
818
|
+
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
819
|
+
*
|
820
|
+
* @private
|
821
|
+
*/
|
822
|
+
}, {
|
823
|
+
key: "onAfterCellMetaReset",
|
824
|
+
value: function onAfterCellMetaReset() {
|
825
|
+
var _this13 = this;
|
826
|
+
var sourceDataArray = this.hot.getSourceDataArray();
|
827
|
+
var valueChanged = false;
|
828
|
+
sourceDataArray.forEach(function (rowData, rowIndex) {
|
829
|
+
rowData.forEach(function (cellValue, columnIndex) {
|
830
|
+
var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
|
831
|
+
var dateFormat = cellMeta.dateFormat;
|
832
|
+
if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
|
833
|
+
valueChanged = true;
|
834
|
+
if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
|
835
|
+
// Rewriting date in HOT format to HF format.
|
836
|
+
sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
|
837
|
+
} else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
|
838
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
839
|
+
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
840
|
+
}
|
841
|
+
}
|
842
|
+
});
|
843
|
+
});
|
844
|
+
if (valueChanged === true) {
|
845
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
846
|
+
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
847
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
848
|
+
}
|
849
|
+
}
|
850
|
+
|
757
851
|
/**
|
758
852
|
* `afterLoadData` hook callback.
|
759
853
|
*
|
@@ -774,7 +868,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
774
868
|
var sourceDataArray = this.hot.getSourceDataArray();
|
775
869
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
776
870
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
777
|
-
var dependentCells = this.engine.setSheetContent(this.sheetId,
|
871
|
+
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
872
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
778
873
|
this.renderDependentSheets(dependentCells);
|
779
874
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
780
875
|
}
|
@@ -787,24 +882,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
787
882
|
* `modifyData` hook callback.
|
788
883
|
*
|
789
884
|
* @private
|
790
|
-
* @param {number}
|
791
|
-
* @param {number}
|
885
|
+
* @param {number} physicalRow Physical row index.
|
886
|
+
* @param {number} visualColumn Visual column index.
|
792
887
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
793
888
|
* property.
|
794
889
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
795
890
|
*/
|
796
891
|
}, {
|
797
892
|
key: "onModifyData",
|
798
|
-
value: function onModifyData(
|
893
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
799
894
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
800
895
|
return;
|
801
896
|
}
|
802
|
-
var visualRow = this.hot.toVisualRow(
|
897
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
898
|
+
if (visualRow === null || visualColumn === null) {
|
899
|
+
return;
|
900
|
+
}
|
803
901
|
|
804
902
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
805
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
903
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
806
904
|
if (!isFormulaCellType) {
|
807
|
-
var cellType = this.getCellType(visualRow,
|
905
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
808
906
|
if (cellType !== 'ARRAY') {
|
809
907
|
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
810
908
|
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
@@ -812,14 +910,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
812
910
|
return;
|
813
911
|
}
|
814
912
|
}
|
815
|
-
|
816
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
817
913
|
var address = {
|
818
|
-
row:
|
819
|
-
col: this.
|
914
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
915
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
820
916
|
sheet: this.sheetId
|
821
917
|
};
|
822
|
-
var cellValue = this.engine.getCellValue(address);
|
918
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
919
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
920
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
921
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
922
|
+
}
|
823
923
|
|
824
924
|
// If `cellValue` is an object it is expected to be an error
|
825
925
|
var value = _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -844,6 +944,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
844
944
|
}
|
845
945
|
var visualRow = this.hot.toVisualRow(row);
|
846
946
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
947
|
+
if (visualRow === null || visualColumn === null) {
|
948
|
+
return;
|
949
|
+
}
|
847
950
|
|
848
951
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
849
952
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -863,9 +966,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
863
966
|
return;
|
864
967
|
}
|
865
968
|
var address = {
|
866
|
-
row:
|
867
|
-
|
868
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
969
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
970
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
869
971
|
sheet: this.sheetId
|
870
972
|
};
|
871
973
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -891,21 +993,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
891
993
|
var dependentCells = this.engine.batch(function () {
|
892
994
|
changes.forEach(function (_ref9) {
|
893
995
|
var _ref10 = _slicedToArray(_ref9, 4),
|
894
|
-
|
996
|
+
visualRow = _ref10[0],
|
895
997
|
prop = _ref10[1],
|
896
998
|
newValue = _ref10[3];
|
897
|
-
var
|
898
|
-
var physicalRow = _this14.hot.toPhysicalRow(
|
899
|
-
var physicalColumn = _this14.hot.toPhysicalColumn(
|
999
|
+
var visualColumn = _this14.hot.propToCol(prop);
|
1000
|
+
var physicalRow = _this14.hot.toPhysicalRow(visualRow);
|
1001
|
+
var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
|
900
1002
|
var address = {
|
901
|
-
row:
|
902
|
-
col:
|
1003
|
+
row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1004
|
+
col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
903
1005
|
sheet: _this14.sheetId
|
904
1006
|
};
|
905
1007
|
if (physicalRow !== null && physicalColumn !== null) {
|
906
|
-
_this14.syncChangeWithEngine(
|
1008
|
+
_this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
907
1009
|
} else {
|
908
|
-
outOfBoundsChanges.push([
|
1010
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
909
1011
|
}
|
910
1012
|
changedCells.push({
|
911
1013
|
address: address
|
@@ -951,16 +1053,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
951
1053
|
var changedCells = [];
|
952
1054
|
changes.forEach(function (_ref13) {
|
953
1055
|
var _ref14 = _slicedToArray(_ref13, 4),
|
954
|
-
|
1056
|
+
visualRow = _ref14[0],
|
955
1057
|
prop = _ref14[1],
|
956
1058
|
newValue = _ref14[3];
|
957
|
-
var
|
958
|
-
if (!(0, _number.isNumeric)(
|
1059
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
1060
|
+
if (!(0, _number.isNumeric)(visualColumn)) {
|
959
1061
|
return;
|
960
1062
|
}
|
961
1063
|
var address = {
|
962
|
-
row:
|
963
|
-
col: _this15.
|
1064
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1065
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
964
1066
|
sheet: _this15.sheetId
|
965
1067
|
};
|
966
1068
|
if (!_this15.engine.isItPossibleToSetCellContents(address)) {
|
@@ -980,14 +1082,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
980
1082
|
* `beforeCreateRow` hook callback.
|
981
1083
|
*
|
982
1084
|
* @private
|
983
|
-
* @param {number}
|
1085
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
984
1086
|
* @param {number} amount Number of newly created rows in the data source array.
|
985
1087
|
* @returns {*|boolean} If false is returned the action is canceled.
|
986
1088
|
*/
|
987
1089
|
}, {
|
988
1090
|
key: "onBeforeCreateRow",
|
989
|
-
value: function onBeforeCreateRow(
|
990
|
-
|
1091
|
+
value: function onBeforeCreateRow(visualRow, amount) {
|
1092
|
+
var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
1093
|
+
if (visualRow >= this.hot.countRows()) {
|
1094
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
991
1098
|
return false;
|
992
1099
|
}
|
993
1100
|
}
|
@@ -996,14 +1103,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
996
1103
|
* `beforeCreateCol` hook callback.
|
997
1104
|
*
|
998
1105
|
* @private
|
999
|
-
* @param {number}
|
1106
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1000
1107
|
* @param {number} amount Number of newly created columns in the data source.
|
1001
1108
|
* @returns {*|boolean} If false is returned the action is canceled.
|
1002
1109
|
*/
|
1003
1110
|
}, {
|
1004
1111
|
key: "onBeforeCreateCol",
|
1005
|
-
value: function onBeforeCreateCol(
|
1006
|
-
|
1112
|
+
value: function onBeforeCreateCol(visualColumn, amount) {
|
1113
|
+
var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
1114
|
+
if (visualColumn >= this.hot.countCols()) {
|
1115
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
1007
1119
|
return false;
|
1008
1120
|
}
|
1009
1121
|
}
|
@@ -1021,8 +1133,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1021
1133
|
key: "onBeforeRemoveRow",
|
1022
1134
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
1023
1135
|
var _this16 = this;
|
1024
|
-
var
|
1025
|
-
|
1136
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1137
|
+
var possible = hfRows.every(function (hfRow) {
|
1138
|
+
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
1026
1139
|
});
|
1027
1140
|
return possible === false ? false : void 0;
|
1028
1141
|
}
|
@@ -1040,8 +1153,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1040
1153
|
key: "onBeforeRemoveCol",
|
1041
1154
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1042
1155
|
var _this17 = this;
|
1043
|
-
var
|
1044
|
-
|
1156
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1157
|
+
var possible = hfColumns.every(function (hfColumn) {
|
1158
|
+
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1045
1159
|
});
|
1046
1160
|
return possible === false ? false : void 0;
|
1047
1161
|
}
|
@@ -1050,18 +1164,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1050
1164
|
* `afterCreateRow` hook callback.
|
1051
1165
|
*
|
1052
1166
|
* @private
|
1053
|
-
* @param {number}
|
1167
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1054
1168
|
* @param {number} amount Number of newly created rows in the data source array.
|
1055
1169
|
* @param {string} [source] String that identifies source of hook call
|
1056
1170
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1057
1171
|
*/
|
1058
1172
|
}, {
|
1059
1173
|
key: "onAfterCreateRow",
|
1060
|
-
value: function onAfterCreateRow(
|
1174
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
1061
1175
|
if (isBlockedSource(source)) {
|
1062
1176
|
return;
|
1063
1177
|
}
|
1064
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1178
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1065
1179
|
this.renderDependentSheets(changes);
|
1066
1180
|
}
|
1067
1181
|
|
@@ -1069,18 +1183,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1069
1183
|
* `afterCreateCol` hook callback.
|
1070
1184
|
*
|
1071
1185
|
* @private
|
1072
|
-
* @param {number}
|
1186
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1073
1187
|
* @param {number} amount Number of newly created columns in the data source.
|
1074
1188
|
* @param {string} [source] String that identifies source of hook call
|
1075
1189
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1076
1190
|
*/
|
1077
1191
|
}, {
|
1078
1192
|
key: "onAfterCreateCol",
|
1079
|
-
value: function onAfterCreateCol(
|
1193
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
1080
1194
|
if (isBlockedSource(source)) {
|
1081
1195
|
return;
|
1082
1196
|
}
|
1083
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1197
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1084
1198
|
this.renderDependentSheets(changes);
|
1085
1199
|
}
|
1086
1200
|
|
@@ -1101,10 +1215,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1101
1215
|
if (isBlockedSource(source)) {
|
1102
1216
|
return;
|
1103
1217
|
}
|
1104
|
-
var
|
1218
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1105
1219
|
var changes = this.engine.batch(function () {
|
1106
|
-
|
1107
|
-
_this18.engine.removeRows(_this18.sheetId, [
|
1220
|
+
descendingHfRows.forEach(function (hfRow) {
|
1221
|
+
_this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
|
1108
1222
|
});
|
1109
1223
|
});
|
1110
1224
|
this.renderDependentSheets(changes);
|
@@ -1127,10 +1241,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1127
1241
|
if (isBlockedSource(source)) {
|
1128
1242
|
return;
|
1129
1243
|
}
|
1130
|
-
var
|
1244
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1131
1245
|
var changes = this.engine.batch(function () {
|
1132
|
-
|
1133
|
-
_this19.engine.removeColumns(_this19.sheetId, [
|
1246
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
1247
|
+
_this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
|
1134
1248
|
});
|
1135
1249
|
});
|
1136
1250
|
this.renderDependentSheets(changes);
|
@@ -1255,6 +1369,11 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1255
1369
|
get: function get() {
|
1256
1370
|
return PLUGIN_PRIORITY;
|
1257
1371
|
}
|
1372
|
+
}, {
|
1373
|
+
key: "SETTING_KEYS",
|
1374
|
+
get: function get() {
|
1375
|
+
return [PLUGIN_KEY].concat(SETTING_KEYS);
|
1376
|
+
}
|
1258
1377
|
}]);
|
1259
1378
|
return Formulas;
|
1260
1379
|
}(_base.BasePlugin);
|