tabulator-tables 5.0.7 → 5.0.8

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.0.7",
4
+ "version": "5.0.8",
5
5
  "description": "Interactive table generation JavaScript library",
6
6
  "keywords": [
7
7
  "table",
package/build/rollup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Bundler from "./Bundler.js";
2
2
 
3
- var bundler = new Bundler("5.0.7", process.env.TARGET);
3
+ var bundler = new Bundler("5.0.8", process.env.TARGET);
4
4
 
5
5
  module.exports = bundler.bundle();
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.0.7 (c) Oliver Folkerd 2021 */
1
+ /* Tabulator v5.0.8 (c) Oliver Folkerd 2021 */
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) :
@@ -616,7 +616,7 @@
616
616
  return ColumnComponent;
617
617
  }();
618
618
 
619
- var defaultOptions$1 = {
619
+ var defaultColumnOptions = {
620
620
  "title": undefined,
621
621
  "field": undefined,
622
622
  "columns": undefined,
@@ -2140,7 +2140,7 @@
2140
2140
  return Column;
2141
2141
  }(CoreFeature);
2142
2142
 
2143
- Column$1.defaultOptionList = defaultOptions$1;
2143
+ Column$1.defaultOptionList = defaultColumnOptions;
2144
2144
 
2145
2145
  var Helpers = /*#__PURE__*/function () {
2146
2146
  function Helpers() {
@@ -2210,11 +2210,13 @@
2210
2210
 
2211
2211
  var OptionsList = /*#__PURE__*/function () {
2212
2212
  function OptionsList(table, msgType) {
2213
+ var defaults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2214
+
2213
2215
  _classCallCheck(this, OptionsList);
2214
2216
 
2215
2217
  this.table = table;
2216
2218
  this.msgType = msgType;
2217
- this.registeredDefaults = {};
2219
+ this.registeredDefaults = Object.assign({}, defaults);
2218
2220
  }
2219
2221
 
2220
2222
  _createClass(OptionsList, [{
@@ -2988,7 +2990,7 @@
2988
2990
  _this.columnsByField = {}; //columns by field
2989
2991
 
2990
2992
  _this.scrollLeft = 0;
2991
- _this.optionsList = new OptionsList(_this.table, "column definition");
2993
+ _this.optionsList = new OptionsList(_this.table, "column definition", defaultColumnOptions);
2992
2994
  _this.renderer = null;
2993
2995
  return _this;
2994
2996
  } ////////////// Setup Functions /////////////////
@@ -6095,7 +6097,7 @@
6095
6097
  _classCallCheck(this, InteractionManager);
6096
6098
 
6097
6099
  _this = _super.call(this, table);
6098
- _this.el = _this.table.element;
6100
+ _this.el = null;
6099
6101
  _this.abortClasses = ["tabulator-headers", "tabulator-table"];
6100
6102
  _this.previousTargets = {};
6101
6103
  _this.listeners = ["click", "dblclick", "contextmenu", "mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove", "touchstart", "touchend"];
@@ -6105,15 +6107,17 @@
6105
6107
  "tabulator-group": "group",
6106
6108
  "tabulator-col": "column"
6107
6109
  };
6108
-
6109
- _this.buildListenerMap();
6110
-
6111
- _this.bindSubscriptionWatchers();
6112
-
6113
6110
  return _this;
6114
6111
  }
6115
6112
 
6116
6113
  _createClass(InteractionManager, [{
6114
+ key: "initialize",
6115
+ value: function initialize() {
6116
+ this.el = this.table.element;
6117
+ this.buildListenerMap();
6118
+ this.bindSubscriptionWatchers();
6119
+ }
6120
+ }, {
6117
6121
  key: "buildListenerMap",
6118
6122
  value: function buildListenerMap() {
6119
6123
  var listenerMap = {};
@@ -6344,15 +6348,15 @@
6344
6348
  return InteractionManager;
6345
6349
  }(CoreFeature);
6346
6350
 
6347
- var ComponentFuctionBinder = /*#__PURE__*/function () {
6348
- function ComponentFuctionBinder(table) {
6349
- _classCallCheck(this, ComponentFuctionBinder);
6351
+ var ComponentFunctionBinder = /*#__PURE__*/function () {
6352
+ function ComponentFunctionBinder(table) {
6353
+ _classCallCheck(this, ComponentFunctionBinder);
6350
6354
 
6351
6355
  this.table = table;
6352
6356
  this.bindings = {};
6353
6357
  }
6354
6358
 
6355
- _createClass(ComponentFuctionBinder, [{
6359
+ _createClass(ComponentFunctionBinder, [{
6356
6360
  key: "bind",
6357
6361
  value: function bind(type, funcName, handler) {
6358
6362
  if (!this.bindings[type]) {
@@ -6378,7 +6382,7 @@
6378
6382
  }
6379
6383
  }]);
6380
6384
 
6381
- return ComponentFuctionBinder;
6385
+ return ComponentFunctionBinder;
6382
6386
  }();
6383
6387
 
6384
6388
  var DataLoader = /*#__PURE__*/function (_CoreFeature) {
@@ -7785,13 +7789,13 @@
7785
7789
 
7786
7790
  this.browserSlow = false; //handle reduced functionality for slower browsers
7787
7791
 
7788
- this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence
7792
+ this.browserMobile = false; //check if running on mobile, prevent resize cancelling edit on keyboard appearance
7789
7793
 
7790
7794
  this.rtl = false; //check if the table is in RTL mode
7791
7795
 
7792
7796
  this.originalElement = null; //hold original table element if it has been replaced
7793
7797
 
7794
- this.componentFunctionBinder = new ComponentFuctionBinder(this); //bind component functions
7798
+ this.componentFunctionBinder = new ComponentFunctionBinder(this); //bind component functions
7795
7799
 
7796
7800
  this.dataLoader = false; //bind component functions
7797
7801
 
@@ -7805,14 +7809,14 @@
7805
7809
  this.initialized = false;
7806
7810
 
7807
7811
  if (this.initializeElement(element)) {
7808
- this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediatly after the constructor
7812
+ this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
7809
7813
 
7810
7814
  setTimeout(function () {
7811
7815
  _this._create();
7812
7816
  });
7813
7817
  }
7814
7818
 
7815
- TableRegistry.register(this); //register table for inderdevice communication
7819
+ TableRegistry.register(this); //register table for inter-device communication
7816
7820
  }
7817
7821
 
7818
7822
  _createClass(Tabulator, [{
@@ -7847,7 +7851,7 @@
7847
7851
 
7848
7852
  this._clearObjectPointers();
7849
7853
 
7850
- this._mapDepricatedFunctionality();
7854
+ this._mapDeprecatedFunctionality();
7851
7855
 
7852
7856
  this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
7853
7857
  this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
@@ -7856,11 +7860,11 @@
7856
7860
  this.columnManager.initialize();
7857
7861
  this.rowManager.initialize();
7858
7862
  this.footerManager.initialize();
7859
- } //convert depricated functionality to new functions
7863
+ } //convert deprecated functionality to new functions
7860
7864
 
7861
7865
  }, {
7862
- key: "_mapDepricatedFunctionality",
7863
- value: function _mapDepricatedFunctionality() {//all previously deprecated functionality removed in the 5.0 release
7866
+ key: "_mapDeprecatedFunctionality",
7867
+ value: function _mapDeprecatedFunctionality() {//all previously deprecated functionality removed in the 5.0 release
7864
7868
  }
7865
7869
  }, {
7866
7870
  key: "_clearSelection",
@@ -7881,7 +7885,7 @@
7881
7885
  }
7882
7886
 
7883
7887
  this.element.classList.remove("tabulator-block-select");
7884
- } //concreate table
7888
+ } //create table
7885
7889
 
7886
7890
  }, {
7887
7891
  key: "_create",
@@ -7989,6 +7993,7 @@
7989
7993
  value: function _initializeTable() {
7990
7994
  var element = this.element,
7991
7995
  options = this.options;
7996
+ this.interactionMonitor.initialize();
7992
7997
  this.columnManager.initialize();
7993
7998
  this.rowManager.initialize();
7994
7999
 
@@ -8042,7 +8047,7 @@
8042
8047
  key: "destroy",
8043
8048
  value: function destroy() {
8044
8049
  var element = this.element;
8045
- TableRegistry.deregister(this); //deregister table from inderdevice communication
8050
+ TableRegistry.deregister(this); //deregister table from inter-device communication
8046
8051
 
8047
8052
  this.eventBus.dispatch("table-destroy"); //clear row data
8048
8053
 
@@ -8414,7 +8419,7 @@
8414
8419
 
8415
8420
  if (row) {
8416
8421
  return row.updateData(data).then(function () {
8417
- resolve(row.getComponent());
8422
+ return Promise.resolve(row.getComponent());
8418
8423
  });
8419
8424
  } else {
8420
8425
  console.warn("Update Error - No matching row found:", index);
@@ -8448,11 +8453,7 @@
8448
8453
  }, {
8449
8454
  key: "getRows",
8450
8455
  value: function getRows(active) {
8451
- if (this.initialized) {
8452
- return this.rowManager.getComponents(active);
8453
- } else {
8454
- console.warn("getRows failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
8455
- }
8456
+ return this.rowManager.getComponents(active);
8456
8457
  } //get position of row in table
8457
8458
 
8458
8459
  }, {
@@ -10082,7 +10083,7 @@
10082
10083
 
10083
10084
  row.getComponent = function () {
10084
10085
  if (!row.component) {
10085
- row.component = new CalcComponent(_this4);
10086
+ row.component = new CalcComponent(row);
10086
10087
  }
10087
10088
 
10088
10089
  return row.component;
@@ -12890,11 +12891,9 @@
12890
12891
 
12891
12892
  //draggable progress bar
12892
12893
  function progress (cell, onRendered, success, cancel, editorParams) {
12893
- var _element$getElementsB, _element$getElementsB2;
12894
-
12895
12894
  var element = cell.getElement(),
12896
- max = typeof editorParams.max === "undefined" ? ((_element$getElementsB = element.getElementsByTagName("div")[0]) === null || _element$getElementsB === void 0 ? void 0 : _element$getElementsB.getAttribute("max")) || 100 : editorParams.max,
12897
- min = typeof editorParams.min === "undefined" ? ((_element$getElementsB2 = element.getElementsByTagName("div")[0]) === null || _element$getElementsB2 === void 0 ? void 0 : _element$getElementsB2.getAttribute("min")) || 0 : editorParams.min,
12895
+ max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max,
12896
+ min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min,
12898
12897
  percent = (max - min) / 100,
12899
12898
  value = cell.getValue() || 0,
12900
12899
  handle = document.createElement("div"),
@@ -15188,7 +15187,7 @@
15188
15187
  if (this.table.options.filterMode === "remote") {
15189
15188
  this.reloadData();
15190
15189
  } else {
15191
- this.refreshData();
15190
+ this.refreshData(true);
15192
15191
  }
15193
15192
  } //TODO - Persist left position of row manager
15194
15193
  // left = this.scrollLeft;
@@ -15741,7 +15740,7 @@
15741
15740
  var value = cell.getValue();
15742
15741
 
15743
15742
  if (typeof DT != "undefined") {
15744
- var newDatetime = (window.DateTime || luxon.DateTime).fromFormat(value, inputFormat);
15743
+ var newDatetime = DT.fromFormat(String(value), inputFormat);
15745
15744
 
15746
15745
  if (newDatetime.isValid) {
15747
15746
  if (formatterParams.timezone) {
@@ -15750,7 +15749,7 @@
15750
15749
 
15751
15750
  return newDatetime.toFormat(outputFormat);
15752
15751
  } else {
15753
- if (invalid === true) {
15752
+ if (invalid === true || !value) {
15754
15753
  return value;
15755
15754
  } else if (typeof invalid === "function") {
15756
15755
  return invalid(value);
@@ -15774,7 +15773,7 @@
15774
15773
  var value = cell.getValue();
15775
15774
 
15776
15775
  if (typeof DT != "undefined") {
15777
- var newDatetime = DT.fromFormat(value, inputFormat);
15776
+ var newDatetime = DT.fromFormat(String(value), inputFormat);
15778
15777
 
15779
15778
  if (newDatetime.isValid) {
15780
15779
  if (humanize) ; else {
@@ -16921,10 +16920,16 @@
16921
16920
  group.wipe();
16922
16921
  });
16923
16922
  } else {
16924
- this.element = false;
16925
- this.arrowElement = false;
16926
- this.elementContents = false;
16923
+ this.rows.forEach(function (row) {
16924
+ if (row.modules) {
16925
+ delete row.modules.group;
16926
+ }
16927
+ });
16927
16928
  }
16929
+
16930
+ this.element = false;
16931
+ this.arrowElement = false;
16932
+ this.elementContents = false;
16928
16933
  }
16929
16934
  }, {
16930
16935
  key: "createElements",
@@ -17789,7 +17794,13 @@
17789
17794
  key: "setGroupBy",
17790
17795
  value: function setGroupBy(groups) {
17791
17796
  this.table.options.groupBy = groups;
17792
- this.configureGroupSetup();
17797
+
17798
+ if (!this.initialized) {
17799
+ this.initialize();
17800
+ } else {
17801
+ this.configureGroupSetup();
17802
+ }
17803
+
17793
17804
  this.refreshData();
17794
17805
  this.trackChanges();
17795
17806
  }
@@ -18417,7 +18428,7 @@
18417
18428
  data = [];
18418
18429
  this.hasIndex = false;
18419
18430
  this.dispatchExternal("htmlImporting");
18420
- rows = rows ? rows.getElementsByTagName("tr") : []; //check for tablator inline options
18431
+ rows = rows ? rows.getElementsByTagName("tr") : []; //check for Tabulator inline options
18421
18432
 
18422
18433
  this._extractOptions(element, options);
18423
18434
 
@@ -18457,7 +18468,7 @@
18457
18468
  key: "_extractOptions",
18458
18469
  value: function _extractOptions(element, options, defaultOptions) {
18459
18470
  var attributes = element.attributes;
18460
- var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options);
18471
+ var optionsArr = defaultOptions ? Object.keys(defaultOptions) : Object.keys(options);
18461
18472
  var optionsList = {};
18462
18473
  optionsArr.forEach(function (item) {
18463
18474
  optionsList[item.toLowerCase()] = item;
@@ -18525,12 +18536,10 @@
18525
18536
 
18526
18537
  if (width && !col.width) {
18527
18538
  col.width = width;
18528
- } //check for tablator inline options
18539
+ } //check for Tabulator inline options
18529
18540
 
18530
18541
 
18531
- header.attributes; // //check for tablator inline options
18532
-
18533
- this._extractOptions(header, col, Column$1.prototype.defaultOptionList);
18542
+ this._extractOptions(header, col, this.table.columnManager.optionsList.registeredDefaults);
18534
18543
 
18535
18544
  this.fieldIndex[index] = col.field;
18536
18545
 
@@ -19628,7 +19637,9 @@
19628
19637
  }, {
19629
19638
  key: "initialize",
19630
19639
  value: function initialize() {
19631
- this.subscribe("column-init", this.initializeColumn.bind(this));
19640
+ if (this.table.options.movableColumns) {
19641
+ this.subscribe("column-init", this.initializeColumn.bind(this));
19642
+ }
19632
19643
  }
19633
19644
  }, {
19634
19645
  key: "initializeColumn",
@@ -20939,7 +20950,7 @@
20939
20950
  margin = this.table.options.progressiveLoadScrollMargin || element.clientHeight * 2;
20940
20951
 
20941
20952
  if (diff < margin) {
20942
- this.nextPage();
20953
+ this.nextPage()["catch"](function () {}); //consume the exception thrown when on the last page
20943
20954
  }
20944
20955
  }
20945
20956
  }
@@ -23378,7 +23389,7 @@
23378
23389
  this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
23379
23390
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
23380
23391
 
23381
- if (this.table.options.selectable && this.table.options.selectablePersistence) {
23392
+ if (this.table.options.selectable && !this.table.options.selectablePersistence) {
23382
23393
  this.subscribe("data-refeshing", this.deselectRows.bind(this));
23383
23394
  }
23384
23395
  }
@@ -23641,6 +23652,7 @@
23641
23652
  value: function deselectRows(rows, silent) {
23642
23653
  var self = this,
23643
23654
  rowCount;
23655
+ console.trace("deselect");
23644
23656
 
23645
23657
  if (typeof rows == "undefined") {
23646
23658
  rowCount = self.selectedRows.length;
@@ -23885,8 +23897,8 @@
23885
23897
  emptyAlign = 0;
23886
23898
 
23887
23899
  if (typeof DT != "undefined") {
23888
- a = DT.fromFormat(a, format);
23889
- b = DT.fromFormat(b, format);
23900
+ a = DT.fromFormat(String(a), format);
23901
+ b = DT.fromFormat(String(b), format);
23890
23902
 
23891
23903
  if (!a.isValid) {
23892
23904
  emptyAlign = !b.isValid ? 0 : -1;
@@ -24274,7 +24286,7 @@
24274
24286
  if (this.table.options.sortMode === "remote") {
24275
24287
  this.reloadData();
24276
24288
  } else {
24277
- this.refreshData();
24289
+ this.refreshData(true);
24278
24290
  } //TODO - Persist left position of row manager
24279
24291
  // left = this.scrollLeft;
24280
24292
  // this.scrollHorizontal(left);