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.
- package/3rdparty/walkontable/src/index.js +2 -0
- package/3rdparty/walkontable/src/index.mjs +2 -1
- package/3rdparty/walkontable/src/overlays.js +2 -39
- package/3rdparty/walkontable/src/overlays.mjs +2 -39
- package/3rdparty/walkontable/src/renderer/_base.js +3 -4
- package/3rdparty/walkontable/src/renderer/_base.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/cells.js +7 -11
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -9
- package/3rdparty/walkontable/src/renderer/colGroup.js +6 -7
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +5 -5
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +4 -5
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +3 -3
- package/3rdparty/walkontable/src/renderer/index.js +18 -19
- package/3rdparty/walkontable/src/renderer/index.mjs +6 -6
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -7
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +5 -5
- package/3rdparty/walkontable/src/renderer/rows.js +23 -11
- package/3rdparty/walkontable/src/renderer/rows.mjs +23 -10
- package/3rdparty/walkontable/src/renderer/table.js +1 -1
- package/3rdparty/walkontable/src/renderer/table.mjs +1 -1
- package/3rdparty/walkontable/src/selection/border/border.js +10 -2
- package/3rdparty/walkontable/src/selection/border/border.mjs +10 -2
- package/3rdparty/walkontable/src/utils/nodesPool.js +21 -6
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +21 -6
- package/3rdparty/walkontable/src/utils/orderView/index.js +4 -5
- package/3rdparty/walkontable/src/utils/orderView/index.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/sharedView.js +3 -4
- package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.js +60 -76
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +59 -74
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.js +138 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.mjs +135 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +72 -0
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +68 -0
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +4 -5
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +3 -3
- package/CHANGELOG.md +51 -2
- package/README.md +3 -3
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/dropdownType/dropdownType.js +4 -2
- package/cellTypes/dropdownType/dropdownType.mjs +4 -2
- package/core.js +39 -38
- package/core.mjs +36 -35
- package/dataMap/dataMap.js +8 -0
- package/dataMap/dataMap.mjs +8 -0
- package/dataMap/dataSource.js +4 -0
- package/dataMap/dataSource.mjs +4 -0
- package/dataMap/metaManager/lazyFactoryMap.js +8 -5
- package/dataMap/metaManager/lazyFactoryMap.mjs +8 -5
- package/dataMap/metaManager/metaSchema.js +24 -9
- package/dataMap/metaManager/metaSchema.mjs +24 -9
- package/dist/handsontable.css +6 -2
- package/dist/handsontable.full.css +6 -2
- package/dist/handsontable.full.js +8026 -6927
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +530 -528
- package/dist/handsontable.js +3833 -2914
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +35 -33
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -3
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -3
- package/editors/dateEditor/dateEditor.js +4 -0
- package/editors/dateEditor/dateEditor.mjs +4 -0
- package/editors/dropdownEditor/dropdownEditor.js +3 -16
- package/editors/dropdownEditor/dropdownEditor.mjs +3 -16
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/focusManager.js +1 -1
- package/focusManager.mjs +1 -1
- package/helpers/dom/element.d.ts +0 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/object.js +4 -0
- package/helpers/object.mjs +4 -0
- package/package.json +2 -2
- package/plugins/base/base.js +0 -7
- package/plugins/base/base.mjs +0 -7
- package/plugins/comments/comments.js +12 -3
- package/plugins/comments/comments.mjs +12 -3
- package/plugins/contextMenu/contextMenu.js +2 -7
- package/plugins/contextMenu/contextMenu.mjs +2 -7
- package/plugins/contextMenu/menu/menu.js +2 -2
- package/plugins/contextMenu/menu/menu.mjs +2 -2
- package/plugins/contextMenu/predefinedItems/clearColumn.js +15 -4
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +15 -4
- package/plugins/copyPaste/copyPaste.js +6 -12
- package/plugins/copyPaste/copyPaste.mjs +6 -12
- package/plugins/filters/conditionCollection.js +8 -7
- package/plugins/filters/conditionCollection.mjs +8 -7
- package/plugins/filters/filters.js +26 -16
- package/plugins/filters/filters.mjs +26 -16
- package/plugins/filters/utils.js +7 -24
- package/plugins/filters/utils.mjs +7 -24
- package/plugins/hiddenColumns/hiddenColumns.js +1 -3
- package/plugins/hiddenColumns/hiddenColumns.mjs +1 -3
- package/plugins/hiddenRows/hiddenRows.js +1 -3
- package/plugins/hiddenRows/hiddenRows.mjs +1 -3
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/mergeCells/calculations/autofill.js +60 -44
- package/plugins/mergeCells/calculations/autofill.mjs +60 -44
- package/plugins/mergeCells/cellsCollection.js +25 -8
- package/plugins/mergeCells/cellsCollection.mjs +25 -8
- package/plugins/mergeCells/mergeCells.js +15 -16
- package/plugins/mergeCells/mergeCells.mjs +15 -16
- package/plugins/nestedHeaders/nestedHeaders.js +6 -1
- package/plugins/nestedHeaders/nestedHeaders.mjs +6 -1
- package/plugins/nestedHeaders/stateManager/index.js +1 -2
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -2
- package/plugins/nestedHeaders/utils/ghostTable.js +4 -0
- package/plugins/nestedHeaders/utils/ghostTable.mjs +4 -0
- package/plugins/nestedRows/utils/rowMoveController.js +1 -6
- package/plugins/nestedRows/utils/rowMoveController.mjs +1 -6
- 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 +123 -0
- package/plugins/undoRedo/actions/dataChange.mjs +119 -0
- package/plugins/undoRedo/actions/filters.js +66 -0
- package/plugins/undoRedo/actions/filters.mjs +62 -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/renderers/checkboxRenderer/checkboxRenderer.js +8 -1
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +8 -1
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +1 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +1 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -1
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -1
- package/styles/handsontable.css +75 -103
- 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/tableView.js +17 -1
- package/tableView.mjs +17 -1
- package/utils/autoResize.js +1 -1
- package/utils/autoResize.mjs +1 -1
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
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.every.js");
|
5
7
|
var _object = require("../../../helpers/object");
|
6
8
|
var _array = require("../../../helpers/array");
|
7
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; }
|
@@ -38,35 +40,20 @@ class AutofillCalculations {
|
|
38
40
|
this.mergedCellsCollection = this.plugin.mergedCellsCollection;
|
39
41
|
}
|
40
42
|
|
41
|
-
/**
|
42
|
-
* Correct the provided selection area, so it's not selecting only a part of a merged cell.
|
43
|
-
*
|
44
|
-
* @param {Array} selectionArea The selection to correct.
|
45
|
-
*/
|
46
|
-
correctSelectionAreaSize(selectionArea) {
|
47
|
-
if (selectionArea[0] === selectionArea[2] && selectionArea[1] === selectionArea[3]) {
|
48
|
-
const mergedCell = this.mergedCellsCollection.get(selectionArea[0], selectionArea[1]);
|
49
|
-
if (mergedCell) {
|
50
|
-
selectionArea[2] = selectionArea[0] + mergedCell.rowspan - 1;
|
51
|
-
selectionArea[3] = selectionArea[1] + mergedCell.colspan - 1;
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
43
|
/**
|
57
44
|
* Get the direction of the autofill process.
|
58
45
|
*
|
59
|
-
* @param {Array}
|
60
|
-
* @param {Array}
|
46
|
+
* @param {Array} baseArea The selection area.
|
47
|
+
* @param {Array} fullArea The final area (base + drag).
|
61
48
|
* @returns {string} `up`, `down`, `left` or `right`.
|
62
49
|
*/
|
63
|
-
getDirection(
|
50
|
+
getDirection(baseArea, fullArea) {
|
64
51
|
let direction = null;
|
65
|
-
if (
|
52
|
+
if (fullArea[0] === baseArea[0] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
66
53
|
direction = 'down';
|
67
|
-
} else if (
|
54
|
+
} else if (fullArea[2] === baseArea[2] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
68
55
|
direction = 'up';
|
69
|
-
} else if (
|
56
|
+
} else if (fullArea[1] === baseArea[1] && fullArea[2] === baseArea[2]) {
|
70
57
|
direction = 'right';
|
71
58
|
} else {
|
72
59
|
direction = 'left';
|
@@ -78,20 +65,20 @@ class AutofillCalculations {
|
|
78
65
|
* Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells.
|
79
66
|
*
|
80
67
|
* @param {Array} baseArea The base selected area.
|
81
|
-
* @param {Array}
|
68
|
+
* @param {Array} fullArea The drag area.
|
82
69
|
* @param {string} dragDirection The autofill drag direction.
|
83
70
|
* @param {Array} foundMergedCells MergeCellCoords found in the base selection area.
|
84
71
|
* @returns {Array} The new drag area.
|
85
72
|
*/
|
86
|
-
snapDragArea(baseArea,
|
87
|
-
const newDragArea =
|
88
|
-
const fillSize = this.getAutofillSize(baseArea,
|
73
|
+
snapDragArea(baseArea, fullArea, dragDirection, foundMergedCells) {
|
74
|
+
const newDragArea = fullArea.slice(0);
|
75
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, dragDirection);
|
89
76
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
90
77
|
const verticalDirection = ['up', 'down'].indexOf(dragDirection) > -1;
|
91
78
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
92
79
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
93
80
|
const partials = fillSize - fulls;
|
94
|
-
const farthestCollection = this.getFarthestCollection(baseArea,
|
81
|
+
const farthestCollection = this.getFarthestCollection(baseArea, fullArea, dragDirection, foundMergedCells);
|
95
82
|
if (farthestCollection) {
|
96
83
|
if (dragDirection === 'down') {
|
97
84
|
const fill = farthestCollection.row + farthestCollection.rowspan - baseAreaStartRow - partials;
|
@@ -156,13 +143,13 @@ class AutofillCalculations {
|
|
156
143
|
*
|
157
144
|
* @private
|
158
145
|
* @param {Array} baseArea The base selection area.
|
159
|
-
* @param {Array}
|
146
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
160
147
|
* @param {string} direction The drag direction.
|
161
148
|
* @returns {number|null} The "length" (height or width, depending on the direction) of the drag.
|
162
149
|
*/
|
163
|
-
getAutofillSize(baseArea,
|
150
|
+
getAutofillSize(baseArea, fullArea, direction) {
|
164
151
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
165
|
-
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] =
|
152
|
+
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = fullArea;
|
166
153
|
switch (direction) {
|
167
154
|
case 'up':
|
168
155
|
return baseAreaStartRow - dragAreaStartRow;
|
@@ -182,22 +169,30 @@ class AutofillCalculations {
|
|
182
169
|
*
|
183
170
|
* @private
|
184
171
|
* @param {Array} baseArea The base selection area.
|
185
|
-
* @param {Array}
|
172
|
+
* @param {Array} fullArea The base selection area extended by the drag area.
|
186
173
|
* @param {string} direction Drag direction.
|
187
174
|
* @returns {Array|null} Array representing the drag area coordinates.
|
188
175
|
*/
|
189
|
-
getDragArea(baseArea,
|
176
|
+
getDragArea(baseArea, fullArea, direction) {
|
190
177
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
191
|
-
const [
|
178
|
+
const [fullAreaStartRow, fullAreaStartColumn, fullAreaEndRow, fullAreaEndColumn] = fullArea;
|
192
179
|
switch (direction) {
|
193
180
|
case 'up':
|
194
|
-
return [
|
181
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];
|
195
182
|
case 'down':
|
196
|
-
|
183
|
+
{
|
184
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
185
|
+
const rowShift = mergedCell ? mergedCell.rowspan - 1 : 0;
|
186
|
+
return [baseAreaEndRow + 1, baseAreaStartColumn, fullAreaEndRow + rowShift, baseAreaEndColumn];
|
187
|
+
}
|
197
188
|
case 'left':
|
198
|
-
return [
|
189
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];
|
199
190
|
case 'right':
|
200
|
-
|
191
|
+
{
|
192
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
193
|
+
const columnShift = mergedCell ? mergedCell.colspan - 1 : 0;
|
194
|
+
return [baseAreaStartRow, baseAreaEndColumn + columnShift, fullAreaEndRow, fullAreaEndColumn];
|
195
|
+
}
|
201
196
|
default:
|
202
197
|
return null;
|
203
198
|
}
|
@@ -208,17 +203,17 @@ class AutofillCalculations {
|
|
208
203
|
*
|
209
204
|
* @private
|
210
205
|
* @param {Array} baseArea The base selection area.
|
211
|
-
* @param {Array}
|
206
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
212
207
|
* @param {string} direction The drag direction.
|
213
208
|
* @param {Array} mergedCellArray Array of the merged cells found in the base area.
|
214
209
|
* @returns {MergedCellCoords|null}
|
215
210
|
*/
|
216
|
-
getFarthestCollection(baseArea,
|
211
|
+
getFarthestCollection(baseArea, fullArea, direction, mergedCellArray) {
|
217
212
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
218
213
|
const verticalDirection = ['up', 'down'].indexOf(direction) > -1;
|
219
214
|
const baseEnd = verticalDirection ? baseAreaEndRow : baseAreaEndColumn;
|
220
215
|
const baseStart = verticalDirection ? baseAreaStartRow : baseAreaStartColumn;
|
221
|
-
const fillSize = this.getAutofillSize(baseArea,
|
216
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, direction);
|
222
217
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
223
218
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
224
219
|
const partials = fillSize - fulls;
|
@@ -293,7 +288,7 @@ class AutofillCalculations {
|
|
293
288
|
rowspan: current.rowspan,
|
294
289
|
col: current.col,
|
295
290
|
colspan: current.colspan
|
296
|
-
});
|
291
|
+
}, true);
|
297
292
|
break;
|
298
293
|
case 'down':
|
299
294
|
this.plugin.mergedCellsCollection.add({
|
@@ -301,7 +296,7 @@ class AutofillCalculations {
|
|
301
296
|
rowspan: current.rowspan,
|
302
297
|
col: current.col,
|
303
298
|
colspan: current.colspan
|
304
|
-
});
|
299
|
+
}, true);
|
305
300
|
break;
|
306
301
|
case 'left':
|
307
302
|
this.plugin.mergedCellsCollection.add({
|
@@ -309,7 +304,7 @@ class AutofillCalculations {
|
|
309
304
|
rowspan: current.rowspan,
|
310
305
|
col: current.col - fillOffset,
|
311
306
|
colspan: current.colspan
|
312
|
-
});
|
307
|
+
}, true);
|
313
308
|
break;
|
314
309
|
case 'right':
|
315
310
|
this.plugin.mergedCellsCollection.add({
|
@@ -317,7 +312,7 @@ class AutofillCalculations {
|
|
317
312
|
rowspan: current.rowspan,
|
318
313
|
col: current.col + fillOffset,
|
319
314
|
colspan: current.colspan
|
320
|
-
});
|
315
|
+
}, true);
|
321
316
|
break;
|
322
317
|
default:
|
323
318
|
}
|
@@ -392,7 +387,28 @@ class AutofillCalculations {
|
|
392
387
|
const topLeft = this.plugin.hot._createCellCoords(dragAreaStartRow, dragAreaStartColumn);
|
393
388
|
const bottomRight = this.plugin.hot._createCellCoords(dragAreaEndRow, dragAreaEndColumn);
|
394
389
|
const dragRange = this.plugin.hot._createCellRange(topLeft, topLeft, bottomRight);
|
395
|
-
|
390
|
+
const mergedCellsWithPartials = this.mergedCellsCollection.getWithinRange(dragRange, true);
|
391
|
+
if (mergedCellsWithPartials.length === 0) {
|
392
|
+
return false;
|
393
|
+
}
|
394
|
+
const mergedCellsWithoutPartials = this.mergedCellsCollection.getWithinRange(dragRange, false);
|
395
|
+
if (mergedCellsWithoutPartials.length === 0) {
|
396
|
+
return true;
|
397
|
+
}
|
398
|
+
if (direction === 'up' || direction === 'down') {
|
399
|
+
return !mergedCellsWithoutPartials.every(_ref => {
|
400
|
+
let {
|
401
|
+
colspan
|
402
|
+
} = _ref;
|
403
|
+
return colspan === dragRange.getWidth();
|
404
|
+
});
|
405
|
+
}
|
406
|
+
return !mergedCellsWithoutPartials.every(_ref2 => {
|
407
|
+
let {
|
408
|
+
rowspan
|
409
|
+
} = _ref2;
|
410
|
+
return rowspan === dragRange.getHeight();
|
411
|
+
});
|
396
412
|
}
|
397
413
|
}
|
398
414
|
var _default = exports.default = AutofillCalculations;
|
@@ -1,4 +1,6 @@
|
|
1
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.every.js";
|
2
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; }
|
3
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
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); }
|
@@ -35,35 +37,20 @@ class AutofillCalculations {
|
|
35
37
|
this.mergedCellsCollection = this.plugin.mergedCellsCollection;
|
36
38
|
}
|
37
39
|
|
38
|
-
/**
|
39
|
-
* Correct the provided selection area, so it's not selecting only a part of a merged cell.
|
40
|
-
*
|
41
|
-
* @param {Array} selectionArea The selection to correct.
|
42
|
-
*/
|
43
|
-
correctSelectionAreaSize(selectionArea) {
|
44
|
-
if (selectionArea[0] === selectionArea[2] && selectionArea[1] === selectionArea[3]) {
|
45
|
-
const mergedCell = this.mergedCellsCollection.get(selectionArea[0], selectionArea[1]);
|
46
|
-
if (mergedCell) {
|
47
|
-
selectionArea[2] = selectionArea[0] + mergedCell.rowspan - 1;
|
48
|
-
selectionArea[3] = selectionArea[1] + mergedCell.colspan - 1;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
40
|
/**
|
54
41
|
* Get the direction of the autofill process.
|
55
42
|
*
|
56
|
-
* @param {Array}
|
57
|
-
* @param {Array}
|
43
|
+
* @param {Array} baseArea The selection area.
|
44
|
+
* @param {Array} fullArea The final area (base + drag).
|
58
45
|
* @returns {string} `up`, `down`, `left` or `right`.
|
59
46
|
*/
|
60
|
-
getDirection(
|
47
|
+
getDirection(baseArea, fullArea) {
|
61
48
|
let direction = null;
|
62
|
-
if (
|
49
|
+
if (fullArea[0] === baseArea[0] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
63
50
|
direction = 'down';
|
64
|
-
} else if (
|
51
|
+
} else if (fullArea[2] === baseArea[2] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
|
65
52
|
direction = 'up';
|
66
|
-
} else if (
|
53
|
+
} else if (fullArea[1] === baseArea[1] && fullArea[2] === baseArea[2]) {
|
67
54
|
direction = 'right';
|
68
55
|
} else {
|
69
56
|
direction = 'left';
|
@@ -75,20 +62,20 @@ class AutofillCalculations {
|
|
75
62
|
* Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells.
|
76
63
|
*
|
77
64
|
* @param {Array} baseArea The base selected area.
|
78
|
-
* @param {Array}
|
65
|
+
* @param {Array} fullArea The drag area.
|
79
66
|
* @param {string} dragDirection The autofill drag direction.
|
80
67
|
* @param {Array} foundMergedCells MergeCellCoords found in the base selection area.
|
81
68
|
* @returns {Array} The new drag area.
|
82
69
|
*/
|
83
|
-
snapDragArea(baseArea,
|
84
|
-
const newDragArea =
|
85
|
-
const fillSize = this.getAutofillSize(baseArea,
|
70
|
+
snapDragArea(baseArea, fullArea, dragDirection, foundMergedCells) {
|
71
|
+
const newDragArea = fullArea.slice(0);
|
72
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, dragDirection);
|
86
73
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
87
74
|
const verticalDirection = ['up', 'down'].indexOf(dragDirection) > -1;
|
88
75
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
89
76
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
90
77
|
const partials = fillSize - fulls;
|
91
|
-
const farthestCollection = this.getFarthestCollection(baseArea,
|
78
|
+
const farthestCollection = this.getFarthestCollection(baseArea, fullArea, dragDirection, foundMergedCells);
|
92
79
|
if (farthestCollection) {
|
93
80
|
if (dragDirection === 'down') {
|
94
81
|
const fill = farthestCollection.row + farthestCollection.rowspan - baseAreaStartRow - partials;
|
@@ -153,13 +140,13 @@ class AutofillCalculations {
|
|
153
140
|
*
|
154
141
|
* @private
|
155
142
|
* @param {Array} baseArea The base selection area.
|
156
|
-
* @param {Array}
|
143
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
157
144
|
* @param {string} direction The drag direction.
|
158
145
|
* @returns {number|null} The "length" (height or width, depending on the direction) of the drag.
|
159
146
|
*/
|
160
|
-
getAutofillSize(baseArea,
|
147
|
+
getAutofillSize(baseArea, fullArea, direction) {
|
161
148
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
162
|
-
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] =
|
149
|
+
const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = fullArea;
|
163
150
|
switch (direction) {
|
164
151
|
case 'up':
|
165
152
|
return baseAreaStartRow - dragAreaStartRow;
|
@@ -179,22 +166,30 @@ class AutofillCalculations {
|
|
179
166
|
*
|
180
167
|
* @private
|
181
168
|
* @param {Array} baseArea The base selection area.
|
182
|
-
* @param {Array}
|
169
|
+
* @param {Array} fullArea The base selection area extended by the drag area.
|
183
170
|
* @param {string} direction Drag direction.
|
184
171
|
* @returns {Array|null} Array representing the drag area coordinates.
|
185
172
|
*/
|
186
|
-
getDragArea(baseArea,
|
173
|
+
getDragArea(baseArea, fullArea, direction) {
|
187
174
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
188
|
-
const [
|
175
|
+
const [fullAreaStartRow, fullAreaStartColumn, fullAreaEndRow, fullAreaEndColumn] = fullArea;
|
189
176
|
switch (direction) {
|
190
177
|
case 'up':
|
191
|
-
return [
|
178
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];
|
192
179
|
case 'down':
|
193
|
-
|
180
|
+
{
|
181
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
182
|
+
const rowShift = mergedCell ? mergedCell.rowspan - 1 : 0;
|
183
|
+
return [baseAreaEndRow + 1, baseAreaStartColumn, fullAreaEndRow + rowShift, baseAreaEndColumn];
|
184
|
+
}
|
194
185
|
case 'left':
|
195
|
-
return [
|
186
|
+
return [fullAreaStartRow, fullAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];
|
196
187
|
case 'right':
|
197
|
-
|
188
|
+
{
|
189
|
+
const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
|
190
|
+
const columnShift = mergedCell ? mergedCell.colspan - 1 : 0;
|
191
|
+
return [baseAreaStartRow, baseAreaEndColumn + columnShift, fullAreaEndRow, fullAreaEndColumn];
|
192
|
+
}
|
198
193
|
default:
|
199
194
|
return null;
|
200
195
|
}
|
@@ -205,17 +200,17 @@ class AutofillCalculations {
|
|
205
200
|
*
|
206
201
|
* @private
|
207
202
|
* @param {Array} baseArea The base selection area.
|
208
|
-
* @param {Array}
|
203
|
+
* @param {Array} fullArea The drag area (containing the base area).
|
209
204
|
* @param {string} direction The drag direction.
|
210
205
|
* @param {Array} mergedCellArray Array of the merged cells found in the base area.
|
211
206
|
* @returns {MergedCellCoords|null}
|
212
207
|
*/
|
213
|
-
getFarthestCollection(baseArea,
|
208
|
+
getFarthestCollection(baseArea, fullArea, direction, mergedCellArray) {
|
214
209
|
const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
|
215
210
|
const verticalDirection = ['up', 'down'].indexOf(direction) > -1;
|
216
211
|
const baseEnd = verticalDirection ? baseAreaEndRow : baseAreaEndColumn;
|
217
212
|
const baseStart = verticalDirection ? baseAreaStartRow : baseAreaStartColumn;
|
218
|
-
const fillSize = this.getAutofillSize(baseArea,
|
213
|
+
const fillSize = this.getAutofillSize(baseArea, fullArea, direction);
|
219
214
|
const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
|
220
215
|
const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
|
221
216
|
const partials = fillSize - fulls;
|
@@ -290,7 +285,7 @@ class AutofillCalculations {
|
|
290
285
|
rowspan: current.rowspan,
|
291
286
|
col: current.col,
|
292
287
|
colspan: current.colspan
|
293
|
-
});
|
288
|
+
}, true);
|
294
289
|
break;
|
295
290
|
case 'down':
|
296
291
|
this.plugin.mergedCellsCollection.add({
|
@@ -298,7 +293,7 @@ class AutofillCalculations {
|
|
298
293
|
rowspan: current.rowspan,
|
299
294
|
col: current.col,
|
300
295
|
colspan: current.colspan
|
301
|
-
});
|
296
|
+
}, true);
|
302
297
|
break;
|
303
298
|
case 'left':
|
304
299
|
this.plugin.mergedCellsCollection.add({
|
@@ -306,7 +301,7 @@ class AutofillCalculations {
|
|
306
301
|
rowspan: current.rowspan,
|
307
302
|
col: current.col - fillOffset,
|
308
303
|
colspan: current.colspan
|
309
|
-
});
|
304
|
+
}, true);
|
310
305
|
break;
|
311
306
|
case 'right':
|
312
307
|
this.plugin.mergedCellsCollection.add({
|
@@ -314,7 +309,7 @@ class AutofillCalculations {
|
|
314
309
|
rowspan: current.rowspan,
|
315
310
|
col: current.col + fillOffset,
|
316
311
|
colspan: current.colspan
|
317
|
-
});
|
312
|
+
}, true);
|
318
313
|
break;
|
319
314
|
default:
|
320
315
|
}
|
@@ -389,7 +384,28 @@ class AutofillCalculations {
|
|
389
384
|
const topLeft = this.plugin.hot._createCellCoords(dragAreaStartRow, dragAreaStartColumn);
|
390
385
|
const bottomRight = this.plugin.hot._createCellCoords(dragAreaEndRow, dragAreaEndColumn);
|
391
386
|
const dragRange = this.plugin.hot._createCellRange(topLeft, topLeft, bottomRight);
|
392
|
-
|
387
|
+
const mergedCellsWithPartials = this.mergedCellsCollection.getWithinRange(dragRange, true);
|
388
|
+
if (mergedCellsWithPartials.length === 0) {
|
389
|
+
return false;
|
390
|
+
}
|
391
|
+
const mergedCellsWithoutPartials = this.mergedCellsCollection.getWithinRange(dragRange, false);
|
392
|
+
if (mergedCellsWithoutPartials.length === 0) {
|
393
|
+
return true;
|
394
|
+
}
|
395
|
+
if (direction === 'up' || direction === 'down') {
|
396
|
+
return !mergedCellsWithoutPartials.every(_ref => {
|
397
|
+
let {
|
398
|
+
colspan
|
399
|
+
} = _ref;
|
400
|
+
return colspan === dragRange.getWidth();
|
401
|
+
});
|
402
|
+
}
|
403
|
+
return !mergedCellsWithoutPartials.every(_ref2 => {
|
404
|
+
let {
|
405
|
+
rowspan
|
406
|
+
} = _ref2;
|
407
|
+
return rowspan === dragRange.getHeight();
|
408
|
+
});
|
393
409
|
}
|
394
410
|
}
|
395
411
|
export default AutofillCalculations;
|
@@ -109,18 +109,33 @@ class MergedCellsCollection {
|
|
109
109
|
/**
|
110
110
|
* Get the first-found merged cell containing the provided range.
|
111
111
|
*
|
112
|
-
* @param {CellRange
|
113
|
-
* @returns {MergedCellCoords|
|
112
|
+
* @param {CellRange} range The range to search merged cells for.
|
113
|
+
* @returns {MergedCellCoords | false}
|
114
114
|
*/
|
115
115
|
getByRange(range) {
|
116
|
+
const {
|
117
|
+
row: rowStart,
|
118
|
+
col: columnStart
|
119
|
+
} = range.getTopStartCorner();
|
120
|
+
const {
|
121
|
+
row: rowEnd,
|
122
|
+
col: columnEnd
|
123
|
+
} = range.getBottomEndCorner();
|
124
|
+
const mergedCellsLength = this.mergedCells.length;
|
116
125
|
let result = false;
|
117
|
-
(0
|
118
|
-
|
126
|
+
for (let i = 0; i < mergedCellsLength; i++) {
|
127
|
+
const mergedCell = this.mergedCells[i];
|
128
|
+
const {
|
129
|
+
row,
|
130
|
+
col,
|
131
|
+
rowspan,
|
132
|
+
colspan
|
133
|
+
} = mergedCell;
|
134
|
+
if (row >= rowStart && row + rowspan - 1 <= rowEnd && col >= columnStart && col + colspan - 1 <= columnEnd) {
|
119
135
|
result = mergedCell;
|
120
|
-
|
136
|
+
break;
|
121
137
|
}
|
122
|
-
|
123
|
-
});
|
138
|
+
}
|
124
139
|
return result;
|
125
140
|
}
|
126
141
|
|
@@ -230,7 +245,9 @@ class MergedCellsCollection {
|
|
230
245
|
_assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, newMergedCell);
|
231
246
|
return newMergedCell;
|
232
247
|
}
|
233
|
-
|
248
|
+
if (isOverlapping) {
|
249
|
+
(0, _console.warn)(MergedCellsCollection.IS_OVERLAPPING_WARNING(newMergedCell));
|
250
|
+
}
|
234
251
|
return false;
|
235
252
|
}
|
236
253
|
|
@@ -105,18 +105,33 @@ class MergedCellsCollection {
|
|
105
105
|
/**
|
106
106
|
* Get the first-found merged cell containing the provided range.
|
107
107
|
*
|
108
|
-
* @param {CellRange
|
109
|
-
* @returns {MergedCellCoords|
|
108
|
+
* @param {CellRange} range The range to search merged cells for.
|
109
|
+
* @returns {MergedCellCoords | false}
|
110
110
|
*/
|
111
111
|
getByRange(range) {
|
112
|
+
const {
|
113
|
+
row: rowStart,
|
114
|
+
col: columnStart
|
115
|
+
} = range.getTopStartCorner();
|
116
|
+
const {
|
117
|
+
row: rowEnd,
|
118
|
+
col: columnEnd
|
119
|
+
} = range.getBottomEndCorner();
|
120
|
+
const mergedCellsLength = this.mergedCells.length;
|
112
121
|
let result = false;
|
113
|
-
|
114
|
-
|
122
|
+
for (let i = 0; i < mergedCellsLength; i++) {
|
123
|
+
const mergedCell = this.mergedCells[i];
|
124
|
+
const {
|
125
|
+
row,
|
126
|
+
col,
|
127
|
+
rowspan,
|
128
|
+
colspan
|
129
|
+
} = mergedCell;
|
130
|
+
if (row >= rowStart && row + rowspan - 1 <= rowEnd && col >= columnStart && col + colspan - 1 <= columnEnd) {
|
115
131
|
result = mergedCell;
|
116
|
-
|
132
|
+
break;
|
117
133
|
}
|
118
|
-
|
119
|
-
});
|
134
|
+
}
|
120
135
|
return result;
|
121
136
|
}
|
122
137
|
|
@@ -226,7 +241,9 @@ class MergedCellsCollection {
|
|
226
241
|
_assertClassBrand(_MergedCellsCollection_brand, this, _addMergedCellToMatrix).call(this, newMergedCell);
|
227
242
|
return newMergedCell;
|
228
243
|
}
|
229
|
-
|
244
|
+
if (isOverlapping) {
|
245
|
+
warn(MergedCellsCollection.IS_OVERLAPPING_WARNING(newMergedCell));
|
246
|
+
}
|
230
247
|
return false;
|
231
248
|
}
|
232
249
|
|
@@ -909,8 +909,8 @@ class MergeCells extends _base.BasePlugin {
|
|
909
909
|
/**
|
910
910
|
* The `modifyAutofillRange` hook callback.
|
911
911
|
*
|
912
|
-
* @param {Array}
|
913
|
-
* @param {Array}
|
912
|
+
* @param {Array} fullArea The drag + base area coordinates.
|
913
|
+
* @param {Array} baseArea The selection information.
|
914
914
|
* @returns {Array} The new drag area.
|
915
915
|
*/
|
916
916
|
}
|
@@ -1294,23 +1294,19 @@ function _onAfterViewportColumnCalculatorOverride(calc) {
|
|
1294
1294
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1295
1295
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1296
1296
|
}
|
1297
|
-
function _onModifyAutofillRange(
|
1298
|
-
this.autofillCalculations.
|
1299
|
-
|
1300
|
-
|
1301
|
-
if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
|
1302
|
-
dragArea = select;
|
1303
|
-
return dragArea;
|
1297
|
+
function _onModifyAutofillRange(fullArea, baseArea) {
|
1298
|
+
const dragDirection = this.autofillCalculations.getDirection(baseArea, fullArea);
|
1299
|
+
if (this.autofillCalculations.dragAreaOverlapsCollections(baseArea, fullArea, dragDirection)) {
|
1300
|
+
return baseArea;
|
1304
1301
|
}
|
1305
|
-
const from = this.hot._createCellCoords(
|
1306
|
-
const to = this.hot._createCellCoords(
|
1302
|
+
const from = this.hot._createCellCoords(baseArea[0], baseArea[1]);
|
1303
|
+
const to = this.hot._createCellCoords(baseArea[2], baseArea[3]);
|
1307
1304
|
const range = this.hot._createCellRange(from, from, to);
|
1308
1305
|
const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange(range);
|
1309
1306
|
if (mergedCellsWithinSelectionArea.length === 0) {
|
1310
|
-
return
|
1307
|
+
return fullArea;
|
1311
1308
|
}
|
1312
|
-
|
1313
|
-
return dragArea;
|
1309
|
+
return this.autofillCalculations.snapDragArea(baseArea, fullArea, dragDirection, mergedCellsWithinSelectionArea);
|
1314
1310
|
}
|
1315
1311
|
/**
|
1316
1312
|
* `afterCreateCol` hook callback.
|
@@ -1474,7 +1470,6 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1474
1470
|
rowspanCorrection = maxRowspan - mergedCellsWithinRange[0].rowspan;
|
1475
1471
|
}
|
1476
1472
|
mergedCellsWithinRange.forEach(_ref2 => {
|
1477
|
-
var _height;
|
1478
1473
|
let {
|
1479
1474
|
rowspan
|
1480
1475
|
} = _ref2;
|
@@ -1484,7 +1479,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1484
1479
|
} else {
|
1485
1480
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
1486
1481
|
}
|
1487
|
-
height = Math.max(
|
1482
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, _assertClassBrand(_MergeCells_brand, this, _sumCellsHeights).call(this, row, rowspanAfterCorrection));
|
1488
1483
|
});
|
1489
1484
|
return height;
|
1490
1485
|
}
|
@@ -1496,6 +1491,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1496
1491
|
* @returns {number}
|
1497
1492
|
*/
|
1498
1493
|
function _sumCellsHeights(row, rowspan) {
|
1494
|
+
const stylesHandler = this.hot.view.getStylesHandler();
|
1499
1495
|
const defaultHeight = this.hot.view.getDefaultRowHeight();
|
1500
1496
|
const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
|
1501
1497
|
let height = 0;
|
@@ -1503,6 +1499,9 @@ function _sumCellsHeights(row, rowspan) {
|
|
1503
1499
|
if (!this.hot.rowIndexMapper.isHidden(i)) {
|
1504
1500
|
var _autoRowSizePlugin$ge;
|
1505
1501
|
height += (_autoRowSizePlugin$ge = autoRowSizePlugin === null || autoRowSizePlugin === void 0 ? void 0 : autoRowSizePlugin.getRowHeight(i)) !== null && _autoRowSizePlugin$ge !== void 0 ? _autoRowSizePlugin$ge : defaultHeight;
|
1502
|
+
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1503
|
+
height += 1; // border-top-width
|
1504
|
+
}
|
1506
1505
|
}
|
1507
1506
|
}
|
1508
1507
|
return height;
|