tabulator-tables 5.4.1 → 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.1",
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
  }
@@ -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);
@@ -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
 
@@ -479,7 +483,7 @@ class GroupRows extends Module{
479
483
  }
480
484
 
481
485
  Object.values(oldGroups).forEach((group) => {
482
- group.wipe();
486
+ group.wipe(true);
483
487
  });
484
488
  }
485
489
 
@@ -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);