tabulator-tables 5.2.3 → 5.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "5.2.3",
3
+ "version": "5.2.4",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -8,8 +8,8 @@ export default class CoreFeature{
8
8
  /////////////// DataLoad /////////////////
9
9
  //////////////////////////////////////////
10
10
 
11
- reloadData(data, silent){
12
- return this.table.dataLoader.load(data, undefined, undefined, undefined, silent);
11
+ reloadData(data, silent, columnsChanged){
12
+ return this.table.dataLoader.load(data, undefined, undefined, undefined, silent, columnsChanged);
13
13
  }
14
14
 
15
15
  //////////////////////////////////////////
@@ -10,7 +10,7 @@ export default class DataLoader extends CoreFeature{
10
10
 
11
11
  initialize(){}
12
12
 
13
- load(data, params, config, replace, silent){
13
+ load(data, params, config, replace, silent, columnsChanged){
14
14
  var requestNo = ++this.requestOrder;
15
15
 
16
16
  this.dispatchExternal("dataLoading", data);
@@ -46,7 +46,7 @@ export default class DataLoader extends CoreFeature{
46
46
 
47
47
  if(rowData !== false){
48
48
  this.dispatchExternal("dataLoaded", rowData);
49
- this.table.rowManager.setData(rowData, replace, !replace);
49
+ this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
50
50
  }
51
51
  }else{
52
52
  console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
@@ -73,7 +73,7 @@ export default class DataLoader extends CoreFeature{
73
73
  data = [];
74
74
  }
75
75
 
76
- this.table.rowManager.setData(data, replace, !replace);
76
+ this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
77
77
  return Promise.resolve();
78
78
  }
79
79
  }
@@ -432,6 +432,10 @@ class DataTree extends Module{
432
432
  return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false;
433
433
  }
434
434
 
435
+ getTreeParentRoot(row){
436
+ return row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
437
+ }
438
+
435
439
  getFilteredTreeChildren(row){
436
440
  var config = row.modules.dataTree,
437
441
  output = [], children;
@@ -475,7 +475,7 @@ export default class Edit{
475
475
  values = this._ajaxRequest(this.params.valuesURL, this.input.value);
476
476
  }else{
477
477
  if(typeof this.params.valuesLookup === "function"){
478
- values = this.params.valuesLookup(cell, this.input.value);
478
+ values = this.params.valuesLookup(this.cell, this.input.value);
479
479
  }else if(this.params.valuesLookup){
480
480
  values = this._uniqueColumnValues(this.params.valuesLookupField);
481
481
  }
@@ -994,4 +994,4 @@ export default class Edit{
994
994
  }
995
995
  }
996
996
 
997
- }
997
+ }
@@ -556,7 +556,7 @@ class Filter extends Module{
556
556
  refreshFilter(){
557
557
  if(this.tableInitialized){
558
558
  if(this.table.options.filterMode === "remote"){
559
- this.reloadData();
559
+ this.reloadData(null, false, false);
560
560
  }else{
561
561
  this.refreshData(true);
562
562
  }
@@ -178,7 +178,8 @@ class FrozenColumns extends Module{
178
178
  this.table.columnManager.element.style.paddingRight = this.rightMargin;
179
179
 
180
180
  this.leftColumns.forEach((column, i) => {
181
- column.modules.frozen.margin = (leftMargin + this.table.columnManager.scrollLeft) + "px";
181
+ column.modules.frozen.marginValue = leftMargin + this.table.columnManager.scrollLeft;
182
+ column.modules.frozen.margin = column.modules.frozen.marginValue + "px";
182
183
 
183
184
  if(column.visible){
184
185
  leftMargin += column.getWidth();
@@ -217,7 +218,8 @@ class FrozenColumns extends Module{
217
218
  rightMargin += column.getWidth();
218
219
  }
219
220
 
220
- column.modules.frozen.margin = (this.rightPadding - rightMargin) + "px";
221
+ column.modules.frozen.marginValue = this.rightPadding - rightMargin;
222
+ column.modules.frozen.margin = column.modules.frozen.marginValue + "px";
221
223
 
222
224
  if(i == this.rightColumns.length - 1){
223
225
  column.modules.frozen.edge = true;
@@ -436,6 +436,10 @@ class GroupRows extends Module{
436
436
  getRowGroup(row){
437
437
  var match = false;
438
438
 
439
+ if(this.options("dataTree")){
440
+ row = this.table.modules.dataTree.getTreeParentRoot(row);
441
+ }
442
+
439
443
  this.groupList.forEach((group) => {
440
444
  var result = group.getRowGroup(row);
441
445
 
@@ -33,6 +33,7 @@ class ResizeColumns extends Module{
33
33
 
34
34
  this.subscribe("column-hide", this.deInitializeColumn.bind(this));
35
35
  this.subscribe("column-show", this.columnLayoutUpdated.bind(this));
36
+ this.subscribe("column-width", this.columnWidthUpdated.bind(this));
36
37
 
37
38
  this.subscribe("column-delete", this.deInitializeComponent.bind(this));
38
39
  this.subscribe("column-height", this.resizeHandle.bind(this));
@@ -67,14 +68,39 @@ class ResizeColumns extends Module{
67
68
  }
68
69
  }
69
70
 
71
+ columnWidthUpdated(column){
72
+ if(column.modules.frozen){
73
+ if(this.table.modules.frozenColumns.leftColumns.includes(column)){
74
+ this.table.modules.frozenColumns.leftColumns.forEach((col) => {
75
+ this.reinitializeColumn(col);
76
+ });
77
+ }else if(this.table.modules.frozenColumns.rightColumns.includes(column)){
78
+ this.table.modules.frozenColumns.rightColumns.forEach((col) => {
79
+ this.reinitializeColumn(col);
80
+ });
81
+ }
82
+ }
83
+ }
84
+
70
85
  reinitializeColumn(column){
86
+ var frozenOffset = column.modules.frozen ? (column.modules.frozen.marginValue + column.getWidth() + "px") : false;
87
+ ;
88
+
71
89
  column.cells.forEach((cell) => {
72
90
  if(cell.modules.resize && cell.modules.resize.handleEl){
91
+ if(frozenOffset){
92
+ cell.modules.resize.handleEl.style.left = frozenOffset;
93
+ }
94
+
73
95
  cell.element.after(cell.modules.resize.handleEl);
74
96
  }
75
97
  });
76
98
 
77
99
  if(column.modules.resize && column.modules.resize.handleEl){
100
+ if(frozenOffset){
101
+ column.modules.resize.handleEl.style.left = frozenOffset;
102
+ }
103
+
78
104
  column.element.after(column.modules.resize.handleEl);
79
105
  }
80
106
  }
@@ -123,6 +149,11 @@ class ResizeColumns extends Module{
123
149
  }
124
150
  });
125
151
 
152
+ if(column.modules.frozen){
153
+ handle.style.position = "absolute";
154
+ handle.style.left = column.modules.frozen.marginValue + column.getWidth() + "px";
155
+ }
156
+
126
157
  config.handleEl = handle;
127
158
 
128
159
  if(element.parentNode){
@@ -173,27 +204,27 @@ class ResizeColumns extends Module{
173
204
  startDiff = x - self.startX,
174
205
  moveDiff = x - self.latestX,
175
206
  blockedBefore, blockedAfter;
176
-
207
+
177
208
  self.latestX = x;
178
209
 
179
210
  if(self.table.rtl){
180
211
  startDiff = -startDiff;
181
212
  moveDiff = -moveDiff;
182
213
  }
183
-
214
+
184
215
  blockedBefore = column.width == column.minWidth || column.width == column.maxWidth;
185
-
216
+
186
217
  column.setWidth(self.startWidth + startDiff);
187
-
218
+
188
219
  blockedAfter = column.width == column.minWidth || column.width == column.maxWidth;
189
-
220
+
190
221
  if(moveDiff < 0){
191
222
  self.nextColumn = self.initialNextColumn;
192
223
  }
193
224
 
194
225
  if(self.table.options.resizableColumnFit && self.nextColumn && !(blockedBefore && blockedAfter)){
195
226
  let colWidth = self.nextColumn.getWidth();
196
-
227
+
197
228
  if(moveDiff > 0){
198
229
  if(colWidth <= self.nextColumn.minWidth){
199
230
  self.nextColumn = self.nextColumn.nextColumn();
@@ -204,7 +204,7 @@ class Sort extends Module{
204
204
 
205
205
  refreshSort(){
206
206
  if(this.table.options.sortMode === "remote"){
207
- this.reloadData();
207
+ this.reloadData(null, false, false);
208
208
  }else{
209
209
  this.refreshData(true);
210
210
  }