handsontable 0.0.0-next-59715d3-20230523 → 0.0.0-next-93e34dc-20230601
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +61 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +44 -7
- package/3rdparty/walkontable/src/cell/range.mjs +44 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
- package/3rdparty/walkontable/src/overlay/top.js +2 -4
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
- package/3rdparty/walkontable/src/selection/constants.js +63 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +30 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +328 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
- package/3rdparty/walkontable/src/selection/scanner.js +363 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
- package/3rdparty/walkontable/src/selection/selection.js +133 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +7 -79
- package/3rdparty/walkontable/src/table.mjs +8 -80
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +5 -3
- package/core.js +82 -300
- package/core.mjs +82 -300
- package/dataMap/metaManager/metaSchema.js +15 -0
- package/dataMap/metaManager/metaSchema.mjs +15 -0
- package/dist/handsontable.css +8 -3
- package/dist/handsontable.full.css +8 -3
- package/dist/handsontable.full.js +12245 -9953
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +15898 -13606
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +20 -82
- package/editorManager.mjs +25 -86
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +5 -1
- package/plugins/copyPaste/copyPaste.mjs +5 -1
- package/plugins/customBorders/customBorders.js +18 -52
- package/plugins/customBorders/customBorders.mjs +19 -53
- package/plugins/mergeCells/mergeCells.js +5 -18
- package/plugins/mergeCells/mergeCells.mjs +5 -18
- package/plugins/nestedHeaders/nestedHeaders.js +89 -9
- package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +311 -88
- package/selection/highlight/highlight.mjs +301 -84
- package/selection/highlight/types/activeHeader.js +10 -9
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +12 -27
- package/selection/highlight/types/area.mjs +16 -30
- package/selection/highlight/types/areaLayered.js +54 -0
- package/selection/highlight/types/areaLayered.mjs +49 -0
- package/selection/highlight/types/column.js +50 -0
- package/selection/highlight/types/column.mjs +45 -0
- package/selection/highlight/types/customSelection.js +7 -10
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -8
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -8
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +10 -20
- package/selection/highlight/types/header.mjs +10 -19
- package/selection/highlight/types/{index.js → row.js} +27 -31
- package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
- package/selection/highlight/visualSelection.js +23 -28
- package/selection/highlight/visualSelection.mjs +23 -28
- 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 +296 -180
- package/selection/selection.mjs +291 -179
- package/selection/transformation.js +233 -96
- package/selection/transformation.mjs +230 -93
- package/selection/utils.js +12 -35
- package/selection/utils.mjs +13 -35
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +29 -0
- package/shortcutContexts/commands/editor/open.mjs +24 -0
- package/shortcutContexts/commands/emptySelectedCells.js +12 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/index.js +51 -0
- package/shortcutContexts/commands/index.mjs +47 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
- package/shortcutContexts/commands/selectAll.js +11 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +19 -0
- package/shortcutContexts/constants.mjs +12 -0
- package/shortcutContexts/editor.js +29 -0
- package/shortcutContexts/editor.mjs +25 -0
- package/shortcutContexts/grid.js +232 -0
- package/shortcutContexts/grid.mjs +228 -0
- package/shortcutContexts/index.js +29 -0
- package/shortcutContexts/index.mjs +15 -0
- package/tableView.js +58 -9
- package/tableView.mjs +58 -9
- package/3rdparty/walkontable/src/selection.js +0 -354
- package/3rdparty/walkontable/src/selection.mjs +0 -348
- package/selection/highlight/constants.js +0 -16
- package/selection/highlight/constants.mjs +0 -6
package/selection/selection.js
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require("core-js/modules/es.array.slice.js");
|
4
4
|
require("core-js/modules/es.object.freeze.js");
|
5
5
|
require("core-js/modules/es.symbol.iterator.js");
|
6
|
-
require("core-js/modules/es.
|
7
|
-
require("core-js/modules/es.
|
6
|
+
require("core-js/modules/es.weak-map.js");
|
7
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
8
8
|
exports.__esModule = true;
|
9
9
|
exports.default = void 0;
|
10
10
|
require("core-js/modules/es.array.iterator.js");
|
@@ -23,11 +23,12 @@ require("core-js/modules/es.symbol.to-primitive.js");
|
|
23
23
|
require("core-js/modules/es.date.to-primitive.js");
|
24
24
|
require("core-js/modules/es.symbol.js");
|
25
25
|
require("core-js/modules/es.symbol.description.js");
|
26
|
-
var
|
27
|
-
var
|
26
|
+
var _src = require("./../3rdparty/walkontable/src");
|
27
|
+
var _highlight = _interopRequireWildcard(require("./highlight/highlight"));
|
28
28
|
var _range = _interopRequireDefault(require("./range"));
|
29
29
|
var _object = require("./../helpers/object");
|
30
30
|
var _mixed = require("./../helpers/mixed");
|
31
|
+
var _number = require("./../helpers/number");
|
31
32
|
var _array = require("./../helpers/array");
|
32
33
|
var _localHooks = _interopRequireDefault(require("./../mixins/localHooks"));
|
33
34
|
var _transformation = _interopRequireDefault(require("./transformation"));
|
@@ -35,17 +36,14 @@ var _utils = require("./utils");
|
|
35
36
|
var _templateLiteralTag = require("./../helpers/templateLiteralTag");
|
36
37
|
var _templateObject;
|
37
38
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
39
|
+
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); }
|
40
|
+
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; }
|
38
41
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
39
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
40
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
41
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
42
|
-
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; }
|
43
|
-
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; } }
|
44
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
45
42
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
46
43
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
47
44
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
48
45
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
46
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
49
47
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
50
48
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
51
49
|
/**
|
@@ -61,57 +59,62 @@ var Selection = /*#__PURE__*/function () {
|
|
61
59
|
*
|
62
60
|
* @type {GridSettings}
|
63
61
|
*/
|
64
|
-
this
|
62
|
+
_defineProperty(this, "settings", void 0);
|
65
63
|
/**
|
66
64
|
* An additional object with dynamically defined properties which describes table state.
|
67
65
|
*
|
68
66
|
* @type {object}
|
69
67
|
*/
|
70
|
-
this
|
68
|
+
_defineProperty(this, "tableProps", void 0);
|
71
69
|
/**
|
72
70
|
* The flag which determines if the selection is in progress.
|
73
71
|
*
|
74
72
|
* @type {boolean}
|
75
73
|
*/
|
76
|
-
this
|
74
|
+
_defineProperty(this, "inProgress", false);
|
77
75
|
/**
|
78
|
-
*
|
76
|
+
* Selection data layer (handle visual coordinates).
|
79
77
|
*
|
80
|
-
* @type {
|
78
|
+
* @type {SelectionRange}
|
81
79
|
*/
|
82
|
-
this.
|
80
|
+
_defineProperty(this, "selectedRange", new _range.default(function (highlight, from, to) {
|
81
|
+
return _this.tableProps.createCellRange(highlight, from, to);
|
82
|
+
}));
|
83
83
|
/**
|
84
|
-
*
|
85
|
-
* the corner header.
|
84
|
+
* Visualization layer.
|
86
85
|
*
|
87
|
-
* @type {
|
86
|
+
* @type {Highlight}
|
88
87
|
*/
|
89
|
-
this
|
88
|
+
_defineProperty(this, "highlight", void 0);
|
90
89
|
/**
|
91
|
-
* The
|
92
|
-
* the corner header.
|
90
|
+
* The module for modifying coordinates.
|
93
91
|
*
|
94
|
-
* @type {
|
92
|
+
* @type {Transformation}
|
95
93
|
*/
|
96
|
-
this
|
94
|
+
_defineProperty(this, "transformation", void 0);
|
97
95
|
/**
|
98
|
-
*
|
96
|
+
* The collection of the selection layer levels where the whole row was selected using the row header or
|
97
|
+
* the corner header.
|
99
98
|
*
|
100
|
-
* @type {
|
99
|
+
* @type {Set<number>}
|
101
100
|
*/
|
102
|
-
this
|
103
|
-
return _this.tableProps.createCellRange(highlight, from, to);
|
104
|
-
});
|
101
|
+
_defineProperty(this, "selectedByRowHeader", new Set());
|
105
102
|
/**
|
106
|
-
*
|
103
|
+
* The collection of the selection layer levels where the whole column was selected using the column header or
|
104
|
+
* the corner header.
|
107
105
|
*
|
108
|
-
* @type {
|
106
|
+
* @type {Set<number>}
|
109
107
|
*/
|
108
|
+
_defineProperty(this, "selectedByColumnHeader", new Set());
|
109
|
+
this.settings = settings;
|
110
|
+
this.tableProps = tableProps;
|
110
111
|
this.highlight = new _highlight.default({
|
111
112
|
headerClassName: settings.currentHeaderClassName,
|
112
113
|
activeHeaderClassName: settings.activeHeaderClassName,
|
113
114
|
rowClassName: settings.currentRowClassName,
|
114
115
|
columnClassName: settings.currentColClassName,
|
116
|
+
rowIndexMapper: this.tableProps.rowIndexMapper,
|
117
|
+
columnIndexMapper: this.tableProps.columnIndexMapper,
|
115
118
|
disabledCellSelection: function disabledCellSelection(row, column) {
|
116
119
|
return _this.tableProps.isDisabledCellSelection(row, column);
|
117
120
|
},
|
@@ -132,25 +135,22 @@ var Selection = /*#__PURE__*/function () {
|
|
132
135
|
},
|
133
136
|
createCellRange: function createCellRange(highlight, from, to) {
|
134
137
|
return _this.tableProps.createCellRange(highlight, from, to);
|
135
|
-
},
|
136
|
-
rowIndexMapper: function rowIndexMapper() {
|
137
|
-
return _this.tableProps.rowIndexMapper();
|
138
|
-
},
|
139
|
-
columnIndexMapper: function columnIndexMapper() {
|
140
|
-
return _this.tableProps.columnIndexMapper();
|
141
138
|
}
|
142
139
|
});
|
143
|
-
/**
|
144
|
-
* The module for modifying coordinates.
|
145
|
-
*
|
146
|
-
* @type {Transformation}
|
147
|
-
*/
|
148
140
|
this.transformation = new _transformation.default(this.selectedRange, {
|
149
|
-
|
150
|
-
|
141
|
+
rowIndexMapper: this.tableProps.rowIndexMapper,
|
142
|
+
columnIndexMapper: this.tableProps.columnIndexMapper,
|
143
|
+
countRenderableRows: function countRenderableRows() {
|
144
|
+
return _this.tableProps.countRenderableRows();
|
151
145
|
},
|
152
|
-
|
153
|
-
return _this.tableProps.
|
146
|
+
countRenderableColumns: function countRenderableColumns() {
|
147
|
+
return _this.tableProps.countRenderableColumns();
|
148
|
+
},
|
149
|
+
countRowHeaders: function countRowHeaders() {
|
150
|
+
return _this.tableProps.countRowHeaders();
|
151
|
+
},
|
152
|
+
countColHeaders: function countColHeaders() {
|
153
|
+
return _this.tableProps.countColHeaders();
|
154
154
|
},
|
155
155
|
visualToRenderableCoords: function visualToRenderableCoords(coords) {
|
156
156
|
return _this.tableProps.visualToRenderableCoords(coords);
|
@@ -161,6 +161,9 @@ var Selection = /*#__PURE__*/function () {
|
|
161
161
|
createCellCoords: function createCellCoords(row, column) {
|
162
162
|
return _this.tableProps.createCellCoords(row, column);
|
163
163
|
},
|
164
|
+
navigableHeaders: function navigableHeaders() {
|
165
|
+
return settings.navigableHeaders;
|
166
|
+
},
|
164
167
|
fixedRowsBottom: function fixedRowsBottom() {
|
165
168
|
return settings.fixedRowsBottom;
|
166
169
|
},
|
@@ -265,35 +268,27 @@ var Selection = /*#__PURE__*/function () {
|
|
265
268
|
* the default trigger will be used.
|
266
269
|
* @param {boolean} [fragment=false] If `true`, the selection will be treated as a partial selection where the
|
267
270
|
* `setRangeEnd` method won't be called on every `setRangeStart` call.
|
271
|
+
* @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
|
268
272
|
*/
|
269
273
|
}, {
|
270
274
|
key: "setRangeStart",
|
271
275
|
value: function setRangeStart(coords, multipleSelection) {
|
272
276
|
var fragment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
277
|
+
var highlightCoords = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : coords;
|
273
278
|
var isMultipleMode = this.settings.selectionMode === 'multiple';
|
274
279
|
var isMultipleSelection = (0, _mixed.isUndefined)(multipleSelection) ? this.tableProps.getShortcutManager().isCtrlPressed() : multipleSelection;
|
275
|
-
var isRowNegative = coords.row < 0;
|
276
|
-
var isColumnNegative = coords.col < 0;
|
277
|
-
var selectedByCorner = isRowNegative && isColumnNegative;
|
278
280
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
279
281
|
// should be handled by next methods.
|
280
282
|
var coordsClone = coords.clone();
|
281
|
-
this.selectedByCorner = selectedByCorner;
|
282
283
|
this.runLocalHooks("beforeSetRangeStart".concat(fragment ? 'Only' : ''), coordsClone);
|
283
284
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
|
284
285
|
this.selectedRange.clear();
|
285
286
|
}
|
286
|
-
this.selectedRange.add(coordsClone);
|
287
|
+
this.selectedRange.add(coordsClone).current().setHighlight(highlightCoords.clone());
|
287
288
|
if (this.getLayerLevel() === 0) {
|
288
289
|
this.selectedByRowHeader.clear();
|
289
290
|
this.selectedByColumnHeader.clear();
|
290
291
|
}
|
291
|
-
if (!selectedByCorner && isColumnNegative) {
|
292
|
-
this.selectedByRowHeader.add(this.getLayerLevel());
|
293
|
-
}
|
294
|
-
if (!selectedByCorner && isRowNegative) {
|
295
|
-
this.selectedByColumnHeader.add(this.getLayerLevel());
|
296
|
-
}
|
297
292
|
if (!fragment) {
|
298
293
|
this.setRangeEnd(coords);
|
299
294
|
}
|
@@ -306,11 +301,13 @@ var Selection = /*#__PURE__*/function () {
|
|
306
301
|
* @param {boolean} [multipleSelection] If `true`, selection will be worked in 'multiple' mode. This option works
|
307
302
|
* only when 'selectionMode' is set as 'multiple'. If the argument is not defined
|
308
303
|
* the default trigger will be used.
|
304
|
+
* @param {CellCoords} [highlightCoords] If set, allows changing the coordinates of the highlight/focus cell.
|
309
305
|
*/
|
310
306
|
}, {
|
311
307
|
key: "setRangeStartOnly",
|
312
308
|
value: function setRangeStartOnly(coords, multipleSelection) {
|
313
|
-
|
309
|
+
var highlightCoords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : coords;
|
310
|
+
this.setRangeStart(coords, multipleSelection, true, highlightCoords);
|
314
311
|
}
|
315
312
|
|
316
313
|
/**
|
@@ -324,21 +321,39 @@ var Selection = /*#__PURE__*/function () {
|
|
324
321
|
if (this.selectedRange.isEmpty()) {
|
325
322
|
return;
|
326
323
|
}
|
327
|
-
|
328
|
-
// We are creating copy. We would like to modify just the end of the selection by below hook. Then original coords
|
329
|
-
// should be handled by next methods.
|
330
324
|
var coordsClone = coords.clone();
|
325
|
+
var countRows = this.tableProps.countRows();
|
326
|
+
var countCols = this.tableProps.countCols();
|
327
|
+
var isSingle = this.selectedRange.current().clone().setTo(coords).isSingleHeader();
|
328
|
+
|
329
|
+
// Ignore processing the end range when the header selection starts overlapping the corner and
|
330
|
+
// the selection is not a single header highlight.
|
331
|
+
if ((countRows > 0 || countCols > 0) && (countRows === 0 && coordsClone.col < 0 && !isSingle || countCols === 0 && coordsClone.row < 0 && !isSingle)) {
|
332
|
+
return;
|
333
|
+
}
|
331
334
|
this.runLocalHooks('beforeSetRangeEnd', coordsClone);
|
332
335
|
this.begin();
|
333
336
|
var cellRange = this.selectedRange.current();
|
334
|
-
if (this.settings.
|
335
|
-
cellRange.
|
337
|
+
if (!this.settings.navigableHeaders) {
|
338
|
+
cellRange.highlight.normalize();
|
339
|
+
}
|
340
|
+
if (this.settings.selectionMode === 'single') {
|
341
|
+
cellRange.setFrom(cellRange.highlight);
|
342
|
+
cellRange.setTo(cellRange.highlight);
|
343
|
+
} else {
|
344
|
+
cellRange.setTo(coordsClone);
|
336
345
|
}
|
337
346
|
|
338
|
-
//
|
339
|
-
|
340
|
-
|
341
|
-
|
347
|
+
// Prevent creating "area" selection that overlaps headers.
|
348
|
+
if (countRows > 0 && countCols > 0) {
|
349
|
+
if (!this.settings.navigableHeaders || this.settings.navigableHeaders && !cellRange.isSingleHeader()) {
|
350
|
+
cellRange.to.normalize();
|
351
|
+
}
|
352
|
+
}
|
353
|
+
var focusHighlight = this.highlight.getFocus();
|
354
|
+
focusHighlight.clear();
|
355
|
+
if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
|
356
|
+
focusHighlight.add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
342
357
|
}
|
343
358
|
var layerLevel = this.getLayerLevel();
|
344
359
|
|
@@ -348,73 +363,96 @@ var Selection = /*#__PURE__*/function () {
|
|
348
363
|
(0, _array.arrayEach)(this.highlight.getAreas(), function (highlight) {
|
349
364
|
return void highlight.clear();
|
350
365
|
});
|
351
|
-
(0, _array.arrayEach)(this.highlight.
|
366
|
+
(0, _array.arrayEach)(this.highlight.getLayeredAreas(), function (highlight) {
|
367
|
+
return void highlight.clear();
|
368
|
+
});
|
369
|
+
(0, _array.arrayEach)(this.highlight.getRowHeaders(), function (highlight) {
|
370
|
+
return void highlight.clear();
|
371
|
+
});
|
372
|
+
(0, _array.arrayEach)(this.highlight.getColumnHeaders(), function (highlight) {
|
373
|
+
return void highlight.clear();
|
374
|
+
});
|
375
|
+
(0, _array.arrayEach)(this.highlight.getActiveRowHeaders(), function (highlight) {
|
376
|
+
return void highlight.clear();
|
377
|
+
});
|
378
|
+
(0, _array.arrayEach)(this.highlight.getActiveColumnHeaders(), function (highlight) {
|
352
379
|
return void highlight.clear();
|
353
380
|
});
|
354
|
-
(0, _array.arrayEach)(this.highlight.
|
381
|
+
(0, _array.arrayEach)(this.highlight.getActiveCornerHeaders(), function (highlight) {
|
382
|
+
return void highlight.clear();
|
383
|
+
});
|
384
|
+
(0, _array.arrayEach)(this.highlight.getRowHighlights(), function (highlight) {
|
385
|
+
return void highlight.clear();
|
386
|
+
});
|
387
|
+
(0, _array.arrayEach)(this.highlight.getColumnHighlights(), function (highlight) {
|
355
388
|
return void highlight.clear();
|
356
389
|
});
|
357
390
|
}
|
358
391
|
this.highlight.useLayerLevel(layerLevel);
|
359
|
-
var areaHighlight = this.highlight.
|
360
|
-
var
|
361
|
-
var
|
392
|
+
var areaHighlight = this.highlight.createArea();
|
393
|
+
var layeredAreaHighlight = this.highlight.createLayeredArea();
|
394
|
+
var rowHeaderHighlight = this.highlight.createRowHeader();
|
395
|
+
var columnHeaderHighlight = this.highlight.createColumnHeader();
|
396
|
+
var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
|
397
|
+
var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
|
398
|
+
var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
|
399
|
+
var rowHighlight = this.highlight.createRowHighlight();
|
400
|
+
var columnHighlight = this.highlight.createColumnHighlight();
|
362
401
|
areaHighlight.clear();
|
363
|
-
|
364
|
-
|
365
|
-
|
402
|
+
layeredAreaHighlight.clear();
|
403
|
+
rowHeaderHighlight.clear();
|
404
|
+
columnHeaderHighlight.clear();
|
405
|
+
activeRowHeaderHighlight.clear();
|
406
|
+
activeColumnHeaderHighlight.clear();
|
407
|
+
activeCornerHeaderHighlight.clear();
|
408
|
+
rowHighlight.clear();
|
409
|
+
columnHighlight.clear();
|
410
|
+
if (this.highlight.isEnabledFor(_highlight.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
|
366
411
|
areaHighlight.add(cellRange.from).add(cellRange.to).commit();
|
412
|
+
layeredAreaHighlight.add(cellRange.from).add(cellRange.to).commit();
|
367
413
|
if (layerLevel === 1) {
|
368
414
|
// For single cell selection in the same layer, we do not create area selection to prevent blue background.
|
369
415
|
// When non-consecutive selection is performed we have to add that missing area selection to the previous layer
|
370
416
|
// based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
|
371
417
|
var previousRange = this.selectedRange.previous();
|
372
|
-
this.highlight.useLayerLevel(layerLevel - 1)
|
418
|
+
this.highlight.useLayerLevel(layerLevel - 1);
|
419
|
+
this.highlight.createArea().add(previousRange.from).commit()
|
420
|
+
// Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
|
421
|
+
.syncWith(previousRange);
|
422
|
+
this.highlight.createLayeredArea().add(previousRange.from).commit()
|
373
423
|
// Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
|
374
424
|
.syncWith(previousRange);
|
375
425
|
this.highlight.useLayerLevel(layerLevel);
|
376
426
|
}
|
377
427
|
}
|
378
|
-
if (this.highlight.isEnabledFor(
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
}
|
395
|
-
if (this.settings.selectionMode === 'single') {
|
396
|
-
if (this.isSelectedByAnyHeader()) {
|
397
|
-
headerCellRange.from.normalize();
|
428
|
+
if (this.highlight.isEnabledFor(_highlight.HEADER_TYPE, cellRange.highlight)) {
|
429
|
+
if (!cellRange.isSingleHeader()) {
|
430
|
+
var rowCoordsFrom = this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), -1);
|
431
|
+
var rowCoordsTo = this.tableProps.createCellCoords(cellRange.to.row, -1);
|
432
|
+
var columnCoordsFrom = this.tableProps.createCellCoords(-1, Math.max(cellRange.from.col, 0));
|
433
|
+
var columnCoordsTo = this.tableProps.createCellCoords(-1, cellRange.to.col);
|
434
|
+
if (this.settings.selectionMode === 'single') {
|
435
|
+
rowHeaderHighlight.add(rowCoordsFrom).commit();
|
436
|
+
columnHeaderHighlight.add(columnCoordsFrom).commit();
|
437
|
+
rowHighlight.add(rowCoordsFrom).commit();
|
438
|
+
columnHighlight.add(columnCoordsFrom).commit();
|
439
|
+
} else {
|
440
|
+
rowHeaderHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
|
441
|
+
columnHeaderHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
442
|
+
rowHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
|
443
|
+
columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
398
444
|
}
|
399
|
-
headerHighlight.add(headerCellRange.from).commit();
|
400
|
-
} else {
|
401
|
-
headerHighlight.add(headerCellRange.from).add(headerCellRange.to).commit();
|
402
445
|
}
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
if (isRowSelected) {
|
408
|
-
activeHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, -1)).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
|
409
|
-
}
|
446
|
+
var highlightRowHeaders = this.isEntireRowSelected() && (countCols > 0 && countCols === cellRange.getWidth() || countCols === 0 && (this.isSelectedByRowHeader() || this.isSelectedByCorner()));
|
447
|
+
var highlightColumnHeaders = this.isEntireColumnSelected() && (countRows > 0 && countRows === cellRange.getHeight() || countRows === 0 && (this.isSelectedByColumnHeader() || this.isSelectedByCorner()));
|
448
|
+
if (highlightRowHeaders) {
|
449
|
+
activeRowHeaderHighlight.add(this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(Math.max(cellRange.to.row, 0), -1)).commit();
|
410
450
|
}
|
411
|
-
if (
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
activeHeaderHighlight.add(this.tableProps.createCellCoords(-1, cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
|
417
|
-
}
|
451
|
+
if (highlightColumnHeaders) {
|
452
|
+
activeColumnHeaderHighlight.add(this.tableProps.createCellCoords(Math.min(-this.tableProps.countColHeaders(), -1), Math.max(cellRange.from.col, 0))).add(this.tableProps.createCellCoords(-1, Math.max(cellRange.to.col, 0))).commit();
|
453
|
+
}
|
454
|
+
if (highlightRowHeaders && highlightColumnHeaders) {
|
455
|
+
activeCornerHeaderHighlight.add(this.tableProps.createCellCoords(-this.tableProps.countColHeaders(), -this.tableProps.countRowHeaders())).add(this.tableProps.createCellCoords(-1, -1)).commit();
|
418
456
|
}
|
419
457
|
}
|
420
458
|
this.runLocalHooks('afterSetRangeEnd', coords);
|
@@ -439,14 +477,14 @@ var Selection = /*#__PURE__*/function () {
|
|
439
477
|
*
|
440
478
|
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
441
479
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
442
|
-
* @param {boolean} [
|
443
|
-
*
|
480
|
+
* @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary.
|
481
|
+
* Otherwise, row/column will be created according to `minSpareRows/minSpareCols` settings of Handsontable.
|
444
482
|
*/
|
445
483
|
}, {
|
446
484
|
key: "transformStart",
|
447
485
|
value: function transformStart(rowDelta, colDelta) {
|
448
|
-
var
|
449
|
-
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta,
|
486
|
+
var createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
487
|
+
this.setRangeStart(this.transformation.transformStart(rowDelta, colDelta, createMissingRecords));
|
450
488
|
}
|
451
489
|
|
452
490
|
/**
|
@@ -495,7 +533,7 @@ var Selection = /*#__PURE__*/function () {
|
|
495
533
|
key: "isSelectedByRowHeader",
|
496
534
|
value: function isSelectedByRowHeader() {
|
497
535
|
var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
|
498
|
-
return !this.isSelectedByCorner(layerLevel) && this.
|
536
|
+
return !this.isSelectedByCorner(layerLevel) && (layerLevel === -1 ? this.selectedByRowHeader.size > 0 : this.selectedByRowHeader.has(layerLevel));
|
499
537
|
}
|
500
538
|
|
501
539
|
/**
|
@@ -508,8 +546,22 @@ var Selection = /*#__PURE__*/function () {
|
|
508
546
|
}, {
|
509
547
|
key: "isEntireRowSelected",
|
510
548
|
value: function isEntireRowSelected() {
|
549
|
+
var _this2 = this;
|
511
550
|
var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
|
512
|
-
|
551
|
+
var tester = function tester(range) {
|
552
|
+
var _range$getOuterTopSta = range.getOuterTopStartCorner(),
|
553
|
+
col = _range$getOuterTopSta.col;
|
554
|
+
var rowHeaders = _this2.tableProps.countRowHeaders();
|
555
|
+
var countCols = _this2.tableProps.countCols();
|
556
|
+
return (rowHeaders > 0 && col < 0 || rowHeaders === 0) && range.getWidth() === countCols;
|
557
|
+
};
|
558
|
+
if (layerLevel === -1) {
|
559
|
+
return Array.from(this.selectedRange).some(function (range) {
|
560
|
+
return tester(range);
|
561
|
+
});
|
562
|
+
}
|
563
|
+
var range = this.selectedRange.peekByIndex(layerLevel);
|
564
|
+
return range ? tester(range) : false;
|
513
565
|
}
|
514
566
|
|
515
567
|
/**
|
@@ -524,7 +576,7 @@ var Selection = /*#__PURE__*/function () {
|
|
524
576
|
key: "isSelectedByColumnHeader",
|
525
577
|
value: function isSelectedByColumnHeader() {
|
526
578
|
var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
|
527
|
-
return !this.isSelectedByCorner() && this.
|
579
|
+
return !this.isSelectedByCorner() && (layerLevel === -1 ? this.selectedByColumnHeader.size > 0 : this.selectedByColumnHeader.has(layerLevel));
|
528
580
|
}
|
529
581
|
|
530
582
|
/**
|
@@ -537,8 +589,22 @@ var Selection = /*#__PURE__*/function () {
|
|
537
589
|
}, {
|
538
590
|
key: "isEntireColumnSelected",
|
539
591
|
value: function isEntireColumnSelected() {
|
592
|
+
var _this3 = this;
|
540
593
|
var layerLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getLayerLevel();
|
541
|
-
|
594
|
+
var tester = function tester(range) {
|
595
|
+
var _range$getOuterTopSta2 = range.getOuterTopStartCorner(),
|
596
|
+
row = _range$getOuterTopSta2.row;
|
597
|
+
var colHeaders = _this3.tableProps.countColHeaders();
|
598
|
+
var countRows = _this3.tableProps.countRows();
|
599
|
+
return (colHeaders > 0 && row < 0 || colHeaders === 0) && range.getHeight() === countRows;
|
600
|
+
};
|
601
|
+
if (layerLevel === -1) {
|
602
|
+
return Array.from(this.selectedRange).some(function (range) {
|
603
|
+
return tester(range);
|
604
|
+
});
|
605
|
+
}
|
606
|
+
var range = this.selectedRange.peekByIndex(layerLevel);
|
607
|
+
return range ? tester(range) : false;
|
542
608
|
}
|
543
609
|
|
544
610
|
/**
|
@@ -560,7 +626,7 @@ var Selection = /*#__PURE__*/function () {
|
|
560
626
|
}, {
|
561
627
|
key: "isSelectedByCorner",
|
562
628
|
value: function isSelectedByCorner() {
|
563
|
-
return this.
|
629
|
+
return this.selectedByColumnHeader.has(this.getLayerLevel()) && this.selectedByRowHeader.has(this.getLayerLevel());
|
564
630
|
}
|
565
631
|
|
566
632
|
/**
|
@@ -629,31 +695,48 @@ var Selection = /*#__PURE__*/function () {
|
|
629
695
|
}
|
630
696
|
|
631
697
|
/**
|
632
|
-
*
|
698
|
+
* Selects all cells and headers.
|
633
699
|
*
|
634
|
-
* @param {boolean} [
|
635
|
-
*
|
636
|
-
*
|
637
|
-
*
|
700
|
+
* @param {number|boolean} [rowHeaderLevel=false] If passed as `true`, it selects all row headers.
|
701
|
+
* If a value is passed as a number (from -1 to -N), then it additionally allows moving the cell
|
702
|
+
* focus (highlight) to the header (available when the `navigableHeaders` is enabled).
|
703
|
+
* @param {number|boolean} [columnHeaderLevel=false] If passed as `true`, it selects all column headers.
|
704
|
+
* If a value is passed as a number (from -1 to -N), then it additionally allows moving the cell
|
705
|
+
* focus (highlight) to the header (available when the `navigableHeaders` is enabled).
|
638
706
|
*/
|
639
707
|
}, {
|
640
708
|
key: "selectAll",
|
641
709
|
value: function selectAll() {
|
642
|
-
var
|
643
|
-
var
|
710
|
+
var rowHeaderLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
711
|
+
var columnHeaderLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
644
712
|
var nrOfRows = this.tableProps.countRows();
|
645
713
|
var nrOfColumns = this.tableProps.countCols();
|
714
|
+
var countRowHeaders = this.tableProps.countRowHeaders();
|
715
|
+
var countColHeaders = this.tableProps.countColHeaders();
|
716
|
+
var rowFrom = rowHeaderLevel ? -countColHeaders : 0;
|
717
|
+
if (Number.isInteger(rowHeaderLevel)) {
|
718
|
+
rowFrom = (0, _number.clamp)(rowHeaderLevel, -countColHeaders, -1);
|
719
|
+
}
|
720
|
+
var columnFrom = columnHeaderLevel ? -countRowHeaders : 0;
|
721
|
+
if (Number.isInteger(columnHeaderLevel)) {
|
722
|
+
columnFrom = (0, _number.clamp)(columnHeaderLevel, -countRowHeaders, -1);
|
723
|
+
}
|
646
724
|
|
647
725
|
// We can't select cells when there is no data.
|
648
|
-
if (
|
726
|
+
if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
|
649
727
|
return;
|
650
728
|
}
|
651
|
-
var startCoords = this.tableProps.createCellCoords(
|
729
|
+
var startCoords = this.tableProps.createCellCoords(rowFrom < 0 ? -countColHeaders : 0, columnFrom < 0 ? -countRowHeaders : 0);
|
730
|
+
var highlight = this.tableProps.createCellCoords(rowFrom, columnFrom);
|
652
731
|
var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
|
653
732
|
this.clear();
|
654
|
-
this.setRangeStartOnly(startCoords);
|
655
|
-
|
656
|
-
|
733
|
+
this.setRangeStartOnly(startCoords, void 0, highlight);
|
734
|
+
if (columnFrom < 0) {
|
735
|
+
this.selectedByRowHeader.add(this.getLayerLevel());
|
736
|
+
}
|
737
|
+
if (rowFrom < 0) {
|
738
|
+
this.selectedByColumnHeader.add(this.getLayerLevel());
|
739
|
+
}
|
657
740
|
this.setRangeEnd(endCoords);
|
658
741
|
this.finish();
|
659
742
|
}
|
@@ -670,7 +753,7 @@ var Selection = /*#__PURE__*/function () {
|
|
670
753
|
}, {
|
671
754
|
key: "selectCells",
|
672
755
|
value: function selectCells(selectionRanges) {
|
673
|
-
var
|
756
|
+
var _this4 = this;
|
674
757
|
var selectionType = (0, _utils.detectSelectionType)(selectionRanges);
|
675
758
|
if (selectionType === _utils.SELECTION_TYPE_EMPTY) {
|
676
759
|
return false;
|
@@ -679,36 +762,33 @@ var Selection = /*#__PURE__*/function () {
|
|
679
762
|
}
|
680
763
|
var selectionSchemaNormalizer = (0, _utils.normalizeSelectionFactory)(selectionType, {
|
681
764
|
propToCol: function propToCol(prop) {
|
682
|
-
return
|
765
|
+
return _this4.tableProps.propToCol(prop);
|
683
766
|
},
|
684
767
|
keepDirection: true
|
685
768
|
});
|
686
|
-
var
|
687
|
-
var
|
769
|
+
var navigableHeaders = this.settings.navigableHeaders;
|
770
|
+
var tableParams = {
|
771
|
+
countRows: this.tableProps.countRows(),
|
772
|
+
countCols: this.tableProps.countCols(),
|
773
|
+
countRowHeaders: navigableHeaders ? this.tableProps.countRowHeaders() : 0,
|
774
|
+
countColHeaders: navigableHeaders ? this.tableProps.countColHeaders() : 0
|
775
|
+
};
|
688
776
|
|
689
777
|
// Check if every layer of the coordinates are valid.
|
690
778
|
var isValid = !selectionRanges.some(function (selection) {
|
691
|
-
var
|
692
|
-
|
693
|
-
|
694
|
-
columnStart = _selectionSchemaNorma2[1],
|
695
|
-
rowEnd = _selectionSchemaNorma2[2],
|
696
|
-
columnEnd = _selectionSchemaNorma2[3];
|
697
|
-
var _isValid = (0, _utils.isValidCoord)(rowStart, nrOfRows) && (0, _utils.isValidCoord)(columnStart, nrOfColumns) && (0, _utils.isValidCoord)(rowEnd, nrOfRows) && (0, _utils.isValidCoord)(columnEnd, nrOfColumns);
|
698
|
-
return !_isValid;
|
779
|
+
var cellRange = selectionSchemaNormalizer(selection);
|
780
|
+
var rangeValidity = cellRange.isValid(tableParams);
|
781
|
+
return !(rangeValidity && !cellRange.containsHeaders() || rangeValidity && cellRange.containsHeaders() && cellRange.isSingleHeader());
|
699
782
|
});
|
700
783
|
if (isValid) {
|
701
784
|
this.clear();
|
702
785
|
(0, _array.arrayEach)(selectionRanges, function (selection) {
|
703
|
-
var
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
_this2.setRangeStartOnly(_this2.tableProps.createCellCoords(rowStart, columnStart), false);
|
710
|
-
_this2.setRangeEnd(_this2.tableProps.createCellCoords(rowEnd, columnEnd));
|
711
|
-
_this2.finish();
|
786
|
+
var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
|
787
|
+
from = _selectionSchemaNorma.from,
|
788
|
+
to = _selectionSchemaNorma.to;
|
789
|
+
_this4.setRangeStartOnly(from.clone(), false);
|
790
|
+
_this4.setRangeEnd(to.clone());
|
791
|
+
_this4.finish();
|
712
792
|
});
|
713
793
|
}
|
714
794
|
return isValid;
|
@@ -720,24 +800,36 @@ var Selection = /*#__PURE__*/function () {
|
|
720
800
|
*
|
721
801
|
* @param {number|string} startColumn Visual column index or column property from which the selection starts.
|
722
802
|
* @param {number|string} [endColumn] Visual column index or column property from to the selection finishes.
|
723
|
-
* @param {number} [headerLevel
|
724
|
-
*
|
725
|
-
*
|
803
|
+
* @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
|
804
|
+
* take 0 to -N, where 0 means highlighting the cell nearest the column header, -1
|
805
|
+
* means the highlighting header starting from the header closest to the cells.
|
726
806
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
727
807
|
*/
|
728
808
|
}, {
|
729
809
|
key: "selectColumns",
|
730
810
|
value: function selectColumns(startColumn) {
|
731
811
|
var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
732
|
-
var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
812
|
+
var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
733
813
|
var start = typeof startColumn === 'string' ? this.tableProps.propToCol(startColumn) : startColumn;
|
734
814
|
var end = typeof endColumn === 'string' ? this.tableProps.propToCol(endColumn) : endColumn;
|
735
|
-
var
|
736
|
-
var
|
737
|
-
var
|
815
|
+
var countRows = this.tableProps.countRows();
|
816
|
+
var countCols = this.tableProps.countCols();
|
817
|
+
var countColHeaders = this.tableProps.countColHeaders();
|
818
|
+
var columnHeaderLastIndex = countColHeaders === 0 ? 0 : -countColHeaders;
|
819
|
+
var fromCoords = new _src.CellCoords(columnHeaderLastIndex, start);
|
820
|
+
var toCoords = new _src.CellCoords(countRows - 1, end);
|
821
|
+
var isValid = new _src.CellRange(fromCoords, fromCoords, toCoords).isValid({
|
822
|
+
countRows: countRows,
|
823
|
+
countCols: countCols,
|
824
|
+
countRowHeaders: 0,
|
825
|
+
countColHeaders: countColHeaders
|
826
|
+
});
|
738
827
|
if (isValid) {
|
739
|
-
this.
|
740
|
-
this.
|
828
|
+
var from = this.tableProps.createCellCoords(countColHeaders === 0 ? 0 : (0, _number.clamp)(headerLevel, columnHeaderLastIndex, -1), start);
|
829
|
+
var highlight = this.tableProps.createCellCoords((0, _number.clamp)(headerLevel, columnHeaderLastIndex, 0), start);
|
830
|
+
this.setRangeStartOnly(from, void 0, highlight);
|
831
|
+
this.selectedByColumnHeader.add(this.getLayerLevel());
|
832
|
+
this.setRangeEnd(this.tableProps.createCellCoords(countRows - 1, end));
|
741
833
|
this.finish();
|
742
834
|
}
|
743
835
|
return isValid;
|
@@ -748,22 +840,34 @@ var Selection = /*#__PURE__*/function () {
|
|
748
840
|
*
|
749
841
|
* @param {number} startRow Visual row index from which the selection starts.
|
750
842
|
* @param {number} [endRow] Visual row index from to the selection finishes.
|
751
|
-
* @param {number} [headerLevel
|
752
|
-
*
|
753
|
-
*
|
843
|
+
* @param {number} [headerLevel=0] The header level allows changing the cell/header highlight position. The value can
|
844
|
+
* take 0 to -N, where 0 means highlighting the cell nearest the row header, -1
|
845
|
+
* means the highlighting header starting from the header closest to the cells.
|
754
846
|
* @returns {boolean} Returns `true` if selection was successful, `false` otherwise.
|
755
847
|
*/
|
756
848
|
}, {
|
757
849
|
key: "selectRows",
|
758
850
|
value: function selectRows(startRow) {
|
759
851
|
var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
760
|
-
var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
761
|
-
var
|
762
|
-
var
|
763
|
-
var
|
852
|
+
var headerLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
853
|
+
var countRows = this.tableProps.countRows();
|
854
|
+
var countCols = this.tableProps.countCols();
|
855
|
+
var countRowHeaders = this.tableProps.countRowHeaders();
|
856
|
+
var rowHeaderLastIndex = countRowHeaders === 0 ? 0 : -countRowHeaders;
|
857
|
+
var fromCoords = new _src.CellCoords(startRow, rowHeaderLastIndex);
|
858
|
+
var toCoords = new _src.CellCoords(endRow, countCols - 1);
|
859
|
+
var isValid = new _src.CellRange(fromCoords, fromCoords, toCoords).isValid({
|
860
|
+
countRows: countRows,
|
861
|
+
countCols: countCols,
|
862
|
+
countRowHeaders: countRowHeaders,
|
863
|
+
countColHeaders: 0
|
864
|
+
});
|
764
865
|
if (isValid) {
|
765
|
-
this.
|
766
|
-
this.
|
866
|
+
var from = this.tableProps.createCellCoords(startRow, countRowHeaders === 0 ? 0 : (0, _number.clamp)(headerLevel, rowHeaderLastIndex, -1));
|
867
|
+
var highlight = this.tableProps.createCellCoords(startRow, (0, _number.clamp)(headerLevel, rowHeaderLastIndex, 0));
|
868
|
+
this.setRangeStartOnly(from, void 0, highlight);
|
869
|
+
this.selectedByRowHeader.add(this.getLayerLevel());
|
870
|
+
this.setRangeEnd(this.tableProps.createCellCoords(endRow, countCols - 1));
|
767
871
|
this.finish();
|
768
872
|
}
|
769
873
|
return isValid;
|
@@ -782,19 +886,31 @@ var Selection = /*#__PURE__*/function () {
|
|
782
886
|
if (!this.isSelected()) {
|
783
887
|
return;
|
784
888
|
}
|
785
|
-
var
|
889
|
+
var focusHighlight = this.highlight.getFocus();
|
786
890
|
var currentLayer = this.getLayerLevel();
|
787
|
-
|
891
|
+
focusHighlight.commit().syncWith(this.selectedRange.current());
|
788
892
|
|
789
893
|
// Rewriting rendered ranges going through all layers.
|
790
894
|
for (var layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
|
791
895
|
this.highlight.useLayerLevel(layerLevel);
|
792
|
-
var areaHighlight = this.highlight.
|
793
|
-
var
|
794
|
-
var
|
896
|
+
var areaHighlight = this.highlight.createArea();
|
897
|
+
var areaLayeredHighlight = this.highlight.createLayeredArea();
|
898
|
+
var rowHeaderHighlight = this.highlight.createRowHeader();
|
899
|
+
var columnHeaderHighlight = this.highlight.createColumnHeader();
|
900
|
+
var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
|
901
|
+
var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
|
902
|
+
var activeCornerHeaderHighlight = this.highlight.createActiveCornerHeader();
|
903
|
+
var rowHighlight = this.highlight.createRowHighlight();
|
904
|
+
var columnHighlight = this.highlight.createColumnHighlight();
|
795
905
|
areaHighlight.commit();
|
796
|
-
|
797
|
-
|
906
|
+
areaLayeredHighlight.commit();
|
907
|
+
rowHeaderHighlight.commit();
|
908
|
+
columnHeaderHighlight.commit();
|
909
|
+
activeRowHeaderHighlight.commit();
|
910
|
+
activeColumnHeaderHighlight.commit();
|
911
|
+
activeCornerHeaderHighlight.commit();
|
912
|
+
rowHighlight.commit();
|
913
|
+
columnHighlight.commit();
|
798
914
|
}
|
799
915
|
|
800
916
|
// Reverting starting layer for the Highlight.
|