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
|
@@ -76,10 +76,10 @@ import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./eng
|
|
|
76
76
|
import { isArrayOfArrays } from "../../helpers/data.mjs";
|
|
77
77
|
import { toUpperCaseFirst } from "../../helpers/string.mjs";
|
|
78
78
|
import Hooks from "../../pluginHooks.mjs";
|
|
79
|
+
import IndexSyncer from "./indexSyncer/index.mjs";
|
|
79
80
|
export var PLUGIN_KEY = 'formulas';
|
|
80
81
|
export var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
|
81
82
|
export var PLUGIN_PRIORITY = 260;
|
|
82
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
|
83
83
|
Hooks.getSingleton().register('afterNamedExpressionAdded');
|
|
84
84
|
Hooks.getSingleton().register('afterNamedExpressionRemoved');
|
|
85
85
|
Hooks.getSingleton().register('afterSheetAdded');
|
|
@@ -185,6 +185,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
185
185
|
* @type {string|null}
|
|
186
186
|
*/
|
|
187
187
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
|
188
|
+
/**
|
|
189
|
+
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
|
190
|
+
*
|
|
191
|
+
* @type {IndexSyncer|null}
|
|
192
|
+
*/
|
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
|
194
|
+
/**
|
|
195
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
|
196
|
+
*
|
|
197
|
+
* @type {AxisSyncer|null}
|
|
198
|
+
*/
|
|
199
|
+
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
|
200
|
+
/**
|
|
201
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
|
202
|
+
*
|
|
203
|
+
* @type {AxisSyncer|null}
|
|
204
|
+
*/
|
|
205
|
+
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
|
188
206
|
return _this;
|
|
189
207
|
}
|
|
190
208
|
_createClass(Formulas, [{
|
|
@@ -292,6 +310,41 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
292
310
|
this.addHook('afterRemoveCol', function () {
|
|
293
311
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
|
294
312
|
});
|
|
313
|
+
this.indexSyncer = new IndexSyncer(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
|
314
|
+
_this8.hot.addHookOnce('init', function () {
|
|
315
|
+
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
|
316
|
+
// be postponed.
|
|
317
|
+
postponedAction();
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
|
321
|
+
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
|
322
|
+
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
|
323
|
+
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
|
324
|
+
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
|
325
|
+
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
|
326
|
+
});
|
|
327
|
+
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
|
328
|
+
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
|
329
|
+
});
|
|
330
|
+
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
|
331
|
+
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
|
332
|
+
});
|
|
333
|
+
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
|
334
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
|
335
|
+
});
|
|
336
|
+
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
|
337
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
|
338
|
+
});
|
|
339
|
+
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
|
340
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
|
341
|
+
});
|
|
342
|
+
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
|
343
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
|
344
|
+
});
|
|
345
|
+
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
|
346
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
|
347
|
+
});
|
|
295
348
|
|
|
296
349
|
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
|
297
350
|
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
|
@@ -301,22 +354,22 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
301
354
|
});
|
|
302
355
|
|
|
303
356
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
|
304
|
-
this.addHook('beforeUndo', function (
|
|
305
|
-
|
|
306
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
357
|
+
this.addHook('beforeUndo', function () {
|
|
358
|
+
_this8.indexSyncer.setPerformUndo(true);
|
|
309
359
|
_this8.engine.undo();
|
|
310
360
|
});
|
|
311
361
|
|
|
312
362
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
|
313
|
-
this.addHook('beforeRedo', function (
|
|
314
|
-
|
|
315
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
363
|
+
this.addHook('beforeRedo', function () {
|
|
364
|
+
_this8.indexSyncer.setPerformRedo(true);
|
|
318
365
|
_this8.engine.redo();
|
|
319
366
|
});
|
|
367
|
+
this.addHook('afterUndo', function () {
|
|
368
|
+
_this8.indexSyncer.setPerformUndo(false);
|
|
369
|
+
});
|
|
370
|
+
this.addHook('afterUndo', function () {
|
|
371
|
+
_this8.indexSyncer.setPerformRedo(false);
|
|
372
|
+
});
|
|
320
373
|
this.addHook('afterDetachChild', function () {
|
|
321
374
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
|
322
375
|
});
|
|
@@ -401,63 +454,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
401
454
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
|
402
455
|
}
|
|
403
456
|
|
|
404
|
-
/**
|
|
405
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
|
406
|
-
*
|
|
407
|
-
* @private
|
|
408
|
-
* @param {number} visualIndex Visual entry index.
|
|
409
|
-
* @param {number} physicalIndex Physical entry index.
|
|
410
|
-
* @param {number} entriesCount Visual entries count.
|
|
411
|
-
* @param {number} sourceEntriesCount Source entries count.
|
|
412
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
|
413
|
-
* `toPhysical` alias.
|
|
414
|
-
* @returns {*}
|
|
415
|
-
*/
|
|
416
|
-
}, {
|
|
417
|
-
key: "getPhysicalIndexPosition",
|
|
418
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
|
419
|
-
if (!contained) {
|
|
420
|
-
if (visualIndex >= entriesCount) {
|
|
421
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return physicalIndex;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
|
429
|
-
* `null` on rows with indexes higher than the number of rows.
|
|
430
|
-
*
|
|
431
|
-
* @private
|
|
432
|
-
* @param {number} row Visual row index.
|
|
433
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
|
434
|
-
* `toPhysical` alias.
|
|
435
|
-
* @returns {number} The physical row index.
|
|
436
|
-
*/
|
|
437
|
-
}, {
|
|
438
|
-
key: "toPhysicalRowPosition",
|
|
439
|
-
value: function toPhysicalRowPosition(row) {
|
|
440
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
441
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
|
446
|
-
* `null` on columns with indexes higher than the number of columns.
|
|
447
|
-
*
|
|
448
|
-
* @private
|
|
449
|
-
* @param {number} column Visual column index.
|
|
450
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
|
451
|
-
* `toPhysical` alias.
|
|
452
|
-
* @returns {number} The physical column index.
|
|
453
|
-
*/
|
|
454
|
-
}, {
|
|
455
|
-
key: "toPhysicalColumnPosition",
|
|
456
|
-
value: function toPhysicalColumnPosition(column) {
|
|
457
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
458
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
457
|
/**
|
|
462
458
|
* Add a sheet to the shared HyperFormula instance.
|
|
463
459
|
*
|
|
@@ -528,8 +524,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
528
524
|
if (physicalRow !== null && physicalColumn !== null) {
|
|
529
525
|
return this.engine.getCellType({
|
|
530
526
|
sheet: sheet,
|
|
531
|
-
row:
|
|
532
|
-
col:
|
|
527
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
528
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
|
533
529
|
});
|
|
534
530
|
} else {
|
|
535
531
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
|
@@ -549,15 +545,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
549
545
|
key: "isFormulaCellType",
|
|
550
546
|
value: function isFormulaCellType(row, column) {
|
|
551
547
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
|
552
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
|
553
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
|
554
|
-
if (physicalRow === null || physicalColumn === null) {
|
|
555
|
-
return false;
|
|
556
|
-
}
|
|
557
548
|
return this.engine.doesCellHaveFormula({
|
|
558
549
|
sheet: sheet,
|
|
559
|
-
row:
|
|
560
|
-
col:
|
|
550
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
551
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
|
561
552
|
});
|
|
562
553
|
}
|
|
563
554
|
|
|
@@ -622,11 +613,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
622
613
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
|
623
614
|
row = _ref8.row,
|
|
624
615
|
col = _ref8.col;
|
|
625
|
-
var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
|
|
626
|
-
var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
|
|
627
616
|
|
|
628
617
|
// Don't try to validate cells outside of the visual part of the table.
|
|
629
|
-
if (
|
|
618
|
+
if (isDefined(row) === false || isDefined(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
|
630
619
|
return;
|
|
631
620
|
}
|
|
632
621
|
|
|
@@ -645,7 +634,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
645
634
|
}
|
|
646
635
|
|
|
647
636
|
// It will just re-render certain cell when necessary.
|
|
648
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
|
637
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
|
649
638
|
}
|
|
650
639
|
});
|
|
651
640
|
}
|
|
@@ -663,8 +652,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
663
652
|
key: "syncChangeWithEngine",
|
|
664
653
|
value: function syncChangeWithEngine(row, column, newValue) {
|
|
665
654
|
var address = {
|
|
666
|
-
row: this.
|
|
667
|
-
col: this.
|
|
655
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
|
656
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
|
668
657
|
sheet: this.sheetId
|
|
669
658
|
};
|
|
670
659
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
|
@@ -700,8 +689,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
700
689
|
var visualColumn = this.hot.propToCol(prop);
|
|
701
690
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
|
702
691
|
var address = {
|
|
703
|
-
row: this.
|
|
704
|
-
col: this.
|
|
692
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
693
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
705
694
|
sheet: this.sheetId
|
|
706
695
|
};
|
|
707
696
|
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
|
@@ -855,6 +844,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
855
844
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
|
856
845
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
|
857
846
|
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
|
847
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
|
858
848
|
this.renderDependentSheets(dependentCells);
|
|
859
849
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
|
860
850
|
}
|
|
@@ -867,24 +857,27 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
867
857
|
* `modifyData` hook callback.
|
|
868
858
|
*
|
|
869
859
|
* @private
|
|
870
|
-
* @param {number}
|
|
871
|
-
* @param {number}
|
|
860
|
+
* @param {number} physicalRow Physical row index.
|
|
861
|
+
* @param {number} visualColumn Visual column index.
|
|
872
862
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
|
873
863
|
* property.
|
|
874
864
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
|
875
865
|
*/
|
|
876
866
|
}, {
|
|
877
867
|
key: "onModifyData",
|
|
878
|
-
value: function onModifyData(
|
|
868
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
879
869
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
|
880
870
|
return;
|
|
881
871
|
}
|
|
882
|
-
var visualRow = this.hot.toVisualRow(
|
|
872
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
|
873
|
+
if (visualRow === null || visualColumn === null) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
883
876
|
|
|
884
877
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
|
885
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
|
878
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
|
886
879
|
if (!isFormulaCellType) {
|
|
887
|
-
var cellType = this.getCellType(visualRow,
|
|
880
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
|
888
881
|
if (cellType !== 'ARRAY') {
|
|
889
882
|
if (isEscapedFormulaExpression(valueHolder.value)) {
|
|
890
883
|
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
|
@@ -892,15 +885,13 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
892
885
|
return;
|
|
893
886
|
}
|
|
894
887
|
}
|
|
895
|
-
|
|
896
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
|
897
888
|
var address = {
|
|
898
|
-
row:
|
|
899
|
-
col: this.
|
|
889
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
890
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
900
891
|
sheet: this.sheetId
|
|
901
892
|
};
|
|
902
893
|
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
|
903
|
-
var cellMeta = this.hot.getCellMeta(
|
|
894
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
|
904
895
|
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
|
905
896
|
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
|
906
897
|
}
|
|
@@ -928,6 +919,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
928
919
|
}
|
|
929
920
|
var visualRow = this.hot.toVisualRow(row);
|
|
930
921
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
|
922
|
+
if (visualRow === null || visualColumn === null) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
931
925
|
|
|
932
926
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
|
933
927
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
|
@@ -947,9 +941,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
947
941
|
return;
|
|
948
942
|
}
|
|
949
943
|
var address = {
|
|
950
|
-
row:
|
|
951
|
-
|
|
952
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
|
944
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
945
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
953
946
|
sheet: this.sheetId
|
|
954
947
|
};
|
|
955
948
|
valueHolder.value = this.engine.getCellSerialized(address);
|
|
@@ -975,21 +968,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
975
968
|
var dependentCells = this.engine.batch(function () {
|
|
976
969
|
changes.forEach(function (_ref9) {
|
|
977
970
|
var _ref10 = _slicedToArray(_ref9, 4),
|
|
978
|
-
|
|
971
|
+
visualRow = _ref10[0],
|
|
979
972
|
prop = _ref10[1],
|
|
980
973
|
newValue = _ref10[3];
|
|
981
|
-
var
|
|
982
|
-
var physicalRow = _this15.hot.toPhysicalRow(
|
|
983
|
-
var physicalColumn = _this15.hot.toPhysicalColumn(
|
|
974
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
|
975
|
+
var physicalRow = _this15.hot.toPhysicalRow(visualRow);
|
|
976
|
+
var physicalColumn = _this15.hot.toPhysicalColumn(visualColumn);
|
|
984
977
|
var address = {
|
|
985
|
-
row:
|
|
986
|
-
col:
|
|
978
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
979
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
987
980
|
sheet: _this15.sheetId
|
|
988
981
|
};
|
|
989
982
|
if (physicalRow !== null && physicalColumn !== null) {
|
|
990
|
-
_this15.syncChangeWithEngine(
|
|
983
|
+
_this15.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
|
991
984
|
} else {
|
|
992
|
-
outOfBoundsChanges.push([
|
|
985
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
|
993
986
|
}
|
|
994
987
|
changedCells.push({
|
|
995
988
|
address: address
|
|
@@ -1035,16 +1028,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1035
1028
|
var changedCells = [];
|
|
1036
1029
|
changes.forEach(function (_ref13) {
|
|
1037
1030
|
var _ref14 = _slicedToArray(_ref13, 4),
|
|
1038
|
-
|
|
1031
|
+
visualRow = _ref14[0],
|
|
1039
1032
|
prop = _ref14[1],
|
|
1040
1033
|
newValue = _ref14[3];
|
|
1041
|
-
var
|
|
1042
|
-
if (!isNumeric(
|
|
1034
|
+
var visualColumn = _this16.hot.propToCol(prop);
|
|
1035
|
+
if (!isNumeric(visualColumn)) {
|
|
1043
1036
|
return;
|
|
1044
1037
|
}
|
|
1045
1038
|
var address = {
|
|
1046
|
-
row:
|
|
1047
|
-
col: _this16.
|
|
1039
|
+
row: _this16.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
|
1040
|
+
col: _this16.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
|
1048
1041
|
sheet: _this16.sheetId
|
|
1049
1042
|
};
|
|
1050
1043
|
if (!_this16.engine.isItPossibleToSetCellContents(address)) {
|
|
@@ -1064,14 +1057,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1064
1057
|
* `beforeCreateRow` hook callback.
|
|
1065
1058
|
*
|
|
1066
1059
|
* @private
|
|
1067
|
-
* @param {number}
|
|
1060
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
|
1068
1061
|
* @param {number} amount Number of newly created rows in the data source array.
|
|
1069
1062
|
* @returns {*|boolean} If false is returned the action is canceled.
|
|
1070
1063
|
*/
|
|
1071
1064
|
}, {
|
|
1072
1065
|
key: "onBeforeCreateRow",
|
|
1073
|
-
value: function onBeforeCreateRow(
|
|
1074
|
-
|
|
1066
|
+
value: function onBeforeCreateRow(visualRow, amount) {
|
|
1067
|
+
var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
|
1068
|
+
if (visualRow >= this.hot.countRows()) {
|
|
1069
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
|
1075
1073
|
return false;
|
|
1076
1074
|
}
|
|
1077
1075
|
}
|
|
@@ -1080,14 +1078,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1080
1078
|
* `beforeCreateCol` hook callback.
|
|
1081
1079
|
*
|
|
1082
1080
|
* @private
|
|
1083
|
-
* @param {number}
|
|
1081
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
|
1084
1082
|
* @param {number} amount Number of newly created columns in the data source.
|
|
1085
1083
|
* @returns {*|boolean} If false is returned the action is canceled.
|
|
1086
1084
|
*/
|
|
1087
1085
|
}, {
|
|
1088
1086
|
key: "onBeforeCreateCol",
|
|
1089
|
-
value: function onBeforeCreateCol(
|
|
1090
|
-
|
|
1087
|
+
value: function onBeforeCreateCol(visualColumn, amount) {
|
|
1088
|
+
var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
|
1089
|
+
if (visualColumn >= this.hot.countCols()) {
|
|
1090
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
|
1091
1094
|
return false;
|
|
1092
1095
|
}
|
|
1093
1096
|
}
|
|
@@ -1105,8 +1108,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1105
1108
|
key: "onBeforeRemoveRow",
|
|
1106
1109
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
|
1107
1110
|
var _this17 = this;
|
|
1108
|
-
var
|
|
1109
|
-
|
|
1111
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
|
1112
|
+
var possible = hfRows.every(function (hfRow) {
|
|
1113
|
+
return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [hfRow, 1]);
|
|
1110
1114
|
});
|
|
1111
1115
|
return possible === false ? false : void 0;
|
|
1112
1116
|
}
|
|
@@ -1124,8 +1128,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1124
1128
|
key: "onBeforeRemoveCol",
|
|
1125
1129
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
|
1126
1130
|
var _this18 = this;
|
|
1127
|
-
var
|
|
1128
|
-
|
|
1131
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
|
1132
|
+
var possible = hfColumns.every(function (hfColumn) {
|
|
1133
|
+
return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [hfColumn, 1]);
|
|
1129
1134
|
});
|
|
1130
1135
|
return possible === false ? false : void 0;
|
|
1131
1136
|
}
|
|
@@ -1134,18 +1139,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1134
1139
|
* `afterCreateRow` hook callback.
|
|
1135
1140
|
*
|
|
1136
1141
|
* @private
|
|
1137
|
-
* @param {number}
|
|
1142
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
|
1138
1143
|
* @param {number} amount Number of newly created rows in the data source array.
|
|
1139
1144
|
* @param {string} [source] String that identifies source of hook call
|
|
1140
1145
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
|
1141
1146
|
*/
|
|
1142
1147
|
}, {
|
|
1143
1148
|
key: "onAfterCreateRow",
|
|
1144
|
-
value: function onAfterCreateRow(
|
|
1149
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
|
1145
1150
|
if (isBlockedSource(source)) {
|
|
1146
1151
|
return;
|
|
1147
1152
|
}
|
|
1148
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
|
1153
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
|
1149
1154
|
this.renderDependentSheets(changes);
|
|
1150
1155
|
}
|
|
1151
1156
|
|
|
@@ -1153,18 +1158,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1153
1158
|
* `afterCreateCol` hook callback.
|
|
1154
1159
|
*
|
|
1155
1160
|
* @private
|
|
1156
|
-
* @param {number}
|
|
1161
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
|
1157
1162
|
* @param {number} amount Number of newly created columns in the data source.
|
|
1158
1163
|
* @param {string} [source] String that identifies source of hook call
|
|
1159
1164
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
|
1160
1165
|
*/
|
|
1161
1166
|
}, {
|
|
1162
1167
|
key: "onAfterCreateCol",
|
|
1163
|
-
value: function onAfterCreateCol(
|
|
1168
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
|
1164
1169
|
if (isBlockedSource(source)) {
|
|
1165
1170
|
return;
|
|
1166
1171
|
}
|
|
1167
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
|
1172
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
|
1168
1173
|
this.renderDependentSheets(changes);
|
|
1169
1174
|
}
|
|
1170
1175
|
|
|
@@ -1185,10 +1190,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1185
1190
|
if (isBlockedSource(source)) {
|
|
1186
1191
|
return;
|
|
1187
1192
|
}
|
|
1188
|
-
var
|
|
1193
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
|
1189
1194
|
var changes = this.engine.batch(function () {
|
|
1190
|
-
|
|
1191
|
-
_this19.engine.removeRows(_this19.sheetId, [
|
|
1195
|
+
descendingHfRows.forEach(function (hfRow) {
|
|
1196
|
+
_this19.engine.removeRows(_this19.sheetId, [hfRow, 1]);
|
|
1192
1197
|
});
|
|
1193
1198
|
});
|
|
1194
1199
|
this.renderDependentSheets(changes);
|
|
@@ -1211,10 +1216,10 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
|
1211
1216
|
if (isBlockedSource(source)) {
|
|
1212
1217
|
return;
|
|
1213
1218
|
}
|
|
1214
|
-
var
|
|
1219
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
|
1215
1220
|
var changes = this.engine.batch(function () {
|
|
1216
|
-
|
|
1217
|
-
_this20.engine.removeColumns(_this20.sheetId, [
|
|
1221
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
|
1222
|
+
_this20.engine.removeColumns(_this20.sheetId, [hfColumn, 1]);
|
|
1218
1223
|
});
|
|
1219
1224
|
});
|
|
1220
1225
|
this.renderDependentSheets(changes);
|