tabulator-tables 5.1.2 → 5.1.5

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.2 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.1.5 (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) :
@@ -2542,9 +2542,10 @@
2542
2542
  _this.vDomPadLeft = 0;
2543
2543
  _this.vDomPadRight = 0;
2544
2544
  _this.fitDataColAvg = 0;
2545
- _this.window = 200; //pixel margin to make column visible before it is shown on screen
2545
+ _this.windowBuffer = 200; //pixel margin to make column visible before it is shown on screen
2546
2546
 
2547
2547
  _this.initialized = false;
2548
+ _this.isFitData = false;
2548
2549
  _this.columns = [];
2549
2550
  return _this;
2550
2551
  }
@@ -2553,6 +2554,7 @@
2553
2554
  key: "initialize",
2554
2555
  value: function initialize() {
2555
2556
  this.compatibilityCheck();
2557
+ this.layoutCheck();
2556
2558
  }
2557
2559
  }, {
2558
2560
  key: "compatibilityCheck",
@@ -2591,6 +2593,11 @@
2591
2593
 
2592
2594
 
2593
2595
  return ok;
2596
+ }
2597
+ }, {
2598
+ key: "layoutCheck",
2599
+ value: function layoutCheck() {
2600
+ this.isFitData = this.options("layout").startsWith('fitData');
2594
2601
  } //////////////////////////////////////
2595
2602
  ///////// Public Functions ///////////
2596
2603
  //////////////////////////////////////
@@ -2605,9 +2612,24 @@
2605
2612
  value: function scrollColumns(left, dir) {
2606
2613
  if (this.scrollLeft != left) {
2607
2614
  this.scrollLeft = left;
2608
- this.scroll(left - (this.vDomScrollPosLeft + this.window));
2615
+ this.scroll(left - (this.vDomScrollPosLeft + this.windowBuffer));
2609
2616
  }
2610
2617
  }
2618
+ }, {
2619
+ key: "calcWindowBuffer",
2620
+ value: function calcWindowBuffer() {
2621
+ var buffer = this.elementVertical.clientWidth;
2622
+ this.table.columnManager.columnsByIndex.forEach(function (column) {
2623
+ if (column.visible) {
2624
+ var width = column.getWidth();
2625
+
2626
+ if (width > buffer) {
2627
+ buffer = width;
2628
+ }
2629
+ }
2630
+ });
2631
+ this.windowBuffer = buffer * 2;
2632
+ }
2611
2633
  }, {
2612
2634
  key: "rerenderColumns",
2613
2635
  value: function rerenderColumns(update, blockRedraw) {
@@ -2617,17 +2639,18 @@
2617
2639
  cols: this.columns,
2618
2640
  leftCol: this.leftCol,
2619
2641
  rightCol: this.rightCol
2620
- };
2642
+ },
2643
+ colPos = 0;
2621
2644
 
2622
2645
  if (update && !this.initialized) {
2623
2646
  return;
2624
2647
  }
2625
2648
 
2626
2649
  this.clear();
2650
+ this.calcWindowBuffer();
2627
2651
  this.scrollLeft = this.elementVertical.scrollLeft;
2628
- this.vDomScrollPosLeft = this.scrollLeft - this.window;
2629
- this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.window;
2630
- var colPos = 0;
2652
+ this.vDomScrollPosLeft = this.scrollLeft - this.windowBuffer;
2653
+ this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
2631
2654
  this.table.columnManager.columnsByIndex.forEach(function (column) {
2632
2655
  var config = {};
2633
2656
 
@@ -2637,7 +2660,7 @@
2637
2660
  config.rightPos = colPos + width;
2638
2661
  config.width = width;
2639
2662
 
2640
- if (_this2.options("layout") === "fitData") {
2663
+ if (_this2.isFitData) {
2641
2664
  config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
2642
2665
  }
2643
2666
 
@@ -2728,7 +2751,7 @@
2728
2751
  row,
2729
2752
  rowEl;
2730
2753
 
2731
- if (this.options("layout") === "fitData") {
2754
+ if (this.isFitData) {
2732
2755
  this.table.columnManager.columnsByIndex.forEach(function (column) {
2733
2756
  if (!column.definition.width && column.visible) {
2734
2757
  change = true;
@@ -2737,9 +2760,9 @@
2737
2760
 
2738
2761
  if (change) {
2739
2762
  if (change && this.table.rowManager.getDisplayRows().length) {
2740
- this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.window;
2763
+ this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
2741
2764
  var row = this.chain("rows-sample", [1], [], function () {
2742
- return _this3.table.rowManager.getDisplayRows()[0];
2765
+ return _this3.table.rowManager.getDisplayRows();
2743
2766
  })[0];
2744
2767
 
2745
2768
  if (row) {
@@ -3884,6 +3907,7 @@
3884
3907
 
3885
3908
  this.dispatch("row-layout-before", this);
3886
3909
  this.generateCells();
3910
+ this.initialized = true;
3887
3911
  this.table.columnManager.renderer.renderRowCells(this);
3888
3912
 
3889
3913
  if (force) {
@@ -3891,7 +3915,6 @@
3891
3915
  }
3892
3916
 
3893
3917
  this.dispatch("row-layout", this);
3894
- this.initialized = true;
3895
3918
 
3896
3919
  if (this.table.options.rowFormatter) {
3897
3920
  this.table.options.rowFormatter(this.getComponent());
@@ -6066,9 +6089,6 @@
6066
6089
 
6067
6090
  _this.external = false;
6068
6091
  _this.links = [];
6069
-
6070
- _this.initializeElement();
6071
-
6072
6092
  return _this;
6073
6093
  }
6074
6094
 
@@ -6099,10 +6119,10 @@
6099
6119
  switch (_typeof(this.table.options.footerElement)) {
6100
6120
  case "string":
6101
6121
  if (this.table.options.footerElement[0] === "<") {
6102
- this.element.innerHTML = this.table.options.footerElement;
6122
+ this.containerElement.innerHTML = this.table.options.footerElement;
6103
6123
  } else {
6104
6124
  this.external = true;
6105
- this.element = document.querySelector(this.table.options.footerElement);
6125
+ this.containerElement = document.querySelector(this.table.options.footerElement);
6106
6126
  }
6107
6127
 
6108
6128
  break;
@@ -6461,7 +6481,7 @@
6461
6481
  return row.getElement() === target;
6462
6482
  });
6463
6483
 
6464
- if (targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6484
+ if (targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6465
6485
  targets[key] = false;
6466
6486
  }
6467
6487
  }
@@ -7537,6 +7557,7 @@
7537
7557
  }, {
7538
7558
  key: "layout",
7539
7559
  value: function layout() {
7560
+ this.dispatch("layout-refreshing");
7540
7561
  Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
7541
7562
  this.dispatch("layout-refreshed");
7542
7563
  }
@@ -8018,7 +8039,7 @@
8018
8039
  this.initialized = false;
8019
8040
 
8020
8041
  if (this.initializeElement(element)) {
8021
- this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
8042
+ this.initializeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
8022
8043
 
8023
8044
  setTimeout(function () {
8024
8045
  _this._create();
@@ -8049,8 +8070,8 @@
8049
8070
  }
8050
8071
  }
8051
8072
  }, {
8052
- key: "initialzeCoreSystems",
8053
- value: function initialzeCoreSystems(options) {
8073
+ key: "initializeCoreSystems",
8074
+ value: function initializeCoreSystems(options) {
8054
8075
  this.columnManager = new ColumnManager(this);
8055
8076
  this.rowManager = new RowManager(this);
8056
8077
  this.footerManager = new FooterManager(this);
@@ -8142,7 +8163,7 @@
8142
8163
  value: function _clearObjectPointers() {
8143
8164
  this.options.columns = this.options.columns.slice(0);
8144
8165
 
8145
- if (this.options.data && !this.options.reactiveData) {
8166
+ if (Array.isArray(this.options.data) && !this.options.reactiveData) {
8146
8167
  this.options.data = this.options.data.slice(0);
8147
8168
  }
8148
8169
  } //build tabulator element
@@ -8277,7 +8298,7 @@
8277
8298
  this.browserSlow = false;
8278
8299
  }
8279
8300
 
8280
- 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));
8301
+ 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));
8281
8302
  } ////////////////// Data Handling //////////////////
8282
8303
  //block table redrawing
8283
8304
 
@@ -9898,7 +9919,7 @@
9898
9919
  this.subscribe("row-added", this.rowsUpdated.bind(this));
9899
9920
  this.subscribe("column-moved", this.recalcActiveRows.bind(this));
9900
9921
  this.subscribe("column-add", this.recalcActiveRows.bind(this));
9901
- this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
9922
+ this.subscribe("data-refreshed", this.recalcActiveRowsRefresh.bind(this));
9902
9923
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
9903
9924
  this.subscribe("rows-visible", this.visibleRows.bind(this));
9904
9925
  this.registerTableFunction("getCalcResults", this.getResults.bind(this));
@@ -9946,6 +9967,15 @@
9946
9967
  this.recalcActiveRows();
9947
9968
  }
9948
9969
  }
9970
+ }, {
9971
+ key: "recalcActiveRowsRefresh",
9972
+ value: function recalcActiveRowsRefresh() {
9973
+ if (this.table.options.groupBy && this.table.options.dataTreeStartExpanded && this.table.options.dataTree) {
9974
+ this.recalcAll();
9975
+ } else {
9976
+ this.recalcActiveRows();
9977
+ }
9978
+ }
9949
9979
  }, {
9950
9980
  key: "recalcActiveRows",
9951
9981
  value: function recalcActiveRows() {
@@ -14553,7 +14583,9 @@
14553
14583
  if (col) {
14554
14584
  var cellEl = document.createElement("td"),
14555
14585
  column = col.component._column,
14586
+ index = _this8.table.columnManager.findColumnIndex(column),
14556
14587
  value = col.value;
14588
+
14557
14589
  var cellWrapper = {
14558
14590
  modules: {},
14559
14591
  getValue: function getValue() {
@@ -14608,8 +14640,8 @@
14608
14640
  cellEl.innerHTML = value;
14609
14641
  }
14610
14642
 
14611
- if (styles.firstCell) {
14612
- _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"]);
14643
+ if (styles.styleCells[index] || styles.firstCell) {
14644
+ _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"]);
14613
14645
 
14614
14646
  if (column.definition.align) {
14615
14647
  cellEl.style.textAlign = column.definition.align;
@@ -15246,8 +15278,9 @@
15246
15278
  });
15247
15279
  editorElement.addEventListener("focus", function (e) {
15248
15280
  var left = _this3.table.columnManager.element.scrollLeft;
15281
+ var headerPos = _this3.table.rowManager.element.scrollLeft + parseInt(_this3.table.columnManager.element.style.marginLeft);
15249
15282
 
15250
- if (left !== _this3.table.rowManager.element.scrollLeft) {
15283
+ if (left !== headerPos) {
15251
15284
  _this3.table.rowManager.scrollHorizontal(left);
15252
15285
 
15253
15286
  _this3.table.columnManager.scrollHorizontal(left);
@@ -16272,7 +16305,9 @@
16272
16305
  var _this = this;
16273
16306
 
16274
16307
  var checkbox = document.createElement("input");
16308
+ var blocked = false;
16275
16309
  checkbox.type = 'checkbox';
16310
+ checkbox.setAttribute("aria-label", "Select Row");
16276
16311
 
16277
16312
  if (this.table.modExists("selectRow", true)) {
16278
16313
  checkbox.addEventListener("click", function (e) {
@@ -16284,8 +16319,25 @@
16284
16319
 
16285
16320
  if (row instanceof RowComponent$1) {
16286
16321
  checkbox.addEventListener("change", function (e) {
16287
- row.toggleSelect();
16322
+ if (_this.table.options.selectableRangeMode === "click") {
16323
+ if (!blocked) {
16324
+ row.toggleSelect();
16325
+ } else {
16326
+ blocked = false;
16327
+ }
16328
+ } else {
16329
+ row.toggleSelect();
16330
+ }
16288
16331
  });
16332
+
16333
+ if (this.table.options.selectableRangeMode === "click") {
16334
+ checkbox.addEventListener("click", function (e) {
16335
+ blocked = true;
16336
+
16337
+ _this.table.modules.selectRow.handleComplexRowClick(row._row, e);
16338
+ });
16339
+ }
16340
+
16289
16341
  checkbox.checked = row.isSelected && row.isSelected();
16290
16342
  this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
16291
16343
  } else {
@@ -16578,6 +16630,7 @@
16578
16630
  _this.initializationMode = "left";
16579
16631
  _this.active = false;
16580
16632
  _this.scrollEndTimer = false;
16633
+ _this.blocked = true;
16581
16634
 
16582
16635
  _this.registerColumnOption("frozen");
16583
16636
 
@@ -16609,6 +16662,18 @@
16609
16662
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
16610
16663
  this.subscribe("columns-loading", this.reset.bind(this));
16611
16664
  this.subscribe("table-redraw", this.layout.bind(this));
16665
+ this.subscribe("layout-refreshing", this.blockLayout.bind(this));
16666
+ this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
16667
+ }
16668
+ }, {
16669
+ key: "blockLayout",
16670
+ value: function blockLayout() {
16671
+ this.blocked = true;
16672
+ }
16673
+ }, {
16674
+ key: "unblockLayout",
16675
+ value: function unblockLayout() {
16676
+ this.blocked = false;
16612
16677
  }
16613
16678
  }, {
16614
16679
  key: "layoutCell",
@@ -16664,13 +16729,9 @@
16664
16729
  var rows;
16665
16730
 
16666
16731
  if (this.active) {
16667
- clearTimeout(this.scrollEndTimer); //layout all rows after scroll is complete
16668
-
16669
- this.scrollEndTimer = setTimeout(function () {
16670
- _this2.layout();
16671
- }, 100);
16732
+ clearTimeout(this.scrollEndTimer);
16672
16733
  rows = this.table.rowManager.getVisibleRows();
16673
- this.calcMargins();
16734
+ this.calcMargins(true);
16674
16735
  this.layoutColumnPosition();
16675
16736
  this.layoutCalcRows();
16676
16737
  rows.forEach(function (row) {
@@ -16678,17 +16739,18 @@
16678
16739
  _this2.layoutRow(row);
16679
16740
  }
16680
16741
  });
16681
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16682
16742
  }
16683
16743
  } //calculate margins for rows
16684
16744
 
16685
16745
  }, {
16686
16746
  key: "calcMargins",
16687
- value: function calcMargins() {
16688
- this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
16689
- this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
16690
- this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
16691
- this.table.columnManager.element.style.paddingRight = this.rightMargin; //calculate right frozen columns
16747
+ value: function calcMargins(scroll) {
16748
+ if (!scroll) {
16749
+ this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
16750
+ this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
16751
+ this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16752
+ } //calculate right frozen columns
16753
+
16692
16754
 
16693
16755
  this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft;
16694
16756
  } //layout calculation rows
@@ -16736,8 +16798,16 @@
16736
16798
  var _this4 = this;
16737
16799
 
16738
16800
  var leftParents = [];
16801
+ var leftMargin = 0;
16802
+ var rightMargin = 0;
16803
+ this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
16804
+ this.table.columnManager.element.style.paddingRight = this.rightMargin;
16739
16805
  this.leftColumns.forEach(function (column, i) {
16740
- column.modules.frozen.margin = _this4._calcSpace(_this4.leftColumns, i) + _this4.table.columnManager.scrollLeft + "px";
16806
+ column.modules.frozen.margin = leftMargin + _this4.table.columnManager.scrollLeft + "px";
16807
+
16808
+ if (column.visible) {
16809
+ leftMargin += column.getWidth();
16810
+ }
16741
16811
 
16742
16812
  if (i == _this4.leftColumns.length - 1) {
16743
16813
  column.modules.frozen.edge = true;
@@ -16768,7 +16838,11 @@
16768
16838
  }
16769
16839
  });
16770
16840
  this.rightColumns.forEach(function (column, i) {
16771
- column.modules.frozen.margin = _this4.rightPadding - _this4._calcSpace(_this4.rightColumns, i + 1) + "px";
16841
+ if (column.visible) {
16842
+ rightMargin += column.getWidth();
16843
+ }
16844
+
16845
+ column.modules.frozen.margin = _this4.rightPadding - rightMargin + "px";
16772
16846
 
16773
16847
  if (i == _this4.rightColumns.length - 1) {
16774
16848
  column.modules.frozen.edge = true;
@@ -16793,14 +16867,14 @@
16793
16867
  key: "getColGroupParentElement",
16794
16868
  value: function getColGroupParentElement(column) {
16795
16869
  return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
16796
- } //layout columns appropropriatly
16870
+ } //layout columns appropriately
16797
16871
 
16798
16872
  }, {
16799
16873
  key: "layout",
16800
16874
  value: function layout() {
16801
16875
  var _this5 = this;
16802
16876
 
16803
- if (this.active) {
16877
+ if (this.active && !this.blocked) {
16804
16878
  //calculate row padding
16805
16879
  this.calcMargins();
16806
16880
  this.table.rowManager.getDisplayRows().forEach(function (row) {
@@ -16811,7 +16885,6 @@
16811
16885
  this.layoutCalcRows(); //calculate left columns
16812
16886
 
16813
16887
  this.layoutColumnPosition(true);
16814
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16815
16888
  }
16816
16889
  }
16817
16890
  }, {
@@ -16821,6 +16894,11 @@
16821
16894
 
16822
16895
  var rowEl = row.getElement();
16823
16896
  rowEl.style.paddingLeft = this.leftMargin;
16897
+
16898
+ if (this.table.options.layout === "fitDataFill" && this.rightColumns.length) {
16899
+ this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
16900
+ }
16901
+
16824
16902
  this.leftColumns.forEach(function (column) {
16825
16903
  var cell = row.getCell(column);
16826
16904
 
@@ -17254,10 +17332,12 @@
17254
17332
  }, {
17255
17333
  key: "scrollHeader",
17256
17334
  value: function scrollHeader(left) {
17257
- this.arrowElement.style.marginLeft = left;
17258
- this.groupList.forEach(function (child) {
17259
- child.scrollHeader(left);
17260
- });
17335
+ if (this.arrowElement) {
17336
+ this.arrowElement.style.marginLeft = left;
17337
+ this.groupList.forEach(function (child) {
17338
+ child.scrollHeader(left);
17339
+ });
17340
+ }
17261
17341
  }
17262
17342
  }, {
17263
17343
  key: "getRowIndex",
@@ -21198,19 +21278,28 @@
21198
21278
  this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21199
21279
  showingEl.innerHTML = value;
21200
21280
  });
21201
- valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21202
21281
  this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21203
21282
  ofEl.innerHTML = value;
21204
21283
  });
21205
- totalEl.innerHTML = " " + totalRows + " ";
21206
21284
  this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
21207
21285
  rowsEl.innerHTML = value;
21208
21286
  });
21209
- el.appendChild(showingEl);
21210
- el.appendChild(valueEl);
21211
- el.appendChild(ofEl);
21212
- el.appendChild(totalEl);
21213
- el.appendChild(rowsEl);
21287
+
21288
+ if (totalRows) {
21289
+ valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21290
+ totalEl.innerHTML = " " + totalRows + " ";
21291
+ el.appendChild(showingEl);
21292
+ el.appendChild(valueEl);
21293
+ el.appendChild(ofEl);
21294
+ el.appendChild(totalEl);
21295
+ el.appendChild(rowsEl);
21296
+ } else {
21297
+ valueEl.innerHTML = " 0 ";
21298
+ el.appendChild(showingEl);
21299
+ el.appendChild(valueEl);
21300
+ el.appendChild(rowsEl);
21301
+ }
21302
+
21214
21303
  return el;
21215
21304
  }
21216
21305
 
@@ -21847,17 +21936,17 @@
21847
21936
  }
21848
21937
  }, {
21849
21938
  key: "_setPageCounter",
21850
- value: function _setPageCounter(totalRows) {
21851
- var content, currentRow;
21939
+ value: function _setPageCounter(totalRows, size, currentRow) {
21940
+ var content;
21852
21941
 
21853
21942
  if (this.pageCounter) {
21854
- currentRow = (this.page - 1) * this.size + 1;
21855
-
21856
21943
  if (this.mode === "remote") {
21944
+ size = this.size;
21945
+ currentRow = (this.page - 1) * this.size + 1;
21857
21946
  totalRows = this.remoteRowCountEstimate;
21858
21947
  }
21859
21948
 
21860
- content = this.pageCounter.call(this, this.size, currentRow, this.page, totalRows, this.max);
21949
+ content = this.pageCounter.call(this, size, currentRow, this.page, totalRows, this.max);
21861
21950
 
21862
21951
  switch (_typeof(content)) {
21863
21952
  case "object":
@@ -22005,7 +22094,14 @@
22005
22094
  }, {
22006
22095
  key: "getRows",
22007
22096
  value: function getRows(data) {
22008
- var output, start, end;
22097
+ var actualRowPageSize = 0,
22098
+ output,
22099
+ start,
22100
+ end,
22101
+ actualStartRow;
22102
+ var actualRows = data.filter(function (row) {
22103
+ return row.type === "row";
22104
+ });
22009
22105
 
22010
22106
  if (this.mode == "local") {
22011
22107
  output = [];
@@ -22022,18 +22118,28 @@
22022
22118
  this._setPageButtons();
22023
22119
 
22024
22120
  for (var i = start; i < end; i++) {
22025
- if (data[i]) {
22026
- output.push(data[i]);
22121
+ var row = data[i];
22122
+
22123
+ if (row) {
22124
+ output.push(row);
22125
+
22126
+ if (row.type === "row") {
22127
+ if (!actualStartRow) {
22128
+ actualStartRow = row;
22129
+ }
22130
+
22131
+ actualRowPageSize++;
22132
+ }
22027
22133
  }
22028
22134
  }
22029
22135
 
22030
- this._setPageCounter(data.length);
22136
+ this._setPageCounter(actualRows.length, actualRowPageSize, actualStartRow ? actualRows.indexOf(actualStartRow) + 1 : 0);
22031
22137
 
22032
22138
  return output;
22033
22139
  } else {
22034
22140
  this._setPageButtons();
22035
22141
 
22036
- this._setPageCounter(data.length);
22142
+ this._setPageCounter(actualRows.length);
22037
22143
 
22038
22144
  return data.slice(0);
22039
22145
  }
@@ -22132,7 +22238,7 @@
22132
22238
  }, {
22133
22239
  key: "footerRedraw",
22134
22240
  value: function footerRedraw() {
22135
- var footer = this.table.footerManager.element;
22241
+ var footer = this.table.footerManager.containerElement;
22136
22242
 
22137
22243
  if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) {
22138
22244
  this.pagesElement.style.display = 'none';
@@ -22167,11 +22273,11 @@
22167
22273
  data; //if cookie exists, decode and load column data into tabulator
22168
22274
 
22169
22275
  if (cookiePos > -1) {
22170
- cookie = cookie.substr(cookiePos);
22276
+ cookie = cookie.slice(cookiePos);
22171
22277
  end = cookie.indexOf(";");
22172
22278
 
22173
22279
  if (end > -1) {
22174
- cookie = cookie.substr(0, end);
22280
+ cookie = cookie.slice(0, end);
22175
22281
  }
22176
22282
 
22177
22283
  data = cookie.replace(key + "=", "");
@@ -23216,11 +23322,18 @@
23216
23322
  }); //reszie column on double click
23217
23323
 
23218
23324
  handle.addEventListener("dblclick", function (e) {
23219
- var col = column.getLastColumn();
23325
+ var col = column.getLastColumn(),
23326
+ oldWidth;
23220
23327
 
23221
23328
  if (col && self._checkResizability(col)) {
23329
+ oldWidth = col.getWidth();
23222
23330
  e.stopPropagation();
23223
23331
  col.reinitializeWidth(true);
23332
+
23333
+ if (oldWidth !== col.getWidth()) {
23334
+ self.dispatch("column-resized", col);
23335
+ self.table.externalEvents.dispatch("columnResized", col.getComponent());
23336
+ }
23224
23337
  }
23225
23338
  });
23226
23339
  prevHandle.addEventListener("click", function (e) {
@@ -23307,8 +23420,11 @@
23307
23420
  handle.removeEventListener("touchmove", mouseMove);
23308
23421
  handle.removeEventListener("touchend", mouseUp);
23309
23422
  self.table.element.classList.remove("tabulator-block-select");
23310
- self.dispatch("column-resized", column);
23311
- self.table.externalEvents.dispatch("columnResized", column.getComponent());
23423
+
23424
+ if (self.startWidth !== column.getWidth()) {
23425
+ self.dispatch("column-resized", column);
23426
+ self.table.externalEvents.dispatch("columnResized", column.getComponent());
23427
+ }
23312
23428
  }
23313
23429
 
23314
23430
  e.stopPropagation(); //prevent resize from interfereing with movable columns
@@ -24074,53 +24190,7 @@
24074
24190
 
24075
24191
  if (self.table.options.selectable && self.table.options.selectable != "highlight") {
24076
24192
  if (self.table.options.selectableRangeMode === "click") {
24077
- element.addEventListener("click", function (e) {
24078
- if (e.shiftKey) {
24079
- self.table._clearSelection();
24080
-
24081
- self.lastClickedRow = self.lastClickedRow || row;
24082
- var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow);
24083
- var rowIdx = self.table.rowManager.getDisplayRowIndex(row);
24084
- var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
24085
- var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
24086
- var rows = self.table.rowManager.getDisplayRows().slice(0);
24087
- var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
24088
-
24089
- if (e.ctrlKey || e.metaKey) {
24090
- toggledRows.forEach(function (toggledRow) {
24091
- if (toggledRow !== self.lastClickedRow) {
24092
- if (self.table.options.selectable !== true && !self.isRowSelected(row)) {
24093
- if (self.selectedRows.length < self.table.options.selectable) {
24094
- self.toggleRow(toggledRow);
24095
- }
24096
- } else {
24097
- self.toggleRow(toggledRow);
24098
- }
24099
- }
24100
- });
24101
- self.lastClickedRow = row;
24102
- } else {
24103
- self.deselectRows(undefined, true);
24104
-
24105
- if (self.table.options.selectable !== true) {
24106
- if (toggledRows.length > self.table.options.selectable) {
24107
- toggledRows = toggledRows.slice(0, self.table.options.selectable);
24108
- }
24109
- }
24110
-
24111
- self.selectRows(toggledRows);
24112
- }
24113
-
24114
- self.table._clearSelection();
24115
- } else if (e.ctrlKey || e.metaKey) {
24116
- self.toggleRow(row);
24117
- self.lastClickedRow = row;
24118
- } else {
24119
- self.deselectRows(undefined, true);
24120
- self.selectRows(row);
24121
- self.lastClickedRow = row;
24122
- }
24123
- });
24193
+ element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
24124
24194
  } else {
24125
24195
  element.addEventListener("click", function (e) {
24126
24196
  if (!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()) {
@@ -24167,6 +24237,57 @@
24167
24237
  element.classList.add("tabulator-unselectable");
24168
24238
  element.classList.remove("tabulator-selectable");
24169
24239
  }
24240
+ }
24241
+ }, {
24242
+ key: "handleComplexRowClick",
24243
+ value: function handleComplexRowClick(row, e) {
24244
+ var _this2 = this;
24245
+
24246
+ if (e.shiftKey) {
24247
+ this.table._clearSelection();
24248
+
24249
+ this.lastClickedRow = this.lastClickedRow || row;
24250
+ var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
24251
+ var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
24252
+ var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
24253
+ var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
24254
+ var rows = this.table.rowManager.getDisplayRows().slice(0);
24255
+ var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
24256
+
24257
+ if (e.ctrlKey || e.metaKey) {
24258
+ toggledRows.forEach(function (toggledRow) {
24259
+ if (toggledRow !== _this2.lastClickedRow) {
24260
+ if (_this2.table.options.selectable !== true && !_this2.isRowSelected(row)) {
24261
+ if (_this2.selectedRows.length < _this2.table.options.selectable) {
24262
+ _this2.toggleRow(toggledRow);
24263
+ }
24264
+ } else {
24265
+ _this2.toggleRow(toggledRow);
24266
+ }
24267
+ }
24268
+ });
24269
+ this.lastClickedRow = row;
24270
+ } else {
24271
+ this.deselectRows(undefined, true);
24272
+
24273
+ if (this.table.options.selectable !== true) {
24274
+ if (toggledRows.length > this.table.options.selectable) {
24275
+ toggledRows = toggledRows.slice(0, this.table.options.selectable);
24276
+ }
24277
+ }
24278
+
24279
+ this.selectRows(toggledRows);
24280
+ }
24281
+
24282
+ this.table._clearSelection();
24283
+ } else if (e.ctrlKey || e.metaKey) {
24284
+ this.toggleRow(row);
24285
+ this.lastClickedRow = row;
24286
+ } else {
24287
+ this.deselectRows(undefined, true);
24288
+ this.selectRows(row);
24289
+ this.lastClickedRow = row;
24290
+ }
24170
24291
  } //toggle row selection
24171
24292
 
24172
24293
  }, {
@@ -24184,14 +24305,14 @@
24184
24305
  }, {
24185
24306
  key: "selectRows",
24186
24307
  value: function selectRows(rows) {
24187
- var _this2 = this;
24308
+ var _this3 = this;
24188
24309
 
24189
24310
  var rowMatch;
24190
24311
 
24191
24312
  switch (_typeof(rows)) {
24192
24313
  case "undefined":
24193
24314
  this.table.rowManager.rows.forEach(function (row) {
24194
- _this2._selectRow(row, true, true);
24315
+ _this3._selectRow(row, true, true);
24195
24316
  });
24196
24317
 
24197
24318
  this._rowSelectionChanged();
@@ -24205,7 +24326,7 @@
24205
24326
  this._selectRow(rowMatch, true, true);
24206
24327
  } else {
24207
24328
  this.table.rowManager.getRows(rows).forEach(function (row) {
24208
- _this2._selectRow(row, true, true);
24329
+ _this3._selectRow(row, true, true);
24209
24330
  });
24210
24331
  }
24211
24332
 
@@ -24216,7 +24337,7 @@
24216
24337
  default:
24217
24338
  if (Array.isArray(rows)) {
24218
24339
  rows.forEach(function (row) {
24219
- _this2._selectRow(row, true, true);
24340
+ _this3._selectRow(row, true, true);
24220
24341
  });
24221
24342
 
24222
24343
  this._rowSelectionChanged();
@@ -24293,7 +24414,9 @@
24293
24414
  self._deselectRow(self.selectedRows[0], true);
24294
24415
  }
24295
24416
 
24296
- self._rowSelectionChanged(silent);
24417
+ if (rowCount) {
24418
+ self._rowSelectionChanged(silent);
24419
+ }
24297
24420
  } else {
24298
24421
  if (Array.isArray(rows)) {
24299
24422
  rows.forEach(function (row) {