handsontable 15.1.0 → 15.2.0-next-8670a33-20250312

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/3rdparty/walkontable/src/selection/border/border.js +16 -3
  2. package/3rdparty/walkontable/src/selection/border/border.mjs +17 -4
  3. package/3rdparty/walkontable/src/selection/scanner.js +1 -1
  4. package/3rdparty/walkontable/src/selection/scanner.mjs +2 -2
  5. package/3rdparty/walkontable/src/table.js +3 -2
  6. package/3rdparty/walkontable/src/table.mjs +4 -3
  7. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +1 -0
  8. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +1 -0
  9. package/3rdparty/walkontable/src/viewport.js +30 -3
  10. package/3rdparty/walkontable/src/viewport.mjs +30 -3
  11. package/CHANGELOG.md +40 -0
  12. package/base.js +2 -2
  13. package/base.mjs +2 -2
  14. package/core.js +2 -37
  15. package/core.mjs +2 -37
  16. package/dataMap/dataMap.js +4 -12
  17. package/dataMap/dataMap.mjs +4 -12
  18. package/dataMap/dataSource.js +2 -2
  19. package/dataMap/dataSource.mjs +2 -2
  20. package/dataMap/metaManager/metaSchema.js +2 -2
  21. package/dataMap/metaManager/metaSchema.mjs +2 -2
  22. package/dist/handsontable.css +2 -2
  23. package/dist/handsontable.full.css +2 -2
  24. package/dist/handsontable.full.js +494 -400
  25. package/dist/handsontable.full.min.css +2 -2
  26. package/dist/handsontable.full.min.js +73 -73
  27. package/dist/handsontable.js +494 -400
  28. package/dist/handsontable.min.css +2 -2
  29. package/dist/handsontable.min.js +43 -43
  30. package/dist/languages/all.js +139 -28
  31. package/dist/languages/all.min.js +1 -1
  32. package/dist/languages/fa-IR.js +167 -0
  33. package/dist/languages/fa-IR.min.js +1 -0
  34. package/dist/languages/it-IT.js +3 -0
  35. package/dist/languages/it-IT.min.js +1 -1
  36. package/dist/languages/sr-SP.js +3 -0
  37. package/dist/languages/sr-SP.min.js +1 -1
  38. package/editors/autocompleteEditor/autocompleteEditor.js +25 -20
  39. package/editors/autocompleteEditor/autocompleteEditor.mjs +25 -20
  40. package/editors/dateEditor/dateEditor.d.ts +0 -2
  41. package/editors/dateEditor/dateEditor.js +18 -7
  42. package/editors/dateEditor/dateEditor.mjs +17 -6
  43. package/focusManager.js +5 -3
  44. package/focusManager.mjs +6 -4
  45. package/helpers/dom/element.d.ts +1 -0
  46. package/helpers/dom/element.js +21 -2
  47. package/helpers/dom/element.mjs +20 -2
  48. package/helpers/dom/event.js +2 -1
  49. package/helpers/dom/event.mjs +2 -1
  50. package/helpers/mixed.js +2 -2
  51. package/helpers/mixed.mjs +2 -2
  52. package/helpers/number.js +1 -0
  53. package/helpers/number.mjs +1 -0
  54. package/i18n/languages/fa-IR.d.ts +5 -0
  55. package/i18n/languages/fa-IR.js +96 -0
  56. package/i18n/languages/fa-IR.mjs +90 -0
  57. package/i18n/languages/index.d.ts +2 -0
  58. package/i18n/languages/index.js +2 -0
  59. package/i18n/languages/index.mjs +2 -1
  60. package/i18n/languages/it-IT.js +3 -0
  61. package/i18n/languages/it-IT.mjs +3 -0
  62. package/i18n/languages/sr-SP.js +3 -0
  63. package/i18n/languages/sr-SP.mjs +3 -0
  64. package/i18n/phraseFormatters/substituteVariables.js +1 -0
  65. package/i18n/phraseFormatters/substituteVariables.mjs +1 -0
  66. package/languages/all.js +139 -28
  67. package/languages/fa-IR.js +167 -0
  68. package/languages/fa-IR.mjs +92 -0
  69. package/languages/index.js +139 -28
  70. package/languages/index.mjs +2 -1
  71. package/languages/it-IT.js +3 -0
  72. package/languages/it-IT.mjs +3 -0
  73. package/languages/sr-SP.js +3 -0
  74. package/languages/sr-SP.mjs +3 -0
  75. package/package.json +13 -2
  76. package/plugins/columnSorting/columnSorting.js +17 -1
  77. package/plugins/columnSorting/columnSorting.mjs +18 -2
  78. package/plugins/columnSorting/columnStatesManager.js +1 -0
  79. package/plugins/columnSorting/columnStatesManager.mjs +1 -0
  80. package/plugins/columnSorting/utils.js +14 -0
  81. package/plugins/columnSorting/utils.mjs +13 -0
  82. package/plugins/comments/comments.js +5 -2
  83. package/plugins/comments/comments.mjs +6 -3
  84. package/plugins/contextMenu/menu/menu.js +9 -3
  85. package/plugins/contextMenu/menu/menu.mjs +9 -3
  86. package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -8
  87. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -8
  88. package/plugins/contextMenu/predefinedItems/columnRight.js +2 -9
  89. package/plugins/contextMenu/predefinedItems/columnRight.mjs +2 -9
  90. package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -8
  91. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -8
  92. package/plugins/contextMenu/predefinedItems/rowBelow.js +2 -9
  93. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +2 -9
  94. package/plugins/copyPaste/copyPaste.js +3 -3
  95. package/plugins/copyPaste/copyPaste.mjs +4 -4
  96. package/plugins/exportFile/types/csv.js +1 -0
  97. package/plugins/exportFile/types/csv.mjs +1 -0
  98. package/plugins/filters/conditionCollection.js +0 -26
  99. package/plugins/filters/conditionCollection.mjs +0 -26
  100. package/plugins/filters/filters.d.ts +2 -0
  101. package/plugins/filters/filters.js +77 -8
  102. package/plugins/filters/filters.mjs +77 -8
  103. package/plugins/mergeCells/mergeCells.js +9 -6
  104. package/plugins/mergeCells/mergeCells.mjs +9 -6
  105. package/plugins/multiColumnSorting/multiColumnSorting.js +1 -21
  106. package/plugins/multiColumnSorting/multiColumnSorting.mjs +1 -21
  107. package/plugins/nestedHeaders/nestedHeaders.js +5 -3
  108. package/plugins/nestedHeaders/nestedHeaders.mjs +5 -3
  109. package/plugins/nestedHeaders/stateManager/index.js +1 -0
  110. package/plugins/nestedHeaders/stateManager/index.mjs +1 -0
  111. package/plugins/undoRedo/actions/_base.js +10 -0
  112. package/plugins/undoRedo/actions/_base.mjs +10 -0
  113. package/plugins/undoRedo/actions/cellAlignment.js +1 -1
  114. package/plugins/undoRedo/actions/cellAlignment.mjs +1 -1
  115. package/plugins/undoRedo/actions/columnMove.js +1 -1
  116. package/plugins/undoRedo/actions/columnMove.mjs +1 -1
  117. package/plugins/undoRedo/actions/columnSort.js +1 -1
  118. package/plugins/undoRedo/actions/columnSort.mjs +1 -1
  119. package/plugins/undoRedo/actions/createColumn.js +1 -1
  120. package/plugins/undoRedo/actions/createColumn.mjs +1 -1
  121. package/plugins/undoRedo/actions/createRow.js +1 -1
  122. package/plugins/undoRedo/actions/createRow.mjs +1 -1
  123. package/plugins/undoRedo/actions/dataChange.js +1 -1
  124. package/plugins/undoRedo/actions/dataChange.mjs +1 -1
  125. package/plugins/undoRedo/actions/filters.js +3 -3
  126. package/plugins/undoRedo/actions/filters.mjs +3 -3
  127. package/plugins/undoRedo/actions/mergeCells.js +4 -1
  128. package/plugins/undoRedo/actions/mergeCells.mjs +4 -1
  129. package/plugins/undoRedo/actions/removeColumn.js +4 -2
  130. package/plugins/undoRedo/actions/removeColumn.mjs +4 -2
  131. package/plugins/undoRedo/actions/removeRow.js +1 -1
  132. package/plugins/undoRedo/actions/removeRow.mjs +1 -1
  133. package/plugins/undoRedo/actions/rowMove.js +1 -1
  134. package/plugins/undoRedo/actions/rowMove.mjs +1 -1
  135. package/plugins/undoRedo/actions/unmergeCells.js +4 -1
  136. package/plugins/undoRedo/actions/unmergeCells.mjs +4 -1
  137. package/plugins/undoRedo/undoRedo.d.ts +48 -17
  138. package/renderers/checkboxRenderer/checkboxRenderer.js +1 -1
  139. package/renderers/checkboxRenderer/checkboxRenderer.mjs +2 -2
  140. package/renderers/numericRenderer/numericRenderer.js +10 -2
  141. package/renderers/numericRenderer/numericRenderer.mjs +10 -2
  142. package/renderers/textRenderer/textRenderer.js +3 -12
  143. package/renderers/textRenderer/textRenderer.mjs +4 -13
  144. package/shortcuts/utils.js +1 -0
  145. package/shortcuts/utils.mjs +1 -0
  146. package/styles/handsontable.css +83 -99
  147. package/styles/handsontable.min.css +3 -3
  148. package/styles/ht-theme-horizon.css +14 -2
  149. package/styles/ht-theme-horizon.min.css +3 -3
  150. package/styles/ht-theme-main.css +14 -2
  151. package/styles/ht-theme-main.min.css +3 -3
  152. package/tableView.js +9 -0
  153. package/tableView.mjs +9 -0
  154. package/translations/maps/linkedPhysicalIndexToValueMap.js +1 -0
  155. package/translations/maps/linkedPhysicalIndexToValueMap.mjs +1 -0
  156. package/translations/maps/utils/physicallyIndexed.js +1 -0
  157. package/translations/maps/utils/physicallyIndexed.mjs +1 -0
  158. package/utils/dataStructures/priorityMap.js +1 -0
  159. package/utils/dataStructures/priorityMap.mjs +1 -0
  160. package/plugins/multiColumnSorting/utils.js +0 -13
  161. package/plugins/multiColumnSorting/utils.mjs +0 -9
@@ -75,6 +75,7 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
75
75
  */
76
76
  var _menuFocusNavigator = /*#__PURE__*/new WeakMap();
77
77
  var _dropdownMenuTraces = /*#__PURE__*/new WeakMap();
78
+ var _previousConditionStack = /*#__PURE__*/new WeakMap();
78
79
  var _Filters_brand = /*#__PURE__*/new WeakSet();
79
80
  export class Filters extends BasePlugin {
80
81
  static get PLUGIN_KEY() {
@@ -146,6 +147,13 @@ export class Filters extends BasePlugin {
146
147
  * @type {WeakSet<Menu>}
147
148
  */
148
149
  _classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());
150
+ /**
151
+ * Stores the previous state of the condition stack before the latest filter operation.
152
+ * This is used in the `beforeFilter` plugin to allow performing the undo operation.
153
+ *
154
+ * @type {Array}
155
+ */
156
+ _classPrivateFieldInitSpec(this, _previousConditionStack, []);
149
157
  this.hot.addHook('afterGetColHeader', function () {
150
158
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
151
159
  args[_key] = arguments[_key];
@@ -488,6 +496,51 @@ export class Filters extends BasePlugin {
488
496
  }
489
497
  }
490
498
 
499
+ /**
500
+ * Imports filter conditions to all columns to the plugin. The method accepts
501
+ * the array of conditions with the same structure as the {@link Filters#exportConditions} method returns.
502
+ * Importing conditions will replace the current conditions. Once replaced, the state of the condition
503
+ * will be reflected in the UI. To apply the changes and filter the table, call
504
+ * the {@link Filters#filter} method eventually.
505
+ *
506
+ * @param {Array} conditions Array of conditions.
507
+ */
508
+ importConditions(conditions) {
509
+ this.conditionCollection.importAllConditions(conditions);
510
+ }
511
+
512
+ /* eslint-disable jsdoc/require-description-complete-sentence */
513
+ /**
514
+ * Exports filter conditions for all columns from the plugin.
515
+ * The array represents the filter state for each column. For example:
516
+ *
517
+ * ```js
518
+ * [
519
+ * {
520
+ * column: 1,
521
+ * operation: 'conjunction',
522
+ * conditions: [
523
+ * { name: 'gt', args: [95] },
524
+ * ]
525
+ * },
526
+ * {
527
+ * column: 7,
528
+ * operation: 'conjunction',
529
+ * conditions: [
530
+ * { name: 'contains', args: ['mike'] },
531
+ * { name: 'begins_with', args: ['m'] },
532
+ * ]
533
+ * },
534
+ * ]
535
+ * ```
536
+ *
537
+ * @returns {Array}
538
+ */
539
+ /* eslint-enable jsdoc/require-description-complete-sentence */
540
+ exportConditions() {
541
+ return this.conditionCollection.exportAllConditions();
542
+ }
543
+
491
544
  /**
492
545
  * Filters data based on added filter conditions.
493
546
  *
@@ -501,8 +554,8 @@ export class Filters extends BasePlugin {
501
554
  const dataFilter = this._createDataFilter();
502
555
  const needToFilter = !this.conditionCollection.isEmpty();
503
556
  let visibleVisualRows = [];
504
- const conditions = this.conditionCollection.exportAllConditions();
505
- const allowFiltering = this.hot.runHooks('beforeFilter', conditions, this.conditionCollection.previousConditionStack);
557
+ const conditions = this.exportConditions();
558
+ const allowFiltering = this.hot.runHooks('beforeFilter', conditions, _classPrivateFieldGet(_previousConditionStack, this));
506
559
  if (allowFiltering !== false) {
507
560
  if (needToFilter) {
508
561
  const trimmedRows = [];
@@ -525,11 +578,13 @@ export class Filters extends BasePlugin {
525
578
  } else {
526
579
  this.filtersRowsMap.clear();
527
580
  }
581
+ _classPrivateFieldSet(_previousConditionStack, this, this.exportConditions());
582
+ this.hot.runHooks('afterFilter', conditions);
583
+ this.hot.view.adjustElementsSize();
584
+ this.hot.render();
585
+ } else {
586
+ this.importConditions(_classPrivateFieldGet(_previousConditionStack, this));
528
587
  }
529
- this.hot.runHooks('afterFilter', conditions);
530
- this.conditionCollection.setPreviousConditionStack(null);
531
- this.hot.view.adjustElementsSize();
532
- this.hot.render();
533
588
  if (this.hot.selection.isSelected()) {
534
589
  this.hot.selectCell(navigableHeaders ? -1 : 0, this.hot.getSelectedRangeLast().highlight.col);
535
590
  }
@@ -891,7 +946,6 @@ function _onActionBarSubmit(submitType) {
891
946
  }
892
947
  this.conditionUpdateObserver.flush();
893
948
  this.components.forEach(component => component.saveState(physicalIndex));
894
- this.filtersRowsMap.clear();
895
949
  this.filter();
896
950
  }
897
951
  (_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 || _this$dropdownMenuPlu3.close();
@@ -933,8 +987,23 @@ function _updateComponents(conditionsState) {
933
987
  editedConditionStack: {
934
988
  conditions,
935
989
  column
936
- }
990
+ },
991
+ conditionArgsChange
937
992
  } = conditionsState;
993
+ if (Array.isArray(conditionArgsChange)) {
994
+ // update the previous condition stack (only for 'by_value' condition) on each dataset
995
+ // change to make the undo/redo work properly
996
+ _classPrivateFieldSet(_previousConditionStack, this, _classPrivateFieldGet(_previousConditionStack, this).map(stack => {
997
+ if (stack.column === column && conditions.length > 0) {
998
+ stack.conditions.forEach(condition => {
999
+ if (condition.name === 'by_value') {
1000
+ condition.args = [[...conditionArgsChange]];
1001
+ }
1002
+ });
1003
+ }
1004
+ return stack;
1005
+ }));
1006
+ }
938
1007
  const conditionsByValue = conditions.filter(condition => condition.name === CONDITION_BY_VALUE);
939
1008
  const conditionsWithoutByValue = conditions.filter(condition => condition.name !== CONDITION_BY_VALUE);
940
1009
  if (conditionsByValue.length >= 2 || conditionsWithoutByValue.length >= 3) {
@@ -1491,14 +1491,17 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
1491
1491
  * @returns {number}
1492
1492
  */
1493
1493
  function _sumCellsHeights(row, rowspan) {
1494
- const stylesHandler = this.hot.view.getStylesHandler();
1495
- const defaultHeight = this.hot.view.getDefaultRowHeight();
1496
- const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
1494
+ const {
1495
+ view,
1496
+ rowIndexMapper
1497
+ } = this.hot;
1498
+ const stylesHandler = view.getStylesHandler();
1499
+ const defaultHeight = view.getDefaultRowHeight();
1497
1500
  let height = 0;
1498
1501
  for (let i = row; i < row + rowspan; i++) {
1499
- if (!this.hot.rowIndexMapper.isHidden(i)) {
1500
- var _autoRowSizePlugin$ge;
1501
- height += (_autoRowSizePlugin$ge = autoRowSizePlugin === null || autoRowSizePlugin === void 0 ? void 0 : autoRowSizePlugin.getRowHeight(i)) !== null && _autoRowSizePlugin$ge !== void 0 ? _autoRowSizePlugin$ge : defaultHeight;
1502
+ if (!rowIndexMapper.isHidden(i)) {
1503
+ var _this$hot$getRowHeigh;
1504
+ height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
1502
1505
  if (i === 0 && !stylesHandler.isClassicTheme()) {
1503
1506
  height += 1; // border-top-width
1504
1507
  }
@@ -1486,14 +1486,17 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
1486
1486
  * @returns {number}
1487
1487
  */
1488
1488
  function _sumCellsHeights(row, rowspan) {
1489
- const stylesHandler = this.hot.view.getStylesHandler();
1490
- const defaultHeight = this.hot.view.getDefaultRowHeight();
1491
- const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
1489
+ const {
1490
+ view,
1491
+ rowIndexMapper
1492
+ } = this.hot;
1493
+ const stylesHandler = view.getStylesHandler();
1494
+ const defaultHeight = view.getDefaultRowHeight();
1492
1495
  let height = 0;
1493
1496
  for (let i = row; i < row + rowspan; i++) {
1494
- if (!this.hot.rowIndexMapper.isHidden(i)) {
1495
- var _autoRowSizePlugin$ge;
1496
- height += (_autoRowSizePlugin$ge = autoRowSizePlugin === null || autoRowSizePlugin === void 0 ? void 0 : autoRowSizePlugin.getRowHeight(i)) !== null && _autoRowSizePlugin$ge !== void 0 ? _autoRowSizePlugin$ge : defaultHeight;
1497
+ if (!rowIndexMapper.isHidden(i)) {
1498
+ var _this$hot$getRowHeigh;
1499
+ height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
1497
1500
  if (i === 0 && !stylesHandler.isClassicTheme()) {
1498
1501
  height += 1; // border-top-width
1499
1502
  }
@@ -7,7 +7,6 @@ var _sortService = require("../columnSorting/sortService");
7
7
  var _utils = require("../columnSorting/utils");
8
8
  var _element = require("../../helpers/dom/element");
9
9
  var _rootComparator = require("./rootComparator");
10
- var _utils2 = require("./utils");
11
10
  var _domHelpers = require("./domHelpers");
12
11
  var _shortcutContexts = require("../../shortcutContexts");
13
12
  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; }
@@ -15,7 +14,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
15
14
  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
15
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'multiColumnSorting';
17
16
  const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 170;
18
- const CONFLICTED_PLUGIN_KEY = 'columnSorting';
19
17
  const SHORTCUTS_GROUP = PLUGIN_KEY;
20
18
  (0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
21
19
 
@@ -95,17 +93,13 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
95
93
  * @returns {boolean}
96
94
  */
97
95
  isEnabled() {
98
- return super.isEnabled();
96
+ return !!this.hot.getSettings()[this.pluginKey];
99
97
  }
100
98
 
101
99
  /**
102
100
  * Enables the plugin functionality for this Handsontable instance.
103
101
  */
104
102
  enablePlugin() {
105
- if (!this.enabled && this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
106
- (0, _utils2.warnAboutPluginsConflict)();
107
- this.hot.getPlugin(CONFLICTED_PLUGIN_KEY).disablePlugin();
108
- }
109
103
  super.enablePlugin();
110
104
  }
111
105
 
@@ -277,20 +271,6 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
277
271
  }
278
272
  }
279
273
 
280
- /**
281
- * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
282
- * for `updateSettings` in specific situations.
283
- *
284
- * @private
285
- * @param {object} newSettings New settings object.
286
- */
287
- onUpdateSettings(newSettings) {
288
- if (this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
289
- (0, _utils2.warnAboutPluginsConflict)();
290
- }
291
- super.onUpdateSettings(newSettings);
292
- }
293
-
294
274
  /**
295
275
  * Callback for the `onAfterOnCellMouseDown` hook.
296
276
  *
@@ -7,12 +7,10 @@ import { registerRootComparator } from "../columnSorting/sortService/index.mjs";
7
7
  import { wasHeaderClickedProperly } from "../columnSorting/utils.mjs";
8
8
  import { addClass, removeClass } from "../../helpers/dom/element.mjs";
9
9
  import { rootComparator } from "./rootComparator.mjs";
10
- import { warnAboutPluginsConflict } from "./utils.mjs";
11
10
  import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
12
11
  import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
13
12
  export const PLUGIN_KEY = 'multiColumnSorting';
14
13
  export const PLUGIN_PRIORITY = 170;
15
- const CONFLICTED_PLUGIN_KEY = 'columnSorting';
16
14
  const SHORTCUTS_GROUP = PLUGIN_KEY;
17
15
  registerRootComparator(PLUGIN_KEY, rootComparator);
18
16
 
@@ -92,17 +90,13 @@ export class MultiColumnSorting extends ColumnSorting {
92
90
  * @returns {boolean}
93
91
  */
94
92
  isEnabled() {
95
- return super.isEnabled();
93
+ return !!this.hot.getSettings()[this.pluginKey];
96
94
  }
97
95
 
98
96
  /**
99
97
  * Enables the plugin functionality for this Handsontable instance.
100
98
  */
101
99
  enablePlugin() {
102
- if (!this.enabled && this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
103
- warnAboutPluginsConflict();
104
- this.hot.getPlugin(CONFLICTED_PLUGIN_KEY).disablePlugin();
105
- }
106
100
  super.enablePlugin();
107
101
  }
108
102
 
@@ -274,20 +268,6 @@ export class MultiColumnSorting extends ColumnSorting {
274
268
  }
275
269
  }
276
270
 
277
- /**
278
- * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
279
- * for `updateSettings` in specific situations.
280
- *
281
- * @private
282
- * @param {object} newSettings New settings object.
283
- */
284
- onUpdateSettings(newSettings) {
285
- if (this.hot.getSettings()[this.pluginKey] && this.hot.getSettings()[CONFLICTED_PLUGIN_KEY]) {
286
- warnAboutPluginsConflict();
287
- }
288
- super.onUpdateSettings(newSettings);
289
- }
290
-
291
271
  /**
292
272
  * Callback for the `onAfterOnCellMouseDown` hook.
293
273
  *
@@ -902,9 +902,11 @@ function _onBeforeSelectColumns(from, to, highlight) {
902
902
  * @param {Array} renderersArray Array of renderers.
903
903
  */
904
904
  function _onAfterGetColumnHeaderRenderers(renderersArray) {
905
- renderersArray.length = 0;
906
- for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
907
- renderersArray.push(this.headerRendererFactory(headerLayer));
905
+ if (_classPrivateFieldGet(_stateManager, this).getLayersCount() > 0) {
906
+ renderersArray.length = 0;
907
+ for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
908
+ renderersArray.push(this.headerRendererFactory(headerLayer));
909
+ }
908
910
  }
909
911
  }
910
912
  /**
@@ -897,9 +897,11 @@ function _onBeforeSelectColumns(from, to, highlight) {
897
897
  * @param {Array} renderersArray Array of renderers.
898
898
  */
899
899
  function _onAfterGetColumnHeaderRenderers(renderersArray) {
900
- renderersArray.length = 0;
901
- for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
902
- renderersArray.push(this.headerRendererFactory(headerLayer));
900
+ if (_classPrivateFieldGet(_stateManager, this).getLayersCount() > 0) {
901
+ renderersArray.length = 0;
902
+ for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(_stateManager, this).getLayersCount(); headerLayer++) {
903
+ renderersArray.push(this.headerRendererFactory(headerLayer));
904
+ }
903
905
  }
904
906
  }
905
907
  /**
@@ -3,6 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
+ require("core-js/modules/esnext.iterator.constructor.js");
6
7
  require("core-js/modules/esnext.iterator.map.js");
7
8
  var _array = require("../../../helpers/array");
8
9
  var _sourceSettings2 = _interopRequireDefault(require("./sourceSettings"));
@@ -1,5 +1,6 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/esnext.iterator.constructor.js";
3
4
  import "core-js/modules/esnext.iterator.map.js";
4
5
  function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
5
6
  function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
@@ -2,6 +2,9 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
+ 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); }
5
8
  /**
6
9
  * An abstract class that defines the structure of an undo/redo action.
7
10
  *
@@ -9,6 +12,13 @@ require("core-js/modules/es.error.cause.js");
9
12
  * @private
10
13
  */
11
14
  class BaseAction {
15
+ constructor(actionType) {
16
+ /**
17
+ * @param {string} actionType The action type.
18
+ */
19
+ _defineProperty(this, "actionType", '');
20
+ this.actionType = actionType;
21
+ }
12
22
  undo() {
13
23
  throw new Error('Not implemented');
14
24
  }
@@ -1,4 +1,7 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
+ 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; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ 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); }
2
5
  /**
3
6
  * An abstract class that defines the structure of an undo/redo action.
4
7
  *
@@ -6,6 +9,13 @@ import "core-js/modules/es.error.cause.js";
6
9
  * @private
7
10
  */
8
11
  export class BaseAction {
12
+ constructor(actionType) {
13
+ /**
14
+ * @param {string} actionType The action type.
15
+ */
16
+ _defineProperty(this, "actionType", '');
17
+ this.actionType = actionType;
18
+ }
9
19
  undo() {
10
20
  throw new Error('Not implemented');
11
21
  }
@@ -22,7 +22,7 @@ class CellAlignmentAction extends _base.BaseAction {
22
22
  type,
23
23
  alignment
24
24
  } = _ref;
25
- super();
25
+ super('cell_alignment');
26
26
  /**
27
27
  * @param {Array} stateBefore The previous state.
28
28
  */
@@ -19,7 +19,7 @@ export class CellAlignmentAction extends BaseAction {
19
19
  type,
20
20
  alignment
21
21
  } = _ref;
22
- super();
22
+ super('cell_alignment');
23
23
  /**
24
24
  * @param {Array} stateBefore The previous state.
25
25
  */
@@ -21,7 +21,7 @@ class ColumnMoveAction extends _base.BaseAction {
21
21
  columns,
22
22
  finalIndex
23
23
  } = _ref;
24
- super();
24
+ super('col_move');
25
25
  /**
26
26
  * @param {number[]} columns An array with moved columns.
27
27
  */
@@ -18,7 +18,7 @@ export class ColumnMoveAction extends BaseAction {
18
18
  columns,
19
19
  finalIndex
20
20
  } = _ref;
21
- super();
21
+ super('col_move');
22
22
  /**
23
23
  * @param {number[]} columns An array with moved columns.
24
24
  */
@@ -18,7 +18,7 @@ class ColumnSortAction extends _base.BaseAction {
18
18
  currentSortState,
19
19
  newSortState
20
20
  } = _ref;
21
- super();
21
+ super('col_sort');
22
22
  /**
23
23
  * @param {Array} currentSortState The current sort state.
24
24
  */
@@ -15,7 +15,7 @@ export class ColumnSortAction extends BaseAction {
15
15
  currentSortState,
16
16
  newSortState
17
17
  } = _ref;
18
- super();
18
+ super('col_sort');
19
19
  /**
20
20
  * @param {Array} currentSortState The current sort state.
21
21
  */
@@ -18,7 +18,7 @@ class CreateColumnAction extends _base.BaseAction {
18
18
  index,
19
19
  amount
20
20
  } = _ref;
21
- super();
21
+ super('insert_col');
22
22
  /**
23
23
  * @param {number} index The visual column index.
24
24
  */
@@ -15,7 +15,7 @@ export class CreateColumnAction extends BaseAction {
15
15
  index,
16
16
  amount
17
17
  } = _ref;
18
- super();
18
+ super('insert_col');
19
19
  /**
20
20
  * @param {number} index The visual column index.
21
21
  */
@@ -18,7 +18,7 @@ class CreateRowAction extends _base.BaseAction {
18
18
  index,
19
19
  amount
20
20
  } = _ref;
21
- super();
21
+ super('insert_row');
22
22
  /**
23
23
  * @param {number} index The visual row index.
24
24
  */
@@ -15,7 +15,7 @@ export class CreateRowAction extends BaseAction {
15
15
  index,
16
16
  amount
17
17
  } = _ref;
18
- super();
18
+ super('insert_row');
19
19
  /**
20
20
  * @param {number} index The visual row index.
21
21
  */
@@ -26,7 +26,7 @@ class DataChangeAction extends _base.BaseAction {
26
26
  countCols,
27
27
  countRows
28
28
  } = _ref;
29
- super();
29
+ super('change');
30
30
  /**
31
31
  * @param {Array} changes 2D array containing information about each of the edited cells.
32
32
  */
@@ -23,7 +23,7 @@ export class DataChangeAction extends BaseAction {
23
23
  countCols,
24
24
  countRows
25
25
  } = _ref;
26
- super();
26
+ super('change');
27
27
  /**
28
28
  * @param {Array} changes 2D array containing information about each of the edited cells.
29
29
  */
@@ -20,7 +20,7 @@ class FiltersAction extends _base.BaseAction {
20
20
  conditionsStack,
21
21
  previousConditionsStack
22
22
  } = _ref;
23
- super();
23
+ super('filter');
24
24
  /**
25
25
  * @param {Array} previousConditionsStack An array of the previous filter conditions.
26
26
  */
@@ -48,7 +48,7 @@ class FiltersAction extends _base.BaseAction {
48
48
  undo(hot, undoneCallback) {
49
49
  const filters = hot.getPlugin('filters');
50
50
  hot.addHookOnce('afterViewRender', undoneCallback);
51
- filters.conditionCollection.importAllConditions(this.previousConditionsStack);
51
+ filters.importConditions(this.previousConditionsStack);
52
52
  filters.filter();
53
53
  }
54
54
 
@@ -59,7 +59,7 @@ class FiltersAction extends _base.BaseAction {
59
59
  redo(hot, redoneCallback) {
60
60
  const filters = hot.getPlugin('filters');
61
61
  hot.addHookOnce('afterViewRender', redoneCallback);
62
- filters.conditionCollection.importAllConditions(this.conditionsStack);
62
+ filters.importConditions(this.conditionsStack);
63
63
  filters.filter();
64
64
  }
65
65
  }
@@ -17,7 +17,7 @@ export class FiltersAction extends BaseAction {
17
17
  conditionsStack,
18
18
  previousConditionsStack
19
19
  } = _ref;
20
- super();
20
+ super('filter');
21
21
  /**
22
22
  * @param {Array} previousConditionsStack An array of the previous filter conditions.
23
23
  */
@@ -45,7 +45,7 @@ export class FiltersAction extends BaseAction {
45
45
  undo(hot, undoneCallback) {
46
46
  const filters = hot.getPlugin('filters');
47
47
  hot.addHookOnce('afterViewRender', undoneCallback);
48
- filters.conditionCollection.importAllConditions(this.previousConditionsStack);
48
+ filters.importConditions(this.previousConditionsStack);
49
49
  filters.filter();
50
50
  }
51
51
 
@@ -56,7 +56,7 @@ export class FiltersAction extends BaseAction {
56
56
  redo(hot, redoneCallback) {
57
57
  const filters = hot.getPlugin('filters');
58
58
  hot.addHookOnce('afterViewRender', redoneCallback);
59
- filters.conditionCollection.importAllConditions(this.conditionsStack);
59
+ filters.importConditions(this.conditionsStack);
60
60
  filters.filter();
61
61
  }
62
62
  }
@@ -18,7 +18,10 @@ class MergeCellsAction extends _base.BaseAction {
18
18
  data,
19
19
  cellRange
20
20
  } = _ref;
21
- super();
21
+ super('merge_cells');
22
+ /**
23
+ * @param {CellRange} cellRange The merged cell range.
24
+ */
22
25
  _defineProperty(this, "cellRange", void 0);
23
26
  this.cellRange = cellRange;
24
27
  this.data = data;
@@ -15,7 +15,10 @@ export class MergeCellsAction extends BaseAction {
15
15
  data,
16
16
  cellRange
17
17
  } = _ref;
18
- super();
18
+ super('merge_cells');
19
+ /**
20
+ * @param {CellRange} cellRange The merged cell range.
21
+ */
19
22
  _defineProperty(this, "cellRange", void 0);
20
23
  this.cellRange = cellRange;
21
24
  this.data = data;
@@ -24,13 +24,14 @@ class RemoveColumnAction extends _base.BaseAction {
24
24
  index,
25
25
  indexes,
26
26
  data,
27
+ amount,
27
28
  headers,
28
29
  columnPositions,
29
30
  rowPositions,
30
31
  fixedColumnsStart,
31
32
  removedCellMetas
32
33
  } = _ref;
33
- super();
34
+ super('remove_col');
34
35
  /**
35
36
  * @param {number} index The visual column index.
36
37
  */
@@ -70,7 +71,7 @@ class RemoveColumnAction extends _base.BaseAction {
70
71
  this.index = index;
71
72
  this.indexes = indexes;
72
73
  this.data = data;
73
- this.amount = this.data[0].length;
74
+ this.amount = amount;
74
75
  this.headers = headers;
75
76
  this.columnPositions = columnPositions.slice(0);
76
77
  this.rowPositions = rowPositions.slice(0);
@@ -108,6 +109,7 @@ class RemoveColumnAction extends _base.BaseAction {
108
109
  index: columnIndex,
109
110
  indexes,
110
111
  data: removedData,
112
+ amount,
111
113
  headers,
112
114
  columnPositions: columnsMap,
113
115
  rowPositions: rowsMap,
@@ -21,13 +21,14 @@ export class RemoveColumnAction extends BaseAction {
21
21
  index,
22
22
  indexes,
23
23
  data,
24
+ amount,
24
25
  headers,
25
26
  columnPositions,
26
27
  rowPositions,
27
28
  fixedColumnsStart,
28
29
  removedCellMetas
29
30
  } = _ref;
30
- super();
31
+ super('remove_col');
31
32
  /**
32
33
  * @param {number} index The visual column index.
33
34
  */
@@ -67,7 +68,7 @@ export class RemoveColumnAction extends BaseAction {
67
68
  this.index = index;
68
69
  this.indexes = indexes;
69
70
  this.data = data;
70
- this.amount = this.data[0].length;
71
+ this.amount = amount;
71
72
  this.headers = headers;
72
73
  this.columnPositions = columnPositions.slice(0);
73
74
  this.rowPositions = rowPositions.slice(0);
@@ -105,6 +106,7 @@ export class RemoveColumnAction extends BaseAction {
105
106
  index: columnIndex,
106
107
  indexes,
107
108
  data: removedData,
109
+ amount,
108
110
  headers,
109
111
  columnPositions: columnsMap,
110
112
  rowPositions: rowsMap,