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.
package/bower.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tabulator",
3
3
  "main": "dist/js/tabulator.js",
4
- "version": "5.1.1",
4
+ "version": "5.1.2",
5
5
  "description": "Interactive table generation JavaScript library",
6
6
  "keywords": [
7
7
  "table",
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.1.1 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.1.2 (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) :
@@ -6025,12 +6025,6 @@
6025
6025
  if (!force) {
6026
6026
  this.reRenderInPosition();
6027
6027
  this.scrollHorizontal(left);
6028
-
6029
- if (!this.displayRowsCount) {
6030
- if (this.table.options.placeholder) {
6031
- this.getElement().appendChild(this.table.options.placeholder);
6032
- }
6033
- }
6034
6028
  } else {
6035
6029
  this.renderTable();
6036
6030
  }
@@ -7935,18 +7929,30 @@
7935
7929
 
7936
7930
 
7937
7931
  tabulator.prototype.bindModules = function () {
7932
+ var orderedMods = [],
7933
+ unOrderedMods = [];
7938
7934
  this.modules = {};
7939
7935
 
7940
7936
  for (var name in tabulator.moduleBindings) {
7941
7937
  var mod = tabulator.moduleBindings[name];
7942
- this.modules[name] = new mod(this);
7938
+ var module = new mod(this);
7939
+ this.modules[name] = module;
7943
7940
 
7944
7941
  if (mod.prototype.moduleCore) {
7945
- this.modulesCore[name] = this.modules[name];
7942
+ this.modulesCore.push(module);
7946
7943
  } else {
7947
- this.modulesRegular[name] = this.modules[name];
7944
+ if (mod.moduleInitOrder) {
7945
+ orderedMods.push(module);
7946
+ } else {
7947
+ unOrderedMods.push(module);
7948
+ }
7948
7949
  }
7949
7950
  }
7951
+
7952
+ orderedMods.sort(function (a, b) {
7953
+ return a.moduleInitOrder > b.moduleInitOrder ? 1 : -1;
7954
+ });
7955
+ this.modulesRegular = orderedMods.concat(unOrderedMods);
7950
7956
  };
7951
7957
  }
7952
7958
  }, {
@@ -8004,9 +8010,9 @@
8004
8010
 
8005
8011
  this.modules = {}; //hold all modules bound to this table
8006
8012
 
8007
- this.modulesCore = {}; //hold core modules bound to this table (for initialization purposes)
8013
+ this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
8008
8014
 
8009
- this.modulesRegular = {}; //hold regular modules bound to this table (for initialization purposes)
8015
+ this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
8010
8016
 
8011
8017
  this.optionsList = new OptionsList(this, "table constructor");
8012
8018
  this.initialized = false;
@@ -8059,9 +8065,9 @@
8059
8065
  this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
8060
8066
  this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
8061
8067
  this.interactionMonitor = new InteractionManager(this);
8062
- this.dataLoader.initialize();
8063
- this.columnManager.initialize();
8064
- this.rowManager.initialize();
8068
+ this.dataLoader.initialize(); // this.columnManager.initialize();
8069
+ // this.rowManager.initialize();
8070
+
8065
8071
  this.footerManager.initialize();
8066
8072
  } //convert deprecated functionality to new functions
8067
8073
 
@@ -8203,21 +8209,9 @@
8203
8209
  this._detectBrowser(); //initialize core modules
8204
8210
 
8205
8211
 
8206
- for (var key in this.modulesCore) {
8207
- var mod = this.modulesCore[key];
8212
+ this.modulesCore.forEach(function (mod) {
8208
8213
  mod.initialize();
8209
- } //configure placeholder element
8210
-
8211
-
8212
- if (typeof options.placeholder == "string") {
8213
- var el = document.createElement("div");
8214
- el.classList.add("tabulator-placeholder");
8215
- var span = document.createElement("span");
8216
- span.innerHTML = options.placeholder;
8217
- el.appendChild(span);
8218
- options.placeholder = el;
8219
- } //build table elements
8220
-
8214
+ }); //build table elements
8221
8215
 
8222
8216
  element.appendChild(this.columnManager.getElement());
8223
8217
  element.appendChild(this.rowManager.getElement());
@@ -8231,12 +8225,9 @@
8231
8225
  } //initialize regular modules
8232
8226
 
8233
8227
 
8234
- for (var _key in this.modulesRegular) {
8235
- var _mod = this.modulesRegular[_key];
8236
-
8237
- _mod.initialize();
8238
- }
8239
-
8228
+ this.modulesRegular.forEach(function (mod) {
8229
+ mod.initialize();
8230
+ });
8240
8231
  this.columnManager.setColumns(options.columns);
8241
8232
  this.eventBus.dispatch("table-built");
8242
8233
  }
@@ -14309,7 +14300,8 @@
14309
14300
  var columns = [];
14310
14301
  header.forEach(function (col) {
14311
14302
  if (col) {
14312
- columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth));
14303
+ var title = typeof col.title === "undefined" ? "" : col.title;
14304
+ columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
14313
14305
  } else {
14314
14306
  columns.push(null);
14315
14307
  }
@@ -15430,6 +15422,8 @@
15430
15422
  value: function addFilter(field, type, value, params) {
15431
15423
  var _this4 = this;
15432
15424
 
15425
+ var changed = false;
15426
+
15433
15427
  if (!Array.isArray(field)) {
15434
15428
  field = [{
15435
15429
  field: field,
@@ -15445,9 +15439,13 @@
15445
15439
  if (filter) {
15446
15440
  _this4.filterList.push(filter);
15447
15441
 
15448
- _this4.changed = true;
15442
+ changed = true;
15449
15443
  }
15450
15444
  });
15445
+
15446
+ if (changed) {
15447
+ this.trackChanges();
15448
+ }
15451
15449
  }
15452
15450
  }, {
15453
15451
  key: "findFilter",
@@ -16231,7 +16229,7 @@
16231
16229
  }
16232
16230
 
16233
16231
  function rownum (cell, formatterParams, onRendered) {
16234
- return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1;
16232
+ return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1 || "";
16235
16233
  }
16236
16234
 
16237
16235
  function handle (cell, formatterParams, onRendered) {
@@ -21345,11 +21343,14 @@
21345
21343
  value: function initialize() {
21346
21344
  if (this.table.options.pagination) {
21347
21345
  this.subscribe("row-deleted", this.rowsUpdated.bind(this));
21348
- this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
21349
21346
  this.subscribe("row-added", this.rowsUpdated.bind(this));
21350
21347
  this.subscribe("data-processed", this.initialLoadComplete.bind(this));
21351
21348
  this.subscribe("table-built", this.calculatePageSizes.bind(this));
21352
21349
 
21350
+ if (this.table.options.paginationAddRow == "page") {
21351
+ this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
21352
+ }
21353
+
21353
21354
  if (this.table.options.paginationMode === "remote") {
21354
21355
  this.subscribe("data-params", this.remotePageParams.bind(this));
21355
21356
  this.subscribe("data-loaded", this._parseRemoteData.bind(this));
@@ -22338,9 +22339,9 @@
22338
22339
  this.subscribe("column-show", this.save.bind(this, "columns"));
22339
22340
  this.subscribe("column-hide", this.save.bind(this, "columns"));
22340
22341
  this.subscribe("column-moved", this.save.bind(this, "columns"));
22341
- this.subscribe("table-built", this.tableBuilt.bind(this), 0);
22342
22342
  }
22343
22343
 
22344
+ this.subscribe("table-built", this.tableBuilt.bind(this), 0);
22344
22345
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
22345
22346
  this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
22346
22347
  this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
@@ -22371,7 +22372,7 @@
22371
22372
  sorters = this.load("sort");
22372
22373
 
22373
22374
  if (!sorters === false) {
22374
- this.table.initialSort = sorters;
22375
+ this.table.options.initialSort = sorters;
22375
22376
  }
22376
22377
  }
22377
22378
 
@@ -22379,7 +22380,7 @@
22379
22380
  filters = this.load("filter");
22380
22381
 
22381
22382
  if (!filters === false) {
22382
- this.table.initialFilter = filters;
22383
+ this.table.options.initialFilter = filters;
22383
22384
  }
22384
22385
  }
22385
22386
  }
@@ -22662,7 +22663,8 @@
22662
22663
  return Persistence;
22663
22664
  }(Module);
22664
22665
 
22665
- Persistence.moduleName = "persistence"; //load defaults
22666
+ Persistence.moduleName = "persistence";
22667
+ Persistence.moduleInitOrder = 1; //load defaults
22666
22668
 
22667
22669
  Persistence.readers = defaultReaders;
22668
22670
  Persistence.writers = defaultWriters;
@@ -23929,7 +23931,7 @@
23929
23931
  var titleHighlight = document.createElement("strong");
23930
23932
  titleData.appendChild(titleHighlight);
23931
23933
  this.langBind("columns|" + item.field, function (text) {
23932
- titleHighlight.innerText = text || item.title;
23934
+ titleHighlight.innerHTML = text || item.title;
23933
23935
  });
23934
23936
 
23935
23937
  if (item.value instanceof Node) {