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
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -2442,6 +2442,8 @@
2442
2442
  _this2.elementVertical.scrollTop = _this2.elementVertical.scrollTop - _this2.elementVertical.clientHeight + rowEl.offsetHeight;
2443
2443
  }
2444
2444
 
2445
+ case "top":
2446
+ _this2.elementVertical.scrollTop = rowEl.offsetTop;
2445
2447
  break;
2446
2448
  }
2447
2449
 
@@ -5913,7 +5915,9 @@
5913
5915
  this.redrawBlockRenderInPosition = true;
5914
5916
  }
5915
5917
  } else {
5918
+ this.dispatchExternal("renderStarted");
5916
5919
  this.renderer.rerenderRows(callback);
5920
+ this.dispatchExternal("renderComplete");
5917
5921
  }
5918
5922
  }
5919
5923
  }, {
@@ -10997,9 +11001,24 @@
10997
11001
  this.subscribe("edit-cancelled", this.cellValueChanged.bind(this));
10998
11002
  this.subscribe("column-moving-rows", this.columnMoving.bind(this));
10999
11003
  this.subscribe("table-built", this.initializeElementField.bind(this));
11004
+ this.subscribe("table-redrawing", this.tableRedrawing.bind(this));
11000
11005
  this.registerDisplayHandler(this.getRows.bind(this), 30);
11001
11006
  }
11002
11007
  }
11008
+ }, {
11009
+ key: "tableRedrawing",
11010
+ value: function tableRedrawing(force) {
11011
+ var _this2 = this;
11012
+
11013
+ var rows;
11014
+
11015
+ if (force) {
11016
+ rows = this.table.rowManager.getRows();
11017
+ rows.forEach(function (row) {
11018
+ _this2.reinitializeRowChildren(row);
11019
+ });
11020
+ }
11021
+ }
11003
11022
  }, {
11004
11023
  key: "initializeElementField",
11005
11024
  value: function initializeElementField() {
@@ -11014,11 +11033,11 @@
11014
11033
  }, {
11015
11034
  key: "columnMoving",
11016
11035
  value: function columnMoving() {
11017
- var _this2 = this;
11036
+ var _this3 = this;
11018
11037
 
11019
11038
  var rows = [];
11020
11039
  this.table.rowManager.rows.forEach(function (row) {
11021
- rows = rows.concat(_this2.getTreeChildren(row, false, true));
11040
+ rows = rows.concat(_this3.getTreeChildren(row, false, true));
11022
11041
  });
11023
11042
  return rows;
11024
11043
  }
@@ -11123,7 +11142,7 @@
11123
11142
  }, {
11124
11143
  key: "generateControlElement",
11125
11144
  value: function generateControlElement(row, el) {
11126
- var _this3 = this;
11145
+ var _this4 = this;
11127
11146
 
11128
11147
  var config = row.modules.dataTree,
11129
11148
  el = el || row.getCells()[0].getElement(),
@@ -11135,14 +11154,14 @@
11135
11154
  config.controlEl.addEventListener("click", function (e) {
11136
11155
  e.stopPropagation();
11137
11156
 
11138
- _this3.collapseRow(row);
11157
+ _this4.collapseRow(row);
11139
11158
  });
11140
11159
  } else {
11141
11160
  config.controlEl = this.expandEl.cloneNode(true);
11142
11161
  config.controlEl.addEventListener("click", function (e) {
11143
11162
  e.stopPropagation();
11144
11163
 
11145
- _this3.expandRow(row);
11164
+ _this4.expandRow(row);
11146
11165
  });
11147
11166
  }
11148
11167
 
@@ -11170,7 +11189,7 @@
11170
11189
  }, {
11171
11190
  key: "getRows",
11172
11191
  value: function getRows(rows) {
11173
- var _this4 = this;
11192
+ var _this5 = this;
11174
11193
 
11175
11194
  var output = [];
11176
11195
  rows.forEach(function (row, i) {
@@ -11182,7 +11201,7 @@
11182
11201
  config = row.modules.dataTree.children;
11183
11202
 
11184
11203
  if (!config.index && config.children !== false) {
11185
- children = _this4.getChildren(row);
11204
+ children = _this5.getChildren(row);
11186
11205
  children.forEach(function (child) {
11187
11206
  child.create();
11188
11207
  output.push(child);
@@ -11195,7 +11214,7 @@
11195
11214
  }, {
11196
11215
  key: "getChildren",
11197
11216
  value: function getChildren(row, allChildren) {
11198
- var _this5 = this;
11217
+ var _this6 = this;
11199
11218
 
11200
11219
  var config = row.modules.dataTree,
11201
11220
  children = [],
@@ -11219,7 +11238,7 @@
11219
11238
  children.forEach(function (child) {
11220
11239
  output.push(child);
11221
11240
 
11222
- var subChildren = _this5.getChildren(child);
11241
+ var subChildren = _this6.getChildren(child);
11223
11242
 
11224
11243
  subChildren.forEach(function (sub) {
11225
11244
  output.push(sub);
@@ -11232,7 +11251,7 @@
11232
11251
  }, {
11233
11252
  key: "generateChildren",
11234
11253
  value: function generateChildren(row) {
11235
- var _this6 = this;
11254
+ var _this7 = this;
11236
11255
 
11237
11256
  var children = [];
11238
11257
  var childArray = row.getData()[this.field];
@@ -11242,13 +11261,13 @@
11242
11261
  }
11243
11262
 
11244
11263
  childArray.forEach(function (childData) {
11245
- var childRow = new Row(childData || {}, _this6.table.rowManager);
11264
+ var childRow = new Row(childData || {}, _this7.table.rowManager);
11246
11265
  childRow.create();
11247
11266
  childRow.modules.dataTree.index = row.modules.dataTree.index + 1;
11248
11267
  childRow.modules.dataTree.parent = row;
11249
11268
 
11250
11269
  if (childRow.modules.dataTree.children) {
11251
- childRow.modules.dataTree.open = _this6.startOpen(childRow.getComponent(), childRow.modules.dataTree.index);
11270
+ childRow.modules.dataTree.open = _this7.startOpen(childRow.getComponent(), childRow.modules.dataTree.index);
11252
11271
  }
11253
11272
 
11254
11273
  children.push(childRow);
@@ -11389,7 +11408,7 @@
11389
11408
  }, {
11390
11409
  key: "findChildIndex",
11391
11410
  value: function findChildIndex(subject, parent) {
11392
- var _this7 = this;
11411
+ var _this8 = this;
11393
11412
 
11394
11413
  var match = false;
11395
11414
 
@@ -11416,7 +11435,7 @@
11416
11435
  } else {
11417
11436
  //subject should be treated as the index of the row
11418
11437
  match = parent.data[this.field].find(function (row) {
11419
- return row.data[_this7.table.options.index] == subject;
11438
+ return row.data[_this8.table.options.index] == subject;
11420
11439
  });
11421
11440
  }
11422
11441
 
@@ -11436,7 +11455,7 @@
11436
11455
  }, {
11437
11456
  key: "getTreeChildren",
11438
11457
  value: function getTreeChildren(row, component, recurse) {
11439
- var _this8 = this;
11458
+ var _this9 = this;
11440
11459
 
11441
11460
  var config = row.modules.dataTree,
11442
11461
  output = [];
@@ -11451,7 +11470,7 @@
11451
11470
  output.push(component ? childRow.getComponent() : childRow);
11452
11471
 
11453
11472
  if (recurse) {
11454
- output = output.concat(_this8.getTreeChildren(childRow, component, recurse));
11473
+ output = output.concat(_this9.getTreeChildren(childRow, component, recurse));
11455
11474
  }
11456
11475
  }
11457
11476
  });
@@ -17189,7 +17208,6 @@
17189
17208
  _this.rightPadding = 0;
17190
17209
  _this.initializationMode = "left";
17191
17210
  _this.active = false;
17192
- _this.scrollEndTimer = false;
17193
17211
  _this.blocked = true;
17194
17212
 
17195
17213
  _this.registerColumnOption("frozen");
@@ -17296,21 +17314,12 @@
17296
17314
  }, {
17297
17315
  key: "scrollHorizontal",
17298
17316
  value: function scrollHorizontal() {
17299
- var _this3 = this;
17300
-
17301
- var rows;
17302
17317
 
17303
17318
  if (this.active) {
17304
- clearTimeout(this.scrollEndTimer);
17305
- rows = this.table.rowManager.getVisibleRows();
17306
17319
  this.calcMargins(true);
17307
17320
  this.layoutColumnPosition();
17308
17321
  this.layoutCalcRows();
17309
- rows.forEach(function (row) {
17310
- if (row.type === "row") {
17311
- _this3.layoutRow(row);
17312
- }
17313
- });
17322
+ this.reinitializeRows();
17314
17323
  }
17315
17324
  } //calculate margins for rows
17316
17325
 
@@ -17347,19 +17356,19 @@
17347
17356
  }, {
17348
17357
  key: "layoutGroupCalcs",
17349
17358
  value: function layoutGroupCalcs(groups) {
17350
- var _this4 = this;
17359
+ var _this3 = this;
17351
17360
 
17352
17361
  groups.forEach(function (group) {
17353
17362
  if (group.calcs.top) {
17354
- _this4.layoutRow(group.calcs.top);
17363
+ _this3.layoutRow(group.calcs.top);
17355
17364
  }
17356
17365
 
17357
17366
  if (group.calcs.bottom) {
17358
- _this4.layoutRow(group.calcs.bottom);
17367
+ _this3.layoutRow(group.calcs.bottom);
17359
17368
  }
17360
17369
 
17361
17370
  if (group.groupList && group.groupList.length) {
17362
- _this4.layoutGroupCalcs(group.groupList && group.groupList);
17371
+ _this3.layoutGroupCalcs(group.groupList && group.groupList);
17363
17372
  }
17364
17373
  });
17365
17374
  } //calculate column positions and layout headers
@@ -17367,7 +17376,7 @@
17367
17376
  }, {
17368
17377
  key: "layoutColumnPosition",
17369
17378
  value: function layoutColumnPosition(allCells) {
17370
- var _this5 = this;
17379
+ var _this4 = this;
17371
17380
 
17372
17381
  var leftParents = [];
17373
17382
  var leftMargin = 0;
@@ -17375,23 +17384,23 @@
17375
17384
  this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
17376
17385
  this.table.columnManager.element.style.paddingRight = this.rightMargin;
17377
17386
  this.leftColumns.forEach(function (column, i) {
17378
- column.modules.frozen.margin = leftMargin + _this5.table.columnManager.scrollLeft + "px";
17387
+ column.modules.frozen.margin = leftMargin + _this4.table.columnManager.scrollLeft + "px";
17379
17388
 
17380
17389
  if (column.visible) {
17381
17390
  leftMargin += column.getWidth();
17382
17391
  }
17383
17392
 
17384
- if (i == _this5.leftColumns.length - 1) {
17393
+ if (i == _this4.leftColumns.length - 1) {
17385
17394
  column.modules.frozen.edge = true;
17386
17395
  } else {
17387
17396
  column.modules.frozen.edge = false;
17388
17397
  }
17389
17398
 
17390
17399
  if (column.parent.isGroup) {
17391
- var parentEl = _this5.getColGroupParentElement(column);
17400
+ var parentEl = _this4.getColGroupParentElement(column);
17392
17401
 
17393
17402
  if (!leftParents.includes(parentEl)) {
17394
- _this5.layoutElement(parentEl, column);
17403
+ _this4.layoutElement(parentEl, column);
17395
17404
 
17396
17405
  leftParents.push(parentEl);
17397
17406
  }
@@ -17400,12 +17409,12 @@
17400
17409
  parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position);
17401
17410
  }
17402
17411
  } else {
17403
- _this5.layoutElement(column.getElement(), column);
17412
+ _this4.layoutElement(column.getElement(), column);
17404
17413
  }
17405
17414
 
17406
17415
  if (allCells) {
17407
17416
  column.cells.forEach(function (cell) {
17408
- _this5.layoutElement(cell.getElement(true), column);
17417
+ _this4.layoutElement(cell.getElement(true), column);
17409
17418
  });
17410
17419
  }
17411
17420
  });
@@ -17414,23 +17423,23 @@
17414
17423
  rightMargin += column.getWidth();
17415
17424
  }
17416
17425
 
17417
- column.modules.frozen.margin = _this5.rightPadding - rightMargin + "px";
17426
+ column.modules.frozen.margin = _this4.rightPadding - rightMargin + "px";
17418
17427
 
17419
- if (i == _this5.rightColumns.length - 1) {
17428
+ if (i == _this4.rightColumns.length - 1) {
17420
17429
  column.modules.frozen.edge = true;
17421
17430
  } else {
17422
17431
  column.modules.frozen.edge = false;
17423
17432
  }
17424
17433
 
17425
17434
  if (column.parent.isGroup) {
17426
- _this5.layoutElement(_this5.getColGroupParentElement(column), column);
17435
+ _this4.layoutElement(_this4.getColGroupParentElement(column), column);
17427
17436
  } else {
17428
- _this5.layoutElement(column.getElement(), column);
17437
+ _this4.layoutElement(column.getElement(), column);
17429
17438
  }
17430
17439
 
17431
17440
  if (allCells) {
17432
17441
  column.cells.forEach(function (cell) {
17433
- _this5.layoutElement(cell.getElement(true), column);
17442
+ _this4.layoutElement(cell.getElement(true), column);
17434
17443
  });
17435
17444
  }
17436
17445
  });
@@ -17444,35 +17453,37 @@
17444
17453
  }, {
17445
17454
  key: "layout",
17446
17455
  value: function layout() {
17447
- var _this6 = this;
17448
-
17449
- var visibleRows = [],
17450
- otherRows = [];
17451
-
17452
17456
  if (this.active && !this.blocked) {
17453
17457
  //calculate row padding
17454
17458
  this.calcMargins(); //calculate left columns
17455
17459
 
17456
17460
  this.layoutColumnPosition();
17457
- visibleRows = this.table.rowManager.getVisibleRows();
17458
- otherRows = this.table.rowManager.getDisplayRows().filter(function (row) {
17459
- return !visibleRows.includes(row);
17460
- });
17461
- otherRows.forEach(function (row) {
17462
- row.deinitialize();
17463
- });
17464
- visibleRows.forEach(function (row) {
17465
- if (row.type === "row") {
17466
- _this6.layoutRow(row);
17467
- }
17468
- });
17461
+ this.reinitializeRows();
17469
17462
  this.layoutCalcRows();
17470
17463
  }
17471
17464
  }
17465
+ }, {
17466
+ key: "reinitializeRows",
17467
+ value: function reinitializeRows() {
17468
+ var _this5 = this;
17469
+
17470
+ var visibleRows = this.table.rowManager.getVisibleRows();
17471
+ var otherRows = this.table.rowManager.getRows().filter(function (row) {
17472
+ return !visibleRows.includes(row);
17473
+ });
17474
+ otherRows.forEach(function (row) {
17475
+ row.deinitialize();
17476
+ });
17477
+ visibleRows.forEach(function (row) {
17478
+ if (row.type === "row") {
17479
+ _this5.layoutRow(row);
17480
+ }
17481
+ });
17482
+ }
17472
17483
  }, {
17473
17484
  key: "layoutRow",
17474
17485
  value: function layoutRow(row) {
17475
- var _this7 = this;
17486
+ var _this6 = this;
17476
17487
 
17477
17488
  // console.trace("row")
17478
17489
  var rowEl = row.getElement();
@@ -17486,14 +17497,14 @@
17486
17497
  var cell = row.getCell(column);
17487
17498
 
17488
17499
  if (cell) {
17489
- _this7.layoutElement(cell.getElement(true), column);
17500
+ _this6.layoutElement(cell.getElement(true), column);
17490
17501
  }
17491
17502
  });
17492
17503
  this.rightColumns.forEach(function (column) {
17493
17504
  var cell = row.getCell(column);
17494
17505
 
17495
17506
  if (cell) {
17496
- _this7.layoutElement(cell.getElement(true), column);
17507
+ _this6.layoutElement(cell.getElement(true), column);
17497
17508
  }
17498
17509
  });
17499
17510
  }
@@ -20679,7 +20690,7 @@
20679
20690
  config = {},
20680
20691
  colEl;
20681
20692
 
20682
- if (!column.modules.frozen) {
20693
+ if (!column.modules.frozen && !column.isGroup) {
20683
20694
  colEl = column.getElement();
20684
20695
 
20685
20696
  config.mousemove = function (e) {
@@ -23245,6 +23256,7 @@
23245
23256
  if (_this3.config.columns === true || _this3.config.columns == undefined) {
23246
23257
  keys = Object.keys(colDef);
23247
23258
  keys.push("width");
23259
+ keys.push("visible");
23248
23260
  } else {
23249
23261
  keys = _this3.config.columns;
23250
23262
  }
@@ -26442,7 +26454,7 @@
26442
26454
 
26443
26455
  var invalid = [];
26444
26456
  column.cells.forEach(function (cell) {
26445
- if (!_this3.cellValidate(cell)) {
26457
+ if (_this3.cellValidate(cell) !== true) {
26446
26458
  invalid.push(cell.getComponent());
26447
26459
  }
26448
26460
  });
@@ -26458,7 +26470,7 @@
26458
26470
 
26459
26471
  var invalid = [];
26460
26472
  row.cells.forEach(function (cell) {
26461
- if (!_this4.cellValidate(cell)) {
26473
+ if (_this4.cellValidate(cell) !== true) {
26462
26474
  invalid.push(cell.getComponent());
26463
26475
  }
26464
26476
  });