tabulator-tables 5.2.2 → 5.2.3

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.2 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.2.3 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -4138,11 +4138,24 @@ class DataTree extends Module{
4138
4138
  this.subscribe("edit-cancelled", this.cellValueChanged.bind(this));
4139
4139
  this.subscribe("column-moving-rows", this.columnMoving.bind(this));
4140
4140
  this.subscribe("table-built", this.initializeElementField.bind(this));
4141
+ this.subscribe("table-redrawing", this.tableRedrawing.bind(this));
4141
4142
 
4142
4143
  this.registerDisplayHandler(this.getRows.bind(this), 30);
4143
4144
  }
4144
4145
  }
4145
4146
 
4147
+ tableRedrawing(force){
4148
+ var rows;
4149
+
4150
+ if(force){
4151
+ rows = this.table.rowManager.getRows();
4152
+
4153
+ rows.forEach((row) => {
4154
+ this.reinitializeRowChildren(row);
4155
+ });
4156
+ }
4157
+ }
4158
+
4146
4159
  initializeElementField(){
4147
4160
  var firstCol = this.table.columnManager.getFirstVisibleColumn();
4148
4161
 
@@ -10130,7 +10143,6 @@ class FrozenColumns extends Module{
10130
10143
  this.rightPadding = 0;
10131
10144
  this.initializationMode = "left";
10132
10145
  this.active = false;
10133
- this.scrollEndTimer = false;
10134
10146
  this.blocked = true;
10135
10147
 
10136
10148
  this.registerColumnOption("frozen");
@@ -10159,10 +10171,10 @@ class FrozenColumns extends Module{
10159
10171
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
10160
10172
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
10161
10173
  this.subscribe("columns-loading", this.reset.bind(this));
10162
-
10174
+
10163
10175
  this.subscribe("column-add", this.reinitializeColumns.bind(this));
10164
10176
  this.subscribe("column-delete", this.reinitializeColumns.bind(this));
10165
-
10177
+
10166
10178
  this.subscribe("table-redraw", this.layout.bind(this));
10167
10179
  this.subscribe("layout-refreshing", this.blockLayout.bind(this));
10168
10180
  this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
@@ -10179,10 +10191,10 @@ class FrozenColumns extends Module{
10179
10191
  layoutCell(cell){
10180
10192
  this.layoutElement(cell.element, cell.column);
10181
10193
  }
10182
-
10194
+
10183
10195
  reinitializeColumns(){
10184
10196
  this.reset();
10185
-
10197
+
10186
10198
  this.table.columnManager.columnsByIndex.forEach((column) => {
10187
10199
  this.initializeColumn(column);
10188
10200
  });
@@ -10227,24 +10239,15 @@ class FrozenColumns extends Module{
10227
10239
 
10228
10240
  //quick layout to smooth horizontal scrolling
10229
10241
  scrollHorizontal(){
10230
- var rows;
10231
10242
 
10232
- if(this.active){
10233
- clearTimeout(this.scrollEndTimer);
10234
-
10235
- rows = this.table.rowManager.getVisibleRows();
10236
-
10243
+ if(this.active){
10237
10244
  this.calcMargins(true);
10238
10245
 
10239
10246
  this.layoutColumnPosition();
10240
10247
 
10241
10248
  this.layoutCalcRows();
10242
10249
 
10243
- rows.forEach((row) => {
10244
- if(row.type === "row"){
10245
- this.layoutRow(row);
10246
- }
10247
- });
10250
+ this.reinitializeRows();
10248
10251
  }
10249
10252
  }
10250
10253
 
@@ -10256,7 +10259,7 @@ class FrozenColumns extends Module{
10256
10259
  this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
10257
10260
  this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
10258
10261
  }
10259
-
10262
+
10260
10263
  //calculate right frozen columns
10261
10264
  this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft;
10262
10265
  }
@@ -10303,10 +10306,10 @@ class FrozenColumns extends Module{
10303
10306
 
10304
10307
  this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
10305
10308
  this.table.columnManager.element.style.paddingRight = this.rightMargin;
10306
-
10309
+
10307
10310
  this.leftColumns.forEach((column, i) => {
10308
10311
  column.modules.frozen.margin = (leftMargin + this.table.columnManager.scrollLeft) + "px";
10309
-
10312
+
10310
10313
  if(column.visible){
10311
10314
  leftMargin += column.getWidth();
10312
10315
  }
@@ -10339,11 +10342,11 @@ class FrozenColumns extends Module{
10339
10342
  });
10340
10343
 
10341
10344
  this.rightColumns.forEach((column, i) => {
10342
-
10345
+
10343
10346
  if(column.visible){
10344
10347
  rightMargin += column.getWidth();
10345
10348
  }
10346
-
10349
+
10347
10350
  column.modules.frozen.margin = (this.rightPadding - rightMargin) + "px";
10348
10351
 
10349
10352
  if(i == this.rightColumns.length - 1){
@@ -10372,36 +10375,35 @@ class FrozenColumns extends Module{
10372
10375
  }
10373
10376
 
10374
10377
  //layout columns appropriately
10375
- layout(){
10376
- var visibleRows = [],
10377
- otherRows = [];
10378
-
10378
+ layout(){
10379
10379
  if(this.active && !this.blocked){
10380
10380
  //calculate row padding
10381
10381
  this.calcMargins();
10382
-
10382
+
10383
10383
  //calculate left columns
10384
10384
  this.layoutColumnPosition();
10385
10385
 
10386
- visibleRows = this.table.rowManager.getVisibleRows();
10387
- otherRows = this.table.rowManager.getDisplayRows().filter(row => !visibleRows.includes(row));
10388
-
10389
- otherRows.forEach((row) =>{
10390
- row.deinitialize();
10391
- });
10392
-
10393
- visibleRows.forEach((row) =>{
10394
- if(row.type === "row"){
10395
- this.layoutRow(row);
10396
- }
10397
- });
10386
+ this.reinitializeRows();
10398
10387
 
10399
10388
  this.layoutCalcRows();
10400
-
10401
-
10402
10389
  }
10403
10390
  }
10404
10391
 
10392
+ reinitializeRows(){
10393
+ var visibleRows = this.table.rowManager.getVisibleRows();
10394
+ var otherRows = this.table.rowManager.getRows().filter(row => !visibleRows.includes(row));
10395
+
10396
+ otherRows.forEach((row) =>{
10397
+ row.deinitialize();
10398
+ });
10399
+
10400
+ visibleRows.forEach((row) =>{
10401
+ if(row.type === "row"){
10402
+ this.layoutRow(row);
10403
+ }
10404
+ });
10405
+ }
10406
+
10405
10407
  layoutRow(row){
10406
10408
  // console.trace("row")
10407
10409
  var rowEl = row.getElement();
@@ -13417,7 +13419,7 @@ class MoveColumns extends Module{
13417
13419
  config = {},
13418
13420
  colEl;
13419
13421
 
13420
- if(!column.modules.frozen){
13422
+ if(!column.modules.frozen && !column.isGroup){
13421
13423
  colEl = column.getElement();
13422
13424
 
13423
13425
  config.mousemove = function(e){
@@ -15880,6 +15882,7 @@ class Persistence extends Module{
15880
15882
  if(this.config.columns === true || this.config.columns == undefined){
15881
15883
  keys = Object.keys(colDef);
15882
15884
  keys.push("width");
15885
+ keys.push("visible");
15883
15886
  }else {
15884
15887
  keys = this.config.columns;
15885
15888
  }
@@ -18874,7 +18877,7 @@ class Validate extends Module{
18874
18877
  var invalid = [];
18875
18878
 
18876
18879
  column.cells.forEach((cell) => {
18877
- if(!this.cellValidate(cell)){
18880
+ if(this.cellValidate(cell) !== true){
18878
18881
  invalid.push(cell.getComponent());
18879
18882
  }
18880
18883
  });
@@ -18890,7 +18893,7 @@ class Validate extends Module{
18890
18893
  var invalid = [];
18891
18894
 
18892
18895
  row.cells.forEach((cell) => {
18893
- if(!this.cellValidate(cell)){
18896
+ if(this.cellValidate(cell) !== true){
18894
18897
  invalid.push(cell.getComponent());
18895
18898
  }
18896
18899
  });
@@ -19417,6 +19420,8 @@ class Renderer extends CoreFeature{
19417
19420
  this.elementVertical.scrollTop = this.elementVertical.scrollTop - this.elementVertical.clientHeight + rowEl.offsetHeight;
19418
19421
  }
19419
19422
 
19423
+ case "top":
19424
+ this.elementVertical.scrollTop = rowEl.offsetTop;
19420
19425
  break;
19421
19426
  }
19422
19427
 
@@ -22168,7 +22173,9 @@ class RowManager extends CoreFeature{
22168
22173
  this.redrawBlockRenderInPosition = true;
22169
22174
  }
22170
22175
  }else {
22176
+ this.dispatchExternal("renderStarted");
22171
22177
  this.renderer.rerenderRows(callback);
22178
+ this.dispatchExternal("renderComplete");
22172
22179
  }
22173
22180
  }
22174
22181