handsontable 0.0.0-next-549d023-20240119 → 0.0.0-next-f3514b0-20240124
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +56 -10
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +4 -4
- package/dist/handsontable.js +56 -10
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +25 -25
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/undoRedo/undoRedo.js +51 -5
- package/plugins/undoRedo/undoRedo.mjs +51 -5
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-f3514b0-20240124";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-f3514b0-20240124";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-f3514b0-20240124",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -132,6 +132,12 @@ function UndoRedo(instance) {
|
|
132
132
|
}
|
133
133
|
plugin.done(() => new UndoRedo.RowMoveAction(rows, finalIndex));
|
134
134
|
});
|
135
|
+
instance.addHook('beforeColumnMove', (columns, finalIndex) => {
|
136
|
+
if (columns === false) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
plugin.done(() => new UndoRedo.ColumnMoveAction(columns, finalIndex));
|
140
|
+
});
|
135
141
|
instance.addHook('beforeMergeCells', (cellRange, auto) => {
|
136
142
|
if (auto) {
|
137
143
|
return;
|
@@ -714,15 +720,15 @@ UndoRedo.UnmergeCellsAction = UnmergeCellsAction;
|
|
714
720
|
*/
|
715
721
|
UndoRedo.RowMoveAction = function (rows, finalIndex) {
|
716
722
|
this.rows = rows.slice();
|
717
|
-
this.
|
723
|
+
this.finalRowIndex = finalIndex;
|
718
724
|
this.actionType = 'row_move';
|
719
725
|
};
|
720
726
|
(0, _object.inherit)(UndoRedo.RowMoveAction, UndoRedo.Action);
|
721
727
|
UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
|
722
728
|
const manualRowMove = instance.getPlugin('manualRowMove');
|
723
729
|
const copyOfRows = [].concat(this.rows);
|
724
|
-
const rowsMovedUp = copyOfRows.filter(a => a > this.
|
725
|
-
const rowsMovedDown = copyOfRows.filter(a => a <= this.
|
730
|
+
const rowsMovedUp = copyOfRows.filter(a => a > this.finalRowIndex);
|
731
|
+
const rowsMovedDown = copyOfRows.filter(a => a <= this.finalRowIndex);
|
726
732
|
const allMovedRows = rowsMovedUp.sort((a, b) => b - a).concat(rowsMovedDown.sort((a, b) => a - b));
|
727
733
|
instance.addHookOnce('afterViewRender', undoneCallback);
|
728
734
|
|
@@ -739,10 +745,50 @@ UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
|
|
739
745
|
UndoRedo.RowMoveAction.prototype.redo = function (instance, redoneCallback) {
|
740
746
|
const manualRowMove = instance.getPlugin('manualRowMove');
|
741
747
|
instance.addHookOnce('afterViewRender', redoneCallback);
|
742
|
-
manualRowMove.moveRows(this.rows.slice(), this.
|
748
|
+
manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
|
749
|
+
instance.render();
|
750
|
+
instance.deselectCell();
|
751
|
+
instance.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
|
752
|
+
};
|
753
|
+
|
754
|
+
/**
|
755
|
+
* ManualColumnMove action.
|
756
|
+
*
|
757
|
+
* @private
|
758
|
+
* @param {number[]} columns An array with moved columns.
|
759
|
+
* @param {number} finalIndex The destination index.
|
760
|
+
*/
|
761
|
+
UndoRedo.ColumnMoveAction = function (columns, finalIndex) {
|
762
|
+
this.columns = columns.slice();
|
763
|
+
this.finalColumnIndex = finalIndex;
|
764
|
+
this.actionType = 'col_move';
|
765
|
+
};
|
766
|
+
(0, _object.inherit)(UndoRedo.ColumnMoveAction, UndoRedo.Action);
|
767
|
+
UndoRedo.ColumnMoveAction.prototype.undo = function (instance, undoneCallback) {
|
768
|
+
const manualColumnMove = instance.getPlugin('manualColumnMove');
|
769
|
+
const copyOfColumns = [].concat(this.columns);
|
770
|
+
const columnsMovedLeft = copyOfColumns.filter(a => a > this.finalColumnIndex);
|
771
|
+
const rowsMovedRight = copyOfColumns.filter(a => a <= this.finalColumnIndex);
|
772
|
+
const allMovedColumns = columnsMovedLeft.sort((a, b) => b - a).concat(rowsMovedRight.sort((a, b) => a - b));
|
773
|
+
instance.addHookOnce('afterViewRender', undoneCallback);
|
774
|
+
|
775
|
+
// Moving columns from those with higher indexes to those with lower indexes when action was performed from right to left
|
776
|
+
// Moving columns from those with lower indexes to those with higher indexes when action was performed from left to right
|
777
|
+
for (let i = 0; i < allMovedColumns.length; i += 1) {
|
778
|
+
const newPhysicalColumn = instance.toVisualColumn(allMovedColumns[i]);
|
779
|
+
manualColumnMove.moveColumn(newPhysicalColumn, allMovedColumns[i]);
|
780
|
+
}
|
781
|
+
instance.render();
|
782
|
+
instance.deselectCell();
|
783
|
+
instance.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);
|
784
|
+
};
|
785
|
+
UndoRedo.ColumnMoveAction.prototype.redo = function (instance, redoneCallback) {
|
786
|
+
const manualColumnMove = instance.getPlugin('manualColumnMove');
|
787
|
+
instance.addHookOnce('afterViewRender', redoneCallback);
|
788
|
+
manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
|
743
789
|
instance.render();
|
744
790
|
instance.deselectCell();
|
745
|
-
instance.
|
791
|
+
instance.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
|
746
792
|
};
|
747
793
|
|
748
794
|
/**
|
@@ -128,6 +128,12 @@ function UndoRedo(instance) {
|
|
128
128
|
}
|
129
129
|
plugin.done(() => new UndoRedo.RowMoveAction(rows, finalIndex));
|
130
130
|
});
|
131
|
+
instance.addHook('beforeColumnMove', (columns, finalIndex) => {
|
132
|
+
if (columns === false) {
|
133
|
+
return;
|
134
|
+
}
|
135
|
+
plugin.done(() => new UndoRedo.ColumnMoveAction(columns, finalIndex));
|
136
|
+
});
|
131
137
|
instance.addHook('beforeMergeCells', (cellRange, auto) => {
|
132
138
|
if (auto) {
|
133
139
|
return;
|
@@ -710,15 +716,15 @@ UndoRedo.UnmergeCellsAction = UnmergeCellsAction;
|
|
710
716
|
*/
|
711
717
|
UndoRedo.RowMoveAction = function (rows, finalIndex) {
|
712
718
|
this.rows = rows.slice();
|
713
|
-
this.
|
719
|
+
this.finalRowIndex = finalIndex;
|
714
720
|
this.actionType = 'row_move';
|
715
721
|
};
|
716
722
|
inherit(UndoRedo.RowMoveAction, UndoRedo.Action);
|
717
723
|
UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
|
718
724
|
const manualRowMove = instance.getPlugin('manualRowMove');
|
719
725
|
const copyOfRows = [].concat(this.rows);
|
720
|
-
const rowsMovedUp = copyOfRows.filter(a => a > this.
|
721
|
-
const rowsMovedDown = copyOfRows.filter(a => a <= this.
|
726
|
+
const rowsMovedUp = copyOfRows.filter(a => a > this.finalRowIndex);
|
727
|
+
const rowsMovedDown = copyOfRows.filter(a => a <= this.finalRowIndex);
|
722
728
|
const allMovedRows = rowsMovedUp.sort((a, b) => b - a).concat(rowsMovedDown.sort((a, b) => a - b));
|
723
729
|
instance.addHookOnce('afterViewRender', undoneCallback);
|
724
730
|
|
@@ -735,10 +741,50 @@ UndoRedo.RowMoveAction.prototype.undo = function (instance, undoneCallback) {
|
|
735
741
|
UndoRedo.RowMoveAction.prototype.redo = function (instance, redoneCallback) {
|
736
742
|
const manualRowMove = instance.getPlugin('manualRowMove');
|
737
743
|
instance.addHookOnce('afterViewRender', redoneCallback);
|
738
|
-
manualRowMove.moveRows(this.rows.slice(), this.
|
744
|
+
manualRowMove.moveRows(this.rows.slice(), this.finalRowIndex);
|
745
|
+
instance.render();
|
746
|
+
instance.deselectCell();
|
747
|
+
instance.selectRows(this.finalRowIndex, this.finalRowIndex + this.rows.length - 1);
|
748
|
+
};
|
749
|
+
|
750
|
+
/**
|
751
|
+
* ManualColumnMove action.
|
752
|
+
*
|
753
|
+
* @private
|
754
|
+
* @param {number[]} columns An array with moved columns.
|
755
|
+
* @param {number} finalIndex The destination index.
|
756
|
+
*/
|
757
|
+
UndoRedo.ColumnMoveAction = function (columns, finalIndex) {
|
758
|
+
this.columns = columns.slice();
|
759
|
+
this.finalColumnIndex = finalIndex;
|
760
|
+
this.actionType = 'col_move';
|
761
|
+
};
|
762
|
+
inherit(UndoRedo.ColumnMoveAction, UndoRedo.Action);
|
763
|
+
UndoRedo.ColumnMoveAction.prototype.undo = function (instance, undoneCallback) {
|
764
|
+
const manualColumnMove = instance.getPlugin('manualColumnMove');
|
765
|
+
const copyOfColumns = [].concat(this.columns);
|
766
|
+
const columnsMovedLeft = copyOfColumns.filter(a => a > this.finalColumnIndex);
|
767
|
+
const rowsMovedRight = copyOfColumns.filter(a => a <= this.finalColumnIndex);
|
768
|
+
const allMovedColumns = columnsMovedLeft.sort((a, b) => b - a).concat(rowsMovedRight.sort((a, b) => a - b));
|
769
|
+
instance.addHookOnce('afterViewRender', undoneCallback);
|
770
|
+
|
771
|
+
// Moving columns from those with higher indexes to those with lower indexes when action was performed from right to left
|
772
|
+
// Moving columns from those with lower indexes to those with higher indexes when action was performed from left to right
|
773
|
+
for (let i = 0; i < allMovedColumns.length; i += 1) {
|
774
|
+
const newPhysicalColumn = instance.toVisualColumn(allMovedColumns[i]);
|
775
|
+
manualColumnMove.moveColumn(newPhysicalColumn, allMovedColumns[i]);
|
776
|
+
}
|
777
|
+
instance.render();
|
778
|
+
instance.deselectCell();
|
779
|
+
instance.selectColumns(this.columns[0], this.columns[0] + this.columns.length - 1);
|
780
|
+
};
|
781
|
+
UndoRedo.ColumnMoveAction.prototype.redo = function (instance, redoneCallback) {
|
782
|
+
const manualColumnMove = instance.getPlugin('manualColumnMove');
|
783
|
+
instance.addHookOnce('afterViewRender', redoneCallback);
|
784
|
+
manualColumnMove.moveColumns(this.columns.slice(), this.finalColumnIndex);
|
739
785
|
instance.render();
|
740
786
|
instance.deselectCell();
|
741
|
-
instance.
|
787
|
+
instance.selectColumns(this.finalColumnIndex, this.finalColumnIndex + this.columns.length - 1);
|
742
788
|
};
|
743
789
|
|
744
790
|
/**
|