handsontable 0.0.0-next-eaf150e-20240823 → 0.0.0-next-0306a1a-20240826

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 (104) hide show
  1. package/3rdparty/walkontable/src/calculator/constants.js +26 -0
  2. package/3rdparty/walkontable/src/calculator/constants.mjs +23 -0
  3. package/3rdparty/walkontable/src/calculator/index.js +17 -18
  4. package/3rdparty/walkontable/src/calculator/index.mjs +6 -11
  5. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.js → renderAllColumns.js} +9 -32
  6. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.mjs → renderAllColumns.mjs} +8 -31
  7. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js} +9 -32
  8. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.mjs → renderAllRows.mjs} +8 -31
  9. package/3rdparty/walkontable/src/calculator/viewportColumns.js +145 -51
  10. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +145 -51
  11. package/3rdparty/walkontable/src/calculator/viewportRows.js +141 -59
  12. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +141 -59
  13. package/3rdparty/walkontable/src/index.js +0 -2
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/table.js +11 -5
  16. package/3rdparty/walkontable/src/table.mjs +11 -5
  17. package/3rdparty/walkontable/src/utils/column.js +1 -2
  18. package/3rdparty/walkontable/src/utils/column.mjs +1 -2
  19. package/3rdparty/walkontable/src/utils/columnStretching.js +19 -10
  20. package/3rdparty/walkontable/src/utils/columnStretching.mjs +19 -10
  21. package/3rdparty/walkontable/src/viewport.js +46 -35
  22. package/3rdparty/walkontable/src/viewport.mjs +47 -36
  23. package/CHANGELOG.md +0 -27
  24. package/base.js +2 -2
  25. package/base.mjs +2 -2
  26. package/core.d.ts +2 -1
  27. package/core.js +1 -1
  28. package/core.mjs +2 -2
  29. package/dataMap/metaManager/metaSchema.js +6 -5
  30. package/dataMap/metaManager/metaSchema.mjs +6 -5
  31. package/dist/handsontable.css +20 -32
  32. package/dist/handsontable.full.css +20 -32
  33. package/dist/handsontable.full.js +2091 -2741
  34. package/dist/handsontable.full.min.css +5 -5
  35. package/dist/handsontable.full.min.js +148 -148
  36. package/dist/handsontable.js +2092 -2742
  37. package/dist/handsontable.min.css +4 -4
  38. package/dist/handsontable.min.js +32 -32
  39. package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
  40. package/helpers/a11y.js +0 -2
  41. package/helpers/a11y.mjs +0 -1
  42. package/helpers/mixed.js +2 -2
  43. package/helpers/mixed.mjs +2 -2
  44. package/package.json +1 -1
  45. package/pluginHooks.d.ts +1 -1
  46. package/pluginHooks.js +1 -1
  47. package/pluginHooks.mjs +1 -1
  48. package/plugins/autoColumnSize/autoColumnSize.js +1 -1
  49. package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
  50. package/plugins/autoRowSize/autoRowSize.js +2 -1
  51. package/plugins/autoRowSize/autoRowSize.mjs +2 -1
  52. package/plugins/columnSorting/columnSorting.js +1 -10
  53. package/plugins/columnSorting/columnSorting.mjs +1 -10
  54. package/plugins/contextMenu/menu/menuItemRenderer.js +4 -3
  55. package/plugins/contextMenu/menu/menuItemRenderer.mjs +6 -5
  56. package/plugins/contextMenu/menu/positioner.js +12 -4
  57. package/plugins/contextMenu/menu/positioner.mjs +12 -4
  58. package/plugins/contextMenu/menu/utils.js +0 -11
  59. package/plugins/contextMenu/menu/utils.mjs +0 -10
  60. package/plugins/contextMenu/predefinedItems/alignment.js +49 -67
  61. package/plugins/contextMenu/predefinedItems/alignment.mjs +50 -68
  62. package/plugins/contextMenu/predefinedItems/readOnly.js +0 -11
  63. package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -11
  64. package/plugins/contextMenu/utils.js +0 -26
  65. package/plugins/contextMenu/utils.mjs +0 -24
  66. package/plugins/copyPaste/copyPaste.js +14 -14
  67. package/plugins/copyPaste/copyPaste.mjs +14 -14
  68. package/plugins/dropdownMenu/dropdownMenu.js +4 -10
  69. package/plugins/dropdownMenu/dropdownMenu.mjs +4 -10
  70. package/plugins/filters/component/condition.js +1 -6
  71. package/plugins/filters/component/condition.mjs +1 -6
  72. package/plugins/filters/component/value.js +1 -6
  73. package/plugins/filters/component/value.mjs +1 -6
  74. package/plugins/filters/conditionCollection.d.ts +3 -4
  75. package/plugins/filters/conditionCollection.js +0 -26
  76. package/plugins/filters/conditionCollection.mjs +0 -26
  77. package/plugins/filters/filters.js +1 -2
  78. package/plugins/filters/filters.mjs +1 -2
  79. package/plugins/filters/ui/multipleSelect.js +9 -7
  80. package/plugins/filters/ui/multipleSelect.mjs +9 -7
  81. package/plugins/manualRowResize/manualRowResize.js +1 -1
  82. package/plugins/manualRowResize/manualRowResize.mjs +2 -2
  83. package/plugins/mergeCells/cellsCollection.js +9 -11
  84. package/plugins/mergeCells/cellsCollection.mjs +10 -12
  85. package/plugins/undoRedo/undoRedo.js +5 -9
  86. package/plugins/undoRedo/undoRedo.mjs +5 -9
  87. package/shortcuts/utils.js +1 -3
  88. package/shortcuts/utils.mjs +1 -3
  89. package/utils/ghostTable.js +9 -11
  90. package/utils/ghostTable.mjs +10 -12
  91. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +0 -126
  92. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +0 -122
  93. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +0 -119
  94. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +0 -115
  95. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +0 -125
  96. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +0 -121
  97. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +0 -118
  98. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +0 -114
  99. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -37
  100. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -33
  101. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -37
  102. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -33
  103. package/3rdparty/walkontable/src/calculator/viewportBase.js +0 -92
  104. package/3rdparty/walkontable/src/calculator/viewportBase.mjs +0 -88
@@ -41,13 +41,6 @@ class ConditionCollection {
41
41
  * @type {LinkedPhysicalIndexToValueMap}
42
42
  */
43
43
  _defineProperty(this, "filteringStates", new IndexToValueMap());
44
- /**
45
- * Stores the previous state of the condition stack before the latest filter operation.
46
- * This is used in the `beforeFilter` plugin to allow performing the undo operation.
47
- *
48
- * @type {null|Array}
49
- */
50
- _defineProperty(this, "previousConditionStack", null);
51
44
  this.hot = hot;
52
45
  this.isMapRegistrable = isMapRegistrable;
53
46
  if (this.isMapRegistrable === true) {
@@ -116,13 +109,6 @@ class ConditionCollection {
116
109
  const localeForColumn = this.hot.getCellMeta(0, column).locale;
117
110
  const args = arrayMap(conditionDefinition.args, v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
118
111
  const name = conditionDefinition.name || conditionDefinition.command.key;
119
-
120
- // If there's no previous condition stack defined (which means the condition stack was not cleared after the
121
- // previous filter operation or that there was no filter operation performed yet), store the current conditions as
122
- // the previous condition stack.
123
- if (this.previousConditionStack === null) {
124
- this.setPreviousConditionStack(this.exportAllConditions());
125
- }
126
112
  this.runLocalHooks('beforeAdd', column);
127
113
  const columnType = this.getOperation(column);
128
114
  if (columnType) {
@@ -251,8 +237,6 @@ class ConditionCollection {
251
237
  * @fires ConditionCollection#afterRemove
252
238
  */
253
239
  removeConditions(column) {
254
- // Store the current conditions as the previous condition stack before it's cleared.
255
- this.setPreviousConditionStack(this.exportAllConditions());
256
240
  this.runLocalHooks('beforeRemove', column);
257
241
  this.filteringStates.clearValue(column);
258
242
  this.runLocalHooks('afterRemove', column);
@@ -286,16 +270,6 @@ class ConditionCollection {
286
270
  return conditions.length > 0;
287
271
  }
288
272
 
289
- /**
290
- * Updates the `previousConditionStack` property with the provided stack.
291
- * It is used to store the current conditions before they are modified, allowing for undo operations.
292
- *
293
- * @param {Array|null} previousConditionStack The stack of previous conditions.
294
- */
295
- setPreviousConditionStack(previousConditionStack) {
296
- this.previousConditionStack = previousConditionStack;
297
- }
298
-
299
273
  /**
300
274
  * Destroy object.
301
275
  */
@@ -483,7 +483,7 @@ class Filters extends _base.BasePlugin {
483
483
  const needToFilter = !this.conditionCollection.isEmpty();
484
484
  let visibleVisualRows = [];
485
485
  const conditions = this.conditionCollection.exportAllConditions();
486
- const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);
486
+ const allowFiltering = this.hot.runHooks('beforeFilter', conditions);
487
487
  if (allowFiltering !== false) {
488
488
  if (needToFilter) {
489
489
  const trimmedRows = [];
@@ -508,7 +508,6 @@ class Filters extends _base.BasePlugin {
508
508
  }
509
509
  }
510
510
  this.hot.runHooks('afterFilter', conditions);
511
- this.conditionCollection.setPreviousConditionStack(null);
512
511
  this.hot.view.adjustElementsSize();
513
512
  this.hot.render();
514
513
  if (this.hot.selection.isSelected()) {
@@ -477,7 +477,7 @@ export class Filters extends BasePlugin {
477
477
  const needToFilter = !this.conditionCollection.isEmpty();
478
478
  let visibleVisualRows = [];
479
479
  const conditions = this.conditionCollection.exportAllConditions();
480
- const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);
480
+ const allowFiltering = this.hot.runHooks('beforeFilter', conditions);
481
481
  if (allowFiltering !== false) {
482
482
  if (needToFilter) {
483
483
  const trimmedRows = [];
@@ -502,7 +502,6 @@ export class Filters extends BasePlugin {
502
502
  }
503
503
  }
504
504
  this.hot.runHooks('afterFilter', conditions);
505
- this.conditionCollection.setPreviousConditionStack(null);
506
505
  this.hot.view.adjustElementsSize();
507
506
  this.hot.render();
508
507
  if (this.hot.selection.isSelected()) {
@@ -128,9 +128,10 @@ class MultipleSelectUI extends _base.BaseUI {
128
128
  * @param {Array} items Array of objects with `checked` and `label` property.
129
129
  */
130
130
  setItems(items) {
131
- var _classPrivateFieldGet2;
132
131
  _classPrivateFieldSet(_items, this, items);
133
- (_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
132
+ if (_classPrivateFieldGet(_itemsBox, this)) {
133
+ _classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
134
+ }
134
135
  }
135
136
 
136
137
  /**
@@ -222,13 +223,13 @@ class MultipleSelectUI extends _base.BaseUI {
222
223
  this._element.appendChild(selectionControl.element);
223
224
  this._element.appendChild(itemsBoxWrapper);
224
225
  const hotInitializer = wrapper => {
225
- var _classPrivateFieldGet3;
226
226
  if (!this._element) {
227
227
  return;
228
228
  }
229
- (_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
229
+ if (_classPrivateFieldGet(_itemsBox, this)) {
230
+ _classPrivateFieldGet(_itemsBox, this).destroy();
231
+ }
230
232
  (0, _element.addClass)(wrapper, 'htUIMultipleSelectHot');
231
-
232
233
  // Constructs and initializes a new Handsontable instance
233
234
  _classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
234
235
  data: _classPrivateFieldGet(_items, this),
@@ -322,8 +323,9 @@ class MultipleSelectUI extends _base.BaseUI {
322
323
  * Destroy instance.
323
324
  */
324
325
  destroy() {
325
- var _classPrivateFieldGet4;
326
- (_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
326
+ if (_classPrivateFieldGet(_itemsBox, this)) {
327
+ _classPrivateFieldGet(_itemsBox, this).destroy();
328
+ }
327
329
  _classPrivateFieldGet(_searchInput, this).destroy();
328
330
  _classPrivateFieldGet(_clearAllUI, this).destroy();
329
331
  _classPrivateFieldGet(_selectAllUI, this).destroy();
@@ -123,9 +123,10 @@ export class MultipleSelectUI extends BaseUI {
123
123
  * @param {Array} items Array of objects with `checked` and `label` property.
124
124
  */
125
125
  setItems(items) {
126
- var _classPrivateFieldGet2;
127
126
  _classPrivateFieldSet(_items, this, items);
128
- (_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
127
+ if (_classPrivateFieldGet(_itemsBox, this)) {
128
+ _classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
129
+ }
129
130
  }
130
131
 
131
132
  /**
@@ -217,13 +218,13 @@ export class MultipleSelectUI extends BaseUI {
217
218
  this._element.appendChild(selectionControl.element);
218
219
  this._element.appendChild(itemsBoxWrapper);
219
220
  const hotInitializer = wrapper => {
220
- var _classPrivateFieldGet3;
221
221
  if (!this._element) {
222
222
  return;
223
223
  }
224
- (_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
224
+ if (_classPrivateFieldGet(_itemsBox, this)) {
225
+ _classPrivateFieldGet(_itemsBox, this).destroy();
226
+ }
225
227
  addClass(wrapper, 'htUIMultipleSelectHot');
226
-
227
228
  // Constructs and initializes a new Handsontable instance
228
229
  _classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
229
230
  data: _classPrivateFieldGet(_items, this),
@@ -317,8 +318,9 @@ export class MultipleSelectUI extends BaseUI {
317
318
  * Destroy instance.
318
319
  */
319
320
  destroy() {
320
- var _classPrivateFieldGet4;
321
- (_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
321
+ if (_classPrivateFieldGet(_itemsBox, this)) {
322
+ _classPrivateFieldGet(_itemsBox, this).destroy();
323
+ }
322
324
  _classPrivateFieldGet(_searchInput, this).destroy();
323
325
  _classPrivateFieldGet(_clearAllUI, this).destroy();
324
326
  _classPrivateFieldGet(_selectAllUI, this).destroy();
@@ -227,7 +227,7 @@ class ManualRowResize extends _base.BasePlugin {
227
227
  */
228
228
  setManualSize(row, height) {
229
229
  const physicalRow = this.hot.toPhysicalRow(row);
230
- const newHeight = Math.max(height, _src.DEFAULT_ROW_HEIGHT);
230
+ const newHeight = Math.max(height, _src.ViewportRowsCalculator.DEFAULT_HEIGHT);
231
231
  _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
232
232
  return newHeight;
233
233
  }
@@ -11,7 +11,7 @@ import { addClass, closest, hasClass, removeClass, outerWidth, isDetached } from
11
11
  import { arrayEach } from "../../helpers/array.mjs";
12
12
  import { rangeEach } from "../../helpers/number.mjs";
13
13
  import { PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
14
- import { DEFAULT_ROW_HEIGHT } from "../../3rdparty/walkontable/src/index.mjs"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
14
+ import { ViewportRowsCalculator } from "../../3rdparty/walkontable/src/index.mjs"; // Developer note! Whenever you make a change in this file, make an analogous change in manualColumnResize.js
15
15
  export const PLUGIN_KEY = 'manualRowResize';
16
16
  export const PLUGIN_PRIORITY = 30;
17
17
  const PERSISTENT_STATE_KEY = 'manualRowHeights';
@@ -222,7 +222,7 @@ export class ManualRowResize extends BasePlugin {
222
222
  */
223
223
  setManualSize(row, height) {
224
224
  const physicalRow = this.hot.toPhysicalRow(row);
225
- const newHeight = Math.max(height, DEFAULT_ROW_HEIGHT);
225
+ const newHeight = Math.max(height, ViewportRowsCalculator.DEFAULT_HEIGHT);
226
226
  _classPrivateFieldGet(_rowHeightsMap, this).setValueAtIndex(physicalRow, newHeight);
227
227
  return newHeight;
228
228
  }
@@ -424,20 +424,18 @@ class MergedCellsCollection {
424
424
  break;
425
425
  default:
426
426
  }
427
- const removedMergedCells = [];
428
- this.mergedCells.forEach(currentMerge => {
427
+ (0, _array.arrayEach)(this.mergedCells, currentMerge => {
428
+ _assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
429
429
  currentMerge.shift(shiftVector, index);
430
- if (currentMerge.removed) {
431
- removedMergedCells.push(currentMerge);
432
- }
433
- });
434
- removedMergedCells.forEach(removedMerge => {
435
- this.mergedCells.splice(this.mergedCells.indexOf(removedMerge), 1);
436
- });
437
- this.mergedCellsMatrix.clear();
438
- this.mergedCells.forEach(currentMerge => {
439
430
  _assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, currentMerge);
440
431
  });
432
+ (0, _number.rangeEachReverse)(this.mergedCells.length - 1, 0, i => {
433
+ const currentMerge = this.mergedCells[i];
434
+ if (currentMerge && currentMerge.removed) {
435
+ this.mergedCells.splice(this.mergedCells.indexOf(currentMerge), 1);
436
+ _assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
437
+ }
438
+ });
441
439
  }
442
440
 
443
441
  /**
@@ -15,7 +15,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
15
15
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
16
16
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
17
17
  import MergedCellCoords from "./cellCoords.mjs";
18
- import { rangeEach } from "../../helpers/number.mjs";
18
+ import { rangeEach, rangeEachReverse } from "../../helpers/number.mjs";
19
19
  import { warn } from "../../helpers/console.mjs";
20
20
  import { arrayEach } from "../../helpers/array.mjs";
21
21
  import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
@@ -420,20 +420,18 @@ class MergedCellsCollection {
420
420
  break;
421
421
  default:
422
422
  }
423
- const removedMergedCells = [];
424
- this.mergedCells.forEach(currentMerge => {
423
+ arrayEach(this.mergedCells, currentMerge => {
424
+ _assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
425
425
  currentMerge.shift(shiftVector, index);
426
- if (currentMerge.removed) {
427
- removedMergedCells.push(currentMerge);
428
- }
429
- });
430
- removedMergedCells.forEach(removedMerge => {
431
- this.mergedCells.splice(this.mergedCells.indexOf(removedMerge), 1);
432
- });
433
- this.mergedCellsMatrix.clear();
434
- this.mergedCells.forEach(currentMerge => {
435
426
  _assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, currentMerge);
436
427
  });
428
+ rangeEachReverse(this.mergedCells.length - 1, 0, i => {
429
+ const currentMerge = this.mergedCells[i];
430
+ if (currentMerge && currentMerge.removed) {
431
+ this.mergedCells.splice(this.mergedCells.indexOf(currentMerge), 1);
432
+ _assertClassBrand(_MergedCellsCollection_brand, this, _removeMergedCellFromMatrix).call(this, currentMerge);
433
+ }
434
+ });
437
435
  }
438
436
 
439
437
  /**
@@ -124,8 +124,8 @@ function UndoRedo(instance) {
124
124
  instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
125
125
  plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));
126
126
  });
127
- instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
128
- plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));
127
+ instance.addHook('beforeFilter', conditionsStack => {
128
+ plugin.done(() => new UndoRedo.FiltersAction(conditionsStack));
129
129
  });
130
130
  instance.addHook('beforeRowMove', (rows, finalIndex) => {
131
131
  if (rows === false) {
@@ -645,11 +645,9 @@ UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback
645
645
  * Filters action.
646
646
  *
647
647
  * @private
648
- * @param {Array} conditionsStack An array of the filter conditions.
649
- * @param {Array} previousConditionsStack An array of the previous filter conditions.
648
+ * @param {Array} conditionsStack An array of the filter condition.
650
649
  */
651
- UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
652
- this.previousConditionsStack = previousConditionsStack;
650
+ UndoRedo.FiltersAction = function (conditionsStack) {
653
651
  this.conditionsStack = conditionsStack;
654
652
  this.actionType = 'filter';
655
653
  };
@@ -657,9 +655,7 @@ UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
657
655
  UndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {
658
656
  const filters = instance.getPlugin('filters');
659
657
  instance.addHookOnce('afterViewRender', undoneCallback);
660
- if (this.previousConditionsStack) {
661
- filters.conditionCollection.importAllConditions(this.previousConditionsStack);
662
- }
658
+ filters.conditionCollection.importAllConditions(this.conditionsStack.slice(0, this.conditionsStack.length - 1));
663
659
  filters.filter();
664
660
  };
665
661
  UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
@@ -120,8 +120,8 @@ function UndoRedo(instance) {
120
120
  instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
121
121
  plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));
122
122
  });
123
- instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
124
- plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));
123
+ instance.addHook('beforeFilter', conditionsStack => {
124
+ plugin.done(() => new UndoRedo.FiltersAction(conditionsStack));
125
125
  });
126
126
  instance.addHook('beforeRowMove', (rows, finalIndex) => {
127
127
  if (rows === false) {
@@ -641,11 +641,9 @@ UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback
641
641
  * Filters action.
642
642
  *
643
643
  * @private
644
- * @param {Array} conditionsStack An array of the filter conditions.
645
- * @param {Array} previousConditionsStack An array of the previous filter conditions.
644
+ * @param {Array} conditionsStack An array of the filter condition.
646
645
  */
647
- UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
648
- this.previousConditionsStack = previousConditionsStack;
646
+ UndoRedo.FiltersAction = function (conditionsStack) {
649
647
  this.conditionsStack = conditionsStack;
650
648
  this.actionType = 'filter';
651
649
  };
@@ -653,9 +651,7 @@ inherit(UndoRedo.FiltersAction, UndoRedo.Action);
653
651
  UndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {
654
652
  const filters = instance.getPlugin('filters');
655
653
  instance.addHookOnce('afterViewRender', undoneCallback);
656
- if (this.previousConditionsStack) {
657
- filters.conditionCollection.importAllConditions(this.previousConditionsStack);
658
- }
654
+ filters.conditionCollection.importAllConditions(this.conditionsStack.slice(0, this.conditionsStack.length - 1));
659
655
  filters.filter();
660
656
  };
661
657
  UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
@@ -36,9 +36,7 @@ const getKeysList = normalizedKeys => {
36
36
  return normalizedKeys.split('+');
37
37
  };
38
38
  exports.getKeysList = getKeysList;
39
- const specialCharactersSet = new Map([[96, 'numpad0'], [97, 'numpad1'], [98, 'numpad2'], [99, 'numpad3'], [100, 'numpad4'], [101, 'numpad5'], [102, 'numpad6'], [103, 'numpad7'], [104, 'numpad8'], [105, 'numpad9'], [106, 'multiply'], [107, 'add'], [108, 'decimal'],
40
- // firefox
41
- [109, 'subtract'], [110, 'decimal'], [111, 'divide'], [112, 'f1'], [113, 'f2'], [114, 'f3'], [115, 'f4'], [116, 'f5'], [117, 'f6'], [118, 'f7'], [119, 'f8'], [120, 'f9'], [121, 'f10'], [122, 'f11'], [123, 'f12'], [186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
39
+ const specialCharactersSet = new Map([[186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
42
40
 
43
41
  /**
44
42
  * Normalizes a keyboard event key value to a key before its modification.
@@ -31,9 +31,7 @@ export const normalizeKeys = keys => {
31
31
  export const getKeysList = normalizedKeys => {
32
32
  return normalizedKeys.split('+');
33
33
  };
34
- const specialCharactersSet = new Map([[96, 'numpad0'], [97, 'numpad1'], [98, 'numpad2'], [99, 'numpad3'], [100, 'numpad4'], [101, 'numpad5'], [102, 'numpad6'], [103, 'numpad7'], [104, 'numpad8'], [105, 'numpad9'], [106, 'multiply'], [107, 'add'], [108, 'decimal'],
35
- // firefox
36
- [109, 'subtract'], [110, 'decimal'], [111, 'divide'], [112, 'f1'], [113, 'f2'], [114, 'f3'], [115, 'f4'], [116, 'f5'], [117, 'f6'], [118, 'f7'], [119, 'f8'], [120, 'f9'], [121, 'f10'], [122, 'f11'], [123, 'f12'], [186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
34
+ const specialCharactersSet = new Map([[186, 'semicolon'], [187, 'equal'], [188, 'comma'], [189, 'minus'], [190, 'period'], [191, 'slash'], [192, 'backquote'], [219, 'bracketleft'], [220, 'backslash'], [221, 'bracketright'], [222, 'quote']]);
37
35
 
38
36
  /**
39
37
  * Normalizes a keyboard event key value to a key before its modification.
@@ -148,15 +148,8 @@ class GhostTable {
148
148
  this.injectTable();
149
149
  }
150
150
  (0, _array.arrayEach)(this.rows, row => {
151
- // In cases when the cell's content produces the height with a decimal point, the height
152
- // needs to be rounded up to make sure that there will be a space for the cell's content.
153
- // The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
154
- const {
155
- height
156
- } = row.table.getBoundingClientRect();
157
-
158
151
  // -1 <- reduce border-top from table
159
- callback(row.row, Math.ceil(height) - 1);
152
+ callback(row.row, (0, _element.outerHeight)(row.table) - 1);
160
153
  });
161
154
  }
162
155
 
@@ -170,9 +163,14 @@ class GhostTable {
170
163
  this.injectTable();
171
164
  }
172
165
  (0, _array.arrayEach)(this.columns, column => {
173
- // In cases when the cell's content produces the width with a decimal point, the width
174
- // needs to be rounded up to make sure that there will be a space for the cell's content.
175
- // The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
166
+ // The GhostTable class is responsible for calculating the columns' width based on the
167
+ // contents rendered in the cells. In some cases, when the column's width calculated by
168
+ // the browser is a decimal point with a fractional component. For example, 35.32px.
169
+ // The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
170
+ // The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
171
+ // would cause the text to not fit in the cell, thus increasing the row height.
172
+ // That's why the `getBoundingClientRect` method is used. The method returns the number
173
+ // that is rounded up to make sure that there will be a space for the cell's content.
176
174
  const {
177
175
  width
178
176
  } = column.table.getBoundingClientRect();
@@ -3,7 +3,7 @@ import "core-js/modules/es.array.push.js";
3
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import { addClass } from "./../helpers/dom/element.mjs";
6
+ import { addClass, outerHeight } from "./../helpers/dom/element.mjs";
7
7
  import { arrayEach } from "./../helpers/array.mjs";
8
8
  /**
9
9
  * @class GhostTable
@@ -145,15 +145,8 @@ class GhostTable {
145
145
  this.injectTable();
146
146
  }
147
147
  arrayEach(this.rows, row => {
148
- // In cases when the cell's content produces the height with a decimal point, the height
149
- // needs to be rounded up to make sure that there will be a space for the cell's content.
150
- // The `.offsetHeight` always returns the rounded number (floored), so it's not suitable for this case.
151
- const {
152
- height
153
- } = row.table.getBoundingClientRect();
154
-
155
148
  // -1 <- reduce border-top from table
156
- callback(row.row, Math.ceil(height) - 1);
149
+ callback(row.row, outerHeight(row.table) - 1);
157
150
  });
158
151
  }
159
152
 
@@ -167,9 +160,14 @@ class GhostTable {
167
160
  this.injectTable();
168
161
  }
169
162
  arrayEach(this.columns, column => {
170
- // In cases when the cell's content produces the width with a decimal point, the width
171
- // needs to be rounded up to make sure that there will be a space for the cell's content.
172
- // The `.offsetWidth` always returns the rounded number (floored), so it's not suitable for this case.
163
+ // The GhostTable class is responsible for calculating the columns' width based on the
164
+ // contents rendered in the cells. In some cases, when the column's width calculated by
165
+ // the browser is a decimal point with a fractional component. For example, 35.32px.
166
+ // The usage of the `.offsetWidth` (or our helper `outerWidth`) is incorrect.
167
+ // The `outerWidth` in the mentioned example (35.32px) would return 35 pixels that
168
+ // would cause the text to not fit in the cell, thus increasing the row height.
169
+ // That's why the `getBoundingClientRect` method is used. The method returns the number
170
+ // that is rounded up to make sure that there will be a space for the cell's content.
173
171
  const {
174
172
  width
175
173
  } = column.table.getBoundingClientRect();
@@ -1,126 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- require("core-js/modules/es.error.cause.js");
5
- require("core-js/modules/es.array.at.js");
6
- require("core-js/modules/es.string.at-alternative.js");
7
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
9
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
- /**
11
- * @class FullyVisibleColumnsCalculationType
12
- */
13
- class FullyVisibleColumnsCalculationType {
14
- constructor() {
15
- /**
16
- * Total number of fully visible columns in the viewport.
17
- *
18
- * @type {number}
19
- */
20
- _defineProperty(this, "count", 0);
21
- /**
22
- * The column index of the first fully visible column in the viewport.
23
- *
24
- * @type {number|null}
25
- */
26
- _defineProperty(this, "startColumn", null);
27
- /**
28
- * The column index of the last fully visible column in the viewport.
29
- *
30
- * @type {number|null}
31
- */
32
- _defineProperty(this, "endColumn", null);
33
- /**
34
- * Position of the first fully visible column (in px).
35
- *
36
- * @type {number|null}
37
- */
38
- _defineProperty(this, "startPosition", null);
39
- /**
40
- * Determines if the viewport is visible in the trimming container.
41
- *
42
- * @type {boolean}
43
- */
44
- _defineProperty(this, "isVisibleInTrimmingContainer", false);
45
- }
46
- /**
47
- * Initializes the calculation.
48
- */
49
- initialize() {}
50
-
51
- /**
52
- * Processes the column.
53
- *
54
- * @param {number} column The column index.
55
- * @param {ViewportColumnsCalculator} viewportCalculator The viewport calculator object.
56
- */
57
- process(column, viewportCalculator) {
58
- const {
59
- totalCalculatedWidth,
60
- zeroBasedScrollOffset,
61
- viewportWidth,
62
- columnWidth
63
- } = viewportCalculator;
64
- const compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
65
- if (totalCalculatedWidth >= zeroBasedScrollOffset && totalCalculatedWidth + columnWidth <= zeroBasedScrollOffset + compensatedViewportWidth) {
66
- if (this.startColumn === null || this.startColumn === undefined) {
67
- this.startColumn = column;
68
- }
69
- this.endColumn = column;
70
- }
71
- }
72
-
73
- /**
74
- * Finalizes the calculation.
75
- *
76
- * @param {ViewportColumnsCalculator} viewportCalculator The viewport calculator object.
77
- */
78
- finalize(viewportCalculator) {
79
- var _startPositions$this$;
80
- const {
81
- scrollOffset,
82
- viewportWidth,
83
- inlineStartOffset,
84
- zeroBasedScrollOffset,
85
- totalColumns,
86
- needReverse,
87
- startPositions,
88
- columnWidth
89
- } = viewportCalculator;
90
-
91
- // If the estimation has reached the last column and there is still some space available in the viewport,
92
- // we need to render in reverse in order to fill the whole viewport with columns
93
- if (this.endColumn === totalColumns - 1 && needReverse) {
94
- this.startColumn = this.endColumn;
95
- while (this.startColumn > 0) {
96
- const calculatedViewportHeight = startPositions[this.endColumn] + columnWidth - startPositions[this.startColumn - 1];
97
- if (calculatedViewportHeight <= viewportWidth) {
98
- this.startColumn -= 1;
99
- }
100
- if (calculatedViewportHeight >= viewportWidth) {
101
- break;
102
- }
103
- }
104
- }
105
- this.startPosition = (_startPositions$this$ = startPositions[this.startColumn]) !== null && _startPositions$this$ !== void 0 ? _startPositions$this$ : null;
106
- const compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
107
- const mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
108
- const inlineStartColumnOffset = this.startColumn === null ? 0 : viewportCalculator.getColumnWidth(this.startColumn);
109
- if (
110
- // the table is to the left of the viewport
111
- mostRightScrollOffset < -1 * inlineStartOffset || scrollOffset > startPositions.at(-1) ||
112
- // the table is to the right of the viewport
113
- -1 * scrollOffset - viewportWidth > -1 * inlineStartColumnOffset) {
114
- this.isVisibleInTrimmingContainer = false;
115
- } else {
116
- this.isVisibleInTrimmingContainer = true;
117
- }
118
- if (totalColumns < this.endColumn) {
119
- this.endColumn = totalColumns - 1;
120
- }
121
- if (this.startColumn !== null) {
122
- this.count = this.endColumn - this.startColumn + 1;
123
- }
124
- }
125
- }
126
- exports.FullyVisibleColumnsCalculationType = FullyVisibleColumnsCalculationType;