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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "5.4.0",
3
+ "version": "5.4.2",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -53,7 +53,7 @@
53
53
  "eslint-plugin-only-warn": "^1.0.3",
54
54
  "fs-extra": "^9.0.1",
55
55
  "globby": "^11.0.2",
56
- "node-sass": "^5.0.0",
56
+ "node-sass": "^7.0.3",
57
57
  "postcss": "^8.2.4",
58
58
  "postcss-prettify": "^0.3.4",
59
59
  "rollup": "^2.36.1",
@@ -535,10 +535,11 @@ export default class ColumnManager extends CoreFeature {
535
535
 
536
536
  scrollToColumn(column, position, ifVisible){
537
537
  var left = 0,
538
- offset = 0,
538
+ offset = column.getLeftOffset(),
539
539
  adjust = 0,
540
540
  colEl = column.getElement();
541
541
 
542
+
542
543
  return new Promise((resolve, reject) => {
543
544
 
544
545
  if(typeof position === "undefined"){
@@ -565,16 +566,13 @@ export default class ColumnManager extends CoreFeature {
565
566
 
566
567
  //check column visibility
567
568
  if(!ifVisible){
568
-
569
- offset = colEl.offsetLeft;
570
-
571
569
  if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
572
570
  return false;
573
571
  }
574
572
  }
575
573
 
576
574
  //calculate scroll position
577
- left = colEl.offsetLeft + adjust;
575
+ left = offset + adjust;
578
576
 
579
577
  left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
580
578
 
@@ -721,6 +721,16 @@ class Column extends CoreFeature{
721
721
  return width;
722
722
  }
723
723
 
724
+ getLeftOffset(){
725
+ var offset = this.element.offsetLeft;
726
+
727
+ if(this.parent.isGroup){
728
+ offset += this.parent.getLeftOffset();
729
+ }
730
+
731
+ return offset;
732
+ }
733
+
724
734
  getHeight(){
725
735
  return Math.ceil(this.element.getBoundingClientRect().height);
726
736
  }
@@ -343,6 +343,12 @@ export default class VirtualDomHorizontal extends Renderer{
343
343
  this.fitDataColActualWidthCheck(column);
344
344
 
345
345
  this.rightCol++; // Don't move this below the >= check below
346
+
347
+ this.getVisibleRows().forEach((row) => {
348
+ if(row.type !== "group"){
349
+ row.modules.vdomHoz.rightCol = this.rightCol;
350
+ }
351
+ });
346
352
 
347
353
  if(this.rightCol >= (this.columns.length - 1)){
348
354
  this.vDomPadRight = 0;
@@ -382,6 +388,12 @@ export default class VirtualDomHorizontal extends Renderer{
382
388
  });
383
389
 
384
390
  this.leftCol--; // don't move this below the <= check below
391
+
392
+ this.getVisibleRows().forEach((row) => {
393
+ if(row.type !== "group"){
394
+ row.modules.vdomHoz.leftCol = this.leftCol;
395
+ }
396
+ });
385
397
 
386
398
  if(this.leftCol <= 0){ // replicating logic in addColRight
387
399
  this.vDomPadLeft = 0;
@@ -434,6 +446,12 @@ export default class VirtualDomHorizontal extends Renderer{
434
446
 
435
447
  this.vDomPadRight += column.getWidth();
436
448
  this.rightCol --;
449
+
450
+ this.getVisibleRows().forEach((row) => {
451
+ if(row.type !== "group"){
452
+ row.modules.vdomHoz.rightCol = this.rightCol;
453
+ }
454
+ });
437
455
  }else{
438
456
  working = false;
439
457
  }
@@ -472,6 +490,12 @@ export default class VirtualDomHorizontal extends Renderer{
472
490
 
473
491
  this.vDomPadLeft += column.getWidth();
474
492
  this.leftCol ++;
493
+
494
+ this.getVisibleRows().forEach((row) => {
495
+ if(row.type !== "group"){
496
+ row.modules.vdomHoz.leftCol = this.leftCol;
497
+ }
498
+ });
475
499
  }else{
476
500
  working = false;
477
501
  }
@@ -250,6 +250,16 @@ class ColumnCalcs extends Module{
250
250
  }
251
251
  }
252
252
 
253
+ reinitializeCalcs(){
254
+ if(this.topCalcs.length){
255
+ this.initializeTopRow();
256
+ }
257
+
258
+ if(this.botCalcs.length){
259
+ this.initializeBottomRow();
260
+ }
261
+ }
262
+
253
263
  initializeTopRow(){
254
264
  if(!this.topInitialized){
255
265
  this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
@@ -30,6 +30,7 @@ export default class Edit{
30
30
  this.listIteration = 0;
31
31
 
32
32
  this.lastAction="";
33
+ this.filterTerm="";
33
34
 
34
35
  this.blurable = true;
35
36
 
@@ -413,9 +413,9 @@ class Filter extends Module{
413
413
  });
414
414
 
415
415
  editorElement.addEventListener("focus", (e) => {
416
- var left = this.table.columnManager.element.scrollLeft;
416
+ var left = this.table.columnManager.contentsElement.scrollLeft;
417
417
 
418
- var headerPos = this.table.rowManager.element.scrollLeft + parseInt(this.table.columnManager.element.style.marginLeft);
418
+ var headerPos = this.table.rowManager.element.scrollLeft;
419
419
 
420
420
  if(left !== headerPos){
421
421
  this.table.rowManager.scrollHorizontal(left);
@@ -38,17 +38,19 @@ class Group{
38
38
  this.createValueGroups();
39
39
  }
40
40
 
41
- wipe(){
42
- if(this.groupList.length){
43
- this.groupList.forEach(function(group){
44
- group.wipe();
45
- });
46
- }else{
47
- this.rows.forEach((row) => {
48
- if(row.modules){
49
- delete row.modules.group;
50
- }
51
- });
41
+ wipe(elementsOnly){
42
+ if(!elementsOnly){
43
+ if(this.groupList.length){
44
+ this.groupList.forEach(function(group){
45
+ group.wipe();
46
+ });
47
+ }else{
48
+ this.rows.forEach((row) => {
49
+ if(row.modules){
50
+ delete row.modules.group;
51
+ }
52
+ });
53
+ }
52
54
  }
53
55
 
54
56
  this.element = false;
@@ -92,7 +92,7 @@ class GroupRows extends Module{
92
92
 
93
93
  this.groupIDLookups = [];
94
94
 
95
- if(Array.isArray(groupBy)){
95
+ if(groupBy){
96
96
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
97
97
  this.table.modules.columnCalcs.removeCalcs();
98
98
  }
@@ -233,6 +233,10 @@ class GroupRows extends Module{
233
233
  }
234
234
 
235
235
  this.configureGroupSetup();
236
+
237
+ if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
238
+ this.table.modules.columnCalcs.reinitializeCalcs();
239
+ }
236
240
 
237
241
  this.refreshData();
238
242
 
@@ -388,6 +392,9 @@ class GroupRows extends Module{
388
392
  this.groupList.forEach(function(group){
389
393
  group.wipe();
390
394
  });
395
+
396
+ this.groupList = [];
397
+ this.groups = {};
391
398
  }
392
399
  }
393
400
 
@@ -474,8 +481,13 @@ class GroupRows extends Module{
474
481
  this.assignRowToGroup(row, oldGroups);
475
482
  });
476
483
  }
484
+
485
+ Object.values(oldGroups).forEach((group) => {
486
+ group.wipe(true);
487
+ });
477
488
  }
478
489
 
490
+
479
491
  createGroup(groupID, level, oldGroups){
480
492
  var groupKey = level + "_" + groupID,
481
493
  group;
@@ -50,7 +50,7 @@ class MoveColumns extends Module{
50
50
 
51
51
  config.mousemove = function(e){
52
52
  if(column.parent === self.moving.parent){
53
- if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.element.scrollLeft) > (column.getWidth() / 2)){
53
+ if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.contentsElement.scrollLeft) > (column.getWidth() / 2)){
54
54
  if(self.toCol !== column || !self.toColAfter){
55
55
  colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
56
56
  self.moveColumn(column, true);
@@ -486,6 +486,7 @@ class Page extends Module{
486
486
  if(!this.initialLoad){
487
487
  if(this.mode == "local" || force){
488
488
  this.page = 1;
489
+ this.trackChanges();
489
490
  }
490
491
  }
491
492
  }