handsontable 0.0.0-next-cecf979-20231026 → 0.0.0-next-e54c3d6-20231026
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/3rdparty/walkontable/src/cell/coords.d.ts +2 -0
- package/3rdparty/walkontable/src/cell/coords.js +29 -0
- package/3rdparty/walkontable/src/cell/coords.mjs +29 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/index.js +26 -20
- package/core/focusCatcher/index.mjs +26 -20
- package/core.js +65 -53
- package/core.mjs +65 -53
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3602 -2219
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +88 -81
- package/dist/handsontable.js +3603 -2220
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +30 -23
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +30 -6
- package/pluginHooks.js +148 -62
- package/pluginHooks.mjs +148 -62
- package/plugins/copyPaste/clipboardData/clipboardData.js +517 -0
- package/plugins/copyPaste/clipboardData/clipboardData.mjs +512 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.js +69 -0
- package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +65 -0
- package/plugins/copyPaste/clipboardData/index.js +9 -0
- package/plugins/copyPaste/clipboardData/index.mjs +4 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.js +81 -0
- package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +77 -0
- package/plugins/copyPaste/copyPaste.js +38 -92
- package/plugins/copyPaste/copyPaste.mjs +40 -94
- package/plugins/nestedHeaders/nestedHeaders.js +21 -22
- package/plugins/nestedHeaders/nestedHeaders.mjs +21 -22
- package/selection/selection.js +12 -0
- package/selection/selection.mjs +12 -0
- package/selection/transformation.js +42 -44
- package/selection/transformation.mjs +42 -44
- package/shortcutContexts/grid.js +4 -0
- package/shortcutContexts/grid.mjs +4 -0
- package/utils/parseTable.js +527 -83
- package/utils/parseTable.mjs +523 -82
- package/plugins/copyPaste/clipboardData.js +0 -18
- package/plugins/copyPaste/clipboardData.mjs +0 -14
- package/plugins/copyPaste/pasteEvent.js +0 -14
- package/plugins/copyPaste/pasteEvent.mjs +0 -9
@@ -531,45 +531,44 @@ class NestedHeaders extends _base.BasePlugin {
|
|
531
531
|
* of the column.
|
532
532
|
*
|
533
533
|
* @private
|
534
|
-
* @param {
|
535
|
-
* @param {
|
536
|
-
*
|
537
|
-
* @param {
|
538
|
-
*
|
534
|
+
* @param {object} clipboardData Information about already performed copy action.
|
535
|
+
* @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
|
536
|
+
* @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
|
537
|
+
* @param {Function} clipboardData.insertAtRow Insert values at row index.
|
538
|
+
* @param {Function} clipboardData.insertAtColumn Insert values at column index.
|
539
|
+
* @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
|
540
|
+
* @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
|
541
|
+
* @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
|
542
|
+
* @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
|
543
|
+
* @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
|
539
544
|
*/
|
540
|
-
onBeforeCopy(
|
541
|
-
|
542
|
-
|
543
|
-
} = _ref2;
|
544
|
-
if (columnHeadersCount === 0) {
|
545
|
-
return;
|
546
|
-
}
|
547
|
-
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
|
545
|
+
onBeforeCopy(clipboardData) {
|
546
|
+
const copyableRanges = clipboardData.getRanges();
|
547
|
+
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex += 1) {
|
548
548
|
const {
|
549
549
|
startRow,
|
550
550
|
startCol,
|
551
551
|
endRow,
|
552
552
|
endCol
|
553
553
|
} = copyableRanges[rangeIndex];
|
554
|
-
const rowsCount = endRow - startRow + 1;
|
555
554
|
const columnsCount = startCol - endCol + 1;
|
556
555
|
|
557
556
|
// do not process dataset ranges and column headers where only one column is copied
|
558
557
|
if (startRow >= 0 || columnsCount === 1) {
|
559
558
|
break;
|
560
559
|
}
|
561
|
-
for (let column = startCol; column <= endCol; column
|
562
|
-
for (let row = startRow; row <= endRow; row
|
563
|
-
var _classPrivateFieldGet4;
|
564
|
-
const zeroBasedColumnHeaderLevel = rowsCount + row;
|
560
|
+
for (let column = startCol; column <= endCol; column += 1) {
|
561
|
+
for (let row = startRow; row <= endRow; row += 1) {
|
562
|
+
var _classPrivateFieldGet4, _classPrivateFieldGet5;
|
565
563
|
const zeroBasedColumnIndex = column - startCol;
|
566
564
|
if (zeroBasedColumnIndex === 0) {
|
567
565
|
continue; // eslint-disable-line no-continue
|
568
566
|
}
|
569
567
|
|
570
568
|
const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
|
571
|
-
|
572
|
-
|
569
|
+
const collapsible = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.collapsible;
|
570
|
+
if (collapsible === true && isRoot === false) {
|
571
|
+
clipboardData.setCellAt(row, zeroBasedColumnIndex, '');
|
573
572
|
}
|
574
573
|
}
|
575
574
|
}
|
@@ -872,10 +871,10 @@ class NestedHeaders extends _base.BasePlugin {
|
|
872
871
|
* @returns {string} Returns the column header value to update.
|
873
872
|
*/
|
874
873
|
onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
|
875
|
-
var
|
874
|
+
var _classPrivateFieldGet6;
|
876
875
|
const {
|
877
876
|
label
|
878
|
-
} = (
|
877
|
+
} = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
|
879
878
|
label: ''
|
880
879
|
};
|
881
880
|
return label;
|
@@ -525,45 +525,44 @@ export class NestedHeaders extends BasePlugin {
|
|
525
525
|
* of the column.
|
526
526
|
*
|
527
527
|
* @private
|
528
|
-
* @param {
|
529
|
-
* @param {
|
530
|
-
*
|
531
|
-
* @param {
|
532
|
-
*
|
528
|
+
* @param {object} clipboardData Information about already performed copy action.
|
529
|
+
* @param {Function} clipboardData.removeRow Remove row from the copied/pasted dataset.
|
530
|
+
* @param {Function} clipboardData.removeColumn Remove column from the copied/pasted dataset.
|
531
|
+
* @param {Function} clipboardData.insertAtRow Insert values at row index.
|
532
|
+
* @param {Function} clipboardData.insertAtColumn Insert values at column index.
|
533
|
+
* @param {Function} clipboardData.setCellAt Change headers or cells in the copied/pasted dataset.
|
534
|
+
* @param {Function} clipboardData.getCellAt Get headers or cells from the copied/pasted dataset.
|
535
|
+
* @param {Function} clipboardData.getData Gets copied data stored as array of arrays.
|
536
|
+
* @param {Function} clipboardData.getMetaInfo Gets grid settings for copied data.
|
537
|
+
* @param {Function} clipboardData.getRanges Returns ranges related to copied part of Handsontable.
|
533
538
|
*/
|
534
|
-
onBeforeCopy(
|
535
|
-
|
536
|
-
|
537
|
-
} = _ref2;
|
538
|
-
if (columnHeadersCount === 0) {
|
539
|
-
return;
|
540
|
-
}
|
541
|
-
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
|
539
|
+
onBeforeCopy(clipboardData) {
|
540
|
+
const copyableRanges = clipboardData.getRanges();
|
541
|
+
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex += 1) {
|
542
542
|
const {
|
543
543
|
startRow,
|
544
544
|
startCol,
|
545
545
|
endRow,
|
546
546
|
endCol
|
547
547
|
} = copyableRanges[rangeIndex];
|
548
|
-
const rowsCount = endRow - startRow + 1;
|
549
548
|
const columnsCount = startCol - endCol + 1;
|
550
549
|
|
551
550
|
// do not process dataset ranges and column headers where only one column is copied
|
552
551
|
if (startRow >= 0 || columnsCount === 1) {
|
553
552
|
break;
|
554
553
|
}
|
555
|
-
for (let column = startCol; column <= endCol; column
|
556
|
-
for (let row = startRow; row <= endRow; row
|
557
|
-
var _classPrivateFieldGet4;
|
558
|
-
const zeroBasedColumnHeaderLevel = rowsCount + row;
|
554
|
+
for (let column = startCol; column <= endCol; column += 1) {
|
555
|
+
for (let row = startRow; row <= endRow; row += 1) {
|
556
|
+
var _classPrivateFieldGet4, _classPrivateFieldGet5;
|
559
557
|
const zeroBasedColumnIndex = column - startCol;
|
560
558
|
if (zeroBasedColumnIndex === 0) {
|
561
559
|
continue; // eslint-disable-line no-continue
|
562
560
|
}
|
563
561
|
|
564
562
|
const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
|
565
|
-
|
566
|
-
|
563
|
+
const collapsible = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.collapsible;
|
564
|
+
if (collapsible === true && isRoot === false) {
|
565
|
+
clipboardData.setCellAt(row, zeroBasedColumnIndex, '');
|
567
566
|
}
|
568
567
|
}
|
569
568
|
}
|
@@ -866,10 +865,10 @@ export class NestedHeaders extends BasePlugin {
|
|
866
865
|
* @returns {string} Returns the column header value to update.
|
867
866
|
*/
|
868
867
|
onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
|
869
|
-
var
|
868
|
+
var _classPrivateFieldGet6;
|
870
869
|
const {
|
871
870
|
label
|
872
|
-
} = (
|
871
|
+
} = (_classPrivateFieldGet6 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
|
873
872
|
label: ''
|
874
873
|
};
|
875
874
|
return label;
|
package/selection/selection.js
CHANGED
@@ -172,6 +172,18 @@ class Selection {
|
|
172
172
|
}
|
173
173
|
return _this.runLocalHooks('insertColRequire', ...args);
|
174
174
|
});
|
175
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
176
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
177
|
+
args[_key7] = arguments[_key7];
|
178
|
+
}
|
179
|
+
return _this.runLocalHooks('beforeRowWrap', ...args);
|
180
|
+
});
|
181
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
182
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
183
|
+
args[_key8] = arguments[_key8];
|
184
|
+
}
|
185
|
+
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
186
|
+
});
|
175
187
|
}
|
176
188
|
|
177
189
|
/**
|
package/selection/selection.mjs
CHANGED
@@ -166,6 +166,18 @@ class Selection {
|
|
166
166
|
}
|
167
167
|
return _this.runLocalHooks('insertColRequire', ...args);
|
168
168
|
});
|
169
|
+
this.transformation.addLocalHook('beforeRowWrap', function () {
|
170
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
171
|
+
args[_key7] = arguments[_key7];
|
172
|
+
}
|
173
|
+
return _this.runLocalHooks('beforeRowWrap', ...args);
|
174
|
+
});
|
175
|
+
this.transformation.addLocalHook('beforeColumnWrap', function () {
|
176
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
177
|
+
args[_key8] = arguments[_key8];
|
178
|
+
}
|
179
|
+
return _this.runLocalHooks('beforeColumnWrap', ...args);
|
180
|
+
});
|
169
181
|
}
|
170
182
|
|
171
183
|
/**
|
@@ -50,7 +50,7 @@ class Transformation {
|
|
50
50
|
* Translates the visual coordinates to zero-based ones.
|
51
51
|
*
|
52
52
|
* @param {CellCoords} visualCoords The visual coords to process.
|
53
|
-
* @returns {
|
53
|
+
* @returns {CellCoords}
|
54
54
|
*/
|
55
55
|
_classPrivateMethodInitSpec(this, _visualToZeroBasedCoords);
|
56
56
|
/**
|
@@ -137,56 +137,60 @@ class Transformation {
|
|
137
137
|
height
|
138
138
|
} = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this);
|
139
139
|
const {
|
140
|
-
|
141
|
-
|
140
|
+
row,
|
141
|
+
col
|
142
142
|
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, visualCoords);
|
143
143
|
const fixedRowsBottom = _classPrivateFieldGet(this, _options).fixedRowsBottom();
|
144
144
|
const minSpareRows = _classPrivateFieldGet(this, _options).minSpareRows();
|
145
145
|
const minSpareCols = _classPrivateFieldGet(this, _options).minSpareCols();
|
146
146
|
const autoWrapRow = _classPrivateFieldGet(this, _options).autoWrapRow();
|
147
147
|
const autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
|
148
|
-
const
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
const zeroBasedCoords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
|
149
|
+
if (zeroBasedCoords.row >= height) {
|
150
|
+
const autoInsertingMode = createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0;
|
151
|
+
const isWrapEnabled = !autoInsertingMode && autoWrapCol;
|
152
|
+
const nextColumn = zeroBasedCoords.col + 1;
|
153
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(zeroBasedCoords.row - height, nextColumn >= width ? nextColumn - width : nextColumn);
|
154
|
+
this.runLocalHooks('beforeColumnWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
|
155
|
+
if (autoInsertingMode) {
|
154
156
|
this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
|
155
|
-
} else if (
|
156
|
-
|
157
|
-
rawCoords.row = rawCoords.row - height;
|
158
|
-
rawCoords.col = nextColumn >= width ? nextColumn - width : nextColumn;
|
157
|
+
} else if (isWrapEnabled) {
|
158
|
+
zeroBasedCoords.assign(newCoords);
|
159
159
|
}
|
160
|
-
} else if (
|
160
|
+
} else if (zeroBasedCoords.row < 0) {
|
161
|
+
const previousColumn = zeroBasedCoords.col - 1;
|
162
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(height + zeroBasedCoords.row, previousColumn < 0 ? width + previousColumn : previousColumn);
|
163
|
+
this.runLocalHooks('beforeColumnWrap', autoWrapCol, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
|
161
164
|
if (autoWrapCol) {
|
162
|
-
|
163
|
-
rawCoords.row = height + rawCoords.row;
|
164
|
-
rawCoords.col = previousColumn < 0 ? width + previousColumn : previousColumn;
|
165
|
+
zeroBasedCoords.assign(newCoords);
|
165
166
|
}
|
166
167
|
}
|
167
|
-
if (
|
168
|
-
|
168
|
+
if (zeroBasedCoords.col >= width) {
|
169
|
+
const autoInsertingMode = createMissingRecords && minSpareCols > 0;
|
170
|
+
const isWrapEnabled = !autoInsertingMode && autoWrapRow;
|
171
|
+
const nextRow = zeroBasedCoords.row + 1;
|
172
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(nextRow >= height ? nextRow - height : nextRow, zeroBasedCoords.col - width);
|
173
|
+
this.runLocalHooks('beforeRowWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
|
174
|
+
if (autoInsertingMode) {
|
169
175
|
this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
|
170
|
-
} else if (
|
171
|
-
|
172
|
-
rawCoords.row = nextRow >= height ? nextRow - height : nextRow;
|
173
|
-
rawCoords.col = rawCoords.col - width;
|
176
|
+
} else if (isWrapEnabled) {
|
177
|
+
zeroBasedCoords.assign(newCoords);
|
174
178
|
}
|
175
|
-
} else if (
|
179
|
+
} else if (zeroBasedCoords.col < 0) {
|
180
|
+
const previousRow = zeroBasedCoords.row - 1;
|
181
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(previousRow < 0 ? height + previousRow : previousRow, width + zeroBasedCoords.col);
|
182
|
+
this.runLocalHooks('beforeRowWrap', autoWrapRow, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
|
176
183
|
if (autoWrapRow) {
|
177
|
-
|
178
|
-
rawCoords.row = previousRow < 0 ? height + previousRow : previousRow;
|
179
|
-
rawCoords.col = width + rawCoords.col;
|
184
|
+
zeroBasedCoords.assign(newCoords);
|
180
185
|
}
|
181
186
|
}
|
182
|
-
const coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
183
187
|
const {
|
184
188
|
rowDir,
|
185
189
|
colDir
|
186
|
-
} = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this,
|
190
|
+
} = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, zeroBasedCoords);
|
187
191
|
rowTransformDir = rowDir;
|
188
192
|
colTransformDir = colDir;
|
189
|
-
visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this,
|
193
|
+
visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, zeroBasedCoords);
|
190
194
|
}
|
191
195
|
this.runLocalHooks('afterTransformStart', visualCoords, rowTransformDir, colTransformDir);
|
192
196
|
return visualCoords;
|
@@ -213,14 +217,10 @@ class Transformation {
|
|
213
217
|
this.runLocalHooks('beforeTransformEnd', delta);
|
214
218
|
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
|
215
219
|
const {
|
216
|
-
|
217
|
-
|
220
|
+
row,
|
221
|
+
col
|
218
222
|
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to);
|
219
|
-
const
|
220
|
-
row: y + delta.row,
|
221
|
-
col: x + delta.col
|
222
|
-
};
|
223
|
-
const coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
223
|
+
const coords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
|
224
224
|
const {
|
225
225
|
rowDir,
|
226
226
|
colDir
|
@@ -288,15 +288,13 @@ function _visualToZeroBasedCoords2(visualCoords) {
|
|
288
288
|
row,
|
289
289
|
col
|
290
290
|
} = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
291
|
-
return
|
292
|
-
x: _classPrivateFieldGet(this, _offset).x + col,
|
293
|
-
y: _classPrivateFieldGet(this, _offset).y + row
|
294
|
-
};
|
291
|
+
return _classPrivateFieldGet(this, _options).createCellCoords(_classPrivateFieldGet(this, _offset).y + row, _classPrivateFieldGet(this, _offset).x + col);
|
295
292
|
}
|
296
293
|
function _zeroBasedToVisualCoords2(zeroBasedCoords) {
|
297
|
-
|
298
|
-
|
299
|
-
|
294
|
+
const coords = zeroBasedCoords.clone();
|
295
|
+
coords.col = zeroBasedCoords.col - _classPrivateFieldGet(this, _offset).x;
|
296
|
+
coords.row = zeroBasedCoords.row - _classPrivateFieldGet(this, _offset).y;
|
297
|
+
return _classPrivateFieldGet(this, _options).renderableToVisualCoords(coords);
|
300
298
|
}
|
301
299
|
(0, _object.mixin)(Transformation, _localHooks.default);
|
302
300
|
var _default = Transformation;
|
@@ -46,7 +46,7 @@ class Transformation {
|
|
46
46
|
* Translates the visual coordinates to zero-based ones.
|
47
47
|
*
|
48
48
|
* @param {CellCoords} visualCoords The visual coords to process.
|
49
|
-
* @returns {
|
49
|
+
* @returns {CellCoords}
|
50
50
|
*/
|
51
51
|
_classPrivateMethodInitSpec(this, _visualToZeroBasedCoords);
|
52
52
|
/**
|
@@ -133,56 +133,60 @@ class Transformation {
|
|
133
133
|
height
|
134
134
|
} = _classPrivateMethodGet(this, _getTableSize, _getTableSize2).call(this);
|
135
135
|
const {
|
136
|
-
|
137
|
-
|
136
|
+
row,
|
137
|
+
col
|
138
138
|
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, visualCoords);
|
139
139
|
const fixedRowsBottom = _classPrivateFieldGet(this, _options).fixedRowsBottom();
|
140
140
|
const minSpareRows = _classPrivateFieldGet(this, _options).minSpareRows();
|
141
141
|
const minSpareCols = _classPrivateFieldGet(this, _options).minSpareCols();
|
142
142
|
const autoWrapRow = _classPrivateFieldGet(this, _options).autoWrapRow();
|
143
143
|
const autoWrapCol = _classPrivateFieldGet(this, _options).autoWrapCol();
|
144
|
-
const
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
144
|
+
const zeroBasedCoords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
|
145
|
+
if (zeroBasedCoords.row >= height) {
|
146
|
+
const autoInsertingMode = createMissingRecords && minSpareRows > 0 && fixedRowsBottom === 0;
|
147
|
+
const isWrapEnabled = !autoInsertingMode && autoWrapCol;
|
148
|
+
const nextColumn = zeroBasedCoords.col + 1;
|
149
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(zeroBasedCoords.row - height, nextColumn >= width ? nextColumn - width : nextColumn);
|
150
|
+
this.runLocalHooks('beforeColumnWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextColumn >= width);
|
151
|
+
if (autoInsertingMode) {
|
150
152
|
this.runLocalHooks('insertRowRequire', _classPrivateFieldGet(this, _options).countRenderableRows());
|
151
|
-
} else if (
|
152
|
-
|
153
|
-
rawCoords.row = rawCoords.row - height;
|
154
|
-
rawCoords.col = nextColumn >= width ? nextColumn - width : nextColumn;
|
153
|
+
} else if (isWrapEnabled) {
|
154
|
+
zeroBasedCoords.assign(newCoords);
|
155
155
|
}
|
156
|
-
} else if (
|
156
|
+
} else if (zeroBasedCoords.row < 0) {
|
157
|
+
const previousColumn = zeroBasedCoords.col - 1;
|
158
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(height + zeroBasedCoords.row, previousColumn < 0 ? width + previousColumn : previousColumn);
|
159
|
+
this.runLocalHooks('beforeColumnWrap', autoWrapCol, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousColumn < 0);
|
157
160
|
if (autoWrapCol) {
|
158
|
-
|
159
|
-
rawCoords.row = height + rawCoords.row;
|
160
|
-
rawCoords.col = previousColumn < 0 ? width + previousColumn : previousColumn;
|
161
|
+
zeroBasedCoords.assign(newCoords);
|
161
162
|
}
|
162
163
|
}
|
163
|
-
if (
|
164
|
-
|
164
|
+
if (zeroBasedCoords.col >= width) {
|
165
|
+
const autoInsertingMode = createMissingRecords && minSpareCols > 0;
|
166
|
+
const isWrapEnabled = !autoInsertingMode && autoWrapRow;
|
167
|
+
const nextRow = zeroBasedCoords.row + 1;
|
168
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(nextRow >= height ? nextRow - height : nextRow, zeroBasedCoords.col - width);
|
169
|
+
this.runLocalHooks('beforeRowWrap', isWrapEnabled, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), nextRow >= height);
|
170
|
+
if (autoInsertingMode) {
|
165
171
|
this.runLocalHooks('insertColRequire', _classPrivateFieldGet(this, _options).countRenderableColumns());
|
166
|
-
} else if (
|
167
|
-
|
168
|
-
rawCoords.row = nextRow >= height ? nextRow - height : nextRow;
|
169
|
-
rawCoords.col = rawCoords.col - width;
|
172
|
+
} else if (isWrapEnabled) {
|
173
|
+
zeroBasedCoords.assign(newCoords);
|
170
174
|
}
|
171
|
-
} else if (
|
175
|
+
} else if (zeroBasedCoords.col < 0) {
|
176
|
+
const previousRow = zeroBasedCoords.row - 1;
|
177
|
+
const newCoords = _classPrivateFieldGet(this, _options).createCellCoords(previousRow < 0 ? height + previousRow : previousRow, width + zeroBasedCoords.col);
|
178
|
+
this.runLocalHooks('beforeRowWrap', autoWrapRow, _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, newCoords), previousRow < 0);
|
172
179
|
if (autoWrapRow) {
|
173
|
-
|
174
|
-
rawCoords.row = previousRow < 0 ? height + previousRow : previousRow;
|
175
|
-
rawCoords.col = width + rawCoords.col;
|
180
|
+
zeroBasedCoords.assign(newCoords);
|
176
181
|
}
|
177
182
|
}
|
178
|
-
const coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
179
183
|
const {
|
180
184
|
rowDir,
|
181
185
|
colDir
|
182
|
-
} = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this,
|
186
|
+
} = _classPrivateMethodGet(this, _clampCoords, _clampCoords2).call(this, zeroBasedCoords);
|
183
187
|
rowTransformDir = rowDir;
|
184
188
|
colTransformDir = colDir;
|
185
|
-
visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this,
|
189
|
+
visualCoords = _classPrivateMethodGet(this, _zeroBasedToVisualCoords, _zeroBasedToVisualCoords2).call(this, zeroBasedCoords);
|
186
190
|
}
|
187
191
|
this.runLocalHooks('afterTransformStart', visualCoords, rowTransformDir, colTransformDir);
|
188
192
|
return visualCoords;
|
@@ -209,14 +213,10 @@ class Transformation {
|
|
209
213
|
this.runLocalHooks('beforeTransformEnd', delta);
|
210
214
|
if (highlightRenderableCoords.row !== null && highlightRenderableCoords.col !== null) {
|
211
215
|
const {
|
212
|
-
|
213
|
-
|
216
|
+
row,
|
217
|
+
col
|
214
218
|
} = _classPrivateMethodGet(this, _visualToZeroBasedCoords, _visualToZeroBasedCoords2).call(this, cellRange.to);
|
215
|
-
const
|
216
|
-
row: y + delta.row,
|
217
|
-
col: x + delta.col
|
218
|
-
};
|
219
|
-
const coords = _classPrivateFieldGet(this, _options).createCellCoords(rawCoords.row, rawCoords.col);
|
219
|
+
const coords = _classPrivateFieldGet(this, _options).createCellCoords(row + delta.row, col + delta.col);
|
220
220
|
const {
|
221
221
|
rowDir,
|
222
222
|
colDir
|
@@ -284,15 +284,13 @@ function _visualToZeroBasedCoords2(visualCoords) {
|
|
284
284
|
row,
|
285
285
|
col
|
286
286
|
} = _classPrivateFieldGet(this, _options).visualToRenderableCoords(visualCoords);
|
287
|
-
return
|
288
|
-
x: _classPrivateFieldGet(this, _offset).x + col,
|
289
|
-
y: _classPrivateFieldGet(this, _offset).y + row
|
290
|
-
};
|
287
|
+
return _classPrivateFieldGet(this, _options).createCellCoords(_classPrivateFieldGet(this, _offset).y + row, _classPrivateFieldGet(this, _offset).x + col);
|
291
288
|
}
|
292
289
|
function _zeroBasedToVisualCoords2(zeroBasedCoords) {
|
293
|
-
|
294
|
-
|
295
|
-
|
290
|
+
const coords = zeroBasedCoords.clone();
|
291
|
+
coords.col = zeroBasedCoords.col - _classPrivateFieldGet(this, _offset).x;
|
292
|
+
coords.row = zeroBasedCoords.row - _classPrivateFieldGet(this, _offset).y;
|
293
|
+
return _classPrivateFieldGet(this, _options).renderableToVisualCoords(coords);
|
296
294
|
}
|
297
295
|
mixin(Transformation, localHooks);
|
298
296
|
export default Transformation;
|
package/shortcutContexts/grid.js
CHANGED
@@ -152,9 +152,13 @@ function shortcutsGridContext(hot) {
|
|
152
152
|
callback: () => commandsPool.extendCellsSelectionDownByViewportHeight()
|
153
153
|
}, {
|
154
154
|
keys: [['Tab']],
|
155
|
+
// The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
|
156
|
+
preventDefault: false,
|
155
157
|
callback: () => commandsPool.moveCellSelectionInlineStart()
|
156
158
|
}, {
|
157
159
|
keys: [['Shift', 'Tab']],
|
160
|
+
// The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
|
161
|
+
preventDefault: false,
|
158
162
|
callback: () => commandsPool.moveCellSelectionInlineEnd()
|
159
163
|
}, {
|
160
164
|
keys: [['Control/Meta', 'Backspace']],
|
@@ -148,9 +148,13 @@ export function shortcutsGridContext(hot) {
|
|
148
148
|
callback: () => commandsPool.extendCellsSelectionDownByViewportHeight()
|
149
149
|
}, {
|
150
150
|
keys: [['Tab']],
|
151
|
+
// The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
|
152
|
+
preventDefault: false,
|
151
153
|
callback: () => commandsPool.moveCellSelectionInlineStart()
|
152
154
|
}, {
|
153
155
|
keys: [['Shift', 'Tab']],
|
156
|
+
// The property value is controlled by focusCatcher module (https://github.com/handsontable/handsontable/blob/master/handsontable/src/core/focusCatcher/index.js)
|
157
|
+
preventDefault: false,
|
154
158
|
callback: () => commandsPool.moveCellSelectionInlineEnd()
|
155
159
|
}, {
|
156
160
|
keys: [['Control/Meta', 'Backspace']],
|