tabulator-tables 5.3.0 → 5.3.3

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 (46) hide show
  1. package/bower.json +1 -1
  2. package/dist/css/tabulator_bootstrap3.css +1 -1
  3. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  4. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  5. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  6. package/dist/css/tabulator_bootstrap4.css +4 -4
  7. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  8. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  9. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  10. package/dist/css/tabulator_bootstrap5.css +4 -4
  11. package/dist/css/tabulator_bootstrap5.css.map +1 -1
  12. package/dist/css/tabulator_bootstrap5.min.css +1 -1
  13. package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
  14. package/dist/js/tabulator.js +304 -233
  15. package/dist/js/tabulator.js.map +1 -1
  16. package/dist/js/tabulator.min.js +2 -2
  17. package/dist/js/tabulator.min.js.map +1 -1
  18. package/dist/js/tabulator_esm.js +456 -388
  19. package/dist/js/tabulator_esm.js.map +1 -1
  20. package/dist/js/tabulator_esm.min.js +2 -2
  21. package/dist/js/tabulator_esm.min.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/js/core/ColumnManager.js +18 -4
  24. package/src/js/core/Module.js +54 -23
  25. package/src/js/core/RowManager.js +83 -94
  26. package/src/js/core/Tabulator.js +2 -2
  27. package/src/js/core/column/Column.js +26 -2
  28. package/src/js/core/tools/InteractionMonitor.js +12 -9
  29. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
  30. package/src/js/modules/DataTree/DataTree.js +5 -11
  31. package/src/js/modules/Edit/List.js +1 -1
  32. package/src/js/modules/Filter/Filter.js +3 -0
  33. package/src/js/modules/GroupRows/Group.js +5 -9
  34. package/src/js/modules/GroupRows/GroupComponent.js +1 -1
  35. package/src/js/modules/GroupRows/GroupRows.js +217 -194
  36. package/src/js/modules/History/History.js +1 -1
  37. package/src/js/modules/Interaction/Interaction.js +3 -3
  38. package/src/js/modules/Layout/defaults/modes/fitColumns.js +4 -6
  39. package/src/js/modules/Page/Page.js +2 -12
  40. package/src/js/modules/Persistence/Persistence.js +3 -2
  41. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +3 -2
  42. package/src/js/modules/SelectRow/SelectRow.js +8 -4
  43. package/src/js/modules/Sort/Sort.js +4 -7
  44. package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +1 -1
  45. package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +1 -1
  46. package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +1 -1
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.3.0 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.3.3 (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) :
@@ -1624,8 +1624,19 @@
1624
1624
 
1625
1625
  }, {
1626
1626
  key: "getColumns",
1627
- value: function getColumns() {
1628
- return this.columns;
1627
+ value: function getColumns(traverse) {
1628
+ var columns = [];
1629
+
1630
+ if (traverse) {
1631
+ this.columns.forEach(function (column) {
1632
+ columns.push(column);
1633
+ columns = columns.concat(column.getColumns(true));
1634
+ });
1635
+ } else {
1636
+ columns = this.columns;
1637
+ }
1638
+
1639
+ return columns;
1629
1640
  } //return all columns in a group
1630
1641
 
1631
1642
  }, {
@@ -1855,6 +1866,11 @@
1855
1866
  }, {
1856
1867
  key: "setMinWidth",
1857
1868
  value: function setMinWidth(minWidth) {
1869
+ if (this.maxWidth && minWidth > this.maxWidth) {
1870
+ minWidth = this.maxWidth;
1871
+ console.warn("the minWidth (" + minWidth + "px) for column '" + this.field + "' cannot be bigger that its maxWidth (" + this.maxWidthStyled + ")");
1872
+ }
1873
+
1858
1874
  this.minWidth = minWidth;
1859
1875
  this.minWidthStyled = minWidth ? minWidth + "px" : "";
1860
1876
  this.element.style.minWidth = this.minWidthStyled;
@@ -1865,6 +1881,11 @@
1865
1881
  }, {
1866
1882
  key: "setMaxWidth",
1867
1883
  value: function setMaxWidth(maxWidth) {
1884
+ if (this.minWidth && maxWidth < this.minWidth) {
1885
+ maxWidth = this.minWidth;
1886
+ console.warn("the maxWidth (" + maxWidth + "px) for column '" + this.field + "' cannot be smaller that its minWidth (" + this.minWidthStyled + ")");
1887
+ }
1888
+
1868
1889
  this.maxWidth = maxWidth;
1869
1890
  this.maxWidthStyled = maxWidth ? maxWidth + "px" : "";
1870
1891
  this.element.style.maxWidth = this.maxWidthStyled;
@@ -3304,6 +3325,7 @@
3304
3325
  var minHeight = 0;
3305
3326
 
3306
3327
  if (!this.redrawBlock) {
3328
+ this.element.style.height = "";
3307
3329
  this.columns.forEach(function (column) {
3308
3330
  column.clearVerticalAlign();
3309
3331
  });
@@ -3314,6 +3336,7 @@
3314
3336
  minHeight = height;
3315
3337
  }
3316
3338
  });
3339
+ this.element.style.height = minHeight + "px";
3317
3340
  this.columns.forEach(function (column) {
3318
3341
  column.verticalAlign(_this3.table.options.columnHeaderVertAlign, minHeight);
3319
3342
  });
@@ -3324,6 +3347,8 @@
3324
3347
  }, {
3325
3348
  key: "findColumn",
3326
3349
  value: function findColumn(subject) {
3350
+ var columns;
3351
+
3327
3352
  if (_typeof(subject) == "object") {
3328
3353
  if (subject instanceof Column) {
3329
3354
  //subject is column element
@@ -3332,8 +3357,13 @@
3332
3357
  //subject is public column component
3333
3358
  return subject._getSelf() || false;
3334
3359
  } else if (typeof HTMLElement !== "undefined" && subject instanceof HTMLElement) {
3335
- //subject is a HTML element of the column header
3336
- var match = this.columns.find(function (column) {
3360
+ columns = [];
3361
+ this.columns.forEach(function (column) {
3362
+ columns.push(column);
3363
+ columns = columns.concat(column.getColumns(true));
3364
+ }); //subject is a HTML element of the column header
3365
+
3366
+ var match = columns.find(function (column) {
3337
3367
  return column.element === subject;
3338
3368
  });
3339
3369
  return match || false;
@@ -3451,13 +3481,13 @@
3451
3481
  }, {
3452
3482
  key: "moveColumn",
3453
3483
  value: function moveColumn(from, to, after) {
3454
- this.moveColumnActual(from, to, after);
3455
3484
  to.element.parentNode.insertBefore(from.element, to.element);
3456
3485
 
3457
3486
  if (after) {
3458
3487
  to.element.parentNode.insertBefore(to.element, from.element);
3459
3488
  }
3460
3489
 
3490
+ this.moveColumnActual(from, to, after);
3461
3491
  this.verticalAlignHeaders();
3462
3492
  this.table.rowManager.reinitialize();
3463
3493
  }
@@ -5664,80 +5694,82 @@
5664
5694
  index = 0,
5665
5695
  cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
5666
5696
 
5667
- if (typeof handler === "function") {
5668
- index = this.dataPipeline.findIndex(function (item) {
5669
- return item.handler === handler;
5670
- });
5671
-
5672
- if (index > -1) {
5673
- stage = "dataPipeline";
5674
-
5675
- if (skipStage) {
5676
- if (index == this.dataPipeline.length - 1) {
5677
- stage = "display";
5678
- } else {
5679
- index++;
5680
- }
5681
- }
5682
- } else {
5683
- index = this.displayPipeline.findIndex(function (item) {
5697
+ if (!this.table.destroyed) {
5698
+ if (typeof handler === "function") {
5699
+ index = this.dataPipeline.findIndex(function (item) {
5684
5700
  return item.handler === handler;
5685
5701
  });
5686
5702
 
5687
5703
  if (index > -1) {
5688
- stage = "displayPipeline";
5704
+ stage = "dataPipeline";
5689
5705
 
5690
5706
  if (skipStage) {
5691
- if (index == this.displayPipeline.length - 1) {
5692
- stage = "end";
5707
+ if (index == this.dataPipeline.length - 1) {
5708
+ stage = "display";
5693
5709
  } else {
5694
5710
  index++;
5695
5711
  }
5696
5712
  }
5697
5713
  } else {
5698
- console.error("Unable to refresh data, invalid handler provided", handler);
5699
- return;
5714
+ index = this.displayPipeline.findIndex(function (item) {
5715
+ return item.handler === handler;
5716
+ });
5717
+
5718
+ if (index > -1) {
5719
+ stage = "displayPipeline";
5720
+
5721
+ if (skipStage) {
5722
+ if (index == this.displayPipeline.length - 1) {
5723
+ stage = "end";
5724
+ } else {
5725
+ index++;
5726
+ }
5727
+ }
5728
+ } else {
5729
+ console.error("Unable to refresh data, invalid handler provided", handler);
5730
+ return;
5731
+ }
5700
5732
  }
5733
+ } else {
5734
+ stage = handler || "all";
5735
+ index = 0;
5701
5736
  }
5702
- } else {
5703
- stage = handler || "all";
5704
- index = 0;
5705
- }
5706
5737
 
5707
- if (this.redrawBlock) {
5708
- if (!this.redrawBlockRestoreConfig || this.redrawBlockRestoreConfig && (this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))) {
5709
- this.redrawBlockRestoreConfig = {
5710
- handler: handler,
5711
- skipStage: skipStage,
5712
- renderInPosition: renderInPosition,
5713
- stage: stage,
5714
- index: index
5715
- };
5716
- }
5738
+ if (this.redrawBlock) {
5739
+ if (!this.redrawBlockRestoreConfig || this.redrawBlockRestoreConfig && (this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index || cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))) {
5740
+ this.redrawBlockRestoreConfig = {
5741
+ handler: handler,
5742
+ skipStage: skipStage,
5743
+ renderInPosition: renderInPosition,
5744
+ stage: stage,
5745
+ index: index
5746
+ };
5747
+ }
5717
5748
 
5718
- return;
5719
- } else {
5720
- if (Helpers.elVisible(this.element)) {
5721
- if (renderInPosition) {
5722
- this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
5723
- } else {
5724
- this.refreshPipelines(handler, stage, index, renderInPosition);
5749
+ return;
5750
+ } else {
5751
+ if (Helpers.elVisible(this.element)) {
5752
+ if (renderInPosition) {
5753
+ this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
5754
+ } else {
5755
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5725
5756
 
5726
- if (!handler) {
5727
- this.table.columnManager.renderer.renderColumns();
5728
- }
5757
+ if (!handler) {
5758
+ this.table.columnManager.renderer.renderColumns();
5759
+ }
5729
5760
 
5730
- this.renderTable();
5761
+ this.renderTable();
5731
5762
 
5732
- if (table.options.layoutColumnsOnNewData) {
5733
- this.table.columnManager.redraw(true);
5763
+ if (table.options.layoutColumnsOnNewData) {
5764
+ this.table.columnManager.redraw(true);
5765
+ }
5734
5766
  }
5767
+ } else {
5768
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5735
5769
  }
5736
- } else {
5737
- this.refreshPipelines(handler, stage, index, renderInPosition);
5738
- }
5739
5770
 
5740
- this.dispatch("data-refreshed");
5771
+ this.dispatch("data-refreshed");
5772
+ }
5741
5773
  }
5742
5774
  }
5743
5775
  }, {
@@ -5803,31 +5835,16 @@
5803
5835
  this.displayRows = [];
5804
5836
  this.displayRows.push(this.activeRows.slice(0));
5805
5837
  this.displayRowsCount = this.displayRows[0].length;
5806
- }
5807
- }, {
5808
- key: "getNextDisplayIndex",
5809
- value: function getNextDisplayIndex() {
5810
- return this.displayRows.length;
5811
5838
  } //set display row pipeline data
5812
5839
 
5813
5840
  }, {
5814
5841
  key: "setDisplayRows",
5815
5842
  value: function setDisplayRows(displayRows, index) {
5816
- var output = true;
5817
-
5818
- if (index && typeof this.displayRows[index] != "undefined") {
5819
- this.displayRows[index] = displayRows;
5820
- output = true;
5821
- } else {
5822
- this.displayRows.push(displayRows);
5823
- output = index = this.displayRows.length - 1;
5824
- }
5843
+ this.displayRows[index] = displayRows;
5825
5844
 
5826
5845
  if (index == this.displayRows.length - 1) {
5827
5846
  this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length;
5828
5847
  }
5829
-
5830
- return output;
5831
5848
  }
5832
5849
  }, {
5833
5850
  key: "getDisplayRows",
@@ -5861,23 +5878,24 @@
5861
5878
  }, {
5862
5879
  key: "getRows",
5863
5880
  value: function getRows(type) {
5864
- var rows;
5865
-
5866
- switch (type) {
5867
- case "active":
5868
- rows = this.activeRows;
5869
- break;
5881
+ var rows = [];
5870
5882
 
5871
- case "display":
5872
- rows = this.table.rowManager.getDisplayRows();
5873
- break;
5883
+ if (!type) {
5884
+ rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
5885
+ } else {
5886
+ switch (type) {
5887
+ case "active":
5888
+ rows = this.activeRows;
5889
+ break;
5874
5890
 
5875
- case "visible":
5876
- rows = this.getVisibleRows(false, true);
5877
- break;
5891
+ case "display":
5892
+ rows = this.table.rowManager.getDisplayRows();
5893
+ break;
5878
5894
 
5879
- default:
5880
- rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
5895
+ case "visible":
5896
+ rows = this.getVisibleRows(false, true);
5897
+ break;
5898
+ }
5881
5899
  }
5882
5900
 
5883
5901
  return rows;
@@ -5920,6 +5938,7 @@
5920
5938
  }
5921
5939
 
5922
5940
  if (renderClass) {
5941
+ this.renderMode = this.table.options.renderVertical;
5923
5942
  this.renderer = new renderClass(this.table, this.element, this.tableElement);
5924
5943
  this.renderer.initialize();
5925
5944
 
@@ -5985,9 +6004,7 @@
5985
6004
  this._clearPlaceholder();
5986
6005
 
5987
6006
  this.scrollTop = 0;
5988
- this.scrollLeft = 0; // clear empty table placeholder min
5989
-
5990
- this.tableElement.style.minWidth = "";
6007
+ this.scrollLeft = 0;
5991
6008
  this.renderer.clearRows();
5992
6009
  }
5993
6010
  }, {
@@ -6004,7 +6021,9 @@
6004
6021
  key: "_clearPlaceholder",
6005
6022
  value: function _clearPlaceholder() {
6006
6023
  if (this.placeholder && this.placeholder.parentNode) {
6007
- this.placeholder.parentNode.removeChild(this.placeholder);
6024
+ this.placeholder.parentNode.removeChild(this.placeholder); // clear empty table placeholder min
6025
+
6026
+ this.tableElement.style.minWidth = "";
6008
6027
  }
6009
6028
  }
6010
6029
  }, {
@@ -6487,7 +6506,10 @@
6487
6506
  try {
6488
6507
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
6489
6508
  var target = _step3.value;
6490
- targets[this.componentMap[target]] = el;
6509
+
6510
+ if (!targets[this.componentMap[target]]) {
6511
+ targets[this.componentMap[target]] = el;
6512
+ }
6491
6513
  }
6492
6514
  } catch (err) {
6493
6515
  _iterator3.e(err);
@@ -6515,6 +6537,7 @@
6515
6537
  //ensure row component is looked up before cell
6516
6538
  var keys = Object.keys(targets).reverse(),
6517
6539
  listener = this.listeners[type],
6540
+ matches = {},
6518
6541
  targetMatches = {};
6519
6542
 
6520
6543
  var _iterator4 = _createForOfIteratorHelper(keys),
@@ -6523,9 +6546,9 @@
6523
6546
  try {
6524
6547
  var _loop = function _loop() {
6525
6548
  var key = _step4.value;
6526
- var component = void 0;
6527
- var target = targets[key];
6528
- var previousTarget = _this5.previousTargets[key];
6549
+ var component = void 0,
6550
+ target = targets[key],
6551
+ previousTarget = _this5.previousTargets[key];
6529
6552
 
6530
6553
  if (previousTarget && previousTarget.target === target) {
6531
6554
  component = previousTarget.component;
@@ -6556,8 +6579,8 @@
6556
6579
 
6557
6580
  case "cell":
6558
6581
  if (listener.components.includes("cell")) {
6559
- if (targets["row"] instanceof Row) {
6560
- component = targets["row"].findCell(target);
6582
+ if (matches["row"] instanceof Row) {
6583
+ component = matches["row"].findCell(target);
6561
6584
  } else {
6562
6585
  if (targets["row"]) {
6563
6586
  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?");
@@ -6570,7 +6593,7 @@
6570
6593
  }
6571
6594
 
6572
6595
  if (component) {
6573
- targets[key] = component;
6596
+ matches[key] = component;
6574
6597
  targetMatches[key] = {
6575
6598
  target: target,
6576
6599
  component: component
@@ -6588,7 +6611,7 @@
6588
6611
  }
6589
6612
 
6590
6613
  this.previousTargets = targetMatches;
6591
- return targets;
6614
+ return matches;
6592
6615
  }
6593
6616
  }, {
6594
6617
  key: "triggerEvents",
@@ -7616,6 +7639,41 @@
7616
7639
  this.table.rowManager.registerDisplayPipelineHandler(handler, priority);
7617
7640
  this._handler = handler;
7618
7641
  }
7642
+ }, {
7643
+ key: "displayRows",
7644
+ value: function displayRows(adjust) {
7645
+ var _this3 = this;
7646
+
7647
+ var index = this.table.rowManager.displayRows.length - 1,
7648
+ lookupIndex;
7649
+
7650
+ if (this._handler) {
7651
+ lookupIndex = this.table.rowManager.displayPipeline.findIndex(function (item) {
7652
+ return item.handler === _this3._handler;
7653
+ });
7654
+
7655
+ if (lookupIndex > -1) {
7656
+ index = lookupIndex;
7657
+ }
7658
+ }
7659
+
7660
+ if (adjust) {
7661
+ index = index + adjust;
7662
+ }
7663
+
7664
+ if (this._handler) {
7665
+ if (index > -1) {
7666
+ return this.table.rowManager.getDisplayRows(index);
7667
+ } else {
7668
+ return this.activeRows();
7669
+ }
7670
+ }
7671
+ }
7672
+ }, {
7673
+ key: "activeRows",
7674
+ value: function activeRows() {
7675
+ return this.table.rowManager.activeRows;
7676
+ }
7619
7677
  }, {
7620
7678
  key: "refreshData",
7621
7679
  value: function refreshData(renderInPosition, handler) {
@@ -7737,7 +7795,7 @@
7737
7795
 
7738
7796
  //resize columns to fit
7739
7797
  function fitColumns (columns, forced) {
7740
- var totalWidth = this.table.element.clientWidth; //table element width
7798
+ var totalWidth = this.table.rowManager.element.getBoundingClientRect().width; //table element width
7741
7799
 
7742
7800
  var fixedWidth = 0; //total width of columns with a defined width
7743
7801
 
@@ -7820,8 +7878,7 @@
7820
7878
  });
7821
7879
  remainingSpace = freeSpace - oversizeSpace;
7822
7880
  nextColWidth = changeUnits ? Math.floor(remainingSpace / changeUnits) : remainingSpace;
7823
- gap = remainingSpace - nextColWidth * changeUnits;
7824
- gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols);
7881
+ gap = scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols);
7825
7882
  } else {
7826
7883
  gap = changeUnits ? freeSpace - Math.floor(freeSpace / changeUnits) * changeUnits : freeSpace;
7827
7884
  undersizeCols.forEach(function (column) {
@@ -7876,7 +7933,7 @@
7876
7933
  gapFill = scaleColumns(flexColumns, flexWidth, flexColWidth, false); //increase width of last column to account for rounding errors
7877
7934
 
7878
7935
  if (flexColumns.length && gapFill > 0) {
7879
- flexColumns[flexColumns.length - 1].width += +gapFill;
7936
+ flexColumns[flexColumns.length - 1].width += gapFill;
7880
7937
  } //calculate space for columns to be shrunk into
7881
7938
 
7882
7939
 
@@ -7890,7 +7947,7 @@
7890
7947
  } //decrease width of last column to account for rounding errors
7891
7948
 
7892
7949
 
7893
- if (fixedShrinkColumns.length) {
7950
+ if (gapFill && fixedShrinkColumns.length) {
7894
7951
  fixedShrinkColumns[fixedShrinkColumns.length - 1].width -= gapFill;
7895
7952
  }
7896
7953
 
@@ -8892,7 +8949,7 @@
8892
8949
  data = JSON.parse(data);
8893
8950
  }
8894
8951
 
8895
- if (data) {
8952
+ if (data && data.length > 0) {
8896
8953
  data.forEach(function (item) {
8897
8954
  var row = _this2.rowManager.findRow(item[_this2.options.index]);
8898
8955
 
@@ -8956,7 +9013,7 @@
8956
9013
  data = JSON.parse(data);
8957
9014
  }
8958
9015
 
8959
- if (data) {
9016
+ if (data && data.length > 0) {
8960
9017
  data.forEach(function (item) {
8961
9018
  var row = _this4.rowManager.findRow(item[_this4.options.index]);
8962
9019
 
@@ -10490,7 +10547,7 @@
10490
10547
  key: "rowsUpdated",
10491
10548
  value: function rowsUpdated(row) {
10492
10549
  if (this.table.options.groupBy) {
10493
- this.recalcRowGroup(this);
10550
+ this.recalcRowGroup(row);
10494
10551
  } else {
10495
10552
  this.recalcActiveRows();
10496
10553
  }
@@ -10960,8 +11017,6 @@
10960
11017
 
10961
11018
  _this.startOpen = function () {};
10962
11019
 
10963
- _this.displayIndex = 0;
10964
-
10965
11020
  _this.registerTableOption("dataTree", false); //enable data tree
10966
11021
 
10967
11022
 
@@ -11023,6 +11078,10 @@
11023
11078
  this.field = options.dataTreeChildField;
11024
11079
  this.indent = options.dataTreeChildIndent;
11025
11080
 
11081
+ if (this.options("movableRows")) {
11082
+ console.warn("The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior");
11083
+ }
11084
+
11026
11085
  if (options.dataTreeBranchElement) {
11027
11086
  if (options.dataTreeBranchElement === true) {
11028
11087
  this.branchEl = document.createElement("div");
@@ -11271,16 +11330,6 @@
11271
11330
  }
11272
11331
  }
11273
11332
  }
11274
- }, {
11275
- key: "setDisplayIndex",
11276
- value: function setDisplayIndex(index) {
11277
- this.displayIndex = index;
11278
- }
11279
- }, {
11280
- key: "getDisplayIndex",
11281
- value: function getDisplayIndex() {
11282
- return this.displayIndex;
11283
- }
11284
11333
  }, {
11285
11334
  key: "getRows",
11286
11335
  value: function getRows(rows) {
@@ -11419,7 +11468,7 @@
11419
11468
  }, {
11420
11469
  key: "getTreeParentRoot",
11421
11470
  value: function getTreeParentRoot(row) {
11422
- return row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
11471
+ return row.modules.dataTree && row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
11423
11472
  }
11424
11473
  }, {
11425
11474
  key: "getFilteredTreeChildren",
@@ -13834,7 +13883,7 @@
13834
13883
  if (!startVis) {
13835
13884
  setTimeout(function () {
13836
13885
  _this13.popup.hideOnBlur(_this13._resolveValue.bind(_this13, true));
13837
- });
13886
+ }, 10);
13838
13887
  }
13839
13888
  }
13840
13889
  }
@@ -16267,6 +16316,9 @@
16267
16316
  getColumn: function getColumn() {
16268
16317
  return column.getComponent();
16269
16318
  },
16319
+ getTable: function getTable() {
16320
+ return _this3.table;
16321
+ },
16270
16322
  getRow: function getRow() {
16271
16323
  return {
16272
16324
  normalizeHeight: function normalizeHeight() {}
@@ -18244,7 +18296,7 @@
18244
18296
  }, {
18245
18297
  key: "isVisible",
18246
18298
  value: function isVisible() {
18247
- return this._group.visible;
18299
+ return this._group._visible;
18248
18300
  }
18249
18301
  }, {
18250
18302
  key: "show",
@@ -18637,7 +18689,7 @@
18637
18689
  value: function hide() {
18638
18690
  this.visible = false;
18639
18691
 
18640
- if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) {
18692
+ if (this.groupManager.table.rowManager.getRenderMode() == "basic" && !this.groupManager.table.options.pagination) {
18641
18693
  this.element.classList.remove("tabulator-group-visible");
18642
18694
 
18643
18695
  if (this.groupList.length) {
@@ -18654,8 +18706,7 @@
18654
18706
  });
18655
18707
  }
18656
18708
 
18657
- this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
18658
- this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
18709
+ this.groupManager.updateGroupRows(true);
18659
18710
  } else {
18660
18711
  this.groupManager.updateGroupRows(true);
18661
18712
  }
@@ -18667,7 +18718,7 @@
18667
18718
  value: function show() {
18668
18719
  this.visible = true;
18669
18720
 
18670
- if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) {
18721
+ if (this.groupManager.table.rowManager.getRenderMode() == "basic" && !this.groupManager.table.options.pagination) {
18671
18722
  this.element.classList.add("tabulator-group-visible");
18672
18723
  var prev = this.generateElement();
18673
18724
 
@@ -18690,8 +18741,7 @@
18690
18741
  });
18691
18742
  }
18692
18743
 
18693
- this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
18694
- this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
18744
+ this.groupManager.updateGroupRows(true);
18695
18745
  } else {
18696
18746
  this.groupManager.updateGroupRows(true);
18697
18747
  }
@@ -18916,8 +18966,6 @@
18916
18966
  _this.allowedValues = false;
18917
18967
  _this.groups = {}; //hold row groups
18918
18968
 
18919
- _this.displayIndex = 0; //index in display pipeline
18920
-
18921
18969
  _this.displayHandler = _this.getRows.bind(_assertThisInitialized(_this)); //register table options
18922
18970
 
18923
18971
  _this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
@@ -19088,8 +19136,11 @@
19088
19136
  }, {
19089
19137
  key: "rowSample",
19090
19138
  value: function rowSample(rows, prevValue) {
19091
- var group = this.getGroups(false)[0];
19092
- prevValue.push(group.getRows(false)[0]);
19139
+ if (this.table.options.groupBy) {
19140
+ var group = this.getGroups(false)[0];
19141
+ prevValue.push(group.getRows(false)[0]);
19142
+ }
19143
+
19093
19144
  return prevValue;
19094
19145
  }
19095
19146
  }, {
@@ -19097,40 +19148,43 @@
19097
19148
  value: function virtualRenderFill() {
19098
19149
  var el = this.table.rowManager.tableElement;
19099
19150
  var rows = this.table.rowManager.getVisibleRows();
19100
- rows = rows.filter(function (row) {
19101
- return row.type !== "group";
19102
- });
19103
- el.style.minWidth = !rows.length ? this.table.columnManager.getWidth() + "px" : ""; // if(this.table.options.groupBy){
19104
- // if(this.layoutMode() != "fitDataFill" && rowsCount == this.table.modules.groupRows.countGroups()){
19105
- // el.style.minWidth = this.table.columnManager.getWidth() + "px";
19106
- // }
19107
- // }
19151
+
19152
+ if (this.table.options.groupBy) {
19153
+ rows = rows.filter(function (row) {
19154
+ return row.type !== "group";
19155
+ });
19156
+ el.style.minWidth = !rows.length ? this.table.columnManager.getWidth() + "px" : "";
19157
+ } else {
19158
+ return rows;
19159
+ }
19108
19160
  }
19109
19161
  }, {
19110
19162
  key: "rowAddingIndex",
19111
19163
  value: function rowAddingIndex(row, index, top) {
19112
- this.assignRowToGroup(row);
19113
- var groupRows = row.modules.group.rows;
19114
-
19115
- if (groupRows.length > 1) {
19116
- if (!index || index && groupRows.indexOf(index) == -1) {
19117
- if (top) {
19118
- if (groupRows[0] !== row) {
19119
- index = groupRows[0];
19120
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19164
+ if (this.table.options.groupBy) {
19165
+ this.assignRowToGroup(row);
19166
+ var groupRows = row.modules.group.rows;
19167
+
19168
+ if (groupRows.length > 1) {
19169
+ if (!index || index && groupRows.indexOf(index) == -1) {
19170
+ if (top) {
19171
+ if (groupRows[0] !== row) {
19172
+ index = groupRows[0];
19173
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19174
+ }
19175
+ } else {
19176
+ if (groupRows[groupRows.length - 1] !== row) {
19177
+ index = groupRows[groupRows.length - 1];
19178
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19179
+ }
19121
19180
  }
19122
19181
  } else {
19123
- if (groupRows[groupRows.length - 1] !== row) {
19124
- index = groupRows[groupRows.length - 1];
19125
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19126
- }
19182
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19127
19183
  }
19128
- } else {
19129
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
19130
19184
  }
19131
- }
19132
19185
 
19133
- return index;
19186
+ return index;
19187
+ }
19134
19188
  }
19135
19189
  }, {
19136
19190
  key: "trackChanges",
@@ -19212,50 +19266,46 @@
19212
19266
  }, {
19213
19267
  key: "rowMoving",
19214
19268
  value: function rowMoving(from, to, after) {
19215
- if (!after && to instanceof Group) {
19216
- to = this.table.rowManager.prevDisplayRow(from) || to;
19217
- }
19269
+ if (this.table.options.groupBy) {
19270
+ if (!after && to instanceof Group) {
19271
+ to = this.table.rowManager.prevDisplayRow(from) || to;
19272
+ }
19218
19273
 
19219
- var toGroup = to instanceof Group ? to : to.modules.group;
19220
- var fromGroup = from instanceof Group ? from : from.modules.group;
19274
+ var toGroup = to instanceof Group ? to : to.modules.group;
19275
+ var fromGroup = from instanceof Group ? from : from.modules.group;
19221
19276
 
19222
- if (toGroup === fromGroup) {
19223
- this.table.rowManager.moveRowInArray(toGroup.rows, from, to, after);
19224
- } else {
19225
- if (fromGroup) {
19226
- fromGroup.removeRow(from);
19227
- }
19277
+ if (toGroup === fromGroup) {
19278
+ this.table.rowManager.moveRowInArray(toGroup.rows, from, to, after);
19279
+ } else {
19280
+ if (fromGroup) {
19281
+ fromGroup.removeRow(from);
19282
+ }
19228
19283
 
19229
- toGroup.insertRow(from, to, after);
19284
+ toGroup.insertRow(from, to, after);
19285
+ }
19230
19286
  }
19231
19287
  }
19232
19288
  }, {
19233
19289
  key: "rowDeleting",
19234
19290
  value: function rowDeleting(row) {
19235
19291
  //remove from group
19236
- if (row.modules.group) {
19292
+ if (this.table.options.groupBy && row.modules.group) {
19237
19293
  row.modules.group.removeRow(row);
19238
19294
  }
19239
19295
  }
19240
19296
  }, {
19241
19297
  key: "rowsUpdated",
19242
19298
  value: function rowsUpdated(row) {
19243
- this.updateGroupRows(true);
19299
+ if (this.table.options.groupBy) {
19300
+ this.updateGroupRows(true);
19301
+ }
19244
19302
  }
19245
19303
  }, {
19246
19304
  key: "cellUpdated",
19247
19305
  value: function cellUpdated(cell) {
19248
- this.reassignRowToGroup(cell.row);
19249
- }
19250
- }, {
19251
- key: "setDisplayIndex",
19252
- value: function setDisplayIndex(index) {
19253
- this.displayIndex = index;
19254
- }
19255
- }, {
19256
- key: "getDisplayIndex",
19257
- value: function getDisplayIndex() {
19258
- return this.displayIndex;
19306
+ if (this.table.options.groupBy) {
19307
+ this.reassignRowToGroup(cell.row);
19308
+ }
19259
19309
  } //return appropriate rows with group headers
19260
19310
 
19261
19311
  }, {
@@ -19306,9 +19356,11 @@
19306
19356
  }, {
19307
19357
  key: "wipe",
19308
19358
  value: function wipe() {
19309
- this.groupList.forEach(function (group) {
19310
- group.wipe();
19311
- });
19359
+ if (this.table.options.groupBy) {
19360
+ this.groupList.forEach(function (group) {
19361
+ group.wipe();
19362
+ });
19363
+ }
19312
19364
  }
19313
19365
  }, {
19314
19366
  key: "pullGroupListData",
@@ -19473,14 +19525,16 @@
19473
19525
  }, {
19474
19526
  key: "scrollHeaders",
19475
19527
  value: function scrollHeaders(left) {
19476
- if (this.table.options.renderHorizontal === "virtual") {
19477
- left -= this.table.columnManager.renderer.vDomPadLeft;
19478
- }
19528
+ if (this.table.options.groupBy) {
19529
+ if (this.table.options.renderHorizontal === "virtual") {
19530
+ left -= this.table.columnManager.renderer.vDomPadLeft;
19531
+ }
19479
19532
 
19480
- left = left + "px";
19481
- this.groupList.forEach(function (group) {
19482
- group.scrollHeader(left);
19483
- });
19533
+ left = left + "px";
19534
+ this.groupList.forEach(function (group) {
19535
+ group.scrollHeader(left);
19536
+ });
19537
+ }
19484
19538
  }
19485
19539
  }, {
19486
19540
  key: "removeGroup",
@@ -19497,6 +19551,30 @@
19497
19551
  }
19498
19552
  }
19499
19553
  }
19554
+ }, {
19555
+ key: "checkBasicModeGroupHeaderWidth",
19556
+ value: function checkBasicModeGroupHeaderWidth() {
19557
+ var _this6 = this;
19558
+
19559
+ var element = this.table.rowManager.tableElement,
19560
+ onlyGroupHeaders = true;
19561
+ this.table.rowManager.getDisplayRows().forEach(function (row, index) {
19562
+ _this6.table.rowManager.styleRow(row, index);
19563
+
19564
+ element.appendChild(row.getElement());
19565
+ row.initialize(true);
19566
+
19567
+ if (row.type !== "group") {
19568
+ onlyGroupHeaders = false;
19569
+ }
19570
+ });
19571
+
19572
+ if (onlyGroupHeaders) {
19573
+ element.style.minWidth = this.table.columnManager.getWidth() + "px";
19574
+ } else {
19575
+ element.style.minWidth = "";
19576
+ }
19577
+ }
19500
19578
  }]);
19501
19579
 
19502
19580
  return GroupRows;
@@ -19613,7 +19691,7 @@
19613
19691
  var index, rows;
19614
19692
 
19615
19693
  if (this.table.options.groupBy) {
19616
- rows = row.getComponent().getGroup().rows;
19694
+ rows = row.getComponent().getGroup()._getSelf().rows;
19617
19695
  index = rows.indexOf(row);
19618
19696
 
19619
19697
  if (index) {
@@ -20361,7 +20439,7 @@
20361
20439
  var range;
20362
20440
 
20363
20441
  if (this.table.modExists("edit")) {
20364
- if (this.table.modules.edit.currentCell === this) {
20442
+ if (this.table.modules.edit.currentCell === cell) {
20365
20443
  return; //prevent instant selection of editor content
20366
20444
  }
20367
20445
  }
@@ -20372,11 +20450,11 @@
20372
20450
  if (document.selection) {
20373
20451
  // IE
20374
20452
  range = document.body.createTextRange();
20375
- range.moveToElementText(this.element);
20453
+ range.moveToElementText(cell.getElement());
20376
20454
  range.select();
20377
20455
  } else if (window.getSelection) {
20378
20456
  range = document.createRange();
20379
- range.selectNode(this.element);
20457
+ range.selectNode(cell.getElement());
20380
20458
  window.getSelection().removeAllRanges();
20381
20459
  window.getSelection().addRange(range);
20382
20460
  }
@@ -22404,8 +22482,6 @@
22404
22482
  _this.count = 5;
22405
22483
  _this.max = 1;
22406
22484
  _this.remoteRowCountEstimate = null;
22407
- _this.displayIndex = 0; //index in display pipeline
22408
-
22409
22485
  _this.initialLoad = true;
22410
22486
  _this.dataChanging = false; //flag to check if data is being changed by this module
22411
22487
 
@@ -22877,16 +22953,6 @@
22877
22953
  key: "trackChanges",
22878
22954
  value: function trackChanges() {
22879
22955
  this.dispatch("page-changed");
22880
- }
22881
- }, {
22882
- key: "setDisplayIndex",
22883
- value: function setDisplayIndex(index) {
22884
- this.displayIndex = index;
22885
- }
22886
- }, {
22887
- key: "getDisplayIndex",
22888
- value: function getDisplayIndex() {
22889
- return this.displayIndex;
22890
22956
  } //calculate maximum page from number of rows
22891
22957
 
22892
22958
  }, {
@@ -22956,7 +23022,7 @@
22956
23022
  }, {
22957
23023
  key: "setPageToRow",
22958
23024
  value: function setPageToRow(row) {
22959
- var rows = this.table.rowManager.getDisplayRows(this.displayIndex - 1);
23025
+ var rows = this.displayRows(-1);
22960
23026
  var index = rows.indexOf(row);
22961
23027
 
22962
23028
  if (index > -1) {
@@ -23566,6 +23632,8 @@
23566
23632
  }, {
23567
23633
  key: "initializeColumn",
23568
23634
  value: function initializeColumn(column) {
23635
+ var _this2 = this;
23636
+
23569
23637
  var def, keys;
23570
23638
 
23571
23639
  if (this.config.columns) {
@@ -23581,8 +23649,8 @@
23581
23649
  set: function set(newValue) {
23582
23650
  value = newValue;
23583
23651
 
23584
- if (!this.defWatcherBlock) {
23585
- this.save("columns");
23652
+ if (!_this2.defWatcherBlock) {
23653
+ _this2.save("columns");
23586
23654
  }
23587
23655
 
23588
23656
  if (props.set) {
@@ -23624,20 +23692,20 @@
23624
23692
  }, {
23625
23693
  key: "mergeDefinition",
23626
23694
  value: function mergeDefinition(oldCols, newCols) {
23627
- var _this2 = this;
23695
+ var _this3 = this;
23628
23696
 
23629
23697
  var output = [];
23630
23698
  newCols = newCols || [];
23631
23699
  newCols.forEach(function (column, to) {
23632
- var from = _this2._findColumn(oldCols, column),
23700
+ var from = _this3._findColumn(oldCols, column),
23633
23701
  keys;
23634
23702
 
23635
23703
  if (from) {
23636
- if (_this2.config.columns === true || _this2.config.columns == undefined) {
23704
+ if (_this3.config.columns === true || _this3.config.columns == undefined) {
23637
23705
  keys = Object.keys(from);
23638
23706
  keys.push("width");
23639
23707
  } else {
23640
- keys = _this2.config.columns;
23708
+ keys = _this3.config.columns;
23641
23709
  }
23642
23710
 
23643
23711
  keys.forEach(function (key) {
@@ -23647,14 +23715,14 @@
23647
23715
  });
23648
23716
 
23649
23717
  if (from.columns) {
23650
- from.columns = _this2.mergeDefinition(from.columns, column.columns);
23718
+ from.columns = _this3.mergeDefinition(from.columns, column.columns);
23651
23719
  }
23652
23720
 
23653
23721
  output.push(from);
23654
23722
  }
23655
23723
  });
23656
23724
  oldCols.forEach(function (column, i) {
23657
- var from = _this2._findColumn(newCols, column);
23725
+ var from = _this3._findColumn(newCols, column);
23658
23726
 
23659
23727
  if (!from) {
23660
23728
  if (output.length > i) {
@@ -23768,7 +23836,7 @@
23768
23836
  }, {
23769
23837
  key: "parseColumns",
23770
23838
  value: function parseColumns(columns) {
23771
- var _this3 = this;
23839
+ var _this4 = this;
23772
23840
 
23773
23841
  var definitions = [],
23774
23842
  excludedKeys = ["headerContextMenu", "headerMenu", "contextMenu", "clickMenu"];
@@ -23779,16 +23847,16 @@
23779
23847
 
23780
23848
  if (column.isGroup) {
23781
23849
  defStore.title = colDef.title;
23782
- defStore.columns = _this3.parseColumns(column.getColumns());
23850
+ defStore.columns = _this4.parseColumns(column.getColumns());
23783
23851
  } else {
23784
23852
  defStore.field = column.getField();
23785
23853
 
23786
- if (_this3.config.columns === true || _this3.config.columns == undefined) {
23854
+ if (_this4.config.columns === true || _this4.config.columns == undefined) {
23787
23855
  keys = Object.keys(colDef);
23788
23856
  keys.push("width");
23789
23857
  keys.push("visible");
23790
23858
  } else {
23791
- keys = _this3.config.columns;
23859
+ keys = _this4.config.columns;
23792
23860
  }
23793
23861
 
23794
23862
  keys.forEach(function (key) {
@@ -25207,6 +25275,7 @@
25207
25275
  this.subscribe("table-redrawing", this.tableRedraw.bind(this));
25208
25276
 
25209
25277
  if (this.table.options.responsiveLayout === "collapse") {
25278
+ this.subscribe("row-data-changed", this.generateCollapsedRowContent.bind(this));
25210
25279
  this.subscribe("row-init", this.initializeRow.bind(this));
25211
25280
  this.subscribe("row-layout", this.layoutRow.bind(this));
25212
25281
  }
@@ -25781,13 +25850,18 @@
25781
25850
 
25782
25851
  if (rowMatch) {
25783
25852
  this._selectRow(rowMatch, true, true);
25853
+
25854
+ this._rowSelectionChanged();
25784
25855
  } else {
25785
- this.table.rowManager.getRows(rows).forEach(function (row) {
25856
+ rowMatch = this.table.rowManager.getRows(rows);
25857
+ rowMatch.forEach(function (row) {
25786
25858
  _this3._selectRow(row, true, true);
25787
25859
  });
25788
- }
25789
25860
 
25790
- this._rowSelectionChanged();
25861
+ if (rowMatch.length) {
25862
+ this._rowSelectionChanged();
25863
+ }
25864
+ }
25791
25865
 
25792
25866
  break;
25793
25867
 
@@ -26481,13 +26555,10 @@
26481
26555
 
26482
26556
  if (match > -1) {
26483
26557
  sorters[match].dir = dir;
26558
+ match = sorters.splice(match, 1)[0];
26484
26559
 
26485
- if (match != sorters.length - 1) {
26486
- match = sorters.splice(match, 1)[0];
26487
-
26488
- if (dir != "none") {
26489
- sorters.push(match);
26490
- }
26560
+ if (dir != "none") {
26561
+ sorters.push(match);
26491
26562
  }
26492
26563
  } else {
26493
26564
  if (dir != "none") {
@@ -26712,7 +26783,7 @@
26712
26783
  var sortEl = column.modules.sort.element,
26713
26784
  arrowEl;
26714
26785
 
26715
- if (typeof this.table.options.headerSortElement === "function") {
26786
+ if (column.definition.headerSort && typeof this.table.options.headerSortElement === "function") {
26716
26787
  while (sortEl.firstChild) {
26717
26788
  sortEl.removeChild(sortEl.firstChild);
26718
26789
  }