tabulator-tables 5.1.3 → 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.
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.3",
4
+ "version": "5.1.4",
5
5
  "description": "Interactive table generation JavaScript library",
6
6
  "keywords": [
7
7
  "table",
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.1.3 (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());
@@ -6099,7 +6099,7 @@
6099
6099
  this.containerElement.innerHTML = this.table.options.footerElement;
6100
6100
  } else {
6101
6101
  this.external = true;
6102
- this.element = document.querySelector(this.table.options.footerElement);
6102
+ this.containerElement = document.querySelector(this.table.options.footerElement);
6103
6103
  }
6104
6104
 
6105
6105
  break;
@@ -6458,7 +6458,7 @@
6458
6458
  return row.getElement() === target;
6459
6459
  });
6460
6460
 
6461
- if (targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6461
+ if (targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6462
6462
  targets[key] = false;
6463
6463
  }
6464
6464
  }
@@ -8140,7 +8140,7 @@
8140
8140
  value: function _clearObjectPointers() {
8141
8141
  this.options.columns = this.options.columns.slice(0);
8142
8142
 
8143
- if (this.options.data && !this.options.reactiveData) {
8143
+ if (Array.isArray(this.options.data) && !this.options.reactiveData) {
8144
8144
  this.options.data = this.options.data.slice(0);
8145
8145
  }
8146
8146
  } //build tabulator element
@@ -14560,7 +14560,9 @@
14560
14560
  if (col) {
14561
14561
  var cellEl = document.createElement("td"),
14562
14562
  column = col.component._column,
14563
+ index = _this8.table.columnManager.findColumnIndex(column),
14563
14564
  value = col.value;
14565
+
14564
14566
  var cellWrapper = {
14565
14567
  modules: {},
14566
14568
  getValue: function getValue() {
@@ -14615,8 +14617,8 @@
14615
14617
  cellEl.innerHTML = value;
14616
14618
  }
14617
14619
 
14618
- if (styles.firstCell) {
14619
- _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"]);
14620
14622
 
14621
14623
  if (column.definition.align) {
14622
14624
  cellEl.style.textAlign = column.definition.align;
@@ -15253,8 +15255,9 @@
15253
15255
  });
15254
15256
  editorElement.addEventListener("focus", function (e) {
15255
15257
  var left = _this3.table.columnManager.element.scrollLeft;
15258
+ var headerPos = _this3.table.rowManager.element.scrollLeft + parseInt(_this3.table.columnManager.element.style.marginLeft);
15256
15259
 
15257
- if (left !== _this3.table.rowManager.element.scrollLeft) {
15260
+ if (left !== headerPos) {
15258
15261
  _this3.table.rowManager.scrollHorizontal(left);
15259
15262
 
15260
15263
  _this3.table.columnManager.scrollHorizontal(left);
@@ -16281,6 +16284,7 @@
16281
16284
  var checkbox = document.createElement("input");
16282
16285
  var blocked = false;
16283
16286
  checkbox.type = 'checkbox';
16287
+ checkbox.setAttribute("aria-label", "Select Row");
16284
16288
 
16285
16289
  if (this.table.modExists("selectRow", true)) {
16286
16290
  checkbox.addEventListener("click", function (e) {
@@ -16702,13 +16706,9 @@
16702
16706
  var rows;
16703
16707
 
16704
16708
  if (this.active) {
16705
- clearTimeout(this.scrollEndTimer); //layout all rows after scroll is complete
16706
-
16707
- this.scrollEndTimer = setTimeout(function () {
16708
- _this2.layout();
16709
- }, 100);
16709
+ clearTimeout(this.scrollEndTimer);
16710
16710
  rows = this.table.rowManager.getVisibleRows();
16711
- this.calcMargins();
16711
+ this.calcMargins(true);
16712
16712
  this.layoutColumnPosition();
16713
16713
  this.layoutCalcRows();
16714
16714
  rows.forEach(function (row) {
@@ -16716,17 +16716,18 @@
16716
16716
  _this2.layoutRow(row);
16717
16717
  }
16718
16718
  });
16719
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16720
16719
  }
16721
16720
  } //calculate margins for rows
16722
16721
 
16723
16722
  }, {
16724
16723
  key: "calcMargins",
16725
- value: function calcMargins() {
16726
- this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
16727
- this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
16728
- this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
16729
- 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
+
16730
16731
 
16731
16732
  this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft;
16732
16733
  } //layout calculation rows
@@ -16774,8 +16775,16 @@
16774
16775
  var _this4 = this;
16775
16776
 
16776
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;
16777
16782
  this.leftColumns.forEach(function (column, i) {
16778
- 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
+ }
16779
16788
 
16780
16789
  if (i == _this4.leftColumns.length - 1) {
16781
16790
  column.modules.frozen.edge = true;
@@ -16806,7 +16815,11 @@
16806
16815
  }
16807
16816
  });
16808
16817
  this.rightColumns.forEach(function (column, i) {
16809
- 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";
16810
16823
 
16811
16824
  if (i == _this4.rightColumns.length - 1) {
16812
16825
  column.modules.frozen.edge = true;
@@ -16849,7 +16862,6 @@
16849
16862
  this.layoutCalcRows(); //calculate left columns
16850
16863
 
16851
16864
  this.layoutColumnPosition(true);
16852
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
16853
16865
  }
16854
16866
  }
16855
16867
  }, {
@@ -21243,19 +21255,28 @@
21243
21255
  this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21244
21256
  showingEl.innerHTML = value;
21245
21257
  });
21246
- valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21247
21258
  this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21248
21259
  ofEl.innerHTML = value;
21249
21260
  });
21250
- totalEl.innerHTML = " " + totalRows + " ";
21251
21261
  this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
21252
21262
  rowsEl.innerHTML = value;
21253
21263
  });
21254
- el.appendChild(showingEl);
21255
- el.appendChild(valueEl);
21256
- el.appendChild(ofEl);
21257
- el.appendChild(totalEl);
21258
- 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
+
21259
21280
  return el;
21260
21281
  }
21261
21282
 
@@ -22177,7 +22198,7 @@
22177
22198
  }, {
22178
22199
  key: "footerRedraw",
22179
22200
  value: function footerRedraw() {
22180
- var footer = this.table.footerManager.element;
22201
+ var footer = this.table.footerManager.containerElement;
22181
22202
 
22182
22203
  if (Math.ceil(footer.clientWidth) - footer.scrollWidth < 0) {
22183
22204
  this.pagesElement.style.display = 'none';
@@ -24353,7 +24374,9 @@
24353
24374
  self._deselectRow(self.selectedRows[0], true);
24354
24375
  }
24355
24376
 
24356
- self._rowSelectionChanged(silent);
24377
+ if (rowCount) {
24378
+ self._rowSelectionChanged(silent);
24379
+ }
24357
24380
  } else {
24358
24381
  if (Array.isArray(rows)) {
24359
24382
  rows.forEach(function (row) {