handsontable 0.0.0-next-b66c79f-20230713 → 0.0.0-next-85c3085-20230713
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.js +37 -22
- package/3rdparty/walkontable/src/cell/coords.mjs +37 -22
- package/3rdparty/walkontable/src/cell/range.js +54 -39
- package/3rdparty/walkontable/src/cell/range.mjs +54 -39
- package/3rdparty/walkontable/src/core/_base.js +33 -31
- package/3rdparty/walkontable/src/core/_base.mjs +33 -31
- package/3rdparty/walkontable/src/core/clone.js +6 -3
- package/3rdparty/walkontable/src/core/clone.mjs +6 -3
- package/3rdparty/walkontable/src/event.js +2 -1
- package/3rdparty/walkontable/src/event.mjs +2 -1
- package/3rdparty/walkontable/src/overlay/_base.js +10 -8
- package/3rdparty/walkontable/src/overlay/_base.mjs +10 -8
- package/3rdparty/walkontable/src/overlay/bottom.js +10 -8
- package/3rdparty/walkontable/src/overlay/bottom.mjs +10 -8
- package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +11 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +11 -9
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +16 -13
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +16 -13
- package/3rdparty/walkontable/src/overlays.js +75 -80
- package/3rdparty/walkontable/src/overlays.mjs +75 -80
- package/3rdparty/walkontable/src/scroll.js +27 -24
- package/3rdparty/walkontable/src/scroll.mjs +27 -24
- package/3rdparty/walkontable/src/settings.js +18 -17
- package/3rdparty/walkontable/src/settings.mjs +18 -17
- package/3rdparty/walkontable/src/table.js +42 -37
- package/3rdparty/walkontable/src/table.mjs +42 -37
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +8 -8
- package/core.mjs +8 -8
- package/dataMap/metaManager/metaLayers/cellMeta.js +2 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +1 -1
- package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +3 -2
- package/dataMap/metaManager/utils.js +4 -2
- package/dataMap/metaManager/utils.mjs +4 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3247 -2847
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +17 -17
- package/dist/handsontable.js +3249 -2849
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +17 -17
- package/editors/autocompleteEditor/autocompleteEditor.js +70 -67
- package/editors/autocompleteEditor/autocompleteEditor.mjs +70 -67
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +2 -1
- package/editors/dateEditor/dateEditor.mjs +2 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +1 -0
- package/helpers/object.mjs +1 -0
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +4 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +4 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +54 -38
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +54 -38
- package/plugins/columnSorting/columnSorting.js +2 -1
- package/plugins/columnSorting/columnSorting.mjs +2 -1
- package/plugins/columnSorting/columnStatesManager.js +2 -1
- package/plugins/columnSorting/columnStatesManager.mjs +2 -1
- package/plugins/comments/comments.js +2 -2
- package/plugins/comments/comments.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +6 -4
- package/plugins/copyPaste/copyPaste.mjs +6 -4
- package/plugins/customBorders/customBorders.js +13 -9
- package/plugins/customBorders/customBorders.mjs +13 -9
- package/plugins/customBorders/utils.js +3 -3
- package/plugins/customBorders/utils.mjs +3 -3
- package/plugins/filters/conditionCollection.js +6 -5
- package/plugins/filters/conditionCollection.mjs +6 -5
- package/plugins/filters/filters.js +13 -7
- package/plugins/filters/filters.mjs +13 -7
- package/plugins/formulas/engine/register.js +3 -3
- package/plugins/formulas/engine/register.mjs +3 -3
- package/plugins/formulas/engine/settings.js +6 -3
- package/plugins/formulas/engine/settings.mjs +6 -3
- package/plugins/formulas/formulas.js +151 -143
- package/plugins/formulas/formulas.mjs +151 -143
- package/plugins/formulas/indexSyncer/axisSyncer.js +115 -79
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +115 -79
- package/plugins/formulas/indexSyncer/index.js +100 -64
- package/plugins/formulas/indexSyncer/index.mjs +100 -64
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +2 -2
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +2 -2
- package/plugins/hiddenColumns/hiddenColumns.js +51 -34
- package/plugins/hiddenColumns/hiddenColumns.mjs +51 -34
- package/plugins/hiddenRows/contextMenuItem/showRow.js +2 -2
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +2 -2
- package/plugins/hiddenRows/hiddenRows.js +50 -33
- package/plugins/hiddenRows/hiddenRows.mjs +50 -33
- package/plugins/manualRowResize/manualRowResize.js +2 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -1
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +88 -67
- package/plugins/nestedHeaders/nestedHeaders.mjs +87 -66
- package/plugins/nestedHeaders/stateManager/headersTree.js +58 -38
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +58 -38
- package/plugins/nestedHeaders/stateManager/index.js +70 -49
- package/plugins/nestedHeaders/stateManager/index.mjs +68 -47
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +1 -1
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +57 -37
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +57 -37
- package/plugins/nestedHeaders/utils/ghostTable.js +39 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +39 -35
- package/plugins/nestedRows/data/dataManager.js +4 -2
- package/plugins/nestedRows/data/dataManager.mjs +4 -2
- package/plugins/persistentState/storage.js +1 -0
- package/plugins/persistentState/storage.mjs +1 -0
- package/plugins/undoRedo/undoRedo.js +2 -1
- package/plugins/undoRedo/undoRedo.mjs +2 -1
- package/selection/highlight/visualSelection.js +10 -6
- package/selection/highlight/visualSelection.mjs +10 -6
- package/tableView.js +98 -80
- package/tableView.mjs +98 -80
- package/translations/changesObservable/observable.js +82 -54
- package/translations/changesObservable/observable.mjs +82 -54
- package/translations/changesObservable/observer.js +24 -11
- package/translations/changesObservable/observer.mjs +24 -11
- package/translations/maps/linkedPhysicalIndexToValueMap.js +14 -8
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +14 -8
- package/utils/dataStructures/tree.js +21 -18
- package/utils/dataStructures/tree.mjs +21 -18
package/tableView.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _element = require("./helpers/dom/element");
|
6
7
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
7
8
|
var _event = require("./helpers/dom/event");
|
@@ -9,90 +10,107 @@ var _src = _interopRequireDefault(require("./3rdparty/walkontable/src"));
|
|
9
10
|
var _mouseEventHandler = require("./selection/mouseEventHandler");
|
10
11
|
var _rootInstance = require("./utils/rootInstance");
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
14
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
15
|
+
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; }
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
17
|
+
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); }
|
18
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
19
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
20
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
21
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
22
|
+
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; } }
|
12
23
|
const privatePool = new WeakMap();
|
13
24
|
|
14
25
|
/**
|
15
26
|
* @class TableView
|
16
27
|
* @private
|
17
28
|
*/
|
29
|
+
var _columnHeadersCount = /*#__PURE__*/new WeakMap();
|
30
|
+
var _rowHeadersCount = /*#__PURE__*/new WeakMap();
|
18
31
|
class TableView {
|
19
|
-
/**
|
20
|
-
* Instance of {@link Handsontable}.
|
21
|
-
*
|
22
|
-
* @private
|
23
|
-
* @type {Handsontable}
|
24
|
-
*/
|
25
|
-
instance;
|
26
|
-
/**
|
27
|
-
* Instance of {@link EventManager}.
|
28
|
-
*
|
29
|
-
* @private
|
30
|
-
* @type {EventManager}
|
31
|
-
*/
|
32
|
-
eventManager;
|
33
|
-
/**
|
34
|
-
* Current Handsontable's GridSettings object.
|
35
|
-
*
|
36
|
-
* @private
|
37
|
-
* @type {GridSettings}
|
38
|
-
*/
|
39
|
-
settings;
|
40
|
-
/**
|
41
|
-
* Main <THEAD> element.
|
42
|
-
*
|
43
|
-
* @private
|
44
|
-
* @type {HTMLTableSectionElement}
|
45
|
-
*/
|
46
|
-
THEAD;
|
47
|
-
/**
|
48
|
-
* Main <TBODY> element.
|
49
|
-
*
|
50
|
-
* @private
|
51
|
-
* @type {HTMLTableSectionElement}
|
52
|
-
*/
|
53
|
-
TBODY;
|
54
|
-
/**
|
55
|
-
* Main Walkontable instance.
|
56
|
-
*
|
57
|
-
* @private
|
58
|
-
* @type {Walkontable}
|
59
|
-
*/
|
60
|
-
_wt;
|
61
|
-
/**
|
62
|
-
* Main Walkontable instance.
|
63
|
-
*
|
64
|
-
* @private
|
65
|
-
* @type {Walkontable}
|
66
|
-
*/
|
67
|
-
activeWt;
|
68
|
-
/**
|
69
|
-
* The total number of the column header renderers applied to the table through the
|
70
|
-
* `afterGetColumnHeaderRenderers` hook.
|
71
|
-
*
|
72
|
-
* @type {number}
|
73
|
-
*/
|
74
|
-
#columnHeadersCount = 0;
|
75
|
-
/**
|
76
|
-
* The total number of the row header renderers applied to the table through the
|
77
|
-
* `afterGetRowHeaderRenderers` hook.
|
78
|
-
*
|
79
|
-
* @type {number}
|
80
|
-
*/
|
81
|
-
#rowHeadersCount = 0;
|
82
|
-
/**
|
83
|
-
* The flag determines if the `adjustElementsSize` method call was made during
|
84
|
-
* the render suspending. If true, the method has to be triggered once after render
|
85
|
-
* resuming.
|
86
|
-
*
|
87
|
-
* @private
|
88
|
-
* @type {boolean}
|
89
|
-
*/
|
90
|
-
postponedAdjustElementsSize = false;
|
91
|
-
|
92
32
|
/**
|
93
33
|
* @param {Hanstontable} instance Instance of {@link Handsontable}.
|
94
34
|
*/
|
95
35
|
constructor(instance) {
|
36
|
+
/**
|
37
|
+
* Instance of {@link Handsontable}.
|
38
|
+
*
|
39
|
+
* @private
|
40
|
+
* @type {Handsontable}
|
41
|
+
*/
|
42
|
+
_defineProperty(this, "instance", void 0);
|
43
|
+
/**
|
44
|
+
* Instance of {@link EventManager}.
|
45
|
+
*
|
46
|
+
* @private
|
47
|
+
* @type {EventManager}
|
48
|
+
*/
|
49
|
+
_defineProperty(this, "eventManager", void 0);
|
50
|
+
/**
|
51
|
+
* Current Handsontable's GridSettings object.
|
52
|
+
*
|
53
|
+
* @private
|
54
|
+
* @type {GridSettings}
|
55
|
+
*/
|
56
|
+
_defineProperty(this, "settings", void 0);
|
57
|
+
/**
|
58
|
+
* Main <THEAD> element.
|
59
|
+
*
|
60
|
+
* @private
|
61
|
+
* @type {HTMLTableSectionElement}
|
62
|
+
*/
|
63
|
+
_defineProperty(this, "THEAD", void 0);
|
64
|
+
/**
|
65
|
+
* Main <TBODY> element.
|
66
|
+
*
|
67
|
+
* @private
|
68
|
+
* @type {HTMLTableSectionElement}
|
69
|
+
*/
|
70
|
+
_defineProperty(this, "TBODY", void 0);
|
71
|
+
/**
|
72
|
+
* Main Walkontable instance.
|
73
|
+
*
|
74
|
+
* @private
|
75
|
+
* @type {Walkontable}
|
76
|
+
*/
|
77
|
+
_defineProperty(this, "_wt", void 0);
|
78
|
+
/**
|
79
|
+
* Main Walkontable instance.
|
80
|
+
*
|
81
|
+
* @private
|
82
|
+
* @type {Walkontable}
|
83
|
+
*/
|
84
|
+
_defineProperty(this, "activeWt", void 0);
|
85
|
+
/**
|
86
|
+
* The total number of the column header renderers applied to the table through the
|
87
|
+
* `afterGetColumnHeaderRenderers` hook.
|
88
|
+
*
|
89
|
+
* @type {number}
|
90
|
+
*/
|
91
|
+
_classPrivateFieldInitSpec(this, _columnHeadersCount, {
|
92
|
+
writable: true,
|
93
|
+
value: 0
|
94
|
+
});
|
95
|
+
/**
|
96
|
+
* The total number of the row header renderers applied to the table through the
|
97
|
+
* `afterGetRowHeaderRenderers` hook.
|
98
|
+
*
|
99
|
+
* @type {number}
|
100
|
+
*/
|
101
|
+
_classPrivateFieldInitSpec(this, _rowHeadersCount, {
|
102
|
+
writable: true,
|
103
|
+
value: 0
|
104
|
+
});
|
105
|
+
/**
|
106
|
+
* The flag determines if the `adjustElementsSize` method call was made during
|
107
|
+
* the render suspending. If true, the method has to be triggered once after render
|
108
|
+
* resuming.
|
109
|
+
*
|
110
|
+
* @private
|
111
|
+
* @type {boolean}
|
112
|
+
*/
|
113
|
+
_defineProperty(this, "postponedAdjustElementsSize", false);
|
96
114
|
this.instance = instance;
|
97
115
|
this.eventManager = new _eventManager.default(this.instance);
|
98
116
|
this.settings = this.instance.getSettings();
|
@@ -595,7 +613,7 @@ class TableView {
|
|
595
613
|
});
|
596
614
|
}
|
597
615
|
this.instance.runHooks('afterGetRowHeaderRenderers', headerRenderers);
|
598
|
-
this
|
616
|
+
_classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
|
599
617
|
return headerRenderers;
|
600
618
|
},
|
601
619
|
columnHeaders: () => {
|
@@ -609,7 +627,7 @@ class TableView {
|
|
609
627
|
});
|
610
628
|
}
|
611
629
|
this.instance.runHooks('afterGetColumnHeaderRenderers', headerRenderers);
|
612
|
-
this
|
630
|
+
_classPrivateFieldSet(this, _columnHeadersCount, headerRenderers.length);
|
613
631
|
return headerRenderers;
|
614
632
|
},
|
615
633
|
columnWidth: renderedColumnIndex => {
|
@@ -774,7 +792,7 @@ class TableView {
|
|
774
792
|
if (selectionRangeSize > 0) {
|
775
793
|
// Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
|
776
794
|
// Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
|
777
|
-
const selectionOffset = (layerLevel
|
795
|
+
const selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
|
778
796
|
const selectionForLayer = selectedRange.peekByIndex(selectionOffset);
|
779
797
|
cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
|
780
798
|
}
|
@@ -927,8 +945,8 @@ class TableView {
|
|
927
945
|
* @returns {boolean}
|
928
946
|
*/
|
929
947
|
isSelectedOnlyCell() {
|
930
|
-
var _this$instance$getSel;
|
931
|
-
return (_this$instance$getSel = this.instance.getSelectedRangeLast()
|
948
|
+
var _this$instance$getSel, _this$instance$getSel2;
|
949
|
+
return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
|
932
950
|
}
|
933
951
|
|
934
952
|
/**
|
@@ -1166,7 +1184,7 @@ class TableView {
|
|
1166
1184
|
* @returns {number}
|
1167
1185
|
*/
|
1168
1186
|
getColumnHeadersCount() {
|
1169
|
-
return this
|
1187
|
+
return _classPrivateFieldGet(this, _columnHeadersCount);
|
1170
1188
|
}
|
1171
1189
|
|
1172
1190
|
/**
|
@@ -1175,7 +1193,7 @@ class TableView {
|
|
1175
1193
|
* @returns {number}
|
1176
1194
|
*/
|
1177
1195
|
getRowHeadersCount() {
|
1178
|
-
return this
|
1196
|
+
return _classPrivateFieldGet(this, _rowHeadersCount);
|
1179
1197
|
}
|
1180
1198
|
|
1181
1199
|
/**
|
package/tableView.mjs
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
+
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; }
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
7
|
+
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); }
|
8
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
9
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
10
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
11
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
12
|
+
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; } }
|
2
13
|
import { addClass, clearTextSelection, empty, fastInnerHTML, fastInnerText, getScrollbarWidth, hasClass, isChildOf, isInput, isOutsideInput } from "./helpers/dom/element.mjs";
|
3
14
|
import EventManager from "./eventManager.mjs";
|
4
15
|
import { isImmediatePropagationStopped, isRightClick, isLeftClick } from "./helpers/dom/event.mjs";
|
@@ -11,84 +22,91 @@ const privatePool = new WeakMap();
|
|
11
22
|
* @class TableView
|
12
23
|
* @private
|
13
24
|
*/
|
25
|
+
var _columnHeadersCount = /*#__PURE__*/new WeakMap();
|
26
|
+
var _rowHeadersCount = /*#__PURE__*/new WeakMap();
|
14
27
|
class TableView {
|
15
|
-
/**
|
16
|
-
* Instance of {@link Handsontable}.
|
17
|
-
*
|
18
|
-
* @private
|
19
|
-
* @type {Handsontable}
|
20
|
-
*/
|
21
|
-
instance;
|
22
|
-
/**
|
23
|
-
* Instance of {@link EventManager}.
|
24
|
-
*
|
25
|
-
* @private
|
26
|
-
* @type {EventManager}
|
27
|
-
*/
|
28
|
-
eventManager;
|
29
|
-
/**
|
30
|
-
* Current Handsontable's GridSettings object.
|
31
|
-
*
|
32
|
-
* @private
|
33
|
-
* @type {GridSettings}
|
34
|
-
*/
|
35
|
-
settings;
|
36
|
-
/**
|
37
|
-
* Main <THEAD> element.
|
38
|
-
*
|
39
|
-
* @private
|
40
|
-
* @type {HTMLTableSectionElement}
|
41
|
-
*/
|
42
|
-
THEAD;
|
43
|
-
/**
|
44
|
-
* Main <TBODY> element.
|
45
|
-
*
|
46
|
-
* @private
|
47
|
-
* @type {HTMLTableSectionElement}
|
48
|
-
*/
|
49
|
-
TBODY;
|
50
|
-
/**
|
51
|
-
* Main Walkontable instance.
|
52
|
-
*
|
53
|
-
* @private
|
54
|
-
* @type {Walkontable}
|
55
|
-
*/
|
56
|
-
_wt;
|
57
|
-
/**
|
58
|
-
* Main Walkontable instance.
|
59
|
-
*
|
60
|
-
* @private
|
61
|
-
* @type {Walkontable}
|
62
|
-
*/
|
63
|
-
activeWt;
|
64
|
-
/**
|
65
|
-
* The total number of the column header renderers applied to the table through the
|
66
|
-
* `afterGetColumnHeaderRenderers` hook.
|
67
|
-
*
|
68
|
-
* @type {number}
|
69
|
-
*/
|
70
|
-
#columnHeadersCount = 0;
|
71
|
-
/**
|
72
|
-
* The total number of the row header renderers applied to the table through the
|
73
|
-
* `afterGetRowHeaderRenderers` hook.
|
74
|
-
*
|
75
|
-
* @type {number}
|
76
|
-
*/
|
77
|
-
#rowHeadersCount = 0;
|
78
|
-
/**
|
79
|
-
* The flag determines if the `adjustElementsSize` method call was made during
|
80
|
-
* the render suspending. If true, the method has to be triggered once after render
|
81
|
-
* resuming.
|
82
|
-
*
|
83
|
-
* @private
|
84
|
-
* @type {boolean}
|
85
|
-
*/
|
86
|
-
postponedAdjustElementsSize = false;
|
87
|
-
|
88
28
|
/**
|
89
29
|
* @param {Hanstontable} instance Instance of {@link Handsontable}.
|
90
30
|
*/
|
91
31
|
constructor(instance) {
|
32
|
+
/**
|
33
|
+
* Instance of {@link Handsontable}.
|
34
|
+
*
|
35
|
+
* @private
|
36
|
+
* @type {Handsontable}
|
37
|
+
*/
|
38
|
+
_defineProperty(this, "instance", void 0);
|
39
|
+
/**
|
40
|
+
* Instance of {@link EventManager}.
|
41
|
+
*
|
42
|
+
* @private
|
43
|
+
* @type {EventManager}
|
44
|
+
*/
|
45
|
+
_defineProperty(this, "eventManager", void 0);
|
46
|
+
/**
|
47
|
+
* Current Handsontable's GridSettings object.
|
48
|
+
*
|
49
|
+
* @private
|
50
|
+
* @type {GridSettings}
|
51
|
+
*/
|
52
|
+
_defineProperty(this, "settings", void 0);
|
53
|
+
/**
|
54
|
+
* Main <THEAD> element.
|
55
|
+
*
|
56
|
+
* @private
|
57
|
+
* @type {HTMLTableSectionElement}
|
58
|
+
*/
|
59
|
+
_defineProperty(this, "THEAD", void 0);
|
60
|
+
/**
|
61
|
+
* Main <TBODY> element.
|
62
|
+
*
|
63
|
+
* @private
|
64
|
+
* @type {HTMLTableSectionElement}
|
65
|
+
*/
|
66
|
+
_defineProperty(this, "TBODY", void 0);
|
67
|
+
/**
|
68
|
+
* Main Walkontable instance.
|
69
|
+
*
|
70
|
+
* @private
|
71
|
+
* @type {Walkontable}
|
72
|
+
*/
|
73
|
+
_defineProperty(this, "_wt", void 0);
|
74
|
+
/**
|
75
|
+
* Main Walkontable instance.
|
76
|
+
*
|
77
|
+
* @private
|
78
|
+
* @type {Walkontable}
|
79
|
+
*/
|
80
|
+
_defineProperty(this, "activeWt", void 0);
|
81
|
+
/**
|
82
|
+
* The total number of the column header renderers applied to the table through the
|
83
|
+
* `afterGetColumnHeaderRenderers` hook.
|
84
|
+
*
|
85
|
+
* @type {number}
|
86
|
+
*/
|
87
|
+
_classPrivateFieldInitSpec(this, _columnHeadersCount, {
|
88
|
+
writable: true,
|
89
|
+
value: 0
|
90
|
+
});
|
91
|
+
/**
|
92
|
+
* The total number of the row header renderers applied to the table through the
|
93
|
+
* `afterGetRowHeaderRenderers` hook.
|
94
|
+
*
|
95
|
+
* @type {number}
|
96
|
+
*/
|
97
|
+
_classPrivateFieldInitSpec(this, _rowHeadersCount, {
|
98
|
+
writable: true,
|
99
|
+
value: 0
|
100
|
+
});
|
101
|
+
/**
|
102
|
+
* The flag determines if the `adjustElementsSize` method call was made during
|
103
|
+
* the render suspending. If true, the method has to be triggered once after render
|
104
|
+
* resuming.
|
105
|
+
*
|
106
|
+
* @private
|
107
|
+
* @type {boolean}
|
108
|
+
*/
|
109
|
+
_defineProperty(this, "postponedAdjustElementsSize", false);
|
92
110
|
this.instance = instance;
|
93
111
|
this.eventManager = new EventManager(this.instance);
|
94
112
|
this.settings = this.instance.getSettings();
|
@@ -591,7 +609,7 @@ class TableView {
|
|
591
609
|
});
|
592
610
|
}
|
593
611
|
this.instance.runHooks('afterGetRowHeaderRenderers', headerRenderers);
|
594
|
-
this
|
612
|
+
_classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
|
595
613
|
return headerRenderers;
|
596
614
|
},
|
597
615
|
columnHeaders: () => {
|
@@ -605,7 +623,7 @@ class TableView {
|
|
605
623
|
});
|
606
624
|
}
|
607
625
|
this.instance.runHooks('afterGetColumnHeaderRenderers', headerRenderers);
|
608
|
-
this
|
626
|
+
_classPrivateFieldSet(this, _columnHeadersCount, headerRenderers.length);
|
609
627
|
return headerRenderers;
|
610
628
|
},
|
611
629
|
columnWidth: renderedColumnIndex => {
|
@@ -770,7 +788,7 @@ class TableView {
|
|
770
788
|
if (selectionRangeSize > 0) {
|
771
789
|
// Selection layers are stored from the "oldest" to the "newest". We should calculate the offset.
|
772
790
|
// Please look at the `SelectedRange` class and it's method for getting selection's layer for more information.
|
773
|
-
const selectionOffset = (layerLevel
|
791
|
+
const selectionOffset = (layerLevel !== null && layerLevel !== void 0 ? layerLevel : 0) + 1 - selectionRangeSize;
|
774
792
|
const selectionForLayer = selectedRange.peekByIndex(selectionOffset);
|
775
793
|
cornersOfSelection = [selectionForLayer.from.row, selectionForLayer.from.col, selectionForLayer.to.row, selectionForLayer.to.col];
|
776
794
|
}
|
@@ -923,8 +941,8 @@ class TableView {
|
|
923
941
|
* @returns {boolean}
|
924
942
|
*/
|
925
943
|
isSelectedOnlyCell() {
|
926
|
-
var _this$instance$getSel;
|
927
|
-
return (_this$instance$getSel = this.instance.getSelectedRangeLast()
|
944
|
+
var _this$instance$getSel, _this$instance$getSel2;
|
945
|
+
return (_this$instance$getSel = (_this$instance$getSel2 = this.instance.getSelectedRangeLast()) === null || _this$instance$getSel2 === void 0 ? void 0 : _this$instance$getSel2.isSingle()) !== null && _this$instance$getSel !== void 0 ? _this$instance$getSel : false;
|
928
946
|
}
|
929
947
|
|
930
948
|
/**
|
@@ -1162,7 +1180,7 @@ class TableView {
|
|
1162
1180
|
* @returns {number}
|
1163
1181
|
*/
|
1164
1182
|
getColumnHeadersCount() {
|
1165
|
-
return this
|
1183
|
+
return _classPrivateFieldGet(this, _columnHeadersCount);
|
1166
1184
|
}
|
1167
1185
|
|
1168
1186
|
/**
|
@@ -1171,7 +1189,7 @@ class TableView {
|
|
1171
1189
|
* @returns {number}
|
1172
1190
|
*/
|
1173
1191
|
getRowHeadersCount() {
|
1174
|
-
return this
|
1192
|
+
return _classPrivateFieldGet(this, _rowHeadersCount);
|
1175
1193
|
}
|
1176
1194
|
|
1177
1195
|
/**
|
@@ -1,8 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
4
5
|
var _observer = require("./observer");
|
5
6
|
var _utils = require("./utils");
|
7
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
8
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
9
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
11
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
12
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
|
+
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; } }
|
6
14
|
/**
|
7
15
|
* The ChangesObservable module is an object that represents a resource that provides
|
8
16
|
* the ability to observe the changes that happened in the index map indexes during
|
@@ -11,53 +19,73 @@ var _utils = require("./utils");
|
|
11
19
|
* @private
|
12
20
|
* @class ChangesObservable
|
13
21
|
*/
|
22
|
+
var _observers = /*#__PURE__*/new WeakMap();
|
23
|
+
var _indexMatrix = /*#__PURE__*/new WeakMap();
|
24
|
+
var _currentIndexState = /*#__PURE__*/new WeakMap();
|
25
|
+
var _isMatrixIndexesInitialized = /*#__PURE__*/new WeakMap();
|
26
|
+
var _initialIndexValue = /*#__PURE__*/new WeakMap();
|
14
27
|
class ChangesObservable {
|
15
|
-
/**
|
16
|
-
* The list of registered ChangesObserver instances.
|
17
|
-
*
|
18
|
-
* @type {ChangesObserver[]}
|
19
|
-
*/
|
20
|
-
#observers = new Set();
|
21
|
-
/**
|
22
|
-
* An array with default values that act as a base array that will be compared with
|
23
|
-
* the last saved index state. The changes are generated and immediately send through
|
24
|
-
* the newly created ChangesObserver object. Thanks to that, the observer initially has
|
25
|
-
* all information about what indexes are currently changed.
|
26
|
-
*
|
27
|
-
* @type {Array}
|
28
|
-
*/
|
29
|
-
#indexMatrix = [];
|
30
|
-
/**
|
31
|
-
* An array that holds the indexes state that is currently valid. The value is changed on every
|
32
|
-
* index mapper cache update.
|
33
|
-
*
|
34
|
-
* @type {Array}
|
35
|
-
*/
|
36
|
-
#currentIndexState = [];
|
37
|
-
/**
|
38
|
-
* The flag determines if the observable is initialized or not. Not initialized object creates
|
39
|
-
* index matrix once while emitting new changes.
|
40
|
-
*
|
41
|
-
* @type {boolean}
|
42
|
-
*/
|
43
|
-
#isMatrixIndexesInitialized = false;
|
44
|
-
/**
|
45
|
-
* The initial index value allows control from what value the index matrix array will be created.
|
46
|
-
* Changing that value changes how the array diff generates the changes for the initial data
|
47
|
-
* sent to the subscribers. For example, the changes can be triggered by detecting the changes
|
48
|
-
* from `false` to `true` value or vice versa. Generally, it depends on which index map type
|
49
|
-
* the Observable will work with. For "hiding" or "trimming" index types, it will be boolean
|
50
|
-
* values. For various index maps, it can be anything, but I suspect that the most appropriate
|
51
|
-
* initial value will be "undefined" in that case.
|
52
|
-
*
|
53
|
-
* @type {boolean}
|
54
|
-
*/
|
55
|
-
#initialIndexValue = false;
|
56
28
|
constructor() {
|
57
29
|
let {
|
58
30
|
initialIndexValue
|
59
31
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
60
|
-
|
32
|
+
/**
|
33
|
+
* The list of registered ChangesObserver instances.
|
34
|
+
*
|
35
|
+
* @type {ChangesObserver[]}
|
36
|
+
*/
|
37
|
+
_classPrivateFieldInitSpec(this, _observers, {
|
38
|
+
writable: true,
|
39
|
+
value: new Set()
|
40
|
+
});
|
41
|
+
/**
|
42
|
+
* An array with default values that act as a base array that will be compared with
|
43
|
+
* the last saved index state. The changes are generated and immediately send through
|
44
|
+
* the newly created ChangesObserver object. Thanks to that, the observer initially has
|
45
|
+
* all information about what indexes are currently changed.
|
46
|
+
*
|
47
|
+
* @type {Array}
|
48
|
+
*/
|
49
|
+
_classPrivateFieldInitSpec(this, _indexMatrix, {
|
50
|
+
writable: true,
|
51
|
+
value: []
|
52
|
+
});
|
53
|
+
/**
|
54
|
+
* An array that holds the indexes state that is currently valid. The value is changed on every
|
55
|
+
* index mapper cache update.
|
56
|
+
*
|
57
|
+
* @type {Array}
|
58
|
+
*/
|
59
|
+
_classPrivateFieldInitSpec(this, _currentIndexState, {
|
60
|
+
writable: true,
|
61
|
+
value: []
|
62
|
+
});
|
63
|
+
/**
|
64
|
+
* The flag determines if the observable is initialized or not. Not initialized object creates
|
65
|
+
* index matrix once while emitting new changes.
|
66
|
+
*
|
67
|
+
* @type {boolean}
|
68
|
+
*/
|
69
|
+
_classPrivateFieldInitSpec(this, _isMatrixIndexesInitialized, {
|
70
|
+
writable: true,
|
71
|
+
value: false
|
72
|
+
});
|
73
|
+
/**
|
74
|
+
* The initial index value allows control from what value the index matrix array will be created.
|
75
|
+
* Changing that value changes how the array diff generates the changes for the initial data
|
76
|
+
* sent to the subscribers. For example, the changes can be triggered by detecting the changes
|
77
|
+
* from `false` to `true` value or vice versa. Generally, it depends on which index map type
|
78
|
+
* the Observable will work with. For "hiding" or "trimming" index types, it will be boolean
|
79
|
+
* values. For various index maps, it can be anything, but I suspect that the most appropriate
|
80
|
+
* initial value will be "undefined" in that case.
|
81
|
+
*
|
82
|
+
* @type {boolean}
|
83
|
+
*/
|
84
|
+
_classPrivateFieldInitSpec(this, _initialIndexValue, {
|
85
|
+
writable: true,
|
86
|
+
value: false
|
87
|
+
});
|
88
|
+
_classPrivateFieldSet(this, _initialIndexValue, initialIndexValue !== null && initialIndexValue !== void 0 ? initialIndexValue : false);
|
61
89
|
}
|
62
90
|
|
63
91
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
@@ -86,11 +114,11 @@ class ChangesObservable {
|
|
86
114
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
87
115
|
createObserver() {
|
88
116
|
const observer = new _observer.ChangesObserver();
|
89
|
-
this
|
117
|
+
_classPrivateFieldGet(this, _observers).add(observer);
|
90
118
|
observer.addLocalHook('unsubscribe', () => {
|
91
|
-
this
|
119
|
+
_classPrivateFieldGet(this, _observers).delete(observer);
|
92
120
|
});
|
93
|
-
observer._writeInitialChanges((0, _utils.arrayDiff)(this
|
121
|
+
observer._writeInitialChanges((0, _utils.arrayDiff)(_classPrivateFieldGet(this, _indexMatrix), _classPrivateFieldGet(this, _currentIndexState)));
|
94
122
|
return observer;
|
95
123
|
}
|
96
124
|
|
@@ -102,21 +130,21 @@ class ChangesObservable {
|
|
102
130
|
* @param {Array} indexesState An array with index map state.
|
103
131
|
*/
|
104
132
|
emit(indexesState) {
|
105
|
-
let currentIndexState = this
|
106
|
-
if (!this
|
133
|
+
let currentIndexState = _classPrivateFieldGet(this, _currentIndexState);
|
134
|
+
if (!_classPrivateFieldGet(this, _isMatrixIndexesInitialized) || _classPrivateFieldGet(this, _indexMatrix).length !== indexesState.length) {
|
107
135
|
if (indexesState.length === 0) {
|
108
|
-
indexesState = new Array(currentIndexState.length).fill(this
|
136
|
+
indexesState = new Array(currentIndexState.length).fill(_classPrivateFieldGet(this, _initialIndexValue));
|
109
137
|
} else {
|
110
|
-
this
|
138
|
+
_classPrivateFieldSet(this, _indexMatrix, new Array(indexesState.length).fill(_classPrivateFieldGet(this, _initialIndexValue)));
|
111
139
|
}
|
112
|
-
if (!this
|
113
|
-
this
|
114
|
-
currentIndexState = this
|
140
|
+
if (!_classPrivateFieldGet(this, _isMatrixIndexesInitialized)) {
|
141
|
+
_classPrivateFieldSet(this, _isMatrixIndexesInitialized, true);
|
142
|
+
currentIndexState = _classPrivateFieldGet(this, _indexMatrix);
|
115
143
|
}
|
116
144
|
}
|
117
145
|
const changes = (0, _utils.arrayDiff)(currentIndexState, indexesState);
|
118
|
-
this
|
119
|
-
this
|
146
|
+
_classPrivateFieldGet(this, _observers).forEach(observer => observer._write(changes));
|
147
|
+
_classPrivateFieldSet(this, _currentIndexState, indexesState);
|
120
148
|
}
|
121
149
|
}
|
122
150
|
exports.ChangesObservable = ChangesObservable;
|