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.
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.4.0 (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);
@@ -6015,6 +6035,7 @@ class Edit{
6015
6035
  this.listIteration = 0;
6016
6036
 
6017
6037
  this.lastAction="";
6038
+ this.filterTerm="";
6018
6039
 
6019
6040
  this.blurable = true;
6020
6041
 
@@ -9306,9 +9327,9 @@ class Filter extends Module{
9306
9327
  });
9307
9328
 
9308
9329
  editorElement.addEventListener("focus", (e) => {
9309
- var left = this.table.columnManager.element.scrollLeft;
9330
+ var left = this.table.columnManager.contentsElement.scrollLeft;
9310
9331
 
9311
- var headerPos = this.table.rowManager.element.scrollLeft + parseInt(this.table.columnManager.element.style.marginLeft);
9332
+ var headerPos = this.table.rowManager.element.scrollLeft;
9312
9333
 
9313
9334
  if(left !== headerPos){
9314
9335
  this.table.rowManager.scrollHorizontal(left);
@@ -11205,17 +11226,19 @@ class Group{
11205
11226
  this.createValueGroups();
11206
11227
  }
11207
11228
 
11208
- wipe(){
11209
- if(this.groupList.length){
11210
- this.groupList.forEach(function(group){
11211
- group.wipe();
11212
- });
11213
- }else {
11214
- this.rows.forEach((row) => {
11215
- if(row.modules){
11216
- delete row.modules.group;
11217
- }
11218
- });
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
+ }
11219
11242
  }
11220
11243
 
11221
11244
  this.element = false;
@@ -11848,7 +11871,7 @@ class GroupRows extends Module{
11848
11871
 
11849
11872
  this.groupIDLookups = [];
11850
11873
 
11851
- if(Array.isArray(groupBy)){
11874
+ if(groupBy){
11852
11875
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
11853
11876
  this.table.modules.columnCalcs.removeCalcs();
11854
11877
  }
@@ -11988,6 +12011,10 @@ class GroupRows extends Module{
11988
12011
  }
11989
12012
 
11990
12013
  this.configureGroupSetup();
12014
+
12015
+ if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
12016
+ this.table.modules.columnCalcs.reinitializeCalcs();
12017
+ }
11991
12018
 
11992
12019
  this.refreshData();
11993
12020
 
@@ -12143,6 +12170,9 @@ class GroupRows extends Module{
12143
12170
  this.groupList.forEach(function(group){
12144
12171
  group.wipe();
12145
12172
  });
12173
+
12174
+ this.groupList = [];
12175
+ this.groups = {};
12146
12176
  }
12147
12177
  }
12148
12178
 
@@ -12229,8 +12259,13 @@ class GroupRows extends Module{
12229
12259
  this.assignRowToGroup(row, oldGroups);
12230
12260
  });
12231
12261
  }
12262
+
12263
+ Object.values(oldGroups).forEach((group) => {
12264
+ group.wipe(true);
12265
+ });
12232
12266
  }
12233
12267
 
12268
+
12234
12269
  createGroup(groupID, level, oldGroups){
12235
12270
  var groupKey = level + "_" + groupID,
12236
12271
  group;
@@ -13997,7 +14032,7 @@ class MoveColumns extends Module{
13997
14032
 
13998
14033
  config.mousemove = function(e){
13999
14034
  if(column.parent === self.moving.parent){
14000
- 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)){
14001
14036
  if(self.toCol !== column || !self.toColAfter){
14002
14037
  colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
14003
14038
  self.moveColumn(column, true);
@@ -15596,6 +15631,7 @@ class Page extends Module{
15596
15631
  if(!this.initialLoad){
15597
15632
  if(this.mode == "local" || force){
15598
15633
  this.page = 1;
15634
+ this.trackChanges();
15599
15635
  }
15600
15636
  }
15601
15637
  }
@@ -20595,6 +20631,12 @@ class VirtualDomHorizontal extends Renderer{
20595
20631
  this.fitDataColActualWidthCheck(column);
20596
20632
 
20597
20633
  this.rightCol++; // Don't move this below the >= check below
20634
+
20635
+ this.getVisibleRows().forEach((row) => {
20636
+ if(row.type !== "group"){
20637
+ row.modules.vdomHoz.rightCol = this.rightCol;
20638
+ }
20639
+ });
20598
20640
 
20599
20641
  if(this.rightCol >= (this.columns.length - 1)){
20600
20642
  this.vDomPadRight = 0;
@@ -20634,6 +20676,12 @@ class VirtualDomHorizontal extends Renderer{
20634
20676
  });
20635
20677
 
20636
20678
  this.leftCol--; // don't move this below the <= check below
20679
+
20680
+ this.getVisibleRows().forEach((row) => {
20681
+ if(row.type !== "group"){
20682
+ row.modules.vdomHoz.leftCol = this.leftCol;
20683
+ }
20684
+ });
20637
20685
 
20638
20686
  if(this.leftCol <= 0){ // replicating logic in addColRight
20639
20687
  this.vDomPadLeft = 0;
@@ -20686,6 +20734,12 @@ class VirtualDomHorizontal extends Renderer{
20686
20734
 
20687
20735
  this.vDomPadRight += column.getWidth();
20688
20736
  this.rightCol --;
20737
+
20738
+ this.getVisibleRows().forEach((row) => {
20739
+ if(row.type !== "group"){
20740
+ row.modules.vdomHoz.rightCol = this.rightCol;
20741
+ }
20742
+ });
20689
20743
  }else {
20690
20744
  working = false;
20691
20745
  }
@@ -20724,6 +20778,12 @@ class VirtualDomHorizontal extends Renderer{
20724
20778
 
20725
20779
  this.vDomPadLeft += column.getWidth();
20726
20780
  this.leftCol ++;
20781
+
20782
+ this.getVisibleRows().forEach((row) => {
20783
+ if(row.type !== "group"){
20784
+ row.modules.vdomHoz.leftCol = this.leftCol;
20785
+ }
20786
+ });
20727
20787
  }else {
20728
20788
  working = false;
20729
20789
  }
@@ -21331,10 +21391,11 @@ class ColumnManager extends CoreFeature {
21331
21391
 
21332
21392
  scrollToColumn(column, position, ifVisible){
21333
21393
  var left = 0,
21334
- offset = 0,
21394
+ offset = column.getLeftOffset(),
21335
21395
  adjust = 0,
21336
21396
  colEl = column.getElement();
21337
21397
 
21398
+
21338
21399
  return new Promise((resolve, reject) => {
21339
21400
 
21340
21401
  if(typeof position === "undefined"){
@@ -21361,16 +21422,13 @@ class ColumnManager extends CoreFeature {
21361
21422
 
21362
21423
  //check column visibility
21363
21424
  if(!ifVisible){
21364
-
21365
- offset = colEl.offsetLeft;
21366
-
21367
21425
  if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
21368
21426
  return false;
21369
21427
  }
21370
21428
  }
21371
21429
 
21372
21430
  //calculate scroll position
21373
- left = colEl.offsetLeft + adjust;
21431
+ left = offset + adjust;
21374
21432
 
21375
21433
  left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
21376
21434