tabulator-tables 5.2.3 → 5.2.4

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.2.3 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.2.4 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -9,8 +9,8 @@ class CoreFeature{
9
9
  /////////////// DataLoad /////////////////
10
10
  //////////////////////////////////////////
11
11
 
12
- reloadData(data, silent){
13
- return this.table.dataLoader.load(data, undefined, undefined, undefined, silent);
12
+ reloadData(data, silent, columnsChanged){
13
+ return this.table.dataLoader.load(data, undefined, undefined, undefined, silent, columnsChanged);
14
14
  }
15
15
 
16
16
  //////////////////////////////////////////
@@ -4448,6 +4448,10 @@ class DataTree extends Module{
4448
4448
  return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false;
4449
4449
  }
4450
4450
 
4451
+ getTreeParentRoot(row){
4452
+ return row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
4453
+ }
4454
+
4451
4455
  getFilteredTreeChildren(row){
4452
4456
  var config = row.modules.dataTree,
4453
4457
  output = [], children;
@@ -6032,7 +6036,7 @@ class Edit{
6032
6036
  values = this._ajaxRequest(this.params.valuesURL, this.input.value);
6033
6037
  }else {
6034
6038
  if(typeof this.params.valuesLookup === "function"){
6035
- values = this.params.valuesLookup(cell, this.input.value);
6039
+ values = this.params.valuesLookup(this.cell, this.input.value);
6036
6040
  }else if(this.params.valuesLookup){
6037
6041
  values = this._uniqueColumnValues(this.params.valuesLookupField);
6038
6042
  }
@@ -8947,7 +8951,7 @@ class Filter extends Module{
8947
8951
  refreshFilter(){
8948
8952
  if(this.tableInitialized){
8949
8953
  if(this.table.options.filterMode === "remote"){
8950
- this.reloadData();
8954
+ this.reloadData(null, false, false);
8951
8955
  }else {
8952
8956
  this.refreshData(true);
8953
8957
  }
@@ -10308,7 +10312,8 @@ class FrozenColumns extends Module{
10308
10312
  this.table.columnManager.element.style.paddingRight = this.rightMargin;
10309
10313
 
10310
10314
  this.leftColumns.forEach((column, i) => {
10311
- column.modules.frozen.margin = (leftMargin + this.table.columnManager.scrollLeft) + "px";
10315
+ column.modules.frozen.marginValue = leftMargin + this.table.columnManager.scrollLeft;
10316
+ column.modules.frozen.margin = column.modules.frozen.marginValue + "px";
10312
10317
 
10313
10318
  if(column.visible){
10314
10319
  leftMargin += column.getWidth();
@@ -10347,7 +10352,8 @@ class FrozenColumns extends Module{
10347
10352
  rightMargin += column.getWidth();
10348
10353
  }
10349
10354
 
10350
- column.modules.frozen.margin = (this.rightPadding - rightMargin) + "px";
10355
+ column.modules.frozen.marginValue = this.rightPadding - rightMargin;
10356
+ column.modules.frozen.margin = column.modules.frozen.marginValue + "px";
10351
10357
 
10352
10358
  if(i == this.rightColumns.length - 1){
10353
10359
  column.modules.frozen.edge = true;
@@ -11684,6 +11690,10 @@ class GroupRows extends Module{
11684
11690
  getRowGroup(row){
11685
11691
  var match = false;
11686
11692
 
11693
+ if(this.options("dataTree")){
11694
+ row = this.table.modules.dataTree.getTreeParentRoot(row);
11695
+ }
11696
+
11687
11697
  this.groupList.forEach((group) => {
11688
11698
  var result = group.getRowGroup(row);
11689
11699
 
@@ -16603,6 +16613,7 @@ class ResizeColumns extends Module{
16603
16613
 
16604
16614
  this.subscribe("column-hide", this.deInitializeColumn.bind(this));
16605
16615
  this.subscribe("column-show", this.columnLayoutUpdated.bind(this));
16616
+ this.subscribe("column-width", this.columnWidthUpdated.bind(this));
16606
16617
 
16607
16618
  this.subscribe("column-delete", this.deInitializeComponent.bind(this));
16608
16619
  this.subscribe("column-height", this.resizeHandle.bind(this));
@@ -16637,14 +16648,38 @@ class ResizeColumns extends Module{
16637
16648
  }
16638
16649
  }
16639
16650
 
16651
+ columnWidthUpdated(column){
16652
+ if(column.modules.frozen){
16653
+ if(this.table.modules.frozenColumns.leftColumns.includes(column)){
16654
+ this.table.modules.frozenColumns.leftColumns.forEach((col) => {
16655
+ this.reinitializeColumn(col);
16656
+ });
16657
+ }else if(this.table.modules.frozenColumns.rightColumns.includes(column)){
16658
+ this.table.modules.frozenColumns.rightColumns.forEach((col) => {
16659
+ this.reinitializeColumn(col);
16660
+ });
16661
+ }
16662
+ }
16663
+ }
16664
+
16640
16665
  reinitializeColumn(column){
16666
+ var frozenOffset = column.modules.frozen ? (column.modules.frozen.marginValue + column.getWidth() + "px") : false;
16667
+
16641
16668
  column.cells.forEach((cell) => {
16642
16669
  if(cell.modules.resize && cell.modules.resize.handleEl){
16670
+ if(frozenOffset){
16671
+ cell.modules.resize.handleEl.style.left = frozenOffset;
16672
+ }
16673
+
16643
16674
  cell.element.after(cell.modules.resize.handleEl);
16644
16675
  }
16645
16676
  });
16646
16677
 
16647
16678
  if(column.modules.resize && column.modules.resize.handleEl){
16679
+ if(frozenOffset){
16680
+ column.modules.resize.handleEl.style.left = frozenOffset;
16681
+ }
16682
+
16648
16683
  column.element.after(column.modules.resize.handleEl);
16649
16684
  }
16650
16685
  }
@@ -16693,6 +16728,11 @@ class ResizeColumns extends Module{
16693
16728
  }
16694
16729
  });
16695
16730
 
16731
+ if(column.modules.frozen){
16732
+ handle.style.position = "absolute";
16733
+ handle.style.left = column.modules.frozen.marginValue + column.getWidth() + "px";
16734
+ }
16735
+
16696
16736
  config.handleEl = handle;
16697
16737
 
16698
16738
  if(element.parentNode){
@@ -16743,27 +16783,27 @@ class ResizeColumns extends Module{
16743
16783
  startDiff = x - self.startX,
16744
16784
  moveDiff = x - self.latestX,
16745
16785
  blockedBefore, blockedAfter;
16746
-
16786
+
16747
16787
  self.latestX = x;
16748
16788
 
16749
16789
  if(self.table.rtl){
16750
16790
  startDiff = -startDiff;
16751
16791
  moveDiff = -moveDiff;
16752
16792
  }
16753
-
16793
+
16754
16794
  blockedBefore = column.width == column.minWidth || column.width == column.maxWidth;
16755
-
16795
+
16756
16796
  column.setWidth(self.startWidth + startDiff);
16757
-
16797
+
16758
16798
  blockedAfter = column.width == column.minWidth || column.width == column.maxWidth;
16759
-
16799
+
16760
16800
  if(moveDiff < 0){
16761
16801
  self.nextColumn = self.initialNextColumn;
16762
16802
  }
16763
16803
 
16764
16804
  if(self.table.options.resizableColumnFit && self.nextColumn && !(blockedBefore && blockedAfter)){
16765
16805
  let colWidth = self.nextColumn.getWidth();
16766
-
16806
+
16767
16807
  if(moveDiff > 0){
16768
16808
  if(colWidth <= self.nextColumn.minWidth){
16769
16809
  self.nextColumn = self.nextColumn.nextColumn();
@@ -18304,7 +18344,7 @@ class Sort extends Module{
18304
18344
 
18305
18345
  refreshSort(){
18306
18346
  if(this.table.options.sortMode === "remote"){
18307
- this.reloadData();
18347
+ this.reloadData(null, false, false);
18308
18348
  }else {
18309
18349
  this.refreshData(true);
18310
18350
  }
@@ -22855,7 +22895,7 @@ class DataLoader extends CoreFeature{
22855
22895
 
22856
22896
  initialize(){}
22857
22897
 
22858
- load(data, params, config, replace, silent){
22898
+ load(data, params, config, replace, silent, columnsChanged){
22859
22899
  var requestNo = ++this.requestOrder;
22860
22900
 
22861
22901
  this.dispatchExternal("dataLoading", data);
@@ -22891,7 +22931,7 @@ class DataLoader extends CoreFeature{
22891
22931
 
22892
22932
  if(rowData !== false){
22893
22933
  this.dispatchExternal("dataLoaded", rowData);
22894
- this.table.rowManager.setData(rowData, replace, !replace);
22934
+ this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
22895
22935
  }
22896
22936
  }else {
22897
22937
  console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
@@ -22918,7 +22958,7 @@ class DataLoader extends CoreFeature{
22918
22958
  data = [];
22919
22959
  }
22920
22960
 
22921
- this.table.rowManager.setData(data, replace, !replace);
22961
+ this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
22922
22962
  return Promise.resolve();
22923
22963
  }
22924
22964
  }