handsontable 0.0.0-next-6d7bdba-20230620 → 0.0.0-next-af5139c-20230620
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/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2066 -2286
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +77 -77
- package/dist/handsontable.js +1982 -2202
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +4 -4
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/comments/comments.js +4 -11
- package/plugins/comments/comments.mjs +4 -11
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +29 -80
- package/plugins/contextMenu/contextMenu.mjs +30 -81
- package/plugins/contextMenu/predefinedItems/alignment.js +0 -7
- package/plugins/contextMenu/predefinedItems/alignment.mjs +0 -7
- package/plugins/contextMenu/predefinedItems/clearColumn.js +3 -5
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -5
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/columnRight.js +3 -5
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/readOnly.js +0 -7
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -7
- package/plugins/contextMenu/predefinedItems/removeColumn.js +5 -7
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/removeRow.js +5 -7
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -5
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -5
- package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -5
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -5
- package/plugins/contextMenu/utils.js +16 -25
- package/plugins/contextMenu/utils.mjs +15 -24
- package/plugins/copyPaste/contextMenuItem/copy.js +0 -7
- package/plugins/copyPaste/contextMenuItem/copy.mjs +0 -7
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +1 -9
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/cut.js +0 -7
- package/plugins/copyPaste/contextMenuItem/cut.mjs +0 -7
- package/plugins/customBorders/customBorders.js +0 -7
- package/plugins/customBorders/customBorders.mjs +0 -7
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +30 -94
- package/plugins/dropdownMenu/dropdownMenu.mjs +30 -94
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +5 -21
- package/shortcuts/utils.mjs +4 -20
@@ -36,13 +36,6 @@ export default function readOnlyItem() {
|
|
36
36
|
this.render();
|
37
37
|
},
|
38
38
|
disabled: function disabled() {
|
39
|
-
var range = this.getSelectedRangeLast();
|
40
|
-
if (!range) {
|
41
|
-
return true;
|
42
|
-
}
|
43
|
-
if (range.isSingleHeader()) {
|
44
|
-
return true;
|
45
|
-
}
|
46
39
|
if (this.selection.isSelectedByCorner()) {
|
47
40
|
return true;
|
48
41
|
}
|
@@ -18,7 +18,8 @@ require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
18
18
|
exports.__esModule = true;
|
19
19
|
exports.KEY = void 0;
|
20
20
|
exports.default = removeColumnItem;
|
21
|
-
var _utils = require("
|
21
|
+
var _utils = require("../utils");
|
22
|
+
var _utils2 = require("../../../selection/utils");
|
22
23
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -55,17 +56,14 @@ function removeColumnItem() {
|
|
55
56
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COLUMN, pluralForm);
|
56
57
|
},
|
57
58
|
callback: function callback() {
|
58
|
-
this.alter('remove_col', (0,
|
59
|
+
this.alter('remove_col', (0, _utils2.transformSelectionToColumnDistance)(this.getSelected()), null, 'ContextMenu.removeColumn');
|
59
60
|
},
|
60
61
|
disabled: function disabled() {
|
61
62
|
if (!this.isColumnModificationAllowed()) {
|
62
63
|
return true;
|
63
64
|
}
|
64
|
-
var
|
65
|
-
if (!
|
66
|
-
return true;
|
67
|
-
}
|
68
|
-
if (range.isSingleHeader() && range.highlight.col < 0) {
|
65
|
+
var selected = (0, _utils.getValidSelection)(this);
|
66
|
+
if (!selected) {
|
69
67
|
return true;
|
70
68
|
}
|
71
69
|
var totalColumns = this.countCols();
|
@@ -16,6 +16,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
16
16
|
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; }
|
17
17
|
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; } }
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
19
|
+
import { getValidSelection } from "../utils.mjs";
|
19
20
|
import { transformSelectionToColumnDistance } from "../../../selection/utils.mjs";
|
20
21
|
import * as C from "../../../i18n/constants.mjs";
|
21
22
|
export var KEY = 'remove_col';
|
@@ -50,11 +51,8 @@ export default function removeColumnItem() {
|
|
50
51
|
if (!this.isColumnModificationAllowed()) {
|
51
52
|
return true;
|
52
53
|
}
|
53
|
-
var
|
54
|
-
if (!
|
55
|
-
return true;
|
56
|
-
}
|
57
|
-
if (range.isSingleHeader() && range.highlight.col < 0) {
|
54
|
+
var selected = getValidSelection(this);
|
55
|
+
if (!selected) {
|
58
56
|
return true;
|
59
57
|
}
|
60
58
|
var totalColumns = this.countCols();
|
@@ -18,7 +18,8 @@ require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
18
18
|
exports.__esModule = true;
|
19
19
|
exports.KEY = void 0;
|
20
20
|
exports.default = removeRowItem;
|
21
|
-
var _utils = require("
|
21
|
+
var _utils = require("../utils");
|
22
|
+
var _utils2 = require("../../../selection/utils");
|
22
23
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -57,14 +58,11 @@ function removeRowItem() {
|
|
57
58
|
callback: function callback() {
|
58
59
|
// TODO: Please keep in mind that below `1` may be improper. The table's way of work, before change `f1747b3912ea3b21fe423fd102ca94c87db81379` was restored.
|
59
60
|
// There is still problem when removing more than one row.
|
60
|
-
this.alter('remove_row', (0,
|
61
|
+
this.alter('remove_row', (0, _utils2.transformSelectionToRowDistance)(this.getSelected()), 1, 'ContextMenu.removeRow');
|
61
62
|
},
|
62
63
|
disabled: function disabled() {
|
63
|
-
var
|
64
|
-
if (!
|
65
|
-
return true;
|
66
|
-
}
|
67
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
64
|
+
var selected = (0, _utils.getValidSelection)(this);
|
65
|
+
if (!selected) {
|
68
66
|
return true;
|
69
67
|
}
|
70
68
|
var totalRows = this.countRows();
|
@@ -16,6 +16,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
16
16
|
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; }
|
17
17
|
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; } }
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
19
|
+
import { getValidSelection } from "../utils.mjs";
|
19
20
|
import { transformSelectionToRowDistance } from "../../../selection/utils.mjs";
|
20
21
|
import * as C from "../../../i18n/constants.mjs";
|
21
22
|
export var KEY = 'remove_row';
|
@@ -49,11 +50,8 @@ export default function removeRowItem() {
|
|
49
50
|
this.alter('remove_row', transformSelectionToRowDistance(this.getSelected()), 1, 'ContextMenu.removeRow');
|
50
51
|
},
|
51
52
|
disabled: function disabled() {
|
52
|
-
var
|
53
|
-
if (!
|
54
|
-
return true;
|
55
|
-
}
|
56
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
53
|
+
var selected = getValidSelection(this);
|
54
|
+
if (!selected) {
|
57
55
|
return true;
|
58
56
|
}
|
59
57
|
var totalRows = this.countRows();
|
@@ -13,6 +13,7 @@ require("core-js/modules/es.symbol.iterator.js");
|
|
13
13
|
exports.__esModule = true;
|
14
14
|
exports.KEY = void 0;
|
15
15
|
exports.default = rowAboveItem;
|
16
|
+
var _utils = require("../utils");
|
16
17
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
17
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
18
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -33,11 +34,8 @@ function rowAboveItem() {
|
|
33
34
|
this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
|
34
35
|
},
|
35
36
|
disabled: function disabled() {
|
36
|
-
var
|
37
|
-
if (!
|
38
|
-
return true;
|
39
|
-
}
|
40
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
37
|
+
var selected = (0, _utils.getValidSelection)(this);
|
38
|
+
if (!selected) {
|
41
39
|
return true;
|
42
40
|
}
|
43
41
|
if (this.selection.isSelectedByCorner()) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { getValidSelection } from "../utils.mjs";
|
1
2
|
import * as C from "../../../i18n/constants.mjs";
|
2
3
|
export var KEY = 'row_above';
|
3
4
|
|
@@ -15,11 +16,8 @@ export default function rowAboveItem() {
|
|
15
16
|
this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
|
16
17
|
},
|
17
18
|
disabled: function disabled() {
|
18
|
-
var
|
19
|
-
if (!
|
20
|
-
return true;
|
21
|
-
}
|
22
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
19
|
+
var selected = getValidSelection(this);
|
20
|
+
if (!selected) {
|
23
21
|
return true;
|
24
22
|
}
|
25
23
|
if (this.selection.isSelectedByCorner()) {
|
@@ -13,6 +13,7 @@ require("core-js/modules/es.symbol.iterator.js");
|
|
13
13
|
exports.__esModule = true;
|
14
14
|
exports.KEY = void 0;
|
15
15
|
exports.default = rowBelowItem;
|
16
|
+
var _utils = require("../utils");
|
16
17
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
17
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
18
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -33,11 +34,8 @@ function rowBelowItem() {
|
|
33
34
|
this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
|
34
35
|
},
|
35
36
|
disabled: function disabled() {
|
36
|
-
var
|
37
|
-
if (!
|
38
|
-
return true;
|
39
|
-
}
|
40
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
37
|
+
var selected = (0, _utils.getValidSelection)(this);
|
38
|
+
if (!selected) {
|
41
39
|
return true;
|
42
40
|
}
|
43
41
|
if (this.selection.isSelectedByCorner()) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { getValidSelection } from "../utils.mjs";
|
1
2
|
import * as C from "../../../i18n/constants.mjs";
|
2
3
|
export var KEY = 'row_below';
|
3
4
|
|
@@ -15,11 +16,8 @@ export default function rowBelowItem() {
|
|
15
16
|
this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
|
16
17
|
},
|
17
18
|
disabled: function disabled() {
|
18
|
-
var
|
19
|
-
if (!
|
20
|
-
return true;
|
21
|
-
}
|
22
|
-
if (range.isSingleHeader() && range.highlight.row < 0) {
|
19
|
+
var selected = getValidSelection(this);
|
20
|
+
if (!selected) {
|
23
21
|
return true;
|
24
22
|
}
|
25
23
|
if (this.selection.isSelectedByCorner()) {
|
@@ -5,7 +5,7 @@ exports.align = align;
|
|
5
5
|
exports.checkSelectionConsistency = checkSelectionConsistency;
|
6
6
|
exports.filterSeparators = filterSeparators;
|
7
7
|
exports.getAlignmentClasses = getAlignmentClasses;
|
8
|
-
exports.
|
8
|
+
exports.getValidSelection = getValidSelection;
|
9
9
|
exports.hasSubMenu = hasSubMenu;
|
10
10
|
exports.isDisabled = isDisabled;
|
11
11
|
exports.isItemHidden = isItemHidden;
|
@@ -70,6 +70,21 @@ function isSelectionDisabled(cell) {
|
|
70
70
|
return (0, _element.hasClass)(cell, 'htSelectionDisabled');
|
71
71
|
}
|
72
72
|
|
73
|
+
/**
|
74
|
+
* @param {Core} hot The Handsontable instance.
|
75
|
+
* @returns {Array[]|null}
|
76
|
+
*/
|
77
|
+
function getValidSelection(hot) {
|
78
|
+
var selected = hot.getSelected();
|
79
|
+
if (!selected) {
|
80
|
+
return null;
|
81
|
+
}
|
82
|
+
if (selected[0] < 0) {
|
83
|
+
return null;
|
84
|
+
}
|
85
|
+
return selected;
|
86
|
+
}
|
87
|
+
|
73
88
|
/**
|
74
89
|
* @param {string} className The full element class name to process.
|
75
90
|
* @param {string} alignment The slignment class name to compare with.
|
@@ -260,28 +275,4 @@ function filterSeparators(items) {
|
|
260
275
|
result = popSeparators(result, separator);
|
261
276
|
result = removeDuplicatedSeparators(result);
|
262
277
|
return result;
|
263
|
-
}
|
264
|
-
|
265
|
-
/**
|
266
|
-
* Returns document offset based on the passed element. If the document objects between element and the
|
267
|
-
* base document are not the same the offset as top and left properties will be returned.
|
268
|
-
*
|
269
|
-
* @param {Element} elementToCheck The element to compare with Document object.
|
270
|
-
* @param {Document} baseDocument The base Document object.
|
271
|
-
* @returns {{ top: number, left: number }}
|
272
|
-
*/
|
273
|
-
function getDocumentOffsetByElement(elementToCheck, baseDocument) {
|
274
|
-
var offset = {
|
275
|
-
top: 0,
|
276
|
-
left: 0
|
277
|
-
};
|
278
|
-
if (baseDocument !== elementToCheck.ownerDocument) {
|
279
|
-
var frameElement = baseDocument.defaultView.frameElement;
|
280
|
-
var _frameElement$getBoun = frameElement.getBoundingClientRect(),
|
281
|
-
top = _frameElement$getBoun.top,
|
282
|
-
left = _frameElement$getBoun.left;
|
283
|
-
offset.top = top;
|
284
|
-
offset.left = left;
|
285
|
-
}
|
286
|
-
return offset;
|
287
278
|
}
|
@@ -53,6 +53,21 @@ export function isSelectionDisabled(cell) {
|
|
53
53
|
return hasClass(cell, 'htSelectionDisabled');
|
54
54
|
}
|
55
55
|
|
56
|
+
/**
|
57
|
+
* @param {Core} hot The Handsontable instance.
|
58
|
+
* @returns {Array[]|null}
|
59
|
+
*/
|
60
|
+
export function getValidSelection(hot) {
|
61
|
+
var selected = hot.getSelected();
|
62
|
+
if (!selected) {
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
if (selected[0] < 0) {
|
66
|
+
return null;
|
67
|
+
}
|
68
|
+
return selected;
|
69
|
+
}
|
70
|
+
|
56
71
|
/**
|
57
72
|
* @param {string} className The full element class name to process.
|
58
73
|
* @param {string} alignment The slignment class name to compare with.
|
@@ -243,28 +258,4 @@ export function filterSeparators(items) {
|
|
243
258
|
result = popSeparators(result, separator);
|
244
259
|
result = removeDuplicatedSeparators(result);
|
245
260
|
return result;
|
246
|
-
}
|
247
|
-
|
248
|
-
/**
|
249
|
-
* Returns document offset based on the passed element. If the document objects between element and the
|
250
|
-
* base document are not the same the offset as top and left properties will be returned.
|
251
|
-
*
|
252
|
-
* @param {Element} elementToCheck The element to compare with Document object.
|
253
|
-
* @param {Document} baseDocument The base Document object.
|
254
|
-
* @returns {{ top: number, left: number }}
|
255
|
-
*/
|
256
|
-
export function getDocumentOffsetByElement(elementToCheck, baseDocument) {
|
257
|
-
var offset = {
|
258
|
-
top: 0,
|
259
|
-
left: 0
|
260
|
-
};
|
261
|
-
if (baseDocument !== elementToCheck.ownerDocument) {
|
262
|
-
var frameElement = baseDocument.defaultView.frameElement;
|
263
|
-
var _frameElement$getBoun = frameElement.getBoundingClientRect(),
|
264
|
-
top = _frameElement$getBoun.top,
|
265
|
-
left = _frameElement$getBoun.left;
|
266
|
-
offset.top = top;
|
267
|
-
offset.left = left;
|
268
|
-
}
|
269
|
-
return offset;
|
270
261
|
}
|
@@ -20,13 +20,6 @@ function copyItem(copyPastePlugin) {
|
|
20
20
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
21
21
|
return true;
|
22
22
|
}
|
23
|
-
var range = this.getSelectedRangeLast();
|
24
|
-
if (!range) {
|
25
|
-
return true;
|
26
|
-
}
|
27
|
-
if (range.isSingleHeader()) {
|
28
|
-
return true;
|
29
|
-
}
|
30
23
|
var selected = this.getSelected();
|
31
24
|
|
32
25
|
// Disable for no selection or for non-contiguous selection.
|
@@ -16,13 +16,6 @@ export default function copyItem(copyPastePlugin) {
|
|
16
16
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
17
17
|
return true;
|
18
18
|
}
|
19
|
-
var range = this.getSelectedRangeLast();
|
20
|
-
if (!range) {
|
21
|
-
return true;
|
22
|
-
}
|
23
|
-
if (range.isSingleHeader()) {
|
24
|
-
return true;
|
25
|
-
}
|
26
19
|
var selected = this.getSelected();
|
27
20
|
|
28
21
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,7 +3,6 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyColumnHeadersOnlyItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
-
var _number = require("../../../helpers/number");
|
7
6
|
/**
|
8
7
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
9
8
|
* @returns {object}
|
@@ -13,7 +12,7 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
13
12
|
key: 'copy_column_headers_only',
|
14
13
|
name: function name() {
|
15
14
|
var selectedRange = this.getSelectedRangeLast();
|
16
|
-
var nounForm = selectedRange ?
|
15
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
17
16
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
|
18
17
|
},
|
19
18
|
callback: function callback() {
|
@@ -23,13 +22,6 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
23
22
|
if (!this.hasColHeaders()) {
|
24
23
|
return true;
|
25
24
|
}
|
26
|
-
var range = this.getSelectedRangeLast();
|
27
|
-
if (!range) {
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
if (range.isSingleHeader()) {
|
31
|
-
return true;
|
32
|
-
}
|
33
25
|
var selected = this.getSelected();
|
34
26
|
|
35
27
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY } from "../../../i18n/constants.mjs";
|
2
|
-
import { clamp } from "../../../helpers/number.mjs";
|
3
2
|
/**
|
4
3
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
5
4
|
* @returns {object}
|
@@ -9,7 +8,7 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
9
8
|
key: 'copy_column_headers_only',
|
10
9
|
name: function name() {
|
11
10
|
var selectedRange = this.getSelectedRangeLast();
|
12
|
-
var nounForm = selectedRange ?
|
11
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
13
12
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
|
14
13
|
},
|
15
14
|
callback: function callback() {
|
@@ -19,13 +18,6 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
19
18
|
if (!this.hasColHeaders()) {
|
20
19
|
return true;
|
21
20
|
}
|
22
|
-
var range = this.getSelectedRangeLast();
|
23
|
-
if (!range) {
|
24
|
-
return true;
|
25
|
-
}
|
26
|
-
if (range.isSingleHeader()) {
|
27
|
-
return true;
|
28
|
-
}
|
29
21
|
var selected = this.getSelected();
|
30
22
|
|
31
23
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,7 +3,6 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyWithColumnGroupHeadersItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
-
var _number = require("../../../helpers/number");
|
7
6
|
/**
|
8
7
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
9
8
|
* @returns {object}
|
@@ -13,7 +12,7 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
13
12
|
key: 'copy_with_column_group_headers',
|
14
13
|
name: function name() {
|
15
14
|
var selectedRange = this.getSelectedRangeLast();
|
16
|
-
var nounForm = selectedRange ?
|
15
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
17
16
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
|
18
17
|
},
|
19
18
|
callback: function callback() {
|
@@ -23,13 +22,6 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
23
22
|
if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
|
24
23
|
return true;
|
25
24
|
}
|
26
|
-
var range = this.getSelectedRangeLast();
|
27
|
-
if (!range) {
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
if (range.isSingleHeader()) {
|
31
|
-
return true;
|
32
|
-
}
|
33
25
|
var selected = this.getSelected();
|
34
26
|
|
35
27
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS } from "../../../i18n/constants.mjs";
|
2
|
-
import { clamp } from "../../../helpers/number.mjs";
|
3
2
|
/**
|
4
3
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
5
4
|
* @returns {object}
|
@@ -9,7 +8,7 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
9
8
|
key: 'copy_with_column_group_headers',
|
10
9
|
name: function name() {
|
11
10
|
var selectedRange = this.getSelectedRangeLast();
|
12
|
-
var nounForm = selectedRange ?
|
11
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
13
12
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
|
14
13
|
},
|
15
14
|
callback: function callback() {
|
@@ -19,13 +18,6 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
19
18
|
if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
|
20
19
|
return true;
|
21
20
|
}
|
22
|
-
var range = this.getSelectedRangeLast();
|
23
|
-
if (!range) {
|
24
|
-
return true;
|
25
|
-
}
|
26
|
-
if (range.isSingleHeader()) {
|
27
|
-
return true;
|
28
|
-
}
|
29
21
|
var selected = this.getSelected();
|
30
22
|
|
31
23
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,7 +3,6 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyWithColumnHeadersItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
-
var _number = require("../../../helpers/number");
|
7
6
|
/**
|
8
7
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
9
8
|
* @returns {object}
|
@@ -13,7 +12,7 @@ function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
13
12
|
key: 'copy_with_column_headers',
|
14
13
|
name: function name() {
|
15
14
|
var selectedRange = this.getSelectedRangeLast();
|
16
|
-
var nounForm = selectedRange ?
|
15
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
17
16
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS, nounForm);
|
18
17
|
},
|
19
18
|
callback: function callback() {
|
@@ -23,13 +22,6 @@ function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
23
22
|
if (!this.hasColHeaders()) {
|
24
23
|
return true;
|
25
24
|
}
|
26
|
-
var range = this.getSelectedRangeLast();
|
27
|
-
if (!range) {
|
28
|
-
return true;
|
29
|
-
}
|
30
|
-
if (range.isSingleHeader()) {
|
31
|
-
return true;
|
32
|
-
}
|
33
25
|
var selected = this.getSelected();
|
34
26
|
|
35
27
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS } from "../../../i18n/constants.mjs";
|
2
|
-
import { clamp } from "../../../helpers/number.mjs";
|
3
2
|
/**
|
4
3
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
5
4
|
* @returns {object}
|
@@ -9,7 +8,7 @@ export default function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
9
8
|
key: 'copy_with_column_headers',
|
10
9
|
name: function name() {
|
11
10
|
var selectedRange = this.getSelectedRangeLast();
|
12
|
-
var nounForm = selectedRange ?
|
11
|
+
var nounForm = selectedRange ? Math.min(selectedRange.getWidth() - 1, 1) : 0;
|
13
12
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS, nounForm);
|
14
13
|
},
|
15
14
|
callback: function callback() {
|
@@ -19,13 +18,6 @@ export default function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
19
18
|
if (!this.hasColHeaders()) {
|
20
19
|
return true;
|
21
20
|
}
|
22
|
-
var range = this.getSelectedRangeLast();
|
23
|
-
if (!range) {
|
24
|
-
return true;
|
25
|
-
}
|
26
|
-
if (range.isSingleHeader()) {
|
27
|
-
return true;
|
28
|
-
}
|
29
21
|
var selected = this.getSelected();
|
30
22
|
|
31
23
|
// Disable for no selection or for non-contiguous selection.
|
@@ -32,13 +32,6 @@ function cutItem(copyPastePlugin) {
|
|
32
32
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
33
33
|
return true;
|
34
34
|
}
|
35
|
-
var range = this.getSelectedRangeLast();
|
36
|
-
if (!range) {
|
37
|
-
return true;
|
38
|
-
}
|
39
|
-
if (range.isSingleHeader()) {
|
40
|
-
return true;
|
41
|
-
}
|
42
35
|
var selected = this.getSelected();
|
43
36
|
|
44
37
|
// Disable for no selection or for non-contiquous selection.
|
@@ -16,13 +16,6 @@ export default function cutItem(copyPastePlugin) {
|
|
16
16
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
17
17
|
return true;
|
18
18
|
}
|
19
|
-
var range = this.getSelectedRangeLast();
|
20
|
-
if (!range) {
|
21
|
-
return true;
|
22
|
-
}
|
23
|
-
if (range.isSingleHeader()) {
|
24
|
-
return true;
|
25
|
-
}
|
26
19
|
var selected = this.getSelected();
|
27
20
|
|
28
21
|
// Disable for no selection or for non-contiquous selection.
|
@@ -814,13 +814,6 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
814
814
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS);
|
815
815
|
},
|
816
816
|
disabled: function disabled() {
|
817
|
-
var range = this.getSelectedRangeLast();
|
818
|
-
if (!range) {
|
819
|
-
return true;
|
820
|
-
}
|
821
|
-
if (range.isSingleHeader()) {
|
822
|
-
return true;
|
823
|
-
}
|
824
817
|
return this.selection.isSelectedByCorner();
|
825
818
|
},
|
826
819
|
submenu: {
|
@@ -805,13 +805,6 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
805
805
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_BORDERS);
|
806
806
|
},
|
807
807
|
disabled: function disabled() {
|
808
|
-
var range = this.getSelectedRangeLast();
|
809
|
-
if (!range) {
|
810
|
-
return true;
|
811
|
-
}
|
812
|
-
if (range.isSingleHeader()) {
|
813
|
-
return true;
|
814
|
-
}
|
815
808
|
return this.selection.isSelectedByCorner();
|
816
809
|
},
|
817
810
|
submenu: {
|
@@ -18,7 +18,7 @@ export class DropdownMenu extends BasePlugin {
|
|
18
18
|
|
19
19
|
constructor(hotInstance: Core);
|
20
20
|
isEnabled(): boolean;
|
21
|
-
open(
|
21
|
+
open(event: Event): void;
|
22
22
|
close(): void;
|
23
23
|
executeCommand(commandName: string, ...params: any): void;
|
24
24
|
}
|