handsontable 0.0.0-next-820d8a2-20221122 → 0.0.0-next-6812ce6-20221122
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/range.js +8 -0
- package/3rdparty/walkontable/src/cell/range.mjs +8 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -1
- package/core.js +37 -29
- package/core.mjs +37 -29
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3135 -2444
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +62 -62
- package/dist/handsontable.js +2563 -1872
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/dist/languages/all.js +1 -1
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/en-US.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/i18n/constants.js +49 -42
- package/i18n/constants.mjs +45 -41
- package/i18n/languages/en-US.js +1 -1
- package/i18n/languages/en-US.mjs +1 -1
- package/languages/all.js +1 -1
- package/languages/en-US.js +1 -1
- package/languages/en-US.mjs +1 -1
- package/languages/index.js +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +7 -2
- package/pluginHooks.js +23 -3
- package/pluginHooks.mjs +23 -3
- package/plugins/contextMenu/contextMenu.d.ts +4 -3
- package/plugins/copyPaste/contextMenuItem/copy.js +4 -16
- package/plugins/copyPaste/contextMenuItem/copy.mjs +4 -4
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +35 -0
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +31 -0
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +35 -0
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +31 -0
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +35 -0
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +31 -0
- package/plugins/copyPaste/copyPaste.d.ts +10 -2
- package/plugins/copyPaste/copyPaste.js +263 -173
- package/plugins/copyPaste/copyPaste.mjs +263 -173
- package/plugins/copyPaste/copyableRanges.js +260 -0
- package/plugins/copyPaste/copyableRanges.mjs +255 -0
- package/plugins/nestedHeaders/nestedHeaders.js +114 -11
- package/plugins/nestedHeaders/nestedHeaders.mjs +114 -11
- package/plugins/nestedHeaders/stateManager/headersTree.js +1 -0
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +1 -0
- package/plugins/nestedHeaders/stateManager/index.js +21 -10
- package/plugins/nestedHeaders/stateManager/index.mjs +21 -10
- package/selection/selection.js +2 -1
- package/selection/selection.mjs +2 -1
- package/tableView.js +133 -63
- package/tableView.mjs +133 -63
package/tableView.js
CHANGED
@@ -36,76 +36,119 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
36
36
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
37
37
|
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, descriptor.key, descriptor); } }
|
38
38
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
39
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
40
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
41
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
42
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
43
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
44
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
45
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
46
|
+
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; } }
|
39
47
|
var privatePool = new WeakMap();
|
40
48
|
|
41
49
|
/**
|
42
50
|
* @class TableView
|
43
51
|
* @private
|
44
52
|
*/
|
53
|
+
var _columnHeadersCount = /*#__PURE__*/new WeakMap();
|
54
|
+
var _rowHeadersCount = /*#__PURE__*/new WeakMap();
|
45
55
|
var TableView = /*#__PURE__*/function () {
|
56
|
+
/**
|
57
|
+
* Instance of {@link Handsontable}.
|
58
|
+
*
|
59
|
+
* @private
|
60
|
+
* @type {Handsontable}
|
61
|
+
*/
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Instance of {@link EventManager}.
|
65
|
+
*
|
66
|
+
* @private
|
67
|
+
* @type {EventManager}
|
68
|
+
*/
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Current Handsontable's GridSettings object.
|
72
|
+
*
|
73
|
+
* @private
|
74
|
+
* @type {GridSettings}
|
75
|
+
*/
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Main <THEAD> element.
|
79
|
+
*
|
80
|
+
* @private
|
81
|
+
* @type {HTMLTableSectionElement}
|
82
|
+
*/
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Main <TBODY> element.
|
86
|
+
*
|
87
|
+
* @private
|
88
|
+
* @type {HTMLTableSectionElement}
|
89
|
+
*/
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Main Walkontable instance.
|
93
|
+
*
|
94
|
+
* @private
|
95
|
+
* @type {Walkontable}
|
96
|
+
*/
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Main Walkontable instance.
|
100
|
+
*
|
101
|
+
* @private
|
102
|
+
* @type {Walkontable}
|
103
|
+
*/
|
104
|
+
|
105
|
+
/**
|
106
|
+
* The total number of the column header renderers applied to the table through the
|
107
|
+
* `afterGetColumnHeaderRenderers` hook.
|
108
|
+
*
|
109
|
+
* @type {number}
|
110
|
+
*/
|
111
|
+
|
112
|
+
/**
|
113
|
+
* The total number of the row header renderers applied to the table through the
|
114
|
+
* `afterGetRowHeaderRenderers` hook.
|
115
|
+
*
|
116
|
+
* @type {number}
|
117
|
+
*/
|
118
|
+
|
119
|
+
/**
|
120
|
+
* The flag determines if the `adjustElementsSize` method call was made during
|
121
|
+
* the render suspending. If true, the method has to be triggered once after render
|
122
|
+
* resuming.
|
123
|
+
*
|
124
|
+
* @private
|
125
|
+
* @type {boolean}
|
126
|
+
*/
|
127
|
+
|
46
128
|
/**
|
47
129
|
* @param {Hanstontable} instance Instance of {@link Handsontable}.
|
48
130
|
*/
|
49
131
|
function TableView(instance) {
|
50
132
|
_classCallCheck(this, TableView);
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
133
|
+
_defineProperty(this, "instance", void 0);
|
134
|
+
_defineProperty(this, "eventManager", void 0);
|
135
|
+
_defineProperty(this, "settings", void 0);
|
136
|
+
_defineProperty(this, "THEAD", void 0);
|
137
|
+
_defineProperty(this, "TBODY", void 0);
|
138
|
+
_defineProperty(this, "_wt", void 0);
|
139
|
+
_defineProperty(this, "activeWt", void 0);
|
140
|
+
_classPrivateFieldInitSpec(this, _columnHeadersCount, {
|
141
|
+
writable: true,
|
142
|
+
value: 0
|
143
|
+
});
|
144
|
+
_classPrivateFieldInitSpec(this, _rowHeadersCount, {
|
145
|
+
writable: true,
|
146
|
+
value: 0
|
147
|
+
});
|
148
|
+
_defineProperty(this, "postponedAdjustElementsSize", false);
|
57
149
|
this.instance = instance;
|
58
|
-
|
59
|
-
|
60
|
-
*
|
61
|
-
* @private
|
62
|
-
* @type {EventManager}
|
63
|
-
*/
|
64
|
-
this.eventManager = new _eventManager.default(instance);
|
65
|
-
/**
|
66
|
-
* Current Handsontable's GridSettings object.
|
67
|
-
*
|
68
|
-
* @private
|
69
|
-
* @type {GridSettings}
|
70
|
-
*/
|
71
|
-
this.settings = instance.getSettings();
|
72
|
-
/**
|
73
|
-
* Main <THEAD> element.
|
74
|
-
*
|
75
|
-
* @private
|
76
|
-
* @type {HTMLTableSectionElement}
|
77
|
-
*/
|
78
|
-
this.THEAD = void 0;
|
79
|
-
/**
|
80
|
-
* Main <TBODY> element.
|
81
|
-
*
|
82
|
-
* @private
|
83
|
-
* @type {HTMLTableSectionElement}
|
84
|
-
*/
|
85
|
-
this.TBODY = void 0;
|
86
|
-
/**
|
87
|
-
* Main Walkontable instance.
|
88
|
-
*
|
89
|
-
* @private
|
90
|
-
* @type {Walkontable}
|
91
|
-
*/
|
92
|
-
this._wt = void 0;
|
93
|
-
/**
|
94
|
-
* Main Walkontable instance.
|
95
|
-
*
|
96
|
-
* @private
|
97
|
-
* @type {Walkontable}
|
98
|
-
*/
|
99
|
-
this.activeWt = void 0;
|
100
|
-
/**
|
101
|
-
* The flag determines if the `adjustElementsSize` method call was made during
|
102
|
-
* the render suspending. If true, the method has to be triggered once after render
|
103
|
-
* resuming.
|
104
|
-
*
|
105
|
-
* @private
|
106
|
-
* @type {boolean}
|
107
|
-
*/
|
108
|
-
this.postponedAdjustElementsSize = false;
|
150
|
+
this.eventManager = new _eventManager.default(this.instance);
|
151
|
+
this.settings = this.instance.getSettings();
|
109
152
|
privatePool.set(this, {
|
110
153
|
/**
|
111
154
|
* Defines if the text should be selected during mousemove.
|
@@ -663,6 +706,7 @@ var TableView = /*#__PURE__*/function () {
|
|
663
706
|
});
|
664
707
|
}
|
665
708
|
_this2.instance.runHooks('afterGetRowHeaderRenderers', headerRenderers);
|
709
|
+
_classPrivateFieldSet(_this2, _rowHeadersCount, headerRenderers.length);
|
666
710
|
return headerRenderers;
|
667
711
|
},
|
668
712
|
columnHeaders: function columnHeaders() {
|
@@ -676,6 +720,7 @@ var TableView = /*#__PURE__*/function () {
|
|
676
720
|
});
|
677
721
|
}
|
678
722
|
_this2.instance.runHooks('afterGetColumnHeaderRenderers', headerRenderers);
|
723
|
+
_classPrivateFieldSet(_this2, _columnHeadersCount, headerRenderers.length);
|
679
724
|
return headerRenderers;
|
680
725
|
},
|
681
726
|
columnWidth: function columnWidth(renderedColumnIndex) {
|
@@ -1128,7 +1173,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1128
1173
|
* @private
|
1129
1174
|
* @param {number} visualColumnIndex Visual column index.
|
1130
1175
|
* @param {HTMLTableCellElement} TH The table header element.
|
1131
|
-
* @param {Function} label The function that returns the header label.
|
1176
|
+
* @param {Function} [label] The function that returns the header label.
|
1132
1177
|
* @param {number} [headerLevel=0] The index of header level counting from the top (positive
|
1133
1178
|
* values counting from 0 to N).
|
1134
1179
|
*/
|
@@ -1140,10 +1185,10 @@ var TableView = /*#__PURE__*/function () {
|
|
1140
1185
|
if (TH.firstChild) {
|
1141
1186
|
var container = TH.firstChild;
|
1142
1187
|
if ((0, _element.hasClass)(container, 'relative')) {
|
1143
|
-
this.updateCellHeader(container.querySelector('.colHeader'), visualColumnIndex, label);
|
1188
|
+
this.updateCellHeader(container.querySelector('.colHeader'), visualColumnIndex, label, headerLevel);
|
1144
1189
|
} else {
|
1145
1190
|
(0, _element.empty)(TH);
|
1146
|
-
this.appendColHeader(visualColumnIndex, TH, headerLevel);
|
1191
|
+
this.appendColHeader(visualColumnIndex, TH, label, headerLevel);
|
1147
1192
|
}
|
1148
1193
|
} else {
|
1149
1194
|
var rootDocument = this.instance.rootDocument;
|
@@ -1151,7 +1196,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1151
1196
|
var span = rootDocument.createElement('span');
|
1152
1197
|
div.className = 'relative';
|
1153
1198
|
span.className = 'colHeader';
|
1154
|
-
this.updateCellHeader(span, visualColumnIndex, label);
|
1199
|
+
this.updateCellHeader(span, visualColumnIndex, label, headerLevel);
|
1155
1200
|
div.appendChild(span);
|
1156
1201
|
TH.appendChild(div);
|
1157
1202
|
}
|
@@ -1161,14 +1206,17 @@ var TableView = /*#__PURE__*/function () {
|
|
1161
1206
|
/**
|
1162
1207
|
* Updates header cell content.
|
1163
1208
|
*
|
1164
|
-
* @
|
1209
|
+
* @private
|
1165
1210
|
* @param {HTMLElement} element Element to update.
|
1166
1211
|
* @param {number} index Row index or column index.
|
1167
1212
|
* @param {Function} content Function which should be returns content for this cell.
|
1213
|
+
* @param {number} [headerLevel=0] The index of header level counting from the top (positive
|
1214
|
+
* values counting from 0 to N).
|
1168
1215
|
*/
|
1169
1216
|
}, {
|
1170
1217
|
key: "updateCellHeader",
|
1171
1218
|
value: function updateCellHeader(element, index, content) {
|
1219
|
+
var headerLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
1172
1220
|
var renderedIndex = index;
|
1173
1221
|
var parentOverlay = this._wt.wtOverlays.getParentOverlay(element) || this._wt;
|
1174
1222
|
|
@@ -1181,7 +1229,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1181
1229
|
}
|
1182
1230
|
}
|
1183
1231
|
if (renderedIndex > -1) {
|
1184
|
-
(0, _element.fastInnerHTML)(element, content(index));
|
1232
|
+
(0, _element.fastInnerHTML)(element, content(index, headerLevel));
|
1185
1233
|
} else {
|
1186
1234
|
// workaround for https://github.com/handsontable/handsontable/issues/1946
|
1187
1235
|
(0, _element.fastInnerText)(element, String.fromCharCode(160));
|
@@ -1295,6 +1343,28 @@ var TableView = /*#__PURE__*/function () {
|
|
1295
1343
|
return this.instance.columnIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getLastVisibleColumn());
|
1296
1344
|
}
|
1297
1345
|
|
1346
|
+
/**
|
1347
|
+
* Returns the total count of the rendered column headers.
|
1348
|
+
*
|
1349
|
+
* @returns {number}
|
1350
|
+
*/
|
1351
|
+
}, {
|
1352
|
+
key: "getColumnHeadersCount",
|
1353
|
+
value: function getColumnHeadersCount() {
|
1354
|
+
return _classPrivateFieldGet(this, _columnHeadersCount);
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
/**
|
1358
|
+
* Returns the total count of the rendered row headers.
|
1359
|
+
*
|
1360
|
+
* @returns {number}
|
1361
|
+
*/
|
1362
|
+
}, {
|
1363
|
+
key: "getRowHeadersCount",
|
1364
|
+
value: function getRowHeadersCount() {
|
1365
|
+
return _classPrivateFieldGet(this, _rowHeadersCount);
|
1366
|
+
}
|
1367
|
+
|
1298
1368
|
/**
|
1299
1369
|
* Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
|
1300
1370
|
*
|
package/tableView.mjs
CHANGED
@@ -11,6 +11,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
11
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
12
12
|
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, descriptor.key, descriptor); } }
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
14
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
15
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
16
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
18
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
19
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
20
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
21
|
+
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; } }
|
14
22
|
import "core-js/modules/es.array.iterator.js";
|
15
23
|
import "core-js/modules/es.object.to-string.js";
|
16
24
|
import "core-js/modules/es.string.iterator.js";
|
@@ -37,70 +45,105 @@ var privatePool = new WeakMap();
|
|
37
45
|
* @class TableView
|
38
46
|
* @private
|
39
47
|
*/
|
48
|
+
var _columnHeadersCount = /*#__PURE__*/new WeakMap();
|
49
|
+
var _rowHeadersCount = /*#__PURE__*/new WeakMap();
|
40
50
|
var TableView = /*#__PURE__*/function () {
|
51
|
+
/**
|
52
|
+
* Instance of {@link Handsontable}.
|
53
|
+
*
|
54
|
+
* @private
|
55
|
+
* @type {Handsontable}
|
56
|
+
*/
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Instance of {@link EventManager}.
|
60
|
+
*
|
61
|
+
* @private
|
62
|
+
* @type {EventManager}
|
63
|
+
*/
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Current Handsontable's GridSettings object.
|
67
|
+
*
|
68
|
+
* @private
|
69
|
+
* @type {GridSettings}
|
70
|
+
*/
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Main <THEAD> element.
|
74
|
+
*
|
75
|
+
* @private
|
76
|
+
* @type {HTMLTableSectionElement}
|
77
|
+
*/
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Main <TBODY> element.
|
81
|
+
*
|
82
|
+
* @private
|
83
|
+
* @type {HTMLTableSectionElement}
|
84
|
+
*/
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Main Walkontable instance.
|
88
|
+
*
|
89
|
+
* @private
|
90
|
+
* @type {Walkontable}
|
91
|
+
*/
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Main Walkontable instance.
|
95
|
+
*
|
96
|
+
* @private
|
97
|
+
* @type {Walkontable}
|
98
|
+
*/
|
99
|
+
|
100
|
+
/**
|
101
|
+
* The total number of the column header renderers applied to the table through the
|
102
|
+
* `afterGetColumnHeaderRenderers` hook.
|
103
|
+
*
|
104
|
+
* @type {number}
|
105
|
+
*/
|
106
|
+
|
107
|
+
/**
|
108
|
+
* The total number of the row header renderers applied to the table through the
|
109
|
+
* `afterGetRowHeaderRenderers` hook.
|
110
|
+
*
|
111
|
+
* @type {number}
|
112
|
+
*/
|
113
|
+
|
114
|
+
/**
|
115
|
+
* The flag determines if the `adjustElementsSize` method call was made during
|
116
|
+
* the render suspending. If true, the method has to be triggered once after render
|
117
|
+
* resuming.
|
118
|
+
*
|
119
|
+
* @private
|
120
|
+
* @type {boolean}
|
121
|
+
*/
|
122
|
+
|
41
123
|
/**
|
42
124
|
* @param {Hanstontable} instance Instance of {@link Handsontable}.
|
43
125
|
*/
|
44
126
|
function TableView(instance) {
|
45
127
|
_classCallCheck(this, TableView);
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
128
|
+
_defineProperty(this, "instance", void 0);
|
129
|
+
_defineProperty(this, "eventManager", void 0);
|
130
|
+
_defineProperty(this, "settings", void 0);
|
131
|
+
_defineProperty(this, "THEAD", void 0);
|
132
|
+
_defineProperty(this, "TBODY", void 0);
|
133
|
+
_defineProperty(this, "_wt", void 0);
|
134
|
+
_defineProperty(this, "activeWt", void 0);
|
135
|
+
_classPrivateFieldInitSpec(this, _columnHeadersCount, {
|
136
|
+
writable: true,
|
137
|
+
value: 0
|
138
|
+
});
|
139
|
+
_classPrivateFieldInitSpec(this, _rowHeadersCount, {
|
140
|
+
writable: true,
|
141
|
+
value: 0
|
142
|
+
});
|
143
|
+
_defineProperty(this, "postponedAdjustElementsSize", false);
|
52
144
|
this.instance = instance;
|
53
|
-
|
54
|
-
|
55
|
-
*
|
56
|
-
* @private
|
57
|
-
* @type {EventManager}
|
58
|
-
*/
|
59
|
-
this.eventManager = new EventManager(instance);
|
60
|
-
/**
|
61
|
-
* Current Handsontable's GridSettings object.
|
62
|
-
*
|
63
|
-
* @private
|
64
|
-
* @type {GridSettings}
|
65
|
-
*/
|
66
|
-
this.settings = instance.getSettings();
|
67
|
-
/**
|
68
|
-
* Main <THEAD> element.
|
69
|
-
*
|
70
|
-
* @private
|
71
|
-
* @type {HTMLTableSectionElement}
|
72
|
-
*/
|
73
|
-
this.THEAD = void 0;
|
74
|
-
/**
|
75
|
-
* Main <TBODY> element.
|
76
|
-
*
|
77
|
-
* @private
|
78
|
-
* @type {HTMLTableSectionElement}
|
79
|
-
*/
|
80
|
-
this.TBODY = void 0;
|
81
|
-
/**
|
82
|
-
* Main Walkontable instance.
|
83
|
-
*
|
84
|
-
* @private
|
85
|
-
* @type {Walkontable}
|
86
|
-
*/
|
87
|
-
this._wt = void 0;
|
88
|
-
/**
|
89
|
-
* Main Walkontable instance.
|
90
|
-
*
|
91
|
-
* @private
|
92
|
-
* @type {Walkontable}
|
93
|
-
*/
|
94
|
-
this.activeWt = void 0;
|
95
|
-
/**
|
96
|
-
* The flag determines if the `adjustElementsSize` method call was made during
|
97
|
-
* the render suspending. If true, the method has to be triggered once after render
|
98
|
-
* resuming.
|
99
|
-
*
|
100
|
-
* @private
|
101
|
-
* @type {boolean}
|
102
|
-
*/
|
103
|
-
this.postponedAdjustElementsSize = false;
|
145
|
+
this.eventManager = new EventManager(this.instance);
|
146
|
+
this.settings = this.instance.getSettings();
|
104
147
|
privatePool.set(this, {
|
105
148
|
/**
|
106
149
|
* Defines if the text should be selected during mousemove.
|
@@ -658,6 +701,7 @@ var TableView = /*#__PURE__*/function () {
|
|
658
701
|
});
|
659
702
|
}
|
660
703
|
_this2.instance.runHooks('afterGetRowHeaderRenderers', headerRenderers);
|
704
|
+
_classPrivateFieldSet(_this2, _rowHeadersCount, headerRenderers.length);
|
661
705
|
return headerRenderers;
|
662
706
|
},
|
663
707
|
columnHeaders: function columnHeaders() {
|
@@ -671,6 +715,7 @@ var TableView = /*#__PURE__*/function () {
|
|
671
715
|
});
|
672
716
|
}
|
673
717
|
_this2.instance.runHooks('afterGetColumnHeaderRenderers', headerRenderers);
|
718
|
+
_classPrivateFieldSet(_this2, _columnHeadersCount, headerRenderers.length);
|
674
719
|
return headerRenderers;
|
675
720
|
},
|
676
721
|
columnWidth: function columnWidth(renderedColumnIndex) {
|
@@ -1123,7 +1168,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1123
1168
|
* @private
|
1124
1169
|
* @param {number} visualColumnIndex Visual column index.
|
1125
1170
|
* @param {HTMLTableCellElement} TH The table header element.
|
1126
|
-
* @param {Function} label The function that returns the header label.
|
1171
|
+
* @param {Function} [label] The function that returns the header label.
|
1127
1172
|
* @param {number} [headerLevel=0] The index of header level counting from the top (positive
|
1128
1173
|
* values counting from 0 to N).
|
1129
1174
|
*/
|
@@ -1135,10 +1180,10 @@ var TableView = /*#__PURE__*/function () {
|
|
1135
1180
|
if (TH.firstChild) {
|
1136
1181
|
var container = TH.firstChild;
|
1137
1182
|
if (hasClass(container, 'relative')) {
|
1138
|
-
this.updateCellHeader(container.querySelector('.colHeader'), visualColumnIndex, label);
|
1183
|
+
this.updateCellHeader(container.querySelector('.colHeader'), visualColumnIndex, label, headerLevel);
|
1139
1184
|
} else {
|
1140
1185
|
empty(TH);
|
1141
|
-
this.appendColHeader(visualColumnIndex, TH, headerLevel);
|
1186
|
+
this.appendColHeader(visualColumnIndex, TH, label, headerLevel);
|
1142
1187
|
}
|
1143
1188
|
} else {
|
1144
1189
|
var rootDocument = this.instance.rootDocument;
|
@@ -1146,7 +1191,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1146
1191
|
var span = rootDocument.createElement('span');
|
1147
1192
|
div.className = 'relative';
|
1148
1193
|
span.className = 'colHeader';
|
1149
|
-
this.updateCellHeader(span, visualColumnIndex, label);
|
1194
|
+
this.updateCellHeader(span, visualColumnIndex, label, headerLevel);
|
1150
1195
|
div.appendChild(span);
|
1151
1196
|
TH.appendChild(div);
|
1152
1197
|
}
|
@@ -1156,14 +1201,17 @@ var TableView = /*#__PURE__*/function () {
|
|
1156
1201
|
/**
|
1157
1202
|
* Updates header cell content.
|
1158
1203
|
*
|
1159
|
-
* @
|
1204
|
+
* @private
|
1160
1205
|
* @param {HTMLElement} element Element to update.
|
1161
1206
|
* @param {number} index Row index or column index.
|
1162
1207
|
* @param {Function} content Function which should be returns content for this cell.
|
1208
|
+
* @param {number} [headerLevel=0] The index of header level counting from the top (positive
|
1209
|
+
* values counting from 0 to N).
|
1163
1210
|
*/
|
1164
1211
|
}, {
|
1165
1212
|
key: "updateCellHeader",
|
1166
1213
|
value: function updateCellHeader(element, index, content) {
|
1214
|
+
var headerLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
1167
1215
|
var renderedIndex = index;
|
1168
1216
|
var parentOverlay = this._wt.wtOverlays.getParentOverlay(element) || this._wt;
|
1169
1217
|
|
@@ -1176,7 +1224,7 @@ var TableView = /*#__PURE__*/function () {
|
|
1176
1224
|
}
|
1177
1225
|
}
|
1178
1226
|
if (renderedIndex > -1) {
|
1179
|
-
fastInnerHTML(element, content(index));
|
1227
|
+
fastInnerHTML(element, content(index, headerLevel));
|
1180
1228
|
} else {
|
1181
1229
|
// workaround for https://github.com/handsontable/handsontable/issues/1946
|
1182
1230
|
fastInnerText(element, String.fromCharCode(160));
|
@@ -1290,6 +1338,28 @@ var TableView = /*#__PURE__*/function () {
|
|
1290
1338
|
return this.instance.columnIndexMapper.getVisualFromRenderableIndex(this.instance.view._wt.wtScroll.getLastVisibleColumn());
|
1291
1339
|
}
|
1292
1340
|
|
1341
|
+
/**
|
1342
|
+
* Returns the total count of the rendered column headers.
|
1343
|
+
*
|
1344
|
+
* @returns {number}
|
1345
|
+
*/
|
1346
|
+
}, {
|
1347
|
+
key: "getColumnHeadersCount",
|
1348
|
+
value: function getColumnHeadersCount() {
|
1349
|
+
return _classPrivateFieldGet(this, _columnHeadersCount);
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
/**
|
1353
|
+
* Returns the total count of the rendered row headers.
|
1354
|
+
*
|
1355
|
+
* @returns {number}
|
1356
|
+
*/
|
1357
|
+
}, {
|
1358
|
+
key: "getRowHeadersCount",
|
1359
|
+
value: function getRowHeadersCount() {
|
1360
|
+
return _classPrivateFieldGet(this, _rowHeadersCount);
|
1361
|
+
}
|
1362
|
+
|
1293
1363
|
/**
|
1294
1364
|
* Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
|
1295
1365
|
*
|