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