handsontable 0.0.0-next-b02b3d1-20230710 → 0.0.0-next-3b33ccd-20230710
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/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -0
- package/core.js +31 -24
- package/core.mjs +31 -24
- package/dataMap/metaManager/metaSchema.js +0 -22
- package/dataMap/metaManager/metaSchema.mjs +0 -22
- package/dist/handsontable.css +2 -13
- package/dist/handsontable.full.css +2 -13
- package/dist/handsontable.full.js +4811 -4809
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +61 -61
- package/dist/handsontable.js +13683 -13681
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +4 -10
- package/editorManager.mjs +4 -10
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +7 -10
- package/pluginHooks.mjs +7 -10
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +289 -231
- package/plugins/comments/comments.mjs +297 -241
- package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
- package/plugins/comments/contextMenuItem/removeComment.js +48 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.js +1 -0
- package/plugins/contextMenu/contextMenu.mjs +1 -0
- package/plugins/copyPaste/copyPaste.js +1 -1
- package/plugins/copyPaste/copyPaste.mjs +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +0 -1
- package/plugins/dropdownMenu/dropdownMenu.mjs +0 -1
- package/plugins/formulas/engine/settings.js +2 -2
- package/plugins/formulas/engine/settings.mjs +2 -2
- package/plugins/formulas/formulas.js +2 -2
- package/plugins/formulas/formulas.mjs +2 -2
- package/plugins/manualRowResize/manualRowResize.js +2 -2
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/settings.d.ts +0 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +7 -2
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +7 -2
- package/shortcutContexts/constants.js +6 -1
- package/shortcutContexts/constants.mjs +4 -0
- package/tableView.js +9 -4
- package/tableView.mjs +9 -4
- package/core/focusCatcher/focusDetector.js +0 -62
- package/core/focusCatcher/focusDetector.mjs +0 -58
- package/core/focusCatcher/index.js +0 -133
- package/core/focusCatcher/index.mjs +0 -129
- package/core/index.js +0 -12
- package/core/index.mjs +0 -1
package/tableView.js
CHANGED
@@ -356,11 +356,14 @@ var TableView = /*#__PURE__*/function () {
|
|
356
356
|
});
|
357
357
|
this.eventManager.addEventListener(documentElement, 'mouseup', function (event) {
|
358
358
|
if (selection.isInProgress() && (0, _event.isLeftClick)(event)) {
|
359
|
-
// is left mouse button
|
360
359
|
selection.finish();
|
361
360
|
}
|
362
361
|
priv.mouseDown = false;
|
363
|
-
|
362
|
+
var isOutsideInputElement = (0, _element.isOutsideInput)(rootDocument.activeElement);
|
363
|
+
if (!isOutsideInputElement) {
|
364
|
+
return;
|
365
|
+
}
|
366
|
+
if (isOutsideInputElement || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !(0, _event.isRightClick)(event)) {
|
364
367
|
_this.instance.unlisten();
|
365
368
|
}
|
366
369
|
});
|
@@ -912,10 +915,12 @@ var TableView = /*#__PURE__*/function () {
|
|
912
915
|
return _this2.afterRender(force);
|
913
916
|
},
|
914
917
|
onScrollVertically: function onScrollVertically() {
|
915
|
-
|
918
|
+
_this2.instance.runHooks('afterScrollVertically');
|
919
|
+
_this2.instance.runHooks('afterScroll');
|
916
920
|
},
|
917
921
|
onScrollHorizontally: function onScrollHorizontally() {
|
918
|
-
|
922
|
+
_this2.instance.runHooks('afterScrollHorizontally');
|
923
|
+
_this2.instance.runHooks('afterScroll');
|
919
924
|
},
|
920
925
|
onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
|
921
926
|
return _this2.instance.runHooks('beforeRemoveCellClassNames');
|
package/tableView.mjs
CHANGED
@@ -351,11 +351,14 @@ var TableView = /*#__PURE__*/function () {
|
|
351
351
|
});
|
352
352
|
this.eventManager.addEventListener(documentElement, 'mouseup', function (event) {
|
353
353
|
if (selection.isInProgress() && isLeftClick(event)) {
|
354
|
-
// is left mouse button
|
355
354
|
selection.finish();
|
356
355
|
}
|
357
356
|
priv.mouseDown = false;
|
358
|
-
|
357
|
+
var isOutsideInputElement = isOutsideInput(rootDocument.activeElement);
|
358
|
+
if (!isOutsideInputElement) {
|
359
|
+
return;
|
360
|
+
}
|
361
|
+
if (isOutsideInputElement || !selection.isSelected() && !selection.isSelectedByAnyHeader() && !rootElement.contains(event.target) && !isRightClick(event)) {
|
359
362
|
_this.instance.unlisten();
|
360
363
|
}
|
361
364
|
});
|
@@ -907,10 +910,12 @@ var TableView = /*#__PURE__*/function () {
|
|
907
910
|
return _this2.afterRender(force);
|
908
911
|
},
|
909
912
|
onScrollVertically: function onScrollVertically() {
|
910
|
-
|
913
|
+
_this2.instance.runHooks('afterScrollVertically');
|
914
|
+
_this2.instance.runHooks('afterScroll');
|
911
915
|
},
|
912
916
|
onScrollHorizontally: function onScrollHorizontally() {
|
913
|
-
|
917
|
+
_this2.instance.runHooks('afterScrollHorizontally');
|
918
|
+
_this2.instance.runHooks('afterScroll');
|
914
919
|
},
|
915
920
|
onBeforeRemoveCellClassNames: function onBeforeRemoveCellClassNames() {
|
916
921
|
return _this2.instance.runHooks('beforeRemoveCellClassNames');
|
@@ -1,62 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
exports.installFocusDetector = installFocusDetector;
|
5
|
-
/**
|
6
|
-
* Installs a focus detector module. The module appends two input elements into the DOM side by side.
|
7
|
-
* When the first input is focused, then it means that a user entered to the component using the TAB key
|
8
|
-
* from the element above. When the second input is focused, a user enters to the component from
|
9
|
-
* the element below the table. Each action, once detected, triggers the specific hook.
|
10
|
-
*
|
11
|
-
* @param {Handsontable} hot The Handsontable instance.
|
12
|
-
* @param {{ onFocusFromTop: Function, onFocusFromBottom: Function }} hooks An object with defined callbacks to call.
|
13
|
-
* @returns {{ activate: Function, deactivate: Function }}
|
14
|
-
*/
|
15
|
-
function installFocusDetector(hot) {
|
16
|
-
var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
17
|
-
var rootDocument = hot.rootDocument;
|
18
|
-
var rootElement = hot.rootElement;
|
19
|
-
var inputTrapTop = createInputElement(rootDocument);
|
20
|
-
var inputTrapBottom = createInputElement(rootDocument);
|
21
|
-
inputTrapTop.addEventListener('focus', function () {
|
22
|
-
return hooks === null || hooks === void 0 ? void 0 : hooks.onFocusFromTop();
|
23
|
-
});
|
24
|
-
inputTrapBottom.addEventListener('focus', function () {
|
25
|
-
return hooks === null || hooks === void 0 ? void 0 : hooks.onFocusFromBottom();
|
26
|
-
});
|
27
|
-
rootElement.firstChild.before(inputTrapTop);
|
28
|
-
rootElement.lastChild.after(inputTrapBottom);
|
29
|
-
return {
|
30
|
-
/**
|
31
|
-
* Activates the detector by resetting the tabIndex of the input elements.
|
32
|
-
*/
|
33
|
-
activate: function activate() {
|
34
|
-
hot._registerTimeout(function () {
|
35
|
-
inputTrapTop.tabIndex = 0;
|
36
|
-
inputTrapBottom.tabIndex = 0;
|
37
|
-
}, 10);
|
38
|
-
},
|
39
|
-
/**
|
40
|
-
* Deactivates the detector by setting tabIndex to -1.
|
41
|
-
*/
|
42
|
-
deactivate: function deactivate() {
|
43
|
-
hot._registerTimeout(function () {
|
44
|
-
inputTrapTop.tabIndex = -1;
|
45
|
-
inputTrapBottom.tabIndex = -1;
|
46
|
-
}, 10);
|
47
|
-
}
|
48
|
-
};
|
49
|
-
}
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Creates a new HTML input element.
|
53
|
-
*
|
54
|
-
* @param {Document} rootDocument The owner document element.
|
55
|
-
* @returns {HTMLInputElement}
|
56
|
-
*/
|
57
|
-
function createInputElement(rootDocument) {
|
58
|
-
var input = rootDocument.createElement('input');
|
59
|
-
input.type = 'text';
|
60
|
-
input.classList.add('htFocusCatcher');
|
61
|
-
return input;
|
62
|
-
}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Installs a focus detector module. The module appends two input elements into the DOM side by side.
|
3
|
-
* When the first input is focused, then it means that a user entered to the component using the TAB key
|
4
|
-
* from the element above. When the second input is focused, a user enters to the component from
|
5
|
-
* the element below the table. Each action, once detected, triggers the specific hook.
|
6
|
-
*
|
7
|
-
* @param {Handsontable} hot The Handsontable instance.
|
8
|
-
* @param {{ onFocusFromTop: Function, onFocusFromBottom: Function }} hooks An object with defined callbacks to call.
|
9
|
-
* @returns {{ activate: Function, deactivate: Function }}
|
10
|
-
*/
|
11
|
-
export function installFocusDetector(hot) {
|
12
|
-
var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
13
|
-
var rootDocument = hot.rootDocument;
|
14
|
-
var rootElement = hot.rootElement;
|
15
|
-
var inputTrapTop = createInputElement(rootDocument);
|
16
|
-
var inputTrapBottom = createInputElement(rootDocument);
|
17
|
-
inputTrapTop.addEventListener('focus', function () {
|
18
|
-
return hooks === null || hooks === void 0 ? void 0 : hooks.onFocusFromTop();
|
19
|
-
});
|
20
|
-
inputTrapBottom.addEventListener('focus', function () {
|
21
|
-
return hooks === null || hooks === void 0 ? void 0 : hooks.onFocusFromBottom();
|
22
|
-
});
|
23
|
-
rootElement.firstChild.before(inputTrapTop);
|
24
|
-
rootElement.lastChild.after(inputTrapBottom);
|
25
|
-
return {
|
26
|
-
/**
|
27
|
-
* Activates the detector by resetting the tabIndex of the input elements.
|
28
|
-
*/
|
29
|
-
activate: function activate() {
|
30
|
-
hot._registerTimeout(function () {
|
31
|
-
inputTrapTop.tabIndex = 0;
|
32
|
-
inputTrapBottom.tabIndex = 0;
|
33
|
-
}, 10);
|
34
|
-
},
|
35
|
-
/**
|
36
|
-
* Deactivates the detector by setting tabIndex to -1.
|
37
|
-
*/
|
38
|
-
deactivate: function deactivate() {
|
39
|
-
hot._registerTimeout(function () {
|
40
|
-
inputTrapTop.tabIndex = -1;
|
41
|
-
inputTrapBottom.tabIndex = -1;
|
42
|
-
}, 10);
|
43
|
-
}
|
44
|
-
};
|
45
|
-
}
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Creates a new HTML input element.
|
49
|
-
*
|
50
|
-
* @param {Document} rootDocument The owner document element.
|
51
|
-
* @returns {HTMLInputElement}
|
52
|
-
*/
|
53
|
-
function createInputElement(rootDocument) {
|
54
|
-
var input = rootDocument.createElement('input');
|
55
|
-
input.type = 'text';
|
56
|
-
input.classList.add('htFocusCatcher');
|
57
|
-
return input;
|
58
|
-
}
|
@@ -1,133 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
exports.installFocusCatcher = installFocusCatcher;
|
5
|
-
var _shortcutContexts = require("../../shortcutContexts");
|
6
|
-
var _focusDetector = require("./focusDetector");
|
7
|
-
/**
|
8
|
-
* Installs a focus catcher module. The module observes when the table is focused and depending on
|
9
|
-
* from the which side it was focused on it selects a specified cell or releases the TAB navigation
|
10
|
-
* to the browser.
|
11
|
-
*
|
12
|
-
* @param {Core} hot The Handsontable instance.
|
13
|
-
*/
|
14
|
-
function installFocusCatcher(hot) {
|
15
|
-
var recentlyAddedFocusCoords;
|
16
|
-
var _installFocusDetector = (0, _focusDetector.installFocusDetector)(hot, {
|
17
|
-
onFocusFromTop: function onFocusFromTop() {
|
18
|
-
var _recentlyAddedFocusCo;
|
19
|
-
var mostTopStartCoords = (_recentlyAddedFocusCo = recentlyAddedFocusCoords) !== null && _recentlyAddedFocusCo !== void 0 ? _recentlyAddedFocusCo : getMostTopStartPosition(hot);
|
20
|
-
if (mostTopStartCoords) {
|
21
|
-
hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
|
22
|
-
hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
|
23
|
-
}
|
24
|
-
hot.listen();
|
25
|
-
},
|
26
|
-
onFocusFromBottom: function onFocusFromBottom() {
|
27
|
-
var _recentlyAddedFocusCo2;
|
28
|
-
var mostBottomEndCoords = (_recentlyAddedFocusCo2 = recentlyAddedFocusCoords) !== null && _recentlyAddedFocusCo2 !== void 0 ? _recentlyAddedFocusCo2 : getMostBottomEndPosition(hot);
|
29
|
-
if (mostBottomEndCoords) {
|
30
|
-
hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
|
31
|
-
hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
|
32
|
-
}
|
33
|
-
hot.listen();
|
34
|
-
}
|
35
|
-
}),
|
36
|
-
activate = _installFocusDetector.activate,
|
37
|
-
deactivate = _installFocusDetector.deactivate;
|
38
|
-
hot.addHook('afterListen', function () {
|
39
|
-
return deactivate();
|
40
|
-
});
|
41
|
-
hot.addHook('afterUnlisten', function () {
|
42
|
-
return activate();
|
43
|
-
});
|
44
|
-
hot.addHook('afterSelection', function () {
|
45
|
-
var _hot$getSelectedRange;
|
46
|
-
recentlyAddedFocusCoords = (_hot$getSelectedRange = hot.getSelectedRangeLast()) === null || _hot$getSelectedRange === void 0 ? void 0 : _hot$getSelectedRange.highlight;
|
47
|
-
});
|
48
|
-
hot.getShortcutManager().getContext('grid').addShortcut({
|
49
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
50
|
-
callback: function callback(event) {
|
51
|
-
var _hot$getSelectedRange2;
|
52
|
-
var _hot$getSettings = hot.getSettings(),
|
53
|
-
disableTabNavigation = _hot$getSettings.disableTabNavigation,
|
54
|
-
autoWrapRow = _hot$getSettings.autoWrapRow;
|
55
|
-
if (disableTabNavigation) {
|
56
|
-
hot.deselectCell();
|
57
|
-
hot.unlisten();
|
58
|
-
return false;
|
59
|
-
}
|
60
|
-
var isSelected = hot.selection.isSelected();
|
61
|
-
var highlight = (_hot$getSelectedRange2 = hot.getSelectedRangeLast()) === null || _hot$getSelectedRange2 === void 0 ? void 0 : _hot$getSelectedRange2.highlight;
|
62
|
-
var mostTopStartCoords = getMostTopStartPosition(hot);
|
63
|
-
var mostBottomEndCoords = getMostBottomEndPosition(hot);
|
64
|
-
|
65
|
-
// For disabled `autoWrapRow` option set the row to the same position as the currently selected row.
|
66
|
-
if (!autoWrapRow) {
|
67
|
-
mostTopStartCoords.row = highlight.row;
|
68
|
-
mostBottomEndCoords.row = highlight.row;
|
69
|
-
}
|
70
|
-
if (event.shiftKey && (!isSelected || highlight.isEqual(mostTopStartCoords)) || !event.shiftKey && (!isSelected || highlight.isEqual(mostBottomEndCoords))) {
|
71
|
-
hot.deselectCell();
|
72
|
-
hot.unlisten();
|
73
|
-
return false;
|
74
|
-
}
|
75
|
-
return true;
|
76
|
-
},
|
77
|
-
runOnlyIf: function runOnlyIf() {
|
78
|
-
return !hot.getSettings().minSpareCols;
|
79
|
-
},
|
80
|
-
preventDefault: false,
|
81
|
-
stopPropagation: false,
|
82
|
-
position: 'before',
|
83
|
-
relativeToGroup: _shortcutContexts.GRID_GROUP,
|
84
|
-
group: 'focusCatcher'
|
85
|
-
});
|
86
|
-
}
|
87
|
-
|
88
|
-
/**
|
89
|
-
* Gets the coordinates of the most top-start cell or header (depends on the table settings and its size).
|
90
|
-
*
|
91
|
-
* @param {Core} hot The Handsontable instance.
|
92
|
-
* @returns {CellCoords|null}
|
93
|
-
*/
|
94
|
-
function getMostTopStartPosition(hot) {
|
95
|
-
var rowIndexMapper = hot.rowIndexMapper,
|
96
|
-
columnIndexMapper = hot.columnIndexMapper;
|
97
|
-
var _hot$getSettings2 = hot.getSettings(),
|
98
|
-
navigableHeaders = _hot$getSettings2.navigableHeaders;
|
99
|
-
var topRow = navigableHeaders && hot.countColHeaders() > 0 ? -hot.countColHeaders() : 0;
|
100
|
-
var startColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -hot.countRowHeaders() : 0;
|
101
|
-
topRow = topRow === 0 ? rowIndexMapper.getVisualFromRenderableIndex(topRow) : topRow;
|
102
|
-
startColumn = startColumn === 0 ? columnIndexMapper.getVisualFromRenderableIndex(startColumn) : startColumn;
|
103
|
-
if (topRow === null || startColumn === null) {
|
104
|
-
return null;
|
105
|
-
}
|
106
|
-
return hot._createCellCoords(topRow, startColumn);
|
107
|
-
}
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Gets the coordinates of the most bottom-end cell or header (depends on the table settings and its size).
|
111
|
-
*
|
112
|
-
* @param {Core} hot The Handsontable instance.
|
113
|
-
* @returns {CellCoords|null}
|
114
|
-
*/
|
115
|
-
function getMostBottomEndPosition(hot) {
|
116
|
-
var _rowIndexMapper$getVi, _columnIndexMapper$ge;
|
117
|
-
var rowIndexMapper = hot.rowIndexMapper,
|
118
|
-
columnIndexMapper = hot.columnIndexMapper;
|
119
|
-
var _hot$getSettings3 = hot.getSettings(),
|
120
|
-
navigableHeaders = _hot$getSettings3.navigableHeaders;
|
121
|
-
var bottomRow = rowIndexMapper.getRenderableIndexesLength() - 1;
|
122
|
-
var endColumn = columnIndexMapper.getRenderableIndexesLength() - 1;
|
123
|
-
if (bottomRow < 0) {
|
124
|
-
bottomRow = navigableHeaders && hot.countColHeaders() > 0 ? -1 : null;
|
125
|
-
}
|
126
|
-
if (endColumn < 0) {
|
127
|
-
endColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -1 : null;
|
128
|
-
}
|
129
|
-
if (bottomRow === null || endColumn === null) {
|
130
|
-
return null;
|
131
|
-
}
|
132
|
-
return hot._createCellCoords((_rowIndexMapper$getVi = rowIndexMapper.getVisualFromRenderableIndex(bottomRow)) !== null && _rowIndexMapper$getVi !== void 0 ? _rowIndexMapper$getVi : bottomRow, (_columnIndexMapper$ge = columnIndexMapper.getVisualFromRenderableIndex(endColumn)) !== null && _columnIndexMapper$ge !== void 0 ? _columnIndexMapper$ge : endColumn);
|
133
|
-
}
|
@@ -1,129 +0,0 @@
|
|
1
|
-
import { GRID_GROUP } from "../../shortcutContexts/index.mjs";
|
2
|
-
import { installFocusDetector } from "./focusDetector.mjs";
|
3
|
-
/**
|
4
|
-
* Installs a focus catcher module. The module observes when the table is focused and depending on
|
5
|
-
* from the which side it was focused on it selects a specified cell or releases the TAB navigation
|
6
|
-
* to the browser.
|
7
|
-
*
|
8
|
-
* @param {Core} hot The Handsontable instance.
|
9
|
-
*/
|
10
|
-
export function installFocusCatcher(hot) {
|
11
|
-
var recentlyAddedFocusCoords;
|
12
|
-
var _installFocusDetector = installFocusDetector(hot, {
|
13
|
-
onFocusFromTop: function onFocusFromTop() {
|
14
|
-
var _recentlyAddedFocusCo;
|
15
|
-
var mostTopStartCoords = (_recentlyAddedFocusCo = recentlyAddedFocusCoords) !== null && _recentlyAddedFocusCo !== void 0 ? _recentlyAddedFocusCo : getMostTopStartPosition(hot);
|
16
|
-
if (mostTopStartCoords) {
|
17
|
-
hot.runHooks('modifyFocusOnTabNavigation', 'from_above', mostTopStartCoords);
|
18
|
-
hot.selectCell(mostTopStartCoords.row, mostTopStartCoords.col);
|
19
|
-
}
|
20
|
-
hot.listen();
|
21
|
-
},
|
22
|
-
onFocusFromBottom: function onFocusFromBottom() {
|
23
|
-
var _recentlyAddedFocusCo2;
|
24
|
-
var mostBottomEndCoords = (_recentlyAddedFocusCo2 = recentlyAddedFocusCoords) !== null && _recentlyAddedFocusCo2 !== void 0 ? _recentlyAddedFocusCo2 : getMostBottomEndPosition(hot);
|
25
|
-
if (mostBottomEndCoords) {
|
26
|
-
hot.runHooks('modifyFocusOnTabNavigation', 'from_below', mostBottomEndCoords);
|
27
|
-
hot.selectCell(mostBottomEndCoords.row, mostBottomEndCoords.col);
|
28
|
-
}
|
29
|
-
hot.listen();
|
30
|
-
}
|
31
|
-
}),
|
32
|
-
activate = _installFocusDetector.activate,
|
33
|
-
deactivate = _installFocusDetector.deactivate;
|
34
|
-
hot.addHook('afterListen', function () {
|
35
|
-
return deactivate();
|
36
|
-
});
|
37
|
-
hot.addHook('afterUnlisten', function () {
|
38
|
-
return activate();
|
39
|
-
});
|
40
|
-
hot.addHook('afterSelection', function () {
|
41
|
-
var _hot$getSelectedRange;
|
42
|
-
recentlyAddedFocusCoords = (_hot$getSelectedRange = hot.getSelectedRangeLast()) === null || _hot$getSelectedRange === void 0 ? void 0 : _hot$getSelectedRange.highlight;
|
43
|
-
});
|
44
|
-
hot.getShortcutManager().getContext('grid').addShortcut({
|
45
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
46
|
-
callback: function callback(event) {
|
47
|
-
var _hot$getSelectedRange2;
|
48
|
-
var _hot$getSettings = hot.getSettings(),
|
49
|
-
disableTabNavigation = _hot$getSettings.disableTabNavigation,
|
50
|
-
autoWrapRow = _hot$getSettings.autoWrapRow;
|
51
|
-
if (disableTabNavigation) {
|
52
|
-
hot.deselectCell();
|
53
|
-
hot.unlisten();
|
54
|
-
return false;
|
55
|
-
}
|
56
|
-
var isSelected = hot.selection.isSelected();
|
57
|
-
var highlight = (_hot$getSelectedRange2 = hot.getSelectedRangeLast()) === null || _hot$getSelectedRange2 === void 0 ? void 0 : _hot$getSelectedRange2.highlight;
|
58
|
-
var mostTopStartCoords = getMostTopStartPosition(hot);
|
59
|
-
var mostBottomEndCoords = getMostBottomEndPosition(hot);
|
60
|
-
|
61
|
-
// For disabled `autoWrapRow` option set the row to the same position as the currently selected row.
|
62
|
-
if (!autoWrapRow) {
|
63
|
-
mostTopStartCoords.row = highlight.row;
|
64
|
-
mostBottomEndCoords.row = highlight.row;
|
65
|
-
}
|
66
|
-
if (event.shiftKey && (!isSelected || highlight.isEqual(mostTopStartCoords)) || !event.shiftKey && (!isSelected || highlight.isEqual(mostBottomEndCoords))) {
|
67
|
-
hot.deselectCell();
|
68
|
-
hot.unlisten();
|
69
|
-
return false;
|
70
|
-
}
|
71
|
-
return true;
|
72
|
-
},
|
73
|
-
runOnlyIf: function runOnlyIf() {
|
74
|
-
return !hot.getSettings().minSpareCols;
|
75
|
-
},
|
76
|
-
preventDefault: false,
|
77
|
-
stopPropagation: false,
|
78
|
-
position: 'before',
|
79
|
-
relativeToGroup: GRID_GROUP,
|
80
|
-
group: 'focusCatcher'
|
81
|
-
});
|
82
|
-
}
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Gets the coordinates of the most top-start cell or header (depends on the table settings and its size).
|
86
|
-
*
|
87
|
-
* @param {Core} hot The Handsontable instance.
|
88
|
-
* @returns {CellCoords|null}
|
89
|
-
*/
|
90
|
-
function getMostTopStartPosition(hot) {
|
91
|
-
var rowIndexMapper = hot.rowIndexMapper,
|
92
|
-
columnIndexMapper = hot.columnIndexMapper;
|
93
|
-
var _hot$getSettings2 = hot.getSettings(),
|
94
|
-
navigableHeaders = _hot$getSettings2.navigableHeaders;
|
95
|
-
var topRow = navigableHeaders && hot.countColHeaders() > 0 ? -hot.countColHeaders() : 0;
|
96
|
-
var startColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -hot.countRowHeaders() : 0;
|
97
|
-
topRow = topRow === 0 ? rowIndexMapper.getVisualFromRenderableIndex(topRow) : topRow;
|
98
|
-
startColumn = startColumn === 0 ? columnIndexMapper.getVisualFromRenderableIndex(startColumn) : startColumn;
|
99
|
-
if (topRow === null || startColumn === null) {
|
100
|
-
return null;
|
101
|
-
}
|
102
|
-
return hot._createCellCoords(topRow, startColumn);
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Gets the coordinates of the most bottom-end cell or header (depends on the table settings and its size).
|
107
|
-
*
|
108
|
-
* @param {Core} hot The Handsontable instance.
|
109
|
-
* @returns {CellCoords|null}
|
110
|
-
*/
|
111
|
-
function getMostBottomEndPosition(hot) {
|
112
|
-
var _rowIndexMapper$getVi, _columnIndexMapper$ge;
|
113
|
-
var rowIndexMapper = hot.rowIndexMapper,
|
114
|
-
columnIndexMapper = hot.columnIndexMapper;
|
115
|
-
var _hot$getSettings3 = hot.getSettings(),
|
116
|
-
navigableHeaders = _hot$getSettings3.navigableHeaders;
|
117
|
-
var bottomRow = rowIndexMapper.getRenderableIndexesLength() - 1;
|
118
|
-
var endColumn = columnIndexMapper.getRenderableIndexesLength() - 1;
|
119
|
-
if (bottomRow < 0) {
|
120
|
-
bottomRow = navigableHeaders && hot.countColHeaders() > 0 ? -1 : null;
|
121
|
-
}
|
122
|
-
if (endColumn < 0) {
|
123
|
-
endColumn = navigableHeaders && hot.countRowHeaders() > 0 ? -1 : null;
|
124
|
-
}
|
125
|
-
if (bottomRow === null || endColumn === null) {
|
126
|
-
return null;
|
127
|
-
}
|
128
|
-
return hot._createCellCoords((_rowIndexMapper$getVi = rowIndexMapper.getVisualFromRenderableIndex(bottomRow)) !== null && _rowIndexMapper$getVi !== void 0 ? _rowIndexMapper$getVi : bottomRow, (_columnIndexMapper$ge = columnIndexMapper.getVisualFromRenderableIndex(endColumn)) !== null && _columnIndexMapper$ge !== void 0 ? _columnIndexMapper$ge : endColumn);
|
129
|
-
}
|
package/core/index.js
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
require("core-js/modules/es.object.to-string.js");
|
4
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
5
|
-
require("core-js/modules/es.object.keys.js");
|
6
|
-
exports.__esModule = true;
|
7
|
-
var _focusCatcher = require("./focusCatcher");
|
8
|
-
Object.keys(_focusCatcher).forEach(function (key) {
|
9
|
-
if (key === "default" || key === "__esModule") return;
|
10
|
-
if (key in exports && exports[key] === _focusCatcher[key]) return;
|
11
|
-
exports[key] = _focusCatcher[key];
|
12
|
-
});
|
package/core/index.mjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from "./focusCatcher/index.mjs";
|