tabulator-tables 5.0.6 → 5.0.7
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.
- package/bower.json +1 -1
- package/build/rollup.js +1 -1
- package/dist/js/tabulator.js +189 -142
- package/dist/js/tabulator.js.map +1 -1
- package/dist/js/tabulator.min.js +2 -2
- package/dist/js/tabulator.min.js.map +1 -1
- package/dist/js/tabulator_esm.js +195 -153
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +1 -1
- package/src/js/core/ColumnManager.js +4 -5
- package/src/js/core/Tabulator.js +118 -90
- package/src/js/core/tools/InteractionMonitor.js +0 -1
- package/src/js/modules/Filter/Filter.js +9 -4
- package/src/js/modules/FrozenRows/FrozenRows.js +4 -1
- package/src/js/modules/GroupRows/GroupRows.js +36 -29
- package/src/js/modules/History/History.js +3 -1
- package/src/js/modules/MoveColumns/MoveColumns.js +6 -4
- package/src/js/modules/SelectRow/SelectRow.js +1 -2
package/dist/js/tabulator_esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.0.
|
|
1
|
+
/* Tabulator v5.0.7 (c) Oliver Folkerd 2021 */
|
|
2
2
|
class CoreFeature{
|
|
3
3
|
|
|
4
4
|
constructor(table){
|
|
@@ -1180,7 +1180,7 @@ class CellComponent {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
|
-
class Cell
|
|
1183
|
+
class Cell extends CoreFeature{
|
|
1184
1184
|
constructor(column, row){
|
|
1185
1185
|
super(column.table);
|
|
1186
1186
|
|
|
@@ -2557,7 +2557,7 @@ class Column$1 extends CoreFeature{
|
|
|
2557
2557
|
//////////////// Cell Management /////////////////
|
|
2558
2558
|
//generate cell for this column
|
|
2559
2559
|
generateCell(row){
|
|
2560
|
-
var cell = new Cell
|
|
2560
|
+
var cell = new Cell(this, row);
|
|
2561
2561
|
|
|
2562
2562
|
this.cells.push(cell);
|
|
2563
2563
|
|
|
@@ -2772,7 +2772,7 @@ class RowComponent$1 {
|
|
|
2772
2772
|
}
|
|
2773
2773
|
}
|
|
2774
2774
|
|
|
2775
|
-
class Row
|
|
2775
|
+
class Row extends CoreFeature{
|
|
2776
2776
|
constructor (data, parent, type = "row"){
|
|
2777
2777
|
super(parent.table);
|
|
2778
2778
|
|
|
@@ -3614,7 +3614,7 @@ class ColumnCalcs extends Module{
|
|
|
3614
3614
|
this.table.modules.mutator.disable();
|
|
3615
3615
|
}
|
|
3616
3616
|
|
|
3617
|
-
row = new Row
|
|
3617
|
+
row = new Row(rowData, this, "calc");
|
|
3618
3618
|
|
|
3619
3619
|
if(this.table.modExists("mutator")){
|
|
3620
3620
|
this.table.modules.mutator.enable();
|
|
@@ -3658,7 +3658,7 @@ class ColumnCalcs extends Module{
|
|
|
3658
3658
|
this.genColumn.definition.cssClass = column.definition.cssClass;
|
|
3659
3659
|
|
|
3660
3660
|
//generate cell and assign to correct column
|
|
3661
|
-
var cell = new Cell
|
|
3661
|
+
var cell = new Cell(this.genColumn, row);
|
|
3662
3662
|
cell.getElement();
|
|
3663
3663
|
cell.column = column;
|
|
3664
3664
|
cell.setWidth();
|
|
@@ -4041,7 +4041,7 @@ class DataTree extends Module{
|
|
|
4041
4041
|
|
|
4042
4042
|
output.push(row);
|
|
4043
4043
|
|
|
4044
|
-
if(row instanceof Row
|
|
4044
|
+
if(row instanceof Row){
|
|
4045
4045
|
|
|
4046
4046
|
row.create();
|
|
4047
4047
|
|
|
@@ -4105,7 +4105,7 @@ class DataTree extends Module{
|
|
|
4105
4105
|
}
|
|
4106
4106
|
|
|
4107
4107
|
childArray.forEach((childData) => {
|
|
4108
|
-
var childRow = new Row
|
|
4108
|
+
var childRow = new Row(childData || {}, this.table.rowManager);
|
|
4109
4109
|
|
|
4110
4110
|
childRow.create();
|
|
4111
4111
|
|
|
@@ -4182,7 +4182,7 @@ class DataTree extends Module{
|
|
|
4182
4182
|
}
|
|
4183
4183
|
|
|
4184
4184
|
children.forEach((childRow) => {
|
|
4185
|
-
if(childRow instanceof Row
|
|
4185
|
+
if(childRow instanceof Row){
|
|
4186
4186
|
output.push(childRow);
|
|
4187
4187
|
}
|
|
4188
4188
|
});
|
|
@@ -4253,7 +4253,7 @@ class DataTree extends Module{
|
|
|
4253
4253
|
|
|
4254
4254
|
if(typeof subject == "object"){
|
|
4255
4255
|
|
|
4256
|
-
if(subject instanceof Row
|
|
4256
|
+
if(subject instanceof Row){
|
|
4257
4257
|
//subject is row element
|
|
4258
4258
|
match = subject.data;
|
|
4259
4259
|
}else if(subject instanceof RowComponent){
|
|
@@ -4262,7 +4262,7 @@ class DataTree extends Module{
|
|
|
4262
4262
|
}else if(typeof HTMLElement !== "undefined" && subject instanceof HTMLElement){
|
|
4263
4263
|
if(parent.modules.dataTree){
|
|
4264
4264
|
match = parent.modules.dataTree.children.find((childRow) => {
|
|
4265
|
-
return childRow instanceof Row
|
|
4265
|
+
return childRow instanceof Row ? childRow.element === subject : false;
|
|
4266
4266
|
});
|
|
4267
4267
|
|
|
4268
4268
|
if(match){
|
|
@@ -4307,7 +4307,7 @@ class DataTree extends Module{
|
|
|
4307
4307
|
}
|
|
4308
4308
|
|
|
4309
4309
|
config.children.forEach((childRow) => {
|
|
4310
|
-
if(childRow instanceof Row
|
|
4310
|
+
if(childRow instanceof Row){
|
|
4311
4311
|
output.push(component ? childRow.getComponent() : childRow);
|
|
4312
4312
|
|
|
4313
4313
|
if(recurse){
|
|
@@ -8118,6 +8118,7 @@ class Filter extends Module{
|
|
|
8118
8118
|
this.prevHeaderFilterChangeCheck = "{}";
|
|
8119
8119
|
|
|
8120
8120
|
this.changed = false; //has filtering changed since last render
|
|
8121
|
+
this.tableInitialized = false;
|
|
8121
8122
|
|
|
8122
8123
|
this.registerTableOption("filterMode", "local"); //local or remote filtering
|
|
8123
8124
|
|
|
@@ -8185,6 +8186,8 @@ class Filter extends Module{
|
|
|
8185
8186
|
}
|
|
8186
8187
|
});
|
|
8187
8188
|
}
|
|
8189
|
+
|
|
8190
|
+
this.tableInitialized = true;
|
|
8188
8191
|
}
|
|
8189
8192
|
|
|
8190
8193
|
remoteFilterParams(data, config, silent, params){
|
|
@@ -8648,10 +8651,12 @@ class Filter extends Module{
|
|
|
8648
8651
|
}
|
|
8649
8652
|
|
|
8650
8653
|
refreshFilter(){
|
|
8651
|
-
if(this.
|
|
8652
|
-
this.
|
|
8653
|
-
|
|
8654
|
-
|
|
8654
|
+
if(this.tableInitialized){
|
|
8655
|
+
if(this.table.options.filterMode === "remote"){
|
|
8656
|
+
this.reloadData();
|
|
8657
|
+
}else {
|
|
8658
|
+
this.refreshData();
|
|
8659
|
+
}
|
|
8655
8660
|
}
|
|
8656
8661
|
|
|
8657
8662
|
//TODO - Persist left position of row manager
|
|
@@ -10174,7 +10179,10 @@ class FrozenRows extends Module{
|
|
|
10174
10179
|
|
|
10175
10180
|
if(index > -1){
|
|
10176
10181
|
var rowEl = row.getElement();
|
|
10177
|
-
|
|
10182
|
+
|
|
10183
|
+
if(rowEl.parentNode){
|
|
10184
|
+
rowEl.parentNode.removeChild(rowEl);
|
|
10185
|
+
}
|
|
10178
10186
|
|
|
10179
10187
|
this.rows.splice(index, 1);
|
|
10180
10188
|
}
|
|
@@ -10946,6 +10954,34 @@ class GroupRows extends Module{
|
|
|
10946
10954
|
|
|
10947
10955
|
//initialize group configuration
|
|
10948
10956
|
initialize(){
|
|
10957
|
+
if(this.table.options.groupBy){
|
|
10958
|
+
|
|
10959
|
+
this.configureGroupSetup();
|
|
10960
|
+
|
|
10961
|
+
if(this.table.options.groupUpdateOnCellEdit){
|
|
10962
|
+
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
10963
|
+
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
10964
|
+
}
|
|
10965
|
+
|
|
10966
|
+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
10967
|
+
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
10968
|
+
this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
|
|
10969
|
+
this.subscribe("rows-wipe", this.wipe.bind(this));
|
|
10970
|
+
this.subscribe("rows-added", this.rowsUpdated.bind(this));
|
|
10971
|
+
this.subscribe("row-moving", this.rowMoving.bind(this));
|
|
10972
|
+
this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
|
|
10973
|
+
|
|
10974
|
+
this.subscribe("rows-sample", this.rowSample.bind(this));
|
|
10975
|
+
|
|
10976
|
+
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
|
|
10977
|
+
|
|
10978
|
+
this.registerDisplayHandler(this.displayHandler, 20);
|
|
10979
|
+
|
|
10980
|
+
this.initialized = true;
|
|
10981
|
+
}
|
|
10982
|
+
}
|
|
10983
|
+
|
|
10984
|
+
configureGroupSetup(){
|
|
10949
10985
|
if(this.table.options.groupBy){
|
|
10950
10986
|
var groupBy = this.table.options.groupBy,
|
|
10951
10987
|
startOpen = this.table.options.groupStartOpen,
|
|
@@ -11033,27 +11069,6 @@ class GroupRows extends Module{
|
|
|
11033
11069
|
if(groupHeader){
|
|
11034
11070
|
this.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader];
|
|
11035
11071
|
}
|
|
11036
|
-
|
|
11037
|
-
if(this.table.options.groupUpdateOnCellEdit){
|
|
11038
|
-
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
11039
|
-
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
11040
|
-
}
|
|
11041
|
-
|
|
11042
|
-
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
11043
|
-
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
11044
|
-
this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
|
|
11045
|
-
this.subscribe("rows-wipe", this.wipe.bind(this));
|
|
11046
|
-
this.subscribe("rows-added", this.rowsUpdated.bind(this));
|
|
11047
|
-
this.subscribe("row-moving", this.rowMoving.bind(this));
|
|
11048
|
-
this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
|
|
11049
|
-
|
|
11050
|
-
this.subscribe("rows-sample", this.rowSample.bind(this));
|
|
11051
|
-
|
|
11052
|
-
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
|
|
11053
|
-
|
|
11054
|
-
this.registerDisplayHandler(this.displayHandler, 20);
|
|
11055
|
-
|
|
11056
|
-
this.initialized = true;
|
|
11057
11072
|
}
|
|
11058
11073
|
}
|
|
11059
11074
|
|
|
@@ -11118,23 +11133,23 @@ class GroupRows extends Module{
|
|
|
11118
11133
|
|
|
11119
11134
|
setGroupBy(groups){
|
|
11120
11135
|
this.table.options.groupBy = groups;
|
|
11121
|
-
this.
|
|
11122
|
-
this.refreshData(
|
|
11136
|
+
this.configureGroupSetup();
|
|
11137
|
+
this.refreshData();
|
|
11123
11138
|
|
|
11124
11139
|
this.trackChanges();
|
|
11125
11140
|
}
|
|
11126
11141
|
|
|
11127
11142
|
setGroupValues(groupValues){
|
|
11128
11143
|
this.table.options.groupValues = groupValues;
|
|
11129
|
-
this.
|
|
11130
|
-
this.refreshData(
|
|
11144
|
+
this.configureGroupSetup();
|
|
11145
|
+
this.refreshData();
|
|
11131
11146
|
|
|
11132
11147
|
this.trackChanges();
|
|
11133
11148
|
}
|
|
11134
11149
|
|
|
11135
11150
|
setGroupStartOpen(values){
|
|
11136
11151
|
this.table.options.groupStartOpen = values;
|
|
11137
|
-
this.
|
|
11152
|
+
this.configureGroupSetup();
|
|
11138
11153
|
|
|
11139
11154
|
if(this.table.options.groupBy){
|
|
11140
11155
|
this.refreshData();
|
|
@@ -11147,7 +11162,7 @@ class GroupRows extends Module{
|
|
|
11147
11162
|
|
|
11148
11163
|
setGroupHeader(values){
|
|
11149
11164
|
this.table.options.groupHeader = values;
|
|
11150
|
-
this.
|
|
11165
|
+
this.configureGroupSetup();
|
|
11151
11166
|
|
|
11152
11167
|
if(this.table.options.groupBy){
|
|
11153
11168
|
this.refreshData();
|
|
@@ -11228,7 +11243,7 @@ class GroupRows extends Module{
|
|
|
11228
11243
|
|
|
11229
11244
|
//return appropriate rows with group headers
|
|
11230
11245
|
getRows(rows){
|
|
11231
|
-
if(this.groupIDLookups.length){
|
|
11246
|
+
if(this.table.options.groupBy && this.groupIDLookups.length){
|
|
11232
11247
|
|
|
11233
11248
|
this.dispatchExternal("dataGrouping");
|
|
11234
11249
|
|
|
@@ -11343,7 +11358,7 @@ class GroupRows extends Module{
|
|
|
11343
11358
|
var oldGroups = this.groups;
|
|
11344
11359
|
|
|
11345
11360
|
this.groups = {};
|
|
11346
|
-
this.groupList =[];
|
|
11361
|
+
this.groupList = [];
|
|
11347
11362
|
|
|
11348
11363
|
if(this.allowedValues && this.allowedValues[0]){
|
|
11349
11364
|
this.allowedValues[0].forEach((value) => {
|
|
@@ -11576,7 +11591,7 @@ class History extends Module{
|
|
|
11576
11591
|
}
|
|
11577
11592
|
}
|
|
11578
11593
|
|
|
11579
|
-
this.
|
|
11594
|
+
this.action("rowDelete", row, {data:row.getData(), pos:!index, index:index});
|
|
11580
11595
|
}
|
|
11581
11596
|
|
|
11582
11597
|
cellUpdated(cell){
|
|
@@ -12148,7 +12163,7 @@ class Interaction extends Module{
|
|
|
12148
12163
|
|
|
12149
12164
|
if(this.columnSubscribers[action]){
|
|
12150
12165
|
|
|
12151
|
-
if(component instanceof Cell
|
|
12166
|
+
if(component instanceof Cell){
|
|
12152
12167
|
callback = component.column.definition[action];
|
|
12153
12168
|
}else if(component instanceof Column$1){
|
|
12154
12169
|
callback = component.definition[action];
|
|
@@ -12965,7 +12980,9 @@ class MoveColumns extends Module{
|
|
|
12965
12980
|
}
|
|
12966
12981
|
|
|
12967
12982
|
startMove(e, column){
|
|
12968
|
-
var element = column.getElement()
|
|
12983
|
+
var element = column.getElement(),
|
|
12984
|
+
headerElement = this.table.columnManager.getElement(),
|
|
12985
|
+
headersElement = this.table.columnManager.getHeadersElement();
|
|
12969
12986
|
|
|
12970
12987
|
this.moving = column;
|
|
12971
12988
|
this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(element).left;
|
|
@@ -12986,7 +13003,7 @@ class MoveColumns extends Module{
|
|
|
12986
13003
|
this.table.columnManager.getElement().appendChild(this.hoverElement);
|
|
12987
13004
|
|
|
12988
13005
|
this.hoverElement.style.left = "0";
|
|
12989
|
-
this.hoverElement.style.bottom = "
|
|
13006
|
+
this.hoverElement.style.bottom = (headerElement.clientHeight - headersElement.offsetHeight) + "px";
|
|
12990
13007
|
|
|
12991
13008
|
if(!this.touchMove){
|
|
12992
13009
|
this._bindMouseMove();
|
|
@@ -13024,7 +13041,7 @@ class MoveColumns extends Module{
|
|
|
13024
13041
|
column.getCells().forEach(function(cell, i){
|
|
13025
13042
|
var cellEl = cell.getElement(true);
|
|
13026
13043
|
|
|
13027
|
-
if(cellEl.parentNode){
|
|
13044
|
+
if(cellEl.parentNode && movingCells[i]){
|
|
13028
13045
|
cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling);
|
|
13029
13046
|
}
|
|
13030
13047
|
});
|
|
@@ -13032,7 +13049,7 @@ class MoveColumns extends Module{
|
|
|
13032
13049
|
column.getCells().forEach(function(cell, i){
|
|
13033
13050
|
var cellEl = cell.getElement(true);
|
|
13034
13051
|
|
|
13035
|
-
if(cellEl.parentNode){
|
|
13052
|
+
if(cellEl.parentNode && movingCells[i]){
|
|
13036
13053
|
cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl);
|
|
13037
13054
|
}
|
|
13038
13055
|
});
|
|
@@ -16386,7 +16403,7 @@ class SelectRow extends Module{
|
|
|
16386
16403
|
this.subscribe("row-init", this.initializeRow.bind(this));
|
|
16387
16404
|
this.subscribe("row-deleting", this.rowDeleted.bind(this));
|
|
16388
16405
|
this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
|
|
16389
|
-
this.subscribe("rows-retrieve", this.
|
|
16406
|
+
this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
|
|
16390
16407
|
|
|
16391
16408
|
if(this.table.options.selectable && this.table.options.selectablePersistence){
|
|
16392
16409
|
this.subscribe("data-refeshing", this.deselectRows.bind(this));
|
|
@@ -16402,7 +16419,6 @@ class SelectRow extends Module{
|
|
|
16402
16419
|
this._deselectRow(row, true);
|
|
16403
16420
|
}
|
|
16404
16421
|
|
|
16405
|
-
|
|
16406
16422
|
clearSelectionData(silent){
|
|
16407
16423
|
this.selecting = false;
|
|
16408
16424
|
this.lastClickedRow = false;
|
|
@@ -18911,8 +18927,9 @@ class ColumnManager extends CoreFeature {
|
|
|
18911
18927
|
index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
|
|
18912
18928
|
|
|
18913
18929
|
if(nextToColumn && index > -1){
|
|
18914
|
-
var
|
|
18915
|
-
var
|
|
18930
|
+
var topColumn = nextToColumn.getTopColumn();
|
|
18931
|
+
var parentIndex = this.columns.indexOf(topColumn);
|
|
18932
|
+
var nextEl = topColumn.getElement();
|
|
18916
18933
|
|
|
18917
18934
|
if(before){
|
|
18918
18935
|
this.columns.splice(parentIndex, 0, column);
|
|
@@ -19287,13 +19304,11 @@ class ColumnManager extends CoreFeature {
|
|
|
19287
19304
|
|
|
19288
19305
|
this.dispatch("column-add", definition, before, nextToColumn);
|
|
19289
19306
|
|
|
19290
|
-
this.redraw(true);
|
|
19291
|
-
|
|
19292
19307
|
if(this.layoutMode() != "fitColumns"){
|
|
19293
19308
|
column.reinitializeWidth();
|
|
19294
19309
|
}
|
|
19295
19310
|
|
|
19296
|
-
this.
|
|
19311
|
+
this.redraw(true);
|
|
19297
19312
|
|
|
19298
19313
|
this.table.rowManager.reinitialize();
|
|
19299
19314
|
|
|
@@ -20112,7 +20127,7 @@ class RowManager extends CoreFeature{
|
|
|
20112
20127
|
////////////////// Row Manipulation //////////////////
|
|
20113
20128
|
findRow(subject){
|
|
20114
20129
|
if(typeof subject == "object"){
|
|
20115
|
-
if(subject instanceof Row
|
|
20130
|
+
if(subject instanceof Row){
|
|
20116
20131
|
//subject is row element
|
|
20117
20132
|
return subject;
|
|
20118
20133
|
}else if(subject instanceof RowComponent$1){
|
|
@@ -20195,7 +20210,7 @@ class RowManager extends CoreFeature{
|
|
|
20195
20210
|
|
|
20196
20211
|
data.forEach((def, i) => {
|
|
20197
20212
|
if(def && typeof def === "object"){
|
|
20198
|
-
var row = new Row
|
|
20213
|
+
var row = new Row(def, this);
|
|
20199
20214
|
this.rows.push(row);
|
|
20200
20215
|
}else {
|
|
20201
20216
|
console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def);
|
|
@@ -20327,7 +20342,7 @@ class RowManager extends CoreFeature{
|
|
|
20327
20342
|
}
|
|
20328
20343
|
|
|
20329
20344
|
addRowActual(data, pos, index, blockRedraw){
|
|
20330
|
-
var row = data instanceof Row
|
|
20345
|
+
var row = data instanceof Row ? data : new Row(data || {}, this),
|
|
20331
20346
|
top = this.findAddRowPos(pos),
|
|
20332
20347
|
allIndex = -1,
|
|
20333
20348
|
activeIndex, chainResult;
|
|
@@ -20486,7 +20501,7 @@ class RowManager extends CoreFeature{
|
|
|
20486
20501
|
nextRow = this.getDisplayRows()[index+1];
|
|
20487
20502
|
}
|
|
20488
20503
|
|
|
20489
|
-
if(nextRow && (!(nextRow instanceof Row
|
|
20504
|
+
if(nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")){
|
|
20490
20505
|
return this.nextDisplayRow(nextRow, rowOnly);
|
|
20491
20506
|
}
|
|
20492
20507
|
|
|
@@ -20501,7 +20516,7 @@ class RowManager extends CoreFeature{
|
|
|
20501
20516
|
prevRow = this.getDisplayRows()[index-1];
|
|
20502
20517
|
}
|
|
20503
20518
|
|
|
20504
|
-
if(rowOnly && prevRow && (!(prevRow instanceof Row
|
|
20519
|
+
if(rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")){
|
|
20505
20520
|
return this.prevDisplayRow(prevRow, rowOnly);
|
|
20506
20521
|
}
|
|
20507
20522
|
|
|
@@ -21217,7 +21232,6 @@ class InteractionManager extends CoreFeature {
|
|
|
21217
21232
|
if(!listener.handler){
|
|
21218
21233
|
listener.handler = this.track.bind(this, key);
|
|
21219
21234
|
this.el.addEventListener(key, listener.handler);
|
|
21220
|
-
console.log("add", key);
|
|
21221
21235
|
// this.el.addEventListener(key, listener.handler, {passive: true})
|
|
21222
21236
|
}
|
|
21223
21237
|
}else {
|
|
@@ -22921,68 +22935,80 @@ class Tabulator {
|
|
|
22921
22935
|
|
|
22922
22936
|
//replace data, keeping table in position with same sort
|
|
22923
22937
|
replaceData(data, params, config){
|
|
22924
|
-
|
|
22938
|
+
if(this.initialized){
|
|
22939
|
+
return this.dataLoader.load(data, params, config, true, true);
|
|
22940
|
+
}else {
|
|
22941
|
+
console.warn("replaceData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
22942
|
+
}
|
|
22925
22943
|
}
|
|
22926
22944
|
|
|
22927
22945
|
//update table data
|
|
22928
22946
|
updateData(data){
|
|
22929
22947
|
var responses = 0;
|
|
22930
22948
|
|
|
22931
|
-
|
|
22932
|
-
|
|
22949
|
+
if(this.initialized){
|
|
22950
|
+
return new Promise((resolve, reject) => {
|
|
22951
|
+
this.dataLoader.blockActiveLoad();
|
|
22933
22952
|
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
|
|
22953
|
+
if(typeof data === "string"){
|
|
22954
|
+
data = JSON.parse(data);
|
|
22955
|
+
}
|
|
22937
22956
|
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
|
|
22957
|
+
if(data){
|
|
22958
|
+
data.forEach((item) => {
|
|
22959
|
+
var row = this.rowManager.findRow(item[this.options.index]);
|
|
22941
22960
|
|
|
22942
|
-
|
|
22943
|
-
|
|
22961
|
+
if(row){
|
|
22962
|
+
responses++;
|
|
22944
22963
|
|
|
22945
|
-
|
|
22946
|
-
|
|
22947
|
-
|
|
22964
|
+
row.updateData(item)
|
|
22965
|
+
.then(()=>{
|
|
22966
|
+
responses--;
|
|
22948
22967
|
|
|
22949
|
-
|
|
22950
|
-
|
|
22951
|
-
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
|
|
22958
|
-
|
|
22959
|
-
|
|
22968
|
+
if(!responses){
|
|
22969
|
+
resolve();
|
|
22970
|
+
}
|
|
22971
|
+
});
|
|
22972
|
+
}
|
|
22973
|
+
});
|
|
22974
|
+
}else {
|
|
22975
|
+
console.warn("Update Error - No data provided");
|
|
22976
|
+
reject("Update Error - No data provided");
|
|
22977
|
+
}
|
|
22978
|
+
});
|
|
22979
|
+
}else {
|
|
22980
|
+
console.warn("updateData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
22981
|
+
}
|
|
22960
22982
|
}
|
|
22961
22983
|
|
|
22962
22984
|
addData(data, pos, index){
|
|
22963
|
-
|
|
22964
|
-
|
|
22985
|
+
if(this.initialized){
|
|
22986
|
+
return new Promise((resolve, reject) => {
|
|
22987
|
+
this.dataLoader.blockActiveLoad();
|
|
22965
22988
|
|
|
22966
|
-
|
|
22967
|
-
|
|
22968
|
-
|
|
22989
|
+
if(typeof data === "string"){
|
|
22990
|
+
data = JSON.parse(data);
|
|
22991
|
+
}
|
|
22969
22992
|
|
|
22970
|
-
|
|
22971
|
-
|
|
22972
|
-
|
|
22973
|
-
|
|
22993
|
+
if(data){
|
|
22994
|
+
this.rowManager.addRows(data, pos, index)
|
|
22995
|
+
.then((rows) => {
|
|
22996
|
+
var output = [];
|
|
22974
22997
|
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
|
|
22998
|
+
rows.forEach(function(row){
|
|
22999
|
+
output.push(row.getComponent());
|
|
23000
|
+
});
|
|
22978
23001
|
|
|
22979
|
-
|
|
22980
|
-
|
|
22981
|
-
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
23002
|
+
resolve(output);
|
|
23003
|
+
});
|
|
23004
|
+
}else {
|
|
23005
|
+
console.warn("Update Error - No data provided");
|
|
23006
|
+
reject("Update Error - No data provided");
|
|
23007
|
+
}
|
|
23008
|
+
});
|
|
23009
|
+
}else {
|
|
23010
|
+
console.warn("addData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
23011
|
+
}
|
|
22986
23012
|
}
|
|
22987
23013
|
|
|
22988
23014
|
//update table data
|
|
@@ -22990,46 +23016,50 @@ class Tabulator {
|
|
|
22990
23016
|
var rows = [],
|
|
22991
23017
|
responses = 0;
|
|
22992
23018
|
|
|
22993
|
-
|
|
22994
|
-
|
|
23019
|
+
if(this.initialized){
|
|
23020
|
+
return new Promise((resolve, reject) => {
|
|
23021
|
+
this.dataLoader.blockActiveLoad();
|
|
22995
23022
|
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
23023
|
+
if(typeof data === "string"){
|
|
23024
|
+
data = JSON.parse(data);
|
|
23025
|
+
}
|
|
22999
23026
|
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
|
|
23027
|
+
if(data){
|
|
23028
|
+
data.forEach((item) => {
|
|
23029
|
+
var row = this.rowManager.findRow(item[this.options.index]);
|
|
23003
23030
|
|
|
23004
|
-
|
|
23031
|
+
responses++;
|
|
23005
23032
|
|
|
23006
|
-
|
|
23007
|
-
|
|
23008
|
-
|
|
23009
|
-
|
|
23010
|
-
|
|
23033
|
+
if(row){
|
|
23034
|
+
row.updateData(item)
|
|
23035
|
+
.then(()=>{
|
|
23036
|
+
responses--;
|
|
23037
|
+
rows.push(row.getComponent());
|
|
23011
23038
|
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23039
|
+
if(!responses){
|
|
23040
|
+
resolve(rows);
|
|
23041
|
+
}
|
|
23042
|
+
});
|
|
23043
|
+
}else {
|
|
23044
|
+
this.rowManager.addRows(item)
|
|
23045
|
+
.then((newRows)=>{
|
|
23046
|
+
responses--;
|
|
23047
|
+
rows.push(newRows[0].getComponent());
|
|
23021
23048
|
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23049
|
+
if(!responses){
|
|
23050
|
+
resolve(rows);
|
|
23051
|
+
}
|
|
23052
|
+
});
|
|
23053
|
+
}
|
|
23054
|
+
});
|
|
23055
|
+
}else {
|
|
23056
|
+
console.warn("Update Error - No data provided");
|
|
23057
|
+
reject("Update Error - No data provided");
|
|
23058
|
+
}
|
|
23059
|
+
});
|
|
23060
|
+
}else {
|
|
23061
|
+
console.warn("updateOrAddData failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
23062
|
+
}
|
|
23033
23063
|
}
|
|
23034
23064
|
|
|
23035
23065
|
//get row object
|
|
@@ -23093,14 +23123,18 @@ class Tabulator {
|
|
|
23093
23123
|
|
|
23094
23124
|
//add row to table
|
|
23095
23125
|
addRow(data, pos, index){
|
|
23096
|
-
if(
|
|
23097
|
-
data
|
|
23098
|
-
|
|
23126
|
+
if(this.initialized){
|
|
23127
|
+
if(typeof data === "string"){
|
|
23128
|
+
data = JSON.parse(data);
|
|
23129
|
+
}
|
|
23099
23130
|
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23131
|
+
return this.rowManager.addRows(data, pos, index)
|
|
23132
|
+
.then((rows)=>{
|
|
23133
|
+
return rows[0].getComponent();
|
|
23134
|
+
});
|
|
23135
|
+
}else {
|
|
23136
|
+
console.warn("addRow failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
23137
|
+
}
|
|
23104
23138
|
}
|
|
23105
23139
|
|
|
23106
23140
|
//update a row if it exitsts otherwise create it
|
|
@@ -23166,7 +23200,11 @@ class Tabulator {
|
|
|
23166
23200
|
}
|
|
23167
23201
|
|
|
23168
23202
|
getRows(active){
|
|
23169
|
-
|
|
23203
|
+
if(this.initialized){
|
|
23204
|
+
return this.rowManager.getComponents(active);
|
|
23205
|
+
}else {
|
|
23206
|
+
console.warn("getRows failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
23207
|
+
}
|
|
23170
23208
|
}
|
|
23171
23209
|
|
|
23172
23210
|
//get position of row in table
|
|
@@ -23309,8 +23347,12 @@ class Tabulator {
|
|
|
23309
23347
|
//////////// General Public Functions ////////////
|
|
23310
23348
|
//redraw list without updating data
|
|
23311
23349
|
redraw(force){
|
|
23312
|
-
this.
|
|
23313
|
-
|
|
23350
|
+
if(this.initialized){
|
|
23351
|
+
this.columnManager.redraw(force);
|
|
23352
|
+
this.rowManager.redraw(force);
|
|
23353
|
+
}else {
|
|
23354
|
+
console.warn("redraw failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
23355
|
+
}
|
|
23314
23356
|
}
|
|
23315
23357
|
|
|
23316
23358
|
setHeight(height){
|