handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-c73b24c-20230510
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.js +13 -40
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- 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 +10 -12
- package/3rdparty/walkontable/src/event.mjs +10 -12
- 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 +7 -8
- package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- 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 +10 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
- package/3rdparty/walkontable/src/overlays.js +55 -64
- package/3rdparty/walkontable/src/overlays.mjs +55 -64
- package/3rdparty/walkontable/src/renderer/table.js +0 -2
- package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/selection.js +354 -0
- package/3rdparty/walkontable/src/selection.mjs +348 -0
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- 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 +101 -33
- package/3rdparty/walkontable/src/table.mjs +102 -34
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.d.ts +0 -4
- package/core.js +24 -52
- package/core.mjs +24 -52
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +1 -8
- package/dataMap/metaManager/metaSchema.mjs +1 -8
- package/dist/handsontable.css +2 -7
- package/dist/handsontable.full.css +2 -7
- package/dist/handsontable.full.js +9101 -9413
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +123 -115
- package/dist/handsontable.js +8761 -9074
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +11 -3
- package/dist/languages/all.js +133 -0
- package/dist/languages/ar-AR.js +7 -0
- package/dist/languages/cs-CZ.js +7 -0
- package/dist/languages/de-CH.js +7 -0
- package/dist/languages/de-DE.js +7 -0
- package/dist/languages/en-US.js +7 -0
- package/dist/languages/es-MX.js +7 -0
- package/dist/languages/fr-FR.js +7 -0
- package/dist/languages/it-IT.js +7 -0
- package/dist/languages/ja-JP.js +7 -0
- package/dist/languages/ko-KR.js +7 -0
- package/dist/languages/lv-LV.js +7 -0
- package/dist/languages/nb-NO.js +7 -0
- package/dist/languages/nl-NL.js +7 -0
- package/dist/languages/pl-PL.js +7 -0
- package/dist/languages/pt-BR.js +7 -0
- package/dist/languages/ru-RU.js +7 -0
- package/dist/languages/sr-SP.js +7 -0
- package/dist/languages/zh-CN.js +7 -0
- package/dist/languages/zh-TW.js +7 -0
- package/editorManager.js +3 -7
- package/editorManager.mjs +3 -7
- package/editors/textEditor/textEditor.js +16 -3
- package/editors/textEditor/textEditor.mjs +17 -4
- package/helpers/dom/element.js +0 -11
- package/helpers/dom/element.mjs +0 -10
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/i18n/languages/ar-AR.js +7 -1
- package/i18n/languages/cs-CZ.js +7 -1
- package/i18n/languages/de-CH.js +7 -1
- package/i18n/languages/de-DE.js +7 -1
- package/i18n/languages/en-US.js +7 -1
- package/i18n/languages/es-MX.js +7 -1
- package/i18n/languages/fr-FR.js +7 -1
- package/i18n/languages/it-IT.js +7 -1
- package/i18n/languages/ja-JP.js +7 -1
- package/i18n/languages/ko-KR.js +7 -1
- package/i18n/languages/lv-LV.js +7 -1
- package/i18n/languages/nb-NO.js +7 -1
- package/i18n/languages/nl-NL.js +7 -1
- package/i18n/languages/pl-PL.js +7 -1
- package/i18n/languages/pt-BR.js +7 -1
- package/i18n/languages/ru-RU.js +7 -1
- package/i18n/languages/sr-SP.js +7 -1
- package/i18n/languages/zh-CN.js +7 -1
- package/i18n/languages/zh-TW.js +7 -1
- package/languages/all.js +133 -0
- package/languages/ar-AR.js +7 -0
- package/languages/cs-CZ.js +7 -0
- package/languages/de-CH.js +7 -0
- package/languages/de-DE.js +7 -0
- package/languages/en-US.js +7 -0
- package/languages/es-MX.js +7 -0
- package/languages/fr-FR.js +7 -0
- package/languages/index.js +133 -0
- package/languages/it-IT.js +7 -0
- package/languages/ja-JP.js +7 -0
- package/languages/ko-KR.js +7 -0
- package/languages/lv-LV.js +7 -0
- package/languages/nb-NO.js +7 -0
- package/languages/nl-NL.js +7 -0
- package/languages/pl-PL.js +7 -0
- package/languages/pt-BR.js +7 -0
- package/languages/ru-RU.js +7 -0
- package/languages/sr-SP.js +7 -0
- package/languages/zh-CN.js +7 -0
- package/languages/zh-TW.js +7 -0
- package/package.json +3 -2
- package/pluginHooks.js +17 -7
- package/pluginHooks.mjs +16 -4
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +93 -12
- package/plugins/copyPaste/copyPaste.mjs +93 -12
- package/plugins/copyPaste/copyableRanges.js +25 -31
- package/plugins/copyPaste/copyableRanges.mjs +18 -24
- package/plugins/copyPaste/focusableElement.js +219 -0
- package/plugins/copyPaste/focusableElement.mjs +213 -0
- package/plugins/customBorders/customBorders.js +2 -6
- package/plugins/customBorders/customBorders.mjs +3 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/formulas.js +190 -168
- package/plugins/formulas/formulas.mjs +190 -168
- package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
- package/plugins/formulas/indexSyncer/index.js +225 -0
- package/plugins/formulas/indexSyncer/index.mjs +219 -0
- package/plugins/mergeCells/mergeCells.js +16 -0
- package/plugins/mergeCells/mergeCells.mjs +16 -0
- package/plugins/nestedHeaders/nestedHeaders.js +4 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +3 -3
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
- package/plugins/registry.js +3 -1
- package/plugins/undoRedo/undoRedo.js +0 -1
- package/plugins/undoRedo/undoRedo.mjs +0 -1
- package/renderers/baseRenderer/baseRenderer.js +0 -3
- package/renderers/baseRenderer/baseRenderer.mjs +0 -3
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +133 -335
- package/selection/highlight/highlight.mjs +129 -325
- 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 +21 -12
- package/selection/highlight/visualSelection.mjs +21 -12
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- package/selection/selection.js +46 -88
- package/selection/selection.mjs +44 -82
- package/settings.d.ts +0 -1
- package/tableView.js +66 -94
- package/tableView.mjs +66 -94
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +1 -1
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/utils/dataStructures/tree.js +15 -18
- package/utils/dataStructures/tree.mjs +15 -18
- package/utils/parseTable.js +5 -1
- package/utils/parseTable.mjs +5 -1
- 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 -334
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
- 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/focusManager.d.ts +0 -12
- package/focusManager.js +0 -249
- package/focusManager.mjs +0 -245
- 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
@@ -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 };
|
@@ -37,16 +37,15 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
37
37
|
var VisualSelection = /*#__PURE__*/function (_Selection) {
|
38
38
|
_inherits(VisualSelection, _Selection);
|
39
39
|
var _super = _createSuper(VisualSelection);
|
40
|
-
/**
|
41
|
-
* Range of selection visually. Visual representation may have representation in a rendered selection.
|
42
|
-
*
|
43
|
-
* @type {null|CellRange}
|
44
|
-
*/
|
45
|
-
|
46
40
|
function VisualSelection(settings, visualCellRange) {
|
47
41
|
var _this;
|
48
42
|
_classCallCheck(this, VisualSelection);
|
49
43
|
_this = _super.call(this, settings, null);
|
44
|
+
/**
|
45
|
+
* Range of selection visually. Visual representation may have representation in a rendered selection.
|
46
|
+
*
|
47
|
+
* @type {null|CellRange}
|
48
|
+
*/
|
50
49
|
_defineProperty(_assertThisInitialized(_this), "visualCellRange", null);
|
51
50
|
_this.visualCellRange = visualCellRange || null;
|
52
51
|
_this.commit();
|
@@ -100,6 +99,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
100
99
|
return null;
|
101
100
|
}
|
102
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
|
+
}
|
103
106
|
visibleFromCoords = from;
|
104
107
|
visibleToCoords = to;
|
105
108
|
}
|
@@ -152,7 +155,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
152
155
|
if (visualIndex < 0) {
|
153
156
|
return visualIndex;
|
154
157
|
}
|
155
|
-
|
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;
|
156
164
|
}
|
157
165
|
|
158
166
|
/**
|
@@ -228,7 +236,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
228
236
|
var _this$cellRange = this.cellRange,
|
229
237
|
from = _this$cellRange.from,
|
230
238
|
to = _this$cellRange.to;
|
231
|
-
|
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];
|
232
244
|
}
|
233
245
|
|
234
246
|
/**
|
@@ -253,16 +265,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
253
265
|
* points to the beginning of the selection.
|
254
266
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
255
267
|
* points to the end of the selection.
|
256
|
-
* @returns {CellRange
|
268
|
+
* @returns {CellRange}
|
257
269
|
*/
|
258
270
|
}, {
|
259
271
|
key: "createRenderableCellRange",
|
260
272
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
261
273
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
262
274
|
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
275
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
267
276
|
}
|
268
277
|
}]);
|
@@ -33,16 +33,15 @@ import { Selection } from "./../../3rdparty/walkontable/src/index.mjs";
|
|
33
33
|
var VisualSelection = /*#__PURE__*/function (_Selection) {
|
34
34
|
_inherits(VisualSelection, _Selection);
|
35
35
|
var _super = _createSuper(VisualSelection);
|
36
|
-
/**
|
37
|
-
* Range of selection visually. Visual representation may have representation in a rendered selection.
|
38
|
-
*
|
39
|
-
* @type {null|CellRange}
|
40
|
-
*/
|
41
|
-
|
42
36
|
function VisualSelection(settings, visualCellRange) {
|
43
37
|
var _this;
|
44
38
|
_classCallCheck(this, VisualSelection);
|
45
39
|
_this = _super.call(this, settings, null);
|
40
|
+
/**
|
41
|
+
* Range of selection visually. Visual representation may have representation in a rendered selection.
|
42
|
+
*
|
43
|
+
* @type {null|CellRange}
|
44
|
+
*/
|
46
45
|
_defineProperty(_assertThisInitialized(_this), "visualCellRange", null);
|
47
46
|
_this.visualCellRange = visualCellRange || null;
|
48
47
|
_this.commit();
|
@@ -96,6 +95,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
96
95
|
return null;
|
97
96
|
}
|
98
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
|
+
}
|
99
102
|
visibleFromCoords = from;
|
100
103
|
visibleToCoords = to;
|
101
104
|
}
|
@@ -148,7 +151,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
148
151
|
if (visualIndex < 0) {
|
149
152
|
return visualIndex;
|
150
153
|
}
|
151
|
-
|
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;
|
152
160
|
}
|
153
161
|
|
154
162
|
/**
|
@@ -224,7 +232,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
224
232
|
var _this$cellRange = this.cellRange,
|
225
233
|
from = _this$cellRange.from,
|
226
234
|
to = _this$cellRange.to;
|
227
|
-
|
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];
|
228
240
|
}
|
229
241
|
|
230
242
|
/**
|
@@ -249,16 +261,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
|
|
249
261
|
* points to the beginning of the selection.
|
250
262
|
* @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
|
251
263
|
* points to the end of the selection.
|
252
|
-
* @returns {CellRange
|
264
|
+
* @returns {CellRange}
|
253
265
|
*/
|
254
266
|
}, {
|
255
267
|
key: "createRenderableCellRange",
|
256
268
|
value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
|
257
269
|
var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
|
258
270
|
var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
|
259
|
-
if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
|
260
|
-
return null;
|
261
|
-
}
|
262
271
|
return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
|
263
272
|
}
|
264
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/selection.js
CHANGED
@@ -5,8 +5,6 @@ require("core-js/modules/es.object.freeze.js");
|
|
5
5
|
require("core-js/modules/es.symbol.iterator.js");
|
6
6
|
require("core-js/modules/es.function.name.js");
|
7
7
|
require("core-js/modules/es.regexp.exec.js");
|
8
|
-
require("core-js/modules/es.weak-map.js");
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
10
8
|
exports.__esModule = true;
|
11
9
|
exports.default = void 0;
|
12
10
|
require("core-js/modules/es.array.iterator.js");
|
@@ -25,7 +23,8 @@ require("core-js/modules/es.symbol.to-primitive.js");
|
|
25
23
|
require("core-js/modules/es.date.to-primitive.js");
|
26
24
|
require("core-js/modules/es.symbol.js");
|
27
25
|
require("core-js/modules/es.symbol.description.js");
|
28
|
-
var _highlight =
|
26
|
+
var _highlight = _interopRequireDefault(require("./highlight/highlight"));
|
27
|
+
var _constants = require("./highlight/constants");
|
29
28
|
var _range = _interopRequireDefault(require("./range"));
|
30
29
|
var _object = require("./../helpers/object");
|
31
30
|
var _mixed = require("./../helpers/mixed");
|
@@ -36,8 +35,6 @@ var _utils = require("./utils");
|
|
36
35
|
var _templateLiteralTag = require("./../helpers/templateLiteralTag");
|
37
36
|
var _templateObject;
|
38
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
39
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
40
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
41
38
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
42
39
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
43
40
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
@@ -155,12 +152,6 @@ var Selection = /*#__PURE__*/function () {
|
|
155
152
|
countCols: function countCols() {
|
156
153
|
return _this.tableProps.countColsTranslated();
|
157
154
|
},
|
158
|
-
countRowHeaders: function countRowHeaders() {
|
159
|
-
return _this.tableProps.countRowHeaders();
|
160
|
-
},
|
161
|
-
countColHeaders: function countColHeaders() {
|
162
|
-
return _this.tableProps.countColHeaders();
|
163
|
-
},
|
164
155
|
visualToRenderableCoords: function visualToRenderableCoords(coords) {
|
165
156
|
return _this.tableProps.visualToRenderableCoords(coords);
|
166
157
|
},
|
@@ -345,9 +336,9 @@ var Selection = /*#__PURE__*/function () {
|
|
345
336
|
}
|
346
337
|
|
347
338
|
// Set up current selection.
|
348
|
-
this.highlight.
|
349
|
-
if (this.highlight.isEnabledFor(
|
350
|
-
this.highlight.
|
339
|
+
this.highlight.getCell().clear();
|
340
|
+
if (this.highlight.isEnabledFor(_constants.CELL_TYPE, cellRange.highlight)) {
|
341
|
+
this.highlight.getCell().add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
|
351
342
|
}
|
352
343
|
var layerLevel = this.getLayerLevel();
|
353
344
|
|
@@ -357,85 +348,64 @@ var Selection = /*#__PURE__*/function () {
|
|
357
348
|
(0, _array.arrayEach)(this.highlight.getAreas(), function (highlight) {
|
358
349
|
return void highlight.clear();
|
359
350
|
});
|
360
|
-
(0, _array.arrayEach)(this.highlight.
|
361
|
-
return void highlight.clear();
|
362
|
-
});
|
363
|
-
(0, _array.arrayEach)(this.highlight.getRowHeaders(), function (highlight) {
|
364
|
-
return void highlight.clear();
|
365
|
-
});
|
366
|
-
(0, _array.arrayEach)(this.highlight.getColumnHeaders(), function (highlight) {
|
367
|
-
return void highlight.clear();
|
368
|
-
});
|
369
|
-
(0, _array.arrayEach)(this.highlight.getActiveRowHeaders(), function (highlight) {
|
370
|
-
return void highlight.clear();
|
371
|
-
});
|
372
|
-
(0, _array.arrayEach)(this.highlight.getActiveColumnHeaders(), function (highlight) {
|
373
|
-
return void highlight.clear();
|
374
|
-
});
|
375
|
-
(0, _array.arrayEach)(this.highlight.getRowHighlights(), function (highlight) {
|
351
|
+
(0, _array.arrayEach)(this.highlight.getHeaders(), function (highlight) {
|
376
352
|
return void highlight.clear();
|
377
353
|
});
|
378
|
-
(0, _array.arrayEach)(this.highlight.
|
354
|
+
(0, _array.arrayEach)(this.highlight.getActiveHeaders(), function (highlight) {
|
379
355
|
return void highlight.clear();
|
380
356
|
});
|
381
357
|
}
|
382
358
|
this.highlight.useLayerLevel(layerLevel);
|
383
|
-
var areaHighlight = this.highlight.
|
384
|
-
var
|
385
|
-
var
|
386
|
-
var columnHeaderHighlight = this.highlight.createColumnHeader();
|
387
|
-
var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
|
388
|
-
var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
|
389
|
-
var rowHighlight = this.highlight.createRowHighlight();
|
390
|
-
var columnHighlight = this.highlight.createColumnHighlight();
|
359
|
+
var areaHighlight = this.highlight.createOrGetArea();
|
360
|
+
var headerHighlight = this.highlight.createOrGetHeader();
|
361
|
+
var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
|
391
362
|
areaHighlight.clear();
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
activeRowHeaderHighlight.clear();
|
396
|
-
activeColumnHeaderHighlight.clear();
|
397
|
-
rowHighlight.clear();
|
398
|
-
columnHighlight.clear();
|
399
|
-
if (this.highlight.isEnabledFor(_highlight.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
|
363
|
+
headerHighlight.clear();
|
364
|
+
activeHeaderHighlight.clear();
|
365
|
+
if (this.highlight.isEnabledFor(_constants.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
|
400
366
|
areaHighlight.add(cellRange.from).add(cellRange.to).commit();
|
401
|
-
layeredAreaHighlight.add(cellRange.from).add(cellRange.to).commit();
|
402
367
|
if (layerLevel === 1) {
|
403
368
|
// For single cell selection in the same layer, we do not create area selection to prevent blue background.
|
404
369
|
// When non-consecutive selection is performed we have to add that missing area selection to the previous layer
|
405
370
|
// based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
|
406
371
|
var previousRange = this.selectedRange.previous();
|
407
|
-
this.highlight.useLayerLevel(layerLevel - 1)
|
408
|
-
this.highlight.createArea().add(previousRange.from).commit()
|
409
|
-
// Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
|
410
|
-
.syncWith(previousRange);
|
411
|
-
this.highlight.createLayeredArea().add(previousRange.from).commit()
|
372
|
+
this.highlight.useLayerLevel(layerLevel - 1).createOrGetArea().add(previousRange.from).commit()
|
412
373
|
// Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
|
413
374
|
.syncWith(previousRange);
|
414
375
|
this.highlight.useLayerLevel(layerLevel);
|
415
376
|
}
|
416
377
|
}
|
417
|
-
if (this.highlight.isEnabledFor(
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
378
|
+
if (this.highlight.isEnabledFor(_constants.HEADER_TYPE, cellRange.highlight)) {
|
379
|
+
// The header selection generally contains cell selection. In a case when all rows (or columns)
|
380
|
+
// are hidden that visual coordinates are translated to renderable coordinates that do not exist.
|
381
|
+
// Hence no header highlight is generated. In that case, to make a column (or a row) header
|
382
|
+
// highlight, the row and column index has to point to the header (the negative value). See #7052.
|
383
|
+
var areAnyRowsRendered = this.tableProps.countRowsTranslated() === 0;
|
384
|
+
var areAnyColumnsRendered = this.tableProps.countColsTranslated() === 0;
|
385
|
+
var headerCellRange = cellRange;
|
386
|
+
if (areAnyRowsRendered || areAnyColumnsRendered) {
|
387
|
+
headerCellRange = cellRange.clone();
|
388
|
+
}
|
389
|
+
if (areAnyRowsRendered) {
|
390
|
+
headerCellRange.from.row = -1;
|
391
|
+
}
|
392
|
+
if (areAnyColumnsRendered) {
|
393
|
+
headerCellRange.from.col = -1;
|
394
|
+
}
|
422
395
|
if (this.settings.selectionMode === 'single') {
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
396
|
+
if (this.isSelectedByAnyHeader()) {
|
397
|
+
headerCellRange.from.normalize();
|
398
|
+
}
|
399
|
+
headerHighlight.add(headerCellRange.from).commit();
|
427
400
|
} else {
|
428
|
-
|
429
|
-
columnHeaderHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
430
|
-
rowHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
|
431
|
-
columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
|
401
|
+
headerHighlight.add(headerCellRange.from).add(headerCellRange.to).commit();
|
432
402
|
}
|
433
403
|
if (this.isEntireRowSelected()) {
|
434
404
|
var isRowSelected = this.tableProps.countCols() === cellRange.getWidth();
|
435
405
|
|
436
406
|
// Make sure that the whole row is selected (in case where selectionMode is set to 'single')
|
437
407
|
if (isRowSelected) {
|
438
|
-
|
408
|
+
activeHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, -1)).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
|
439
409
|
}
|
440
410
|
}
|
441
411
|
if (this.isEntireColumnSelected()) {
|
@@ -443,7 +413,7 @@ var Selection = /*#__PURE__*/function () {
|
|
443
413
|
|
444
414
|
// Make sure that the whole column is selected (in case where selectionMode is set to 'single')
|
445
415
|
if (isColumnSelected) {
|
446
|
-
|
416
|
+
activeHeaderHighlight.add(this.tableProps.createCellCoords(-1, cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
|
447
417
|
}
|
448
418
|
}
|
449
419
|
}
|
@@ -678,9 +648,7 @@ var Selection = /*#__PURE__*/function () {
|
|
678
648
|
if (!includeRowHeaders && !includeColumnHeaders && (nrOfRows === 0 || nrOfColumns === 0)) {
|
679
649
|
return;
|
680
650
|
}
|
681
|
-
var
|
682
|
-
var columnFrom = includeRowHeaders ? -this.tableProps.countRowHeaders() : 0;
|
683
|
-
var startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
|
651
|
+
var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
|
684
652
|
var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
|
685
653
|
this.clear();
|
686
654
|
this.setRangeStartOnly(startCoords);
|
@@ -814,29 +782,19 @@ var Selection = /*#__PURE__*/function () {
|
|
814
782
|
if (!this.isSelected()) {
|
815
783
|
return;
|
816
784
|
}
|
817
|
-
var
|
785
|
+
var cellHighlight = this.highlight.getCell();
|
818
786
|
var currentLayer = this.getLayerLevel();
|
819
|
-
|
787
|
+
cellHighlight.commit().syncWith(this.selectedRange.current());
|
820
788
|
|
821
789
|
// Rewriting rendered ranges going through all layers.
|
822
790
|
for (var layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
|
823
791
|
this.highlight.useLayerLevel(layerLevel);
|
824
|
-
var areaHighlight = this.highlight.
|
825
|
-
var
|
826
|
-
var
|
827
|
-
var columnHeaderHighlight = this.highlight.createColumnHeader();
|
828
|
-
var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
|
829
|
-
var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
|
830
|
-
var rowHighlight = this.highlight.createRowHighlight();
|
831
|
-
var columnHighlight = this.highlight.createColumnHighlight();
|
792
|
+
var areaHighlight = this.highlight.createOrGetArea();
|
793
|
+
var headerHighlight = this.highlight.createOrGetHeader();
|
794
|
+
var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
|
832
795
|
areaHighlight.commit();
|
833
|
-
|
834
|
-
|
835
|
-
columnHeaderHighlight.commit();
|
836
|
-
activeRowHeaderHighlight.commit();
|
837
|
-
activeColumnHeaderHighlight.commit();
|
838
|
-
rowHighlight.commit();
|
839
|
-
columnHighlight.commit();
|
796
|
+
headerHighlight.commit();
|
797
|
+
activeHeaderHighlight.commit();
|
840
798
|
}
|
841
799
|
|
842
800
|
// Reverting starting layer for the Highlight.
|