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
@@ -905,8 +905,8 @@ export class MergeCells extends BasePlugin {
|
|
905
905
|
/**
|
906
906
|
* The `modifyAutofillRange` hook callback.
|
907
907
|
*
|
908
|
-
* @param {Array}
|
909
|
-
* @param {Array}
|
908
|
+
* @param {Array} fullArea The drag + base area coordinates.
|
909
|
+
* @param {Array} baseArea The selection information.
|
910
910
|
* @returns {Array} The new drag area.
|
911
911
|
*/
|
912
912
|
}
|
@@ -1289,23 +1289,19 @@ function _onAfterViewportColumnCalculatorOverride(calc) {
|
|
1289
1289
|
this.modifyViewportColumnStart(calc, nrOfRows);
|
1290
1290
|
this.modifyViewportColumnEnd(calc, nrOfRows);
|
1291
1291
|
}
|
1292
|
-
function _onModifyAutofillRange(
|
1293
|
-
this.autofillCalculations.
|
1294
|
-
|
1295
|
-
|
1296
|
-
if (this.autofillCalculations.dragAreaOverlapsCollections(select, dragArea, dragDirection)) {
|
1297
|
-
dragArea = select;
|
1298
|
-
return dragArea;
|
1292
|
+
function _onModifyAutofillRange(fullArea, baseArea) {
|
1293
|
+
const dragDirection = this.autofillCalculations.getDirection(baseArea, fullArea);
|
1294
|
+
if (this.autofillCalculations.dragAreaOverlapsCollections(baseArea, fullArea, dragDirection)) {
|
1295
|
+
return baseArea;
|
1299
1296
|
}
|
1300
|
-
const from = this.hot._createCellCoords(
|
1301
|
-
const to = this.hot._createCellCoords(
|
1297
|
+
const from = this.hot._createCellCoords(baseArea[0], baseArea[1]);
|
1298
|
+
const to = this.hot._createCellCoords(baseArea[2], baseArea[3]);
|
1302
1299
|
const range = this.hot._createCellRange(from, from, to);
|
1303
1300
|
const mergedCellsWithinSelectionArea = this.mergedCellsCollection.getWithinRange(range);
|
1304
1301
|
if (mergedCellsWithinSelectionArea.length === 0) {
|
1305
|
-
return
|
1302
|
+
return fullArea;
|
1306
1303
|
}
|
1307
|
-
|
1308
|
-
return dragArea;
|
1304
|
+
return this.autofillCalculations.snapDragArea(baseArea, fullArea, dragDirection, mergedCellsWithinSelectionArea);
|
1309
1305
|
}
|
1310
1306
|
/**
|
1311
1307
|
* `afterCreateCol` hook callback.
|
@@ -1469,7 +1465,6 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1469
1465
|
rowspanCorrection = maxRowspan - mergedCellsWithinRange[0].rowspan;
|
1470
1466
|
}
|
1471
1467
|
mergedCellsWithinRange.forEach(_ref2 => {
|
1472
|
-
var _height;
|
1473
1468
|
let {
|
1474
1469
|
rowspan
|
1475
1470
|
} = _ref2;
|
@@ -1479,7 +1474,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1479
1474
|
} else {
|
1480
1475
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
1481
1476
|
}
|
1482
|
-
height = Math.max(
|
1477
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, _assertClassBrand(_MergeCells_brand, this, _sumCellsHeights).call(this, row, rowspanAfterCorrection));
|
1483
1478
|
});
|
1484
1479
|
return height;
|
1485
1480
|
}
|
@@ -1491,6 +1486,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
1491
1486
|
* @returns {number}
|
1492
1487
|
*/
|
1493
1488
|
function _sumCellsHeights(row, rowspan) {
|
1489
|
+
const stylesHandler = this.hot.view.getStylesHandler();
|
1494
1490
|
const defaultHeight = this.hot.view.getDefaultRowHeight();
|
1495
1491
|
const autoRowSizePlugin = this.hot.getPlugin('autoRowSize');
|
1496
1492
|
let height = 0;
|
@@ -1498,6 +1494,9 @@ function _sumCellsHeights(row, rowspan) {
|
|
1498
1494
|
if (!this.hot.rowIndexMapper.isHidden(i)) {
|
1499
1495
|
var _autoRowSizePlugin$ge;
|
1500
1496
|
height += (_autoRowSizePlugin$ge = autoRowSizePlugin === null || autoRowSizePlugin === void 0 ? void 0 : autoRowSizePlugin.getRowHeight(i)) !== null && _autoRowSizePlugin$ge !== void 0 ? _autoRowSizePlugin$ge : defaultHeight;
|
1497
|
+
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
1498
|
+
height += 1; // border-top-width
|
1499
|
+
}
|
1501
1500
|
}
|
1502
1501
|
}
|
1503
1502
|
return height;
|
@@ -425,6 +425,7 @@ class NestedHeaders extends _base.BasePlugin {
|
|
425
425
|
}
|
426
426
|
TH.removeAttribute('colspan');
|
427
427
|
(0, _element.removeClass)(TH, 'hiddenHeader');
|
428
|
+
(0, _element.removeClass)(TH, 'hiddenHeaderText');
|
428
429
|
const {
|
429
430
|
colspan,
|
430
431
|
isHidden,
|
@@ -436,12 +437,16 @@ class NestedHeaders extends _base.BasePlugin {
|
|
436
437
|
if (isPlaceholder || isHidden) {
|
437
438
|
(0, _element.addClass)(TH, 'hiddenHeader');
|
438
439
|
} else if (colspan > 1) {
|
439
|
-
var _wtOverlays$topInline, _wtOverlays$inlineSta;
|
440
|
+
var _wtOverlays$topInline, _wtOverlays$inlineSta, _wtOverlays$topOverla;
|
440
441
|
const {
|
441
442
|
wtOverlays
|
442
443
|
} = view._wt;
|
443
444
|
const isTopInlineStartOverlay = (_wtOverlays$topInline = wtOverlays.topInlineStartCornerOverlay) === null || _wtOverlays$topInline === void 0 ? void 0 : _wtOverlays$topInline.clone.wtTable.THEAD.contains(TH);
|
444
445
|
const isInlineStartOverlay = (_wtOverlays$inlineSta = wtOverlays.inlineStartOverlay) === null || _wtOverlays$inlineSta === void 0 ? void 0 : _wtOverlays$inlineSta.clone.wtTable.THEAD.contains(TH);
|
446
|
+
const isTopOverlay = (_wtOverlays$topOverla = wtOverlays.topOverlay) === null || _wtOverlays$topOverla === void 0 ? void 0 : _wtOverlays$topOverla.clone.wtTable.THEAD.contains(TH);
|
447
|
+
if (isTopOverlay && visualColumnIndex < fixedColumnsStart) {
|
448
|
+
(0, _element.addClass)(TH, 'hiddenHeaderText');
|
449
|
+
}
|
445
450
|
|
446
451
|
// Check if there is a fixed column enabled, if so then reduce colspan to fixed column width.
|
447
452
|
const correctedColspan = isTopInlineStartOverlay || isInlineStartOverlay ? Math.min(colspan, fixedColumnsStart - renderedColumnIndex) : colspan;
|
@@ -421,6 +421,7 @@ export class NestedHeaders extends BasePlugin {
|
|
421
421
|
}
|
422
422
|
TH.removeAttribute('colspan');
|
423
423
|
removeClass(TH, 'hiddenHeader');
|
424
|
+
removeClass(TH, 'hiddenHeaderText');
|
424
425
|
const {
|
425
426
|
colspan,
|
426
427
|
isHidden,
|
@@ -432,12 +433,16 @@ export class NestedHeaders extends BasePlugin {
|
|
432
433
|
if (isPlaceholder || isHidden) {
|
433
434
|
addClass(TH, 'hiddenHeader');
|
434
435
|
} else if (colspan > 1) {
|
435
|
-
var _wtOverlays$topInline, _wtOverlays$inlineSta;
|
436
|
+
var _wtOverlays$topInline, _wtOverlays$inlineSta, _wtOverlays$topOverla;
|
436
437
|
const {
|
437
438
|
wtOverlays
|
438
439
|
} = view._wt;
|
439
440
|
const isTopInlineStartOverlay = (_wtOverlays$topInline = wtOverlays.topInlineStartCornerOverlay) === null || _wtOverlays$topInline === void 0 ? void 0 : _wtOverlays$topInline.clone.wtTable.THEAD.contains(TH);
|
440
441
|
const isInlineStartOverlay = (_wtOverlays$inlineSta = wtOverlays.inlineStartOverlay) === null || _wtOverlays$inlineSta === void 0 ? void 0 : _wtOverlays$inlineSta.clone.wtTable.THEAD.contains(TH);
|
442
|
+
const isTopOverlay = (_wtOverlays$topOverla = wtOverlays.topOverlay) === null || _wtOverlays$topOverla === void 0 ? void 0 : _wtOverlays$topOverla.clone.wtTable.THEAD.contains(TH);
|
443
|
+
if (isTopOverlay && visualColumnIndex < fixedColumnsStart) {
|
444
|
+
addClass(TH, 'hiddenHeaderText');
|
445
|
+
}
|
441
446
|
|
442
447
|
// Check if there is a fixed column enabled, if so then reduce colspan to fixed column width.
|
443
448
|
const correctedColspan = isTopInlineStartOverlay || isInlineStartOverlay ? Math.min(colspan, fixedColumnsStart - renderedColumnIndex) : colspan;
|
@@ -348,7 +348,6 @@ class StateManager {
|
|
348
348
|
* @returns {number} Returns a header level in format -1 to -N.
|
349
349
|
*/
|
350
350
|
findTopMostEntireHeaderLevel(columnIndexFrom) {
|
351
|
-
var _headerLevel;
|
352
351
|
let columnIndexTo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : columnIndexFrom;
|
353
352
|
const columnsWidth = columnIndexTo - columnIndexFrom + 1;
|
354
353
|
let atLeastOneRootFound = false;
|
@@ -381,7 +380,7 @@ class StateManager {
|
|
381
380
|
if (atLeastOneRootFound && headerLevel === null) {
|
382
381
|
return -1;
|
383
382
|
}
|
384
|
-
return this.levelToRowCoords(
|
383
|
+
return this.levelToRowCoords(headerLevel !== null && headerLevel !== void 0 ? headerLevel : 0);
|
385
384
|
}
|
386
385
|
|
387
386
|
/**
|
@@ -344,7 +344,6 @@ export default class StateManager {
|
|
344
344
|
* @returns {number} Returns a header level in format -1 to -N.
|
345
345
|
*/
|
346
346
|
findTopMostEntireHeaderLevel(columnIndexFrom) {
|
347
|
-
var _headerLevel;
|
348
347
|
let columnIndexTo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : columnIndexFrom;
|
349
348
|
const columnsWidth = columnIndexTo - columnIndexFrom + 1;
|
350
349
|
let atLeastOneRootFound = false;
|
@@ -377,7 +376,7 @@ export default class StateManager {
|
|
377
376
|
if (atLeastOneRootFound && headerLevel === null) {
|
378
377
|
return -1;
|
379
378
|
}
|
380
|
-
return this.levelToRowCoords(
|
379
|
+
return this.levelToRowCoords(headerLevel !== null && headerLevel !== void 0 ? headerLevel : 0);
|
381
380
|
}
|
382
381
|
|
383
382
|
/**
|
@@ -81,8 +81,12 @@ class GhostTable {
|
|
81
81
|
* Build cache of the headers widths.
|
82
82
|
*/
|
83
83
|
buildWidthsMap() {
|
84
|
+
const currentThemeName = this.hot.getCurrentThemeName();
|
84
85
|
this.container = this.hot.rootDocument.createElement('div');
|
85
86
|
this.container.classList.add('handsontable', 'htGhostTable', 'htAutoSize');
|
87
|
+
if (currentThemeName) {
|
88
|
+
this.container.classList.add(currentThemeName);
|
89
|
+
}
|
86
90
|
this._buildGhostTable(this.container);
|
87
91
|
this.hot.rootDocument.body.appendChild(this.container);
|
88
92
|
const columns = this.container.querySelectorAll('tr:last-of-type th');
|
@@ -78,8 +78,12 @@ class GhostTable {
|
|
78
78
|
* Build cache of the headers widths.
|
79
79
|
*/
|
80
80
|
buildWidthsMap() {
|
81
|
+
const currentThemeName = this.hot.getCurrentThemeName();
|
81
82
|
this.container = this.hot.rootDocument.createElement('div');
|
82
83
|
this.container.classList.add('handsontable', 'htGhostTable', 'htAutoSize');
|
84
|
+
if (currentThemeName) {
|
85
|
+
this.container.classList.add(currentThemeName);
|
86
|
+
}
|
83
87
|
this._buildGhostTable(this.container);
|
84
88
|
this.hot.rootDocument.body.appendChild(this.container);
|
85
89
|
const columns = this.container.querySelectorAll('tr:last-of-type th');
|
@@ -247,8 +247,6 @@ class RowMoveController {
|
|
247
247
|
const rowsLen = rows.length;
|
248
248
|
let startRow = 0;
|
249
249
|
let endRow = 0;
|
250
|
-
let selection = null;
|
251
|
-
let lastColIndex = null;
|
252
250
|
if (this.movedToCollapsed) {
|
253
251
|
let physicalDropIndex = null;
|
254
252
|
if (rows[rowsLen - 1] < dropIndex) {
|
@@ -267,10 +265,7 @@ class RowMoveController {
|
|
267
265
|
startRow = dropIndex;
|
268
266
|
endRow = startRow + rowsLen - 1;
|
269
267
|
}
|
270
|
-
|
271
|
-
lastColIndex = this.hot.countCols() - 1;
|
272
|
-
selection.setRangeStart(this.hot._createCellCoords(startRow, 0));
|
273
|
-
selection.setRangeEnd(this.hot._createCellCoords(endRow, lastColIndex), true);
|
268
|
+
this.hot.selectCells([[startRow, 0, endRow, this.hot.countCols() - 1]], false);
|
274
269
|
}
|
275
270
|
|
276
271
|
// TODO: Reimplementation of function which is inside the `ManualRowMove` plugin.
|
@@ -244,8 +244,6 @@ export default class RowMoveController {
|
|
244
244
|
const rowsLen = rows.length;
|
245
245
|
let startRow = 0;
|
246
246
|
let endRow = 0;
|
247
|
-
let selection = null;
|
248
|
-
let lastColIndex = null;
|
249
247
|
if (this.movedToCollapsed) {
|
250
248
|
let physicalDropIndex = null;
|
251
249
|
if (rows[rowsLen - 1] < dropIndex) {
|
@@ -264,10 +262,7 @@ export default class RowMoveController {
|
|
264
262
|
startRow = dropIndex;
|
265
263
|
endRow = startRow + rowsLen - 1;
|
266
264
|
}
|
267
|
-
|
268
|
-
lastColIndex = this.hot.countCols() - 1;
|
269
|
-
selection.setRangeStart(this.hot._createCellCoords(startRow, 0));
|
270
|
-
selection.setRangeEnd(this.hot._createCellCoords(endRow, lastColIndex), true);
|
265
|
+
this.hot.selectCells([[startRow, 0, endRow, this.hot.countCols() - 1]], false);
|
271
266
|
}
|
272
267
|
|
273
268
|
// TODO: Reimplementation of function which is inside the `ManualRowMove` plugin.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
5
|
+
/**
|
6
|
+
* An abstract class that defines the structure of an undo/redo action.
|
7
|
+
*
|
8
|
+
* @class BaseAction
|
9
|
+
* @private
|
10
|
+
*/
|
11
|
+
class BaseAction {
|
12
|
+
undo() {
|
13
|
+
throw new Error('Not implemented');
|
14
|
+
}
|
15
|
+
redo() {
|
16
|
+
throw new Error('Not implemented');
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.BaseAction = BaseAction;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
/**
|
3
|
+
* An abstract class that defines the structure of an undo/redo action.
|
4
|
+
*
|
5
|
+
* @class BaseAction
|
6
|
+
* @private
|
7
|
+
*/
|
8
|
+
export class BaseAction {
|
9
|
+
undo() {
|
10
|
+
throw new Error('Not implemented');
|
11
|
+
}
|
12
|
+
redo() {
|
13
|
+
throw new Error('Not implemented');
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,85 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
5
|
+
var _base = require("./_base");
|
6
|
+
var _utils = require("../../contextMenu/utils");
|
7
|
+
var _array = require("../../../helpers/array");
|
8
|
+
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; }
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
10
|
+
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); }
|
11
|
+
/**
|
12
|
+
* Action that tracks cell alignment changes.
|
13
|
+
*
|
14
|
+
* @class CellAlignmentAction
|
15
|
+
* @private
|
16
|
+
*/
|
17
|
+
class CellAlignmentAction extends _base.BaseAction {
|
18
|
+
constructor(_ref) {
|
19
|
+
let {
|
20
|
+
stateBefore,
|
21
|
+
range,
|
22
|
+
type,
|
23
|
+
alignment
|
24
|
+
} = _ref;
|
25
|
+
super();
|
26
|
+
/**
|
27
|
+
* @param {Array} stateBefore The previous state.
|
28
|
+
*/
|
29
|
+
_defineProperty(this, "stateBefore", void 0);
|
30
|
+
/**
|
31
|
+
* @param {object} range The cell range.
|
32
|
+
*/
|
33
|
+
_defineProperty(this, "range", void 0);
|
34
|
+
/**
|
35
|
+
* @param {string} type The type of the alignment ("top", "left", "bottom" or "right").
|
36
|
+
*/
|
37
|
+
_defineProperty(this, "type", void 0);
|
38
|
+
/**
|
39
|
+
* @param {string} alignment The alignment CSS class.
|
40
|
+
*/
|
41
|
+
_defineProperty(this, "alignment", void 0);
|
42
|
+
this.stateBefore = stateBefore;
|
43
|
+
this.range = range;
|
44
|
+
this.type = type;
|
45
|
+
this.alignment = alignment;
|
46
|
+
}
|
47
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
48
|
+
hot.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
|
49
|
+
undoRedoPlugin.done(() => new CellAlignmentAction({
|
50
|
+
stateBefore,
|
51
|
+
range,
|
52
|
+
type,
|
53
|
+
alignment
|
54
|
+
}));
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* @param {Core} hot The Handsontable instance.
|
60
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
61
|
+
*/
|
62
|
+
undo(hot, undoneCallback) {
|
63
|
+
(0, _array.arrayEach)(this.range, range => {
|
64
|
+
range.forAll((row, col) => {
|
65
|
+
// Alignment classes should only collected within cell ranges. We skip header coordinates.
|
66
|
+
if (row >= 0 && col >= 0) {
|
67
|
+
hot.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
|
68
|
+
}
|
69
|
+
});
|
70
|
+
});
|
71
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
72
|
+
hot.render();
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @param {Core} hot The Handsontable instance.
|
77
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
78
|
+
*/
|
79
|
+
redo(hot, redoneCallback) {
|
80
|
+
(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));
|
81
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
82
|
+
hot.render();
|
83
|
+
}
|
84
|
+
}
|
85
|
+
exports.CellAlignmentAction = CellAlignmentAction;
|
@@ -0,0 +1,81 @@
|
|
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
|
+
import { align } from "../../contextMenu/utils.mjs";
|
7
|
+
import { arrayEach } from "../../../helpers/array.mjs";
|
8
|
+
/**
|
9
|
+
* Action that tracks cell alignment changes.
|
10
|
+
*
|
11
|
+
* @class CellAlignmentAction
|
12
|
+
* @private
|
13
|
+
*/
|
14
|
+
export class CellAlignmentAction extends BaseAction {
|
15
|
+
constructor(_ref) {
|
16
|
+
let {
|
17
|
+
stateBefore,
|
18
|
+
range,
|
19
|
+
type,
|
20
|
+
alignment
|
21
|
+
} = _ref;
|
22
|
+
super();
|
23
|
+
/**
|
24
|
+
* @param {Array} stateBefore The previous state.
|
25
|
+
*/
|
26
|
+
_defineProperty(this, "stateBefore", void 0);
|
27
|
+
/**
|
28
|
+
* @param {object} range The cell range.
|
29
|
+
*/
|
30
|
+
_defineProperty(this, "range", void 0);
|
31
|
+
/**
|
32
|
+
* @param {string} type The type of the alignment ("top", "left", "bottom" or "right").
|
33
|
+
*/
|
34
|
+
_defineProperty(this, "type", void 0);
|
35
|
+
/**
|
36
|
+
* @param {string} alignment The alignment CSS class.
|
37
|
+
*/
|
38
|
+
_defineProperty(this, "alignment", void 0);
|
39
|
+
this.stateBefore = stateBefore;
|
40
|
+
this.range = range;
|
41
|
+
this.type = type;
|
42
|
+
this.alignment = alignment;
|
43
|
+
}
|
44
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
45
|
+
hot.addHook('beforeCellAlignment', (stateBefore, range, type, alignment) => {
|
46
|
+
undoRedoPlugin.done(() => new CellAlignmentAction({
|
47
|
+
stateBefore,
|
48
|
+
range,
|
49
|
+
type,
|
50
|
+
alignment
|
51
|
+
}));
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @param {Core} hot The Handsontable instance.
|
57
|
+
* @param {function(): void} undoneCallback The callback to be called after the action is undone.
|
58
|
+
*/
|
59
|
+
undo(hot, undoneCallback) {
|
60
|
+
arrayEach(this.range, range => {
|
61
|
+
range.forAll((row, col) => {
|
62
|
+
// Alignment classes should only collected within cell ranges. We skip header coordinates.
|
63
|
+
if (row >= 0 && col >= 0) {
|
64
|
+
hot.setCellMeta(row, col, 'className', this.stateBefore[row][col] || ' htLeft');
|
65
|
+
}
|
66
|
+
});
|
67
|
+
});
|
68
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
69
|
+
hot.render();
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* @param {Core} hot The Handsontable instance.
|
74
|
+
* @param {function(): void} redoneCallback The callback to be called after the action is redone.
|
75
|
+
*/
|
76
|
+
redo(hot, redoneCallback) {
|
77
|
+
align(this.range, this.type, this.alignment, (row, col) => hot.getCellMeta(row, col), (row, col, key, value) => hot.setCellMeta(row, col, key, value));
|
78
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
79
|
+
hot.render();
|
80
|
+
}
|
81
|
+
}
|
@@ -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 column move changes.
|
14
|
+
*
|
15
|
+
* @class ColumnMoveAction
|
16
|
+
* @private
|
17
|
+
*/
|
18
|
+
class ColumnMoveAction extends _base.BaseAction {
|
19
|
+
constructor(_ref) {
|
20
|
+
let {
|
21
|
+
columns,
|
22
|
+
finalIndex
|
23
|
+
} = _ref;
|
24
|
+
super();
|
25
|
+
/**
|
26
|
+
* @param {number[]} columns An array with moved columns.
|
27
|
+
*/
|
28
|
+
_defineProperty(this, "columns", void 0);
|
29
|
+
/**
|
30
|
+
* @param {number} finalIndex The destination index.
|
31
|
+
*/
|
32
|
+
_defineProperty(this, "finalColumnIndex", void 0);
|
33
|
+
this.columns = columns.slice();
|
34
|
+
this.finalColumnIndex = finalIndex;
|
35
|
+
}
|
36
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
37
|
+
hot.addHook('beforeColumnMove', (columns, finalIndex) => {
|
38
|
+
if (columns === false) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
undoRedoPlugin.done(() => new ColumnMoveAction({
|
42
|
+
columns,
|
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 manualColumnMove = hot.getPlugin('manualColumnMove');
|
54
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
55
|
+
const columnMoves = (0, _moves.getMoves)(this.columns, this.finalColumnIndex, hot.columnIndexMapper.getNumberOfIndexes());
|
56
|
+
columnMoves.reverse().forEach(_ref2 => {
|
57
|
+
let {
|
58
|
+
from,
|
59
|
+
to
|
60
|
+
} = _ref2;
|
61
|
+
if (from < to) {
|
62
|
+
to -= 1;
|
63
|
+
}
|
64
|
+
manualColumnMove.moveColumn(to, from);
|
65
|
+
});
|
66
|
+
hot.render();
|
67
|
+
hot.deselectCell();
|
68
|
+
hot.selectColumns(this.columns[0], this.columns[0] + this.columns.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 manualColumnMove = hot.getPlugin('manualColumnMove');
|
77
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
78
|
+
manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
|
79
|
+
hot.render();
|
80
|
+
hot.deselectCell();
|
81
|
+
hot.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
exports.ColumnMoveAction = ColumnMoveAction;
|
@@ -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 column move changes.
|
11
|
+
*
|
12
|
+
* @class ColumnMoveAction
|
13
|
+
* @private
|
14
|
+
*/
|
15
|
+
export class ColumnMoveAction extends BaseAction {
|
16
|
+
constructor(_ref) {
|
17
|
+
let {
|
18
|
+
columns,
|
19
|
+
finalIndex
|
20
|
+
} = _ref;
|
21
|
+
super();
|
22
|
+
/**
|
23
|
+
* @param {number[]} columns An array with moved columns.
|
24
|
+
*/
|
25
|
+
_defineProperty(this, "columns", void 0);
|
26
|
+
/**
|
27
|
+
* @param {number} finalIndex The destination index.
|
28
|
+
*/
|
29
|
+
_defineProperty(this, "finalColumnIndex", void 0);
|
30
|
+
this.columns = columns.slice();
|
31
|
+
this.finalColumnIndex = finalIndex;
|
32
|
+
}
|
33
|
+
static startRegisteringEvents(hot, undoRedoPlugin) {
|
34
|
+
hot.addHook('beforeColumnMove', (columns, finalIndex) => {
|
35
|
+
if (columns === false) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
undoRedoPlugin.done(() => new ColumnMoveAction({
|
39
|
+
columns,
|
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 manualColumnMove = hot.getPlugin('manualColumnMove');
|
51
|
+
hot.addHookOnce('afterViewRender', undoneCallback);
|
52
|
+
const columnMoves = getMoves(this.columns, this.finalColumnIndex, hot.columnIndexMapper.getNumberOfIndexes());
|
53
|
+
columnMoves.reverse().forEach(_ref2 => {
|
54
|
+
let {
|
55
|
+
from,
|
56
|
+
to
|
57
|
+
} = _ref2;
|
58
|
+
if (from < to) {
|
59
|
+
to -= 1;
|
60
|
+
}
|
61
|
+
manualColumnMove.moveColumn(to, from);
|
62
|
+
});
|
63
|
+
hot.render();
|
64
|
+
hot.deselectCell();
|
65
|
+
hot.selectColumns(this.columns[0], this.columns[0] + this.columns.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 manualColumnMove = hot.getPlugin('manualColumnMove');
|
74
|
+
hot.addHookOnce('afterViewRender', redoneCallback);
|
75
|
+
manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
|
76
|
+
hot.render();
|
77
|
+
hot.deselectCell();
|
78
|
+
hot.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
|
79
|
+
}
|
80
|
+
}
|