handsontable 0.0.0-next-95bb75e-20240131 → 0.0.0-next-c40f8b4-20240131
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.
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 +305 -367
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +7 -7
- package/dist/handsontable.js +305 -367
- 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/formulas/indexSyncer/axisSyncer.js +74 -2
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +74 -2
- package/plugins/undoRedo/undoRedo.js +14 -61
- package/plugins/undoRedo/undoRedo.mjs +14 -61
- package/tableView.js +10 -5
- package/tableView.mjs +11 -6
- package/helpers/moves.js +0 -86
- package/helpers/moves.mjs +0 -82
package/helpers/moves.mjs
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.array.push.js";
|
2
|
-
/**
|
3
|
-
* Gets first position where to move element (respecting the fact that some element will be sooner or later
|
4
|
-
* taken out of the dataset in order to move them).
|
5
|
-
*
|
6
|
-
* @param {Array<number>} movedIndexes Sequence of moved indexes for certain axis.
|
7
|
-
* @param {number} finalIndex Final place where to move rows.
|
8
|
-
* @param {number} numberOfIndexes Number of indexes in a dataset.
|
9
|
-
* @returns {number} Index informing where to move the first element.
|
10
|
-
*/
|
11
|
-
function getMoveLine(movedIndexes, finalIndex, numberOfIndexes) {
|
12
|
-
const notMovedElements = Array.from(Array(numberOfIndexes).keys()).filter(index => movedIndexes.includes(index) === false);
|
13
|
-
if (finalIndex === 0) {
|
14
|
-
var _notMovedElements$fin;
|
15
|
-
return (_notMovedElements$fin = notMovedElements[finalIndex]) !== null && _notMovedElements$fin !== void 0 ? _notMovedElements$fin : 0; // Moving before the first dataset's element.
|
16
|
-
}
|
17
|
-
return notMovedElements[finalIndex - 1] + 1; // Moving before another element.
|
18
|
-
}
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Gets initially calculated move positions.
|
22
|
-
*
|
23
|
-
* @param {Array<number>} movedIndexes Sequence of moved indexes for certain axis.
|
24
|
-
* @param {number} moveLine Final place where to move rows.
|
25
|
-
* @returns {Array<{from: number, to: number}>} Initially calculated move positions.
|
26
|
-
*/
|
27
|
-
function getInitiallyCalculatedMoves(movedIndexes, moveLine) {
|
28
|
-
const moves = [];
|
29
|
-
movedIndexes.forEach(movedIndex => {
|
30
|
-
const move = {
|
31
|
-
from: movedIndex,
|
32
|
-
to: moveLine
|
33
|
-
};
|
34
|
-
moves.forEach(previouslyMovedIndex => {
|
35
|
-
const isMovingFromEndToStart = previouslyMovedIndex.from > previouslyMovedIndex.to;
|
36
|
-
const isMovingElementBefore = previouslyMovedIndex.to <= move.from;
|
37
|
-
const isMovingAfterElement = previouslyMovedIndex.from > move.from;
|
38
|
-
if (isMovingAfterElement && isMovingElementBefore && isMovingFromEndToStart) {
|
39
|
-
move.from += 1;
|
40
|
-
}
|
41
|
-
});
|
42
|
-
|
43
|
-
// Moved element from right to left (or bottom to top).
|
44
|
-
if (move.from >= moveLine) {
|
45
|
-
moveLine += 1;
|
46
|
-
}
|
47
|
-
moves.push(move);
|
48
|
-
});
|
49
|
-
return moves;
|
50
|
-
}
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Gets finally calculated move positions (after adjusting).
|
54
|
-
*
|
55
|
-
* @param {Array<{from: number, to: number}>} moves Initially calculated move positions.
|
56
|
-
* @returns {Array<{from: number, to: number}>} Finally calculated move positions (after adjusting).
|
57
|
-
*/
|
58
|
-
function adjustedCalculatedMoves(moves) {
|
59
|
-
moves.forEach((move, index) => {
|
60
|
-
const nextMoved = moves.slice(index + 1);
|
61
|
-
nextMoved.forEach(nextMovedIndex => {
|
62
|
-
const isMovingFromStartToEnd = nextMovedIndex.from < nextMovedIndex.to;
|
63
|
-
if (nextMovedIndex.from > move.from && isMovingFromStartToEnd) {
|
64
|
-
nextMovedIndex.from -= 1;
|
65
|
-
}
|
66
|
-
});
|
67
|
-
});
|
68
|
-
return moves;
|
69
|
-
}
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Get list of move positions.
|
73
|
-
*
|
74
|
-
* @param {Array<number>} movedIndexes Sequence of moved indexes for certain axis.
|
75
|
-
* @param {number} finalIndex Final place where to move rows.
|
76
|
-
* @param {number} numberOfIndexes Number of indexes in a dataset.
|
77
|
-
* @returns {Array<{from: number, to: number}>}
|
78
|
-
*/
|
79
|
-
export function getMoves(movedIndexes, finalIndex, numberOfIndexes) {
|
80
|
-
const moves = getInitiallyCalculatedMoves(movedIndexes, getMoveLine(movedIndexes, finalIndex, numberOfIndexes));
|
81
|
-
return adjustedCalculatedMoves(moves);
|
82
|
-
}
|