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
@@ -1,12 +1,10 @@
|
|
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";
|
5
1
|
import "core-js/modules/es.symbol.to-primitive.js";
|
6
2
|
import "core-js/modules/es.date.to-primitive.js";
|
3
|
+
import "core-js/modules/es.symbol.js";
|
7
4
|
import "core-js/modules/es.symbol.description.js";
|
8
5
|
import "core-js/modules/es.object.to-string.js";
|
9
6
|
import "core-js/modules/es.number.constructor.js";
|
7
|
+
import "core-js/modules/es.object.keys.js";
|
10
8
|
import "core-js/modules/es.array.filter.js";
|
11
9
|
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
12
10
|
import "core-js/modules/web.dom-collections.for-each.js";
|
@@ -15,31 +13,38 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
15
13
|
import "core-js/modules/es.array.iterator.js";
|
16
14
|
import "core-js/modules/es.string.iterator.js";
|
17
15
|
import "core-js/modules/web.dom-collections.iterator.js";
|
18
|
-
|
16
|
+
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); }
|
19
17
|
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
18
|
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
19
|
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; }
|
22
20
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
23
21
|
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
|
-
|
25
|
-
|
26
|
-
import
|
27
|
-
import
|
22
|
+
import staticRegister from "./../../../utils/staticRegister.mjs";
|
23
|
+
import { ACTIVE_HEADER_TYPE, AREA_TYPE, CELL_TYPE, CUSTOM_SELECTION_TYPE, FILL_TYPE, HEADER_TYPE } from "../constants.mjs";
|
24
|
+
import activeHeaderHighlight from "./activeHeader.mjs";
|
25
|
+
import areaHighlight from "./area.mjs";
|
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
|
+
|
28
40
|
/**
|
29
|
-
*
|
30
|
-
*
|
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.
|
41
|
+
* @param {string} highlightType The selection type.
|
42
|
+
* @param {object} options The selection options.
|
35
43
|
* @returns {Selection}
|
36
44
|
*/
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
selectionType: HIGHLIGHT_ROW_TYPE
|
44
|
-
}));
|
45
|
-
}
|
45
|
+
function createHighlight(highlightType, options) {
|
46
|
+
return getItem(highlightType)(_objectSpread({
|
47
|
+
type: highlightType
|
48
|
+
}, options));
|
49
|
+
}
|
50
|
+
export { createHighlight };
|
@@ -99,6 +99,10 @@ 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
|
+
}
|
102
106
|
visibleFromCoords = from;
|
103
107
|
visibleToCoords = to;
|
104
108
|
}
|
@@ -120,13 +124,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
120
124
|
key: "getNearestNotHiddenCoords",
|
121
125
|
value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
|
122
126
|
var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
|
123
|
-
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
|
127
|
+
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
|
124
128
|
|
125
129
|
// There are no more visual rows in the range.
|
126
130
|
if (nextVisibleRow === null) {
|
127
131
|
return null;
|
128
132
|
}
|
129
|
-
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
|
133
|
+
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
|
130
134
|
|
131
135
|
// There are no more visual columns in the range.
|
132
136
|
if (nextVisibleColumn === null) {
|
@@ -151,7 +155,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
151
155
|
if (visualIndex < 0) {
|
152
156
|
return visualIndex;
|
153
157
|
}
|
154
|
-
|
158
|
+
var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
|
159
|
+
var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
|
160
|
+
if (isHeaderSelectionType && nearestVisualIndex === null) {
|
161
|
+
return -1;
|
162
|
+
}
|
163
|
+
return nearestVisualIndex;
|
155
164
|
}
|
156
165
|
|
157
166
|
/**
|
@@ -192,29 +201,24 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
192
201
|
}, {
|
193
202
|
key: "syncWith",
|
194
203
|
value: function syncWith(broaderCellRange) {
|
195
|
-
var coordsFrom = broaderCellRange.from.clone().normalize();
|
196
204
|
var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
|
197
205
|
var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
|
198
|
-
var
|
199
|
-
if (
|
200
|
-
|
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.
|
206
|
+
var singleCellRangeVisual = this.getNearestNotHiddenCoords(broaderCellRange.from.clone().normalize(), rowDirection, columnDirection);
|
207
|
+
if (singleCellRangeVisual !== null && broaderCellRange.overlaps(singleCellRangeVisual)) {
|
208
|
+
// We can't show selection visually now, but we found fist visible range in the broader cell range.
|
209
209
|
if (this.cellRange === null) {
|
210
|
-
var
|
211
|
-
this.cellRange = this.settings.createCellRange(
|
210
|
+
var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
|
211
|
+
this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
|
212
212
|
}
|
213
213
|
|
214
214
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
215
215
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
216
|
-
broaderCellRange.setHighlight(
|
216
|
+
broaderCellRange.setHighlight(singleCellRangeVisual);
|
217
|
+
return this;
|
217
218
|
}
|
219
|
+
|
220
|
+
// Fallback to the start of the range. It resets the previous highlight (for example, when all columns have been hidden).
|
221
|
+
broaderCellRange.setHighlight(broaderCellRange.from);
|
218
222
|
return this;
|
219
223
|
}
|
220
224
|
|
@@ -232,7 +236,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
232
236
|
var _this$cellRange = this.cellRange,
|
233
237
|
from = _this$cellRange.from,
|
234
238
|
to = _this$cellRange.to;
|
235
|
-
|
239
|
+
var isRowUndefined = from.row === null || to.row === null;
|
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];
|
236
244
|
}
|
237
245
|
|
238
246
|
/**
|
@@ -257,16 +265,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
257
265
|
* points to the beginning of the selection.
|
258
266
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
259
267
|
* points to the end of the selection.
|
260
|
-
* @returns {CellRange
|
268
|
+
* @returns {CellRange}
|
261
269
|
*/
|
262
270
|
}, {
|
263
271
|
key: "createRenderableCellRange",
|
264
272
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
265
273
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
266
274
|
var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
|
267
|
-
if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
|
268
|
-
return null;
|
269
|
-
}
|
270
275
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
271
276
|
}
|
272
277
|
}]);
|
@@ -95,6 +95,10 @@ 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
|
+
}
|
98
102
|
visibleFromCoords = from;
|
99
103
|
visibleToCoords = to;
|
100
104
|
}
|
@@ -116,13 +120,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
116
120
|
key: "getNearestNotHiddenCoords",
|
117
121
|
value: function getNearestNotHiddenCoords(coords, rowSearchDirection) {
|
118
122
|
var columnSearchDirection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rowSearchDirection;
|
119
|
-
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper, coords.row, rowSearchDirection);
|
123
|
+
var nextVisibleRow = this.getNearestNotHiddenIndex(this.settings.rowIndexMapper(), coords.row, rowSearchDirection);
|
120
124
|
|
121
125
|
// There are no more visual rows in the range.
|
122
126
|
if (nextVisibleRow === null) {
|
123
127
|
return null;
|
124
128
|
}
|
125
|
-
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper, coords.col, columnSearchDirection);
|
129
|
+
var nextVisibleColumn = this.getNearestNotHiddenIndex(this.settings.columnIndexMapper(), coords.col, columnSearchDirection);
|
126
130
|
|
127
131
|
// There are no more visual columns in the range.
|
128
132
|
if (nextVisibleColumn === null) {
|
@@ -147,7 +151,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
147
151
|
if (visualIndex < 0) {
|
148
152
|
return visualIndex;
|
149
153
|
}
|
150
|
-
|
154
|
+
var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
|
155
|
+
var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
|
156
|
+
if (isHeaderSelectionType && nearestVisualIndex === null) {
|
157
|
+
return -1;
|
158
|
+
}
|
159
|
+
return nearestVisualIndex;
|
151
160
|
}
|
152
161
|
|
153
162
|
/**
|
@@ -188,29 +197,24 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
188
197
|
}, {
|
189
198
|
key: "syncWith",
|
190
199
|
value: function syncWith(broaderCellRange) {
|
191
|
-
var coordsFrom = broaderCellRange.from.clone().normalize();
|
192
200
|
var rowDirection = broaderCellRange.getVerticalDirection() === 'N-S' ? 1 : -1;
|
193
201
|
var columnDirection = broaderCellRange.getHorizontalDirection() === 'W-E' ? 1 : -1;
|
194
|
-
var
|
195
|
-
if (
|
196
|
-
|
197
|
-
if (currentHighlight.row >= 0) {
|
198
|
-
currentHighlight.row = cellCoordsVisual.row;
|
199
|
-
}
|
200
|
-
if (currentHighlight.col >= 0) {
|
201
|
-
currentHighlight.col = cellCoordsVisual.col;
|
202
|
-
}
|
203
|
-
|
204
|
-
// We can't show selection visually now, but we found first visible range in the broader cell range.
|
202
|
+
var singleCellRangeVisual = this.getNearestNotHiddenCoords(broaderCellRange.from.clone().normalize(), rowDirection, columnDirection);
|
203
|
+
if (singleCellRangeVisual !== null && broaderCellRange.overlaps(singleCellRangeVisual)) {
|
204
|
+
// We can't show selection visually now, but we found fist visible range in the broader cell range.
|
205
205
|
if (this.cellRange === null) {
|
206
|
-
var
|
207
|
-
this.cellRange = this.settings.createCellRange(
|
206
|
+
var singleCellRangeRenderable = this.settings.visualToRenderableCoords(singleCellRangeVisual);
|
207
|
+
this.cellRange = this.settings.createCellRange(singleCellRangeRenderable);
|
208
208
|
}
|
209
209
|
|
210
210
|
// We set new highlight as it might change (for example, when showing/hiding some cells from the broader selection range)
|
211
211
|
// TODO: It is also handled by the `MergeCells` plugin while adjusting already modified coordinates. Should it?
|
212
|
-
broaderCellRange.setHighlight(
|
212
|
+
broaderCellRange.setHighlight(singleCellRangeVisual);
|
213
|
+
return this;
|
213
214
|
}
|
215
|
+
|
216
|
+
// Fallback to the start of the range. It resets the previous highlight (for example, when all columns have been hidden).
|
217
|
+
broaderCellRange.setHighlight(broaderCellRange.from);
|
214
218
|
return this;
|
215
219
|
}
|
216
220
|
|
@@ -228,7 +232,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
228
232
|
var _this$cellRange = this.cellRange,
|
229
233
|
from = _this$cellRange.from,
|
230
234
|
to = _this$cellRange.to;
|
231
|
-
|
235
|
+
var isRowUndefined = from.row === null || to.row === null;
|
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];
|
232
240
|
}
|
233
241
|
|
234
242
|
/**
|
@@ -253,16 +261,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
253
261
|
* points to the beginning of the selection.
|
254
262
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
255
263
|
* points to the end of the selection.
|
256
|
-
* @returns {CellRange
|
264
|
+
* @returns {CellRange}
|
257
265
|
*/
|
258
266
|
}, {
|
259
267
|
key: "createRenderableCellRange",
|
260
268
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
261
269
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
262
270
|
var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
|
263
|
-
if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
|
264
|
-
return null;
|
265
|
-
}
|
266
271
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
267
272
|
}
|
268
273
|
}]);
|
package/selection/index.js
CHANGED
@@ -5,11 +5,14 @@ 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,
|
8
9
|
Selection: true,
|
9
10
|
handleMouseEvent: true,
|
10
11
|
detectSelectionType: true,
|
11
12
|
normalizeSelectionFactory: true
|
12
13
|
};
|
14
|
+
var _highlight = _interopRequireDefault(require("./highlight/highlight"));
|
15
|
+
exports.Highlight = _highlight.default;
|
13
16
|
var _selection = _interopRequireDefault(require("./selection"));
|
14
17
|
exports.Selection = _selection.default;
|
15
18
|
var _mouseEventHandler = require("./mouseEventHandler");
|
@@ -17,11 +20,11 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
|
|
17
20
|
var _utils = require("./utils");
|
18
21
|
exports.detectSelectionType = _utils.detectSelectionType;
|
19
22
|
exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
|
20
|
-
var
|
21
|
-
Object.keys(
|
23
|
+
var _constants = require("./highlight/constants");
|
24
|
+
Object.keys(_constants).forEach(function (key) {
|
22
25
|
if (key === "default" || key === "__esModule") return;
|
23
26
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
24
|
-
if (key in exports && exports[key] ===
|
25
|
-
exports[key] =
|
27
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
28
|
+
exports[key] = _constants[key];
|
26
29
|
});
|
27
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/selection/index.mjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
import Highlight from "./highlight/highlight.mjs";
|
1
2
|
import Selection from "./selection.mjs";
|
2
3
|
import { handleMouseEvent } from "./mouseEventHandler.mjs";
|
3
4
|
import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
|
4
|
-
export * from "./highlight/
|
5
|
-
export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory };
|
5
|
+
export * from "./highlight/constants.mjs";
|
6
|
+
export { handleMouseEvent, Highlight, 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(0);
|
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(-1);
|
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 offset where that coordinate resides in the collection.
|
155
155
|
*
|
156
|
-
* @param {number} [
|
157
|
-
* latest range.
|
156
|
+
* @param {number} [offset=0] An offset where the coordinate will be retrieved from.
|
158
157
|
* @returns {CellRange|undefined}
|
159
158
|
*/
|
160
159
|
}, {
|
161
160
|
key: "peekByIndex",
|
162
161
|
value: function peekByIndex() {
|
163
|
-
var
|
162
|
+
var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
163
|
+
var rangeIndex = this.size() + offset - 1;
|
164
164
|
var cellRange;
|
165
|
-
if (
|
166
|
-
cellRange = this.ranges[
|
165
|
+
if (rangeIndex >= 0) {
|
166
|
+
cellRange = this.ranges[rangeIndex];
|
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(0);
|
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(-1);
|
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 offset where that coordinate resides in the collection.
|
151
151
|
*
|
152
|
-
* @param {number} [
|
153
|
-
* latest range.
|
152
|
+
* @param {number} [offset=0] An offset where the coordinate will be retrieved from.
|
154
153
|
* @returns {CellRange|undefined}
|
155
154
|
*/
|
156
155
|
}, {
|
157
156
|
key: "peekByIndex",
|
158
157
|
value: function peekByIndex() {
|
159
|
-
var
|
158
|
+
var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
159
|
+
var rangeIndex = this.size() + offset - 1;
|
160
160
|
var cellRange;
|
161
|
-
if (
|
162
|
-
cellRange = this.ranges[
|
161
|
+
if (rangeIndex >= 0) {
|
162
|
+
cellRange = this.ranges[rangeIndex];
|
163
163
|
}
|
164
164
|
return cellRange;
|
165
165
|
}
|