tabulator-tables 5.1.1 → 5.1.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.1.1 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.1.2 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -7645,7 +7645,8 @@ class Export extends Module{
7645
7645
 
7646
7646
  header.forEach((col) => {
7647
7647
  if(col){
7648
- columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth));
7648
+ let title = typeof col.title === "undefined" ? "" : col.title;
7649
+ columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
7649
7650
  }else {
7650
7651
  columns.push(null);
7651
7652
  }
@@ -8738,20 +8739,24 @@ class Filter extends Module{
8738
8739
 
8739
8740
  //add filter to array
8740
8741
  addFilter(field, type, value, params){
8742
+ var changed = false;
8741
8743
 
8742
8744
  if(!Array.isArray(field)){
8743
8745
  field = [{field:field, type:type, value:value, params:params}];
8744
8746
  }
8745
8747
 
8746
8748
  field.forEach((filter) => {
8747
-
8748
8749
  filter = this.findFilter(filter);
8749
8750
 
8750
8751
  if(filter){
8751
8752
  this.filterList.push(filter);
8752
- this.changed = true;
8753
+ changed = true;
8753
8754
  }
8754
8755
  });
8756
+
8757
+ if(changed){
8758
+ this.trackChanges();
8759
+ }
8755
8760
  }
8756
8761
 
8757
8762
  findFilter(filter){
@@ -9523,7 +9528,7 @@ function buttonCross(cell, formatterParams, onRendered){
9523
9528
  }
9524
9529
 
9525
9530
  function rownum(cell, formatterParams, onRendered){
9526
- return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1;
9531
+ return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1 || "";
9527
9532
  }
9528
9533
 
9529
9534
  function handle(cell, formatterParams, onRendered){
@@ -14335,10 +14340,13 @@ class Page extends Module{
14335
14340
  initialize(){
14336
14341
  if(this.table.options.pagination){
14337
14342
  this.subscribe("row-deleted", this.rowsUpdated.bind(this));
14338
- this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
14339
14343
  this.subscribe("row-added", this.rowsUpdated.bind(this));
14340
14344
  this.subscribe("data-processed", this.initialLoadComplete.bind(this));
14341
14345
  this.subscribe("table-built", this.calculatePageSizes.bind(this));
14346
+
14347
+ if(this.table.options.paginationAddRow == "page"){
14348
+ this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
14349
+ }
14342
14350
 
14343
14351
  if(this.table.options.paginationMode === "remote"){
14344
14352
  this.subscribe("data-params", this.remotePageParams.bind(this));
@@ -15309,11 +15317,11 @@ class Persistence extends Module{
15309
15317
  this.subscribe("column-show", this.save.bind(this, "columns"));
15310
15318
  this.subscribe("column-hide", this.save.bind(this, "columns"));
15311
15319
  this.subscribe("column-moved", this.save.bind(this, "columns"));
15312
- this.subscribe("table-built", this.tableBuilt.bind(this), 0);
15313
15320
  }
15314
15321
 
15315
- this.subscribe("table-redraw", this.tableRedraw.bind(this));
15322
+ this.subscribe("table-built", this.tableBuilt.bind(this), 0);
15316
15323
 
15324
+ this.subscribe("table-redraw", this.tableRedraw.bind(this));
15317
15325
 
15318
15326
  this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
15319
15327
  this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
@@ -15341,7 +15349,7 @@ class Persistence extends Module{
15341
15349
  sorters = this.load("sort");
15342
15350
 
15343
15351
  if(!sorters === false){
15344
- this.table.initialSort = sorters;
15352
+ this.table.options.initialSort = sorters;
15345
15353
  }
15346
15354
  }
15347
15355
 
@@ -15349,7 +15357,7 @@ class Persistence extends Module{
15349
15357
  filters = this.load("filter");
15350
15358
 
15351
15359
  if(!filters === false){
15352
- this.table.initialFilter = filters;
15360
+ this.table.options.initialFilter = filters;
15353
15361
  }
15354
15362
  }
15355
15363
  }
@@ -15626,6 +15634,8 @@ class Persistence extends Module{
15626
15634
 
15627
15635
  Persistence.moduleName = "persistence";
15628
15636
 
15637
+ Persistence.moduleInitOrder = 1;
15638
+
15629
15639
  //load defaults
15630
15640
  Persistence.readers = defaultReaders;
15631
15641
  Persistence.writers = defaultWriters;
@@ -16837,7 +16847,7 @@ class ResponsiveLayout extends Module{
16837
16847
  var titleHighlight = document.createElement("strong");
16838
16848
  titleData.appendChild(titleHighlight);
16839
16849
  this.langBind("columns|" + item.field, function(text){
16840
- titleHighlight.innerText = text || item.title;
16850
+ titleHighlight.innerHTML = text || item.title;
16841
16851
  });
16842
16852
 
16843
16853
  if(item.value instanceof Node){
@@ -21562,12 +21572,6 @@ class RowManager extends CoreFeature{
21562
21572
  if(!force){
21563
21573
  this.reRenderInPosition();
21564
21574
  this.scrollHorizontal(left);
21565
-
21566
- if(!this.displayRowsCount){
21567
- if(this.table.options.placeholder){
21568
- this.getElement().appendChild(this.table.options.placeholder);
21569
- }
21570
- }
21571
21575
  }else {
21572
21576
  this.renderTable();
21573
21577
  }
@@ -23187,19 +23191,31 @@ class ModuleBinder {
23187
23191
 
23188
23192
  //ensure that module are bound to instantiated function
23189
23193
  tabulator.prototype.bindModules = function(){
23194
+ var orderedMods = [],
23195
+ unOrderedMods = [];
23196
+
23190
23197
  this.modules = {};
23191
23198
 
23192
23199
  for(var name in tabulator.moduleBindings){
23193
23200
  let mod = tabulator.moduleBindings[name];
23201
+ let module = new mod(this);
23194
23202
 
23195
- this.modules[name] = new mod(this);
23203
+ this.modules[name] = module;
23196
23204
 
23197
23205
  if(mod.prototype.moduleCore){
23198
- this.modulesCore[name] = this.modules[name];
23206
+ this.modulesCore.push(module);
23199
23207
  }else {
23200
- this.modulesRegular[name] = this.modules[name];
23208
+ if(mod.moduleInitOrder){
23209
+ orderedMods.push(module);
23210
+ }else {
23211
+ unOrderedMods.push(module);
23212
+ }
23201
23213
  }
23202
23214
  }
23215
+
23216
+ orderedMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
23217
+
23218
+ this.modulesRegular = orderedMods.concat(unOrderedMods);
23203
23219
  };
23204
23220
  }
23205
23221
 
@@ -23239,8 +23255,8 @@ class Tabulator {
23239
23255
  this.dataLoader = false; //bind component functions
23240
23256
 
23241
23257
  this.modules = {}; //hold all modules bound to this table
23242
- this.modulesCore = {}; //hold core modules bound to this table (for initialization purposes)
23243
- this.modulesRegular = {}; //hold regular modules bound to this table (for initialization purposes)
23258
+ this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
23259
+ this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
23244
23260
 
23245
23261
  this.optionsList = new OptionsList(this, "table constructor");
23246
23262
 
@@ -23298,8 +23314,8 @@ class Tabulator {
23298
23314
  this.interactionMonitor = new InteractionManager(this);
23299
23315
 
23300
23316
  this.dataLoader.initialize();
23301
- this.columnManager.initialize();
23302
- this.rowManager.initialize();
23317
+ // this.columnManager.initialize();
23318
+ // this.rowManager.initialize();
23303
23319
  this.footerManager.initialize();
23304
23320
  }
23305
23321
 
@@ -23437,24 +23453,9 @@ class Tabulator {
23437
23453
  this._detectBrowser();
23438
23454
 
23439
23455
  //initialize core modules
23440
- for (let key in this.modulesCore){
23441
- let mod = this.modulesCore[key];
23442
-
23456
+ this.modulesCore.forEach((mod) => {
23443
23457
  mod.initialize();
23444
- }
23445
-
23446
- //configure placeholder element
23447
- if(typeof options.placeholder == "string"){
23448
- var el = document.createElement("div");
23449
- el.classList.add("tabulator-placeholder");
23450
-
23451
- var span = document.createElement("span");
23452
- span.innerHTML = options.placeholder;
23453
-
23454
- el.appendChild(span);
23455
-
23456
- options.placeholder = el;
23457
- }
23458
+ });
23458
23459
 
23459
23460
  //build table elements
23460
23461
  element.appendChild(this.columnManager.getElement());
@@ -23470,11 +23471,9 @@ class Tabulator {
23470
23471
  }
23471
23472
 
23472
23473
  //initialize regular modules
23473
- for (let key in this.modulesRegular){
23474
- let mod = this.modulesRegular[key];
23475
-
23474
+ this.modulesRegular.forEach((mod) => {
23476
23475
  mod.initialize();
23477
- }
23476
+ });
23478
23477
 
23479
23478
  this.columnManager.setColumns(options.columns);
23480
23479