handsontable 0.0.0-next-442b0cf-20241209 → 0.0.0-next-aa821c7-20241209

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 (61) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/core.js +1 -7
  4. package/core.mjs +1 -7
  5. package/dataMap/metaManager/metaSchema.js +2 -3
  6. package/dataMap/metaManager/metaSchema.mjs +2 -3
  7. package/dist/handsontable.css +12 -2
  8. package/dist/handsontable.full.css +12 -2
  9. package/dist/handsontable.full.js +1438 -864
  10. package/dist/handsontable.full.min.css +3 -3
  11. package/dist/handsontable.full.min.js +9 -7
  12. package/dist/handsontable.js +1437 -863
  13. package/dist/handsontable.min.css +3 -3
  14. package/dist/handsontable.min.js +35 -33
  15. package/helpers/mixed.js +1 -1
  16. package/helpers/mixed.mjs +1 -1
  17. package/package.json +1 -1
  18. package/plugins/base/base.js +0 -7
  19. package/plugins/base/base.mjs +0 -7
  20. package/plugins/undoRedo/actions/_base.js +19 -0
  21. package/plugins/undoRedo/actions/_base.mjs +15 -0
  22. package/plugins/undoRedo/actions/cellAlignment.js +85 -0
  23. package/plugins/undoRedo/actions/cellAlignment.mjs +81 -0
  24. package/plugins/undoRedo/actions/columnMove.js +84 -0
  25. package/plugins/undoRedo/actions/columnMove.mjs +80 -0
  26. package/plugins/undoRedo/actions/columnSort.js +73 -0
  27. package/plugins/undoRedo/actions/columnSort.mjs +69 -0
  28. package/plugins/undoRedo/actions/createColumn.js +60 -0
  29. package/plugins/undoRedo/actions/createColumn.mjs +56 -0
  30. package/plugins/undoRedo/actions/createRow.js +65 -0
  31. package/plugins/undoRedo/actions/createRow.mjs +61 -0
  32. package/plugins/undoRedo/actions/dataChange.js +114 -0
  33. package/plugins/undoRedo/actions/dataChange.mjs +110 -0
  34. package/plugins/undoRedo/actions/filters.js +68 -0
  35. package/plugins/undoRedo/actions/filters.mjs +64 -0
  36. package/plugins/undoRedo/actions/index.js +27 -0
  37. package/plugins/undoRedo/actions/index.mjs +23 -0
  38. package/plugins/undoRedo/actions/mergeCells.js +63 -0
  39. package/plugins/undoRedo/actions/mergeCells.mjs +59 -0
  40. package/plugins/undoRedo/actions/removeColumn.js +176 -0
  41. package/plugins/undoRedo/actions/removeColumn.mjs +172 -0
  42. package/plugins/undoRedo/actions/removeRow.js +119 -0
  43. package/plugins/undoRedo/actions/removeRow.mjs +115 -0
  44. package/plugins/undoRedo/actions/rowMove.js +84 -0
  45. package/plugins/undoRedo/actions/rowMove.mjs +80 -0
  46. package/plugins/undoRedo/actions/unmergeCells.js +56 -0
  47. package/plugins/undoRedo/actions/unmergeCells.mjs +52 -0
  48. package/plugins/undoRedo/index.js +3 -4
  49. package/plugins/undoRedo/index.mjs +1 -2
  50. package/plugins/undoRedo/undoRedo.js +277 -879
  51. package/plugins/undoRedo/undoRedo.mjs +277 -880
  52. package/plugins/undoRedo/utils.js +37 -0
  53. package/plugins/undoRedo/utils.mjs +33 -0
  54. package/styles/handsontable.css +9 -2
  55. package/styles/handsontable.min.css +3 -3
  56. package/styles/ht-theme-horizon.css +2 -2
  57. package/styles/ht-theme-horizon.min.css +2 -2
  58. package/styles/ht-theme-main.css +2 -2
  59. package/styles/ht-theme-main.min.css +2 -2
  60. package/utils/ghostTable.js +1 -5
  61. package/utils/ghostTable.mjs +1 -5
@@ -25,8 +25,8 @@
25
25
  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
26
  * USE OR INABILITY TO USE THIS SOFTWARE.
27
27
  *
28
- * Version: 0.0.0-next-442b0cf-20241209
29
- * Release date: 17/10/2024 (built at 09/12/2024 10:20:53)
28
+ * Version: 0.0.0-next-aa821c7-20241209
29
+ * Release date: 17/10/2024 (built at 09/12/2024 14:26:47)
30
30
  */
31
31
  (function webpackUniversalModuleDefinition(root, factory) {
32
32
  if(typeof exports === 'object' && typeof module === 'object')
@@ -42502,7 +42502,7 @@ exports.CellRange = _base.CellRange;
42502
42502
  var _registry = __webpack_require__(760);
42503
42503
  var _eventManager = _interopRequireWildcard(__webpack_require__(522));
42504
42504
  var _translations = __webpack_require__(621);
42505
- var _jquery = _interopRequireDefault(__webpack_require__(1083));
42505
+ var _jquery = _interopRequireDefault(__webpack_require__(1098));
42506
42506
  var _ghostTable = _interopRequireDefault(__webpack_require__(839));
42507
42507
  var parseTableHelpers = _interopRequireWildcard(__webpack_require__(524));
42508
42508
  var arrayHelpers = _interopRequireWildcard(__webpack_require__(495));
@@ -42676,8 +42676,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
42676
42676
  Handsontable.CellCoords = _src.CellCoords;
42677
42677
  Handsontable.CellRange = _src.CellRange;
42678
42678
  Handsontable.packageName = 'handsontable';
42679
- Handsontable.buildDate = "09/12/2024 10:20:53";
42680
- Handsontable.version = "0.0.0-next-442b0cf-20241209";
42679
+ Handsontable.buildDate = "09/12/2024 14:26:47";
42680
+ Handsontable.version = "0.0.0-next-aa821c7-20241209";
42681
42681
  Handsontable.languages = {
42682
42682
  dictionaryKeys: _registry.dictionaryKeys,
42683
42683
  getLanguageDictionary: _registry.getLanguageDictionary,
@@ -47118,13 +47118,7 @@ function Core(rootElement, userSettings) {
47118
47118
  * @returns {BasePlugin|undefined} The plugin instance or undefined if there is no plugin.
47119
47119
  */
47120
47120
  this.getPlugin = function (pluginName) {
47121
- const unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName);
47122
-
47123
- // Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
47124
- if (unifiedPluginName === 'UndoRedo') {
47125
- return this.undoRedo;
47126
- }
47127
- return pluginsRegistry.getItem(unifiedPluginName);
47121
+ return pluginsRegistry.getItem((0, _string.toUpperCaseFirst)(pluginName));
47128
47122
  };
47129
47123
 
47130
47124
  /**
@@ -53970,7 +53964,7 @@ const domMessages = {
53970
53964
  function _injectProductInfo(key, element) {
53971
53965
  const hasValidType = !isEmpty(key);
53972
53966
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
53973
- const hotVersion = "0.0.0-next-442b0cf-20241209";
53967
+ const hotVersion = "0.0.0-next-aa821c7-20241209";
53974
53968
  let keyValidityDate;
53975
53969
  let consoleMessageState = 'invalid';
53976
53970
  let domMessageState = 'invalid';
@@ -95479,8 +95473,7 @@ var _default = () => {
95479
95473
  * | `true` | Enable the [`UndoRedo`](@/api/undoRedo.md) plugin |
95480
95474
  * | `false` | Disable the [`UndoRedo`](@/api/undoRedo.md) plugin |
95481
95475
  *
95482
- * By default, the `undo` option is set to `undefined`,
95483
- * but the [`UndoRedo`](@/api/undoRedo.md) plugin acts as enabled.
95476
+ * By default, the `undo` option is set to `true`,
95484
95477
  * To disable the [`UndoRedo`](@/api/undoRedo.md) plugin completely,
95485
95478
  * set the `undo` option to `false`.
95486
95479
  *
@@ -95498,7 +95491,7 @@ var _default = () => {
95498
95491
  * undo: true,
95499
95492
  * ```
95500
95493
  */
95501
- undo: undefined,
95494
+ undo: true,
95502
95495
  /**
95503
95496
  * @description
95504
95497
  * The `validator` option sets a [cell validator](@/guides/cell-functions/cell-validator/cell-validator.md) for a cell.
@@ -112266,13 +112259,6 @@ class BasePlugin {
112266
112259
  if (!initializedPlugins) {
112267
112260
  initializedPlugins = (0, _registry.getPluginsNames)();
112268
112261
  }
112269
-
112270
- // Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
112271
- // Without this line the `callOnPluginsReady` callback won't be triggered after all plugin
112272
- // initialization.
112273
- if (initializedPlugins.indexOf('UndoRedo') >= 0) {
112274
- initializedPlugins.splice(initializedPlugins.indexOf('UndoRedo'), 1);
112275
- }
112276
112262
  if (initializedPlugins.indexOf(this.pluginName) >= 0) {
112277
112263
  initializedPlugins.splice(initializedPlugins.indexOf(this.pluginName), 1);
112278
112264
  }
@@ -112620,8 +112606,6 @@ class GhostTable {
112620
112606
  if (!this.injected) {
112621
112607
  this.injectTable();
112622
112608
  }
112623
- const isBorderBoxSizing = this.hot.view.getStylesHandler().areCellsBorderBox();
112624
- const borderCompensation = isBorderBoxSizing ? 0 : 1;
112625
112609
  (0, _array.arrayEach)(this.rows, row => {
112626
112610
  // In cases when the cell's content produces the height with a decimal point, the height
112627
112611
  // needs to be rounded up to make sure that there will be a space for the cell's content.
@@ -112629,9 +112613,7 @@ class GhostTable {
112629
112613
  const {
112630
112614
  height
112631
112615
  } = row.table.getBoundingClientRect();
112632
-
112633
- // -1 <- reduce border-top from table (if box-sizing is not border-box)
112634
- callback(row.row, Math.ceil(height) - borderCompensation);
112616
+ callback(row.row, Math.ceil(height));
112635
112617
  });
112636
112618
  }
112637
112619
 
@@ -151067,11 +151049,10 @@ function _onMapInit() {
151067
151049
 
151068
151050
 
151069
151051
  exports.__esModule = true;
151070
- var _undoRedo = _interopRequireWildcard(__webpack_require__(1081));
151071
- exports.UndoRedo = _undoRedo.default;
151052
+ var _undoRedo = __webpack_require__(1081);
151072
151053
  exports.PLUGIN_KEY = _undoRedo.PLUGIN_KEY;
151073
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
151074
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
151054
+ exports.PLUGIN_PRIORITY = _undoRedo.PLUGIN_PRIORITY;
151055
+ exports.UndoRedo = _undoRedo.UndoRedo;
151075
151056
 
151076
151057
  /***/ }),
151077
151058
  /* 1081 */
@@ -151080,22 +151061,35 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
151080
151061
  "use strict";
151081
151062
 
151082
151063
 
151064
+ __webpack_require__(201);
151065
+ var _interopRequireDefault = __webpack_require__(197);
151083
151066
  exports.__esModule = true;
151067
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151084
151068
  __webpack_require__(283);
151085
- __webpack_require__(1082);
151086
- __webpack_require__(311);
151087
- __webpack_require__(323);
151088
- __webpack_require__(519);
151089
- __webpack_require__(329);
151090
- __webpack_require__(530);
151069
+ __webpack_require__(287);
151070
+ __webpack_require__(298);
151071
+ __webpack_require__(300);
151072
+ __webpack_require__(303);
151073
+ __webpack_require__(305);
151074
+ __webpack_require__(307);
151075
+ __webpack_require__(309);
151076
+ var _base = __webpack_require__(837);
151091
151077
  var _hooks = __webpack_require__(511);
151092
- var _array = __webpack_require__(495);
151093
- var _number = __webpack_require__(534);
151094
151078
  var _object = __webpack_require__(499);
151095
- var _utils = __webpack_require__(877);
151096
- var _moves = __webpack_require__(993);
151079
+ var _templateLiteralTag = __webpack_require__(494);
151080
+ var _console = __webpack_require__(512);
151081
+ var _actions = __webpack_require__(1082);
151082
+ function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
151083
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
151084
+ 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"); }
151097
151085
  const SHORTCUTS_GROUP = 'undoRedo';
151098
151086
  const PLUGIN_KEY = exports.PLUGIN_KEY = 'undoRedo';
151087
+ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 1000;
151088
+ _hooks.Hooks.getSingleton().register('beforeUndo');
151089
+ _hooks.Hooks.getSingleton().register('afterUndo');
151090
+ _hooks.Hooks.getSingleton().register('beforeRedo');
151091
+ _hooks.Hooks.getSingleton().register('afterRedo');
151092
+ const deprecationWarns = new Set();
151099
151093
 
151100
151094
  /**
151101
151095
  * @description
@@ -151108,969 +151102,1278 @@ const PLUGIN_KEY = exports.PLUGIN_KEY = 'undoRedo';
151108
151102
  * ```
151109
151103
  * @class UndoRedo
151110
151104
  * @plugin UndoRedo
151111
- * @param {Core} instance The Handsontable instance.
151112
151105
  */
151113
- function UndoRedo(instance) {
151114
- const plugin = this;
151115
- this.instance = instance;
151116
- this.doneActions = [];
151117
- this.undoneActions = [];
151118
- this.ignoreNewActions = false;
151119
- this.enabled = false;
151120
- instance.addHook('afterChange', function (changes, source) {
151121
- const changesLen = changes && changes.length;
151122
- if (!changesLen) {
151106
+ var _UndoRedo_brand = /*#__PURE__*/new WeakSet();
151107
+ class UndoRedo extends _base.BasePlugin {
151108
+ static get PLUGIN_KEY() {
151109
+ return PLUGIN_KEY;
151110
+ }
151111
+ static get PLUGIN_PRIORITY() {
151112
+ return PLUGIN_PRIORITY;
151113
+ }
151114
+ static get SETTING_KEYS() {
151115
+ return true;
151116
+ }
151117
+
151118
+ /**
151119
+ * The list of registered action do undo.
151120
+ *
151121
+ * @private
151122
+ * @type {Array}
151123
+ */
151124
+
151125
+ constructor(hotInstance) {
151126
+ super(hotInstance);
151127
+ /**
151128
+ * Listens to the data change and if the source is `loadData` then clears the undo and redo history.
151129
+ *
151130
+ * @param {Array} changes The data changes.
151131
+ * @param {string} source The source of the change.
151132
+ */
151133
+ _classPrivateMethodInitSpec(this, _UndoRedo_brand);
151134
+ (0, _defineProperty2.default)(this, "doneActions", []);
151135
+ /**
151136
+ * The list of registered action do redo.
151137
+ *
151138
+ * @private
151139
+ * @type {Array}
151140
+ */
151141
+ (0, _defineProperty2.default)(this, "undoneActions", []);
151142
+ /**
151143
+ * The flag that determines if new actions should be ignored.
151144
+ *
151145
+ * @private
151146
+ * @type {boolean}
151147
+ */
151148
+ (0, _defineProperty2.default)(this, "ignoreNewActions", false);
151149
+ (0, _actions.registerActions)(hotInstance, this);
151150
+ }
151151
+
151152
+ /**
151153
+ * Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
151154
+ * hook and if it returns `true` then the {@link UndoRedo#enablePlugin} method is called.
151155
+ *
151156
+ * @returns {boolean}
151157
+ */
151158
+ isEnabled() {
151159
+ return !!this.hot.getSettings().undo;
151160
+ }
151161
+
151162
+ /**
151163
+ * Enables the plugin functionality for this Handsontable instance.
151164
+ */
151165
+ enablePlugin() {
151166
+ var _this = this;
151167
+ if (this.enabled) {
151123
151168
  return;
151124
151169
  }
151125
- const hasDifferences = changes.find(change => {
151126
- const [,, oldValue, newValue] = change;
151127
- return oldValue !== newValue;
151170
+ this.addHook('afterChange', function () {
151171
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
151172
+ args[_key] = arguments[_key];
151173
+ }
151174
+ return _assertClassBrand(_UndoRedo_brand, _this, _onAfterChange).call(_this, ...args);
151128
151175
  });
151129
- if (!hasDifferences) {
151130
- return;
151131
- }
151132
- const wrappedAction = () => {
151133
- const clonedChanges = changes.reduce((arr, change) => {
151134
- arr.push([...change]);
151135
- return arr;
151136
- }, []);
151137
- (0, _array.arrayEach)(clonedChanges, change => {
151138
- change[1] = instance.propToCol(change[1]);
151139
- });
151140
- const selected = changesLen > 1 ? this.getSelected() : [[clonedChanges[0][0], clonedChanges[0][1]]];
151141
- return new UndoRedo.ChangeAction(clonedChanges, selected);
151176
+ this.registerShortcuts();
151177
+ _assertClassBrand(_UndoRedo_brand, this, _exposeAPIToCore).call(this);
151178
+ super.enablePlugin();
151179
+ }
151180
+
151181
+ /**
151182
+ * Disables the plugin functionality for this Handsontable instance.
151183
+ */
151184
+ disablePlugin() {
151185
+ super.disablePlugin();
151186
+ this.clear();
151187
+ this.unregisterShortcuts();
151188
+ _assertClassBrand(_UndoRedo_brand, this, _removeAPIFromCore).call(this);
151189
+ }
151190
+
151191
+ /**
151192
+ * Registers shortcuts responsible for performing undo/redo.
151193
+ *
151194
+ * @private
151195
+ */
151196
+ registerShortcuts() {
151197
+ const shortcutManager = this.hot.getShortcutManager();
151198
+ const gridContext = shortcutManager.getContext('grid');
151199
+ const runOnlyIf = event => {
151200
+ return !event.altKey; // right ALT in some systems triggers ALT+CTR
151142
151201
  };
151143
- plugin.done(wrappedAction, source);
151144
- });
151145
- instance.addHook('afterCreateRow', (index, amount, source) => {
151146
- plugin.done(() => new UndoRedo.CreateRowAction(index, amount), source);
151147
- });
151148
- const getCellMetas = (fromRow, toRow, fromColumn, toColumn) => {
151149
- const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];
151150
- const genericKeysLength = genericKeys.length;
151151
- const cellMetas = [];
151152
- (0, _number.rangeEach)(fromColumn, toColumn, columnIndex => {
151153
- (0, _number.rangeEach)(fromRow, toRow, rowIndex => {
151154
- const cellMeta = instance.getCellMeta(rowIndex, columnIndex);
151155
- if (Object.keys(cellMeta).length !== genericKeysLength) {
151156
- const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {
151157
- let [key] = _ref;
151158
- return genericKeys.includes(key) === false;
151159
- }));
151160
- cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);
151161
- }
151162
- });
151163
- });
151164
- return cellMetas;
151165
- };
151166
- instance.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
151167
- const wrappedAction = () => {
151168
- const physicalRowIndex = instance.toPhysicalRow(index);
151169
- const lastRowIndex = physicalRowIndex + amount - 1;
151170
- const removedData = (0, _object.deepClone)(plugin.instance.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, plugin.instance.countSourceCols() - 1));
151171
- return new UndoRedo.RemoveRowAction(physicalRowIndex, removedData, instance.getSettings().fixedRowsBottom, instance.getSettings().fixedRowsTop, instance.rowIndexMapper.getIndexesSequence(), getCellMetas(physicalRowIndex, lastRowIndex, 0, instance.countCols() - 1));
151172
- };
151173
- plugin.done(wrappedAction, source);
151174
- });
151175
- instance.addHook('afterCreateCol', (index, amount, source) => {
151176
- plugin.done(() => new UndoRedo.CreateColumnAction(index, amount), source);
151177
- });
151178
- instance.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {
151179
- const wrappedAction = () => {
151180
- const originalData = plugin.instance.getSourceDataArray();
151181
- const columnIndex = (plugin.instance.countCols() + index) % plugin.instance.countCols();
151182
- const lastColumnIndex = columnIndex + amount - 1;
151183
- const removedData = [];
151184
- const headers = [];
151185
- const indexes = [];
151186
- (0, _number.rangeEach)(originalData.length - 1, i => {
151187
- const column = [];
151188
- const origRow = originalData[i];
151189
- (0, _number.rangeEach)(columnIndex, lastColumnIndex, j => {
151190
- column.push(origRow[instance.toPhysicalColumn(j)]);
151191
- });
151192
- removedData.push(column);
151193
- });
151194
- (0, _number.rangeEach)(amount - 1, i => {
151195
- indexes.push(instance.toPhysicalColumn(columnIndex + i));
151196
- });
151197
- if (Array.isArray(instance.getSettings().colHeaders)) {
151198
- (0, _number.rangeEach)(amount - 1, i => {
151199
- headers.push(instance.getSettings().colHeaders[instance.toPhysicalColumn(columnIndex + i)] || null);
151200
- });
151201
- }
151202
- const columnsMap = instance.columnIndexMapper.getIndexesSequence();
151203
- const rowsMap = instance.rowIndexMapper.getIndexesSequence();
151204
- return new UndoRedo.RemoveColumnAction(columnIndex, indexes, removedData, headers, columnsMap, rowsMap, instance.getSettings().fixedColumnsStart, getCellMetas(0, instance.countRows(), columnIndex, lastColumnIndex));
151202
+ const config = {
151203
+ runOnlyIf,
151204
+ group: SHORTCUTS_GROUP
151205
151205
  };
151206
- plugin.done(wrappedAction, source);
151207
- });
151208
- instance.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
151209
- plugin.done(() => new UndoRedo.CellAlignmentAction(stateBefore, range, type, alignment));
151210
- });
151211
- instance.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
151212
- plugin.done(() => new UndoRedo.FiltersAction(conditionsStack, previousConditionsStack));
151213
- });
151214
- instance.addHook('beforeRowMove', (rows, finalIndex) => {
151215
- if (rows === false) {
151216
- return;
151217
- }
151218
- plugin.done(() => new UndoRedo.RowMoveAction(rows, finalIndex));
151219
- });
151220
- instance.addHook('beforeColumnMove', (columns, finalIndex) => {
151221
- if (columns === false) {
151222
- return;
151223
- }
151224
- plugin.done(() => new UndoRedo.ColumnMoveAction(columns, finalIndex));
151225
- });
151226
- instance.addHook('beforeMergeCells', (cellRange, auto) => {
151227
- if (auto) {
151206
+ gridContext.addShortcuts([{
151207
+ keys: [['Control/Meta', 'z']],
151208
+ callback: () => {
151209
+ this.undo();
151210
+ }
151211
+ }, {
151212
+ keys: [['Control/Meta', 'y'], ['Control/Meta', 'Shift', 'z']],
151213
+ callback: () => {
151214
+ this.redo();
151215
+ }
151216
+ }], config);
151217
+ }
151218
+
151219
+ /**
151220
+ * Unregister shortcuts responsible for performing undo/redo.
151221
+ *
151222
+ * @private
151223
+ */
151224
+ unregisterShortcuts() {
151225
+ const shortcutManager = this.hot.getShortcutManager();
151226
+ const gridContext = shortcutManager.getContext('grid');
151227
+ gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
151228
+ }
151229
+
151230
+ /**
151231
+ * Stash information about performed actions.
151232
+ *
151233
+ * @fires Hooks#beforeUndoStackChange
151234
+ * @fires Hooks#afterUndoStackChange
151235
+ * @fires Hooks#beforeRedoStackChange
151236
+ * @fires Hooks#afterRedoStackChange
151237
+ * @param {Function} wrappedAction The action descriptor wrapped in a closure.
151238
+ * @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins).
151239
+ */
151240
+ done(wrappedAction, source) {
151241
+ if (this.ignoreNewActions) {
151228
151242
  return;
151229
151243
  }
151230
- plugin.done(() => new UndoRedo.MergeCellsAction(instance, cellRange));
151231
- });
151232
- instance.addHook('afterUnmergeCells', (cellRange, auto) => {
151233
- if (auto) {
151244
+ const isBlockedByDefault = source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';
151245
+ if (isBlockedByDefault) {
151234
151246
  return;
151235
151247
  }
151236
- plugin.done(() => new UndoRedo.UnmergeCellsAction(instance, cellRange));
151237
- });
151238
- instance.addHook('beforeColumnSort', (currentSortConfig, destinationSortConfigs, sortPossible) => {
151239
- if (!sortPossible) {
151248
+ const doneActionsCopy = this.doneActions.slice();
151249
+ const continueAction = this.hot.runHooks('beforeUndoStackChange', doneActionsCopy, source);
151250
+ if (continueAction === false) {
151240
151251
  return;
151241
151252
  }
151242
- plugin.done(() => new UndoRedo.ColumnSortAction(currentSortConfig, destinationSortConfigs));
151243
- });
151244
-
151245
- // TODO: Why this callback is needed? One test doesn't pass after calling method right after plugin creation (outside the callback).
151246
- instance.addHook('afterInit', () => {
151247
- plugin.init();
151248
- });
151249
- }
151250
-
151251
- /**
151252
- * Stash information about performed actions.
151253
- *
151254
- * @function done
151255
- * @memberof UndoRedo#
151256
- * @fires Hooks#beforeUndoStackChange
151257
- * @fires Hooks#afterUndoStackChange
151258
- * @fires Hooks#beforeRedoStackChange
151259
- * @fires Hooks#afterRedoStackChange
151260
- * @param {Function} wrappedAction The action descriptor wrapped in a closure.
151261
- * @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins).
151262
- */
151263
- UndoRedo.prototype.done = function (wrappedAction, source) {
151264
- if (this.ignoreNewActions) {
151265
- return;
151266
- }
151267
- const isBlockedByDefault = source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';
151268
- if (isBlockedByDefault) {
151269
- return;
151270
- }
151271
- const doneActionsCopy = this.doneActions.slice();
151272
- const continueAction = this.instance.runHooks('beforeUndoStackChange', doneActionsCopy, source);
151273
- if (continueAction === false) {
151274
- return;
151253
+ const newAction = wrappedAction();
151254
+ const undoneActionsCopy = this.undoneActions.slice();
151255
+ this.doneActions.push(newAction);
151256
+ this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151257
+ this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
151258
+ this.undoneActions.length = 0;
151259
+ this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151275
151260
  }
151276
- const newAction = wrappedAction();
151277
- const undoneActionsCopy = this.undoneActions.slice();
151278
- this.doneActions.push(newAction);
151279
- this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151280
- this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);
151281
- this.undoneActions.length = 0;
151282
- this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151283
- };
151284
151261
 
151285
- /**
151286
- * Undo the last action performed to the table.
151287
- *
151288
- * @function undo
151289
- * @memberof UndoRedo#
151290
- * @fires Hooks#beforeUndoStackChange
151291
- * @fires Hooks#afterUndoStackChange
151292
- * @fires Hooks#beforeRedoStackChange
151293
- * @fires Hooks#afterRedoStackChange
151294
- * @fires Hooks#beforeUndo
151295
- * @fires Hooks#afterUndo
151296
- */
151297
- UndoRedo.prototype.undo = function () {
151298
- if (this.isUndoAvailable()) {
151262
+ /**
151263
+ * Undo the last action performed to the table.
151264
+ *
151265
+ * @fires Hooks#beforeUndoStackChange
151266
+ * @fires Hooks#afterUndoStackChange
151267
+ * @fires Hooks#beforeRedoStackChange
151268
+ * @fires Hooks#afterRedoStackChange
151269
+ * @fires Hooks#beforeUndo
151270
+ * @fires Hooks#afterUndo
151271
+ */
151272
+ undo() {
151273
+ if (!this.isUndoAvailable()) {
151274
+ return;
151275
+ }
151299
151276
  const doneActionsCopy = this.doneActions.slice();
151300
- this.instance.runHooks('beforeUndoStackChange', doneActionsCopy);
151277
+ this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);
151301
151278
  const action = this.doneActions.pop();
151302
- this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151279
+ this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151303
151280
  const actionClone = (0, _object.deepClone)(action);
151304
- const continueAction = this.instance.runHooks('beforeUndo', actionClone);
151281
+ const continueAction = this.hot.runHooks('beforeUndo', actionClone);
151305
151282
  if (continueAction === false) {
151306
151283
  return;
151307
151284
  }
151308
151285
  this.ignoreNewActions = true;
151309
- const that = this;
151310
151286
  const undoneActionsCopy = this.undoneActions.slice();
151311
- this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);
151312
- action.undo(this.instance, () => {
151313
- that.ignoreNewActions = false;
151314
- that.undoneActions.push(action);
151287
+ this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
151288
+ action.undo(this.hot, () => {
151289
+ this.ignoreNewActions = false;
151290
+ this.undoneActions.push(action);
151315
151291
  });
151316
- this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151317
- this.instance.runHooks('afterUndo', actionClone);
151292
+ this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151293
+ this.hot.runHooks('afterUndo', actionClone);
151318
151294
  }
151319
- };
151320
151295
 
151321
- /**
151322
- * Redo the previous action performed to the table (used to reverse an undo).
151323
- *
151324
- * @function redo
151325
- * @memberof UndoRedo#
151326
- * @fires Hooks#beforeUndoStackChange
151327
- * @fires Hooks#afterUndoStackChange
151328
- * @fires Hooks#beforeRedoStackChange
151329
- * @fires Hooks#afterRedoStackChange
151330
- * @fires Hooks#beforeRedo
151331
- * @fires Hooks#afterRedo
151332
- */
151333
- UndoRedo.prototype.redo = function () {
151334
- if (this.isRedoAvailable()) {
151296
+ /**
151297
+ * Redo the previous action performed to the table (used to reverse an undo).
151298
+ *
151299
+ * @fires Hooks#beforeUndoStackChange
151300
+ * @fires Hooks#afterUndoStackChange
151301
+ * @fires Hooks#beforeRedoStackChange
151302
+ * @fires Hooks#afterRedoStackChange
151303
+ * @fires Hooks#beforeRedo
151304
+ * @fires Hooks#afterRedo
151305
+ */
151306
+ redo() {
151307
+ if (!this.isRedoAvailable()) {
151308
+ return;
151309
+ }
151335
151310
  const undoneActionsCopy = this.undoneActions.slice();
151336
- this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);
151311
+ this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
151337
151312
  const action = this.undoneActions.pop();
151338
- this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151313
+ this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
151339
151314
  const actionClone = (0, _object.deepClone)(action);
151340
- const continueAction = this.instance.runHooks('beforeRedo', actionClone);
151315
+ const continueAction = this.hot.runHooks('beforeRedo', actionClone);
151341
151316
  if (continueAction === false) {
151342
151317
  return;
151343
151318
  }
151344
151319
  this.ignoreNewActions = true;
151345
- const that = this;
151346
151320
  const doneActionsCopy = this.doneActions.slice();
151347
- this.instance.runHooks('beforeUndoStackChange', doneActionsCopy);
151348
- action.redo(this.instance, () => {
151349
- that.ignoreNewActions = false;
151350
- that.doneActions.push(action);
151321
+ this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);
151322
+ action.redo(this.hot, () => {
151323
+ this.ignoreNewActions = false;
151324
+ this.doneActions.push(action);
151351
151325
  });
151352
- this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151353
- this.instance.runHooks('afterRedo', actionClone);
151326
+ this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
151327
+ this.hot.runHooks('afterRedo', actionClone);
151354
151328
  }
151355
- };
151356
151329
 
151357
- /**
151358
- * Checks if undo action is available.
151359
- *
151360
- * @function isUndoAvailable
151361
- * @memberof UndoRedo#
151362
- * @returns {boolean} Return `true` if undo can be performed, `false` otherwise.
151363
- */
151364
- UndoRedo.prototype.isUndoAvailable = function () {
151365
- return this.doneActions.length > 0;
151366
- };
151330
+ /**
151331
+ * Checks if undo action is available.
151332
+ *
151333
+ * @returns {boolean} Return `true` if undo can be performed, `false` otherwise.
151334
+ */
151335
+ isUndoAvailable() {
151336
+ return this.doneActions.length > 0;
151337
+ }
151367
151338
 
151368
- /**
151369
- * Checks if redo action is available.
151370
- *
151371
- * @function isRedoAvailable
151372
- * @memberof UndoRedo#
151373
- * @returns {boolean} Return `true` if redo can be performed, `false` otherwise.
151374
- */
151375
- UndoRedo.prototype.isRedoAvailable = function () {
151376
- return this.undoneActions.length > 0;
151377
- };
151339
+ /**
151340
+ * Checks if redo action is available.
151341
+ *
151342
+ * @returns {boolean} Return `true` if redo can be performed, `false` otherwise.
151343
+ */
151344
+ isRedoAvailable() {
151345
+ return this.undoneActions.length > 0;
151346
+ }
151378
151347
 
151348
+ /**
151349
+ * Clears undo and redo history.
151350
+ */
151351
+ clear() {
151352
+ this.doneActions.length = 0;
151353
+ this.undoneActions.length = 0;
151354
+ }
151355
+ /**
151356
+ * Destroys the plugin instance.
151357
+ */
151358
+ destroy() {
151359
+ this.clear();
151360
+ this.doneActions = null;
151361
+ this.undoneActions = null;
151362
+ super.destroy();
151363
+ }
151364
+ }
151365
+ exports.UndoRedo = UndoRedo;
151366
+ function _onAfterChange(changes, source) {
151367
+ if (source === 'loadData') {
151368
+ this.clear();
151369
+ }
151370
+ }
151379
151371
  /**
151380
- * Clears undo history.
151381
- *
151382
- * @function clear
151383
- * @memberof UndoRedo#
151372
+ * Expose the plugin API to the Core. It is for backward compatibility and it should be removed in the future.
151384
151373
  */
151385
- UndoRedo.prototype.clear = function () {
151386
- this.doneActions.length = 0;
151387
- this.undoneActions.length = 0;
151388
- };
151374
+ function _exposeAPIToCore() {
151375
+ const deprecatedWarn = methodName => {
151376
+ if (!deprecationWarns.has(methodName)) {
151377
+ (0, _console.warn)((0, _templateLiteralTag.toSingleLine)`The "${methodName}" method is deprecated and it will be removed\x20
151378
+ from the Core API in the future. Please use the method from the UndoRedo plugin\x20
151379
+ (e.g. \`hotInstance.getPlugin("undoRedo").${methodName}()\`).`);
151380
+ deprecationWarns.add(methodName);
151381
+ }
151382
+ };
151389
151383
 
151384
+ /**
151385
+ * {@link UndoRedo#undo}.
151386
+ *
151387
+ * @alias undo
151388
+ * @memberof! Core#
151389
+ */
151390
+ this.hot.undo = () => {
151391
+ deprecatedWarn('undo');
151392
+ this.undo();
151393
+ };
151394
+ /**
151395
+ * {@link UndoRedo#redo}.
151396
+ *
151397
+ * @alias redo
151398
+ * @memberof! Core#
151399
+ */
151400
+ this.hot.redo = () => {
151401
+ deprecatedWarn('redo');
151402
+ this.redo();
151403
+ };
151404
+ /**
151405
+ * {@link UndoRedo#isUndoAvailable}.
151406
+ *
151407
+ * @alias isUndoAvailable
151408
+ * @memberof! Core#
151409
+ * @returns {boolean}
151410
+ */
151411
+ this.hot.isUndoAvailable = () => {
151412
+ deprecatedWarn('isUndoAvailable');
151413
+ return this.isUndoAvailable();
151414
+ };
151415
+ /**
151416
+ * {@link UndoRedo#isRedoAvailable}.
151417
+ *
151418
+ * @alias isRedoAvailable
151419
+ * @memberof! Core#
151420
+ * @returns {boolean}
151421
+ */
151422
+ this.hot.isRedoAvailable = () => {
151423
+ deprecatedWarn('isRedoAvailable');
151424
+ return this.isRedoAvailable();
151425
+ };
151426
+ /**
151427
+ * {@link UndoRedo#clear}.
151428
+ *
151429
+ * @alias clearUndo
151430
+ * @memberof! Core#
151431
+ */
151432
+ this.hot.clearUndo = () => {
151433
+ deprecatedWarn('clear');
151434
+ this.clear();
151435
+ };
151436
+ this.hot.undoRedo = this;
151437
+ }
151390
151438
  /**
151391
- * Checks if the plugin is enabled.
151392
- *
151393
- * @function isEnabled
151394
- * @memberof UndoRedo#
151395
- * @returns {boolean}
151439
+ * Removes the plugin API from the Core. It is for backward compatibility and it should be removed in the future.
151396
151440
  */
151397
- UndoRedo.prototype.isEnabled = function () {
151398
- return this.enabled;
151399
- };
151441
+ function _removeAPIFromCore() {
151442
+ delete this.hot.undo;
151443
+ delete this.hot.redo;
151444
+ delete this.hot.isUndoAvailable;
151445
+ delete this.hot.isRedoAvailable;
151446
+ delete this.hot.clearUndo;
151447
+ delete this.hot.undoRedo;
151448
+ }
151400
151449
 
151401
- /**
151402
- * Enables the plugin.
151403
- *
151404
- * @function enable
151405
- * @memberof UndoRedo#
151406
- */
151407
- UndoRedo.prototype.enable = function () {
151408
- if (this.isEnabled()) {
151409
- return;
151410
- }
151411
- const hot = this.instance;
151412
- this.enabled = true;
151413
- exposeUndoRedoMethods(hot);
151414
- this.registerShortcuts();
151415
- hot.addHook('afterChange', onAfterChange);
151416
- };
151450
+ /***/ }),
151451
+ /* 1082 */
151452
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151417
151453
 
151418
- /**
151419
- * Disables the plugin.
151420
- *
151421
- * @function disable
151422
- * @memberof UndoRedo#
151423
- */
151424
- UndoRedo.prototype.disable = function () {
151425
- if (!this.isEnabled()) {
151426
- return;
151427
- }
151428
- const hot = this.instance;
151429
- this.enabled = false;
151430
- removeExposedUndoRedoMethods(hot);
151431
- this.unregisterShortcuts();
151432
- hot.removeHook('afterChange', onAfterChange);
151433
- };
151454
+ "use strict";
151434
151455
 
151435
- /**
151436
- * Destroys the instance.
151456
+
151457
+ exports.__esModule = true;
151458
+ exports.registerActions = registerActions;
151459
+ __webpack_require__(311);
151460
+ __webpack_require__(329);
151461
+ var _cellAlignment = __webpack_require__(1083);
151462
+ var _columnMove = __webpack_require__(1085);
151463
+ var _columnSort = __webpack_require__(1086);
151464
+ var _createColumn = __webpack_require__(1087);
151465
+ var _createRow = __webpack_require__(1088);
151466
+ var _dataChange = __webpack_require__(1089);
151467
+ var _filters = __webpack_require__(1090);
151468
+ var _mergeCells = __webpack_require__(1091);
151469
+ var _removeColumn = __webpack_require__(1092);
151470
+ var _removeRow = __webpack_require__(1095);
151471
+ var _rowMove = __webpack_require__(1096);
151472
+ var _unmergeCells = __webpack_require__(1097);
151473
+ /**
151474
+ * Register all undo/redo actions.
151437
151475
  *
151438
- * @function destroy
151439
- * @memberof UndoRedo#
151476
+ * @param {Core} hot The Handsontable instance.
151477
+ * @param {UndoRedo} undoRedoPlugin The undoRedo plugin instance.
151440
151478
  */
151441
- UndoRedo.prototype.destroy = function () {
151442
- this.clear();
151443
- this.instance = null;
151444
- this.doneActions = null;
151445
- this.undoneActions = null;
151446
- };
151447
- UndoRedo.Action = function () {};
151448
- UndoRedo.Action.prototype.undo = function () {};
151449
- UndoRedo.Action.prototype.redo = function () {};
151479
+ function registerActions(hot, undoRedoPlugin) {
151480
+ [_cellAlignment.CellAlignmentAction, _columnMove.ColumnMoveAction, _columnSort.ColumnSortAction, _createColumn.CreateColumnAction, _createRow.CreateRowAction, _dataChange.DataChangeAction, _filters.FiltersAction, _mergeCells.MergeCellsAction, _removeColumn.RemoveColumnAction, _removeRow.RemoveRowAction, _rowMove.RowMoveAction, _unmergeCells.UnmergeCellsAction].forEach(action => action.startRegisteringEvents(hot, undoRedoPlugin));
151481
+ }
151482
+
151483
+ /***/ }),
151484
+ /* 1083 */
151485
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151450
151486
 
151487
+ "use strict";
151488
+
151489
+
151490
+ var _interopRequireDefault = __webpack_require__(197);
151491
+ exports.__esModule = true;
151492
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151493
+ var _base = __webpack_require__(1084);
151494
+ var _utils = __webpack_require__(877);
151495
+ var _array = __webpack_require__(495);
151451
151496
  /**
151452
- * Change action.
151497
+ * Action that tracks cell alignment changes.
151453
151498
  *
151499
+ * @class CellAlignmentAction
151454
151500
  * @private
151455
- * @param {Array} changes 2D array containing information about each of the edited cells.
151456
- * @param {number[]} selected The cell selection.
151457
151501
  */
151458
- UndoRedo.ChangeAction = function (changes, selected) {
151459
- this.changes = changes;
151460
- this.selected = selected;
151461
- this.actionType = 'change';
151462
- };
151463
- (0, _object.inherit)(UndoRedo.ChangeAction, UndoRedo.Action);
151464
- UndoRedo.ChangeAction.prototype.undo = function (instance, undoneCallback) {
151465
- const data = (0, _object.deepClone)(this.changes);
151466
- const emptyRowsAtTheEnd = instance.countEmptyRows(true);
151467
- const emptyColsAtTheEnd = instance.countEmptyCols(true);
151468
- for (let i = 0, len = data.length; i < len; i++) {
151469
- data[i].splice(3, 1);
151470
- }
151471
- instance.addHookOnce('afterChange', undoneCallback);
151472
- instance.setDataAtCell(data, null, null, 'UndoRedo.undo');
151473
- for (let i = 0, len = data.length; i < len; i++) {
151474
- const [row, column] = data[i];
151475
- if (instance.getSettings().minSpareRows && row + 1 + instance.getSettings().minSpareRows === instance.countRows() && emptyRowsAtTheEnd === instance.getSettings().minSpareRows) {
151476
- instance.alter('remove_row', parseInt(row + 1, 10), instance.getSettings().minSpareRows);
151477
- instance.undoRedo.doneActions.pop();
151478
- }
151479
- if (instance.getSettings().minSpareCols && column + 1 + instance.getSettings().minSpareCols === instance.countCols() && emptyColsAtTheEnd === instance.getSettings().minSpareCols) {
151480
- instance.alter('remove_col', parseInt(column + 1, 10), instance.getSettings().minSpareCols);
151481
- instance.undoRedo.doneActions.pop();
151482
- }
151483
- }
151484
- const selectedLast = instance.getSelectedLast();
151485
- if (selectedLast !== undefined) {
151486
- const [changedRow, changedColumn] = data[0];
151487
- const [selectedRow, selectedColumn] = selectedLast;
151488
- const firstFullyVisibleRow = instance.getFirstFullyVisibleRow();
151489
- const firstFullyVisibleColumn = instance.getFirstFullyVisibleColumn();
151490
- const isInVerticalViewPort = changedRow >= firstFullyVisibleRow;
151491
- const isInHorizontalViewPort = changedColumn >= firstFullyVisibleColumn;
151492
- const isInViewport = isInVerticalViewPort && isInHorizontalViewPort;
151493
- const isChangedSelection = selectedRow !== changedRow || selectedColumn !== changedColumn;
151494
-
151495
- // Performing scroll only when selection has been changed right after editing a cell.
151496
- if (isInViewport === false && isChangedSelection === true) {
151497
- const scrollConfig = {
151498
- row: changedRow,
151499
- col: changedColumn
151500
- };
151501
- if (isInVerticalViewPort === false) {
151502
- scrollConfig.verticalSnap = 'top';
151503
- }
151504
- if (isInHorizontalViewPort === false) {
151505
- scrollConfig.horizontalSnap = 'start';
151506
- }
151507
- instance.scrollViewportTo(scrollConfig);
151508
- }
151502
+ class CellAlignmentAction extends _base.BaseAction {
151503
+ constructor(_ref) {
151504
+ let {
151505
+ stateBefore,
151506
+ range,
151507
+ type,
151508
+ alignment
151509
+ } = _ref;
151510
+ super();
151511
+ /**
151512
+ * @param {Array} stateBefore The previous state.
151513
+ */
151514
+ (0, _defineProperty2.default)(this, "stateBefore", void 0);
151515
+ /**
151516
+ * @param {object} range The cell range.
151517
+ */
151518
+ (0, _defineProperty2.default)(this, "range", void 0);
151519
+ /**
151520
+ * @param {string} type The type of the alignment ("top", "left", "bottom" or "right").
151521
+ */
151522
+ (0, _defineProperty2.default)(this, "type", void 0);
151523
+ /**
151524
+ * @param {string} alignment The alignment CSS class.
151525
+ */
151526
+ (0, _defineProperty2.default)(this, "alignment", void 0);
151527
+ this.stateBefore = stateBefore;
151528
+ this.range = range;
151529
+ this.type = type;
151530
+ this.alignment = alignment;
151509
151531
  }
151510
- instance.selectCells(this.selected, false, false);
151511
- };
151512
- UndoRedo.ChangeAction.prototype.redo = function (instance, onFinishCallback) {
151513
- const data = (0, _object.deepClone)(this.changes);
151514
- for (let i = 0, len = data.length; i < len; i++) {
151515
- data[i].splice(2, 1);
151532
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151533
+ hot.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
151534
+ undoRedoPlugin.done(() => new CellAlignmentAction({
151535
+ stateBefore,
151536
+ range,
151537
+ type,
151538
+ alignment
151539
+ }));
151540
+ });
151516
151541
  }
151517
- instance.addHookOnce('afterChange', onFinishCallback);
151518
- instance.setDataAtCell(data, null, null, 'UndoRedo.redo');
151519
- if (this.selected) {
151520
- instance.selectCells(this.selected, false, false);
151542
+
151543
+ /**
151544
+ * @param {Core} hot The Handsontable instance.
151545
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151546
+ */
151547
+ undo(hot, undoneCallback) {
151548
+ (0, _array.arrayEach)(this.range, range => {
151549
+ range.forAll((row, col) => {
151550
+ // Alignment classes should only collected within cell ranges. We skip header coordinates.
151551
+ if (row >= 0 && col >= 0) {
151552
+ hot.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
151553
+ }
151554
+ });
151555
+ });
151556
+ hot.addHookOnce('afterViewRender', undoneCallback);
151557
+ hot.render();
151521
151558
  }
151522
- };
151523
151559
 
151524
- /**
151525
- * Create row action.
151526
- *
151527
- * @private
151528
- * @param {number} index The visual row index.
151529
- * @param {number} amount The number of created rows.
151530
- */
151531
- UndoRedo.CreateRowAction = function (index, amount) {
151532
- this.index = index;
151533
- this.amount = amount;
151534
- this.actionType = 'insert_row';
151535
- };
151536
- (0, _object.inherit)(UndoRedo.CreateRowAction, UndoRedo.Action);
151537
- UndoRedo.CreateRowAction.prototype.undo = function (instance, undoneCallback) {
151538
- const rowCount = instance.countRows();
151539
- const minSpareRows = instance.getSettings().minSpareRows;
151540
- if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
151541
- this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
151542
- }
151543
- instance.addHookOnce('afterRemoveRow', undoneCallback);
151544
- instance.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
151545
- };
151546
- UndoRedo.CreateRowAction.prototype.redo = function (instance, redoneCallback) {
151547
- instance.addHookOnce('afterCreateRow', redoneCallback);
151548
- instance.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');
151549
- };
151560
+ /**
151561
+ * @param {Core} hot The Handsontable instance.
151562
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151563
+ */
151564
+ redo(hot, redoneCallback) {
151565
+ (0, _utils.align)(this.range, this.type, this.alignment, (row, col) => hot.getCellMeta(row, col), (row, col, key, value) => hot.setCellMeta(row, col, key, value));
151566
+ hot.addHookOnce('afterViewRender', redoneCallback);
151567
+ hot.render();
151568
+ }
151569
+ }
151570
+ exports.CellAlignmentAction = CellAlignmentAction;
151550
151571
 
151551
- /**
151552
- * Remove row action.
151553
- *
151554
- * @private
151555
- * @param {number} index The visual row index.
151556
- * @param {Array} data The removed data.
151557
- * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
151558
- * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
151559
- * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
151560
- * @param {Array} removedCellMetas List of removed cell metas.
151561
- */
151562
- UndoRedo.RemoveRowAction = function (index, data, fixedRowsBottom, fixedRowsTop, rowIndexesSequence, removedCellMetas) {
151563
- this.index = index;
151564
- this.data = data;
151565
- this.actionType = 'remove_row';
151566
- this.fixedRowsBottom = fixedRowsBottom;
151567
- this.fixedRowsTop = fixedRowsTop;
151568
- this.rowIndexesSequence = rowIndexesSequence;
151569
- this.removedCellMetas = removedCellMetas;
151570
- };
151571
- (0, _object.inherit)(UndoRedo.RemoveRowAction, UndoRedo.Action);
151572
- UndoRedo.RemoveRowAction.prototype.undo = function (instance, undoneCallback) {
151573
- const settings = instance.getSettings();
151574
- const changes = [];
151572
+ /***/ }),
151573
+ /* 1084 */
151574
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151575
151575
 
151576
- // Changing by the reference as `updateSettings` doesn't work the best.
151577
- settings.fixedRowsBottom = this.fixedRowsBottom;
151578
- settings.fixedRowsTop = this.fixedRowsTop;
151576
+ "use strict";
151579
151577
 
151580
- // Prepare the change list to fill the source data.
151581
- this.data.forEach((dataRow, rowIndexDelta) => {
151582
- Object.keys(dataRow).forEach(columnProp => {
151583
- const columnIndex = parseInt(columnProp, 10);
151584
- changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
151585
- });
151586
- });
151587
- instance.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
151588
- this.removedCellMetas.forEach(_ref2 => {
151589
- let [rowIndex, columnIndex, cellMeta] = _ref2;
151590
- instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);
151591
- });
151592
- instance.addHookOnce('afterViewRender', undoneCallback);
151593
- instance.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
151594
- instance.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
151595
- };
151596
- UndoRedo.RemoveRowAction.prototype.redo = function (instance, redoneCallback) {
151597
- instance.addHookOnce('afterRemoveRow', redoneCallback);
151598
- instance.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
151599
- };
151600
151578
 
151579
+ exports.__esModule = true;
151580
+ __webpack_require__(201);
151601
151581
  /**
151602
- * Create column action.
151582
+ * An abstract class that defines the structure of an undo/redo action.
151603
151583
  *
151584
+ * @class BaseAction
151604
151585
  * @private
151605
- * @param {number} index The visual column index.
151606
- * @param {number} amount The number of created columns.
151607
151586
  */
151608
- UndoRedo.CreateColumnAction = function (index, amount) {
151609
- this.index = index;
151610
- this.amount = amount;
151611
- this.actionType = 'insert_col';
151612
- };
151613
- (0, _object.inherit)(UndoRedo.CreateColumnAction, UndoRedo.Action);
151614
- UndoRedo.CreateColumnAction.prototype.undo = function (instance, undoneCallback) {
151615
- instance.addHookOnce('afterRemoveCol', undoneCallback);
151616
- instance.alter('remove_col', this.index, this.amount, 'UndoRedo.undo');
151617
- };
151618
- UndoRedo.CreateColumnAction.prototype.redo = function (instance, redoneCallback) {
151619
- instance.addHookOnce('afterCreateCol', redoneCallback);
151620
- instance.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');
151621
- };
151587
+ class BaseAction {
151588
+ undo() {
151589
+ throw new Error('Not implemented');
151590
+ }
151591
+ redo() {
151592
+ throw new Error('Not implemented');
151593
+ }
151594
+ }
151595
+ exports.BaseAction = BaseAction;
151622
151596
 
151597
+ /***/ }),
151598
+ /* 1085 */
151599
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151600
+
151601
+ "use strict";
151602
+
151603
+
151604
+ var _interopRequireDefault = __webpack_require__(197);
151605
+ exports.__esModule = true;
151606
+ __webpack_require__(311);
151607
+ __webpack_require__(329);
151608
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151609
+ var _base = __webpack_require__(1084);
151610
+ var _moves = __webpack_require__(993);
151623
151611
  /**
151624
- * Remove column action.
151612
+ * Action that tracks column move changes.
151625
151613
  *
151614
+ * @class ColumnMoveAction
151626
151615
  * @private
151627
- * @param {number} index The visual column index.
151628
- * @param {number[]} indexes The visual column indexes.
151629
- * @param {Array} data The removed data.
151630
- * @param {Array} headers The header values.
151631
- * @param {number[]} columnPositions The column position.
151632
- * @param {number[]} rowPositions The row position.
151633
- * @param {number} fixedColumnsStart Number of fixed columns on the left. Remove column action change it sometimes.
151634
- * @param {Array} removedCellMetas List of removed cell metas.
151635
- */
151636
- UndoRedo.RemoveColumnAction = function (index, indexes, data, headers, columnPositions, rowPositions, fixedColumnsStart, removedCellMetas) {
151637
- // eslint-disable-line max-len
151638
- this.index = index;
151639
- this.indexes = indexes;
151640
- this.data = data;
151641
- this.amount = this.data[0].length;
151642
- this.headers = headers;
151643
- this.columnPositions = columnPositions.slice(0);
151644
- this.rowPositions = rowPositions.slice(0);
151645
- this.actionType = 'remove_col';
151646
- this.fixedColumnsStart = fixedColumnsStart;
151647
- this.removedCellMetas = removedCellMetas;
151648
- };
151649
- (0, _object.inherit)(UndoRedo.RemoveColumnAction, UndoRedo.Action);
151650
- UndoRedo.RemoveColumnAction.prototype.undo = function (instance, undoneCallback) {
151651
- const settings = instance.getSettings();
151652
-
151653
- // Changing by the reference as `updateSettings` doesn't work the best.
151654
- settings.fixedColumnsStart = this.fixedColumnsStart;
151655
- const ascendingIndexes = this.indexes.slice(0).sort();
151656
- const sortByIndexes = (elem, j, arr) => arr[this.indexes.indexOf(ascendingIndexes[j])];
151657
- const removedDataLength = this.data.length;
151658
- const sortedData = [];
151659
- for (let rowIndex = 0; rowIndex < removedDataLength; rowIndex++) {
151660
- sortedData.push((0, _array.arrayMap)(this.data[rowIndex], sortByIndexes));
151661
- }
151662
- const sortedHeaders = (0, _array.arrayMap)(this.headers, sortByIndexes);
151663
- const changes = [];
151664
- instance.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
151665
- (0, _array.arrayEach)(instance.getSourceDataArray(), (rowData, rowIndex) => {
151666
- (0, _array.arrayEach)(ascendingIndexes, (changedIndex, contiquesIndex) => {
151667
- rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
151668
- changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
151669
- });
151670
- });
151671
- instance.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
151672
- if (typeof this.headers !== 'undefined') {
151673
- (0, _array.arrayEach)(sortedHeaders, (headerData, columnIndex) => {
151674
- instance.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
151616
+ */
151617
+ class ColumnMoveAction extends _base.BaseAction {
151618
+ constructor(_ref) {
151619
+ let {
151620
+ columns,
151621
+ finalIndex
151622
+ } = _ref;
151623
+ super();
151624
+ /**
151625
+ * @param {number[]} columns An array with moved columns.
151626
+ */
151627
+ (0, _defineProperty2.default)(this, "columns", void 0);
151628
+ /**
151629
+ * @param {number} finalIndex The destination index.
151630
+ */
151631
+ (0, _defineProperty2.default)(this, "finalColumnIndex", void 0);
151632
+ this.columns = columns.slice();
151633
+ this.finalColumnIndex = finalIndex;
151634
+ }
151635
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151636
+ hot.addHook('beforeColumnMove', (columns, finalIndex) => {
151637
+ if (columns === false) {
151638
+ return;
151639
+ }
151640
+ undoRedoPlugin.done(() => new ColumnMoveAction({
151641
+ columns,
151642
+ finalIndex
151643
+ }));
151675
151644
  });
151676
151645
  }
151677
- this.removedCellMetas.forEach(_ref3 => {
151678
- let [rowIndex, columnIndex, cellMeta] = _ref3;
151679
- instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);
151680
- });
151681
- instance.batchExecution(() => {
151682
- // Restore row sequence in a case when all columns are removed. the original
151683
- // row sequence is lost in that case.
151684
- instance.rowIndexMapper.setIndexesSequence(this.rowPositions);
151685
- instance.columnIndexMapper.setIndexesSequence(this.columnPositions);
151686
- }, true);
151687
- instance.addHookOnce('afterViewRender', undoneCallback);
151688
- instance.render();
151689
- };
151690
- UndoRedo.RemoveColumnAction.prototype.redo = function (instance, redoneCallback) {
151691
- instance.addHookOnce('afterRemoveCol', redoneCallback);
151692
- instance.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');
151693
- };
151694
151646
 
151695
- /**
151696
- * Cell alignment action.
151697
- *
151698
- * @private
151699
- * @param {Array} stateBefore The previous state.
151700
- * @param {object} range The cell range.
151701
- * @param {string} type The type of the alignment ("top", "left", "bottom" or "right").
151702
- * @param {string} alignment The alignment CSS class.
151703
- */
151704
- UndoRedo.CellAlignmentAction = function (stateBefore, range, type, alignment) {
151705
- this.stateBefore = stateBefore;
151706
- this.range = range;
151707
- this.type = type;
151708
- this.alignment = alignment;
151709
- };
151710
- UndoRedo.CellAlignmentAction.prototype.undo = function (instance, undoneCallback) {
151711
- (0, _array.arrayEach)(this.range, range => {
151712
- range.forAll((row, col) => {
151713
- // Alignment classes should only collected within cell ranges. We skip header coordinates.
151714
- if (row >= 0 && col >= 0) {
151715
- instance.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
151647
+ /**
151648
+ * @param {Core} hot The Handsontable instance.
151649
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151650
+ */
151651
+ undo(hot, undoneCallback) {
151652
+ const manualColumnMove = hot.getPlugin('manualColumnMove');
151653
+ hot.addHookOnce('afterViewRender', undoneCallback);
151654
+ const columnMoves = (0, _moves.getMoves)(this.columns, this.finalColumnIndex, hot.columnIndexMapper.getNumberOfIndexes());
151655
+ columnMoves.reverse().forEach(_ref2 => {
151656
+ let {
151657
+ from,
151658
+ to
151659
+ } = _ref2;
151660
+ if (from < to) {
151661
+ to -= 1;
151716
151662
  }
151663
+ manualColumnMove.moveColumn(to, from);
151717
151664
  });
151718
- });
151719
- instance.addHookOnce('afterViewRender', undoneCallback);
151720
- instance.render();
151721
- };
151722
- UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback) {
151723
- (0, _utils.align)(this.range, this.type, this.alignment, (row, col) => instance.getCellMeta(row, col), (row, col, key, value) => instance.setCellMeta(row, col, key, value));
151724
- instance.addHookOnce('afterViewRender', undoneCallback);
151725
- instance.render();
151726
- };
151665
+ hot.render();
151666
+ hot.deselectCell();
151667
+ hot.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);
151668
+ }
151727
151669
 
151728
- /**
151729
- * Filters action.
151730
- *
151731
- * @private
151732
- * @param {Array} conditionsStack An array of the filter conditions.
151733
- * @param {Array} previousConditionsStack An array of the previous filter conditions.
151734
- */
151735
- UndoRedo.FiltersAction = function (conditionsStack, previousConditionsStack) {
151736
- this.previousConditionsStack = previousConditionsStack;
151737
- this.conditionsStack = conditionsStack;
151738
- this.actionType = 'filter';
151739
- };
151740
- (0, _object.inherit)(UndoRedo.FiltersAction, UndoRedo.Action);
151741
- UndoRedo.FiltersAction.prototype.undo = function (instance, undoneCallback) {
151742
- const filters = instance.getPlugin('filters');
151743
- instance.addHookOnce('afterViewRender', undoneCallback);
151744
- if (this.previousConditionsStack) {
151745
- filters.conditionCollection.importAllConditions(this.previousConditionsStack);
151746
- }
151747
- filters.filter();
151748
- };
151749
- UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
151750
- const filters = instance.getPlugin('filters');
151751
- instance.addHookOnce('afterViewRender', redoneCallback);
151752
- filters.conditionCollection.importAllConditions(this.conditionsStack);
151753
- filters.filter();
151754
- };
151670
+ /**
151671
+ * @param {Core} hot The Handsontable instance.
151672
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151673
+ */
151674
+ redo(hot, redoneCallback) {
151675
+ const manualColumnMove = hot.getPlugin('manualColumnMove');
151676
+ hot.addHookOnce('afterViewRender', redoneCallback);
151677
+ manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
151678
+ hot.render();
151679
+ hot.deselectCell();
151680
+ hot.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
151681
+ }
151682
+ }
151683
+ exports.ColumnMoveAction = ColumnMoveAction;
151684
+
151685
+ /***/ }),
151686
+ /* 1086 */
151687
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151688
+
151689
+ "use strict";
151755
151690
 
151691
+
151692
+ var _interopRequireDefault = __webpack_require__(197);
151693
+ exports.__esModule = true;
151694
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151695
+ var _base = __webpack_require__(1084);
151756
151696
  /**
151757
- * Merge Cells action.
151697
+ * Action that tracks column sort changes.
151758
151698
  *
151759
- * @util
151699
+ * @class ColumnSortAction
151700
+ * @private
151760
151701
  */
151761
- class MergeCellsAction extends UndoRedo.Action {
151762
- constructor(instance, cellRange) {
151702
+ class ColumnSortAction extends _base.BaseAction {
151703
+ constructor(_ref) {
151704
+ let {
151705
+ currentSortState,
151706
+ newSortState
151707
+ } = _ref;
151763
151708
  super();
151764
- this.cellRange = cellRange;
151765
- const topStartCorner = this.cellRange.getTopStartCorner();
151766
- const bottomEndCorner = this.cellRange.getBottomEndCorner();
151767
- this.rangeData = instance.getData(topStartCorner.row, topStartCorner.col, bottomEndCorner.row, bottomEndCorner.col);
151709
+ /**
151710
+ * @param {Array} currentSortState The current sort state.
151711
+ */
151712
+ (0, _defineProperty2.default)(this, "previousSortState", void 0);
151713
+ /**
151714
+ * @param {Array} newSortState The new sort state.
151715
+ */
151716
+ (0, _defineProperty2.default)(this, "nextSortState", void 0);
151717
+ this.previousSortState = currentSortState;
151718
+ this.nextSortState = newSortState;
151768
151719
  }
151769
- undo(instance, undoneCallback) {
151770
- const mergeCellsPlugin = instance.getPlugin('mergeCells');
151771
- instance.addHookOnce('afterViewRender', undoneCallback);
151772
- mergeCellsPlugin.unmergeRange(this.cellRange, true);
151773
- const topStartCorner = this.cellRange.getTopStartCorner();
151774
- instance.populateFromArray(topStartCorner.row, topStartCorner.col, this.rangeData, undefined, undefined, 'MergeCells');
151720
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151721
+ hot.addHook('beforeColumnSort', (currentSortState, newSortState, sortPossible) => {
151722
+ if (!sortPossible) {
151723
+ return;
151724
+ }
151725
+ undoRedoPlugin.done(() => new ColumnSortAction({
151726
+ currentSortState,
151727
+ newSortState
151728
+ }));
151729
+ });
151775
151730
  }
151776
- redo(instance, redoneCallback) {
151777
- const mergeCellsPlugin = instance.getPlugin('mergeCells');
151778
- instance.addHookOnce('afterViewRender', redoneCallback);
151779
- mergeCellsPlugin.mergeRange(this.cellRange);
151731
+
151732
+ /**
151733
+ * @param {Core} hot The Handsontable instance.
151734
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151735
+ */
151736
+ undo(hot, undoneCallback) {
151737
+ const sortPlugin = hot.getPlugin('columnSorting');
151738
+ const multiSortPlugin = hot.getPlugin('multiColumnSorting');
151739
+ const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
151740
+ if (this.previousSortState.length) {
151741
+ enabledSortPlugin.sort(this.previousSortState);
151742
+ } else {
151743
+ enabledSortPlugin.clearSort();
151744
+ }
151745
+ undoneCallback();
151746
+ }
151747
+
151748
+ /**
151749
+ * @param {Core} hot The Handsontable instance.
151750
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151751
+ */
151752
+ redo(hot, redoneCallback) {
151753
+ const sortPlugin = hot.getPlugin('columnSorting');
151754
+ const multiSortPlugin = hot.getPlugin('multiColumnSorting');
151755
+ const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
151756
+ enabledSortPlugin.sort(this.nextSortState);
151757
+ redoneCallback();
151780
151758
  }
151781
151759
  }
151782
- UndoRedo.MergeCellsAction = MergeCellsAction;
151760
+ exports.ColumnSortAction = ColumnSortAction;
151761
+
151762
+ /***/ }),
151763
+ /* 1087 */
151764
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151783
151765
 
151766
+ "use strict";
151767
+
151768
+
151769
+ var _interopRequireDefault = __webpack_require__(197);
151770
+ exports.__esModule = true;
151771
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151772
+ var _base = __webpack_require__(1084);
151784
151773
  /**
151785
- * Unmerge Cells action.
151774
+ * Action that tracks column creation.
151786
151775
  *
151787
- * @util
151776
+ * @class CreateColumnAction
151777
+ * @private
151788
151778
  */
151789
- class UnmergeCellsAction extends UndoRedo.Action {
151790
- constructor(instance, cellRange) {
151779
+ class CreateColumnAction extends _base.BaseAction {
151780
+ constructor(_ref) {
151781
+ let {
151782
+ index,
151783
+ amount
151784
+ } = _ref;
151791
151785
  super();
151792
- this.cellRange = cellRange;
151786
+ /**
151787
+ * @param {number} index The visual column index.
151788
+ */
151789
+ (0, _defineProperty2.default)(this, "index", void 0);
151790
+ /**
151791
+ * @param {number} amount The number of created columns.
151792
+ */
151793
+ (0, _defineProperty2.default)(this, "amount", void 0);
151794
+ this.index = index;
151795
+ this.amount = amount;
151793
151796
  }
151794
- undo(instance, undoneCallback) {
151795
- const mergeCellsPlugin = instance.getPlugin('mergeCells');
151796
- instance.addHookOnce('afterViewRender', undoneCallback);
151797
- mergeCellsPlugin.mergeRange(this.cellRange, true);
151797
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151798
+ hot.addHook('afterCreateCol', (index, amount, source) => {
151799
+ undoRedoPlugin.done(() => new CreateColumnAction({
151800
+ index,
151801
+ amount
151802
+ }), source);
151803
+ });
151798
151804
  }
151799
- redo(instance, redoneCallback) {
151800
- const mergeCellsPlugin = instance.getPlugin('mergeCells');
151801
- instance.addHookOnce('afterViewRender', redoneCallback);
151802
- mergeCellsPlugin.unmergeRange(this.cellRange, true);
151803
- instance.render();
151805
+
151806
+ /**
151807
+ * @param {Core} hot The Handsontable instance.
151808
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151809
+ */
151810
+ undo(hot, undoneCallback) {
151811
+ hot.addHookOnce('afterRemoveCol', undoneCallback);
151812
+ hot.alter('remove_col', this.index, this.amount, 'UndoRedo.undo');
151813
+ }
151814
+
151815
+ /**
151816
+ * @param {Core} hot The Handsontable instance.
151817
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151818
+ */
151819
+ redo(hot, redoneCallback) {
151820
+ hot.addHookOnce('afterCreateCol', redoneCallback);
151821
+ hot.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');
151804
151822
  }
151805
151823
  }
151806
- UndoRedo.UnmergeCellsAction = UnmergeCellsAction;
151824
+ exports.CreateColumnAction = CreateColumnAction;
151825
+
151826
+ /***/ }),
151827
+ /* 1088 */
151828
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151807
151829
 
151830
+ "use strict";
151831
+
151832
+
151833
+ var _interopRequireDefault = __webpack_require__(197);
151834
+ exports.__esModule = true;
151835
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151836
+ var _base = __webpack_require__(1084);
151808
151837
  /**
151809
- * ManualRowMove action.
151838
+ * Action that tracks row creation.
151810
151839
  *
151811
- * @TODO removeRow undo should works on logical index
151840
+ * @class CreateRowAction
151812
151841
  * @private
151813
- * @param {number[]} rows An array with moved rows.
151814
- * @param {number} finalIndex The destination index.
151815
151842
  */
151816
- UndoRedo.RowMoveAction = function (rows, finalIndex) {
151817
- this.rows = rows.slice();
151818
- this.finalRowIndex = finalIndex;
151819
- this.actionType = 'row_move';
151820
- };
151821
- (0, _object.inherit)(UndoRedo.RowMoveAction, UndoRedo.Action);
151822
- UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
151823
- const manualRowMove = instance.getPlugin('manualRowMove');
151824
- instance.addHookOnce('afterViewRender', undoneCallback);
151825
- const rowMoves = (0, _moves.getMoves)(this.rows, this.finalRowIndex, instance.rowIndexMapper.getNumberOfIndexes());
151826
- rowMoves.reverse().forEach(_ref4 => {
151843
+ class CreateRowAction extends _base.BaseAction {
151844
+ constructor(_ref) {
151827
151845
  let {
151828
- from,
151829
- to
151830
- } = _ref4;
151831
- if (from < to) {
151832
- to -= 1;
151846
+ index,
151847
+ amount
151848
+ } = _ref;
151849
+ super();
151850
+ /**
151851
+ * @param {number} index The visual row index.
151852
+ */
151853
+ (0, _defineProperty2.default)(this, "index", void 0);
151854
+ /**
151855
+ * @param {number} amount The number of created rows.
151856
+ */
151857
+ (0, _defineProperty2.default)(this, "amount", void 0);
151858
+ this.index = index;
151859
+ this.amount = amount;
151860
+ }
151861
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151862
+ hot.addHook('afterCreateRow', (index, amount, source) => {
151863
+ undoRedoPlugin.done(() => new CreateRowAction({
151864
+ index,
151865
+ amount
151866
+ }), source);
151867
+ });
151868
+ }
151869
+
151870
+ /**
151871
+ * @param {Core} hot The Handsontable instance.
151872
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151873
+ */
151874
+ undo(hot, undoneCallback) {
151875
+ const rowCount = hot.countRows();
151876
+ const minSpareRows = hot.getSettings().minSpareRows;
151877
+ if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
151878
+ this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
151833
151879
  }
151834
- manualRowMove.moveRow(to, from);
151835
- });
151836
- instance.render();
151837
- instance.deselectCell();
151838
- instance.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
151839
- };
151840
- UndoRedo.RowMoveAction.prototype.redo = function (instance, redoneCallback) {
151841
- const manualRowMove = instance.getPlugin('manualRowMove');
151842
- instance.addHookOnce('afterViewRender', redoneCallback);
151843
- manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
151844
- instance.render();
151845
- instance.deselectCell();
151846
- instance.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
151847
- };
151880
+ hot.addHookOnce('afterRemoveRow', undoneCallback);
151881
+ hot.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
151882
+ }
151883
+
151884
+ /**
151885
+ * @param {Core} hot The Handsontable instance.
151886
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151887
+ */
151888
+ redo(hot, redoneCallback) {
151889
+ hot.addHookOnce('afterCreateRow', redoneCallback);
151890
+ hot.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');
151891
+ }
151892
+ }
151893
+ exports.CreateRowAction = CreateRowAction;
151848
151894
 
151895
+ /***/ }),
151896
+ /* 1089 */
151897
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
151898
+
151899
+ "use strict";
151900
+
151901
+
151902
+ var _interopRequireDefault = __webpack_require__(197);
151903
+ exports.__esModule = true;
151904
+ __webpack_require__(283);
151905
+ __webpack_require__(311);
151906
+ __webpack_require__(519);
151907
+ __webpack_require__(530);
151908
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
151909
+ var _base = __webpack_require__(1084);
151910
+ var _object = __webpack_require__(499);
151911
+ var _array = __webpack_require__(495);
151849
151912
  /**
151850
- * ManualColumnMove action.
151913
+ * Action that tracks data changes.
151851
151914
  *
151915
+ * @class DataChangeAction
151852
151916
  * @private
151853
- * @param {number[]} columns An array with moved columns.
151854
- * @param {number} finalIndex The destination index.
151855
151917
  */
151856
- UndoRedo.ColumnMoveAction = function (columns, finalIndex) {
151857
- this.columns = columns.slice();
151858
- this.finalColumnIndex = finalIndex;
151859
- this.actionType = 'col_move';
151860
- };
151861
- (0, _object.inherit)(UndoRedo.ColumnMoveAction, UndoRedo.Action);
151862
- UndoRedo.ColumnMoveAction.prototype.undo = function (instance, undoneCallback) {
151863
- const manualColumnMove = instance.getPlugin('manualColumnMove');
151864
- instance.addHookOnce('afterViewRender', undoneCallback);
151865
- const columnMoves = (0, _moves.getMoves)(this.columns, this.finalColumnIndex, instance.columnIndexMapper.getNumberOfIndexes());
151866
- columnMoves.reverse().forEach(_ref5 => {
151918
+ class DataChangeAction extends _base.BaseAction {
151919
+ constructor(_ref) {
151867
151920
  let {
151868
- from,
151869
- to
151870
- } = _ref5;
151871
- if (from < to) {
151872
- to -= 1;
151921
+ changes,
151922
+ selected
151923
+ } = _ref;
151924
+ super();
151925
+ /**
151926
+ * @param {Array} changes 2D array containing information about each of the edited cells.
151927
+ */
151928
+ (0, _defineProperty2.default)(this, "changes", void 0);
151929
+ /**
151930
+ * @param {number[]} selected The cell selection.
151931
+ */
151932
+ (0, _defineProperty2.default)(this, "selected", void 0);
151933
+ this.changes = changes;
151934
+ this.selected = selected;
151935
+ }
151936
+ static startRegisteringEvents(hot, undoRedoPlugin) {
151937
+ hot.addHook('afterChange', function (changes, source) {
151938
+ const changesLen = changes && changes.length;
151939
+ if (!changesLen) {
151940
+ return;
151941
+ }
151942
+ const hasDifferences = changes.find(change => {
151943
+ const [,, oldValue, newValue] = change;
151944
+ return oldValue !== newValue;
151945
+ });
151946
+ if (!hasDifferences) {
151947
+ return;
151948
+ }
151949
+ const wrappedAction = () => {
151950
+ const clonedChanges = changes.reduce((arr, change) => {
151951
+ arr.push([...change]);
151952
+ return arr;
151953
+ }, []);
151954
+ (0, _array.arrayEach)(clonedChanges, change => {
151955
+ change[1] = hot.propToCol(change[1]);
151956
+ });
151957
+ const selected = changesLen > 1 ? this.getSelected() : [[clonedChanges[0][0], clonedChanges[0][1]]];
151958
+ return new DataChangeAction({
151959
+ changes: clonedChanges,
151960
+ selected
151961
+ });
151962
+ };
151963
+ undoRedoPlugin.done(wrappedAction, source);
151964
+ });
151965
+ }
151966
+
151967
+ /**
151968
+ * @param {Core} hot The Handsontable instance.
151969
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151970
+ */
151971
+ undo(hot, undoneCallback) {
151972
+ const data = (0, _object.deepClone)(this.changes);
151973
+ const emptyRowsAtTheEnd = hot.countEmptyRows(true);
151974
+ const emptyColsAtTheEnd = hot.countEmptyCols(true);
151975
+ for (let i = 0, len = data.length; i < len; i++) {
151976
+ data[i].splice(3, 1);
151873
151977
  }
151874
- manualColumnMove.moveColumn(to, from);
151875
- });
151876
- instance.render();
151877
- instance.deselectCell();
151878
- instance.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);
151879
- };
151880
- UndoRedo.ColumnMoveAction.prototype.redo = function (instance, redoneCallback) {
151881
- const manualColumnMove = instance.getPlugin('manualColumnMove');
151882
- instance.addHookOnce('afterViewRender', redoneCallback);
151883
- manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
151884
- instance.render();
151885
- instance.deselectCell();
151886
- instance.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
151887
- };
151978
+ hot.addHookOnce('afterChange', undoneCallback);
151979
+ hot.setDataAtCell(data, null, null, 'UndoRedo.undo');
151980
+ for (let i = 0, len = data.length; i < len; i++) {
151981
+ const [row, column] = data[i];
151982
+ if (hot.getSettings().minSpareRows && row + 1 + hot.getSettings().minSpareRows === hot.countRows() && emptyRowsAtTheEnd === hot.getSettings().minSpareRows) {
151983
+ hot.alter('remove_row', parseInt(row + 1, 10), hot.getSettings().minSpareRows);
151984
+ hot.getPlugin('undoRedo').doneActions.pop();
151985
+ }
151986
+ if (hot.getSettings().minSpareCols && column + 1 + hot.getSettings().minSpareCols === hot.countCols() && emptyColsAtTheEnd === hot.getSettings().minSpareCols) {
151987
+ hot.alter('remove_col', parseInt(column + 1, 10), hot.getSettings().minSpareCols);
151988
+ hot.getPlugin('undoRedo').doneActions.pop();
151989
+ }
151990
+ }
151991
+ hot.scrollToFocusedCell();
151992
+ hot.selectCells(this.selected, false, false);
151993
+ }
151888
151994
 
151889
- /**
151890
- * ColumnSort action.
151891
- *
151892
- * @private
151893
- * @param {Array} currentSortState The current sort state.
151894
- * @param {Array} newSortState The new sort state.
151895
- */
151896
- UndoRedo.ColumnSortAction = function (currentSortState, newSortState) {
151897
- this.previousSortState = currentSortState;
151898
- this.nextSortState = newSortState;
151899
- };
151900
- (0, _object.inherit)(UndoRedo.ColumnSortAction, UndoRedo.Action);
151901
- UndoRedo.ColumnSortAction.prototype.undo = function (instance, undoneCallback) {
151902
- const sortPlugin = instance.getPlugin('columnSorting');
151903
- const multiSortPlugin = instance.getPlugin('multiColumnSorting');
151904
- const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
151905
- if (this.previousSortState.length) {
151906
- enabledSortPlugin.sort(this.previousSortState);
151907
- } else {
151908
- enabledSortPlugin.clearSort();
151995
+ /**
151996
+ * @param {Core} hot The Handsontable instance.
151997
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
151998
+ */
151999
+ redo(hot, redoneCallback) {
152000
+ const data = (0, _object.deepClone)(this.changes);
152001
+ for (let i = 0, len = data.length; i < len; i++) {
152002
+ data[i].splice(2, 1);
152003
+ }
152004
+ hot.addHookOnce('afterChange', redoneCallback);
152005
+ hot.setDataAtCell(data, null, null, 'UndoRedo.redo');
152006
+ if (this.selected) {
152007
+ hot.selectCells(this.selected, false, false);
152008
+ }
151909
152009
  }
151910
- undoneCallback();
151911
- };
151912
- UndoRedo.ColumnSortAction.prototype.redo = function (instance, redoneCallback) {
151913
- const sortPlugin = instance.getPlugin('columnSorting');
151914
- const multiSortPlugin = instance.getPlugin('multiColumnSorting');
151915
- const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
151916
- enabledSortPlugin.sort(this.nextSortState);
151917
- redoneCallback();
151918
- };
152010
+ }
152011
+ exports.DataChangeAction = DataChangeAction;
151919
152012
 
152013
+ /***/ }),
152014
+ /* 1090 */
152015
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152016
+
152017
+ "use strict";
152018
+
152019
+
152020
+ var _interopRequireDefault = __webpack_require__(197);
152021
+ exports.__esModule = true;
152022
+ __webpack_require__(311);
152023
+ __webpack_require__(323);
152024
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152025
+ var _base = __webpack_require__(1084);
151920
152026
  /**
151921
- * Enabling and disabling plugin and attaching its to an instance.
152027
+ * Action that tracks filter changes.
151922
152028
  *
152029
+ * @class FiltersAction
151923
152030
  * @private
151924
152031
  */
151925
- UndoRedo.prototype.init = function () {
151926
- const settings = this.instance.getSettings().undo;
151927
- const pluginEnabled = typeof settings === 'undefined' || settings;
151928
- if (!this.instance.undoRedo) {
151929
- this.instance.undoRedo = this;
152032
+ class FiltersAction extends _base.BaseAction {
152033
+ constructor(_ref) {
152034
+ let {
152035
+ conditionsStack,
152036
+ previousConditionsStack
152037
+ } = _ref;
152038
+ super();
152039
+ /**
152040
+ * @param {Array} previousConditionsStack An array of the previous filter conditions.
152041
+ */
152042
+ (0, _defineProperty2.default)(this, "conditionsStack", void 0);
152043
+ /**
152044
+ * @param {Array} conditionsStack An array of the filter conditions.
152045
+ */
152046
+ (0, _defineProperty2.default)(this, "previousConditionsStack", void 0);
152047
+ this.conditionsStack = conditionsStack;
152048
+ this.previousConditionsStack = previousConditionsStack;
151930
152049
  }
151931
- if (pluginEnabled) {
151932
- this.instance.undoRedo.enable();
151933
- } else {
151934
- this.instance.undoRedo.disable();
152050
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152051
+ hot.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
152052
+ undoRedoPlugin.done(() => new FiltersAction({
152053
+ conditionsStack,
152054
+ previousConditionsStack
152055
+ }));
152056
+ });
151935
152057
  }
151936
- };
151937
152058
 
151938
- /**
151939
- * Registers shortcuts responsible for performing undo/redo.
151940
- *
151941
- * @private
151942
- */
151943
- UndoRedo.prototype.registerShortcuts = function () {
151944
- const shortcutManager = this.instance.getShortcutManager();
151945
- const gridContext = shortcutManager.getContext('grid');
151946
- const runOnlyIf = event => {
151947
- return !event.altKey; // right ALT in some systems triggers ALT+CTR
151948
- };
151949
- const config = {
151950
- runOnlyIf,
151951
- group: SHORTCUTS_GROUP
151952
- };
151953
- gridContext.addShortcuts([{
151954
- keys: [['Control/Meta', 'z']],
151955
- callback: () => {
151956
- this.undo();
151957
- }
151958
- }, {
151959
- keys: [['Control/Meta', 'y'], ['Control/Meta', 'Shift', 'z']],
151960
- callback: () => {
151961
- this.redo();
152059
+ /**
152060
+ * @param {Core} hot The Handsontable instance.
152061
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
152062
+ */
152063
+ undo(hot, undoneCallback) {
152064
+ const filters = hot.getPlugin('filters');
152065
+ hot.addHookOnce('afterViewRender', undoneCallback);
152066
+ if (this.previousConditionsStack) {
152067
+ filters.conditionCollection.importAllConditions(this.previousConditionsStack);
151962
152068
  }
151963
- }], config);
151964
- };
152069
+ filters.filter();
152070
+ }
152071
+
152072
+ /**
152073
+ * @param {Core} hot The Handsontable instance.
152074
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152075
+ */
152076
+ redo(hot, redoneCallback) {
152077
+ const filters = hot.getPlugin('filters');
152078
+ hot.addHookOnce('afterViewRender', redoneCallback);
152079
+ filters.conditionCollection.importAllConditions(this.conditionsStack);
152080
+ filters.filter();
152081
+ }
152082
+ }
152083
+ exports.FiltersAction = FiltersAction;
152084
+
152085
+ /***/ }),
152086
+ /* 1091 */
152087
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152088
+
152089
+ "use strict";
152090
+
151965
152091
 
152092
+ var _interopRequireDefault = __webpack_require__(197);
152093
+ exports.__esModule = true;
152094
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152095
+ var _base = __webpack_require__(1084);
151966
152096
  /**
151967
- * Unregister shortcuts responsible for performing undo/redo.
152097
+ * Action that tracks changes in merged cells.
151968
152098
  *
152099
+ * @class MergeCellsAction
151969
152100
  * @private
151970
152101
  */
151971
- UndoRedo.prototype.unregisterShortcuts = function () {
151972
- const shortcutManager = this.instance.getShortcutManager();
151973
- const gridContext = shortcutManager.getContext('grid');
151974
- gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
151975
- };
151976
-
151977
- /**
151978
- * @param {Array} changes 2D array containing information about each of the edited cells.
151979
- * @param {string} source String that identifies source of hook call.
151980
- * @returns {boolean}
151981
- */
151982
- function onAfterChange(changes, source) {
151983
- const instance = this;
151984
- if (source === 'loadData') {
151985
- return instance.undoRedo.clear();
152102
+ class MergeCellsAction extends _base.BaseAction {
152103
+ constructor(_ref) {
152104
+ let {
152105
+ data,
152106
+ cellRange
152107
+ } = _ref;
152108
+ super();
152109
+ (0, _defineProperty2.default)(this, "cellRange", void 0);
152110
+ this.cellRange = cellRange;
152111
+ this.data = data;
152112
+ }
152113
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152114
+ hot.addHook('beforeMergeCells', (cellRange, auto) => {
152115
+ if (auto) {
152116
+ return;
152117
+ }
152118
+ const topStartCorner = cellRange.getTopStartCorner();
152119
+ const bottomEndCorner = cellRange.getBottomEndCorner();
152120
+ const data = hot.getData(topStartCorner.row, topStartCorner.col, bottomEndCorner.row, bottomEndCorner.col);
152121
+ undoRedoPlugin.done(() => new MergeCellsAction({
152122
+ data,
152123
+ cellRange
152124
+ }));
152125
+ });
151986
152126
  }
151987
- }
151988
152127
 
151989
- /**
151990
- * @param {Core} instance The Handsontable instance.
151991
- */
151992
- function exposeUndoRedoMethods(instance) {
151993
152128
  /**
151994
- * {@link UndoRedo#undo}.
151995
- *
151996
- * @alias undo
151997
- * @memberof! Core#
151998
- * @returns {boolean}
152129
+ * @param {Core} hot The Handsontable instance.
152130
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
151999
152131
  */
152000
- instance.undo = function () {
152001
- return instance.undoRedo.undo();
152002
- };
152132
+ undo(hot, undoneCallback) {
152133
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
152134
+ hot.addHookOnce('afterViewRender', undoneCallback);
152135
+ mergeCellsPlugin.unmergeRange(this.cellRange, true);
152136
+ const topStartCorner = this.cellRange.getTopStartCorner();
152137
+ hot.populateFromArray(topStartCorner.row, topStartCorner.col, this.data, undefined, undefined, 'MergeCells');
152138
+ }
152003
152139
 
152004
152140
  /**
152005
- * {@link UndoRedo#redo}.
152006
- *
152007
- * @alias redo
152008
- * @memberof! Core#
152009
- * @returns {boolean}
152141
+ * @param {Core} hot The Handsontable instance.
152142
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152010
152143
  */
152011
- instance.redo = function () {
152012
- return instance.undoRedo.redo();
152013
- };
152144
+ redo(hot, redoneCallback) {
152145
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
152146
+ hot.addHookOnce('afterViewRender', redoneCallback);
152147
+ mergeCellsPlugin.mergeRange(this.cellRange);
152148
+ }
152149
+ }
152150
+ exports.MergeCellsAction = MergeCellsAction;
152014
152151
 
152015
- /**
152016
- * {@link UndoRedo#isUndoAvailable}.
152017
- *
152018
- * @alias isUndoAvailable
152019
- * @memberof! Core#
152020
- * @returns {boolean}
152021
- */
152022
- instance.isUndoAvailable = function () {
152023
- return instance.undoRedo.isUndoAvailable();
152024
- };
152152
+ /***/ }),
152153
+ /* 1092 */
152154
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152155
+
152156
+ "use strict";
152157
+
152158
+
152159
+ var _interopRequireDefault = __webpack_require__(197);
152160
+ exports.__esModule = true;
152161
+ __webpack_require__(283);
152162
+ __webpack_require__(311);
152163
+ __webpack_require__(329);
152164
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152165
+ var _base = __webpack_require__(1084);
152166
+ var _utils = __webpack_require__(1093);
152167
+ var _number = __webpack_require__(534);
152168
+ var _array = __webpack_require__(495);
152169
+ /**
152170
+ * Action that tracks changes in column removal.
152171
+ *
152172
+ * @class RemoveColumnAction
152173
+ * @private
152174
+ */
152175
+ class RemoveColumnAction extends _base.BaseAction {
152176
+ constructor(_ref) {
152177
+ let {
152178
+ index,
152179
+ indexes,
152180
+ data,
152181
+ headers,
152182
+ columnPositions,
152183
+ rowPositions,
152184
+ fixedColumnsStart,
152185
+ removedCellMetas
152186
+ } = _ref;
152187
+ super();
152188
+ /**
152189
+ * @param {number} index The visual column index.
152190
+ */
152191
+ (0, _defineProperty2.default)(this, "index", void 0);
152192
+ /**
152193
+ * @param {number[]} indexes The visual column indexes.
152194
+ */
152195
+ (0, _defineProperty2.default)(this, "indexes", void 0);
152196
+ /**
152197
+ * @param {Array} data The removed data.
152198
+ */
152199
+ (0, _defineProperty2.default)(this, "data", void 0);
152200
+ /**
152201
+ * @param {number} amount The number of removed columns.
152202
+ */
152203
+ (0, _defineProperty2.default)(this, "amount", void 0);
152204
+ /**
152205
+ * @param {Array} headers The header values.
152206
+ */
152207
+ (0, _defineProperty2.default)(this, "headers", void 0);
152208
+ /**
152209
+ * @param {number[]} columnPositions The column position.
152210
+ */
152211
+ (0, _defineProperty2.default)(this, "columnPositions", void 0);
152212
+ /**
152213
+ * @param {number[]} rowPositions The row position.
152214
+ */
152215
+ (0, _defineProperty2.default)(this, "rowPositions", void 0);
152216
+ /**
152217
+ * @param {number} fixedColumnsStart Number of fixed columns on the left. Remove column action change it sometimes.
152218
+ */
152219
+ (0, _defineProperty2.default)(this, "fixedColumnsStart", void 0);
152220
+ /**
152221
+ * @param {Array} removedCellMetas List of removed cell metas.
152222
+ */
152223
+ (0, _defineProperty2.default)(this, "removedCellMetas", void 0);
152224
+ this.index = index;
152225
+ this.indexes = indexes;
152226
+ this.data = data;
152227
+ this.amount = this.data[0].length;
152228
+ this.headers = headers;
152229
+ this.columnPositions = columnPositions.slice(0);
152230
+ this.rowPositions = rowPositions.slice(0);
152231
+ this.fixedColumnsStart = fixedColumnsStart;
152232
+ this.removedCellMetas = removedCellMetas;
152233
+ }
152234
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152235
+ hot.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {
152236
+ const wrappedAction = () => {
152237
+ const originalData = hot.getSourceDataArray();
152238
+ const columnIndex = (hot.countCols() + index) % hot.countCols();
152239
+ const lastColumnIndex = columnIndex + amount - 1;
152240
+ const removedData = [];
152241
+ const headers = [];
152242
+ const indexes = [];
152243
+ (0, _number.rangeEach)(originalData.length - 1, i => {
152244
+ const column = [];
152245
+ const origRow = originalData[i];
152246
+ (0, _number.rangeEach)(columnIndex, lastColumnIndex, j => {
152247
+ column.push(origRow[hot.toPhysicalColumn(j)]);
152248
+ });
152249
+ removedData.push(column);
152250
+ });
152251
+ (0, _number.rangeEach)(amount - 1, i => {
152252
+ indexes.push(hot.toPhysicalColumn(columnIndex + i));
152253
+ });
152254
+ if (Array.isArray(hot.getSettings().colHeaders)) {
152255
+ (0, _number.rangeEach)(amount - 1, i => {
152256
+ headers.push(hot.getSettings().colHeaders[hot.toPhysicalColumn(columnIndex + i)] || null);
152257
+ });
152258
+ }
152259
+ const columnsMap = hot.columnIndexMapper.getIndexesSequence();
152260
+ const rowsMap = hot.rowIndexMapper.getIndexesSequence();
152261
+ return new RemoveColumnAction({
152262
+ index: columnIndex,
152263
+ indexes,
152264
+ data: removedData,
152265
+ headers,
152266
+ columnPositions: columnsMap,
152267
+ rowPositions: rowsMap,
152268
+ fixedColumnsStart: hot.getSettings().fixedColumnsStart,
152269
+ removedCellMetas: (0, _utils.getCellMetas)(hot, 0, hot.countRows(), columnIndex, lastColumnIndex)
152270
+ });
152271
+ };
152272
+ undoRedoPlugin.done(wrappedAction, source);
152273
+ });
152274
+ }
152025
152275
 
152026
152276
  /**
152027
- * {@link UndoRedo#isRedoAvailable}.
152028
- *
152029
- * @alias isRedoAvailable
152030
- * @memberof! Core#
152031
- * @returns {boolean}
152277
+ * @param {Core} hot The Handsontable instance.
152278
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
152032
152279
  */
152033
- instance.isRedoAvailable = function () {
152034
- return instance.undoRedo.isRedoAvailable();
152035
- };
152280
+ undo(hot, undoneCallback) {
152281
+ const settings = hot.getSettings();
152282
+
152283
+ // Changing by the reference as `updateSettings` doesn't work the best.
152284
+ settings.fixedColumnsStart = this.fixedColumnsStart;
152285
+ const ascendingIndexes = this.indexes.slice(0).sort();
152286
+ const sortByIndexes = (elem, j, arr) => arr[this.indexes.indexOf(ascendingIndexes[j])];
152287
+ const removedDataLength = this.data.length;
152288
+ const sortedData = [];
152289
+ for (let rowIndex = 0; rowIndex < removedDataLength; rowIndex++) {
152290
+ sortedData.push((0, _array.arrayMap)(this.data[rowIndex], sortByIndexes));
152291
+ }
152292
+ const sortedHeaders = (0, _array.arrayMap)(this.headers, sortByIndexes);
152293
+ const changes = [];
152294
+ hot.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
152295
+ (0, _array.arrayEach)(hot.getSourceDataArray(), (rowData, rowIndex) => {
152296
+ (0, _array.arrayEach)(ascendingIndexes, (changedIndex, contiquesIndex) => {
152297
+ rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
152298
+ changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
152299
+ });
152300
+ });
152301
+ hot.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
152302
+ if (typeof this.headers !== 'undefined') {
152303
+ (0, _array.arrayEach)(sortedHeaders, (headerData, columnIndex) => {
152304
+ hot.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
152305
+ });
152306
+ }
152307
+ this.removedCellMetas.forEach(_ref2 => {
152308
+ let [rowIndex, columnIndex, cellMeta] = _ref2;
152309
+ hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
152310
+ });
152311
+ hot.batchExecution(() => {
152312
+ // Restore row sequence in a case when all columns are removed. the original
152313
+ // row sequence is lost in that case.
152314
+ hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
152315
+ hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
152316
+ }, true);
152317
+ hot.addHookOnce('afterViewRender', undoneCallback);
152318
+ hot.render();
152319
+ }
152036
152320
 
152037
152321
  /**
152038
- * {@link UndoRedo#clear}.
152039
- *
152040
- * @alias clearUndo
152041
- * @memberof! Core#
152042
- * @returns {boolean}
152322
+ * @param {Core} hot The Handsontable instance.
152323
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152043
152324
  */
152044
- instance.clearUndo = function () {
152045
- return instance.undoRedo.clear();
152046
- };
152325
+ redo(hot, redoneCallback) {
152326
+ hot.addHookOnce('afterRemoveCol', redoneCallback);
152327
+ hot.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');
152328
+ }
152047
152329
  }
152330
+ exports.RemoveColumnAction = RemoveColumnAction;
152331
+
152332
+ /***/ }),
152333
+ /* 1093 */
152334
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152335
+
152336
+ "use strict";
152337
+
152048
152338
 
152339
+ exports.__esModule = true;
152340
+ exports.getCellMetas = getCellMetas;
152341
+ __webpack_require__(283);
152342
+ __webpack_require__(1094);
152343
+ __webpack_require__(311);
152344
+ __webpack_require__(323);
152345
+ var _number = __webpack_require__(534);
152049
152346
  /**
152050
- * @param {Core} instance The Handsontable instance.
152051
- */
152052
- function removeExposedUndoRedoMethods(instance) {
152053
- delete instance.undo;
152054
- delete instance.redo;
152055
- delete instance.isUndoAvailable;
152056
- delete instance.isRedoAvailable;
152057
- delete instance.clearUndo;
152058
- }
152059
- const hook = _hooks.Hooks.getSingleton();
152060
- hook.add('afterUpdateSettings', function () {
152061
- var _this$getPlugin;
152062
- (_this$getPlugin = this.getPlugin('undoRedo')) === null || _this$getPlugin === void 0 || _this$getPlugin.init();
152063
- });
152064
- hook.register('beforeUndo');
152065
- hook.register('afterUndo');
152066
- hook.register('beforeRedo');
152067
- hook.register('afterRedo');
152068
- UndoRedo.PLUGIN_KEY = PLUGIN_KEY;
152069
- UndoRedo.SETTING_KEYS = true;
152070
- var _default = exports["default"] = UndoRedo;
152347
+ * Gets all cell metas from the provided range.
152348
+ *
152349
+ * @param {Core} hot The Handsontable instance.
152350
+ * @param {number} fromRow The starting row index.
152351
+ * @param {number} toRow The ending row index.
152352
+ * @param {number} fromColumn The starting column index.
152353
+ * @param {number} toColumn The ending column index.
152354
+ * @returns {Array} Returns an array of cell metas.
152355
+ */
152356
+ function getCellMetas(hot, fromRow, toRow, fromColumn, toColumn) {
152357
+ const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];
152358
+ const genericKeysLength = genericKeys.length;
152359
+ const cellMetas = [];
152360
+ (0, _number.rangeEach)(fromColumn, toColumn, columnIndex => {
152361
+ (0, _number.rangeEach)(fromRow, toRow, rowIndex => {
152362
+ const cellMeta = hot.getCellMeta(rowIndex, columnIndex);
152363
+ if (Object.keys(cellMeta).length !== genericKeysLength) {
152364
+ const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {
152365
+ let [key] = _ref;
152366
+ return genericKeys.includes(key) === false;
152367
+ }));
152368
+ cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);
152369
+ }
152370
+ });
152371
+ });
152372
+ return cellMetas;
152373
+ }
152071
152374
 
152072
152375
  /***/ }),
152073
- /* 1082 */
152376
+ /* 1094 */
152074
152377
  /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
152075
152378
 
152076
152379
  "use strict";
@@ -152093,7 +152396,278 @@ $({ target: 'Object', stat: true }, {
152093
152396
 
152094
152397
 
152095
152398
  /***/ }),
152096
- /* 1083 */
152399
+ /* 1095 */
152400
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152401
+
152402
+ "use strict";
152403
+
152404
+
152405
+ var _interopRequireDefault = __webpack_require__(197);
152406
+ exports.__esModule = true;
152407
+ __webpack_require__(283);
152408
+ __webpack_require__(311);
152409
+ __webpack_require__(329);
152410
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152411
+ var _base = __webpack_require__(1084);
152412
+ var _utils = __webpack_require__(1093);
152413
+ var _object = __webpack_require__(499);
152414
+ /**
152415
+ * Action that tracks changes in row removal.
152416
+ *
152417
+ * @class RemoveRowAction
152418
+ * @private
152419
+ */
152420
+ class RemoveRowAction extends _base.BaseAction {
152421
+ constructor(_ref) {
152422
+ let {
152423
+ index,
152424
+ data,
152425
+ fixedRowsBottom,
152426
+ fixedRowsTop,
152427
+ rowIndexesSequence,
152428
+ removedCellMetas
152429
+ } = _ref;
152430
+ super();
152431
+ /**
152432
+ * @param {number} index The visual row index.
152433
+ */
152434
+ (0, _defineProperty2.default)(this, "index", void 0);
152435
+ /**
152436
+ * @param {Array} data The removed data.
152437
+ */
152438
+ (0, _defineProperty2.default)(this, "data", void 0);
152439
+ /**
152440
+ * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
152441
+ */
152442
+ (0, _defineProperty2.default)(this, "fixedRowsBottom", void 0);
152443
+ /**
152444
+ * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
152445
+ */
152446
+ (0, _defineProperty2.default)(this, "fixedRowsTop", void 0);
152447
+ /**
152448
+ * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
152449
+ */
152450
+ (0, _defineProperty2.default)(this, "rowIndexesSequence", void 0);
152451
+ /**
152452
+ * @param {Array} removedCellMetas List of removed cell metas.
152453
+ */
152454
+ (0, _defineProperty2.default)(this, "removedCellMetas", void 0);
152455
+ this.index = index;
152456
+ this.data = data;
152457
+ this.fixedRowsBottom = fixedRowsBottom;
152458
+ this.fixedRowsTop = fixedRowsTop;
152459
+ this.rowIndexesSequence = rowIndexesSequence;
152460
+ this.removedCellMetas = removedCellMetas;
152461
+ }
152462
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152463
+ hot.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
152464
+ const wrappedAction = () => {
152465
+ const physicalRowIndex = hot.toPhysicalRow(index);
152466
+ const lastRowIndex = physicalRowIndex + amount - 1;
152467
+ const removedData = (0, _object.deepClone)(hot.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, hot.countSourceCols() - 1));
152468
+ return new RemoveRowAction({
152469
+ index: physicalRowIndex,
152470
+ data: removedData,
152471
+ fixedRowsBottom: hot.getSettings().fixedRowsBottom,
152472
+ fixedRowsTop: hot.getSettings().fixedRowsTop,
152473
+ rowIndexesSequence: hot.rowIndexMapper.getIndexesSequence(),
152474
+ removedCellMetas: (0, _utils.getCellMetas)(hot, physicalRowIndex, lastRowIndex, 0, hot.countCols() - 1)
152475
+ });
152476
+ };
152477
+ undoRedoPlugin.done(wrappedAction, source);
152478
+ });
152479
+ }
152480
+
152481
+ /**
152482
+ * @param {Core} hot The Handsontable instance.
152483
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
152484
+ */
152485
+ undo(hot, undoneCallback) {
152486
+ const settings = hot.getSettings();
152487
+ const changes = [];
152488
+
152489
+ // Changing by the reference as `updateSettings` doesn't work the best.
152490
+ settings.fixedRowsBottom = this.fixedRowsBottom;
152491
+ settings.fixedRowsTop = this.fixedRowsTop;
152492
+
152493
+ // Prepare the change list to fill the source data.
152494
+ this.data.forEach((dataRow, rowIndexDelta) => {
152495
+ Object.keys(dataRow).forEach(columnProp => {
152496
+ const columnIndex = parseInt(columnProp, 10);
152497
+ changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
152498
+ });
152499
+ });
152500
+ hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
152501
+ this.removedCellMetas.forEach(_ref2 => {
152502
+ let [rowIndex, columnIndex, cellMeta] = _ref2;
152503
+ hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
152504
+ });
152505
+ hot.addHookOnce('afterViewRender', undoneCallback);
152506
+ hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
152507
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
152508
+ }
152509
+
152510
+ /**
152511
+ * @param {Core} hot The Handsontable instance.
152512
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152513
+ */
152514
+ redo(hot, redoneCallback) {
152515
+ hot.addHookOnce('afterRemoveRow', redoneCallback);
152516
+ hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
152517
+ }
152518
+ }
152519
+ exports.RemoveRowAction = RemoveRowAction;
152520
+
152521
+ /***/ }),
152522
+ /* 1096 */
152523
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152524
+
152525
+ "use strict";
152526
+
152527
+
152528
+ var _interopRequireDefault = __webpack_require__(197);
152529
+ exports.__esModule = true;
152530
+ __webpack_require__(311);
152531
+ __webpack_require__(329);
152532
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152533
+ var _base = __webpack_require__(1084);
152534
+ var _moves = __webpack_require__(993);
152535
+ /**
152536
+ * Action that tracks row move changes.
152537
+ *
152538
+ * @class RowMoveAction
152539
+ * @private
152540
+ */
152541
+ class RowMoveAction extends _base.BaseAction {
152542
+ constructor(_ref) {
152543
+ let {
152544
+ rows,
152545
+ finalIndex
152546
+ } = _ref;
152547
+ super();
152548
+ /**
152549
+ * @param {number[]} rows An array with moved rows.
152550
+ */
152551
+ (0, _defineProperty2.default)(this, "rows", void 0);
152552
+ /**
152553
+ * @param {number} finalIndex The destination index.
152554
+ */
152555
+ (0, _defineProperty2.default)(this, "finalRowIndex", void 0);
152556
+ this.rows = rows.slice();
152557
+ this.finalRowIndex = finalIndex;
152558
+ }
152559
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152560
+ hot.addHook('beforeRowMove', (rows, finalIndex) => {
152561
+ if (rows === false) {
152562
+ return;
152563
+ }
152564
+ undoRedoPlugin.done(() => new RowMoveAction({
152565
+ rows,
152566
+ finalIndex
152567
+ }));
152568
+ });
152569
+ }
152570
+
152571
+ /**
152572
+ * @param {Core} hot The Handsontable instance.
152573
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
152574
+ */
152575
+ undo(hot, undoneCallback) {
152576
+ const manualRowMove = hot.getPlugin('manualRowMove');
152577
+ hot.addHookOnce('afterViewRender', undoneCallback);
152578
+ const rowMoves = (0, _moves.getMoves)(this.rows, this.finalRowIndex, hot.rowIndexMapper.getNumberOfIndexes());
152579
+ rowMoves.reverse().forEach(_ref2 => {
152580
+ let {
152581
+ from,
152582
+ to
152583
+ } = _ref2;
152584
+ if (from < to) {
152585
+ to -= 1;
152586
+ }
152587
+ manualRowMove.moveRow(to, from);
152588
+ });
152589
+ hot.render();
152590
+ hot.deselectCell();
152591
+ hot.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
152592
+ }
152593
+
152594
+ /**
152595
+ * @param {Core} hot The Handsontable instance.
152596
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152597
+ */
152598
+ redo(hot, redoneCallback) {
152599
+ const manualRowMove = hot.getPlugin('manualRowMove');
152600
+ hot.addHookOnce('afterViewRender', redoneCallback);
152601
+ manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
152602
+ hot.render();
152603
+ hot.deselectCell();
152604
+ hot.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
152605
+ }
152606
+ }
152607
+ exports.RowMoveAction = RowMoveAction;
152608
+
152609
+ /***/ }),
152610
+ /* 1097 */
152611
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152612
+
152613
+ "use strict";
152614
+
152615
+
152616
+ var _interopRequireDefault = __webpack_require__(197);
152617
+ exports.__esModule = true;
152618
+ var _defineProperty2 = _interopRequireDefault(__webpack_require__(504));
152619
+ var _base = __webpack_require__(1084);
152620
+ /**
152621
+ * Action that tracks changes in merged cells.
152622
+ *
152623
+ * @class UnmergeCellsAction
152624
+ * @private
152625
+ */
152626
+ class UnmergeCellsAction extends _base.BaseAction {
152627
+ constructor(_ref) {
152628
+ let {
152629
+ cellRange
152630
+ } = _ref;
152631
+ super();
152632
+ (0, _defineProperty2.default)(this, "cellRange", void 0);
152633
+ this.cellRange = cellRange;
152634
+ }
152635
+ static startRegisteringEvents(hot, undoRedoPlugin) {
152636
+ hot.addHook('afterUnmergeCells', (cellRange, auto) => {
152637
+ if (auto) {
152638
+ return;
152639
+ }
152640
+ undoRedoPlugin.done(() => new UnmergeCellsAction({
152641
+ cellRange
152642
+ }));
152643
+ });
152644
+ }
152645
+
152646
+ /**
152647
+ * @param {Core} hot The Handsontable instance.
152648
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
152649
+ */
152650
+ undo(hot, undoneCallback) {
152651
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
152652
+ hot.addHookOnce('afterViewRender', undoneCallback);
152653
+ mergeCellsPlugin.mergeRange(this.cellRange, true);
152654
+ }
152655
+
152656
+ /**
152657
+ * @param {Core} hot The Handsontable instance.
152658
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
152659
+ */
152660
+ redo(hot, redoneCallback) {
152661
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
152662
+ hot.addHookOnce('afterViewRender', redoneCallback);
152663
+ mergeCellsPlugin.unmergeRange(this.cellRange, true);
152664
+ hot.render();
152665
+ }
152666
+ }
152667
+ exports.UnmergeCellsAction = UnmergeCellsAction;
152668
+
152669
+ /***/ }),
152670
+ /* 1098 */
152097
152671
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
152098
152672
 
152099
152673
  "use strict";