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.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +1 -7
- package/core.mjs +1 -7
- package/dataMap/metaManager/metaSchema.js +2 -3
- package/dataMap/metaManager/metaSchema.mjs +2 -3
- package/dist/handsontable.css +12 -2
- package/dist/handsontable.full.css +12 -2
- package/dist/handsontable.full.js +1438 -864
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +9 -7
- package/dist/handsontable.js +1437 -863
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +35 -33
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/base/base.js +0 -7
- package/plugins/base/base.mjs +0 -7
- package/plugins/undoRedo/actions/_base.js +19 -0
- package/plugins/undoRedo/actions/_base.mjs +15 -0
- package/plugins/undoRedo/actions/cellAlignment.js +85 -0
- package/plugins/undoRedo/actions/cellAlignment.mjs +81 -0
- package/plugins/undoRedo/actions/columnMove.js +84 -0
- package/plugins/undoRedo/actions/columnMove.mjs +80 -0
- package/plugins/undoRedo/actions/columnSort.js +73 -0
- package/plugins/undoRedo/actions/columnSort.mjs +69 -0
- package/plugins/undoRedo/actions/createColumn.js +60 -0
- package/plugins/undoRedo/actions/createColumn.mjs +56 -0
- package/plugins/undoRedo/actions/createRow.js +65 -0
- package/plugins/undoRedo/actions/createRow.mjs +61 -0
- package/plugins/undoRedo/actions/dataChange.js +114 -0
- package/plugins/undoRedo/actions/dataChange.mjs +110 -0
- package/plugins/undoRedo/actions/filters.js +68 -0
- package/plugins/undoRedo/actions/filters.mjs +64 -0
- package/plugins/undoRedo/actions/index.js +27 -0
- package/plugins/undoRedo/actions/index.mjs +23 -0
- package/plugins/undoRedo/actions/mergeCells.js +63 -0
- package/plugins/undoRedo/actions/mergeCells.mjs +59 -0
- package/plugins/undoRedo/actions/removeColumn.js +176 -0
- package/plugins/undoRedo/actions/removeColumn.mjs +172 -0
- package/plugins/undoRedo/actions/removeRow.js +119 -0
- package/plugins/undoRedo/actions/removeRow.mjs +115 -0
- package/plugins/undoRedo/actions/rowMove.js +84 -0
- package/plugins/undoRedo/actions/rowMove.mjs +80 -0
- package/plugins/undoRedo/actions/unmergeCells.js +56 -0
- package/plugins/undoRedo/actions/unmergeCells.mjs +52 -0
- package/plugins/undoRedo/index.js +3 -4
- package/plugins/undoRedo/index.mjs +1 -2
- package/plugins/undoRedo/undoRedo.js +277 -879
- package/plugins/undoRedo/undoRedo.mjs +277 -880
- package/plugins/undoRedo/utils.js +37 -0
- package/plugins/undoRedo/utils.mjs +33 -0
- package/styles/handsontable.css +9 -2
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +2 -2
- package/styles/ht-theme-horizon.min.css +2 -2
- package/styles/ht-theme-main.css +2 -2
- package/styles/ht-theme-main.min.css +2 -2
- package/utils/ghostTable.js +1 -5
- package/utils/ghostTable.mjs +1 -5
package/dist/handsontable.js
CHANGED
@@ -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-
|
29
|
-
* Release date: 17/10/2024 (built at 09/12/2024
|
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')
|
@@ -104,8 +104,8 @@ Handsontable.hooks = _hooks.Hooks.getSingleton();
|
|
104
104
|
Handsontable.CellCoords = _src.CellCoords;
|
105
105
|
Handsontable.CellRange = _src.CellRange;
|
106
106
|
Handsontable.packageName = 'handsontable';
|
107
|
-
Handsontable.buildDate = "09/12/2024
|
108
|
-
Handsontable.version = "0.0.0-next-
|
107
|
+
Handsontable.buildDate = "09/12/2024 14:26:47";
|
108
|
+
Handsontable.version = "0.0.0-next-aa821c7-20241209";
|
109
109
|
Handsontable.languages = {
|
110
110
|
dictionaryKeys: _registry.dictionaryKeys,
|
111
111
|
getLanguageDictionary: _registry.getLanguageDictionary,
|
@@ -4549,13 +4549,7 @@ function Core(rootElement, userSettings) {
|
|
4549
4549
|
* @returns {BasePlugin|undefined} The plugin instance or undefined if there is no plugin.
|
4550
4550
|
*/
|
4551
4551
|
this.getPlugin = function (pluginName) {
|
4552
|
-
|
4553
|
-
|
4554
|
-
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
4555
|
-
if (unifiedPluginName === 'UndoRedo') {
|
4556
|
-
return this.undoRedo;
|
4557
|
-
}
|
4558
|
-
return pluginsRegistry.getItem(unifiedPluginName);
|
4552
|
+
return pluginsRegistry.getItem((0, _string.toUpperCaseFirst)(pluginName));
|
4559
4553
|
};
|
4560
4554
|
|
4561
4555
|
/**
|
@@ -10059,7 +10053,7 @@ const domMessages = {
|
|
10059
10053
|
function _injectProductInfo(key, element) {
|
10060
10054
|
const hasValidType = !isEmpty(key);
|
10061
10055
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
10062
|
-
const hotVersion = "0.0.0-next-
|
10056
|
+
const hotVersion = "0.0.0-next-aa821c7-20241209";
|
10063
10057
|
let keyValidityDate;
|
10064
10058
|
let consoleMessageState = 'invalid';
|
10065
10059
|
let domMessageState = 'invalid';
|
@@ -44755,8 +44749,7 @@ var _default = () => {
|
|
44755
44749
|
* | `true` | Enable the [`UndoRedo`](@/api/undoRedo.md) plugin |
|
44756
44750
|
* | `false` | Disable the [`UndoRedo`](@/api/undoRedo.md) plugin |
|
44757
44751
|
*
|
44758
|
-
* By default, the `undo` option is set to `
|
44759
|
-
* but the [`UndoRedo`](@/api/undoRedo.md) plugin acts as enabled.
|
44752
|
+
* By default, the `undo` option is set to `true`,
|
44760
44753
|
* To disable the [`UndoRedo`](@/api/undoRedo.md) plugin completely,
|
44761
44754
|
* set the `undo` option to `false`.
|
44762
44755
|
*
|
@@ -44774,7 +44767,7 @@ var _default = () => {
|
|
44774
44767
|
* undo: true,
|
44775
44768
|
* ```
|
44776
44769
|
*/
|
44777
|
-
undo:
|
44770
|
+
undo: true,
|
44778
44771
|
/**
|
44779
44772
|
* @description
|
44780
44773
|
* The `validator` option sets a [cell validator](@/guides/cell-functions/cell-validator/cell-validator.md) for a cell.
|
@@ -55136,13 +55129,6 @@ class BasePlugin {
|
|
55136
55129
|
if (!initializedPlugins) {
|
55137
55130
|
initializedPlugins = (0, _registry.getPluginsNames)();
|
55138
55131
|
}
|
55139
|
-
|
55140
|
-
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
55141
|
-
// Without this line the `callOnPluginsReady` callback won't be triggered after all plugin
|
55142
|
-
// initialization.
|
55143
|
-
if (initializedPlugins.indexOf('UndoRedo') >= 0) {
|
55144
|
-
initializedPlugins.splice(initializedPlugins.indexOf('UndoRedo'), 1);
|
55145
|
-
}
|
55146
55132
|
if (initializedPlugins.indexOf(this.pluginName) >= 0) {
|
55147
55133
|
initializedPlugins.splice(initializedPlugins.indexOf(this.pluginName), 1);
|
55148
55134
|
}
|
@@ -55490,8 +55476,6 @@ class GhostTable {
|
|
55490
55476
|
if (!this.injected) {
|
55491
55477
|
this.injectTable();
|
55492
55478
|
}
|
55493
|
-
const isBorderBoxSizing = this.hot.view.getStylesHandler().areCellsBorderBox();
|
55494
|
-
const borderCompensation = isBorderBoxSizing ? 0 : 1;
|
55495
55479
|
(0, _array.arrayEach)(this.rows, row => {
|
55496
55480
|
// In cases when the cell's content produces the height with a decimal point, the height
|
55497
55481
|
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
@@ -55499,9 +55483,7 @@ class GhostTable {
|
|
55499
55483
|
const {
|
55500
55484
|
height
|
55501
55485
|
} = row.table.getBoundingClientRect();
|
55502
|
-
|
55503
|
-
// -1 <- reduce border-top from table (if box-sizing is not border-box)
|
55504
|
-
callback(row.row, Math.ceil(height) - borderCompensation);
|
55486
|
+
callback(row.row, Math.ceil(height));
|
55505
55487
|
});
|
55506
55488
|
}
|
55507
55489
|
|
@@ -93937,11 +93919,10 @@ function _onMapInit() {
|
|
93937
93919
|
|
93938
93920
|
|
93939
93921
|
exports.__esModule = true;
|
93940
|
-
var _undoRedo =
|
93941
|
-
exports.UndoRedo = _undoRedo.default;
|
93922
|
+
var _undoRedo = __webpack_require__(747);
|
93942
93923
|
exports.PLUGIN_KEY = _undoRedo.PLUGIN_KEY;
|
93943
|
-
|
93944
|
-
|
93924
|
+
exports.PLUGIN_PRIORITY = _undoRedo.PLUGIN_PRIORITY;
|
93925
|
+
exports.UndoRedo = _undoRedo.UndoRedo;
|
93945
93926
|
|
93946
93927
|
/***/ }),
|
93947
93928
|
/* 747 */
|
@@ -93950,22 +93931,35 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
93950
93931
|
"use strict";
|
93951
93932
|
|
93952
93933
|
|
93934
|
+
__webpack_require__(5);
|
93935
|
+
var _interopRequireDefault = __webpack_require__(1);
|
93953
93936
|
exports.__esModule = true;
|
93937
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
93954
93938
|
__webpack_require__(87);
|
93955
|
-
__webpack_require__(
|
93956
|
-
__webpack_require__(
|
93957
|
-
__webpack_require__(
|
93958
|
-
__webpack_require__(
|
93959
|
-
__webpack_require__(
|
93960
|
-
__webpack_require__(
|
93939
|
+
__webpack_require__(91);
|
93940
|
+
__webpack_require__(102);
|
93941
|
+
__webpack_require__(104);
|
93942
|
+
__webpack_require__(107);
|
93943
|
+
__webpack_require__(109);
|
93944
|
+
__webpack_require__(111);
|
93945
|
+
__webpack_require__(113);
|
93946
|
+
var _base = __webpack_require__(503);
|
93961
93947
|
var _hooks = __webpack_require__(177);
|
93962
|
-
var _array = __webpack_require__(161);
|
93963
|
-
var _number = __webpack_require__(200);
|
93964
93948
|
var _object = __webpack_require__(165);
|
93965
|
-
var
|
93966
|
-
var
|
93949
|
+
var _templateLiteralTag = __webpack_require__(160);
|
93950
|
+
var _console = __webpack_require__(178);
|
93951
|
+
var _actions = __webpack_require__(748);
|
93952
|
+
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
93953
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
93954
|
+
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"); }
|
93967
93955
|
const SHORTCUTS_GROUP = 'undoRedo';
|
93968
93956
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'undoRedo';
|
93957
|
+
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 1000;
|
93958
|
+
_hooks.Hooks.getSingleton().register('beforeUndo');
|
93959
|
+
_hooks.Hooks.getSingleton().register('afterUndo');
|
93960
|
+
_hooks.Hooks.getSingleton().register('beforeRedo');
|
93961
|
+
_hooks.Hooks.getSingleton().register('afterRedo');
|
93962
|
+
const deprecationWarns = new Set();
|
93969
93963
|
|
93970
93964
|
/**
|
93971
93965
|
* @description
|
@@ -93978,969 +93972,1278 @@ const PLUGIN_KEY = exports.PLUGIN_KEY = 'undoRedo';
|
|
93978
93972
|
* ```
|
93979
93973
|
* @class UndoRedo
|
93980
93974
|
* @plugin UndoRedo
|
93981
|
-
* @param {Core} instance The Handsontable instance.
|
93982
93975
|
*/
|
93983
|
-
|
93984
|
-
|
93985
|
-
|
93986
|
-
|
93987
|
-
|
93988
|
-
|
93989
|
-
|
93990
|
-
|
93991
|
-
|
93992
|
-
|
93976
|
+
var _UndoRedo_brand = /*#__PURE__*/new WeakSet();
|
93977
|
+
class UndoRedo extends _base.BasePlugin {
|
93978
|
+
static get PLUGIN_KEY() {
|
93979
|
+
return PLUGIN_KEY;
|
93980
|
+
}
|
93981
|
+
static get PLUGIN_PRIORITY() {
|
93982
|
+
return PLUGIN_PRIORITY;
|
93983
|
+
}
|
93984
|
+
static get SETTING_KEYS() {
|
93985
|
+
return true;
|
93986
|
+
}
|
93987
|
+
|
93988
|
+
/**
|
93989
|
+
* The list of registered action do undo.
|
93990
|
+
*
|
93991
|
+
* @private
|
93992
|
+
* @type {Array}
|
93993
|
+
*/
|
93994
|
+
|
93995
|
+
constructor(hotInstance) {
|
93996
|
+
super(hotInstance);
|
93997
|
+
/**
|
93998
|
+
* Listens to the data change and if the source is `loadData` then clears the undo and redo history.
|
93999
|
+
*
|
94000
|
+
* @param {Array} changes The data changes.
|
94001
|
+
* @param {string} source The source of the change.
|
94002
|
+
*/
|
94003
|
+
_classPrivateMethodInitSpec(this, _UndoRedo_brand);
|
94004
|
+
(0, _defineProperty2.default)(this, "doneActions", []);
|
94005
|
+
/**
|
94006
|
+
* The list of registered action do redo.
|
94007
|
+
*
|
94008
|
+
* @private
|
94009
|
+
* @type {Array}
|
94010
|
+
*/
|
94011
|
+
(0, _defineProperty2.default)(this, "undoneActions", []);
|
94012
|
+
/**
|
94013
|
+
* The flag that determines if new actions should be ignored.
|
94014
|
+
*
|
94015
|
+
* @private
|
94016
|
+
* @type {boolean}
|
94017
|
+
*/
|
94018
|
+
(0, _defineProperty2.default)(this, "ignoreNewActions", false);
|
94019
|
+
(0, _actions.registerActions)(hotInstance, this);
|
94020
|
+
}
|
94021
|
+
|
94022
|
+
/**
|
94023
|
+
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
94024
|
+
* hook and if it returns `true` then the {@link UndoRedo#enablePlugin} method is called.
|
94025
|
+
*
|
94026
|
+
* @returns {boolean}
|
94027
|
+
*/
|
94028
|
+
isEnabled() {
|
94029
|
+
return !!this.hot.getSettings().undo;
|
94030
|
+
}
|
94031
|
+
|
94032
|
+
/**
|
94033
|
+
* Enables the plugin functionality for this Handsontable instance.
|
94034
|
+
*/
|
94035
|
+
enablePlugin() {
|
94036
|
+
var _this = this;
|
94037
|
+
if (this.enabled) {
|
93993
94038
|
return;
|
93994
94039
|
}
|
93995
|
-
|
93996
|
-
|
93997
|
-
|
94040
|
+
this.addHook('afterChange', function () {
|
94041
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
94042
|
+
args[_key] = arguments[_key];
|
94043
|
+
}
|
94044
|
+
return _assertClassBrand(_UndoRedo_brand, _this, _onAfterChange).call(_this, ...args);
|
93998
94045
|
});
|
93999
|
-
|
94000
|
-
|
94001
|
-
|
94002
|
-
|
94003
|
-
|
94004
|
-
|
94005
|
-
|
94006
|
-
|
94007
|
-
|
94008
|
-
|
94009
|
-
|
94010
|
-
|
94011
|
-
|
94046
|
+
this.registerShortcuts();
|
94047
|
+
_assertClassBrand(_UndoRedo_brand, this, _exposeAPIToCore).call(this);
|
94048
|
+
super.enablePlugin();
|
94049
|
+
}
|
94050
|
+
|
94051
|
+
/**
|
94052
|
+
* Disables the plugin functionality for this Handsontable instance.
|
94053
|
+
*/
|
94054
|
+
disablePlugin() {
|
94055
|
+
super.disablePlugin();
|
94056
|
+
this.clear();
|
94057
|
+
this.unregisterShortcuts();
|
94058
|
+
_assertClassBrand(_UndoRedo_brand, this, _removeAPIFromCore).call(this);
|
94059
|
+
}
|
94060
|
+
|
94061
|
+
/**
|
94062
|
+
* Registers shortcuts responsible for performing undo/redo.
|
94063
|
+
*
|
94064
|
+
* @private
|
94065
|
+
*/
|
94066
|
+
registerShortcuts() {
|
94067
|
+
const shortcutManager = this.hot.getShortcutManager();
|
94068
|
+
const gridContext = shortcutManager.getContext('grid');
|
94069
|
+
const runOnlyIf = event => {
|
94070
|
+
return !event.altKey; // right ALT in some systems triggers ALT+CTR
|
94012
94071
|
};
|
94013
|
-
|
94014
|
-
|
94015
|
-
|
94016
|
-
plugin.done(() => new UndoRedo.CreateRowAction(index, amount), source);
|
94017
|
-
});
|
94018
|
-
const getCellMetas = (fromRow, toRow, fromColumn, toColumn) => {
|
94019
|
-
const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];
|
94020
|
-
const genericKeysLength = genericKeys.length;
|
94021
|
-
const cellMetas = [];
|
94022
|
-
(0, _number.rangeEach)(fromColumn, toColumn, columnIndex => {
|
94023
|
-
(0, _number.rangeEach)(fromRow, toRow, rowIndex => {
|
94024
|
-
const cellMeta = instance.getCellMeta(rowIndex, columnIndex);
|
94025
|
-
if (Object.keys(cellMeta).length !== genericKeysLength) {
|
94026
|
-
const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {
|
94027
|
-
let [key] = _ref;
|
94028
|
-
return genericKeys.includes(key) === false;
|
94029
|
-
}));
|
94030
|
-
cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);
|
94031
|
-
}
|
94032
|
-
});
|
94033
|
-
});
|
94034
|
-
return cellMetas;
|
94035
|
-
};
|
94036
|
-
instance.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
|
94037
|
-
const wrappedAction = () => {
|
94038
|
-
const physicalRowIndex = instance.toPhysicalRow(index);
|
94039
|
-
const lastRowIndex = physicalRowIndex + amount - 1;
|
94040
|
-
const removedData = (0, _object.deepClone)(plugin.instance.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, plugin.instance.countSourceCols() - 1));
|
94041
|
-
return new UndoRedo.RemoveRowAction(physicalRowIndex, removedData, instance.getSettings().fixedRowsBottom, instance.getSettings().fixedRowsTop, instance.rowIndexMapper.getIndexesSequence(), getCellMetas(physicalRowIndex, lastRowIndex, 0, instance.countCols() - 1));
|
94072
|
+
const config = {
|
94073
|
+
runOnlyIf,
|
94074
|
+
group: SHORTCUTS_GROUP
|
94042
94075
|
};
|
94043
|
-
|
94044
|
-
|
94045
|
-
|
94046
|
-
|
94047
|
-
});
|
94048
|
-
instance.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {
|
94049
|
-
const wrappedAction = () => {
|
94050
|
-
const originalData = plugin.instance.getSourceDataArray();
|
94051
|
-
const columnIndex = (plugin.instance.countCols() + index) % plugin.instance.countCols();
|
94052
|
-
const lastColumnIndex = columnIndex + amount - 1;
|
94053
|
-
const removedData = [];
|
94054
|
-
const headers = [];
|
94055
|
-
const indexes = [];
|
94056
|
-
(0, _number.rangeEach)(originalData.length - 1, i => {
|
94057
|
-
const column = [];
|
94058
|
-
const origRow = originalData[i];
|
94059
|
-
(0, _number.rangeEach)(columnIndex, lastColumnIndex, j => {
|
94060
|
-
column.push(origRow[instance.toPhysicalColumn(j)]);
|
94061
|
-
});
|
94062
|
-
removedData.push(column);
|
94063
|
-
});
|
94064
|
-
(0, _number.rangeEach)(amount - 1, i => {
|
94065
|
-
indexes.push(instance.toPhysicalColumn(columnIndex + i));
|
94066
|
-
});
|
94067
|
-
if (Array.isArray(instance.getSettings().colHeaders)) {
|
94068
|
-
(0, _number.rangeEach)(amount - 1, i => {
|
94069
|
-
headers.push(instance.getSettings().colHeaders[instance.toPhysicalColumn(columnIndex + i)] || null);
|
94070
|
-
});
|
94076
|
+
gridContext.addShortcuts([{
|
94077
|
+
keys: [['Control/Meta', 'z']],
|
94078
|
+
callback: () => {
|
94079
|
+
this.undo();
|
94071
94080
|
}
|
94072
|
-
|
94073
|
-
|
94074
|
-
|
94075
|
-
|
94076
|
-
|
94077
|
-
|
94078
|
-
|
94079
|
-
|
94080
|
-
|
94081
|
-
|
94082
|
-
|
94083
|
-
|
94084
|
-
|
94085
|
-
|
94086
|
-
|
94087
|
-
|
94088
|
-
|
94089
|
-
}
|
94090
|
-
|
94091
|
-
|
94092
|
-
|
94093
|
-
|
94094
|
-
|
94095
|
-
|
94096
|
-
|
94097
|
-
|
94081
|
+
}, {
|
94082
|
+
keys: [['Control/Meta', 'y'], ['Control/Meta', 'Shift', 'z']],
|
94083
|
+
callback: () => {
|
94084
|
+
this.redo();
|
94085
|
+
}
|
94086
|
+
}], config);
|
94087
|
+
}
|
94088
|
+
|
94089
|
+
/**
|
94090
|
+
* Unregister shortcuts responsible for performing undo/redo.
|
94091
|
+
*
|
94092
|
+
* @private
|
94093
|
+
*/
|
94094
|
+
unregisterShortcuts() {
|
94095
|
+
const shortcutManager = this.hot.getShortcutManager();
|
94096
|
+
const gridContext = shortcutManager.getContext('grid');
|
94097
|
+
gridContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
94098
|
+
}
|
94099
|
+
|
94100
|
+
/**
|
94101
|
+
* Stash information about performed actions.
|
94102
|
+
*
|
94103
|
+
* @fires Hooks#beforeUndoStackChange
|
94104
|
+
* @fires Hooks#afterUndoStackChange
|
94105
|
+
* @fires Hooks#beforeRedoStackChange
|
94106
|
+
* @fires Hooks#afterRedoStackChange
|
94107
|
+
* @param {Function} wrappedAction The action descriptor wrapped in a closure.
|
94108
|
+
* @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins).
|
94109
|
+
*/
|
94110
|
+
done(wrappedAction, source) {
|
94111
|
+
if (this.ignoreNewActions) {
|
94098
94112
|
return;
|
94099
94113
|
}
|
94100
|
-
|
94101
|
-
|
94102
|
-
instance.addHook('afterUnmergeCells', (cellRange, auto) => {
|
94103
|
-
if (auto) {
|
94114
|
+
const isBlockedByDefault = source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';
|
94115
|
+
if (isBlockedByDefault) {
|
94104
94116
|
return;
|
94105
94117
|
}
|
94106
|
-
|
94107
|
-
|
94108
|
-
|
94109
|
-
if (!sortPossible) {
|
94118
|
+
const doneActionsCopy = this.doneActions.slice();
|
94119
|
+
const continueAction = this.hot.runHooks('beforeUndoStackChange', doneActionsCopy, source);
|
94120
|
+
if (continueAction === false) {
|
94110
94121
|
return;
|
94111
94122
|
}
|
94112
|
-
|
94113
|
-
|
94114
|
-
|
94115
|
-
|
94116
|
-
|
94117
|
-
|
94118
|
-
|
94119
|
-
}
|
94120
|
-
|
94121
|
-
/**
|
94122
|
-
* Stash information about performed actions.
|
94123
|
-
*
|
94124
|
-
* @function done
|
94125
|
-
* @memberof UndoRedo#
|
94126
|
-
* @fires Hooks#beforeUndoStackChange
|
94127
|
-
* @fires Hooks#afterUndoStackChange
|
94128
|
-
* @fires Hooks#beforeRedoStackChange
|
94129
|
-
* @fires Hooks#afterRedoStackChange
|
94130
|
-
* @param {Function} wrappedAction The action descriptor wrapped in a closure.
|
94131
|
-
* @param {string} [source] Source of the action. It is defined just for more general actions (not related to plugins).
|
94132
|
-
*/
|
94133
|
-
UndoRedo.prototype.done = function (wrappedAction, source) {
|
94134
|
-
if (this.ignoreNewActions) {
|
94135
|
-
return;
|
94136
|
-
}
|
94137
|
-
const isBlockedByDefault = source === 'UndoRedo.undo' || source === 'UndoRedo.redo' || source === 'auto';
|
94138
|
-
if (isBlockedByDefault) {
|
94139
|
-
return;
|
94140
|
-
}
|
94141
|
-
const doneActionsCopy = this.doneActions.slice();
|
94142
|
-
const continueAction = this.instance.runHooks('beforeUndoStackChange', doneActionsCopy, source);
|
94143
|
-
if (continueAction === false) {
|
94144
|
-
return;
|
94123
|
+
const newAction = wrappedAction();
|
94124
|
+
const undoneActionsCopy = this.undoneActions.slice();
|
94125
|
+
this.doneActions.push(newAction);
|
94126
|
+
this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
|
94127
|
+
this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
|
94128
|
+
this.undoneActions.length = 0;
|
94129
|
+
this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
|
94145
94130
|
}
|
94146
|
-
const newAction = wrappedAction();
|
94147
|
-
const undoneActionsCopy = this.undoneActions.slice();
|
94148
|
-
this.doneActions.push(newAction);
|
94149
|
-
this.instance.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
|
94150
|
-
this.instance.runHooks('beforeRedoStackChange', undoneActionsCopy);
|
94151
|
-
this.undoneActions.length = 0;
|
94152
|
-
this.instance.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
|
94153
|
-
};
|
94154
94131
|
|
94155
|
-
/**
|
94156
|
-
|
94157
|
-
|
94158
|
-
|
94159
|
-
|
94160
|
-
|
94161
|
-
|
94162
|
-
|
94163
|
-
|
94164
|
-
|
94165
|
-
|
94166
|
-
|
94167
|
-
|
94168
|
-
|
94132
|
+
/**
|
94133
|
+
* Undo the last action performed to the table.
|
94134
|
+
*
|
94135
|
+
* @fires Hooks#beforeUndoStackChange
|
94136
|
+
* @fires Hooks#afterUndoStackChange
|
94137
|
+
* @fires Hooks#beforeRedoStackChange
|
94138
|
+
* @fires Hooks#afterRedoStackChange
|
94139
|
+
* @fires Hooks#beforeUndo
|
94140
|
+
* @fires Hooks#afterUndo
|
94141
|
+
*/
|
94142
|
+
undo() {
|
94143
|
+
if (!this.isUndoAvailable()) {
|
94144
|
+
return;
|
94145
|
+
}
|
94169
94146
|
const doneActionsCopy = this.doneActions.slice();
|
94170
|
-
this.
|
94147
|
+
this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);
|
94171
94148
|
const action = this.doneActions.pop();
|
94172
|
-
this.
|
94149
|
+
this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
|
94173
94150
|
const actionClone = (0, _object.deepClone)(action);
|
94174
|
-
const continueAction = this.
|
94151
|
+
const continueAction = this.hot.runHooks('beforeUndo', actionClone);
|
94175
94152
|
if (continueAction === false) {
|
94176
94153
|
return;
|
94177
94154
|
}
|
94178
94155
|
this.ignoreNewActions = true;
|
94179
|
-
const that = this;
|
94180
94156
|
const undoneActionsCopy = this.undoneActions.slice();
|
94181
|
-
this.
|
94182
|
-
action.undo(this.
|
94183
|
-
|
94184
|
-
|
94157
|
+
this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
|
94158
|
+
action.undo(this.hot, () => {
|
94159
|
+
this.ignoreNewActions = false;
|
94160
|
+
this.undoneActions.push(action);
|
94185
94161
|
});
|
94186
|
-
this.
|
94187
|
-
this.
|
94162
|
+
this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
|
94163
|
+
this.hot.runHooks('afterUndo', actionClone);
|
94188
94164
|
}
|
94189
|
-
};
|
94190
94165
|
|
94191
|
-
/**
|
94192
|
-
|
94193
|
-
|
94194
|
-
|
94195
|
-
|
94196
|
-
|
94197
|
-
|
94198
|
-
|
94199
|
-
|
94200
|
-
|
94201
|
-
|
94202
|
-
|
94203
|
-
|
94204
|
-
|
94166
|
+
/**
|
94167
|
+
* Redo the previous action performed to the table (used to reverse an undo).
|
94168
|
+
*
|
94169
|
+
* @fires Hooks#beforeUndoStackChange
|
94170
|
+
* @fires Hooks#afterUndoStackChange
|
94171
|
+
* @fires Hooks#beforeRedoStackChange
|
94172
|
+
* @fires Hooks#afterRedoStackChange
|
94173
|
+
* @fires Hooks#beforeRedo
|
94174
|
+
* @fires Hooks#afterRedo
|
94175
|
+
*/
|
94176
|
+
redo() {
|
94177
|
+
if (!this.isRedoAvailable()) {
|
94178
|
+
return;
|
94179
|
+
}
|
94205
94180
|
const undoneActionsCopy = this.undoneActions.slice();
|
94206
|
-
this.
|
94181
|
+
this.hot.runHooks('beforeRedoStackChange', undoneActionsCopy);
|
94207
94182
|
const action = this.undoneActions.pop();
|
94208
|
-
this.
|
94183
|
+
this.hot.runHooks('afterRedoStackChange', undoneActionsCopy, this.undoneActions.slice());
|
94209
94184
|
const actionClone = (0, _object.deepClone)(action);
|
94210
|
-
const continueAction = this.
|
94185
|
+
const continueAction = this.hot.runHooks('beforeRedo', actionClone);
|
94211
94186
|
if (continueAction === false) {
|
94212
94187
|
return;
|
94213
94188
|
}
|
94214
94189
|
this.ignoreNewActions = true;
|
94215
|
-
const that = this;
|
94216
94190
|
const doneActionsCopy = this.doneActions.slice();
|
94217
|
-
this.
|
94218
|
-
action.redo(this.
|
94219
|
-
|
94220
|
-
|
94191
|
+
this.hot.runHooks('beforeUndoStackChange', doneActionsCopy);
|
94192
|
+
action.redo(this.hot, () => {
|
94193
|
+
this.ignoreNewActions = false;
|
94194
|
+
this.doneActions.push(action);
|
94221
94195
|
});
|
94222
|
-
this.
|
94223
|
-
this.
|
94196
|
+
this.hot.runHooks('afterUndoStackChange', doneActionsCopy, this.doneActions.slice());
|
94197
|
+
this.hot.runHooks('afterRedo', actionClone);
|
94224
94198
|
}
|
94225
|
-
};
|
94226
94199
|
|
94227
|
-
/**
|
94228
|
-
|
94229
|
-
|
94230
|
-
|
94231
|
-
|
94232
|
-
|
94233
|
-
|
94234
|
-
|
94235
|
-
return this.doneActions.length > 0;
|
94236
|
-
};
|
94200
|
+
/**
|
94201
|
+
* Checks if undo action is available.
|
94202
|
+
*
|
94203
|
+
* @returns {boolean} Return `true` if undo can be performed, `false` otherwise.
|
94204
|
+
*/
|
94205
|
+
isUndoAvailable() {
|
94206
|
+
return this.doneActions.length > 0;
|
94207
|
+
}
|
94237
94208
|
|
94238
|
-
/**
|
94239
|
-
|
94240
|
-
|
94241
|
-
|
94242
|
-
|
94243
|
-
|
94244
|
-
|
94245
|
-
|
94246
|
-
return this.undoneActions.length > 0;
|
94247
|
-
};
|
94209
|
+
/**
|
94210
|
+
* Checks if redo action is available.
|
94211
|
+
*
|
94212
|
+
* @returns {boolean} Return `true` if redo can be performed, `false` otherwise.
|
94213
|
+
*/
|
94214
|
+
isRedoAvailable() {
|
94215
|
+
return this.undoneActions.length > 0;
|
94216
|
+
}
|
94248
94217
|
|
94218
|
+
/**
|
94219
|
+
* Clears undo and redo history.
|
94220
|
+
*/
|
94221
|
+
clear() {
|
94222
|
+
this.doneActions.length = 0;
|
94223
|
+
this.undoneActions.length = 0;
|
94224
|
+
}
|
94225
|
+
/**
|
94226
|
+
* Destroys the plugin instance.
|
94227
|
+
*/
|
94228
|
+
destroy() {
|
94229
|
+
this.clear();
|
94230
|
+
this.doneActions = null;
|
94231
|
+
this.undoneActions = null;
|
94232
|
+
super.destroy();
|
94233
|
+
}
|
94234
|
+
}
|
94235
|
+
exports.UndoRedo = UndoRedo;
|
94236
|
+
function _onAfterChange(changes, source) {
|
94237
|
+
if (source === 'loadData') {
|
94238
|
+
this.clear();
|
94239
|
+
}
|
94240
|
+
}
|
94249
94241
|
/**
|
94250
|
-
*
|
94251
|
-
*
|
94252
|
-
* @function clear
|
94253
|
-
* @memberof UndoRedo#
|
94242
|
+
* Expose the plugin API to the Core. It is for backward compatibility and it should be removed in the future.
|
94254
94243
|
*/
|
94255
|
-
|
94256
|
-
|
94257
|
-
|
94258
|
-
}
|
94244
|
+
function _exposeAPIToCore() {
|
94245
|
+
const deprecatedWarn = methodName => {
|
94246
|
+
if (!deprecationWarns.has(methodName)) {
|
94247
|
+
(0, _console.warn)((0, _templateLiteralTag.toSingleLine)`The "${methodName}" method is deprecated and it will be removed\x20
|
94248
|
+
from the Core API in the future. Please use the method from the UndoRedo plugin\x20
|
94249
|
+
(e.g. \`hotInstance.getPlugin("undoRedo").${methodName}()\`).`);
|
94250
|
+
deprecationWarns.add(methodName);
|
94251
|
+
}
|
94252
|
+
};
|
94259
94253
|
|
94254
|
+
/**
|
94255
|
+
* {@link UndoRedo#undo}.
|
94256
|
+
*
|
94257
|
+
* @alias undo
|
94258
|
+
* @memberof! Core#
|
94259
|
+
*/
|
94260
|
+
this.hot.undo = () => {
|
94261
|
+
deprecatedWarn('undo');
|
94262
|
+
this.undo();
|
94263
|
+
};
|
94264
|
+
/**
|
94265
|
+
* {@link UndoRedo#redo}.
|
94266
|
+
*
|
94267
|
+
* @alias redo
|
94268
|
+
* @memberof! Core#
|
94269
|
+
*/
|
94270
|
+
this.hot.redo = () => {
|
94271
|
+
deprecatedWarn('redo');
|
94272
|
+
this.redo();
|
94273
|
+
};
|
94274
|
+
/**
|
94275
|
+
* {@link UndoRedo#isUndoAvailable}.
|
94276
|
+
*
|
94277
|
+
* @alias isUndoAvailable
|
94278
|
+
* @memberof! Core#
|
94279
|
+
* @returns {boolean}
|
94280
|
+
*/
|
94281
|
+
this.hot.isUndoAvailable = () => {
|
94282
|
+
deprecatedWarn('isUndoAvailable');
|
94283
|
+
return this.isUndoAvailable();
|
94284
|
+
};
|
94285
|
+
/**
|
94286
|
+
* {@link UndoRedo#isRedoAvailable}.
|
94287
|
+
*
|
94288
|
+
* @alias isRedoAvailable
|
94289
|
+
* @memberof! Core#
|
94290
|
+
* @returns {boolean}
|
94291
|
+
*/
|
94292
|
+
this.hot.isRedoAvailable = () => {
|
94293
|
+
deprecatedWarn('isRedoAvailable');
|
94294
|
+
return this.isRedoAvailable();
|
94295
|
+
};
|
94296
|
+
/**
|
94297
|
+
* {@link UndoRedo#clear}.
|
94298
|
+
*
|
94299
|
+
* @alias clearUndo
|
94300
|
+
* @memberof! Core#
|
94301
|
+
*/
|
94302
|
+
this.hot.clearUndo = () => {
|
94303
|
+
deprecatedWarn('clear');
|
94304
|
+
this.clear();
|
94305
|
+
};
|
94306
|
+
this.hot.undoRedo = this;
|
94307
|
+
}
|
94260
94308
|
/**
|
94261
|
-
*
|
94262
|
-
*
|
94263
|
-
* @function isEnabled
|
94264
|
-
* @memberof UndoRedo#
|
94265
|
-
* @returns {boolean}
|
94309
|
+
* Removes the plugin API from the Core. It is for backward compatibility and it should be removed in the future.
|
94266
94310
|
*/
|
94267
|
-
|
94268
|
-
|
94269
|
-
|
94311
|
+
function _removeAPIFromCore() {
|
94312
|
+
delete this.hot.undo;
|
94313
|
+
delete this.hot.redo;
|
94314
|
+
delete this.hot.isUndoAvailable;
|
94315
|
+
delete this.hot.isRedoAvailable;
|
94316
|
+
delete this.hot.clearUndo;
|
94317
|
+
delete this.hot.undoRedo;
|
94318
|
+
}
|
94270
94319
|
|
94271
|
-
|
94272
|
-
|
94273
|
-
|
94274
|
-
* @function enable
|
94275
|
-
* @memberof UndoRedo#
|
94276
|
-
*/
|
94277
|
-
UndoRedo.prototype.enable = function () {
|
94278
|
-
if (this.isEnabled()) {
|
94279
|
-
return;
|
94280
|
-
}
|
94281
|
-
const hot = this.instance;
|
94282
|
-
this.enabled = true;
|
94283
|
-
exposeUndoRedoMethods(hot);
|
94284
|
-
this.registerShortcuts();
|
94285
|
-
hot.addHook('afterChange', onAfterChange);
|
94286
|
-
};
|
94320
|
+
/***/ }),
|
94321
|
+
/* 748 */
|
94322
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94287
94323
|
|
94288
|
-
|
94289
|
-
* Disables the plugin.
|
94290
|
-
*
|
94291
|
-
* @function disable
|
94292
|
-
* @memberof UndoRedo#
|
94293
|
-
*/
|
94294
|
-
UndoRedo.prototype.disable = function () {
|
94295
|
-
if (!this.isEnabled()) {
|
94296
|
-
return;
|
94297
|
-
}
|
94298
|
-
const hot = this.instance;
|
94299
|
-
this.enabled = false;
|
94300
|
-
removeExposedUndoRedoMethods(hot);
|
94301
|
-
this.unregisterShortcuts();
|
94302
|
-
hot.removeHook('afterChange', onAfterChange);
|
94303
|
-
};
|
94324
|
+
"use strict";
|
94304
94325
|
|
94305
|
-
|
94306
|
-
|
94326
|
+
|
94327
|
+
exports.__esModule = true;
|
94328
|
+
exports.registerActions = registerActions;
|
94329
|
+
__webpack_require__(115);
|
94330
|
+
__webpack_require__(133);
|
94331
|
+
var _cellAlignment = __webpack_require__(749);
|
94332
|
+
var _columnMove = __webpack_require__(751);
|
94333
|
+
var _columnSort = __webpack_require__(752);
|
94334
|
+
var _createColumn = __webpack_require__(753);
|
94335
|
+
var _createRow = __webpack_require__(754);
|
94336
|
+
var _dataChange = __webpack_require__(755);
|
94337
|
+
var _filters = __webpack_require__(756);
|
94338
|
+
var _mergeCells = __webpack_require__(757);
|
94339
|
+
var _removeColumn = __webpack_require__(758);
|
94340
|
+
var _removeRow = __webpack_require__(761);
|
94341
|
+
var _rowMove = __webpack_require__(762);
|
94342
|
+
var _unmergeCells = __webpack_require__(763);
|
94343
|
+
/**
|
94344
|
+
* Register all undo/redo actions.
|
94307
94345
|
*
|
94308
|
-
* @
|
94309
|
-
* @
|
94346
|
+
* @param {Core} hot The Handsontable instance.
|
94347
|
+
* @param {UndoRedo} undoRedoPlugin The undoRedo plugin instance.
|
94310
94348
|
*/
|
94311
|
-
|
94312
|
-
|
94313
|
-
|
94314
|
-
|
94315
|
-
|
94316
|
-
|
94317
|
-
|
94318
|
-
|
94319
|
-
|
94349
|
+
function registerActions(hot, undoRedoPlugin) {
|
94350
|
+
[_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));
|
94351
|
+
}
|
94352
|
+
|
94353
|
+
/***/ }),
|
94354
|
+
/* 749 */
|
94355
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94356
|
+
|
94357
|
+
"use strict";
|
94320
94358
|
|
94359
|
+
|
94360
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94361
|
+
exports.__esModule = true;
|
94362
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94363
|
+
var _base = __webpack_require__(750);
|
94364
|
+
var _utils = __webpack_require__(543);
|
94365
|
+
var _array = __webpack_require__(161);
|
94321
94366
|
/**
|
94322
|
-
*
|
94367
|
+
* Action that tracks cell alignment changes.
|
94323
94368
|
*
|
94369
|
+
* @class CellAlignmentAction
|
94324
94370
|
* @private
|
94325
|
-
* @param {Array} changes 2D array containing information about each of the edited cells.
|
94326
|
-
* @param {number[]} selected The cell selection.
|
94327
94371
|
*/
|
94328
|
-
|
94329
|
-
|
94330
|
-
|
94331
|
-
|
94332
|
-
|
94333
|
-
|
94334
|
-
|
94335
|
-
|
94336
|
-
|
94337
|
-
|
94338
|
-
|
94339
|
-
|
94340
|
-
|
94341
|
-
|
94342
|
-
|
94343
|
-
|
94344
|
-
|
94345
|
-
|
94346
|
-
|
94347
|
-
|
94348
|
-
|
94349
|
-
|
94350
|
-
|
94351
|
-
|
94352
|
-
|
94353
|
-
|
94354
|
-
|
94355
|
-
|
94356
|
-
|
94357
|
-
const [selectedRow, selectedColumn] = selectedLast;
|
94358
|
-
const firstFullyVisibleRow = instance.getFirstFullyVisibleRow();
|
94359
|
-
const firstFullyVisibleColumn = instance.getFirstFullyVisibleColumn();
|
94360
|
-
const isInVerticalViewPort = changedRow >= firstFullyVisibleRow;
|
94361
|
-
const isInHorizontalViewPort = changedColumn >= firstFullyVisibleColumn;
|
94362
|
-
const isInViewport = isInVerticalViewPort && isInHorizontalViewPort;
|
94363
|
-
const isChangedSelection = selectedRow !== changedRow || selectedColumn !== changedColumn;
|
94364
|
-
|
94365
|
-
// Performing scroll only when selection has been changed right after editing a cell.
|
94366
|
-
if (isInViewport === false && isChangedSelection === true) {
|
94367
|
-
const scrollConfig = {
|
94368
|
-
row: changedRow,
|
94369
|
-
col: changedColumn
|
94370
|
-
};
|
94371
|
-
if (isInVerticalViewPort === false) {
|
94372
|
-
scrollConfig.verticalSnap = 'top';
|
94373
|
-
}
|
94374
|
-
if (isInHorizontalViewPort === false) {
|
94375
|
-
scrollConfig.horizontalSnap = 'start';
|
94376
|
-
}
|
94377
|
-
instance.scrollViewportTo(scrollConfig);
|
94378
|
-
}
|
94372
|
+
class CellAlignmentAction extends _base.BaseAction {
|
94373
|
+
constructor(_ref) {
|
94374
|
+
let {
|
94375
|
+
stateBefore,
|
94376
|
+
range,
|
94377
|
+
type,
|
94378
|
+
alignment
|
94379
|
+
} = _ref;
|
94380
|
+
super();
|
94381
|
+
/**
|
94382
|
+
* @param {Array} stateBefore The previous state.
|
94383
|
+
*/
|
94384
|
+
(0, _defineProperty2.default)(this, "stateBefore", void 0);
|
94385
|
+
/**
|
94386
|
+
* @param {object} range The cell range.
|
94387
|
+
*/
|
94388
|
+
(0, _defineProperty2.default)(this, "range", void 0);
|
94389
|
+
/**
|
94390
|
+
* @param {string} type The type of the alignment ("top", "left", "bottom" or "right").
|
94391
|
+
*/
|
94392
|
+
(0, _defineProperty2.default)(this, "type", void 0);
|
94393
|
+
/**
|
94394
|
+
* @param {string} alignment The alignment CSS class.
|
94395
|
+
*/
|
94396
|
+
(0, _defineProperty2.default)(this, "alignment", void 0);
|
94397
|
+
this.stateBefore = stateBefore;
|
94398
|
+
this.range = range;
|
94399
|
+
this.type = type;
|
94400
|
+
this.alignment = alignment;
|
94379
94401
|
}
|
94380
|
-
|
94381
|
-
|
94382
|
-
|
94383
|
-
|
94384
|
-
|
94385
|
-
|
94402
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94403
|
+
hot.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
|
94404
|
+
undoRedoPlugin.done(() => new CellAlignmentAction({
|
94405
|
+
stateBefore,
|
94406
|
+
range,
|
94407
|
+
type,
|
94408
|
+
alignment
|
94409
|
+
}));
|
94410
|
+
});
|
94386
94411
|
}
|
94387
|
-
|
94388
|
-
|
94389
|
-
|
94390
|
-
|
94412
|
+
|
94413
|
+
/**
|
94414
|
+
* @param {Core} hot The Handsontable instance.
|
94415
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94416
|
+
*/
|
94417
|
+
undo(hot, undoneCallback) {
|
94418
|
+
(0, _array.arrayEach)(this.range, range => {
|
94419
|
+
range.forAll((row, col) => {
|
94420
|
+
// Alignment classes should only collected within cell ranges. We skip header coordinates.
|
94421
|
+
if (row >= 0 && col >= 0) {
|
94422
|
+
hot.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
|
94423
|
+
}
|
94424
|
+
});
|
94425
|
+
});
|
94426
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
94427
|
+
hot.render();
|
94391
94428
|
}
|
94392
|
-
};
|
94393
94429
|
|
94394
|
-
/**
|
94395
|
-
|
94396
|
-
|
94397
|
-
|
94398
|
-
|
94399
|
-
|
94400
|
-
|
94401
|
-
|
94402
|
-
|
94403
|
-
|
94404
|
-
|
94405
|
-
};
|
94406
|
-
(0, _object.inherit)(UndoRedo.CreateRowAction, UndoRedo.Action);
|
94407
|
-
UndoRedo.CreateRowAction.prototype.undo = function (instance, undoneCallback) {
|
94408
|
-
const rowCount = instance.countRows();
|
94409
|
-
const minSpareRows = instance.getSettings().minSpareRows;
|
94410
|
-
if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
|
94411
|
-
this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
|
94412
|
-
}
|
94413
|
-
instance.addHookOnce('afterRemoveRow', undoneCallback);
|
94414
|
-
instance.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
|
94415
|
-
};
|
94416
|
-
UndoRedo.CreateRowAction.prototype.redo = function (instance, redoneCallback) {
|
94417
|
-
instance.addHookOnce('afterCreateRow', redoneCallback);
|
94418
|
-
instance.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');
|
94419
|
-
};
|
94430
|
+
/**
|
94431
|
+
* @param {Core} hot The Handsontable instance.
|
94432
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94433
|
+
*/
|
94434
|
+
redo(hot, redoneCallback) {
|
94435
|
+
(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));
|
94436
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
94437
|
+
hot.render();
|
94438
|
+
}
|
94439
|
+
}
|
94440
|
+
exports.CellAlignmentAction = CellAlignmentAction;
|
94420
94441
|
|
94421
|
-
|
94422
|
-
|
94423
|
-
|
94424
|
-
* @private
|
94425
|
-
* @param {number} index The visual row index.
|
94426
|
-
* @param {Array} data The removed data.
|
94427
|
-
* @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
|
94428
|
-
* @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
|
94429
|
-
* @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
|
94430
|
-
* @param {Array} removedCellMetas List of removed cell metas.
|
94431
|
-
*/
|
94432
|
-
UndoRedo.RemoveRowAction = function (index, data, fixedRowsBottom, fixedRowsTop, rowIndexesSequence, removedCellMetas) {
|
94433
|
-
this.index = index;
|
94434
|
-
this.data = data;
|
94435
|
-
this.actionType = 'remove_row';
|
94436
|
-
this.fixedRowsBottom = fixedRowsBottom;
|
94437
|
-
this.fixedRowsTop = fixedRowsTop;
|
94438
|
-
this.rowIndexesSequence = rowIndexesSequence;
|
94439
|
-
this.removedCellMetas = removedCellMetas;
|
94440
|
-
};
|
94441
|
-
(0, _object.inherit)(UndoRedo.RemoveRowAction, UndoRedo.Action);
|
94442
|
-
UndoRedo.RemoveRowAction.prototype.undo = function (instance, undoneCallback) {
|
94443
|
-
const settings = instance.getSettings();
|
94444
|
-
const changes = [];
|
94442
|
+
/***/ }),
|
94443
|
+
/* 750 */
|
94444
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94445
94445
|
|
94446
|
-
|
94447
|
-
settings.fixedRowsBottom = this.fixedRowsBottom;
|
94448
|
-
settings.fixedRowsTop = this.fixedRowsTop;
|
94446
|
+
"use strict";
|
94449
94447
|
|
94450
|
-
// Prepare the change list to fill the source data.
|
94451
|
-
this.data.forEach((dataRow, rowIndexDelta) => {
|
94452
|
-
Object.keys(dataRow).forEach(columnProp => {
|
94453
|
-
const columnIndex = parseInt(columnProp, 10);
|
94454
|
-
changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
|
94455
|
-
});
|
94456
|
-
});
|
94457
|
-
instance.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
|
94458
|
-
this.removedCellMetas.forEach(_ref2 => {
|
94459
|
-
let [rowIndex, columnIndex, cellMeta] = _ref2;
|
94460
|
-
instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);
|
94461
|
-
});
|
94462
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94463
|
-
instance.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
|
94464
|
-
instance.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
|
94465
|
-
};
|
94466
|
-
UndoRedo.RemoveRowAction.prototype.redo = function (instance, redoneCallback) {
|
94467
|
-
instance.addHookOnce('afterRemoveRow', redoneCallback);
|
94468
|
-
instance.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
|
94469
|
-
};
|
94470
94448
|
|
94449
|
+
exports.__esModule = true;
|
94450
|
+
__webpack_require__(5);
|
94471
94451
|
/**
|
94472
|
-
*
|
94452
|
+
* An abstract class that defines the structure of an undo/redo action.
|
94473
94453
|
*
|
94454
|
+
* @class BaseAction
|
94474
94455
|
* @private
|
94475
|
-
* @param {number} index The visual column index.
|
94476
|
-
* @param {number} amount The number of created columns.
|
94477
94456
|
*/
|
94478
|
-
|
94479
|
-
|
94480
|
-
|
94481
|
-
|
94482
|
-
|
94483
|
-
|
94484
|
-
|
94485
|
-
|
94486
|
-
|
94487
|
-
};
|
94488
|
-
UndoRedo.CreateColumnAction.prototype.redo = function (instance, redoneCallback) {
|
94489
|
-
instance.addHookOnce('afterCreateCol', redoneCallback);
|
94490
|
-
instance.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');
|
94491
|
-
};
|
94457
|
+
class BaseAction {
|
94458
|
+
undo() {
|
94459
|
+
throw new Error('Not implemented');
|
94460
|
+
}
|
94461
|
+
redo() {
|
94462
|
+
throw new Error('Not implemented');
|
94463
|
+
}
|
94464
|
+
}
|
94465
|
+
exports.BaseAction = BaseAction;
|
94492
94466
|
|
94467
|
+
/***/ }),
|
94468
|
+
/* 751 */
|
94469
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94470
|
+
|
94471
|
+
"use strict";
|
94472
|
+
|
94473
|
+
|
94474
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94475
|
+
exports.__esModule = true;
|
94476
|
+
__webpack_require__(115);
|
94477
|
+
__webpack_require__(133);
|
94478
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94479
|
+
var _base = __webpack_require__(750);
|
94480
|
+
var _moves = __webpack_require__(659);
|
94493
94481
|
/**
|
94494
|
-
*
|
94482
|
+
* Action that tracks column move changes.
|
94495
94483
|
*
|
94484
|
+
* @class ColumnMoveAction
|
94496
94485
|
* @private
|
94497
|
-
|
94498
|
-
|
94499
|
-
|
94500
|
-
|
94501
|
-
|
94502
|
-
|
94503
|
-
|
94504
|
-
|
94505
|
-
|
94506
|
-
|
94507
|
-
|
94508
|
-
|
94509
|
-
|
94510
|
-
|
94511
|
-
|
94512
|
-
|
94513
|
-
|
94514
|
-
|
94515
|
-
|
94516
|
-
|
94517
|
-
|
94518
|
-
|
94519
|
-
|
94520
|
-
|
94521
|
-
|
94522
|
-
|
94523
|
-
|
94524
|
-
|
94525
|
-
const ascendingIndexes = this.indexes.slice(0).sort();
|
94526
|
-
const sortByIndexes = (elem, j, arr) => arr[this.indexes.indexOf(ascendingIndexes[j])];
|
94527
|
-
const removedDataLength = this.data.length;
|
94528
|
-
const sortedData = [];
|
94529
|
-
for (let rowIndex = 0; rowIndex < removedDataLength; rowIndex++) {
|
94530
|
-
sortedData.push((0, _array.arrayMap)(this.data[rowIndex], sortByIndexes));
|
94531
|
-
}
|
94532
|
-
const sortedHeaders = (0, _array.arrayMap)(this.headers, sortByIndexes);
|
94533
|
-
const changes = [];
|
94534
|
-
instance.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
|
94535
|
-
(0, _array.arrayEach)(instance.getSourceDataArray(), (rowData, rowIndex) => {
|
94536
|
-
(0, _array.arrayEach)(ascendingIndexes, (changedIndex, contiquesIndex) => {
|
94537
|
-
rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
|
94538
|
-
changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
|
94539
|
-
});
|
94540
|
-
});
|
94541
|
-
instance.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
|
94542
|
-
if (typeof this.headers !== 'undefined') {
|
94543
|
-
(0, _array.arrayEach)(sortedHeaders, (headerData, columnIndex) => {
|
94544
|
-
instance.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
|
94486
|
+
*/
|
94487
|
+
class ColumnMoveAction extends _base.BaseAction {
|
94488
|
+
constructor(_ref) {
|
94489
|
+
let {
|
94490
|
+
columns,
|
94491
|
+
finalIndex
|
94492
|
+
} = _ref;
|
94493
|
+
super();
|
94494
|
+
/**
|
94495
|
+
* @param {number[]} columns An array with moved columns.
|
94496
|
+
*/
|
94497
|
+
(0, _defineProperty2.default)(this, "columns", void 0);
|
94498
|
+
/**
|
94499
|
+
* @param {number} finalIndex The destination index.
|
94500
|
+
*/
|
94501
|
+
(0, _defineProperty2.default)(this, "finalColumnIndex", void 0);
|
94502
|
+
this.columns = columns.slice();
|
94503
|
+
this.finalColumnIndex = finalIndex;
|
94504
|
+
}
|
94505
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94506
|
+
hot.addHook('beforeColumnMove', (columns, finalIndex) => {
|
94507
|
+
if (columns === false) {
|
94508
|
+
return;
|
94509
|
+
}
|
94510
|
+
undoRedoPlugin.done(() => new ColumnMoveAction({
|
94511
|
+
columns,
|
94512
|
+
finalIndex
|
94513
|
+
}));
|
94545
94514
|
});
|
94546
94515
|
}
|
94547
|
-
this.removedCellMetas.forEach(_ref3 => {
|
94548
|
-
let [rowIndex, columnIndex, cellMeta] = _ref3;
|
94549
|
-
instance.setCellMetaObject(rowIndex, columnIndex, cellMeta);
|
94550
|
-
});
|
94551
|
-
instance.batchExecution(() => {
|
94552
|
-
// Restore row sequence in a case when all columns are removed. the original
|
94553
|
-
// row sequence is lost in that case.
|
94554
|
-
instance.rowIndexMapper.setIndexesSequence(this.rowPositions);
|
94555
|
-
instance.columnIndexMapper.setIndexesSequence(this.columnPositions);
|
94556
|
-
}, true);
|
94557
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94558
|
-
instance.render();
|
94559
|
-
};
|
94560
|
-
UndoRedo.RemoveColumnAction.prototype.redo = function (instance, redoneCallback) {
|
94561
|
-
instance.addHookOnce('afterRemoveCol', redoneCallback);
|
94562
|
-
instance.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');
|
94563
|
-
};
|
94564
94516
|
|
94565
|
-
/**
|
94566
|
-
|
94567
|
-
|
94568
|
-
|
94569
|
-
|
94570
|
-
|
94571
|
-
|
94572
|
-
|
94573
|
-
|
94574
|
-
|
94575
|
-
|
94576
|
-
|
94577
|
-
|
94578
|
-
|
94579
|
-
|
94580
|
-
UndoRedo.CellAlignmentAction.prototype.undo = function (instance, undoneCallback) {
|
94581
|
-
(0, _array.arrayEach)(this.range, range => {
|
94582
|
-
range.forAll((row, col) => {
|
94583
|
-
// Alignment classes should only collected within cell ranges. We skip header coordinates.
|
94584
|
-
if (row >= 0 && col >= 0) {
|
94585
|
-
instance.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
|
94517
|
+
/**
|
94518
|
+
* @param {Core} hot The Handsontable instance.
|
94519
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94520
|
+
*/
|
94521
|
+
undo(hot, undoneCallback) {
|
94522
|
+
const manualColumnMove = hot.getPlugin('manualColumnMove');
|
94523
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
94524
|
+
const columnMoves = (0, _moves.getMoves)(this.columns, this.finalColumnIndex, hot.columnIndexMapper.getNumberOfIndexes());
|
94525
|
+
columnMoves.reverse().forEach(_ref2 => {
|
94526
|
+
let {
|
94527
|
+
from,
|
94528
|
+
to
|
94529
|
+
} = _ref2;
|
94530
|
+
if (from < to) {
|
94531
|
+
to -= 1;
|
94586
94532
|
}
|
94533
|
+
manualColumnMove.moveColumn(to, from);
|
94587
94534
|
});
|
94588
|
-
|
94589
|
-
|
94590
|
-
|
94591
|
-
}
|
94592
|
-
UndoRedo.CellAlignmentAction.prototype.redo = function (instance, undoneCallback) {
|
94593
|
-
(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));
|
94594
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94595
|
-
instance.render();
|
94596
|
-
};
|
94535
|
+
hot.render();
|
94536
|
+
hot.deselectCell();
|
94537
|
+
hot.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);
|
94538
|
+
}
|
94597
94539
|
|
94598
|
-
/**
|
94599
|
-
|
94600
|
-
|
94601
|
-
|
94602
|
-
|
94603
|
-
|
94604
|
-
|
94605
|
-
|
94606
|
-
|
94607
|
-
|
94608
|
-
|
94609
|
-
}
|
94610
|
-
|
94611
|
-
|
94612
|
-
const filters = instance.getPlugin('filters');
|
94613
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94614
|
-
if (this.previousConditionsStack) {
|
94615
|
-
filters.conditionCollection.importAllConditions(this.previousConditionsStack);
|
94616
|
-
}
|
94617
|
-
filters.filter();
|
94618
|
-
};
|
94619
|
-
UndoRedo.FiltersAction.prototype.redo = function (instance, redoneCallback) {
|
94620
|
-
const filters = instance.getPlugin('filters');
|
94621
|
-
instance.addHookOnce('afterViewRender', redoneCallback);
|
94622
|
-
filters.conditionCollection.importAllConditions(this.conditionsStack);
|
94623
|
-
filters.filter();
|
94624
|
-
};
|
94540
|
+
/**
|
94541
|
+
* @param {Core} hot The Handsontable instance.
|
94542
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94543
|
+
*/
|
94544
|
+
redo(hot, redoneCallback) {
|
94545
|
+
const manualColumnMove = hot.getPlugin('manualColumnMove');
|
94546
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
94547
|
+
manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
|
94548
|
+
hot.render();
|
94549
|
+
hot.deselectCell();
|
94550
|
+
hot.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
|
94551
|
+
}
|
94552
|
+
}
|
94553
|
+
exports.ColumnMoveAction = ColumnMoveAction;
|
94625
94554
|
|
94555
|
+
/***/ }),
|
94556
|
+
/* 752 */
|
94557
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94558
|
+
|
94559
|
+
"use strict";
|
94560
|
+
|
94561
|
+
|
94562
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94563
|
+
exports.__esModule = true;
|
94564
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94565
|
+
var _base = __webpack_require__(750);
|
94626
94566
|
/**
|
94627
|
-
*
|
94567
|
+
* Action that tracks column sort changes.
|
94628
94568
|
*
|
94629
|
-
* @
|
94569
|
+
* @class ColumnSortAction
|
94570
|
+
* @private
|
94630
94571
|
*/
|
94631
|
-
class
|
94632
|
-
constructor(
|
94572
|
+
class ColumnSortAction extends _base.BaseAction {
|
94573
|
+
constructor(_ref) {
|
94574
|
+
let {
|
94575
|
+
currentSortState,
|
94576
|
+
newSortState
|
94577
|
+
} = _ref;
|
94633
94578
|
super();
|
94634
|
-
|
94635
|
-
|
94636
|
-
|
94637
|
-
|
94579
|
+
/**
|
94580
|
+
* @param {Array} currentSortState The current sort state.
|
94581
|
+
*/
|
94582
|
+
(0, _defineProperty2.default)(this, "previousSortState", void 0);
|
94583
|
+
/**
|
94584
|
+
* @param {Array} newSortState The new sort state.
|
94585
|
+
*/
|
94586
|
+
(0, _defineProperty2.default)(this, "nextSortState", void 0);
|
94587
|
+
this.previousSortState = currentSortState;
|
94588
|
+
this.nextSortState = newSortState;
|
94638
94589
|
}
|
94639
|
-
|
94640
|
-
|
94641
|
-
|
94642
|
-
|
94643
|
-
|
94644
|
-
|
94590
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94591
|
+
hot.addHook('beforeColumnSort', (currentSortState, newSortState, sortPossible) => {
|
94592
|
+
if (!sortPossible) {
|
94593
|
+
return;
|
94594
|
+
}
|
94595
|
+
undoRedoPlugin.done(() => new ColumnSortAction({
|
94596
|
+
currentSortState,
|
94597
|
+
newSortState
|
94598
|
+
}));
|
94599
|
+
});
|
94645
94600
|
}
|
94646
|
-
|
94647
|
-
|
94648
|
-
|
94649
|
-
|
94601
|
+
|
94602
|
+
/**
|
94603
|
+
* @param {Core} hot The Handsontable instance.
|
94604
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94605
|
+
*/
|
94606
|
+
undo(hot, undoneCallback) {
|
94607
|
+
const sortPlugin = hot.getPlugin('columnSorting');
|
94608
|
+
const multiSortPlugin = hot.getPlugin('multiColumnSorting');
|
94609
|
+
const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
|
94610
|
+
if (this.previousSortState.length) {
|
94611
|
+
enabledSortPlugin.sort(this.previousSortState);
|
94612
|
+
} else {
|
94613
|
+
enabledSortPlugin.clearSort();
|
94614
|
+
}
|
94615
|
+
undoneCallback();
|
94616
|
+
}
|
94617
|
+
|
94618
|
+
/**
|
94619
|
+
* @param {Core} hot The Handsontable instance.
|
94620
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94621
|
+
*/
|
94622
|
+
redo(hot, redoneCallback) {
|
94623
|
+
const sortPlugin = hot.getPlugin('columnSorting');
|
94624
|
+
const multiSortPlugin = hot.getPlugin('multiColumnSorting');
|
94625
|
+
const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
|
94626
|
+
enabledSortPlugin.sort(this.nextSortState);
|
94627
|
+
redoneCallback();
|
94650
94628
|
}
|
94651
94629
|
}
|
94652
|
-
|
94630
|
+
exports.ColumnSortAction = ColumnSortAction;
|
94631
|
+
|
94632
|
+
/***/ }),
|
94633
|
+
/* 753 */
|
94634
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94635
|
+
|
94636
|
+
"use strict";
|
94653
94637
|
|
94638
|
+
|
94639
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94640
|
+
exports.__esModule = true;
|
94641
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94642
|
+
var _base = __webpack_require__(750);
|
94654
94643
|
/**
|
94655
|
-
*
|
94644
|
+
* Action that tracks column creation.
|
94656
94645
|
*
|
94657
|
-
* @
|
94646
|
+
* @class CreateColumnAction
|
94647
|
+
* @private
|
94658
94648
|
*/
|
94659
|
-
class
|
94660
|
-
constructor(
|
94649
|
+
class CreateColumnAction extends _base.BaseAction {
|
94650
|
+
constructor(_ref) {
|
94651
|
+
let {
|
94652
|
+
index,
|
94653
|
+
amount
|
94654
|
+
} = _ref;
|
94661
94655
|
super();
|
94662
|
-
|
94656
|
+
/**
|
94657
|
+
* @param {number} index The visual column index.
|
94658
|
+
*/
|
94659
|
+
(0, _defineProperty2.default)(this, "index", void 0);
|
94660
|
+
/**
|
94661
|
+
* @param {number} amount The number of created columns.
|
94662
|
+
*/
|
94663
|
+
(0, _defineProperty2.default)(this, "amount", void 0);
|
94664
|
+
this.index = index;
|
94665
|
+
this.amount = amount;
|
94663
94666
|
}
|
94664
|
-
|
94665
|
-
|
94666
|
-
|
94667
|
-
|
94667
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94668
|
+
hot.addHook('afterCreateCol', (index, amount, source) => {
|
94669
|
+
undoRedoPlugin.done(() => new CreateColumnAction({
|
94670
|
+
index,
|
94671
|
+
amount
|
94672
|
+
}), source);
|
94673
|
+
});
|
94668
94674
|
}
|
94669
|
-
|
94670
|
-
|
94671
|
-
|
94672
|
-
|
94673
|
-
|
94675
|
+
|
94676
|
+
/**
|
94677
|
+
* @param {Core} hot The Handsontable instance.
|
94678
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94679
|
+
*/
|
94680
|
+
undo(hot, undoneCallback) {
|
94681
|
+
hot.addHookOnce('afterRemoveCol', undoneCallback);
|
94682
|
+
hot.alter('remove_col', this.index, this.amount, 'UndoRedo.undo');
|
94683
|
+
}
|
94684
|
+
|
94685
|
+
/**
|
94686
|
+
* @param {Core} hot The Handsontable instance.
|
94687
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94688
|
+
*/
|
94689
|
+
redo(hot, redoneCallback) {
|
94690
|
+
hot.addHookOnce('afterCreateCol', redoneCallback);
|
94691
|
+
hot.alter('insert_col_start', this.index, this.amount, 'UndoRedo.redo');
|
94674
94692
|
}
|
94675
94693
|
}
|
94676
|
-
|
94694
|
+
exports.CreateColumnAction = CreateColumnAction;
|
94695
|
+
|
94696
|
+
/***/ }),
|
94697
|
+
/* 754 */
|
94698
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94699
|
+
|
94700
|
+
"use strict";
|
94677
94701
|
|
94702
|
+
|
94703
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94704
|
+
exports.__esModule = true;
|
94705
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94706
|
+
var _base = __webpack_require__(750);
|
94678
94707
|
/**
|
94679
|
-
*
|
94708
|
+
* Action that tracks row creation.
|
94680
94709
|
*
|
94681
|
-
* @
|
94710
|
+
* @class CreateRowAction
|
94682
94711
|
* @private
|
94683
|
-
* @param {number[]} rows An array with moved rows.
|
94684
|
-
* @param {number} finalIndex The destination index.
|
94685
94712
|
*/
|
94686
|
-
|
94687
|
-
|
94688
|
-
this.finalRowIndex = finalIndex;
|
94689
|
-
this.actionType = 'row_move';
|
94690
|
-
};
|
94691
|
-
(0, _object.inherit)(UndoRedo.RowMoveAction, UndoRedo.Action);
|
94692
|
-
UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
|
94693
|
-
const manualRowMove = instance.getPlugin('manualRowMove');
|
94694
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94695
|
-
const rowMoves = (0, _moves.getMoves)(this.rows, this.finalRowIndex, instance.rowIndexMapper.getNumberOfIndexes());
|
94696
|
-
rowMoves.reverse().forEach(_ref4 => {
|
94713
|
+
class CreateRowAction extends _base.BaseAction {
|
94714
|
+
constructor(_ref) {
|
94697
94715
|
let {
|
94698
|
-
|
94699
|
-
|
94700
|
-
} =
|
94701
|
-
|
94702
|
-
|
94716
|
+
index,
|
94717
|
+
amount
|
94718
|
+
} = _ref;
|
94719
|
+
super();
|
94720
|
+
/**
|
94721
|
+
* @param {number} index The visual row index.
|
94722
|
+
*/
|
94723
|
+
(0, _defineProperty2.default)(this, "index", void 0);
|
94724
|
+
/**
|
94725
|
+
* @param {number} amount The number of created rows.
|
94726
|
+
*/
|
94727
|
+
(0, _defineProperty2.default)(this, "amount", void 0);
|
94728
|
+
this.index = index;
|
94729
|
+
this.amount = amount;
|
94730
|
+
}
|
94731
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94732
|
+
hot.addHook('afterCreateRow', (index, amount, source) => {
|
94733
|
+
undoRedoPlugin.done(() => new CreateRowAction({
|
94734
|
+
index,
|
94735
|
+
amount
|
94736
|
+
}), source);
|
94737
|
+
});
|
94738
|
+
}
|
94739
|
+
|
94740
|
+
/**
|
94741
|
+
* @param {Core} hot The Handsontable instance.
|
94742
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94743
|
+
*/
|
94744
|
+
undo(hot, undoneCallback) {
|
94745
|
+
const rowCount = hot.countRows();
|
94746
|
+
const minSpareRows = hot.getSettings().minSpareRows;
|
94747
|
+
if (this.index >= rowCount && this.index - minSpareRows < rowCount) {
|
94748
|
+
this.index -= minSpareRows; // work around the situation where the needed row was removed due to an 'undo' of a made change
|
94703
94749
|
}
|
94704
|
-
|
94705
|
-
|
94706
|
-
|
94707
|
-
instance.deselectCell();
|
94708
|
-
instance.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
|
94709
|
-
};
|
94710
|
-
UndoRedo.RowMoveAction.prototype.redo = function (instance, redoneCallback) {
|
94711
|
-
const manualRowMove = instance.getPlugin('manualRowMove');
|
94712
|
-
instance.addHookOnce('afterViewRender', redoneCallback);
|
94713
|
-
manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
|
94714
|
-
instance.render();
|
94715
|
-
instance.deselectCell();
|
94716
|
-
instance.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
|
94717
|
-
};
|
94750
|
+
hot.addHookOnce('afterRemoveRow', undoneCallback);
|
94751
|
+
hot.alter('remove_row', this.index, this.amount, 'UndoRedo.undo');
|
94752
|
+
}
|
94718
94753
|
|
94754
|
+
/**
|
94755
|
+
* @param {Core} hot The Handsontable instance.
|
94756
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94757
|
+
*/
|
94758
|
+
redo(hot, redoneCallback) {
|
94759
|
+
hot.addHookOnce('afterCreateRow', redoneCallback);
|
94760
|
+
hot.alter('insert_row_above', this.index, this.amount, 'UndoRedo.redo');
|
94761
|
+
}
|
94762
|
+
}
|
94763
|
+
exports.CreateRowAction = CreateRowAction;
|
94764
|
+
|
94765
|
+
/***/ }),
|
94766
|
+
/* 755 */
|
94767
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94768
|
+
|
94769
|
+
"use strict";
|
94770
|
+
|
94771
|
+
|
94772
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94773
|
+
exports.__esModule = true;
|
94774
|
+
__webpack_require__(87);
|
94775
|
+
__webpack_require__(115);
|
94776
|
+
__webpack_require__(185);
|
94777
|
+
__webpack_require__(196);
|
94778
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94779
|
+
var _base = __webpack_require__(750);
|
94780
|
+
var _object = __webpack_require__(165);
|
94781
|
+
var _array = __webpack_require__(161);
|
94719
94782
|
/**
|
94720
|
-
*
|
94783
|
+
* Action that tracks data changes.
|
94721
94784
|
*
|
94785
|
+
* @class DataChangeAction
|
94722
94786
|
* @private
|
94723
|
-
* @param {number[]} columns An array with moved columns.
|
94724
|
-
* @param {number} finalIndex The destination index.
|
94725
94787
|
*/
|
94726
|
-
|
94727
|
-
|
94728
|
-
this.finalColumnIndex = finalIndex;
|
94729
|
-
this.actionType = 'col_move';
|
94730
|
-
};
|
94731
|
-
(0, _object.inherit)(UndoRedo.ColumnMoveAction, UndoRedo.Action);
|
94732
|
-
UndoRedo.ColumnMoveAction.prototype.undo = function (instance, undoneCallback) {
|
94733
|
-
const manualColumnMove = instance.getPlugin('manualColumnMove');
|
94734
|
-
instance.addHookOnce('afterViewRender', undoneCallback);
|
94735
|
-
const columnMoves = (0, _moves.getMoves)(this.columns, this.finalColumnIndex, instance.columnIndexMapper.getNumberOfIndexes());
|
94736
|
-
columnMoves.reverse().forEach(_ref5 => {
|
94788
|
+
class DataChangeAction extends _base.BaseAction {
|
94789
|
+
constructor(_ref) {
|
94737
94790
|
let {
|
94738
|
-
|
94739
|
-
|
94740
|
-
} =
|
94741
|
-
|
94742
|
-
|
94791
|
+
changes,
|
94792
|
+
selected
|
94793
|
+
} = _ref;
|
94794
|
+
super();
|
94795
|
+
/**
|
94796
|
+
* @param {Array} changes 2D array containing information about each of the edited cells.
|
94797
|
+
*/
|
94798
|
+
(0, _defineProperty2.default)(this, "changes", void 0);
|
94799
|
+
/**
|
94800
|
+
* @param {number[]} selected The cell selection.
|
94801
|
+
*/
|
94802
|
+
(0, _defineProperty2.default)(this, "selected", void 0);
|
94803
|
+
this.changes = changes;
|
94804
|
+
this.selected = selected;
|
94805
|
+
}
|
94806
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94807
|
+
hot.addHook('afterChange', function (changes, source) {
|
94808
|
+
const changesLen = changes && changes.length;
|
94809
|
+
if (!changesLen) {
|
94810
|
+
return;
|
94811
|
+
}
|
94812
|
+
const hasDifferences = changes.find(change => {
|
94813
|
+
const [,, oldValue, newValue] = change;
|
94814
|
+
return oldValue !== newValue;
|
94815
|
+
});
|
94816
|
+
if (!hasDifferences) {
|
94817
|
+
return;
|
94818
|
+
}
|
94819
|
+
const wrappedAction = () => {
|
94820
|
+
const clonedChanges = changes.reduce((arr, change) => {
|
94821
|
+
arr.push([...change]);
|
94822
|
+
return arr;
|
94823
|
+
}, []);
|
94824
|
+
(0, _array.arrayEach)(clonedChanges, change => {
|
94825
|
+
change[1] = hot.propToCol(change[1]);
|
94826
|
+
});
|
94827
|
+
const selected = changesLen > 1 ? this.getSelected() : [[clonedChanges[0][0], clonedChanges[0][1]]];
|
94828
|
+
return new DataChangeAction({
|
94829
|
+
changes: clonedChanges,
|
94830
|
+
selected
|
94831
|
+
});
|
94832
|
+
};
|
94833
|
+
undoRedoPlugin.done(wrappedAction, source);
|
94834
|
+
});
|
94835
|
+
}
|
94836
|
+
|
94837
|
+
/**
|
94838
|
+
* @param {Core} hot The Handsontable instance.
|
94839
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94840
|
+
*/
|
94841
|
+
undo(hot, undoneCallback) {
|
94842
|
+
const data = (0, _object.deepClone)(this.changes);
|
94843
|
+
const emptyRowsAtTheEnd = hot.countEmptyRows(true);
|
94844
|
+
const emptyColsAtTheEnd = hot.countEmptyCols(true);
|
94845
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
94846
|
+
data[i].splice(3, 1);
|
94743
94847
|
}
|
94744
|
-
|
94745
|
-
|
94746
|
-
|
94747
|
-
|
94748
|
-
|
94749
|
-
|
94750
|
-
|
94751
|
-
|
94752
|
-
|
94753
|
-
|
94754
|
-
|
94755
|
-
|
94756
|
-
|
94757
|
-
|
94848
|
+
hot.addHookOnce('afterChange', undoneCallback);
|
94849
|
+
hot.setDataAtCell(data, null, null, 'UndoRedo.undo');
|
94850
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
94851
|
+
const [row, column] = data[i];
|
94852
|
+
if (hot.getSettings().minSpareRows && row + 1 + hot.getSettings().minSpareRows === hot.countRows() && emptyRowsAtTheEnd === hot.getSettings().minSpareRows) {
|
94853
|
+
hot.alter('remove_row', parseInt(row + 1, 10), hot.getSettings().minSpareRows);
|
94854
|
+
hot.getPlugin('undoRedo').doneActions.pop();
|
94855
|
+
}
|
94856
|
+
if (hot.getSettings().minSpareCols && column + 1 + hot.getSettings().minSpareCols === hot.countCols() && emptyColsAtTheEnd === hot.getSettings().minSpareCols) {
|
94857
|
+
hot.alter('remove_col', parseInt(column + 1, 10), hot.getSettings().minSpareCols);
|
94858
|
+
hot.getPlugin('undoRedo').doneActions.pop();
|
94859
|
+
}
|
94860
|
+
}
|
94861
|
+
hot.scrollToFocusedCell();
|
94862
|
+
hot.selectCells(this.selected, false, false);
|
94863
|
+
}
|
94758
94864
|
|
94759
|
-
/**
|
94760
|
-
|
94761
|
-
|
94762
|
-
|
94763
|
-
|
94764
|
-
|
94765
|
-
|
94766
|
-
|
94767
|
-
|
94768
|
-
|
94769
|
-
|
94770
|
-
(
|
94771
|
-
|
94772
|
-
|
94773
|
-
const multiSortPlugin = instance.getPlugin('multiColumnSorting');
|
94774
|
-
const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
|
94775
|
-
if (this.previousSortState.length) {
|
94776
|
-
enabledSortPlugin.sort(this.previousSortState);
|
94777
|
-
} else {
|
94778
|
-
enabledSortPlugin.clearSort();
|
94865
|
+
/**
|
94866
|
+
* @param {Core} hot The Handsontable instance.
|
94867
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94868
|
+
*/
|
94869
|
+
redo(hot, redoneCallback) {
|
94870
|
+
const data = (0, _object.deepClone)(this.changes);
|
94871
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
94872
|
+
data[i].splice(2, 1);
|
94873
|
+
}
|
94874
|
+
hot.addHookOnce('afterChange', redoneCallback);
|
94875
|
+
hot.setDataAtCell(data, null, null, 'UndoRedo.redo');
|
94876
|
+
if (this.selected) {
|
94877
|
+
hot.selectCells(this.selected, false, false);
|
94878
|
+
}
|
94779
94879
|
}
|
94780
|
-
|
94781
|
-
|
94782
|
-
UndoRedo.ColumnSortAction.prototype.redo = function (instance, redoneCallback) {
|
94783
|
-
const sortPlugin = instance.getPlugin('columnSorting');
|
94784
|
-
const multiSortPlugin = instance.getPlugin('multiColumnSorting');
|
94785
|
-
const enabledSortPlugin = multiSortPlugin.isEnabled() ? multiSortPlugin : sortPlugin;
|
94786
|
-
enabledSortPlugin.sort(this.nextSortState);
|
94787
|
-
redoneCallback();
|
94788
|
-
};
|
94880
|
+
}
|
94881
|
+
exports.DataChangeAction = DataChangeAction;
|
94789
94882
|
|
94883
|
+
/***/ }),
|
94884
|
+
/* 756 */
|
94885
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94886
|
+
|
94887
|
+
"use strict";
|
94888
|
+
|
94889
|
+
|
94890
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94891
|
+
exports.__esModule = true;
|
94892
|
+
__webpack_require__(115);
|
94893
|
+
__webpack_require__(127);
|
94894
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94895
|
+
var _base = __webpack_require__(750);
|
94790
94896
|
/**
|
94791
|
-
*
|
94897
|
+
* Action that tracks filter changes.
|
94792
94898
|
*
|
94899
|
+
* @class FiltersAction
|
94793
94900
|
* @private
|
94794
94901
|
*/
|
94795
|
-
|
94796
|
-
|
94797
|
-
|
94798
|
-
|
94799
|
-
|
94902
|
+
class FiltersAction extends _base.BaseAction {
|
94903
|
+
constructor(_ref) {
|
94904
|
+
let {
|
94905
|
+
conditionsStack,
|
94906
|
+
previousConditionsStack
|
94907
|
+
} = _ref;
|
94908
|
+
super();
|
94909
|
+
/**
|
94910
|
+
* @param {Array} previousConditionsStack An array of the previous filter conditions.
|
94911
|
+
*/
|
94912
|
+
(0, _defineProperty2.default)(this, "conditionsStack", void 0);
|
94913
|
+
/**
|
94914
|
+
* @param {Array} conditionsStack An array of the filter conditions.
|
94915
|
+
*/
|
94916
|
+
(0, _defineProperty2.default)(this, "previousConditionsStack", void 0);
|
94917
|
+
this.conditionsStack = conditionsStack;
|
94918
|
+
this.previousConditionsStack = previousConditionsStack;
|
94800
94919
|
}
|
94801
|
-
|
94802
|
-
|
94803
|
-
|
94804
|
-
|
94920
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94921
|
+
hot.addHook('beforeFilter', (conditionsStack, previousConditionsStack) => {
|
94922
|
+
undoRedoPlugin.done(() => new FiltersAction({
|
94923
|
+
conditionsStack,
|
94924
|
+
previousConditionsStack
|
94925
|
+
}));
|
94926
|
+
});
|
94805
94927
|
}
|
94806
|
-
};
|
94807
94928
|
|
94808
|
-
/**
|
94809
|
-
|
94810
|
-
|
94811
|
-
|
94812
|
-
|
94813
|
-
|
94814
|
-
|
94815
|
-
|
94816
|
-
|
94817
|
-
return !event.altKey; // right ALT in some systems triggers ALT+CTR
|
94818
|
-
};
|
94819
|
-
const config = {
|
94820
|
-
runOnlyIf,
|
94821
|
-
group: SHORTCUTS_GROUP
|
94822
|
-
};
|
94823
|
-
gridContext.addShortcuts([{
|
94824
|
-
keys: [['Control/Meta', 'z']],
|
94825
|
-
callback: () => {
|
94826
|
-
this.undo();
|
94827
|
-
}
|
94828
|
-
}, {
|
94829
|
-
keys: [['Control/Meta', 'y'], ['Control/Meta', 'Shift', 'z']],
|
94830
|
-
callback: () => {
|
94831
|
-
this.redo();
|
94929
|
+
/**
|
94930
|
+
* @param {Core} hot The Handsontable instance.
|
94931
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94932
|
+
*/
|
94933
|
+
undo(hot, undoneCallback) {
|
94934
|
+
const filters = hot.getPlugin('filters');
|
94935
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
94936
|
+
if (this.previousConditionsStack) {
|
94937
|
+
filters.conditionCollection.importAllConditions(this.previousConditionsStack);
|
94832
94938
|
}
|
94833
|
-
|
94834
|
-
}
|
94939
|
+
filters.filter();
|
94940
|
+
}
|
94941
|
+
|
94942
|
+
/**
|
94943
|
+
* @param {Core} hot The Handsontable instance.
|
94944
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94945
|
+
*/
|
94946
|
+
redo(hot, redoneCallback) {
|
94947
|
+
const filters = hot.getPlugin('filters');
|
94948
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
94949
|
+
filters.conditionCollection.importAllConditions(this.conditionsStack);
|
94950
|
+
filters.filter();
|
94951
|
+
}
|
94952
|
+
}
|
94953
|
+
exports.FiltersAction = FiltersAction;
|
94835
94954
|
|
94955
|
+
/***/ }),
|
94956
|
+
/* 757 */
|
94957
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94958
|
+
|
94959
|
+
"use strict";
|
94960
|
+
|
94961
|
+
|
94962
|
+
var _interopRequireDefault = __webpack_require__(1);
|
94963
|
+
exports.__esModule = true;
|
94964
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
94965
|
+
var _base = __webpack_require__(750);
|
94836
94966
|
/**
|
94837
|
-
*
|
94967
|
+
* Action that tracks changes in merged cells.
|
94838
94968
|
*
|
94969
|
+
* @class MergeCellsAction
|
94839
94970
|
* @private
|
94840
94971
|
*/
|
94841
|
-
|
94842
|
-
|
94843
|
-
|
94844
|
-
|
94845
|
-
|
94846
|
-
|
94847
|
-
|
94848
|
-
|
94849
|
-
|
94850
|
-
|
94851
|
-
|
94852
|
-
|
94853
|
-
|
94854
|
-
|
94855
|
-
|
94972
|
+
class MergeCellsAction extends _base.BaseAction {
|
94973
|
+
constructor(_ref) {
|
94974
|
+
let {
|
94975
|
+
data,
|
94976
|
+
cellRange
|
94977
|
+
} = _ref;
|
94978
|
+
super();
|
94979
|
+
(0, _defineProperty2.default)(this, "cellRange", void 0);
|
94980
|
+
this.cellRange = cellRange;
|
94981
|
+
this.data = data;
|
94982
|
+
}
|
94983
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
94984
|
+
hot.addHook('beforeMergeCells', (cellRange, auto) => {
|
94985
|
+
if (auto) {
|
94986
|
+
return;
|
94987
|
+
}
|
94988
|
+
const topStartCorner = cellRange.getTopStartCorner();
|
94989
|
+
const bottomEndCorner = cellRange.getBottomEndCorner();
|
94990
|
+
const data = hot.getData(topStartCorner.row, topStartCorner.col, bottomEndCorner.row, bottomEndCorner.col);
|
94991
|
+
undoRedoPlugin.done(() => new MergeCellsAction({
|
94992
|
+
data,
|
94993
|
+
cellRange
|
94994
|
+
}));
|
94995
|
+
});
|
94856
94996
|
}
|
94857
|
-
}
|
94858
94997
|
|
94859
|
-
/**
|
94860
|
-
* @param {Core} instance The Handsontable instance.
|
94861
|
-
*/
|
94862
|
-
function exposeUndoRedoMethods(instance) {
|
94863
94998
|
/**
|
94864
|
-
*
|
94865
|
-
*
|
94866
|
-
* @alias undo
|
94867
|
-
* @memberof! Core#
|
94868
|
-
* @returns {boolean}
|
94999
|
+
* @param {Core} hot The Handsontable instance.
|
95000
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94869
95001
|
*/
|
94870
|
-
|
94871
|
-
|
94872
|
-
|
95002
|
+
undo(hot, undoneCallback) {
|
95003
|
+
const mergeCellsPlugin = hot.getPlugin('mergeCells');
|
95004
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
95005
|
+
mergeCellsPlugin.unmergeRange(this.cellRange, true);
|
95006
|
+
const topStartCorner = this.cellRange.getTopStartCorner();
|
95007
|
+
hot.populateFromArray(topStartCorner.row, topStartCorner.col, this.data, undefined, undefined, 'MergeCells');
|
95008
|
+
}
|
94873
95009
|
|
94874
95010
|
/**
|
94875
|
-
*
|
94876
|
-
*
|
94877
|
-
* @alias redo
|
94878
|
-
* @memberof! Core#
|
94879
|
-
* @returns {boolean}
|
95011
|
+
* @param {Core} hot The Handsontable instance.
|
95012
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94880
95013
|
*/
|
94881
|
-
|
94882
|
-
|
94883
|
-
|
95014
|
+
redo(hot, redoneCallback) {
|
95015
|
+
const mergeCellsPlugin = hot.getPlugin('mergeCells');
|
95016
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
95017
|
+
mergeCellsPlugin.mergeRange(this.cellRange);
|
95018
|
+
}
|
95019
|
+
}
|
95020
|
+
exports.MergeCellsAction = MergeCellsAction;
|
94884
95021
|
|
94885
|
-
|
94886
|
-
|
94887
|
-
|
94888
|
-
|
94889
|
-
|
94890
|
-
|
94891
|
-
|
94892
|
-
|
94893
|
-
|
94894
|
-
|
95022
|
+
/***/ }),
|
95023
|
+
/* 758 */
|
95024
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
95025
|
+
|
95026
|
+
"use strict";
|
95027
|
+
|
95028
|
+
|
95029
|
+
var _interopRequireDefault = __webpack_require__(1);
|
95030
|
+
exports.__esModule = true;
|
95031
|
+
__webpack_require__(87);
|
95032
|
+
__webpack_require__(115);
|
95033
|
+
__webpack_require__(133);
|
95034
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
95035
|
+
var _base = __webpack_require__(750);
|
95036
|
+
var _utils = __webpack_require__(759);
|
95037
|
+
var _number = __webpack_require__(200);
|
95038
|
+
var _array = __webpack_require__(161);
|
95039
|
+
/**
|
95040
|
+
* Action that tracks changes in column removal.
|
95041
|
+
*
|
95042
|
+
* @class RemoveColumnAction
|
95043
|
+
* @private
|
95044
|
+
*/
|
95045
|
+
class RemoveColumnAction extends _base.BaseAction {
|
95046
|
+
constructor(_ref) {
|
95047
|
+
let {
|
95048
|
+
index,
|
95049
|
+
indexes,
|
95050
|
+
data,
|
95051
|
+
headers,
|
95052
|
+
columnPositions,
|
95053
|
+
rowPositions,
|
95054
|
+
fixedColumnsStart,
|
95055
|
+
removedCellMetas
|
95056
|
+
} = _ref;
|
95057
|
+
super();
|
95058
|
+
/**
|
95059
|
+
* @param {number} index The visual column index.
|
95060
|
+
*/
|
95061
|
+
(0, _defineProperty2.default)(this, "index", void 0);
|
95062
|
+
/**
|
95063
|
+
* @param {number[]} indexes The visual column indexes.
|
95064
|
+
*/
|
95065
|
+
(0, _defineProperty2.default)(this, "indexes", void 0);
|
95066
|
+
/**
|
95067
|
+
* @param {Array} data The removed data.
|
95068
|
+
*/
|
95069
|
+
(0, _defineProperty2.default)(this, "data", void 0);
|
95070
|
+
/**
|
95071
|
+
* @param {number} amount The number of removed columns.
|
95072
|
+
*/
|
95073
|
+
(0, _defineProperty2.default)(this, "amount", void 0);
|
95074
|
+
/**
|
95075
|
+
* @param {Array} headers The header values.
|
95076
|
+
*/
|
95077
|
+
(0, _defineProperty2.default)(this, "headers", void 0);
|
95078
|
+
/**
|
95079
|
+
* @param {number[]} columnPositions The column position.
|
95080
|
+
*/
|
95081
|
+
(0, _defineProperty2.default)(this, "columnPositions", void 0);
|
95082
|
+
/**
|
95083
|
+
* @param {number[]} rowPositions The row position.
|
95084
|
+
*/
|
95085
|
+
(0, _defineProperty2.default)(this, "rowPositions", void 0);
|
95086
|
+
/**
|
95087
|
+
* @param {number} fixedColumnsStart Number of fixed columns on the left. Remove column action change it sometimes.
|
95088
|
+
*/
|
95089
|
+
(0, _defineProperty2.default)(this, "fixedColumnsStart", void 0);
|
95090
|
+
/**
|
95091
|
+
* @param {Array} removedCellMetas List of removed cell metas.
|
95092
|
+
*/
|
95093
|
+
(0, _defineProperty2.default)(this, "removedCellMetas", void 0);
|
95094
|
+
this.index = index;
|
95095
|
+
this.indexes = indexes;
|
95096
|
+
this.data = data;
|
95097
|
+
this.amount = this.data[0].length;
|
95098
|
+
this.headers = headers;
|
95099
|
+
this.columnPositions = columnPositions.slice(0);
|
95100
|
+
this.rowPositions = rowPositions.slice(0);
|
95101
|
+
this.fixedColumnsStart = fixedColumnsStart;
|
95102
|
+
this.removedCellMetas = removedCellMetas;
|
95103
|
+
}
|
95104
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
95105
|
+
hot.addHook('beforeRemoveCol', (index, amount, logicColumns, source) => {
|
95106
|
+
const wrappedAction = () => {
|
95107
|
+
const originalData = hot.getSourceDataArray();
|
95108
|
+
const columnIndex = (hot.countCols() + index) % hot.countCols();
|
95109
|
+
const lastColumnIndex = columnIndex + amount - 1;
|
95110
|
+
const removedData = [];
|
95111
|
+
const headers = [];
|
95112
|
+
const indexes = [];
|
95113
|
+
(0, _number.rangeEach)(originalData.length - 1, i => {
|
95114
|
+
const column = [];
|
95115
|
+
const origRow = originalData[i];
|
95116
|
+
(0, _number.rangeEach)(columnIndex, lastColumnIndex, j => {
|
95117
|
+
column.push(origRow[hot.toPhysicalColumn(j)]);
|
95118
|
+
});
|
95119
|
+
removedData.push(column);
|
95120
|
+
});
|
95121
|
+
(0, _number.rangeEach)(amount - 1, i => {
|
95122
|
+
indexes.push(hot.toPhysicalColumn(columnIndex + i));
|
95123
|
+
});
|
95124
|
+
if (Array.isArray(hot.getSettings().colHeaders)) {
|
95125
|
+
(0, _number.rangeEach)(amount - 1, i => {
|
95126
|
+
headers.push(hot.getSettings().colHeaders[hot.toPhysicalColumn(columnIndex + i)] || null);
|
95127
|
+
});
|
95128
|
+
}
|
95129
|
+
const columnsMap = hot.columnIndexMapper.getIndexesSequence();
|
95130
|
+
const rowsMap = hot.rowIndexMapper.getIndexesSequence();
|
95131
|
+
return new RemoveColumnAction({
|
95132
|
+
index: columnIndex,
|
95133
|
+
indexes,
|
95134
|
+
data: removedData,
|
95135
|
+
headers,
|
95136
|
+
columnPositions: columnsMap,
|
95137
|
+
rowPositions: rowsMap,
|
95138
|
+
fixedColumnsStart: hot.getSettings().fixedColumnsStart,
|
95139
|
+
removedCellMetas: (0, _utils.getCellMetas)(hot, 0, hot.countRows(), columnIndex, lastColumnIndex)
|
95140
|
+
});
|
95141
|
+
};
|
95142
|
+
undoRedoPlugin.done(wrappedAction, source);
|
95143
|
+
});
|
95144
|
+
}
|
94895
95145
|
|
94896
95146
|
/**
|
94897
|
-
*
|
94898
|
-
*
|
94899
|
-
* @alias isRedoAvailable
|
94900
|
-
* @memberof! Core#
|
94901
|
-
* @returns {boolean}
|
95147
|
+
* @param {Core} hot The Handsontable instance.
|
95148
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
94902
95149
|
*/
|
94903
|
-
|
94904
|
-
|
94905
|
-
|
95150
|
+
undo(hot, undoneCallback) {
|
95151
|
+
const settings = hot.getSettings();
|
95152
|
+
|
95153
|
+
// Changing by the reference as `updateSettings` doesn't work the best.
|
95154
|
+
settings.fixedColumnsStart = this.fixedColumnsStart;
|
95155
|
+
const ascendingIndexes = this.indexes.slice(0).sort();
|
95156
|
+
const sortByIndexes = (elem, j, arr) => arr[this.indexes.indexOf(ascendingIndexes[j])];
|
95157
|
+
const removedDataLength = this.data.length;
|
95158
|
+
const sortedData = [];
|
95159
|
+
for (let rowIndex = 0; rowIndex < removedDataLength; rowIndex++) {
|
95160
|
+
sortedData.push((0, _array.arrayMap)(this.data[rowIndex], sortByIndexes));
|
95161
|
+
}
|
95162
|
+
const sortedHeaders = (0, _array.arrayMap)(this.headers, sortByIndexes);
|
95163
|
+
const changes = [];
|
95164
|
+
hot.alter('insert_col_start', this.indexes[0], this.indexes.length, 'UndoRedo.undo');
|
95165
|
+
(0, _array.arrayEach)(hot.getSourceDataArray(), (rowData, rowIndex) => {
|
95166
|
+
(0, _array.arrayEach)(ascendingIndexes, (changedIndex, contiquesIndex) => {
|
95167
|
+
rowData[changedIndex] = sortedData[rowIndex][contiquesIndex];
|
95168
|
+
changes.push([rowIndex, changedIndex, rowData[changedIndex]]);
|
95169
|
+
});
|
95170
|
+
});
|
95171
|
+
hot.setSourceDataAtCell(changes, undefined, undefined, 'UndoRedo.undo');
|
95172
|
+
if (typeof this.headers !== 'undefined') {
|
95173
|
+
(0, _array.arrayEach)(sortedHeaders, (headerData, columnIndex) => {
|
95174
|
+
hot.getSettings().colHeaders[ascendingIndexes[columnIndex]] = headerData;
|
95175
|
+
});
|
95176
|
+
}
|
95177
|
+
this.removedCellMetas.forEach(_ref2 => {
|
95178
|
+
let [rowIndex, columnIndex, cellMeta] = _ref2;
|
95179
|
+
hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
|
95180
|
+
});
|
95181
|
+
hot.batchExecution(() => {
|
95182
|
+
// Restore row sequence in a case when all columns are removed. the original
|
95183
|
+
// row sequence is lost in that case.
|
95184
|
+
hot.rowIndexMapper.setIndexesSequence(this.rowPositions);
|
95185
|
+
hot.columnIndexMapper.setIndexesSequence(this.columnPositions);
|
95186
|
+
}, true);
|
95187
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
95188
|
+
hot.render();
|
95189
|
+
}
|
94906
95190
|
|
94907
95191
|
/**
|
94908
|
-
*
|
94909
|
-
*
|
94910
|
-
* @alias clearUndo
|
94911
|
-
* @memberof! Core#
|
94912
|
-
* @returns {boolean}
|
95192
|
+
* @param {Core} hot The Handsontable instance.
|
95193
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
94913
95194
|
*/
|
94914
|
-
|
94915
|
-
|
94916
|
-
|
95195
|
+
redo(hot, redoneCallback) {
|
95196
|
+
hot.addHookOnce('afterRemoveCol', redoneCallback);
|
95197
|
+
hot.alter('remove_col', this.index, this.amount, 'UndoRedo.redo');
|
95198
|
+
}
|
94917
95199
|
}
|
95200
|
+
exports.RemoveColumnAction = RemoveColumnAction;
|
95201
|
+
|
95202
|
+
/***/ }),
|
95203
|
+
/* 759 */
|
95204
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
95205
|
+
|
95206
|
+
"use strict";
|
95207
|
+
|
94918
95208
|
|
95209
|
+
exports.__esModule = true;
|
95210
|
+
exports.getCellMetas = getCellMetas;
|
95211
|
+
__webpack_require__(87);
|
95212
|
+
__webpack_require__(760);
|
95213
|
+
__webpack_require__(115);
|
95214
|
+
__webpack_require__(127);
|
95215
|
+
var _number = __webpack_require__(200);
|
94919
95216
|
/**
|
94920
|
-
*
|
94921
|
-
|
94922
|
-
|
94923
|
-
|
94924
|
-
|
94925
|
-
|
94926
|
-
|
94927
|
-
|
94928
|
-
|
94929
|
-
|
94930
|
-
|
94931
|
-
|
94932
|
-
|
94933
|
-
|
94934
|
-
|
94935
|
-
|
94936
|
-
|
94937
|
-
|
94938
|
-
|
94939
|
-
|
94940
|
-
|
95217
|
+
* Gets all cell metas from the provided range.
|
95218
|
+
*
|
95219
|
+
* @param {Core} hot The Handsontable instance.
|
95220
|
+
* @param {number} fromRow The starting row index.
|
95221
|
+
* @param {number} toRow The ending row index.
|
95222
|
+
* @param {number} fromColumn The starting column index.
|
95223
|
+
* @param {number} toColumn The ending column index.
|
95224
|
+
* @returns {Array} Returns an array of cell metas.
|
95225
|
+
*/
|
95226
|
+
function getCellMetas(hot, fromRow, toRow, fromColumn, toColumn) {
|
95227
|
+
const genericKeys = ['visualRow', 'visualCol', 'row', 'col', 'prop'];
|
95228
|
+
const genericKeysLength = genericKeys.length;
|
95229
|
+
const cellMetas = [];
|
95230
|
+
(0, _number.rangeEach)(fromColumn, toColumn, columnIndex => {
|
95231
|
+
(0, _number.rangeEach)(fromRow, toRow, rowIndex => {
|
95232
|
+
const cellMeta = hot.getCellMeta(rowIndex, columnIndex);
|
95233
|
+
if (Object.keys(cellMeta).length !== genericKeysLength) {
|
95234
|
+
const uniqueMeta = Object.fromEntries(Object.entries(cellMeta).filter(_ref => {
|
95235
|
+
let [key] = _ref;
|
95236
|
+
return genericKeys.includes(key) === false;
|
95237
|
+
}));
|
95238
|
+
cellMetas.push([cellMeta.visualRow, cellMeta.visualCol, uniqueMeta]);
|
95239
|
+
}
|
95240
|
+
});
|
95241
|
+
});
|
95242
|
+
return cellMetas;
|
95243
|
+
}
|
94941
95244
|
|
94942
95245
|
/***/ }),
|
94943
|
-
/*
|
95246
|
+
/* 760 */
|
94944
95247
|
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
|
94945
95248
|
|
94946
95249
|
"use strict";
|
@@ -94963,7 +95266,278 @@ $({ target: 'Object', stat: true }, {
|
|
94963
95266
|
|
94964
95267
|
|
94965
95268
|
/***/ }),
|
94966
|
-
/*
|
95269
|
+
/* 761 */
|
95270
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
95271
|
+
|
95272
|
+
"use strict";
|
95273
|
+
|
95274
|
+
|
95275
|
+
var _interopRequireDefault = __webpack_require__(1);
|
95276
|
+
exports.__esModule = true;
|
95277
|
+
__webpack_require__(87);
|
95278
|
+
__webpack_require__(115);
|
95279
|
+
__webpack_require__(133);
|
95280
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
95281
|
+
var _base = __webpack_require__(750);
|
95282
|
+
var _utils = __webpack_require__(759);
|
95283
|
+
var _object = __webpack_require__(165);
|
95284
|
+
/**
|
95285
|
+
* Action that tracks changes in row removal.
|
95286
|
+
*
|
95287
|
+
* @class RemoveRowAction
|
95288
|
+
* @private
|
95289
|
+
*/
|
95290
|
+
class RemoveRowAction extends _base.BaseAction {
|
95291
|
+
constructor(_ref) {
|
95292
|
+
let {
|
95293
|
+
index,
|
95294
|
+
data,
|
95295
|
+
fixedRowsBottom,
|
95296
|
+
fixedRowsTop,
|
95297
|
+
rowIndexesSequence,
|
95298
|
+
removedCellMetas
|
95299
|
+
} = _ref;
|
95300
|
+
super();
|
95301
|
+
/**
|
95302
|
+
* @param {number} index The visual row index.
|
95303
|
+
*/
|
95304
|
+
(0, _defineProperty2.default)(this, "index", void 0);
|
95305
|
+
/**
|
95306
|
+
* @param {Array} data The removed data.
|
95307
|
+
*/
|
95308
|
+
(0, _defineProperty2.default)(this, "data", void 0);
|
95309
|
+
/**
|
95310
|
+
* @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
|
95311
|
+
*/
|
95312
|
+
(0, _defineProperty2.default)(this, "fixedRowsBottom", void 0);
|
95313
|
+
/**
|
95314
|
+
* @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
|
95315
|
+
*/
|
95316
|
+
(0, _defineProperty2.default)(this, "fixedRowsTop", void 0);
|
95317
|
+
/**
|
95318
|
+
* @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
|
95319
|
+
*/
|
95320
|
+
(0, _defineProperty2.default)(this, "rowIndexesSequence", void 0);
|
95321
|
+
/**
|
95322
|
+
* @param {Array} removedCellMetas List of removed cell metas.
|
95323
|
+
*/
|
95324
|
+
(0, _defineProperty2.default)(this, "removedCellMetas", void 0);
|
95325
|
+
this.index = index;
|
95326
|
+
this.data = data;
|
95327
|
+
this.fixedRowsBottom = fixedRowsBottom;
|
95328
|
+
this.fixedRowsTop = fixedRowsTop;
|
95329
|
+
this.rowIndexesSequence = rowIndexesSequence;
|
95330
|
+
this.removedCellMetas = removedCellMetas;
|
95331
|
+
}
|
95332
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
95333
|
+
hot.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
|
95334
|
+
const wrappedAction = () => {
|
95335
|
+
const physicalRowIndex = hot.toPhysicalRow(index);
|
95336
|
+
const lastRowIndex = physicalRowIndex + amount - 1;
|
95337
|
+
const removedData = (0, _object.deepClone)(hot.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, hot.countSourceCols() - 1));
|
95338
|
+
return new RemoveRowAction({
|
95339
|
+
index: physicalRowIndex,
|
95340
|
+
data: removedData,
|
95341
|
+
fixedRowsBottom: hot.getSettings().fixedRowsBottom,
|
95342
|
+
fixedRowsTop: hot.getSettings().fixedRowsTop,
|
95343
|
+
rowIndexesSequence: hot.rowIndexMapper.getIndexesSequence(),
|
95344
|
+
removedCellMetas: (0, _utils.getCellMetas)(hot, physicalRowIndex, lastRowIndex, 0, hot.countCols() - 1)
|
95345
|
+
});
|
95346
|
+
};
|
95347
|
+
undoRedoPlugin.done(wrappedAction, source);
|
95348
|
+
});
|
95349
|
+
}
|
95350
|
+
|
95351
|
+
/**
|
95352
|
+
* @param {Core} hot The Handsontable instance.
|
95353
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
95354
|
+
*/
|
95355
|
+
undo(hot, undoneCallback) {
|
95356
|
+
const settings = hot.getSettings();
|
95357
|
+
const changes = [];
|
95358
|
+
|
95359
|
+
// Changing by the reference as `updateSettings` doesn't work the best.
|
95360
|
+
settings.fixedRowsBottom = this.fixedRowsBottom;
|
95361
|
+
settings.fixedRowsTop = this.fixedRowsTop;
|
95362
|
+
|
95363
|
+
// Prepare the change list to fill the source data.
|
95364
|
+
this.data.forEach((dataRow, rowIndexDelta) => {
|
95365
|
+
Object.keys(dataRow).forEach(columnProp => {
|
95366
|
+
const columnIndex = parseInt(columnProp, 10);
|
95367
|
+
changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
|
95368
|
+
});
|
95369
|
+
});
|
95370
|
+
hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
|
95371
|
+
this.removedCellMetas.forEach(_ref2 => {
|
95372
|
+
let [rowIndex, columnIndex, cellMeta] = _ref2;
|
95373
|
+
hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
|
95374
|
+
});
|
95375
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
95376
|
+
hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
|
95377
|
+
hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
|
95378
|
+
}
|
95379
|
+
|
95380
|
+
/**
|
95381
|
+
* @param {Core} hot The Handsontable instance.
|
95382
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
95383
|
+
*/
|
95384
|
+
redo(hot, redoneCallback) {
|
95385
|
+
hot.addHookOnce('afterRemoveRow', redoneCallback);
|
95386
|
+
hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
|
95387
|
+
}
|
95388
|
+
}
|
95389
|
+
exports.RemoveRowAction = RemoveRowAction;
|
95390
|
+
|
95391
|
+
/***/ }),
|
95392
|
+
/* 762 */
|
95393
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
95394
|
+
|
95395
|
+
"use strict";
|
95396
|
+
|
95397
|
+
|
95398
|
+
var _interopRequireDefault = __webpack_require__(1);
|
95399
|
+
exports.__esModule = true;
|
95400
|
+
__webpack_require__(115);
|
95401
|
+
__webpack_require__(133);
|
95402
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
95403
|
+
var _base = __webpack_require__(750);
|
95404
|
+
var _moves = __webpack_require__(659);
|
95405
|
+
/**
|
95406
|
+
* Action that tracks row move changes.
|
95407
|
+
*
|
95408
|
+
* @class RowMoveAction
|
95409
|
+
* @private
|
95410
|
+
*/
|
95411
|
+
class RowMoveAction extends _base.BaseAction {
|
95412
|
+
constructor(_ref) {
|
95413
|
+
let {
|
95414
|
+
rows,
|
95415
|
+
finalIndex
|
95416
|
+
} = _ref;
|
95417
|
+
super();
|
95418
|
+
/**
|
95419
|
+
* @param {number[]} rows An array with moved rows.
|
95420
|
+
*/
|
95421
|
+
(0, _defineProperty2.default)(this, "rows", void 0);
|
95422
|
+
/**
|
95423
|
+
* @param {number} finalIndex The destination index.
|
95424
|
+
*/
|
95425
|
+
(0, _defineProperty2.default)(this, "finalRowIndex", void 0);
|
95426
|
+
this.rows = rows.slice();
|
95427
|
+
this.finalRowIndex = finalIndex;
|
95428
|
+
}
|
95429
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
95430
|
+
hot.addHook('beforeRowMove', (rows, finalIndex) => {
|
95431
|
+
if (rows === false) {
|
95432
|
+
return;
|
95433
|
+
}
|
95434
|
+
undoRedoPlugin.done(() => new RowMoveAction({
|
95435
|
+
rows,
|
95436
|
+
finalIndex
|
95437
|
+
}));
|
95438
|
+
});
|
95439
|
+
}
|
95440
|
+
|
95441
|
+
/**
|
95442
|
+
* @param {Core} hot The Handsontable instance.
|
95443
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
95444
|
+
*/
|
95445
|
+
undo(hot, undoneCallback) {
|
95446
|
+
const manualRowMove = hot.getPlugin('manualRowMove');
|
95447
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
95448
|
+
const rowMoves = (0, _moves.getMoves)(this.rows, this.finalRowIndex, hot.rowIndexMapper.getNumberOfIndexes());
|
95449
|
+
rowMoves.reverse().forEach(_ref2 => {
|
95450
|
+
let {
|
95451
|
+
from,
|
95452
|
+
to
|
95453
|
+
} = _ref2;
|
95454
|
+
if (from < to) {
|
95455
|
+
to -= 1;
|
95456
|
+
}
|
95457
|
+
manualRowMove.moveRow(to, from);
|
95458
|
+
});
|
95459
|
+
hot.render();
|
95460
|
+
hot.deselectCell();
|
95461
|
+
hot.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
|
95462
|
+
}
|
95463
|
+
|
95464
|
+
/**
|
95465
|
+
* @param {Core} hot The Handsontable instance.
|
95466
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
95467
|
+
*/
|
95468
|
+
redo(hot, redoneCallback) {
|
95469
|
+
const manualRowMove = hot.getPlugin('manualRowMove');
|
95470
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
95471
|
+
manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
|
95472
|
+
hot.render();
|
95473
|
+
hot.deselectCell();
|
95474
|
+
hot.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
|
95475
|
+
}
|
95476
|
+
}
|
95477
|
+
exports.RowMoveAction = RowMoveAction;
|
95478
|
+
|
95479
|
+
/***/ }),
|
95480
|
+
/* 763 */
|
95481
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
95482
|
+
|
95483
|
+
"use strict";
|
95484
|
+
|
95485
|
+
|
95486
|
+
var _interopRequireDefault = __webpack_require__(1);
|
95487
|
+
exports.__esModule = true;
|
95488
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(170));
|
95489
|
+
var _base = __webpack_require__(750);
|
95490
|
+
/**
|
95491
|
+
* Action that tracks changes in merged cells.
|
95492
|
+
*
|
95493
|
+
* @class UnmergeCellsAction
|
95494
|
+
* @private
|
95495
|
+
*/
|
95496
|
+
class UnmergeCellsAction extends _base.BaseAction {
|
95497
|
+
constructor(_ref) {
|
95498
|
+
let {
|
95499
|
+
cellRange
|
95500
|
+
} = _ref;
|
95501
|
+
super();
|
95502
|
+
(0, _defineProperty2.default)(this, "cellRange", void 0);
|
95503
|
+
this.cellRange = cellRange;
|
95504
|
+
}
|
95505
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
95506
|
+
hot.addHook('afterUnmergeCells', (cellRange, auto) => {
|
95507
|
+
if (auto) {
|
95508
|
+
return;
|
95509
|
+
}
|
95510
|
+
undoRedoPlugin.done(() => new UnmergeCellsAction({
|
95511
|
+
cellRange
|
95512
|
+
}));
|
95513
|
+
});
|
95514
|
+
}
|
95515
|
+
|
95516
|
+
/**
|
95517
|
+
* @param {Core} hot The Handsontable instance.
|
95518
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
95519
|
+
*/
|
95520
|
+
undo(hot, undoneCallback) {
|
95521
|
+
const mergeCellsPlugin = hot.getPlugin('mergeCells');
|
95522
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
95523
|
+
mergeCellsPlugin.mergeRange(this.cellRange, true);
|
95524
|
+
}
|
95525
|
+
|
95526
|
+
/**
|
95527
|
+
* @param {Core} hot The Handsontable instance.
|
95528
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
95529
|
+
*/
|
95530
|
+
redo(hot, redoneCallback) {
|
95531
|
+
const mergeCellsPlugin = hot.getPlugin('mergeCells');
|
95532
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
95533
|
+
mergeCellsPlugin.unmergeRange(this.cellRange, true);
|
95534
|
+
hot.render();
|
95535
|
+
}
|
95536
|
+
}
|
95537
|
+
exports.UnmergeCellsAction = UnmergeCellsAction;
|
95538
|
+
|
95539
|
+
/***/ }),
|
95540
|
+
/* 764 */
|
94967
95541
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
94968
95542
|
|
94969
95543
|
"use strict";
|
@@ -95072,7 +95646,7 @@ exports.CellRange = _base.CellRange;
|
|
95072
95646
|
var _registry = __webpack_require__(426);
|
95073
95647
|
var _eventManager = _interopRequireWildcard(__webpack_require__(188));
|
95074
95648
|
var _translations = __webpack_require__(287);
|
95075
|
-
var _jquery = _interopRequireDefault(__webpack_require__(
|
95649
|
+
var _jquery = _interopRequireDefault(__webpack_require__(764));
|
95076
95650
|
var _ghostTable = _interopRequireDefault(__webpack_require__(505));
|
95077
95651
|
var parseTableHelpers = _interopRequireWildcard(__webpack_require__(190));
|
95078
95652
|
var arrayHelpers = _interopRequireWildcard(__webpack_require__(161));
|