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.

Files changed (133) hide show
  1. package/3rdparty/walkontable/src/cell/coords.js +37 -22
  2. package/3rdparty/walkontable/src/cell/coords.mjs +37 -22
  3. package/3rdparty/walkontable/src/cell/range.js +54 -39
  4. package/3rdparty/walkontable/src/cell/range.mjs +54 -39
  5. package/3rdparty/walkontable/src/core/_base.js +33 -31
  6. package/3rdparty/walkontable/src/core/_base.mjs +33 -31
  7. package/3rdparty/walkontable/src/core/clone.js +6 -3
  8. package/3rdparty/walkontable/src/core/clone.mjs +6 -3
  9. package/3rdparty/walkontable/src/event.js +2 -1
  10. package/3rdparty/walkontable/src/event.mjs +2 -1
  11. package/3rdparty/walkontable/src/overlay/_base.js +10 -8
  12. package/3rdparty/walkontable/src/overlay/_base.mjs +10 -8
  13. package/3rdparty/walkontable/src/overlay/bottom.js +10 -8
  14. package/3rdparty/walkontable/src/overlay/bottom.mjs +10 -8
  15. package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -1
  16. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
  17. package/3rdparty/walkontable/src/overlay/top.js +11 -9
  18. package/3rdparty/walkontable/src/overlay/top.mjs +11 -9
  19. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +16 -13
  20. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +16 -13
  21. package/3rdparty/walkontable/src/overlays.js +75 -80
  22. package/3rdparty/walkontable/src/overlays.mjs +75 -80
  23. package/3rdparty/walkontable/src/scroll.js +27 -24
  24. package/3rdparty/walkontable/src/scroll.mjs +27 -24
  25. package/3rdparty/walkontable/src/settings.js +18 -17
  26. package/3rdparty/walkontable/src/settings.mjs +18 -17
  27. package/3rdparty/walkontable/src/table.js +42 -37
  28. package/3rdparty/walkontable/src/table.mjs +42 -37
  29. package/base.js +2 -2
  30. package/base.mjs +2 -2
  31. package/core.js +8 -8
  32. package/core.mjs +8 -8
  33. package/dataMap/metaManager/metaLayers/cellMeta.js +2 -1
  34. package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -1
  35. package/dataMap/metaManager/metaLayers/globalMeta.js +1 -1
  36. package/dataMap/metaManager/metaLayers/globalMeta.mjs +1 -1
  37. package/dataMap/metaManager/mods/dynamicCellMeta.js +3 -2
  38. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +3 -2
  39. package/dataMap/metaManager/utils.js +4 -2
  40. package/dataMap/metaManager/utils.mjs +4 -2
  41. package/dist/handsontable.css +2 -2
  42. package/dist/handsontable.full.css +2 -2
  43. package/dist/handsontable.full.js +3247 -2847
  44. package/dist/handsontable.full.min.css +2 -2
  45. package/dist/handsontable.full.min.js +17 -17
  46. package/dist/handsontable.js +3249 -2849
  47. package/dist/handsontable.min.css +2 -2
  48. package/dist/handsontable.min.js +17 -17
  49. package/editors/autocompleteEditor/autocompleteEditor.js +70 -67
  50. package/editors/autocompleteEditor/autocompleteEditor.mjs +70 -67
  51. package/editors/baseEditor/baseEditor.js +1 -1
  52. package/editors/baseEditor/baseEditor.mjs +1 -1
  53. package/editors/dateEditor/dateEditor.js +2 -1
  54. package/editors/dateEditor/dateEditor.mjs +2 -1
  55. package/helpers/mixed.js +1 -1
  56. package/helpers/mixed.mjs +1 -1
  57. package/helpers/object.js +1 -0
  58. package/helpers/object.mjs +1 -0
  59. package/index.js +5 -5
  60. package/index.mjs +5 -5
  61. package/package.json +1 -1
  62. package/plugins/autoColumnSize/autoColumnSize.js +4 -1
  63. package/plugins/autoColumnSize/autoColumnSize.mjs +4 -1
  64. package/plugins/collapsibleColumns/collapsibleColumns.js +54 -38
  65. package/plugins/collapsibleColumns/collapsibleColumns.mjs +54 -38
  66. package/plugins/columnSorting/columnSorting.js +2 -1
  67. package/plugins/columnSorting/columnSorting.mjs +2 -1
  68. package/plugins/columnSorting/columnStatesManager.js +2 -1
  69. package/plugins/columnSorting/columnStatesManager.mjs +2 -1
  70. package/plugins/comments/comments.js +2 -2
  71. package/plugins/comments/comments.mjs +2 -2
  72. package/plugins/copyPaste/copyPaste.js +6 -4
  73. package/plugins/copyPaste/copyPaste.mjs +6 -4
  74. package/plugins/customBorders/customBorders.js +13 -9
  75. package/plugins/customBorders/customBorders.mjs +13 -9
  76. package/plugins/customBorders/utils.js +3 -3
  77. package/plugins/customBorders/utils.mjs +3 -3
  78. package/plugins/filters/conditionCollection.js +6 -5
  79. package/plugins/filters/conditionCollection.mjs +6 -5
  80. package/plugins/filters/filters.js +13 -7
  81. package/plugins/filters/filters.mjs +13 -7
  82. package/plugins/formulas/engine/register.js +3 -3
  83. package/plugins/formulas/engine/register.mjs +3 -3
  84. package/plugins/formulas/engine/settings.js +6 -3
  85. package/plugins/formulas/engine/settings.mjs +6 -3
  86. package/plugins/formulas/formulas.js +151 -143
  87. package/plugins/formulas/formulas.mjs +151 -143
  88. package/plugins/formulas/indexSyncer/axisSyncer.js +115 -79
  89. package/plugins/formulas/indexSyncer/axisSyncer.mjs +115 -79
  90. package/plugins/formulas/indexSyncer/index.js +100 -64
  91. package/plugins/formulas/indexSyncer/index.mjs +100 -64
  92. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +2 -2
  93. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +2 -2
  94. package/plugins/hiddenColumns/hiddenColumns.js +51 -34
  95. package/plugins/hiddenColumns/hiddenColumns.mjs +51 -34
  96. package/plugins/hiddenRows/contextMenuItem/showRow.js +2 -2
  97. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +2 -2
  98. package/plugins/hiddenRows/hiddenRows.js +50 -33
  99. package/plugins/hiddenRows/hiddenRows.mjs +50 -33
  100. package/plugins/manualRowResize/manualRowResize.js +2 -1
  101. package/plugins/manualRowResize/manualRowResize.mjs +2 -1
  102. package/plugins/mergeCells/mergeCells.js +1 -1
  103. package/plugins/mergeCells/mergeCells.mjs +1 -1
  104. package/plugins/nestedHeaders/nestedHeaders.js +88 -67
  105. package/plugins/nestedHeaders/nestedHeaders.mjs +87 -66
  106. package/plugins/nestedHeaders/stateManager/headersTree.js +58 -38
  107. package/plugins/nestedHeaders/stateManager/headersTree.mjs +58 -38
  108. package/plugins/nestedHeaders/stateManager/index.js +70 -49
  109. package/plugins/nestedHeaders/stateManager/index.mjs +68 -47
  110. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +1 -1
  111. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +1 -1
  112. package/plugins/nestedHeaders/stateManager/sourceSettings.js +57 -37
  113. package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +57 -37
  114. package/plugins/nestedHeaders/utils/ghostTable.js +39 -35
  115. package/plugins/nestedHeaders/utils/ghostTable.mjs +39 -35
  116. package/plugins/nestedRows/data/dataManager.js +4 -2
  117. package/plugins/nestedRows/data/dataManager.mjs +4 -2
  118. package/plugins/persistentState/storage.js +1 -0
  119. package/plugins/persistentState/storage.mjs +1 -0
  120. package/plugins/undoRedo/undoRedo.js +2 -1
  121. package/plugins/undoRedo/undoRedo.mjs +2 -1
  122. package/selection/highlight/visualSelection.js +10 -6
  123. package/selection/highlight/visualSelection.mjs +10 -6
  124. package/tableView.js +98 -80
  125. package/tableView.mjs +98 -80
  126. package/translations/changesObservable/observable.js +82 -54
  127. package/translations/changesObservable/observable.mjs +82 -54
  128. package/translations/changesObservable/observer.js +24 -11
  129. package/translations/changesObservable/observer.mjs +24 -11
  130. package/translations/maps/linkedPhysicalIndexToValueMap.js +14 -8
  131. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +14 -8
  132. package/utils/dataStructures/tree.js +21 -18
  133. package/utils/dataStructures/tree.mjs +21 -18
@@ -1,4 +1,12 @@
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 _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
6
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
7
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
8
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
9
+ 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
10
  import { BasePlugin } from "../base/index.mjs";
3
11
  import { addClass } from "../../helpers/dom/element.mjs";
4
12
  import { rangeEach } from "../../helpers/number.mjs";
@@ -123,29 +131,38 @@ export const PLUGIN_PRIORITY = 320;
123
131
  * ```
124
132
  * :::
125
133
  */
134
+ var _settings = /*#__PURE__*/new WeakMap();
135
+ var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
126
136
  export class HiddenRows extends BasePlugin {
137
+ constructor() {
138
+ super(...arguments);
139
+ /**
140
+ * Cached settings from Handsontable settings.
141
+ *
142
+ * @private
143
+ * @type {object}
144
+ */
145
+ _classPrivateFieldInitSpec(this, _settings, {
146
+ writable: true,
147
+ value: {}
148
+ });
149
+ /**
150
+ * Map of hidden rows by the plugin.
151
+ *
152
+ * @private
153
+ * @type {HidingMap|null}
154
+ */
155
+ _classPrivateFieldInitSpec(this, _hiddenRowsMap, {
156
+ writable: true,
157
+ value: null
158
+ });
159
+ }
127
160
  static get PLUGIN_KEY() {
128
161
  return PLUGIN_KEY;
129
162
  }
130
163
  static get PLUGIN_PRIORITY() {
131
164
  return PLUGIN_PRIORITY;
132
165
  }
133
-
134
- /**
135
- * Cached settings from Handsontable settings.
136
- *
137
- * @private
138
- * @type {object}
139
- */
140
- #settings = {};
141
- /**
142
- * Map of hidden rows by the plugin.
143
- *
144
- * @private
145
- * @type {HidingMap|null}
146
- */
147
- #hiddenRowsMap = null;
148
-
149
166
  /**
150
167
  * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
151
168
  * hook and if it returns `true` then the {@link HiddenRows#enablePlugin} method is called.
@@ -166,14 +183,14 @@ export class HiddenRows extends BasePlugin {
166
183
  }
167
184
  const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
168
185
  if (isObject(pluginSettings)) {
169
- this.#settings = pluginSettings;
186
+ _classPrivateFieldSet(this, _settings, pluginSettings);
170
187
  if (isUndefined(pluginSettings.copyPasteEnabled)) {
171
188
  pluginSettings.copyPasteEnabled = true;
172
189
  }
173
190
  }
174
- this.#hiddenRowsMap = new HidingMap();
175
- this.#hiddenRowsMap.addLocalHook('init', () => this.onMapInit());
176
- this.hot.rowIndexMapper.registerMap(this.pluginName, this.#hiddenRowsMap);
191
+ _classPrivateFieldSet(this, _hiddenRowsMap, new HidingMap());
192
+ _classPrivateFieldGet(this, _hiddenRowsMap).addLocalHook('init', () => this.onMapInit());
193
+ this.hot.rowIndexMapper.registerMap(this.pluginName, _classPrivateFieldGet(this, _hiddenRowsMap));
177
194
  this.addHook('afterContextMenuDefaultOptions', function () {
178
195
  return _this.onAfterContextMenuDefaultOptions(...arguments);
179
196
  });
@@ -203,7 +220,7 @@ export class HiddenRows extends BasePlugin {
203
220
  */
204
221
  disablePlugin() {
205
222
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
206
- this.#settings = {};
223
+ _classPrivateFieldSet(this, _settings, {});
207
224
  super.disablePlugin();
208
225
  this.resetCellsMeta();
209
226
  }
@@ -217,7 +234,7 @@ export class HiddenRows extends BasePlugin {
217
234
  const currentHideConfig = this.getHiddenRows();
218
235
  const isValidConfig = this.isValidConfig(rows);
219
236
  let destinationHideConfig = currentHideConfig;
220
- const hidingMapValues = this.#hiddenRowsMap.getValues().slice();
237
+ const hidingMapValues = _classPrivateFieldGet(this, _hiddenRowsMap).getValues().slice();
221
238
  const isAnyRowShowed = rows.length > 0;
222
239
  if (isValidConfig && isAnyRowShowed) {
223
240
  const physicalRows = rows.map(visualRow => this.hot.toPhysicalRow(visualRow));
@@ -240,7 +257,7 @@ export class HiddenRows extends BasePlugin {
240
257
  return;
241
258
  }
242
259
  if (isValidConfig && isAnyRowShowed) {
243
- this.#hiddenRowsMap.setValues(hidingMapValues);
260
+ _classPrivateFieldGet(this, _hiddenRowsMap).setValues(hidingMapValues);
244
261
  }
245
262
  this.hot.runHooks('afterUnhideRows', currentHideConfig, destinationHideConfig, isValidConfig && isAnyRowShowed, isValidConfig && destinationHideConfig.length < currentHideConfig.length);
246
263
  }
@@ -276,7 +293,7 @@ export class HiddenRows extends BasePlugin {
276
293
  if (isConfigValid) {
277
294
  this.hot.batchExecution(() => {
278
295
  arrayEach(rows, visualRow => {
279
- this.#hiddenRowsMap.setValueAtIndex(this.hot.toPhysicalRow(visualRow), true);
296
+ _classPrivateFieldGet(this, _hiddenRowsMap).setValueAtIndex(this.hot.toPhysicalRow(visualRow), true);
280
297
  });
281
298
  }, true);
282
299
  }
@@ -301,7 +318,7 @@ export class HiddenRows extends BasePlugin {
301
318
  * @returns {number[]}
302
319
  */
303
320
  getHiddenRows() {
304
- return arrayMap(this.#hiddenRowsMap.getHiddenIndexes(), physicalRowIndex => {
321
+ return arrayMap(_classPrivateFieldGet(this, _hiddenRowsMap).getHiddenIndexes(), physicalRowIndex => {
305
322
  return this.hot.toVisualRow(physicalRowIndex);
306
323
  });
307
324
  }
@@ -313,7 +330,7 @@ export class HiddenRows extends BasePlugin {
313
330
  * @returns {boolean}
314
331
  */
315
332
  isHidden(row) {
316
- return this.#hiddenRowsMap.getValueAtIndex(this.hot.toPhysicalRow(row)) || false;
333
+ return _classPrivateFieldGet(this, _hiddenRowsMap).getValueAtIndex(this.hot.toPhysicalRow(row)) || false;
317
334
  }
318
335
 
319
336
  /**
@@ -369,7 +386,7 @@ export class HiddenRows extends BasePlugin {
369
386
  * @param {object} cellProperties Object containing the cell properties.
370
387
  */
371
388
  onAfterGetCellMeta(row, column, cellProperties) {
372
- if (this.#settings.copyPasteEnabled === false && this.isHidden(row)) {
389
+ if (_classPrivateFieldGet(this, _settings).copyPasteEnabled === false && this.isHidden(row)) {
373
390
  // Cell property handled by the `Autofill` and the `CopyPaste` plugins.
374
391
  cellProperties.skipRowOnPaste = true;
375
392
  }
@@ -399,7 +416,7 @@ export class HiddenRows extends BasePlugin {
399
416
  */
400
417
  onModifyCopyableRange(ranges) {
401
418
  // Ranges shouldn't be modified when `copyPasteEnabled` option is set to `true` (by default).
402
- if (this.#settings.copyPasteEnabled) {
419
+ if (_classPrivateFieldGet(this, _settings).copyPasteEnabled) {
403
420
  return ranges;
404
421
  }
405
422
  const newRanges = [];
@@ -442,7 +459,7 @@ export class HiddenRows extends BasePlugin {
442
459
  * @param {HTMLElement} TH Header's TH element.
443
460
  */
444
461
  onAfterGetRowHeader(row, TH) {
445
- if (!this.#settings.indicators || row < 0) {
462
+ if (!_classPrivateFieldGet(this, _settings).indicators || row < 0) {
446
463
  return;
447
464
  }
448
465
  const classList = [];
@@ -473,8 +490,8 @@ export class HiddenRows extends BasePlugin {
473
490
  * @private
474
491
  */
475
492
  onMapInit() {
476
- if (Array.isArray(this.#settings.rows)) {
477
- this.hideRows(this.#settings.rows);
493
+ if (Array.isArray(_classPrivateFieldGet(this, _settings).rows)) {
494
+ this.hideRows(_classPrivateFieldGet(this, _settings).rows);
478
495
  }
479
496
  }
480
497
 
@@ -482,8 +499,8 @@ export class HiddenRows extends BasePlugin {
482
499
  * Destroys the plugin instance.
483
500
  */
484
501
  destroy() {
485
- this.#settings = null;
486
- this.#hiddenRowsMap = null;
502
+ _classPrivateFieldSet(this, _settings, null);
503
+ _classPrivateFieldSet(this, _hiddenRowsMap, null);
487
504
  super.destroy();
488
505
  }
489
506
  }
@@ -292,8 +292,9 @@ class ManualRowResize extends _base.BasePlugin {
292
292
  * @returns {boolean}
293
293
  */
294
294
  checkIfRowHeader(element) {
295
+ var _element$parentNode;
295
296
  const thElement = (0, _element.closest)(element, ['TH'], this.hot.rootElement);
296
- return thElement && element.parentNode?.parentNode?.tagName === 'TBODY';
297
+ return thElement && ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.tagName) === 'TBODY';
297
298
  }
298
299
 
299
300
  /**
@@ -284,8 +284,9 @@ export class ManualRowResize extends BasePlugin {
284
284
  * @returns {boolean}
285
285
  */
286
286
  checkIfRowHeader(element) {
287
+ var _element$parentNode;
287
288
  const thElement = closest(element, ['TH'], this.hot.rootElement);
288
- return thElement && element.parentNode?.parentNode?.tagName === 'TBODY';
289
+ return thElement && ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.parentNode) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode.tagName) === 'TBODY';
289
290
  }
290
291
 
291
292
  /**
@@ -252,7 +252,7 @@ class MergeCells extends _base.BasePlugin {
252
252
  rowIndexesToRefresh = [...new Set(rowIndexesToRefresh)];
253
253
  rowIndexesToRefresh.forEach(rowIndex => {
254
254
  const renderableRowIndex = this.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
255
- this.hot.view._wt.wtOverlays.getOverlays(true).map(overlay => overlay?.name === 'master' ? overlay : overlay.clone.wtTable).forEach(wtTableRef => {
255
+ this.hot.view._wt.wtOverlays.getOverlays(true).map(overlay => (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable).forEach(wtTableRef => {
256
256
  const rowToRefresh = wtTableRef.getRow(renderableRowIndex);
257
257
  if (rowToRefresh) {
258
258
  // Modify the TR's `background` property to later modify it asynchronously.
@@ -246,7 +246,7 @@ export class MergeCells extends BasePlugin {
246
246
  rowIndexesToRefresh = [...new Set(rowIndexesToRefresh)];
247
247
  rowIndexesToRefresh.forEach(rowIndex => {
248
248
  const renderableRowIndex = this.hot.rowIndexMapper.getRenderableFromVisualIndex(rowIndex);
249
- this.hot.view._wt.wtOverlays.getOverlays(true).map(overlay => overlay?.name === 'master' ? overlay : overlay.clone.wtTable).forEach(wtTableRef => {
249
+ this.hot.view._wt.wtOverlays.getOverlays(true).map(overlay => (overlay === null || overlay === void 0 ? void 0 : overlay.name) === 'master' ? overlay : overlay.clone.wtTable).forEach(wtTableRef => {
250
250
  const rowToRefresh = wtTableRef.getRow(renderableRowIndex);
251
251
  if (rowToRefresh) {
252
252
  // Modify the TR's `background` property to later modify it asynchronously.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ require("core-js/modules/es.error.cause.js");
3
4
  exports.__esModule = true;
4
5
  require("core-js/modules/es.array.push.js");
5
6
  var _element = require("../../helpers/dom/element");
@@ -9,9 +10,19 @@ var _templateLiteralTag = require("../../helpers/templateLiteralTag");
9
10
  var _console = require("../../helpers/console");
10
11
  var _selection = require("../../selection");
11
12
  var _base = require("../base");
12
- var _stateManager = _interopRequireDefault(require("./stateManager"));
13
+ var _stateManager2 = _interopRequireDefault(require("./stateManager"));
13
14
  var _ghostTable = _interopRequireDefault(require("./utils/ghostTable"));
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ 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; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
20
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
21
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
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; } }
23
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
24
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
25
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
15
26
  const PLUGIN_KEY = 'nestedHeaders';
16
27
  exports.PLUGIN_KEY = PLUGIN_KEY;
17
28
  const PLUGIN_PRIORITY = 280;
@@ -62,46 +73,54 @@ const PLUGIN_PRIORITY = 280;
62
73
  * :::
63
74
  */
64
75
  exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
76
+ var _stateManager = /*#__PURE__*/new WeakMap();
77
+ var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
65
78
  class NestedHeaders extends _base.BasePlugin {
79
+ constructor() {
80
+ super(...arguments);
81
+ /**
82
+ * The state manager for the nested headers.
83
+ *
84
+ * @private
85
+ * @type {StateManager}
86
+ */
87
+ _classPrivateFieldInitSpec(this, _stateManager, {
88
+ writable: true,
89
+ value: new _stateManager2.default()
90
+ });
91
+ /**
92
+ * The instance of the ChangesObservable class that allows track the changes that happens in the
93
+ * column indexes.
94
+ *
95
+ * @private
96
+ * @type {ChangesObservable}
97
+ */
98
+ _classPrivateFieldInitSpec(this, _hidingIndexMapObserver, {
99
+ writable: true,
100
+ value: null
101
+ });
102
+ /**
103
+ * Custom helper for getting widths of the nested headers.
104
+ *
105
+ * @private
106
+ * @type {GhostTable}
107
+ */
108
+ // @TODO This should be changed after refactor handsontable/utils/ghostTable.
109
+ _defineProperty(this, "ghostTable", new _ghostTable.default(this.hot, (row, column) => this.getHeaderSettings(row, column)));
110
+ /**
111
+ * The flag which determines that the nested header settings contains overlapping headers
112
+ * configuration.
113
+ *
114
+ * @type {boolean}
115
+ */
116
+ _defineProperty(this, "detectedOverlappedHeaders", false);
117
+ }
66
118
  static get PLUGIN_KEY() {
67
119
  return PLUGIN_KEY;
68
120
  }
69
121
  static get PLUGIN_PRIORITY() {
70
122
  return PLUGIN_PRIORITY;
71
123
  }
72
-
73
- /**
74
- * The state manager for the nested headers.
75
- *
76
- * @private
77
- * @type {StateManager}
78
- */
79
- #stateManager = new _stateManager.default();
80
- /**
81
- * The instance of the ChangesObservable class that allows track the changes that happens in the
82
- * column indexes.
83
- *
84
- * @private
85
- * @type {ChangesObservable}
86
- */
87
- #hidingIndexMapObserver = null;
88
- /**
89
- * Custom helper for getting widths of the nested headers.
90
- *
91
- * @private
92
- * @type {GhostTable}
93
- */
94
- // @TODO This should be changed after refactor handsontable/utils/ghostTable.
95
- ghostTable = new _ghostTable.default(this.hot, (row, column) => this.getHeaderSettings(row, column));
96
-
97
- /**
98
- * The flag which determines that the nested header settings contains overlapping headers
99
- * configuration.
100
- *
101
- * @type {boolean}
102
- */
103
- detectedOverlappedHeaders = false;
104
-
105
124
  /**
106
125
  * Check if plugin is enabled.
107
126
  *
@@ -173,9 +192,9 @@ class NestedHeaders extends _base.BasePlugin {
173
192
  const {
174
193
  nestedHeaders
175
194
  } = this.hot.getSettings();
176
- this.#stateManager.setColumnsLimit(this.hot.countCols());
195
+ _classPrivateFieldGet(this, _stateManager).setColumnsLimit(this.hot.countCols());
177
196
  if (Array.isArray(nestedHeaders)) {
178
- this.detectedOverlappedHeaders = this.#stateManager.setState(nestedHeaders);
197
+ this.detectedOverlappedHeaders = _classPrivateFieldGet(this, _stateManager).setState(nestedHeaders);
179
198
  }
180
199
  if (this.detectedOverlappedHeaders) {
181
200
  (0, _console.warn)((0, _templateLiteralTag.toSingleLine)`Your Nested Headers plugin setup contains overlapping headers. This kind of configuration\x20
@@ -187,11 +206,11 @@ class NestedHeaders extends _base.BasePlugin {
187
206
  // as if all the columns are visible, needs to be modified to be in sync with a dataset.
188
207
  this.hot.columnIndexMapper.hidingMapsCollection.getMergedValues().forEach((isColumnHidden, physicalColumnIndex) => {
189
208
  const actionName = isColumnHidden === true ? 'hide-column' : 'show-column';
190
- this.#stateManager.triggerColumnModification(actionName, physicalColumnIndex);
209
+ _classPrivateFieldGet(this, _stateManager).triggerColumnModification(actionName, physicalColumnIndex);
191
210
  });
192
211
  }
193
- if (!this.#hidingIndexMapObserver && this.enabled) {
194
- this.#hidingIndexMapObserver = this.hot.columnIndexMapper.createChangesObserver('hiding').subscribe(changes => {
212
+ if (!_classPrivateFieldGet(this, _hidingIndexMapObserver) && this.enabled) {
213
+ _classPrivateFieldSet(this, _hidingIndexMapObserver, this.hot.columnIndexMapper.createChangesObserver('hiding').subscribe(changes => {
195
214
  changes.forEach(_ref => {
196
215
  let {
197
216
  op,
@@ -200,11 +219,11 @@ class NestedHeaders extends _base.BasePlugin {
200
219
  } = _ref;
201
220
  if (op === 'replace') {
202
221
  const actionName = newValue === true ? 'hide-column' : 'show-column';
203
- this.#stateManager.triggerColumnModification(actionName, columnIndex);
222
+ _classPrivateFieldGet(this, _stateManager).triggerColumnModification(actionName, columnIndex);
204
223
  }
205
224
  });
206
225
  this.ghostTable.buildWidthsMap();
207
- });
226
+ }));
208
227
  }
209
228
  this.ghostTable.setLayersCount(this.getLayersCount()).buildWidthsMap();
210
229
  super.updatePlugin();
@@ -215,9 +234,9 @@ class NestedHeaders extends _base.BasePlugin {
215
234
  */
216
235
  disablePlugin() {
217
236
  this.clearColspans();
218
- this.#stateManager.clear();
219
- this.#hidingIndexMapObserver.unsubscribe();
220
- this.#hidingIndexMapObserver = null;
237
+ _classPrivateFieldGet(this, _stateManager).clear();
238
+ _classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
239
+ _classPrivateFieldSet(this, _hidingIndexMapObserver, null);
221
240
  this.ghostTable.clear();
222
241
  super.disablePlugin();
223
242
  }
@@ -229,7 +248,7 @@ class NestedHeaders extends _base.BasePlugin {
229
248
  * @returns {StateManager}
230
249
  */
231
250
  getStateManager() {
232
- return this.#stateManager;
251
+ return _classPrivateFieldGet(this, _stateManager);
233
252
  }
234
253
 
235
254
  /**
@@ -239,7 +258,7 @@ class NestedHeaders extends _base.BasePlugin {
239
258
  * @returns {number}
240
259
  */
241
260
  getLayersCount() {
242
- return this.#stateManager.getLayersCount();
261
+ return _classPrivateFieldGet(this, _stateManager).getLayersCount();
243
262
  }
244
263
 
245
264
  /**
@@ -253,7 +272,7 @@ class NestedHeaders extends _base.BasePlugin {
253
272
  * @returns {object}
254
273
  */
255
274
  getHeaderSettings(headerLevel, columnIndex) {
256
- return this.#stateManager.getHeaderSettings(headerLevel, columnIndex);
275
+ return _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, columnIndex);
257
276
  }
258
277
 
259
278
  /**
@@ -307,7 +326,7 @@ class NestedHeaders extends _base.BasePlugin {
307
326
  var _this2 = this;
308
327
  const fixedColumnsStart = this.hot.view._wt.getSetting('fixedColumnsStart');
309
328
  return (renderedColumnIndex, TH) => {
310
- var _this$stateManager$ge;
329
+ var _classPrivateFieldGet2;
311
330
  const {
312
331
  columnIndexMapper,
313
332
  view
@@ -322,17 +341,18 @@ class NestedHeaders extends _base.BasePlugin {
322
341
  colspan,
323
342
  isHidden,
324
343
  isPlaceholder
325
- } = (_this$stateManager$ge = this.#stateManager.getHeaderSettings(headerLevel, visualColumnIndex)) != null ? _this$stateManager$ge : {
344
+ } = (_classPrivateFieldGet2 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : {
326
345
  label: ''
327
346
  };
328
347
  if (isPlaceholder || isHidden) {
329
348
  (0, _element.addClass)(TH, 'hiddenHeader');
330
349
  } else if (colspan > 1) {
350
+ var _wtOverlays$topInline, _wtOverlays$inlineSta;
331
351
  const {
332
352
  wtOverlays
333
353
  } = view._wt;
334
- const isTopInlineStartOverlay = wtOverlays.topInlineStartCornerOverlay?.clone.wtTable.THEAD.contains(TH);
335
- const isInlineStartOverlay = wtOverlays.inlineStartOverlay?.clone.wtTable.THEAD.contains(TH);
354
+ const isTopInlineStartOverlay = (_wtOverlays$topInline = wtOverlays.topInlineStartCornerOverlay) === null || _wtOverlays$topInline === void 0 ? void 0 : _wtOverlays$topInline.clone.wtTable.THEAD.contains(TH);
355
+ const isInlineStartOverlay = (_wtOverlays$inlineSta = wtOverlays.inlineStartOverlay) === null || _wtOverlays$inlineSta === void 0 ? void 0 : _wtOverlays$inlineSta.clone.wtTable.THEAD.contains(TH);
336
356
 
337
357
  // Check if there is a fixed column enabled, if so then reduce colspan to fixed column width.
338
358
  const correctedColspan = isTopInlineStartOverlay || isInlineStartOverlay ? Math.min(colspan, fixedColumnsStart - renderedColumnIndex) : colspan;
@@ -358,11 +378,11 @@ class NestedHeaders extends _base.BasePlugin {
358
378
  * @returns {string} Returns the column header value to update.
359
379
  */
360
380
  getColumnHeaderValue(visualColumnIndex, headerLevel) {
361
- var _this$stateManager$ge2;
381
+ var _classPrivateFieldGet3;
362
382
  const {
363
383
  isHidden,
364
384
  isPlaceholder
365
- } = (_this$stateManager$ge2 = this.#stateManager.getHeaderSettings(headerLevel, visualColumnIndex)) != null ? _this$stateManager$ge2 : {};
385
+ } = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : {};
366
386
  if (isPlaceholder || isHidden) {
367
387
  return '';
368
388
  }
@@ -379,7 +399,7 @@ class NestedHeaders extends _base.BasePlugin {
379
399
  * @returns {number}
380
400
  */
381
401
  onBeforeHighlightingColumnHeader(visualColumn, headerLevel, highlightMeta) {
382
- const headerNodeData = this.#stateManager.getHeaderTreeNodeData(headerLevel, visualColumn);
402
+ const headerNodeData = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumn);
383
403
  if (!headerNodeData) {
384
404
  return visualColumn;
385
405
  }
@@ -392,7 +412,7 @@ class NestedHeaders extends _base.BasePlugin {
392
412
  const {
393
413
  isRoot,
394
414
  colspan
395
- } = this.#stateManager.getHeaderSettings(headerLevel, visualColumn);
415
+ } = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn);
396
416
  if (selectionType === _selection.HEADER_TYPE) {
397
417
  if (!isRoot) {
398
418
  return headerNodeData.columnIndex;
@@ -441,13 +461,14 @@ class NestedHeaders extends _base.BasePlugin {
441
461
  }
442
462
  for (let column = startCol; column <= endCol; column++) {
443
463
  for (let row = startRow; row <= endRow; row++) {
464
+ var _classPrivateFieldGet4;
444
465
  const zeroBasedColumnHeaderLevel = rowsCount + row;
445
466
  const zeroBasedColumnIndex = column - startCol;
446
467
  if (zeroBasedColumnIndex === 0) {
447
468
  continue; // eslint-disable-line no-continue
448
469
  }
449
470
 
450
- const isRoot = this.#stateManager.getHeaderTreeNodeData(row, column)?.isRoot;
471
+ const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
451
472
  if (isRoot === false) {
452
473
  data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
453
474
  }
@@ -570,7 +591,7 @@ class NestedHeaders extends _base.BasePlugin {
570
591
  */
571
592
  onAfterGetColumnHeaderRenderers(renderersArray) {
572
593
  renderersArray.length = 0;
573
- for (let headerLayer = 0; headerLayer < this.#stateManager.getLayersCount(); headerLayer++) {
594
+ for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(this, _stateManager).getLayersCount(); headerLayer++) {
574
595
  renderersArray.push(this.headerRendererFactory(headerLayer));
575
596
  }
576
597
  }
@@ -582,11 +603,11 @@ class NestedHeaders extends _base.BasePlugin {
582
603
  * @param {object} calc Viewport column calculator.
583
604
  */
584
605
  onAfterViewportColumnCalculatorOverride(calc) {
585
- const headerLayersCount = this.#stateManager.getLayersCount();
606
+ const headerLayersCount = _classPrivateFieldGet(this, _stateManager).getLayersCount();
586
607
  let newStartColumn = calc.startColumn;
587
608
  let nonRenderable = !!headerLayersCount;
588
609
  for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {
589
- const startColumn = this.#stateManager.findLeftMostColumnIndex(headerLayer, calc.startColumn);
610
+ const startColumn = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(headerLayer, calc.startColumn);
590
611
  const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);
591
612
 
592
613
  // If any of the headers for that column index is rendered, all of them should be rendered properly, see
@@ -605,7 +626,7 @@ class NestedHeaders extends _base.BasePlugin {
605
626
 
606
627
  // If no headers for the provided column index are renderable, start rendering from the beginning of the upmost
607
628
  // header for that position.
608
- calc.startColumn = nonRenderable ? this.#stateManager.getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
629
+ calc.startColumn = nonRenderable ? _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
609
630
  }
610
631
 
611
632
  /**
@@ -635,10 +656,10 @@ class NestedHeaders extends _base.BasePlugin {
635
656
  * @returns {string} Returns the column header value to update.
636
657
  */
637
658
  onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
638
- var _this$stateManager$ge3;
659
+ var _classPrivateFieldGet5;
639
660
  const {
640
661
  label
641
- } = (_this$stateManager$ge3 = this.#stateManager.getHeaderTreeNodeData(headerLevel, visualColumnIndex)) != null ? _this$stateManager$ge3 : {
662
+ } = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
642
663
  label: ''
643
664
  };
644
665
  return label;
@@ -672,10 +693,10 @@ class NestedHeaders extends _base.BasePlugin {
672
693
  * Destroys the plugin instance.
673
694
  */
674
695
  destroy() {
675
- this.#stateManager = null;
676
- if (this.#hidingIndexMapObserver !== null) {
677
- this.#hidingIndexMapObserver.unsubscribe();
678
- this.#hidingIndexMapObserver = null;
696
+ _classPrivateFieldSet(this, _stateManager, null);
697
+ if (_classPrivateFieldGet(this, _hidingIndexMapObserver) !== null) {
698
+ _classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
699
+ _classPrivateFieldSet(this, _hidingIndexMapObserver, null);
679
700
  }
680
701
  super.destroy();
681
702
  }
@@ -691,7 +712,7 @@ class NestedHeaders extends _base.BasePlugin {
691
712
  if (coords.row >= 0 || coords.col < 0) {
692
713
  return;
693
714
  }
694
- return this.#stateManager.getHeaderTreeNodeData(coords.row, coords.col);
715
+ return _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(coords.row, coords.col);
695
716
  }
696
717
  }
697
718
  exports.NestedHeaders = NestedHeaders;