handsontable 0.0.0-next-baf2fcf-20230809 → 0.0.0-next-08765b9-20230809
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +50 -11
- package/3rdparty/walkontable/src/cell/coords.mjs +50 -11
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +38 -7
- package/3rdparty/walkontable/src/cell/range.mjs +38 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
- package/3rdparty/walkontable/src/overlay/top.js +2 -6
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -6
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
- package/3rdparty/walkontable/src/selection/constants.js +62 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +26 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +259 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +254 -0
- package/3rdparty/walkontable/src/selection/scanner.js +270 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
- package/3rdparty/walkontable/src/selection/selection.js +101 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +6 -78
- package/3rdparty/walkontable/src/table.mjs +7 -79
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/common.d.ts +1 -1
- package/core/focusCatcher/focusDetector.js +58 -0
- package/core/focusCatcher/focusDetector.mjs +54 -0
- package/core/focusCatcher/index.js +142 -0
- package/core/focusCatcher/index.mjs +138 -0
- package/core/index.js +9 -0
- package/core/index.mjs +1 -0
- package/core.d.ts +6 -3
- package/core.js +173 -290
- package/core.mjs +173 -290
- package/dataMap/metaManager/metaSchema.js +41 -0
- package/dataMap/metaManager/metaSchema.mjs +41 -0
- package/dist/handsontable.css +24 -4
- package/dist/handsontable.full.css +24 -4
- package/dist/handsontable.full.js +8676 -5381
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +25 -25
- package/dist/handsontable.js +10984 -7689
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +11 -75
- package/editorManager.mjs +11 -74
- package/editors/baseEditor/baseEditor.d.ts +0 -1
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.d.ts +7 -1
- package/pluginHooks.js +106 -1
- package/pluginHooks.mjs +106 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +58 -4
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +58 -4
- package/plugins/columnSorting/columnSorting.js +38 -0
- package/plugins/columnSorting/columnSorting.mjs +38 -2
- package/plugins/columnSorting/index.js +3 -1
- package/plugins/columnSorting/index.mjs +1 -1
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +251 -189
- package/plugins/comments/comments.mjs +250 -190
- package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
- package/plugins/comments/contextMenuItem/removeComment.js +38 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +72 -30
- package/plugins/contextMenu/contextMenu.mjs +73 -31
- package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
- package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
- package/plugins/contextMenu/utils.js +28 -16
- package/plugins/contextMenu/utils.mjs +27 -15
- package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
- package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
- package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
- package/plugins/copyPaste/copyPaste.js +14 -10
- package/plugins/copyPaste/copyPaste.mjs +14 -10
- package/plugins/customBorders/customBorders.js +23 -20
- package/plugins/customBorders/customBorders.mjs +24 -21
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +89 -32
- package/plugins/dropdownMenu/dropdownMenu.mjs +89 -32
- package/plugins/filters/filters.js +31 -14
- package/plugins/filters/filters.mjs +30 -13
- package/plugins/manualColumnResize/manualColumnResize.js +0 -6
- package/plugins/manualColumnResize/manualColumnResize.mjs +1 -7
- package/plugins/mergeCells/mergeCells.js +5 -17
- package/plugins/mergeCells/mergeCells.mjs +5 -17
- package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
- package/plugins/nestedHeaders/nestedHeaders.js +121 -8
- package/plugins/nestedHeaders/nestedHeaders.mjs +121 -8
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/plugins/nestedRows/nestedRows.js +41 -0
- package/plugins/nestedRows/nestedRows.mjs +41 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +256 -71
- package/selection/highlight/highlight.mjs +250 -71
- package/selection/highlight/types/activeHeader.js +10 -8
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +6 -18
- package/selection/highlight/types/area.mjs +6 -18
- package/selection/highlight/types/areaLayered.js +31 -0
- package/selection/highlight/types/areaLayered.mjs +26 -0
- package/selection/highlight/types/column.js +27 -0
- package/selection/highlight/types/column.mjs +22 -0
- package/selection/highlight/types/customSelection.js +7 -9
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -7
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -7
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +9 -18
- package/selection/highlight/types/header.mjs +9 -18
- package/selection/highlight/types/row.js +27 -0
- package/selection/highlight/types/row.mjs +22 -0
- package/selection/highlight/visualSelection.js +31 -27
- package/selection/highlight/visualSelection.mjs +31 -27
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +290 -154
- package/selection/selection.mjs +287 -153
- package/selection/transformation.js +232 -90
- package/selection/transformation.mjs +232 -90
- package/selection/utils.js +15 -21
- package/selection/utils.mjs +16 -21
- package/settings.d.ts +2 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +27 -0
- package/shortcutContexts/commands/editor/open.mjs +23 -0
- package/shortcutContexts/commands/emptySelectedCells.js +11 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/index.js +35 -0
- package/shortcutContexts/commands/index.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +36 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +32 -0
- package/shortcutContexts/commands/selectAll.js +10 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +13 -0
- package/shortcutContexts/constants.mjs +8 -0
- package/shortcutContexts/editor.js +25 -0
- package/shortcutContexts/editor.mjs +21 -0
- package/shortcutContexts/grid.js +163 -0
- package/shortcutContexts/grid.mjs +159 -0
- package/shortcutContexts/index.js +24 -0
- package/shortcutContexts/index.mjs +11 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -0
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +19 -5
- package/shortcuts/utils.mjs +18 -4
- package/tableView.js +67 -13
- package/tableView.mjs +67 -13
- package/3rdparty/walkontable/src/selection.js +0 -295
- package/3rdparty/walkontable/src/selection.mjs +0 -290
- package/selection/highlight/constants.js +0 -15
- package/selection/highlight/constants.mjs +0 -6
- package/selection/highlight/types/index.js +0 -35
- package/selection/highlight/types/index.mjs +0 -31
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import * as C from "../../../i18n/constants.mjs";
|
3
2
|
export const KEY = 'col_left';
|
4
3
|
|
@@ -20,8 +19,11 @@ export default function columnLeftItem() {
|
|
20
19
|
if (!this.isColumnModificationAllowed()) {
|
21
20
|
return true;
|
22
21
|
}
|
23
|
-
const
|
24
|
-
if (!
|
22
|
+
const range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.isSingleHeader() && range.highlight.col < 0) {
|
25
27
|
return true;
|
26
28
|
}
|
27
29
|
if (this.selection.isSelectedByCorner()) {
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = columnRightItem;
|
5
|
-
var _utils = require("../utils");
|
6
5
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
7
6
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
8
7
|
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; }
|
@@ -27,8 +26,11 @@ function columnRightItem() {
|
|
27
26
|
if (!this.isColumnModificationAllowed()) {
|
28
27
|
return true;
|
29
28
|
}
|
30
|
-
const
|
31
|
-
if (!
|
29
|
+
const range = this.getSelectedRangeLast();
|
30
|
+
if (!range) {
|
31
|
+
return true;
|
32
|
+
}
|
33
|
+
if (range.isSingleHeader() && range.highlight.col < 0) {
|
32
34
|
return true;
|
33
35
|
}
|
34
36
|
if (this.selection.isSelectedByCorner()) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import * as C from "../../../i18n/constants.mjs";
|
3
2
|
export const KEY = 'col_right';
|
4
3
|
|
@@ -20,8 +19,11 @@ export default function columnRightItem() {
|
|
20
19
|
if (!this.isColumnModificationAllowed()) {
|
21
20
|
return true;
|
22
21
|
}
|
23
|
-
const
|
24
|
-
if (!
|
22
|
+
const range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.isSingleHeader() && range.highlight.col < 0) {
|
25
27
|
return true;
|
26
28
|
}
|
27
29
|
if (this.selection.isSelectedByCorner()) {
|
@@ -37,6 +37,13 @@ function readOnlyItem() {
|
|
37
37
|
this.render();
|
38
38
|
},
|
39
39
|
disabled() {
|
40
|
+
const range = this.getSelectedRangeLast();
|
41
|
+
if (!range) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
if (range.isSingleHeader()) {
|
45
|
+
return true;
|
46
|
+
}
|
40
47
|
if (this.selection.isSelectedByCorner()) {
|
41
48
|
return true;
|
42
49
|
}
|
@@ -30,6 +30,13 @@ export default function readOnlyItem() {
|
|
30
30
|
this.render();
|
31
31
|
},
|
32
32
|
disabled() {
|
33
|
+
const range = this.getSelectedRangeLast();
|
34
|
+
if (!range) {
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
if (range.isSingleHeader()) {
|
38
|
+
return true;
|
39
|
+
}
|
33
40
|
if (this.selection.isSelectedByCorner()) {
|
34
41
|
return true;
|
35
42
|
}
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = removeColumnItem;
|
5
|
-
var _utils = require("
|
6
|
-
var _utils2 = require("../../../selection/utils");
|
5
|
+
var _utils = require("../../../selection/utils");
|
7
6
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
8
7
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
9
8
|
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; }
|
@@ -32,14 +31,17 @@ function removeColumnItem() {
|
|
32
31
|
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COLUMN, pluralForm);
|
33
32
|
},
|
34
33
|
callback() {
|
35
|
-
this.alter('remove_col', (0,
|
34
|
+
this.alter('remove_col', (0, _utils.transformSelectionToColumnDistance)(this.getSelected()), null, 'ContextMenu.removeColumn');
|
36
35
|
},
|
37
36
|
disabled() {
|
38
37
|
if (!this.isColumnModificationAllowed()) {
|
39
38
|
return true;
|
40
39
|
}
|
41
|
-
const
|
42
|
-
if (!
|
40
|
+
const range = this.getSelectedRangeLast();
|
41
|
+
if (!range) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
if (range.isSingleHeader() && range.highlight.col < 0) {
|
43
45
|
return true;
|
44
46
|
}
|
45
47
|
const totalColumns = this.countCols();
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import { transformSelectionToColumnDistance } from "../../../selection/utils.mjs";
|
3
2
|
import * as C from "../../../i18n/constants.mjs";
|
4
3
|
export const KEY = 'remove_col';
|
@@ -31,8 +30,11 @@ export default function removeColumnItem() {
|
|
31
30
|
if (!this.isColumnModificationAllowed()) {
|
32
31
|
return true;
|
33
32
|
}
|
34
|
-
const
|
35
|
-
if (!
|
33
|
+
const range = this.getSelectedRangeLast();
|
34
|
+
if (!range) {
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
if (range.isSingleHeader() && range.highlight.col < 0) {
|
36
38
|
return true;
|
37
39
|
}
|
38
40
|
const totalColumns = this.countCols();
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = removeRowItem;
|
5
|
-
var _utils = require("
|
6
|
-
var _utils2 = require("../../../selection/utils");
|
5
|
+
var _utils = require("../../../selection/utils");
|
7
6
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
8
7
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
9
8
|
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; }
|
@@ -34,11 +33,14 @@ function removeRowItem() {
|
|
34
33
|
callback() {
|
35
34
|
// TODO: Please keep in mind that below `1` may be improper. The table's way of work, before change `f1747b3912ea3b21fe423fd102ca94c87db81379` was restored.
|
36
35
|
// There is still problem when removing more than one row.
|
37
|
-
this.alter('remove_row', (0,
|
36
|
+
this.alter('remove_row', (0, _utils.transformSelectionToRowDistance)(this.getSelected()), 1, 'ContextMenu.removeRow');
|
38
37
|
},
|
39
38
|
disabled() {
|
40
|
-
const
|
41
|
-
if (!
|
39
|
+
const range = this.getSelectedRangeLast();
|
40
|
+
if (!range) {
|
41
|
+
return true;
|
42
|
+
}
|
43
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
42
44
|
return true;
|
43
45
|
}
|
44
46
|
const totalRows = this.countRows();
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import { transformSelectionToRowDistance } from "../../../selection/utils.mjs";
|
3
2
|
import * as C from "../../../i18n/constants.mjs";
|
4
3
|
export const KEY = 'remove_row';
|
@@ -30,8 +29,11 @@ export default function removeRowItem() {
|
|
30
29
|
this.alter('remove_row', transformSelectionToRowDistance(this.getSelected()), 1, 'ContextMenu.removeRow');
|
31
30
|
},
|
32
31
|
disabled() {
|
33
|
-
const
|
34
|
-
if (!
|
32
|
+
const range = this.getSelectedRangeLast();
|
33
|
+
if (!range) {
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
35
37
|
return true;
|
36
38
|
}
|
37
39
|
const totalRows = this.countRows();
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = rowAboveItem;
|
5
|
-
var _utils = require("../utils");
|
6
5
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
7
6
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
8
7
|
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; }
|
@@ -23,8 +22,11 @@ function rowAboveItem() {
|
|
23
22
|
this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
|
24
23
|
},
|
25
24
|
disabled() {
|
26
|
-
const
|
27
|
-
if (!
|
25
|
+
const range = this.getSelectedRangeLast();
|
26
|
+
if (!range) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
28
30
|
return true;
|
29
31
|
}
|
30
32
|
if (this.selection.isSelectedByCorner()) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import * as C from "../../../i18n/constants.mjs";
|
3
2
|
export const KEY = 'row_above';
|
4
3
|
|
@@ -16,8 +15,11 @@ export default function rowAboveItem() {
|
|
16
15
|
this.alter('insert_row_above', latestSelection.row, 1, 'ContextMenu.rowAbove');
|
17
16
|
},
|
18
17
|
disabled() {
|
19
|
-
const
|
20
|
-
if (!
|
18
|
+
const range = this.getSelectedRangeLast();
|
19
|
+
if (!range) {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
21
23
|
return true;
|
22
24
|
}
|
23
25
|
if (this.selection.isSelectedByCorner()) {
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = rowBelowItem;
|
5
|
-
var _utils = require("../utils");
|
6
5
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
7
6
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
8
7
|
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; }
|
@@ -23,8 +22,11 @@ function rowBelowItem() {
|
|
23
22
|
this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
|
24
23
|
},
|
25
24
|
disabled() {
|
26
|
-
const
|
27
|
-
if (!
|
25
|
+
const range = this.getSelectedRangeLast();
|
26
|
+
if (!range) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
28
30
|
return true;
|
29
31
|
}
|
30
32
|
if (this.selection.isSelectedByCorner()) {
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { getValidSelection } from "../utils.mjs";
|
2
1
|
import * as C from "../../../i18n/constants.mjs";
|
3
2
|
export const KEY = 'row_below';
|
4
3
|
|
@@ -16,8 +15,11 @@ export default function rowBelowItem() {
|
|
16
15
|
this.alter('insert_row_below', latestSelection.row, 1, 'ContextMenu.rowBelow');
|
17
16
|
},
|
18
17
|
disabled() {
|
19
|
-
const
|
20
|
-
if (!
|
18
|
+
const range = this.getSelectedRangeLast();
|
19
|
+
if (!range) {
|
20
|
+
return true;
|
21
|
+
}
|
22
|
+
if (range.isSingleHeader() && range.highlight.row < 0) {
|
21
23
|
return true;
|
22
24
|
}
|
23
25
|
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.getDocumentOffsetByElement = getDocumentOffsetByElement;
|
9
9
|
exports.hasSubMenu = hasSubMenu;
|
10
10
|
exports.isDisabled = isDisabled;
|
11
11
|
exports.isItemHidden = isItemHidden;
|
@@ -62,21 +62,6 @@ function isSelectionDisabled(cell) {
|
|
62
62
|
return (0, _element.hasClass)(cell, 'htSelectionDisabled');
|
63
63
|
}
|
64
64
|
|
65
|
-
/**
|
66
|
-
* @param {Core} hot The Handsontable instance.
|
67
|
-
* @returns {Array[]|null}
|
68
|
-
*/
|
69
|
-
function getValidSelection(hot) {
|
70
|
-
const selected = hot.getSelected();
|
71
|
-
if (!selected) {
|
72
|
-
return null;
|
73
|
-
}
|
74
|
-
if (selected[0] < 0) {
|
75
|
-
return null;
|
76
|
-
}
|
77
|
-
return selected;
|
78
|
-
}
|
79
|
-
|
80
65
|
/**
|
81
66
|
* @param {string} className The full element class name to process.
|
82
67
|
* @param {string} alignment The slignment class name to compare with.
|
@@ -267,4 +252,31 @@ function filterSeparators(items) {
|
|
267
252
|
result = popSeparators(result, separator);
|
268
253
|
result = removeDuplicatedSeparators(result);
|
269
254
|
return result;
|
255
|
+
}
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Returns document offset based on the passed element. If the document objects between element and the
|
259
|
+
* base document are not the same the offset as top and left properties will be returned.
|
260
|
+
*
|
261
|
+
* @param {Element} elementToCheck The element to compare with Document object.
|
262
|
+
* @param {Document} baseDocument The base Document object.
|
263
|
+
* @returns {{ top: number, left: number }}
|
264
|
+
*/
|
265
|
+
function getDocumentOffsetByElement(elementToCheck, baseDocument) {
|
266
|
+
const offset = {
|
267
|
+
top: 0,
|
268
|
+
left: 0
|
269
|
+
};
|
270
|
+
if (baseDocument !== elementToCheck.ownerDocument) {
|
271
|
+
const {
|
272
|
+
frameElement
|
273
|
+
} = baseDocument.defaultView;
|
274
|
+
const {
|
275
|
+
top,
|
276
|
+
left
|
277
|
+
} = frameElement.getBoundingClientRect();
|
278
|
+
offset.top = top;
|
279
|
+
offset.left = left;
|
280
|
+
}
|
281
|
+
return offset;
|
270
282
|
}
|
@@ -45,21 +45,6 @@ export function isSelectionDisabled(cell) {
|
|
45
45
|
return hasClass(cell, 'htSelectionDisabled');
|
46
46
|
}
|
47
47
|
|
48
|
-
/**
|
49
|
-
* @param {Core} hot The Handsontable instance.
|
50
|
-
* @returns {Array[]|null}
|
51
|
-
*/
|
52
|
-
export function getValidSelection(hot) {
|
53
|
-
const selected = hot.getSelected();
|
54
|
-
if (!selected) {
|
55
|
-
return null;
|
56
|
-
}
|
57
|
-
if (selected[0] < 0) {
|
58
|
-
return null;
|
59
|
-
}
|
60
|
-
return selected;
|
61
|
-
}
|
62
|
-
|
63
48
|
/**
|
64
49
|
* @param {string} className The full element class name to process.
|
65
50
|
* @param {string} alignment The slignment class name to compare with.
|
@@ -250,4 +235,31 @@ export function filterSeparators(items) {
|
|
250
235
|
result = popSeparators(result, separator);
|
251
236
|
result = removeDuplicatedSeparators(result);
|
252
237
|
return result;
|
238
|
+
}
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Returns document offset based on the passed element. If the document objects between element and the
|
242
|
+
* base document are not the same the offset as top and left properties will be returned.
|
243
|
+
*
|
244
|
+
* @param {Element} elementToCheck The element to compare with Document object.
|
245
|
+
* @param {Document} baseDocument The base Document object.
|
246
|
+
* @returns {{ top: number, left: number }}
|
247
|
+
*/
|
248
|
+
export function getDocumentOffsetByElement(elementToCheck, baseDocument) {
|
249
|
+
const offset = {
|
250
|
+
top: 0,
|
251
|
+
left: 0
|
252
|
+
};
|
253
|
+
if (baseDocument !== elementToCheck.ownerDocument) {
|
254
|
+
const {
|
255
|
+
frameElement
|
256
|
+
} = baseDocument.defaultView;
|
257
|
+
const {
|
258
|
+
top,
|
259
|
+
left
|
260
|
+
} = frameElement.getBoundingClientRect();
|
261
|
+
offset.top = top;
|
262
|
+
offset.left = left;
|
263
|
+
}
|
264
|
+
return offset;
|
253
265
|
}
|
@@ -20,6 +20,13 @@ function copyItem(copyPastePlugin) {
|
|
20
20
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
21
21
|
return true;
|
22
22
|
}
|
23
|
+
const range = this.getSelectedRangeLast();
|
24
|
+
if (!range) {
|
25
|
+
return true;
|
26
|
+
}
|
27
|
+
if (range.isSingleHeader()) {
|
28
|
+
return true;
|
29
|
+
}
|
23
30
|
const selected = this.getSelected();
|
24
31
|
|
25
32
|
// Disable for no selection or for non-contiguous selection.
|
@@ -16,6 +16,13 @@ export default function copyItem(copyPastePlugin) {
|
|
16
16
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
17
17
|
return true;
|
18
18
|
}
|
19
|
+
const range = this.getSelectedRangeLast();
|
20
|
+
if (!range) {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
if (range.isSingleHeader()) {
|
24
|
+
return true;
|
25
|
+
}
|
19
26
|
const selected = this.getSelected();
|
20
27
|
|
21
28
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyColumnHeadersOnlyItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
+
var _number = require("../../../helpers/number");
|
6
7
|
/**
|
7
8
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
8
9
|
* @returns {object}
|
@@ -12,7 +13,7 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
12
13
|
key: 'copy_column_headers_only',
|
13
14
|
name() {
|
14
15
|
const selectedRange = this.getSelectedRangeLast();
|
15
|
-
const nounForm = selectedRange ?
|
16
|
+
const nounForm = selectedRange ? (0, _number.clamp)(selectedRange.getWidth() - 1, 0, 1) : 0;
|
16
17
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
|
17
18
|
},
|
18
19
|
callback() {
|
@@ -22,6 +23,13 @@ function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
22
23
|
if (!this.hasColHeaders()) {
|
23
24
|
return true;
|
24
25
|
}
|
26
|
+
const range = this.getSelectedRangeLast();
|
27
|
+
if (!range) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
if (range.isSingleHeader()) {
|
31
|
+
return true;
|
32
|
+
}
|
25
33
|
const selected = this.getSelected();
|
26
34
|
|
27
35
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY } from "../../../i18n/constants.mjs";
|
2
|
+
import { clamp } from "../../../helpers/number.mjs";
|
2
3
|
/**
|
3
4
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
4
5
|
* @returns {object}
|
@@ -8,7 +9,7 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
8
9
|
key: 'copy_column_headers_only',
|
9
10
|
name() {
|
10
11
|
const selectedRange = this.getSelectedRangeLast();
|
11
|
-
const nounForm = selectedRange ?
|
12
|
+
const nounForm = selectedRange ? clamp(selectedRange.getWidth() - 1, 0, 1) : 0;
|
12
13
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
|
13
14
|
},
|
14
15
|
callback() {
|
@@ -18,6 +19,13 @@ export default function copyColumnHeadersOnlyItem(copyPastePlugin) {
|
|
18
19
|
if (!this.hasColHeaders()) {
|
19
20
|
return true;
|
20
21
|
}
|
22
|
+
const range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.isSingleHeader()) {
|
27
|
+
return true;
|
28
|
+
}
|
21
29
|
const selected = this.getSelected();
|
22
30
|
|
23
31
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyWithColumnGroupHeadersItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
+
var _number = require("../../../helpers/number");
|
6
7
|
/**
|
7
8
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
8
9
|
* @returns {object}
|
@@ -12,7 +13,7 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
12
13
|
key: 'copy_with_column_group_headers',
|
13
14
|
name() {
|
14
15
|
const selectedRange = this.getSelectedRangeLast();
|
15
|
-
const nounForm = selectedRange ?
|
16
|
+
const nounForm = selectedRange ? (0, _number.clamp)(selectedRange.getWidth() - 1, 0, 1) : 0;
|
16
17
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
|
17
18
|
},
|
18
19
|
callback() {
|
@@ -22,6 +23,13 @@ function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
22
23
|
if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
|
23
24
|
return true;
|
24
25
|
}
|
26
|
+
const range = this.getSelectedRangeLast();
|
27
|
+
if (!range) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
if (range.isSingleHeader()) {
|
31
|
+
return true;
|
32
|
+
}
|
25
33
|
const selected = this.getSelected();
|
26
34
|
|
27
35
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS } from "../../../i18n/constants.mjs";
|
2
|
+
import { clamp } from "../../../helpers/number.mjs";
|
2
3
|
/**
|
3
4
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
4
5
|
* @returns {object}
|
@@ -8,7 +9,7 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
8
9
|
key: 'copy_with_column_group_headers',
|
9
10
|
name() {
|
10
11
|
const selectedRange = this.getSelectedRangeLast();
|
11
|
-
const nounForm = selectedRange ?
|
12
|
+
const nounForm = selectedRange ? clamp(selectedRange.getWidth() - 1, 0, 1) : 0;
|
12
13
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_GROUP_HEADERS, nounForm);
|
13
14
|
},
|
14
15
|
callback() {
|
@@ -18,6 +19,13 @@ export default function copyWithColumnGroupHeadersItem(copyPastePlugin) {
|
|
18
19
|
if (!this.hasColHeaders() || !this.getSettings().nestedHeaders) {
|
19
20
|
return true;
|
20
21
|
}
|
22
|
+
const range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.isSingleHeader()) {
|
27
|
+
return true;
|
28
|
+
}
|
21
29
|
const selected = this.getSelected();
|
22
30
|
|
23
31
|
// Disable for no selection or for non-contiguous selection.
|
@@ -3,6 +3,7 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.default = copyWithColumnHeadersItem;
|
5
5
|
var _constants = require("../../../i18n/constants");
|
6
|
+
var _number = require("../../../helpers/number");
|
6
7
|
/**
|
7
8
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
8
9
|
* @returns {object}
|
@@ -12,7 +13,7 @@ function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
12
13
|
key: 'copy_with_column_headers',
|
13
14
|
name() {
|
14
15
|
const selectedRange = this.getSelectedRangeLast();
|
15
|
-
const nounForm = selectedRange ?
|
16
|
+
const nounForm = selectedRange ? (0, _number.clamp)(selectedRange.getWidth() - 1, 0, 1) : 0;
|
16
17
|
return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS, nounForm);
|
17
18
|
},
|
18
19
|
callback() {
|
@@ -22,6 +23,13 @@ function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
22
23
|
if (!this.hasColHeaders()) {
|
23
24
|
return true;
|
24
25
|
}
|
26
|
+
const range = this.getSelectedRangeLast();
|
27
|
+
if (!range) {
|
28
|
+
return true;
|
29
|
+
}
|
30
|
+
if (range.isSingleHeader()) {
|
31
|
+
return true;
|
32
|
+
}
|
25
33
|
const selected = this.getSelected();
|
26
34
|
|
27
35
|
// Disable for no selection or for non-contiguous selection.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS } from "../../../i18n/constants.mjs";
|
2
|
+
import { clamp } from "../../../helpers/number.mjs";
|
2
3
|
/**
|
3
4
|
* @param {CopyPaste} copyPastePlugin The plugin instance.
|
4
5
|
* @returns {object}
|
@@ -8,7 +9,7 @@ export default function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
8
9
|
key: 'copy_with_column_headers',
|
9
10
|
name() {
|
10
11
|
const selectedRange = this.getSelectedRangeLast();
|
11
|
-
const nounForm = selectedRange ?
|
12
|
+
const nounForm = selectedRange ? clamp(selectedRange.getWidth() - 1, 0, 1) : 0;
|
12
13
|
return this.getTranslatedPhrase(CONTEXTMENU_ITEMS_COPY_WITH_COLUMN_HEADERS, nounForm);
|
13
14
|
},
|
14
15
|
callback() {
|
@@ -18,6 +19,13 @@ export default function copyWithColumnHeadersItem(copyPastePlugin) {
|
|
18
19
|
if (!this.hasColHeaders()) {
|
19
20
|
return true;
|
20
21
|
}
|
22
|
+
const range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.isSingleHeader()) {
|
27
|
+
return true;
|
28
|
+
}
|
21
29
|
const selected = this.getSelected();
|
22
30
|
|
23
31
|
// Disable for no selection or for non-contiguous selection.
|
@@ -22,6 +22,13 @@ function cutItem(copyPastePlugin) {
|
|
22
22
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
23
23
|
return true;
|
24
24
|
}
|
25
|
+
const range = this.getSelectedRangeLast();
|
26
|
+
if (!range) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
if (range.isSingleHeader()) {
|
30
|
+
return true;
|
31
|
+
}
|
25
32
|
const selected = this.getSelected();
|
26
33
|
|
27
34
|
// Disable for no selection or for non-contiquous selection.
|
@@ -16,6 +16,13 @@ export default function cutItem(copyPastePlugin) {
|
|
16
16
|
if (this.countRows() === 0 || this.countCols() === 0) {
|
17
17
|
return true;
|
18
18
|
}
|
19
|
+
const range = this.getSelectedRangeLast();
|
20
|
+
if (!range) {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
if (range.isSingleHeader()) {
|
24
|
+
return true;
|
25
|
+
}
|
19
26
|
const selected = this.getSelected();
|
20
27
|
|
21
28
|
// Disable for no selection or for non-contiquous selection.
|