tabulator-tables 5.1.2 → 5.1.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.
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.1.2 (c) Oliver Folkerd 2022 */
1
+ /* Tabulator v5.1.3 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -3324,7 +3324,7 @@ class ColumnCalcs extends Module{
3324
3324
  this.subscribe("row-added", this.rowsUpdated.bind(this));
3325
3325
  this.subscribe("column-moved", this.recalcActiveRows.bind(this));
3326
3326
  this.subscribe("column-add", this.recalcActiveRows.bind(this));
3327
- this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
3327
+ this.subscribe("data-refreshed", this.recalcActiveRowsRefresh.bind(this));
3328
3328
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
3329
3329
  this.subscribe("rows-visible", this.visibleRows.bind(this));
3330
3330
 
@@ -3372,6 +3372,14 @@ class ColumnCalcs extends Module{
3372
3372
  }
3373
3373
  }
3374
3374
 
3375
+ recalcActiveRowsRefresh(){
3376
+ if(this.table.options.groupBy && this.table.options.dataTreeStartExpanded && this.table.options.dataTree){
3377
+ this.recalcAll();
3378
+ }else {
3379
+ this.recalcActiveRows();
3380
+ }
3381
+ }
3382
+
3375
3383
  recalcActiveRows(){
3376
3384
  this.recalc(this.table.rowManager.activeRows);
3377
3385
  }
@@ -3379,7 +3387,6 @@ class ColumnCalcs extends Module{
3379
3387
  cellValueChanged(cell){
3380
3388
  if(cell.column.definition.topCalc || cell.column.definition.bottomCalc){
3381
3389
  if(this.table.options.groupBy){
3382
-
3383
3390
  if(this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both"){
3384
3391
  this.recalcActiveRows();
3385
3392
  }
@@ -3387,7 +3394,6 @@ class ColumnCalcs extends Module{
3387
3394
  if(this.table.options.columnCalcs != "table"){
3388
3395
  this.recalcRowGroup(cell.row);
3389
3396
  }
3390
-
3391
3397
  }else {
3392
3398
  this.recalcActiveRows();
3393
3399
  }
@@ -3559,7 +3565,6 @@ class ColumnCalcs extends Module{
3559
3565
 
3560
3566
  if(this.table.options.groupBy && this.table.options.columnCalcs !== "table"){
3561
3567
 
3562
-
3563
3568
  var groups = this.table.modules.groupRows.getChildGroups();
3564
3569
 
3565
3570
  groups.forEach((group) => {
@@ -9574,8 +9579,10 @@ function responsiveCollapse(cell, formatterParams, onRendered){
9574
9579
 
9575
9580
  function rowSelection(cell, formatterParams, onRendered){
9576
9581
  var checkbox = document.createElement("input");
9582
+ var blocked = false;
9577
9583
 
9578
9584
  checkbox.type = 'checkbox';
9585
+
9579
9586
 
9580
9587
  if(this.table.modExists("selectRow", true)){
9581
9588
 
@@ -9589,9 +9596,24 @@ function rowSelection(cell, formatterParams, onRendered){
9589
9596
  if(row instanceof RowComponent$1){
9590
9597
 
9591
9598
  checkbox.addEventListener("change", (e) => {
9592
- row.toggleSelect();
9599
+ if(this.table.options.selectableRangeMode === "click"){
9600
+ if(!blocked){
9601
+ row.toggleSelect();
9602
+ }else {
9603
+ blocked = false;
9604
+ }
9605
+ }else {
9606
+ row.toggleSelect();
9607
+ }
9593
9608
  });
9594
9609
 
9610
+ if(this.table.options.selectableRangeMode === "click"){
9611
+ checkbox.addEventListener("click", (e) => {
9612
+ blocked = true;
9613
+ this.table.modules.selectRow.handleComplexRowClick(row._row, e);
9614
+ });
9615
+ }
9616
+
9595
9617
  checkbox.checked = row.isSelected && row.isSelected();
9596
9618
  this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
9597
9619
  }else {
@@ -9853,6 +9875,7 @@ class FrozenColumns extends Module{
9853
9875
  this.initializationMode = "left";
9854
9876
  this.active = false;
9855
9877
  this.scrollEndTimer = false;
9878
+ this.blocked = true;
9856
9879
 
9857
9880
  this.registerColumnOption("frozen");
9858
9881
  }
@@ -9880,6 +9903,16 @@ class FrozenColumns extends Module{
9880
9903
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
9881
9904
  this.subscribe("columns-loading", this.reset.bind(this));
9882
9905
  this.subscribe("table-redraw", this.layout.bind(this));
9906
+ this.subscribe("layout-refreshing", this.blockLayout.bind(this));
9907
+ this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
9908
+ }
9909
+
9910
+ blockLayout(){
9911
+ this.blocked = true;
9912
+ }
9913
+
9914
+ unblockLayout(){
9915
+ this.blocked = false;
9883
9916
  }
9884
9917
 
9885
9918
  layoutCell(cell){
@@ -10062,11 +10095,10 @@ class FrozenColumns extends Module{
10062
10095
  return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
10063
10096
  }
10064
10097
 
10065
- //layout columns appropropriatly
10098
+ //layout columns appropriately
10066
10099
  layout(){
10067
10100
 
10068
- if(this.active){
10069
-
10101
+ if(this.active && !this.blocked){
10070
10102
  //calculate row padding
10071
10103
  this.calcMargins();
10072
10104
 
@@ -10090,6 +10122,10 @@ class FrozenColumns extends Module{
10090
10122
 
10091
10123
  rowEl.style.paddingLeft = this.leftMargin;
10092
10124
 
10125
+ if(this.table.options.layout === "fitDataFill" && this.rightColumns.length){
10126
+ this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
10127
+ }
10128
+
10093
10129
  this.leftColumns.forEach((column) => {
10094
10130
  var cell = row.getCell(column);
10095
10131
 
@@ -10328,7 +10364,7 @@ class GroupComponent {
10328
10364
 
10329
10365
  //Group functions
10330
10366
  class Group{
10331
-
10367
+
10332
10368
  constructor(groupManager, parent, level, key, field, generator, oldGroup){
10333
10369
  this.groupManager = groupManager;
10334
10370
  this.parent = parent;
@@ -10352,17 +10388,17 @@ class Group{
10352
10388
  this.initialized = false;
10353
10389
  this.modules = {};
10354
10390
  this.arrowElement = false;
10355
-
10391
+
10356
10392
  this.visible = oldGroup ? oldGroup.visible : (typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]);
10357
-
10393
+
10358
10394
  this.component = null;
10359
-
10395
+
10360
10396
  this.createElements();
10361
10397
  this.addBindings();
10362
-
10398
+
10363
10399
  this.createValueGroups();
10364
10400
  }
10365
-
10401
+
10366
10402
  wipe(){
10367
10403
  if(this.groupList.length){
10368
10404
  this.groupList.forEach(function(group){
@@ -10375,32 +10411,32 @@ class Group{
10375
10411
  }
10376
10412
  });
10377
10413
  }
10378
-
10414
+
10379
10415
  this.element = false;
10380
10416
  this.arrowElement = false;
10381
10417
  this.elementContents = false;
10382
10418
  }
10383
-
10419
+
10384
10420
  createElements(){
10385
10421
  var arrow = document.createElement("div");
10386
10422
  arrow.classList.add("tabulator-arrow");
10387
-
10423
+
10388
10424
  this.element = document.createElement("div");
10389
10425
  this.element.classList.add("tabulator-row");
10390
10426
  this.element.classList.add("tabulator-group");
10391
10427
  this.element.classList.add("tabulator-group-level-" + this.level);
10392
10428
  this.element.setAttribute("role", "rowgroup");
10393
-
10429
+
10394
10430
  this.arrowElement = document.createElement("div");
10395
10431
  this.arrowElement.classList.add("tabulator-group-toggle");
10396
10432
  this.arrowElement.appendChild(arrow);
10397
-
10433
+
10398
10434
  //setup movable rows
10399
10435
  if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
10400
10436
  this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
10401
10437
  }
10402
10438
  }
10403
-
10439
+
10404
10440
  createValueGroups(){
10405
10441
  var level = this.level + 1;
10406
10442
  if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
@@ -10409,13 +10445,13 @@ class Group{
10409
10445
  });
10410
10446
  }
10411
10447
  }
10412
-
10448
+
10413
10449
  addBindings(){
10414
10450
  var toggleElement;
10415
-
10451
+
10416
10452
  if(this.groupManager.table.options.groupToggleElement){
10417
10453
  toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
10418
-
10454
+
10419
10455
  toggleElement.addEventListener("click", (e) => {
10420
10456
  e.stopPropagation();
10421
10457
  e.stopImmediatePropagation();
@@ -10423,23 +10459,23 @@ class Group{
10423
10459
  });
10424
10460
  }
10425
10461
  }
10426
-
10462
+
10427
10463
  _createGroup(groupID, level){
10428
10464
  var groupKey = level + "_" + groupID;
10429
10465
  var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false);
10430
-
10466
+
10431
10467
  this.groups[groupKey] = group;
10432
10468
  this.groupList.push(group);
10433
10469
  }
10434
-
10470
+
10435
10471
  _addRowToGroup(row){
10436
-
10472
+
10437
10473
  var level = this.level + 1;
10438
-
10474
+
10439
10475
  if(this.hasSubGroups){
10440
10476
  var groupID = this.groupManager.groupIDLookups[level].func(row.getData()),
10441
10477
  groupKey = level + "_" + groupID;
10442
-
10478
+
10443
10479
  if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
10444
10480
  if(this.groups[groupKey]){
10445
10481
  this.groups[groupKey].addRow(row);
@@ -10448,24 +10484,24 @@ class Group{
10448
10484
  if(!this.groups[groupKey]){
10449
10485
  this._createGroup(groupID, level);
10450
10486
  }
10451
-
10487
+
10452
10488
  this.groups[groupKey].addRow(row);
10453
10489
  }
10454
10490
  }
10455
10491
  }
10456
-
10492
+
10457
10493
  _addRow(row){
10458
10494
  this.rows.push(row);
10459
10495
  row.modules.group = this;
10460
10496
  }
10461
-
10497
+
10462
10498
  insertRow(row, to, after){
10463
10499
  var data = this.conformRowData({});
10464
-
10500
+
10465
10501
  row.updateData(data);
10466
-
10502
+
10467
10503
  var toIndex = this.rows.indexOf(to);
10468
-
10504
+
10469
10505
  if(toIndex > -1){
10470
10506
  if(after){
10471
10507
  this.rows.splice(toIndex+1, 0, row);
@@ -10479,28 +10515,30 @@ class Group{
10479
10515
  this.rows.unshift(row);
10480
10516
  }
10481
10517
  }
10482
-
10518
+
10483
10519
  row.modules.group = this;
10484
-
10520
+
10485
10521
  this.generateGroupHeaderContents();
10486
-
10522
+
10487
10523
  if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
10488
10524
  this.groupManager.table.modules.columnCalcs.recalcGroup(this);
10489
10525
  }
10490
-
10526
+
10491
10527
  this.groupManager.updateGroupRows(true);
10492
10528
  }
10493
-
10529
+
10494
10530
  scrollHeader(left){
10495
- this.arrowElement.style.marginLeft = left;
10496
-
10497
- this.groupList.forEach(function(child){
10498
- child.scrollHeader(left);
10499
- });
10531
+ if(this.arrowElement){
10532
+ this.arrowElement.style.marginLeft = left;
10533
+
10534
+ this.groupList.forEach(function(child){
10535
+ child.scrollHeader(left);
10536
+ });
10537
+ }
10500
10538
  }
10501
-
10539
+
10502
10540
  getRowIndex(row){}
10503
-
10541
+
10504
10542
  //update row data to match grouping contraints
10505
10543
  conformRowData(data){
10506
10544
  if(this.field){
@@ -10508,59 +10546,59 @@ class Group{
10508
10546
  }else {
10509
10547
  console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function");
10510
10548
  }
10511
-
10549
+
10512
10550
  if(this.parent){
10513
10551
  data = this.parent.conformRowData(data);
10514
10552
  }
10515
-
10553
+
10516
10554
  return data;
10517
10555
  }
10518
-
10556
+
10519
10557
  removeRow(row){
10520
10558
  var index = this.rows.indexOf(row);
10521
10559
  var el = row.getElement();
10522
-
10523
-
10560
+
10561
+
10524
10562
  if(index > -1){
10525
10563
  this.rows.splice(index, 1);
10526
10564
  }
10527
-
10565
+
10528
10566
  if(!this.groupManager.table.options.groupValues && !this.rows.length){
10529
10567
  if(this.parent){
10530
10568
  this.parent.removeGroup(this);
10531
10569
  }else {
10532
10570
  this.groupManager.removeGroup(this);
10533
10571
  }
10534
-
10572
+
10535
10573
  this.groupManager.updateGroupRows(true);
10536
10574
  }else {
10537
-
10575
+
10538
10576
  if(el.parentNode){
10539
10577
  el.parentNode.removeChild(el);
10540
10578
  }
10541
-
10579
+
10542
10580
  this.generateGroupHeaderContents();
10543
10581
 
10544
10582
  if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
10545
10583
  this.groupManager.table.modules.columnCalcs.recalcGroup(this);
10546
10584
  }
10547
-
10585
+
10548
10586
  }
10549
10587
  }
10550
-
10588
+
10551
10589
  removeGroup(group){
10552
10590
  var groupKey = group.level + "_" + group.key,
10553
10591
  index;
10554
-
10592
+
10555
10593
  if(this.groups[groupKey]){
10556
10594
  delete this.groups[groupKey];
10557
-
10595
+
10558
10596
  index = this.groupList.indexOf(group);
10559
-
10597
+
10560
10598
  if(index > -1){
10561
10599
  this.groupList.splice(index, 1);
10562
10600
  }
10563
-
10601
+
10564
10602
  if(!this.groupList.length){
10565
10603
  if(this.parent){
10566
10604
  this.parent.removeGroup(this);
@@ -10570,66 +10608,66 @@ class Group{
10570
10608
  }
10571
10609
  }
10572
10610
  }
10573
-
10611
+
10574
10612
  getHeadersAndRows(noCalc){
10575
10613
  var output = [];
10576
-
10614
+
10577
10615
  output.push(this);
10578
-
10616
+
10579
10617
  this._visSet();
10580
-
10618
+
10581
10619
  if(this.visible){
10582
10620
  if(this.groupList.length){
10583
10621
  this.groupList.forEach(function(group){
10584
10622
  output = output.concat(group.getHeadersAndRows(noCalc));
10585
10623
  });
10586
-
10624
+
10587
10625
  }else {
10588
10626
  if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
10589
10627
  if(this.calcs.top){
10590
10628
  this.calcs.top.detachElement();
10591
10629
  this.calcs.top.deleteCells();
10592
10630
  }
10593
-
10631
+
10594
10632
  this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
10595
10633
  output.push(this.calcs.top);
10596
10634
  }
10597
-
10635
+
10598
10636
  output = output.concat(this.rows);
10599
-
10637
+
10600
10638
  if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
10601
10639
  if(this.calcs.bottom){
10602
10640
  this.calcs.bottom.detachElement();
10603
10641
  this.calcs.bottom.deleteCells();
10604
10642
  }
10605
-
10643
+
10606
10644
  this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
10607
10645
  output.push(this.calcs.bottom);
10608
10646
  }
10609
10647
  }
10610
10648
  }else {
10611
10649
  if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table"){
10612
-
10650
+
10613
10651
  if(this.groupManager.table.modExists("columnCalcs")){
10614
-
10652
+
10615
10653
  if(!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
10616
10654
  if(this.calcs.top){
10617
10655
  this.calcs.top.detachElement();
10618
10656
  this.calcs.top.deleteCells();
10619
10657
  }
10620
-
10658
+
10621
10659
  if(this.groupManager.table.options.groupClosedShowCalcs){
10622
10660
  this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
10623
10661
  output.push(this.calcs.top);
10624
10662
  }
10625
10663
  }
10626
-
10664
+
10627
10665
  if(!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
10628
10666
  if(this.calcs.bottom){
10629
10667
  this.calcs.bottom.detachElement();
10630
10668
  this.calcs.bottom.deleteCells();
10631
10669
  }
10632
-
10670
+
10633
10671
  if(this.groupManager.table.options.groupClosedShowCalcs){
10634
10672
  this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
10635
10673
  output.push(this.calcs.bottom);
@@ -10637,29 +10675,29 @@ class Group{
10637
10675
  }
10638
10676
  }
10639
10677
  }
10640
-
10678
+
10641
10679
  }
10642
-
10680
+
10643
10681
  return output;
10644
10682
  }
10645
-
10683
+
10646
10684
  getData(visible, transform){
10647
10685
  var output = [];
10648
-
10686
+
10649
10687
  this._visSet();
10650
-
10688
+
10651
10689
  if(!visible || (visible && this.visible)){
10652
10690
  this.rows.forEach((row) => {
10653
10691
  output.push(row.getData(transform || "data"));
10654
10692
  });
10655
10693
  }
10656
-
10694
+
10657
10695
  return output;
10658
10696
  }
10659
-
10697
+
10660
10698
  getRowCount(){
10661
10699
  var count = 0;
10662
-
10700
+
10663
10701
  if(this.groupList.length){
10664
10702
  this.groupList.forEach((group) => {
10665
10703
  count += group.getRowCount();
@@ -10669,7 +10707,7 @@ class Group{
10669
10707
  }
10670
10708
  return count;
10671
10709
  }
10672
-
10710
+
10673
10711
  toggleVisibility(){
10674
10712
  if(this.visible){
10675
10713
  this.hide();
@@ -10677,55 +10715,55 @@ class Group{
10677
10715
  this.show();
10678
10716
  }
10679
10717
  }
10680
-
10718
+
10681
10719
  hide(){
10682
10720
  this.visible = false;
10683
-
10721
+
10684
10722
  if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
10685
-
10723
+
10686
10724
  this.element.classList.remove("tabulator-group-visible");
10687
-
10725
+
10688
10726
  if(this.groupList.length){
10689
10727
  this.groupList.forEach((group) => {
10690
-
10728
+
10691
10729
  var rows = group.getHeadersAndRows();
10692
-
10730
+
10693
10731
  rows.forEach((row) => {
10694
10732
  row.detachElement();
10695
10733
  });
10696
10734
  });
10697
-
10735
+
10698
10736
  }else {
10699
10737
  this.rows.forEach((row) => {
10700
10738
  var rowEl = row.getElement();
10701
10739
  rowEl.parentNode.removeChild(rowEl);
10702
10740
  });
10703
10741
  }
10704
-
10742
+
10705
10743
  this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
10706
-
10744
+
10707
10745
  this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
10708
-
10746
+
10709
10747
  }else {
10710
10748
  this.groupManager.updateGroupRows(true);
10711
10749
  }
10712
-
10750
+
10713
10751
  this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), false);
10714
10752
  }
10715
-
10753
+
10716
10754
  show(){
10717
10755
  this.visible = true;
10718
-
10756
+
10719
10757
  if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
10720
-
10758
+
10721
10759
  this.element.classList.add("tabulator-group-visible");
10722
-
10760
+
10723
10761
  var prev = this.generateElement();
10724
-
10762
+
10725
10763
  if(this.groupList.length){
10726
10764
  this.groupList.forEach((group) => {
10727
10765
  var rows = group.getHeadersAndRows();
10728
-
10766
+
10729
10767
  rows.forEach((row) => {
10730
10768
  var rowEl = row.getElement();
10731
10769
  prev.parentNode.insertBefore(rowEl, prev.nextSibling);
@@ -10733,7 +10771,7 @@ class Group{
10733
10771
  prev = rowEl;
10734
10772
  });
10735
10773
  });
10736
-
10774
+
10737
10775
  }else {
10738
10776
  this.rows.forEach((row) => {
10739
10777
  var rowEl = row.getElement();
@@ -10742,36 +10780,36 @@ class Group{
10742
10780
  prev = rowEl;
10743
10781
  });
10744
10782
  }
10745
-
10783
+
10746
10784
  this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
10747
-
10785
+
10748
10786
  this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
10749
10787
  }else {
10750
10788
  this.groupManager.updateGroupRows(true);
10751
10789
  }
10752
-
10790
+
10753
10791
  this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), true);
10754
10792
  }
10755
-
10793
+
10756
10794
  _visSet(){
10757
10795
  var data = [];
10758
-
10796
+
10759
10797
  if(typeof this.visible == "function"){
10760
-
10798
+
10761
10799
  this.rows.forEach(function(row){
10762
10800
  data.push(row.getData());
10763
10801
  });
10764
-
10802
+
10765
10803
  this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent());
10766
10804
  }
10767
10805
  }
10768
-
10806
+
10769
10807
  getRowGroup(row){
10770
10808
  var match = false;
10771
10809
  if(this.groupList.length){
10772
10810
  this.groupList.forEach(function(group){
10773
10811
  var result = group.getRowGroup(row);
10774
-
10812
+
10775
10813
  if(result){
10776
10814
  match = result;
10777
10815
  }
@@ -10783,50 +10821,50 @@ class Group{
10783
10821
  match = this;
10784
10822
  }
10785
10823
  }
10786
-
10824
+
10787
10825
  return match;
10788
10826
  }
10789
-
10827
+
10790
10828
  getSubGroups(component){
10791
10829
  var output = [];
10792
-
10830
+
10793
10831
  this.groupList.forEach(function(child){
10794
10832
  output.push(component ? child.getComponent() : child);
10795
10833
  });
10796
-
10834
+
10797
10835
  return output;
10798
10836
  }
10799
-
10837
+
10800
10838
  getRows(compoment){
10801
10839
  var output = [];
10802
-
10840
+
10803
10841
  this.rows.forEach(function(row){
10804
10842
  output.push(compoment ? row.getComponent() : row);
10805
10843
  });
10806
-
10844
+
10807
10845
  return output;
10808
10846
  }
10809
-
10847
+
10810
10848
  generateGroupHeaderContents(){
10811
10849
  var data = [];
10812
-
10850
+
10813
10851
  this.rows.forEach(function(row){
10814
10852
  data.push(row.getData());
10815
10853
  });
10816
-
10854
+
10817
10855
  this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent());
10818
-
10856
+
10819
10857
  while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
10820
-
10858
+
10821
10859
  if(typeof this.elementContents === "string"){
10822
10860
  this.element.innerHTML = this.elementContents;
10823
10861
  }else {
10824
10862
  this.element.appendChild(this.elementContents);
10825
10863
  }
10826
-
10864
+
10827
10865
  this.element.insertBefore(this.arrowElement, this.element.firstChild);
10828
10866
  }
10829
-
10867
+
10830
10868
  getPath(path = []) {
10831
10869
  path.unshift(this.key);
10832
10870
  if(this.parent) {
@@ -10834,94 +10872,94 @@ class Group{
10834
10872
  }
10835
10873
  return path;
10836
10874
  }
10837
-
10875
+
10838
10876
  ////////////// Standard Row Functions //////////////
10839
-
10877
+
10840
10878
  getElement(){
10841
10879
  return this.elementContents ? this.element : this.generateElement();
10842
10880
  }
10843
-
10881
+
10844
10882
  generateElement(){
10845
10883
  this.addBindings = false;
10846
-
10884
+
10847
10885
  this._visSet();
10848
-
10886
+
10849
10887
  if(this.visible){
10850
10888
  this.element.classList.add("tabulator-group-visible");
10851
10889
  }else {
10852
10890
  this.element.classList.remove("tabulator-group-visible");
10853
10891
  }
10854
-
10892
+
10855
10893
  for(var i = 0; i < this.element.childNodes.length; ++i){
10856
10894
  this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]);
10857
10895
  }
10858
-
10896
+
10859
10897
  this.generateGroupHeaderContents();
10860
-
10898
+
10861
10899
  // this.addBindings();
10862
-
10900
+
10863
10901
  return this.element;
10864
10902
  }
10865
-
10903
+
10866
10904
  detachElement(){
10867
10905
  if (this.element && this.element.parentNode){
10868
10906
  this.element.parentNode.removeChild(this.element);
10869
10907
  }
10870
10908
  }
10871
-
10909
+
10872
10910
  //normalize the height of elements in the row
10873
10911
  normalizeHeight(){
10874
10912
  this.setHeight(this.element.clientHeight);
10875
10913
  }
10876
-
10914
+
10877
10915
  initialize(force){
10878
10916
  if(!this.initialized || force){
10879
10917
  this.normalizeHeight();
10880
10918
  this.initialized = true;
10881
10919
  }
10882
10920
  }
10883
-
10921
+
10884
10922
  reinitialize(){
10885
10923
  this.initialized = false;
10886
10924
  this.height = 0;
10887
-
10925
+
10888
10926
  if(Helpers.elVisible(this.element)){
10889
10927
  this.initialize(true);
10890
10928
  }
10891
10929
  }
10892
-
10930
+
10893
10931
  setHeight(height){
10894
10932
  if(this.height != height){
10895
10933
  this.height = height;
10896
10934
  this.outerHeight = this.element.offsetHeight;
10897
10935
  }
10898
10936
  }
10899
-
10937
+
10900
10938
  //return rows outer height
10901
10939
  getHeight(){
10902
10940
  return this.outerHeight;
10903
10941
  }
10904
-
10942
+
10905
10943
  getGroup(){
10906
10944
  return this;
10907
10945
  }
10908
-
10946
+
10909
10947
  reinitializeHeight(){}
10910
-
10948
+
10911
10949
  calcHeight(){}
10912
-
10950
+
10913
10951
  setCellHeight(){}
10914
-
10952
+
10915
10953
  clearCellHeight(){}
10916
-
10954
+
10917
10955
  deinitializeHeight(){}
10918
-
10956
+
10919
10957
  //////////////// Object Generation /////////////////
10920
10958
  getComponent(){
10921
10959
  if(!this.component){
10922
10960
  this.component = new GroupComponent(this);
10923
10961
  }
10924
-
10962
+
10925
10963
  return this.component;
10926
10964
  }
10927
10965
  }
@@ -15160,12 +15198,12 @@ var defaultReaders = {
15160
15198
 
15161
15199
  //if cookie exists, decode and load column data into tabulator
15162
15200
  if(cookiePos > -1){
15163
- cookie = cookie.substr(cookiePos);
15201
+ cookie = cookie.slice(cookiePos);
15164
15202
 
15165
15203
  end = cookie.indexOf(";");
15166
15204
 
15167
15205
  if(end > -1){
15168
- cookie = cookie.substr(0, end);
15206
+ cookie = cookie.slice(0, end);
15169
15207
  }
15170
15208
 
15171
15209
  data = cookie.replace(key + "=", "");
@@ -16102,186 +16140,196 @@ class ReactiveData extends Module{
16102
16140
  ReactiveData.moduleName = "reactiveData";
16103
16141
 
16104
16142
  class ResizeColumns extends Module{
16105
-
16143
+
16106
16144
  constructor(table){
16107
16145
  super(table);
16108
-
16146
+
16109
16147
  this.startColumn = false;
16110
16148
  this.startX = false;
16111
16149
  this.startWidth = false;
16112
16150
  this.handle = null;
16113
16151
  this.prevHandle = null;
16114
-
16152
+
16115
16153
  this.registerColumnOption("resizable", true);
16116
16154
  }
16117
-
16155
+
16118
16156
  initialize(){
16119
16157
  // if(this.table.options.resizableColumns){
16120
- this.subscribe("cell-layout", this.layoutCellHandles.bind(this));
16121
- this.subscribe("column-init", this.layoutColumnHeader.bind(this));
16158
+ this.subscribe("cell-layout", this.layoutCellHandles.bind(this));
16159
+ this.subscribe("column-init", this.layoutColumnHeader.bind(this));
16122
16160
  // }
16123
16161
  }
16124
-
16162
+
16125
16163
  layoutCellHandles(cell){
16126
16164
  if(cell.row.type === "row"){
16127
16165
  this.initializeColumn("cell", cell.column, cell.element);
16128
16166
  }
16129
16167
  }
16130
-
16168
+
16131
16169
  layoutColumnHeader(column){
16132
16170
  this.initializeColumn("header", column, column.element);
16133
16171
  }
16134
-
16172
+
16135
16173
  initializeColumn(type, column, element){
16136
16174
  var self = this,
16137
16175
  variableHeight = false,
16138
16176
  mode = column.definition.resizable;
16139
-
16177
+
16140
16178
  //set column resize mode
16141
16179
  if(type === "header"){
16142
16180
  variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight;
16143
16181
  column.modules.resize = {variableHeight:variableHeight};
16144
16182
  }
16145
-
16183
+
16146
16184
  if(mode === true || mode == type){
16147
-
16185
+
16148
16186
  var handle = document.createElement('div');
16149
16187
  handle.className = "tabulator-col-resize-handle";
16150
-
16151
-
16188
+
16189
+
16152
16190
  var prevHandle = document.createElement('div');
16153
16191
  prevHandle.className = "tabulator-col-resize-handle prev";
16154
-
16192
+
16155
16193
  handle.addEventListener("click", function(e){
16156
16194
  e.stopPropagation();
16157
16195
  });
16158
-
16196
+
16159
16197
  var handleDown = function(e){
16160
16198
  var nearestColumn = column.getLastColumn();
16161
-
16199
+
16162
16200
  if(nearestColumn && self._checkResizability(nearestColumn)){
16163
16201
  self.startColumn = column;
16164
16202
  self._mouseDown(e, nearestColumn, handle);
16165
16203
  }
16166
16204
  };
16167
-
16205
+
16168
16206
  handle.addEventListener("mousedown", handleDown);
16169
16207
  handle.addEventListener("touchstart", handleDown, {passive: true});
16170
-
16208
+
16171
16209
  //reszie column on double click
16172
16210
  handle.addEventListener("dblclick", function(e){
16173
- var col = column.getLastColumn();
16174
-
16211
+ var col = column.getLastColumn(),
16212
+ oldWidth;
16213
+
16175
16214
  if(col && self._checkResizability(col)){
16215
+ oldWidth = col.getWidth();
16216
+
16176
16217
  e.stopPropagation();
16177
16218
  col.reinitializeWidth(true);
16219
+
16220
+ if(oldWidth !== col.getWidth()){
16221
+ self.dispatch("column-resized", col);
16222
+ self.table.externalEvents.dispatch("columnResized", col.getComponent());
16223
+ }
16178
16224
  }
16179
16225
  });
16180
-
16181
-
16226
+
16227
+
16182
16228
  prevHandle.addEventListener("click", function(e){
16183
16229
  e.stopPropagation();
16184
16230
  });
16185
-
16231
+
16186
16232
  var prevHandleDown = function(e){
16187
16233
  var nearestColumn, colIndex, prevColumn;
16188
-
16234
+
16189
16235
  nearestColumn = column.getFirstColumn();
16190
-
16236
+
16191
16237
  if(nearestColumn){
16192
16238
  colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
16193
16239
  prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
16194
-
16240
+
16195
16241
  if(prevColumn && self._checkResizability(prevColumn)){
16196
16242
  self.startColumn = column;
16197
16243
  self._mouseDown(e, prevColumn, prevHandle);
16198
16244
  }
16199
16245
  }
16200
16246
  };
16201
-
16247
+
16202
16248
  prevHandle.addEventListener("mousedown", prevHandleDown);
16203
16249
  prevHandle.addEventListener("touchstart", prevHandleDown, {passive: true});
16204
-
16250
+
16205
16251
  //resize column on double click
16206
16252
  prevHandle.addEventListener("dblclick", function(e){
16207
16253
  var nearestColumn, colIndex, prevColumn;
16208
-
16254
+
16209
16255
  nearestColumn = column.getFirstColumn();
16210
-
16256
+
16211
16257
  if(nearestColumn){
16212
16258
  colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
16213
16259
  prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
16214
-
16260
+
16215
16261
  if(prevColumn && self._checkResizability(prevColumn)){
16216
16262
  e.stopPropagation();
16217
16263
  prevColumn.reinitializeWidth(true);
16218
16264
  }
16219
16265
  }
16220
16266
  });
16221
-
16267
+
16222
16268
  element.appendChild(handle);
16223
16269
  element.appendChild(prevHandle);
16224
16270
  }
16225
16271
  }
16226
-
16272
+
16227
16273
  _checkResizability(column){
16228
16274
  return column.definition.resizable;
16229
16275
  }
16230
-
16276
+
16231
16277
  _mouseDown(e, column, handle){
16232
16278
  var self = this;
16233
-
16279
+
16234
16280
  self.table.element.classList.add("tabulator-block-select");
16235
16281
 
16236
16282
  function mouseMove(e){
16237
16283
  // self.table.columnManager.tempScrollBlock();
16238
-
16284
+
16239
16285
  if(self.table.rtl){
16240
16286
  column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
16241
16287
  }else {
16242
16288
  column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
16243
16289
  }
16244
-
16290
+
16245
16291
  self.table.columnManager.renderer.rerenderColumns(true);
16246
-
16292
+
16247
16293
  if(!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
16248
16294
  column.checkCellHeights();
16249
16295
  }
16250
16296
  }
16251
-
16297
+
16252
16298
  function mouseUp(e){
16253
-
16299
+
16254
16300
  //block editor from taking action while resizing is taking place
16255
16301
  if(self.startColumn.modules.edit){
16256
16302
  self.startColumn.modules.edit.blocked = false;
16257
16303
  }
16258
-
16304
+
16259
16305
  if(self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
16260
16306
  column.checkCellHeights();
16261
16307
  }
16262
-
16308
+
16263
16309
  document.body.removeEventListener("mouseup", mouseUp);
16264
16310
  document.body.removeEventListener("mousemove", mouseMove);
16265
-
16311
+
16266
16312
  handle.removeEventListener("touchmove", mouseMove);
16267
16313
  handle.removeEventListener("touchend", mouseUp);
16268
-
16314
+
16269
16315
  self.table.element.classList.remove("tabulator-block-select");
16270
16316
 
16271
- self.dispatch("column-resized", column);
16272
- self.table.externalEvents.dispatch("columnResized", column.getComponent());
16317
+ if(self.startWidth !== column.getWidth()){
16318
+ self.dispatch("column-resized", column);
16319
+ self.table.externalEvents.dispatch("columnResized", column.getComponent());
16320
+ }
16273
16321
  }
16274
-
16322
+
16275
16323
  e.stopPropagation(); //prevent resize from interfereing with movable columns
16276
-
16324
+
16277
16325
  //block editor from taking action while resizing is taking place
16278
16326
  if(self.startColumn.modules.edit){
16279
16327
  self.startColumn.modules.edit.blocked = true;
16280
16328
  }
16281
-
16329
+
16282
16330
  self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX;
16283
16331
  self.startWidth = column.getWidth();
16284
-
16332
+
16285
16333
  document.body.addEventListener("mousemove", mouseMove);
16286
16334
  document.body.addEventListener("mouseup", mouseUp);
16287
16335
  handle.addEventListener("touchmove", mouseMove, {passive: true});
@@ -16870,179 +16918,130 @@ class ResponsiveLayout extends Module{
16870
16918
  ResponsiveLayout.moduleName = "responsiveLayout";
16871
16919
 
16872
16920
  class SelectRow extends Module{
16873
-
16921
+
16874
16922
  constructor(table){
16875
16923
  super(table);
16876
-
16924
+
16877
16925
  this.selecting = false; //flag selecting in progress
16878
16926
  this.lastClickedRow = false; //last clicked row
16879
16927
  this.selectPrev = []; //hold previously selected element for drag drop selection
16880
16928
  this.selectedRows = []; //hold selected rows
16881
16929
  this.headerCheckboxElement = null; // hold header select element
16882
-
16930
+
16883
16931
  this.registerTableOption("selectable", "highlight"); //highlight rows on hover
16884
16932
  this.registerTableOption("selectableRangeMode", "drag"); //highlight rows on hover
16885
16933
  this.registerTableOption("selectableRollingSelection", true); //roll selection once maximum number of selectable rows is reached
16886
16934
  this.registerTableOption("selectablePersistence", true); // maintain selection when table view is updated
16887
16935
  this.registerTableOption("selectableCheck", function(data, row){return true;}); //check wheather row is selectable
16888
-
16936
+
16889
16937
  this.registerTableFunction("selectRow", this.selectRows.bind(this));
16890
16938
  this.registerTableFunction("deselectRow", this.deselectRows.bind(this));
16891
16939
  this.registerTableFunction("toggleSelectRow", this.toggleRow.bind(this));
16892
16940
  this.registerTableFunction("getSelectedRows", this.getSelectedRows.bind(this));
16893
16941
  this.registerTableFunction("getSelectedData", this.getSelectedData.bind(this));
16894
-
16942
+
16895
16943
  //register component functions
16896
16944
  this.registerComponentFunction("row", "select", this.selectRows.bind(this));
16897
16945
  this.registerComponentFunction("row", "deselect", this.deselectRows.bind(this));
16898
16946
  this.registerComponentFunction("row", "toggleSelect", this.toggleRow.bind(this));
16899
16947
  this.registerComponentFunction("row", "isSelected", this.isRowSelected.bind(this));
16900
16948
  }
16901
-
16949
+
16902
16950
  initialize(){
16903
16951
  if(this.table.options.selectable !== false){
16904
16952
  this.subscribe("row-init", this.initializeRow.bind(this));
16905
16953
  this.subscribe("row-deleting", this.rowDeleted.bind(this));
16906
16954
  this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
16907
16955
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
16908
-
16956
+
16909
16957
  if(this.table.options.selectable && !this.table.options.selectablePersistence){
16910
16958
  this.subscribe("data-refreshing", this.deselectRows.bind(this));
16911
16959
  }
16912
16960
  }
16913
16961
  }
16914
-
16962
+
16915
16963
  rowRetrieve(type, prevValue){
16916
16964
  return type === "selected" ? this.selectedRows : prevValue;
16917
16965
  }
16918
-
16966
+
16919
16967
  rowDeleted(row){
16920
16968
  this._deselectRow(row, true);
16921
16969
  }
16922
-
16970
+
16923
16971
  clearSelectionData(silent){
16924
16972
  this.selecting = false;
16925
16973
  this.lastClickedRow = false;
16926
16974
  this.selectPrev = [];
16927
16975
  this.selectedRows = [];
16928
-
16976
+
16929
16977
  if(silent !== true){
16930
16978
  this._rowSelectionChanged();
16931
16979
  }
16932
16980
  }
16933
-
16981
+
16934
16982
  initializeRow(row){
16935
16983
  var self = this,
16936
16984
  element = row.getElement();
16937
-
16985
+
16938
16986
  // trigger end of row selection
16939
16987
  var endSelect = function(){
16940
-
16988
+
16941
16989
  setTimeout(function(){
16942
16990
  self.selecting = false;
16943
16991
  }, 50);
16944
-
16992
+
16945
16993
  document.body.removeEventListener("mouseup", endSelect);
16946
16994
  };
16947
-
16995
+
16948
16996
  row.modules.select = {selected:false};
16949
-
16997
+
16950
16998
  //set row selection class
16951
16999
  if(self.table.options.selectableCheck.call(this.table, row.getComponent())){
16952
17000
  element.classList.add("tabulator-selectable");
16953
17001
  element.classList.remove("tabulator-unselectable");
16954
-
17002
+
16955
17003
  if(self.table.options.selectable && self.table.options.selectable != "highlight"){
16956
17004
  if(self.table.options.selectableRangeMode === "click"){
16957
- element.addEventListener("click", function(e){
16958
- if(e.shiftKey){
16959
- self.table._clearSelection();
16960
- self.lastClickedRow = self.lastClickedRow || row;
16961
-
16962
- var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow);
16963
- var rowIdx = self.table.rowManager.getDisplayRowIndex(row);
16964
-
16965
- var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
16966
- var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
16967
-
16968
- var rows = self.table.rowManager.getDisplayRows().slice(0);
16969
- var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
16970
-
16971
- if(e.ctrlKey || e.metaKey){
16972
- toggledRows.forEach(function(toggledRow){
16973
- if(toggledRow !== self.lastClickedRow){
16974
-
16975
- if(self.table.options.selectable !== true && !self.isRowSelected(row)){
16976
- if(self.selectedRows.length < self.table.options.selectable){
16977
- self.toggleRow(toggledRow);
16978
- }
16979
- }else {
16980
- self.toggleRow(toggledRow);
16981
- }
16982
- }
16983
- });
16984
- self.lastClickedRow = row;
16985
- }else {
16986
- self.deselectRows(undefined, true);
16987
-
16988
- if(self.table.options.selectable !== true){
16989
- if(toggledRows.length > self.table.options.selectable){
16990
- toggledRows = toggledRows.slice(0, self.table.options.selectable);
16991
- }
16992
- }
16993
-
16994
- self.selectRows(toggledRows);
16995
- }
16996
- self.table._clearSelection();
16997
- }
16998
- else if(e.ctrlKey || e.metaKey){
16999
- self.toggleRow(row);
17000
- self.lastClickedRow = row;
17001
- }else {
17002
- self.deselectRows(undefined, true);
17003
- self.selectRows(row);
17004
- self.lastClickedRow = row;
17005
- }
17006
- });
17005
+ element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
17007
17006
  }else {
17008
17007
  element.addEventListener("click", function(e){
17009
17008
  if(!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()){
17010
17009
  self.table._clearSelection();
17011
17010
  }
17012
-
17011
+
17013
17012
  if(!self.selecting){
17014
17013
  self.toggleRow(row);
17015
17014
  }
17016
17015
  });
17017
-
17016
+
17018
17017
  element.addEventListener("mousedown", function(e){
17019
17018
  if(e.shiftKey){
17020
17019
  self.table._clearSelection();
17021
-
17020
+
17022
17021
  self.selecting = true;
17023
-
17022
+
17024
17023
  self.selectPrev = [];
17025
-
17024
+
17026
17025
  document.body.addEventListener("mouseup", endSelect);
17027
17026
  document.body.addEventListener("keyup", endSelect);
17028
-
17027
+
17029
17028
  self.toggleRow(row);
17030
-
17029
+
17031
17030
  return false;
17032
17031
  }
17033
17032
  });
17034
-
17033
+
17035
17034
  element.addEventListener("mouseenter", function(e){
17036
17035
  if(self.selecting){
17037
17036
  self.table._clearSelection();
17038
17037
  self.toggleRow(row);
17039
-
17038
+
17040
17039
  if(self.selectPrev[1] == row){
17041
17040
  self.toggleRow(self.selectPrev[0]);
17042
17041
  }
17043
17042
  }
17044
17043
  });
17045
-
17044
+
17046
17045
  element.addEventListener("mouseout", function(e){
17047
17046
  if(self.selecting){
17048
17047
  self.table._clearSelection();
@@ -17051,13 +17050,64 @@ class SelectRow extends Module{
17051
17050
  });
17052
17051
  }
17053
17052
  }
17054
-
17053
+
17055
17054
  }else {
17056
17055
  element.classList.add("tabulator-unselectable");
17057
17056
  element.classList.remove("tabulator-selectable");
17058
17057
  }
17059
17058
  }
17060
-
17059
+
17060
+ handleComplexRowClick(row, e){
17061
+ if(e.shiftKey){
17062
+ this.table._clearSelection();
17063
+ this.lastClickedRow = this.lastClickedRow || row;
17064
+
17065
+ var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
17066
+ var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
17067
+
17068
+ var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
17069
+ var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
17070
+
17071
+ var rows = this.table.rowManager.getDisplayRows().slice(0);
17072
+ var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
17073
+
17074
+ if(e.ctrlKey || e.metaKey){
17075
+ toggledRows.forEach((toggledRow)=>{
17076
+ if(toggledRow !== this.lastClickedRow){
17077
+
17078
+ if(this.table.options.selectable !== true && !this.isRowSelected(row)){
17079
+ if(this.selectedRows.length < this.table.options.selectable){
17080
+ this.toggleRow(toggledRow);
17081
+ }
17082
+ }else {
17083
+ this.toggleRow(toggledRow);
17084
+ }
17085
+ }
17086
+ });
17087
+ this.lastClickedRow = row;
17088
+ }else {
17089
+ this.deselectRows(undefined, true);
17090
+
17091
+ if(this.table.options.selectable !== true){
17092
+ if(toggledRows.length > this.table.options.selectable){
17093
+ toggledRows = toggledRows.slice(0, this.table.options.selectable);
17094
+ }
17095
+ }
17096
+
17097
+ this.selectRows(toggledRows);
17098
+ }
17099
+ this.table._clearSelection();
17100
+ }
17101
+ else if(e.ctrlKey || e.metaKey){
17102
+ this.toggleRow(row);
17103
+ this.lastClickedRow = row;
17104
+ }else {
17105
+ this.deselectRows(undefined, true);
17106
+ this.selectRows(row);
17107
+ this.lastClickedRow = row;
17108
+ }
17109
+ }
17110
+
17061
17111
  //toggle row selection
17062
17112
  toggleRow(row){
17063
17113
  if(this.table.options.selectableCheck.call(this.table, row.getComponent())){
@@ -17068,24 +17118,24 @@ class SelectRow extends Module{
17068
17118
  }
17069
17119
  }
17070
17120
  }
17071
-
17121
+
17072
17122
  //select a number of rows
17073
17123
  selectRows(rows){
17074
17124
  var rowMatch;
17075
-
17125
+
17076
17126
  switch(typeof rows){
17077
17127
  case "undefined":
17078
17128
  this.table.rowManager.rows.forEach((row) => {
17079
17129
  this._selectRow(row, true, true);
17080
17130
  });
17081
-
17131
+
17082
17132
  this._rowSelectionChanged();
17083
17133
  break;
17084
-
17134
+
17085
17135
  case "string":
17086
-
17136
+
17087
17137
  rowMatch = this.table.rowManager.findRow(rows);
17088
-
17138
+
17089
17139
  if(rowMatch){
17090
17140
  this._selectRow(rowMatch, true, true);
17091
17141
  }else {
@@ -17093,16 +17143,16 @@ class SelectRow extends Module{
17093
17143
  this._selectRow(row, true, true);
17094
17144
  });
17095
17145
  }
17096
-
17146
+
17097
17147
  this._rowSelectionChanged();
17098
17148
  break;
17099
-
17149
+
17100
17150
  default:
17101
17151
  if(Array.isArray(rows)){
17102
17152
  rows.forEach((row) => {
17103
17153
  this._selectRow(row, true, true);
17104
17154
  });
17105
-
17155
+
17106
17156
  this._rowSelectionChanged();
17107
17157
  }else {
17108
17158
  this._selectRow(rows, false, true);
@@ -17110,10 +17160,10 @@ class SelectRow extends Module{
17110
17160
  break;
17111
17161
  }
17112
17162
  }
17113
-
17163
+
17114
17164
  //select an individual row
17115
17165
  _selectRow(rowInfo, silent, force){
17116
-
17166
+
17117
17167
  //handle max row count
17118
17168
  if(!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force){
17119
17169
  if(this.selectedRows.length >= this.table.options.selectable){
@@ -17124,29 +17174,29 @@ class SelectRow extends Module{
17124
17174
  }
17125
17175
  }
17126
17176
  }
17127
-
17177
+
17128
17178
  var row = this.table.rowManager.findRow(rowInfo);
17129
-
17179
+
17130
17180
  if(row){
17131
17181
  if(this.selectedRows.indexOf(row) == -1){
17132
17182
  row.getElement().classList.add("tabulator-selected");
17133
17183
  if(!row.modules.select){
17134
17184
  row.modules.select = {};
17135
17185
  }
17136
-
17186
+
17137
17187
  row.modules.select.selected = true;
17138
17188
  if(row.modules.select.checkboxEl){
17139
17189
  row.modules.select.checkboxEl.checked = true;
17140
17190
  }
17141
-
17191
+
17142
17192
  this.selectedRows.push(row);
17143
-
17193
+
17144
17194
  if(this.table.options.dataTreeSelectPropagate){
17145
17195
  this.childRowSelection(row, true);
17146
17196
  }
17147
-
17197
+
17148
17198
  this.dispatchExternal("rowSelected", row.getComponent());
17149
-
17199
+
17150
17200
  this._rowSelectionChanged(silent);
17151
17201
  }
17152
17202
  }else {
@@ -17155,69 +17205,69 @@ class SelectRow extends Module{
17155
17205
  }
17156
17206
  }
17157
17207
  }
17158
-
17208
+
17159
17209
  isRowSelected(row){
17160
17210
  return this.selectedRows.indexOf(row) !== -1;
17161
17211
  }
17162
-
17212
+
17163
17213
  //deselect a number of rows
17164
17214
  deselectRows(rows, silent){
17165
17215
  var self = this,
17166
17216
  rowCount;
17167
17217
 
17168
17218
  if(typeof rows == "undefined"){
17169
-
17219
+
17170
17220
  rowCount = self.selectedRows.length;
17171
-
17221
+
17172
17222
  for(let i = 0; i < rowCount; i++){
17173
17223
  self._deselectRow(self.selectedRows[0], true);
17174
17224
  }
17175
-
17225
+
17176
17226
  self._rowSelectionChanged(silent);
17177
-
17227
+
17178
17228
  }else {
17179
17229
  if(Array.isArray(rows)){
17180
17230
  rows.forEach(function(row){
17181
17231
  self._deselectRow(row, true);
17182
17232
  });
17183
-
17233
+
17184
17234
  self._rowSelectionChanged(silent);
17185
17235
  }else {
17186
17236
  self._deselectRow(rows, silent);
17187
17237
  }
17188
17238
  }
17189
17239
  }
17190
-
17240
+
17191
17241
  //deselect an individual row
17192
17242
  _deselectRow(rowInfo, silent){
17193
17243
  var self = this,
17194
17244
  row = self.table.rowManager.findRow(rowInfo),
17195
17245
  index;
17196
-
17246
+
17197
17247
  if(row){
17198
17248
  index = self.selectedRows.findIndex(function(selectedRow){
17199
17249
  return selectedRow == row;
17200
17250
  });
17201
-
17251
+
17202
17252
  if(index > -1){
17203
-
17253
+
17204
17254
  row.getElement().classList.remove("tabulator-selected");
17205
17255
  if(!row.modules.select){
17206
17256
  row.modules.select = {};
17207
17257
  }
17208
-
17258
+
17209
17259
  row.modules.select.selected = false;
17210
17260
  if(row.modules.select.checkboxEl){
17211
17261
  row.modules.select.checkboxEl.checked = false;
17212
17262
  }
17213
17263
  self.selectedRows.splice(index, 1);
17214
-
17264
+
17215
17265
  if(this.table.options.dataTreeSelectPropagate){
17216
17266
  this.childRowSelection(row, false);
17217
17267
  }
17218
-
17268
+
17219
17269
  this.dispatchExternal("rowDeselected", row.getComponent());
17220
-
17270
+
17221
17271
  self._rowSelectionChanged(silent);
17222
17272
  }
17223
17273
  }else {
@@ -17226,28 +17276,28 @@ class SelectRow extends Module{
17226
17276
  }
17227
17277
  }
17228
17278
  }
17229
-
17279
+
17230
17280
  getSelectedData(){
17231
17281
  var data = [];
17232
-
17282
+
17233
17283
  this.selectedRows.forEach(function(row){
17234
17284
  data.push(row.getData());
17235
17285
  });
17236
-
17286
+
17237
17287
  return data;
17238
17288
  }
17239
-
17289
+
17240
17290
  getSelectedRows(){
17241
-
17291
+
17242
17292
  var rows = [];
17243
-
17293
+
17244
17294
  this.selectedRows.forEach(function(row){
17245
17295
  rows.push(row.getComponent());
17246
17296
  });
17247
-
17297
+
17248
17298
  return rows;
17249
17299
  }
17250
-
17300
+
17251
17301
  _rowSelectionChanged(silent){
17252
17302
  if(this.headerCheckboxElement){
17253
17303
  if(this.selectedRows.length === 0){
@@ -17261,27 +17311,27 @@ class SelectRow extends Module{
17261
17311
  this.headerCheckboxElement.checked = false;
17262
17312
  }
17263
17313
  }
17264
-
17314
+
17265
17315
  if(!silent){
17266
17316
  this.dispatchExternal("rowSelectionChanged", this.getSelectedData(), this.getSelectedRows());
17267
17317
  }
17268
17318
  }
17269
-
17319
+
17270
17320
  registerRowSelectCheckbox (row, element) {
17271
17321
  if(!row._row.modules.select){
17272
17322
  row._row.modules.select = {};
17273
17323
  }
17274
-
17324
+
17275
17325
  row._row.modules.select.checkboxEl = element;
17276
17326
  }
17277
-
17327
+
17278
17328
  registerHeaderSelectCheckbox (element) {
17279
17329
  this.headerCheckboxElement = element;
17280
17330
  }
17281
-
17331
+
17282
17332
  childRowSelection(row, select){
17283
17333
  var children = this.table.modules.dataTree.getChildren(row, true);
17284
-
17334
+
17285
17335
  if(select){
17286
17336
  for(let child of children){
17287
17337
  this._selectRow(child, true);
@@ -21601,8 +21651,6 @@ class FooterManager extends CoreFeature{
21601
21651
  this.containerElement = this.createContainerElement(); //containing element
21602
21652
  this.external = false;
21603
21653
  this.links = [];
21604
-
21605
- this.initializeElement();
21606
21654
  }
21607
21655
 
21608
21656
  initialize(){
@@ -21634,7 +21682,7 @@ class FooterManager extends CoreFeature{
21634
21682
  switch(typeof this.table.options.footerElement){
21635
21683
  case "string":
21636
21684
  if(this.table.options.footerElement[0] === "<"){
21637
- this.element.innerHTML = this.table.options.footerElement;
21685
+ this.containerElement.innerHTML = this.table.options.footerElement;
21638
21686
  }else {
21639
21687
  this.external = true;
21640
21688
  this.element = document.querySelector(this.table.options.footerElement);
@@ -22844,6 +22892,7 @@ class Layout extends Module{
22844
22892
 
22845
22893
  //trigger table layout
22846
22894
  layout(){
22895
+ this.dispatch("layout-refreshing");
22847
22896
  Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
22848
22897
 
22849
22898
  this.dispatch("layout-refreshed");
@@ -23264,7 +23313,7 @@ class Tabulator {
23264
23313
 
23265
23314
  if(this.initializeElement(element)){
23266
23315
 
23267
- this.initialzeCoreSystems(options);
23316
+ this.initializeCoreSystems(options);
23268
23317
 
23269
23318
  //delay table creation to allow event bindings immediately after the constructor
23270
23319
  setTimeout(() => {
@@ -23294,7 +23343,7 @@ class Tabulator {
23294
23343
  }
23295
23344
  }
23296
23345
 
23297
- initialzeCoreSystems(options){
23346
+ initializeCoreSystems(options){
23298
23347
  this.columnManager = new ColumnManager(this);
23299
23348
  this.rowManager = new RowManager(this);
23300
23349
  this.footerManager = new FooterManager(this);
@@ -23523,7 +23572,7 @@ class Tabulator {
23523
23572
  this.browserSlow = false;
23524
23573
  }
23525
23574
 
23526
- this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.substr(0,4));
23575
+ this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.slice(0,4));
23527
23576
  }
23528
23577
 
23529
23578
  ////////////////// Data Handling //////////////////