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
package/editorManager.js
CHANGED
@@ -1,84 +1,111 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
4
5
|
var _unicode = require("./helpers/unicode");
|
5
6
|
var _event = require("./helpers/dom/event");
|
6
7
|
var _registry = require("./editors/registry");
|
7
8
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
8
9
|
var _mixed = require("./helpers/mixed");
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
12
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
13
|
+
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; }
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
15
|
+
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); }
|
16
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
10
17
|
const SHORTCUTS_GROUP_NAVIGATION = exports.SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
18
|
+
var _onAfterDocumentKeyDown = /*#__PURE__*/new WeakSet();
|
19
|
+
var _onCellDblClick = /*#__PURE__*/new WeakSet();
|
11
20
|
class EditorManager {
|
12
21
|
/**
|
13
|
-
* @param {Core}
|
22
|
+
* @param {Core} hotInstance The Handsontable instance.
|
14
23
|
* @param {TableMeta} tableMeta The table meta instance.
|
15
24
|
* @param {Selection} selection The selection instance.
|
16
25
|
*/
|
17
|
-
constructor(
|
26
|
+
constructor(hotInstance, tableMeta, _selection) {
|
27
|
+
/**
|
28
|
+
* OnCellDblClick callback.
|
29
|
+
*
|
30
|
+
* @param {MouseEvent} event The mouse event object.
|
31
|
+
* @param {object} coords The cell coordinates.
|
32
|
+
* @param {HTMLTableCellElement|HTMLTableHeaderCellElement} elem The element which triggers the action.
|
33
|
+
*/
|
34
|
+
_classPrivateMethodInitSpec(this, _onCellDblClick);
|
35
|
+
/**
|
36
|
+
* OnAfterDocumentKeyDown callback.
|
37
|
+
*
|
38
|
+
* @param {KeyboardEvent} event The keyboard event object.
|
39
|
+
*/
|
40
|
+
_classPrivateMethodInitSpec(this, _onAfterDocumentKeyDown);
|
18
41
|
/**
|
19
42
|
* Instance of {@link Handsontable}.
|
20
43
|
*
|
21
44
|
* @private
|
22
45
|
* @type {Handsontable}
|
23
46
|
*/
|
24
|
-
this
|
47
|
+
_defineProperty(this, "hot", void 0);
|
25
48
|
/**
|
26
49
|
* Reference to an instance's private GridSettings object.
|
27
50
|
*
|
28
51
|
* @private
|
29
52
|
* @type {GridSettings}
|
30
53
|
*/
|
31
|
-
this
|
54
|
+
_defineProperty(this, "tableMeta", void 0);
|
32
55
|
/**
|
33
56
|
* Instance of {@link Selection}.
|
34
57
|
*
|
35
58
|
* @private
|
36
59
|
* @type {Selection}
|
37
60
|
*/
|
38
|
-
this
|
61
|
+
_defineProperty(this, "selection", void 0);
|
39
62
|
/**
|
40
63
|
* Instance of {@link EventManager}.
|
41
64
|
*
|
42
65
|
* @private
|
43
66
|
* @type {EventManager}
|
44
67
|
*/
|
45
|
-
this
|
68
|
+
_defineProperty(this, "eventManager", void 0);
|
46
69
|
/**
|
47
70
|
* Determines if EditorManager is destroyed.
|
48
71
|
*
|
49
72
|
* @private
|
50
73
|
* @type {boolean}
|
51
74
|
*/
|
52
|
-
this
|
75
|
+
_defineProperty(this, "destroyed", false);
|
53
76
|
/**
|
54
77
|
* Determines if EditorManager is locked.
|
55
78
|
*
|
56
79
|
* @private
|
57
80
|
* @type {boolean}
|
58
81
|
*/
|
59
|
-
this
|
82
|
+
_defineProperty(this, "lock", false);
|
60
83
|
/**
|
61
84
|
* A reference to an instance of the activeEditor.
|
62
85
|
*
|
63
86
|
* @private
|
64
87
|
* @type {BaseEditor}
|
65
88
|
*/
|
66
|
-
this
|
89
|
+
_defineProperty(this, "activeEditor", void 0);
|
67
90
|
/**
|
68
91
|
* Keeps a reference to the cell's properties object.
|
69
92
|
*
|
70
93
|
* @type {object}
|
71
94
|
*/
|
72
|
-
this
|
73
|
-
this.
|
95
|
+
_defineProperty(this, "cellProperties", void 0);
|
96
|
+
this.hot = hotInstance;
|
97
|
+
this.tableMeta = tableMeta;
|
98
|
+
this.selection = _selection;
|
99
|
+
this.eventManager = new _eventManager.default(hotInstance);
|
100
|
+
this.hot.addHook('afterDocumentKeyDown', event => _classPrivateMethodGet(this, _onAfterDocumentKeyDown, _onAfterDocumentKeyDown2).call(this, event));
|
74
101
|
|
75
102
|
// Open editor when text composition is started (IME editor)
|
76
|
-
this.eventManager.addEventListener(this.
|
77
|
-
if (!this.destroyed && this.
|
103
|
+
this.eventManager.addEventListener(this.hot.rootDocument.documentElement, 'compositionstart', event => {
|
104
|
+
if (!this.destroyed && this.hot.isListening()) {
|
78
105
|
this.openEditor('', event);
|
79
106
|
}
|
80
107
|
});
|
81
|
-
this.
|
108
|
+
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _classPrivateMethodGet(this, _onCellDblClick, _onCellDblClick2).call(this, event, coords, elem));
|
82
109
|
}
|
83
110
|
|
84
111
|
/**
|
@@ -135,7 +162,7 @@ class EditorManager {
|
|
135
162
|
}
|
136
163
|
const {
|
137
164
|
highlight
|
138
|
-
} = this.
|
165
|
+
} = this.hot.getSelectedRangeLast();
|
139
166
|
if (highlight.isHeader()) {
|
140
167
|
return;
|
141
168
|
}
|
@@ -143,7 +170,7 @@ class EditorManager {
|
|
143
170
|
row,
|
144
171
|
col
|
145
172
|
} = highlight;
|
146
|
-
const modifiedCellCoords = this.
|
173
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
|
147
174
|
let visualRowToCheck = row;
|
148
175
|
let visualColumnToCheck = col;
|
149
176
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -151,20 +178,20 @@ class EditorManager {
|
|
151
178
|
}
|
152
179
|
|
153
180
|
// Getting values using the modified coordinates.
|
154
|
-
this.cellProperties = this.
|
181
|
+
this.cellProperties = this.hot.getCellMeta(visualRowToCheck, visualColumnToCheck);
|
155
182
|
if (!this.isCellEditable()) {
|
156
183
|
this.clearActiveEditor();
|
157
184
|
return;
|
158
185
|
}
|
159
|
-
const td = this.
|
186
|
+
const td = this.hot.getCell(row, col, true);
|
160
187
|
|
161
188
|
// Skip the preparation when the cell is not rendered in the DOM. The cell is scrolled out of
|
162
189
|
// the table's viewport.
|
163
190
|
if (td) {
|
164
|
-
const editorClass = this.
|
165
|
-
const prop = this.
|
166
|
-
const originalValue = this.
|
167
|
-
this.activeEditor = (0, _registry.getEditorInstance)(editorClass, this.
|
191
|
+
const editorClass = this.hot.getCellEditor(this.cellProperties);
|
192
|
+
const prop = this.hot.colToProp(visualColumnToCheck);
|
193
|
+
const originalValue = this.hot.getSourceDataAtCell(this.hot.toPhysicalRow(visualRowToCheck), visualColumnToCheck);
|
194
|
+
this.activeEditor = (0, _registry.getEditorInstance)(editorClass, this.hot);
|
168
195
|
// Using not modified coordinates, as we need to get the table element using selection coordinates.
|
169
196
|
// There is an extra translation in the editor for saving value.
|
170
197
|
this.activeEditor.prepare(row, col, prop, td, originalValue, this.cellProperties);
|
@@ -195,7 +222,7 @@ class EditorManager {
|
|
195
222
|
return;
|
196
223
|
}
|
197
224
|
if (!this.activeEditor) {
|
198
|
-
this.
|
225
|
+
this.hot.scrollToFocusedCell();
|
199
226
|
this.prepareEditor();
|
200
227
|
}
|
201
228
|
if (this.activeEditor) {
|
@@ -245,7 +272,7 @@ class EditorManager {
|
|
245
272
|
* @private
|
246
273
|
*/
|
247
274
|
clearActiveEditor() {
|
248
|
-
this.activeEditor =
|
275
|
+
this.activeEditor = undefined;
|
249
276
|
}
|
250
277
|
|
251
278
|
/**
|
@@ -259,11 +286,11 @@ class EditorManager {
|
|
259
286
|
* @returns {boolean}
|
260
287
|
*/
|
261
288
|
isCellEditable() {
|
262
|
-
const selection = this.
|
289
|
+
const selection = this.hot.getSelectedRangeLast();
|
263
290
|
if (!selection) {
|
264
291
|
return false;
|
265
292
|
}
|
266
|
-
const editorClass = this.
|
293
|
+
const editorClass = this.hot.getCellEditor(this.cellProperties);
|
267
294
|
const {
|
268
295
|
row,
|
269
296
|
col
|
@@ -271,8 +298,8 @@ class EditorManager {
|
|
271
298
|
const {
|
272
299
|
rowIndexMapper,
|
273
300
|
columnIndexMapper
|
274
|
-
} = this.
|
275
|
-
const isCellHidden = rowIndexMapper.isHidden(this.
|
301
|
+
} = this.hot;
|
302
|
+
const isCellHidden = rowIndexMapper.isHidden(this.hot.toPhysicalRow(row)) || columnIndexMapper.isHidden(this.hot.toPhysicalColumn(col));
|
276
303
|
if (this.cellProperties.readOnly || !editorClass || isCellHidden) {
|
277
304
|
return false;
|
278
305
|
}
|
@@ -295,73 +322,6 @@ class EditorManager {
|
|
295
322
|
this.selection.transformStart(enterMoves.row, enterMoves.col, true);
|
296
323
|
}
|
297
324
|
}
|
298
|
-
|
299
|
-
/**
|
300
|
-
* OnAfterDocumentKeyDown callback.
|
301
|
-
*
|
302
|
-
* @private
|
303
|
-
* @param {KeyboardEvent} event The keyboard event object.
|
304
|
-
*/
|
305
|
-
onAfterDocumentKeyDown(event) {
|
306
|
-
const selection = this.instance.getSelectedRangeLast();
|
307
|
-
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
|
308
|
-
return;
|
309
|
-
}
|
310
|
-
const {
|
311
|
-
keyCode
|
312
|
-
} = event;
|
313
|
-
|
314
|
-
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
315
|
-
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
316
|
-
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
317
|
-
if (!(0, _unicode.isFunctionKey)(keyCode) && !(0, _unicode.isCtrlMetaKey)(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
318
|
-
const shortcutManager = this.instance.getShortcutManager();
|
319
|
-
const editorContext = shortcutManager.getContext('editor');
|
320
|
-
const runOnlySelectedConfig = {
|
321
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.instance.getSelected()),
|
322
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
323
|
-
};
|
324
|
-
editorContext.addShortcuts([{
|
325
|
-
keys: [['ArrowUp']],
|
326
|
-
callback: () => {
|
327
|
-
this.instance.selection.transformStart(-1, 0);
|
328
|
-
}
|
329
|
-
}, {
|
330
|
-
keys: [['ArrowDown']],
|
331
|
-
callback: () => {
|
332
|
-
this.instance.selection.transformStart(1, 0);
|
333
|
-
}
|
334
|
-
}, {
|
335
|
-
keys: [['ArrowLeft']],
|
336
|
-
callback: () => {
|
337
|
-
this.instance.selection.transformStart(0, -1 * this.instance.getDirectionFactor());
|
338
|
-
}
|
339
|
-
}, {
|
340
|
-
keys: [['ArrowRight']],
|
341
|
-
callback: () => {
|
342
|
-
this.instance.selection.transformStart(0, this.instance.getDirectionFactor());
|
343
|
-
}
|
344
|
-
}], runOnlySelectedConfig);
|
345
|
-
this.openEditor('', event);
|
346
|
-
}
|
347
|
-
}
|
348
|
-
}
|
349
|
-
|
350
|
-
/**
|
351
|
-
* OnCellDblClick callback.
|
352
|
-
*
|
353
|
-
* @private
|
354
|
-
* @param {MouseEvent} event The mouse event object.
|
355
|
-
* @param {object} coords The cell coordinates.
|
356
|
-
* @param {HTMLTableCellElement|HTMLTableHeaderCellElement} elem The element which triggers the action.
|
357
|
-
*/
|
358
|
-
onCellDblClick(event, coords, elem) {
|
359
|
-
// may be TD or TH
|
360
|
-
if (elem.nodeName === 'TD') {
|
361
|
-
this.openEditor(null, event, true);
|
362
|
-
}
|
363
|
-
}
|
364
|
-
|
365
325
|
/**
|
366
326
|
* Destroy the instance.
|
367
327
|
*/
|
@@ -370,6 +330,56 @@ class EditorManager {
|
|
370
330
|
this.eventManager.destroy();
|
371
331
|
}
|
372
332
|
}
|
333
|
+
function _onAfterDocumentKeyDown2(event) {
|
334
|
+
const selection = this.hot.getSelectedRangeLast();
|
335
|
+
if (!this.hot.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
|
336
|
+
return;
|
337
|
+
}
|
338
|
+
const {
|
339
|
+
keyCode
|
340
|
+
} = event;
|
341
|
+
|
342
|
+
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
343
|
+
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
344
|
+
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
345
|
+
if (!(0, _unicode.isFunctionKey)(keyCode) && !(0, _unicode.isCtrlMetaKey)(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
346
|
+
const shortcutManager = this.hot.getShortcutManager();
|
347
|
+
const editorContext = shortcutManager.getContext('editor');
|
348
|
+
const runOnlySelectedConfig = {
|
349
|
+
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
350
|
+
group: SHORTCUTS_GROUP_NAVIGATION
|
351
|
+
};
|
352
|
+
editorContext.addShortcuts([{
|
353
|
+
keys: [['ArrowUp']],
|
354
|
+
callback: () => {
|
355
|
+
this.hot.selection.transformStart(-1, 0);
|
356
|
+
}
|
357
|
+
}, {
|
358
|
+
keys: [['ArrowDown']],
|
359
|
+
callback: () => {
|
360
|
+
this.hot.selection.transformStart(1, 0);
|
361
|
+
}
|
362
|
+
}, {
|
363
|
+
keys: [['ArrowLeft']],
|
364
|
+
callback: () => {
|
365
|
+
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
366
|
+
}
|
367
|
+
}, {
|
368
|
+
keys: [['ArrowRight']],
|
369
|
+
callback: () => {
|
370
|
+
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
371
|
+
}
|
372
|
+
}], runOnlySelectedConfig);
|
373
|
+
this.openEditor('', event);
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
function _onCellDblClick2(event, coords, elem) {
|
378
|
+
// may be TD or TH
|
379
|
+
if (elem.nodeName === 'TD') {
|
380
|
+
this.openEditor(null, event, true);
|
381
|
+
}
|
382
|
+
}
|
373
383
|
const instances = new WeakMap();
|
374
384
|
|
375
385
|
/**
|
package/editorManager.mjs
CHANGED
@@ -1,80 +1,107 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
4
|
+
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; }
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
6
|
+
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); }
|
7
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
1
8
|
import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
2
9
|
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
3
10
|
import { getEditorInstance } from "./editors/registry.mjs";
|
4
11
|
import EventManager from "./eventManager.mjs";
|
5
12
|
import { isDefined } from "./helpers/mixed.mjs";
|
6
13
|
export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
14
|
+
var _onAfterDocumentKeyDown = /*#__PURE__*/new WeakSet();
|
15
|
+
var _onCellDblClick = /*#__PURE__*/new WeakSet();
|
7
16
|
class EditorManager {
|
8
17
|
/**
|
9
|
-
* @param {Core}
|
18
|
+
* @param {Core} hotInstance The Handsontable instance.
|
10
19
|
* @param {TableMeta} tableMeta The table meta instance.
|
11
20
|
* @param {Selection} selection The selection instance.
|
12
21
|
*/
|
13
|
-
constructor(
|
22
|
+
constructor(hotInstance, tableMeta, _selection) {
|
23
|
+
/**
|
24
|
+
* OnCellDblClick callback.
|
25
|
+
*
|
26
|
+
* @param {MouseEvent} event The mouse event object.
|
27
|
+
* @param {object} coords The cell coordinates.
|
28
|
+
* @param {HTMLTableCellElement|HTMLTableHeaderCellElement} elem The element which triggers the action.
|
29
|
+
*/
|
30
|
+
_classPrivateMethodInitSpec(this, _onCellDblClick);
|
31
|
+
/**
|
32
|
+
* OnAfterDocumentKeyDown callback.
|
33
|
+
*
|
34
|
+
* @param {KeyboardEvent} event The keyboard event object.
|
35
|
+
*/
|
36
|
+
_classPrivateMethodInitSpec(this, _onAfterDocumentKeyDown);
|
14
37
|
/**
|
15
38
|
* Instance of {@link Handsontable}.
|
16
39
|
*
|
17
40
|
* @private
|
18
41
|
* @type {Handsontable}
|
19
42
|
*/
|
20
|
-
this
|
43
|
+
_defineProperty(this, "hot", void 0);
|
21
44
|
/**
|
22
45
|
* Reference to an instance's private GridSettings object.
|
23
46
|
*
|
24
47
|
* @private
|
25
48
|
* @type {GridSettings}
|
26
49
|
*/
|
27
|
-
this
|
50
|
+
_defineProperty(this, "tableMeta", void 0);
|
28
51
|
/**
|
29
52
|
* Instance of {@link Selection}.
|
30
53
|
*
|
31
54
|
* @private
|
32
55
|
* @type {Selection}
|
33
56
|
*/
|
34
|
-
this
|
57
|
+
_defineProperty(this, "selection", void 0);
|
35
58
|
/**
|
36
59
|
* Instance of {@link EventManager}.
|
37
60
|
*
|
38
61
|
* @private
|
39
62
|
* @type {EventManager}
|
40
63
|
*/
|
41
|
-
this
|
64
|
+
_defineProperty(this, "eventManager", void 0);
|
42
65
|
/**
|
43
66
|
* Determines if EditorManager is destroyed.
|
44
67
|
*
|
45
68
|
* @private
|
46
69
|
* @type {boolean}
|
47
70
|
*/
|
48
|
-
this
|
71
|
+
_defineProperty(this, "destroyed", false);
|
49
72
|
/**
|
50
73
|
* Determines if EditorManager is locked.
|
51
74
|
*
|
52
75
|
* @private
|
53
76
|
* @type {boolean}
|
54
77
|
*/
|
55
|
-
this
|
78
|
+
_defineProperty(this, "lock", false);
|
56
79
|
/**
|
57
80
|
* A reference to an instance of the activeEditor.
|
58
81
|
*
|
59
82
|
* @private
|
60
83
|
* @type {BaseEditor}
|
61
84
|
*/
|
62
|
-
this
|
85
|
+
_defineProperty(this, "activeEditor", void 0);
|
63
86
|
/**
|
64
87
|
* Keeps a reference to the cell's properties object.
|
65
88
|
*
|
66
89
|
* @type {object}
|
67
90
|
*/
|
68
|
-
this
|
69
|
-
this.
|
91
|
+
_defineProperty(this, "cellProperties", void 0);
|
92
|
+
this.hot = hotInstance;
|
93
|
+
this.tableMeta = tableMeta;
|
94
|
+
this.selection = _selection;
|
95
|
+
this.eventManager = new EventManager(hotInstance);
|
96
|
+
this.hot.addHook('afterDocumentKeyDown', event => _classPrivateMethodGet(this, _onAfterDocumentKeyDown, _onAfterDocumentKeyDown2).call(this, event));
|
70
97
|
|
71
98
|
// Open editor when text composition is started (IME editor)
|
72
|
-
this.eventManager.addEventListener(this.
|
73
|
-
if (!this.destroyed && this.
|
99
|
+
this.eventManager.addEventListener(this.hot.rootDocument.documentElement, 'compositionstart', event => {
|
100
|
+
if (!this.destroyed && this.hot.isListening()) {
|
74
101
|
this.openEditor('', event);
|
75
102
|
}
|
76
103
|
});
|
77
|
-
this.
|
104
|
+
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _classPrivateMethodGet(this, _onCellDblClick, _onCellDblClick2).call(this, event, coords, elem));
|
78
105
|
}
|
79
106
|
|
80
107
|
/**
|
@@ -131,7 +158,7 @@ class EditorManager {
|
|
131
158
|
}
|
132
159
|
const {
|
133
160
|
highlight
|
134
|
-
} = this.
|
161
|
+
} = this.hot.getSelectedRangeLast();
|
135
162
|
if (highlight.isHeader()) {
|
136
163
|
return;
|
137
164
|
}
|
@@ -139,7 +166,7 @@ class EditorManager {
|
|
139
166
|
row,
|
140
167
|
col
|
141
168
|
} = highlight;
|
142
|
-
const modifiedCellCoords = this.
|
169
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', row, col);
|
143
170
|
let visualRowToCheck = row;
|
144
171
|
let visualColumnToCheck = col;
|
145
172
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -147,20 +174,20 @@ class EditorManager {
|
|
147
174
|
}
|
148
175
|
|
149
176
|
// Getting values using the modified coordinates.
|
150
|
-
this.cellProperties = this.
|
177
|
+
this.cellProperties = this.hot.getCellMeta(visualRowToCheck, visualColumnToCheck);
|
151
178
|
if (!this.isCellEditable()) {
|
152
179
|
this.clearActiveEditor();
|
153
180
|
return;
|
154
181
|
}
|
155
|
-
const td = this.
|
182
|
+
const td = this.hot.getCell(row, col, true);
|
156
183
|
|
157
184
|
// Skip the preparation when the cell is not rendered in the DOM. The cell is scrolled out of
|
158
185
|
// the table's viewport.
|
159
186
|
if (td) {
|
160
|
-
const editorClass = this.
|
161
|
-
const prop = this.
|
162
|
-
const originalValue = this.
|
163
|
-
this.activeEditor = getEditorInstance(editorClass, this.
|
187
|
+
const editorClass = this.hot.getCellEditor(this.cellProperties);
|
188
|
+
const prop = this.hot.colToProp(visualColumnToCheck);
|
189
|
+
const originalValue = this.hot.getSourceDataAtCell(this.hot.toPhysicalRow(visualRowToCheck), visualColumnToCheck);
|
190
|
+
this.activeEditor = getEditorInstance(editorClass, this.hot);
|
164
191
|
// Using not modified coordinates, as we need to get the table element using selection coordinates.
|
165
192
|
// There is an extra translation in the editor for saving value.
|
166
193
|
this.activeEditor.prepare(row, col, prop, td, originalValue, this.cellProperties);
|
@@ -191,7 +218,7 @@ class EditorManager {
|
|
191
218
|
return;
|
192
219
|
}
|
193
220
|
if (!this.activeEditor) {
|
194
|
-
this.
|
221
|
+
this.hot.scrollToFocusedCell();
|
195
222
|
this.prepareEditor();
|
196
223
|
}
|
197
224
|
if (this.activeEditor) {
|
@@ -241,7 +268,7 @@ class EditorManager {
|
|
241
268
|
* @private
|
242
269
|
*/
|
243
270
|
clearActiveEditor() {
|
244
|
-
this.activeEditor =
|
271
|
+
this.activeEditor = undefined;
|
245
272
|
}
|
246
273
|
|
247
274
|
/**
|
@@ -255,11 +282,11 @@ class EditorManager {
|
|
255
282
|
* @returns {boolean}
|
256
283
|
*/
|
257
284
|
isCellEditable() {
|
258
|
-
const selection = this.
|
285
|
+
const selection = this.hot.getSelectedRangeLast();
|
259
286
|
if (!selection) {
|
260
287
|
return false;
|
261
288
|
}
|
262
|
-
const editorClass = this.
|
289
|
+
const editorClass = this.hot.getCellEditor(this.cellProperties);
|
263
290
|
const {
|
264
291
|
row,
|
265
292
|
col
|
@@ -267,8 +294,8 @@ class EditorManager {
|
|
267
294
|
const {
|
268
295
|
rowIndexMapper,
|
269
296
|
columnIndexMapper
|
270
|
-
} = this.
|
271
|
-
const isCellHidden = rowIndexMapper.isHidden(this.
|
297
|
+
} = this.hot;
|
298
|
+
const isCellHidden = rowIndexMapper.isHidden(this.hot.toPhysicalRow(row)) || columnIndexMapper.isHidden(this.hot.toPhysicalColumn(col));
|
272
299
|
if (this.cellProperties.readOnly || !editorClass || isCellHidden) {
|
273
300
|
return false;
|
274
301
|
}
|
@@ -291,73 +318,6 @@ class EditorManager {
|
|
291
318
|
this.selection.transformStart(enterMoves.row, enterMoves.col, true);
|
292
319
|
}
|
293
320
|
}
|
294
|
-
|
295
|
-
/**
|
296
|
-
* OnAfterDocumentKeyDown callback.
|
297
|
-
*
|
298
|
-
* @private
|
299
|
-
* @param {KeyboardEvent} event The keyboard event object.
|
300
|
-
*/
|
301
|
-
onAfterDocumentKeyDown(event) {
|
302
|
-
const selection = this.instance.getSelectedRangeLast();
|
303
|
-
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
|
304
|
-
return;
|
305
|
-
}
|
306
|
-
const {
|
307
|
-
keyCode
|
308
|
-
} = event;
|
309
|
-
|
310
|
-
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
311
|
-
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
312
|
-
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
313
|
-
if (!isFunctionKey(keyCode) && !isCtrlMetaKey(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
314
|
-
const shortcutManager = this.instance.getShortcutManager();
|
315
|
-
const editorContext = shortcutManager.getContext('editor');
|
316
|
-
const runOnlySelectedConfig = {
|
317
|
-
runOnlyIf: () => isDefined(this.instance.getSelected()),
|
318
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
319
|
-
};
|
320
|
-
editorContext.addShortcuts([{
|
321
|
-
keys: [['ArrowUp']],
|
322
|
-
callback: () => {
|
323
|
-
this.instance.selection.transformStart(-1, 0);
|
324
|
-
}
|
325
|
-
}, {
|
326
|
-
keys: [['ArrowDown']],
|
327
|
-
callback: () => {
|
328
|
-
this.instance.selection.transformStart(1, 0);
|
329
|
-
}
|
330
|
-
}, {
|
331
|
-
keys: [['ArrowLeft']],
|
332
|
-
callback: () => {
|
333
|
-
this.instance.selection.transformStart(0, -1 * this.instance.getDirectionFactor());
|
334
|
-
}
|
335
|
-
}, {
|
336
|
-
keys: [['ArrowRight']],
|
337
|
-
callback: () => {
|
338
|
-
this.instance.selection.transformStart(0, this.instance.getDirectionFactor());
|
339
|
-
}
|
340
|
-
}], runOnlySelectedConfig);
|
341
|
-
this.openEditor('', event);
|
342
|
-
}
|
343
|
-
}
|
344
|
-
}
|
345
|
-
|
346
|
-
/**
|
347
|
-
* OnCellDblClick callback.
|
348
|
-
*
|
349
|
-
* @private
|
350
|
-
* @param {MouseEvent} event The mouse event object.
|
351
|
-
* @param {object} coords The cell coordinates.
|
352
|
-
* @param {HTMLTableCellElement|HTMLTableHeaderCellElement} elem The element which triggers the action.
|
353
|
-
*/
|
354
|
-
onCellDblClick(event, coords, elem) {
|
355
|
-
// may be TD or TH
|
356
|
-
if (elem.nodeName === 'TD') {
|
357
|
-
this.openEditor(null, event, true);
|
358
|
-
}
|
359
|
-
}
|
360
|
-
|
361
321
|
/**
|
362
322
|
* Destroy the instance.
|
363
323
|
*/
|
@@ -366,6 +326,56 @@ class EditorManager {
|
|
366
326
|
this.eventManager.destroy();
|
367
327
|
}
|
368
328
|
}
|
329
|
+
function _onAfterDocumentKeyDown2(event) {
|
330
|
+
const selection = this.hot.getSelectedRangeLast();
|
331
|
+
if (!this.hot.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
|
332
|
+
return;
|
333
|
+
}
|
334
|
+
const {
|
335
|
+
keyCode
|
336
|
+
} = event;
|
337
|
+
|
338
|
+
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
339
|
+
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
340
|
+
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
341
|
+
if (!isFunctionKey(keyCode) && !isCtrlMetaKey(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
342
|
+
const shortcutManager = this.hot.getShortcutManager();
|
343
|
+
const editorContext = shortcutManager.getContext('editor');
|
344
|
+
const runOnlySelectedConfig = {
|
345
|
+
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
346
|
+
group: SHORTCUTS_GROUP_NAVIGATION
|
347
|
+
};
|
348
|
+
editorContext.addShortcuts([{
|
349
|
+
keys: [['ArrowUp']],
|
350
|
+
callback: () => {
|
351
|
+
this.hot.selection.transformStart(-1, 0);
|
352
|
+
}
|
353
|
+
}, {
|
354
|
+
keys: [['ArrowDown']],
|
355
|
+
callback: () => {
|
356
|
+
this.hot.selection.transformStart(1, 0);
|
357
|
+
}
|
358
|
+
}, {
|
359
|
+
keys: [['ArrowLeft']],
|
360
|
+
callback: () => {
|
361
|
+
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
362
|
+
}
|
363
|
+
}, {
|
364
|
+
keys: [['ArrowRight']],
|
365
|
+
callback: () => {
|
366
|
+
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
367
|
+
}
|
368
|
+
}], runOnlySelectedConfig);
|
369
|
+
this.openEditor('', event);
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
function _onCellDblClick2(event, coords, elem) {
|
374
|
+
// may be TD or TH
|
375
|
+
if (elem.nodeName === 'TD') {
|
376
|
+
this.openEditor(null, event, true);
|
377
|
+
}
|
378
|
+
}
|
369
379
|
const instances = new WeakMap();
|
370
380
|
|
371
381
|
/**
|