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
@@ -2,7 +2,15 @@
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 _string = require("../../../helpers/string");
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
  * @private
8
16
  * @class IndexSyncer
@@ -12,60 +20,88 @@ var _string = require("../../../helpers/string");
12
20
  * elements in HF's engine to perform formulas calculations on them. It also provides method for translation from visual
13
21
  * row/column indexes to HF's row/column indexes.
14
22
  */
23
+ var _axis = /*#__PURE__*/new WeakMap();
24
+ var _indexMapper = /*#__PURE__*/new WeakMap();
25
+ var _indexSyncer = /*#__PURE__*/new WeakMap();
26
+ var _indexesSequence = /*#__PURE__*/new WeakMap();
27
+ var _movedIndexes = /*#__PURE__*/new WeakMap();
28
+ var _finalIndex = /*#__PURE__*/new WeakMap();
29
+ var _removedIndexes = /*#__PURE__*/new WeakMap();
15
30
  class AxisSyncer {
16
- /**
17
- * The axis for which the actions are performed.
18
- *
19
- * @private
20
- * @type {'row'|'column'}
21
- */
22
- #axis;
23
- /**
24
- * Reference to index mapper.
25
- *
26
- * @private
27
- * @type {IndexMapper}
28
- */
29
- #indexMapper;
30
- /**
31
- * The index synchronizer for both axis (is storing some more general information).
32
- *
33
- * @private
34
- * @type {IndexSyncer}
35
- */
36
- #indexSyncer;
37
- /**
38
- * Sequence of physical indexes stored for watching changes and calculating some transformations.
39
- *
40
- * @private
41
- * @type {Array<number>}
42
- */
43
- #indexesSequence = [];
44
- /**
45
- * List of moved HF indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
46
- *
47
- * @private
48
- * @type {Array<number>}
49
- */
50
- #movedIndexes = [];
51
- /**
52
- * Final HF's place where to move indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
53
- *
54
- * @private
55
- * @type {number|undefined}
56
- */
57
- #finalIndex;
58
- /**
59
- * List of removed HF indexes, stored before performing removal on HOT to calculate transformation needed on HF's engine.
60
- *
61
- * @private
62
- * @type {Array<number>}
63
- */
64
- #removedIndexes = [];
65
31
  constructor(axis, indexMapper, indexSyncer) {
66
- this.#axis = axis;
67
- this.#indexMapper = indexMapper;
68
- this.#indexSyncer = indexSyncer;
32
+ /**
33
+ * The axis for which the actions are performed.
34
+ *
35
+ * @private
36
+ * @type {'row'|'column'}
37
+ */
38
+ _classPrivateFieldInitSpec(this, _axis, {
39
+ writable: true,
40
+ value: void 0
41
+ });
42
+ /**
43
+ * Reference to index mapper.
44
+ *
45
+ * @private
46
+ * @type {IndexMapper}
47
+ */
48
+ _classPrivateFieldInitSpec(this, _indexMapper, {
49
+ writable: true,
50
+ value: void 0
51
+ });
52
+ /**
53
+ * The index synchronizer for both axis (is storing some more general information).
54
+ *
55
+ * @private
56
+ * @type {IndexSyncer}
57
+ */
58
+ _classPrivateFieldInitSpec(this, _indexSyncer, {
59
+ writable: true,
60
+ value: void 0
61
+ });
62
+ /**
63
+ * Sequence of physical indexes stored for watching changes and calculating some transformations.
64
+ *
65
+ * @private
66
+ * @type {Array<number>}
67
+ */
68
+ _classPrivateFieldInitSpec(this, _indexesSequence, {
69
+ writable: true,
70
+ value: []
71
+ });
72
+ /**
73
+ * List of moved HF indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
74
+ *
75
+ * @private
76
+ * @type {Array<number>}
77
+ */
78
+ _classPrivateFieldInitSpec(this, _movedIndexes, {
79
+ writable: true,
80
+ value: []
81
+ });
82
+ /**
83
+ * Final HF's place where to move indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
84
+ *
85
+ * @private
86
+ * @type {number|undefined}
87
+ */
88
+ _classPrivateFieldInitSpec(this, _finalIndex, {
89
+ writable: true,
90
+ value: void 0
91
+ });
92
+ /**
93
+ * List of removed HF indexes, stored before performing removal on HOT to calculate transformation needed on HF's engine.
94
+ *
95
+ * @private
96
+ * @type {Array<number>}
97
+ */
98
+ _classPrivateFieldInitSpec(this, _removedIndexes, {
99
+ writable: true,
100
+ value: []
101
+ });
102
+ _classPrivateFieldSet(this, _axis, axis);
103
+ _classPrivateFieldSet(this, _indexMapper, indexMapper);
104
+ _classPrivateFieldSet(this, _indexSyncer, indexSyncer);
69
105
  }
70
106
 
71
107
  /**
@@ -75,11 +111,11 @@ class AxisSyncer {
75
111
  * @returns {Array<number>} List of removed visual indexes.
76
112
  */
77
113
  setRemovedHfIndexes(removedIndexes) {
78
- this.#removedIndexes = removedIndexes.map(physicalIndex => {
79
- const visualIndex = this.#indexMapper.getVisualFromPhysicalIndex(physicalIndex);
114
+ _classPrivateFieldSet(this, _removedIndexes, removedIndexes.map(physicalIndex => {
115
+ const visualIndex = _classPrivateFieldGet(this, _indexMapper).getVisualFromPhysicalIndex(physicalIndex);
80
116
  return this.getHfIndexFromVisualIndex(visualIndex);
81
- });
82
- return this.#removedIndexes;
117
+ }));
118
+ return _classPrivateFieldGet(this, _removedIndexes);
83
119
  }
84
120
 
85
121
  /**
@@ -88,7 +124,7 @@ class AxisSyncer {
88
124
  * @returns {Array<number>} List of removed HF indexes.
89
125
  */
90
126
  getRemovedHfIndexes() {
91
- return this.#removedIndexes;
127
+ return _classPrivateFieldGet(this, _removedIndexes);
92
128
  }
93
129
 
94
130
  /**
@@ -99,8 +135,8 @@ class AxisSyncer {
99
135
  * @returns {number}
100
136
  */
101
137
  getHfIndexFromVisualIndex(visualIndex) {
102
- const indexesSequence = this.#indexMapper.getIndexesSequence();
103
- const notTrimmedIndexes = this.#indexMapper.getNotTrimmedIndexes();
138
+ const indexesSequence = _classPrivateFieldGet(this, _indexMapper).getIndexesSequence();
139
+ const notTrimmedIndexes = _classPrivateFieldGet(this, _indexMapper).getNotTrimmedIndexes();
104
140
  return indexesSequence.indexOf(notTrimmedIndexes[visualIndex]);
105
141
  }
106
142
 
@@ -112,14 +148,14 @@ class AxisSyncer {
112
148
  */
113
149
  syncMoves(moves) {
114
150
  const NUMBER_OF_MOVED_INDEXES = 1;
115
- const SYNC_MOVE_METHOD_NAME = `move${(0, _string.toUpperCaseFirst)(this.#axis)}s`;
116
- this.#indexSyncer.getEngine().batch(() => {
151
+ const SYNC_MOVE_METHOD_NAME = `move${(0, _string.toUpperCaseFirst)(_classPrivateFieldGet(this, _axis))}s`;
152
+ _classPrivateFieldGet(this, _indexSyncer).getEngine().batch(() => {
117
153
  moves.forEach(move => {
118
154
  const moveToTheSamePosition = move.from !== move.to;
119
155
  // Moving from left to right (or top to bottom) to a line (drop index) right after already moved element.
120
156
  const anotherMoveWithoutEffect = move.from + 1 !== move.to;
121
157
  if (moveToTheSamePosition && anotherMoveWithoutEffect) {
122
- this.#indexSyncer.getEngine()[SYNC_MOVE_METHOD_NAME](this.#indexSyncer.getSheetId(), move.from, NUMBER_OF_MOVED_INDEXES, move.to);
158
+ _classPrivateFieldGet(this, _indexSyncer).getEngine()[SYNC_MOVE_METHOD_NAME](_classPrivateFieldGet(this, _indexSyncer).getSheetId(), move.from, NUMBER_OF_MOVED_INDEXES, move.to);
123
159
  }
124
160
  });
125
161
  });
@@ -136,8 +172,8 @@ class AxisSyncer {
136
172
  if (movePossible === false) {
137
173
  return;
138
174
  }
139
- this.#movedIndexes = movedVisualIndexes.map(index => this.getHfIndexFromVisualIndex(index));
140
- this.#finalIndex = this.getHfIndexFromVisualIndex(visualFinalIndex);
175
+ _classPrivateFieldSet(this, _movedIndexes, movedVisualIndexes.map(index => this.getHfIndexFromVisualIndex(index)));
176
+ _classPrivateFieldSet(this, _finalIndex, this.getHfIndexFromVisualIndex(visualFinalIndex));
141
177
  }
142
178
 
143
179
  /**
@@ -150,11 +186,11 @@ class AxisSyncer {
150
186
  * @private
151
187
  */
152
188
  getMoveLine(movedHfIndexes, finalHfIndex) {
153
- const numberOfElements = this.#indexMapper.getNumberOfIndexes();
189
+ const numberOfElements = _classPrivateFieldGet(this, _indexMapper).getNumberOfIndexes();
154
190
  const notMovedElements = Array.from(Array(numberOfElements).keys()).filter(index => movedHfIndexes.includes(index) === false);
155
191
  if (finalHfIndex === 0) {
156
192
  var _notMovedElements$fin;
157
- return (_notMovedElements$fin = notMovedElements[finalHfIndex]) != null ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
193
+ return (_notMovedElements$fin = notMovedElements[finalHfIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
158
194
  }
159
195
 
160
196
  return notMovedElements[finalHfIndex - 1] + 1; // Moving before another element.
@@ -221,15 +257,15 @@ class AxisSyncer {
221
257
  * @param {boolean} orderChanged Indicates if order of HOT indexes was changed by move.
222
258
  */
223
259
  calculateAndSyncMoves(movePossible, orderChanged) {
224
- if (this.#indexSyncer.isPerformingUndoRedo()) {
260
+ if (_classPrivateFieldGet(this, _indexSyncer).isPerformingUndoRedo()) {
225
261
  return;
226
262
  }
227
263
  if (movePossible === false || orderChanged === false) {
228
264
  return;
229
265
  }
230
- const calculatedMoves = this.adjustedCalculatedMoves(this.getInitiallyCalculatedMoves(this.#movedIndexes, this.#finalIndex));
231
- if (this.#indexSyncer.getSheetId() === null) {
232
- this.#indexSyncer.getPostponeAction(() => this.syncMoves(calculatedMoves));
266
+ const calculatedMoves = this.adjustedCalculatedMoves(this.getInitiallyCalculatedMoves(_classPrivateFieldGet(this, _movedIndexes), _classPrivateFieldGet(this, _finalIndex)));
267
+ if (_classPrivateFieldGet(this, _indexSyncer).getSheetId() === null) {
268
+ _classPrivateFieldGet(this, _indexSyncer).getPostponeAction(() => this.syncMoves(calculatedMoves));
233
269
  } else {
234
270
  this.syncMoves(calculatedMoves);
235
271
  }
@@ -241,17 +277,17 @@ class AxisSyncer {
241
277
  * @returns {Function}
242
278
  */
243
279
  getIndexesChangeSyncMethod() {
244
- const SYNC_ORDER_CHANGE_METHOD_NAME = `set${(0, _string.toUpperCaseFirst)(this.#axis)}Order`;
280
+ const SYNC_ORDER_CHANGE_METHOD_NAME = `set${(0, _string.toUpperCaseFirst)(_classPrivateFieldGet(this, _axis))}Order`;
245
281
  return source => {
246
- if (this.#indexSyncer.isPerformingUndoRedo()) {
282
+ if (_classPrivateFieldGet(this, _indexSyncer).isPerformingUndoRedo()) {
247
283
  return;
248
284
  }
249
- const newSequence = this.#indexMapper.getIndexesSequence();
285
+ const newSequence = _classPrivateFieldGet(this, _indexMapper).getIndexesSequence();
250
286
  if (source === 'update') {
251
- const relativeTransformation = this.#indexesSequence.map(index => newSequence.indexOf(index));
252
- const sheetDimensions = this.#indexSyncer.getEngine().getSheetDimensions(this.#indexSyncer.getSheetId());
287
+ const relativeTransformation = _classPrivateFieldGet(this, _indexesSequence).map(index => newSequence.indexOf(index));
288
+ const sheetDimensions = _classPrivateFieldGet(this, _indexSyncer).getEngine().getSheetDimensions(_classPrivateFieldGet(this, _indexSyncer).getSheetId());
253
289
  let sizeForAxis;
254
- if (this.#axis === 'row') {
290
+ if (_classPrivateFieldGet(this, _axis) === 'row') {
255
291
  sizeForAxis = sheetDimensions.height;
256
292
  } else {
257
293
  sizeForAxis = sheetDimensions.width;
@@ -264,9 +300,9 @@ class AxisSyncer {
264
300
  for (let i = numberOfReorganisedIndexes; i < sizeForAxis; i += 1) {
265
301
  relativeTransformation.push(i);
266
302
  }
267
- this.#indexSyncer.getEngine()[SYNC_ORDER_CHANGE_METHOD_NAME](this.#indexSyncer.getSheetId(), relativeTransformation);
303
+ _classPrivateFieldGet(this, _indexSyncer).getEngine()[SYNC_ORDER_CHANGE_METHOD_NAME](_classPrivateFieldGet(this, _indexSyncer).getSheetId(), relativeTransformation);
268
304
  }
269
- this.#indexesSequence = newSequence;
305
+ _classPrivateFieldSet(this, _indexesSequence, newSequence);
270
306
  };
271
307
  }
272
308
 
@@ -274,7 +310,7 @@ class AxisSyncer {
274
310
  * Initialize the AxisSyncer.
275
311
  */
276
312
  init() {
277
- this.#indexesSequence = this.#indexMapper.getIndexesSequence();
313
+ _classPrivateFieldSet(this, _indexesSequence, _classPrivateFieldGet(this, _indexMapper).getIndexesSequence());
278
314
  }
279
315
  }
280
316
  var _default = AxisSyncer;
@@ -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 { toUpperCaseFirst } from "../../../helpers/string.mjs";
3
11
  /**
4
12
  * @private
@@ -9,60 +17,88 @@ import { toUpperCaseFirst } from "../../../helpers/string.mjs";
9
17
  * elements in HF's engine to perform formulas calculations on them. It also provides method for translation from visual
10
18
  * row/column indexes to HF's row/column indexes.
11
19
  */
20
+ var _axis = /*#__PURE__*/new WeakMap();
21
+ var _indexMapper = /*#__PURE__*/new WeakMap();
22
+ var _indexSyncer = /*#__PURE__*/new WeakMap();
23
+ var _indexesSequence = /*#__PURE__*/new WeakMap();
24
+ var _movedIndexes = /*#__PURE__*/new WeakMap();
25
+ var _finalIndex = /*#__PURE__*/new WeakMap();
26
+ var _removedIndexes = /*#__PURE__*/new WeakMap();
12
27
  class AxisSyncer {
13
- /**
14
- * The axis for which the actions are performed.
15
- *
16
- * @private
17
- * @type {'row'|'column'}
18
- */
19
- #axis;
20
- /**
21
- * Reference to index mapper.
22
- *
23
- * @private
24
- * @type {IndexMapper}
25
- */
26
- #indexMapper;
27
- /**
28
- * The index synchronizer for both axis (is storing some more general information).
29
- *
30
- * @private
31
- * @type {IndexSyncer}
32
- */
33
- #indexSyncer;
34
- /**
35
- * Sequence of physical indexes stored for watching changes and calculating some transformations.
36
- *
37
- * @private
38
- * @type {Array<number>}
39
- */
40
- #indexesSequence = [];
41
- /**
42
- * List of moved HF indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
43
- *
44
- * @private
45
- * @type {Array<number>}
46
- */
47
- #movedIndexes = [];
48
- /**
49
- * Final HF's place where to move indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
50
- *
51
- * @private
52
- * @type {number|undefined}
53
- */
54
- #finalIndex;
55
- /**
56
- * List of removed HF indexes, stored before performing removal on HOT to calculate transformation needed on HF's engine.
57
- *
58
- * @private
59
- * @type {Array<number>}
60
- */
61
- #removedIndexes = [];
62
28
  constructor(axis, indexMapper, indexSyncer) {
63
- this.#axis = axis;
64
- this.#indexMapper = indexMapper;
65
- this.#indexSyncer = indexSyncer;
29
+ /**
30
+ * The axis for which the actions are performed.
31
+ *
32
+ * @private
33
+ * @type {'row'|'column'}
34
+ */
35
+ _classPrivateFieldInitSpec(this, _axis, {
36
+ writable: true,
37
+ value: void 0
38
+ });
39
+ /**
40
+ * Reference to index mapper.
41
+ *
42
+ * @private
43
+ * @type {IndexMapper}
44
+ */
45
+ _classPrivateFieldInitSpec(this, _indexMapper, {
46
+ writable: true,
47
+ value: void 0
48
+ });
49
+ /**
50
+ * The index synchronizer for both axis (is storing some more general information).
51
+ *
52
+ * @private
53
+ * @type {IndexSyncer}
54
+ */
55
+ _classPrivateFieldInitSpec(this, _indexSyncer, {
56
+ writable: true,
57
+ value: void 0
58
+ });
59
+ /**
60
+ * Sequence of physical indexes stored for watching changes and calculating some transformations.
61
+ *
62
+ * @private
63
+ * @type {Array<number>}
64
+ */
65
+ _classPrivateFieldInitSpec(this, _indexesSequence, {
66
+ writable: true,
67
+ value: []
68
+ });
69
+ /**
70
+ * List of moved HF indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
71
+ *
72
+ * @private
73
+ * @type {Array<number>}
74
+ */
75
+ _classPrivateFieldInitSpec(this, _movedIndexes, {
76
+ writable: true,
77
+ value: []
78
+ });
79
+ /**
80
+ * Final HF's place where to move indexes, stored before performing move on HOT to calculate transformation needed on HF's engine.
81
+ *
82
+ * @private
83
+ * @type {number|undefined}
84
+ */
85
+ _classPrivateFieldInitSpec(this, _finalIndex, {
86
+ writable: true,
87
+ value: void 0
88
+ });
89
+ /**
90
+ * List of removed HF indexes, stored before performing removal on HOT to calculate transformation needed on HF's engine.
91
+ *
92
+ * @private
93
+ * @type {Array<number>}
94
+ */
95
+ _classPrivateFieldInitSpec(this, _removedIndexes, {
96
+ writable: true,
97
+ value: []
98
+ });
99
+ _classPrivateFieldSet(this, _axis, axis);
100
+ _classPrivateFieldSet(this, _indexMapper, indexMapper);
101
+ _classPrivateFieldSet(this, _indexSyncer, indexSyncer);
66
102
  }
67
103
 
68
104
  /**
@@ -72,11 +108,11 @@ class AxisSyncer {
72
108
  * @returns {Array<number>} List of removed visual indexes.
73
109
  */
74
110
  setRemovedHfIndexes(removedIndexes) {
75
- this.#removedIndexes = removedIndexes.map(physicalIndex => {
76
- const visualIndex = this.#indexMapper.getVisualFromPhysicalIndex(physicalIndex);
111
+ _classPrivateFieldSet(this, _removedIndexes, removedIndexes.map(physicalIndex => {
112
+ const visualIndex = _classPrivateFieldGet(this, _indexMapper).getVisualFromPhysicalIndex(physicalIndex);
77
113
  return this.getHfIndexFromVisualIndex(visualIndex);
78
- });
79
- return this.#removedIndexes;
114
+ }));
115
+ return _classPrivateFieldGet(this, _removedIndexes);
80
116
  }
81
117
 
82
118
  /**
@@ -85,7 +121,7 @@ class AxisSyncer {
85
121
  * @returns {Array<number>} List of removed HF indexes.
86
122
  */
87
123
  getRemovedHfIndexes() {
88
- return this.#removedIndexes;
124
+ return _classPrivateFieldGet(this, _removedIndexes);
89
125
  }
90
126
 
91
127
  /**
@@ -96,8 +132,8 @@ class AxisSyncer {
96
132
  * @returns {number}
97
133
  */
98
134
  getHfIndexFromVisualIndex(visualIndex) {
99
- const indexesSequence = this.#indexMapper.getIndexesSequence();
100
- const notTrimmedIndexes = this.#indexMapper.getNotTrimmedIndexes();
135
+ const indexesSequence = _classPrivateFieldGet(this, _indexMapper).getIndexesSequence();
136
+ const notTrimmedIndexes = _classPrivateFieldGet(this, _indexMapper).getNotTrimmedIndexes();
101
137
  return indexesSequence.indexOf(notTrimmedIndexes[visualIndex]);
102
138
  }
103
139
 
@@ -109,14 +145,14 @@ class AxisSyncer {
109
145
  */
110
146
  syncMoves(moves) {
111
147
  const NUMBER_OF_MOVED_INDEXES = 1;
112
- const SYNC_MOVE_METHOD_NAME = `move${toUpperCaseFirst(this.#axis)}s`;
113
- this.#indexSyncer.getEngine().batch(() => {
148
+ const SYNC_MOVE_METHOD_NAME = `move${toUpperCaseFirst(_classPrivateFieldGet(this, _axis))}s`;
149
+ _classPrivateFieldGet(this, _indexSyncer).getEngine().batch(() => {
114
150
  moves.forEach(move => {
115
151
  const moveToTheSamePosition = move.from !== move.to;
116
152
  // Moving from left to right (or top to bottom) to a line (drop index) right after already moved element.
117
153
  const anotherMoveWithoutEffect = move.from + 1 !== move.to;
118
154
  if (moveToTheSamePosition && anotherMoveWithoutEffect) {
119
- this.#indexSyncer.getEngine()[SYNC_MOVE_METHOD_NAME](this.#indexSyncer.getSheetId(), move.from, NUMBER_OF_MOVED_INDEXES, move.to);
155
+ _classPrivateFieldGet(this, _indexSyncer).getEngine()[SYNC_MOVE_METHOD_NAME](_classPrivateFieldGet(this, _indexSyncer).getSheetId(), move.from, NUMBER_OF_MOVED_INDEXES, move.to);
120
156
  }
121
157
  });
122
158
  });
@@ -133,8 +169,8 @@ class AxisSyncer {
133
169
  if (movePossible === false) {
134
170
  return;
135
171
  }
136
- this.#movedIndexes = movedVisualIndexes.map(index => this.getHfIndexFromVisualIndex(index));
137
- this.#finalIndex = this.getHfIndexFromVisualIndex(visualFinalIndex);
172
+ _classPrivateFieldSet(this, _movedIndexes, movedVisualIndexes.map(index => this.getHfIndexFromVisualIndex(index)));
173
+ _classPrivateFieldSet(this, _finalIndex, this.getHfIndexFromVisualIndex(visualFinalIndex));
138
174
  }
139
175
 
140
176
  /**
@@ -147,11 +183,11 @@ class AxisSyncer {
147
183
  * @private
148
184
  */
149
185
  getMoveLine(movedHfIndexes, finalHfIndex) {
150
- const numberOfElements = this.#indexMapper.getNumberOfIndexes();
186
+ const numberOfElements = _classPrivateFieldGet(this, _indexMapper).getNumberOfIndexes();
151
187
  const notMovedElements = Array.from(Array(numberOfElements).keys()).filter(index => movedHfIndexes.includes(index) === false);
152
188
  if (finalHfIndex === 0) {
153
189
  var _notMovedElements$fin;
154
- return (_notMovedElements$fin = notMovedElements[finalHfIndex]) != null ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
190
+ return (_notMovedElements$fin = notMovedElements[finalHfIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
155
191
  }
156
192
 
157
193
  return notMovedElements[finalHfIndex - 1] + 1; // Moving before another element.
@@ -218,15 +254,15 @@ class AxisSyncer {
218
254
  * @param {boolean} orderChanged Indicates if order of HOT indexes was changed by move.
219
255
  */
220
256
  calculateAndSyncMoves(movePossible, orderChanged) {
221
- if (this.#indexSyncer.isPerformingUndoRedo()) {
257
+ if (_classPrivateFieldGet(this, _indexSyncer).isPerformingUndoRedo()) {
222
258
  return;
223
259
  }
224
260
  if (movePossible === false || orderChanged === false) {
225
261
  return;
226
262
  }
227
- const calculatedMoves = this.adjustedCalculatedMoves(this.getInitiallyCalculatedMoves(this.#movedIndexes, this.#finalIndex));
228
- if (this.#indexSyncer.getSheetId() === null) {
229
- this.#indexSyncer.getPostponeAction(() => this.syncMoves(calculatedMoves));
263
+ const calculatedMoves = this.adjustedCalculatedMoves(this.getInitiallyCalculatedMoves(_classPrivateFieldGet(this, _movedIndexes), _classPrivateFieldGet(this, _finalIndex)));
264
+ if (_classPrivateFieldGet(this, _indexSyncer).getSheetId() === null) {
265
+ _classPrivateFieldGet(this, _indexSyncer).getPostponeAction(() => this.syncMoves(calculatedMoves));
230
266
  } else {
231
267
  this.syncMoves(calculatedMoves);
232
268
  }
@@ -238,17 +274,17 @@ class AxisSyncer {
238
274
  * @returns {Function}
239
275
  */
240
276
  getIndexesChangeSyncMethod() {
241
- const SYNC_ORDER_CHANGE_METHOD_NAME = `set${toUpperCaseFirst(this.#axis)}Order`;
277
+ const SYNC_ORDER_CHANGE_METHOD_NAME = `set${toUpperCaseFirst(_classPrivateFieldGet(this, _axis))}Order`;
242
278
  return source => {
243
- if (this.#indexSyncer.isPerformingUndoRedo()) {
279
+ if (_classPrivateFieldGet(this, _indexSyncer).isPerformingUndoRedo()) {
244
280
  return;
245
281
  }
246
- const newSequence = this.#indexMapper.getIndexesSequence();
282
+ const newSequence = _classPrivateFieldGet(this, _indexMapper).getIndexesSequence();
247
283
  if (source === 'update') {
248
- const relativeTransformation = this.#indexesSequence.map(index => newSequence.indexOf(index));
249
- const sheetDimensions = this.#indexSyncer.getEngine().getSheetDimensions(this.#indexSyncer.getSheetId());
284
+ const relativeTransformation = _classPrivateFieldGet(this, _indexesSequence).map(index => newSequence.indexOf(index));
285
+ const sheetDimensions = _classPrivateFieldGet(this, _indexSyncer).getEngine().getSheetDimensions(_classPrivateFieldGet(this, _indexSyncer).getSheetId());
250
286
  let sizeForAxis;
251
- if (this.#axis === 'row') {
287
+ if (_classPrivateFieldGet(this, _axis) === 'row') {
252
288
  sizeForAxis = sheetDimensions.height;
253
289
  } else {
254
290
  sizeForAxis = sheetDimensions.width;
@@ -261,9 +297,9 @@ class AxisSyncer {
261
297
  for (let i = numberOfReorganisedIndexes; i < sizeForAxis; i += 1) {
262
298
  relativeTransformation.push(i);
263
299
  }
264
- this.#indexSyncer.getEngine()[SYNC_ORDER_CHANGE_METHOD_NAME](this.#indexSyncer.getSheetId(), relativeTransformation);
300
+ _classPrivateFieldGet(this, _indexSyncer).getEngine()[SYNC_ORDER_CHANGE_METHOD_NAME](_classPrivateFieldGet(this, _indexSyncer).getSheetId(), relativeTransformation);
265
301
  }
266
- this.#indexesSequence = newSequence;
302
+ _classPrivateFieldSet(this, _indexesSequence, newSequence);
267
303
  };
268
304
  }
269
305
 
@@ -271,7 +307,7 @@ class AxisSyncer {
271
307
  * Initialize the AxisSyncer.
272
308
  */
273
309
  init() {
274
- this.#indexesSequence = this.#indexMapper.getIndexesSequence();
310
+ _classPrivateFieldSet(this, _indexesSequence, _classPrivateFieldGet(this, _indexMapper).getIndexesSequence());
275
311
  }
276
312
  }
277
313
  export default AxisSyncer;