handsontable 0.0.0-next-ecc62fd-20230525 → 0.0.0-next-93e34dc-20230601
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +61 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +44 -7
- package/3rdparty/walkontable/src/cell/range.mjs +44 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
- package/3rdparty/walkontable/src/overlay/top.js +2 -4
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
- package/3rdparty/walkontable/src/selection/constants.js +63 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +30 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +328 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
- package/3rdparty/walkontable/src/selection/scanner.js +363 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
- package/3rdparty/walkontable/src/selection/selection.js +133 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +7 -79
- package/3rdparty/walkontable/src/table.mjs +8 -80
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +5 -3
- package/core.js +82 -300
- package/core.mjs +82 -300
- package/dataMap/metaManager/metaSchema.js +15 -0
- package/dataMap/metaManager/metaSchema.mjs +15 -0
- package/dist/handsontable.css +8 -3
- package/dist/handsontable.full.css +8 -3
- package/dist/handsontable.full.js +12245 -9953
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +15898 -13606
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +20 -82
- package/editorManager.mjs +25 -86
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +5 -1
- package/plugins/copyPaste/copyPaste.mjs +5 -1
- package/plugins/customBorders/customBorders.js +18 -52
- package/plugins/customBorders/customBorders.mjs +19 -53
- package/plugins/mergeCells/mergeCells.js +5 -18
- package/plugins/mergeCells/mergeCells.mjs +5 -18
- package/plugins/nestedHeaders/nestedHeaders.js +89 -9
- package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +311 -88
- package/selection/highlight/highlight.mjs +301 -84
- package/selection/highlight/types/activeHeader.js +10 -9
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +12 -27
- package/selection/highlight/types/area.mjs +16 -30
- package/selection/highlight/types/areaLayered.js +54 -0
- package/selection/highlight/types/areaLayered.mjs +49 -0
- package/selection/highlight/types/column.js +50 -0
- package/selection/highlight/types/column.mjs +45 -0
- package/selection/highlight/types/customSelection.js +7 -10
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -8
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -8
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +10 -20
- package/selection/highlight/types/header.mjs +10 -19
- package/selection/highlight/types/{index.js → row.js} +27 -31
- package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
- package/selection/highlight/visualSelection.js +23 -28
- package/selection/highlight/visualSelection.mjs +23 -28
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +296 -180
- package/selection/selection.mjs +291 -179
- package/selection/transformation.js +233 -96
- package/selection/transformation.mjs +230 -93
- package/selection/utils.js +12 -35
- package/selection/utils.mjs +13 -35
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +29 -0
- package/shortcutContexts/commands/editor/open.mjs +24 -0
- package/shortcutContexts/commands/emptySelectedCells.js +12 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/index.js +51 -0
- package/shortcutContexts/commands/index.mjs +47 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
- package/shortcutContexts/commands/selectAll.js +11 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +19 -0
- package/shortcutContexts/constants.mjs +12 -0
- package/shortcutContexts/editor.js +29 -0
- package/shortcutContexts/editor.mjs +25 -0
- package/shortcutContexts/grid.js +232 -0
- package/shortcutContexts/grid.mjs +228 -0
- package/shortcutContexts/index.js +29 -0
- package/shortcutContexts/index.mjs +15 -0
- package/tableView.js +58 -9
- package/tableView.mjs +58 -9
- package/3rdparty/walkontable/src/selection.js +0 -354
- package/3rdparty/walkontable/src/selection.mjs +0 -348
- package/selection/highlight/constants.js +0 -16
- package/selection/highlight/constants.mjs +0 -6
@@ -1,127 +1,212 @@
|
|
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.array.iterator.js";
|
3
|
+
import "core-js/modules/es.object.to-string.js";
|
4
|
+
import "core-js/modules/es.string.iterator.js";
|
5
|
+
import "core-js/modules/es.weak-map.js";
|
6
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
7
|
+
import "core-js/modules/es.weak-set.js";
|
1
8
|
import "core-js/modules/es.symbol.to-primitive.js";
|
2
9
|
import "core-js/modules/es.date.to-primitive.js";
|
3
10
|
import "core-js/modules/es.symbol.js";
|
4
11
|
import "core-js/modules/es.symbol.description.js";
|
5
|
-
import "core-js/modules/es.object.to-string.js";
|
6
12
|
import "core-js/modules/es.number.constructor.js";
|
7
13
|
import "core-js/modules/es.symbol.iterator.js";
|
8
|
-
import "core-js/modules/es.array.iterator.js";
|
9
|
-
import "core-js/modules/es.string.iterator.js";
|
10
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
11
|
-
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); }
|
12
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
13
15
|
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); } }
|
14
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
15
17
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
16
18
|
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); }
|
19
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
20
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
21
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
22
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
23
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
24
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
25
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
26
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
27
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
17
28
|
import { mixin } from "../helpers/object.mjs";
|
18
29
|
import localHooks from "./../mixins/localHooks.mjs";
|
19
30
|
/**
|
20
31
|
* The Transformation class implements algorithms for transforming coordinates based on current settings
|
21
|
-
* passed to the Handsontable.
|
32
|
+
* passed to the Handsontable. The class performs the calculations based on the renderable indexes.
|
22
33
|
*
|
23
34
|
* Transformation is always applied relative to the current selection.
|
24
35
|
*
|
36
|
+
* The class operates on a table size defined by the renderable indexes. If the `navigableHeaders`
|
37
|
+
* option is enabled, the table size is increased by the number of row and/or column headers.
|
38
|
+
* Because the headers are treated as cells as part of the table size (indexes always go from 0 to N),
|
39
|
+
* the algorithm can be written as simply as possible (without new if's that distinguish the headers
|
40
|
+
* logic).
|
41
|
+
*
|
25
42
|
* @class Transformation
|
26
43
|
* @util
|
27
44
|
*/
|
45
|
+
var _range = /*#__PURE__*/new WeakMap();
|
46
|
+
var _options = /*#__PURE__*/new WeakMap();
|
47
|
+
var _offset = /*#__PURE__*/new WeakMap();
|
48
|
+
var _setOffsetSize = /*#__PURE__*/new WeakSet();
|
49
|
+
var _clampCoords = /*#__PURE__*/new WeakSet();
|
50
|
+
var _getTableSize = /*#__PURE__*/new WeakSet();
|
51
|
+
var _visualToZeroBasedCoords = /*#__PURE__*/new WeakSet();
|
52
|
+
var _zeroBasedToVisualCoords = /*#__PURE__*/new WeakSet();
|
28
53
|
var Transformation = /*#__PURE__*/function () {
|
29
54
|
function Transformation(range, options) {
|
30
55
|
_classCallCheck(this, Transformation);
|
56
|
+
/**
|
57
|
+
* Translates the zero-based coordinates to visual ones.
|
58
|
+
*
|
59
|
+
* @param {CellCoords} zeroBasedCoords The coordinates to process.
|
60
|
+
* @returns {CellCoords}
|
61
|
+
*/
|
62
|
+
_classPrivateMethodInitSpec(this, _zeroBasedToVisualCoords);
|
63
|
+
/**
|
64
|
+
* Translates the visual coordinates to zero-based ones.
|
65
|
+
*
|
66
|
+
* @param {CellCoords} visualCoords The visual coords to process.
|
67
|
+
* @returns {{x: number, y: number}}
|
68
|
+
*/
|
69
|
+
_classPrivateMethodInitSpec(this, _visualToZeroBasedCoords);
|
70
|
+
/**
|
71
|
+
* Gets the table size in number of rows with headers as "height" and number of columns with
|
72
|
+
* headers as "width".
|
73
|
+
*
|
74
|
+
* @returns {{width: number, height: number}}
|
75
|
+
*/
|
76
|
+
_classPrivateMethodInitSpec(this, _getTableSize);
|
77
|
+
/**
|
78
|
+
* Clamps the coords to make sure they points to the cell (or header) in the table range.
|
79
|
+
*
|
80
|
+
* @param {CellCoords} zeroBasedCoords The coords object to clamp.
|
81
|
+
* @returns {{rowDir: 1|0|-1, colDir: 1|0|-1}}
|
82
|
+
*/
|
83
|
+
_classPrivateMethodInitSpec(this, _clampCoords);
|
84
|
+
/**
|
85
|
+
* Sets the additional offset in table size that may occur when the `navigableHeaders` option
|
86
|
+
* is enabled.
|
87
|
+
*
|
88
|
+
* @param {{x: number, y: number}} offset Offset as x and y properties.
|
89
|
+
*/
|
90
|
+
_classPrivateMethodInitSpec(this, _setOffsetSize);
|
31
91
|
/**
|
32
92
|
* Instance of the SelectionRange, holder for visual coordinates applied to the table.
|
33
93
|
*
|
34
94
|
* @type {SelectionRange}
|
35
95
|
*/
|
36
|
-
this
|
96
|
+
_classPrivateFieldInitSpec(this, _range, {
|
97
|
+
writable: true,
|
98
|
+
value: void 0
|
99
|
+
});
|
37
100
|
/**
|
38
101
|
* Additional options which define the state of the settings which can infer transformation and
|
39
102
|
* give the possibility to translate indexes.
|
40
103
|
*
|
41
104
|
* @type {object}
|
42
105
|
*/
|
43
|
-
this
|
106
|
+
_classPrivateFieldInitSpec(this, _options, {
|
107
|
+
writable: true,
|
108
|
+
value: void 0
|
109
|
+
});
|
110
|
+
/**
|
111
|
+
* Increases the table size by applying the offsets. The option is used by the `navigableHeaders`
|
112
|
+
* option.
|
113
|
+
*
|
114
|
+
* @type {{ x: number, y: number }}
|
115
|
+
*/
|
116
|
+
_classPrivateFieldInitSpec(this, _offset, {
|
117
|
+
writable: true,
|
118
|
+
value: {
|
119
|
+
x: 0,
|
120
|
+
y: 0
|
121
|
+
}
|
122
|
+
});
|
123
|
+
_classPrivateFieldSet(this, _range, range);
|
124
|
+
_classPrivateFieldSet(this, _options, options);
|
44
125
|
}
|
45
126
|
|
46
127
|
/**
|
47
|
-
* Selects cell relative to current cell (if possible).
|
128
|
+
* Selects cell relative to the current cell (if possible).
|
48
129
|
*
|
49
130
|
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
50
131
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
51
|
-
* @param {boolean} [
|
132
|
+
* @param {boolean} [createMissingRecords=false] If `true` the new rows/columns will be created if necessary. Otherwise, row/column will
|
52
133
|
* be created according to `minSpareRows/minSpareCols` settings of Handsontable.
|
53
134
|
* @returns {CellCoords} Visual coordinates after transformation.
|
54
135
|
*/
|
55
136
|
_createClass(Transformation, [{
|
56
137
|
key: "transformStart",
|
57
138
|
value: function transformStart(rowDelta, colDelta) {
|
58
|
-
var
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
var visualCoords =
|
139
|
+
var createMissingRecords = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
140
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
141
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
142
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
143
|
+
});
|
144
|
+
var delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
145
|
+
var visualCoords = _classPrivateFieldGet(this, _range).current().highlight;
|
146
|
+
var highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
65
147
|
var rowTransformDir = 0;
|
66
148
|
var colTransformDir = 0;
|
67
149
|
this.runLocalHooks('beforeTransformStart', delta);
|
68
|
-
if (
|
69
|
-
var
|
70
|
-
|
71
|
-
|
72
|
-
var
|
73
|
-
|
74
|
-
|
75
|
-
var
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
150
|
+
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
|
151
|
+
var _classPrivateMethodGe = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this),
|
152
|
+
width = _classPrivateMethodGe.width,
|
153
|
+
height = _classPrivateMethodGe.height;
|
154
|
+
var _classPrivateMethodGe2 = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, visualCoords),
|
155
|
+
x = _classPrivateMethodGe2.x,
|
156
|
+
y = _classPrivateMethodGe2.y;
|
157
|
+
var fixedRowsBottom = _classPrivateFieldGet(this, _options).fixedRowsBottom();
|
158
|
+
var minSpareRows = _classPrivateFieldGet(this, _options).minSpareRows();
|
159
|
+
var minSpareCols = _classPrivateFieldGet(this, _options).minSpareCols();
|
160
|
+
var autoWrapRow = _classPrivateFieldGet(this, _options).autoWrapRow();
|
161
|
+
var autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
|
162
|
+
var rawCoords = {
|
163
|
+
row: y + delta.row,
|
164
|
+
col: x + delta.col
|
165
|
+
};
|
166
|
+
if (rawCoords.row >= height) {
|
167
|
+
if (createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0) {
|
168
|
+
this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
|
80
169
|
} else if (autoWrapCol) {
|
81
|
-
|
82
|
-
|
170
|
+
var nextColumn = rawCoords.col + 1;
|
171
|
+
rawCoords.row = rawCoords.row - height;
|
172
|
+
rawCoords.col = nextColumn >= width ? nextColumn - width : nextColumn;
|
173
|
+
}
|
174
|
+
} else if (rawCoords.row < 0) {
|
175
|
+
if (autoWrapCol) {
|
176
|
+
var previousColumn = rawCoords.col - 1;
|
177
|
+
rawCoords.row = height + rawCoords.row;
|
178
|
+
rawCoords.col = previousColumn < 0 ? width + previousColumn : previousColumn;
|
83
179
|
}
|
84
|
-
} else if (autoWrapCol && renderableRow + delta.row < 0 && renderableColumn + delta.col >= 0) {
|
85
|
-
delta.row = totalRows - 1;
|
86
|
-
delta.col = renderableColumn + delta.col === 0 ? totalCols - 1 : -1;
|
87
180
|
}
|
88
|
-
if (
|
89
|
-
if (
|
90
|
-
this.runLocalHooks('insertColRequire',
|
91
|
-
totalCols = this.options.countCols();
|
181
|
+
if (rawCoords.col >= width) {
|
182
|
+
if (createMissingRecords && minSpareCols > 0) {
|
183
|
+
this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
|
92
184
|
} else if (autoWrapRow) {
|
93
|
-
|
94
|
-
|
185
|
+
var nextRow = rawCoords.row + 1;
|
186
|
+
rawCoords.row = nextRow >= height ? nextRow - height : nextRow;
|
187
|
+
rawCoords.col = rawCoords.col - width;
|
188
|
+
}
|
189
|
+
} else if (rawCoords.col < 0) {
|
190
|
+
if (autoWrapRow) {
|
191
|
+
var previousRow = rawCoords.row - 1;
|
192
|
+
rawCoords.row = previousRow < 0 ? height + previousRow : previousRow;
|
193
|
+
rawCoords.col = width + rawCoords.col;
|
95
194
|
}
|
96
|
-
} else if (autoWrapRow && renderableColumn + delta.col < 0 && renderableRow + delta.row >= 0) {
|
97
|
-
delta.row = renderableRow + delta.row === 0 ? totalRows - 1 : -1;
|
98
|
-
delta.col = totalCols - 1;
|
99
|
-
}
|
100
|
-
var coords = this.options.createCellCoords(renderableRow + delta.row, renderableColumn + delta.col);
|
101
|
-
rowTransformDir = 0;
|
102
|
-
colTransformDir = 0;
|
103
|
-
if (coords.row < 0) {
|
104
|
-
rowTransformDir = -1;
|
105
|
-
coords.row = 0;
|
106
|
-
} else if (coords.row > 0 && coords.row >= totalRows) {
|
107
|
-
rowTransformDir = 1;
|
108
|
-
coords.row = totalRows - 1;
|
109
|
-
}
|
110
|
-
if (coords.col < 0) {
|
111
|
-
colTransformDir = -1;
|
112
|
-
coords.col = 0;
|
113
|
-
} else if (coords.col > 0 && coords.col >= totalCols) {
|
114
|
-
colTransformDir = 1;
|
115
|
-
coords.col = totalCols - 1;
|
116
195
|
}
|
117
|
-
|
196
|
+
var coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
197
|
+
var _classPrivateMethodGe3 = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, coords),
|
198
|
+
rowDir = _classPrivateMethodGe3.rowDir,
|
199
|
+
colDir = _classPrivateMethodGe3.colDir;
|
200
|
+
rowTransformDir = rowDir;
|
201
|
+
colTransformDir = colDir;
|
202
|
+
visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, coords);
|
118
203
|
}
|
119
204
|
this.runLocalHooks('afterTransformStart', visualCoords, rowTransformDir, colTransformDir);
|
120
205
|
return visualCoords;
|
121
206
|
}
|
122
207
|
|
123
208
|
/**
|
124
|
-
* Sets selection end cell relative to current selection end cell (if possible).
|
209
|
+
* Sets selection end cell relative to the current selection end cell (if possible).
|
125
210
|
*
|
126
211
|
* @param {number} rowDelta Rows number to move, value can be passed as negative number.
|
127
212
|
* @param {number} colDelta Columns number to move, value can be passed as negative number.
|
@@ -130,41 +215,40 @@ var Transformation = /*#__PURE__*/function () {
|
|
130
215
|
}, {
|
131
216
|
key: "transformEnd",
|
132
217
|
value: function transformEnd(rowDelta, colDelta) {
|
133
|
-
|
134
|
-
|
135
|
-
|
218
|
+
_classPrivateMethodGet(this, _setOffsetSize, _setOffsetSize2).call(this, {
|
219
|
+
x: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countRowHeaders() : 0,
|
220
|
+
y: _classPrivateFieldGet(this, _options).navigableHeaders() ? _classPrivateFieldGet(this, _options).countColHeaders() : 0
|
221
|
+
});
|
222
|
+
var delta = _classPrivateFieldGet(this, _options).createCellCoords(rowDelta, colDelta);
|
223
|
+
var cellRange = _classPrivateFieldGet(this, _range).current();
|
224
|
+
var highlightRenderableCoords = _classPrivateFieldGet(this, _options).visualToRenderableCoords(cellRange.highlight);
|
225
|
+
var visualCoords = cellRange.to.clone();
|
136
226
|
var rowTransformDir = 0;
|
137
227
|
var colTransformDir = 0;
|
138
228
|
this.runLocalHooks('beforeTransformEnd', delta);
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
var
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
rowTransformDir =
|
152
|
-
colTransformDir =
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
} else if (
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
colTransformDir = -1;
|
162
|
-
coords.col = 0;
|
163
|
-
} else if (coords.col > 0 && coords.col >= totalCols) {
|
164
|
-
colTransformDir = 1;
|
165
|
-
coords.col = totalCols - 1;
|
229
|
+
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
|
230
|
+
var _classPrivateMethodGe4 = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to),
|
231
|
+
x = _classPrivateMethodGe4.x,
|
232
|
+
y = _classPrivateMethodGe4.y;
|
233
|
+
var rawCoords = {
|
234
|
+
row: y + delta.row,
|
235
|
+
col: x + delta.col
|
236
|
+
};
|
237
|
+
var coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
238
|
+
var _classPrivateMethodGe5 = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, coords),
|
239
|
+
rowDir = _classPrivateMethodGe5.rowDir,
|
240
|
+
colDir = _classPrivateMethodGe5.colDir;
|
241
|
+
rowTransformDir = rowDir;
|
242
|
+
colTransformDir = colDir;
|
243
|
+
var newVisualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, coords);
|
244
|
+
if (delta.row === 0 && delta.col !== 0) {
|
245
|
+
visualCoords.col = newVisualCoords.col;
|
246
|
+
} else if (delta.row !== 0 && delta.col === 0) {
|
247
|
+
visualCoords.row = newVisualCoords.row;
|
248
|
+
} else {
|
249
|
+
visualCoords.row = newVisualCoords.row;
|
250
|
+
visualCoords.col = newVisualCoords.col;
|
166
251
|
}
|
167
|
-
visualCoords = this.options.renderableToVisualCoords(coords);
|
168
252
|
}
|
169
253
|
this.runLocalHooks('afterTransformEnd', visualCoords, rowTransformDir, colTransformDir);
|
170
254
|
return visualCoords;
|
@@ -172,5 +256,58 @@ var Transformation = /*#__PURE__*/function () {
|
|
172
256
|
}]);
|
173
257
|
return Transformation;
|
174
258
|
}();
|
259
|
+
function _setOffsetSize2(_ref) {
|
260
|
+
var x = _ref.x,
|
261
|
+
y = _ref.y;
|
262
|
+
_classPrivateFieldSet(this, _offset, {
|
263
|
+
x: x,
|
264
|
+
y: y
|
265
|
+
});
|
266
|
+
}
|
267
|
+
function _clampCoords2(zeroBasedCoords) {
|
268
|
+
var _classPrivateMethodGe6 = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this),
|
269
|
+
width = _classPrivateMethodGe6.width,
|
270
|
+
height = _classPrivateMethodGe6.height;
|
271
|
+
var rowDir = 0;
|
272
|
+
var colDir = 0;
|
273
|
+
if (zeroBasedCoords.row < 0) {
|
274
|
+
rowDir = -1;
|
275
|
+
zeroBasedCoords.row = 0;
|
276
|
+
} else if (zeroBasedCoords.row > 0 && zeroBasedCoords.row >= height) {
|
277
|
+
rowDir = 1;
|
278
|
+
zeroBasedCoords.row = height - 1;
|
279
|
+
}
|
280
|
+
if (zeroBasedCoords.col < 0) {
|
281
|
+
colDir = -1;
|
282
|
+
zeroBasedCoords.col = 0;
|
283
|
+
} else if (zeroBasedCoords.col > 0 && zeroBasedCoords.col >= width) {
|
284
|
+
colDir = 1;
|
285
|
+
zeroBasedCoords.col = width - 1;
|
286
|
+
}
|
287
|
+
return {
|
288
|
+
rowDir: rowDir,
|
289
|
+
colDir: colDir
|
290
|
+
};
|
291
|
+
}
|
292
|
+
function _getTableSize2() {
|
293
|
+
return {
|
294
|
+
width: _classPrivateFieldGet(this, _offset).x + _classPrivateFieldGet(this, _options).countRenderableColumns(),
|
295
|
+
height: _classPrivateFieldGet(this, _offset).y + _classPrivateFieldGet(this, _options).countRenderableRows()
|
296
|
+
};
|
297
|
+
}
|
298
|
+
function _visualToZeroBasedCoords2(visualCoords) {
|
299
|
+
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords),
|
300
|
+
row = _classPrivateFieldGet2.row,
|
301
|
+
col = _classPrivateFieldGet2.col;
|
302
|
+
return {
|
303
|
+
x: _classPrivateFieldGet(this, _offset).x + (col !== null && col !== void 0 ? col : visualCoords.col),
|
304
|
+
y: _classPrivateFieldGet(this, _offset).y + (row !== null && row !== void 0 ? row : visualCoords.row)
|
305
|
+
};
|
306
|
+
}
|
307
|
+
function _zeroBasedToVisualCoords2(zeroBasedCoords) {
|
308
|
+
zeroBasedCoords.col = zeroBasedCoords.col - _classPrivateFieldGet(this, _offset).x;
|
309
|
+
zeroBasedCoords.row = zeroBasedCoords.row - _classPrivateFieldGet(this, _offset).y;
|
310
|
+
return _classPrivateFieldGet(this, _options).renderableToVisualCoords(zeroBasedCoords);
|
311
|
+
}
|
175
312
|
mixin(Transformation, localHooks);
|
176
313
|
export default Transformation;
|
package/selection/utils.js
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
require("core-js/modules/es.symbol.iterator.js");
|
4
|
-
require("core-js/modules/es.array.slice.js");
|
5
|
-
require("core-js/modules/es.function.name.js");
|
6
|
-
require("core-js/modules/es.regexp.exec.js");
|
7
4
|
exports.__esModule = true;
|
8
5
|
exports.SELECTION_TYPE_UNRECOGNIZED = exports.SELECTION_TYPE_OBJECT = exports.SELECTION_TYPE_EMPTY = exports.SELECTION_TYPE_ARRAY = exports.SELECTION_TYPES = void 0;
|
9
6
|
exports.detectSelectionType = detectSelectionType;
|
10
|
-
exports.isValidCoord = isValidCoord;
|
11
7
|
exports.normalizeSelectionFactory = normalizeSelectionFactory;
|
12
8
|
exports.transformSelectionToColumnDistance = transformSelectionToColumnDistance;
|
13
9
|
exports.transformSelectionToRowDistance = transformSelectionToRowDistance;
|
@@ -25,12 +21,6 @@ require("core-js/modules/es.array.sort.js");
|
|
25
21
|
var _src = require("./../3rdparty/walkontable/src");
|
26
22
|
var _array = require("./../helpers/array");
|
27
23
|
var _mixed = require("./../helpers/mixed");
|
28
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
29
|
-
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."); }
|
30
|
-
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); }
|
31
|
-
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; }
|
32
|
-
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; } }
|
33
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
34
24
|
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); }
|
35
25
|
var SELECTION_TYPE_UNRECOGNIZED = 0;
|
36
26
|
exports.SELECTION_TYPE_UNRECOGNIZED = SELECTION_TYPE_UNRECOGNIZED;
|
@@ -134,7 +124,9 @@ function normalizeSelectionFactory(type) {
|
|
134
124
|
rowEnd = Math.max(origRowStart, origRowEnd);
|
135
125
|
columnEnd = Math.max(origColumnStart, origColumnEnd);
|
136
126
|
}
|
137
|
-
|
127
|
+
var from = new _src.CellCoords(rowStart, columnStart);
|
128
|
+
var to = new _src.CellCoords(rowEnd, columnEnd);
|
129
|
+
return new _src.CellRange(from, from, to);
|
138
130
|
};
|
139
131
|
}
|
140
132
|
|
@@ -161,11 +153,10 @@ function transformSelectionToColumnDistance(selectionRanges) {
|
|
161
153
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
162
154
|
(0, _array.arrayEach)(selectionRanges, function (selection) {
|
163
155
|
var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
var
|
168
|
-
var amount = columnEnd - columnNonHeaderStart + 1;
|
156
|
+
from = _selectionSchemaNorma.from,
|
157
|
+
to = _selectionSchemaNorma.to;
|
158
|
+
var columnNonHeaderStart = Math.max(from.col, 0);
|
159
|
+
var amount = to.col - columnNonHeaderStart + 1;
|
169
160
|
(0, _array.arrayEach)(Array.from(new Array(amount), function (_, i) {
|
170
161
|
return columnNonHeaderStart + i;
|
171
162
|
}), function (index) {
|
@@ -212,12 +203,11 @@ function transformSelectionToRowDistance(selectionRanges) {
|
|
212
203
|
|
213
204
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
214
205
|
(0, _array.arrayEach)(selectionRanges, function (selection) {
|
215
|
-
var
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
var
|
220
|
-
var amount = rowEnd - rowNonHeaderStart + 1;
|
206
|
+
var _selectionSchemaNorma2 = selectionSchemaNormalizer(selection),
|
207
|
+
from = _selectionSchemaNorma2.from,
|
208
|
+
to = _selectionSchemaNorma2.to;
|
209
|
+
var rowNonHeaderStart = Math.max(from.row, 0);
|
210
|
+
var amount = to.row - rowNonHeaderStart + 1;
|
221
211
|
(0, _array.arrayEach)(Array.from(new Array(amount), function (_, i) {
|
222
212
|
return rowNonHeaderStart + i;
|
223
213
|
}), function (index) {
|
@@ -240,17 +230,4 @@ function transformSelectionToRowDistance(selectionRanges) {
|
|
240
230
|
return acc;
|
241
231
|
}, []);
|
242
232
|
return normalizedRowRanges;
|
243
|
-
}
|
244
|
-
|
245
|
-
/**
|
246
|
-
* Check if passed value can be treated as valid cell coordinate. The second argument is
|
247
|
-
* used to check if the value doesn't exceed the defined max table rows/columns count.
|
248
|
-
*
|
249
|
-
* @param {number} coord The coordinate to validate (row index or column index).
|
250
|
-
* @param {number} maxTableItemsCount The value that declares the maximum coordinate that is still validatable.
|
251
|
-
* @returns {boolean}
|
252
|
-
*/
|
253
|
-
function isValidCoord(coord) {
|
254
|
-
var maxTableItemsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
255
|
-
return typeof coord === 'number' && coord >= 0 && coord < maxTableItemsCount;
|
256
233
|
}
|
package/selection/utils.mjs
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
-
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."); }
|
3
|
-
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); }
|
4
|
-
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; }
|
5
|
-
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; } }
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
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); }
|
8
2
|
import "core-js/modules/es.symbol.js";
|
9
3
|
import "core-js/modules/es.symbol.description.js";
|
@@ -17,10 +11,7 @@ import "core-js/modules/web.dom-collections.iterator.js";
|
|
17
11
|
import "core-js/modules/es.array.from.js";
|
18
12
|
import "core-js/modules/es.array.sort.js";
|
19
13
|
import "core-js/modules/es.symbol.iterator.js";
|
20
|
-
import "
|
21
|
-
import "core-js/modules/es.function.name.js";
|
22
|
-
import "core-js/modules/es.regexp.exec.js";
|
23
|
-
import { CellRange } from "./../3rdparty/walkontable/src/index.mjs";
|
14
|
+
import { CellRange, CellCoords } from "./../3rdparty/walkontable/src/index.mjs";
|
24
15
|
import { arrayEach, arrayReduce } from "./../helpers/array.mjs";
|
25
16
|
import { isUndefined } from "./../helpers/mixed.mjs";
|
26
17
|
export var SELECTION_TYPE_UNRECOGNIZED = 0;
|
@@ -120,7 +111,9 @@ export function normalizeSelectionFactory(type) {
|
|
120
111
|
rowEnd = Math.max(origRowStart, origRowEnd);
|
121
112
|
columnEnd = Math.max(origColumnStart, origColumnEnd);
|
122
113
|
}
|
123
|
-
|
114
|
+
var from = new CellCoords(rowStart, columnStart);
|
115
|
+
var to = new CellCoords(rowEnd, columnEnd);
|
116
|
+
return new CellRange(from, from, to);
|
124
117
|
};
|
125
118
|
}
|
126
119
|
|
@@ -147,11 +140,10 @@ export function transformSelectionToColumnDistance(selectionRanges) {
|
|
147
140
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
148
141
|
arrayEach(selectionRanges, function (selection) {
|
149
142
|
var _selectionSchemaNorma = selectionSchemaNormalizer(selection),
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
var
|
154
|
-
var amount = columnEnd - columnNonHeaderStart + 1;
|
143
|
+
from = _selectionSchemaNorma.from,
|
144
|
+
to = _selectionSchemaNorma.to;
|
145
|
+
var columnNonHeaderStart = Math.max(from.col, 0);
|
146
|
+
var amount = to.col - columnNonHeaderStart + 1;
|
155
147
|
arrayEach(Array.from(new Array(amount), function (_, i) {
|
156
148
|
return columnNonHeaderStart + i;
|
157
149
|
}), function (index) {
|
@@ -198,12 +190,11 @@ export function transformSelectionToRowDistance(selectionRanges) {
|
|
198
190
|
|
199
191
|
// Iterate through all ranges and collect all column indexes which are not saved yet.
|
200
192
|
arrayEach(selectionRanges, function (selection) {
|
201
|
-
var
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
var
|
206
|
-
var amount = rowEnd - rowNonHeaderStart + 1;
|
193
|
+
var _selectionSchemaNorma2 = selectionSchemaNormalizer(selection),
|
194
|
+
from = _selectionSchemaNorma2.from,
|
195
|
+
to = _selectionSchemaNorma2.to;
|
196
|
+
var rowNonHeaderStart = Math.max(from.row, 0);
|
197
|
+
var amount = to.row - rowNonHeaderStart + 1;
|
207
198
|
arrayEach(Array.from(new Array(amount), function (_, i) {
|
208
199
|
return rowNonHeaderStart + i;
|
209
200
|
}), function (index) {
|
@@ -226,17 +217,4 @@ export function transformSelectionToRowDistance(selectionRanges) {
|
|
226
217
|
return acc;
|
227
218
|
}, []);
|
228
219
|
return normalizedRowRanges;
|
229
|
-
}
|
230
|
-
|
231
|
-
/**
|
232
|
-
* Check if passed value can be treated as valid cell coordinate. The second argument is
|
233
|
-
* used to check if the value doesn't exceed the defined max table rows/columns count.
|
234
|
-
*
|
235
|
-
* @param {number} coord The coordinate to validate (row index or column index).
|
236
|
-
* @param {number} maxTableItemsCount The value that declares the maximum coordinate that is still validatable.
|
237
|
-
* @returns {boolean}
|
238
|
-
*/
|
239
|
-
export function isValidCoord(coord) {
|
240
|
-
var maxTableItemsCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
241
|
-
return typeof coord === 'number' && coord >= 0 && coord < maxTableItemsCount;
|
242
220
|
}
|
package/settings.d.ts
CHANGED
@@ -163,6 +163,7 @@ export interface GridSettings extends Events {
|
|
163
163
|
minSpareCols?: number;
|
164
164
|
minSpareRows?: number;
|
165
165
|
multiColumnSorting?: MultiColumnSortingSettings;
|
166
|
+
navigableHeaders?: boolean;
|
166
167
|
nestedHeaders?: NestedHeadersSettings;
|
167
168
|
nestedRows?: boolean;
|
168
169
|
noWordWrapClassName?: string;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.command = void 0;
|
5
|
+
require("core-js/modules/es.array.includes.js");
|
6
|
+
require("core-js/modules/es.string.includes.js");
|
7
|
+
var command = {
|
8
|
+
name: 'editorCloseAndSave',
|
9
|
+
callback: function callback(hot, event, keys) {
|
10
|
+
var editorManager = hot._getEditorManager();
|
11
|
+
editorManager.closeEditorAndSaveChanges(hot.getShortcutManager().isCtrlPressed());
|
12
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
13
|
+
}
|
14
|
+
};
|
15
|
+
exports.command = command;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import "core-js/modules/es.array.includes.js";
|
2
|
+
import "core-js/modules/es.string.includes.js";
|
3
|
+
export var command = {
|
4
|
+
name: 'editorCloseAndSave',
|
5
|
+
callback: function callback(hot, event, keys) {
|
6
|
+
var editorManager = hot._getEditorManager();
|
7
|
+
editorManager.closeEditorAndSaveChanges(hot.getShortcutManager().isCtrlPressed());
|
8
|
+
editorManager.moveSelectionAfterEnter(keys.includes('shift'));
|
9
|
+
}
|
10
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.command = void 0;
|
5
|
+
var command = {
|
6
|
+
name: 'editorCloseWithoutSaving',
|
7
|
+
callback: function callback(hot) {
|
8
|
+
var editorManager = hot._getEditorManager();
|
9
|
+
editorManager.closeEditorAndRestoreOriginalValue(hot.getShortcutManager().isCtrlPressed());
|
10
|
+
editorManager.activeEditor.focus();
|
11
|
+
}
|
12
|
+
};
|
13
|
+
exports.command = command;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export var command = {
|
2
|
+
name: 'editorCloseWithoutSaving',
|
3
|
+
callback: function callback(hot) {
|
4
|
+
var editorManager = hot._getEditorManager();
|
5
|
+
editorManager.closeEditorAndRestoreOriginalValue(hot.getShortcutManager().isCtrlPressed());
|
6
|
+
editorManager.activeEditor.focus();
|
7
|
+
}
|
8
|
+
};
|