handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-834f47e-20230509
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
- package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
- package/3rdparty/walkontable/src/cell/coords.js +13 -40
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- package/3rdparty/walkontable/src/core/_base.js +3 -9
- package/3rdparty/walkontable/src/core/_base.mjs +3 -9
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +2 -3
- package/3rdparty/walkontable/src/core/core.mjs +2 -3
- package/3rdparty/walkontable/src/event.js +10 -12
- package/3rdparty/walkontable/src/event.mjs +10 -12
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +2 -10
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +7 -8
- package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
- package/3rdparty/walkontable/src/overlay/top.js +10 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
- 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/renderer/table.js +0 -2
- package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/selection.js +354 -0
- package/3rdparty/walkontable/src/selection.mjs +348 -0
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
- package/3rdparty/walkontable/src/table.js +101 -33
- package/3rdparty/walkontable/src/table.mjs +102 -34
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.d.ts +0 -4
- package/core.js +19 -52
- package/core.mjs +19 -52
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +1 -8
- package/dataMap/metaManager/metaSchema.mjs +1 -8
- package/dist/handsontable.css +2 -7
- package/dist/handsontable.full.css +2 -7
- package/dist/handsontable.full.js +9162 -9474
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +123 -115
- package/dist/handsontable.js +8763 -9076
- package/dist/handsontable.min.css +3 -3
- 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/editorManager.js +3 -7
- package/editorManager.mjs +3 -7
- package/editors/textEditor/textEditor.js +16 -3
- package/editors/textEditor/textEditor.mjs +17 -4
- package/helpers/dom/element.js +0 -11
- package/helpers/dom/element.mjs +0 -10
- 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 +17 -7
- package/pluginHooks.mjs +16 -4
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +93 -12
- package/plugins/copyPaste/copyPaste.mjs +93 -12
- package/plugins/copyPaste/copyableRanges.js +25 -31
- package/plugins/copyPaste/copyableRanges.mjs +18 -24
- package/plugins/copyPaste/focusableElement.js +219 -0
- package/plugins/copyPaste/focusableElement.mjs +213 -0
- package/plugins/customBorders/customBorders.js +2 -6
- package/plugins/customBorders/customBorders.mjs +3 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/formulas.js +190 -168
- package/plugins/formulas/formulas.mjs +190 -168
- 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/mergeCells/mergeCells.js +16 -0
- package/plugins/mergeCells/mergeCells.mjs +16 -0
- package/plugins/nestedHeaders/nestedHeaders.js +4 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
- 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/renderers/baseRenderer/baseRenderer.js +0 -3
- package/renderers/baseRenderer/baseRenderer.mjs +0 -3
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +133 -335
- package/selection/highlight/highlight.mjs +129 -325
- package/selection/highlight/types/activeHeader.js +9 -10
- package/selection/highlight/types/activeHeader.mjs +8 -10
- package/selection/highlight/types/area.js +27 -12
- package/selection/highlight/types/area.mjs +30 -16
- package/selection/highlight/types/{focus.js → cell.js} +8 -5
- package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
- package/selection/highlight/types/customSelection.js +10 -7
- package/selection/highlight/types/customSelection.mjs +9 -7
- package/selection/highlight/types/fill.js +8 -5
- package/selection/highlight/types/fill.mjs +7 -5
- package/selection/highlight/types/header.js +20 -10
- package/selection/highlight/types/header.mjs +19 -10
- package/selection/highlight/types/{row.js → index.js} +31 -27
- package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
- package/selection/highlight/visualSelection.js +21 -12
- package/selection/highlight/visualSelection.mjs +21 -12
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- package/selection/selection.js +46 -88
- package/selection/selection.mjs +44 -82
- package/settings.d.ts +0 -1
- package/tableView.js +66 -94
- package/tableView.mjs +66 -94
- 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
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
- package/3rdparty/walkontable/src/selection/constants.js +0 -63
- package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
- package/3rdparty/walkontable/src/selection/index.js +0 -30
- package/3rdparty/walkontable/src/selection/index.mjs +0 -5
- package/3rdparty/walkontable/src/selection/manager.js +0 -334
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
- package/3rdparty/walkontable/src/selection/scanner.js +0 -363
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
- package/3rdparty/walkontable/src/selection/selection.js +0 -133
- package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
- package/focusManager.d.ts +0 -12
- package/focusManager.js +0 -249
- package/focusManager.mjs +0 -245
- package/selection/highlight/types/areaLayered.js +0 -54
- package/selection/highlight/types/areaLayered.mjs +0 -49
- package/selection/highlight/types/column.js +0 -50
- package/selection/highlight/types/column.mjs +0 -45
@@ -14,9 +14,6 @@ require("core-js/modules/es.symbol.iterator.js");
|
|
14
14
|
require("core-js/modules/es.function.name.js");
|
15
15
|
require("core-js/modules/es.array.from.js");
|
16
16
|
require("core-js/modules/es.regexp.exec.js");
|
17
|
-
require("core-js/modules/es.object.keys.js");
|
18
|
-
require("core-js/modules/es.array.filter.js");
|
19
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
20
17
|
exports.__esModule = true;
|
21
18
|
exports.SETTING_KEYS = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
|
22
19
|
require("core-js/modules/es.array.concat.js");
|
@@ -45,13 +42,12 @@ var _settings = require("./engine/settings");
|
|
45
42
|
var _data = require("../../helpers/data");
|
46
43
|
var _string = require("../../helpers/string");
|
47
44
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
45
|
+
var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
|
48
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
49
47
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
50
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."); }
|
51
49
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
52
50
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
53
|
-
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; }
|
54
|
-
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; }
|
55
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); }
|
56
52
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
57
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."); }
|
@@ -87,7 +83,6 @@ var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
|
87
83
|
exports.SETTING_KEYS = SETTING_KEYS;
|
88
84
|
var PLUGIN_PRIORITY = 260;
|
89
85
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
90
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
91
86
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
|
92
87
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
|
93
88
|
_pluginHooks.default.getSingleton().register('afterSheetAdded');
|
@@ -193,6 +188,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
193
188
|
* @type {string|null}
|
194
189
|
*/
|
195
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);
|
196
209
|
return _this;
|
197
210
|
}
|
198
211
|
_createClass(Formulas, [{
|
@@ -300,6 +313,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
300
313
|
this.addHook('afterRemoveCol', function () {
|
301
314
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
302
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
|
+
});
|
303
351
|
|
304
352
|
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
305
353
|
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
@@ -309,22 +357,22 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
309
357
|
});
|
310
358
|
|
311
359
|
// 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
|
-
}
|
360
|
+
this.addHook('beforeUndo', function () {
|
361
|
+
_this8.indexSyncer.setPerformUndo(true);
|
317
362
|
_this8.engine.undo();
|
318
363
|
});
|
319
364
|
|
320
365
|
// 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
|
-
}
|
366
|
+
this.addHook('beforeRedo', function () {
|
367
|
+
_this8.indexSyncer.setPerformRedo(true);
|
326
368
|
_this8.engine.redo();
|
327
369
|
});
|
370
|
+
this.addHook('afterUndo', function () {
|
371
|
+
_this8.indexSyncer.setPerformUndo(false);
|
372
|
+
});
|
373
|
+
this.addHook('afterUndo', function () {
|
374
|
+
_this8.indexSyncer.setPerformRedo(false);
|
375
|
+
});
|
328
376
|
this.addHook('afterDetachChild', function () {
|
329
377
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
330
378
|
});
|
@@ -409,63 +457,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
409
457
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
410
458
|
}
|
411
459
|
|
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
460
|
/**
|
470
461
|
* Add a sheet to the shared HyperFormula instance.
|
471
462
|
*
|
@@ -536,8 +527,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
536
527
|
if (physicalRow !== null && physicalColumn !== null) {
|
537
528
|
return this.engine.getCellType({
|
538
529
|
sheet: sheet,
|
539
|
-
row:
|
540
|
-
col:
|
530
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
531
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
541
532
|
});
|
542
533
|
} else {
|
543
534
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -557,15 +548,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
557
548
|
key: "isFormulaCellType",
|
558
549
|
value: function isFormulaCellType(row, column) {
|
559
550
|
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
551
|
return this.engine.doesCellHaveFormula({
|
566
552
|
sheet: sheet,
|
567
|
-
row:
|
568
|
-
col:
|
553
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
554
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
569
555
|
});
|
570
556
|
}
|
571
557
|
|
@@ -630,11 +616,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
630
616
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
631
617
|
row = _ref8.row,
|
632
618
|
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
619
|
|
636
620
|
// Don't try to validate cells outside of the visual part of the table.
|
637
|
-
if (
|
621
|
+
if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
638
622
|
return;
|
639
623
|
}
|
640
624
|
|
@@ -653,7 +637,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
653
637
|
}
|
654
638
|
|
655
639
|
// It will just re-render certain cell when necessary.
|
656
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
640
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
657
641
|
}
|
658
642
|
});
|
659
643
|
}
|
@@ -671,8 +655,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
671
655
|
key: "syncChangeWithEngine",
|
672
656
|
value: function syncChangeWithEngine(row, column, newValue) {
|
673
657
|
var address = {
|
674
|
-
row: this.
|
675
|
-
col: this.
|
658
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
659
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
676
660
|
sheet: this.sheetId
|
677
661
|
};
|
678
662
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
@@ -708,8 +692,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
708
692
|
var visualColumn = this.hot.propToCol(prop);
|
709
693
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
710
694
|
var address = {
|
711
|
-
row: this.
|
712
|
-
col: this.
|
695
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
696
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
713
697
|
sheet: this.sheetId
|
714
698
|
};
|
715
699
|
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
@@ -738,19 +722,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
738
722
|
}, {
|
739
723
|
key: "onBeforeAutofill",
|
740
724
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
741
|
-
var
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
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;
|
747
737
|
var engineSourceRange = {
|
748
|
-
start:
|
749
|
-
|
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
|
+
}
|
750
748
|
};
|
751
749
|
var engineTargetRange = {
|
752
|
-
start:
|
753
|
-
|
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
|
+
}
|
754
760
|
};
|
755
761
|
|
756
762
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -816,19 +822,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
816
822
|
}, {
|
817
823
|
key: "onAfterCellMetaReset",
|
818
824
|
value: function onAfterCellMetaReset() {
|
819
|
-
var
|
825
|
+
var _this13 = this;
|
820
826
|
var sourceDataArray = this.hot.getSourceDataArray();
|
821
827
|
var valueChanged = false;
|
822
828
|
sourceDataArray.forEach(function (rowData, rowIndex) {
|
823
829
|
rowData.forEach(function (cellValue, columnIndex) {
|
824
|
-
var cellMeta =
|
830
|
+
var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
|
825
831
|
var dateFormat = cellMeta.dateFormat;
|
826
832
|
if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
|
827
833
|
valueChanged = true;
|
828
834
|
if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
|
829
835
|
// Rewriting date in HOT format to HF format.
|
830
836
|
sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
|
831
|
-
} else if (
|
837
|
+
} else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
|
832
838
|
// Escaping value from date parsing using "'" sign (HF feature).
|
833
839
|
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
834
840
|
}
|
@@ -863,6 +869,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
863
869
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
864
870
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
865
871
|
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
872
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
866
873
|
this.renderDependentSheets(dependentCells);
|
867
874
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
868
875
|
}
|
@@ -875,24 +882,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
875
882
|
* `modifyData` hook callback.
|
876
883
|
*
|
877
884
|
* @private
|
878
|
-
* @param {number}
|
879
|
-
* @param {number}
|
885
|
+
* @param {number} physicalRow Physical row index.
|
886
|
+
* @param {number} visualColumn Visual column index.
|
880
887
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
881
888
|
* property.
|
882
889
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
883
890
|
*/
|
884
891
|
}, {
|
885
892
|
key: "onModifyData",
|
886
|
-
value: function onModifyData(
|
893
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
887
894
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
888
895
|
return;
|
889
896
|
}
|
890
|
-
var visualRow = this.hot.toVisualRow(
|
897
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
898
|
+
if (visualRow === null || visualColumn === null) {
|
899
|
+
return;
|
900
|
+
}
|
891
901
|
|
892
902
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
893
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
903
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
894
904
|
if (!isFormulaCellType) {
|
895
|
-
var cellType = this.getCellType(visualRow,
|
905
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
896
906
|
if (cellType !== 'ARRAY') {
|
897
907
|
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
898
908
|
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
@@ -900,15 +910,13 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
900
910
|
return;
|
901
911
|
}
|
902
912
|
}
|
903
|
-
|
904
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
905
913
|
var address = {
|
906
|
-
row:
|
907
|
-
col: this.
|
914
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
915
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
908
916
|
sheet: this.sheetId
|
909
917
|
};
|
910
918
|
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
911
|
-
var cellMeta = this.hot.getCellMeta(
|
919
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
912
920
|
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
913
921
|
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
914
922
|
}
|
@@ -936,6 +944,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
936
944
|
}
|
937
945
|
var visualRow = this.hot.toVisualRow(row);
|
938
946
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
947
|
+
if (visualRow === null || visualColumn === null) {
|
948
|
+
return;
|
949
|
+
}
|
939
950
|
|
940
951
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
941
952
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -955,9 +966,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
955
966
|
return;
|
956
967
|
}
|
957
968
|
var address = {
|
958
|
-
row:
|
959
|
-
|
960
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
969
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
970
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
961
971
|
sheet: this.sheetId
|
962
972
|
};
|
963
973
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -974,7 +984,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
974
984
|
}, {
|
975
985
|
key: "onAfterSetDataAtCell",
|
976
986
|
value: function onAfterSetDataAtCell(changes, source) {
|
977
|
-
var
|
987
|
+
var _this14 = this;
|
978
988
|
if (isBlockedSource(source)) {
|
979
989
|
return;
|
980
990
|
}
|
@@ -983,21 +993,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
983
993
|
var dependentCells = this.engine.batch(function () {
|
984
994
|
changes.forEach(function (_ref9) {
|
985
995
|
var _ref10 = _slicedToArray(_ref9, 4),
|
986
|
-
|
996
|
+
visualRow = _ref10[0],
|
987
997
|
prop = _ref10[1],
|
988
998
|
newValue = _ref10[3];
|
989
|
-
var
|
990
|
-
var physicalRow =
|
991
|
-
var physicalColumn =
|
999
|
+
var visualColumn = _this14.hot.propToCol(prop);
|
1000
|
+
var physicalRow = _this14.hot.toPhysicalRow(visualRow);
|
1001
|
+
var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
|
992
1002
|
var address = {
|
993
|
-
row:
|
994
|
-
col:
|
995
|
-
sheet:
|
1003
|
+
row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1004
|
+
col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
1005
|
+
sheet: _this14.sheetId
|
996
1006
|
};
|
997
1007
|
if (physicalRow !== null && physicalColumn !== null) {
|
998
|
-
|
1008
|
+
_this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
999
1009
|
} else {
|
1000
|
-
outOfBoundsChanges.push([
|
1010
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
1001
1011
|
}
|
1002
1012
|
changedCells.push({
|
1003
1013
|
address: address
|
@@ -1008,16 +1018,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1008
1018
|
// Workaround for rows/columns being created two times (by HOT and the engine).
|
1009
1019
|
// (unfortunately, this requires an extra re-render)
|
1010
1020
|
this.hot.addHookOnce('afterChange', function () {
|
1011
|
-
var outOfBoundsDependentCells =
|
1021
|
+
var outOfBoundsDependentCells = _this14.engine.batch(function () {
|
1012
1022
|
outOfBoundsChanges.forEach(function (_ref11) {
|
1013
1023
|
var _ref12 = _slicedToArray(_ref11, 3),
|
1014
1024
|
row = _ref12[0],
|
1015
1025
|
column = _ref12[1],
|
1016
1026
|
newValue = _ref12[2];
|
1017
|
-
|
1027
|
+
_this14.syncChangeWithEngine(row, column, newValue);
|
1018
1028
|
});
|
1019
1029
|
});
|
1020
|
-
|
1030
|
+
_this14.renderDependentSheets(outOfBoundsDependentCells, true);
|
1021
1031
|
});
|
1022
1032
|
}
|
1023
1033
|
this.renderDependentSheets(dependentCells);
|
@@ -1035,7 +1045,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1035
1045
|
}, {
|
1036
1046
|
key: "onAfterSetSourceDataAtCell",
|
1037
1047
|
value: function onAfterSetSourceDataAtCell(changes, source) {
|
1038
|
-
var
|
1048
|
+
var _this15 = this;
|
1039
1049
|
if (isBlockedSource(source)) {
|
1040
1050
|
return;
|
1041
1051
|
}
|
@@ -1043,26 +1053,26 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1043
1053
|
var changedCells = [];
|
1044
1054
|
changes.forEach(function (_ref13) {
|
1045
1055
|
var _ref14 = _slicedToArray(_ref13, 4),
|
1046
|
-
|
1056
|
+
visualRow = _ref14[0],
|
1047
1057
|
prop = _ref14[1],
|
1048
1058
|
newValue = _ref14[3];
|
1049
|
-
var
|
1050
|
-
if (!(0, _number.isNumeric)(
|
1059
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
1060
|
+
if (!(0, _number.isNumeric)(visualColumn)) {
|
1051
1061
|
return;
|
1052
1062
|
}
|
1053
1063
|
var address = {
|
1054
|
-
row:
|
1055
|
-
col:
|
1056
|
-
sheet:
|
1064
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1065
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
1066
|
+
sheet: _this15.sheetId
|
1057
1067
|
};
|
1058
|
-
if (!
|
1068
|
+
if (!_this15.engine.isItPossibleToSetCellContents(address)) {
|
1059
1069
|
(0, _console.warn)("Not possible to set source cell data at ".concat(JSON.stringify(address)));
|
1060
1070
|
return;
|
1061
1071
|
}
|
1062
1072
|
changedCells.push({
|
1063
1073
|
address: address
|
1064
1074
|
});
|
1065
|
-
dependentCells.push.apply(dependentCells, _toConsumableArray(
|
1075
|
+
dependentCells.push.apply(dependentCells, _toConsumableArray(_this15.engine.setCellContents(address, newValue)));
|
1066
1076
|
});
|
1067
1077
|
this.renderDependentSheets(dependentCells);
|
1068
1078
|
this.validateDependentCells(dependentCells, changedCells);
|
@@ -1072,14 +1082,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1072
1082
|
* `beforeCreateRow` hook callback.
|
1073
1083
|
*
|
1074
1084
|
* @private
|
1075
|
-
* @param {number}
|
1085
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1076
1086
|
* @param {number} amount Number of newly created rows in the data source array.
|
1077
1087
|
* @returns {*|boolean} If false is returned the action is canceled.
|
1078
1088
|
*/
|
1079
1089
|
}, {
|
1080
1090
|
key: "onBeforeCreateRow",
|
1081
|
-
value: function onBeforeCreateRow(
|
1082
|
-
|
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])) {
|
1083
1098
|
return false;
|
1084
1099
|
}
|
1085
1100
|
}
|
@@ -1088,14 +1103,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1088
1103
|
* `beforeCreateCol` hook callback.
|
1089
1104
|
*
|
1090
1105
|
* @private
|
1091
|
-
* @param {number}
|
1106
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1092
1107
|
* @param {number} amount Number of newly created columns in the data source.
|
1093
1108
|
* @returns {*|boolean} If false is returned the action is canceled.
|
1094
1109
|
*/
|
1095
1110
|
}, {
|
1096
1111
|
key: "onBeforeCreateCol",
|
1097
|
-
value: function onBeforeCreateCol(
|
1098
|
-
|
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])) {
|
1099
1119
|
return false;
|
1100
1120
|
}
|
1101
1121
|
}
|
@@ -1112,9 +1132,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1112
1132
|
}, {
|
1113
1133
|
key: "onBeforeRemoveRow",
|
1114
1134
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
1115
|
-
var
|
1116
|
-
var
|
1117
|
-
|
1135
|
+
var _this16 = this;
|
1136
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1137
|
+
var possible = hfRows.every(function (hfRow) {
|
1138
|
+
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
1118
1139
|
});
|
1119
1140
|
return possible === false ? false : void 0;
|
1120
1141
|
}
|
@@ -1131,9 +1152,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1131
1152
|
}, {
|
1132
1153
|
key: "onBeforeRemoveCol",
|
1133
1154
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1134
|
-
var
|
1135
|
-
var
|
1136
|
-
|
1155
|
+
var _this17 = this;
|
1156
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1157
|
+
var possible = hfColumns.every(function (hfColumn) {
|
1158
|
+
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1137
1159
|
});
|
1138
1160
|
return possible === false ? false : void 0;
|
1139
1161
|
}
|
@@ -1142,18 +1164,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1142
1164
|
* `afterCreateRow` hook callback.
|
1143
1165
|
*
|
1144
1166
|
* @private
|
1145
|
-
* @param {number}
|
1167
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1146
1168
|
* @param {number} amount Number of newly created rows in the data source array.
|
1147
1169
|
* @param {string} [source] String that identifies source of hook call
|
1148
1170
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1149
1171
|
*/
|
1150
1172
|
}, {
|
1151
1173
|
key: "onAfterCreateRow",
|
1152
|
-
value: function onAfterCreateRow(
|
1174
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
1153
1175
|
if (isBlockedSource(source)) {
|
1154
1176
|
return;
|
1155
1177
|
}
|
1156
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1178
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1157
1179
|
this.renderDependentSheets(changes);
|
1158
1180
|
}
|
1159
1181
|
|
@@ -1161,18 +1183,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1161
1183
|
* `afterCreateCol` hook callback.
|
1162
1184
|
*
|
1163
1185
|
* @private
|
1164
|
-
* @param {number}
|
1186
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1165
1187
|
* @param {number} amount Number of newly created columns in the data source.
|
1166
1188
|
* @param {string} [source] String that identifies source of hook call
|
1167
1189
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1168
1190
|
*/
|
1169
1191
|
}, {
|
1170
1192
|
key: "onAfterCreateCol",
|
1171
|
-
value: function onAfterCreateCol(
|
1193
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
1172
1194
|
if (isBlockedSource(source)) {
|
1173
1195
|
return;
|
1174
1196
|
}
|
1175
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1197
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1176
1198
|
this.renderDependentSheets(changes);
|
1177
1199
|
}
|
1178
1200
|
|
@@ -1189,14 +1211,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1189
1211
|
}, {
|
1190
1212
|
key: "onAfterRemoveRow",
|
1191
1213
|
value: function onAfterRemoveRow(row, amount, physicalRows, source) {
|
1192
|
-
var
|
1214
|
+
var _this18 = this;
|
1193
1215
|
if (isBlockedSource(source)) {
|
1194
1216
|
return;
|
1195
1217
|
}
|
1196
|
-
var
|
1218
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1197
1219
|
var changes = this.engine.batch(function () {
|
1198
|
-
|
1199
|
-
|
1220
|
+
descendingHfRows.forEach(function (hfRow) {
|
1221
|
+
_this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
|
1200
1222
|
});
|
1201
1223
|
});
|
1202
1224
|
this.renderDependentSheets(changes);
|
@@ -1215,14 +1237,14 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1215
1237
|
}, {
|
1216
1238
|
key: "onAfterRemoveCol",
|
1217
1239
|
value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
|
1218
|
-
var
|
1240
|
+
var _this19 = this;
|
1219
1241
|
if (isBlockedSource(source)) {
|
1220
1242
|
return;
|
1221
1243
|
}
|
1222
|
-
var
|
1244
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1223
1245
|
var changes = this.engine.batch(function () {
|
1224
|
-
|
1225
|
-
|
1246
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
1247
|
+
_this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
|
1226
1248
|
});
|
1227
1249
|
});
|
1228
1250
|
this.renderDependentSheets(changes);
|
@@ -1241,16 +1263,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1241
1263
|
key: "onAfterDetachChild",
|
1242
1264
|
value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
|
1243
1265
|
var _element$__children,
|
1244
|
-
|
1266
|
+
_this20 = this;
|
1245
1267
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1246
1268
|
var rowsData = this.hot.getSourceDataArray(finalElementRowIndex, 0, finalElementRowIndex + (((_element$__children = element.__children) === null || _element$__children === void 0 ? void 0 : _element$__children.length) || 0), this.hot.countSourceCols());
|
1247
1269
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1248
1270
|
rowsData.forEach(function (row, relativeRowIndex) {
|
1249
1271
|
row.forEach(function (value, colIndex) {
|
1250
|
-
|
1272
|
+
_this20.engine.setCellContents({
|
1251
1273
|
col: colIndex,
|
1252
1274
|
row: finalElementRowIndex + relativeRowIndex,
|
1253
|
-
sheet:
|
1275
|
+
sheet: _this20.sheetId
|
1254
1276
|
}, [[value]]);
|
1255
1277
|
});
|
1256
1278
|
});
|