handsontable 0.0.0-next-086cb13-20230613 → 0.0.0-next-ac97c93-20230617
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/{selection/border/border.js → border.js} +12 -7
- package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
- package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
- package/3rdparty/walkontable/src/cell/coords.js +12 -61
- package/3rdparty/walkontable/src/cell/coords.mjs +12 -61
- package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
- package/3rdparty/walkontable/src/cell/range.js +7 -44
- package/3rdparty/walkontable/src/cell/range.mjs +7 -44
- package/3rdparty/walkontable/src/core/_base.js +3 -9
- package/3rdparty/walkontable/src/core/_base.mjs +3 -9
- 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 +2 -3
- package/3rdparty/walkontable/src/core/core.mjs +2 -3
- 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 +2 -10
- 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 +4 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
- package/3rdparty/walkontable/src/overlay/top.js +4 -2
- package/3rdparty/walkontable/src/overlay/top.mjs +4 -2
- package/3rdparty/walkontable/src/selection.js +355 -0
- package/3rdparty/walkontable/src/selection.mjs +349 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
- package/3rdparty/walkontable/src/table.js +79 -7
- package/3rdparty/walkontable/src/table.mjs +80 -8
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/common.d.ts +1 -1
- package/core.d.ts +6 -9
- package/core.js +390 -235
- package/core.mjs +395 -240
- package/dataMap/metaManager/metaSchema.js +0 -19
- package/dataMap/metaManager/metaSchema.mjs +0 -19
- package/dist/handsontable.css +3 -8
- package/dist/handsontable.full.css +3 -8
- package/dist/handsontable.full.js +10189 -12963
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +112 -112
- package/dist/handsontable.js +13133 -15907
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +82 -21
- package/editorManager.mjs +86 -26
- package/editors/textEditor/textEditor.js +11 -3
- package/editors/textEditor/textEditor.mjs +12 -4
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +0 -1
- package/helpers/number.js +0 -18
- package/helpers/number.mjs +0 -17
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -6
- package/pluginHooks.js +1 -100
- package/pluginHooks.mjs +1 -100
- package/plugins/autofill/autofill.js +1 -2
- package/plugins/autofill/autofill.mjs +2 -3
- package/plugins/autofill/utils.js +1 -39
- package/plugins/autofill/utils.mjs +0 -37
- package/plugins/collapsibleColumns/collapsibleColumns.js +24 -81
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -81
- package/plugins/copyPaste/copyPaste.js +1 -5
- package/plugins/copyPaste/copyPaste.mjs +1 -5
- package/plugins/customBorders/customBorders.js +53 -18
- package/plugins/customBorders/customBorders.mjs +54 -19
- package/plugins/mergeCells/mergeCells.js +18 -5
- package/plugins/mergeCells/mergeCells.mjs +18 -5
- package/plugins/nestedHeaders/nestedHeaders.js +10 -132
- package/plugins/nestedHeaders/nestedHeaders.mjs +10 -132
- package/plugins/nestedHeaders/stateManager/index.js +0 -37
- package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +89 -312
- package/selection/highlight/highlight.mjs +85 -302
- package/selection/highlight/types/activeHeader.js +9 -10
- package/selection/highlight/types/activeHeader.mjs +8 -10
- package/selection/highlight/types/area.js +27 -12
- package/selection/highlight/types/area.mjs +30 -16
- package/selection/highlight/types/{focus.js → cell.js} +8 -5
- package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
- package/selection/highlight/types/customSelection.js +10 -7
- package/selection/highlight/types/customSelection.mjs +9 -7
- package/selection/highlight/types/fill.js +8 -5
- package/selection/highlight/types/fill.mjs +7 -5
- package/selection/highlight/types/header.js +20 -10
- package/selection/highlight/types/header.mjs +19 -10
- package/selection/highlight/types/{row.js → index.js} +31 -27
- package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
- package/selection/highlight/visualSelection.js +27 -31
- package/selection/highlight/visualSelection.mjs +27 -31
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- 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 +181 -315
- package/selection/selection.mjs +180 -310
- package/selection/transformation.js +96 -233
- package/selection/transformation.mjs +93 -230
- package/selection/utils.js +36 -12
- package/selection/utils.mjs +36 -13
- package/settings.d.ts +0 -1
- package/shortcuts/manager.js +0 -2
- package/shortcuts/manager.mjs +0 -2
- package/tableView.js +9 -58
- package/tableView.mjs +9 -58
- package/translations/indexMapper.js +7 -56
- package/translations/indexMapper.mjs +8 -56
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
- package/3rdparty/walkontable/src/selection/constants.js +0 -63
- package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
- package/3rdparty/walkontable/src/selection/index.js +0 -30
- package/3rdparty/walkontable/src/selection/index.mjs +0 -5
- package/3rdparty/walkontable/src/selection/manager.js +0 -329
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -323
- package/3rdparty/walkontable/src/selection/scanner.js +0 -364
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -360
- package/3rdparty/walkontable/src/selection/selection.js +0 -133
- package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
- package/selection/highlight/types/areaLayered.js +0 -54
- package/selection/highlight/types/areaLayered.mjs +0 -49
- package/selection/highlight/types/column.js +0 -50
- package/selection/highlight/types/column.mjs +0 -45
- package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
- package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
- package/shortcutContexts/commands/editor/fastOpen.js +0 -16
- package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
- package/shortcutContexts/commands/editor/index.js +0 -16
- package/shortcutContexts/commands/editor/index.mjs +0 -12
- package/shortcutContexts/commands/editor/open.js +0 -29
- package/shortcutContexts/commands/editor/open.mjs +0 -24
- package/shortcutContexts/commands/emptySelectedCells.js +0 -12
- package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
- package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
- package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
- package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -14
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -40
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -35
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -40
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -35
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -14
- package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
- package/shortcutContexts/commands/index.js +0 -52
- package/shortcutContexts/commands/index.mjs +0 -48
- package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
- package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -29
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -24
- package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
- package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
- package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
- package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
- package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -36
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -31
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -36
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -31
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
- package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
- package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -29
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -24
- package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
- package/shortcutContexts/commands/selectAll.js +0 -11
- package/shortcutContexts/commands/selectAll.mjs +0 -6
- package/shortcutContexts/constants.js +0 -19
- package/shortcutContexts/constants.mjs +0 -12
- package/shortcutContexts/editor.js +0 -29
- package/shortcutContexts/editor.mjs +0 -25
- package/shortcutContexts/grid.js +0 -244
- package/shortcutContexts/grid.mjs +0 -240
- package/shortcutContexts/index.js +0 -29
- package/shortcutContexts/index.mjs +0 -15
package/editorManager.js
CHANGED
@@ -7,7 +7,9 @@ require("core-js/modules/es.function.name.js");
|
|
7
7
|
require("core-js/modules/es.array.from.js");
|
8
8
|
require("core-js/modules/es.regexp.exec.js");
|
9
9
|
exports.__esModule = true;
|
10
|
-
exports.default = exports.SHORTCUTS_GROUP_NAVIGATION = void 0;
|
10
|
+
exports.default = exports.SHORTCUTS_GROUP_NAVIGATION = exports.SHORTCUTS_GROUP_EDITOR = void 0;
|
11
|
+
require("core-js/modules/es.array.includes.js");
|
12
|
+
require("core-js/modules/es.string.includes.js");
|
11
13
|
require("core-js/modules/es.symbol.to-primitive.js");
|
12
14
|
require("core-js/modules/es.date.to-primitive.js");
|
13
15
|
require("core-js/modules/es.symbol.js");
|
@@ -19,8 +21,8 @@ require("core-js/modules/es.string.iterator.js");
|
|
19
21
|
require("core-js/modules/es.weak-map.js");
|
20
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
21
23
|
var _unicode = require("./helpers/unicode");
|
22
|
-
var _element = require("./helpers/dom/element");
|
23
24
|
var _event = require("./helpers/dom/event");
|
25
|
+
var _element = require("./helpers/dom/element");
|
24
26
|
var _registry = require("./editors/registry");
|
25
27
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
26
28
|
var _mixed = require("./helpers/mixed");
|
@@ -39,6 +41,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
39
41
|
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); }
|
40
42
|
var SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
41
43
|
exports.SHORTCUTS_GROUP_NAVIGATION = SHORTCUTS_GROUP_NAVIGATION;
|
44
|
+
var SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
45
|
+
exports.SHORTCUTS_GROUP_EDITOR = SHORTCUTS_GROUP_EDITOR;
|
42
46
|
var EditorManager = /*#__PURE__*/function () {
|
43
47
|
/**
|
44
48
|
* @param {Core} instance The Handsontable instance.
|
@@ -103,6 +107,9 @@ var EditorManager = /*#__PURE__*/function () {
|
|
103
107
|
* @type {object}
|
104
108
|
*/
|
105
109
|
this.cellProperties = void 0;
|
110
|
+
var shortcutManager = this.instance.getShortcutManager();
|
111
|
+
shortcutManager.addContext('editor');
|
112
|
+
this.registerShortcuts();
|
106
113
|
this.instance.addHook('afterDocumentKeyDown', function (event) {
|
107
114
|
return _this.onAfterDocumentKeyDown(event);
|
108
115
|
});
|
@@ -119,10 +126,66 @@ var EditorManager = /*#__PURE__*/function () {
|
|
119
126
|
}
|
120
127
|
|
121
128
|
/**
|
122
|
-
*
|
123
|
-
*
|
129
|
+
* Register shortcuts responsible for handling some actions related to an editor.
|
130
|
+
*
|
131
|
+
* @private
|
124
132
|
*/
|
125
133
|
_createClass(EditorManager, [{
|
134
|
+
key: "registerShortcuts",
|
135
|
+
value: function registerShortcuts() {
|
136
|
+
var _this2 = this;
|
137
|
+
var shortcutManager = this.instance.getShortcutManager();
|
138
|
+
var gridContext = shortcutManager.getContext('grid');
|
139
|
+
var editorContext = shortcutManager.getContext('editor');
|
140
|
+
var config = {
|
141
|
+
group: SHORTCUTS_GROUP_EDITOR
|
142
|
+
};
|
143
|
+
editorContext.addShortcuts([{
|
144
|
+
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
145
|
+
callback: function callback(event, keys) {
|
146
|
+
_this2.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
147
|
+
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
148
|
+
}
|
149
|
+
}, {
|
150
|
+
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
151
|
+
callback: function callback() {
|
152
|
+
_this2.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
153
|
+
_this2.activeEditor.focus();
|
154
|
+
}
|
155
|
+
}], config);
|
156
|
+
gridContext.addShortcuts([{
|
157
|
+
keys: [['F2']],
|
158
|
+
callback: function callback(event) {
|
159
|
+
_this2.openEditor(null, event, true);
|
160
|
+
}
|
161
|
+
}, {
|
162
|
+
keys: [['Backspace'], ['Delete']],
|
163
|
+
callback: function callback() {
|
164
|
+
_this2.instance.emptySelectedCells();
|
165
|
+
_this2.prepareEditor();
|
166
|
+
}
|
167
|
+
}, {
|
168
|
+
keys: [['Enter'], ['Enter', 'Shift']],
|
169
|
+
callback: function callback(event, keys) {
|
170
|
+
if (_this2.instance.getSettings().enterBeginsEditing) {
|
171
|
+
if (_this2.cellProperties.readOnly) {
|
172
|
+
_this2.moveSelectionAfterEnter();
|
173
|
+
} else {
|
174
|
+
_this2.openEditor(null, event, true);
|
175
|
+
}
|
176
|
+
} else {
|
177
|
+
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
178
|
+
}
|
179
|
+
(0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
|
180
|
+
}
|
181
|
+
}], config);
|
182
|
+
}
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
186
|
+
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
187
|
+
*/
|
188
|
+
}, {
|
126
189
|
key: "lockEditor",
|
127
190
|
value: function lockEditor() {
|
128
191
|
this.lock = true;
|
@@ -169,25 +232,21 @@ var EditorManager = /*#__PURE__*/function () {
|
|
169
232
|
}, {
|
170
233
|
key: "prepareEditor",
|
171
234
|
value: function prepareEditor() {
|
172
|
-
var
|
235
|
+
var _this3 = this;
|
173
236
|
if (this.lock) {
|
174
237
|
return;
|
175
238
|
}
|
176
239
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
177
240
|
this.closeEditor(false, false, function (dataSaved) {
|
178
241
|
if (dataSaved) {
|
179
|
-
|
242
|
+
_this3.prepareEditor();
|
180
243
|
}
|
181
244
|
});
|
182
245
|
return;
|
183
246
|
}
|
184
|
-
var _this$instance$getSel = this.instance.getSelectedRangeLast(),
|
185
|
-
|
186
|
-
|
187
|
-
return;
|
188
|
-
}
|
189
|
-
var row = highlight.row,
|
190
|
-
col = highlight.col;
|
247
|
+
var _this$instance$getSel = this.instance.getSelectedRangeLast().highlight,
|
248
|
+
row = _this$instance$getSel.row,
|
249
|
+
col = _this$instance$getSel.col;
|
191
250
|
var modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
192
251
|
var visualRowToCheck = row;
|
193
252
|
var visualColumnToCheck = col;
|
@@ -377,12 +436,14 @@ var EditorManager = /*#__PURE__*/function () {
|
|
377
436
|
}, {
|
378
437
|
key: "onAfterDocumentKeyDown",
|
379
438
|
value: function onAfterDocumentKeyDown(event) {
|
380
|
-
var
|
381
|
-
|
382
|
-
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || (0, _event.isImmediatePropagationStopped)(event)) {
|
439
|
+
var _this4 = this;
|
440
|
+
if (!this.instance.isListening()) {
|
383
441
|
return;
|
384
442
|
}
|
385
443
|
var keyCode = event.keyCode;
|
444
|
+
if (!this.selection.isSelected()) {
|
445
|
+
return;
|
446
|
+
}
|
386
447
|
|
387
448
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
388
449
|
var isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
@@ -392,29 +453,29 @@ var EditorManager = /*#__PURE__*/function () {
|
|
392
453
|
var editorContext = shortcutManager.getContext('editor');
|
393
454
|
var runOnlySelectedConfig = {
|
394
455
|
runOnlyIf: function runOnlyIf() {
|
395
|
-
return (0, _mixed.isDefined)(
|
456
|
+
return (0, _mixed.isDefined)(_this4.instance.getSelected());
|
396
457
|
},
|
397
458
|
group: SHORTCUTS_GROUP_NAVIGATION
|
398
459
|
};
|
399
460
|
editorContext.addShortcuts([{
|
400
461
|
keys: [['ArrowUp']],
|
401
462
|
callback: function callback() {
|
402
|
-
|
463
|
+
_this4.instance.selection.transformStart(-1, 0);
|
403
464
|
}
|
404
465
|
}, {
|
405
466
|
keys: [['ArrowDown']],
|
406
467
|
callback: function callback() {
|
407
|
-
|
468
|
+
_this4.instance.selection.transformStart(1, 0);
|
408
469
|
}
|
409
470
|
}, {
|
410
471
|
keys: [['ArrowLeft']],
|
411
472
|
callback: function callback() {
|
412
|
-
|
473
|
+
_this4.instance.selection.transformStart(0, -1 * _this4.instance.getDirectionFactor());
|
413
474
|
}
|
414
475
|
}, {
|
415
476
|
keys: [['ArrowRight']],
|
416
477
|
callback: function callback() {
|
417
|
-
|
478
|
+
_this4.instance.selection.transformStart(0, _this4.instance.getDirectionFactor());
|
418
479
|
}
|
419
480
|
}], runOnlySelectedConfig);
|
420
481
|
this.openEditor('', event);
|
package/editorManager.mjs
CHANGED
@@ -1,4 +1,12 @@
|
|
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";
|
2
10
|
import "core-js/modules/es.array.iterator.js";
|
3
11
|
import "core-js/modules/es.object.to-string.js";
|
4
12
|
import "core-js/modules/es.string.iterator.js";
|
@@ -15,24 +23,19 @@ import "core-js/modules/es.regexp.to-string.js";
|
|
15
23
|
import "core-js/modules/es.function.name.js";
|
16
24
|
import "core-js/modules/es.array.from.js";
|
17
25
|
import "core-js/modules/es.regexp.exec.js";
|
18
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
19
|
-
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."); }
|
20
|
-
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); }
|
21
|
-
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; }
|
22
|
-
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; } }
|
23
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25
27
|
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); } }
|
26
28
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
27
29
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
28
30
|
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); }
|
29
31
|
import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
32
|
+
import { stopImmediatePropagation } from "./helpers/dom/event.mjs";
|
30
33
|
import { isOutsideInput } from "./helpers/dom/element.mjs";
|
31
|
-
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
32
34
|
import { getEditorInstance } from "./editors/registry.mjs";
|
33
35
|
import EventManager from "./eventManager.mjs";
|
34
36
|
import { isDefined } from "./helpers/mixed.mjs";
|
35
37
|
export var SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
38
|
+
export var SHORTCUTS_GROUP_EDITOR = 'editorManager.handlingEditor';
|
36
39
|
var EditorManager = /*#__PURE__*/function () {
|
37
40
|
/**
|
38
41
|
* @param {Core} instance The Handsontable instance.
|
@@ -97,6 +100,9 @@ var EditorManager = /*#__PURE__*/function () {
|
|
97
100
|
* @type {object}
|
98
101
|
*/
|
99
102
|
this.cellProperties = void 0;
|
103
|
+
var shortcutManager = this.instance.getShortcutManager();
|
104
|
+
shortcutManager.addContext('editor');
|
105
|
+
this.registerShortcuts();
|
100
106
|
this.instance.addHook('afterDocumentKeyDown', function (event) {
|
101
107
|
return _this.onAfterDocumentKeyDown(event);
|
102
108
|
});
|
@@ -113,10 +119,66 @@ var EditorManager = /*#__PURE__*/function () {
|
|
113
119
|
}
|
114
120
|
|
115
121
|
/**
|
116
|
-
*
|
117
|
-
*
|
122
|
+
* Register shortcuts responsible for handling some actions related to an editor.
|
123
|
+
*
|
124
|
+
* @private
|
118
125
|
*/
|
119
126
|
_createClass(EditorManager, [{
|
127
|
+
key: "registerShortcuts",
|
128
|
+
value: function registerShortcuts() {
|
129
|
+
var _this2 = this;
|
130
|
+
var shortcutManager = this.instance.getShortcutManager();
|
131
|
+
var gridContext = shortcutManager.getContext('grid');
|
132
|
+
var editorContext = shortcutManager.getContext('editor');
|
133
|
+
var config = {
|
134
|
+
group: SHORTCUTS_GROUP_EDITOR
|
135
|
+
};
|
136
|
+
editorContext.addShortcuts([{
|
137
|
+
keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
|
138
|
+
callback: function callback(event, keys) {
|
139
|
+
_this2.closeEditorAndSaveChanges(shortcutManager.isCtrlPressed());
|
140
|
+
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
141
|
+
}
|
142
|
+
}, {
|
143
|
+
keys: [['Escape'], ['Escape', 'Control/Meta']],
|
144
|
+
callback: function callback() {
|
145
|
+
_this2.closeEditorAndRestoreOriginalValue(shortcutManager.isCtrlPressed());
|
146
|
+
_this2.activeEditor.focus();
|
147
|
+
}
|
148
|
+
}], config);
|
149
|
+
gridContext.addShortcuts([{
|
150
|
+
keys: [['F2']],
|
151
|
+
callback: function callback(event) {
|
152
|
+
_this2.openEditor(null, event, true);
|
153
|
+
}
|
154
|
+
}, {
|
155
|
+
keys: [['Backspace'], ['Delete']],
|
156
|
+
callback: function callback() {
|
157
|
+
_this2.instance.emptySelectedCells();
|
158
|
+
_this2.prepareEditor();
|
159
|
+
}
|
160
|
+
}, {
|
161
|
+
keys: [['Enter'], ['Enter', 'Shift']],
|
162
|
+
callback: function callback(event, keys) {
|
163
|
+
if (_this2.instance.getSettings().enterBeginsEditing) {
|
164
|
+
if (_this2.cellProperties.readOnly) {
|
165
|
+
_this2.moveSelectionAfterEnter();
|
166
|
+
} else {
|
167
|
+
_this2.openEditor(null, event, true);
|
168
|
+
}
|
169
|
+
} else {
|
170
|
+
_this2.moveSelectionAfterEnter(keys.includes('shift'));
|
171
|
+
}
|
172
|
+
stopImmediatePropagation(event); // required by HandsontableEditor
|
173
|
+
}
|
174
|
+
}], config);
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
179
|
+
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
180
|
+
*/
|
181
|
+
}, {
|
120
182
|
key: "lockEditor",
|
121
183
|
value: function lockEditor() {
|
122
184
|
this.lock = true;
|
@@ -163,25 +225,21 @@ var EditorManager = /*#__PURE__*/function () {
|
|
163
225
|
}, {
|
164
226
|
key: "prepareEditor",
|
165
227
|
value: function prepareEditor() {
|
166
|
-
var
|
228
|
+
var _this3 = this;
|
167
229
|
if (this.lock) {
|
168
230
|
return;
|
169
231
|
}
|
170
232
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
171
233
|
this.closeEditor(false, false, function (dataSaved) {
|
172
234
|
if (dataSaved) {
|
173
|
-
|
235
|
+
_this3.prepareEditor();
|
174
236
|
}
|
175
237
|
});
|
176
238
|
return;
|
177
239
|
}
|
178
|
-
var _this$instance$getSel = this.instance.getSelectedRangeLast(),
|
179
|
-
|
180
|
-
|
181
|
-
return;
|
182
|
-
}
|
183
|
-
var row = highlight.row,
|
184
|
-
col = highlight.col;
|
240
|
+
var _this$instance$getSel = this.instance.getSelectedRangeLast().highlight,
|
241
|
+
row = _this$instance$getSel.row,
|
242
|
+
col = _this$instance$getSel.col;
|
185
243
|
var modifiedCellCoords = this.instance.runHooks('modifyGetCellCoords', row, col);
|
186
244
|
var visualRowToCheck = row;
|
187
245
|
var visualColumnToCheck = col;
|
@@ -371,12 +429,14 @@ var EditorManager = /*#__PURE__*/function () {
|
|
371
429
|
}, {
|
372
430
|
key: "onAfterDocumentKeyDown",
|
373
431
|
value: function onAfterDocumentKeyDown(event) {
|
374
|
-
var
|
375
|
-
|
376
|
-
if (!this.instance.isListening() || !selection || selection.highlight.isHeader() || isImmediatePropagationStopped(event)) {
|
432
|
+
var _this4 = this;
|
433
|
+
if (!this.instance.isListening()) {
|
377
434
|
return;
|
378
435
|
}
|
379
436
|
var keyCode = event.keyCode;
|
437
|
+
if (!this.selection.isSelected()) {
|
438
|
+
return;
|
439
|
+
}
|
380
440
|
|
381
441
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
382
442
|
var isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
@@ -386,29 +446,29 @@ var EditorManager = /*#__PURE__*/function () {
|
|
386
446
|
var editorContext = shortcutManager.getContext('editor');
|
387
447
|
var runOnlySelectedConfig = {
|
388
448
|
runOnlyIf: function runOnlyIf() {
|
389
|
-
return isDefined(
|
449
|
+
return isDefined(_this4.instance.getSelected());
|
390
450
|
},
|
391
451
|
group: SHORTCUTS_GROUP_NAVIGATION
|
392
452
|
};
|
393
453
|
editorContext.addShortcuts([{
|
394
454
|
keys: [['ArrowUp']],
|
395
455
|
callback: function callback() {
|
396
|
-
|
456
|
+
_this4.instance.selection.transformStart(-1, 0);
|
397
457
|
}
|
398
458
|
}, {
|
399
459
|
keys: [['ArrowDown']],
|
400
460
|
callback: function callback() {
|
401
|
-
|
461
|
+
_this4.instance.selection.transformStart(1, 0);
|
402
462
|
}
|
403
463
|
}, {
|
404
464
|
keys: [['ArrowLeft']],
|
405
465
|
callback: function callback() {
|
406
|
-
|
466
|
+
_this4.instance.selection.transformStart(0, -1 * _this4.instance.getDirectionFactor());
|
407
467
|
}
|
408
468
|
}, {
|
409
469
|
keys: [['ArrowRight']],
|
410
470
|
callback: function callback() {
|
411
|
-
|
471
|
+
_this4.instance.selection.transformStart(0, _this4.instance.getDirectionFactor());
|
412
472
|
}
|
413
473
|
}], runOnlySelectedConfig);
|
414
474
|
this.openEditor('', event);
|
@@ -508,7 +508,9 @@ var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
508
508
|
// We trigger a data population for multiple selection.
|
509
509
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
510
510
|
!event.altKey;
|
511
|
-
}
|
511
|
+
},
|
512
|
+
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
513
|
+
position: 'before'
|
512
514
|
}, {
|
513
515
|
keys: [['Meta', 'Enter']],
|
514
516
|
callback: function callback() {
|
@@ -518,13 +520,19 @@ var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
518
520
|
|
519
521
|
runOnlyIf: function runOnlyIf() {
|
520
522
|
return !_this4.hot.selection.isMultiple();
|
521
|
-
}
|
523
|
+
},
|
524
|
+
// We trigger a data population for multiple selection.
|
525
|
+
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
526
|
+
position: 'before'
|
522
527
|
}, {
|
523
528
|
keys: [['Alt', 'Enter']],
|
524
529
|
callback: function callback() {
|
525
530
|
insertNewLine();
|
526
531
|
return false; // Will block closing editor.
|
527
|
-
}
|
532
|
+
},
|
533
|
+
|
534
|
+
relativeToGroup: _editorManager.SHORTCUTS_GROUP_EDITOR,
|
535
|
+
position: 'before'
|
528
536
|
}, {
|
529
537
|
// TODO: Duplicated part of code (callback to shortcut)
|
530
538
|
keys: [['PageUp']],
|
@@ -48,7 +48,7 @@ import { rangeEach } from "../../helpers/number.mjs";
|
|
48
48
|
import { KEY_CODES } from "../../helpers/unicode.mjs";
|
49
49
|
import { autoResize } from "../../3rdparty/autoResize/index.mjs";
|
50
50
|
import { isDefined } from "../../helpers/mixed.mjs";
|
51
|
-
import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
|
51
|
+
import { SHORTCUTS_GROUP_NAVIGATION, SHORTCUTS_GROUP_EDITOR as EDITOR_MANAGER_GROUP } from "../../editorManager.mjs";
|
52
52
|
import { SHORTCUTS_GROUP_EDITOR } from "../baseEditor/baseEditor.mjs";
|
53
53
|
import { updateCaretPosition } from "./caretPositioner.mjs";
|
54
54
|
var EDITOR_VISIBLE_CLASS_NAME = 'ht_editor_visible';
|
@@ -502,7 +502,9 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
502
502
|
// We trigger a data population for multiple selection.
|
503
503
|
// catch CTRL but not right ALT (which in some systems triggers ALT+CTRL)
|
504
504
|
!event.altKey;
|
505
|
-
}
|
505
|
+
},
|
506
|
+
relativeToGroup: EDITOR_MANAGER_GROUP,
|
507
|
+
position: 'before'
|
506
508
|
}, {
|
507
509
|
keys: [['Meta', 'Enter']],
|
508
510
|
callback: function callback() {
|
@@ -512,13 +514,19 @@ export var TextEditor = /*#__PURE__*/function (_BaseEditor) {
|
|
512
514
|
|
513
515
|
runOnlyIf: function runOnlyIf() {
|
514
516
|
return !_this4.hot.selection.isMultiple();
|
515
|
-
}
|
517
|
+
},
|
518
|
+
// We trigger a data population for multiple selection.
|
519
|
+
relativeToGroup: EDITOR_MANAGER_GROUP,
|
520
|
+
position: 'before'
|
516
521
|
}, {
|
517
522
|
keys: [['Alt', 'Enter']],
|
518
523
|
callback: function callback() {
|
519
524
|
insertNewLine();
|
520
525
|
return false; // Will block closing editor.
|
521
|
-
}
|
526
|
+
},
|
527
|
+
|
528
|
+
relativeToGroup: EDITOR_MANAGER_GROUP,
|
529
|
+
position: 'before'
|
522
530
|
}, {
|
523
531
|
// TODO: Duplicated part of code (callback to shortcut)
|
524
532
|
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-ac97c93-20230617";
|
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-ac97c93-20230617";
|
146
146
|
var keyValidityDate;
|
147
147
|
var consoleMessageState = 'invalid';
|
148
148
|
var domMessageState = 'invalid';
|
package/helpers/number.d.ts
CHANGED
@@ -3,4 +3,3 @@ 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,7 +3,6 @@
|
|
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;
|
7
6
|
exports.isNumeric = isNumeric;
|
8
7
|
exports.isNumericLike = isNumericLike;
|
9
8
|
exports.rangeEach = rangeEach;
|
@@ -140,21 +139,4 @@ function valueAccordingPercent(value, percent) {
|
|
140
139
|
percent = parseInt(percent.toString().replace('%', ''), 10);
|
141
140
|
percent = isNaN(percent) ? 0 : percent;
|
142
141
|
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;
|
160
142
|
}
|
package/helpers/number.mjs
CHANGED
@@ -131,21 +131,4 @@ 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;
|
151
134
|
}
|
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-ac97c93-20230617",
|
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
|
-
afterOnCellMouseOut?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
114
113
|
afterOnCellMouseOver?: (event: MouseEvent, coords: CellCoords, TD: HTMLTableCellElement) => void;
|
114
|
+
afterOnCellMouseOut?: (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,12 +128,10 @@ 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;
|
132
131
|
afterSelection?: (row: number, column: number, row2: number, column2: number, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
|
133
132
|
afterSelectionByProp?: (row: number, prop: string, row2: number, prop2: string, preventScrolling: { value: boolean }, selectionLayerLevel: number) => void;
|
134
133
|
afterSelectionEnd?: (row: number, column: number, row2: number, column2: number, selectionLayerLevel: number) => void;
|
135
134
|
afterSelectionEndByProp?: (row: number, prop: string, row2: number, prop2: string, selectionLayerLevel: number) => void;
|
136
|
-
afterSelectRows?: (from: CellCoords, to: CellCoords, highlight: CellCoords) => void;
|
137
135
|
afterSetCellMeta?: (row: number, column: number, key: string, value: any) => void;
|
138
136
|
afterSetDataAtCell?: (changes: CellChange[], source?: ChangeSource) => void;
|
139
137
|
afterSetDataAtRowProp?: (changes: CellChange[], source?: ChangeSource) => void;
|
@@ -157,7 +155,6 @@ export interface Events {
|
|
157
155
|
afterViewRender?: (isForced: boolean) => void;
|
158
156
|
beforeAddChild?: (parent: RowObject, element?: RowObject, index?: number) => void;
|
159
157
|
beforeAutofill?: (selectionData: CellValue[][], sourceRange: CellRange, targetRange: CellRange, direction: 'up' | 'down' | 'left' | 'right') => CellValue[][] | boolean | void;
|
160
|
-
beforeAutofillInsidePopulate?: (index: CellCoords, direction: 'up' | 'down' | 'left' | 'right', input: CellValue[][], deltas: any[]) => void;
|
161
158
|
beforeCellAlignment?: (stateBefore: { [row: number]: string[] }, range: CellRange[], type: 'horizontal' | 'vertical',
|
162
159
|
alignmentClass: 'htLeft' | 'htCenter' | 'htRight' | 'htJustify' | 'htTop' | 'htMiddle' | 'htBottom') => void;
|
163
160
|
beforeChange?: (changes: Array<CellChange | null>, source: ChangeSource) => void | boolean;
|
@@ -208,8 +205,6 @@ export interface Events {
|
|
208
205
|
beforeRenderer?: (TD: HTMLTableCellElement, row: number, column: number, prop: string | number, value: CellValue, cellProperties: CellProperties) => void;
|
209
206
|
beforeRowMove?: (movedRows: number[], finalIndex: number, dropIndex: number | undefined, movePossible: boolean) => void;
|
210
207
|
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;
|
213
208
|
beforeSetCellMeta?: (row: number, col: number, key: string, value: any) => boolean | void;
|
214
209
|
beforeSetRangeEnd?: (coords: CellCoords) => void;
|
215
210
|
beforeSetRangeStart?: (coords: CellCoords) => void;
|