handsontable 0.0.0-next-5e7f0fe-20230504 → 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 +49 -8
- package/core.mjs +49 -8
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +7 -0
- package/dataMap/metaManager/metaSchema.mjs +7 -0
- package/dist/handsontable.css +7 -2
- package/dist/handsontable.full.css +7 -2
- package/dist/handsontable.full.js +9409 -9084
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +115 -123
- package/dist/handsontable.js +9497 -9171
- 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
@@ -2,6 +2,8 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
2
2
|
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."); }
|
3
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
4
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
5
|
+
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; }
|
6
|
+
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; }
|
5
7
|
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); }
|
6
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
7
9
|
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."); }
|
@@ -38,6 +40,9 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
38
40
|
import "core-js/modules/es.function.name.js";
|
39
41
|
import "core-js/modules/es.array.from.js";
|
40
42
|
import "core-js/modules/es.regexp.exec.js";
|
43
|
+
import "core-js/modules/es.object.keys.js";
|
44
|
+
import "core-js/modules/es.array.filter.js";
|
45
|
+
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
41
46
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
42
47
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
43
48
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
@@ -71,10 +76,10 @@ import { getEngineSettingsWithOverrides, haveEngineSettingsChanged } from "./eng
|
|
71
76
|
import { isArrayOfArrays } from "../../helpers/data.mjs";
|
72
77
|
import { toUpperCaseFirst } from "../../helpers/string.mjs";
|
73
78
|
import Hooks from "../../pluginHooks.mjs";
|
74
|
-
import IndexSyncer from "./indexSyncer/index.mjs";
|
75
79
|
export var PLUGIN_KEY = 'formulas';
|
76
80
|
export var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
77
81
|
export var PLUGIN_PRIORITY = 260;
|
82
|
+
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
78
83
|
Hooks.getSingleton().register('afterNamedExpressionAdded');
|
79
84
|
Hooks.getSingleton().register('afterNamedExpressionRemoved');
|
80
85
|
Hooks.getSingleton().register('afterSheetAdded');
|
@@ -180,24 +185,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
180
185
|
* @type {string|null}
|
181
186
|
*/
|
182
187
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
183
|
-
/**
|
184
|
-
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
185
|
-
*
|
186
|
-
* @type {IndexSyncer|null}
|
187
|
-
*/
|
188
|
-
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
189
|
-
/**
|
190
|
-
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
191
|
-
*
|
192
|
-
* @type {AxisSyncer|null}
|
193
|
-
*/
|
194
|
-
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
195
|
-
/**
|
196
|
-
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
197
|
-
*
|
198
|
-
* @type {AxisSyncer|null}
|
199
|
-
*/
|
200
|
-
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
201
188
|
return _this;
|
202
189
|
}
|
203
190
|
_createClass(Formulas, [{
|
@@ -305,41 +292,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
305
292
|
this.addHook('afterRemoveCol', function () {
|
306
293
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
307
294
|
});
|
308
|
-
this.indexSyncer = new IndexSyncer(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
309
|
-
_this8.hot.addHookOnce('init', function () {
|
310
|
-
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
311
|
-
// be postponed.
|
312
|
-
postponedAction();
|
313
|
-
});
|
314
|
-
});
|
315
|
-
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
316
|
-
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
317
|
-
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
318
|
-
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
319
|
-
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
320
|
-
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
321
|
-
});
|
322
|
-
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
323
|
-
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
324
|
-
});
|
325
|
-
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
326
|
-
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
327
|
-
});
|
328
|
-
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
329
|
-
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
330
|
-
});
|
331
|
-
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
332
|
-
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
333
|
-
});
|
334
|
-
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
335
|
-
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
336
|
-
});
|
337
|
-
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
338
|
-
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
339
|
-
});
|
340
|
-
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
341
|
-
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
342
|
-
});
|
343
295
|
|
344
296
|
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
345
297
|
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
@@ -349,22 +301,22 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
349
301
|
});
|
350
302
|
|
351
303
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
352
|
-
this.addHook('beforeUndo', function () {
|
353
|
-
|
304
|
+
this.addHook('beforeUndo', function (action) {
|
305
|
+
// TODO: Move action isn't handled by HyperFormula.
|
306
|
+
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
307
|
+
return;
|
308
|
+
}
|
354
309
|
_this8.engine.undo();
|
355
310
|
});
|
356
311
|
|
357
312
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
358
|
-
this.addHook('beforeRedo', function () {
|
359
|
-
|
313
|
+
this.addHook('beforeRedo', function (action) {
|
314
|
+
// TODO: Move action isn't handled by HyperFormula.
|
315
|
+
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
316
|
+
return;
|
317
|
+
}
|
360
318
|
_this8.engine.redo();
|
361
319
|
});
|
362
|
-
this.addHook('afterUndo', function () {
|
363
|
-
_this8.indexSyncer.setPerformUndo(false);
|
364
|
-
});
|
365
|
-
this.addHook('afterUndo', function () {
|
366
|
-
_this8.indexSyncer.setPerformRedo(false);
|
367
|
-
});
|
368
320
|
this.addHook('afterDetachChild', function () {
|
369
321
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
370
322
|
});
|
@@ -449,6 +401,63 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
449
401
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
450
402
|
}
|
451
403
|
|
404
|
+
/**
|
405
|
+
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
406
|
+
*
|
407
|
+
* @private
|
408
|
+
* @param {number} visualIndex Visual entry index.
|
409
|
+
* @param {number} physicalIndex Physical entry index.
|
410
|
+
* @param {number} entriesCount Visual entries count.
|
411
|
+
* @param {number} sourceEntriesCount Source entries count.
|
412
|
+
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
413
|
+
* `toPhysical` alias.
|
414
|
+
* @returns {*}
|
415
|
+
*/
|
416
|
+
}, {
|
417
|
+
key: "getPhysicalIndexPosition",
|
418
|
+
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
419
|
+
if (!contained) {
|
420
|
+
if (visualIndex >= entriesCount) {
|
421
|
+
return sourceEntriesCount + (visualIndex - entriesCount);
|
422
|
+
}
|
423
|
+
}
|
424
|
+
return physicalIndex;
|
425
|
+
}
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
429
|
+
* `null` on rows with indexes higher than the number of rows.
|
430
|
+
*
|
431
|
+
* @private
|
432
|
+
* @param {number} row Visual row index.
|
433
|
+
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
434
|
+
* `toPhysical` alias.
|
435
|
+
* @returns {number} The physical row index.
|
436
|
+
*/
|
437
|
+
}, {
|
438
|
+
key: "toPhysicalRowPosition",
|
439
|
+
value: function toPhysicalRowPosition(row) {
|
440
|
+
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
441
|
+
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
442
|
+
}
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
446
|
+
* `null` on columns with indexes higher than the number of columns.
|
447
|
+
*
|
448
|
+
* @private
|
449
|
+
* @param {number} column Visual column index.
|
450
|
+
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
451
|
+
* `toPhysical` alias.
|
452
|
+
* @returns {number} The physical column index.
|
453
|
+
*/
|
454
|
+
}, {
|
455
|
+
key: "toPhysicalColumnPosition",
|
456
|
+
value: function toPhysicalColumnPosition(column) {
|
457
|
+
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
458
|
+
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
459
|
+
}
|
460
|
+
|
452
461
|
/**
|
453
462
|
* Add a sheet to the shared HyperFormula instance.
|
454
463
|
*
|
@@ -519,8 +528,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
519
528
|
if (physicalRow !== null && physicalColumn !== null) {
|
520
529
|
return this.engine.getCellType({
|
521
530
|
sheet: sheet,
|
522
|
-
row:
|
523
|
-
col:
|
531
|
+
row: physicalRow,
|
532
|
+
col: physicalColumn
|
524
533
|
});
|
525
534
|
} else {
|
526
535
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -540,10 +549,15 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
540
549
|
key: "isFormulaCellType",
|
541
550
|
value: function isFormulaCellType(row, column) {
|
542
551
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
552
|
+
var physicalRow = this.hot.toPhysicalRow(row);
|
553
|
+
var physicalColumn = this.hot.toPhysicalColumn(column);
|
554
|
+
if (physicalRow === null || physicalColumn === null) {
|
555
|
+
return false;
|
556
|
+
}
|
543
557
|
return this.engine.doesCellHaveFormula({
|
544
558
|
sheet: sheet,
|
545
|
-
row:
|
546
|
-
col:
|
559
|
+
row: physicalRow,
|
560
|
+
col: physicalColumn
|
547
561
|
});
|
548
562
|
}
|
549
563
|
|
@@ -608,9 +622,11 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
608
622
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
609
623
|
row = _ref8.row,
|
610
624
|
col = _ref8.col;
|
625
|
+
var visualRow = isDefined(row) ? _this12.hot.toVisualRow(row) : null;
|
626
|
+
var visualColumn = isDefined(col) ? _this12.hot.toVisualColumn(col) : null;
|
611
627
|
|
612
628
|
// Don't try to validate cells outside of the visual part of the table.
|
613
|
-
if (
|
629
|
+
if (visualRow === null || visualColumn === null) {
|
614
630
|
return;
|
615
631
|
}
|
616
632
|
|
@@ -629,7 +645,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
629
645
|
}
|
630
646
|
|
631
647
|
// It will just re-render certain cell when necessary.
|
632
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
648
|
+
boundHot.validateCell(boundHot.getDataAtCell(visualRow, visualColumn), boundHot.getCellMeta(visualRow, visualColumn), function () {});
|
633
649
|
}
|
634
650
|
});
|
635
651
|
}
|
@@ -647,8 +663,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
647
663
|
key: "syncChangeWithEngine",
|
648
664
|
value: function syncChangeWithEngine(row, column, newValue) {
|
649
665
|
var address = {
|
650
|
-
row: this.
|
651
|
-
col: this.
|
666
|
+
row: this.toPhysicalRowPosition(row),
|
667
|
+
col: this.toPhysicalColumnPosition(column),
|
652
668
|
sheet: this.sheetId
|
653
669
|
};
|
654
670
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
@@ -684,8 +700,8 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
684
700
|
var visualColumn = this.hot.propToCol(prop);
|
685
701
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
686
702
|
var address = {
|
687
|
-
row: this.
|
688
|
-
col: this.
|
703
|
+
row: this.hot.toPhysicalRow(visualRow),
|
704
|
+
col: this.hot.toPhysicalColumn(visualColumn),
|
689
705
|
sheet: this.sheetId
|
690
706
|
};
|
691
707
|
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
@@ -714,41 +730,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
714
730
|
}, {
|
715
731
|
key: "onBeforeAutofill",
|
716
732
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
717
|
-
var
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
var _targetRange$getTopSt = targetRange.getTopStartCorner(),
|
724
|
-
targetTopStartRow = _targetRange$getTopSt.row,
|
725
|
-
targetTopStartColumn = _targetRange$getTopSt.col;
|
726
|
-
var _targetRange$getBotto = targetRange.getBottomEndCorner(),
|
727
|
-
targetBottomEndRow = _targetRange$getBotto.row,
|
728
|
-
targetBottomEndColumn = _targetRange$getBotto.col;
|
733
|
+
var _this13 = this;
|
734
|
+
var withSheetId = function withSheetId(range) {
|
735
|
+
return _objectSpread(_objectSpread({}, range), {}, {
|
736
|
+
sheet: _this13.sheetId
|
737
|
+
});
|
738
|
+
};
|
729
739
|
var engineSourceRange = {
|
730
|
-
start:
|
731
|
-
|
732
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
733
|
-
sheet: this.sheetId
|
734
|
-
},
|
735
|
-
end: {
|
736
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
737
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
738
|
-
sheet: this.sheetId
|
739
|
-
}
|
740
|
+
start: withSheetId(sourceRange.getTopStartCorner()),
|
741
|
+
end: withSheetId(sourceRange.getBottomEndCorner())
|
740
742
|
};
|
741
743
|
var engineTargetRange = {
|
742
|
-
start:
|
743
|
-
|
744
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
745
|
-
sheet: this.sheetId
|
746
|
-
},
|
747
|
-
end: {
|
748
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
749
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
750
|
-
sheet: this.sheetId
|
751
|
-
}
|
744
|
+
start: withSheetId(targetRange.getTopStartCorner()),
|
745
|
+
end: withSheetId(targetRange.getBottomEndCorner())
|
752
746
|
};
|
753
747
|
|
754
748
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -814,19 +808,19 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
814
808
|
}, {
|
815
809
|
key: "onAfterCellMetaReset",
|
816
810
|
value: function onAfterCellMetaReset() {
|
817
|
-
var
|
811
|
+
var _this14 = this;
|
818
812
|
var sourceDataArray = this.hot.getSourceDataArray();
|
819
813
|
var valueChanged = false;
|
820
814
|
sourceDataArray.forEach(function (rowData, rowIndex) {
|
821
815
|
rowData.forEach(function (cellValue, columnIndex) {
|
822
|
-
var cellMeta =
|
816
|
+
var cellMeta = _this14.hot.getCellMeta(rowIndex, columnIndex);
|
823
817
|
var dateFormat = cellMeta.dateFormat;
|
824
818
|
if (isDate(cellValue, cellMeta.type)) {
|
825
819
|
valueChanged = true;
|
826
820
|
if (isDateValid(cellValue, dateFormat)) {
|
827
821
|
// Rewriting date in HOT format to HF format.
|
828
822
|
sourceDataArray[rowIndex][columnIndex] = getDateInHfFormat(cellValue, dateFormat);
|
829
|
-
} else if (
|
823
|
+
} else if (_this14.isFormulaCellType(rowIndex, columnIndex) === false) {
|
830
824
|
// Escaping value from date parsing using "'" sign (HF feature).
|
831
825
|
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
832
826
|
}
|
@@ -861,7 +855,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
861
855
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
862
856
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
863
857
|
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
864
|
-
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
865
858
|
this.renderDependentSheets(dependentCells);
|
866
859
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
867
860
|
}
|
@@ -874,27 +867,24 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
874
867
|
* `modifyData` hook callback.
|
875
868
|
*
|
876
869
|
* @private
|
877
|
-
* @param {number}
|
878
|
-
* @param {number}
|
870
|
+
* @param {number} row Physical row height.
|
871
|
+
* @param {number} column Physical column index.
|
879
872
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
880
873
|
* property.
|
881
874
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
882
875
|
*/
|
883
876
|
}, {
|
884
877
|
key: "onModifyData",
|
885
|
-
value: function onModifyData(
|
878
|
+
value: function onModifyData(row, column, valueHolder, ioMode) {
|
886
879
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
887
880
|
return;
|
888
881
|
}
|
889
|
-
var visualRow = this.hot.toVisualRow(
|
890
|
-
if (visualRow === null || visualColumn === null) {
|
891
|
-
return;
|
892
|
-
}
|
882
|
+
var visualRow = this.hot.toVisualRow(row);
|
893
883
|
|
894
884
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
895
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
885
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, column);
|
896
886
|
if (!isFormulaCellType) {
|
897
|
-
var cellType = this.getCellType(visualRow,
|
887
|
+
var cellType = this.getCellType(visualRow, column);
|
898
888
|
if (cellType !== 'ARRAY') {
|
899
889
|
if (isEscapedFormulaExpression(valueHolder.value)) {
|
900
890
|
valueHolder.value = unescapeFormulaExpression(valueHolder.value);
|
@@ -902,13 +892,15 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
902
892
|
return;
|
903
893
|
}
|
904
894
|
}
|
895
|
+
|
896
|
+
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
905
897
|
var address = {
|
906
|
-
row:
|
907
|
-
col: this.
|
898
|
+
row: row,
|
899
|
+
col: this.toPhysicalColumnPosition(column),
|
908
900
|
sheet: this.sheetId
|
909
901
|
};
|
910
902
|
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
911
|
-
var cellMeta = this.hot.getCellMeta(
|
903
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
912
904
|
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
913
905
|
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
914
906
|
}
|
@@ -936,9 +928,6 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
936
928
|
}
|
937
929
|
var visualRow = this.hot.toVisualRow(row);
|
938
930
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
939
|
-
if (visualRow === null || visualColumn === null) {
|
940
|
-
return;
|
941
|
-
}
|
942
931
|
|
943
932
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
944
933
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -958,8 +947,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
958
947
|
return;
|
959
948
|
}
|
960
949
|
var address = {
|
961
|
-
row:
|
962
|
-
|
950
|
+
row: row,
|
951
|
+
// Workaround for inconsistencies in `src/dataSource.js`
|
952
|
+
col: this.toPhysicalColumnPosition(visualColumn),
|
963
953
|
sheet: this.sheetId
|
964
954
|
};
|
965
955
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -976,7 +966,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
976
966
|
}, {
|
977
967
|
key: "onAfterSetDataAtCell",
|
978
968
|
value: function onAfterSetDataAtCell(changes, source) {
|
979
|
-
var
|
969
|
+
var _this15 = this;
|
980
970
|
if (isBlockedSource(source)) {
|
981
971
|
return;
|
982
972
|
}
|
@@ -985,21 +975,21 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
985
975
|
var dependentCells = this.engine.batch(function () {
|
986
976
|
changes.forEach(function (_ref9) {
|
987
977
|
var _ref10 = _slicedToArray(_ref9, 4),
|
988
|
-
|
978
|
+
row = _ref10[0],
|
989
979
|
prop = _ref10[1],
|
990
980
|
newValue = _ref10[3];
|
991
|
-
var
|
992
|
-
var physicalRow =
|
993
|
-
var physicalColumn =
|
981
|
+
var column = _this15.hot.propToCol(prop);
|
982
|
+
var physicalRow = _this15.hot.toPhysicalRow(row);
|
983
|
+
var physicalColumn = _this15.hot.toPhysicalColumn(column);
|
994
984
|
var address = {
|
995
|
-
row:
|
996
|
-
col:
|
997
|
-
sheet:
|
985
|
+
row: physicalRow,
|
986
|
+
col: physicalColumn,
|
987
|
+
sheet: _this15.sheetId
|
998
988
|
};
|
999
989
|
if (physicalRow !== null && physicalColumn !== null) {
|
1000
|
-
|
990
|
+
_this15.syncChangeWithEngine(row, column, newValue);
|
1001
991
|
} else {
|
1002
|
-
outOfBoundsChanges.push([
|
992
|
+
outOfBoundsChanges.push([row, column, newValue]);
|
1003
993
|
}
|
1004
994
|
changedCells.push({
|
1005
995
|
address: address
|
@@ -1010,16 +1000,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1010
1000
|
// Workaround for rows/columns being created two times (by HOT and the engine).
|
1011
1001
|
// (unfortunately, this requires an extra re-render)
|
1012
1002
|
this.hot.addHookOnce('afterChange', function () {
|
1013
|
-
var outOfBoundsDependentCells =
|
1003
|
+
var outOfBoundsDependentCells = _this15.engine.batch(function () {
|
1014
1004
|
outOfBoundsChanges.forEach(function (_ref11) {
|
1015
1005
|
var _ref12 = _slicedToArray(_ref11, 3),
|
1016
1006
|
row = _ref12[0],
|
1017
1007
|
column = _ref12[1],
|
1018
1008
|
newValue = _ref12[2];
|
1019
|
-
|
1009
|
+
_this15.syncChangeWithEngine(row, column, newValue);
|
1020
1010
|
});
|
1021
1011
|
});
|
1022
|
-
|
1012
|
+
_this15.renderDependentSheets(outOfBoundsDependentCells, true);
|
1023
1013
|
});
|
1024
1014
|
}
|
1025
1015
|
this.renderDependentSheets(dependentCells);
|
@@ -1037,7 +1027,7 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1037
1027
|
}, {
|
1038
1028
|
key: "onAfterSetSourceDataAtCell",
|
1039
1029
|
value: function onAfterSetSourceDataAtCell(changes, source) {
|
1040
|
-
var
|
1030
|
+
var _this16 = this;
|
1041
1031
|
if (isBlockedSource(source)) {
|
1042
1032
|
return;
|
1043
1033
|
}
|
@@ -1045,26 +1035,26 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1045
1035
|
var changedCells = [];
|
1046
1036
|
changes.forEach(function (_ref13) {
|
1047
1037
|
var _ref14 = _slicedToArray(_ref13, 4),
|
1048
|
-
|
1038
|
+
row = _ref14[0],
|
1049
1039
|
prop = _ref14[1],
|
1050
1040
|
newValue = _ref14[3];
|
1051
|
-
var
|
1052
|
-
if (!isNumeric(
|
1041
|
+
var column = _this16.hot.propToCol(prop);
|
1042
|
+
if (!isNumeric(column)) {
|
1053
1043
|
return;
|
1054
1044
|
}
|
1055
1045
|
var address = {
|
1056
|
-
row:
|
1057
|
-
col:
|
1058
|
-
sheet:
|
1046
|
+
row: row,
|
1047
|
+
col: _this16.toPhysicalColumnPosition(column),
|
1048
|
+
sheet: _this16.sheetId
|
1059
1049
|
};
|
1060
|
-
if (!
|
1050
|
+
if (!_this16.engine.isItPossibleToSetCellContents(address)) {
|
1061
1051
|
warn("Not possible to set source cell data at ".concat(JSON.stringify(address)));
|
1062
1052
|
return;
|
1063
1053
|
}
|
1064
1054
|
changedCells.push({
|
1065
1055
|
address: address
|
1066
1056
|
});
|
1067
|
-
dependentCells.push.apply(dependentCells, _toConsumableArray(
|
1057
|
+
dependentCells.push.apply(dependentCells, _toConsumableArray(_this16.engine.setCellContents(address, newValue)));
|
1068
1058
|
});
|
1069
1059
|
this.renderDependentSheets(dependentCells);
|
1070
1060
|
this.validateDependentCells(dependentCells, changedCells);
|
@@ -1074,19 +1064,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1074
1064
|
* `beforeCreateRow` hook callback.
|
1075
1065
|
*
|
1076
1066
|
* @private
|
1077
|
-
* @param {number}
|
1067
|
+
* @param {number} row Represents the visual index of first newly created row in the data source array.
|
1078
1068
|
* @param {number} amount Number of newly created rows in the data source array.
|
1079
1069
|
* @returns {*|boolean} If false is returned the action is canceled.
|
1080
1070
|
*/
|
1081
1071
|
}, {
|
1082
1072
|
key: "onBeforeCreateRow",
|
1083
|
-
value: function onBeforeCreateRow(
|
1084
|
-
|
1085
|
-
if (visualRow >= this.hot.countRows()) {
|
1086
|
-
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1087
|
-
}
|
1088
|
-
|
1089
|
-
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
1073
|
+
value: function onBeforeCreateRow(row, amount) {
|
1074
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [this.toPhysicalRowPosition(row), amount])) {
|
1090
1075
|
return false;
|
1091
1076
|
}
|
1092
1077
|
}
|
@@ -1095,19 +1080,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1095
1080
|
* `beforeCreateCol` hook callback.
|
1096
1081
|
*
|
1097
1082
|
* @private
|
1098
|
-
* @param {number}
|
1083
|
+
* @param {number} col Represents the visual index of first newly created column in the data source.
|
1099
1084
|
* @param {number} amount Number of newly created columns in the data source.
|
1100
1085
|
* @returns {*|boolean} If false is returned the action is canceled.
|
1101
1086
|
*/
|
1102
1087
|
}, {
|
1103
1088
|
key: "onBeforeCreateCol",
|
1104
|
-
value: function onBeforeCreateCol(
|
1105
|
-
|
1106
|
-
if (visualColumn >= this.hot.countCols()) {
|
1107
|
-
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1108
|
-
}
|
1109
|
-
|
1110
|
-
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
1089
|
+
value: function onBeforeCreateCol(col, amount) {
|
1090
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount])) {
|
1111
1091
|
return false;
|
1112
1092
|
}
|
1113
1093
|
}
|
@@ -1124,10 +1104,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1124
1104
|
}, {
|
1125
1105
|
key: "onBeforeRemoveRow",
|
1126
1106
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
1127
|
-
var
|
1128
|
-
var
|
1129
|
-
|
1130
|
-
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
1107
|
+
var _this17 = this;
|
1108
|
+
var possible = physicalRows.every(function (physicalRow) {
|
1109
|
+
return _this17.engine.isItPossibleToRemoveRows(_this17.sheetId, [physicalRow, 1]);
|
1131
1110
|
});
|
1132
1111
|
return possible === false ? false : void 0;
|
1133
1112
|
}
|
@@ -1144,10 +1123,9 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1144
1123
|
}, {
|
1145
1124
|
key: "onBeforeRemoveCol",
|
1146
1125
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1147
|
-
var
|
1148
|
-
var
|
1149
|
-
|
1150
|
-
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1126
|
+
var _this18 = this;
|
1127
|
+
var possible = physicalColumns.every(function (physicalColumn) {
|
1128
|
+
return _this18.engine.isItPossibleToRemoveColumns(_this18.sheetId, [physicalColumn, 1]);
|
1151
1129
|
});
|
1152
1130
|
return possible === false ? false : void 0;
|
1153
1131
|
}
|
@@ -1156,18 +1134,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1156
1134
|
* `afterCreateRow` hook callback.
|
1157
1135
|
*
|
1158
1136
|
* @private
|
1159
|
-
* @param {number}
|
1137
|
+
* @param {number} row Represents the visual index of first newly created row in the data source array.
|
1160
1138
|
* @param {number} amount Number of newly created rows in the data source array.
|
1161
1139
|
* @param {string} [source] String that identifies source of hook call
|
1162
1140
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1163
1141
|
*/
|
1164
1142
|
}, {
|
1165
1143
|
key: "onAfterCreateRow",
|
1166
|
-
value: function onAfterCreateRow(
|
1144
|
+
value: function onAfterCreateRow(row, amount, source) {
|
1167
1145
|
if (isBlockedSource(source)) {
|
1168
1146
|
return;
|
1169
1147
|
}
|
1170
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1148
|
+
var changes = this.engine.addRows(this.sheetId, [this.toPhysicalRowPosition(row), amount]);
|
1171
1149
|
this.renderDependentSheets(changes);
|
1172
1150
|
}
|
1173
1151
|
|
@@ -1175,18 +1153,18 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1175
1153
|
* `afterCreateCol` hook callback.
|
1176
1154
|
*
|
1177
1155
|
* @private
|
1178
|
-
* @param {number}
|
1156
|
+
* @param {number} col Represents the visual index of first newly created column in the data source.
|
1179
1157
|
* @param {number} amount Number of newly created columns in the data source.
|
1180
1158
|
* @param {string} [source] String that identifies source of hook call
|
1181
1159
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1182
1160
|
*/
|
1183
1161
|
}, {
|
1184
1162
|
key: "onAfterCreateCol",
|
1185
|
-
value: function onAfterCreateCol(
|
1163
|
+
value: function onAfterCreateCol(col, amount, source) {
|
1186
1164
|
if (isBlockedSource(source)) {
|
1187
1165
|
return;
|
1188
1166
|
}
|
1189
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1167
|
+
var changes = this.engine.addColumns(this.sheetId, [this.toPhysicalColumnPosition(col), amount]);
|
1190
1168
|
this.renderDependentSheets(changes);
|
1191
1169
|
}
|
1192
1170
|
|
@@ -1203,14 +1181,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1203
1181
|
}, {
|
1204
1182
|
key: "onAfterRemoveRow",
|
1205
1183
|
value: function onAfterRemoveRow(row, amount, physicalRows, source) {
|
1206
|
-
var
|
1184
|
+
var _this19 = this;
|
1207
1185
|
if (isBlockedSource(source)) {
|
1208
1186
|
return;
|
1209
1187
|
}
|
1210
|
-
var
|
1188
|
+
var descendingPhysicalRows = physicalRows.sort().reverse();
|
1211
1189
|
var changes = this.engine.batch(function () {
|
1212
|
-
|
1213
|
-
|
1190
|
+
descendingPhysicalRows.forEach(function (physicalRow) {
|
1191
|
+
_this19.engine.removeRows(_this19.sheetId, [physicalRow, 1]);
|
1214
1192
|
});
|
1215
1193
|
});
|
1216
1194
|
this.renderDependentSheets(changes);
|
@@ -1229,14 +1207,14 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1229
1207
|
}, {
|
1230
1208
|
key: "onAfterRemoveCol",
|
1231
1209
|
value: function onAfterRemoveCol(col, amount, physicalColumns, source) {
|
1232
|
-
var
|
1210
|
+
var _this20 = this;
|
1233
1211
|
if (isBlockedSource(source)) {
|
1234
1212
|
return;
|
1235
1213
|
}
|
1236
|
-
var
|
1214
|
+
var descendingPhysicalColumns = physicalColumns.sort().reverse();
|
1237
1215
|
var changes = this.engine.batch(function () {
|
1238
|
-
|
1239
|
-
|
1216
|
+
descendingPhysicalColumns.forEach(function (physicalColumn) {
|
1217
|
+
_this20.engine.removeColumns(_this20.sheetId, [physicalColumn, 1]);
|
1240
1218
|
});
|
1241
1219
|
});
|
1242
1220
|
this.renderDependentSheets(changes);
|
@@ -1255,16 +1233,16 @@ export var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1255
1233
|
key: "onAfterDetachChild",
|
1256
1234
|
value: function onAfterDetachChild(parent, element, finalElementRowIndex) {
|
1257
1235
|
var _element$__children,
|
1258
|
-
|
1236
|
+
_this21 = this;
|
1259
1237
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1260
1238
|
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());
|
1261
1239
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1262
1240
|
rowsData.forEach(function (row, relativeRowIndex) {
|
1263
1241
|
row.forEach(function (value, colIndex) {
|
1264
|
-
|
1242
|
+
_this21.engine.setCellContents({
|
1265
1243
|
col: colIndex,
|
1266
1244
|
row: finalElementRowIndex + relativeRowIndex,
|
1267
|
-
sheet:
|
1245
|
+
sheet: _this21.sheetId
|
1268
1246
|
}, [[value]]);
|
1269
1247
|
});
|
1270
1248
|
});
|