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
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -469,90 +469,121 @@ class Popup extends CoreFeature{
469
469
  }
470
470
 
471
471
  class Module extends CoreFeature{
472
-
472
+
473
473
  constructor(table, name){
474
474
  super(table);
475
-
475
+
476
476
  this._handler = null;
477
477
  }
478
-
478
+
479
479
  initialize(){
480
480
  // setup module when table is initialized, to be overridden in module
481
481
  }
482
-
483
-
482
+
483
+
484
484
  ///////////////////////////////////
485
485
  ////// Options Registration ///////
486
486
  ///////////////////////////////////
487
-
487
+
488
488
  registerTableOption(key, value){
489
489
  this.table.optionsList.register(key, value);
490
490
  }
491
-
491
+
492
492
  registerColumnOption(key, value){
493
493
  this.table.columnManager.optionsList.register(key, value);
494
494
  }
495
-
495
+
496
496
  ///////////////////////////////////
497
497
  /// Public Function Registration ///
498
498
  ///////////////////////////////////
499
-
499
+
500
500
  registerTableFunction(name, func){
501
501
  if(typeof this.table[name] === "undefined"){
502
502
  this.table[name] = (...args) => {
503
503
  this.table.initGuard(name);
504
-
504
+
505
505
  return func(...args);
506
506
  };
507
507
  }else {
508
508
  console.warn("Unable to bind table function, name already in use", name);
509
509
  }
510
510
  }
511
-
511
+
512
512
  registerComponentFunction(component, func, handler){
513
513
  return this.table.componentFunctionBinder.bind(component, func, handler);
514
514
  }
515
-
515
+
516
516
  ///////////////////////////////////
517
517
  ////////// Data Pipeline //////////
518
518
  ///////////////////////////////////
519
-
519
+
520
520
  registerDataHandler(handler, priority){
521
521
  this.table.rowManager.registerDataPipelineHandler(handler, priority);
522
522
  this._handler = handler;
523
523
  }
524
-
524
+
525
525
  registerDisplayHandler(handler, priority){
526
526
  this.table.rowManager.registerDisplayPipelineHandler(handler, priority);
527
527
  this._handler = handler;
528
528
  }
529
+
530
+ displayRows(adjust){
531
+ var index = this.table.rowManager.displayRows.length - 1,
532
+ lookupIndex;
533
+
534
+ if(this._handler){
535
+ lookupIndex = this.table.rowManager.displayPipeline.findIndex((item) => {
536
+ return item.handler === this._handler;
537
+ });
529
538
 
539
+ if(lookupIndex > -1){
540
+ index = lookupIndex;
541
+ }
542
+ }
543
+
544
+ if(adjust){
545
+ index = index + adjust;
546
+ }
547
+
548
+ if(this._handler){
549
+ if(index > -1){
550
+ return this.table.rowManager.getDisplayRows(index);
551
+ }else {
552
+ return this.activeRows();
553
+ }
554
+ }
555
+ }
556
+
557
+ activeRows(){
558
+ return this.table.rowManager.activeRows;
559
+ }
560
+
530
561
  refreshData(renderInPosition, handler){
531
562
  if(!handler){
532
563
  handler = this._handler;
533
564
  }
534
-
565
+
535
566
  if(handler){
536
567
  this.table.rowManager.refreshActiveData(handler, false, renderInPosition);
537
568
  }
538
569
  }
539
-
570
+
540
571
  ///////////////////////////////////
541
572
  //////// Footer Management ////////
542
573
  ///////////////////////////////////
543
-
574
+
544
575
  footerAppend(element){
545
576
  return this.table.footerManager.append(element);
546
577
  }
547
-
578
+
548
579
  footerPrepend(element){
549
580
  return this.table.footerManager.prepend(element);
550
581
  }
551
-
582
+
552
583
  footerRemove(element){
553
584
  return this.table.footerManager.remove(element);
554
585
  }
555
-
586
+
556
587
  ///////////////////////////////////
557
588
  //////// Popups Management ////////
558
589
  ///////////////////////////////////
@@ -560,15 +591,15 @@ class Module extends CoreFeature{
560
591
  popup(menuEl, menuContainer){
561
592
  return new Popup(this.table, menuEl, menuContainer);
562
593
  }
563
-
594
+
564
595
  ///////////////////////////////////
565
596
  //////// Alert Management ////////
566
597
  ///////////////////////////////////
567
-
598
+
568
599
  alert(content, type){
569
600
  return this.table.alertManager.alert(content, type);
570
601
  }
571
-
602
+
572
603
  clearAlert(){
573
604
  return this.table.alertManager.clear();
574
605
  }
@@ -2433,8 +2464,20 @@ class Column extends CoreFeature{
2433
2464
  }
2434
2465
 
2435
2466
  //return all columns in a group
2436
- getColumns(){
2437
- return this.columns;
2467
+ getColumns(traverse){
2468
+ var columns = [];
2469
+
2470
+ if(traverse){
2471
+ this.columns.forEach((column) => {
2472
+ columns.push(column);
2473
+
2474
+ columns = columns.concat(column.getColumns(true));
2475
+ });
2476
+ }else {
2477
+ columns = this.columns;
2478
+ }
2479
+
2480
+ return columns;
2438
2481
  }
2439
2482
 
2440
2483
  //return all columns in a group
@@ -2662,6 +2705,12 @@ class Column extends CoreFeature{
2662
2705
  }
2663
2706
 
2664
2707
  setMinWidth(minWidth){
2708
+ if(this.maxWidth && minWidth > this.maxWidth){
2709
+ minWidth = this.maxWidth;
2710
+
2711
+ console.warn("the minWidth ("+ minWidth + "px) for column '" + this.field + "' cannot be bigger that its maxWidth ("+ this.maxWidthStyled + ")");
2712
+ }
2713
+
2665
2714
  this.minWidth = minWidth;
2666
2715
  this.minWidthStyled = minWidth ? minWidth + "px" : "";
2667
2716
 
@@ -2673,6 +2722,12 @@ class Column extends CoreFeature{
2673
2722
  }
2674
2723
 
2675
2724
  setMaxWidth(maxWidth){
2725
+ if(this.minWidth && maxWidth < this.minWidth){
2726
+ maxWidth = this.minWidth;
2727
+
2728
+ console.warn("the maxWidth ("+ maxWidth + "px) for column '" + this.field + "' cannot be smaller that its minWidth ("+ this.minWidthStyled + ")");
2729
+ }
2730
+
2676
2731
  this.maxWidth = maxWidth;
2677
2732
  this.maxWidthStyled = maxWidth ? maxWidth + "px" : "";
2678
2733
 
@@ -3581,7 +3636,7 @@ class ColumnCalcs extends Module{
3581
3636
 
3582
3637
  rowsUpdated(row){
3583
3638
  if(this.table.options.groupBy){
3584
- this.recalcRowGroup(this);
3639
+ this.recalcRowGroup(row);
3585
3640
  }else {
3586
3641
  this.recalcActiveRows();
3587
3642
  }
@@ -4019,8 +4074,6 @@ class DataTree extends Module{
4019
4074
 
4020
4075
  this.startOpen = function(){};
4021
4076
 
4022
- this.displayIndex = 0;
4023
-
4024
4077
  this.registerTableOption("dataTree", false); //enable data tree
4025
4078
  this.registerTableOption("dataTreeFilter", true); //filter child rows
4026
4079
  this.registerTableOption("dataTreeSort", true); //sort child rows
@@ -4052,6 +4105,10 @@ class DataTree extends Module{
4052
4105
  this.field = options.dataTreeChildField;
4053
4106
  this.indent = options.dataTreeChildIndent;
4054
4107
 
4108
+ if(this.options("movableRows")){
4109
+ console.warn("The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior");
4110
+ }
4111
+
4055
4112
  if(options.dataTreeBranchElement){
4056
4113
 
4057
4114
  if(options.dataTreeBranchElement === true){
@@ -4292,14 +4349,6 @@ class DataTree extends Module{
4292
4349
  }
4293
4350
  }
4294
4351
 
4295
- setDisplayIndex (index) {
4296
- this.displayIndex = index;
4297
- }
4298
-
4299
- getDisplayIndex () {
4300
- return this.displayIndex;
4301
- }
4302
-
4303
4352
  getRows(rows){
4304
4353
  var output = [];
4305
4354
 
@@ -4437,7 +4486,7 @@ class DataTree extends Module{
4437
4486
  }
4438
4487
 
4439
4488
  getTreeParentRoot(row){
4440
- return row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
4489
+ return row.modules.dataTree && row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
4441
4490
  }
4442
4491
 
4443
4492
  getFilteredTreeChildren(row){
@@ -6765,7 +6814,7 @@ class Edit{
6765
6814
  if(!startVis){
6766
6815
  setTimeout(() => {
6767
6816
  this.popup.hideOnBlur(this._resolveValue.bind(this, true));
6768
- });
6817
+ }, 10);
6769
6818
  }
6770
6819
  }
6771
6820
  }
@@ -9139,6 +9188,9 @@ class Filter extends Module{
9139
9188
  getColumn:function(){
9140
9189
  return column.getComponent();
9141
9190
  },
9191
+ getTable:() => {
9192
+ return this.table;
9193
+ },
9142
9194
  getRow:function(){
9143
9195
  return {
9144
9196
  normalizeHeight:function(){
@@ -11032,7 +11084,7 @@ class GroupComponent {
11032
11084
  }
11033
11085
 
11034
11086
  isVisible(){
11035
- return this._group.visible;
11087
+ return this._group._visible;
11036
11088
  }
11037
11089
 
11038
11090
  show(){
@@ -11413,7 +11465,7 @@ class Group{
11413
11465
  hide(){
11414
11466
  this.visible = false;
11415
11467
 
11416
- if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
11468
+ if(this.groupManager.table.rowManager.getRenderMode() == "basic" && !this.groupManager.table.options.pagination){
11417
11469
 
11418
11470
  this.element.classList.remove("tabulator-group-visible");
11419
11471
 
@@ -11434,9 +11486,7 @@ class Group{
11434
11486
  });
11435
11487
  }
11436
11488
 
11437
- this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
11438
-
11439
- this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
11489
+ this.groupManager.updateGroupRows(true);
11440
11490
 
11441
11491
  }else {
11442
11492
  this.groupManager.updateGroupRows(true);
@@ -11448,7 +11498,7 @@ class Group{
11448
11498
  show(){
11449
11499
  this.visible = true;
11450
11500
 
11451
- if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
11501
+ if(this.groupManager.table.rowManager.getRenderMode() == "basic" && !this.groupManager.table.options.pagination){
11452
11502
 
11453
11503
  this.element.classList.add("tabulator-group-visible");
11454
11504
 
@@ -11474,10 +11524,8 @@ class Group{
11474
11524
  prev = rowEl;
11475
11525
  });
11476
11526
  }
11477
-
11478
- this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
11479
-
11480
- this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
11527
+
11528
+ this.groupManager.updateGroupRows(true);
11481
11529
  }else {
11482
11530
  this.groupManager.updateGroupRows(true);
11483
11531
  }
@@ -11659,20 +11707,19 @@ class Group{
11659
11707
  }
11660
11708
 
11661
11709
  class GroupRows extends Module{
11662
-
11710
+
11663
11711
  constructor(table){
11664
11712
  super(table);
11665
-
11713
+
11666
11714
  this.groupIDLookups = false; //enable table grouping and set field to group by
11667
11715
  this.startOpen = [function(){return false;}]; //starting state of group
11668
11716
  this.headerGenerator = [function(){return "";}];
11669
11717
  this.groupList = []; //ordered list of groups
11670
11718
  this.allowedValues = false;
11671
11719
  this.groups = {}; //hold row groups
11672
- this.displayIndex = 0; //index in display pipeline
11673
-
11720
+
11674
11721
  this.displayHandler = this.getRows.bind(this);
11675
-
11722
+
11676
11723
  //register table options
11677
11724
  this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
11678
11725
  this.registerTableOption("groupStartOpen", true); //starting state of group
@@ -11685,7 +11732,7 @@ class GroupRows extends Module{
11685
11732
  this.registerTableOption("groupHeaderDownload", null);
11686
11733
  this.registerTableOption("groupToggleElement", "arrow");
11687
11734
  this.registerTableOption("groupClosedShowCalcs", false);
11688
-
11735
+
11689
11736
  //register table functions
11690
11737
  this.registerTableFunction("setGroupBy", this.setGroupBy.bind(this));
11691
11738
  this.registerTableFunction("setGroupValues", this.setGroupValues.bind(this));
@@ -11693,11 +11740,11 @@ class GroupRows extends Module{
11693
11740
  this.registerTableFunction("setGroupHeader", this.setGroupHeader.bind(this));
11694
11741
  this.registerTableFunction("getGroups", this.userGetGroups.bind(this));
11695
11742
  this.registerTableFunction("getGroupedData", this.userGetGroupedData.bind(this));
11696
-
11743
+
11697
11744
  //register component functions
11698
11745
  this.registerComponentFunction("row", "getGroup", this.rowGetGroup.bind(this));
11699
11746
  }
11700
-
11747
+
11701
11748
  //initialize group configuration
11702
11749
  initialize(){
11703
11750
  if(this.table.options.groupBy){
@@ -11705,7 +11752,7 @@ class GroupRows extends Module{
11705
11752
  this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
11706
11753
  this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
11707
11754
  }
11708
-
11755
+
11709
11756
  this.subscribe("table-built", this.configureGroupSetup.bind(this));
11710
11757
 
11711
11758
  this.subscribe("row-deleting", this.rowDeleting.bind(this));
@@ -11715,73 +11762,73 @@ class GroupRows extends Module{
11715
11762
  this.subscribe("rows-added", this.rowsUpdated.bind(this));
11716
11763
  this.subscribe("row-moving", this.rowMoving.bind(this));
11717
11764
  this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
11718
-
11765
+
11719
11766
  this.subscribe("rows-sample", this.rowSample.bind(this));
11720
-
11767
+
11721
11768
  this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
11722
-
11769
+
11723
11770
  this.registerDisplayHandler(this.displayHandler, 20);
11724
-
11771
+
11725
11772
  this.initialized = true;
11726
11773
  }
11727
11774
  }
11728
-
11775
+
11729
11776
  configureGroupSetup(){
11730
11777
  if(this.table.options.groupBy){
11731
11778
  var groupBy = this.table.options.groupBy,
11732
11779
  startOpen = this.table.options.groupStartOpen,
11733
11780
  groupHeader = this.table.options.groupHeader;
11734
-
11781
+
11735
11782
  this.allowedValues = this.table.options.groupValues;
11736
-
11783
+
11737
11784
  if(Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length){
11738
11785
  console.warn("Error creating group headers, groupHeader array is shorter than groupBy array");
11739
11786
  }
11740
-
11787
+
11741
11788
  this.headerGenerator = [function(){return "";}];
11742
11789
  this.startOpen = [function(){return false;}]; //starting state of group
11743
-
11790
+
11744
11791
  this.langBind("groups|item", (langValue, lang) => {
11745
11792
  this.headerGenerator[0] = (value, count, data) => { //header layout function
11746
11793
  return (typeof value === "undefined" ? "" : value) + "<span>(" + count + " " + ((count === 1) ? langValue : lang.groups.items) + ")</span>";
11747
11794
  };
11748
11795
  });
11749
-
11796
+
11750
11797
  this.groupIDLookups = [];
11751
-
11798
+
11752
11799
  if(Array.isArray(groupBy)){
11753
11800
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
11754
11801
  this.table.modules.columnCalcs.removeCalcs();
11755
11802
  }
11756
11803
  }else {
11757
11804
  if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group"){
11758
-
11805
+
11759
11806
  var cols = this.table.columnManager.getRealColumns();
11760
-
11807
+
11761
11808
  cols.forEach((col) => {
11762
11809
  if(col.definition.topCalc){
11763
11810
  this.table.modules.columnCalcs.initializeTopRow();
11764
11811
  }
11765
-
11812
+
11766
11813
  if(col.definition.bottomCalc){
11767
11814
  this.table.modules.columnCalcs.initializeBottomRow();
11768
11815
  }
11769
11816
  });
11770
11817
  }
11771
11818
  }
11772
-
11819
+
11773
11820
  if(!Array.isArray(groupBy)){
11774
11821
  groupBy = [groupBy];
11775
11822
  }
11776
-
11823
+
11777
11824
  groupBy.forEach((group, i) => {
11778
11825
  var lookupFunc, column;
11779
-
11826
+
11780
11827
  if(typeof group == "function"){
11781
11828
  lookupFunc = group;
11782
11829
  }else {
11783
11830
  column = this.table.columnManager.getColumnByField(group);
11784
-
11831
+
11785
11832
  if(column){
11786
11833
  lookupFunc = function(data){
11787
11834
  return column.getFieldValue(data);
@@ -11792,25 +11839,25 @@ class GroupRows extends Module{
11792
11839
  };
11793
11840
  }
11794
11841
  }
11795
-
11842
+
11796
11843
  this.groupIDLookups.push({
11797
11844
  field: typeof group === "function" ? false : group,
11798
11845
  func:lookupFunc,
11799
11846
  values:this.allowedValues ? this.allowedValues[i] : false,
11800
11847
  });
11801
11848
  });
11802
-
11849
+
11803
11850
  if(startOpen){
11804
11851
  if(!Array.isArray(startOpen)){
11805
11852
  startOpen = [startOpen];
11806
11853
  }
11807
-
11854
+
11808
11855
  startOpen.forEach((level) => {
11809
11856
  });
11810
-
11857
+
11811
11858
  this.startOpen = startOpen;
11812
11859
  }
11813
-
11860
+
11814
11861
  if(groupHeader){
11815
11862
  this.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader];
11816
11863
  }
@@ -11819,218 +11866,216 @@ class GroupRows extends Module{
11819
11866
  this.groups = {};
11820
11867
  }
11821
11868
  }
11822
-
11869
+
11823
11870
  rowSample(rows, prevValue){
11824
- var group = this.getGroups(false)[0];
11825
-
11826
- prevValue.push(group.getRows(false)[0]);
11827
-
11871
+ if(this.table.options.groupBy){
11872
+ var group = this.getGroups(false)[0];
11873
+
11874
+ prevValue.push(group.getRows(false)[0]);
11875
+ }
11876
+
11828
11877
  return prevValue;
11829
11878
  }
11830
-
11879
+
11831
11880
  virtualRenderFill(){
11832
11881
  var el = this.table.rowManager.tableElement;
11833
11882
  var rows = this.table.rowManager.getVisibleRows();
11834
-
11835
- rows = rows.filter((row) => {
11836
- return row.type !== "group";
11837
- });
11838
-
11839
- el.style.minWidth = !rows.length ? this.table.columnManager.getWidth() + "px" : "";
11840
-
11841
- // if(this.table.options.groupBy){
11842
- // if(this.layoutMode() != "fitDataFill" && rowsCount == this.table.modules.groupRows.countGroups()){
11843
- // el.style.minWidth = this.table.columnManager.getWidth() + "px";
11844
- // }
11845
- // }
11883
+
11884
+ if(this.table.options.groupBy){
11885
+ rows = rows.filter((row) => {
11886
+ return row.type !== "group";
11887
+ });
11888
+
11889
+ el.style.minWidth = !rows.length ? this.table.columnManager.getWidth() + "px" : "";
11890
+ }else {
11891
+ return rows;
11892
+ }
11846
11893
  }
11847
-
11894
+
11848
11895
  rowAddingIndex(row, index, top){
11849
- this.assignRowToGroup(row);
11850
-
11851
- var groupRows = row.modules.group.rows;
11852
-
11853
- if(groupRows.length > 1){
11854
- if(!index || (index && groupRows.indexOf(index) == -1)){
11855
- if(top){
11856
- if(groupRows[0] !== row){
11857
- index = groupRows[0];
11858
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11896
+ if(this.table.options.groupBy){
11897
+ this.assignRowToGroup(row);
11898
+
11899
+ var groupRows = row.modules.group.rows;
11900
+
11901
+ if(groupRows.length > 1){
11902
+ if(!index || (index && groupRows.indexOf(index) == -1)){
11903
+ if(top){
11904
+ if(groupRows[0] !== row){
11905
+ index = groupRows[0];
11906
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11907
+ }
11908
+ }else {
11909
+ if(groupRows[groupRows.length -1] !== row){
11910
+ index = groupRows[groupRows.length -1];
11911
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11912
+ }
11859
11913
  }
11860
11914
  }else {
11861
- if(groupRows[groupRows.length -1] !== row){
11862
- index = groupRows[groupRows.length -1];
11863
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11864
- }
11915
+ this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11865
11916
  }
11866
- }else {
11867
- this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
11868
11917
  }
11918
+
11919
+ return index;
11869
11920
  }
11870
-
11871
- return index;
11872
11921
  }
11873
-
11922
+
11874
11923
  trackChanges(){
11875
11924
  this.dispatch("group-changed");
11876
11925
  }
11877
-
11926
+
11878
11927
  ///////////////////////////////////
11879
11928
  ///////// Table Functions /////////
11880
11929
  ///////////////////////////////////
11881
-
11930
+
11882
11931
  setGroupBy(groups){
11883
11932
  this.table.options.groupBy = groups;
11884
-
11933
+
11885
11934
  if(!this.initialized){
11886
11935
  this.initialize();
11887
11936
  }
11888
-
11937
+
11889
11938
  this.configureGroupSetup();
11890
-
11939
+
11891
11940
  this.refreshData();
11892
-
11941
+
11893
11942
  this.trackChanges();
11894
11943
  }
11895
-
11944
+
11896
11945
  setGroupValues(groupValues){
11897
11946
  this.table.options.groupValues = groupValues;
11898
11947
  this.configureGroupSetup();
11899
11948
  this.refreshData();
11900
-
11949
+
11901
11950
  this.trackChanges();
11902
11951
  }
11903
-
11952
+
11904
11953
  setGroupStartOpen(values){
11905
11954
  this.table.options.groupStartOpen = values;
11906
11955
  this.configureGroupSetup();
11907
-
11956
+
11908
11957
  if(this.table.options.groupBy){
11909
11958
  this.refreshData();
11910
-
11959
+
11911
11960
  this.trackChanges();
11912
11961
  }else {
11913
11962
  console.warn("Grouping Update - cant refresh view, no groups have been set");
11914
11963
  }
11915
11964
  }
11916
-
11965
+
11917
11966
  setGroupHeader(values){
11918
11967
  this.table.options.groupHeader = values;
11919
11968
  this.configureGroupSetup();
11920
-
11969
+
11921
11970
  if(this.table.options.groupBy){
11922
11971
  this.refreshData();
11923
-
11972
+
11924
11973
  this.trackChanges();
11925
11974
  }else {
11926
11975
  console.warn("Grouping Update - cant refresh view, no groups have been set");
11927
11976
  }
11928
11977
  }
11929
-
11978
+
11930
11979
  userGetGroups(values){
11931
11980
  return this.getGroups(true);
11932
11981
  }
11933
-
11982
+
11934
11983
  // get grouped table data in the same format as getData()
11935
11984
  userGetGroupedData(){
11936
11985
  return this.table.options.groupBy ?
11937
- this.getGroupedData() : this.getData();
11986
+ this.getGroupedData() : this.getData();
11938
11987
  }
11939
-
11940
-
11988
+
11989
+
11941
11990
  ///////////////////////////////////////
11942
11991
  ///////// Component Functions /////////
11943
11992
  ///////////////////////////////////////
11944
-
11993
+
11945
11994
  rowGetGroup(row){
11946
11995
  return row.modules.group ? row.modules.group.getComponent() : false;
11947
11996
  }
11948
-
11997
+
11949
11998
  ///////////////////////////////////
11950
11999
  ///////// Internal Logic //////////
11951
12000
  ///////////////////////////////////
11952
-
12001
+
11953
12002
  rowMoving(from, to, after){
11954
- if(!after && to instanceof Group){
11955
- to = this.table.rowManager.prevDisplayRow(from) || to;
11956
- }
11957
-
11958
- var toGroup = to instanceof Group ? to : to.modules.group;
11959
- var fromGroup = from instanceof Group ? from : from.modules.group;
11960
-
11961
- if(toGroup === fromGroup){
11962
- this.table.rowManager.moveRowInArray(toGroup.rows, from, to, after);
11963
- }else {
11964
- if(fromGroup){
11965
- fromGroup.removeRow(from);
12003
+ if(this.table.options.groupBy){
12004
+ if(!after && to instanceof Group){
12005
+ to = this.table.rowManager.prevDisplayRow(from) || to;
12006
+ }
12007
+
12008
+ var toGroup = to instanceof Group ? to : to.modules.group;
12009
+ var fromGroup = from instanceof Group ? from : from.modules.group;
12010
+
12011
+ if(toGroup === fromGroup){
12012
+ this.table.rowManager.moveRowInArray(toGroup.rows, from, to, after);
12013
+ }else {
12014
+ if(fromGroup){
12015
+ fromGroup.removeRow(from);
12016
+ }
12017
+
12018
+ toGroup.insertRow(from, to, after);
11966
12019
  }
11967
-
11968
- toGroup.insertRow(from, to, after);
11969
12020
  }
11970
12021
  }
11971
-
11972
-
12022
+
12023
+
11973
12024
  rowDeleting(row){
11974
12025
  //remove from group
11975
- if(row.modules.group){
12026
+ if(this.table.options.groupBy && row.modules.group){
11976
12027
  row.modules.group.removeRow(row);
11977
12028
  }
11978
12029
  }
11979
-
11980
-
12030
+
11981
12031
  rowsUpdated(row){
11982
- this.updateGroupRows(true);
12032
+ if(this.table.options.groupBy){
12033
+ this.updateGroupRows(true);
12034
+ }
11983
12035
  }
11984
-
12036
+
11985
12037
  cellUpdated(cell){
11986
- this.reassignRowToGroup(cell.row);
11987
- }
11988
-
11989
-
11990
- setDisplayIndex(index){
11991
- this.displayIndex = index;
11992
- }
11993
-
11994
- getDisplayIndex(){
11995
- return this.displayIndex;
12038
+ if(this.table.options.groupBy){
12039
+ this.reassignRowToGroup(cell.row);
12040
+ }
11996
12041
  }
11997
-
12042
+
11998
12043
  //return appropriate rows with group headers
11999
12044
  getRows(rows){
12000
12045
  if(this.table.options.groupBy && this.groupIDLookups.length){
12001
-
12046
+
12002
12047
  this.dispatchExternal("dataGrouping");
12003
-
12048
+
12004
12049
  this.generateGroups(rows);
12005
-
12050
+
12006
12051
  if(this.subscribedExternal("dataGrouped")){
12007
12052
  this.dispatchExternal("dataGrouped", this.getGroups(true));
12008
12053
  }
12009
-
12054
+
12010
12055
  return this.updateGroupRows();
12011
-
12056
+
12012
12057
  }else {
12013
12058
  return rows.slice(0);
12014
12059
  }
12015
12060
  }
12016
-
12061
+
12017
12062
  getGroups(component){
12018
12063
  var groupComponents = [];
12019
-
12064
+
12020
12065
  this.groupList.forEach(function(group){
12021
12066
  groupComponents.push(component ? group.getComponent() : group);
12022
12067
  });
12023
-
12068
+
12024
12069
  return groupComponents;
12025
12070
  }
12026
-
12071
+
12027
12072
  getChildGroups(group){
12028
12073
  var groupComponents = [];
12029
-
12074
+
12030
12075
  if(!group){
12031
12076
  group = this;
12032
12077
  }
12033
-
12078
+
12034
12079
  group.groupList.forEach((child) => {
12035
12080
  if(child.groupList.length){
12036
12081
  groupComponents = groupComponents.concat(this.getChildGroups(child));
@@ -12038,91 +12083,93 @@ class GroupRows extends Module{
12038
12083
  groupComponents.push(child);
12039
12084
  }
12040
12085
  });
12041
-
12086
+
12042
12087
  return groupComponents;
12043
12088
  }
12044
-
12089
+
12045
12090
  wipe(){
12046
- this.groupList.forEach(function(group){
12047
- group.wipe();
12048
- });
12091
+ if(this.table.options.groupBy){
12092
+ this.groupList.forEach(function(group){
12093
+ group.wipe();
12094
+ });
12095
+ }
12049
12096
  }
12050
-
12097
+
12051
12098
  pullGroupListData(groupList) {
12052
12099
  var groupListData = [];
12053
-
12100
+
12054
12101
  groupList.forEach((group) => {
12055
12102
  var groupHeader = {};
12056
12103
  groupHeader.level = 0;
12057
12104
  groupHeader.rowCount = 0;
12058
12105
  groupHeader.headerContent = "";
12059
12106
  var childData = [];
12060
-
12107
+
12061
12108
  if (group.hasSubGroups) {
12062
12109
  childData = this.pullGroupListData(group.groupList);
12063
-
12110
+
12064
12111
  groupHeader.level = group.level;
12065
12112
  groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers
12066
12113
  groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group);
12067
-
12114
+
12068
12115
  groupListData.push(groupHeader);
12069
12116
  groupListData = groupListData.concat(childData);
12070
12117
  }
12071
-
12118
+
12072
12119
  else {
12073
12120
  groupHeader.level = group.level;
12074
12121
  groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group);
12075
12122
  groupHeader.rowCount = group.getRows().length;
12076
-
12123
+
12077
12124
  groupListData.push(groupHeader);
12078
-
12125
+
12079
12126
  group.getRows().forEach((row) => {
12080
12127
  groupListData.push(row.getData("data"));
12081
12128
  });
12082
12129
  }
12083
12130
  });
12084
-
12131
+
12085
12132
  return groupListData;
12086
12133
  }
12087
-
12134
+
12088
12135
  getGroupedData(){
12089
-
12136
+
12090
12137
  return this.pullGroupListData(this.groupList);
12091
12138
  }
12092
-
12139
+
12093
12140
  getRowGroup(row){
12094
12141
  var match = false;
12095
-
12142
+
12096
12143
  if(this.options("dataTree")){
12097
12144
  row = this.table.modules.dataTree.getTreeParentRoot(row);
12098
12145
  }
12099
-
12146
+
12100
12147
  this.groupList.forEach((group) => {
12101
12148
  var result = group.getRowGroup(row);
12102
-
12149
+
12103
12150
  if(result){
12104
12151
  match = result;
12105
12152
  }
12106
12153
  });
12107
-
12154
+
12108
12155
  return match;
12109
12156
  }
12110
-
12157
+
12111
12158
  countGroups(){
12112
12159
  return this.groupList.length;
12113
12160
  }
12114
-
12161
+
12115
12162
  generateGroups(rows){
12116
12163
  var oldGroups = this.groups;
12117
-
12164
+
12118
12165
  this.groups = {};
12119
12166
  this.groupList = [];
12120
-
12167
+
12121
12168
  if(this.allowedValues && this.allowedValues[0]){
12122
12169
  this.allowedValues[0].forEach((value) => {
12123
12170
  this.createGroup(value, 0, oldGroups);
12124
12171
  });
12125
-
12172
+
12126
12173
  rows.forEach((row) => {
12127
12174
  this.assignRowToExistingGroup(row, oldGroups);
12128
12175
  });
@@ -12132,53 +12179,53 @@ class GroupRows extends Module{
12132
12179
  });
12133
12180
  }
12134
12181
  }
12135
-
12182
+
12136
12183
  createGroup(groupID, level, oldGroups){
12137
12184
  var groupKey = level + "_" + groupID,
12138
12185
  group;
12139
-
12186
+
12140
12187
  oldGroups = oldGroups || [];
12141
-
12188
+
12142
12189
  group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]);
12143
-
12190
+
12144
12191
  this.groups[groupKey] = group;
12145
12192
  this.groupList.push(group);
12146
12193
  }
12147
-
12194
+
12148
12195
  assignRowToExistingGroup(row, oldGroups){
12149
12196
  var groupID = this.groupIDLookups[0].func(row.getData()),
12150
12197
  groupKey = "0_" + groupID;
12151
-
12198
+
12152
12199
  if(this.groups[groupKey]){
12153
12200
  this.groups[groupKey].addRow(row);
12154
12201
  }
12155
12202
  }
12156
-
12203
+
12157
12204
  assignRowToGroup(row, oldGroups){
12158
12205
  var groupID = this.groupIDLookups[0].func(row.getData()),
12159
12206
  newGroupNeeded = !this.groups["0_" + groupID];
12160
-
12207
+
12161
12208
  if(newGroupNeeded){
12162
12209
  this.createGroup(groupID, 0, oldGroups);
12163
12210
  }
12164
-
12211
+
12165
12212
  this.groups["0_" + groupID].addRow(row);
12166
-
12213
+
12167
12214
  return !newGroupNeeded;
12168
12215
  }
12169
-
12216
+
12170
12217
  reassignRowToGroup(row){
12171
12218
  if(row.type === "row"){
12172
12219
  var oldRowGroup = row.modules.group,
12173
12220
  oldGroupPath = oldRowGroup.getPath(),
12174
12221
  newGroupPath = this.getExpectedPath(row),
12175
12222
  samePath;
12176
-
12223
+
12177
12224
  // figure out if new group path is the same as old group path
12178
12225
  samePath = (oldGroupPath.length == newGroupPath.length) && oldGroupPath.every((element, index) => {
12179
12226
  return element === newGroupPath[index];
12180
12227
  });
12181
-
12228
+
12182
12229
  // refresh if they new path and old path aren't the same (aka the row's groupings have changed)
12183
12230
  if(!samePath) {
12184
12231
  oldRowGroup.removeRow(row);
@@ -12187,57 +12234,81 @@ class GroupRows extends Module{
12187
12234
  }
12188
12235
  }
12189
12236
  }
12190
-
12237
+
12191
12238
  getExpectedPath(row) {
12192
12239
  var groupPath = [], rowData = row.getData();
12193
-
12240
+
12194
12241
  this.groupIDLookups.forEach((groupId) => {
12195
12242
  groupPath.push(groupId.func(rowData));
12196
12243
  });
12197
-
12244
+
12198
12245
  return groupPath;
12199
12246
  }
12200
-
12247
+
12201
12248
  updateGroupRows(force){
12202
12249
  var output = [];
12203
-
12250
+
12204
12251
  this.groupList.forEach((group) => {
12205
12252
  output = output.concat(group.getHeadersAndRows());
12206
12253
  });
12207
-
12254
+
12208
12255
  if(force){
12209
12256
  this.refreshData(true, this.displayHandler);
12210
12257
  }
12211
-
12258
+
12212
12259
  return output;
12213
12260
  }
12214
-
12261
+
12215
12262
  scrollHeaders(left){
12216
- if(this.table.options.renderHorizontal === "virtual"){
12217
- left -= this.table.columnManager.renderer.vDomPadLeft;
12263
+ if(this.table.options.groupBy){
12264
+ if(this.table.options.renderHorizontal === "virtual"){
12265
+ left -= this.table.columnManager.renderer.vDomPadLeft;
12266
+ }
12267
+
12268
+ left = left + "px";
12269
+
12270
+ this.groupList.forEach((group) => {
12271
+ group.scrollHeader(left);
12272
+ });
12218
12273
  }
12219
-
12220
- left = left + "px";
12221
-
12222
- this.groupList.forEach((group) => {
12223
- group.scrollHeader(left);
12224
- });
12225
12274
  }
12226
-
12275
+
12227
12276
  removeGroup(group){
12228
12277
  var groupKey = group.level + "_" + group.key,
12229
12278
  index;
12230
-
12279
+
12231
12280
  if(this.groups[groupKey]){
12232
12281
  delete this.groups[groupKey];
12233
-
12282
+
12234
12283
  index = this.groupList.indexOf(group);
12235
-
12284
+
12236
12285
  if(index > -1){
12237
12286
  this.groupList.splice(index, 1);
12238
12287
  }
12239
12288
  }
12240
12289
  }
12290
+
12291
+ checkBasicModeGroupHeaderWidth(){
12292
+ var element = this.table.rowManager.tableElement,
12293
+ onlyGroupHeaders = true;
12294
+
12295
+ this.table.rowManager.getDisplayRows().forEach((row, index) =>{
12296
+ this.table.rowManager.styleRow(row, index);
12297
+ element.appendChild(row.getElement());
12298
+ row.initialize(true);
12299
+
12300
+ if(row.type !== "group"){
12301
+ onlyGroupHeaders = false;
12302
+ }
12303
+ });
12304
+
12305
+ if(onlyGroupHeaders){
12306
+ element.style.minWidth = this.table.columnManager.getWidth() + "px";
12307
+ }else {
12308
+ element.style.minWidth = "";
12309
+ }
12310
+ }
12311
+
12241
12312
  }
12242
12313
 
12243
12314
  GroupRows.moduleName = "groupRows";
@@ -12335,7 +12406,7 @@ class History extends Module{
12335
12406
 
12336
12407
  if(this.table.options.groupBy){
12337
12408
 
12338
- rows = row.getComponent().getGroup().rows;
12409
+ rows = row.getComponent().getGroup()._getSelf().rows;
12339
12410
  index = rows.indexOf(row);
12340
12411
 
12341
12412
  if(index){
@@ -13032,7 +13103,7 @@ class Interaction extends Module{
13032
13103
  var range;
13033
13104
 
13034
13105
  if(this.table.modExists("edit")){
13035
- if (this.table.modules.edit.currentCell === this){
13106
+ if (this.table.modules.edit.currentCell === cell){
13036
13107
  return; //prevent instant selection of editor content
13037
13108
  }
13038
13109
  }
@@ -13042,11 +13113,11 @@ class Interaction extends Module{
13042
13113
  try{
13043
13114
  if (document.selection) { // IE
13044
13115
  range = document.body.createTextRange();
13045
- range.moveToElementText(this.element);
13116
+ range.moveToElementText(cell.getElement());
13046
13117
  range.select();
13047
13118
  } else if (window.getSelection) {
13048
13119
  range = document.createRange();
13049
- range.selectNode(this.element);
13120
+ range.selectNode(cell.getElement());
13050
13121
  window.getSelection().removeAllRanges();
13051
13122
  window.getSelection().addRange(range);
13052
13123
  }
@@ -14975,8 +15046,6 @@ class Page extends Module{
14975
15046
 
14976
15047
  this.remoteRowCountEstimate = null;
14977
15048
 
14978
- this.displayIndex = 0; //index in display pipeline
14979
-
14980
15049
  this.initialLoad = true;
14981
15050
  this.dataChanging = false; //flag to check if data is being changed by this module
14982
15051
 
@@ -15422,14 +15491,6 @@ class Page extends Module{
15422
15491
  this.dispatch("page-changed");
15423
15492
  }
15424
15493
 
15425
- setDisplayIndex(index){
15426
- this.displayIndex = index;
15427
- }
15428
-
15429
- getDisplayIndex(){
15430
- return this.displayIndex;
15431
- }
15432
-
15433
15494
  //calculate maximum page from number of rows
15434
15495
  setMaxRows(rowCount){
15435
15496
  if(!rowCount){
@@ -15496,9 +15557,9 @@ class Page extends Module{
15496
15557
  }
15497
15558
 
15498
15559
  setPageToRow(row){
15499
- var rows = this.table.rowManager.getDisplayRows(this.displayIndex - 1);
15560
+ var rows = this.displayRows(-1);
15500
15561
  var index = rows.indexOf(row);
15501
-
15562
+
15502
15563
  if(index > -1){
15503
15564
  var page = this.size === true ? 1 : Math.ceil((index + 1) / this.size);
15504
15565
 
@@ -16091,9 +16152,10 @@ class Persistence extends Module{
16091
16152
  keys.forEach((key)=>{
16092
16153
  var props = Object.getOwnPropertyDescriptor(def, key);
16093
16154
  var value = def[key];
16155
+
16094
16156
  if(props){
16095
16157
  Object.defineProperty(def, key, {
16096
- set: function(newValue){
16158
+ set: (newValue) => {
16097
16159
  value = newValue;
16098
16160
 
16099
16161
  if(!this.defWatcherBlock){
@@ -16104,7 +16166,7 @@ class Persistence extends Module{
16104
16166
  props.set(newValue);
16105
16167
  }
16106
16168
  },
16107
- get:function(){
16169
+ get:() => {
16108
16170
  if(props.get){
16109
16171
  props.get();
16110
16172
  }
@@ -17636,8 +17698,9 @@ class ResponsiveLayout extends Module{
17636
17698
  this.subscribe("column-delete", this.initializeResponsivity.bind(this));
17637
17699
 
17638
17700
  this.subscribe("table-redrawing", this.tableRedraw.bind(this));
17639
-
17701
+
17640
17702
  if(this.table.options.responsiveLayout === "collapse"){
17703
+ this.subscribe("row-data-changed", this.generateCollapsedRowContent.bind(this));
17641
17704
  this.subscribe("row-init", this.initializeRow.bind(this));
17642
17705
  this.subscribe("row-layout", this.layoutRow.bind(this));
17643
17706
  }
@@ -18160,18 +18223,22 @@ class SelectRow extends Module{
18160
18223
  break;
18161
18224
 
18162
18225
  case "string":
18163
-
18164
18226
  rowMatch = this.table.rowManager.findRow(rows);
18165
18227
 
18166
18228
  if(rowMatch){
18167
18229
  this._selectRow(rowMatch, true, true);
18230
+ this._rowSelectionChanged();
18168
18231
  }else {
18169
- this.table.rowManager.getRows(rows).forEach((row) => {
18232
+ rowMatch = this.table.rowManager.getRows(rows);
18233
+
18234
+ rowMatch.forEach((row) => {
18170
18235
  this._selectRow(row, true, true);
18171
18236
  });
18237
+
18238
+ if(rowMatch.length){
18239
+ this._rowSelectionChanged();
18240
+ }
18172
18241
  }
18173
-
18174
- this._rowSelectionChanged();
18175
18242
  break;
18176
18243
 
18177
18244
  default:
@@ -18808,7 +18875,6 @@ class Sort extends Module{
18808
18875
  }
18809
18876
  }
18810
18877
 
18811
-
18812
18878
  if (this.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) {
18813
18879
  sorters = this.getSort();
18814
18880
 
@@ -18819,11 +18885,9 @@ class Sort extends Module{
18819
18885
  if(match > -1){
18820
18886
  sorters[match].dir = dir;
18821
18887
 
18822
- if(match != sorters.length -1){
18823
- match = sorters.splice(match, 1)[0];
18824
- if(dir != "none"){
18825
- sorters.push(match);
18826
- }
18888
+ match = sorters.splice(match, 1)[0];
18889
+ if(dir != "none"){
18890
+ sorters.push(match);
18827
18891
  }
18828
18892
  }else {
18829
18893
  if(dir != "none"){
@@ -19038,7 +19102,7 @@ class Sort extends Module{
19038
19102
  var sortEl = column.modules.sort.element,
19039
19103
  arrowEl;
19040
19104
 
19041
- if(typeof this.table.options.headerSortElement === "function"){
19105
+ if(column.definition.headerSort && typeof this.table.options.headerSortElement === "function"){
19042
19106
  while(sortEl.firstChild) sortEl.removeChild(sortEl.firstChild);
19043
19107
 
19044
19108
  arrowEl = this.table.options.headerSortElement.call(this.table, column.getComponent(), dir);
@@ -20863,6 +20927,8 @@ class ColumnManager extends CoreFeature {
20863
20927
  var minHeight = 0;
20864
20928
 
20865
20929
  if(!this.redrawBlock){
20930
+
20931
+ this.element.style.height="";
20866
20932
 
20867
20933
  this.columns.forEach((column) => {
20868
20934
  column.clearVerticalAlign();
@@ -20875,7 +20941,9 @@ class ColumnManager extends CoreFeature {
20875
20941
  minHeight = height;
20876
20942
  }
20877
20943
  });
20878
-
20944
+
20945
+ this.element.style.height = minHeight + "px";
20946
+
20879
20947
  this.columns.forEach((column) => {
20880
20948
  column.verticalAlign(this.table.options.columnHeaderVertAlign, minHeight);
20881
20949
  });
@@ -20886,6 +20954,8 @@ class ColumnManager extends CoreFeature {
20886
20954
 
20887
20955
  //////////////// Column Details /////////////////
20888
20956
  findColumn(subject){
20957
+ var columns;
20958
+
20889
20959
  if(typeof subject == "object"){
20890
20960
 
20891
20961
  if(subject instanceof Column){
@@ -20895,8 +20965,16 @@ class ColumnManager extends CoreFeature {
20895
20965
  //subject is public column component
20896
20966
  return subject._getSelf() || false;
20897
20967
  }else if(typeof HTMLElement !== "undefined" && subject instanceof HTMLElement){
20968
+
20969
+ columns = [];
20970
+
20971
+ this.columns.forEach((column) => {
20972
+ columns.push(column);
20973
+ columns = columns.concat(column.getColumns(true));
20974
+ });
20975
+
20898
20976
  //subject is a HTML element of the column header
20899
- let match = this.columns.find((column) => {
20977
+ let match = columns.find((column) => {
20900
20978
  return column.element === subject;
20901
20979
  });
20902
20980
 
@@ -21011,14 +21089,14 @@ class ColumnManager extends CoreFeature {
21011
21089
  }
21012
21090
 
21013
21091
  moveColumn(from, to, after){
21014
- this.moveColumnActual(from, to, after);
21015
-
21016
21092
  to.element.parentNode.insertBefore(from.element, to.element);
21017
21093
 
21018
21094
  if(after){
21019
21095
  to.element.parentNode.insertBefore(to.element, from.element);
21020
21096
  }
21021
21097
 
21098
+ this.moveColumnActual(from, to, after);
21099
+
21022
21100
  this.verticalAlignHeaders();
21023
21101
 
21024
21102
  this.table.rowManager.reinitialize();
@@ -22533,81 +22611,82 @@ class RowManager extends CoreFeature{
22533
22611
  index = 0,
22534
22612
  cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
22535
22613
 
22536
-
22537
- if(typeof handler === "function"){
22538
- index = this.dataPipeline.findIndex((item) => {
22539
- return item.handler === handler;
22540
- });
22541
-
22542
- if(index > -1){
22543
- stage = "dataPipeline";
22544
-
22545
- if(skipStage){
22546
- if(index == this.dataPipeline.length - 1){
22547
- stage = "display";
22548
- }else {
22549
- index++;
22550
- }
22551
- }
22552
- }else {
22553
- index = this.displayPipeline.findIndex((item) => {
22614
+ if(!this.table.destroyed){
22615
+ if(typeof handler === "function"){
22616
+ index = this.dataPipeline.findIndex((item) => {
22554
22617
  return item.handler === handler;
22555
22618
  });
22556
22619
 
22557
22620
  if(index > -1){
22558
- stage = "displayPipeline";
22621
+ stage = "dataPipeline";
22559
22622
 
22560
22623
  if(skipStage){
22561
- if(index == this.displayPipeline.length - 1){
22562
- stage = "end";
22624
+ if(index == this.dataPipeline.length - 1){
22625
+ stage = "display";
22563
22626
  }else {
22564
22627
  index++;
22565
22628
  }
22566
22629
  }
22567
22630
  }else {
22568
- console.error("Unable to refresh data, invalid handler provided", handler);
22569
- return;
22631
+ index = this.displayPipeline.findIndex((item) => {
22632
+ return item.handler === handler;
22633
+ });
22634
+
22635
+ if(index > -1){
22636
+ stage = "displayPipeline";
22637
+
22638
+ if(skipStage){
22639
+ if(index == this.displayPipeline.length - 1){
22640
+ stage = "end";
22641
+ }else {
22642
+ index++;
22643
+ }
22644
+ }
22645
+ }else {
22646
+ console.error("Unable to refresh data, invalid handler provided", handler);
22647
+ return;
22648
+ }
22570
22649
  }
22571
- }
22572
- }else {
22573
- stage = handler || "all";
22574
- index = 0;
22575
- }
22576
-
22577
- if(this.redrawBlock){
22578
- if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
22579
- this.redrawBlockRestoreConfig = {
22580
- handler: handler,
22581
- skipStage: skipStage,
22582
- renderInPosition: renderInPosition,
22583
- stage:stage,
22584
- index:index,
22585
- };
22650
+ }else {
22651
+ stage = handler || "all";
22652
+ index = 0;
22586
22653
  }
22587
22654
 
22588
- return;
22589
- }else {
22590
- if(Helpers.elVisible(this.element)){
22591
- if(renderInPosition){
22592
- this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
22655
+ if(this.redrawBlock){
22656
+ if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
22657
+ this.redrawBlockRestoreConfig = {
22658
+ handler: handler,
22659
+ skipStage: skipStage,
22660
+ renderInPosition: renderInPosition,
22661
+ stage:stage,
22662
+ index:index,
22663
+ };
22664
+ }
22665
+
22666
+ return;
22667
+ }else {
22668
+ if(Helpers.elVisible(this.element)){
22669
+ if(renderInPosition){
22670
+ this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
22671
+ }else {
22672
+ this.refreshPipelines(handler, stage, index, renderInPosition);
22673
+
22674
+ if(!handler){
22675
+ this.table.columnManager.renderer.renderColumns();
22676
+ }
22677
+
22678
+ this.renderTable();
22679
+
22680
+ if(table.options.layoutColumnsOnNewData){
22681
+ this.table.columnManager.redraw(true);
22682
+ }
22683
+ }
22593
22684
  }else {
22594
22685
  this.refreshPipelines(handler, stage, index, renderInPosition);
22595
-
22596
- if(!handler){
22597
- this.table.columnManager.renderer.renderColumns();
22598
- }
22599
-
22600
- this.renderTable();
22601
-
22602
- if(table.options.layoutColumnsOnNewData){
22603
- this.table.columnManager.redraw(true);
22604
- }
22605
22686
  }
22606
- }else {
22607
- this.refreshPipelines(handler, stage, index, renderInPosition);
22687
+
22688
+ this.dispatch("data-refreshed");
22608
22689
  }
22609
-
22610
- this.dispatch("data-refreshed");
22611
22690
  }
22612
22691
  }
22613
22692
 
@@ -22640,7 +22719,7 @@ class RowManager extends CoreFeature{
22640
22719
  case "displayPipeline":
22641
22720
  for(let i = index; i < this.displayPipeline.length; i++){
22642
22721
  let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
22643
-
22722
+
22644
22723
  this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
22645
22724
  }
22646
22725
 
@@ -22677,28 +22756,13 @@ class RowManager extends CoreFeature{
22677
22756
  this.displayRowsCount = this.displayRows[0].length;
22678
22757
  }
22679
22758
 
22680
- getNextDisplayIndex(){
22681
- return this.displayRows.length;
22682
- }
22683
-
22684
22759
  //set display row pipeline data
22685
22760
  setDisplayRows(displayRows, index){
22686
-
22687
- var output = true;
22688
-
22689
- if(index && typeof this.displayRows[index] != "undefined"){
22690
- this.displayRows[index] = displayRows;
22691
- output = true;
22692
- }else {
22693
- this.displayRows.push(displayRows);
22694
- output = index = this.displayRows.length -1;
22695
- }
22696
-
22761
+ this.displayRows[index] = displayRows;
22762
+
22697
22763
  if(index == this.displayRows.length -1){
22698
22764
  this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
22699
22765
  }
22700
-
22701
- return output;
22702
22766
  }
22703
22767
 
22704
22768
  getDisplayRows(index){
@@ -22729,23 +22793,24 @@ class RowManager extends CoreFeature{
22729
22793
 
22730
22794
  //return only actual rows (not group headers etc)
22731
22795
  getRows(type){
22732
- var rows;
22733
-
22734
- switch(type){
22735
- case "active":
22736
- rows = this.activeRows;
22737
- break;
22738
-
22739
- case "display":
22740
- rows = this.table.rowManager.getDisplayRows();
22741
- break;
22742
-
22743
- case "visible":
22744
- rows = this.getVisibleRows(false, true);
22745
- break;
22796
+ var rows = [];
22797
+
22798
+ if(!type){
22799
+ rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
22800
+ }else {
22801
+ switch(type){
22802
+ case "active":
22803
+ rows = this.activeRows;
22804
+ break;
22746
22805
 
22747
- default:
22748
- rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
22806
+ case "display":
22807
+ rows = this.table.rowManager.getDisplayRows();
22808
+ break;
22809
+
22810
+ case "visible":
22811
+ rows = this.getVisibleRows(false, true);
22812
+ break;
22813
+ }
22749
22814
  }
22750
22815
 
22751
22816
  return rows;
@@ -22788,6 +22853,8 @@ class RowManager extends CoreFeature{
22788
22853
  }
22789
22854
 
22790
22855
  if(renderClass){
22856
+ this.renderMode = this.table.options.renderVertical;
22857
+
22791
22858
  this.renderer = new renderClass(this.table, this.element, this.tableElement);
22792
22859
  this.renderer.initialize();
22793
22860
 
@@ -22852,9 +22919,6 @@ class RowManager extends CoreFeature{
22852
22919
 
22853
22920
  this.scrollTop = 0;
22854
22921
  this.scrollLeft = 0;
22855
-
22856
- // clear empty table placeholder min
22857
- this.tableElement.style.minWidth = "";
22858
22922
 
22859
22923
  this.renderer.clearRows();
22860
22924
  }
@@ -22871,6 +22935,9 @@ class RowManager extends CoreFeature{
22871
22935
  _clearPlaceholder(){
22872
22936
  if(this.placeholder && this.placeholder.parentNode){
22873
22937
  this.placeholder.parentNode.removeChild(this.placeholder);
22938
+
22939
+ // clear empty table placeholder min
22940
+ this.tableElement.style.minWidth = "";
22874
22941
  }
22875
22942
  }
22876
22943
 
@@ -23314,7 +23381,9 @@ class InteractionManager extends CoreFeature {
23314
23381
  });
23315
23382
 
23316
23383
  for (let target of elTargets) {
23317
- targets[this.componentMap[target]] = el;
23384
+ if(!targets[this.componentMap[target]]){
23385
+ targets[this.componentMap[target]] = el;
23386
+ }
23318
23387
  }
23319
23388
  }
23320
23389
 
@@ -23329,12 +23398,13 @@ class InteractionManager extends CoreFeature {
23329
23398
  //ensure row component is looked up before cell
23330
23399
  var keys = Object.keys(targets).reverse(),
23331
23400
  listener = this.listeners[type],
23401
+ matches = {},
23332
23402
  targetMatches = {};
23333
23403
 
23334
23404
  for(let key of keys){
23335
- let component;
23336
- let target = targets[key];
23337
- let previousTarget = this.previousTargets[key];
23405
+ let component,
23406
+ target = targets[key],
23407
+ previousTarget = this.previousTargets[key];
23338
23408
 
23339
23409
  if(previousTarget && previousTarget.target === target){
23340
23410
  component = previousTarget.component;
@@ -23363,8 +23433,8 @@ class InteractionManager extends CoreFeature {
23363
23433
 
23364
23434
  case "cell":
23365
23435
  if(listener.components.includes("cell")){
23366
- if(targets["row"] instanceof Row){
23367
- component = targets["row"].findCell(target);
23436
+ if(matches["row"] instanceof Row){
23437
+ component = matches["row"].findCell(target);
23368
23438
  }else {
23369
23439
  if(targets["row"]){
23370
23440
  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?");
@@ -23376,7 +23446,7 @@ class InteractionManager extends CoreFeature {
23376
23446
  }
23377
23447
 
23378
23448
  if(component){
23379
- targets[key] = component;
23449
+ matches[key] = component;
23380
23450
  targetMatches[key] = {
23381
23451
  target:target,
23382
23452
  component:component,
@@ -23386,12 +23456,12 @@ class InteractionManager extends CoreFeature {
23386
23456
 
23387
23457
  this.previousTargets = targetMatches;
23388
23458
 
23389
- return targets;
23459
+ return matches;
23390
23460
  }
23391
23461
 
23392
23462
  triggerEvents(type, e, targets){
23393
23463
  var listener = this.listeners[type];
23394
-
23464
+
23395
23465
  for(let key in targets){
23396
23466
  if(targets[key] && listener.components.includes(key)){
23397
23467
  this.dispatch(key + "-" + type, e, targets[key]);
@@ -24002,7 +24072,7 @@ function fitDataStretch(columns, forced){
24002
24072
 
24003
24073
  //resize columns to fit
24004
24074
  function fitColumns(columns, forced){
24005
- var totalWidth = this.table.element.clientWidth; //table element width
24075
+ var totalWidth = this.table.rowManager.element.getBoundingClientRect().width; //table element width
24006
24076
  var fixedWidth = 0; //total width of columns with a defined width
24007
24077
  var flexWidth = 0; //total width available to flexible columns
24008
24078
  var flexGrowUnits = 0; //total number of widthGrow blocks across all columns
@@ -24079,9 +24149,7 @@ function fitColumns(columns, forced){
24079
24149
 
24080
24150
  nextColWidth = changeUnits ? Math.floor(remainingSpace/changeUnits) : remainingSpace;
24081
24151
 
24082
- gap = remainingSpace - (nextColWidth * changeUnits);
24083
-
24084
- gap += scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols);
24152
+ gap = scaleColumns(undersizeCols, remainingSpace, nextColWidth, shrinkCols);
24085
24153
  }else {
24086
24154
  gap = changeUnits ? freeSpace - (Math.floor(freeSpace/changeUnits) * changeUnits) : freeSpace;
24087
24155
 
@@ -24145,7 +24213,7 @@ function fitColumns(columns, forced){
24145
24213
 
24146
24214
  //increase width of last column to account for rounding errors
24147
24215
  if(flexColumns.length && gapFill > 0){
24148
- flexColumns[flexColumns.length-1].width += + gapFill;
24216
+ flexColumns[flexColumns.length-1].width += gapFill;
24149
24217
  }
24150
24218
 
24151
24219
  //calculate space for columns to be shrunk into
@@ -24161,7 +24229,7 @@ function fitColumns(columns, forced){
24161
24229
  }
24162
24230
 
24163
24231
  //decrease width of last column to account for rounding errors
24164
- if(fixedShrinkColumns.length){
24232
+ if(gapFill && fixedShrinkColumns.length){
24165
24233
  fixedShrinkColumns[fixedShrinkColumns.length-1].width -= gapFill;
24166
24234
  }
24167
24235
 
@@ -25067,7 +25135,7 @@ class Tabulator {
25067
25135
  data = JSON.parse(data);
25068
25136
  }
25069
25137
 
25070
- if(data){
25138
+ if(data && data.length > 0){
25071
25139
  data.forEach((item) => {
25072
25140
  var row = this.rowManager.findRow(item[this.options.index]);
25073
25141
 
@@ -25133,7 +25201,7 @@ class Tabulator {
25133
25201
  data = JSON.parse(data);
25134
25202
  }
25135
25203
 
25136
- if(data){
25204
+ if(data && data.length > 0){
25137
25205
  data.forEach((item) => {
25138
25206
  var row = this.rowManager.findRow(item[this.options.index]);
25139
25207