handsontable 0.0.0-next-7026906-20231107 → 0.0.0-next-7b93b7d-20231107
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/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +25 -25
- package/core.mjs +25 -25
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7244 -6347
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +7243 -6346
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +97 -102
- package/plugins/autofill/autofill.mjs +96 -101
- package/plugins/base/base.js +57 -22
- package/plugins/base/base.mjs +56 -22
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +105 -98
- package/plugins/columnSorting/columnSorting.mjs +104 -97
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +91 -101
- package/plugins/contextMenu/contextMenu.mjs +90 -100
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +49 -48
- package/plugins/customBorders/customBorders.mjs +48 -47
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +132 -129
- package/plugins/dropdownMenu/dropdownMenu.mjs +132 -129
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +67 -54
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +13 -10
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +13 -10
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +326 -278
- package/plugins/nestedRows/nestedRows.mjs +325 -277
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +3 -3
- package/selection/selection.mjs +3 -3
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
require("core-js/modules/es.error.cause.js");
|
4
3
|
exports.__esModule = true;
|
5
4
|
require("core-js/modules/es.json.stringify.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
6
6
|
require("core-js/modules/es.array.push.js");
|
7
7
|
var _base = require("../base");
|
8
8
|
var _staticRegister = _interopRequireDefault(require("../../utils/staticRegister"));
|
@@ -17,6 +17,7 @@ var _string = require("../../helpers/string");
|
|
17
17
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
18
18
|
var _indexSyncer = _interopRequireDefault(require("./indexSyncer"));
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
20
21
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
22
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
22
23
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
@@ -27,6 +28,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
|
|
27
28
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
28
29
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
29
30
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
31
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
30
32
|
const PLUGIN_KEY = 'formulas';
|
31
33
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
32
34
|
const SETTING_KEYS = ['maxRows', 'maxColumns', 'language'];
|
@@ -59,11 +61,238 @@ const isBlockedSource = source => source === 'UndoRedo.undo' || source === 'Undo
|
|
59
61
|
var _internalOperationPending = /*#__PURE__*/new WeakMap();
|
60
62
|
var _hotWasInitializedWithEmptyData = /*#__PURE__*/new WeakMap();
|
61
63
|
var _engineListeners = /*#__PURE__*/new WeakMap();
|
64
|
+
var _onBeforeValidate = /*#__PURE__*/new WeakSet();
|
65
|
+
var _onBeforeAutofill = /*#__PURE__*/new WeakSet();
|
66
|
+
var _onBeforeLoadData = /*#__PURE__*/new WeakSet();
|
67
|
+
var _onAfterCellMetaReset = /*#__PURE__*/new WeakSet();
|
68
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
69
|
+
var _onModifyData = /*#__PURE__*/new WeakSet();
|
70
|
+
var _onModifySourceData = /*#__PURE__*/new WeakSet();
|
71
|
+
var _onAfterSetDataAtCell = /*#__PURE__*/new WeakSet();
|
72
|
+
var _onAfterSetSourceDataAtCell = /*#__PURE__*/new WeakSet();
|
73
|
+
var _onBeforeCreateRow = /*#__PURE__*/new WeakSet();
|
74
|
+
var _onBeforeCreateCol = /*#__PURE__*/new WeakSet();
|
75
|
+
var _onBeforeRemoveRow = /*#__PURE__*/new WeakSet();
|
76
|
+
var _onBeforeRemoveCol = /*#__PURE__*/new WeakSet();
|
77
|
+
var _onAfterCreateRow = /*#__PURE__*/new WeakSet();
|
78
|
+
var _onAfterCreateCol = /*#__PURE__*/new WeakSet();
|
79
|
+
var _onAfterRemoveRow = /*#__PURE__*/new WeakSet();
|
80
|
+
var _onAfterRemoveCol = /*#__PURE__*/new WeakSet();
|
81
|
+
var _onAfterDetachChild = /*#__PURE__*/new WeakSet();
|
82
|
+
var _onEngineValuesUpdated = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onEngineNamedExpressionsAdded = /*#__PURE__*/new WeakSet();
|
84
|
+
var _onEngineNamedExpressionsRemoved = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onEngineSheetAdded = /*#__PURE__*/new WeakSet();
|
86
|
+
var _onEngineSheetRenamed = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onEngineSheetRemoved = /*#__PURE__*/new WeakSet();
|
62
88
|
class Formulas extends _base.BasePlugin {
|
63
89
|
constructor() {
|
64
90
|
var _this;
|
65
91
|
super(...arguments);
|
66
92
|
_this = this;
|
93
|
+
/**
|
94
|
+
* Called when a sheet is removed from the engine instance.
|
95
|
+
*
|
96
|
+
* @fires Hooks#afterSheetRemoved
|
97
|
+
* @param {string} removedSheetDisplayName The removed sheet name.
|
98
|
+
* @param {Array} changes The values and location of applied changes.
|
99
|
+
*/
|
100
|
+
_classPrivateMethodInitSpec(this, _onEngineSheetRemoved);
|
101
|
+
/**
|
102
|
+
* Called when a sheet in the engine instance is renamed.
|
103
|
+
*
|
104
|
+
* @fires Hooks#afterSheetRenamed
|
105
|
+
* @param {string} oldDisplayName The old name of the sheet.
|
106
|
+
* @param {string} newDisplayName The new name of the sheet.
|
107
|
+
*/
|
108
|
+
_classPrivateMethodInitSpec(this, _onEngineSheetRenamed);
|
109
|
+
/**
|
110
|
+
* Called when a new sheet is added to the engine instance.
|
111
|
+
*
|
112
|
+
* @fires Hooks#afterSheetAdded
|
113
|
+
* @param {string} addedSheetDisplayName The name of the added sheet.
|
114
|
+
*/
|
115
|
+
_classPrivateMethodInitSpec(this, _onEngineSheetAdded);
|
116
|
+
/**
|
117
|
+
* Called when a named expression is removed from the engine instance.
|
118
|
+
*
|
119
|
+
* @fires Hooks#afterNamedExpressionRemoved
|
120
|
+
* @param {string} namedExpressionName The name of the removed expression.
|
121
|
+
* @param {Array} changes The values and location of applied changes.
|
122
|
+
*/
|
123
|
+
_classPrivateMethodInitSpec(this, _onEngineNamedExpressionsRemoved);
|
124
|
+
/**
|
125
|
+
* Called when a named expression is added to the engine instance.
|
126
|
+
*
|
127
|
+
* @fires Hooks#afterNamedExpressionAdded
|
128
|
+
* @param {string} namedExpressionName The name of the added expression.
|
129
|
+
* @param {Array} changes The values and location of applied changes.
|
130
|
+
*/
|
131
|
+
_classPrivateMethodInitSpec(this, _onEngineNamedExpressionsAdded);
|
132
|
+
/**
|
133
|
+
* Called when a value is updated in the engine.
|
134
|
+
*
|
135
|
+
* @fires Hooks#afterFormulasValuesUpdate
|
136
|
+
* @param {Array} changes The values and location of applied changes.
|
137
|
+
*/
|
138
|
+
_classPrivateMethodInitSpec(this, _onEngineValuesUpdated);
|
139
|
+
/**
|
140
|
+
* `afterDetachChild` hook callback.
|
141
|
+
* Used to sync the data of the rows detached in the Nested Rows plugin with the engine's dataset.
|
142
|
+
*
|
143
|
+
* @param {object} parent An object representing the parent from which the element was detached.
|
144
|
+
* @param {object} element The detached element.
|
145
|
+
* @param {number} finalElementRowIndex The final row index of the detached element.
|
146
|
+
*/
|
147
|
+
_classPrivateMethodInitSpec(this, _onAfterDetachChild);
|
148
|
+
/**
|
149
|
+
* `afterRemoveCol` hook callback.
|
150
|
+
*
|
151
|
+
* @param {number} col Visual index of starter column.
|
152
|
+
* @param {number} amount An amount of removed columns.
|
153
|
+
* @param {number[]} physicalColumns An array of physical columns removed from the data source.
|
154
|
+
* @param {string} [source] String that identifies source of hook call
|
155
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
156
|
+
*/
|
157
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveCol);
|
158
|
+
/**
|
159
|
+
* `afterRemoveRow` hook callback.
|
160
|
+
*
|
161
|
+
* @param {number} row Visual index of starter row.
|
162
|
+
* @param {number} amount An amount of removed rows.
|
163
|
+
* @param {number[]} physicalRows An array of physical rows removed from the data source.
|
164
|
+
* @param {string} [source] String that identifies source of hook call
|
165
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
166
|
+
*/
|
167
|
+
_classPrivateMethodInitSpec(this, _onAfterRemoveRow);
|
168
|
+
/**
|
169
|
+
* `afterCreateCol` hook callback.
|
170
|
+
*
|
171
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
172
|
+
* @param {number} amount Number of newly created columns in the data source.
|
173
|
+
* @param {string} [source] String that identifies source of hook call
|
174
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
175
|
+
*/
|
176
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateCol);
|
177
|
+
/**
|
178
|
+
* `afterCreateRow` hook callback.
|
179
|
+
*
|
180
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
181
|
+
* @param {number} amount Number of newly created rows in the data source array.
|
182
|
+
* @param {string} [source] String that identifies source of hook call
|
183
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
184
|
+
*/
|
185
|
+
_classPrivateMethodInitSpec(this, _onAfterCreateRow);
|
186
|
+
/**
|
187
|
+
* `beforeRemoveCol` hook callback.
|
188
|
+
*
|
189
|
+
* @param {number} col Visual index of starter column.
|
190
|
+
* @param {number} amount Amount of columns to be removed.
|
191
|
+
* @param {number[]} physicalColumns An array of physical columns removed from the data source.
|
192
|
+
* @returns {*|boolean} If false is returned the action is canceled.
|
193
|
+
*/
|
194
|
+
_classPrivateMethodInitSpec(this, _onBeforeRemoveCol);
|
195
|
+
/**
|
196
|
+
* `beforeRemoveRow` hook callback.
|
197
|
+
*
|
198
|
+
* @param {number} row Visual index of starter row.
|
199
|
+
* @param {number} amount Amount of rows to be removed.
|
200
|
+
* @param {number[]} physicalRows An array of physical rows removed from the data source.
|
201
|
+
* @returns {*|boolean} If false is returned the action is canceled.
|
202
|
+
*/
|
203
|
+
_classPrivateMethodInitSpec(this, _onBeforeRemoveRow);
|
204
|
+
/**
|
205
|
+
* `beforeCreateCol` hook callback.
|
206
|
+
*
|
207
|
+
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
208
|
+
* @param {number} amount Number of newly created columns in the data source.
|
209
|
+
* @returns {*|boolean} If false is returned the action is canceled.
|
210
|
+
*/
|
211
|
+
_classPrivateMethodInitSpec(this, _onBeforeCreateCol);
|
212
|
+
/**
|
213
|
+
* `beforeCreateRow` hook callback.
|
214
|
+
*
|
215
|
+
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
216
|
+
* @param {number} amount Number of newly created rows in the data source array.
|
217
|
+
* @returns {*|boolean} If false is returned the action is canceled.
|
218
|
+
*/
|
219
|
+
_classPrivateMethodInitSpec(this, _onBeforeCreateRow);
|
220
|
+
/**
|
221
|
+
* `onAfterSetSourceDataAtCell` hook callback.
|
222
|
+
*
|
223
|
+
* @param {Array[]} changes An array of changes in format [[row, column, oldValue, value], ...].
|
224
|
+
* @param {string} [source] String that identifies source of hook call
|
225
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
226
|
+
*/
|
227
|
+
_classPrivateMethodInitSpec(this, _onAfterSetSourceDataAtCell);
|
228
|
+
/**
|
229
|
+
* `onAfterSetDataAtCell` hook callback.
|
230
|
+
*
|
231
|
+
* @param {Array[]} changes An array of changes in format [[row, prop, oldValue, value], ...].
|
232
|
+
* @param {string} [source] String that identifies source of hook call
|
233
|
+
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
234
|
+
*/
|
235
|
+
_classPrivateMethodInitSpec(this, _onAfterSetDataAtCell);
|
236
|
+
/**
|
237
|
+
* `modifySourceData` hook callback.
|
238
|
+
*
|
239
|
+
* @param {number} row Physical row index.
|
240
|
+
* @param {number|string} columnOrProp Physical column index or prop.
|
241
|
+
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
242
|
+
* property.
|
243
|
+
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
244
|
+
*/
|
245
|
+
_classPrivateMethodInitSpec(this, _onModifySourceData);
|
246
|
+
/**
|
247
|
+
* `modifyData` hook callback.
|
248
|
+
*
|
249
|
+
* @param {number} physicalRow Physical row index.
|
250
|
+
* @param {number} visualColumn Visual column index.
|
251
|
+
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
252
|
+
* property.
|
253
|
+
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
254
|
+
*/
|
255
|
+
_classPrivateMethodInitSpec(this, _onModifyData);
|
256
|
+
/**
|
257
|
+
* `afterLoadData` hook callback.
|
258
|
+
*
|
259
|
+
* @param {Array} sourceData Array of arrays or array of objects containing data.
|
260
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
261
|
+
* @param {string} [source] Source of the call.
|
262
|
+
*/
|
263
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
264
|
+
/**
|
265
|
+
* Callback to `afterCellMetaReset` hook which is triggered after setting cell meta.
|
266
|
+
*/
|
267
|
+
_classPrivateMethodInitSpec(this, _onAfterCellMetaReset);
|
268
|
+
/**
|
269
|
+
* `beforeLoadData` hook callback.
|
270
|
+
*
|
271
|
+
* @param {Array} sourceData Array of arrays or array of objects containing data.
|
272
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
273
|
+
* @param {string} [source] Source of the call.
|
274
|
+
*/
|
275
|
+
_classPrivateMethodInitSpec(this, _onBeforeLoadData);
|
276
|
+
/**
|
277
|
+
* `onBeforeAutofill` hook callback.
|
278
|
+
*
|
279
|
+
* @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used
|
280
|
+
* and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`.
|
281
|
+
* @param {CellRange} sourceRange The range values will be filled from.
|
282
|
+
* @param {CellRange} targetRange The range new values will be filled into.
|
283
|
+
* @returns {boolean|*}
|
284
|
+
*/
|
285
|
+
_classPrivateMethodInitSpec(this, _onBeforeAutofill);
|
286
|
+
/**
|
287
|
+
* The hook allows to translate the formula value to calculated value before it goes to the
|
288
|
+
* validator function.
|
289
|
+
*
|
290
|
+
* @param {*} value The cell value to validate.
|
291
|
+
* @param {number} visualRow The visual row index.
|
292
|
+
* @param {number|string} prop The visual column index or property name of the column.
|
293
|
+
* @returns {*} Returns value to validate.
|
294
|
+
*/
|
295
|
+
_classPrivateMethodInitSpec(this, _onBeforeValidate);
|
67
296
|
/**
|
68
297
|
* Flag used to bypass hooks in internal operations.
|
69
298
|
*
|
@@ -92,17 +321,35 @@ class Formulas extends _base.BasePlugin {
|
|
92
321
|
_classPrivateFieldInitSpec(this, _engineListeners, {
|
93
322
|
writable: true,
|
94
323
|
value: [['valuesUpdated', function () {
|
95
|
-
|
324
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
325
|
+
args[_key] = arguments[_key];
|
326
|
+
}
|
327
|
+
return _classPrivateMethodGet(_this, _onEngineValuesUpdated, _onEngineValuesUpdated2).call(_this, ...args);
|
96
328
|
}], ['namedExpressionAdded', function () {
|
97
|
-
|
329
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
330
|
+
args[_key2] = arguments[_key2];
|
331
|
+
}
|
332
|
+
return _classPrivateMethodGet(_this, _onEngineNamedExpressionsAdded, _onEngineNamedExpressionsAdded2).call(_this, ...args);
|
98
333
|
}], ['namedExpressionRemoved', function () {
|
99
|
-
|
334
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
335
|
+
args[_key3] = arguments[_key3];
|
336
|
+
}
|
337
|
+
return _classPrivateMethodGet(_this, _onEngineNamedExpressionsRemoved, _onEngineNamedExpressionsRemoved2).call(_this, ...args);
|
100
338
|
}], ['sheetAdded', function () {
|
101
|
-
|
339
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
340
|
+
args[_key4] = arguments[_key4];
|
341
|
+
}
|
342
|
+
return _classPrivateMethodGet(_this, _onEngineSheetAdded, _onEngineSheetAdded2).call(_this, ...args);
|
102
343
|
}], ['sheetRenamed', function () {
|
103
|
-
|
344
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
345
|
+
args[_key5] = arguments[_key5];
|
346
|
+
}
|
347
|
+
return _classPrivateMethodGet(_this, _onEngineSheetRenamed, _onEngineSheetRenamed2).call(_this, ...args);
|
104
348
|
}], ['sheetRemoved', function () {
|
105
|
-
|
349
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
350
|
+
args[_key6] = arguments[_key6];
|
351
|
+
}
|
352
|
+
return _classPrivateMethodGet(_this, _onEngineSheetRemoved, _onEngineSheetRemoved2).call(_this, ...args);
|
106
353
|
}]]
|
107
354
|
});
|
108
355
|
/**
|
@@ -196,60 +443,114 @@ class Formulas extends _base.BasePlugin {
|
|
196
443
|
}
|
197
444
|
}
|
198
445
|
this.addHook('beforeLoadData', function () {
|
199
|
-
|
446
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
447
|
+
args[_key7] = arguments[_key7];
|
448
|
+
}
|
449
|
+
return _classPrivateMethodGet(_this2, _onBeforeLoadData, _onBeforeLoadData2).call(_this2, ...args);
|
200
450
|
});
|
201
451
|
this.addHook('afterLoadData', function () {
|
202
|
-
|
452
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
453
|
+
args[_key8] = arguments[_key8];
|
454
|
+
}
|
455
|
+
return _classPrivateMethodGet(_this2, _onAfterLoadData, _onAfterLoadData2).call(_this2, ...args);
|
203
456
|
});
|
204
457
|
|
205
458
|
// The `updateData` hooks utilize the same logic as the `loadData` hooks.
|
206
459
|
this.addHook('beforeUpdateData', function () {
|
207
|
-
|
460
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
461
|
+
args[_key9] = arguments[_key9];
|
462
|
+
}
|
463
|
+
return _classPrivateMethodGet(_this2, _onBeforeLoadData, _onBeforeLoadData2).call(_this2, ...args);
|
208
464
|
});
|
209
465
|
this.addHook('afterUpdateData', function () {
|
210
|
-
|
466
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
467
|
+
args[_key10] = arguments[_key10];
|
468
|
+
}
|
469
|
+
return _classPrivateMethodGet(_this2, _onAfterLoadData, _onAfterLoadData2).call(_this2, ...args);
|
211
470
|
});
|
212
471
|
this.addHook('modifyData', function () {
|
213
|
-
|
472
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
473
|
+
args[_key11] = arguments[_key11];
|
474
|
+
}
|
475
|
+
return _classPrivateMethodGet(_this2, _onModifyData, _onModifyData2).call(_this2, ...args);
|
214
476
|
});
|
215
477
|
this.addHook('modifySourceData', function () {
|
216
|
-
|
478
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
479
|
+
args[_key12] = arguments[_key12];
|
480
|
+
}
|
481
|
+
return _classPrivateMethodGet(_this2, _onModifySourceData, _onModifySourceData2).call(_this2, ...args);
|
217
482
|
});
|
218
483
|
this.addHook('beforeValidate', function () {
|
219
|
-
|
484
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
485
|
+
args[_key13] = arguments[_key13];
|
486
|
+
}
|
487
|
+
return _classPrivateMethodGet(_this2, _onBeforeValidate, _onBeforeValidate2).call(_this2, ...args);
|
220
488
|
});
|
221
489
|
this.addHook('afterSetSourceDataAtCell', function () {
|
222
|
-
|
490
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
491
|
+
args[_key14] = arguments[_key14];
|
492
|
+
}
|
493
|
+
return _classPrivateMethodGet(_this2, _onAfterSetSourceDataAtCell, _onAfterSetSourceDataAtCell2).call(_this2, ...args);
|
223
494
|
});
|
224
495
|
this.addHook('afterSetDataAtCell', function () {
|
225
|
-
|
496
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
497
|
+
args[_key15] = arguments[_key15];
|
498
|
+
}
|
499
|
+
return _classPrivateMethodGet(_this2, _onAfterSetDataAtCell, _onAfterSetDataAtCell2).call(_this2, ...args);
|
226
500
|
});
|
227
501
|
this.addHook('afterSetDataAtRowProp', function () {
|
228
|
-
|
502
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
503
|
+
args[_key16] = arguments[_key16];
|
504
|
+
}
|
505
|
+
return _classPrivateMethodGet(_this2, _onAfterSetDataAtCell, _onAfterSetDataAtCell2).call(_this2, ...args);
|
229
506
|
});
|
230
507
|
this.addHook('beforeCreateRow', function () {
|
231
|
-
|
508
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
509
|
+
args[_key17] = arguments[_key17];
|
510
|
+
}
|
511
|
+
return _classPrivateMethodGet(_this2, _onBeforeCreateRow, _onBeforeCreateRow2).call(_this2, ...args);
|
232
512
|
});
|
233
513
|
this.addHook('beforeCreateCol', function () {
|
234
|
-
|
514
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
515
|
+
args[_key18] = arguments[_key18];
|
516
|
+
}
|
517
|
+
return _classPrivateMethodGet(_this2, _onBeforeCreateCol, _onBeforeCreateCol2).call(_this2, ...args);
|
235
518
|
});
|
236
519
|
this.addHook('afterCreateRow', function () {
|
237
|
-
|
520
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
521
|
+
args[_key19] = arguments[_key19];
|
522
|
+
}
|
523
|
+
return _classPrivateMethodGet(_this2, _onAfterCreateRow, _onAfterCreateRow2).call(_this2, ...args);
|
238
524
|
});
|
239
525
|
this.addHook('afterCreateCol', function () {
|
240
|
-
|
526
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
527
|
+
args[_key20] = arguments[_key20];
|
528
|
+
}
|
529
|
+
return _classPrivateMethodGet(_this2, _onAfterCreateCol, _onAfterCreateCol2).call(_this2, ...args);
|
241
530
|
});
|
242
531
|
this.addHook('beforeRemoveRow', function () {
|
243
|
-
|
532
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
533
|
+
args[_key21] = arguments[_key21];
|
534
|
+
}
|
535
|
+
return _classPrivateMethodGet(_this2, _onBeforeRemoveRow, _onBeforeRemoveRow2).call(_this2, ...args);
|
244
536
|
});
|
245
537
|
this.addHook('beforeRemoveCol', function () {
|
246
|
-
|
538
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
539
|
+
args[_key22] = arguments[_key22];
|
540
|
+
}
|
541
|
+
return _classPrivateMethodGet(_this2, _onBeforeRemoveCol, _onBeforeRemoveCol2).call(_this2, ...args);
|
247
542
|
});
|
248
543
|
this.addHook('afterRemoveRow', function () {
|
249
|
-
|
544
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
545
|
+
args[_key23] = arguments[_key23];
|
546
|
+
}
|
547
|
+
return _classPrivateMethodGet(_this2, _onAfterRemoveRow, _onAfterRemoveRow2).call(_this2, ...args);
|
250
548
|
});
|
251
549
|
this.addHook('afterRemoveCol', function () {
|
252
|
-
|
550
|
+
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
551
|
+
args[_key24] = arguments[_key24];
|
552
|
+
}
|
553
|
+
return _classPrivateMethodGet(_this2, _onAfterRemoveCol, _onAfterRemoveCol2).call(_this2, ...args);
|
253
554
|
});
|
254
555
|
this.indexSyncer = new _indexSyncer.default(this.hot.rowIndexMapper, this.hot.columnIndexMapper, postponedAction => {
|
255
556
|
this.hot.addHookOnce('init', () => {
|
@@ -291,7 +592,10 @@ class Formulas extends _base.BasePlugin {
|
|
291
592
|
// hook, because some hooks, such as `afterLoadData` doesn't have information about composed cell properties.
|
292
593
|
// Another hooks are triggered to late for setting HF's engine data needed for some actions.
|
293
594
|
this.addHook('afterCellMetaReset', function () {
|
294
|
-
|
595
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
596
|
+
args[_key25] = arguments[_key25];
|
597
|
+
}
|
598
|
+
return _classPrivateMethodGet(_this2, _onAfterCellMetaReset, _onAfterCellMetaReset2).call(_this2, ...args);
|
295
599
|
});
|
296
600
|
|
297
601
|
// Handling undo actions on data just using HyperFormula's UndoRedo mechanism
|
@@ -312,10 +616,16 @@ class Formulas extends _base.BasePlugin {
|
|
312
616
|
this.indexSyncer.setPerformRedo(false);
|
313
617
|
});
|
314
618
|
this.addHook('afterDetachChild', function () {
|
315
|
-
|
619
|
+
for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {
|
620
|
+
args[_key26] = arguments[_key26];
|
621
|
+
}
|
622
|
+
return _classPrivateMethodGet(_this2, _onAfterDetachChild, _onAfterDetachChild2).call(_this2, ...args);
|
316
623
|
});
|
317
624
|
this.addHook('beforeAutofill', function () {
|
318
|
-
|
625
|
+
for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {
|
626
|
+
args[_key27] = arguments[_key27];
|
627
|
+
}
|
628
|
+
return _classPrivateMethodGet(_this2, _onBeforeAutofill, _onBeforeAutofill2).call(_this2, ...args);
|
319
629
|
});
|
320
630
|
_classPrivateFieldGet(this, _engineListeners).forEach(_ref => {
|
321
631
|
let [eventName, listener] = _ref;
|
@@ -360,7 +670,7 @@ class Formulas extends _base.BasePlugin {
|
|
360
670
|
if (sheetName && this.engine.doesSheetExist(sheetName)) {
|
361
671
|
this.switchSheet(this.sheetName);
|
362
672
|
} else {
|
363
|
-
this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName :
|
673
|
+
this.sheetName = this.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined, this.hot.getSourceDataArray());
|
364
674
|
}
|
365
675
|
}
|
366
676
|
super.updatePlugin(newSettings);
|
@@ -396,12 +706,12 @@ class Formulas extends _base.BasePlugin {
|
|
396
706
|
(0, _console.warn)('The provided data should be an array of arrays.');
|
397
707
|
return false;
|
398
708
|
}
|
399
|
-
if (sheetName !==
|
709
|
+
if (sheetName !== undefined && sheetName !== null && this.engine.doesSheetExist(sheetName)) {
|
400
710
|
(0, _console.warn)('Sheet with the provided name already exists.');
|
401
711
|
return false;
|
402
712
|
}
|
403
713
|
try {
|
404
|
-
const actualSheetName = this.engine.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName :
|
714
|
+
const actualSheetName = this.engine.addSheet(sheetName !== null && sheetName !== void 0 ? sheetName : undefined);
|
405
715
|
if (sheetData) {
|
406
716
|
this.engine.setSheetContent(this.engine.getSheetId(actualSheetName), sheetData);
|
407
717
|
}
|
@@ -486,7 +796,7 @@ class Formulas extends _base.BasePlugin {
|
|
486
796
|
var _change$address;
|
487
797
|
// For the Named expression the address is empty, hence the `sheetId` is undefined.
|
488
798
|
const sheetId = change === null || change === void 0 || (_change$address = change.address) === null || _change$address === void 0 ? void 0 : _change$address.sheet;
|
489
|
-
if (sheetId !==
|
799
|
+
if (sheetId !== undefined) {
|
490
800
|
if (!affectedSheetIds.has(sheetId)) {
|
491
801
|
affectedSheetIds.add(sheetId);
|
492
802
|
}
|
@@ -538,7 +848,7 @@ class Formulas extends _base.BasePlugin {
|
|
538
848
|
|
539
849
|
// Validate the cells that depend on the calculated formulas. Skip that cells
|
540
850
|
// where the user directly changes the values - the Core triggers those validators.
|
541
|
-
if (sheetId !==
|
851
|
+
if (sheetId !== undefined && !changedCellsSet.has(addressId)) {
|
542
852
|
const boundHot = (0, _register.getRegisteredHotInstances)(this.engine).get(sheetId);
|
543
853
|
|
544
854
|
// if `sheetId` is not bound to any Handsontable instance, skip the validation process
|
@@ -583,630 +893,402 @@ class Formulas extends _base.BasePlugin {
|
|
583
893
|
}
|
584
894
|
return this.engine.setCellContents(address, newValue);
|
585
895
|
}
|
896
|
+
}
|
897
|
+
exports.Formulas = Formulas;
|
898
|
+
function _onBeforeValidate2(value, visualRow, prop) {
|
899
|
+
const visualColumn = this.hot.propToCol(prop);
|
900
|
+
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
901
|
+
const address = {
|
902
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
903
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
904
|
+
sheet: this.sheetId
|
905
|
+
};
|
906
|
+
const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
907
|
+
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
586
908
|
|
587
|
-
|
588
|
-
|
589
|
-
* validator function.
|
590
|
-
*
|
591
|
-
* @private
|
592
|
-
* @param {*} value The cell value to validate.
|
593
|
-
* @param {number} visualRow The visual row index.
|
594
|
-
* @param {number|string} prop The visual column index or property name of the column.
|
595
|
-
* @returns {*} Returns value to validate.
|
596
|
-
*/
|
597
|
-
onBeforeValidate(value, visualRow, prop) {
|
598
|
-
const visualColumn = this.hot.propToCol(prop);
|
599
|
-
if (this.isFormulaCellType(visualRow, visualColumn)) {
|
600
|
-
const address = {
|
601
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
602
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
603
|
-
sheet: this.sheetId
|
604
|
-
};
|
605
|
-
const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
606
|
-
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel-like date).
|
607
|
-
|
608
|
-
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
609
|
-
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
610
|
-
}
|
611
|
-
|
612
|
-
// If `cellValue` is an object it is expected to be an error
|
613
|
-
return typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
909
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
910
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
614
911
|
}
|
615
|
-
return value;
|
616
|
-
}
|
617
|
-
|
618
|
-
/**
|
619
|
-
* `onBeforeAutofill` hook callback.
|
620
|
-
*
|
621
|
-
* @private
|
622
|
-
* @param {Array[]} fillData The data that was used to fill the `targetRange`. If `beforeAutofill` was used
|
623
|
-
* and returned `[[]]`, this will be the same object that was returned from `beforeAutofill`.
|
624
|
-
* @param {CellRange} sourceRange The range values will be filled from.
|
625
|
-
* @param {CellRange} targetRange The range new values will be filled into.
|
626
|
-
* @returns {boolean|*}
|
627
|
-
*/
|
628
|
-
onBeforeAutofill(fillData, sourceRange, targetRange) {
|
629
|
-
const {
|
630
|
-
row: sourceTopStartRow,
|
631
|
-
col: sourceTopStartColumn
|
632
|
-
} = sourceRange.getTopStartCorner();
|
633
|
-
const {
|
634
|
-
row: sourceBottomEndRow,
|
635
|
-
col: sourceBottomEndColumn
|
636
|
-
} = sourceRange.getBottomEndCorner();
|
637
|
-
const {
|
638
|
-
row: targetTopStartRow,
|
639
|
-
col: targetTopStartColumn
|
640
|
-
} = targetRange.getTopStartCorner();
|
641
|
-
const {
|
642
|
-
row: targetBottomEndRow,
|
643
|
-
col: targetBottomEndColumn
|
644
|
-
} = targetRange.getBottomEndCorner();
|
645
|
-
const engineSourceRange = {
|
646
|
-
start: {
|
647
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
|
648
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
649
|
-
sheet: this.sheetId
|
650
|
-
},
|
651
|
-
end: {
|
652
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
653
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
654
|
-
sheet: this.sheetId
|
655
|
-
}
|
656
|
-
};
|
657
|
-
const engineTargetRange = {
|
658
|
-
start: {
|
659
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
|
660
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
661
|
-
sheet: this.sheetId
|
662
|
-
},
|
663
|
-
end: {
|
664
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
665
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
666
|
-
sheet: this.sheetId
|
667
|
-
}
|
668
|
-
};
|
669
912
|
|
670
|
-
//
|
671
|
-
|
672
|
-
|
673
|
-
|
913
|
+
// If `cellValue` is an object it is expected to be an error
|
914
|
+
return typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
915
|
+
}
|
916
|
+
return value;
|
917
|
+
}
|
918
|
+
function _onBeforeAutofill2(fillData, sourceRange, targetRange) {
|
919
|
+
const {
|
920
|
+
row: sourceTopStartRow,
|
921
|
+
col: sourceTopStartColumn
|
922
|
+
} = sourceRange.getTopStartCorner();
|
923
|
+
const {
|
924
|
+
row: sourceBottomEndRow,
|
925
|
+
col: sourceBottomEndColumn
|
926
|
+
} = sourceRange.getBottomEndCorner();
|
927
|
+
const {
|
928
|
+
row: targetTopStartRow,
|
929
|
+
col: targetTopStartColumn
|
930
|
+
} = targetRange.getTopStartCorner();
|
931
|
+
const {
|
932
|
+
row: targetBottomEndRow,
|
933
|
+
col: targetBottomEndColumn
|
934
|
+
} = targetRange.getBottomEndCorner();
|
935
|
+
const engineSourceRange = {
|
936
|
+
start: {
|
937
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartRow),
|
938
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceTopStartColumn),
|
939
|
+
sheet: this.sheetId
|
940
|
+
},
|
941
|
+
end: {
|
942
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndRow),
|
943
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(sourceBottomEndColumn),
|
944
|
+
sheet: this.sheetId
|
674
945
|
}
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
946
|
+
};
|
947
|
+
const engineTargetRange = {
|
948
|
+
start: {
|
949
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetTopStartRow),
|
950
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetTopStartColumn),
|
951
|
+
sheet: this.sheetId
|
952
|
+
},
|
953
|
+
end: {
|
954
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndRow),
|
955
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(targetBottomEndColumn),
|
956
|
+
sheet: this.sheetId
|
957
|
+
}
|
958
|
+
};
|
959
|
+
|
960
|
+
// Blocks the autofill operation if HyperFormula says that at least one of
|
961
|
+
// the underlying cell's contents cannot be set.
|
962
|
+
if (this.engine.isItPossibleToSetCellContents(engineTargetRange) === false) {
|
963
|
+
return false;
|
964
|
+
}
|
965
|
+
const fillRangeData = this.engine.getFillRangeData(engineSourceRange, engineTargetRange);
|
966
|
+
const {
|
967
|
+
row: sourceStartRow,
|
968
|
+
col: sourceStartColumn
|
969
|
+
} = engineSourceRange.start;
|
970
|
+
const {
|
971
|
+
row: sourceEndRow,
|
972
|
+
col: sourceEndColumn
|
973
|
+
} = engineSourceRange.end;
|
974
|
+
const populationRowLength = sourceEndRow - sourceStartRow + 1;
|
975
|
+
const populationColumnLength = sourceEndColumn - sourceStartColumn + 1;
|
976
|
+
for (let populatedRowIndex = 0; populatedRowIndex < fillRangeData.length; populatedRowIndex += 1) {
|
977
|
+
for (let populatedColumnIndex = 0; populatedColumnIndex < fillRangeData[populatedRowIndex].length; populatedColumnIndex += 1) {
|
978
|
+
const populatedValue = fillRangeData[populatedRowIndex][populatedColumnIndex];
|
979
|
+
const sourceRow = populatedRowIndex % populationRowLength;
|
980
|
+
const sourceColumn = populatedColumnIndex % populationColumnLength;
|
981
|
+
const sourceCellMeta = this.hot.getCellMeta(sourceRow, sourceColumn);
|
982
|
+
if ((0, _utils.isDate)(populatedValue, sourceCellMeta.type)) {
|
983
|
+
if (populatedValue.startsWith('\'')) {
|
984
|
+
// Populating values on HOT side without apostrophe.
|
985
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = populatedValue.slice(1);
|
986
|
+
} else if (this.isFormulaCellType(sourceRow, sourceColumn, this.sheetId) === false) {
|
987
|
+
// Populating date in proper format, coming from the source cell.
|
988
|
+
fillRangeData[populatedRowIndex][populatedColumnIndex] = (0, _utils.getDateInHotFormat)(populatedValue, sourceCellMeta.dateFormat);
|
700
989
|
}
|
701
990
|
}
|
702
991
|
}
|
703
|
-
return fillRangeData;
|
704
992
|
}
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
* @param {string} [source] Source of the call.
|
712
|
-
* @private
|
713
|
-
*/
|
714
|
-
onBeforeLoadData(sourceData, initialLoad) {
|
715
|
-
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
716
|
-
if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
|
717
|
-
return;
|
718
|
-
}
|
719
|
-
|
720
|
-
// This flag needs to be defined, because not passing data to HOT results in HOT auto-generating a `null`-filled
|
721
|
-
// initial dataset.
|
722
|
-
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
|
993
|
+
return fillRangeData;
|
994
|
+
}
|
995
|
+
function _onBeforeLoadData2(sourceData, initialLoad) {
|
996
|
+
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
997
|
+
if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
|
998
|
+
return;
|
723
999
|
}
|
724
1000
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
|
745
|
-
}
|
1001
|
+
// This flag needs to be defined, because not passing data to HOT results in HOT auto-generating a `null`-filled
|
1002
|
+
// initial dataset.
|
1003
|
+
_classPrivateFieldSet(this, _hotWasInitializedWithEmptyData, (0, _mixed.isUndefined)(this.hot.getSettings().data));
|
1004
|
+
}
|
1005
|
+
function _onAfterCellMetaReset2() {
|
1006
|
+
const sourceDataArray = this.hot.getSourceDataArray();
|
1007
|
+
let valueChanged = false;
|
1008
|
+
sourceDataArray.forEach((rowData, rowIndex) => {
|
1009
|
+
rowData.forEach((cellValue, columnIndex) => {
|
1010
|
+
const cellMeta = this.hot.getCellMeta(rowIndex, columnIndex);
|
1011
|
+
const dateFormat = cellMeta.dateFormat;
|
1012
|
+
if ((0, _utils.isDate)(cellValue, cellMeta.type)) {
|
1013
|
+
valueChanged = true;
|
1014
|
+
if ((0, _utils.isDateValid)(cellValue, dateFormat)) {
|
1015
|
+
// Rewriting date in HOT format to HF format.
|
1016
|
+
sourceDataArray[rowIndex][columnIndex] = (0, _utils.getDateInHfFormat)(cellValue, dateFormat);
|
1017
|
+
} else if (this.isFormulaCellType(rowIndex, columnIndex) === false) {
|
1018
|
+
// Escaping value from date parsing using "'" sign (HF feature).
|
1019
|
+
sourceDataArray[rowIndex][columnIndex] = `'${cellValue}`;
|
746
1020
|
}
|
747
|
-
}
|
1021
|
+
}
|
748
1022
|
});
|
749
|
-
|
1023
|
+
});
|
1024
|
+
if (valueChanged === true) {
|
1025
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1026
|
+
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
1027
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
function _onAfterLoadData2(sourceData, initialLoad) {
|
1031
|
+
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
1032
|
+
if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
|
1033
|
+
return;
|
1034
|
+
}
|
1035
|
+
this.sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
|
1036
|
+
if (!_classPrivateFieldGet(this, _hotWasInitializedWithEmptyData)) {
|
1037
|
+
const sourceDataArray = this.hot.getSourceDataArray();
|
1038
|
+
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
750
1039
|
_classPrivateFieldSet(this, _internalOperationPending, true);
|
751
|
-
this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
1040
|
+
const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
1041
|
+
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
1042
|
+
this.renderDependentSheets(dependentCells);
|
752
1043
|
_classPrivateFieldSet(this, _internalOperationPending, false);
|
753
1044
|
}
|
1045
|
+
} else {
|
1046
|
+
this.switchSheet(this.sheetName);
|
754
1047
|
}
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
* @param {Array} sourceData Array of arrays or array of objects containing data.
|
760
|
-
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
761
|
-
* @param {string} [source] Source of the call.
|
762
|
-
* @private
|
763
|
-
*/
|
764
|
-
onAfterLoadData(sourceData, initialLoad) {
|
765
|
-
let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
766
|
-
if (source.includes((0, _string.toUpperCaseFirst)(PLUGIN_KEY))) {
|
767
|
-
return;
|
768
|
-
}
|
769
|
-
this.sheetName = (0, _register.setupSheet)(this.engine, this.hot.getSettings()[PLUGIN_KEY].sheetName);
|
770
|
-
if (!_classPrivateFieldGet(this, _hotWasInitializedWithEmptyData)) {
|
771
|
-
const sourceDataArray = this.hot.getSourceDataArray();
|
772
|
-
if (this.engine.isItPossibleToReplaceSheetContent(this.sheetId, sourceDataArray)) {
|
773
|
-
_classPrivateFieldSet(this, _internalOperationPending, true);
|
774
|
-
const dependentCells = this.engine.setSheetContent(this.sheetId, sourceDataArray);
|
775
|
-
this.indexSyncer.setupSyncEndpoint(this.engine, this.sheetId);
|
776
|
-
this.renderDependentSheets(dependentCells);
|
777
|
-
_classPrivateFieldSet(this, _internalOperationPending, false);
|
778
|
-
}
|
779
|
-
} else {
|
780
|
-
this.switchSheet(this.sheetName);
|
781
|
-
}
|
1048
|
+
}
|
1049
|
+
function _onModifyData2(physicalRow, visualColumn, valueHolder, ioMode) {
|
1050
|
+
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
1051
|
+
return;
|
782
1052
|
}
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
*
|
787
|
-
* @private
|
788
|
-
* @param {number} physicalRow Physical row index.
|
789
|
-
* @param {number} visualColumn Visual column index.
|
790
|
-
* @param {object} valueHolder Object which contains original value which can be modified by overwriting `.value`
|
791
|
-
* property.
|
792
|
-
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
793
|
-
*/
|
794
|
-
onModifyData(physicalRow, visualColumn, valueHolder, ioMode) {
|
795
|
-
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
796
|
-
return;
|
797
|
-
}
|
798
|
-
const visualRow = this.hot.toVisualRow(physicalRow);
|
799
|
-
if (visualRow === null || visualColumn === null) {
|
800
|
-
return;
|
801
|
-
}
|
802
|
-
|
803
|
-
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
804
|
-
const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
805
|
-
if (!isFormulaCellType) {
|
806
|
-
const cellType = this.getCellType(visualRow, visualColumn);
|
807
|
-
if (cellType !== 'ARRAY') {
|
808
|
-
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
809
|
-
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
810
|
-
}
|
811
|
-
return;
|
812
|
-
}
|
813
|
-
}
|
814
|
-
const address = {
|
815
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
816
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
817
|
-
sheet: this.sheetId
|
818
|
-
};
|
819
|
-
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
820
|
-
const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
821
|
-
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
822
|
-
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
823
|
-
}
|
824
|
-
|
825
|
-
// If `cellValue` is an object it is expected to be an error
|
826
|
-
const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
827
|
-
valueHolder.value = value;
|
1053
|
+
const visualRow = this.hot.toVisualRow(physicalRow);
|
1054
|
+
if (visualRow === null || visualColumn === null) {
|
1055
|
+
return;
|
828
1056
|
}
|
829
1057
|
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
* property.
|
838
|
-
* @param {string} ioMode String which indicates for what operation hook is fired (`get` or `set`).
|
839
|
-
*/
|
840
|
-
onModifySourceData(row, columnOrProp, valueHolder, ioMode) {
|
841
|
-
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
842
|
-
return;
|
843
|
-
}
|
844
|
-
const visualRow = this.hot.toVisualRow(row);
|
845
|
-
const visualColumn = this.hot.propToCol(columnOrProp);
|
846
|
-
if (visualRow === null || visualColumn === null) {
|
847
|
-
return;
|
848
|
-
}
|
849
|
-
|
850
|
-
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
851
|
-
const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
852
|
-
if (!isFormulaCellType) {
|
853
|
-
const cellType = this.getCellType(visualRow, visualColumn);
|
854
|
-
if (cellType !== 'ARRAY') {
|
855
|
-
return;
|
1058
|
+
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
1059
|
+
const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
1060
|
+
if (!isFormulaCellType) {
|
1061
|
+
const cellType = this.getCellType(visualRow, visualColumn);
|
1062
|
+
if (cellType !== 'ARRAY') {
|
1063
|
+
if ((0, _utils.isEscapedFormulaExpression)(valueHolder.value)) {
|
1064
|
+
valueHolder.value = (0, _utils.unescapeFormulaExpression)(valueHolder.value);
|
856
1065
|
}
|
857
|
-
}
|
858
|
-
const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
|
859
|
-
|
860
|
-
// Don't actually change the source data if HyperFormula is not
|
861
|
-
// initialized yet. This is done to allow the `afterLoadData` hook to
|
862
|
-
// load the existing source data with `Handsontable#getSourceDataArray`
|
863
|
-
// properly.
|
864
|
-
if (dimensions.width === 0 && dimensions.height === 0) {
|
865
1066
|
return;
|
866
1067
|
}
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
1068
|
+
}
|
1069
|
+
const address = {
|
1070
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1071
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
1072
|
+
sheet: this.sheetId
|
1073
|
+
};
|
1074
|
+
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
1075
|
+
const cellMeta = this.hot.getCellMeta(visualRow, visualColumn);
|
1076
|
+
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
1077
|
+
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
873
1078
|
}
|
874
1079
|
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
const outOfBoundsChanges = [];
|
888
|
-
const changedCells = [];
|
889
|
-
const dependentCells = this.engine.batch(() => {
|
890
|
-
changes.forEach(_ref4 => {
|
891
|
-
let [visualRow, prop,, newValue] = _ref4;
|
892
|
-
const visualColumn = this.hot.propToCol(prop);
|
893
|
-
const physicalRow = this.hot.toPhysicalRow(visualRow);
|
894
|
-
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
895
|
-
const address = {
|
896
|
-
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
897
|
-
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
898
|
-
sheet: this.sheetId
|
899
|
-
};
|
900
|
-
if (physicalRow !== null && physicalColumn !== null) {
|
901
|
-
this.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
902
|
-
} else {
|
903
|
-
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
904
|
-
}
|
905
|
-
changedCells.push({
|
906
|
-
address
|
907
|
-
});
|
908
|
-
});
|
909
|
-
});
|
910
|
-
if (outOfBoundsChanges.length) {
|
911
|
-
// Workaround for rows/columns being created two times (by HOT and the engine).
|
912
|
-
// (unfortunately, this requires an extra re-render)
|
913
|
-
this.hot.addHookOnce('afterChange', () => {
|
914
|
-
const outOfBoundsDependentCells = this.engine.batch(() => {
|
915
|
-
outOfBoundsChanges.forEach(_ref5 => {
|
916
|
-
let [row, column, newValue] = _ref5;
|
917
|
-
this.syncChangeWithEngine(row, column, newValue);
|
918
|
-
});
|
919
|
-
});
|
920
|
-
this.renderDependentSheets(outOfBoundsDependentCells, true);
|
921
|
-
});
|
922
|
-
}
|
923
|
-
this.renderDependentSheets(dependentCells);
|
924
|
-
this.validateDependentCells(dependentCells, changedCells);
|
1080
|
+
// If `cellValue` is an object it is expected to be an error
|
1081
|
+
const value = typeof cellValue === 'object' && cellValue !== null ? cellValue.value : cellValue;
|
1082
|
+
valueHolder.value = value;
|
1083
|
+
}
|
1084
|
+
function _onModifySourceData2(row, columnOrProp, valueHolder, ioMode) {
|
1085
|
+
if (ioMode !== 'get' || _classPrivateFieldGet(this, _internalOperationPending) || this.sheetName === null || !this.engine.doesSheetExist(this.sheetName)) {
|
1086
|
+
return;
|
1087
|
+
}
|
1088
|
+
const visualRow = this.hot.toVisualRow(row);
|
1089
|
+
const visualColumn = this.hot.propToCol(columnOrProp);
|
1090
|
+
if (visualRow === null || visualColumn === null) {
|
1091
|
+
return;
|
925
1092
|
}
|
926
1093
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
* @param {string} [source] String that identifies source of hook call
|
933
|
-
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
934
|
-
*/
|
935
|
-
onAfterSetSourceDataAtCell(changes, source) {
|
936
|
-
if (isBlockedSource(source)) {
|
1094
|
+
// `column` is here as visual index because of inconsistencies related to hook execution in `src/dataMap`.
|
1095
|
+
const isFormulaCellType = this.isFormulaCellType(visualRow, visualColumn);
|
1096
|
+
if (!isFormulaCellType) {
|
1097
|
+
const cellType = this.getCellType(visualRow, visualColumn);
|
1098
|
+
if (cellType !== 'ARRAY') {
|
937
1099
|
return;
|
938
1100
|
}
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
1101
|
+
}
|
1102
|
+
const dimensions = this.engine.getSheetDimensions(this.engine.getSheetId(this.sheetName));
|
1103
|
+
|
1104
|
+
// Don't actually change the source data if HyperFormula is not
|
1105
|
+
// initialized yet. This is done to allow the `afterLoadData` hook to
|
1106
|
+
// load the existing source data with `Handsontable#getSourceDataArray`
|
1107
|
+
// properly.
|
1108
|
+
if (dimensions.width === 0 && dimensions.height === 0) {
|
1109
|
+
return;
|
1110
|
+
}
|
1111
|
+
const address = {
|
1112
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1113
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
1114
|
+
sheet: this.sheetId
|
1115
|
+
};
|
1116
|
+
valueHolder.value = this.engine.getCellSerialized(address);
|
1117
|
+
}
|
1118
|
+
function _onAfterSetDataAtCell2(changes, source) {
|
1119
|
+
if (isBlockedSource(source)) {
|
1120
|
+
return;
|
1121
|
+
}
|
1122
|
+
const outOfBoundsChanges = [];
|
1123
|
+
const changedCells = [];
|
1124
|
+
const dependentCells = this.engine.batch(() => {
|
1125
|
+
changes.forEach(_ref4 => {
|
1126
|
+
let [visualRow, prop,, newValue] = _ref4;
|
943
1127
|
const visualColumn = this.hot.propToCol(prop);
|
944
|
-
|
945
|
-
|
946
|
-
}
|
1128
|
+
const physicalRow = this.hot.toPhysicalRow(visualRow);
|
1129
|
+
const physicalColumn = this.hot.toPhysicalColumn(visualColumn);
|
947
1130
|
const address = {
|
948
1131
|
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
949
1132
|
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
950
1133
|
sheet: this.sheetId
|
951
1134
|
};
|
952
|
-
if (
|
953
|
-
(
|
954
|
-
|
1135
|
+
if (physicalRow !== null && physicalColumn !== null) {
|
1136
|
+
this.syncChangeWithEngine(visualRow, visualColumn, newValue);
|
1137
|
+
} else {
|
1138
|
+
outOfBoundsChanges.push([visualRow, visualColumn, newValue]);
|
955
1139
|
}
|
956
1140
|
changedCells.push({
|
957
1141
|
address
|
958
1142
|
});
|
959
|
-
dependentCells.push(...this.engine.setCellContents(address, newValue));
|
960
1143
|
});
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
onBeforeCreateRow(visualRow, amount) {
|
974
|
-
let hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
975
|
-
if (visualRow >= this.hot.countRows()) {
|
976
|
-
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
977
|
-
}
|
978
|
-
|
979
|
-
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
980
|
-
return false;
|
981
|
-
}
|
982
|
-
}
|
983
|
-
|
984
|
-
/**
|
985
|
-
* `beforeCreateCol` hook callback.
|
986
|
-
*
|
987
|
-
* @private
|
988
|
-
* @param {number} visualColumn Represents the visual index of first newly created column in the data source.
|
989
|
-
* @param {number} amount Number of newly created columns in the data source.
|
990
|
-
* @returns {*|boolean} If false is returned the action is canceled.
|
991
|
-
*/
|
992
|
-
onBeforeCreateCol(visualColumn, amount) {
|
993
|
-
let hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
994
|
-
if (visualColumn >= this.hot.countCols()) {
|
995
|
-
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
996
|
-
}
|
997
|
-
|
998
|
-
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
999
|
-
return false;
|
1000
|
-
}
|
1001
|
-
}
|
1002
|
-
|
1003
|
-
/**
|
1004
|
-
* `beforeRemoveRow` hook callback.
|
1005
|
-
*
|
1006
|
-
* @private
|
1007
|
-
* @param {number} row Visual index of starter row.
|
1008
|
-
* @param {number} amount Amount of rows to be removed.
|
1009
|
-
* @param {number[]} physicalRows An array of physical rows removed from the data source.
|
1010
|
-
* @returns {*|boolean} If false is returned the action is canceled.
|
1011
|
-
*/
|
1012
|
-
onBeforeRemoveRow(row, amount, physicalRows) {
|
1013
|
-
const hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1014
|
-
const possible = hfRows.every(hfRow => {
|
1015
|
-
return this.engine.isItPossibleToRemoveRows(this.sheetId, [hfRow, 1]);
|
1016
|
-
});
|
1017
|
-
return possible === false ? false : void 0;
|
1018
|
-
}
|
1019
|
-
|
1020
|
-
/**
|
1021
|
-
* `beforeRemoveCol` hook callback.
|
1022
|
-
*
|
1023
|
-
* @private
|
1024
|
-
* @param {number} col Visual index of starter column.
|
1025
|
-
* @param {number} amount Amount of columns to be removed.
|
1026
|
-
* @param {number[]} physicalColumns An array of physical columns removed from the data source.
|
1027
|
-
* @returns {*|boolean} If false is returned the action is canceled.
|
1028
|
-
*/
|
1029
|
-
onBeforeRemoveCol(col, amount, physicalColumns) {
|
1030
|
-
const hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1031
|
-
const possible = hfColumns.every(hfColumn => {
|
1032
|
-
return this.engine.isItPossibleToRemoveColumns(this.sheetId, [hfColumn, 1]);
|
1144
|
+
});
|
1145
|
+
if (outOfBoundsChanges.length) {
|
1146
|
+
// Workaround for rows/columns being created two times (by HOT and the engine).
|
1147
|
+
// (unfortunately, this requires an extra re-render)
|
1148
|
+
this.hot.addHookOnce('afterChange', () => {
|
1149
|
+
const outOfBoundsDependentCells = this.engine.batch(() => {
|
1150
|
+
outOfBoundsChanges.forEach(_ref5 => {
|
1151
|
+
let [row, column, newValue] = _ref5;
|
1152
|
+
this.syncChangeWithEngine(row, column, newValue);
|
1153
|
+
});
|
1154
|
+
});
|
1155
|
+
this.renderDependentSheets(outOfBoundsDependentCells, true);
|
1033
1156
|
});
|
1034
|
-
return possible === false ? false : void 0;
|
1035
|
-
}
|
1036
|
-
|
1037
|
-
/**
|
1038
|
-
* `afterCreateRow` hook callback.
|
1039
|
-
*
|
1040
|
-
* @private
|
1041
|
-
* @param {number} visualRow Represents the visual index of first newly created row in the data source array.
|
1042
|
-
* @param {number} amount Number of newly created rows in the data source array.
|
1043
|
-
* @param {string} [source] String that identifies source of hook call
|
1044
|
-
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1045
|
-
*/
|
1046
|
-
onAfterCreateRow(visualRow, amount, source) {
|
1047
|
-
if (isBlockedSource(source)) {
|
1048
|
-
return;
|
1049
|
-
}
|
1050
|
-
const changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1051
|
-
this.renderDependentSheets(changes);
|
1052
1157
|
}
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
* @param {number} amount Number of newly created columns in the data source.
|
1060
|
-
* @param {string} [source] String that identifies source of hook call
|
1061
|
-
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1062
|
-
*/
|
1063
|
-
onAfterCreateCol(visualColumn, amount, source) {
|
1064
|
-
if (isBlockedSource(source)) {
|
1065
|
-
return;
|
1066
|
-
}
|
1067
|
-
const changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1068
|
-
this.renderDependentSheets(changes);
|
1158
|
+
this.renderDependentSheets(dependentCells);
|
1159
|
+
this.validateDependentCells(dependentCells, changedCells);
|
1160
|
+
}
|
1161
|
+
function _onAfterSetSourceDataAtCell2(changes, source) {
|
1162
|
+
if (isBlockedSource(source)) {
|
1163
|
+
return;
|
1069
1164
|
}
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
* @param {number} amount An amount of removed rows.
|
1077
|
-
* @param {number[]} physicalRows An array of physical rows removed from the data source.
|
1078
|
-
* @param {string} [source] String that identifies source of hook call
|
1079
|
-
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1080
|
-
*/
|
1081
|
-
onAfterRemoveRow(row, amount, physicalRows, source) {
|
1082
|
-
if (isBlockedSource(source)) {
|
1165
|
+
const dependentCells = [];
|
1166
|
+
const changedCells = [];
|
1167
|
+
changes.forEach(_ref6 => {
|
1168
|
+
let [visualRow, prop,, newValue] = _ref6;
|
1169
|
+
const visualColumn = this.hot.propToCol(prop);
|
1170
|
+
if (!(0, _number.isNumeric)(visualColumn)) {
|
1083
1171
|
return;
|
1084
1172
|
}
|
1085
|
-
const
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
}
|
1093
|
-
|
1094
|
-
/**
|
1095
|
-
* `afterRemoveCol` hook callback.
|
1096
|
-
*
|
1097
|
-
* @private
|
1098
|
-
* @param {number} col Visual index of starter column.
|
1099
|
-
* @param {number} amount An amount of removed columns.
|
1100
|
-
* @param {number[]} physicalColumns An array of physical columns removed from the data source.
|
1101
|
-
* @param {string} [source] String that identifies source of hook call
|
1102
|
-
* ([list of all available sources]{@link https://handsontable.com/docs/javascript-data-grid/events-and-hooks/#handsontable-hooks}).
|
1103
|
-
*/
|
1104
|
-
onAfterRemoveCol(col, amount, physicalColumns, source) {
|
1105
|
-
if (isBlockedSource(source)) {
|
1173
|
+
const address = {
|
1174
|
+
row: this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow),
|
1175
|
+
col: this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn),
|
1176
|
+
sheet: this.sheetId
|
1177
|
+
};
|
1178
|
+
if (!this.engine.isItPossibleToSetCellContents(address)) {
|
1179
|
+
(0, _console.warn)(`Not possible to set source cell data at ${JSON.stringify(address)}`);
|
1106
1180
|
return;
|
1107
1181
|
}
|
1108
|
-
|
1109
|
-
|
1110
|
-
descendingHfColumns.forEach(hfColumn => {
|
1111
|
-
this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
|
1112
|
-
});
|
1182
|
+
changedCells.push({
|
1183
|
+
address
|
1113
1184
|
});
|
1114
|
-
this.
|
1185
|
+
dependentCells.push(...this.engine.setCellContents(address, newValue));
|
1186
|
+
});
|
1187
|
+
this.renderDependentSheets(dependentCells);
|
1188
|
+
this.validateDependentCells(dependentCells, changedCells);
|
1189
|
+
}
|
1190
|
+
function _onBeforeCreateRow2(visualRow, amount) {
|
1191
|
+
let hfRowIndex = this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow);
|
1192
|
+
if (visualRow >= this.hot.countRows()) {
|
1193
|
+
hfRowIndex = visualRow; // Row beyond the table boundaries.
|
1115
1194
|
}
|
1116
1195
|
|
1117
|
-
|
1118
|
-
|
1119
|
-
* Used to sync the data of the rows detached in the Nested Rows plugin with the engine's dataset.
|
1120
|
-
*
|
1121
|
-
* @private
|
1122
|
-
* @param {object} parent An object representing the parent from which the element was detached.
|
1123
|
-
* @param {object} element The detached element.
|
1124
|
-
* @param {number} finalElementRowIndex The final row index of the detached element.
|
1125
|
-
*/
|
1126
|
-
onAfterDetachChild(parent, element, finalElementRowIndex) {
|
1127
|
-
var _element$__children;
|
1128
|
-
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1129
|
-
const 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());
|
1130
|
-
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1131
|
-
rowsData.forEach((row, relativeRowIndex) => {
|
1132
|
-
row.forEach((value, colIndex) => {
|
1133
|
-
this.engine.setCellContents({
|
1134
|
-
col: colIndex,
|
1135
|
-
row: finalElementRowIndex + relativeRowIndex,
|
1136
|
-
sheet: this.sheetId
|
1137
|
-
}, [[value]]);
|
1138
|
-
});
|
1139
|
-
});
|
1196
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddRows(this.sheetId, [hfRowIndex, amount])) {
|
1197
|
+
return false;
|
1140
1198
|
}
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
* @fires Hooks#afterFormulasValuesUpdate
|
1147
|
-
* @param {Array} changes The values and location of applied changes.
|
1148
|
-
*/
|
1149
|
-
onEngineValuesUpdated(changes) {
|
1150
|
-
this.hot.runHooks('afterFormulasValuesUpdate', changes);
|
1199
|
+
}
|
1200
|
+
function _onBeforeCreateCol2(visualColumn, amount) {
|
1201
|
+
let hfColumnIndex = this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn);
|
1202
|
+
if (visualColumn >= this.hot.countCols()) {
|
1203
|
+
hfColumnIndex = visualColumn; // Column beyond the table boundaries.
|
1151
1204
|
}
|
1152
1205
|
|
1153
|
-
|
1154
|
-
|
1155
|
-
*
|
1156
|
-
* @private
|
1157
|
-
* @fires Hooks#afterNamedExpressionAdded
|
1158
|
-
* @param {string} namedExpressionName The name of the added expression.
|
1159
|
-
* @param {Array} changes The values and location of applied changes.
|
1160
|
-
*/
|
1161
|
-
onEngineNamedExpressionsAdded(namedExpressionName, changes) {
|
1162
|
-
this.hot.runHooks('afterNamedExpressionAdded', namedExpressionName, changes);
|
1206
|
+
if (this.sheetId === null || !this.engine.doesSheetExist(this.sheetName) || !this.engine.isItPossibleToAddColumns(this.sheetId, [hfColumnIndex, amount])) {
|
1207
|
+
return false;
|
1163
1208
|
}
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1209
|
+
}
|
1210
|
+
function _onBeforeRemoveRow2(row, amount, physicalRows) {
|
1211
|
+
const hfRows = this.rowAxisSyncer.setRemovedHfIndexes(physicalRows);
|
1212
|
+
const possible = hfRows.every(hfRow => {
|
1213
|
+
return this.engine.isItPossibleToRemoveRows(this.sheetId, [hfRow, 1]);
|
1214
|
+
});
|
1215
|
+
return possible === false ? false : undefined;
|
1216
|
+
}
|
1217
|
+
function _onBeforeRemoveCol2(col, amount, physicalColumns) {
|
1218
|
+
const hfColumns = this.columnAxisSyncer.setRemovedHfIndexes(physicalColumns);
|
1219
|
+
const possible = hfColumns.every(hfColumn => {
|
1220
|
+
return this.engine.isItPossibleToRemoveColumns(this.sheetId, [hfColumn, 1]);
|
1221
|
+
});
|
1222
|
+
return possible === false ? false : undefined;
|
1223
|
+
}
|
1224
|
+
function _onAfterCreateRow2(visualRow, amount, source) {
|
1225
|
+
if (isBlockedSource(source)) {
|
1226
|
+
return;
|
1175
1227
|
}
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
* @param {string} addedSheetDisplayName The name of the added sheet.
|
1183
|
-
*/
|
1184
|
-
onEngineSheetAdded(addedSheetDisplayName) {
|
1185
|
-
this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
|
1228
|
+
const changes = this.engine.addRows(this.sheetId, [this.rowAxisSyncer.getHfIndexFromVisualIndex(visualRow), amount]);
|
1229
|
+
this.renderDependentSheets(changes);
|
1230
|
+
}
|
1231
|
+
function _onAfterCreateCol2(visualColumn, amount, source) {
|
1232
|
+
if (isBlockedSource(source)) {
|
1233
|
+
return;
|
1186
1234
|
}
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
* @param {string} oldDisplayName The old name of the sheet.
|
1194
|
-
* @param {string} newDisplayName The new name of the sheet.
|
1195
|
-
*/
|
1196
|
-
onEngineSheetRenamed(oldDisplayName, newDisplayName) {
|
1197
|
-
this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
|
1235
|
+
const changes = this.engine.addColumns(this.sheetId, [this.columnAxisSyncer.getHfIndexFromVisualIndex(visualColumn), amount]);
|
1236
|
+
this.renderDependentSheets(changes);
|
1237
|
+
}
|
1238
|
+
function _onAfterRemoveRow2(row, amount, physicalRows, source) {
|
1239
|
+
if (isBlockedSource(source)) {
|
1240
|
+
return;
|
1198
1241
|
}
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1242
|
+
const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1243
|
+
const changes = this.engine.batch(() => {
|
1244
|
+
descendingHfRows.forEach(hfRow => {
|
1245
|
+
this.engine.removeRows(this.sheetId, [hfRow, 1]);
|
1246
|
+
});
|
1247
|
+
});
|
1248
|
+
this.renderDependentSheets(changes);
|
1249
|
+
}
|
1250
|
+
function _onAfterRemoveCol2(col, amount, physicalColumns, source) {
|
1251
|
+
if (isBlockedSource(source)) {
|
1252
|
+
return;
|
1210
1253
|
}
|
1254
|
+
const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
|
1255
|
+
const changes = this.engine.batch(() => {
|
1256
|
+
descendingHfColumns.forEach(hfColumn => {
|
1257
|
+
this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
|
1258
|
+
});
|
1259
|
+
});
|
1260
|
+
this.renderDependentSheets(changes);
|
1261
|
+
}
|
1262
|
+
function _onAfterDetachChild2(parent, element, finalElementRowIndex) {
|
1263
|
+
var _element$__children;
|
1264
|
+
_classPrivateFieldSet(this, _internalOperationPending, true);
|
1265
|
+
const 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());
|
1266
|
+
_classPrivateFieldSet(this, _internalOperationPending, false);
|
1267
|
+
rowsData.forEach((row, relativeRowIndex) => {
|
1268
|
+
row.forEach((value, colIndex) => {
|
1269
|
+
this.engine.setCellContents({
|
1270
|
+
col: colIndex,
|
1271
|
+
row: finalElementRowIndex + relativeRowIndex,
|
1272
|
+
sheet: this.sheetId
|
1273
|
+
}, [[value]]);
|
1274
|
+
});
|
1275
|
+
});
|
1276
|
+
}
|
1277
|
+
function _onEngineValuesUpdated2(changes) {
|
1278
|
+
this.hot.runHooks('afterFormulasValuesUpdate', changes);
|
1279
|
+
}
|
1280
|
+
function _onEngineNamedExpressionsAdded2(namedExpressionName, changes) {
|
1281
|
+
this.hot.runHooks('afterNamedExpressionAdded', namedExpressionName, changes);
|
1282
|
+
}
|
1283
|
+
function _onEngineNamedExpressionsRemoved2(namedExpressionName, changes) {
|
1284
|
+
this.hot.runHooks('afterNamedExpressionRemoved', namedExpressionName, changes);
|
1285
|
+
}
|
1286
|
+
function _onEngineSheetAdded2(addedSheetDisplayName) {
|
1287
|
+
this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
|
1288
|
+
}
|
1289
|
+
function _onEngineSheetRenamed2(oldDisplayName, newDisplayName) {
|
1290
|
+
this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
|
1211
1291
|
}
|
1212
|
-
|
1292
|
+
function _onEngineSheetRemoved2(removedSheetDisplayName, changes) {
|
1293
|
+
this.hot.runHooks('afterSheetRemoved', removedSheetDisplayName, changes);
|
1294
|
+
}
|