handsontable 0.0.0-next-b7cca45-20230605 → 0.0.0-next-aa25cac-20230607
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 +123 -308
- package/core.mjs +123 -308
- 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 +12578 -10028
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +18881 -16331
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +21 -82
- package/editorManager.mjs +26 -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.d.ts +5 -1
- package/pluginHooks.js +89 -1
- package/pluginHooks.mjs +89 -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 +132 -10
- package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
- 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 +31 -27
- package/selection/highlight/visualSelection.mjs +31 -27
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +315 -180
- package/selection/selection.mjs +310 -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 +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -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/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -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/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -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 +244 -0
- package/shortcutContexts/grid.mjs +240 -0
- package/shortcutContexts/index.js +29 -0
- package/shortcutContexts/index.mjs +15 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -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
@@ -15,7 +15,7 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
15
15
|
import "core-js/modules/es.array.iterator.js";
|
16
16
|
import "core-js/modules/es.string.iterator.js";
|
17
17
|
import "core-js/modules/web.dom-collections.iterator.js";
|
18
|
-
var _excluded = ["headerClassName"
|
18
|
+
var _excluded = ["headerClassName"];
|
19
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
21
21
|
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; }
|
@@ -23,32 +23,23 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
23
23
|
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); }
|
24
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
25
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
26
|
-
import {
|
26
|
+
import { HIGHLIGHT_HEADER_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
|
27
27
|
import VisualSelection from "../visualSelection.mjs";
|
28
28
|
/**
|
29
|
-
* Creates the new instance of Selection, responsible for highlighting
|
30
|
-
*
|
29
|
+
* Creates the new instance of Selection, responsible for highlighting column or row headers when
|
30
|
+
* any cell is selected.
|
31
|
+
* This type of selection can occur multiple times.
|
31
32
|
*
|
32
33
|
* @param {object} highlightParams A configuration object to create a highlight.
|
33
34
|
* @param {string} highlightParams.headerClassName Highlighted headers' class name.
|
34
|
-
* @param {string} highlightParams.rowClassName Highlighted row' class name.
|
35
|
-
* @param {string} highlightParams.columnClassName Highlighted column' class name.
|
36
35
|
* @returns {Selection}
|
37
36
|
*/
|
38
|
-
function createHighlight(_ref) {
|
37
|
+
export function createHighlight(_ref) {
|
39
38
|
var headerClassName = _ref.headerClassName,
|
40
|
-
rowClassName = _ref.rowClassName,
|
41
|
-
columnClassName = _ref.columnClassName,
|
42
39
|
restOptions = _objectWithoutProperties(_ref, _excluded);
|
43
|
-
|
44
|
-
className:
|
45
|
-
highlightHeaderClassName: headerClassName,
|
46
|
-
highlightRowClassName: rowClassName,
|
47
|
-
highlightColumnClassName: columnClassName
|
40
|
+
return new VisualSelection(_objectSpread(_objectSpread({
|
41
|
+
className: headerClassName
|
48
42
|
}, restOptions), {}, {
|
49
|
-
|
50
|
-
selectionType: HEADER_TYPE
|
43
|
+
selectionType: HIGHLIGHT_HEADER_TYPE
|
51
44
|
}));
|
52
|
-
|
53
|
-
}
|
54
|
-
export default createHighlight;
|
45
|
+
}
|
@@ -1,6 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
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); }
|
3
4
|
require("core-js/modules/es.object.keys.js");
|
5
|
+
require("core-js/modules/es.array.index-of.js");
|
6
|
+
require("core-js/modules/es.symbol.js");
|
7
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
8
|
+
require("core-js/modules/es.date.to-primitive.js");
|
9
|
+
require("core-js/modules/es.symbol.description.js");
|
10
|
+
require("core-js/modules/es.object.to-string.js");
|
11
|
+
require("core-js/modules/es.number.constructor.js");
|
4
12
|
require("core-js/modules/es.array.filter.js");
|
5
13
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
6
14
|
require("core-js/modules/web.dom-collections.for-each.js");
|
@@ -11,44 +19,32 @@ require("core-js/modules/es.string.iterator.js");
|
|
11
19
|
require("core-js/modules/web.dom-collections.iterator.js");
|
12
20
|
exports.__esModule = true;
|
13
21
|
exports.createHighlight = createHighlight;
|
14
|
-
require("
|
15
|
-
require("
|
16
|
-
|
17
|
-
require("core-js/modules/es.symbol.description.js");
|
18
|
-
require("core-js/modules/es.object.to-string.js");
|
19
|
-
require("core-js/modules/es.number.constructor.js");
|
20
|
-
var _staticRegister2 = _interopRequireDefault(require("./../../../utils/staticRegister"));
|
21
|
-
var _constants = require("../constants");
|
22
|
-
var _activeHeader = _interopRequireDefault(require("./activeHeader"));
|
23
|
-
var _area = _interopRequireDefault(require("./area"));
|
24
|
-
var _cell = _interopRequireDefault(require("./cell"));
|
25
|
-
var _customSelection = _interopRequireDefault(require("./customSelection"));
|
26
|
-
var _fill = _interopRequireDefault(require("./fill"));
|
27
|
-
var _header = _interopRequireDefault(require("./header"));
|
22
|
+
var _src = require("../../../3rdparty/walkontable/src");
|
23
|
+
var _visualSelection = _interopRequireDefault(require("../visualSelection"));
|
24
|
+
var _excluded = ["rowClassName"];
|
28
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
29
|
-
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); }
|
30
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
31
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
32
28
|
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; }
|
33
29
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
34
30
|
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); }
|
35
|
-
var
|
36
|
-
|
37
|
-
getItem = _staticRegister.getItem;
|
38
|
-
register(_constants.ACTIVE_HEADER_TYPE, _activeHeader.default);
|
39
|
-
register(_constants.AREA_TYPE, _area.default);
|
40
|
-
register(_constants.CELL_TYPE, _cell.default);
|
41
|
-
register(_constants.CUSTOM_SELECTION_TYPE, _customSelection.default);
|
42
|
-
register(_constants.FILL_TYPE, _fill.default);
|
43
|
-
register(_constants.HEADER_TYPE, _header.default);
|
44
|
-
|
31
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
45
33
|
/**
|
46
|
-
*
|
47
|
-
*
|
34
|
+
* Creates the new instance of Selection, responsible for highlighting cells in a rows and
|
35
|
+
* row headers.
|
36
|
+
* This type of selection can occur multiple times.
|
37
|
+
*
|
38
|
+
* @param {object} highlightParams A configuration object to create a highlight.
|
39
|
+
* @param {string} highlightParams.rowClassName Highlighted row' class name.
|
48
40
|
* @returns {Selection}
|
49
41
|
*/
|
50
|
-
function createHighlight(
|
51
|
-
|
52
|
-
|
53
|
-
|
42
|
+
function createHighlight(_ref) {
|
43
|
+
var rowClassName = _ref.rowClassName,
|
44
|
+
restOptions = _objectWithoutProperties(_ref, _excluded);
|
45
|
+
return new _visualSelection.default(_objectSpread(_objectSpread({
|
46
|
+
className: rowClassName
|
47
|
+
}, restOptions), {}, {
|
48
|
+
selectionType: _src.HIGHLIGHT_ROW_TYPE
|
49
|
+
}));
|
54
50
|
}
|
@@ -1,10 +1,12 @@
|
|
1
|
+
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); }
|
2
|
+
import "core-js/modules/es.object.keys.js";
|
3
|
+
import "core-js/modules/es.array.index-of.js";
|
4
|
+
import "core-js/modules/es.symbol.js";
|
1
5
|
import "core-js/modules/es.symbol.to-primitive.js";
|
2
6
|
import "core-js/modules/es.date.to-primitive.js";
|
3
|
-
import "core-js/modules/es.symbol.js";
|
4
7
|
import "core-js/modules/es.symbol.description.js";
|
5
8
|
import "core-js/modules/es.object.to-string.js";
|
6
9
|
import "core-js/modules/es.number.constructor.js";
|
7
|
-
import "core-js/modules/es.object.keys.js";
|
8
10
|
import "core-js/modules/es.array.filter.js";
|
9
11
|
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
10
12
|
import "core-js/modules/web.dom-collections.for-each.js";
|
@@ -13,38 +15,31 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
13
15
|
import "core-js/modules/es.array.iterator.js";
|
14
16
|
import "core-js/modules/es.string.iterator.js";
|
15
17
|
import "core-js/modules/web.dom-collections.iterator.js";
|
16
|
-
|
18
|
+
var _excluded = ["rowClassName"];
|
17
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
19
21
|
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; }
|
20
22
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
21
23
|
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); }
|
22
|
-
|
23
|
-
|
24
|
-
import
|
25
|
-
import
|
26
|
-
import cellHighlight from "./cell.mjs";
|
27
|
-
import customSelection from "./customSelection.mjs";
|
28
|
-
import fillHighlight from "./fill.mjs";
|
29
|
-
import headerHighlight from "./header.mjs";
|
30
|
-
var _staticRegister = staticRegister('highlight/types'),
|
31
|
-
register = _staticRegister.register,
|
32
|
-
getItem = _staticRegister.getItem;
|
33
|
-
register(ACTIVE_HEADER_TYPE, activeHeaderHighlight);
|
34
|
-
register(AREA_TYPE, areaHighlight);
|
35
|
-
register(CELL_TYPE, cellHighlight);
|
36
|
-
register(CUSTOM_SELECTION_TYPE, customSelection);
|
37
|
-
register(FILL_TYPE, fillHighlight);
|
38
|
-
register(HEADER_TYPE, headerHighlight);
|
39
|
-
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
26
|
+
import { HIGHLIGHT_ROW_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
|
27
|
+
import VisualSelection from "../visualSelection.mjs";
|
40
28
|
/**
|
41
|
-
*
|
42
|
-
*
|
29
|
+
* Creates the new instance of Selection, responsible for highlighting cells in a rows and
|
30
|
+
* row headers.
|
31
|
+
* This type of selection can occur multiple times.
|
32
|
+
*
|
33
|
+
* @param {object} highlightParams A configuration object to create a highlight.
|
34
|
+
* @param {string} highlightParams.rowClassName Highlighted row' class name.
|
43
35
|
* @returns {Selection}
|
44
36
|
*/
|
45
|
-
function createHighlight(
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
export function createHighlight(_ref) {
|
38
|
+
var rowClassName = _ref.rowClassName,
|
39
|
+
restOptions = _objectWithoutProperties(_ref, _excluded);
|
40
|
+
return new VisualSelection(_objectSpread(_objectSpread({
|
41
|
+
className: rowClassName
|
42
|
+
}, restOptions), {}, {
|
43
|
+
selectionType: HIGHLIGHT_ROW_TYPE
|
44
|
+
}));
|
45
|
+
}
|
@@ -99,10 +99,6 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
99
99
|
return null;
|
100
100
|
}
|
101
101
|
if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
|
102
|
-
var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
|
103
|
-
if (!isHeaderTypeSelection) {
|
104
|
-
return null;
|
105
|
-
}
|
106
102
|
visibleFromCoords = from;
|
107
103
|
visibleToCoords = to;
|
108
104
|
}
|
@@ -124,13 +120,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
124
120
|
key: "getNearestNotHiddenCoords",
|
125
121
|
value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
|
126
122
|
var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
|
127
|
-
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper
|
123
|
+
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
|
128
124
|
|
129
125
|
// There are no more visual rows in the range.
|
130
126
|
if (nextVisibleRow === null) {
|
131
127
|
return null;
|
132
128
|
}
|
133
|
-
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper
|
129
|
+
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
|
134
130
|
|
135
131
|
// There are no more visual columns in the range.
|
136
132
|
if (nextVisibleColumn === null) {
|
@@ -155,12 +151,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
155
151
|
if (visualIndex < 0) {
|
156
152
|
return visualIndex;
|
157
153
|
}
|
158
|
-
|
159
|
-
var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
|
160
|
-
if (isHeaderSelectionType && nearestVisualIndex === null) {
|
161
|
-
return -1;
|
162
|
-
}
|
163
|
-
return nearestVisualIndex;
|
154
|
+
return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
|
164
155
|
}
|
165
156
|
|
166
157
|
/**
|
@@ -201,24 +192,38 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
201
192
|
}, {
|
202
193
|
key: "syncWith",
|
203
194
|
value: function syncWith(broaderCellRange) {
|
195
|
+
var coordsFrom = broaderCellRange.from.clone().normalize();
|
204
196
|
var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
|
205
197
|
var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
|
206
|
-
var
|
207
|
-
|
208
|
-
|
198
|
+
var renderableHighlight = this.settings.visualToRenderableCoords(this.visualCellRange.highlight);
|
199
|
+
var cellCoordsVisual = null;
|
200
|
+
if (renderableHighlight === null || renderableHighlight.col === null || renderableHighlight.row === null) {
|
201
|
+
cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
|
202
|
+
}
|
203
|
+
if (cellCoordsVisual !== null && broaderCellRange.overlaps(cellCoordsVisual)) {
|
204
|
+
var currentHighlight = broaderCellRange.highlight.clone();
|
205
|
+
if (currentHighlight.row >= 0) {
|
206
|
+
currentHighlight.row = cellCoordsVisual.row;
|
207
|
+
}
|
208
|
+
if (currentHighlight.col >= 0) {
|
209
|
+
currentHighlight.col = cellCoordsVisual.col;
|
210
|
+
}
|
211
|
+
|
212
|
+
// We can't show selection visually now, but we found first visible range in the broader cell range.
|
209
213
|
if (this.cellRange === null) {
|
210
|
-
var
|
211
|
-
this.cellRange = this.settings.createCellRange(
|
214
|
+
var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
|
215
|
+
this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
|
212
216
|
}
|
213
217
|
|
214
218
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
215
219
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
216
|
-
broaderCellRange.setHighlight(
|
217
|
-
return this;
|
220
|
+
broaderCellRange.setHighlight(currentHighlight);
|
218
221
|
}
|
219
222
|
|
220
|
-
//
|
221
|
-
|
223
|
+
// Sync the highlight coords from the visual selection layer with logical coords.
|
224
|
+
if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
|
225
|
+
broaderCellRange.setHighlight(this.visualCellRange.highlight);
|
226
|
+
}
|
222
227
|
return this;
|
223
228
|
}
|
224
229
|
|
@@ -236,11 +241,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
236
241
|
var _this$cellRange = this.cellRange,
|
237
242
|
from = _this$cellRange.from,
|
238
243
|
to = _this$cellRange.to;
|
239
|
-
|
240
|
-
var isColumnUndefined = from.col === null || to.col === null;
|
241
|
-
var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
|
242
|
-
var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
|
243
|
-
return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
|
244
|
+
return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
|
244
245
|
}
|
245
246
|
|
246
247
|
/**
|
@@ -265,13 +266,16 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
265
266
|
* points to the beginning of the selection.
|
266
267
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
267
268
|
* points to the end of the selection.
|
268
|
-
* @returns {CellRange}
|
269
|
+
* @returns {CellRange|null}
|
269
270
|
*/
|
270
271
|
}, {
|
271
272
|
key: "createRenderableCellRange",
|
272
273
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
273
274
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
274
275
|
var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
|
276
|
+
if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
|
277
|
+
return null;
|
278
|
+
}
|
275
279
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
276
280
|
}
|
277
281
|
}]);
|
@@ -95,10 +95,6 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
95
95
|
return null;
|
96
96
|
}
|
97
97
|
if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
|
98
|
-
var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
|
99
|
-
if (!isHeaderTypeSelection) {
|
100
|
-
return null;
|
101
|
-
}
|
102
98
|
visibleFromCoords = from;
|
103
99
|
visibleToCoords = to;
|
104
100
|
}
|
@@ -120,13 +116,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
120
116
|
key: "getNearestNotHiddenCoords",
|
121
117
|
value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
|
122
118
|
var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
|
123
|
-
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper
|
119
|
+
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
|
124
120
|
|
125
121
|
// There are no more visual rows in the range.
|
126
122
|
if (nextVisibleRow === null) {
|
127
123
|
return null;
|
128
124
|
}
|
129
|
-
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper
|
125
|
+
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
|
130
126
|
|
131
127
|
// There are no more visual columns in the range.
|
132
128
|
if (nextVisibleColumn === null) {
|
@@ -151,12 +147,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
151
147
|
if (visualIndex < 0) {
|
152
148
|
return visualIndex;
|
153
149
|
}
|
154
|
-
|
155
|
-
var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
|
156
|
-
if (isHeaderSelectionType && nearestVisualIndex === null) {
|
157
|
-
return -1;
|
158
|
-
}
|
159
|
-
return nearestVisualIndex;
|
150
|
+
return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
|
160
151
|
}
|
161
152
|
|
162
153
|
/**
|
@@ -197,24 +188,38 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
197
188
|
}, {
|
198
189
|
key: "syncWith",
|
199
190
|
value: function syncWith(broaderCellRange) {
|
191
|
+
var coordsFrom = broaderCellRange.from.clone().normalize();
|
200
192
|
var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
|
201
193
|
var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
|
202
|
-
var
|
203
|
-
|
204
|
-
|
194
|
+
var renderableHighlight = this.settings.visualToRenderableCoords(this.visualCellRange.highlight);
|
195
|
+
var cellCoordsVisual = null;
|
196
|
+
if (renderableHighlight === null || renderableHighlight.col === null || renderableHighlight.row === null) {
|
197
|
+
cellCoordsVisual = this.getNearestNotHiddenCoords(coordsFrom, rowDirection, columnDirection);
|
198
|
+
}
|
199
|
+
if (cellCoordsVisual !== null && broaderCellRange.overlaps(cellCoordsVisual)) {
|
200
|
+
var currentHighlight = broaderCellRange.highlight.clone();
|
201
|
+
if (currentHighlight.row >= 0) {
|
202
|
+
currentHighlight.row = cellCoordsVisual.row;
|
203
|
+
}
|
204
|
+
if (currentHighlight.col >= 0) {
|
205
|
+
currentHighlight.col = cellCoordsVisual.col;
|
206
|
+
}
|
207
|
+
|
208
|
+
// We can't show selection visually now, but we found first visible range in the broader cell range.
|
205
209
|
if (this.cellRange === null) {
|
206
|
-
var
|
207
|
-
this.cellRange = this.settings.createCellRange(
|
210
|
+
var cellCoordsRenderable = this.settings.visualToRenderableCoords(currentHighlight);
|
211
|
+
this.cellRange = this.settings.createCellRange(cellCoordsRenderable);
|
208
212
|
}
|
209
213
|
|
210
214
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
211
215
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
212
|
-
broaderCellRange.setHighlight(
|
213
|
-
return this;
|
216
|
+
broaderCellRange.setHighlight(currentHighlight);
|
214
217
|
}
|
215
218
|
|
216
|
-
//
|
217
|
-
|
219
|
+
// Sync the highlight coords from the visual selection layer with logical coords.
|
220
|
+
if (this.settings.selectionType === 'focus' && renderableHighlight !== null && cellCoordsVisual === null) {
|
221
|
+
broaderCellRange.setHighlight(this.visualCellRange.highlight);
|
222
|
+
}
|
218
223
|
return this;
|
219
224
|
}
|
220
225
|
|
@@ -232,11 +237,7 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
232
237
|
var _this$cellRange = this.cellRange,
|
233
238
|
from = _this$cellRange.from,
|
234
239
|
to = _this$cellRange.to;
|
235
|
-
|
236
|
-
var isColumnUndefined = from.col === null || to.col === null;
|
237
|
-
var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
|
238
|
-
var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
|
239
|
-
return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
|
240
|
+
return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
|
240
241
|
}
|
241
242
|
|
242
243
|
/**
|
@@ -261,13 +262,16 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
261
262
|
* points to the beginning of the selection.
|
262
263
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
263
264
|
* points to the end of the selection.
|
264
|
-
* @returns {CellRange}
|
265
|
+
* @returns {CellRange|null}
|
265
266
|
*/
|
266
267
|
}, {
|
267
268
|
key: "createRenderableCellRange",
|
268
269
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
269
270
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
270
271
|
var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
|
272
|
+
if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
|
273
|
+
return null;
|
274
|
+
}
|
271
275
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
272
276
|
}
|
273
277
|
}]);
|
package/selection/index.js
CHANGED
@@ -5,14 +5,11 @@ require("core-js/modules/web.dom-collections.for-each.js");
|
|
5
5
|
require("core-js/modules/es.object.keys.js");
|
6
6
|
exports.__esModule = true;
|
7
7
|
var _exportNames = {
|
8
|
-
Highlight: true,
|
9
8
|
Selection: true,
|
10
9
|
handleMouseEvent: true,
|
11
10
|
detectSelectionType: true,
|
12
11
|
normalizeSelectionFactory: true
|
13
12
|
};
|
14
|
-
var _highlight = _interopRequireDefault(require("./highlight/highlight"));
|
15
|
-
exports.Highlight = _highlight.default;
|
16
13
|
var _selection = _interopRequireDefault(require("./selection"));
|
17
14
|
exports.Selection = _selection.default;
|
18
15
|
var _mouseEventHandler = require("./mouseEventHandler");
|
@@ -20,11 +17,11 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
|
|
20
17
|
var _utils = require("./utils");
|
21
18
|
exports.detectSelectionType = _utils.detectSelectionType;
|
22
19
|
exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
|
23
|
-
var
|
24
|
-
Object.keys(
|
20
|
+
var _highlight = require("./highlight/highlight");
|
21
|
+
Object.keys(_highlight).forEach(function (key) {
|
25
22
|
if (key === "default" || key === "__esModule") return;
|
26
23
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
27
|
-
if (key in exports && exports[key] ===
|
28
|
-
exports[key] =
|
24
|
+
if (key in exports && exports[key] === _highlight[key]) return;
|
25
|
+
exports[key] = _highlight[key];
|
29
26
|
});
|
30
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/selection/index.mjs
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import Highlight from "./highlight/highlight.mjs";
|
2
1
|
import Selection from "./selection.mjs";
|
3
2
|
import { handleMouseEvent } from "./mouseEventHandler.mjs";
|
4
3
|
import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
|
5
|
-
export * from "./highlight/
|
6
|
-
export { handleMouseEvent,
|
4
|
+
export * from "./highlight/highlight.mjs";
|
5
|
+
export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory };
|
package/selection/range.js
CHANGED
@@ -98,7 +98,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
98
98
|
}, {
|
99
99
|
key: "current",
|
100
100
|
value: function current() {
|
101
|
-
return this.peekByIndex(
|
101
|
+
return this.peekByIndex(this.size() - 1);
|
102
102
|
}
|
103
103
|
|
104
104
|
/**
|
@@ -109,7 +109,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
109
109
|
}, {
|
110
110
|
key: "previous",
|
111
111
|
value: function previous() {
|
112
|
-
return this.peekByIndex(-
|
112
|
+
return this.peekByIndex(this.size() - 2);
|
113
113
|
}
|
114
114
|
|
115
115
|
/**
|
@@ -151,19 +151,19 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
151
151
|
}
|
152
152
|
|
153
153
|
/**
|
154
|
-
* Peek the coordinates based on the
|
154
|
+
* Peek the coordinates based on the index where that coordinate resides in the collection.
|
155
155
|
*
|
156
|
-
* @param {number} [
|
156
|
+
* @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
|
157
|
+
* latest range.
|
157
158
|
* @returns {CellRange|undefined}
|
158
159
|
*/
|
159
160
|
}, {
|
160
161
|
key: "peekByIndex",
|
161
162
|
value: function peekByIndex() {
|
162
|
-
var
|
163
|
-
var rangeIndex = this.size() + offset - 1;
|
163
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
164
164
|
var cellRange;
|
165
|
-
if (
|
166
|
-
cellRange = this.ranges[
|
165
|
+
if (index >= 0 && index < this.size()) {
|
166
|
+
cellRange = this.ranges[index];
|
167
167
|
}
|
168
168
|
return cellRange;
|
169
169
|
}
|
package/selection/range.mjs
CHANGED
@@ -94,7 +94,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
94
94
|
}, {
|
95
95
|
key: "current",
|
96
96
|
value: function current() {
|
97
|
-
return this.peekByIndex(
|
97
|
+
return this.peekByIndex(this.size() - 1);
|
98
98
|
}
|
99
99
|
|
100
100
|
/**
|
@@ -105,7 +105,7 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
105
105
|
}, {
|
106
106
|
key: "previous",
|
107
107
|
value: function previous() {
|
108
|
-
return this.peekByIndex(-
|
108
|
+
return this.peekByIndex(this.size() - 2);
|
109
109
|
}
|
110
110
|
|
111
111
|
/**
|
@@ -147,19 +147,19 @@ var SelectionRange = /*#__PURE__*/function (_Symbol$iterator) {
|
|
147
147
|
}
|
148
148
|
|
149
149
|
/**
|
150
|
-
* Peek the coordinates based on the
|
150
|
+
* Peek the coordinates based on the index where that coordinate resides in the collection.
|
151
151
|
*
|
152
|
-
* @param {number} [
|
152
|
+
* @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the
|
153
|
+
* latest range.
|
153
154
|
* @returns {CellRange|undefined}
|
154
155
|
*/
|
155
156
|
}, {
|
156
157
|
key: "peekByIndex",
|
157
158
|
value: function peekByIndex() {
|
158
|
-
var
|
159
|
-
var rangeIndex = this.size() + offset - 1;
|
159
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
160
160
|
var cellRange;
|
161
|
-
if (
|
162
|
-
cellRange = this.ranges[
|
161
|
+
if (index >= 0 && index < this.size()) {
|
162
|
+
cellRange = this.ranges[index];
|
163
163
|
}
|
164
164
|
return cellRange;
|
165
165
|
}
|