handsontable 0.0.0-next-d4ae6d7-20221205 → 0.0.0-next-21b8f14-20221206
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/core.js +11 -5
- package/core.mjs +11 -5
- package/dataMap/dataMap.js +33 -65
- package/dataMap/dataMap.mjs +33 -65
- package/dataMap/metaManager/metaSchema.js +54 -38
- package/dataMap/metaManager/metaSchema.mjs +54 -38
- package/dataMap/replaceData.js +1 -2
- package/dataMap/replaceData.mjs +1 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +130 -129
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +6 -6
- package/dist/handsontable.js +130 -129
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/columnSummary/columnSummary.js +5 -5
- package/plugins/columnSummary/columnSummary.mjs +5 -5
- package/plugins/columnSummary/endpoints.js +14 -2
- package/plugins/columnSummary/endpoints.mjs +14 -2
- package/plugins/formulas/formulas.js +6 -6
- package/plugins/formulas/formulas.mjs +6 -6
- package/shortcuts/manager.js +1 -1
- package/shortcuts/manager.mjs +1 -1
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 = "06/12/2022 11:15:03";
|
50
|
+
Handsontable.version = "0.0.0-next-21b8f14-20221206";
|
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 = "06/12/2022 11:15:18";
|
39
|
+
Handsontable.version = "0.0.0-next-21b8f14-20221206";
|
40
40
|
Handsontable.languages = {
|
41
41
|
dictionaryKeys: dictionaryKeys,
|
42
42
|
getLanguageDictionary: getLanguageDictionary,
|
package/core.js
CHANGED
@@ -90,7 +90,7 @@ var deprecationWarns = new Set();
|
|
90
90
|
*
|
91
91
|
* ::: only-for react
|
92
92
|
* To use these methods, associate a Handsontable instance with your instance
|
93
|
-
* of the [`HotTable` component](@/guides/getting-started/installation.md#hottable-component),
|
93
|
+
* of the [`HotTable` component](@/guides/getting-started/installation.md#use-the-hottable-component),
|
94
94
|
* by using React's `ref` feature (read more on the [Instance methods](@/guides/getting-started/react-methods.md) page).
|
95
95
|
* :::
|
96
96
|
*
|
@@ -527,6 +527,7 @@ 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);
|
530
531
|
var currentSelectedRange = selection.selectedRange.current();
|
531
532
|
var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
532
533
|
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
@@ -582,6 +583,7 @@ function Core(rootElement, userSettings) {
|
|
582
583
|
colDelta = _datamap$createCol.delta,
|
583
584
|
startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
|
584
585
|
if (colDelta) {
|
586
|
+
metaManager.createColumn(startColumnPhysicalIndex, amount);
|
585
587
|
if (Array.isArray(tableMeta.colHeaders)) {
|
586
588
|
var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
|
587
589
|
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
@@ -644,6 +646,7 @@ function Core(rootElement, userSettings) {
|
|
644
646
|
if (!wasRemoved) {
|
645
647
|
return;
|
646
648
|
}
|
649
|
+
metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
|
647
650
|
var totalRows = instance.countRows();
|
648
651
|
var fixedRowsTop = tableMeta.fixedRowsTop;
|
649
652
|
if (fixedRowsTop >= calcIndex + 1) {
|
@@ -689,6 +692,7 @@ function Core(rootElement, userSettings) {
|
|
689
692
|
if (!wasRemoved) {
|
690
693
|
return;
|
691
694
|
}
|
695
|
+
metaManager.removeColumn(physicalColumnIndex, groupAmount);
|
692
696
|
var fixedColumnsStart = tableMeta.fixedColumnsStart;
|
693
697
|
if (fixedColumnsStart >= calcIndex + 1) {
|
694
698
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
@@ -1270,7 +1274,9 @@ function Core(rootElement, userSettings) {
|
|
1270
1274
|
source: source
|
1271
1275
|
}),
|
1272
1276
|
numberOfCreatedRows = _datamap$createRow2.delta;
|
1273
|
-
if (numberOfCreatedRows
|
1277
|
+
if (numberOfCreatedRows >= 1) {
|
1278
|
+
metaManager.createRow(null, numberOfCreatedRows);
|
1279
|
+
} else {
|
1274
1280
|
skipThisChange = true;
|
1275
1281
|
break;
|
1276
1282
|
}
|
@@ -1282,7 +1288,9 @@ function Core(rootElement, userSettings) {
|
|
1282
1288
|
source: source
|
1283
1289
|
}),
|
1284
1290
|
numberOfCreatedColumns = _datamap$createCol2.delta;
|
1285
|
-
if (numberOfCreatedColumns
|
1291
|
+
if (numberOfCreatedColumns >= 1) {
|
1292
|
+
metaManager.createColumn(null, numberOfCreatedColumns);
|
1293
|
+
} else {
|
1286
1294
|
skipThisChange = true;
|
1287
1295
|
break;
|
1288
1296
|
}
|
@@ -2107,7 +2115,6 @@ function Core(rootElement, userSettings) {
|
|
2107
2115
|
dataSource: dataSource,
|
2108
2116
|
internalSource: 'updateData',
|
2109
2117
|
source: source,
|
2110
|
-
metaManager: metaManager,
|
2111
2118
|
firstRun: firstRun
|
2112
2119
|
});
|
2113
2120
|
};
|
@@ -2150,7 +2157,6 @@ function Core(rootElement, userSettings) {
|
|
2150
2157
|
dataSource: dataSource,
|
2151
2158
|
internalSource: 'loadData',
|
2152
2159
|
source: source,
|
2153
|
-
metaManager: metaManager,
|
2154
2160
|
firstRun: firstRun
|
2155
2161
|
});
|
2156
2162
|
};
|
package/core.mjs
CHANGED
@@ -85,7 +85,7 @@ var deprecationWarns = new Set();
|
|
85
85
|
*
|
86
86
|
* ::: only-for react
|
87
87
|
* To use these methods, associate a Handsontable instance with your instance
|
88
|
-
* of the [`HotTable` component](@/guides/getting-started/installation.md#hottable-component),
|
88
|
+
* of the [`HotTable` component](@/guides/getting-started/installation.md#use-the-hottable-component),
|
89
89
|
* by using React's `ref` feature (read more on the [Instance methods](@/guides/getting-started/react-methods.md) page).
|
90
90
|
* :::
|
91
91
|
*
|
@@ -522,6 +522,7 @@ 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);
|
525
526
|
var currentSelectedRange = selection.selectedRange.current();
|
526
527
|
var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
527
528
|
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
@@ -577,6 +578,7 @@ export default function Core(rootElement, userSettings) {
|
|
577
578
|
colDelta = _datamap$createCol.delta,
|
578
579
|
startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
|
579
580
|
if (colDelta) {
|
581
|
+
metaManager.createColumn(startColumnPhysicalIndex, amount);
|
580
582
|
if (Array.isArray(tableMeta.colHeaders)) {
|
581
583
|
var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
|
582
584
|
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
@@ -639,6 +641,7 @@ export default function Core(rootElement, userSettings) {
|
|
639
641
|
if (!wasRemoved) {
|
640
642
|
return;
|
641
643
|
}
|
644
|
+
metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
|
642
645
|
var totalRows = instance.countRows();
|
643
646
|
var fixedRowsTop = tableMeta.fixedRowsTop;
|
644
647
|
if (fixedRowsTop >= calcIndex + 1) {
|
@@ -684,6 +687,7 @@ export default function Core(rootElement, userSettings) {
|
|
684
687
|
if (!wasRemoved) {
|
685
688
|
return;
|
686
689
|
}
|
690
|
+
metaManager.removeColumn(physicalColumnIndex, groupAmount);
|
687
691
|
var fixedColumnsStart = tableMeta.fixedColumnsStart;
|
688
692
|
if (fixedColumnsStart >= calcIndex + 1) {
|
689
693
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
@@ -1265,7 +1269,9 @@ export default function Core(rootElement, userSettings) {
|
|
1265
1269
|
source: source
|
1266
1270
|
}),
|
1267
1271
|
numberOfCreatedRows = _datamap$createRow2.delta;
|
1268
|
-
if (numberOfCreatedRows
|
1272
|
+
if (numberOfCreatedRows >= 1) {
|
1273
|
+
metaManager.createRow(null, numberOfCreatedRows);
|
1274
|
+
} else {
|
1269
1275
|
skipThisChange = true;
|
1270
1276
|
break;
|
1271
1277
|
}
|
@@ -1277,7 +1283,9 @@ export default function Core(rootElement, userSettings) {
|
|
1277
1283
|
source: source
|
1278
1284
|
}),
|
1279
1285
|
numberOfCreatedColumns = _datamap$createCol2.delta;
|
1280
|
-
if (numberOfCreatedColumns
|
1286
|
+
if (numberOfCreatedColumns >= 1) {
|
1287
|
+
metaManager.createColumn(null, numberOfCreatedColumns);
|
1288
|
+
} else {
|
1281
1289
|
skipThisChange = true;
|
1282
1290
|
break;
|
1283
1291
|
}
|
@@ -2102,7 +2110,6 @@ export default function Core(rootElement, userSettings) {
|
|
2102
2110
|
dataSource: dataSource,
|
2103
2111
|
internalSource: 'updateData',
|
2104
2112
|
source: source,
|
2105
|
-
metaManager: metaManager,
|
2106
2113
|
firstRun: firstRun
|
2107
2114
|
});
|
2108
2115
|
};
|
@@ -2145,7 +2152,6 @@ export default function Core(rootElement, userSettings) {
|
|
2145
2152
|
dataSource: dataSource,
|
2146
2153
|
internalSource: 'loadData',
|
2147
2154
|
source: source,
|
2148
|
-
metaManager: metaManager,
|
2149
2155
|
firstRun: firstRun
|
2150
2156
|
});
|
2151
2157
|
};
|
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/web.dom-collections.for-each.js");
|
22
21
|
require("core-js/modules/es.array.concat.js");
|
22
|
+
require("core-js/modules/web.dom-collections.for-each.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 {TableMeta} tableMeta The table meta instance.
|
76
76
|
*/
|
77
|
-
function DataMap(instance, data,
|
77
|
+
function DataMap(instance, data, tableMeta) {
|
78
78
|
_classCallCheck(this, DataMap);
|
79
79
|
/**
|
80
80
|
* Instance of {@link Handsontable}.
|
@@ -84,12 +84,12 @@ var DataMap = /*#__PURE__*/function () {
|
|
84
84
|
*/
|
85
85
|
this.instance = instance;
|
86
86
|
/**
|
87
|
-
* Instance of {@link
|
87
|
+
* Instance of {@link TableMeta}.
|
88
88
|
*
|
89
89
|
* @private
|
90
|
-
* @type {
|
90
|
+
* @type {TableMeta}
|
91
91
|
*/
|
92
|
-
this.
|
92
|
+
this.tableMeta = tableMeta;
|
93
93
|
/**
|
94
94
|
* Reference to the original dataset.
|
95
95
|
*
|
@@ -127,7 +127,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
127
127
|
if (typeof schema === 'undefined') {
|
128
128
|
throw new Error('trying to create `columns` definition but you didn\'t provide `schema` nor `data`');
|
129
129
|
}
|
130
|
-
var columns = this.
|
130
|
+
var columns = this.tableMeta.columns;
|
131
131
|
var i;
|
132
132
|
this.colToPropCache = [];
|
133
133
|
this.propToColCache = new Map();
|
@@ -140,7 +140,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
140
140
|
columnsLen = schemaLen > 0 ? schemaLen : this.countFirstRowKeys();
|
141
141
|
columnsAsFunc = true;
|
142
142
|
} else {
|
143
|
-
var maxCols = this.
|
143
|
+
var maxCols = this.tableMeta.maxCols;
|
144
144
|
columnsLen = Math.min(maxCols, columns.length);
|
145
145
|
}
|
146
146
|
for (i = 0; i < columnsLen; i++) {
|
@@ -262,7 +262,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
262
262
|
}, {
|
263
263
|
key: "getSchema",
|
264
264
|
value: function getSchema() {
|
265
|
-
var schema = this.
|
265
|
+
var schema = this.tableMeta.dataSchema;
|
266
266
|
if (schema) {
|
267
267
|
if (typeof schema === 'function') {
|
268
268
|
return schema();
|
@@ -324,17 +324,15 @@ var DataMap = /*#__PURE__*/function () {
|
|
324
324
|
}
|
325
325
|
var continueProcess = this.instance.runHooks('beforeCreateRow', rowIndex, amount, source);
|
326
326
|
if (continueProcess === false || physicalRowIndex === null) {
|
327
|
-
return
|
328
|
-
delta: 0
|
329
|
-
};
|
327
|
+
return 0;
|
330
328
|
}
|
331
|
-
var maxRows = this.
|
329
|
+
var maxRows = this.tableMeta.maxRows;
|
332
330
|
var columnCount = this.getSchema().length;
|
333
331
|
var rowsToAdd = [];
|
334
332
|
var _loop = function _loop() {
|
335
333
|
var row = null;
|
336
334
|
if (_this2.instance.dataType === 'array') {
|
337
|
-
if (_this2.
|
335
|
+
if (_this2.tableMeta.dataSchema) {
|
338
336
|
// Clone template array
|
339
337
|
row = (0, _object.deepClone)(_this2.getSchema());
|
340
338
|
} else {
|
@@ -345,7 +343,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
345
343
|
});
|
346
344
|
}
|
347
345
|
} else if (_this2.instance.dataType === 'function') {
|
348
|
-
row = _this2.
|
346
|
+
row = _this2.tableMeta.dataSchema(rowIndex + numberOfCreatedRows);
|
349
347
|
} else {
|
350
348
|
row = {};
|
351
349
|
(0, _object.deepExtend)(row, _this2.getSchema());
|
@@ -368,14 +366,6 @@ var DataMap = /*#__PURE__*/function () {
|
|
368
366
|
if (this.instance.countSourceRows() === rowsToAdd.length) {
|
369
367
|
this.instance.columnIndexMapper.initToLength(this.instance.getInitialColumnCount());
|
370
368
|
}
|
371
|
-
if (numberOfCreatedRows > 0) {
|
372
|
-
if (index === void 0 || index === null) {
|
373
|
-
// Creates the meta rows at the end of the rows collection.
|
374
|
-
this.metaManager.createRow(null, numberOfCreatedRows);
|
375
|
-
} else if (source !== 'auto') {
|
376
|
-
this.metaManager.createRow(physicalRowIndex, amount);
|
377
|
-
}
|
378
|
-
}
|
379
369
|
this.instance.runHooks('afterCreateRow', newVisualRowIndex, numberOfCreatedRows, source);
|
380
370
|
this.instance.forceFullRender = true; // used when data was changed
|
381
371
|
|
@@ -409,7 +399,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
409
399
|
throw new Error('Cannot create new column. When data source in an object, ' + 'you can only have as much columns as defined in first data row, data schema or in the \'columns\' setting.' + 'If you want to be able to add new columns, you have to use array datasource.');
|
410
400
|
}
|
411
401
|
var dataSource = this.dataSource;
|
412
|
-
var maxCols = this.
|
402
|
+
var maxCols = this.tableMeta.maxCols;
|
413
403
|
var countSourceCols = this.instance.countSourceCols();
|
414
404
|
var columnIndex = index;
|
415
405
|
if (typeof columnIndex !== 'number' || columnIndex >= countSourceCols) {
|
@@ -417,9 +407,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
417
407
|
}
|
418
408
|
var continueProcess = this.instance.runHooks('beforeCreateCol', columnIndex, amount, source);
|
419
409
|
if (continueProcess === false) {
|
420
|
-
return
|
421
|
-
delta: 0
|
422
|
-
};
|
410
|
+
return 0;
|
423
411
|
}
|
424
412
|
var physicalColumnIndex = countSourceCols;
|
425
413
|
if (columnIndex < this.instance.countCols()) {
|
@@ -455,14 +443,6 @@ var DataMap = /*#__PURE__*/function () {
|
|
455
443
|
nrOfColumns += 1;
|
456
444
|
}
|
457
445
|
this.instance.columnIndexMapper.insertIndexes(columnIndex, numberOfCreatedCols);
|
458
|
-
if (numberOfCreatedCols > 0) {
|
459
|
-
if (index === void 0 || index === null) {
|
460
|
-
// Creates the meta columns at the end of the columns collection.
|
461
|
-
this.metaManager.createColumn(null, numberOfCreatedCols);
|
462
|
-
} else if (source !== 'auto') {
|
463
|
-
this.metaManager.createColumn(startPhysicalIndex, amount);
|
464
|
-
}
|
465
|
-
}
|
466
446
|
var newVisualColumnIndex = this.instance.toVisualColumn(startPhysicalIndex);
|
467
447
|
this.instance.runHooks('afterCreateCol', newVisualColumnIndex, numberOfCreatedCols, source);
|
468
448
|
this.instance.forceFullRender = true; // used when data was changed
|
@@ -487,7 +467,6 @@ var DataMap = /*#__PURE__*/function () {
|
|
487
467
|
}, {
|
488
468
|
key: "removeRow",
|
489
469
|
value: function removeRow(index) {
|
490
|
-
var _this3 = this;
|
491
470
|
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
492
471
|
var source = arguments.length > 2 ? arguments[2] : undefined;
|
493
472
|
var rowIndex = Number.isInteger(index) ? index : -amount; // -amount = taking indexes from the end.
|
@@ -508,19 +487,13 @@ var DataMap = /*#__PURE__*/function () {
|
|
508
487
|
// TODO: Function `removeRow` should validate fully, probably above.
|
509
488
|
if (rowIndex < this.instance.countRows()) {
|
510
489
|
this.instance.rowIndexMapper.removeIndexes(removedPhysicalIndexes);
|
511
|
-
var customDefinedColumns = (0, _mixed.isDefined)(this.
|
490
|
+
var customDefinedColumns = (0, _mixed.isDefined)(this.tableMeta.columns) || (0, _mixed.isDefined)(this.tableMeta.dataSchema);
|
512
491
|
|
513
492
|
// All rows have been removed. There shouldn't be any columns.
|
514
493
|
if (this.instance.rowIndexMapper.getNotTrimmedIndexesLength() === 0 && customDefinedColumns === false) {
|
515
494
|
this.instance.columnIndexMapper.setIndexesSequence([]);
|
516
495
|
}
|
517
496
|
}
|
518
|
-
var descendingPhysicalRows = removedPhysicalIndexes.slice(0).sort(function (a, b) {
|
519
|
-
return b - a;
|
520
|
-
});
|
521
|
-
descendingPhysicalRows.forEach(function (rowPhysicalIndex) {
|
522
|
-
_this3.metaManager.removeRow(rowPhysicalIndex, 1);
|
523
|
-
});
|
524
497
|
this.instance.runHooks('afterRemoveRow', rowIndex, numberOfRemovedIndexes, removedPhysicalIndexes, source);
|
525
498
|
this.instance.forceFullRender = true; // used when data was changed
|
526
499
|
|
@@ -542,56 +515,51 @@ var DataMap = /*#__PURE__*/function () {
|
|
542
515
|
value: function removeCol(index) {
|
543
516
|
var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
544
517
|
var source = arguments.length > 2 ? arguments[2] : undefined;
|
545
|
-
if (this.instance.dataType === 'object' || this.
|
518
|
+
if (this.instance.dataType === 'object' || this.tableMeta.columns) {
|
546
519
|
throw new Error('cannot remove column with object data source or columns option specified');
|
547
520
|
}
|
548
521
|
var columnIndex = typeof index !== 'number' ? -amount : index;
|
549
522
|
columnIndex = (this.instance.countCols() + columnIndex) % this.instance.countCols();
|
550
|
-
var
|
551
|
-
var
|
523
|
+
var logicColumns = this.visualColumnsToPhysical(columnIndex, amount);
|
524
|
+
var descendingLogicColumns = logicColumns.slice(0).sort(function (a, b) {
|
552
525
|
return b - a;
|
553
526
|
});
|
554
|
-
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount,
|
527
|
+
var actionWasNotCancelled = this.instance.runHooks('beforeRemoveCol', columnIndex, amount, logicColumns, source);
|
555
528
|
if (actionWasNotCancelled === false) {
|
556
529
|
return false;
|
557
530
|
}
|
558
531
|
var isTableUniform = true;
|
559
|
-
var removedColumnsCount =
|
532
|
+
var removedColumnsCount = descendingLogicColumns.length;
|
560
533
|
var data = this.dataSource;
|
561
534
|
for (var c = 0; c < removedColumnsCount; c++) {
|
562
|
-
if (isTableUniform &&
|
535
|
+
if (isTableUniform && logicColumns[0] !== logicColumns[c] - c) {
|
563
536
|
isTableUniform = false;
|
564
537
|
}
|
565
538
|
}
|
566
539
|
if (isTableUniform) {
|
567
540
|
for (var r = 0, rlen = this.instance.countSourceRows(); r < rlen; r++) {
|
568
|
-
data[r].splice(
|
569
|
-
if (r === 0) {
|
570
|
-
this.metaManager.removeColumn(removedPhysicalIndexes[0], amount);
|
571
|
-
}
|
541
|
+
data[r].splice(logicColumns[0], amount);
|
572
542
|
}
|
573
543
|
} else {
|
574
544
|
for (var _r = 0, _rlen = this.instance.countSourceRows(); _r < _rlen; _r++) {
|
575
545
|
for (var _c = 0; _c < removedColumnsCount; _c++) {
|
576
|
-
data[_r].splice(
|
577
|
-
if (_r === 0) {
|
578
|
-
this.metaManager.removeColumn(descendingPhysicalColumns[_c], 1);
|
579
|
-
}
|
546
|
+
data[_r].splice(descendingLogicColumns[_c], 1);
|
580
547
|
}
|
581
548
|
}
|
582
549
|
}
|
583
550
|
|
584
551
|
// TODO: Function `removeCol` should validate fully, probably above.
|
585
552
|
if (columnIndex < this.instance.countCols()) {
|
586
|
-
this.instance.columnIndexMapper.removeIndexes(
|
553
|
+
this.instance.columnIndexMapper.removeIndexes(logicColumns);
|
587
554
|
|
588
555
|
// All columns have been removed. There shouldn't be any rows.
|
589
556
|
if (this.instance.columnIndexMapper.getNotTrimmedIndexesLength() === 0) {
|
590
557
|
this.instance.rowIndexMapper.setIndexesSequence([]);
|
591
558
|
}
|
592
559
|
}
|
593
|
-
this.instance.runHooks('afterRemoveCol', columnIndex, amount,
|
560
|
+
this.instance.runHooks('afterRemoveCol', columnIndex, amount, logicColumns, source);
|
594
561
|
this.instance.forceFullRender = true; // used when data was changed
|
562
|
+
|
595
563
|
this.refreshDuckSchema();
|
596
564
|
return true;
|
597
565
|
}
|
@@ -663,7 +631,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
663
631
|
}, {
|
664
632
|
key: "spliceData",
|
665
633
|
value: function spliceData(index, deleteCount, elements) {
|
666
|
-
var
|
634
|
+
var _this3 = this;
|
667
635
|
var continueSplicing = this.instance.runHooks('beforeDataSplice', index, deleteCount, elements);
|
668
636
|
if (continueSplicing !== false) {
|
669
637
|
var newData = [].concat(_toConsumableArray(this.dataSource.slice(0, index)), _toConsumableArray(elements), _toConsumableArray(this.dataSource.slice(index)));
|
@@ -674,7 +642,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
674
642
|
// Pushing to array instead of using `splice`, because Babel changes the code to one that uses the `apply` method.
|
675
643
|
// The used method was cause of the problem described within #7840.
|
676
644
|
newData.forEach(function (row) {
|
677
|
-
return
|
645
|
+
return _this3.dataSource.push(row);
|
678
646
|
});
|
679
647
|
}
|
680
648
|
}
|
@@ -883,7 +851,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
883
851
|
}, {
|
884
852
|
key: "getLength",
|
885
853
|
value: function getLength() {
|
886
|
-
var maxRowsFromSettings = this.
|
854
|
+
var maxRowsFromSettings = this.tableMeta.maxRows;
|
887
855
|
var maxRows;
|
888
856
|
if (maxRowsFromSettings < 0 || maxRowsFromSettings === 0) {
|
889
857
|
maxRows = 0;
|
@@ -942,8 +910,8 @@ var DataMap = /*#__PURE__*/function () {
|
|
942
910
|
var r;
|
943
911
|
var c;
|
944
912
|
var row;
|
945
|
-
var maxRows = this.
|
946
|
-
var maxCols = this.
|
913
|
+
var maxRows = this.tableMeta.maxRows;
|
914
|
+
var maxCols = this.tableMeta.maxCols;
|
947
915
|
if (maxRows === 0 || maxCols === 0) {
|
948
916
|
return [];
|
949
917
|
}
|
@@ -1000,7 +968,7 @@ var DataMap = /*#__PURE__*/function () {
|
|
1000
968
|
key: "destroy",
|
1001
969
|
value: function destroy() {
|
1002
970
|
this.instance = null;
|
1003
|
-
this.
|
971
|
+
this.tableMeta = null;
|
1004
972
|
this.dataSource = null;
|
1005
973
|
this.duckSchema = null;
|
1006
974
|
this.colToPropCache.length = 0;
|