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