handsontable 0.0.0-next-3be5fb5-20230427 → 0.0.0-next-aad186f-20230428
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- 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/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/base.js +2 -4
- package/base.mjs +2 -2
- package/core.js +7 -3
- package/core.mjs +7 -3
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2453 -1877
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +113 -105
- package/dist/handsontable.js +2215 -1640
- 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 +1 -1
- package/helpers/mixed.mjs +1 -1
- 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/formulas/formulas.js +139 -134
- package/plugins/formulas/formulas.mjs +139 -134
- 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/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
|
@@ -45,6 +45,7 @@ var _settings = require("./engine/settings");
|
|
|
45
45
|
var _data = require("../../helpers/data");
|
|
46
46
|
var _string = require("../../helpers/string");
|
|
47
47
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
|
48
|
+
var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
|
|
48
49
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
50
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
50
51
|
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."); }
|
|
@@ -87,7 +88,6 @@ var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
|
|
87
88
|
exports.SETTING_KEYS = SETTING_KEYS;
|
|
88
89
|
var PLUGIN_PRIORITY = 260;
|
|
89
90
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
|
90
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
|
91
91
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
|
|
92
92
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
|
|
93
93
|
_pluginHooks.default.getSingleton().register('afterSheetAdded');
|
|
@@ -193,6 +193,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
193
193
|
* @type {string|null}
|
|
194
194
|
*/
|
|
195
195
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
|
196
|
+
/**
|
|
197
|
+
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
|
198
|
+
*
|
|
199
|
+
* @type {IndexSyncer|null}
|
|
200
|
+
*/
|
|
201
|
+
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
|
202
|
+
/**
|
|
203
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
|
204
|
+
*
|
|
205
|
+
* @type {AxisSyncer|null}
|
|
206
|
+
*/
|
|
207
|
+
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
|
208
|
+
/**
|
|
209
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
|
210
|
+
*
|
|
211
|
+
* @type {AxisSyncer|null}
|
|
212
|
+
*/
|
|
213
|
+
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
|
196
214
|
return _this;
|
|
197
215
|
}
|
|
198
216
|
_createClass(Formulas, [{
|
|
@@ -300,6 +318,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
300
318
|
this.addHook('afterRemoveCol', function () {
|
|
301
319
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
|
302
320
|
});
|
|
321
|
+
this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
|
322
|
+
_this8.hot.addHookOnce('init', function () {
|
|
323
|
+
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
|
324
|
+
// be postponed.
|
|
325
|
+
postponedAction();
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
|
329
|
+
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
|
330
|
+
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
|
331
|
+
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
|
332
|
+
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
|
333
|
+
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
|
334
|
+
});
|
|
335
|
+
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
|
336
|
+
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
|
337
|
+
});
|
|
338
|
+
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
|
339
|
+
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
|
340
|
+
});
|
|
341
|
+
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
|
342
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
|
343
|
+
});
|
|
344
|
+
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
|
345
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
|
346
|
+
});
|
|
347
|
+
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
|
348
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
|
349
|
+
});
|
|
350
|
+
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
|
351
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
|
352
|
+
});
|
|
353
|
+
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
|
354
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
|
355
|
+
});
|
|
303
356
|
|
|
304
357
|
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
|
305
358
|
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
|
@@ -309,22 +362,22 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
309
362
|
});
|
|
310
363
|
|
|
311
364
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
|
312
|
-
this.addHook('beforeUndo', function (
|
|
313
|
-
|
|
314
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
365
|
+
this.addHook('beforeUndo', function () {
|
|
366
|
+
_this8.indexSyncer.setPerformUndo(true);
|
|
317
367
|
_this8.engine.undo();
|
|
318
368
|
});
|
|
319
369
|
|
|
320
370
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
|
321
|
-
this.addHook('beforeRedo', function (
|
|
322
|
-
|
|
323
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
371
|
+
this.addHook('beforeRedo', function () {
|
|
372
|
+
_this8.indexSyncer.setPerformRedo(true);
|
|
326
373
|
_this8.engine.redo();
|
|
327
374
|
});
|
|
375
|
+
this.addHook('afterUndo', function () {
|
|
376
|
+
_this8.indexSyncer.setPerformUndo(false);
|
|
377
|
+
});
|
|
378
|
+
this.addHook('afterUndo', function () {
|
|
379
|
+
_this8.indexSyncer.setPerformRedo(false);
|
|
380
|
+
});
|
|
328
381
|
this.addHook('afterDetachChild', function () {
|
|
329
382
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
|
330
383
|
});
|
|
@@ -409,63 +462,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
409
462
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
|
410
463
|
}
|
|
411
464
|
|
|
412
|
-
/**
|
|
413
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
|
414
|
-
*
|
|
415
|
-
* @private
|
|
416
|
-
* @param {number} visualIndex Visual entry index.
|
|
417
|
-
* @param {number} physicalIndex Physical entry index.
|
|
418
|
-
* @param {number} entriesCount Visual entries count.
|
|
419
|
-
* @param {number} sourceEntriesCount Source entries count.
|
|
420
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
|
421
|
-
* `toPhysical` alias.
|
|
422
|
-
* @returns {*}
|
|
423
|
-
*/
|
|
424
|
-
}, {
|
|
425
|
-
key: "getPhysicalIndexPosition",
|
|
426
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
|
427
|
-
if (!contained) {
|
|
428
|
-
if (visualIndex >= entriesCount) {
|
|
429
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
return physicalIndex;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
|
437
|
-
* `null` on rows with indexes higher than the number of rows.
|
|
438
|
-
*
|
|
439
|
-
* @private
|
|
440
|
-
* @param {number} row Visual row index.
|
|
441
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
|
442
|
-
* `toPhysical` alias.
|
|
443
|
-
* @returns {number} The physical row index.
|
|
444
|
-
*/
|
|
445
|
-
}, {
|
|
446
|
-
key: "toPhysicalRowPosition",
|
|
447
|
-
value: function toPhysicalRowPosition(row) {
|
|
448
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
449
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
|
454
|
-
* `null` on columns with indexes higher than the number of columns.
|
|
455
|
-
*
|
|
456
|
-
* @private
|
|
457
|
-
* @param {number} column Visual column index.
|
|
458
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
|
459
|
-
* `toPhysical` alias.
|
|
460
|
-
* @returns {number} The physical column index.
|
|
461
|
-
*/
|
|
462
|
-
}, {
|
|
463
|
-
key: "toPhysicalColumnPosition",
|
|
464
|
-
value: function toPhysicalColumnPosition(column) {
|
|
465
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
466
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
465
|
/**
|
|
470
466
|
* Add a sheet to the shared HyperFormula instance.
|
|
471
467
|
*
|
|
@@ -536,8 +532,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
536
532
|
if (physicalRow !== null && physicalColumn !== null) {
|
|
537
533
|
return this.engine.getCellType({
|
|
538
534
|
sheet: sheet,
|
|
539
|
-
row:
|
|
540
|
-
col:
|
|
535
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
536
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
|
541
537
|
});
|
|
542
538
|
} else {
|
|
543
539
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
|
@@ -557,15 +553,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
557
553
|
key: "isFormulaCellType",
|
|
558
554
|
value: function isFormulaCellType(row, column) {
|
|
559
555
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
|
560
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
|
561
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
|
562
|
-
if (physicalRow === null || physicalColumn === null) {
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
565
556
|
return this.engine.doesCellHaveFormula({
|
|
566
557
|
sheet: sheet,
|
|
567
|
-
row:
|
|
568
|
-
col:
|
|
558
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
559
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
|
569
560
|
});
|
|
570
561
|
}
|
|
571
562
|
|
|
@@ -630,11 +621,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
630
621
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
|
631
622
|
row = _ref8.row,
|
|
632
623
|
col = _ref8.col;
|
|
633
|
-
var visualRow = (0, _mixed.isDefined)(row) ? _this12.hot.toVisualRow(row) : null;
|
|
634
|
-
var visualColumn = (0, _mixed.isDefined)(col) ? _this12.hot.toVisualColumn(col) : null;
|
|
635
624
|
|
|
636
625
|
// Don't try to validate cells outside of the visual part of the table.
|
|
637
|
-
if (
|
|
626
|
+
if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
|
638
627
|
return;
|
|
639
628
|
}
|
|
640
629
|
|
|
@@ -653,7 +642,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
653
642
|
}
|
|
654
643
|
|
|
655
644
|
// It will just re-render certain cell when necessary.
|
|
656
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
|
645
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
|
657
646
|
}
|
|
658
647
|
});
|
|
659
648
|
}
|
|
@@ -671,8 +660,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
671
660
|
key: "syncChangeWithEngine",
|
|
672
661
|
value: function syncChangeWithEngine(row, column, newValue) {
|
|
673
662
|
var address = {
|
|
674
|
-
row: this.
|
|
675
|
-
col: this.
|
|
663
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
664
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
|
676
665
|
sheet: this.sheetId
|
|
677
666
|
};
|
|
678
667
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
|
@@ -708,8 +697,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
708
697
|
var visualColumn = this.hot.propToCol(prop);
|
|
709
698
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
|
710
699
|
var address = {
|
|
711
|
-
row: this.
|
|
712
|
-
col: this.
|
|
700
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
701
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
713
702
|
sheet: this.sheetId
|
|
714
703
|
};
|
|
715
704
|
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
|
@@ -863,6 +852,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
863
852
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
|
864
853
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
|
865
854
|
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
|
855
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
|
866
856
|
this.renderDependentSheets(dependentCells);
|
|
867
857
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
|
868
858
|
}
|
|
@@ -875,24 +865,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
875
865
|
* `modifyData` hook callback.
|
|
876
866
|
*
|
|
877
867
|
* @private
|
|
878
|
-
* @param {number}
|
|
879
|
-
* @param {number}
|
|
868
|
+
* @param {number} physicalRow Physical row index.
|
|
869
|
+
* @param {number} visualColumn Visual column index.
|
|
880
870
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
|
881
871
|
* property.
|
|
882
872
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
|
883
873
|
*/
|
|
884
874
|
}, {
|
|
885
875
|
key: "onModifyData",
|
|
886
|
-
value: function onModifyData(
|
|
876
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
887
877
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
|
888
878
|
return;
|
|
889
879
|
}
|
|
890
|
-
var visualRow = this.hot.toVisualRow(
|
|
880
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
|
881
|
+
if (visualRow === null || visualColumn === null) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
891
884
|
|
|
892
885
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
|
893
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
|
886
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
|
894
887
|
if (!isFormulaCellType) {
|
|
895
|
-
var cellType = this.getCellType(visualRow,
|
|
888
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
|
896
889
|
if (cellType !== 'ARRAY') {
|
|
897
890
|
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
|
898
891
|
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
|
@@ -900,15 +893,13 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
900
893
|
return;
|
|
901
894
|
}
|
|
902
895
|
}
|
|
903
|
-
|
|
904
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
|
905
896
|
var address = {
|
|
906
|
-
row:
|
|
907
|
-
col: this.
|
|
897
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
898
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
908
899
|
sheet: this.sheetId
|
|
909
900
|
};
|
|
910
901
|
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
|
911
|
-
var cellMeta = this.hot.getCellMeta(
|
|
902
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
|
912
903
|
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
|
913
904
|
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
|
914
905
|
}
|
|
@@ -936,6 +927,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
936
927
|
}
|
|
937
928
|
var visualRow = this.hot.toVisualRow(row);
|
|
938
929
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
|
930
|
+
if (visualRow === null || visualColumn === null) {
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
939
933
|
|
|
940
934
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
|
941
935
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
|
@@ -955,9 +949,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
955
949
|
return;
|
|
956
950
|
}
|
|
957
951
|
var address = {
|
|
958
|
-
row:
|
|
959
|
-
|
|
960
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
|
952
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
953
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
961
954
|
sheet: this.sheetId
|
|
962
955
|
};
|
|
963
956
|
valueHolder.value = this.engine.getCellSerialized(address);
|
|
@@ -983,21 +976,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
983
976
|
var dependentCells = this.engine.batch(function () {
|
|
984
977
|
changes.forEach(function (_ref9) {
|
|
985
978
|
var _ref10 = _slicedToArray(_ref9, 4),
|
|
986
|
-
|
|
979
|
+
visualRow = _ref10[0],
|
|
987
980
|
prop = _ref10[1],
|
|
988
981
|
newValue = _ref10[3];
|
|
989
|
-
var
|
|
990
|
-
var physicalRow = _this15.hot.toPhysicalRow(
|
|
991
|
-
var physicalColumn = _this15.hot.toPhysicalColumn(
|
|
982
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
|
983
|
+
var physicalRow = _this15.hot.toPhysicalRow(visualRow);
|
|
984
|
+
var physicalColumn = _this15.hot.toPhysicalColumn(visualColumn);
|
|
992
985
|
var address = {
|
|
993
|
-
row:
|
|
994
|
-
col:
|
|
986
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
987
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
995
988
|
sheet: _this15.sheetId
|
|
996
989
|
};
|
|
997
990
|
if (physicalRow !== null && physicalColumn !== null) {
|
|
998
|
-
_this15.syncChangeWithEngine(
|
|
991
|
+
_this15.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
|
999
992
|
} else {
|
|
1000
|
-
outOfBoundsChanges.push([
|
|
993
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
|
1001
994
|
}
|
|
1002
995
|
changedCells.push({
|
|
1003
996
|
address: address
|
|
@@ -1043,16 +1036,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1043
1036
|
var changedCells = [];
|
|
1044
1037
|
changes.forEach(function (_ref13) {
|
|
1045
1038
|
var _ref14 = _slicedToArray(_ref13, 4),
|
|
1046
|
-
|
|
1039
|
+
visualRow = _ref14[0],
|
|
1047
1040
|
prop = _ref14[1],
|
|
1048
1041
|
newValue = _ref14[3];
|
|
1049
|
-
var
|
|
1050
|
-
if (!(0, _number.isNumeric)(
|
|
1042
|
+
var visualColumn = _this16.hot.propToCol(prop);
|
|
1043
|
+
if (!(0, _number.isNumeric)(visualColumn)) {
|
|
1051
1044
|
return;
|
|
1052
1045
|
}
|
|
1053
1046
|
var address = {
|
|
1054
|
-
row:
|
|
1055
|
-
col: _this16.
|
|
1047
|
+
row: _this16.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
1048
|
+
col: _this16.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
1056
1049
|
sheet: _this16.sheetId
|
|
1057
1050
|
};
|
|
1058
1051
|
if (!_this16.engine.isItPossibleToSetCellContents(address)) {
|
|
@@ -1072,14 +1065,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1072
1065
|
* `beforeCreateRow` hook callback.
|
|
1073
1066
|
*
|
|
1074
1067
|
* @private
|
|
1075
|
-
* @param {number}
|
|
1068
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
|
1076
1069
|
* @param {number} amount Number of newly created rows in the data source array.
|
|
1077
1070
|
* @returns {*|boolean} If false is returned the action is canceled.
|
|
1078
1071
|
*/
|
|
1079
1072
|
}, {
|
|
1080
1073
|
key: "onBeforeCreateRow",
|
|
1081
|
-
value: function onBeforeCreateRow(
|
|
1082
|
-
|
|
1074
|
+
value: function onBeforeCreateRow(visualRow, amount) {
|
|
1075
|
+
var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
|
1076
|
+
if (visualRow >= this.hot.countRows()) {
|
|
1077
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
|
1083
1081
|
return false;
|
|
1084
1082
|
}
|
|
1085
1083
|
}
|
|
@@ -1088,14 +1086,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1088
1086
|
* `beforeCreateCol` hook callback.
|
|
1089
1087
|
*
|
|
1090
1088
|
* @private
|
|
1091
|
-
* @param {number}
|
|
1089
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
|
1092
1090
|
* @param {number} amount Number of newly created columns in the data source.
|
|
1093
1091
|
* @returns {*|boolean} If false is returned the action is canceled.
|
|
1094
1092
|
*/
|
|
1095
1093
|
}, {
|
|
1096
1094
|
key: "onBeforeCreateCol",
|
|
1097
|
-
value: function onBeforeCreateCol(
|
|
1098
|
-
|
|
1095
|
+
value: function onBeforeCreateCol(visualColumn, amount) {
|
|
1096
|
+
var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
|
1097
|
+
if (visualColumn >= this.hot.countCols()) {
|
|
1098
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
|
1099
1102
|
return false;
|
|
1100
1103
|
}
|
|
1101
1104
|
}
|
|
@@ -1113,8 +1116,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1113
1116
|
key: "onBeforeRemoveRow",
|
|
1114
1117
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
|
1115
1118
|
var _this17 = this;
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1119
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
|
1120
|
+
var possible = hfRows.every(function (hfRow) {
|
|
1121
|
+
return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [hfRow, 1]);
|
|
1118
1122
|
});
|
|
1119
1123
|
return possible === false ? false : void 0;
|
|
1120
1124
|
}
|
|
@@ -1132,8 +1136,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1132
1136
|
key: "onBeforeRemoveCol",
|
|
1133
1137
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
|
1134
1138
|
var _this18 = this;
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1139
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
|
1140
|
+
var possible = hfColumns.every(function (hfColumn) {
|
|
1141
|
+
return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [hfColumn, 1]);
|
|
1137
1142
|
});
|
|
1138
1143
|
return possible === false ? false : void 0;
|
|
1139
1144
|
}
|
|
@@ -1142,18 +1147,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1142
1147
|
* `afterCreateRow` hook callback.
|
|
1143
1148
|
*
|
|
1144
1149
|
* @private
|
|
1145
|
-
* @param {number}
|
|
1150
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
|
1146
1151
|
* @param {number} amount Number of newly created rows in the data source array.
|
|
1147
1152
|
* @param {string} [source] String that identifies source of hook call
|
|
1148
1153
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
|
1149
1154
|
*/
|
|
1150
1155
|
}, {
|
|
1151
1156
|
key: "onAfterCreateRow",
|
|
1152
|
-
value: function onAfterCreateRow(
|
|
1157
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
|
1153
1158
|
if (isBlockedSource(source)) {
|
|
1154
1159
|
return;
|
|
1155
1160
|
}
|
|
1156
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
|
1161
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
|
1157
1162
|
this.renderDependentSheets(changes);
|
|
1158
1163
|
}
|
|
1159
1164
|
|
|
@@ -1161,18 +1166,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1161
1166
|
* `afterCreateCol` hook callback.
|
|
1162
1167
|
*
|
|
1163
1168
|
* @private
|
|
1164
|
-
* @param {number}
|
|
1169
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
|
1165
1170
|
* @param {number} amount Number of newly created columns in the data source.
|
|
1166
1171
|
* @param {string} [source] String that identifies source of hook call
|
|
1167
1172
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
|
1168
1173
|
*/
|
|
1169
1174
|
}, {
|
|
1170
1175
|
key: "onAfterCreateCol",
|
|
1171
|
-
value: function onAfterCreateCol(
|
|
1176
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
|
1172
1177
|
if (isBlockedSource(source)) {
|
|
1173
1178
|
return;
|
|
1174
1179
|
}
|
|
1175
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
|
1180
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
|
1176
1181
|
this.renderDependentSheets(changes);
|
|
1177
1182
|
}
|
|
1178
1183
|
|
|
@@ -1193,10 +1198,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1193
1198
|
if (isBlockedSource(source)) {
|
|
1194
1199
|
return;
|
|
1195
1200
|
}
|
|
1196
|
-
var
|
|
1201
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
|
1197
1202
|
var changes = this.engine.batch(function () {
|
|
1198
|
-
|
|
1199
|
-
_this19.engine.removeRows(_this19.sheetId, [
|
|
1203
|
+
descendingHfRows.forEach(function (hfRow) {
|
|
1204
|
+
_this19.engine.removeRows(_this19.sheetId, [hfRow, 1]);
|
|
1200
1205
|
});
|
|
1201
1206
|
});
|
|
1202
1207
|
this.renderDependentSheets(changes);
|
|
@@ -1219,10 +1224,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1219
1224
|
if (isBlockedSource(source)) {
|
|
1220
1225
|
return;
|
|
1221
1226
|
}
|
|
1222
|
-
var
|
|
1227
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
|
1223
1228
|
var changes = this.engine.batch(function () {
|
|
1224
|
-
|
|
1225
|
-
_this20.engine.removeColumns(_this20.sheetId, [
|
|
1229
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
|
1230
|
+
_this20.engine.removeColumns(_this20.sheetId, [hfColumn, 1]);
|
|
1226
1231
|
});
|
|
1227
1232
|
});
|
|
1228
1233
|
this.renderDependentSheets(changes);
|