handsontable 0.0.0-next-b7cca45-20230605 → 0.0.0-next-aa25cac-20230607
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +61 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +44 -7
- package/3rdparty/walkontable/src/cell/range.mjs +44 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
- package/3rdparty/walkontable/src/overlay/top.js +2 -4
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
- package/3rdparty/walkontable/src/selection/constants.js +63 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +30 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +328 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
- package/3rdparty/walkontable/src/selection/scanner.js +363 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
- package/3rdparty/walkontable/src/selection/selection.js +133 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +7 -79
- package/3rdparty/walkontable/src/table.mjs +8 -80
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +5 -3
- package/core.js +123 -308
- package/core.mjs +123 -308
- package/dataMap/metaManager/metaSchema.js +15 -0
- package/dataMap/metaManager/metaSchema.mjs +15 -0
- package/dist/handsontable.css +8 -3
- package/dist/handsontable.full.css +8 -3
- package/dist/handsontable.full.js +12578 -10028
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +18881 -16331
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +21 -82
- package/editorManager.mjs +26 -86
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.d.ts +5 -1
- package/pluginHooks.js +89 -1
- package/pluginHooks.mjs +89 -1
- package/plugins/copyPaste/copyPaste.js +5 -1
- package/plugins/copyPaste/copyPaste.mjs +5 -1
- package/plugins/customBorders/customBorders.js +18 -52
- package/plugins/customBorders/customBorders.mjs +19 -53
- package/plugins/mergeCells/mergeCells.js +5 -18
- package/plugins/mergeCells/mergeCells.mjs +5 -18
- package/plugins/nestedHeaders/nestedHeaders.js +132 -10
- package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +311 -88
- package/selection/highlight/highlight.mjs +301 -84
- package/selection/highlight/types/activeHeader.js +10 -9
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +12 -27
- package/selection/highlight/types/area.mjs +16 -30
- package/selection/highlight/types/areaLayered.js +54 -0
- package/selection/highlight/types/areaLayered.mjs +49 -0
- package/selection/highlight/types/column.js +50 -0
- package/selection/highlight/types/column.mjs +45 -0
- package/selection/highlight/types/customSelection.js +7 -10
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -8
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -8
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +10 -20
- package/selection/highlight/types/header.mjs +10 -19
- package/selection/highlight/types/{index.js → row.js} +27 -31
- package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
- package/selection/highlight/visualSelection.js +31 -27
- package/selection/highlight/visualSelection.mjs +31 -27
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +315 -180
- package/selection/selection.mjs +310 -179
- package/selection/transformation.js +233 -96
- package/selection/transformation.mjs +230 -93
- package/selection/utils.js +12 -35
- package/selection/utils.mjs +13 -35
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +29 -0
- package/shortcutContexts/commands/editor/open.mjs +24 -0
- package/shortcutContexts/commands/emptySelectedCells.js +12 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/index.js +51 -0
- package/shortcutContexts/commands/index.mjs +47 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
- package/shortcutContexts/commands/selectAll.js +11 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +19 -0
- package/shortcutContexts/constants.mjs +12 -0
- package/shortcutContexts/editor.js +29 -0
- package/shortcutContexts/editor.mjs +25 -0
- package/shortcutContexts/grid.js +244 -0
- package/shortcutContexts/grid.mjs +240 -0
- package/shortcutContexts/index.js +29 -0
- package/shortcutContexts/index.mjs +15 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -0
- package/tableView.js +58 -9
- package/tableView.mjs +58 -9
- package/3rdparty/walkontable/src/selection.js +0 -354
- package/3rdparty/walkontable/src/selection.mjs +0 -348
- package/selection/highlight/constants.js +0 -16
- package/selection/highlight/constants.mjs +0 -6
package/editorManager.js
CHANGED
@@ -6,9 +6,7 @@ require("core-js/modules/es.function.name.js");
|
|
6
6
|
require("core-js/modules/es.array.from.js");
|
7
7
|
require("core-js/modules/es.regexp.exec.js");
|
8
8
|
exports.__esModule = true;
|
9
|
-
exports.default = exports.SHORTCUTS_GROUP_NAVIGATION =
|
10
|
-
require("core-js/modules/es.array.includes.js");
|
11
|
-
require("core-js/modules/es.string.includes.js");
|
9
|
+
exports.default = exports.SHORTCUTS_GROUP_NAVIGATION = void 0;
|
12
10
|
require("core-js/modules/es.symbol.to-primitive.js");
|
13
11
|
require("core-js/modules/es.date.to-primitive.js");
|
14
12
|
require("core-js/modules/es.symbol.js");
|
@@ -20,8 +18,8 @@ require("core-js/modules/es.string.iterator.js");
|
|
20
18
|
require("core-js/modules/es.weak-map.js");
|
21
19
|
require("core-js/modules/web.dom-collections.iterator.js");
|
22
20
|
var _unicode = require("./helpers/unicode");
|
23
|
-
var _event = require("./helpers/dom/event");
|
24
21
|
var _element = require("./helpers/dom/element");
|
22
|
+
var _event = require("./helpers/dom/event");
|
25
23
|
var _registry = require("./editors/registry");
|
26
24
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
27
25
|
var _mixed = require("./helpers/mixed");
|
@@ -40,8 +38,6 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
40
38
|
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); }
|
41
39
|
var SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
42
40
|
exports.SHORTCUTS_GROUP_NAVIGATION = SHORTCUTS_GROUP_NAVIGATION;
|
43
|
-
var SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
44
|
-
exports.SHORTCUTS_GROUP_EDITOR = SHORTCUTS_GROUP_EDITOR;
|
45
41
|
var EditorManager = /*#__PURE__*/function () {
|
46
42
|
/**
|
47
43
|
* @param {Core} instance The Handsontable instance.
|
@@ -106,9 +102,6 @@ var EditorManager = /*#__PURE__*/function () {
|
|
106
102
|
* @type {object}
|
107
103
|
*/
|
108
104
|
this.cellProperties = void 0;
|
109
|
-
var shortcutManager = this.instance.getShortcutManager();
|
110
|
-
shortcutManager.addContext('editor');
|
111
|
-
this.registerShortcuts();
|
112
105
|
this.instance.addHook('afterDocumentKeyDown', function (event) {
|
113
106
|
return _this.onAfterDocumentKeyDown(event);
|
114
107
|
});
|
@@ -125,66 +118,10 @@ var EditorManager = /*#__PURE__*/function () {
|
|
125
118
|
}
|
126
119
|
|
127
120
|
/**
|
128
|
-
*
|
129
|
-
*
|
130
|
-
* @private
|
121
|
+
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
122
|
+
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
131
123
|
*/
|
132
124
|
_createClass(EditorManager, [{
|
133
|
-
key: "registerShortcuts",
|
134
|
-
value: function registerShortcuts() {
|
135
|
-
var _this2 = this;
|
136
|
-
var shortcutManager = this.instance.getShortcutManager();
|
137
|
-
var gridContext = shortcutManager.getContext('grid');
|
138
|
-
var editorContext = shortcutManager.getContext('editor');
|
139
|
-
var config = {
|
140
|
-
group: SHORTCUTS_GROUP_EDITOR
|
141
|
-
};
|
142
|
-
editorContext.addShortcuts([{
|
143
|
-
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
144
|
-
callback: function callback(event, keys) {
|
145
|
-
_this2.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
146
|
-
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
147
|
-
}
|
148
|
-
}, {
|
149
|
-
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
150
|
-
callback: function callback() {
|
151
|
-
_this2.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
152
|
-
_this2.activeEditor.focus();
|
153
|
-
}
|
154
|
-
}], config);
|
155
|
-
gridContext.addShortcuts([{
|
156
|
-
keys: [['F2']],
|
157
|
-
callback: function callback(event) {
|
158
|
-
_this2.openEditor(null, event, true);
|
159
|
-
}
|
160
|
-
}, {
|
161
|
-
keys: [['Backspace'], ['Delete']],
|
162
|
-
callback: function callback() {
|
163
|
-
_this2.instance.emptySelectedCells();
|
164
|
-
_this2.prepareEditor();
|
165
|
-
}
|
166
|
-
}, {
|
167
|
-
keys: [['Enter'], ['Enter', 'Shift']],
|
168
|
-
callback: function callback(event, keys) {
|
169
|
-
if (_this2.instance.getSettings().enterBeginsEditing) {
|
170
|
-
if (_this2.cellProperties.readOnly) {
|
171
|
-
_this2.moveSelectionAfterEnter();
|
172
|
-
} else {
|
173
|
-
_this2.openEditor(null, event, true);
|
174
|
-
}
|
175
|
-
} else {
|
176
|
-
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
177
|
-
}
|
178
|
-
(0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
|
179
|
-
}
|
180
|
-
}], config);
|
181
|
-
}
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
185
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
186
|
-
*/
|
187
|
-
}, {
|
188
125
|
key: "lockEditor",
|
189
126
|
value: function lockEditor() {
|
190
127
|
this.lock = true;
|
@@ -231,21 +168,25 @@ var EditorManager = /*#__PURE__*/function () {
|
|
231
168
|
}, {
|
232
169
|
key: "prepareEditor",
|
233
170
|
value: function prepareEditor() {
|
234
|
-
var
|
171
|
+
var _this2 = this;
|
235
172
|
if (this.lock) {
|
236
173
|
return;
|
237
174
|
}
|
238
175
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
239
176
|
this.closeEditor(false, false, function (dataSaved) {
|
240
177
|
if (dataSaved) {
|
241
|
-
|
178
|
+
_this2.prepareEditor();
|
242
179
|
}
|
243
180
|
});
|
244
181
|
return;
|
245
182
|
}
|
246
|
-
var _this$instance$getSel = this.instance.getSelectedRangeLast()
|
247
|
-
|
248
|
-
|
183
|
+
var _this$instance$getSel = this.instance.getSelectedRangeLast(),
|
184
|
+
highlight = _this$instance$getSel.highlight;
|
185
|
+
if (highlight.isHeader()) {
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
var row = highlight.row,
|
189
|
+
col = highlight.col;
|
249
190
|
var modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
250
191
|
var visualRowToCheck = row;
|
251
192
|
var visualColumnToCheck = col;
|
@@ -435,14 +376,12 @@ var EditorManager = /*#__PURE__*/function () {
|
|
435
376
|
}, {
|
436
377
|
key: "onAfterDocumentKeyDown",
|
437
378
|
value: function onAfterDocumentKeyDown(event) {
|
438
|
-
var
|
439
|
-
|
379
|
+
var _this3 = this;
|
380
|
+
var selection = this.instance.getSelectedRangeLast();
|
381
|
+
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
|
440
382
|
return;
|
441
383
|
}
|
442
384
|
var keyCode = event.keyCode;
|
443
|
-
if (!this.selection.isSelected()) {
|
444
|
-
return;
|
445
|
-
}
|
446
385
|
|
447
386
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
448
387
|
var isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
@@ -452,29 +391,29 @@ var EditorManager = /*#__PURE__*/function () {
|
|
452
391
|
var editorContext = shortcutManager.getContext('editor');
|
453
392
|
var runOnlySelectedConfig = {
|
454
393
|
runOnlyIf: function runOnlyIf() {
|
455
|
-
return (0, _mixed.isDefined)(
|
394
|
+
return (0, _mixed.isDefined)(_this3.instance.getSelected());
|
456
395
|
},
|
457
396
|
group: SHORTCUTS_GROUP_NAVIGATION
|
458
397
|
};
|
459
398
|
editorContext.addShortcuts([{
|
460
399
|
keys: [['ArrowUp']],
|
461
400
|
callback: function callback() {
|
462
|
-
|
401
|
+
_this3.instance.selection.transformStart(-1, 0);
|
463
402
|
}
|
464
403
|
}, {
|
465
404
|
keys: [['ArrowDown']],
|
466
405
|
callback: function callback() {
|
467
|
-
|
406
|
+
_this3.instance.selection.transformStart(1, 0);
|
468
407
|
}
|
469
408
|
}, {
|
470
409
|
keys: [['ArrowLeft']],
|
471
410
|
callback: function callback() {
|
472
|
-
|
411
|
+
_this3.instance.selection.transformStart(0, -1 * _this3.instance.getDirectionFactor());
|
473
412
|
}
|
474
413
|
}, {
|
475
414
|
keys: [['ArrowRight']],
|
476
415
|
callback: function callback() {
|
477
|
-
|
416
|
+
_this3.instance.selection.transformStart(0, _this3.instance.getDirectionFactor());
|
478
417
|
}
|
479
418
|
}], runOnlySelectedConfig);
|
480
419
|
this.openEditor('', event);
|
package/editorManager.mjs
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
3
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
5
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
6
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
7
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
8
|
-
import "core-js/modules/es.array.includes.js";
|
9
|
-
import "core-js/modules/es.string.includes.js";
|
10
2
|
import "core-js/modules/es.array.iterator.js";
|
11
3
|
import "core-js/modules/es.object.to-string.js";
|
12
4
|
import "core-js/modules/es.string.iterator.js";
|
@@ -22,19 +14,24 @@ import "core-js/modules/es.array.slice.js";
|
|
22
14
|
import "core-js/modules/es.function.name.js";
|
23
15
|
import "core-js/modules/es.array.from.js";
|
24
16
|
import "core-js/modules/es.regexp.exec.js";
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
25
23
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
26
24
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
27
25
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
28
26
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
29
27
|
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); }
|
30
28
|
import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
31
|
-
import { stopImmediatePropagation } from "./helpers/dom/event.mjs";
|
32
29
|
import { isOutsideInput } from "./helpers/dom/element.mjs";
|
30
|
+
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
33
31
|
import { getEditorInstance } from "./editors/registry.mjs";
|
34
32
|
import EventManager from "./eventManager.mjs";
|
35
33
|
import { isDefined } from "./helpers/mixed.mjs";
|
36
34
|
export var SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
37
|
-
export var SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
38
35
|
var EditorManager = /*#__PURE__*/function () {
|
39
36
|
/**
|
40
37
|
* @param {Core} instance The Handsontable instance.
|
@@ -99,9 +96,6 @@ var EditorManager = /*#__PURE__*/function () {
|
|
99
96
|
* @type {object}
|
100
97
|
*/
|
101
98
|
this.cellProperties = void 0;
|
102
|
-
var shortcutManager = this.instance.getShortcutManager();
|
103
|
-
shortcutManager.addContext('editor');
|
104
|
-
this.registerShortcuts();
|
105
99
|
this.instance.addHook('afterDocumentKeyDown', function (event) {
|
106
100
|
return _this.onAfterDocumentKeyDown(event);
|
107
101
|
});
|
@@ -118,66 +112,10 @@ var EditorManager = /*#__PURE__*/function () {
|
|
118
112
|
}
|
119
113
|
|
120
114
|
/**
|
121
|
-
*
|
122
|
-
*
|
123
|
-
* @private
|
115
|
+
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
116
|
+
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
124
117
|
*/
|
125
118
|
_createClass(EditorManager, [{
|
126
|
-
key: "registerShortcuts",
|
127
|
-
value: function registerShortcuts() {
|
128
|
-
var _this2 = this;
|
129
|
-
var shortcutManager = this.instance.getShortcutManager();
|
130
|
-
var gridContext = shortcutManager.getContext('grid');
|
131
|
-
var editorContext = shortcutManager.getContext('editor');
|
132
|
-
var config = {
|
133
|
-
group: SHORTCUTS_GROUP_EDITOR
|
134
|
-
};
|
135
|
-
editorContext.addShortcuts([{
|
136
|
-
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
137
|
-
callback: function callback(event, keys) {
|
138
|
-
_this2.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
139
|
-
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
140
|
-
}
|
141
|
-
}, {
|
142
|
-
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
143
|
-
callback: function callback() {
|
144
|
-
_this2.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
145
|
-
_this2.activeEditor.focus();
|
146
|
-
}
|
147
|
-
}], config);
|
148
|
-
gridContext.addShortcuts([{
|
149
|
-
keys: [['F2']],
|
150
|
-
callback: function callback(event) {
|
151
|
-
_this2.openEditor(null, event, true);
|
152
|
-
}
|
153
|
-
}, {
|
154
|
-
keys: [['Backspace'], ['Delete']],
|
155
|
-
callback: function callback() {
|
156
|
-
_this2.instance.emptySelectedCells();
|
157
|
-
_this2.prepareEditor();
|
158
|
-
}
|
159
|
-
}, {
|
160
|
-
keys: [['Enter'], ['Enter', 'Shift']],
|
161
|
-
callback: function callback(event, keys) {
|
162
|
-
if (_this2.instance.getSettings().enterBeginsEditing) {
|
163
|
-
if (_this2.cellProperties.readOnly) {
|
164
|
-
_this2.moveSelectionAfterEnter();
|
165
|
-
} else {
|
166
|
-
_this2.openEditor(null, event, true);
|
167
|
-
}
|
168
|
-
} else {
|
169
|
-
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
170
|
-
}
|
171
|
-
stopImmediatePropagation(event); // required by HandsontableEditor
|
172
|
-
}
|
173
|
-
}], config);
|
174
|
-
}
|
175
|
-
|
176
|
-
/**
|
177
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
178
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
179
|
-
*/
|
180
|
-
}, {
|
181
119
|
key: "lockEditor",
|
182
120
|
value: function lockEditor() {
|
183
121
|
this.lock = true;
|
@@ -224,21 +162,25 @@ var EditorManager = /*#__PURE__*/function () {
|
|
224
162
|
}, {
|
225
163
|
key: "prepareEditor",
|
226
164
|
value: function prepareEditor() {
|
227
|
-
var
|
165
|
+
var _this2 = this;
|
228
166
|
if (this.lock) {
|
229
167
|
return;
|
230
168
|
}
|
231
169
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
232
170
|
this.closeEditor(false, false, function (dataSaved) {
|
233
171
|
if (dataSaved) {
|
234
|
-
|
172
|
+
_this2.prepareEditor();
|
235
173
|
}
|
236
174
|
});
|
237
175
|
return;
|
238
176
|
}
|
239
|
-
var _this$instance$getSel = this.instance.getSelectedRangeLast()
|
240
|
-
|
241
|
-
|
177
|
+
var _this$instance$getSel = this.instance.getSelectedRangeLast(),
|
178
|
+
highlight = _this$instance$getSel.highlight;
|
179
|
+
if (highlight.isHeader()) {
|
180
|
+
return;
|
181
|
+
}
|
182
|
+
var row = highlight.row,
|
183
|
+
col = highlight.col;
|
242
184
|
var modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
243
185
|
var visualRowToCheck = row;
|
244
186
|
var visualColumnToCheck = col;
|
@@ -428,14 +370,12 @@ var EditorManager = /*#__PURE__*/function () {
|
|
428
370
|
}, {
|
429
371
|
key: "onAfterDocumentKeyDown",
|
430
372
|
value: function onAfterDocumentKeyDown(event) {
|
431
|
-
var
|
432
|
-
|
373
|
+
var _this3 = this;
|
374
|
+
var selection = this.instance.getSelectedRangeLast();
|
375
|
+
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
|
433
376
|
return;
|
434
377
|
}
|
435
378
|
var keyCode = event.keyCode;
|
436
|
-
if (!this.selection.isSelected()) {
|
437
|
-
return;
|
438
|
-
}
|
439
379
|
|
440
380
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
441
381
|
var isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
@@ -445,29 +385,29 @@ var EditorManager = /*#__PURE__*/function () {
|
|
445
385
|
var editorContext = shortcutManager.getContext('editor');
|
446
386
|
var runOnlySelectedConfig = {
|
447
387
|
runOnlyIf: function runOnlyIf() {
|
448
|
-
return isDefined(
|
388
|
+
return isDefined(_this3.instance.getSelected());
|
449
389
|
},
|
450
390
|
group: SHORTCUTS_GROUP_NAVIGATION
|
451
391
|
};
|
452
392
|
editorContext.addShortcuts([{
|
453
393
|
keys: [['ArrowUp']],
|
454
394
|
callback: function callback() {
|
455
|
-
|
395
|
+
_this3.instance.selection.transformStart(-1, 0);
|
456
396
|
}
|
457
397
|
}, {
|
458
398
|
keys: [['ArrowDown']],
|
459
399
|
callback: function callback() {
|
460
|
-
|
400
|
+
_this3.instance.selection.transformStart(1, 0);
|
461
401
|
}
|
462
402
|
}, {
|
463
403
|
keys: [['ArrowLeft']],
|
464
404
|
callback: function callback() {
|
465
|
-
|
405
|
+
_this3.instance.selection.transformStart(0, -1 * _this3.instance.getDirectionFactor());
|
466
406
|
}
|
467
407
|
}, {
|
468
408
|
keys: [['ArrowRight']],
|
469
409
|
callback: function callback() {
|
470
|
-
|
410
|
+
_this3.instance.selection.transformStart(0, _this3.instance.getDirectionFactor());
|
471
411
|
}
|
472
412
|
}], runOnlySelectedConfig);
|
473
413
|
this.openEditor('', event);
|
@@ -507,9 +507,7 @@ var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
507
507
|
// We trigger a data population for multiple selection.
|
508
508
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
509
509
|
!event.altKey;
|
510
|
-
}
|
511
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
512
|
-
position: 'before'
|
510
|
+
}
|
513
511
|
}, {
|
514
512
|
keys: [['Meta', 'Enter']],
|
515
513
|
callback: function callback() {
|
@@ -519,19 +517,13 @@ var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
519
517
|
|
520
518
|
runOnlyIf: function runOnlyIf() {
|
521
519
|
return !_this4.hot.selection.isMultiple();
|
522
|
-
}
|
523
|
-
// We trigger a data population for multiple selection.
|
524
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
525
|
-
position: 'before'
|
520
|
+
} // We trigger a data population for multiple selection.
|
526
521
|
}, {
|
527
522
|
keys: [['Alt', 'Enter']],
|
528
523
|
callback: function callback() {
|
529
524
|
insertNewLine();
|
530
525
|
return false; // Will block closing editor.
|
531
|
-
}
|
532
|
-
|
533
|
-
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
534
|
-
position: 'before'
|
526
|
+
}
|
535
527
|
}, {
|
536
528
|
// TODO: Duplicated part of code (callback to shortcut)
|
537
529
|
keys: [['PageUp']],
|
@@ -47,7 +47,7 @@ import { rangeEach } from "../../helpers/number.mjs";
|
|
47
47
|
import { KEY_CODES } from "../../helpers/unicode.mjs";
|
48
48
|
import { autoResize } from "../../3rdparty/autoResize/index.mjs";
|
49
49
|
import { isDefined } from "../../helpers/mixed.mjs";
|
50
|
-
import { SHORTCUTS_GROUP_NAVIGATION
|
50
|
+
import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
|
51
51
|
import { SHORTCUTS_GROUP_EDITOR } from "../baseEditor/baseEditor.mjs";
|
52
52
|
import { updateCaretPosition } from "./caretPositioner.mjs";
|
53
53
|
var EDITOR_VISIBLE_CLASS_NAME = 'ht_editor_visible';
|
@@ -501,9 +501,7 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
501
501
|
// We trigger a data population for multiple selection.
|
502
502
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
503
503
|
!event.altKey;
|
504
|
-
}
|
505
|
-
relativeToGroup: EDITOR_MANAGER_GROUP,
|
506
|
-
position: 'before'
|
504
|
+
}
|
507
505
|
}, {
|
508
506
|
keys: [['Meta', 'Enter']],
|
509
507
|
callback: function callback() {
|
@@ -513,19 +511,13 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
513
511
|
|
514
512
|
runOnlyIf: function runOnlyIf() {
|
515
513
|
return !_this4.hot.selection.isMultiple();
|
516
|
-
}
|
517
|
-
// We trigger a data population for multiple selection.
|
518
|
-
relativeToGroup: EDITOR_MANAGER_GROUP,
|
519
|
-
position: 'before'
|
514
|
+
} // We trigger a data population for multiple selection.
|
520
515
|
}, {
|
521
516
|
keys: [['Alt', 'Enter']],
|
522
517
|
callback: function callback() {
|
523
518
|
insertNewLine();
|
524
519
|
return false; // Will block closing editor.
|
525
|
-
}
|
526
|
-
|
527
|
-
relativeToGroup: EDITOR_MANAGER_GROUP,
|
528
|
-
position: 'before'
|
520
|
+
}
|
529
521
|
}, {
|
530
522
|
// TODO: Duplicated part of code (callback to shortcut)
|
531
523
|
keys: [['PageUp']],
|
package/helpers/mixed.js
CHANGED
@@ -152,7 +152,7 @@ var domMessages = {
|
|
152
152
|
function _injectProductInfo(key, element) {
|
153
153
|
var hasValidType = !isEmpty(key);
|
154
154
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
155
|
-
var hotVersion = "0.0.0-next-
|
155
|
+
var hotVersion = "0.0.0-next-aa25cac-20230607";
|
156
156
|
var keyValidityDate;
|
157
157
|
var consoleMessageState = 'invalid';
|
158
158
|
var domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -142,7 +142,7 @@ var domMessages = {
|
|
142
142
|
export function _injectProductInfo(key, element) {
|
143
143
|
var hasValidType = !isEmpty(key);
|
144
144
|
var isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
145
|
-
var hotVersion = "0.0.0-next-
|
145
|
+
var hotVersion = "0.0.0-next-aa25cac-20230607";
|
146
146
|
var keyValidityDate;
|
147
147
|
var consoleMessageState = 'invalid';
|
148
148
|
var domMessageState = 'invalid';
|
package/helpers/number.d.ts
CHANGED
@@ -3,3 +3,4 @@ export function isNumericLike(value: any): boolean;
|
|
3
3
|
export function rangeEach(rangeFrom: number, rangeTo: number, iteratee: (index: number) => void): void;
|
4
4
|
export function rangeEachReverse(rangeFrom: number, rangeTo: number, iteratee: (index: number) => void): void;
|
5
5
|
export function valueAccordingPercent(value: number, percent: string | number): number;
|
6
|
+
export function clamp(value: number, minValue: number, maxValue: number): number;
|
package/helpers/number.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require("core-js/modules/es.array.slice.js");
|
4
4
|
require("core-js/modules/es.function.name.js");
|
5
5
|
exports.__esModule = true;
|
6
|
+
exports.clamp = clamp;
|
6
7
|
exports.isNumeric = isNumeric;
|
7
8
|
exports.isNumericLike = isNumericLike;
|
8
9
|
exports.rangeEach = rangeEach;
|
@@ -139,4 +140,21 @@ function valueAccordingPercent(value, percent) {
|
|
139
140
|
percent = parseInt(percent.toString().replace('%', ''), 10);
|
140
141
|
percent = isNaN(percent) ? 0 : percent;
|
141
142
|
return parseInt(value * percent / 100, 10);
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Clamps the value between min and max.
|
147
|
+
*
|
148
|
+
* @param {number} value The base number value.
|
149
|
+
* @param {number} minValue The max number value.
|
150
|
+
* @param {number} maxValue The min number value.
|
151
|
+
* @returns {number}
|
152
|
+
*/
|
153
|
+
function clamp(value, minValue, maxValue) {
|
154
|
+
if (Math.min(value, minValue) === value) {
|
155
|
+
return minValue;
|
156
|
+
} else if (Math.max(value, maxValue) === value) {
|
157
|
+
return maxValue;
|
158
|
+
}
|
159
|
+
return value;
|
142
160
|
}
|
package/helpers/number.mjs
CHANGED
@@ -131,4 +131,21 @@ export function valueAccordingPercent(value, percent) {
|
|
131
131
|
percent = parseInt(percent.toString().replace('%', ''), 10);
|
132
132
|
percent = isNaN(percent) ? 0 : percent;
|
133
133
|
return parseInt(value * percent / 100, 10);
|
134
|
+
}
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Clamps the value between min and max.
|
138
|
+
*
|
139
|
+
* @param {number} value The base number value.
|
140
|
+
* @param {number} minValue The max number value.
|
141
|
+
* @param {number} maxValue The min number value.
|
142
|
+
* @returns {number}
|
143
|
+
*/
|
144
|
+
export function clamp(value, minValue, maxValue) {
|
145
|
+
if (Math.min(value, minValue) === value) {
|
146
|
+
return minValue;
|
147
|
+
} else if (Math.max(value, maxValue) === value) {
|
148
|
+
return maxValue;
|
149
|
+
}
|
150
|
+
return value;
|
134
151
|
}
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-aa25cac-20230607",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
package/pluginHooks.d.ts
CHANGED
@@ -110,8 +110,8 @@ export interface Events {
|
|
110
110
|
afterOnCellCornerDblClick?: (event: MouseEvent) => void;
|
111
111
|
afterOnCellCornerMouseDown?: (event: MouseEvent) => void;
|
112
112
|
afterOnCellMouseDown?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
113
|
-
afterOnCellMouseOver?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
114
113
|
afterOnCellMouseOut?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
114
|
+
afterOnCellMouseOver?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
115
115
|
afterOnCellMouseUp?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
116
116
|
afterPaste?: (data: CellValue[][], coords: RangeType[]) => void;
|
117
117
|
afterPluginsInitialized?: () => void;
|
@@ -128,10 +128,12 @@ export interface Events {
|
|
128
128
|
afterRowSequenceChange?: (source: 'init' | 'move' | 'insert' | 'remove' | 'update') => void;
|
129
129
|
afterScrollHorizontally?: () => void;
|
130
130
|
afterScrollVertically?: () => void;
|
131
|
+
afterSelectColumns?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
|
131
132
|
afterSelection?: (row: number, column: number, row2: number, column2: number, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
|
132
133
|
afterSelectionByProp?: (row: number, prop: string, row2: number, prop2: string, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
|
133
134
|
afterSelectionEnd?: (row: number, column: number, row2: number, column2: number, selectionLayerLevel: number) => void;
|
134
135
|
afterSelectionEndByProp?: (row: number, prop: string, row2: number, prop2: string, selectionLayerLevel: number) => void;
|
136
|
+
afterSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
|
135
137
|
afterSetCellMeta?: (row: number, column: number, key: string, value: any) => void;
|
136
138
|
afterSetDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
|
137
139
|
afterSetDataAtRowProp?: (changes: CellChange[], source?: ChangeSource) => void;
|
@@ -206,6 +208,8 @@ export interface Events {
|
|
206
208
|
beforeRenderer?: (TD: HTMLTableCellElement, row: number, column: number, prop: string | number, value: CellValue, cellProperties: CellProperties) => void;
|
207
209
|
beforeRowMove?: (movedRows: number[], finalIndex: number, dropIndex: number | undefined, movePossible: boolean) => void;
|
208
210
|
beforeRowResize?: (newSize: number, row: number, isDoubleClick: boolean) => number | void;
|
211
|
+
beforeSelectColumns?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
|
212
|
+
beforeSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
|
209
213
|
beforeSetCellMeta?: (row: number, col: number, key: string, value: any) => boolean | void;
|
210
214
|
beforeSetRangeEnd?: (coords: CellCoords) => void;
|
211
215
|
beforeSetRangeStart?: (coords: CellCoords) => void;
|