tabulator-tables 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bower.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tabulator",
3
3
  "main": "dist/js/tabulator.js",
4
- "version": "5.3.1",
4
+ "version": "5.3.2",
5
5
  "description": "Interactive table generation JavaScript library",
6
6
  "keywords": [
7
7
  "table",
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.3.1 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.3.2 (c) Oliver Folkerd 2022 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -3479,13 +3479,13 @@
3479
3479
  }, {
3480
3480
  key: "moveColumn",
3481
3481
  value: function moveColumn(from, to, after) {
3482
- this.moveColumnActual(from, to, after);
3483
3482
  to.element.parentNode.insertBefore(from.element, to.element);
3484
3483
 
3485
3484
  if (after) {
3486
3485
  to.element.parentNode.insertBefore(to.element, from.element);
3487
3486
  }
3488
3487
 
3488
+ this.moveColumnActual(from, to, after);
3489
3489
  this.verticalAlignHeaders();
3490
3490
  this.table.rowManager.reinitialize();
3491
3491
  }
@@ -5692,80 +5692,82 @@
5692
5692
  index = 0,
5693
5693
  cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
5694
5694
 
5695
- if (typeof handler === "function") {
5696
- index = this.dataPipeline.findIndex(function (item) {
5697
- return item.handler === handler;
5698
- });
5699
-
5700
- if (index > -1) {
5701
- stage = "dataPipeline";
5702
-
5703
- if (skipStage) {
5704
- if (index == this.dataPipeline.length - 1) {
5705
- stage = "display";
5706
- } else {
5707
- index++;
5708
- }
5709
- }
5710
- } else {
5711
- index = this.displayPipeline.findIndex(function (item) {
5695
+ if (!this.table.destroyed) {
5696
+ if (typeof handler === "function") {
5697
+ index = this.dataPipeline.findIndex(function (item) {
5712
5698
  return item.handler === handler;
5713
5699
  });
5714
5700
 
5715
5701
  if (index > -1) {
5716
- stage = "displayPipeline";
5702
+ stage = "dataPipeline";
5717
5703
 
5718
5704
  if (skipStage) {
5719
- if (index == this.displayPipeline.length - 1) {
5720
- stage = "end";
5705
+ if (index == this.dataPipeline.length - 1) {
5706
+ stage = "display";
5721
5707
  } else {
5722
5708
  index++;
5723
5709
  }
5724
5710
  }
5725
5711
  } else {
5726
- console.error("Unable to refresh data, invalid handler provided", handler);
5727
- return;
5712
+ index = this.displayPipeline.findIndex(function (item) {
5713
+ return item.handler === handler;
5714
+ });
5715
+
5716
+ if (index > -1) {
5717
+ stage = "displayPipeline";
5718
+
5719
+ if (skipStage) {
5720
+ if (index == this.displayPipeline.length - 1) {
5721
+ stage = "end";
5722
+ } else {
5723
+ index++;
5724
+ }
5725
+ }
5726
+ } else {
5727
+ console.error("Unable to refresh data, invalid handler provided", handler);
5728
+ return;
5729
+ }
5728
5730
  }
5731
+ } else {
5732
+ stage = handler || "all";
5733
+ index = 0;
5729
5734
  }
5730
- } else {
5731
- stage = handler || "all";
5732
- index = 0;
5733
- }
5734
5735
 
5735
- if (this.redrawBlock) {
5736
- if (!this.redrawBlockRestoreConfig || this.redrawBlockRestoreConfig && (this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))) {
5737
- this.redrawBlockRestoreConfig = {
5738
- handler: handler,
5739
- skipStage: skipStage,
5740
- renderInPosition: renderInPosition,
5741
- stage: stage,
5742
- index: index
5743
- };
5744
- }
5736
+ if (this.redrawBlock) {
5737
+ if (!this.redrawBlockRestoreConfig || this.redrawBlockRestoreConfig && (this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))) {
5738
+ this.redrawBlockRestoreConfig = {
5739
+ handler: handler,
5740
+ skipStage: skipStage,
5741
+ renderInPosition: renderInPosition,
5742
+ stage: stage,
5743
+ index: index
5744
+ };
5745
+ }
5745
5746
 
5746
- return;
5747
- } else {
5748
- if (Helpers.elVisible(this.element)) {
5749
- if (renderInPosition) {
5750
- this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
5751
- } else {
5752
- this.refreshPipelines(handler, stage, index, renderInPosition);
5747
+ return;
5748
+ } else {
5749
+ if (Helpers.elVisible(this.element)) {
5750
+ if (renderInPosition) {
5751
+ this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
5752
+ } else {
5753
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5753
5754
 
5754
- if (!handler) {
5755
- this.table.columnManager.renderer.renderColumns();
5756
- }
5755
+ if (!handler) {
5756
+ this.table.columnManager.renderer.renderColumns();
5757
+ }
5757
5758
 
5758
- this.renderTable();
5759
+ this.renderTable();
5759
5760
 
5760
- if (table.options.layoutColumnsOnNewData) {
5761
- this.table.columnManager.redraw(true);
5761
+ if (table.options.layoutColumnsOnNewData) {
5762
+ this.table.columnManager.redraw(true);
5763
+ }
5762
5764
  }
5765
+ } else {
5766
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5763
5767
  }
5764
- } else {
5765
- this.refreshPipelines(handler, stage, index, renderInPosition);
5766
- }
5767
5768
 
5768
- this.dispatch("data-refreshed");
5769
+ this.dispatch("data-refreshed");
5770
+ }
5769
5771
  }
5770
5772
  }
5771
5773
  }, {
@@ -5841,21 +5843,11 @@
5841
5843
  }, {
5842
5844
  key: "setDisplayRows",
5843
5845
  value: function setDisplayRows(displayRows, index) {
5844
- var output = true;
5845
-
5846
- if (index && typeof this.displayRows[index] != "undefined") {
5847
- this.displayRows[index] = displayRows;
5848
- output = true;
5849
- } else {
5850
- this.displayRows.push(displayRows);
5851
- output = index = this.displayRows.length - 1;
5852
- }
5846
+ this.displayRows[index] = displayRows;
5853
5847
 
5854
5848
  if (index == this.displayRows.length - 1) {
5855
5849
  this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length;
5856
5850
  }
5857
-
5858
- return output;
5859
5851
  }
5860
5852
  }, {
5861
5853
  key: "getDisplayRows",
@@ -6547,6 +6539,7 @@
6547
6539
  //ensure row component is looked up before cell
6548
6540
  var keys = Object.keys(targets).reverse(),
6549
6541
  listener = this.listeners[type],
6542
+ matches = {},
6550
6543
  targetMatches = {};
6551
6544
 
6552
6545
  var _iterator4 = _createForOfIteratorHelper(keys),
@@ -6555,9 +6548,9 @@
6555
6548
  try {
6556
6549
  var _loop = function _loop() {
6557
6550
  var key = _step4.value;
6558
- var component = void 0;
6559
- var target = targets[key];
6560
- var previousTarget = _this5.previousTargets[key];
6551
+ var component = void 0,
6552
+ target = targets[key],
6553
+ previousTarget = _this5.previousTargets[key];
6561
6554
 
6562
6555
  if (previousTarget && previousTarget.target === target) {
6563
6556
  component = previousTarget.component;
@@ -6588,8 +6581,8 @@
6588
6581
 
6589
6582
  case "cell":
6590
6583
  if (listener.components.includes("cell")) {
6591
- if (targets["row"] instanceof Row) {
6592
- component = targets["row"].findCell(target);
6584
+ if (matches["row"] instanceof Row) {
6585
+ component = matches["row"].findCell(target);
6593
6586
  } else {
6594
6587
  if (targets["row"]) {
6595
6588
  console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?");
@@ -6602,7 +6595,7 @@
6602
6595
  }
6603
6596
 
6604
6597
  if (component) {
6605
- targets[key] = component;
6598
+ matches[key] = component;
6606
6599
  targetMatches[key] = {
6607
6600
  target: target,
6608
6601
  component: component
@@ -6620,7 +6613,7 @@
6620
6613
  }
6621
6614
 
6622
6615
  this.previousTargets = targetMatches;
6623
- return targets;
6616
+ return matches;
6624
6617
  }
6625
6618
  }, {
6626
6619
  key: "triggerEvents",
@@ -8923,7 +8916,7 @@
8923
8916
  data = JSON.parse(data);
8924
8917
  }
8925
8918
 
8926
- if (data) {
8919
+ if (data && data.length > 0) {
8927
8920
  data.forEach(function (item) {
8928
8921
  var row = _this2.rowManager.findRow(item[_this2.options.index]);
8929
8922
 
@@ -8987,7 +8980,7 @@
8987
8980
  data = JSON.parse(data);
8988
8981
  }
8989
8982
 
8990
- if (data) {
8983
+ if (data && data.length > 0) {
8991
8984
  data.forEach(function (item) {
8992
8985
  var row = _this4.rowManager.findRow(item[_this4.options.index]);
8993
8986
 
@@ -20423,7 +20416,7 @@
20423
20416
  var range;
20424
20417
 
20425
20418
  if (this.table.modExists("edit")) {
20426
- if (this.table.modules.edit.currentCell === this) {
20419
+ if (this.table.modules.edit.currentCell === cell) {
20427
20420
  return; //prevent instant selection of editor content
20428
20421
  }
20429
20422
  }
@@ -26544,13 +26537,10 @@
26544
26537
 
26545
26538
  if (match > -1) {
26546
26539
  sorters[match].dir = dir;
26540
+ match = sorters.splice(match, 1)[0];
26547
26541
 
26548
- if (match != sorters.length - 1) {
26549
- match = sorters.splice(match, 1)[0];
26550
-
26551
- if (dir != "none") {
26552
- sorters.push(match);
26553
- }
26542
+ if (dir != "none") {
26543
+ sorters.push(match);
26554
26544
  }
26555
26545
  } else {
26556
26546
  if (dir != "none") {
@@ -26775,7 +26765,7 @@
26775
26765
  var sortEl = column.modules.sort.element,
26776
26766
  arrowEl;
26777
26767
 
26778
- if (typeof this.table.options.headerSortElement === "function") {
26768
+ if (column.definition.headerSort && typeof this.table.options.headerSortElement === "function") {
26779
26769
  while (sortEl.firstChild) {
26780
26770
  sortEl.removeChild(sortEl.firstChild);
26781
26771
  }