handsontable 0.0.0-next-c3a3b3c-20221206 → 0.0.0-next-b266dab-20221207
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/overlays.js +8 -2
- package/3rdparty/walkontable/src/overlays.mjs +8 -2
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +4 -10
- package/core.mjs +4 -10
- package/dataMap/dataMap.js +60 -19
- package/dataMap/dataMap.mjs +60 -19
- package/dataMap/replaceData.js +2 -1
- package/dataMap/replaceData.mjs +2 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +382 -376
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +29 -29
- package/dist/handsontable.js +355 -349
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/editorManager.js +7 -4
- package/editorManager.mjs +7 -4
- package/helpers/feature.js +9 -36
- package/helpers/feature.mjs +3 -30
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -2
- package/plugins/columnSummary/endpoints.js +2 -14
- package/plugins/columnSummary/endpoints.mjs +2 -14
@@ -9,6 +9,7 @@ require("core-js/modules/es.object.to-string.js");
|
|
9
9
|
require("core-js/modules/web.dom-collections.for-each.js");
|
10
10
|
require("core-js/modules/web.timers.js");
|
11
11
|
var _element = require("../../../helpers/dom/element");
|
12
|
+
var _feature = require("../../../helpers/feature");
|
12
13
|
var _array = require("../../../helpers/array");
|
13
14
|
var _unicode = require("../../../helpers/unicode");
|
14
15
|
var _browser = require("../../../helpers/browser");
|
@@ -107,8 +108,13 @@ var Overlays = /*#__PURE__*/function () {
|
|
107
108
|
_defineProperty(this, "bottomInlineStartCornerOverlay", null);
|
108
109
|
_defineProperty(this, "browserLineHeight", undefined);
|
109
110
|
_defineProperty(this, "wtSettings", null);
|
110
|
-
_defineProperty(this, "resizeObserver", new ResizeObserver(function () {
|
111
|
-
|
111
|
+
_defineProperty(this, "resizeObserver", new ResizeObserver(function (entries) {
|
112
|
+
(0, _feature.requestAnimationFrame)(function () {
|
113
|
+
if (!Array.isArray(entries) || !entries.length) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
_this.wtSettings.getSetting('onContainerElementResize');
|
117
|
+
});
|
112
118
|
}));
|
113
119
|
this.wot = wotInstance;
|
114
120
|
this.wtSettings = wtSettings;
|
@@ -12,6 +12,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
13
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
14
14
|
import { getScrollableElement, getScrollbarWidth } from "../../../helpers/dom/element.mjs";
|
15
|
+
import { requestAnimationFrame } from "../../../helpers/feature.mjs";
|
15
16
|
import { arrayEach } from "../../../helpers/array.mjs";
|
16
17
|
import { isKey } from "../../../helpers/unicode.mjs";
|
17
18
|
import { isChrome } from "../../../helpers/browser.mjs";
|
@@ -103,8 +104,13 @@ var Overlays = /*#__PURE__*/function () {
|
|
103
104
|
_defineProperty(this, "bottomInlineStartCornerOverlay", null);
|
104
105
|
_defineProperty(this, "browserLineHeight", undefined);
|
105
106
|
_defineProperty(this, "wtSettings", null);
|
106
|
-
_defineProperty(this, "resizeObserver", new ResizeObserver(function () {
|
107
|
-
|
107
|
+
_defineProperty(this, "resizeObserver", new ResizeObserver(function (entries) {
|
108
|
+
requestAnimationFrame(function () {
|
109
|
+
if (!Array.isArray(entries) || !entries.length) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
_this.wtSettings.getSetting('onContainerElementResize');
|
113
|
+
});
|
108
114
|
}));
|
109
115
|
this.wot = wotInstance;
|
110
116
|
this.wtSettings = wtSettings;
|
package/base.js
CHANGED
@@ -46,8 +46,8 @@ Handsontable.hooks = _pluginHooks.default.getSingleton();
|
|
46
46
|
Handsontable.CellCoords = _src.CellCoords;
|
47
47
|
Handsontable.CellRange = _src.CellRange;
|
48
48
|
Handsontable.packageName = 'handsontable';
|
49
|
-
Handsontable.buildDate = "
|
50
|
-
Handsontable.version = "0.0.0-next-
|
49
|
+
Handsontable.buildDate = "07/12/2022 08:50:44";
|
50
|
+
Handsontable.version = "0.0.0-next-b266dab-20221207";
|
51
51
|
Handsontable.languages = {
|
52
52
|
dictionaryKeys: _registry.dictionaryKeys,
|
53
53
|
getLanguageDictionary: _registry.getLanguageDictionary,
|
package/base.mjs
CHANGED
@@ -35,8 +35,8 @@ Handsontable.hooks = Hooks.getSingleton();
|
|
35
35
|
Handsontable.CellCoords = CellCoords;
|
36
36
|
Handsontable.CellRange = CellRange;
|
37
37
|
Handsontable.packageName = 'handsontable';
|
38
|
-
Handsontable.buildDate = "
|
39
|
-
Handsontable.version = "0.0.0-next-
|
38
|
+
Handsontable.buildDate = "07/12/2022 08:50:59";
|
39
|
+
Handsontable.version = "0.0.0-next-b266dab-20221207";
|
40
40
|
Handsontable.languages = {
|
41
41
|
dictionaryKeys: dictionaryKeys,
|
42
42
|
getLanguageDictionary: getLanguageDictionary,
|
package/core.js
CHANGED
@@ -527,7 +527,6 @@ function Core(rootElement, userSettings) {
|
|
527
527
|
rowDelta = _datamap$createRow.delta,
|
528
528
|
startRowPhysicalIndex = _datamap$createRow.startPhysicalIndex;
|
529
529
|
if (rowDelta) {
|
530
|
-
metaManager.createRow(startRowPhysicalIndex, amount);
|
531
530
|
var currentSelectedRange = selection.selectedRange.current();
|
532
531
|
var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
533
532
|
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
@@ -583,7 +582,6 @@ function Core(rootElement, userSettings) {
|
|
583
582
|
colDelta = _datamap$createCol.delta,
|
584
583
|
startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
|
585
584
|
if (colDelta) {
|
586
|
-
metaManager.createColumn(startColumnPhysicalIndex, amount);
|
587
585
|
if (Array.isArray(tableMeta.colHeaders)) {
|
588
586
|
var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
|
589
587
|
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
@@ -646,7 +644,6 @@ function Core(rootElement, userSettings) {
|
|
646
644
|
if (!wasRemoved) {
|
647
645
|
return;
|
648
646
|
}
|
649
|
-
metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
|
650
647
|
var totalRows = instance.countRows();
|
651
648
|
var fixedRowsTop = tableMeta.fixedRowsTop;
|
652
649
|
if (fixedRowsTop >= calcIndex + 1) {
|
@@ -692,7 +689,6 @@ function Core(rootElement, userSettings) {
|
|
692
689
|
if (!wasRemoved) {
|
693
690
|
return;
|
694
691
|
}
|
695
|
-
metaManager.removeColumn(physicalColumnIndex, groupAmount);
|
696
692
|
var fixedColumnsStart = tableMeta.fixedColumnsStart;
|
697
693
|
if (fixedColumnsStart >= calcIndex + 1) {
|
698
694
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
@@ -1274,9 +1270,7 @@ function Core(rootElement, userSettings) {
|
|
1274
1270
|
source: source
|
1275
1271
|
}),
|
1276
1272
|
numberOfCreatedRows = _datamap$createRow2.delta;
|
1277
|
-
if (numberOfCreatedRows
|
1278
|
-
metaManager.createRow(null, numberOfCreatedRows);
|
1279
|
-
} else {
|
1273
|
+
if (numberOfCreatedRows === 0) {
|
1280
1274
|
skipThisChange = true;
|
1281
1275
|
break;
|
1282
1276
|
}
|
@@ -1288,9 +1282,7 @@ function Core(rootElement, userSettings) {
|
|
1288
1282
|
source: source
|
1289
1283
|
}),
|
1290
1284
|
numberOfCreatedColumns = _datamap$createCol2.delta;
|
1291
|
-
if (numberOfCreatedColumns
|
1292
|
-
metaManager.createColumn(null, numberOfCreatedColumns);
|
1293
|
-
} else {
|
1285
|
+
if (numberOfCreatedColumns === 0) {
|
1294
1286
|
skipThisChange = true;
|
1295
1287
|
break;
|
1296
1288
|
}
|
@@ -2115,6 +2107,7 @@ function Core(rootElement, userSettings) {
|
|
2115
2107
|
dataSource: dataSource,
|
2116
2108
|
internalSource: 'updateData',
|
2117
2109
|
source: source,
|
2110
|
+
metaManager: metaManager,
|
2118
2111
|
firstRun: firstRun
|
2119
2112
|
});
|
2120
2113
|
};
|
@@ -2157,6 +2150,7 @@ function Core(rootElement, userSettings) {
|
|
2157
2150
|
dataSource: dataSource,
|
2158
2151
|
internalSource: 'loadData',
|
2159
2152
|
source: source,
|
2153
|
+
metaManager: metaManager,
|
2160
2154
|
firstRun: firstRun
|
2161
2155
|
});
|
2162
2156
|
};
|
package/core.mjs
CHANGED
@@ -522,7 +522,6 @@ export default function Core(rootElement, userSettings) {
|
|
522
522
|
rowDelta = _datamap$createRow.delta,
|
523
523
|
startRowPhysicalIndex = _datamap$createRow.startPhysicalIndex;
|
524
524
|
if (rowDelta) {
|
525
|
-
metaManager.createRow(startRowPhysicalIndex, amount);
|
526
525
|
var currentSelectedRange = selection.selectedRange.current();
|
527
526
|
var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
528
527
|
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
@@ -578,7 +577,6 @@ export default function Core(rootElement, userSettings) {
|
|
578
577
|
colDelta = _datamap$createCol.delta,
|
579
578
|
startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
|
580
579
|
if (colDelta) {
|
581
|
-
metaManager.createColumn(startColumnPhysicalIndex, amount);
|
582
580
|
if (Array.isArray(tableMeta.colHeaders)) {
|
583
581
|
var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
|
584
582
|
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
@@ -641,7 +639,6 @@ export default function Core(rootElement, userSettings) {
|
|
641
639
|
if (!wasRemoved) {
|
642
640
|
return;
|
643
641
|
}
|
644
|
-
metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
|
645
642
|
var totalRows = instance.countRows();
|
646
643
|
var fixedRowsTop = tableMeta.fixedRowsTop;
|
647
644
|
if (fixedRowsTop >= calcIndex + 1) {
|
@@ -687,7 +684,6 @@ export default function Core(rootElement, userSettings) {
|
|
687
684
|
if (!wasRemoved) {
|
688
685
|
return;
|
689
686
|
}
|
690
|
-
metaManager.removeColumn(physicalColumnIndex, groupAmount);
|
691
687
|
var fixedColumnsStart = tableMeta.fixedColumnsStart;
|
692
688
|
if (fixedColumnsStart >= calcIndex + 1) {
|
693
689
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
@@ -1269,9 +1265,7 @@ export default function Core(rootElement, userSettings) {
|
|
1269
1265
|
source: source
|
1270
1266
|
}),
|
1271
1267
|
numberOfCreatedRows = _datamap$createRow2.delta;
|
1272
|
-
if (numberOfCreatedRows
|
1273
|
-
metaManager.createRow(null, numberOfCreatedRows);
|
1274
|
-
} else {
|
1268
|
+
if (numberOfCreatedRows === 0) {
|
1275
1269
|
skipThisChange = true;
|
1276
1270
|
break;
|
1277
1271
|
}
|
@@ -1283,9 +1277,7 @@ export default function Core(rootElement, userSettings) {
|
|
1283
1277
|
source: source
|
1284
1278
|
}),
|
1285
1279
|
numberOfCreatedColumns = _datamap$createCol2.delta;
|
1286
|
-
if (numberOfCreatedColumns
|
1287
|
-
metaManager.createColumn(null, numberOfCreatedColumns);
|
1288
|
-
} else {
|
1280
|
+
if (numberOfCreatedColumns === 0) {
|
1289
1281
|
skipThisChange = true;
|
1290
1282
|
break;
|
1291
1283
|
}
|
@@ -2110,6 +2102,7 @@ export default function Core(rootElement, userSettings) {
|
|
2110
2102
|
dataSource: dataSource,
|
2111
2103
|
internalSource: 'updateData',
|
2112
2104
|
source: source,
|
2105
|
+
metaManager: metaManager,
|
2113
2106
|
firstRun: firstRun
|
2114
2107
|
});
|
2115
2108
|
};
|
@@ -2152,6 +2145,7 @@ export default function Core(rootElement, userSettings) {
|
|
2152
2145
|
dataSource: dataSource,
|
2153
2146
|
internalSource: 'loadData',
|
2154
2147
|
source: source,
|
2148
|
+
metaManager: metaManager,
|
2155
2149
|
firstRun: firstRun
|
2156
2150
|
});
|
2157
2151
|
};
|
package/dataMap/dataMap.js
CHANGED
@@ -18,8 +18,8 @@ require("core-js/modules/es.number.constructor.js");
|
|
18
18
|
require("core-js/modules/es.array.splice.js");
|
19
19
|
require("core-js/modules/es.array.sort.js");
|
20
20
|
require("core-js/modules/es.array.slice.js");
|
21
|
-
require("core-js/modules/es.array.concat.js");
|
22
21
|
require("core-js/modules/web.dom-collections.for-each.js");
|
22
|
+
require("core-js/modules/es.array.concat.js");
|
23
23
|
require("core-js/modules/es.array.filter.js");
|
24
24
|
require("core-js/modules/es.array.index-of.js");
|
25
25
|
var _SheetClip = require("../3rdparty/SheetClip");
|
@@ -72,9 +72,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
72
72
|
/**
|
73
73
|
* @param {object} instance Instance of Handsontable.
|
74
74
|
* @param {Array} data Array of arrays or array of objects containing data.
|
75
|
-
* @param {
|
75
|
+
* @param {MetaManager} metaManager The meta manager instance.
|
76
76
|
*/
|
77
|
-
function DataMap(instance, data,
|
77
|
+
function DataMap(instance, data, metaManager) {
|
78
78
|
_classCallCheck(this, DataMap);
|
79
79
|
/**
|
80
80
|
* Instance of {@link Handsontable}.
|
@@ -83,13 +83,20 @@ var DataMap = /*#__PURE__*/function () {
|
|
83
83
|
* @type {Handsontable}
|
84
84
|
*/
|
85
85
|
this.instance = instance;
|
86
|
+
/**
|
87
|
+
* Instance of {@link MetaManager}.
|
88
|
+
*
|
89
|
+
* @private
|
90
|
+
* @type {MetaManager}
|
91
|
+
*/
|
92
|
+
this.metaManager = metaManager;
|
86
93
|
/**
|
87
94
|
* Instance of {@link TableMeta}.
|
88
95
|
*
|
89
96
|
* @private
|
90
97
|
* @type {TableMeta}
|
91
98
|
*/
|
92
|
-
this.tableMeta =
|
99
|
+
this.tableMeta = metaManager.getTableMeta();
|
93
100
|
/**
|
94
101
|
* Reference to the original dataset.
|
95
102
|
*
|
@@ -324,7 +331,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
324
331
|
}
|
325
332
|
var continueProcess = this.instance.runHooks('beforeCreateRow', rowIndex, amount, source);
|
326
333
|
if (continueProcess === false || physicalRowIndex === null) {
|
327
|
-
return
|
334
|
+
return {
|
335
|
+
delta: 0
|
336
|
+
};
|
328
337
|
}
|
329
338
|
var maxRows = this.tableMeta.maxRows;
|
330
339
|
var columnCount = this.getSchema().length;
|
@@ -366,6 +375,15 @@ var DataMap = /*#__PURE__*/function () {
|
|
366
375
|
if (this.instance.countSourceRows() === rowsToAdd.length) {
|
367
376
|
this.instance.columnIndexMapper.initToLength(this.instance.getInitialColumnCount());
|
368
377
|
}
|
378
|
+
if (numberOfCreatedRows > 0) {
|
379
|
+
if (index === void 0 || index === null) {
|
380
|
+
// Creates the meta rows at the end of the rows collection without shifting the cells
|
381
|
+
// that were defined out of the range of the dataset.
|
382
|
+
this.metaManager.createRow(null, numberOfCreatedRows);
|
383
|
+
} else if (source !== 'auto') {
|
384
|
+
this.metaManager.createRow(physicalRowIndex, amount);
|
385
|
+
}
|
386
|
+
}
|
369
387
|
this.instance.runHooks('afterCreateRow', newVisualRowIndex, numberOfCreatedRows, source);
|
370
388
|
this.instance.forceFullRender = true; // used when data was changed
|
371
389
|
|
@@ -407,7 +425,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
407
425
|
}
|
408
426
|
var continueProcess = this.instance.runHooks('beforeCreateCol', columnIndex, amount, source);
|
409
427
|
if (continueProcess === false) {
|
410
|
-
return
|
428
|
+
return {
|
429
|
+
delta: 0
|
430
|
+
};
|
411
431
|
}
|
412
432
|
var physicalColumnIndex = countSourceCols;
|
413
433
|
if (columnIndex < this.instance.countCols()) {
|
@@ -443,6 +463,15 @@ var DataMap = /*#__PURE__*/function () {
|
|
443
463
|
nrOfColumns += 1;
|
444
464
|
}
|
445
465
|
this.instance.columnIndexMapper.insertIndexes(columnIndex, numberOfCreatedCols);
|
466
|
+
if (numberOfCreatedCols > 0) {
|
467
|
+
if (index === void 0 || index === null) {
|
468
|
+
// Creates the meta columns at the end of the columns collection without shifting the cells
|
469
|
+
// that were defined out of the range of the dataset.
|
470
|
+
this.metaManager.createColumn(null, numberOfCreatedCols);
|
471
|
+
} else if (source !== 'auto') {
|
472
|
+
this.metaManager.createColumn(startPhysicalIndex, amount);
|
473
|
+
}
|
474
|
+
}
|
446
475
|
var newVisualColumnIndex = this.instance.toVisualColumn(startPhysicalIndex);
|
447
476
|
this.instance.runHooks('afterCreateCol', newVisualColumnIndex, numberOfCreatedCols, source);
|
448
477
|
this.instance.forceFullRender = true; // used when data was changed
|
@@ -467,6 +496,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
467
496
|
}, {
|
468
497
|
key: "removeRow",
|
469
498
|
value: function removeRow(index) {
|
499
|
+
var _this3 = this;
|
470
500
|
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
471
501
|
var source = arguments.length > 2 ? arguments[2] : undefined;
|
472
502
|
var rowIndex = Number.isInteger(index) ? index : -amount; // -amount = taking indexes from the end.
|
@@ -494,6 +524,12 @@ var DataMap = /*#__PURE__*/function () {
|
|
494
524
|
this.instance.columnIndexMapper.setIndexesSequence([]);
|
495
525
|
}
|
496
526
|
}
|
527
|
+
var descendingPhysicalRows = removedPhysicalIndexes.slice(0).sort(function (a, b) {
|
528
|
+
return b - a;
|
529
|
+
});
|
530
|
+
descendingPhysicalRows.forEach(function (rowPhysicalIndex) {
|
531
|
+
_this3.metaManager.removeRow(rowPhysicalIndex, 1);
|
532
|
+
});
|
497
533
|
this.instance.runHooks('afterRemoveRow', rowIndex, numberOfRemovedIndexes, removedPhysicalIndexes, source);
|
498
534
|
this.instance.forceFullRender = true; // used when data was changed
|
499
535
|
|
@@ -520,46 +556,51 @@ var DataMap = /*#__PURE__*/function () {
|
|
520
556
|
}
|
521
557
|
var columnIndex = typeof index !== 'number' ? -amount : index;
|
522
558
|
columnIndex = (this.instance.countCols() + columnIndex) % this.instance.countCols();
|
523
|
-
var
|
524
|
-
var
|
559
|
+
var removedPhysicalIndexes = this.visualColumnsToPhysical(columnIndex, amount);
|
560
|
+
var descendingPhysicalColumns = removedPhysicalIndexes.slice(0).sort(function (a, b) {
|
525
561
|
return b - a;
|
526
562
|
});
|
527
|
-
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount,
|
563
|
+
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
528
564
|
if (actionWasNotCancelled === false) {
|
529
565
|
return false;
|
530
566
|
}
|
531
567
|
var isTableUniform = true;
|
532
|
-
var removedColumnsCount =
|
568
|
+
var removedColumnsCount = descendingPhysicalColumns.length;
|
533
569
|
var data = this.dataSource;
|
534
570
|
for (var c = 0; c < removedColumnsCount; c++) {
|
535
|
-
if (isTableUniform &&
|
571
|
+
if (isTableUniform && removedPhysicalIndexes[0] !== removedPhysicalIndexes[c] - c) {
|
536
572
|
isTableUniform = false;
|
537
573
|
}
|
538
574
|
}
|
539
575
|
if (isTableUniform) {
|
540
576
|
for (var r = 0, rlen = this.instance.countSourceRows(); r < rlen; r++) {
|
541
|
-
data[r].splice(
|
577
|
+
data[r].splice(removedPhysicalIndexes[0], amount);
|
578
|
+
if (r === 0) {
|
579
|
+
this.metaManager.removeColumn(removedPhysicalIndexes[0], amount);
|
580
|
+
}
|
542
581
|
}
|
543
582
|
} else {
|
544
583
|
for (var _r = 0, _rlen = this.instance.countSourceRows(); _r < _rlen; _r++) {
|
545
584
|
for (var _c = 0; _c < removedColumnsCount; _c++) {
|
546
|
-
data[_r].splice(
|
585
|
+
data[_r].splice(descendingPhysicalColumns[_c], 1);
|
586
|
+
if (_r === 0) {
|
587
|
+
this.metaManager.removeColumn(descendingPhysicalColumns[_c], 1);
|
588
|
+
}
|
547
589
|
}
|
548
590
|
}
|
549
591
|
}
|
550
592
|
|
551
593
|
// TODO: Function `removeCol` should validate fully, probably above.
|
552
594
|
if (columnIndex < this.instance.countCols()) {
|
553
|
-
this.instance.columnIndexMapper.removeIndexes(
|
595
|
+
this.instance.columnIndexMapper.removeIndexes(removedPhysicalIndexes);
|
554
596
|
|
555
597
|
// All columns have been removed. There shouldn't be any rows.
|
556
598
|
if (this.instance.columnIndexMapper.getNotTrimmedIndexesLength() === 0) {
|
557
599
|
this.instance.rowIndexMapper.setIndexesSequence([]);
|
558
600
|
}
|
559
601
|
}
|
560
|
-
this.instance.runHooks('afterRemoveCol', columnIndex, amount,
|
602
|
+
this.instance.runHooks('afterRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
561
603
|
this.instance.forceFullRender = true; // used when data was changed
|
562
|
-
|
563
604
|
this.refreshDuckSchema();
|
564
605
|
return true;
|
565
606
|
}
|
@@ -631,7 +672,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
631
672
|
}, {
|
632
673
|
key: "spliceData",
|
633
674
|
value: function spliceData(index, deleteCount, elements) {
|
634
|
-
var
|
675
|
+
var _this4 = this;
|
635
676
|
var continueSplicing = this.instance.runHooks('beforeDataSplice', index, deleteCount, elements);
|
636
677
|
if (continueSplicing !== false) {
|
637
678
|
var newData = [].concat(_toConsumableArray(this.dataSource.slice(0, index)), _toConsumableArray(elements), _toConsumableArray(this.dataSource.slice(index)));
|
@@ -642,7 +683,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
642
683
|
// Pushing to array instead of using `splice`, because Babel changes the code to one that uses the `apply` method.
|
643
684
|
// The used method was cause of the problem described within #7840.
|
644
685
|
newData.forEach(function (row) {
|
645
|
-
return
|
686
|
+
return _this4.dataSource.push(row);
|
646
687
|
});
|
647
688
|
}
|
648
689
|
}
|
@@ -968,7 +1009,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
968
1009
|
key: "destroy",
|
969
1010
|
value: function destroy() {
|
970
1011
|
this.instance = null;
|
971
|
-
this.
|
1012
|
+
this.metaManager = null;
|
972
1013
|
this.dataSource = null;
|
973
1014
|
this.duckSchema = null;
|
974
1015
|
this.colToPropCache.length = 0;
|
package/dataMap/dataMap.mjs
CHANGED
@@ -15,8 +15,8 @@ import "core-js/modules/es.number.constructor.js";
|
|
15
15
|
import "core-js/modules/es.array.splice.js";
|
16
16
|
import "core-js/modules/es.array.sort.js";
|
17
17
|
import "core-js/modules/es.array.slice.js";
|
18
|
-
import "core-js/modules/es.array.concat.js";
|
19
18
|
import "core-js/modules/web.dom-collections.for-each.js";
|
19
|
+
import "core-js/modules/es.array.concat.js";
|
20
20
|
import "core-js/modules/es.array.filter.js";
|
21
21
|
import "core-js/modules/es.array.index-of.js";
|
22
22
|
import "core-js/modules/es.symbol.js";
|
@@ -68,9 +68,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
68
68
|
/**
|
69
69
|
* @param {object} instance Instance of Handsontable.
|
70
70
|
* @param {Array} data Array of arrays or array of objects containing data.
|
71
|
-
* @param {
|
71
|
+
* @param {MetaManager} metaManager The meta manager instance.
|
72
72
|
*/
|
73
|
-
function DataMap(instance, data,
|
73
|
+
function DataMap(instance, data, metaManager) {
|
74
74
|
_classCallCheck(this, DataMap);
|
75
75
|
/**
|
76
76
|
* Instance of {@link Handsontable}.
|
@@ -79,13 +79,20 @@ var DataMap = /*#__PURE__*/function () {
|
|
79
79
|
* @type {Handsontable}
|
80
80
|
*/
|
81
81
|
this.instance = instance;
|
82
|
+
/**
|
83
|
+
* Instance of {@link MetaManager}.
|
84
|
+
*
|
85
|
+
* @private
|
86
|
+
* @type {MetaManager}
|
87
|
+
*/
|
88
|
+
this.metaManager = metaManager;
|
82
89
|
/**
|
83
90
|
* Instance of {@link TableMeta}.
|
84
91
|
*
|
85
92
|
* @private
|
86
93
|
* @type {TableMeta}
|
87
94
|
*/
|
88
|
-
this.tableMeta =
|
95
|
+
this.tableMeta = metaManager.getTableMeta();
|
89
96
|
/**
|
90
97
|
* Reference to the original dataset.
|
91
98
|
*
|
@@ -320,7 +327,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
320
327
|
}
|
321
328
|
var continueProcess = this.instance.runHooks('beforeCreateRow', rowIndex, amount, source);
|
322
329
|
if (continueProcess === false || physicalRowIndex === null) {
|
323
|
-
return
|
330
|
+
return {
|
331
|
+
delta: 0
|
332
|
+
};
|
324
333
|
}
|
325
334
|
var maxRows = this.tableMeta.maxRows;
|
326
335
|
var columnCount = this.getSchema().length;
|
@@ -362,6 +371,15 @@ var DataMap = /*#__PURE__*/function () {
|
|
362
371
|
if (this.instance.countSourceRows() === rowsToAdd.length) {
|
363
372
|
this.instance.columnIndexMapper.initToLength(this.instance.getInitialColumnCount());
|
364
373
|
}
|
374
|
+
if (numberOfCreatedRows > 0) {
|
375
|
+
if (index === void 0 || index === null) {
|
376
|
+
// Creates the meta rows at the end of the rows collection without shifting the cells
|
377
|
+
// that were defined out of the range of the dataset.
|
378
|
+
this.metaManager.createRow(null, numberOfCreatedRows);
|
379
|
+
} else if (source !== 'auto') {
|
380
|
+
this.metaManager.createRow(physicalRowIndex, amount);
|
381
|
+
}
|
382
|
+
}
|
365
383
|
this.instance.runHooks('afterCreateRow', newVisualRowIndex, numberOfCreatedRows, source);
|
366
384
|
this.instance.forceFullRender = true; // used when data was changed
|
367
385
|
|
@@ -403,7 +421,9 @@ var DataMap = /*#__PURE__*/function () {
|
|
403
421
|
}
|
404
422
|
var continueProcess = this.instance.runHooks('beforeCreateCol', columnIndex, amount, source);
|
405
423
|
if (continueProcess === false) {
|
406
|
-
return
|
424
|
+
return {
|
425
|
+
delta: 0
|
426
|
+
};
|
407
427
|
}
|
408
428
|
var physicalColumnIndex = countSourceCols;
|
409
429
|
if (columnIndex < this.instance.countCols()) {
|
@@ -439,6 +459,15 @@ var DataMap = /*#__PURE__*/function () {
|
|
439
459
|
nrOfColumns += 1;
|
440
460
|
}
|
441
461
|
this.instance.columnIndexMapper.insertIndexes(columnIndex, numberOfCreatedCols);
|
462
|
+
if (numberOfCreatedCols > 0) {
|
463
|
+
if (index === void 0 || index === null) {
|
464
|
+
// Creates the meta columns at the end of the columns collection without shifting the cells
|
465
|
+
// that were defined out of the range of the dataset.
|
466
|
+
this.metaManager.createColumn(null, numberOfCreatedCols);
|
467
|
+
} else if (source !== 'auto') {
|
468
|
+
this.metaManager.createColumn(startPhysicalIndex, amount);
|
469
|
+
}
|
470
|
+
}
|
442
471
|
var newVisualColumnIndex = this.instance.toVisualColumn(startPhysicalIndex);
|
443
472
|
this.instance.runHooks('afterCreateCol', newVisualColumnIndex, numberOfCreatedCols, source);
|
444
473
|
this.instance.forceFullRender = true; // used when data was changed
|
@@ -463,6 +492,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
463
492
|
}, {
|
464
493
|
key: "removeRow",
|
465
494
|
value: function removeRow(index) {
|
495
|
+
var _this3 = this;
|
466
496
|
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
467
497
|
var source = arguments.length > 2 ? arguments[2] : undefined;
|
468
498
|
var rowIndex = Number.isInteger(index) ? index : -amount; // -amount = taking indexes from the end.
|
@@ -490,6 +520,12 @@ var DataMap = /*#__PURE__*/function () {
|
|
490
520
|
this.instance.columnIndexMapper.setIndexesSequence([]);
|
491
521
|
}
|
492
522
|
}
|
523
|
+
var descendingPhysicalRows = removedPhysicalIndexes.slice(0).sort(function (a, b) {
|
524
|
+
return b - a;
|
525
|
+
});
|
526
|
+
descendingPhysicalRows.forEach(function (rowPhysicalIndex) {
|
527
|
+
_this3.metaManager.removeRow(rowPhysicalIndex, 1);
|
528
|
+
});
|
493
529
|
this.instance.runHooks('afterRemoveRow', rowIndex, numberOfRemovedIndexes, removedPhysicalIndexes, source);
|
494
530
|
this.instance.forceFullRender = true; // used when data was changed
|
495
531
|
|
@@ -516,46 +552,51 @@ var DataMap = /*#__PURE__*/function () {
|
|
516
552
|
}
|
517
553
|
var columnIndex = typeof index !== 'number' ? -amount : index;
|
518
554
|
columnIndex = (this.instance.countCols() + columnIndex) % this.instance.countCols();
|
519
|
-
var
|
520
|
-
var
|
555
|
+
var removedPhysicalIndexes = this.visualColumnsToPhysical(columnIndex, amount);
|
556
|
+
var descendingPhysicalColumns = removedPhysicalIndexes.slice(0).sort(function (a, b) {
|
521
557
|
return b - a;
|
522
558
|
});
|
523
|
-
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount,
|
559
|
+
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
524
560
|
if (actionWasNotCancelled === false) {
|
525
561
|
return false;
|
526
562
|
}
|
527
563
|
var isTableUniform = true;
|
528
|
-
var removedColumnsCount =
|
564
|
+
var removedColumnsCount = descendingPhysicalColumns.length;
|
529
565
|
var data = this.dataSource;
|
530
566
|
for (var c = 0; c < removedColumnsCount; c++) {
|
531
|
-
if (isTableUniform &&
|
567
|
+
if (isTableUniform && removedPhysicalIndexes[0] !== removedPhysicalIndexes[c] - c) {
|
532
568
|
isTableUniform = false;
|
533
569
|
}
|
534
570
|
}
|
535
571
|
if (isTableUniform) {
|
536
572
|
for (var r = 0, rlen = this.instance.countSourceRows(); r < rlen; r++) {
|
537
|
-
data[r].splice(
|
573
|
+
data[r].splice(removedPhysicalIndexes[0], amount);
|
574
|
+
if (r === 0) {
|
575
|
+
this.metaManager.removeColumn(removedPhysicalIndexes[0], amount);
|
576
|
+
}
|
538
577
|
}
|
539
578
|
} else {
|
540
579
|
for (var _r = 0, _rlen = this.instance.countSourceRows(); _r < _rlen; _r++) {
|
541
580
|
for (var _c = 0; _c < removedColumnsCount; _c++) {
|
542
|
-
data[_r].splice(
|
581
|
+
data[_r].splice(descendingPhysicalColumns[_c], 1);
|
582
|
+
if (_r === 0) {
|
583
|
+
this.metaManager.removeColumn(descendingPhysicalColumns[_c], 1);
|
584
|
+
}
|
543
585
|
}
|
544
586
|
}
|
545
587
|
}
|
546
588
|
|
547
589
|
// TODO: Function `removeCol` should validate fully, probably above.
|
548
590
|
if (columnIndex < this.instance.countCols()) {
|
549
|
-
this.instance.columnIndexMapper.removeIndexes(
|
591
|
+
this.instance.columnIndexMapper.removeIndexes(removedPhysicalIndexes);
|
550
592
|
|
551
593
|
// All columns have been removed. There shouldn't be any rows.
|
552
594
|
if (this.instance.columnIndexMapper.getNotTrimmedIndexesLength() === 0) {
|
553
595
|
this.instance.rowIndexMapper.setIndexesSequence([]);
|
554
596
|
}
|
555
597
|
}
|
556
|
-
this.instance.runHooks('afterRemoveCol', columnIndex, amount,
|
598
|
+
this.instance.runHooks('afterRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
557
599
|
this.instance.forceFullRender = true; // used when data was changed
|
558
|
-
|
559
600
|
this.refreshDuckSchema();
|
560
601
|
return true;
|
561
602
|
}
|
@@ -627,7 +668,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
627
668
|
}, {
|
628
669
|
key: "spliceData",
|
629
670
|
value: function spliceData(index, deleteCount, elements) {
|
630
|
-
var
|
671
|
+
var _this4 = this;
|
631
672
|
var continueSplicing = this.instance.runHooks('beforeDataSplice', index, deleteCount, elements);
|
632
673
|
if (continueSplicing !== false) {
|
633
674
|
var newData = [].concat(_toConsumableArray(this.dataSource.slice(0, index)), _toConsumableArray(elements), _toConsumableArray(this.dataSource.slice(index)));
|
@@ -638,7 +679,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
638
679
|
// Pushing to array instead of using `splice`, because Babel changes the code to one that uses the `apply` method.
|
639
680
|
// The used method was cause of the problem described within #7840.
|
640
681
|
newData.forEach(function (row) {
|
641
|
-
return
|
682
|
+
return _this4.dataSource.push(row);
|
642
683
|
});
|
643
684
|
}
|
644
685
|
}
|
@@ -964,7 +1005,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
964
1005
|
key: "destroy",
|
965
1006
|
value: function destroy() {
|
966
1007
|
this.instance = null;
|
967
|
-
this.
|
1008
|
+
this.metaManager = null;
|
968
1009
|
this.dataSource = null;
|
969
1010
|
this.duckSchema = null;
|
970
1011
|
this.colToPropCache.length = 0;
|
package/dataMap/replaceData.js
CHANGED
@@ -44,6 +44,7 @@ function replaceData(data, setDataMapFunction, callbackFunction, config) {
|
|
44
44
|
dataSource = config.dataSource,
|
45
45
|
internalSource = config.internalSource,
|
46
46
|
source = config.source,
|
47
|
+
metaManager = config.metaManager,
|
47
48
|
firstRun = config.firstRun;
|
48
49
|
var capitalizedInternalSource = (0, _string.toUpperCaseFirst)(internalSource);
|
49
50
|
var tableMeta = hotInstance.getSettings();
|
@@ -58,7 +59,7 @@ function replaceData(data, setDataMapFunction, callbackFunction, config) {
|
|
58
59
|
dataMap.destroy();
|
59
60
|
}
|
60
61
|
data = hotInstance.runHooks("before".concat(capitalizedInternalSource), data, firstRun, source);
|
61
|
-
var newDataMap = new _dataMap.default(hotInstance, data,
|
62
|
+
var newDataMap = new _dataMap.default(hotInstance, data, metaManager);
|
62
63
|
|
63
64
|
// We need to apply the new dataMap immediately, because of some asynchronous logic in the
|
64
65
|
// `autoRowSize`/`autoColumnSize` plugins.
|
package/dataMap/replaceData.mjs
CHANGED
@@ -39,6 +39,7 @@ function replaceData(data, setDataMapFunction, callbackFunction, config) {
|
|
39
39
|
dataSource = config.dataSource,
|
40
40
|
internalSource = config.internalSource,
|
41
41
|
source = config.source,
|
42
|
+
metaManager = config.metaManager,
|
42
43
|
firstRun = config.firstRun;
|
43
44
|
var capitalizedInternalSource = toUpperCaseFirst(internalSource);
|
44
45
|
var tableMeta = hotInstance.getSettings();
|
@@ -53,7 +54,7 @@ function replaceData(data, setDataMapFunction, callbackFunction, config) {
|
|
53
54
|
dataMap.destroy();
|
54
55
|
}
|
55
56
|
data = hotInstance.runHooks("before".concat(capitalizedInternalSource), data, firstRun, source);
|
56
|
-
var newDataMap = new DataMap(hotInstance, data,
|
57
|
+
var newDataMap = new DataMap(hotInstance, data, metaManager);
|
57
58
|
|
58
59
|
// We need to apply the new dataMap immediately, because of some asynchronous logic in the
|
59
60
|
// `autoRowSize`/`autoColumnSize` plugins.
|
package/dist/handsontable.css
CHANGED
@@ -25,8 +25,8 @@
|
|
25
25
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
26
26
|
* USE OR INABILITY TO USE THIS SOFTWARE.
|
27
27
|
*
|
28
|
-
* Version: 0.0.0-next-
|
29
|
-
* Release date: 25/10/2022 (built at
|
28
|
+
* Version: 0.0.0-next-b266dab-20221207
|
29
|
+
* Release date: 25/10/2022 (built at 07/12/2022 08:51:11)
|
30
30
|
*/
|
31
31
|
/**
|
32
32
|
* Fix for bootstrap styles
|