handsontable 12.3.3 → 12.4.0-next-acb5d99-20230512
Sign up to get free protection for your applications and to get access to all the features.
- package/3rdparty/walkontable/src/cell/coords.js +13 -16
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -16
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- package/3rdparty/walkontable/src/core/_base.js +16 -20
- package/3rdparty/walkontable/src/core/_base.mjs +16 -20
- package/3rdparty/walkontable/src/event.js +4 -0
- package/3rdparty/walkontable/src/event.mjs +4 -0
- package/3rdparty/walkontable/src/overlay/_base.js +6 -7
- package/3rdparty/walkontable/src/overlay/_base.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/top.js +6 -7
- package/3rdparty/walkontable/src/overlay/top.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
- package/3rdparty/walkontable/src/overlays.js +55 -64
- package/3rdparty/walkontable/src/overlays.mjs +55 -64
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table.js +22 -26
- package/3rdparty/walkontable/src/table.mjs +22 -26
- package/CHANGELOG.md +14 -0
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.js +23 -6
- package/core.mjs +23 -6
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +9 -7
- package/dataMap/metaManager/metaSchema.mjs +9 -7
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7364 -5992
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +256 -234
- package/dist/handsontable.js +4326 -3275
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +11 -3
- package/dist/languages/all.js +133 -0
- package/dist/languages/ar-AR.js +7 -0
- package/dist/languages/cs-CZ.js +7 -0
- package/dist/languages/de-CH.js +7 -0
- package/dist/languages/de-DE.js +7 -0
- package/dist/languages/en-US.js +7 -0
- package/dist/languages/es-MX.js +7 -0
- package/dist/languages/fr-FR.js +7 -0
- package/dist/languages/it-IT.js +7 -0
- package/dist/languages/ja-JP.js +7 -0
- package/dist/languages/ko-KR.js +7 -0
- package/dist/languages/lv-LV.js +7 -0
- package/dist/languages/nb-NO.js +7 -0
- package/dist/languages/nl-NL.js +7 -0
- package/dist/languages/pl-PL.js +7 -0
- package/dist/languages/pt-BR.js +7 -0
- package/dist/languages/ru-RU.js +7 -0
- package/dist/languages/sr-SP.js +7 -0
- package/dist/languages/zh-CN.js +7 -0
- package/dist/languages/zh-TW.js +7 -0
- package/editors/autocompleteEditor/autocompleteEditor.js +8 -9
- package/editors/autocompleteEditor/autocompleteEditor.mjs +8 -9
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/i18n/languages/ar-AR.js +7 -1
- package/i18n/languages/cs-CZ.js +7 -1
- package/i18n/languages/de-CH.js +7 -1
- package/i18n/languages/de-DE.js +7 -1
- package/i18n/languages/en-US.js +7 -1
- package/i18n/languages/es-MX.js +7 -1
- package/i18n/languages/fr-FR.js +7 -1
- package/i18n/languages/it-IT.js +7 -1
- package/i18n/languages/ja-JP.js +7 -1
- package/i18n/languages/ko-KR.js +7 -1
- package/i18n/languages/lv-LV.js +7 -1
- package/i18n/languages/nb-NO.js +7 -1
- package/i18n/languages/nl-NL.js +7 -1
- package/i18n/languages/pl-PL.js +7 -1
- package/i18n/languages/pt-BR.js +7 -1
- package/i18n/languages/ru-RU.js +7 -1
- package/i18n/languages/sr-SP.js +7 -1
- package/i18n/languages/zh-CN.js +7 -1
- package/i18n/languages/zh-TW.js +7 -1
- package/languages/all.js +133 -0
- package/languages/ar-AR.js +7 -0
- package/languages/cs-CZ.js +7 -0
- package/languages/de-CH.js +7 -0
- package/languages/de-DE.js +7 -0
- package/languages/en-US.js +7 -0
- package/languages/es-MX.js +7 -0
- package/languages/fr-FR.js +7 -0
- package/languages/index.js +133 -0
- package/languages/it-IT.js +7 -0
- package/languages/ja-JP.js +7 -0
- package/languages/ko-KR.js +7 -0
- package/languages/lv-LV.js +7 -0
- package/languages/nb-NO.js +7 -0
- package/languages/nl-NL.js +7 -0
- package/languages/pl-PL.js +7 -0
- package/languages/pt-BR.js +7 -0
- package/languages/ru-RU.js +7 -0
- package/languages/sr-SP.js +7 -0
- package/languages/zh-CN.js +7 -0
- package/languages/zh-TW.js +7 -0
- package/package.json +3 -2
- package/pluginHooks.js +16 -6
- package/pluginHooks.mjs +15 -3
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/base/base.js +9 -10
- package/plugins/base/base.mjs +9 -10
- package/plugins/collapsibleColumns/collapsibleColumns.js +24 -7
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -7
- package/plugins/copyPaste/copyPaste.js +92 -16
- package/plugins/copyPaste/copyPaste.mjs +92 -16
- package/plugins/copyPaste/copyableRanges.js +39 -39
- package/plugins/copyPaste/copyableRanges.mjs +32 -32
- package/plugins/customBorders/customBorders.d.ts +2 -0
- package/plugins/customBorders/customBorders.js +6 -7
- package/plugins/customBorders/customBorders.mjs +6 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/engine/register.js +9 -0
- package/plugins/formulas/engine/register.mjs +13 -4
- package/plugins/formulas/engine/settings.js +18 -3
- package/plugins/formulas/engine/settings.mjs +16 -3
- package/plugins/formulas/formulas.js +308 -162
- package/plugins/formulas/formulas.mjs +308 -163
- package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
- package/plugins/formulas/indexSyncer/index.js +225 -0
- package/plugins/formulas/indexSyncer/index.mjs +219 -0
- package/plugins/formulas/utils.js +81 -0
- package/plugins/formulas/utils.mjs +74 -0
- package/plugins/hiddenColumns/hiddenColumns.js +12 -7
- package/plugins/hiddenColumns/hiddenColumns.mjs +12 -7
- package/plugins/hiddenRows/hiddenRows.js +12 -7
- package/plugins/hiddenRows/hiddenRows.mjs +12 -7
- package/plugins/manualRowMove/manualRowMove.js +26 -11
- package/plugins/manualRowMove/manualRowMove.mjs +27 -12
- package/plugins/nestedHeaders/nestedHeaders.js +26 -7
- package/plugins/nestedHeaders/nestedHeaders.mjs +26 -7
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +21 -3
- package/plugins/nestedHeaders/stateManager/index.mjs +18 -0
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -0
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -0
- package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
- package/plugins/registry.js +3 -1
- package/plugins/undoRedo/undoRedo.js +0 -1
- package/plugins/undoRedo/undoRedo.mjs +0 -1
- package/selection/highlight/visualSelection.js +5 -6
- package/selection/highlight/visualSelection.mjs +5 -6
- package/tableView.js +62 -72
- package/tableView.mjs +62 -72
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +8 -1
- package/translations/changesObservable/observer.mjs +7 -0
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.js +6 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +6 -0
- package/utils/dataStructures/tree.js +15 -18
- package/utils/dataStructures/tree.mjs +15 -18
- package/utils/parseTable.js +5 -1
- package/utils/parseTable.mjs +5 -1
@@ -11,15 +11,11 @@ require("core-js/modules/es.reflect.construct.js");
|
|
11
11
|
require("core-js/modules/es.reflect.get.js");
|
12
12
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
13
13
|
require("core-js/modules/es.symbol.iterator.js");
|
14
|
-
require("core-js/modules/es.array.slice.js");
|
15
14
|
require("core-js/modules/es.function.name.js");
|
16
15
|
require("core-js/modules/es.array.from.js");
|
17
16
|
require("core-js/modules/es.regexp.exec.js");
|
18
|
-
require("core-js/modules/es.object.keys.js");
|
19
|
-
require("core-js/modules/es.array.filter.js");
|
20
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
21
17
|
exports.__esModule = true;
|
22
|
-
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
|
18
|
+
exports.SETTING_KEYS = exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Formulas = void 0;
|
23
19
|
require("core-js/modules/es.array.concat.js");
|
24
20
|
require("core-js/modules/es.object.to-string.js");
|
25
21
|
require("core-js/modules/web.dom-collections.for-each.js");
|
@@ -28,6 +24,8 @@ require("core-js/modules/es.set.js");
|
|
28
24
|
require("core-js/modules/es.string.iterator.js");
|
29
25
|
require("core-js/modules/web.dom-collections.iterator.js");
|
30
26
|
require("core-js/modules/es.array.map.js");
|
27
|
+
require("core-js/modules/es.string.starts-with.js");
|
28
|
+
require("core-js/modules/es.array.slice.js");
|
31
29
|
require("core-js/modules/es.array.includes.js");
|
32
30
|
require("core-js/modules/es.string.includes.js");
|
33
31
|
require("core-js/modules/es.array.reverse.js");
|
@@ -44,13 +42,12 @@ var _settings = require("./engine/settings");
|
|
44
42
|
var _data = require("../../helpers/data");
|
45
43
|
var _string = require("../../helpers/string");
|
46
44
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
45
|
+
var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
|
47
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
48
47
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
49
48
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
50
49
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
51
50
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
52
|
-
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; }
|
53
|
-
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; }
|
54
51
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
55
52
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
56
53
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -82,9 +79,10 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
|
|
82
79
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
83
80
|
var PLUGIN_KEY = 'formulas';
|
84
81
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
82
|
+
var SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
83
|
+
exports.SETTING_KEYS = SETTING_KEYS;
|
85
84
|
var PLUGIN_PRIORITY = 260;
|
86
85
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
87
|
-
var ROW_MOVE_UNDO_REDO_NAME = 'row_move';
|
88
86
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionAdded');
|
89
87
|
_pluginHooks.default.getSingleton().register('afterNamedExpressionRemoved');
|
90
88
|
_pluginHooks.default.getSingleton().register('afterSheetAdded');
|
@@ -123,14 +121,31 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
123
121
|
_args[_key] = arguments[_key];
|
124
122
|
}
|
125
123
|
_this = _super.call.apply(_super, [this].concat(_args));
|
124
|
+
/**
|
125
|
+
* Flag used to bypass hooks in internal operations.
|
126
|
+
*
|
127
|
+
* @private
|
128
|
+
* @type {boolean}
|
129
|
+
*/
|
126
130
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _internalOperationPending, {
|
127
131
|
writable: true,
|
128
132
|
value: false
|
129
133
|
});
|
134
|
+
/**
|
135
|
+
* Flag needed to mark if Handsontable was initialized with no data.
|
136
|
+
* (Required to work around the fact, that Handsontable auto-generates sample data, when no data is provided).
|
137
|
+
*
|
138
|
+
* @type {boolean}
|
139
|
+
*/
|
130
140
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hotWasInitializedWithEmptyData, {
|
131
141
|
writable: true,
|
132
142
|
value: false
|
133
143
|
});
|
144
|
+
/**
|
145
|
+
* The list of the HyperFormula listeners.
|
146
|
+
*
|
147
|
+
* @type {Array}
|
148
|
+
*/
|
134
149
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _engineListeners, {
|
135
150
|
writable: true,
|
136
151
|
value: [['valuesUpdated', function () {
|
@@ -153,9 +168,44 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
153
168
|
return (_this7 = _this).onEngineSheetRemoved.apply(_this7, arguments);
|
154
169
|
}]]
|
155
170
|
});
|
171
|
+
/**
|
172
|
+
* Static register used to set up one global HyperFormula instance.
|
173
|
+
* TODO: currently used in tests, might be removed later.
|
174
|
+
*
|
175
|
+
* @private
|
176
|
+
* @type {object}
|
177
|
+
*/
|
156
178
|
_defineProperty(_assertThisInitialized(_this), "staticRegister", (0, _staticRegister.default)('formulas'));
|
179
|
+
/**
|
180
|
+
* The engine instance that will be used for this instance of Handsontable.
|
181
|
+
*
|
182
|
+
* @type {HyperFormula|null}
|
183
|
+
*/
|
157
184
|
_defineProperty(_assertThisInitialized(_this), "engine", null);
|
185
|
+
/**
|
186
|
+
* HyperFormula's sheet name.
|
187
|
+
*
|
188
|
+
* @type {string|null}
|
189
|
+
*/
|
158
190
|
_defineProperty(_assertThisInitialized(_this), "sheetName", null);
|
191
|
+
/**
|
192
|
+
* Index synchronizer responsible for manipulating with some general options related to indexes synchronization.
|
193
|
+
*
|
194
|
+
* @type {IndexSyncer|null}
|
195
|
+
*/
|
196
|
+
_defineProperty(_assertThisInitialized(_this), "indexSyncer", null);
|
197
|
+
/**
|
198
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the rows.
|
199
|
+
*
|
200
|
+
* @type {AxisSyncer|null}
|
201
|
+
*/
|
202
|
+
_defineProperty(_assertThisInitialized(_this), "rowAxisSyncer", null);
|
203
|
+
/**
|
204
|
+
* Index synchronizer responsible for syncing the order of HOT and HF's data for the axis of the columns.
|
205
|
+
*
|
206
|
+
* @type {AxisSyncer|null}
|
207
|
+
*/
|
208
|
+
_defineProperty(_assertThisInitialized(_this), "columnAxisSyncer", null);
|
159
209
|
return _this;
|
160
210
|
}
|
161
211
|
_createClass(Formulas, [{
|
@@ -263,24 +313,66 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
263
313
|
this.addHook('afterRemoveCol', function () {
|
264
314
|
return _this8.onAfterRemoveCol.apply(_this8, arguments);
|
265
315
|
});
|
316
|
+
this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, function (postponedAction) {
|
317
|
+
_this8.hot.addHookOnce('init', function () {
|
318
|
+
// Engine is initialized after executing callback to `afterLoadData` hook. Thus, some actions on indexes should
|
319
|
+
// be postponed.
|
320
|
+
postponedAction();
|
321
|
+
});
|
322
|
+
});
|
323
|
+
this.rowAxisSyncer = this.indexSyncer.getForAxis('row');
|
324
|
+
this.columnAxisSyncer = this.indexSyncer.getForAxis('column');
|
325
|
+
this.hot.addHook('afterRowSequenceChange', this.rowAxisSyncer.getIndexesChangeSyncMethod());
|
326
|
+
this.hot.addHook('afterColumnSequenceChange', this.columnAxisSyncer.getIndexesChangeSyncMethod());
|
327
|
+
this.hot.addHook('beforeRowMove', function (movedRows, finalIndex, _, movePossible) {
|
328
|
+
_this8.rowAxisSyncer.storeMovesInformation(movedRows, finalIndex, movePossible);
|
329
|
+
});
|
330
|
+
this.hot.addHook('beforeColumnMove', function (movedColumns, finalIndex, _, movePossible) {
|
331
|
+
_this8.columnAxisSyncer.storeMovesInformation(movedColumns, finalIndex, movePossible);
|
332
|
+
});
|
333
|
+
this.hot.addHook('afterRowMove', function (movedRows, finalIndex, dropIndex, movePossible, orderChanged) {
|
334
|
+
_this8.rowAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
335
|
+
});
|
336
|
+
this.hot.addHook('afterColumnMove', function (movedColumns, finalIndex, dropIndex, movePossible, orderChanged) {
|
337
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(movePossible, orderChanged);
|
338
|
+
});
|
339
|
+
this.hot.addHook('beforeColumnFreeze', function (column, freezePerformed) {
|
340
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart, freezePerformed);
|
341
|
+
});
|
342
|
+
this.hot.addHook('afterColumnFreeze', function (_, freezePerformed) {
|
343
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(freezePerformed, freezePerformed);
|
344
|
+
});
|
345
|
+
this.hot.addHook('beforeColumnUnfreeze', function (column, unfreezePerformed) {
|
346
|
+
_this8.columnAxisSyncer.storeMovesInformation([column], _this8.hot.getSettings().fixedColumnsStart - 1, unfreezePerformed);
|
347
|
+
});
|
348
|
+
this.hot.addHook('afterColumnUnfreeze', function (_, unfreezePerformed) {
|
349
|
+
_this8.columnAxisSyncer.calculateAndSyncMoves(unfreezePerformed, unfreezePerformed);
|
350
|
+
});
|
351
|
+
|
352
|
+
// TODO: Actions related to overwriting dates from HOT format to HF default format are done as callback to this
|
353
|
+
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
354
|
+
// Another hooks are triggered to late for setting HF's engine data needed for some actions.
|
355
|
+
this.addHook('afterCellMetaReset', function () {
|
356
|
+
return _this8.onAfterCellMetaReset.apply(_this8, arguments);
|
357
|
+
});
|
266
358
|
|
267
359
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
268
|
-
this.addHook('beforeUndo', function (
|
269
|
-
|
270
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
271
|
-
return;
|
272
|
-
}
|
360
|
+
this.addHook('beforeUndo', function () {
|
361
|
+
_this8.indexSyncer.setPerformUndo(true);
|
273
362
|
_this8.engine.undo();
|
274
363
|
});
|
275
364
|
|
276
365
|
// Handling redo actions on data just using HyperFormula's UndoRedo mechanism
|
277
|
-
this.addHook('beforeRedo', function (
|
278
|
-
|
279
|
-
if ((action === null || action === void 0 ? void 0 : action.actionType) === ROW_MOVE_UNDO_REDO_NAME) {
|
280
|
-
return;
|
281
|
-
}
|
366
|
+
this.addHook('beforeRedo', function () {
|
367
|
+
_this8.indexSyncer.setPerformRedo(true);
|
282
368
|
_this8.engine.redo();
|
283
369
|
});
|
370
|
+
this.addHook('afterUndo', function () {
|
371
|
+
_this8.indexSyncer.setPerformUndo(false);
|
372
|
+
});
|
373
|
+
this.addHook('afterUndo', function () {
|
374
|
+
_this8.indexSyncer.setPerformRedo(false);
|
375
|
+
});
|
284
376
|
this.addHook('afterDetachChild', function () {
|
285
377
|
return _this8.onAfterDetachChild.apply(_this8, arguments);
|
286
378
|
});
|
@@ -323,7 +415,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
323
415
|
}, {
|
324
416
|
key: "updatePlugin",
|
325
417
|
value: function updatePlugin(newSettings) {
|
326
|
-
|
418
|
+
var newEngineSettings = (0, _settings.getEngineSettingsWithOverrides)(this.hot.getSettings());
|
419
|
+
if ((0, _settings.haveEngineSettingsChanged)(this.engine.getConfig(), newEngineSettings)) {
|
420
|
+
this.engine.updateConfig(newEngineSettings);
|
421
|
+
}
|
327
422
|
var pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
328
423
|
if ((0, _mixed.isDefined)(pluginSettings) && (0, _mixed.isDefined)(pluginSettings.sheetName) && pluginSettings.sheetName !== this.sheetName) {
|
329
424
|
this.switchSheet(pluginSettings.sheetName);
|
@@ -362,63 +457,6 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
362
457
|
_get(_getPrototypeOf(Formulas.prototype), "destroy", this).call(this);
|
363
458
|
}
|
364
459
|
|
365
|
-
/**
|
366
|
-
* Helper function for `toPhysicalRowPosition` and `toPhysicalColumnPosition`.
|
367
|
-
*
|
368
|
-
* @private
|
369
|
-
* @param {number} visualIndex Visual entry index.
|
370
|
-
* @param {number} physicalIndex Physical entry index.
|
371
|
-
* @param {number} entriesCount Visual entries count.
|
372
|
-
* @param {number} sourceEntriesCount Source entries count.
|
373
|
-
* @param {boolean} contained `true` if it should return only indexes within boundaries of the table (basically
|
374
|
-
* `toPhysical` alias.
|
375
|
-
* @returns {*}
|
376
|
-
*/
|
377
|
-
}, {
|
378
|
-
key: "getPhysicalIndexPosition",
|
379
|
-
value: function getPhysicalIndexPosition(visualIndex, physicalIndex, entriesCount, sourceEntriesCount, contained) {
|
380
|
-
if (!contained) {
|
381
|
-
if (visualIndex >= entriesCount) {
|
382
|
-
return sourceEntriesCount + (visualIndex - entriesCount);
|
383
|
-
}
|
384
|
-
}
|
385
|
-
return physicalIndex;
|
386
|
-
}
|
387
|
-
|
388
|
-
/**
|
389
|
-
* Returns the physical row index. The difference between this and Core's `toPhysical` is that it doesn't return
|
390
|
-
* `null` on rows with indexes higher than the number of rows.
|
391
|
-
*
|
392
|
-
* @private
|
393
|
-
* @param {number} row Visual row index.
|
394
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
395
|
-
* `toPhysical` alias.
|
396
|
-
* @returns {number} The physical row index.
|
397
|
-
*/
|
398
|
-
}, {
|
399
|
-
key: "toPhysicalRowPosition",
|
400
|
-
value: function toPhysicalRowPosition(row) {
|
401
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
402
|
-
return this.getPhysicalIndexPosition(row, this.hot.toPhysicalRow(row), this.hot.countRows(), this.hot.countSourceRows(), contained);
|
403
|
-
}
|
404
|
-
|
405
|
-
/**
|
406
|
-
* Returns the physical column index. The difference between this and Core's `toPhysical` is that it doesn't return
|
407
|
-
* `null` on columns with indexes higher than the number of columns.
|
408
|
-
*
|
409
|
-
* @private
|
410
|
-
* @param {number} column Visual column index.
|
411
|
-
* @param {boolean} [contained] `true` if it should return only indexes within boundaries of the table (basically
|
412
|
-
* `toPhysical` alias.
|
413
|
-
* @returns {number} The physical column index.
|
414
|
-
*/
|
415
|
-
}, {
|
416
|
-
key: "toPhysicalColumnPosition",
|
417
|
-
value: function toPhysicalColumnPosition(column) {
|
418
|
-
var contained = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
419
|
-
return this.getPhysicalIndexPosition(column, this.hot.toPhysicalColumn(column), this.hot.countCols(), this.hot.countSourceCols(), contained);
|
420
|
-
}
|
421
|
-
|
422
460
|
/**
|
423
461
|
* Add a sheet to the shared HyperFormula instance.
|
424
462
|
*
|
@@ -489,8 +527,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
489
527
|
if (physicalRow !== null && physicalColumn !== null) {
|
490
528
|
return this.engine.getCellType({
|
491
529
|
sheet: sheet,
|
492
|
-
row:
|
493
|
-
col:
|
530
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
531
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
494
532
|
});
|
495
533
|
} else {
|
496
534
|
// Should return `EMPTY` when out of bounds (according to the test cases).
|
@@ -510,15 +548,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
510
548
|
key: "isFormulaCellType",
|
511
549
|
value: function isFormulaCellType(row, column) {
|
512
550
|
var sheet = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.sheetId;
|
513
|
-
var physicalRow = this.hot.toPhysicalRow(row);
|
514
|
-
var physicalColumn = this.hot.toPhysicalColumn(column);
|
515
|
-
if (physicalRow === null || physicalColumn === null) {
|
516
|
-
return false;
|
517
|
-
}
|
518
551
|
return this.engine.doesCellHaveFormula({
|
519
552
|
sheet: sheet,
|
520
|
-
row:
|
521
|
-
col:
|
553
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
554
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column)
|
522
555
|
});
|
523
556
|
}
|
524
557
|
|
@@ -583,11 +616,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
583
616
|
var _ref8 = (_change$address3 = change.address) !== null && _change$address3 !== void 0 ? _change$address3 : {},
|
584
617
|
row = _ref8.row,
|
585
618
|
col = _ref8.col;
|
586
|
-
var visualRow = (0, _mixed.isDefined)(row) ? _this12.hot.toVisualRow(row) : null;
|
587
|
-
var visualColumn = (0, _mixed.isDefined)(col) ? _this12.hot.toVisualColumn(col) : null;
|
588
619
|
|
589
620
|
// Don't try to validate cells outside of the visual part of the table.
|
590
|
-
if (
|
621
|
+
if ((0, _mixed.isDefined)(row) === false || (0, _mixed.isDefined)(col) === false || row >= _this12.hot.countRows() || col >= _this12.hot.countCols()) {
|
591
622
|
return;
|
592
623
|
}
|
593
624
|
|
@@ -606,7 +637,7 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
606
637
|
}
|
607
638
|
|
608
639
|
// It will just re-render certain cell when necessary.
|
609
|
-
boundHot.validateCell(boundHot.getDataAtCell(
|
640
|
+
boundHot.validateCell(boundHot.getDataAtCell(row, col), boundHot.getCellMeta(row, col), function () {});
|
610
641
|
}
|
611
642
|
});
|
612
643
|
}
|
@@ -624,14 +655,24 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
624
655
|
key: "syncChangeWithEngine",
|
625
656
|
value: function syncChangeWithEngine(row, column, newValue) {
|
626
657
|
var address = {
|
627
|
-
row: this.
|
628
|
-
col: this.
|
658
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(row),
|
659
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(column),
|
629
660
|
sheet: this.sheetId
|
630
661
|
};
|
631
662
|
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
632
663
|
(0, _console.warn)("Not possible to set cell data at ".concat(JSON.stringify(address)));
|
633
664
|
return;
|
634
665
|
}
|
666
|
+
var cellMeta = this.hot.getCellMeta(row, column);
|
667
|
+
if ((0, _utils.isDate)(newValue, cellMeta.type)) {
|
668
|
+
if ((0, _utils.isDateValid)(newValue, cellMeta.dateFormat)) {
|
669
|
+
// Rewriting date in HOT format to HF format.
|
670
|
+
newValue = (0, _utils.getDateInHfFormat)(newValue, cellMeta.dateFormat);
|
671
|
+
} else if ((0, _utils.isFormula)(newValue) === false) {
|
672
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
673
|
+
newValue = "'".concat(newValue);
|
674
|
+
}
|
675
|
+
}
|
635
676
|
return this.engine.setCellContents(address, newValue);
|
636
677
|
}
|
637
678
|
|
@@ -651,11 +692,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
651
692
|
var visualColumn = this.hot.propToCol(prop);
|
652
693
|
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
653
694
|
var address = {
|
654
|
-
row: this.
|
655
|
-
col: this.
|
695
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
696
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
656
697
|
sheet: this.sheetId
|
657
698
|
};
|
658
|
-
var
|
699
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
700
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
701
|
+
|
702
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
703
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
704
|
+
}
|
659
705
|
|
660
706
|
// If `cellValue` is an object it is expected to be an error
|
661
707
|
return _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -676,19 +722,41 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
676
722
|
}, {
|
677
723
|
key: "onBeforeAutofill",
|
678
724
|
value: function onBeforeAutofill(fillData, sourceRange, targetRange) {
|
679
|
-
var
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
725
|
+
var _sourceRange$getTopSt = sourceRange.getTopStartCorner(),
|
726
|
+
sourceTopStartRow = _sourceRange$getTopSt.row,
|
727
|
+
sourceTopStartColumn = _sourceRange$getTopSt.col;
|
728
|
+
var _sourceRange$getBotto = sourceRange.getBottomEndCorner(),
|
729
|
+
sourceBottomEndRow = _sourceRange$getBotto.row,
|
730
|
+
sourceBottomEndColumn = _sourceRange$getBotto.col;
|
731
|
+
var _targetRange$getTopSt = targetRange.getTopStartCorner(),
|
732
|
+
targetTopStartRow = _targetRange$getTopSt.row,
|
733
|
+
targetTopStartColumn = _targetRange$getTopSt.col;
|
734
|
+
var _targetRange$getBotto = targetRange.getBottomEndCorner(),
|
735
|
+
targetBottomEndRow = _targetRange$getBotto.row,
|
736
|
+
targetBottomEndColumn = _targetRange$getBotto.col;
|
685
737
|
var engineSourceRange = {
|
686
|
-
start:
|
687
|
-
|
738
|
+
start: {
|
739
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
|
740
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
741
|
+
sheet: this.sheetId
|
742
|
+
},
|
743
|
+
end: {
|
744
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
745
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
746
|
+
sheet: this.sheetId
|
747
|
+
}
|
688
748
|
};
|
689
749
|
var engineTargetRange = {
|
690
|
-
start:
|
691
|
-
|
750
|
+
start: {
|
751
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
|
752
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
753
|
+
sheet: this.sheetId
|
754
|
+
},
|
755
|
+
end: {
|
756
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
757
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
758
|
+
sheet: this.sheetId
|
759
|
+
}
|
692
760
|
};
|
693
761
|
|
694
762
|
// Blocks the autofill operation if HyperFormula says that at least one of
|
@@ -696,7 +764,33 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
696
764
|
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
697
765
|
return false;
|
698
766
|
}
|
699
|
-
|
767
|
+
var fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
|
768
|
+
var _engineSourceRange$st = engineSourceRange.start,
|
769
|
+
sourceStartRow = _engineSourceRange$st.row,
|
770
|
+
sourceStartColumn = _engineSourceRange$st.col;
|
771
|
+
var _engineSourceRange$en = engineSourceRange.end,
|
772
|
+
sourceEndRow = _engineSourceRange$en.row,
|
773
|
+
sourceEndColumn = _engineSourceRange$en.col;
|
774
|
+
var populationRowLength = sourceEndRow - sourceStartRow + 1;
|
775
|
+
var populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
|
776
|
+
for (var populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
|
777
|
+
for (var populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
|
778
|
+
var populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
|
779
|
+
var sourceRow = populatedRowIndex % populationRowLength;
|
780
|
+
var sourceColumn = populatedColumnIndex % populationColumnLength;
|
781
|
+
var sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
|
782
|
+
if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
|
783
|
+
if (populatedValue.startsWith('\'')) {
|
784
|
+
// Populating values on HOT side without apostrophe.
|
785
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
|
786
|
+
} else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
|
787
|
+
// Populating date in proper format, coming from the source cell.
|
788
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
}
|
793
|
+
return fillRangeData;
|
700
794
|
}
|
701
795
|
|
702
796
|
/**
|
@@ -720,6 +814,40 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
720
814
|
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
|
721
815
|
}
|
722
816
|
|
817
|
+
/**
|
818
|
+
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
819
|
+
*
|
820
|
+
* @private
|
821
|
+
*/
|
822
|
+
}, {
|
823
|
+
key: "onAfterCellMetaReset",
|
824
|
+
value: function onAfterCellMetaReset() {
|
825
|
+
var _this13 = this;
|
826
|
+
var sourceDataArray = this.hot.getSourceDataArray();
|
827
|
+
var valueChanged = false;
|
828
|
+
sourceDataArray.forEach(function (rowData, rowIndex) {
|
829
|
+
rowData.forEach(function (cellValue, columnIndex) {
|
830
|
+
var cellMeta = _this13.hot.getCellMeta(rowIndex, columnIndex);
|
831
|
+
var dateFormat = cellMeta.dateFormat;
|
832
|
+
if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
|
833
|
+
valueChanged = true;
|
834
|
+
if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
|
835
|
+
// Rewriting date in HOT format to HF format.
|
836
|
+
sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
|
837
|
+
} else if (_this13.isFormulaCellType(rowIndex, columnIndex) === false) {
|
838
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
839
|
+
sourceDataArray[rowIndex][columnIndex] = "'".concat(cellValue);
|
840
|
+
}
|
841
|
+
}
|
842
|
+
});
|
843
|
+
});
|
844
|
+
if (valueChanged === true) {
|
845
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
846
|
+
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
847
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
848
|
+
}
|
849
|
+
}
|
850
|
+
|
723
851
|
/**
|
724
852
|
* `afterLoadData` hook callback.
|
725
853
|
*
|
@@ -740,7 +868,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
740
868
|
var sourceDataArray = this.hot.getSourceDataArray();
|
741
869
|
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
742
870
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
743
|
-
var dependentCells = this.engine.setSheetContent(this.sheetId,
|
871
|
+
var dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
872
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
744
873
|
this.renderDependentSheets(dependentCells);
|
745
874
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
746
875
|
}
|
@@ -753,24 +882,27 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
753
882
|
* `modifyData` hook callback.
|
754
883
|
*
|
755
884
|
* @private
|
756
|
-
* @param {number}
|
757
|
-
* @param {number}
|
885
|
+
* @param {number} physicalRow Physical row index.
|
886
|
+
* @param {number} visualColumn Visual column index.
|
758
887
|
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
759
888
|
* property.
|
760
889
|
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
761
890
|
*/
|
762
891
|
}, {
|
763
892
|
key: "onModifyData",
|
764
|
-
value: function onModifyData(
|
893
|
+
value: function onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
765
894
|
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
766
895
|
return;
|
767
896
|
}
|
768
|
-
var visualRow = this.hot.toVisualRow(
|
897
|
+
var visualRow = this.hot.toVisualRow(physicalRow);
|
898
|
+
if (visualRow === null || visualColumn === null) {
|
899
|
+
return;
|
900
|
+
}
|
769
901
|
|
770
902
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
771
|
-
var isFormulaCellType = this.isFormulaCellType(visualRow,
|
903
|
+
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
772
904
|
if (!isFormulaCellType) {
|
773
|
-
var cellType = this.getCellType(visualRow,
|
905
|
+
var cellType = this.getCellType(visualRow, visualColumn);
|
774
906
|
if (cellType !== 'ARRAY') {
|
775
907
|
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
776
908
|
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
@@ -778,14 +910,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
778
910
|
return;
|
779
911
|
}
|
780
912
|
}
|
781
|
-
|
782
|
-
// `toPhysicalColumn` is here because of inconsistencies related to hook execution in `DataMap`.
|
783
913
|
var address = {
|
784
|
-
row:
|
785
|
-
col: this.
|
914
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
915
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
786
916
|
sheet: this.sheetId
|
787
917
|
};
|
788
|
-
var cellValue = this.engine.getCellValue(address);
|
918
|
+
var cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
919
|
+
var cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
920
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
921
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
922
|
+
}
|
789
923
|
|
790
924
|
// If `cellValue` is an object it is expected to be an error
|
791
925
|
var value = _typeof(cellValue) === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
@@ -810,6 +944,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
810
944
|
}
|
811
945
|
var visualRow = this.hot.toVisualRow(row);
|
812
946
|
var visualColumn = this.hot.propToCol(columnOrProp);
|
947
|
+
if (visualRow === null || visualColumn === null) {
|
948
|
+
return;
|
949
|
+
}
|
813
950
|
|
814
951
|
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
815
952
|
var isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
@@ -829,9 +966,8 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
829
966
|
return;
|
830
967
|
}
|
831
968
|
var address = {
|
832
|
-
row:
|
833
|
-
|
834
|
-
col: this.toPhysicalColumnPosition(visualColumn),
|
969
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
970
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
835
971
|
sheet: this.sheetId
|
836
972
|
};
|
837
973
|
valueHolder.value = this.engine.getCellSerialized(address);
|
@@ -857,21 +993,21 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
857
993
|
var dependentCells = this.engine.batch(function () {
|
858
994
|
changes.forEach(function (_ref9) {
|
859
995
|
var _ref10 = _slicedToArray(_ref9, 4),
|
860
|
-
|
996
|
+
visualRow = _ref10[0],
|
861
997
|
prop = _ref10[1],
|
862
998
|
newValue = _ref10[3];
|
863
|
-
var
|
864
|
-
var physicalRow = _this14.hot.toPhysicalRow(
|
865
|
-
var physicalColumn = _this14.hot.toPhysicalColumn(
|
999
|
+
var visualColumn = _this14.hot.propToCol(prop);
|
1000
|
+
var physicalRow = _this14.hot.toPhysicalRow(visualRow);
|
1001
|
+
var physicalColumn = _this14.hot.toPhysicalColumn(visualColumn);
|
866
1002
|
var address = {
|
867
|
-
row:
|
868
|
-
col:
|
1003
|
+
row: _this14.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1004
|
+
col: _this14.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
869
1005
|
sheet: _this14.sheetId
|
870
1006
|
};
|
871
1007
|
if (physicalRow !== null && physicalColumn !== null) {
|
872
|
-
_this14.syncChangeWithEngine(
|
1008
|
+
_this14.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
873
1009
|
} else {
|
874
|
-
outOfBoundsChanges.push([
|
1010
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
875
1011
|
}
|
876
1012
|
changedCells.push({
|
877
1013
|
address: address
|
@@ -917,16 +1053,16 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
917
1053
|
var changedCells = [];
|
918
1054
|
changes.forEach(function (_ref13) {
|
919
1055
|
var _ref14 = _slicedToArray(_ref13, 4),
|
920
|
-
|
1056
|
+
visualRow = _ref14[0],
|
921
1057
|
prop = _ref14[1],
|
922
1058
|
newValue = _ref14[3];
|
923
|
-
var
|
924
|
-
if (!(0, _number.isNumeric)(
|
1059
|
+
var visualColumn = _this15.hot.propToCol(prop);
|
1060
|
+
if (!(0, _number.isNumeric)(visualColumn)) {
|
925
1061
|
return;
|
926
1062
|
}
|
927
1063
|
var address = {
|
928
|
-
row:
|
929
|
-
col: _this15.
|
1064
|
+
row: _this15.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1065
|
+
col: _this15.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
930
1066
|
sheet: _this15.sheetId
|
931
1067
|
};
|
932
1068
|
if (!_this15.engine.isItPossibleToSetCellContents(address)) {
|
@@ -946,14 +1082,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
946
1082
|
* `beforeCreateRow` hook callback.
|
947
1083
|
*
|
948
1084
|
* @private
|
949
|
-
* @param {number}
|
1085
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
950
1086
|
* @param {number} amount Number of newly created rows in the data source array.
|
951
1087
|
* @returns {*|boolean} If false is returned the action is canceled.
|
952
1088
|
*/
|
953
1089
|
}, {
|
954
1090
|
key: "onBeforeCreateRow",
|
955
|
-
value: function onBeforeCreateRow(
|
956
|
-
|
1091
|
+
value: function onBeforeCreateRow(visualRow, amount) {
|
1092
|
+
var hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
1093
|
+
if (visualRow >= this.hot.countRows()) {
|
1094
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
957
1098
|
return false;
|
958
1099
|
}
|
959
1100
|
}
|
@@ -962,14 +1103,19 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
962
1103
|
* `beforeCreateCol` hook callback.
|
963
1104
|
*
|
964
1105
|
* @private
|
965
|
-
* @param {number}
|
1106
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
966
1107
|
* @param {number} amount Number of newly created columns in the data source.
|
967
1108
|
* @returns {*|boolean} If false is returned the action is canceled.
|
968
1109
|
*/
|
969
1110
|
}, {
|
970
1111
|
key: "onBeforeCreateCol",
|
971
|
-
value: function onBeforeCreateCol(
|
972
|
-
|
1112
|
+
value: function onBeforeCreateCol(visualColumn, amount) {
|
1113
|
+
var hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
1114
|
+
if (visualColumn >= this.hot.countCols()) {
|
1115
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
973
1119
|
return false;
|
974
1120
|
}
|
975
1121
|
}
|
@@ -987,8 +1133,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
987
1133
|
key: "onBeforeRemoveRow",
|
988
1134
|
value: function onBeforeRemoveRow(row, amount, physicalRows) {
|
989
1135
|
var _this16 = this;
|
990
|
-
var
|
991
|
-
|
1136
|
+
var hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1137
|
+
var possible = hfRows.every(function (hfRow) {
|
1138
|
+
return _this16.engine.isItPossibleToRemoveRows(_this16.sheetId, [hfRow, 1]);
|
992
1139
|
});
|
993
1140
|
return possible === false ? false : void 0;
|
994
1141
|
}
|
@@ -1006,8 +1153,9 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1006
1153
|
key: "onBeforeRemoveCol",
|
1007
1154
|
value: function onBeforeRemoveCol(col, amount, physicalColumns) {
|
1008
1155
|
var _this17 = this;
|
1009
|
-
var
|
1010
|
-
|
1156
|
+
var hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1157
|
+
var possible = hfColumns.every(function (hfColumn) {
|
1158
|
+
return _this17.engine.isItPossibleToRemoveColumns(_this17.sheetId, [hfColumn, 1]);
|
1011
1159
|
});
|
1012
1160
|
return possible === false ? false : void 0;
|
1013
1161
|
}
|
@@ -1016,18 +1164,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1016
1164
|
* `afterCreateRow` hook callback.
|
1017
1165
|
*
|
1018
1166
|
* @private
|
1019
|
-
* @param {number}
|
1167
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1020
1168
|
* @param {number} amount Number of newly created rows in the data source array.
|
1021
1169
|
* @param {string} [source] String that identifies source of hook call
|
1022
1170
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1023
1171
|
*/
|
1024
1172
|
}, {
|
1025
1173
|
key: "onAfterCreateRow",
|
1026
|
-
value: function onAfterCreateRow(
|
1174
|
+
value: function onAfterCreateRow(visualRow, amount, source) {
|
1027
1175
|
if (isBlockedSource(source)) {
|
1028
1176
|
return;
|
1029
1177
|
}
|
1030
|
-
var changes = this.engine.addRows(this.sheetId, [this.
|
1178
|
+
var changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1031
1179
|
this.renderDependentSheets(changes);
|
1032
1180
|
}
|
1033
1181
|
|
@@ -1035,18 +1183,18 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1035
1183
|
* `afterCreateCol` hook callback.
|
1036
1184
|
*
|
1037
1185
|
* @private
|
1038
|
-
* @param {number}
|
1186
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
1039
1187
|
* @param {number} amount Number of newly created columns in the data source.
|
1040
1188
|
* @param {string} [source] String that identifies source of hook call
|
1041
1189
|
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1042
1190
|
*/
|
1043
1191
|
}, {
|
1044
1192
|
key: "onAfterCreateCol",
|
1045
|
-
value: function onAfterCreateCol(
|
1193
|
+
value: function onAfterCreateCol(visualColumn, amount, source) {
|
1046
1194
|
if (isBlockedSource(source)) {
|
1047
1195
|
return;
|
1048
1196
|
}
|
1049
|
-
var changes = this.engine.addColumns(this.sheetId, [this.
|
1197
|
+
var changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1050
1198
|
this.renderDependentSheets(changes);
|
1051
1199
|
}
|
1052
1200
|
|
@@ -1067,10 +1215,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1067
1215
|
if (isBlockedSource(source)) {
|
1068
1216
|
return;
|
1069
1217
|
}
|
1070
|
-
var
|
1218
|
+
var descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1071
1219
|
var changes = this.engine.batch(function () {
|
1072
|
-
|
1073
|
-
_this18.engine.removeRows(_this18.sheetId, [
|
1220
|
+
descendingHfRows.forEach(function (hfRow) {
|
1221
|
+
_this18.engine.removeRows(_this18.sheetId, [hfRow, 1]);
|
1074
1222
|
});
|
1075
1223
|
});
|
1076
1224
|
this.renderDependentSheets(changes);
|
@@ -1093,10 +1241,10 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1093
1241
|
if (isBlockedSource(source)) {
|
1094
1242
|
return;
|
1095
1243
|
}
|
1096
|
-
var
|
1244
|
+
var descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1097
1245
|
var changes = this.engine.batch(function () {
|
1098
|
-
|
1099
|
-
_this19.engine.removeColumns(_this19.sheetId, [
|
1246
|
+
descendingHfColumns.forEach(function (hfColumn) {
|
1247
|
+
_this19.engine.removeColumns(_this19.sheetId, [hfColumn, 1]);
|
1100
1248
|
});
|
1101
1249
|
});
|
1102
1250
|
this.renderDependentSheets(changes);
|
@@ -1221,13 +1369,11 @@ var Formulas = /*#__PURE__*/function (_BasePlugin) {
|
|
1221
1369
|
get: function get() {
|
1222
1370
|
return PLUGIN_PRIORITY;
|
1223
1371
|
}
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
* @type {boolean}
|
1230
|
-
*/
|
1372
|
+
}, {
|
1373
|
+
key: "SETTING_KEYS",
|
1374
|
+
get: function get() {
|
1375
|
+
return [PLUGIN_KEY].concat(SETTING_KEYS);
|
1376
|
+
}
|
1231
1377
|
}]);
|
1232
1378
|
return Formulas;
|
1233
1379
|
}(_base.BasePlugin);
|