tabulator-tables 5.4.0 → 5.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tabulator",
3
3
  "main": "dist/js/tabulator.js",
4
- "version": "5.4.0",
4
+ "version": "5.4.2",
5
5
  "description": "Interactive table generation JavaScript library",
6
6
  "keywords": [
7
7
  "table",
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.4.0 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.4.2 (c) Oliver Folkerd 2022 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -1470,6 +1470,16 @@
1470
1470
  return width;
1471
1471
  }
1472
1472
 
1473
+ getLeftOffset(){
1474
+ var offset = this.element.offsetLeft;
1475
+
1476
+ if(this.parent.isGroup){
1477
+ offset += this.parent.getLeftOffset();
1478
+ }
1479
+
1480
+ return offset;
1481
+ }
1482
+
1473
1483
  getHeight(){
1474
1484
  return Math.ceil(this.element.getBoundingClientRect().height);
1475
1485
  }
@@ -2339,6 +2349,12 @@
2339
2349
  this.fitDataColActualWidthCheck(column);
2340
2350
 
2341
2351
  this.rightCol++; // Don't move this below the >= check below
2352
+
2353
+ this.getVisibleRows().forEach((row) => {
2354
+ if(row.type !== "group"){
2355
+ row.modules.vdomHoz.rightCol = this.rightCol;
2356
+ }
2357
+ });
2342
2358
 
2343
2359
  if(this.rightCol >= (this.columns.length - 1)){
2344
2360
  this.vDomPadRight = 0;
@@ -2378,6 +2394,12 @@
2378
2394
  });
2379
2395
 
2380
2396
  this.leftCol--; // don't move this below the <= check below
2397
+
2398
+ this.getVisibleRows().forEach((row) => {
2399
+ if(row.type !== "group"){
2400
+ row.modules.vdomHoz.leftCol = this.leftCol;
2401
+ }
2402
+ });
2381
2403
 
2382
2404
  if(this.leftCol <= 0){ // replicating logic in addColRight
2383
2405
  this.vDomPadLeft = 0;
@@ -2430,6 +2452,12 @@
2430
2452
 
2431
2453
  this.vDomPadRight += column.getWidth();
2432
2454
  this.rightCol --;
2455
+
2456
+ this.getVisibleRows().forEach((row) => {
2457
+ if(row.type !== "group"){
2458
+ row.modules.vdomHoz.rightCol = this.rightCol;
2459
+ }
2460
+ });
2433
2461
  }else {
2434
2462
  working = false;
2435
2463
  }
@@ -2468,6 +2496,12 @@
2468
2496
 
2469
2497
  this.vDomPadLeft += column.getWidth();
2470
2498
  this.leftCol ++;
2499
+
2500
+ this.getVisibleRows().forEach((row) => {
2501
+ if(row.type !== "group"){
2502
+ row.modules.vdomHoz.leftCol = this.leftCol;
2503
+ }
2504
+ });
2471
2505
  }else {
2472
2506
  working = false;
2473
2507
  }
@@ -3075,10 +3109,11 @@
3075
3109
 
3076
3110
  scrollToColumn(column, position, ifVisible){
3077
3111
  var left = 0,
3078
- offset = 0,
3112
+ offset = column.getLeftOffset(),
3079
3113
  adjust = 0,
3080
3114
  colEl = column.getElement();
3081
3115
 
3116
+
3082
3117
  return new Promise((resolve, reject) => {
3083
3118
 
3084
3119
  if(typeof position === "undefined"){
@@ -3105,16 +3140,13 @@
3105
3140
 
3106
3141
  //check column visibility
3107
3142
  if(!ifVisible){
3108
-
3109
- offset = colEl.offsetLeft;
3110
-
3111
3143
  if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
3112
3144
  return false;
3113
3145
  }
3114
3146
  }
3115
3147
 
3116
3148
  //calculate scroll position
3117
- left = colEl.offsetLeft + adjust;
3149
+ left = offset + adjust;
3118
3150
 
3119
3151
  left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
3120
3152
 
@@ -9709,6 +9741,16 @@
9709
9741
  }
9710
9742
  }
9711
9743
 
9744
+ reinitializeCalcs(){
9745
+ if(this.topCalcs.length){
9746
+ this.initializeTopRow();
9747
+ }
9748
+
9749
+ if(this.botCalcs.length){
9750
+ this.initializeBottomRow();
9751
+ }
9752
+ }
9753
+
9712
9754
  initializeTopRow(){
9713
9755
  if(!this.topInitialized){
9714
9756
  this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
@@ -11904,6 +11946,7 @@
11904
11946
  this.listIteration = 0;
11905
11947
 
11906
11948
  this.lastAction="";
11949
+ this.filterTerm="";
11907
11950
 
11908
11951
  this.blurable = true;
11909
11952
 
@@ -15195,9 +15238,9 @@
15195
15238
  });
15196
15239
 
15197
15240
  editorElement.addEventListener("focus", (e) => {
15198
- var left = this.table.columnManager.element.scrollLeft;
15241
+ var left = this.table.columnManager.contentsElement.scrollLeft;
15199
15242
 
15200
- var headerPos = this.table.rowManager.element.scrollLeft + parseInt(this.table.columnManager.element.style.marginLeft);
15243
+ var headerPos = this.table.rowManager.element.scrollLeft;
15201
15244
 
15202
15245
  if(left !== headerPos){
15203
15246
  this.table.rowManager.scrollHorizontal(left);
@@ -17094,17 +17137,19 @@
17094
17137
  this.createValueGroups();
17095
17138
  }
17096
17139
 
17097
- wipe(){
17098
- if(this.groupList.length){
17099
- this.groupList.forEach(function(group){
17100
- group.wipe();
17101
- });
17102
- }else {
17103
- this.rows.forEach((row) => {
17104
- if(row.modules){
17105
- delete row.modules.group;
17106
- }
17107
- });
17140
+ wipe(elementsOnly){
17141
+ if(!elementsOnly){
17142
+ if(this.groupList.length){
17143
+ this.groupList.forEach(function(group){
17144
+ group.wipe();
17145
+ });
17146
+ }else {
17147
+ this.rows.forEach((row) => {
17148
+ if(row.modules){
17149
+ delete row.modules.group;
17150
+ }
17151
+ });
17152
+ }
17108
17153
  }
17109
17154
 
17110
17155
  this.element = false;
@@ -17737,7 +17782,7 @@
17737
17782
 
17738
17783
  this.groupIDLookups = [];
17739
17784
 
17740
- if(Array.isArray(groupBy)){
17785
+ if(groupBy){
17741
17786
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
17742
17787
  this.table.modules.columnCalcs.removeCalcs();
17743
17788
  }
@@ -17877,6 +17922,10 @@
17877
17922
  }
17878
17923
 
17879
17924
  this.configureGroupSetup();
17925
+
17926
+ if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
17927
+ this.table.modules.columnCalcs.reinitializeCalcs();
17928
+ }
17880
17929
 
17881
17930
  this.refreshData();
17882
17931
 
@@ -18032,6 +18081,9 @@
18032
18081
  this.groupList.forEach(function(group){
18033
18082
  group.wipe();
18034
18083
  });
18084
+
18085
+ this.groupList = [];
18086
+ this.groups = {};
18035
18087
  }
18036
18088
  }
18037
18089
 
@@ -18118,8 +18170,13 @@
18118
18170
  this.assignRowToGroup(row, oldGroups);
18119
18171
  });
18120
18172
  }
18173
+
18174
+ Object.values(oldGroups).forEach((group) => {
18175
+ group.wipe(true);
18176
+ });
18121
18177
  }
18122
18178
 
18179
+
18123
18180
  createGroup(groupID, level, oldGroups){
18124
18181
  var groupKey = level + "_" + groupID,
18125
18182
  group;
@@ -19886,7 +19943,7 @@
19886
19943
 
19887
19944
  config.mousemove = function(e){
19888
19945
  if(column.parent === self.moving.parent){
19889
- if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.element.scrollLeft) > (column.getWidth() / 2)){
19946
+ if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.contentsElement.scrollLeft) > (column.getWidth() / 2)){
19890
19947
  if(self.toCol !== column || !self.toColAfter){
19891
19948
  colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
19892
19949
  self.moveColumn(column, true);
@@ -21485,6 +21542,7 @@
21485
21542
  if(!this.initialLoad){
21486
21543
  if(this.mode == "local" || force){
21487
21544
  this.page = 1;
21545
+ this.trackChanges();
21488
21546
  }
21489
21547
  }
21490
21548
  }