tabulator-tables 5.5.0 → 5.5.1

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.
Files changed (72) hide show
  1. package/bower.json +1 -1
  2. package/build/Bundler.js +7 -3
  3. package/dist/css/tabulator.css +5 -0
  4. package/dist/css/tabulator.css.map +1 -1
  5. package/dist/css/tabulator.min.css +1 -1
  6. package/dist/css/tabulator.min.css.map +1 -1
  7. package/dist/css/tabulator_bootstrap3.css +5 -0
  8. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  9. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  10. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  11. package/dist/css/tabulator_bootstrap4.css +5 -0
  12. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  13. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  14. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  15. package/dist/css/tabulator_bootstrap5.css +5 -0
  16. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  17. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  18. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  19. package/dist/css/tabulator_bulma.css +5 -0
  20. package/dist/css/tabulator_bulma.css.map +1 -1
  21. package/dist/css/tabulator_bulma.min.css +1 -1
  22. package/dist/css/tabulator_bulma.min.css.map +1 -1
  23. package/dist/css/tabulator_materialize.css +20 -15
  24. package/dist/css/tabulator_materialize.css.map +1 -1
  25. package/dist/css/tabulator_materialize.min.css +1 -1
  26. package/dist/css/tabulator_materialize.min.css.map +1 -1
  27. package/dist/css/tabulator_midnight.css +5 -0
  28. package/dist/css/tabulator_midnight.css.map +1 -1
  29. package/dist/css/tabulator_midnight.min.css +1 -1
  30. package/dist/css/tabulator_midnight.min.css.map +1 -1
  31. package/dist/css/tabulator_modern.css +5 -0
  32. package/dist/css/tabulator_modern.css.map +1 -1
  33. package/dist/css/tabulator_modern.min.css +1 -1
  34. package/dist/css/tabulator_modern.min.css.map +1 -1
  35. package/dist/css/tabulator_semanticui.css +7 -2
  36. package/dist/css/tabulator_semanticui.css.map +1 -1
  37. package/dist/css/tabulator_semanticui.min.css +1 -1
  38. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  39. package/dist/css/tabulator_simple.css +5 -0
  40. package/dist/css/tabulator_simple.css.map +1 -1
  41. package/dist/css/tabulator_simple.min.css +1 -1
  42. package/dist/css/tabulator_simple.min.css.map +1 -1
  43. package/dist/css/tabulator_site.css +5 -0
  44. package/dist/css/tabulator_site.css.map +1 -1
  45. package/dist/css/tabulator_site.min.css +1 -1
  46. package/dist/css/tabulator_site.min.css.map +1 -1
  47. package/dist/js/jquery_wrapper.js +10 -2
  48. package/dist/js/tabulator.js +155 -90
  49. package/dist/js/tabulator.js.map +1 -1
  50. package/dist/js/tabulator.min.js +2 -2
  51. package/dist/js/tabulator.min.js.map +1 -1
  52. package/dist/js/tabulator_esm.js +155 -90
  53. package/dist/js/tabulator_esm.js.map +1 -1
  54. package/dist/js/tabulator_esm.min.js +2 -2
  55. package/dist/js/tabulator_esm.min.js.map +1 -1
  56. package/package.json +3 -2
  57. package/src/js/builds/jquery_wrapper.js +10 -2
  58. package/src/js/core/RowManager.js +2 -0
  59. package/src/js/core/rendering/renderers/BasicHorizontal.js +9 -7
  60. package/src/js/core/rendering/renderers/BasicVertical.js +43 -25
  61. package/src/js/core/rendering/renderers/VirtualDomVertical.js +6 -3
  62. package/src/js/core/row/Row.js +9 -3
  63. package/src/js/core/tools/DataLoader.js +44 -36
  64. package/src/js/modules/DataTree/DataTree.js +4 -1
  65. package/src/js/modules/GroupRows/Group.js +27 -10
  66. package/src/js/modules/History/defaults/redoers.js +4 -2
  67. package/src/js/modules/History/defaults/undoers.js +6 -2
  68. package/src/scss/tabulator.scss +5 -0
  69. package/src/scss/themes/materialize/tabulator_materialize.scss +2 -2
  70. package/src/scss/themes/materialize/variables.scss +1 -1
  71. package/src/scss/themes/semanticui/tabulator_semanticui.scss +1 -1
  72. package/src/scss/themes/semanticui/variables_table.scss +1 -1
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.5.0 (c) Oliver Folkerd 2023 */
1
+ /* Tabulator v5.5.1 (c) Oliver Folkerd 2023 */
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) :
@@ -1997,19 +1997,21 @@
1997
1997
  constructor(table){
1998
1998
  super(table);
1999
1999
  }
2000
-
2001
- renderRowCells(row) {
2000
+
2001
+ renderRowCells(row, inFragment) {
2002
2002
  const rowFrag = document.createDocumentFragment();
2003
2003
  row.cells.forEach((cell) => {
2004
2004
  rowFrag.appendChild(cell.getElement());
2005
2005
  });
2006
2006
  row.element.appendChild(rowFrag);
2007
-
2008
- row.cells.forEach((cell) => {
2009
- cell.cellRendered();
2010
- });
2007
+
2008
+ if(!inFragment){
2009
+ row.cells.forEach((cell) => {
2010
+ cell.cellRendered();
2011
+ });
2012
+ }
2011
2013
  }
2012
-
2014
+
2013
2015
  reinitializeColumnWidths(columns){
2014
2016
  columns.forEach(function(column){
2015
2017
  column.reinitializeWidth();
@@ -3493,7 +3495,7 @@
3493
3495
  }
3494
3496
 
3495
3497
  //functions to setup on first render
3496
- initialize(force){
3498
+ initialize(force, inFragment){
3497
3499
  this.create();
3498
3500
 
3499
3501
  if(!this.initialized || force){
@@ -3508,7 +3510,7 @@
3508
3510
 
3509
3511
  this.initialized = true;
3510
3512
 
3511
- this.table.columnManager.renderer.renderRowCells(this);
3513
+ this.table.columnManager.renderer.renderRowCells(this, inFragment);
3512
3514
 
3513
3515
  if(force){
3514
3516
  this.normalizeHeight();
@@ -3522,9 +3524,15 @@
3522
3524
 
3523
3525
  this.dispatch("row-layout-after", this);
3524
3526
  }else {
3525
- this.table.columnManager.renderer.rerenderRowCells(this);
3527
+ this.table.columnManager.renderer.rerenderRowCells(this, inFragment);
3526
3528
  }
3527
3529
  }
3530
+
3531
+ rendered(){
3532
+ this.cells.forEach((cell) => {
3533
+ cell.cellRendered();
3534
+ });
3535
+ }
3528
3536
 
3529
3537
  reinitializeHeight(){
3530
3538
  this.heightInitialized = false;
@@ -3887,82 +3895,100 @@
3887
3895
  class BasicVertical extends Renderer{
3888
3896
  constructor(table){
3889
3897
  super(table);
3890
-
3898
+
3891
3899
  this.verticalFillMode = "fill";
3892
-
3900
+
3893
3901
  this.scrollTop = 0;
3894
3902
  this.scrollLeft = 0;
3895
-
3903
+
3896
3904
  this.scrollTop = 0;
3897
3905
  this.scrollLeft = 0;
3898
3906
  }
3899
-
3907
+
3900
3908
  clearRows(){
3901
3909
  var element = this.tableElement;
3902
-
3910
+
3903
3911
  // element.children.detach();
3904
3912
  while(element.firstChild) element.removeChild(element.firstChild);
3905
-
3913
+
3906
3914
  element.scrollTop = 0;
3907
3915
  element.scrollLeft = 0;
3908
-
3916
+
3909
3917
  element.style.minWidth = "";
3910
3918
  element.style.minHeight = "";
3911
3919
  element.style.display = "";
3912
3920
  element.style.visibility = "";
3913
3921
  }
3914
-
3922
+
3915
3923
  renderRows() {
3916
3924
  var element = this.tableElement,
3917
3925
  onlyGroupHeaders = true,
3918
- tableFrag = document.createDocumentFragment();
3919
-
3920
- this.rows().forEach((row, index) => {
3926
+ tableFrag = document.createDocumentFragment(),
3927
+ rows = this.rows();
3928
+
3929
+ rows.forEach((row, index) => {
3921
3930
  this.styleRow(row, index);
3922
- row.initialize(true);
3923
-
3931
+ row.initialize(false, true);
3932
+
3924
3933
  if (row.type !== "group") {
3925
3934
  onlyGroupHeaders = false;
3926
3935
  }
3927
-
3936
+
3928
3937
  tableFrag.appendChild(row.getElement());
3929
3938
  });
3939
+
3930
3940
  element.appendChild(tableFrag);
3931
-
3941
+
3942
+ rows.forEach((row) => {
3943
+ row.rendered();
3944
+
3945
+ if(!row.heightInitialized) {
3946
+ row.calcHeight(true);
3947
+ }
3948
+ });
3949
+
3950
+ rows.forEach((row) => {
3951
+ if(!row.heightInitialized) {
3952
+ row.setCellHeight();
3953
+ }
3954
+ });
3955
+
3956
+
3957
+
3932
3958
  if(onlyGroupHeaders){
3933
3959
  element.style.minWidth = this.table.columnManager.getWidth() + "px";
3934
3960
  }else {
3935
3961
  element.style.minWidth = "";
3936
3962
  }
3937
3963
  }
3938
-
3939
-
3964
+
3965
+
3940
3966
  rerenderRows(callback){
3941
3967
  this.clearRows();
3942
-
3968
+
3943
3969
  if(callback){
3944
3970
  callback();
3945
3971
  }
3946
-
3972
+
3947
3973
  this.renderRows();
3948
3974
  }
3949
-
3975
+
3950
3976
  scrollToRowNearestTop(row){
3951
3977
  var rowTop = Helpers.elOffset(row.getElement()).top;
3952
-
3978
+
3953
3979
  return !(Math.abs(this.elementVertical.scrollTop - rowTop) > Math.abs(this.elementVertical.scrollTop + this.elementVertical.clientHeight - rowTop));
3954
3980
  }
3955
-
3981
+
3956
3982
  scrollToRow(row){
3957
3983
  var rowEl = row.getElement();
3958
-
3984
+
3959
3985
  this.elementVertical.scrollTop = Helpers.elOffset(rowEl).top - Helpers.elOffset(this.elementVertical).top + this.elementVertical.scrollTop;
3960
3986
  }
3961
-
3987
+
3962
3988
  visibleRows(includingBuffer){
3963
3989
  return this.rows();
3964
3990
  }
3965
-
3991
+
3966
3992
  }
3967
3993
 
3968
3994
  class VirtualDomVertical extends Renderer{
@@ -4251,13 +4277,14 @@
4251
4277
  rowFragment = document.createDocumentFragment();
4252
4278
 
4253
4279
  i = 0;
4280
+
4254
4281
  while ((i < rowsToRender) && this.vDomBottom < rowsCount -1) {
4255
4282
  index = this.vDomBottom + 1,
4256
4283
  row = rows[index];
4257
4284
 
4258
4285
  this.styleRow(row, index);
4259
4286
 
4260
- row.initialize();
4287
+ row.initialize(false, true);
4261
4288
  if(!row.heightInitialized && !this.table.options.rowHeight){
4262
4289
  row.clearCellHeight();
4263
4290
  }
@@ -4271,21 +4298,23 @@
4271
4298
  if(!renderedRows.length){
4272
4299
  break;
4273
4300
  }
4301
+
4274
4302
  element.appendChild(rowFragment);
4275
4303
 
4276
4304
  // NOTE: The next 3 loops are separate on purpose
4277
4305
  // This is to batch up the dom writes and reads which drastically improves performance
4306
+
4278
4307
  renderedRows.forEach((row) => {
4308
+ row.rendered();
4309
+
4279
4310
  if(!row.heightInitialized) {
4280
4311
  row.calcHeight(true);
4281
-
4282
4312
  }
4283
4313
  });
4284
4314
 
4285
4315
  renderedRows.forEach((row) => {
4286
4316
  if(!row.heightInitialized) {
4287
4317
  row.setCellHeight();
4288
-
4289
4318
  }
4290
4319
  });
4291
4320
 
@@ -5578,6 +5607,8 @@
5578
5607
 
5579
5608
  this.getElement().appendChild(this.placeholder);
5580
5609
  this._positionPlaceholder();
5610
+
5611
+ this.adjustTableSize();
5581
5612
  }
5582
5613
  }
5583
5614
 
@@ -6175,58 +6206,66 @@
6175
6206
  class DataLoader extends CoreFeature{
6176
6207
  constructor(table){
6177
6208
  super(table);
6178
-
6209
+
6179
6210
  this.requestOrder = 0; //prevent requests coming out of sequence if overridden by another load request
6180
6211
  this.loading = false;
6181
6212
  }
6182
-
6213
+
6183
6214
  initialize(){}
6184
-
6215
+
6185
6216
  load(data, params, config, replace, silent, columnsChanged){
6186
6217
  var requestNo = ++this.requestOrder;
6187
6218
 
6219
+ if(this.table.destroyed){
6220
+ return Promise.resolve();
6221
+ }
6222
+
6188
6223
  this.dispatchExternal("dataLoading", data);
6189
-
6224
+
6190
6225
  //parse json data to array
6191
6226
  if (data && (data.indexOf("{") == 0 || data.indexOf("[") == 0)){
6192
6227
  data = JSON.parse(data);
6193
6228
  }
6194
-
6229
+
6195
6230
  if(this.confirm("data-loading", [data, params, config, silent])){
6196
6231
  this.loading = true;
6197
-
6232
+
6198
6233
  if(!silent){
6199
6234
  this.alertLoader();
6200
6235
  }
6201
-
6236
+
6202
6237
  //get params for request
6203
6238
  params = this.chain("data-params", [data, config, silent], params || {}, params || {});
6204
-
6239
+
6205
6240
  params = this.mapParams(params, this.table.options.dataSendParams);
6206
-
6241
+
6207
6242
  var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
6208
6243
 
6209
6244
  return result.then((response) => {
6210
- if(!Array.isArray(response) && typeof response == "object"){
6211
- response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
6212
- }
6213
-
6214
- var rowData = this.chain("data-loaded", response, null, response);
6215
-
6216
- if(requestNo == this.requestOrder){
6217
- this.clearAlert();
6218
-
6219
- if(rowData !== false){
6220
- this.dispatchExternal("dataLoaded", rowData);
6221
- this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
6245
+ if(!this.table.destroyed){
6246
+ if(!Array.isArray(response) && typeof response == "object"){
6247
+ response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
6248
+ }
6249
+
6250
+ var rowData = this.chain("data-loaded", response, null, response);
6251
+
6252
+ if(requestNo == this.requestOrder){
6253
+ this.clearAlert();
6254
+
6255
+ if(rowData !== false){
6256
+ this.dispatchExternal("dataLoaded", rowData);
6257
+ this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
6258
+ }
6259
+ }else {
6260
+ 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");
6222
6261
  }
6223
6262
  }else {
6224
- 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");
6263
+ console.warn("Data Load Response Blocked - Table has been destroyed");
6225
6264
  }
6226
6265
  }).catch((error) => {
6227
6266
  console.error("Data Load Error: ", error);
6228
6267
  this.dispatchExternal("dataLoadError", error);
6229
-
6268
+
6230
6269
  if(!silent){
6231
6270
  this.alertError();
6232
6271
  }
@@ -6240,52 +6279,52 @@
6240
6279
  });
6241
6280
  }else {
6242
6281
  this.dispatchExternal("dataLoaded", data);
6243
-
6282
+
6244
6283
  if(!data){
6245
6284
  data = [];
6246
6285
  }
6247
-
6286
+
6248
6287
  this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
6249
6288
  return Promise.resolve();
6250
6289
  }
6251
6290
  }
6252
-
6291
+
6253
6292
  mapParams(params, map){
6254
6293
  var output = {};
6255
-
6294
+
6256
6295
  for(let key in params){
6257
6296
  output[map.hasOwnProperty(key) ? map[key] : key] = params[key];
6258
6297
  }
6259
-
6298
+
6260
6299
  return output;
6261
6300
  }
6262
-
6301
+
6263
6302
  objectInvert(obj){
6264
6303
  var output = {};
6265
-
6304
+
6266
6305
  for(let key in obj){
6267
6306
  output[obj[key]] = key;
6268
6307
  }
6269
-
6308
+
6270
6309
  return output;
6271
6310
  }
6272
-
6311
+
6273
6312
  blockActiveLoad(){
6274
6313
  this.requestOrder++;
6275
6314
  }
6276
-
6315
+
6277
6316
  alertLoader(){
6278
6317
  var shouldLoad = typeof this.table.options.dataLoader === "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
6279
-
6318
+
6280
6319
  if(shouldLoad){
6281
6320
  this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
6282
6321
  }
6283
6322
  }
6284
-
6323
+
6285
6324
  alertError(){
6286
6325
  this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
6287
6326
  }
6288
-
6327
+
6289
6328
  clearAlert(){
6290
6329
  this.table.alertManager.clear();
6291
6330
  }
@@ -10268,6 +10307,9 @@
10268
10307
  this.branchEl = options.dataTreeBranchElement;
10269
10308
  }
10270
10309
  }
10310
+ }else {
10311
+ this.branchEl = document.createElement("div");
10312
+ this.branchEl.classList.add("tabulator-data-tree-branch-empty");
10271
10313
  }
10272
10314
 
10273
10315
  if(options.dataTreeCollapseElement){
@@ -10771,7 +10813,7 @@
10771
10813
  var config = row.modules.dataTree,
10772
10814
  output = [];
10773
10815
 
10774
- if(config.children){
10816
+ if(config && config.children){
10775
10817
 
10776
10818
  if(!Array.isArray(config.children)){
10777
10819
  config.children = this.generateChildren(row);
@@ -17471,7 +17513,7 @@
17471
17513
  this.arrowElement = document.createElement("div");
17472
17514
  this.arrowElement.classList.add("tabulator-group-toggle");
17473
17515
  this.arrowElement.appendChild(arrow);
17474
-
17516
+
17475
17517
  //setup movable rows
17476
17518
  if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
17477
17519
  this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
@@ -17494,9 +17536,15 @@
17494
17536
  toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
17495
17537
 
17496
17538
  toggleElement.addEventListener("click", (e) => {
17497
- e.stopPropagation();
17498
- e.stopImmediatePropagation();
17499
- this.toggleVisibility();
17539
+ if(this.groupManager.table.options.groupToggleElement === "arrow"){
17540
+ e.stopPropagation();
17541
+ e.stopImmediatePropagation();
17542
+ }
17543
+
17544
+ //allow click event to propagate before toggling visibility
17545
+ setTimeout(() => {
17546
+ this.toggleVisibility();
17547
+ });
17500
17548
  });
17501
17549
  }
17502
17550
  }
@@ -17617,7 +17665,7 @@
17617
17665
  if(el.parentNode){
17618
17666
  el.parentNode.removeChild(el);
17619
17667
  }
17620
-
17668
+
17621
17669
  if(!this.groupManager.blockRedraw){
17622
17670
  this.generateGroupHeaderContents();
17623
17671
 
@@ -17742,6 +17790,7 @@
17742
17790
  }
17743
17791
  return count;
17744
17792
  }
17793
+
17745
17794
 
17746
17795
  toggleVisibility(){
17747
17796
  if(this.visible){
@@ -17866,12 +17915,18 @@
17866
17915
  return output;
17867
17916
  }
17868
17917
 
17869
- getRows(component){
17918
+ getRows(component, includeChildren){
17870
17919
  var output = [];
17871
17920
 
17872
- this.rows.forEach(function(row){
17873
- output.push(component ? row.getComponent() : row);
17874
- });
17921
+ if(includeChildren && this.groupList.length){
17922
+ this.groupList.forEach((group) => {
17923
+ output = output.concat(group.getRows(component, includeChildren));
17924
+ });
17925
+ }else {
17926
+ this.rows.forEach(function(row){
17927
+ output.push(component ? row.getComponent() : row);
17928
+ });
17929
+ }
17875
17930
 
17876
17931
  return output;
17877
17932
  }
@@ -17879,7 +17934,9 @@
17879
17934
  generateGroupHeaderContents(){
17880
17935
  var data = [];
17881
17936
 
17882
- this.rows.forEach(function(row){
17937
+ var rows = this.getRows(false, true);
17938
+
17939
+ rows.forEach(function(row){
17883
17940
  data.push(row.getData());
17884
17941
  });
17885
17942
 
@@ -17984,6 +18041,8 @@
17984
18041
  clearCellHeight(){}
17985
18042
 
17986
18043
  deinitializeHeight(){}
18044
+
18045
+ rendered(){}
17987
18046
 
17988
18047
  //////////////// Object Generation /////////////////
17989
18048
  getComponent(){
@@ -18650,8 +18709,12 @@
18650
18709
  },
18651
18710
 
18652
18711
  rowMove: function(action){
18653
- this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posFrom], !action.data.after);
18654
- this.table.rowManager.redraw();
18712
+ var after = (action.data.posFrom - action.data.posTo) > 0;
18713
+
18714
+ this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posFrom), after);
18715
+
18716
+ this.table.rowManager.regenerateRowPositions();
18717
+ this.table.rowManager.reRenderInPosition();
18655
18718
  },
18656
18719
  };
18657
18720
 
@@ -18676,8 +18739,10 @@
18676
18739
  },
18677
18740
 
18678
18741
  rowMove: function(action){
18679
- this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.posTo], action.data.after);
18680
- this.table.rowManager.redraw();
18742
+ this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posTo), action.data.after);
18743
+
18744
+ this.table.rowManager.regenerateRowPositions();
18745
+ this.table.rowManager.reRenderInPosition();
18681
18746
  },
18682
18747
  };
18683
18748