tabulator-tables 5.1.1 → 5.1.4

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 (32) hide show
  1. package/bower.json +1 -1
  2. package/dist/js/tabulator.js +233 -148
  3. package/dist/js/tabulator.js.map +1 -1
  4. package/dist/js/tabulator.min.js +2 -2
  5. package/dist/js/tabulator.min.js.map +1 -1
  6. package/dist/js/tabulator_esm.js +551 -485
  7. package/dist/js/tabulator_esm.js.map +1 -1
  8. package/dist/js/tabulator_esm.min.js +2 -2
  9. package/dist/js/tabulator_esm.min.js.map +1 -1
  10. package/package.json +5 -2
  11. package/src/js/core/FooterManager.js +2 -4
  12. package/src/js/core/RowManager.js +0 -6
  13. package/src/js/core/Tabulator.js +13 -30
  14. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +1 -1
  15. package/src/js/core/row/Row.js +2 -2
  16. package/src/js/core/tools/InteractionMonitor.js +1 -1
  17. package/src/js/core/tools/ModuleBinder.js +15 -3
  18. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +9 -4
  19. package/src/js/modules/Export/Export.js +5 -4
  20. package/src/js/modules/Filter/Filter.js +4 -3
  21. package/src/js/modules/Format/defaults/formatters/rowSelection.js +19 -1
  22. package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
  23. package/src/js/modules/FrozenColumns/FrozenColumns.js +101 -83
  24. package/src/js/modules/GroupRows/Group.js +144 -142
  25. package/src/js/modules/Layout/Layout.js +1 -0
  26. package/src/js/modules/Page/Page.js +6 -3
  27. package/src/js/modules/Page/defaults/pageCounters/rows.js +21 -13
  28. package/src/js/modules/Persistence/Persistence.js +6 -4
  29. package/src/js/modules/Persistence/defaults/readers.js +3 -3
  30. package/src/js/modules/ResizeColumns/ResizeColumns.js +61 -51
  31. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +1 -1
  32. package/src/js/modules/SelectRow/SelectRow.js +132 -128
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.1.1 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.1.4 (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) :
@@ -2739,7 +2739,7 @@
2739
2739
  if (change && this.table.rowManager.getDisplayRows().length) {
2740
2740
  this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.window;
2741
2741
  var row = this.chain("rows-sample", [1], [], function () {
2742
- return _this3.table.rowManager.getDisplayRows()[0];
2742
+ return _this3.table.rowManager.getDisplayRows();
2743
2743
  })[0];
2744
2744
 
2745
2745
  if (row) {
@@ -3884,6 +3884,7 @@
3884
3884
 
3885
3885
  this.dispatch("row-layout-before", this);
3886
3886
  this.generateCells();
3887
+ this.initialized = true;
3887
3888
  this.table.columnManager.renderer.renderRowCells(this);
3888
3889
 
3889
3890
  if (force) {
@@ -3891,7 +3892,6 @@
3891
3892
  }
3892
3893
 
3893
3894
  this.dispatch("row-layout", this);
3894
- this.initialized = true;
3895
3895
 
3896
3896
  if (this.table.options.rowFormatter) {
3897
3897
  this.table.options.rowFormatter(this.getComponent());
@@ -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
  }
@@ -6072,9 +6066,6 @@
6072
6066
 
6073
6067
  _this.external = false;
6074
6068
  _this.links = [];
6075
-
6076
- _this.initializeElement();
6077
-
6078
6069
  return _this;
6079
6070
  }
6080
6071
 
@@ -6105,10 +6096,10 @@
6105
6096
  switch (_typeof(this.table.options.footerElement)) {
6106
6097
  case "string":
6107
6098
  if (this.table.options.footerElement[0] === "<") {
6108
- this.element.innerHTML = this.table.options.footerElement;
6099
+ this.containerElement.innerHTML = this.table.options.footerElement;
6109
6100
  } else {
6110
6101
  this.external = true;
6111
- this.element = document.querySelector(this.table.options.footerElement);
6102
+ this.containerElement = document.querySelector(this.table.options.footerElement);
6112
6103
  }
6113
6104
 
6114
6105
  break;
@@ -6467,7 +6458,7 @@
6467
6458
  return row.getElement() === target;
6468
6459
  });
6469
6460
 
6470
- if (targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6461
+ if (targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6471
6462
  targets[key] = false;
6472
6463
  }
6473
6464
  }
@@ -7543,6 +7534,7 @@
7543
7534
  }, {
7544
7535
  key: "layout",
7545
7536
  value: function layout() {
7537
+ this.dispatch("layout-refreshing");
7546
7538
  Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
7547
7539
  this.dispatch("layout-refreshed");
7548
7540
  }
@@ -7935,18 +7927,30 @@
7935
7927
 
7936
7928
 
7937
7929
  tabulator.prototype.bindModules = function () {
7930
+ var orderedMods = [],
7931
+ unOrderedMods = [];
7938
7932
  this.modules = {};
7939
7933
 
7940
7934
  for (var name in tabulator.moduleBindings) {
7941
7935
  var mod = tabulator.moduleBindings[name];
7942
- this.modules[name] = new mod(this);
7936
+ var module = new mod(this);
7937
+ this.modules[name] = module;
7943
7938
 
7944
7939
  if (mod.prototype.moduleCore) {
7945
- this.modulesCore[name] = this.modules[name];
7940
+ this.modulesCore.push(module);
7946
7941
  } else {
7947
- this.modulesRegular[name] = this.modules[name];
7942
+ if (mod.moduleInitOrder) {
7943
+ orderedMods.push(module);
7944
+ } else {
7945
+ unOrderedMods.push(module);
7946
+ }
7948
7947
  }
7949
7948
  }
7949
+
7950
+ orderedMods.sort(function (a, b) {
7951
+ return a.moduleInitOrder > b.moduleInitOrder ? 1 : -1;
7952
+ });
7953
+ this.modulesRegular = orderedMods.concat(unOrderedMods);
7950
7954
  };
7951
7955
  }
7952
7956
  }, {
@@ -8004,15 +8008,15 @@
8004
8008
 
8005
8009
  this.modules = {}; //hold all modules bound to this table
8006
8010
 
8007
- this.modulesCore = {}; //hold core modules bound to this table (for initialization purposes)
8011
+ this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
8008
8012
 
8009
- this.modulesRegular = {}; //hold regular modules bound to this table (for initialization purposes)
8013
+ this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
8010
8014
 
8011
8015
  this.optionsList = new OptionsList(this, "table constructor");
8012
8016
  this.initialized = false;
8013
8017
 
8014
8018
  if (this.initializeElement(element)) {
8015
- this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
8019
+ this.initializeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
8016
8020
 
8017
8021
  setTimeout(function () {
8018
8022
  _this._create();
@@ -8043,8 +8047,8 @@
8043
8047
  }
8044
8048
  }
8045
8049
  }, {
8046
- key: "initialzeCoreSystems",
8047
- value: function initialzeCoreSystems(options) {
8050
+ key: "initializeCoreSystems",
8051
+ value: function initializeCoreSystems(options) {
8048
8052
  this.columnManager = new ColumnManager(this);
8049
8053
  this.rowManager = new RowManager(this);
8050
8054
  this.footerManager = new FooterManager(this);
@@ -8059,9 +8063,9 @@
8059
8063
  this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
8060
8064
  this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
8061
8065
  this.interactionMonitor = new InteractionManager(this);
8062
- this.dataLoader.initialize();
8063
- this.columnManager.initialize();
8064
- this.rowManager.initialize();
8066
+ this.dataLoader.initialize(); // this.columnManager.initialize();
8067
+ // this.rowManager.initialize();
8068
+
8065
8069
  this.footerManager.initialize();
8066
8070
  } //convert deprecated functionality to new functions
8067
8071
 
@@ -8136,7 +8140,7 @@
8136
8140
  value: function _clearObjectPointers() {
8137
8141
  this.options.columns = this.options.columns.slice(0);
8138
8142
 
8139
- if (this.options.data && !this.options.reactiveData) {
8143
+ if (Array.isArray(this.options.data) && !this.options.reactiveData) {
8140
8144
  this.options.data = this.options.data.slice(0);
8141
8145
  }
8142
8146
  } //build tabulator element
@@ -8203,21 +8207,9 @@
8203
8207
  this._detectBrowser(); //initialize core modules
8204
8208
 
8205
8209
 
8206
- for (var key in this.modulesCore) {
8207
- var mod = this.modulesCore[key];
8210
+ this.modulesCore.forEach(function (mod) {
8208
8211
  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
-
8212
+ }); //build table elements
8221
8213
 
8222
8214
  element.appendChild(this.columnManager.getElement());
8223
8215
  element.appendChild(this.rowManager.getElement());
@@ -8231,12 +8223,9 @@
8231
8223
  } //initialize regular modules
8232
8224
 
8233
8225
 
8234
- for (var _key in this.modulesRegular) {
8235
- var _mod = this.modulesRegular[_key];
8236
-
8237
- _mod.initialize();
8238
- }
8239
-
8226
+ this.modulesRegular.forEach(function (mod) {
8227
+ mod.initialize();
8228
+ });
8240
8229
  this.columnManager.setColumns(options.columns);
8241
8230
  this.eventBus.dispatch("table-built");
8242
8231
  }
@@ -8286,7 +8275,7 @@
8286
8275
  this.browserSlow = false;
8287
8276
  }
8288
8277
 
8289
- this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0, 4));
8278
+ this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.slice(0, 4));
8290
8279
  } ////////////////// Data Handling //////////////////
8291
8280
  //block table redrawing
8292
8281
 
@@ -9907,7 +9896,7 @@
9907
9896
  this.subscribe("row-added", this.rowsUpdated.bind(this));
9908
9897
  this.subscribe("column-moved", this.recalcActiveRows.bind(this));
9909
9898
  this.subscribe("column-add", this.recalcActiveRows.bind(this));
9910
- this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
9899
+ this.subscribe("data-refreshed", this.recalcActiveRowsRefresh.bind(this));
9911
9900
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
9912
9901
  this.subscribe("rows-visible", this.visibleRows.bind(this));
9913
9902
  this.registerTableFunction("getCalcResults", this.getResults.bind(this));
@@ -9955,6 +9944,15 @@
9955
9944
  this.recalcActiveRows();
9956
9945
  }
9957
9946
  }
9947
+ }, {
9948
+ key: "recalcActiveRowsRefresh",
9949
+ value: function recalcActiveRowsRefresh() {
9950
+ if (this.table.options.groupBy && this.table.options.dataTreeStartExpanded && this.table.options.dataTree) {
9951
+ this.recalcAll();
9952
+ } else {
9953
+ this.recalcActiveRows();
9954
+ }
9955
+ }
9958
9956
  }, {
9959
9957
  key: "recalcActiveRows",
9960
9958
  value: function recalcActiveRows() {
@@ -14309,7 +14307,8 @@
14309
14307
  var columns = [];
14310
14308
  header.forEach(function (col) {
14311
14309
  if (col) {
14312
- columns.push(new ExportColumn(col.title, col.column.getComponent(), col.width, col.height, col.depth));
14310
+ var title = typeof col.title === "undefined" ? "" : col.title;
14311
+ columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
14313
14312
  } else {
14314
14313
  columns.push(null);
14315
14314
  }
@@ -14561,7 +14560,9 @@
14561
14560
  if (col) {
14562
14561
  var cellEl = document.createElement("td"),
14563
14562
  column = col.component._column,
14563
+ index = _this8.table.columnManager.findColumnIndex(column),
14564
14564
  value = col.value;
14565
+
14565
14566
  var cellWrapper = {
14566
14567
  modules: {},
14567
14568
  getValue: function getValue() {
@@ -14616,8 +14617,8 @@
14616
14617
  cellEl.innerHTML = value;
14617
14618
  }
14618
14619
 
14619
- if (styles.firstCell) {
14620
- _this8.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]);
14620
+ if (styles.styleCells[index] || styles.firstCell) {
14621
+ _this8.mapElementStyles(styles.styleCells[index] || styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "text-align"]);
14621
14622
 
14622
14623
  if (column.definition.align) {
14623
14624
  cellEl.style.textAlign = column.definition.align;
@@ -15254,8 +15255,9 @@
15254
15255
  });
15255
15256
  editorElement.addEventListener("focus", function (e) {
15256
15257
  var left = _this3.table.columnManager.element.scrollLeft;
15258
+ var headerPos = _this3.table.rowManager.element.scrollLeft + parseInt(_this3.table.columnManager.element.style.marginLeft);
15257
15259
 
15258
- if (left !== _this3.table.rowManager.element.scrollLeft) {
15260
+ if (left !== headerPos) {
15259
15261
  _this3.table.rowManager.scrollHorizontal(left);
15260
15262
 
15261
15263
  _this3.table.columnManager.scrollHorizontal(left);
@@ -15430,6 +15432,8 @@
15430
15432
  value: function addFilter(field, type, value, params) {
15431
15433
  var _this4 = this;
15432
15434
 
15435
+ var changed = false;
15436
+
15433
15437
  if (!Array.isArray(field)) {
15434
15438
  field = [{
15435
15439
  field: field,
@@ -15445,9 +15449,13 @@
15445
15449
  if (filter) {
15446
15450
  _this4.filterList.push(filter);
15447
15451
 
15448
- _this4.changed = true;
15452
+ changed = true;
15449
15453
  }
15450
15454
  });
15455
+
15456
+ if (changed) {
15457
+ this.trackChanges();
15458
+ }
15451
15459
  }
15452
15460
  }, {
15453
15461
  key: "findFilter",
@@ -16231,7 +16239,7 @@
16231
16239
  }
16232
16240
 
16233
16241
  function rownum (cell, formatterParams, onRendered) {
16234
- return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1;
16242
+ return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1 || "";
16235
16243
  }
16236
16244
 
16237
16245
  function handle (cell, formatterParams, onRendered) {
@@ -16274,7 +16282,9 @@
16274
16282
  var _this = this;
16275
16283
 
16276
16284
  var checkbox = document.createElement("input");
16285
+ var blocked = false;
16277
16286
  checkbox.type = 'checkbox';
16287
+ checkbox.setAttribute("aria-label", "Select Row");
16278
16288
 
16279
16289
  if (this.table.modExists("selectRow", true)) {
16280
16290
  checkbox.addEventListener("click", function (e) {
@@ -16286,8 +16296,25 @@
16286
16296
 
16287
16297
  if (row instanceof RowComponent$1) {
16288
16298
  checkbox.addEventListener("change", function (e) {
16289
- row.toggleSelect();
16299
+ if (_this.table.options.selectableRangeMode === "click") {
16300
+ if (!blocked) {
16301
+ row.toggleSelect();
16302
+ } else {
16303
+ blocked = false;
16304
+ }
16305
+ } else {
16306
+ row.toggleSelect();
16307
+ }
16290
16308
  });
16309
+
16310
+ if (this.table.options.selectableRangeMode === "click") {
16311
+ checkbox.addEventListener("click", function (e) {
16312
+ blocked = true;
16313
+
16314
+ _this.table.modules.selectRow.handleComplexRowClick(row._row, e);
16315
+ });
16316
+ }
16317
+
16291
16318
  checkbox.checked = row.isSelected && row.isSelected();
16292
16319
  this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
16293
16320
  } else {
@@ -16580,6 +16607,7 @@
16580
16607
  _this.initializationMode = "left";
16581
16608
  _this.active = false;
16582
16609
  _this.scrollEndTimer = false;
16610
+ _this.blocked = true;
16583
16611
 
16584
16612
  _this.registerColumnOption("frozen");
16585
16613
 
@@ -16611,6 +16639,18 @@
16611
16639
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
16612
16640
  this.subscribe("columns-loading", this.reset.bind(this));
16613
16641
  this.subscribe("table-redraw", this.layout.bind(this));
16642
+ this.subscribe("layout-refreshing", this.blockLayout.bind(this));
16643
+ this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
16644
+ }
16645
+ }, {
16646
+ key: "blockLayout",
16647
+ value: function blockLayout() {
16648
+ this.blocked = true;
16649
+ }
16650
+ }, {
16651
+ key: "unblockLayout",
16652
+ value: function unblockLayout() {
16653
+ this.blocked = false;
16614
16654
  }
16615
16655
  }, {
16616
16656
  key: "layoutCell",
@@ -16666,13 +16706,9 @@
16666
16706
  var rows;
16667
16707
 
16668
16708
  if (this.active) {
16669
- clearTimeout(this.scrollEndTimer); //layout all rows after scroll is complete
16670
-
16671
- this.scrollEndTimer = setTimeout(function () {
16672
- _this2.layout();
16673
- }, 100);
16709
+ clearTimeout(this.scrollEndTimer);
16674
16710
  rows = this.table.rowManager.getVisibleRows();
16675
- this.calcMargins();
16711
+ this.calcMargins(true);
16676
16712
  this.layoutColumnPosition();
16677
16713
  this.layoutCalcRows();
16678
16714
  rows.forEach(function (row) {
@@ -16680,17 +16716,18 @@
16680
16716
  _this2.layoutRow(row);
16681
16717
  }
16682
16718
  });
16683
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16684
16719
  }
16685
16720
  } //calculate margins for rows
16686
16721
 
16687
16722
  }, {
16688
16723
  key: "calcMargins",
16689
- value: function calcMargins() {
16690
- this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
16691
- this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
16692
- this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
16693
- this.table.columnManager.element.style.paddingRight = this.rightMargin; //calculate right frozen columns
16724
+ value: function calcMargins(scroll) {
16725
+ if (!scroll) {
16726
+ this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
16727
+ this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
16728
+ this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16729
+ } //calculate right frozen columns
16730
+
16694
16731
 
16695
16732
  this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft;
16696
16733
  } //layout calculation rows
@@ -16738,8 +16775,16 @@
16738
16775
  var _this4 = this;
16739
16776
 
16740
16777
  var leftParents = [];
16778
+ var leftMargin = 0;
16779
+ var rightMargin = 0;
16780
+ this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
16781
+ this.table.columnManager.element.style.paddingRight = this.rightMargin;
16741
16782
  this.leftColumns.forEach(function (column, i) {
16742
- column.modules.frozen.margin = _this4._calcSpace(_this4.leftColumns, i) + _this4.table.columnManager.scrollLeft + "px";
16783
+ column.modules.frozen.margin = leftMargin + _this4.table.columnManager.scrollLeft + "px";
16784
+
16785
+ if (column.visible) {
16786
+ leftMargin += column.getWidth();
16787
+ }
16743
16788
 
16744
16789
  if (i == _this4.leftColumns.length - 1) {
16745
16790
  column.modules.frozen.edge = true;
@@ -16770,7 +16815,11 @@
16770
16815
  }
16771
16816
  });
16772
16817
  this.rightColumns.forEach(function (column, i) {
16773
- column.modules.frozen.margin = _this4.rightPadding - _this4._calcSpace(_this4.rightColumns, i + 1) + "px";
16818
+ if (column.visible) {
16819
+ rightMargin += column.getWidth();
16820
+ }
16821
+
16822
+ column.modules.frozen.margin = _this4.rightPadding - rightMargin + "px";
16774
16823
 
16775
16824
  if (i == _this4.rightColumns.length - 1) {
16776
16825
  column.modules.frozen.edge = true;
@@ -16795,14 +16844,14 @@
16795
16844
  key: "getColGroupParentElement",
16796
16845
  value: function getColGroupParentElement(column) {
16797
16846
  return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
16798
- } //layout columns appropropriatly
16847
+ } //layout columns appropriately
16799
16848
 
16800
16849
  }, {
16801
16850
  key: "layout",
16802
16851
  value: function layout() {
16803
16852
  var _this5 = this;
16804
16853
 
16805
- if (this.active) {
16854
+ if (this.active && !this.blocked) {
16806
16855
  //calculate row padding
16807
16856
  this.calcMargins();
16808
16857
  this.table.rowManager.getDisplayRows().forEach(function (row) {
@@ -16813,7 +16862,6 @@
16813
16862
  this.layoutCalcRows(); //calculate left columns
16814
16863
 
16815
16864
  this.layoutColumnPosition(true);
16816
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16817
16865
  }
16818
16866
  }
16819
16867
  }, {
@@ -16823,6 +16871,11 @@
16823
16871
 
16824
16872
  var rowEl = row.getElement();
16825
16873
  rowEl.style.paddingLeft = this.leftMargin;
16874
+
16875
+ if (this.table.options.layout === "fitDataFill" && this.rightColumns.length) {
16876
+ this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
16877
+ }
16878
+
16826
16879
  this.leftColumns.forEach(function (column) {
16827
16880
  var cell = row.getCell(column);
16828
16881
 
@@ -17256,10 +17309,12 @@
17256
17309
  }, {
17257
17310
  key: "scrollHeader",
17258
17311
  value: function scrollHeader(left) {
17259
- this.arrowElement.style.marginLeft = left;
17260
- this.groupList.forEach(function (child) {
17261
- child.scrollHeader(left);
17262
- });
17312
+ if (this.arrowElement) {
17313
+ this.arrowElement.style.marginLeft = left;
17314
+ this.groupList.forEach(function (child) {
17315
+ child.scrollHeader(left);
17316
+ });
17317
+ }
17263
17318
  }
17264
17319
  }, {
17265
17320
  key: "getRowIndex",
@@ -21200,19 +21255,28 @@
21200
21255
  this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21201
21256
  showingEl.innerHTML = value;
21202
21257
  });
21203
- valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21204
21258
  this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21205
21259
  ofEl.innerHTML = value;
21206
21260
  });
21207
- totalEl.innerHTML = " " + totalRows + " ";
21208
21261
  this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
21209
21262
  rowsEl.innerHTML = value;
21210
21263
  });
21211
- el.appendChild(showingEl);
21212
- el.appendChild(valueEl);
21213
- el.appendChild(ofEl);
21214
- el.appendChild(totalEl);
21215
- el.appendChild(rowsEl);
21264
+
21265
+ if (totalRows) {
21266
+ valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21267
+ totalEl.innerHTML = " " + totalRows + " ";
21268
+ el.appendChild(showingEl);
21269
+ el.appendChild(valueEl);
21270
+ el.appendChild(ofEl);
21271
+ el.appendChild(totalEl);
21272
+ el.appendChild(rowsEl);
21273
+ } else {
21274
+ valueEl.innerHTML = " 0 ";
21275
+ el.appendChild(showingEl);
21276
+ el.appendChild(valueEl);
21277
+ el.appendChild(rowsEl);
21278
+ }
21279
+
21216
21280
  return el;
21217
21281
  }
21218
21282
 
@@ -21345,11 +21409,14 @@
21345
21409
  value: function initialize() {
21346
21410
  if (this.table.options.pagination) {
21347
21411
  this.subscribe("row-deleted", this.rowsUpdated.bind(this));
21348
- this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
21349
21412
  this.subscribe("row-added", this.rowsUpdated.bind(this));
21350
21413
  this.subscribe("data-processed", this.initialLoadComplete.bind(this));
21351
21414
  this.subscribe("table-built", this.calculatePageSizes.bind(this));
21352
21415
 
21416
+ if (this.table.options.paginationAddRow == "page") {
21417
+ this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
21418
+ }
21419
+
21353
21420
  if (this.table.options.paginationMode === "remote") {
21354
21421
  this.subscribe("data-params", this.remotePageParams.bind(this));
21355
21422
  this.subscribe("data-loaded", this._parseRemoteData.bind(this));
@@ -22131,7 +22198,7 @@
22131
22198
  }, {
22132
22199
  key: "footerRedraw",
22133
22200
  value: function footerRedraw() {
22134
- var footer = this.table.footerManager.element;
22201
+ var footer = this.table.footerManager.containerElement;
22135
22202
 
22136
22203
  if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) {
22137
22204
  this.pagesElement.style.display = 'none';
@@ -22166,11 +22233,11 @@
22166
22233
  data; //if cookie exists, decode and load column data into tabulator
22167
22234
 
22168
22235
  if (cookiePos > -1) {
22169
- cookie = cookie.substr(cookiePos);
22236
+ cookie = cookie.slice(cookiePos);
22170
22237
  end = cookie.indexOf(";");
22171
22238
 
22172
22239
  if (end > -1) {
22173
- cookie = cookie.substr(0, end);
22240
+ cookie = cookie.slice(0, end);
22174
22241
  }
22175
22242
 
22176
22243
  data = cookie.replace(key + "=", "");
@@ -22338,9 +22405,9 @@
22338
22405
  this.subscribe("column-show", this.save.bind(this, "columns"));
22339
22406
  this.subscribe("column-hide", this.save.bind(this, "columns"));
22340
22407
  this.subscribe("column-moved", this.save.bind(this, "columns"));
22341
- this.subscribe("table-built", this.tableBuilt.bind(this), 0);
22342
22408
  }
22343
22409
 
22410
+ this.subscribe("table-built", this.tableBuilt.bind(this), 0);
22344
22411
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
22345
22412
  this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
22346
22413
  this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
@@ -22371,7 +22438,7 @@
22371
22438
  sorters = this.load("sort");
22372
22439
 
22373
22440
  if (!sorters === false) {
22374
- this.table.initialSort = sorters;
22441
+ this.table.options.initialSort = sorters;
22375
22442
  }
22376
22443
  }
22377
22444
 
@@ -22379,7 +22446,7 @@
22379
22446
  filters = this.load("filter");
22380
22447
 
22381
22448
  if (!filters === false) {
22382
- this.table.initialFilter = filters;
22449
+ this.table.options.initialFilter = filters;
22383
22450
  }
22384
22451
  }
22385
22452
  }
@@ -22662,7 +22729,8 @@
22662
22729
  return Persistence;
22663
22730
  }(Module);
22664
22731
 
22665
- Persistence.moduleName = "persistence"; //load defaults
22732
+ Persistence.moduleName = "persistence";
22733
+ Persistence.moduleInitOrder = 1; //load defaults
22666
22734
 
22667
22735
  Persistence.readers = defaultReaders;
22668
22736
  Persistence.writers = defaultWriters;
@@ -23214,11 +23282,18 @@
23214
23282
  }); //reszie column on double click
23215
23283
 
23216
23284
  handle.addEventListener("dblclick", function (e) {
23217
- var col = column.getLastColumn();
23285
+ var col = column.getLastColumn(),
23286
+ oldWidth;
23218
23287
 
23219
23288
  if (col && self._checkResizability(col)) {
23289
+ oldWidth = col.getWidth();
23220
23290
  e.stopPropagation();
23221
23291
  col.reinitializeWidth(true);
23292
+
23293
+ if (oldWidth !== col.getWidth()) {
23294
+ self.dispatch("column-resized", col);
23295
+ self.table.externalEvents.dispatch("columnResized", col.getComponent());
23296
+ }
23222
23297
  }
23223
23298
  });
23224
23299
  prevHandle.addEventListener("click", function (e) {
@@ -23305,8 +23380,11 @@
23305
23380
  handle.removeEventListener("touchmove", mouseMove);
23306
23381
  handle.removeEventListener("touchend", mouseUp);
23307
23382
  self.table.element.classList.remove("tabulator-block-select");
23308
- self.dispatch("column-resized", column);
23309
- self.table.externalEvents.dispatch("columnResized", column.getComponent());
23383
+
23384
+ if (self.startWidth !== column.getWidth()) {
23385
+ self.dispatch("column-resized", column);
23386
+ self.table.externalEvents.dispatch("columnResized", column.getComponent());
23387
+ }
23310
23388
  }
23311
23389
 
23312
23390
  e.stopPropagation(); //prevent resize from interfereing with movable columns
@@ -23929,7 +24007,7 @@
23929
24007
  var titleHighlight = document.createElement("strong");
23930
24008
  titleData.appendChild(titleHighlight);
23931
24009
  this.langBind("columns|" + item.field, function (text) {
23932
- titleHighlight.innerText = text || item.title;
24010
+ titleHighlight.innerHTML = text || item.title;
23933
24011
  });
23934
24012
 
23935
24013
  if (item.value instanceof Node) {
@@ -24072,53 +24150,7 @@
24072
24150
 
24073
24151
  if (self.table.options.selectable && self.table.options.selectable != "highlight") {
24074
24152
  if (self.table.options.selectableRangeMode === "click") {
24075
- element.addEventListener("click", function (e) {
24076
- if (e.shiftKey) {
24077
- self.table._clearSelection();
24078
-
24079
- self.lastClickedRow = self.lastClickedRow || row;
24080
- var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow);
24081
- var rowIdx = self.table.rowManager.getDisplayRowIndex(row);
24082
- var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
24083
- var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
24084
- var rows = self.table.rowManager.getDisplayRows().slice(0);
24085
- var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
24086
-
24087
- if (e.ctrlKey || e.metaKey) {
24088
- toggledRows.forEach(function (toggledRow) {
24089
- if (toggledRow !== self.lastClickedRow) {
24090
- if (self.table.options.selectable !== true && !self.isRowSelected(row)) {
24091
- if (self.selectedRows.length < self.table.options.selectable) {
24092
- self.toggleRow(toggledRow);
24093
- }
24094
- } else {
24095
- self.toggleRow(toggledRow);
24096
- }
24097
- }
24098
- });
24099
- self.lastClickedRow = row;
24100
- } else {
24101
- self.deselectRows(undefined, true);
24102
-
24103
- if (self.table.options.selectable !== true) {
24104
- if (toggledRows.length > self.table.options.selectable) {
24105
- toggledRows = toggledRows.slice(0, self.table.options.selectable);
24106
- }
24107
- }
24108
-
24109
- self.selectRows(toggledRows);
24110
- }
24111
-
24112
- self.table._clearSelection();
24113
- } else if (e.ctrlKey || e.metaKey) {
24114
- self.toggleRow(row);
24115
- self.lastClickedRow = row;
24116
- } else {
24117
- self.deselectRows(undefined, true);
24118
- self.selectRows(row);
24119
- self.lastClickedRow = row;
24120
- }
24121
- });
24153
+ element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
24122
24154
  } else {
24123
24155
  element.addEventListener("click", function (e) {
24124
24156
  if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) {
@@ -24165,6 +24197,57 @@
24165
24197
  element.classList.add("tabulator-unselectable");
24166
24198
  element.classList.remove("tabulator-selectable");
24167
24199
  }
24200
+ }
24201
+ }, {
24202
+ key: "handleComplexRowClick",
24203
+ value: function handleComplexRowClick(row, e) {
24204
+ var _this2 = this;
24205
+
24206
+ if (e.shiftKey) {
24207
+ this.table._clearSelection();
24208
+
24209
+ this.lastClickedRow = this.lastClickedRow || row;
24210
+ var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
24211
+ var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
24212
+ var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
24213
+ var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
24214
+ var rows = this.table.rowManager.getDisplayRows().slice(0);
24215
+ var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
24216
+
24217
+ if (e.ctrlKey || e.metaKey) {
24218
+ toggledRows.forEach(function (toggledRow) {
24219
+ if (toggledRow !== _this2.lastClickedRow) {
24220
+ if (_this2.table.options.selectable !== true && !_this2.isRowSelected(row)) {
24221
+ if (_this2.selectedRows.length < _this2.table.options.selectable) {
24222
+ _this2.toggleRow(toggledRow);
24223
+ }
24224
+ } else {
24225
+ _this2.toggleRow(toggledRow);
24226
+ }
24227
+ }
24228
+ });
24229
+ this.lastClickedRow = row;
24230
+ } else {
24231
+ this.deselectRows(undefined, true);
24232
+
24233
+ if (this.table.options.selectable !== true) {
24234
+ if (toggledRows.length > this.table.options.selectable) {
24235
+ toggledRows = toggledRows.slice(0, this.table.options.selectable);
24236
+ }
24237
+ }
24238
+
24239
+ this.selectRows(toggledRows);
24240
+ }
24241
+
24242
+ this.table._clearSelection();
24243
+ } else if (e.ctrlKey || e.metaKey) {
24244
+ this.toggleRow(row);
24245
+ this.lastClickedRow = row;
24246
+ } else {
24247
+ this.deselectRows(undefined, true);
24248
+ this.selectRows(row);
24249
+ this.lastClickedRow = row;
24250
+ }
24168
24251
  } //toggle row selection
24169
24252
 
24170
24253
  }, {
@@ -24182,14 +24265,14 @@
24182
24265
  }, {
24183
24266
  key: "selectRows",
24184
24267
  value: function selectRows(rows) {
24185
- var _this2 = this;
24268
+ var _this3 = this;
24186
24269
 
24187
24270
  var rowMatch;
24188
24271
 
24189
24272
  switch (_typeof(rows)) {
24190
24273
  case "undefined":
24191
24274
  this.table.rowManager.rows.forEach(function (row) {
24192
- _this2._selectRow(row, true, true);
24275
+ _this3._selectRow(row, true, true);
24193
24276
  });
24194
24277
 
24195
24278
  this._rowSelectionChanged();
@@ -24203,7 +24286,7 @@
24203
24286
  this._selectRow(rowMatch, true, true);
24204
24287
  } else {
24205
24288
  this.table.rowManager.getRows(rows).forEach(function (row) {
24206
- _this2._selectRow(row, true, true);
24289
+ _this3._selectRow(row, true, true);
24207
24290
  });
24208
24291
  }
24209
24292
 
@@ -24214,7 +24297,7 @@
24214
24297
  default:
24215
24298
  if (Array.isArray(rows)) {
24216
24299
  rows.forEach(function (row) {
24217
- _this2._selectRow(row, true, true);
24300
+ _this3._selectRow(row, true, true);
24218
24301
  });
24219
24302
 
24220
24303
  this._rowSelectionChanged();
@@ -24291,7 +24374,9 @@
24291
24374
  self._deselectRow(self.selectedRows[0], true);
24292
24375
  }
24293
24376
 
24294
- self._rowSelectionChanged(silent);
24377
+ if (rowCount) {
24378
+ self._rowSelectionChanged(silent);
24379
+ }
24295
24380
  } else {
24296
24381
  if (Array.isArray(rows)) {
24297
24382
  rows.forEach(function (row) {