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.
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.4.1 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.4.2 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -2727,6 +2727,16 @@ class Column extends CoreFeature{
2727
2727
  return width;
2728
2728
  }
2729
2729
 
2730
+ getLeftOffset(){
2731
+ var offset = this.element.offsetLeft;
2732
+
2733
+ if(this.parent.isGroup){
2734
+ offset += this.parent.getLeftOffset();
2735
+ }
2736
+
2737
+ return offset;
2738
+ }
2739
+
2730
2740
  getHeight(){
2731
2741
  return Math.ceil(this.element.getBoundingClientRect().height);
2732
2742
  }
@@ -3820,6 +3830,16 @@ class ColumnCalcs extends Module{
3820
3830
  }
3821
3831
  }
3822
3832
 
3833
+ reinitializeCalcs(){
3834
+ if(this.topCalcs.length){
3835
+ this.initializeTopRow();
3836
+ }
3837
+
3838
+ if(this.botCalcs.length){
3839
+ this.initializeBottomRow();
3840
+ }
3841
+ }
3842
+
3823
3843
  initializeTopRow(){
3824
3844
  if(!this.topInitialized){
3825
3845
  this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
@@ -11206,17 +11226,19 @@ class Group{
11206
11226
  this.createValueGroups();
11207
11227
  }
11208
11228
 
11209
- wipe(){
11210
- if(this.groupList.length){
11211
- this.groupList.forEach(function(group){
11212
- group.wipe();
11213
- });
11214
- }else {
11215
- this.rows.forEach((row) => {
11216
- if(row.modules){
11217
- delete row.modules.group;
11218
- }
11219
- });
11229
+ wipe(elementsOnly){
11230
+ if(!elementsOnly){
11231
+ if(this.groupList.length){
11232
+ this.groupList.forEach(function(group){
11233
+ group.wipe();
11234
+ });
11235
+ }else {
11236
+ this.rows.forEach((row) => {
11237
+ if(row.modules){
11238
+ delete row.modules.group;
11239
+ }
11240
+ });
11241
+ }
11220
11242
  }
11221
11243
 
11222
11244
  this.element = false;
@@ -11849,7 +11871,7 @@ class GroupRows extends Module{
11849
11871
 
11850
11872
  this.groupIDLookups = [];
11851
11873
 
11852
- if(Array.isArray(groupBy)){
11874
+ if(groupBy){
11853
11875
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
11854
11876
  this.table.modules.columnCalcs.removeCalcs();
11855
11877
  }
@@ -11989,6 +12011,10 @@ class GroupRows extends Module{
11989
12011
  }
11990
12012
 
11991
12013
  this.configureGroupSetup();
12014
+
12015
+ if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
12016
+ this.table.modules.columnCalcs.reinitializeCalcs();
12017
+ }
11992
12018
 
11993
12019
  this.refreshData();
11994
12020
 
@@ -12235,7 +12261,7 @@ class GroupRows extends Module{
12235
12261
  }
12236
12262
 
12237
12263
  Object.values(oldGroups).forEach((group) => {
12238
- group.wipe();
12264
+ group.wipe(true);
12239
12265
  });
12240
12266
  }
12241
12267
 
@@ -14006,7 +14032,7 @@ class MoveColumns extends Module{
14006
14032
 
14007
14033
  config.mousemove = function(e){
14008
14034
  if(column.parent === self.moving.parent){
14009
- if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.element.scrollLeft) > (column.getWidth() / 2)){
14035
+ if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.contentsElement.scrollLeft) > (column.getWidth() / 2)){
14010
14036
  if(self.toCol !== column || !self.toColAfter){
14011
14037
  colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
14012
14038
  self.moveColumn(column, true);
@@ -21365,10 +21391,11 @@ class ColumnManager extends CoreFeature {
21365
21391
 
21366
21392
  scrollToColumn(column, position, ifVisible){
21367
21393
  var left = 0,
21368
- offset = 0,
21394
+ offset = column.getLeftOffset(),
21369
21395
  adjust = 0,
21370
21396
  colEl = column.getElement();
21371
21397
 
21398
+
21372
21399
  return new Promise((resolve, reject) => {
21373
21400
 
21374
21401
  if(typeof position === "undefined"){
@@ -21395,16 +21422,13 @@ class ColumnManager extends CoreFeature {
21395
21422
 
21396
21423
  //check column visibility
21397
21424
  if(!ifVisible){
21398
-
21399
- offset = colEl.offsetLeft;
21400
-
21401
21425
  if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
21402
21426
  return false;
21403
21427
  }
21404
21428
  }
21405
21429
 
21406
21430
  //calculate scroll position
21407
- left = colEl.offsetLeft + adjust;
21431
+ left = offset + adjust;
21408
21432
 
21409
21433
  left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
21410
21434