handsontable 15.0.1-next-ab94a4c-20250207 → 15.1.0-next-dfdf994-20250206

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/3rdparty/walkontable/src/index.js +2 -0
  2. package/3rdparty/walkontable/src/index.mjs +2 -1
  3. package/3rdparty/walkontable/src/overlays.js +2 -39
  4. package/3rdparty/walkontable/src/overlays.mjs +2 -39
  5. package/3rdparty/walkontable/src/renderer/_base.js +3 -4
  6. package/3rdparty/walkontable/src/renderer/_base.mjs +2 -2
  7. package/3rdparty/walkontable/src/renderer/cells.js +7 -11
  8. package/3rdparty/walkontable/src/renderer/cells.mjs +6 -9
  9. package/3rdparty/walkontable/src/renderer/colGroup.js +6 -7
  10. package/3rdparty/walkontable/src/renderer/colGroup.mjs +5 -5
  11. package/3rdparty/walkontable/src/renderer/columnHeaders.js +4 -5
  12. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +3 -3
  13. package/3rdparty/walkontable/src/renderer/index.js +18 -19
  14. package/3rdparty/walkontable/src/renderer/index.mjs +6 -6
  15. package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -7
  16. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -5
  17. package/3rdparty/walkontable/src/renderer/rows.js +23 -11
  18. package/3rdparty/walkontable/src/renderer/rows.mjs +23 -10
  19. package/3rdparty/walkontable/src/renderer/table.js +1 -1
  20. package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
  21. package/3rdparty/walkontable/src/selection/border/border.js +10 -2
  22. package/3rdparty/walkontable/src/selection/border/border.mjs +10 -2
  23. package/3rdparty/walkontable/src/utils/nodesPool.js +21 -6
  24. package/3rdparty/walkontable/src/utils/nodesPool.mjs +21 -6
  25. package/3rdparty/walkontable/src/utils/orderView/index.js +4 -5
  26. package/3rdparty/walkontable/src/utils/orderView/index.mjs +2 -2
  27. package/3rdparty/walkontable/src/utils/orderView/sharedView.js +3 -4
  28. package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +2 -2
  29. package/3rdparty/walkontable/src/utils/orderView/view.js +60 -76
  30. package/3rdparty/walkontable/src/utils/orderView/view.mjs +59 -74
  31. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.js +138 -0
  32. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.mjs +135 -0
  33. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +72 -0
  34. package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +68 -0
  35. package/3rdparty/walkontable/src/utils/orderView/viewSize.js +1 -1
  36. package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +1 -1
  37. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +4 -5
  38. package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +3 -3
  39. package/CHANGELOG.md +51 -2
  40. package/README.md +3 -3
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/cellTypes/dropdownType/dropdownType.js +4 -2
  44. package/cellTypes/dropdownType/dropdownType.mjs +4 -2
  45. package/core.js +39 -38
  46. package/core.mjs +36 -35
  47. package/dataMap/dataMap.js +8 -0
  48. package/dataMap/dataMap.mjs +8 -0
  49. package/dataMap/dataSource.js +4 -0
  50. package/dataMap/dataSource.mjs +4 -0
  51. package/dataMap/metaManager/lazyFactoryMap.js +8 -5
  52. package/dataMap/metaManager/lazyFactoryMap.mjs +8 -5
  53. package/dataMap/metaManager/metaSchema.js +24 -9
  54. package/dataMap/metaManager/metaSchema.mjs +24 -9
  55. package/dist/handsontable.css +6 -2
  56. package/dist/handsontable.full.css +6 -2
  57. package/dist/handsontable.full.js +8026 -6927
  58. package/dist/handsontable.full.min.css +3 -3
  59. package/dist/handsontable.full.min.js +530 -528
  60. package/dist/handsontable.js +3833 -2914
  61. package/dist/handsontable.min.css +3 -3
  62. package/dist/handsontable.min.js +35 -33
  63. package/editors/autocompleteEditor/autocompleteEditor.js +1 -3
  64. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -3
  65. package/editors/dateEditor/dateEditor.js +4 -0
  66. package/editors/dateEditor/dateEditor.mjs +4 -0
  67. package/editors/dropdownEditor/dropdownEditor.js +3 -16
  68. package/editors/dropdownEditor/dropdownEditor.mjs +3 -16
  69. package/editors/handsontableEditor/handsontableEditor.js +4 -4
  70. package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
  71. package/focusManager.js +1 -1
  72. package/focusManager.mjs +1 -1
  73. package/helpers/dom/element.d.ts +0 -1
  74. package/helpers/mixed.js +2 -2
  75. package/helpers/mixed.mjs +2 -2
  76. package/helpers/object.js +4 -0
  77. package/helpers/object.mjs +4 -0
  78. package/package.json +2 -2
  79. package/plugins/base/base.js +0 -7
  80. package/plugins/base/base.mjs +0 -7
  81. package/plugins/comments/comments.js +12 -3
  82. package/plugins/comments/comments.mjs +12 -3
  83. package/plugins/contextMenu/contextMenu.js +2 -7
  84. package/plugins/contextMenu/contextMenu.mjs +2 -7
  85. package/plugins/contextMenu/menu/menu.js +2 -2
  86. package/plugins/contextMenu/menu/menu.mjs +2 -2
  87. package/plugins/contextMenu/predefinedItems/clearColumn.js +15 -4
  88. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +15 -4
  89. package/plugins/copyPaste/copyPaste.js +6 -12
  90. package/plugins/copyPaste/copyPaste.mjs +6 -12
  91. package/plugins/filters/conditionCollection.js +8 -7
  92. package/plugins/filters/conditionCollection.mjs +8 -7
  93. package/plugins/filters/filters.js +26 -16
  94. package/plugins/filters/filters.mjs +26 -16
  95. package/plugins/filters/utils.js +7 -24
  96. package/plugins/filters/utils.mjs +7 -24
  97. package/plugins/hiddenColumns/hiddenColumns.js +1 -3
  98. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -3
  99. package/plugins/hiddenRows/hiddenRows.js +1 -3
  100. package/plugins/hiddenRows/hiddenRows.mjs +1 -3
  101. package/plugins/manualRowMove/manualRowMove.js +1 -1
  102. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  103. package/plugins/mergeCells/calculations/autofill.js +60 -44
  104. package/plugins/mergeCells/calculations/autofill.mjs +60 -44
  105. package/plugins/mergeCells/cellsCollection.js +25 -8
  106. package/plugins/mergeCells/cellsCollection.mjs +25 -8
  107. package/plugins/mergeCells/mergeCells.js +15 -16
  108. package/plugins/mergeCells/mergeCells.mjs +15 -16
  109. package/plugins/nestedHeaders/nestedHeaders.js +6 -1
  110. package/plugins/nestedHeaders/nestedHeaders.mjs +6 -1
  111. package/plugins/nestedHeaders/stateManager/index.js +1 -2
  112. package/plugins/nestedHeaders/stateManager/index.mjs +1 -2
  113. package/plugins/nestedHeaders/utils/ghostTable.js +4 -0
  114. package/plugins/nestedHeaders/utils/ghostTable.mjs +4 -0
  115. package/plugins/nestedRows/utils/rowMoveController.js +1 -6
  116. package/plugins/nestedRows/utils/rowMoveController.mjs +1 -6
  117. package/plugins/undoRedo/actions/_base.js +19 -0
  118. package/plugins/undoRedo/actions/_base.mjs +15 -0
  119. package/plugins/undoRedo/actions/cellAlignment.js +85 -0
  120. package/plugins/undoRedo/actions/cellAlignment.mjs +81 -0
  121. package/plugins/undoRedo/actions/columnMove.js +84 -0
  122. package/plugins/undoRedo/actions/columnMove.mjs +80 -0
  123. package/plugins/undoRedo/actions/columnSort.js +73 -0
  124. package/plugins/undoRedo/actions/columnSort.mjs +69 -0
  125. package/plugins/undoRedo/actions/createColumn.js +60 -0
  126. package/plugins/undoRedo/actions/createColumn.mjs +56 -0
  127. package/plugins/undoRedo/actions/createRow.js +65 -0
  128. package/plugins/undoRedo/actions/createRow.mjs +61 -0
  129. package/plugins/undoRedo/actions/dataChange.js +123 -0
  130. package/plugins/undoRedo/actions/dataChange.mjs +119 -0
  131. package/plugins/undoRedo/actions/filters.js +66 -0
  132. package/plugins/undoRedo/actions/filters.mjs +62 -0
  133. package/plugins/undoRedo/actions/index.js +27 -0
  134. package/plugins/undoRedo/actions/index.mjs +23 -0
  135. package/plugins/undoRedo/actions/mergeCells.js +63 -0
  136. package/plugins/undoRedo/actions/mergeCells.mjs +59 -0
  137. package/plugins/undoRedo/actions/removeColumn.js +176 -0
  138. package/plugins/undoRedo/actions/removeColumn.mjs +172 -0
  139. package/plugins/undoRedo/actions/removeRow.js +119 -0
  140. package/plugins/undoRedo/actions/removeRow.mjs +115 -0
  141. package/plugins/undoRedo/actions/rowMove.js +84 -0
  142. package/plugins/undoRedo/actions/rowMove.mjs +80 -0
  143. package/plugins/undoRedo/actions/unmergeCells.js +56 -0
  144. package/plugins/undoRedo/actions/unmergeCells.mjs +52 -0
  145. package/plugins/undoRedo/index.js +3 -4
  146. package/plugins/undoRedo/index.mjs +1 -2
  147. package/plugins/undoRedo/undoRedo.js +277 -879
  148. package/plugins/undoRedo/undoRedo.mjs +277 -880
  149. package/plugins/undoRedo/utils.js +37 -0
  150. package/plugins/undoRedo/utils.mjs +33 -0
  151. package/renderers/checkboxRenderer/checkboxRenderer.js +8 -1
  152. package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -1
  153. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +1 -0
  154. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +1 -0
  155. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -1
  156. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -1
  157. package/styles/handsontable.css +75 -103
  158. package/styles/handsontable.min.css +3 -3
  159. package/styles/ht-theme-horizon.css +2 -2
  160. package/styles/ht-theme-horizon.min.css +2 -2
  161. package/styles/ht-theme-main.css +2 -2
  162. package/styles/ht-theme-main.min.css +2 -2
  163. package/tableView.js +17 -1
  164. package/tableView.mjs +17 -1
  165. package/utils/autoResize.js +1 -1
  166. package/utils/autoResize.mjs +1 -1
  167. package/utils/parseTable.js +1 -1
  168. package/utils/parseTable.mjs +1 -1
  169. package/validators/dateValidator/dateValidator.js +1 -1
  170. package/validators/dateValidator/dateValidator.mjs +1 -1
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/es.array.push.js");
6
+ require("core-js/modules/esnext.iterator.constructor.js");
7
+ require("core-js/modules/esnext.iterator.for-each.js");
8
+ var _base = require("./_base");
9
+ var _utils = require("../utils");
10
+ var _object = require("../../../helpers/object");
11
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
13
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ /**
15
+ * Action that tracks changes in row removal.
16
+ *
17
+ * @class RemoveRowAction
18
+ * @private
19
+ */
20
+ class RemoveRowAction extends _base.BaseAction {
21
+ constructor(_ref) {
22
+ let {
23
+ index,
24
+ data,
25
+ fixedRowsBottom,
26
+ fixedRowsTop,
27
+ rowIndexesSequence,
28
+ removedCellMetas
29
+ } = _ref;
30
+ super();
31
+ /**
32
+ * @param {number} index The visual row index.
33
+ */
34
+ _defineProperty(this, "index", void 0);
35
+ /**
36
+ * @param {Array} data The removed data.
37
+ */
38
+ _defineProperty(this, "data", void 0);
39
+ /**
40
+ * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
41
+ */
42
+ _defineProperty(this, "fixedRowsBottom", void 0);
43
+ /**
44
+ * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
45
+ */
46
+ _defineProperty(this, "fixedRowsTop", void 0);
47
+ /**
48
+ * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
49
+ */
50
+ _defineProperty(this, "rowIndexesSequence", void 0);
51
+ /**
52
+ * @param {Array} removedCellMetas List of removed cell metas.
53
+ */
54
+ _defineProperty(this, "removedCellMetas", void 0);
55
+ this.index = index;
56
+ this.data = data;
57
+ this.fixedRowsBottom = fixedRowsBottom;
58
+ this.fixedRowsTop = fixedRowsTop;
59
+ this.rowIndexesSequence = rowIndexesSequence;
60
+ this.removedCellMetas = removedCellMetas;
61
+ }
62
+ static startRegisteringEvents(hot, undoRedoPlugin) {
63
+ hot.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
64
+ const wrappedAction = () => {
65
+ const physicalRowIndex = hot.toPhysicalRow(index);
66
+ const lastRowIndex = physicalRowIndex + amount - 1;
67
+ const removedData = (0, _object.deepClone)(hot.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, hot.countSourceCols() - 1));
68
+ return new RemoveRowAction({
69
+ index: physicalRowIndex,
70
+ data: removedData,
71
+ fixedRowsBottom: hot.getSettings().fixedRowsBottom,
72
+ fixedRowsTop: hot.getSettings().fixedRowsTop,
73
+ rowIndexesSequence: hot.rowIndexMapper.getIndexesSequence(),
74
+ removedCellMetas: (0, _utils.getCellMetas)(hot, physicalRowIndex, lastRowIndex, 0, hot.countCols() - 1)
75
+ });
76
+ };
77
+ undoRedoPlugin.done(wrappedAction, source);
78
+ });
79
+ }
80
+
81
+ /**
82
+ * @param {Core} hot The Handsontable instance.
83
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
84
+ */
85
+ undo(hot, undoneCallback) {
86
+ const settings = hot.getSettings();
87
+ const changes = [];
88
+
89
+ // Changing by the reference as `updateSettings` doesn't work the best.
90
+ settings.fixedRowsBottom = this.fixedRowsBottom;
91
+ settings.fixedRowsTop = this.fixedRowsTop;
92
+
93
+ // Prepare the change list to fill the source data.
94
+ this.data.forEach((dataRow, rowIndexDelta) => {
95
+ Object.keys(dataRow).forEach(columnProp => {
96
+ const columnIndex = parseInt(columnProp, 10);
97
+ changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
98
+ });
99
+ });
100
+ hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
101
+ this.removedCellMetas.forEach(_ref2 => {
102
+ let [rowIndex, columnIndex, cellMeta] = _ref2;
103
+ hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
104
+ });
105
+ hot.addHookOnce('afterViewRender', undoneCallback);
106
+ hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
107
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
108
+ }
109
+
110
+ /**
111
+ * @param {Core} hot The Handsontable instance.
112
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
113
+ */
114
+ redo(hot, redoneCallback) {
115
+ hot.addHookOnce('afterRemoveRow', redoneCallback);
116
+ hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
117
+ }
118
+ }
119
+ exports.RemoveRowAction = RemoveRowAction;
@@ -0,0 +1,115 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/esnext.iterator.constructor.js";
4
+ import "core-js/modules/esnext.iterator.for-each.js";
5
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ import { BaseAction } from "./_base.mjs";
9
+ import { getCellMetas } from "../utils.mjs";
10
+ import { deepClone } from "../../../helpers/object.mjs";
11
+ /**
12
+ * Action that tracks changes in row removal.
13
+ *
14
+ * @class RemoveRowAction
15
+ * @private
16
+ */
17
+ export class RemoveRowAction extends BaseAction {
18
+ constructor(_ref) {
19
+ let {
20
+ index,
21
+ data,
22
+ fixedRowsBottom,
23
+ fixedRowsTop,
24
+ rowIndexesSequence,
25
+ removedCellMetas
26
+ } = _ref;
27
+ super();
28
+ /**
29
+ * @param {number} index The visual row index.
30
+ */
31
+ _defineProperty(this, "index", void 0);
32
+ /**
33
+ * @param {Array} data The removed data.
34
+ */
35
+ _defineProperty(this, "data", void 0);
36
+ /**
37
+ * @param {number} fixedRowsBottom Number of fixed rows on the bottom. Remove row action change it sometimes.
38
+ */
39
+ _defineProperty(this, "fixedRowsBottom", void 0);
40
+ /**
41
+ * @param {number} fixedRowsTop Number of fixed rows on the top. Remove row action change it sometimes.
42
+ */
43
+ _defineProperty(this, "fixedRowsTop", void 0);
44
+ /**
45
+ * @param {Array} rowIndexesSequence Row index sequence taken from the row index mapper.
46
+ */
47
+ _defineProperty(this, "rowIndexesSequence", void 0);
48
+ /**
49
+ * @param {Array} removedCellMetas List of removed cell metas.
50
+ */
51
+ _defineProperty(this, "removedCellMetas", void 0);
52
+ this.index = index;
53
+ this.data = data;
54
+ this.fixedRowsBottom = fixedRowsBottom;
55
+ this.fixedRowsTop = fixedRowsTop;
56
+ this.rowIndexesSequence = rowIndexesSequence;
57
+ this.removedCellMetas = removedCellMetas;
58
+ }
59
+ static startRegisteringEvents(hot, undoRedoPlugin) {
60
+ hot.addHook('beforeRemoveRow', (index, amount, logicRows, source) => {
61
+ const wrappedAction = () => {
62
+ const physicalRowIndex = hot.toPhysicalRow(index);
63
+ const lastRowIndex = physicalRowIndex + amount - 1;
64
+ const removedData = deepClone(hot.getSourceData(physicalRowIndex, 0, physicalRowIndex + amount - 1, hot.countSourceCols() - 1));
65
+ return new RemoveRowAction({
66
+ index: physicalRowIndex,
67
+ data: removedData,
68
+ fixedRowsBottom: hot.getSettings().fixedRowsBottom,
69
+ fixedRowsTop: hot.getSettings().fixedRowsTop,
70
+ rowIndexesSequence: hot.rowIndexMapper.getIndexesSequence(),
71
+ removedCellMetas: getCellMetas(hot, physicalRowIndex, lastRowIndex, 0, hot.countCols() - 1)
72
+ });
73
+ };
74
+ undoRedoPlugin.done(wrappedAction, source);
75
+ });
76
+ }
77
+
78
+ /**
79
+ * @param {Core} hot The Handsontable instance.
80
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
81
+ */
82
+ undo(hot, undoneCallback) {
83
+ const settings = hot.getSettings();
84
+ const changes = [];
85
+
86
+ // Changing by the reference as `updateSettings` doesn't work the best.
87
+ settings.fixedRowsBottom = this.fixedRowsBottom;
88
+ settings.fixedRowsTop = this.fixedRowsTop;
89
+
90
+ // Prepare the change list to fill the source data.
91
+ this.data.forEach((dataRow, rowIndexDelta) => {
92
+ Object.keys(dataRow).forEach(columnProp => {
93
+ const columnIndex = parseInt(columnProp, 10);
94
+ changes.push([this.index + rowIndexDelta, isNaN(columnIndex) ? columnProp : columnIndex, dataRow[columnProp]]);
95
+ });
96
+ });
97
+ hot.alter('insert_row_above', this.index, this.data.length, 'UndoRedo.undo');
98
+ this.removedCellMetas.forEach(_ref2 => {
99
+ let [rowIndex, columnIndex, cellMeta] = _ref2;
100
+ hot.setCellMetaObject(rowIndex, columnIndex, cellMeta);
101
+ });
102
+ hot.addHookOnce('afterViewRender', undoneCallback);
103
+ hot.setSourceDataAtCell(changes, null, null, 'UndoRedo.undo');
104
+ hot.rowIndexMapper.setIndexesSequence(this.rowIndexesSequence);
105
+ }
106
+
107
+ /**
108
+ * @param {Core} hot The Handsontable instance.
109
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
110
+ */
111
+ redo(hot, redoneCallback) {
112
+ hot.addHookOnce('afterRemoveRow', redoneCallback);
113
+ hot.alter('remove_row', this.index, this.data.length, 'UndoRedo.redo');
114
+ }
115
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/esnext.iterator.constructor.js");
6
+ require("core-js/modules/esnext.iterator.for-each.js");
7
+ var _base = require("./_base");
8
+ var _moves = require("../../../helpers/moves");
9
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ /**
13
+ * Action that tracks row move changes.
14
+ *
15
+ * @class RowMoveAction
16
+ * @private
17
+ */
18
+ class RowMoveAction extends _base.BaseAction {
19
+ constructor(_ref) {
20
+ let {
21
+ rows,
22
+ finalIndex
23
+ } = _ref;
24
+ super();
25
+ /**
26
+ * @param {number[]} rows An array with moved rows.
27
+ */
28
+ _defineProperty(this, "rows", void 0);
29
+ /**
30
+ * @param {number} finalIndex The destination index.
31
+ */
32
+ _defineProperty(this, "finalRowIndex", void 0);
33
+ this.rows = rows.slice();
34
+ this.finalRowIndex = finalIndex;
35
+ }
36
+ static startRegisteringEvents(hot, undoRedoPlugin) {
37
+ hot.addHook('beforeRowMove', (rows, finalIndex) => {
38
+ if (rows === false) {
39
+ return;
40
+ }
41
+ undoRedoPlugin.done(() => new RowMoveAction({
42
+ rows,
43
+ finalIndex
44
+ }));
45
+ });
46
+ }
47
+
48
+ /**
49
+ * @param {Core} hot The Handsontable instance.
50
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
51
+ */
52
+ undo(hot, undoneCallback) {
53
+ const manualRowMove = hot.getPlugin('manualRowMove');
54
+ hot.addHookOnce('afterViewRender', undoneCallback);
55
+ const rowMoves = (0, _moves.getMoves)(this.rows, this.finalRowIndex, hot.rowIndexMapper.getNumberOfIndexes());
56
+ rowMoves.reverse().forEach(_ref2 => {
57
+ let {
58
+ from,
59
+ to
60
+ } = _ref2;
61
+ if (from < to) {
62
+ to -= 1;
63
+ }
64
+ manualRowMove.moveRow(to, from);
65
+ });
66
+ hot.render();
67
+ hot.deselectCell();
68
+ hot.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
69
+ }
70
+
71
+ /**
72
+ * @param {Core} hot The Handsontable instance.
73
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
74
+ */
75
+ redo(hot, redoneCallback) {
76
+ const manualRowMove = hot.getPlugin('manualRowMove');
77
+ hot.addHookOnce('afterViewRender', redoneCallback);
78
+ manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
79
+ hot.render();
80
+ hot.deselectCell();
81
+ hot.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
82
+ }
83
+ }
84
+ exports.RowMoveAction = RowMoveAction;
@@ -0,0 +1,80 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/esnext.iterator.constructor.js";
3
+ import "core-js/modules/esnext.iterator.for-each.js";
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { BaseAction } from "./_base.mjs";
8
+ import { getMoves } from "../../../helpers/moves.mjs";
9
+ /**
10
+ * Action that tracks row move changes.
11
+ *
12
+ * @class RowMoveAction
13
+ * @private
14
+ */
15
+ export class RowMoveAction extends BaseAction {
16
+ constructor(_ref) {
17
+ let {
18
+ rows,
19
+ finalIndex
20
+ } = _ref;
21
+ super();
22
+ /**
23
+ * @param {number[]} rows An array with moved rows.
24
+ */
25
+ _defineProperty(this, "rows", void 0);
26
+ /**
27
+ * @param {number} finalIndex The destination index.
28
+ */
29
+ _defineProperty(this, "finalRowIndex", void 0);
30
+ this.rows = rows.slice();
31
+ this.finalRowIndex = finalIndex;
32
+ }
33
+ static startRegisteringEvents(hot, undoRedoPlugin) {
34
+ hot.addHook('beforeRowMove', (rows, finalIndex) => {
35
+ if (rows === false) {
36
+ return;
37
+ }
38
+ undoRedoPlugin.done(() => new RowMoveAction({
39
+ rows,
40
+ finalIndex
41
+ }));
42
+ });
43
+ }
44
+
45
+ /**
46
+ * @param {Core} hot The Handsontable instance.
47
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
48
+ */
49
+ undo(hot, undoneCallback) {
50
+ const manualRowMove = hot.getPlugin('manualRowMove');
51
+ hot.addHookOnce('afterViewRender', undoneCallback);
52
+ const rowMoves = getMoves(this.rows, this.finalRowIndex, hot.rowIndexMapper.getNumberOfIndexes());
53
+ rowMoves.reverse().forEach(_ref2 => {
54
+ let {
55
+ from,
56
+ to
57
+ } = _ref2;
58
+ if (from < to) {
59
+ to -= 1;
60
+ }
61
+ manualRowMove.moveRow(to, from);
62
+ });
63
+ hot.render();
64
+ hot.deselectCell();
65
+ hot.selectRows(this.rows[0], this.rows[0] + this.rows.length - 1);
66
+ }
67
+
68
+ /**
69
+ * @param {Core} hot The Handsontable instance.
70
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
71
+ */
72
+ redo(hot, redoneCallback) {
73
+ const manualRowMove = hot.getPlugin('manualRowMove');
74
+ hot.addHookOnce('afterViewRender', redoneCallback);
75
+ manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
76
+ hot.render();
77
+ hot.deselectCell();
78
+ hot.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
79
+ }
80
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ var _base = require("./_base");
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ /**
10
+ * Action that tracks changes in merged cells.
11
+ *
12
+ * @class UnmergeCellsAction
13
+ * @private
14
+ */
15
+ class UnmergeCellsAction extends _base.BaseAction {
16
+ constructor(_ref) {
17
+ let {
18
+ cellRange
19
+ } = _ref;
20
+ super();
21
+ _defineProperty(this, "cellRange", void 0);
22
+ this.cellRange = cellRange;
23
+ }
24
+ static startRegisteringEvents(hot, undoRedoPlugin) {
25
+ hot.addHook('afterUnmergeCells', (cellRange, auto) => {
26
+ if (auto) {
27
+ return;
28
+ }
29
+ undoRedoPlugin.done(() => new UnmergeCellsAction({
30
+ cellRange
31
+ }));
32
+ });
33
+ }
34
+
35
+ /**
36
+ * @param {Core} hot The Handsontable instance.
37
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
38
+ */
39
+ undo(hot, undoneCallback) {
40
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
41
+ hot.addHookOnce('afterViewRender', undoneCallback);
42
+ mergeCellsPlugin.mergeRange(this.cellRange, true);
43
+ }
44
+
45
+ /**
46
+ * @param {Core} hot The Handsontable instance.
47
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
48
+ */
49
+ redo(hot, redoneCallback) {
50
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
51
+ hot.addHookOnce('afterViewRender', redoneCallback);
52
+ mergeCellsPlugin.unmergeRange(this.cellRange, true);
53
+ hot.render();
54
+ }
55
+ }
56
+ exports.UnmergeCellsAction = UnmergeCellsAction;
@@ -0,0 +1,52 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { BaseAction } from "./_base.mjs";
6
+ /**
7
+ * Action that tracks changes in merged cells.
8
+ *
9
+ * @class UnmergeCellsAction
10
+ * @private
11
+ */
12
+ export class UnmergeCellsAction extends BaseAction {
13
+ constructor(_ref) {
14
+ let {
15
+ cellRange
16
+ } = _ref;
17
+ super();
18
+ _defineProperty(this, "cellRange", void 0);
19
+ this.cellRange = cellRange;
20
+ }
21
+ static startRegisteringEvents(hot, undoRedoPlugin) {
22
+ hot.addHook('afterUnmergeCells', (cellRange, auto) => {
23
+ if (auto) {
24
+ return;
25
+ }
26
+ undoRedoPlugin.done(() => new UnmergeCellsAction({
27
+ cellRange
28
+ }));
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @param {Core} hot The Handsontable instance.
34
+ * @param {function(): void} undoneCallback The callback to be called after the action is undone.
35
+ */
36
+ undo(hot, undoneCallback) {
37
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
38
+ hot.addHookOnce('afterViewRender', undoneCallback);
39
+ mergeCellsPlugin.mergeRange(this.cellRange, true);
40
+ }
41
+
42
+ /**
43
+ * @param {Core} hot The Handsontable instance.
44
+ * @param {function(): void} redoneCallback The callback to be called after the action is redone.
45
+ */
46
+ redo(hot, redoneCallback) {
47
+ const mergeCellsPlugin = hot.getPlugin('mergeCells');
48
+ hot.addHookOnce('afterViewRender', redoneCallback);
49
+ mergeCellsPlugin.unmergeRange(this.cellRange, true);
50
+ hot.render();
51
+ }
52
+ }
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- var _undoRedo = _interopRequireWildcard(require("./undoRedo"));
5
- exports.UndoRedo = _undoRedo.default;
4
+ var _undoRedo = require("./undoRedo");
6
5
  exports.PLUGIN_KEY = _undoRedo.PLUGIN_KEY;
7
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
8
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
6
+ exports.PLUGIN_PRIORITY = _undoRedo.PLUGIN_PRIORITY;
7
+ exports.UndoRedo = _undoRedo.UndoRedo;
@@ -1,2 +1 @@
1
- import UndoRedo, { PLUGIN_KEY } from "./undoRedo.mjs";
2
- export { PLUGIN_KEY, UndoRedo };
1
+ export { PLUGIN_KEY, PLUGIN_PRIORITY, UndoRedo } from "./undoRedo.mjs";