handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-834f47e-20230509
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 +19 -52
- package/core.mjs +19 -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 +9162 -9474
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +123 -115
- package/dist/handsontable.js +8763 -9076
- 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
@@ -0,0 +1,348 @@
|
|
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
|
+
import "core-js/modules/es.array.includes.js";
|
8
|
+
import "core-js/modules/es.string.includes.js";
|
9
|
+
import "core-js/modules/es.array.concat.js";
|
10
|
+
import "core-js/modules/es.object.to-string.js";
|
11
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
12
|
+
import "core-js/modules/es.object.values.js";
|
13
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
14
|
+
import "core-js/modules/es.date.to-primitive.js";
|
15
|
+
import "core-js/modules/es.symbol.js";
|
16
|
+
import "core-js/modules/es.symbol.description.js";
|
17
|
+
import "core-js/modules/es.number.constructor.js";
|
18
|
+
import "core-js/modules/es.symbol.iterator.js";
|
19
|
+
import "core-js/modules/es.array.iterator.js";
|
20
|
+
import "core-js/modules/es.string.iterator.js";
|
21
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
22
|
+
import "core-js/modules/es.array.slice.js";
|
23
|
+
import "core-js/modules/es.function.name.js";
|
24
|
+
import "core-js/modules/es.array.from.js";
|
25
|
+
import "core-js/modules/es.regexp.exec.js";
|
26
|
+
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); }
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
28
|
+
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); } }
|
29
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
30
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
31
|
+
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); }
|
32
|
+
import { addClass, hasClass } from "./../../../helpers/dom/element.mjs";
|
33
|
+
import Border from "./border.mjs";
|
34
|
+
/**
|
35
|
+
* @class Selection
|
36
|
+
*/
|
37
|
+
var Selection = /*#__PURE__*/function () {
|
38
|
+
/**
|
39
|
+
* @param {object} settings The selection settings object. @todo type.
|
40
|
+
* @param {CellRange} cellRange The cell range instance.
|
41
|
+
*/
|
42
|
+
function Selection(settings, cellRange) {
|
43
|
+
_classCallCheck(this, Selection);
|
44
|
+
this.settings = settings;
|
45
|
+
this.cellRange = cellRange || null;
|
46
|
+
this.instanceBorders = {};
|
47
|
+
this.classNames = [this.settings.className];
|
48
|
+
this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
|
53
|
+
* borders per instance.
|
54
|
+
*
|
55
|
+
* @param {WalkontableFacade} wotInstance The Walkontable instance.
|
56
|
+
* @returns {Border}
|
57
|
+
*/
|
58
|
+
_createClass(Selection, [{
|
59
|
+
key: "getBorder",
|
60
|
+
value: function getBorder(wotInstance) {
|
61
|
+
if (!this.instanceBorders[wotInstance.guid]) {
|
62
|
+
this.instanceBorders[wotInstance.guid] = new Border(wotInstance, this.settings);
|
63
|
+
}
|
64
|
+
return this.instanceBorders[wotInstance.guid];
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Checks if selection is empty.
|
69
|
+
*
|
70
|
+
* @returns {boolean}
|
71
|
+
*/
|
72
|
+
}, {
|
73
|
+
key: "isEmpty",
|
74
|
+
value: function isEmpty() {
|
75
|
+
return this.cellRange === null;
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Adds a cell coords to the selection.
|
80
|
+
*
|
81
|
+
* @param {CellCoords} coords The cell coordinates to add.
|
82
|
+
* @returns {Selection}
|
83
|
+
*/
|
84
|
+
}, {
|
85
|
+
key: "add",
|
86
|
+
value: function add(coords) {
|
87
|
+
if (this.isEmpty()) {
|
88
|
+
this.cellRange = this.settings.createCellRange(coords);
|
89
|
+
} else {
|
90
|
+
this.cellRange.expand(coords);
|
91
|
+
}
|
92
|
+
return this;
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
|
97
|
+
* information about success.
|
98
|
+
*
|
99
|
+
* @param {CellCoords} oldCoords An old cell coordinates to replace.
|
100
|
+
* @param {CellCoords} newCoords The new cell coordinates.
|
101
|
+
* @returns {boolean}
|
102
|
+
*/
|
103
|
+
}, {
|
104
|
+
key: "replace",
|
105
|
+
value: function replace(oldCoords, newCoords) {
|
106
|
+
if (!this.isEmpty()) {
|
107
|
+
if (this.cellRange.from.isEqual(oldCoords)) {
|
108
|
+
this.cellRange.from = newCoords;
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
if (this.cellRange.to.isEqual(oldCoords)) {
|
112
|
+
this.cellRange.to = newCoords;
|
113
|
+
return true;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Clears selection.
|
121
|
+
*
|
122
|
+
* @returns {Selection}
|
123
|
+
*/
|
124
|
+
}, {
|
125
|
+
key: "clear",
|
126
|
+
value: function clear() {
|
127
|
+
this.cellRange = null;
|
128
|
+
return this;
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
|
133
|
+
*
|
134
|
+
* @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
|
135
|
+
*/
|
136
|
+
}, {
|
137
|
+
key: "getCorners",
|
138
|
+
value: function getCorners() {
|
139
|
+
var topStart = this.cellRange.getOuterTopStartCorner();
|
140
|
+
var bottomEnd = this.cellRange.getOuterBottomEndCorner();
|
141
|
+
return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Adds class name to cell element at given coords.
|
146
|
+
*
|
147
|
+
* @param {WalkontableFacade} wotInstance Walkontable instance.
|
148
|
+
* @param {number} sourceRow Cell row coord.
|
149
|
+
* @param {number} sourceColumn Cell column coord.
|
150
|
+
* @param {string} className Class name.
|
151
|
+
* @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
|
152
|
+
* in a continuous way.
|
153
|
+
* @returns {Selection}
|
154
|
+
*/
|
155
|
+
}, {
|
156
|
+
key: "addClassAtCoords",
|
157
|
+
value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
|
158
|
+
var markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
159
|
+
var TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
|
160
|
+
if (_typeof(TD) === 'object') {
|
161
|
+
var cellClassName = className;
|
162
|
+
if (markIntersections) {
|
163
|
+
cellClassName = this.classNameGenerator(TD);
|
164
|
+
if (!this.classNames.includes(cellClassName)) {
|
165
|
+
this.classNames.push(cellClassName);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
addClass(TD, cellClassName);
|
169
|
+
}
|
170
|
+
return this;
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Generate helper for calculating classNames based on previously added base className.
|
175
|
+
* The generated className is always generated as a continuation of the previous className. For example, when
|
176
|
+
* the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
|
177
|
+
* the element doesn't have any classNames than the base className will be returned ('area');.
|
178
|
+
*
|
179
|
+
* @param {string} baseClassName Base className to be used.
|
180
|
+
* @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
|
181
|
+
* @returns {Function}
|
182
|
+
*/
|
183
|
+
}, {
|
184
|
+
key: "linearClassNameGenerator",
|
185
|
+
value: function linearClassNameGenerator(baseClassName, layerLevelOwner) {
|
186
|
+
// TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
|
187
|
+
return function calcClassName(element) {
|
188
|
+
var previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
189
|
+
if (layerLevelOwner === 0 || previousIndex === 0) {
|
190
|
+
return baseClassName;
|
191
|
+
}
|
192
|
+
var index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
|
193
|
+
var className = baseClassName;
|
194
|
+
index -= 1;
|
195
|
+
var previousClassName = index === 0 ? baseClassName : "".concat(baseClassName, "-").concat(index);
|
196
|
+
if (hasClass(element, previousClassName)) {
|
197
|
+
var currentLayer = index + 1;
|
198
|
+
className = "".concat(baseClassName, "-").concat(currentLayer);
|
199
|
+
} else {
|
200
|
+
className = calcClassName(element, index);
|
201
|
+
}
|
202
|
+
return className;
|
203
|
+
};
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* @param {WalkontableFacade} wotInstance The Walkontable instance.
|
208
|
+
*/
|
209
|
+
}, {
|
210
|
+
key: "draw",
|
211
|
+
value: function draw(wotInstance) {
|
212
|
+
if (this.isEmpty()) {
|
213
|
+
if (this.settings.border) {
|
214
|
+
this.getBorder(wotInstance).disappear();
|
215
|
+
}
|
216
|
+
return;
|
217
|
+
}
|
218
|
+
var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
|
219
|
+
var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
|
220
|
+
var corners = this.getCorners();
|
221
|
+
var _corners = _slicedToArray(corners, 4),
|
222
|
+
topRow = _corners[0],
|
223
|
+
topColumn = _corners[1],
|
224
|
+
bottomRow = _corners[2],
|
225
|
+
bottomColumn = _corners[3];
|
226
|
+
var _this$settings = this.settings,
|
227
|
+
highlightHeaderClassName = _this$settings.highlightHeaderClassName,
|
228
|
+
highlightColumnClassName = _this$settings.highlightColumnClassName,
|
229
|
+
highlightRowClassName = _this$settings.highlightRowClassName,
|
230
|
+
highlightOnlyClosestHeader = _this$settings.highlightOnlyClosestHeader,
|
231
|
+
selectionType = _this$settings.selectionType;
|
232
|
+
var isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
|
233
|
+
if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
|
234
|
+
var selectionColumnCursor = 0;
|
235
|
+
for (var column = 0; column < renderedColumns; column += 1) {
|
236
|
+
var sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
|
237
|
+
if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
|
238
|
+
var THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
|
239
|
+
var closestHeaderLevel = THs.length - 1;
|
240
|
+
if (highlightOnlyClosestHeader && THs.length > 1) {
|
241
|
+
THs = [THs[closestHeaderLevel]];
|
242
|
+
}
|
243
|
+
for (var headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
|
244
|
+
var newClasses = [];
|
245
|
+
var TH = THs[headerLevel];
|
246
|
+
if (highlightHeaderClassName) {
|
247
|
+
newClasses.push(highlightHeaderClassName);
|
248
|
+
}
|
249
|
+
if (highlightColumnClassName) {
|
250
|
+
newClasses.push(highlightColumnClassName);
|
251
|
+
}
|
252
|
+
headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
|
253
|
+
var newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
|
254
|
+
selectionType: selectionType,
|
255
|
+
columnCursor: selectionColumnCursor,
|
256
|
+
selectionWidth: bottomColumn - topColumn + 1,
|
257
|
+
classNames: newClasses
|
258
|
+
});
|
259
|
+
if (newSourceCol !== sourceCol) {
|
260
|
+
TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
|
261
|
+
}
|
262
|
+
addClass(TH, newClasses);
|
263
|
+
}
|
264
|
+
selectionColumnCursor += 1;
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
if (topRow !== null && bottomRow !== null) {
|
269
|
+
var selectionRowCursor = 0;
|
270
|
+
for (var row = 0; row < renderedRows; row += 1) {
|
271
|
+
var sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
|
272
|
+
if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
|
273
|
+
var _THs = wotInstance.wtTable.getRowHeaders(sourceRow);
|
274
|
+
var _closestHeaderLevel = _THs.length - 1;
|
275
|
+
if (highlightOnlyClosestHeader && _THs.length > 1) {
|
276
|
+
_THs = [_THs[_closestHeaderLevel]];
|
277
|
+
}
|
278
|
+
for (var _headerLevel = 0; _headerLevel < _THs.length; _headerLevel += 1) {
|
279
|
+
var _newClasses = [];
|
280
|
+
var _TH = _THs[_headerLevel];
|
281
|
+
if (highlightHeaderClassName) {
|
282
|
+
_newClasses.push(highlightHeaderClassName);
|
283
|
+
}
|
284
|
+
if (highlightRowClassName) {
|
285
|
+
_newClasses.push(highlightRowClassName);
|
286
|
+
}
|
287
|
+
_headerLevel = highlightOnlyClosestHeader ? _closestHeaderLevel : _headerLevel;
|
288
|
+
var newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, _headerLevel, {
|
289
|
+
selectionType: selectionType,
|
290
|
+
rowCursor: selectionRowCursor,
|
291
|
+
selectionHeight: bottomRow - topRow + 1,
|
292
|
+
classNames: _newClasses
|
293
|
+
});
|
294
|
+
if (newSourceRow !== sourceRow) {
|
295
|
+
_TH = wotInstance.wtTable.getRowHeader(newSourceRow, _headerLevel);
|
296
|
+
}
|
297
|
+
addClass(_TH, _newClasses);
|
298
|
+
}
|
299
|
+
selectionRowCursor += 1;
|
300
|
+
}
|
301
|
+
if (topColumn !== null && bottomColumn !== null) {
|
302
|
+
for (var _column = 0; _column < renderedColumns; _column += 1) {
|
303
|
+
var _sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column);
|
304
|
+
if (sourceRow >= topRow && sourceRow <= bottomRow && _sourceCol >= topColumn && _sourceCol <= bottomColumn) {
|
305
|
+
// selected cell
|
306
|
+
if (this.settings.className) {
|
307
|
+
this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, this.settings.className, this.settings.markIntersections);
|
308
|
+
}
|
309
|
+
} else if (sourceRow >= topRow && sourceRow <= bottomRow) {
|
310
|
+
// selection is in this row
|
311
|
+
if (highlightRowClassName) {
|
312
|
+
this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightRowClassName);
|
313
|
+
}
|
314
|
+
} else if (_sourceCol >= topColumn && _sourceCol <= bottomColumn) {
|
315
|
+
// selection is in this column
|
316
|
+
if (highlightColumnClassName) {
|
317
|
+
this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightColumnClassName);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
var additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, _sourceCol, this.settings.layerLevel);
|
321
|
+
if (typeof additionalSelectionClass === 'string') {
|
322
|
+
this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, additionalSelectionClass);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
}
|
327
|
+
}
|
328
|
+
wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
|
329
|
+
if (this.settings.border) {
|
330
|
+
// warning! border.appear modifies corners!
|
331
|
+
this.getBorder(wotInstance).appear(corners);
|
332
|
+
}
|
333
|
+
}
|
334
|
+
|
335
|
+
/**
|
336
|
+
* Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
|
337
|
+
*/
|
338
|
+
}, {
|
339
|
+
key: "destroy",
|
340
|
+
value: function destroy() {
|
341
|
+
Object.values(this.instanceBorders).forEach(function (border) {
|
342
|
+
return border.destroy();
|
343
|
+
});
|
344
|
+
}
|
345
|
+
}]);
|
346
|
+
return Selection;
|
347
|
+
}();
|
348
|
+
export default Selection;
|
@@ -95,28 +95,26 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
95
95
|
* @class Settings
|
96
96
|
*/
|
97
97
|
var Settings = /*#__PURE__*/function () {
|
98
|
-
/**
|
99
|
-
* Reference to settings.
|
100
|
-
*
|
101
|
-
* @protected
|
102
|
-
* @type {SettingsPure}
|
103
|
-
*/
|
104
|
-
|
105
|
-
/**
|
106
|
-
* The defaults values of settings.
|
107
|
-
* Void 0 means it is required, null means it can be empty.
|
108
|
-
*
|
109
|
-
* @public
|
110
|
-
* @type {Readonly<SettingsPure>}
|
111
|
-
*/
|
112
|
-
|
113
98
|
/**
|
114
99
|
* @param {SettingsPure} settings The user defined settings.
|
115
100
|
*/
|
116
101
|
function Settings(settings) {
|
117
102
|
var _this = this;
|
118
103
|
_classCallCheck(this, Settings);
|
104
|
+
/**
|
105
|
+
* Reference to settings.
|
106
|
+
*
|
107
|
+
* @protected
|
108
|
+
* @type {SettingsPure}
|
109
|
+
*/
|
119
110
|
_defineProperty(this, "settings", {});
|
111
|
+
/**
|
112
|
+
* The defaults values of settings.
|
113
|
+
* Void 0 means it is required, null means it can be empty.
|
114
|
+
*
|
115
|
+
* @public
|
116
|
+
* @type {Readonly<SettingsPure>}
|
117
|
+
*/
|
120
118
|
_defineProperty(this, "defaults", Object.freeze(this.getDefaults()));
|
121
119
|
(0, _object.objectEach)(this.defaults, function (value, key) {
|
122
120
|
if (settings[key] !== void 0) {
|
@@ -91,28 +91,26 @@ import { objectEach } from "../../../helpers/object.mjs";
|
|
91
91
|
* @class Settings
|
92
92
|
*/
|
93
93
|
var Settings = /*#__PURE__*/function () {
|
94
|
-
/**
|
95
|
-
* Reference to settings.
|
96
|
-
*
|
97
|
-
* @protected
|
98
|
-
* @type {SettingsPure}
|
99
|
-
*/
|
100
|
-
|
101
|
-
/**
|
102
|
-
* The defaults values of settings.
|
103
|
-
* Void 0 means it is required, null means it can be empty.
|
104
|
-
*
|
105
|
-
* @public
|
106
|
-
* @type {Readonly<SettingsPure>}
|
107
|
-
*/
|
108
|
-
|
109
94
|
/**
|
110
95
|
* @param {SettingsPure} settings The user defined settings.
|
111
96
|
*/
|
112
97
|
function Settings(settings) {
|
113
98
|
var _this = this;
|
114
99
|
_classCallCheck(this, Settings);
|
100
|
+
/**
|
101
|
+
* Reference to settings.
|
102
|
+
*
|
103
|
+
* @protected
|
104
|
+
* @type {SettingsPure}
|
105
|
+
*/
|
115
106
|
_defineProperty(this, "settings", {});
|
107
|
+
/**
|
108
|
+
* The defaults values of settings.
|
109
|
+
* Void 0 means it is required, null means it can be empty.
|
110
|
+
*
|
111
|
+
* @public
|
112
|
+
* @type {Readonly<SettingsPure>}
|
113
|
+
*/
|
116
114
|
_defineProperty(this, "defaults", Object.freeze(this.getDefaults()));
|
117
115
|
objectEach(this.defaults, function (value, key) {
|
118
116
|
if (settings[key] !== void 0) {
|
@@ -83,15 +83,6 @@ var calculatedColumns = {
|
|
83
83
|
*/
|
84
84
|
getVisibleColumnsCount: function getVisibleColumnsCount() {
|
85
85
|
return this.dataAccessObject.countColumnsVisible;
|
86
|
-
},
|
87
|
-
/**
|
88
|
-
* Get the number of rendered row headers.
|
89
|
-
*
|
90
|
-
* @returns {number}
|
91
|
-
* @this Table
|
92
|
-
*/
|
93
|
-
getRowHeadersCount: function getRowHeadersCount() {
|
94
|
-
return this.dataAccessObject.rowHeaders.length;
|
95
86
|
}
|
96
87
|
};
|
97
88
|
(0, _object.defineGetter)(calculatedColumns, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -79,15 +79,6 @@ var calculatedColumns = {
|
|
79
79
|
*/
|
80
80
|
getVisibleColumnsCount: function getVisibleColumnsCount() {
|
81
81
|
return this.dataAccessObject.countColumnsVisible;
|
82
|
-
},
|
83
|
-
/**
|
84
|
-
* Get the number of rendered row headers.
|
85
|
-
*
|
86
|
-
* @returns {number}
|
87
|
-
* @this Table
|
88
|
-
*/
|
89
|
-
getRowHeadersCount: function getRowHeadersCount() {
|
90
|
-
return this.dataAccessObject.rowHeaders.length;
|
91
82
|
}
|
92
83
|
};
|
93
84
|
defineGetter(calculatedColumns, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -83,15 +83,6 @@ var calculatedRows = {
|
|
83
83
|
*/
|
84
84
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
85
85
|
return this.dataAccessObject.countRowsVisible;
|
86
|
-
},
|
87
|
-
/**
|
88
|
-
* Get the number of rendered column headers.
|
89
|
-
*
|
90
|
-
* @returns {number}
|
91
|
-
* @this Table
|
92
|
-
*/
|
93
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
94
|
-
return this.dataAccessObject.columnHeaders.length;
|
95
86
|
}
|
96
87
|
};
|
97
88
|
(0, _object.defineGetter)(calculatedRows, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -79,15 +79,6 @@ var calculatedRows = {
|
|
79
79
|
*/
|
80
80
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
81
81
|
return this.dataAccessObject.countRowsVisible;
|
82
|
-
},
|
83
|
-
/**
|
84
|
-
* Get the number of rendered column headers.
|
85
|
-
*
|
86
|
-
* @returns {number}
|
87
|
-
* @this Table
|
88
|
-
*/
|
89
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
90
|
-
return this.dataAccessObject.columnHeaders.length;
|
91
82
|
}
|
92
83
|
};
|
93
84
|
defineGetter(calculatedRows, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -75,15 +75,6 @@ var stickyColumnsStart = {
|
|
75
75
|
*/
|
76
76
|
getVisibleColumnsCount: function getVisibleColumnsCount() {
|
77
77
|
return this.getRenderedColumnsCount();
|
78
|
-
},
|
79
|
-
/**
|
80
|
-
* Get the number of rendered row headers.
|
81
|
-
*
|
82
|
-
* @returns {number}
|
83
|
-
* @this Table
|
84
|
-
*/
|
85
|
-
getRowHeadersCount: function getRowHeadersCount() {
|
86
|
-
return this.dataAccessObject.rowHeaders.length;
|
87
78
|
}
|
88
79
|
};
|
89
80
|
(0, _object.defineGetter)(stickyColumnsStart, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -71,15 +71,6 @@ var stickyColumnsStart = {
|
|
71
71
|
*/
|
72
72
|
getVisibleColumnsCount: function getVisibleColumnsCount() {
|
73
73
|
return this.getRenderedColumnsCount();
|
74
|
-
},
|
75
|
-
/**
|
76
|
-
* Get the number of rendered row headers.
|
77
|
-
*
|
78
|
-
* @returns {number}
|
79
|
-
* @this Table
|
80
|
-
*/
|
81
|
-
getRowHeadersCount: function getRowHeadersCount() {
|
82
|
-
return this.dataAccessObject.rowHeaders.length;
|
83
74
|
}
|
84
75
|
};
|
85
76
|
defineGetter(stickyColumnsStart, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -80,15 +80,6 @@ var stickyRowsBottom = {
|
|
80
80
|
*/
|
81
81
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
82
82
|
return this.getRenderedRowsCount();
|
83
|
-
},
|
84
|
-
/**
|
85
|
-
* Get the number of rendered column headers.
|
86
|
-
*
|
87
|
-
* @returns {number}
|
88
|
-
* @this Table
|
89
|
-
*/
|
90
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
91
|
-
return 0;
|
92
83
|
}
|
93
84
|
};
|
94
85
|
(0, _object.defineGetter)(stickyRowsBottom, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -76,15 +76,6 @@ var stickyRowsBottom = {
|
|
76
76
|
*/
|
77
77
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
78
78
|
return this.getRenderedRowsCount();
|
79
|
-
},
|
80
|
-
/**
|
81
|
-
* Get the number of rendered column headers.
|
82
|
-
*
|
83
|
-
* @returns {number}
|
84
|
-
* @this Table
|
85
|
-
*/
|
86
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
87
|
-
return 0;
|
88
79
|
}
|
89
80
|
};
|
90
81
|
defineGetter(stickyRowsBottom, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -75,15 +75,6 @@ var stickyRowsTop = {
|
|
75
75
|
*/
|
76
76
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
77
77
|
return this.getRenderedRowsCount();
|
78
|
-
},
|
79
|
-
/**
|
80
|
-
* Get the number of rendered column headers.
|
81
|
-
*
|
82
|
-
* @returns {number}
|
83
|
-
* @this Table
|
84
|
-
*/
|
85
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
86
|
-
return this.dataAccessObject.columnHeaders.length;
|
87
78
|
}
|
88
79
|
};
|
89
80
|
(0, _object.defineGetter)(stickyRowsTop, 'MIXIN_NAME', MIXIN_NAME, {
|
@@ -71,15 +71,6 @@ var stickyRowsTop = {
|
|
71
71
|
*/
|
72
72
|
getVisibleRowsCount: function getVisibleRowsCount() {
|
73
73
|
return this.getRenderedRowsCount();
|
74
|
-
},
|
75
|
-
/**
|
76
|
-
* Get the number of rendered column headers.
|
77
|
-
*
|
78
|
-
* @returns {number}
|
79
|
-
* @this Table
|
80
|
-
*/
|
81
|
-
getColumnHeadersCount: function getColumnHeadersCount() {
|
82
|
-
return this.dataAccessObject.columnHeaders.length;
|
83
74
|
}
|
84
75
|
};
|
85
76
|
defineGetter(stickyRowsTop, 'MIXIN_NAME', MIXIN_NAME, {
|