handsontable 14.0.0-next-c080457-20231107 → 14.0.0-next-bfad250-20231108
Sign up to get free protection for your applications and to get access to all the features.
- 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/cell/coords.js +7 -5
- package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
- 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 +7337 -6389
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +154 -154
- package/dist/handsontable.js +7336 -6388
- 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.d.ts +0 -1
- package/plugins/autofill/autofill.js +98 -102
- package/plugins/autofill/autofill.mjs +97 -101
- package/plugins/base/base.js +61 -28
- package/plugins/base/base.mjs +60 -28
- 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 +107 -99
- package/plugins/columnSorting/columnSorting.mjs +106 -98
- 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 +96 -102
- package/plugins/contextMenu/contextMenu.mjs +95 -101
- 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/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +57 -50
- package/plugins/customBorders/customBorders.mjs +56 -49
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +136 -131
- package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
- 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 +66 -53
- 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 +15 -11
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
- 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 +335 -279
- package/plugins/nestedRows/nestedRows.mjs +334 -278
- 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 +28 -10
- package/selection/selection.mjs +28 -10
- package/selection/utils.js +24 -14
- package/selection/utils.mjs +25 -15
- package/shortcuts/manager.js +1 -1
- package/shortcuts/manager.mjs +1 -1
- 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,9 +1,15 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
+
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; }
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
7
|
+
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); }
|
8
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
2
9
|
import { BasePlugin } from "../base/index.mjs";
|
3
10
|
import Hooks from "../../pluginHooks.mjs";
|
4
11
|
import { offset, outerHeight, outerWidth } from "../../helpers/dom/element.mjs";
|
5
12
|
import { arrayEach, arrayMap } from "../../helpers/array.mjs";
|
6
|
-
import EventManager from "../../eventManager.mjs";
|
7
13
|
import { getDragDirectionAndRange, DIRECTIONS, getMappedFillHandleSetting } from "./utils.mjs";
|
8
14
|
Hooks.getSingleton().register('modifyAutofillRange');
|
9
15
|
Hooks.getSingleton().register('beforeAutofill');
|
@@ -28,69 +34,92 @@ const INTERVAL_FOR_ADDING_ROW = 200;
|
|
28
34
|
* @class Autofill
|
29
35
|
* @plugin Autofill
|
30
36
|
*/
|
31
|
-
|
37
|
+
var _onCellCornerDblClick = /*#__PURE__*/new WeakSet();
|
38
|
+
var _onAfterCellCornerMouseDown = /*#__PURE__*/new WeakSet();
|
39
|
+
var _onBeforeCellMouseOver = /*#__PURE__*/new WeakSet();
|
40
|
+
var _onMouseUp = /*#__PURE__*/new WeakSet();
|
41
|
+
var _onMouseMove = /*#__PURE__*/new WeakSet();
|
32
42
|
export class Autofill extends BasePlugin {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
constructor() {
|
44
|
+
super(...arguments);
|
45
|
+
/**
|
46
|
+
* On mouse move listener.
|
47
|
+
*
|
48
|
+
* @param {MouseEvent} event `mousemove` event properties.
|
49
|
+
*/
|
50
|
+
_classPrivateMethodInitSpec(this, _onMouseMove);
|
51
|
+
/**
|
52
|
+
* On mouse up listener.
|
53
|
+
*/
|
54
|
+
_classPrivateMethodInitSpec(this, _onMouseUp);
|
44
55
|
/**
|
45
|
-
*
|
56
|
+
* On before cell mouse over listener.
|
57
|
+
*
|
58
|
+
* @param {CellCoords} coords `CellCoords` coord object.
|
59
|
+
*/
|
60
|
+
_classPrivateMethodInitSpec(this, _onBeforeCellMouseOver);
|
61
|
+
/**
|
62
|
+
* On after cell corner mouse down listener.
|
63
|
+
*/
|
64
|
+
_classPrivateMethodInitSpec(this, _onAfterCellCornerMouseDown);
|
65
|
+
/**
|
66
|
+
* On cell corner double click callback.
|
46
67
|
*
|
47
68
|
* @private
|
48
|
-
* @type {EventManager}
|
49
69
|
*/
|
50
|
-
this
|
70
|
+
_classPrivateMethodInitSpec(this, _onCellCornerDblClick);
|
51
71
|
/**
|
52
72
|
* Specifies if adding new row started.
|
53
73
|
*
|
54
74
|
* @private
|
55
75
|
* @type {boolean}
|
56
76
|
*/
|
57
|
-
this
|
77
|
+
_defineProperty(this, "addingStarted", false);
|
58
78
|
/**
|
59
79
|
* Specifies if there was mouse down on the cell corner.
|
60
80
|
*
|
61
81
|
* @private
|
62
82
|
* @type {boolean}
|
63
83
|
*/
|
64
|
-
this
|
84
|
+
_defineProperty(this, "mouseDownOnCellCorner", false);
|
65
85
|
/**
|
66
86
|
* Specifies if mouse was dragged outside Handsontable.
|
67
87
|
*
|
68
88
|
* @private
|
69
89
|
* @type {boolean}
|
70
90
|
*/
|
71
|
-
this
|
91
|
+
_defineProperty(this, "mouseDragOutside", false);
|
72
92
|
/**
|
73
93
|
* Specifies how many cell levels were dragged using the handle.
|
74
94
|
*
|
75
95
|
* @private
|
76
96
|
* @type {boolean}
|
77
97
|
*/
|
78
|
-
this
|
98
|
+
_defineProperty(this, "handleDraggedCells", 0);
|
79
99
|
/**
|
80
100
|
* Specifies allowed directions of drag (`'horizontal'` or '`vertical`').
|
81
101
|
*
|
82
102
|
* @private
|
83
103
|
* @type {string[]}
|
84
104
|
*/
|
85
|
-
this
|
105
|
+
_defineProperty(this, "directions", []);
|
86
106
|
/**
|
87
107
|
* Specifies if can insert new rows if needed.
|
88
108
|
*
|
109
|
+
* @private
|
89
110
|
* @type {boolean}
|
90
111
|
*/
|
91
|
-
this
|
112
|
+
_defineProperty(this, "autoInsertRow", false);
|
113
|
+
}
|
114
|
+
static get PLUGIN_KEY() {
|
115
|
+
return PLUGIN_KEY;
|
116
|
+
}
|
117
|
+
static get PLUGIN_PRIORITY() {
|
118
|
+
return PLUGIN_PRIORITY;
|
119
|
+
}
|
120
|
+
static get SETTING_KEYS() {
|
121
|
+
return [PLUGIN_KEY, ...SETTING_KEYS];
|
92
122
|
}
|
93
|
-
|
94
123
|
/**
|
95
124
|
* Checks if the plugin is enabled in the Handsontable settings.
|
96
125
|
*
|
@@ -109,9 +138,9 @@ export class Autofill extends BasePlugin {
|
|
109
138
|
}
|
110
139
|
this.mapSettings();
|
111
140
|
this.registerEvents();
|
112
|
-
this.addHook('afterOnCellCornerMouseDown', event => this.
|
113
|
-
this.addHook('afterOnCellCornerDblClick', event => this.
|
114
|
-
this.addHook('beforeOnCellMouseOver', (_, coords) => this.
|
141
|
+
this.addHook('afterOnCellCornerMouseDown', event => _classPrivateMethodGet(this, _onAfterCellCornerMouseDown, _onAfterCellCornerMouseDown2).call(this, event));
|
142
|
+
this.addHook('afterOnCellCornerDblClick', event => _classPrivateMethodGet(this, _onCellCornerDblClick, _onCellCornerDblClick2).call(this, event));
|
143
|
+
this.addHook('beforeOnCellMouseOver', (_, coords) => _classPrivateMethodGet(this, _onBeforeCellMouseOver, _onBeforeCellMouseOver2).call(this, coords));
|
115
144
|
super.enablePlugin();
|
116
145
|
}
|
117
146
|
|
@@ -322,7 +351,7 @@ export class Autofill extends BasePlugin {
|
|
322
351
|
*/
|
323
352
|
addRow() {
|
324
353
|
this.hot._registerTimeout(() => {
|
325
|
-
this.hot.alter(INSERT_ROW_ALTER_ACTION_NAME,
|
354
|
+
this.hot.alter(INSERT_ROW_ALTER_ACTION_NAME, undefined, 1, `${this.pluginName}.fill`);
|
326
355
|
this.addingStarted = false;
|
327
356
|
}, INTERVAL_FOR_ADDING_ROW);
|
328
357
|
}
|
@@ -402,7 +431,7 @@ export class Autofill extends BasePlugin {
|
|
402
431
|
selectAdjacent() {
|
403
432
|
const cornersOfSelectedCells = this.hot.getSelectedLast();
|
404
433
|
const lastFilledInRowIndex = this.getIndexOfLastAdjacentFilledInRow(cornersOfSelectedCells);
|
405
|
-
if (lastFilledInRowIndex === -1 || lastFilledInRowIndex ===
|
434
|
+
if (lastFilledInRowIndex === -1 || lastFilledInRowIndex === undefined) {
|
406
435
|
return false;
|
407
436
|
}
|
408
437
|
this.addSelectionFromStartAreaToSpecificRowIndex(cornersOfSelectedCells, lastFilledInRowIndex);
|
@@ -455,80 +484,9 @@ export class Autofill extends BasePlugin {
|
|
455
484
|
const {
|
456
485
|
documentElement
|
457
486
|
} = this.hot.rootDocument;
|
458
|
-
this.eventManager.addEventListener(documentElement, 'mouseup', () => this.
|
459
|
-
this.eventManager.addEventListener(documentElement, 'mousemove', event => this.
|
460
|
-
}
|
461
|
-
|
462
|
-
/**
|
463
|
-
* On cell corner double click callback.
|
464
|
-
*
|
465
|
-
* @private
|
466
|
-
*/
|
467
|
-
onCellCornerDblClick() {
|
468
|
-
const selectionApplied = this.selectAdjacent();
|
469
|
-
if (selectionApplied) {
|
470
|
-
this.fillIn();
|
471
|
-
}
|
487
|
+
this.eventManager.addEventListener(documentElement, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
488
|
+
this.eventManager.addEventListener(documentElement, 'mousemove', event => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, event));
|
472
489
|
}
|
473
|
-
|
474
|
-
/**
|
475
|
-
* On after cell corner mouse down listener.
|
476
|
-
*
|
477
|
-
* @private
|
478
|
-
*/
|
479
|
-
onAfterCellCornerMouseDown() {
|
480
|
-
this.handleDraggedCells = 1;
|
481
|
-
this.mouseDownOnCellCorner = true;
|
482
|
-
}
|
483
|
-
|
484
|
-
/**
|
485
|
-
* On before cell mouse over listener.
|
486
|
-
*
|
487
|
-
* @private
|
488
|
-
* @param {CellCoords} coords `CellCoords` coord object.
|
489
|
-
*/
|
490
|
-
onBeforeCellMouseOver(coords) {
|
491
|
-
if (this.mouseDownOnCellCorner && !this.hot.view.isMouseDown() && this.handleDraggedCells) {
|
492
|
-
this.handleDraggedCells += 1;
|
493
|
-
this.showBorder(coords);
|
494
|
-
this.addNewRowIfNeeded();
|
495
|
-
}
|
496
|
-
}
|
497
|
-
|
498
|
-
/**
|
499
|
-
* On mouse up listener.
|
500
|
-
*
|
501
|
-
* @private
|
502
|
-
*/
|
503
|
-
onMouseUp() {
|
504
|
-
if (this.handleDraggedCells) {
|
505
|
-
if (this.handleDraggedCells > 1) {
|
506
|
-
this.fillIn();
|
507
|
-
}
|
508
|
-
this.handleDraggedCells = 0;
|
509
|
-
this.mouseDownOnCellCorner = false;
|
510
|
-
}
|
511
|
-
}
|
512
|
-
|
513
|
-
/**
|
514
|
-
* On mouse move listener.
|
515
|
-
*
|
516
|
-
* @private
|
517
|
-
* @param {MouseEvent} event `mousemove` event properties.
|
518
|
-
*/
|
519
|
-
onMouseMove(event) {
|
520
|
-
const mouseWasDraggedOutside = this.getIfMouseWasDraggedOutside(event);
|
521
|
-
if (this.addingStarted === false && this.handleDraggedCells > 0 && mouseWasDraggedOutside) {
|
522
|
-
this.mouseDragOutside = true;
|
523
|
-
this.addingStarted = true;
|
524
|
-
} else {
|
525
|
-
this.mouseDragOutside = false;
|
526
|
-
}
|
527
|
-
if (this.mouseDragOutside && this.autoInsertRow) {
|
528
|
-
this.addRow();
|
529
|
-
}
|
530
|
-
}
|
531
|
-
|
532
490
|
/**
|
533
491
|
* Clears mapped settings.
|
534
492
|
*
|
@@ -556,4 +514,42 @@ export class Autofill extends BasePlugin {
|
|
556
514
|
destroy() {
|
557
515
|
super.destroy();
|
558
516
|
}
|
517
|
+
}
|
518
|
+
function _onCellCornerDblClick2() {
|
519
|
+
const selectionApplied = this.selectAdjacent();
|
520
|
+
if (selectionApplied) {
|
521
|
+
this.fillIn();
|
522
|
+
}
|
523
|
+
}
|
524
|
+
function _onAfterCellCornerMouseDown2() {
|
525
|
+
this.handleDraggedCells = 1;
|
526
|
+
this.mouseDownOnCellCorner = true;
|
527
|
+
}
|
528
|
+
function _onBeforeCellMouseOver2(coords) {
|
529
|
+
if (this.mouseDownOnCellCorner && !this.hot.view.isMouseDown() && this.handleDraggedCells) {
|
530
|
+
this.handleDraggedCells += 1;
|
531
|
+
this.showBorder(coords);
|
532
|
+
this.addNewRowIfNeeded();
|
533
|
+
}
|
534
|
+
}
|
535
|
+
function _onMouseUp2() {
|
536
|
+
if (this.handleDraggedCells) {
|
537
|
+
if (this.handleDraggedCells > 1) {
|
538
|
+
this.fillIn();
|
539
|
+
}
|
540
|
+
this.handleDraggedCells = 0;
|
541
|
+
this.mouseDownOnCellCorner = false;
|
542
|
+
}
|
543
|
+
}
|
544
|
+
function _onMouseMove2(event) {
|
545
|
+
const mouseWasDraggedOutside = this.getIfMouseWasDraggedOutside(event);
|
546
|
+
if (this.addingStarted === false && this.handleDraggedCells > 0 && mouseWasDraggedOutside) {
|
547
|
+
this.mouseDragOutside = true;
|
548
|
+
this.addingStarted = true;
|
549
|
+
} else {
|
550
|
+
this.mouseDragOutside = false;
|
551
|
+
}
|
552
|
+
if (this.mouseDragOutside && this.autoInsertRow) {
|
553
|
+
this.addRow();
|
554
|
+
}
|
559
555
|
}
|
package/plugins/base/base.js
CHANGED
@@ -10,19 +10,28 @@ var _registry2 = require("../../cellTypes/registry");
|
|
10
10
|
var _registry3 = require("../../editors/registry");
|
11
11
|
var _registry4 = require("../../renderers/registry");
|
12
12
|
var _registry5 = require("../../validators/registry");
|
13
|
+
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
15
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
16
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
14
17
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
18
|
+
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; }
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
20
|
+
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); }
|
15
21
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
22
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
23
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
24
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
16
25
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', _registry.hasPlugin], ['cell-type', _registry2.hasCellType], ['editor', _registry3.hasEditor], ['renderer', _registry4.hasRenderer], ['validator', _registry5.hasValidator]]);
|
17
26
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'base';
|
18
|
-
const
|
19
|
-
const missingDependeciesMsgs = [];
|
27
|
+
const missingDepsMsgs = [];
|
20
28
|
let initializedPlugins = null;
|
21
29
|
|
22
30
|
/**
|
23
31
|
* @util
|
24
32
|
* @property {Core} hot Handsontable instance.
|
25
33
|
*/
|
34
|
+
var _hooks = /*#__PURE__*/new WeakMap();
|
26
35
|
var _isRelevantToSettings = /*#__PURE__*/new WeakSet();
|
27
36
|
class BasePlugin {
|
28
37
|
static get PLUGIN_KEY() {
|
@@ -42,6 +51,12 @@ class BasePlugin {
|
|
42
51
|
return [this.PLUGIN_KEY];
|
43
52
|
}
|
44
53
|
|
54
|
+
/**
|
55
|
+
* The instance of the {@link EventManager} class.
|
56
|
+
*
|
57
|
+
* @type {EventManager}
|
58
|
+
*/
|
59
|
+
|
45
60
|
/**
|
46
61
|
* @param {object} hotInstance Handsontable instance.
|
47
62
|
*/
|
@@ -56,6 +71,34 @@ class BasePlugin {
|
|
56
71
|
* @returns {boolean}
|
57
72
|
*/
|
58
73
|
_classPrivateMethodInitSpec(this, _isRelevantToSettings);
|
74
|
+
_defineProperty(this, "eventManager", new _eventManager.default(this));
|
75
|
+
/**
|
76
|
+
* @type {string}
|
77
|
+
*/
|
78
|
+
_defineProperty(this, "pluginName", null);
|
79
|
+
/**
|
80
|
+
* @type {Function[]}
|
81
|
+
*/
|
82
|
+
_defineProperty(this, "pluginsInitializedCallbacks", []);
|
83
|
+
/**
|
84
|
+
* @type {boolean}
|
85
|
+
*/
|
86
|
+
_defineProperty(this, "isPluginsReady", false);
|
87
|
+
/**
|
88
|
+
* @type {boolean}
|
89
|
+
*/
|
90
|
+
_defineProperty(this, "enabled", false);
|
91
|
+
/**
|
92
|
+
* @type {boolean}
|
93
|
+
*/
|
94
|
+
_defineProperty(this, "initialized", false);
|
95
|
+
/**
|
96
|
+
* Collection of the reference to the plugins hooks.
|
97
|
+
*/
|
98
|
+
_classPrivateFieldInitSpec(this, _hooks, {
|
99
|
+
writable: true,
|
100
|
+
value: {}
|
101
|
+
});
|
59
102
|
/**
|
60
103
|
* Handsontable instance.
|
61
104
|
*
|
@@ -64,15 +107,7 @@ class BasePlugin {
|
|
64
107
|
(0, _object.defineGetter)(this, 'hot', hotInstance, {
|
65
108
|
writable: false
|
66
109
|
});
|
67
|
-
privatePool.set(this, {
|
68
|
-
hooks: {}
|
69
|
-
});
|
70
110
|
initializedPlugins = null;
|
71
|
-
this.pluginName = null;
|
72
|
-
this.pluginsInitializedCallbacks = [];
|
73
|
-
this.isPluginsReady = false;
|
74
|
-
this.enabled = false;
|
75
|
-
this.initialized = false;
|
76
111
|
this.hot.addHook('afterPluginsInitialized', () => this.onAfterPluginsInitialized());
|
77
112
|
this.hot.addHook('afterUpdateSettings', newSettings => this.onUpdateSettings(newSettings));
|
78
113
|
this.hot.addHook('beforeInit', () => this.init());
|
@@ -80,10 +115,10 @@ class BasePlugin {
|
|
80
115
|
init() {
|
81
116
|
this.pluginName = this.hot.getPluginName(this);
|
82
117
|
const pluginDeps = this.constructor.PLUGIN_DEPS;
|
83
|
-
const
|
84
|
-
if (
|
118
|
+
const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
|
119
|
+
if (deps.length > 0) {
|
85
120
|
const missingDependencies = [];
|
86
|
-
|
121
|
+
deps.forEach(dependency => {
|
87
122
|
const [type, moduleName] = dependency.split(':');
|
88
123
|
if (!DEPS_TYPE_CHECKERS.has(type)) {
|
89
124
|
throw new Error(`Unknown plugin dependency type "${type}" was found.`);
|
@@ -94,7 +129,7 @@ class BasePlugin {
|
|
94
129
|
});
|
95
130
|
if (missingDependencies.length > 0) {
|
96
131
|
const errorMsg = [`The ${this.pluginName} plugin requires the following modules:\n`, `${missingDependencies.join('\n')}\n`].join('');
|
97
|
-
|
132
|
+
missingDepsMsgs.push(errorMsg);
|
98
133
|
}
|
99
134
|
}
|
100
135
|
if (!initializedPlugins) {
|
@@ -117,8 +152,8 @@ class BasePlugin {
|
|
117
152
|
});
|
118
153
|
const isAllPluginsAreInitialized = initializedPlugins.length === 0;
|
119
154
|
if (isAllPluginsAreInitialized) {
|
120
|
-
if (
|
121
|
-
const errorMsg = [`${
|
155
|
+
if (missingDepsMsgs.length > 0) {
|
156
|
+
const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
|
122
157
|
throw new Error(errorMsg);
|
123
158
|
}
|
124
159
|
this.hot.runHooks('afterPluginsInitialized');
|
@@ -137,9 +172,8 @@ class BasePlugin {
|
|
137
172
|
* Disable plugin for this Handsontable instance.
|
138
173
|
*/
|
139
174
|
disablePlugin() {
|
140
|
-
|
141
|
-
|
142
|
-
}
|
175
|
+
var _this$eventManager;
|
176
|
+
(_this$eventManager = this.eventManager) === null || _this$eventManager === void 0 || _this$eventManager.clear();
|
143
177
|
this.clearHooks();
|
144
178
|
this.enabled = false;
|
145
179
|
}
|
@@ -151,11 +185,11 @@ class BasePlugin {
|
|
151
185
|
* @param {Function} callback The listener function to add.
|
152
186
|
*/
|
153
187
|
addHook(name, callback) {
|
154
|
-
|
155
|
-
const hooks =
|
188
|
+
_classPrivateFieldGet(this, _hooks)[name] = _classPrivateFieldGet(this, _hooks)[name] || [];
|
189
|
+
const hooks = _classPrivateFieldGet(this, _hooks)[name];
|
156
190
|
this.hot.addHook(name, callback);
|
157
191
|
hooks.push(callback);
|
158
|
-
|
192
|
+
_classPrivateFieldGet(this, _hooks)[name] = hooks;
|
159
193
|
}
|
160
194
|
|
161
195
|
/**
|
@@ -164,7 +198,7 @@ class BasePlugin {
|
|
164
198
|
* @param {string} name The hook name.
|
165
199
|
*/
|
166
200
|
removeHooks(name) {
|
167
|
-
(0, _array.arrayEach)(
|
201
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _hooks)[name] || [], callback => {
|
168
202
|
this.hot.removeHook(name, callback);
|
169
203
|
});
|
170
204
|
}
|
@@ -173,7 +207,7 @@ class BasePlugin {
|
|
173
207
|
* Clear all hooks.
|
174
208
|
*/
|
175
209
|
clearHooks() {
|
176
|
-
const hooks =
|
210
|
+
const hooks = _classPrivateFieldGet(this, _hooks);
|
177
211
|
(0, _object.objectEach)(hooks, (callbacks, name) => this.removeHooks(name));
|
178
212
|
hooks.length = 0;
|
179
213
|
}
|
@@ -233,9 +267,8 @@ class BasePlugin {
|
|
233
267
|
* Destroy plugin.
|
234
268
|
*/
|
235
269
|
destroy() {
|
236
|
-
|
237
|
-
|
238
|
-
}
|
270
|
+
var _this$eventManager2;
|
271
|
+
(_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
|
239
272
|
this.clearHooks();
|
240
273
|
(0, _object.objectEach)(this, (value, property) => {
|
241
274
|
if (property !== 'hot') {
|
@@ -261,7 +294,7 @@ function _isRelevantToSettings2(settings) {
|
|
261
294
|
return settingKeys;
|
262
295
|
}
|
263
296
|
for (let i = 0; i < settingKeys.length; i++) {
|
264
|
-
if (settings[settingKeys[i]] !==
|
297
|
+
if (settings[settingKeys[i]] !== undefined) {
|
265
298
|
return true;
|
266
299
|
}
|
267
300
|
}
|
package/plugins/base/base.mjs
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
3
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
5
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
6
|
+
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; }
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
8
|
+
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); }
|
5
9
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
10
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
11
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
12
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
6
13
|
import { defineGetter, objectEach } from "../../helpers/object.mjs";
|
7
14
|
import { arrayEach } from "../../helpers/array.mjs";
|
8
15
|
import { getPluginsNames, hasPlugin } from "../registry.mjs";
|
@@ -10,16 +17,17 @@ import { hasCellType } from "../../cellTypes/registry.mjs";
|
|
10
17
|
import { hasEditor } from "../../editors/registry.mjs";
|
11
18
|
import { hasRenderer } from "../../renderers/registry.mjs";
|
12
19
|
import { hasValidator } from "../../validators/registry.mjs";
|
20
|
+
import EventManager from "../../eventManager.mjs";
|
13
21
|
const DEPS_TYPE_CHECKERS = new Map([['plugin', hasPlugin], ['cell-type', hasCellType], ['editor', hasEditor], ['renderer', hasRenderer], ['validator', hasValidator]]);
|
14
22
|
export const PLUGIN_KEY = 'base';
|
15
|
-
const
|
16
|
-
const missingDependeciesMsgs = [];
|
23
|
+
const missingDepsMsgs = [];
|
17
24
|
let initializedPlugins = null;
|
18
25
|
|
19
26
|
/**
|
20
27
|
* @util
|
21
28
|
* @property {Core} hot Handsontable instance.
|
22
29
|
*/
|
30
|
+
var _hooks = /*#__PURE__*/new WeakMap();
|
23
31
|
var _isRelevantToSettings = /*#__PURE__*/new WeakSet();
|
24
32
|
export class BasePlugin {
|
25
33
|
static get PLUGIN_KEY() {
|
@@ -39,6 +47,12 @@ export class BasePlugin {
|
|
39
47
|
return [this.PLUGIN_KEY];
|
40
48
|
}
|
41
49
|
|
50
|
+
/**
|
51
|
+
* The instance of the {@link EventManager} class.
|
52
|
+
*
|
53
|
+
* @type {EventManager}
|
54
|
+
*/
|
55
|
+
|
42
56
|
/**
|
43
57
|
* @param {object} hotInstance Handsontable instance.
|
44
58
|
*/
|
@@ -53,6 +67,34 @@ export class BasePlugin {
|
|
53
67
|
* @returns {boolean}
|
54
68
|
*/
|
55
69
|
_classPrivateMethodInitSpec(this, _isRelevantToSettings);
|
70
|
+
_defineProperty(this, "eventManager", new EventManager(this));
|
71
|
+
/**
|
72
|
+
* @type {string}
|
73
|
+
*/
|
74
|
+
_defineProperty(this, "pluginName", null);
|
75
|
+
/**
|
76
|
+
* @type {Function[]}
|
77
|
+
*/
|
78
|
+
_defineProperty(this, "pluginsInitializedCallbacks", []);
|
79
|
+
/**
|
80
|
+
* @type {boolean}
|
81
|
+
*/
|
82
|
+
_defineProperty(this, "isPluginsReady", false);
|
83
|
+
/**
|
84
|
+
* @type {boolean}
|
85
|
+
*/
|
86
|
+
_defineProperty(this, "enabled", false);
|
87
|
+
/**
|
88
|
+
* @type {boolean}
|
89
|
+
*/
|
90
|
+
_defineProperty(this, "initialized", false);
|
91
|
+
/**
|
92
|
+
* Collection of the reference to the plugins hooks.
|
93
|
+
*/
|
94
|
+
_classPrivateFieldInitSpec(this, _hooks, {
|
95
|
+
writable: true,
|
96
|
+
value: {}
|
97
|
+
});
|
56
98
|
/**
|
57
99
|
* Handsontable instance.
|
58
100
|
*
|
@@ -61,15 +103,7 @@ export class BasePlugin {
|
|
61
103
|
defineGetter(this, 'hot', hotInstance, {
|
62
104
|
writable: false
|
63
105
|
});
|
64
|
-
privatePool.set(this, {
|
65
|
-
hooks: {}
|
66
|
-
});
|
67
106
|
initializedPlugins = null;
|
68
|
-
this.pluginName = null;
|
69
|
-
this.pluginsInitializedCallbacks = [];
|
70
|
-
this.isPluginsReady = false;
|
71
|
-
this.enabled = false;
|
72
|
-
this.initialized = false;
|
73
107
|
this.hot.addHook('afterPluginsInitialized', () => this.onAfterPluginsInitialized());
|
74
108
|
this.hot.addHook('afterUpdateSettings', newSettings => this.onUpdateSettings(newSettings));
|
75
109
|
this.hot.addHook('beforeInit', () => this.init());
|
@@ -77,10 +111,10 @@ export class BasePlugin {
|
|
77
111
|
init() {
|
78
112
|
this.pluginName = this.hot.getPluginName(this);
|
79
113
|
const pluginDeps = this.constructor.PLUGIN_DEPS;
|
80
|
-
const
|
81
|
-
if (
|
114
|
+
const deps = Array.isArray(pluginDeps) ? pluginDeps : [];
|
115
|
+
if (deps.length > 0) {
|
82
116
|
const missingDependencies = [];
|
83
|
-
|
117
|
+
deps.forEach(dependency => {
|
84
118
|
const [type, moduleName] = dependency.split(':');
|
85
119
|
if (!DEPS_TYPE_CHECKERS.has(type)) {
|
86
120
|
throw new Error(`Unknown plugin dependency type "${type}" was found.`);
|
@@ -91,7 +125,7 @@ export class BasePlugin {
|
|
91
125
|
});
|
92
126
|
if (missingDependencies.length > 0) {
|
93
127
|
const errorMsg = [`The ${this.pluginName} plugin requires the following modules:\n`, `${missingDependencies.join('\n')}\n`].join('');
|
94
|
-
|
128
|
+
missingDepsMsgs.push(errorMsg);
|
95
129
|
}
|
96
130
|
}
|
97
131
|
if (!initializedPlugins) {
|
@@ -114,8 +148,8 @@ export class BasePlugin {
|
|
114
148
|
});
|
115
149
|
const isAllPluginsAreInitialized = initializedPlugins.length === 0;
|
116
150
|
if (isAllPluginsAreInitialized) {
|
117
|
-
if (
|
118
|
-
const errorMsg = [`${
|
151
|
+
if (missingDepsMsgs.length > 0) {
|
152
|
+
const errorMsg = [`${missingDepsMsgs.join('\n')}\n`, 'You have to import and register them manually.'].join('');
|
119
153
|
throw new Error(errorMsg);
|
120
154
|
}
|
121
155
|
this.hot.runHooks('afterPluginsInitialized');
|
@@ -134,9 +168,8 @@ export class BasePlugin {
|
|
134
168
|
* Disable plugin for this Handsontable instance.
|
135
169
|
*/
|
136
170
|
disablePlugin() {
|
137
|
-
|
138
|
-
|
139
|
-
}
|
171
|
+
var _this$eventManager;
|
172
|
+
(_this$eventManager = this.eventManager) === null || _this$eventManager === void 0 || _this$eventManager.clear();
|
140
173
|
this.clearHooks();
|
141
174
|
this.enabled = false;
|
142
175
|
}
|
@@ -148,11 +181,11 @@ export class BasePlugin {
|
|
148
181
|
* @param {Function} callback The listener function to add.
|
149
182
|
*/
|
150
183
|
addHook(name, callback) {
|
151
|
-
|
152
|
-
const hooks =
|
184
|
+
_classPrivateFieldGet(this, _hooks)[name] = _classPrivateFieldGet(this, _hooks)[name] || [];
|
185
|
+
const hooks = _classPrivateFieldGet(this, _hooks)[name];
|
153
186
|
this.hot.addHook(name, callback);
|
154
187
|
hooks.push(callback);
|
155
|
-
|
188
|
+
_classPrivateFieldGet(this, _hooks)[name] = hooks;
|
156
189
|
}
|
157
190
|
|
158
191
|
/**
|
@@ -161,7 +194,7 @@ export class BasePlugin {
|
|
161
194
|
* @param {string} name The hook name.
|
162
195
|
*/
|
163
196
|
removeHooks(name) {
|
164
|
-
arrayEach(
|
197
|
+
arrayEach(_classPrivateFieldGet(this, _hooks)[name] || [], callback => {
|
165
198
|
this.hot.removeHook(name, callback);
|
166
199
|
});
|
167
200
|
}
|
@@ -170,7 +203,7 @@ export class BasePlugin {
|
|
170
203
|
* Clear all hooks.
|
171
204
|
*/
|
172
205
|
clearHooks() {
|
173
|
-
const hooks =
|
206
|
+
const hooks = _classPrivateFieldGet(this, _hooks);
|
174
207
|
objectEach(hooks, (callbacks, name) => this.removeHooks(name));
|
175
208
|
hooks.length = 0;
|
176
209
|
}
|
@@ -230,9 +263,8 @@ export class BasePlugin {
|
|
230
263
|
* Destroy plugin.
|
231
264
|
*/
|
232
265
|
destroy() {
|
233
|
-
|
234
|
-
|
235
|
-
}
|
266
|
+
var _this$eventManager2;
|
267
|
+
(_this$eventManager2 = this.eventManager) === null || _this$eventManager2 === void 0 || _this$eventManager2.destroy();
|
236
268
|
this.clearHooks();
|
237
269
|
objectEach(this, (value, property) => {
|
238
270
|
if (property !== 'hot') {
|
@@ -257,7 +289,7 @@ function _isRelevantToSettings2(settings) {
|
|
257
289
|
return settingKeys;
|
258
290
|
}
|
259
291
|
for (let i = 0; i < settingKeys.length; i++) {
|
260
|
-
if (settings[settingKeys[i]] !==
|
292
|
+
if (settings[settingKeys[i]] !== undefined) {
|
261
293
|
return true;
|
262
294
|
}
|
263
295
|
}
|