tabulator-tables 5.1.2 → 5.1.5

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.5 (c) Oliver Folkerd 2022 */
2
2
  class CoreFeature{
3
3
 
4
4
  constructor(table){
@@ -2847,6 +2847,8 @@ class Row extends CoreFeature{
2847
2847
 
2848
2848
  this.generateCells();
2849
2849
 
2850
+ this.initialized = true;
2851
+
2850
2852
  this.table.columnManager.renderer.renderRowCells(this);
2851
2853
 
2852
2854
  if(force){
@@ -2855,8 +2857,6 @@ class Row extends CoreFeature{
2855
2857
 
2856
2858
  this.dispatch("row-layout", this);
2857
2859
 
2858
- this.initialized = true;
2859
-
2860
2860
  if(this.table.options.rowFormatter){
2861
2861
  this.table.options.rowFormatter(this.getComponent());
2862
2862
  }
@@ -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) => {
@@ -7901,10 +7906,10 @@ class Export extends Module{
7901
7906
  rowEl.classList.add("tabulator-print-table-row");
7902
7907
 
7903
7908
  row.columns.forEach((col) => {
7904
-
7905
7909
  if(col){
7906
7910
  var cellEl = document.createElement("td"),
7907
7911
  column = col.component._column,
7912
+ index = this.table.columnManager.findColumnIndex(column),
7908
7913
  value = col.value;
7909
7914
 
7910
7915
  var cellWrapper = {
@@ -7963,8 +7968,8 @@ class Export extends Module{
7963
7968
  cellEl.innerHTML = value;
7964
7969
  }
7965
7970
 
7966
- if(styles.firstCell){
7967
- this.mapElementStyles(styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size"]);
7971
+ if(styles.styleCells[index] || styles.firstCell){
7972
+ this.mapElementStyles(styles.styleCells[index] || styles.firstCell, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "text-align"]);
7968
7973
 
7969
7974
  if(column.definition.align){
7970
7975
  cellEl.style.textAlign = column.definition.align;
@@ -8567,7 +8572,9 @@ class Filter extends Module{
8567
8572
  editorElement.addEventListener("focus", (e) => {
8568
8573
  var left = this.table.columnManager.element.scrollLeft;
8569
8574
 
8570
- if(left !== this.table.rowManager.element.scrollLeft){
8575
+ var headerPos = this.table.rowManager.element.scrollLeft + parseInt(this.table.columnManager.element.style.marginLeft);
8576
+
8577
+ if(left !== headerPos){
8571
8578
  this.table.rowManager.scrollHorizontal(left);
8572
8579
  this.table.columnManager.scrollHorizontal(left);
8573
8580
  }
@@ -9574,9 +9581,12 @@ function responsiveCollapse(cell, formatterParams, onRendered){
9574
9581
 
9575
9582
  function rowSelection(cell, formatterParams, onRendered){
9576
9583
  var checkbox = document.createElement("input");
9584
+ var blocked = false;
9577
9585
 
9578
9586
  checkbox.type = 'checkbox';
9579
9587
 
9588
+ checkbox.setAttribute("aria-label", "Select Row");
9589
+
9580
9590
  if(this.table.modExists("selectRow", true)){
9581
9591
 
9582
9592
  checkbox.addEventListener("click", (e) => {
@@ -9589,9 +9599,24 @@ function rowSelection(cell, formatterParams, onRendered){
9589
9599
  if(row instanceof RowComponent$1){
9590
9600
 
9591
9601
  checkbox.addEventListener("change", (e) => {
9592
- row.toggleSelect();
9602
+ if(this.table.options.selectableRangeMode === "click"){
9603
+ if(!blocked){
9604
+ row.toggleSelect();
9605
+ }else {
9606
+ blocked = false;
9607
+ }
9608
+ }else {
9609
+ row.toggleSelect();
9610
+ }
9593
9611
  });
9594
9612
 
9613
+ if(this.table.options.selectableRangeMode === "click"){
9614
+ checkbox.addEventListener("click", (e) => {
9615
+ blocked = true;
9616
+ this.table.modules.selectRow.handleComplexRowClick(row._row, e);
9617
+ });
9618
+ }
9619
+
9595
9620
  checkbox.checked = row.isSelected && row.isSelected();
9596
9621
  this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
9597
9622
  }else {
@@ -9841,10 +9866,10 @@ Format.moduleName = "format";
9841
9866
  Format.formatters = defaultFormatters;
9842
9867
 
9843
9868
  class FrozenColumns extends Module{
9844
-
9869
+
9845
9870
  constructor(table){
9846
9871
  super(table);
9847
-
9872
+
9848
9873
  this.leftColumns = [];
9849
9874
  this.rightColumns = [];
9850
9875
  this.leftMargin = 0;
@@ -9853,10 +9878,11 @@ class FrozenColumns extends Module{
9853
9878
  this.initializationMode = "left";
9854
9879
  this.active = false;
9855
9880
  this.scrollEndTimer = false;
9856
-
9881
+ this.blocked = true;
9882
+
9857
9883
  this.registerColumnOption("frozen");
9858
9884
  }
9859
-
9885
+
9860
9886
  //reset initial state
9861
9887
  reset(){
9862
9888
  this.initializationMode = "left";
@@ -9866,11 +9892,11 @@ class FrozenColumns extends Module{
9866
9892
  this.rightMargin = 0;
9867
9893
  this.rightMargin = 0;
9868
9894
  this.active = false;
9869
-
9895
+
9870
9896
  this.table.columnManager.headersElement.style.marginLeft = 0;
9871
9897
  this.table.columnManager.element.style.paddingRight = 0;
9872
9898
  }
9873
-
9899
+
9874
9900
  initialize(){
9875
9901
  this.subscribe("cell-layout", this.layoutCell.bind(this));
9876
9902
  this.subscribe("column-init", this.initializeColumn.bind(this));
@@ -9880,176 +9906,194 @@ class FrozenColumns extends Module{
9880
9906
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
9881
9907
  this.subscribe("columns-loading", this.reset.bind(this));
9882
9908
  this.subscribe("table-redraw", this.layout.bind(this));
9909
+ this.subscribe("layout-refreshing", this.blockLayout.bind(this));
9910
+ this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
9883
9911
  }
9884
-
9912
+
9913
+ blockLayout(){
9914
+ this.blocked = true;
9915
+ }
9916
+
9917
+ unblockLayout(){
9918
+ this.blocked = false;
9919
+ }
9920
+
9885
9921
  layoutCell(cell){
9886
9922
  this.layoutElement(cell.element, cell.column);
9887
9923
  }
9888
-
9924
+
9889
9925
  //initialize specific column
9890
9926
  initializeColumn(column){
9891
9927
  var config = {margin:0, edge:false};
9892
-
9928
+
9893
9929
  if(!column.isGroup){
9894
-
9930
+
9895
9931
  if(this.frozenCheck(column)){
9896
-
9932
+
9897
9933
  config.position = this.initializationMode;
9898
-
9934
+
9899
9935
  if(this.initializationMode == "left"){
9900
9936
  this.leftColumns.push(column);
9901
9937
  }else {
9902
9938
  this.rightColumns.unshift(column);
9903
9939
  }
9904
-
9940
+
9905
9941
  this.active = true;
9906
-
9942
+
9907
9943
  column.modules.frozen = config;
9908
9944
  }else {
9909
9945
  this.initializationMode = "right";
9910
9946
  }
9911
9947
  }
9912
9948
  }
9913
-
9949
+
9914
9950
  frozenCheck(column){
9915
-
9951
+
9916
9952
  if(column.parent.isGroup && column.definition.frozen){
9917
9953
  console.warn("Frozen Column Error - Parent column group must be frozen, not individual columns or sub column groups");
9918
9954
  }
9919
-
9955
+
9920
9956
  if(column.parent.isGroup){
9921
9957
  return this.frozenCheck(column.parent);
9922
9958
  }else {
9923
9959
  return column.definition.frozen;
9924
9960
  }
9925
9961
  }
9926
-
9962
+
9927
9963
  //quick layout to smooth horizontal scrolling
9928
9964
  scrollHorizontal(){
9929
9965
  var rows;
9930
-
9966
+
9931
9967
  if(this.active){
9932
9968
  clearTimeout(this.scrollEndTimer);
9933
9969
 
9934
- //layout all rows after scroll is complete
9935
- this.scrollEndTimer = setTimeout(() => {
9936
- this.layout();
9937
- }, 100);
9938
-
9939
9970
  rows = this.table.rowManager.getVisibleRows();
9940
-
9941
- this.calcMargins();
9942
-
9971
+
9972
+ this.calcMargins(true);
9973
+
9943
9974
  this.layoutColumnPosition();
9944
-
9975
+
9945
9976
  this.layoutCalcRows();
9946
-
9977
+
9947
9978
  rows.forEach((row) => {
9948
9979
  if(row.type === "row"){
9949
9980
  this.layoutRow(row);
9950
9981
  }
9951
9982
  });
9952
-
9953
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
9954
9983
  }
9955
9984
  }
9956
-
9985
+
9957
9986
  //calculate margins for rows
9958
- calcMargins(){
9959
- this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
9960
- this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
9961
-
9962
- this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
9963
- this.table.columnManager.element.style.paddingRight = this.rightMargin;
9964
-
9987
+ calcMargins(scroll){
9988
+
9989
+ if(!scroll){
9990
+ this.leftMargin = this._calcSpace(this.leftColumns, this.leftColumns.length) + "px";
9991
+ this.rightMargin = this._calcSpace(this.rightColumns, this.rightColumns.length) + "px";
9992
+ this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
9993
+ }
9994
+
9965
9995
  //calculate right frozen columns
9966
9996
  this.rightPadding = this.table.rowManager.element.clientWidth + this.table.columnManager.scrollLeft;
9967
9997
  }
9968
-
9998
+
9969
9999
  //layout calculation rows
9970
10000
  layoutCalcRows(){
9971
10001
  if(this.table.modExists("columnCalcs")){
9972
10002
  if(this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow){
9973
10003
  this.layoutRow(this.table.modules.columnCalcs.topRow);
9974
10004
  }
9975
-
10005
+
9976
10006
  if(this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow){
9977
10007
  this.layoutRow(this.table.modules.columnCalcs.botRow);
9978
10008
  }
9979
-
10009
+
9980
10010
  if(this.table.modExists("groupRows")){
9981
10011
  this.layoutGroupCalcs(this.table.modules.groupRows.getGroups());
9982
10012
  }
9983
10013
  }
9984
10014
  }
9985
-
10015
+
9986
10016
  layoutGroupCalcs(groups){
9987
10017
  groups.forEach((group) => {
9988
10018
  if(group.calcs.top){
9989
10019
  this.layoutRow(group.calcs.top);
9990
10020
  }
9991
-
10021
+
9992
10022
  if(group.calcs.bottom){
9993
10023
  this.layoutRow(group.calcs.bottom);
9994
10024
  }
9995
-
10025
+
9996
10026
  if(group.groupList && group.groupList.length){
9997
10027
  this.layoutGroupCalcs(group.groupList && group.groupList);
9998
10028
  }
9999
10029
  });
10000
10030
  }
10001
-
10031
+
10002
10032
  //calculate column positions and layout headers
10003
10033
  layoutColumnPosition(allCells){
10004
-
10005
10034
  var leftParents = [];
10035
+
10036
+ var leftMargin = 0;
10037
+ var rightMargin = 0;
10038
+
10039
+ this.table.columnManager.headersElement.style.marginLeft = this.leftMargin;
10040
+ this.table.columnManager.element.style.paddingRight = this.rightMargin;
10006
10041
 
10007
- this.leftColumns.forEach((column, i) => {
10008
- column.modules.frozen.margin = (this._calcSpace(this.leftColumns, i) + this.table.columnManager.scrollLeft) + "px";
10042
+ this.leftColumns.forEach((column, i) => {
10043
+ column.modules.frozen.margin = (leftMargin + this.table.columnManager.scrollLeft) + "px";
10009
10044
 
10045
+ if(column.visible){
10046
+ leftMargin += column.getWidth();
10047
+ }
10048
+
10010
10049
  if(i == this.leftColumns.length - 1){
10011
10050
  column.modules.frozen.edge = true;
10012
10051
  }else {
10013
10052
  column.modules.frozen.edge = false;
10014
10053
  }
10015
-
10054
+
10016
10055
  if(column.parent.isGroup){
10017
10056
  var parentEl = this.getColGroupParentElement(column);
10018
10057
  if(!leftParents.includes(parentEl)){
10019
10058
  this.layoutElement(parentEl, column);
10020
10059
  leftParents.push(parentEl);
10021
10060
  }
10022
-
10061
+
10023
10062
  if(column.modules.frozen.edge){
10024
10063
  parentEl.classList.add("tabulator-frozen-" + column.modules.frozen.position);
10025
10064
  }
10026
10065
  }else {
10027
10066
  this.layoutElement(column.getElement(), column);
10028
10067
  }
10029
-
10068
+
10030
10069
  if(allCells){
10031
10070
  column.cells.forEach((cell) => {
10032
10071
  this.layoutElement(cell.getElement(true), column);
10033
10072
  });
10034
10073
  }
10035
10074
  });
10036
-
10075
+
10037
10076
  this.rightColumns.forEach((column, i) => {
10038
- column.modules.frozen.margin = (this.rightPadding - this._calcSpace(this.rightColumns, i + 1)) + "px";
10039
10077
 
10078
+ if(column.visible){
10079
+ rightMargin += column.getWidth();
10080
+ }
10081
+
10082
+ column.modules.frozen.margin = (this.rightPadding - rightMargin) + "px";
10083
+
10040
10084
  if(i == this.rightColumns.length - 1){
10041
10085
  column.modules.frozen.edge = true;
10042
10086
  }else {
10043
10087
  column.modules.frozen.edge = false;
10044
10088
  }
10045
-
10046
-
10089
+
10090
+
10047
10091
  if(column.parent.isGroup){
10048
10092
  this.layoutElement(this.getColGroupParentElement(column), column);
10049
10093
  }else {
10050
10094
  this.layoutElement(column.getElement(), column);
10051
10095
  }
10052
-
10096
+
10053
10097
  if(allCells){
10054
10098
  column.cells.forEach((cell) => {
10055
10099
  this.layoutElement(cell.getElement(true), column);
@@ -10057,79 +10101,79 @@ class FrozenColumns extends Module{
10057
10101
  }
10058
10102
  });
10059
10103
  }
10060
-
10104
+
10061
10105
  getColGroupParentElement(column){
10062
10106
  return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
10063
10107
  }
10064
-
10065
- //layout columns appropropriatly
10108
+
10109
+ //layout columns appropriately
10066
10110
  layout(){
10067
-
10068
- if(this.active){
10069
-
10111
+ if(this.active && !this.blocked){
10070
10112
  //calculate row padding
10071
10113
  this.calcMargins();
10072
-
10114
+
10073
10115
  this.table.rowManager.getDisplayRows().forEach((row) =>{
10074
10116
  if(row.type === "row"){
10075
10117
  this.layoutRow(row);
10076
10118
  }
10077
10119
  });
10078
-
10120
+
10079
10121
  this.layoutCalcRows();
10080
-
10122
+
10081
10123
  //calculate left columns
10082
10124
  this.layoutColumnPosition(true);
10083
-
10084
- this.table.rowManager.tableElement.style.marginRight = this.rightMargin;
10085
10125
  }
10086
10126
  }
10087
-
10127
+
10088
10128
  layoutRow(row){
10089
10129
  var rowEl = row.getElement();
10090
-
10130
+
10091
10131
  rowEl.style.paddingLeft = this.leftMargin;
10092
-
10132
+
10133
+ if(this.table.options.layout === "fitDataFill" && this.rightColumns.length){
10134
+ this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
10135
+ }
10136
+
10093
10137
  this.leftColumns.forEach((column) => {
10094
10138
  var cell = row.getCell(column);
10095
-
10139
+
10096
10140
  if(cell){
10097
10141
  this.layoutElement(cell.getElement(true), column);
10098
10142
  }
10099
10143
  });
10100
-
10144
+
10101
10145
  this.rightColumns.forEach((column) => {
10102
10146
  var cell = row.getCell(column);
10103
-
10147
+
10104
10148
  if(cell){
10105
10149
  this.layoutElement(cell.getElement(true), column);
10106
10150
  }
10107
10151
  });
10108
10152
  }
10109
-
10153
+
10110
10154
  layoutElement(element, column){
10111
-
10155
+
10112
10156
  if(column.modules.frozen){
10113
10157
  element.style.position = "absolute";
10114
10158
  element.style.left = column.modules.frozen.margin;
10115
-
10159
+
10116
10160
  element.classList.add("tabulator-frozen");
10117
-
10161
+
10118
10162
  if(column.modules.frozen.edge){
10119
10163
  element.classList.add("tabulator-frozen-" + column.modules.frozen.position);
10120
10164
  }
10121
10165
  }
10122
10166
  }
10123
-
10167
+
10124
10168
  _calcSpace(columns, index){
10125
10169
  var width = 0;
10126
-
10170
+
10127
10171
  for (let i = 0; i < index; i++){
10128
10172
  if(columns[i].visible){
10129
10173
  width += columns[i].getWidth();
10130
10174
  }
10131
10175
  }
10132
-
10176
+
10133
10177
  return width;
10134
10178
  }
10135
10179
  }
@@ -10328,7 +10372,7 @@ class GroupComponent {
10328
10372
 
10329
10373
  //Group functions
10330
10374
  class Group{
10331
-
10375
+
10332
10376
  constructor(groupManager, parent, level, key, field, generator, oldGroup){
10333
10377
  this.groupManager = groupManager;
10334
10378
  this.parent = parent;
@@ -10352,17 +10396,17 @@ class Group{
10352
10396
  this.initialized = false;
10353
10397
  this.modules = {};
10354
10398
  this.arrowElement = false;
10355
-
10399
+
10356
10400
  this.visible = oldGroup ? oldGroup.visible : (typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]);
10357
-
10401
+
10358
10402
  this.component = null;
10359
-
10403
+
10360
10404
  this.createElements();
10361
10405
  this.addBindings();
10362
-
10406
+
10363
10407
  this.createValueGroups();
10364
10408
  }
10365
-
10409
+
10366
10410
  wipe(){
10367
10411
  if(this.groupList.length){
10368
10412
  this.groupList.forEach(function(group){
@@ -10375,32 +10419,32 @@ class Group{
10375
10419
  }
10376
10420
  });
10377
10421
  }
10378
-
10422
+
10379
10423
  this.element = false;
10380
10424
  this.arrowElement = false;
10381
10425
  this.elementContents = false;
10382
10426
  }
10383
-
10427
+
10384
10428
  createElements(){
10385
10429
  var arrow = document.createElement("div");
10386
10430
  arrow.classList.add("tabulator-arrow");
10387
-
10431
+
10388
10432
  this.element = document.createElement("div");
10389
10433
  this.element.classList.add("tabulator-row");
10390
10434
  this.element.classList.add("tabulator-group");
10391
10435
  this.element.classList.add("tabulator-group-level-" + this.level);
10392
10436
  this.element.setAttribute("role", "rowgroup");
10393
-
10437
+
10394
10438
  this.arrowElement = document.createElement("div");
10395
10439
  this.arrowElement.classList.add("tabulator-group-toggle");
10396
10440
  this.arrowElement.appendChild(arrow);
10397
-
10441
+
10398
10442
  //setup movable rows
10399
10443
  if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
10400
10444
  this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
10401
10445
  }
10402
10446
  }
10403
-
10447
+
10404
10448
  createValueGroups(){
10405
10449
  var level = this.level + 1;
10406
10450
  if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
@@ -10409,13 +10453,13 @@ class Group{
10409
10453
  });
10410
10454
  }
10411
10455
  }
10412
-
10456
+
10413
10457
  addBindings(){
10414
10458
  var toggleElement;
10415
-
10459
+
10416
10460
  if(this.groupManager.table.options.groupToggleElement){
10417
10461
  toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
10418
-
10462
+
10419
10463
  toggleElement.addEventListener("click", (e) => {
10420
10464
  e.stopPropagation();
10421
10465
  e.stopImmediatePropagation();
@@ -10423,23 +10467,23 @@ class Group{
10423
10467
  });
10424
10468
  }
10425
10469
  }
10426
-
10470
+
10427
10471
  _createGroup(groupID, level){
10428
10472
  var groupKey = level + "_" + groupID;
10429
10473
  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
-
10474
+
10431
10475
  this.groups[groupKey] = group;
10432
10476
  this.groupList.push(group);
10433
10477
  }
10434
-
10478
+
10435
10479
  _addRowToGroup(row){
10436
-
10480
+
10437
10481
  var level = this.level + 1;
10438
-
10482
+
10439
10483
  if(this.hasSubGroups){
10440
10484
  var groupID = this.groupManager.groupIDLookups[level].func(row.getData()),
10441
10485
  groupKey = level + "_" + groupID;
10442
-
10486
+
10443
10487
  if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
10444
10488
  if(this.groups[groupKey]){
10445
10489
  this.groups[groupKey].addRow(row);
@@ -10448,24 +10492,24 @@ class Group{
10448
10492
  if(!this.groups[groupKey]){
10449
10493
  this._createGroup(groupID, level);
10450
10494
  }
10451
-
10495
+
10452
10496
  this.groups[groupKey].addRow(row);
10453
10497
  }
10454
10498
  }
10455
10499
  }
10456
-
10500
+
10457
10501
  _addRow(row){
10458
10502
  this.rows.push(row);
10459
10503
  row.modules.group = this;
10460
10504
  }
10461
-
10505
+
10462
10506
  insertRow(row, to, after){
10463
10507
  var data = this.conformRowData({});
10464
-
10508
+
10465
10509
  row.updateData(data);
10466
-
10510
+
10467
10511
  var toIndex = this.rows.indexOf(to);
10468
-
10512
+
10469
10513
  if(toIndex > -1){
10470
10514
  if(after){
10471
10515
  this.rows.splice(toIndex+1, 0, row);
@@ -10479,28 +10523,30 @@ class Group{
10479
10523
  this.rows.unshift(row);
10480
10524
  }
10481
10525
  }
10482
-
10526
+
10483
10527
  row.modules.group = this;
10484
-
10528
+
10485
10529
  this.generateGroupHeaderContents();
10486
-
10530
+
10487
10531
  if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
10488
10532
  this.groupManager.table.modules.columnCalcs.recalcGroup(this);
10489
10533
  }
10490
-
10534
+
10491
10535
  this.groupManager.updateGroupRows(true);
10492
10536
  }
10493
-
10537
+
10494
10538
  scrollHeader(left){
10495
- this.arrowElement.style.marginLeft = left;
10496
-
10497
- this.groupList.forEach(function(child){
10498
- child.scrollHeader(left);
10499
- });
10539
+ if(this.arrowElement){
10540
+ this.arrowElement.style.marginLeft = left;
10541
+
10542
+ this.groupList.forEach(function(child){
10543
+ child.scrollHeader(left);
10544
+ });
10545
+ }
10500
10546
  }
10501
-
10547
+
10502
10548
  getRowIndex(row){}
10503
-
10549
+
10504
10550
  //update row data to match grouping contraints
10505
10551
  conformRowData(data){
10506
10552
  if(this.field){
@@ -10508,59 +10554,59 @@ class Group{
10508
10554
  }else {
10509
10555
  console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function");
10510
10556
  }
10511
-
10557
+
10512
10558
  if(this.parent){
10513
10559
  data = this.parent.conformRowData(data);
10514
10560
  }
10515
-
10561
+
10516
10562
  return data;
10517
10563
  }
10518
-
10564
+
10519
10565
  removeRow(row){
10520
10566
  var index = this.rows.indexOf(row);
10521
10567
  var el = row.getElement();
10522
-
10523
-
10568
+
10569
+
10524
10570
  if(index > -1){
10525
10571
  this.rows.splice(index, 1);
10526
10572
  }
10527
-
10573
+
10528
10574
  if(!this.groupManager.table.options.groupValues && !this.rows.length){
10529
10575
  if(this.parent){
10530
10576
  this.parent.removeGroup(this);
10531
10577
  }else {
10532
10578
  this.groupManager.removeGroup(this);
10533
10579
  }
10534
-
10580
+
10535
10581
  this.groupManager.updateGroupRows(true);
10536
10582
  }else {
10537
-
10583
+
10538
10584
  if(el.parentNode){
10539
10585
  el.parentNode.removeChild(el);
10540
10586
  }
10541
-
10587
+
10542
10588
  this.generateGroupHeaderContents();
10543
10589
 
10544
10590
  if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
10545
10591
  this.groupManager.table.modules.columnCalcs.recalcGroup(this);
10546
10592
  }
10547
-
10593
+
10548
10594
  }
10549
10595
  }
10550
-
10596
+
10551
10597
  removeGroup(group){
10552
10598
  var groupKey = group.level + "_" + group.key,
10553
10599
  index;
10554
-
10600
+
10555
10601
  if(this.groups[groupKey]){
10556
10602
  delete this.groups[groupKey];
10557
-
10603
+
10558
10604
  index = this.groupList.indexOf(group);
10559
-
10605
+
10560
10606
  if(index > -1){
10561
10607
  this.groupList.splice(index, 1);
10562
10608
  }
10563
-
10609
+
10564
10610
  if(!this.groupList.length){
10565
10611
  if(this.parent){
10566
10612
  this.parent.removeGroup(this);
@@ -10570,66 +10616,66 @@ class Group{
10570
10616
  }
10571
10617
  }
10572
10618
  }
10573
-
10619
+
10574
10620
  getHeadersAndRows(noCalc){
10575
10621
  var output = [];
10576
-
10622
+
10577
10623
  output.push(this);
10578
-
10624
+
10579
10625
  this._visSet();
10580
-
10626
+
10581
10627
  if(this.visible){
10582
10628
  if(this.groupList.length){
10583
10629
  this.groupList.forEach(function(group){
10584
10630
  output = output.concat(group.getHeadersAndRows(noCalc));
10585
10631
  });
10586
-
10632
+
10587
10633
  }else {
10588
10634
  if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
10589
10635
  if(this.calcs.top){
10590
10636
  this.calcs.top.detachElement();
10591
10637
  this.calcs.top.deleteCells();
10592
10638
  }
10593
-
10639
+
10594
10640
  this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
10595
10641
  output.push(this.calcs.top);
10596
10642
  }
10597
-
10643
+
10598
10644
  output = output.concat(this.rows);
10599
-
10645
+
10600
10646
  if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
10601
10647
  if(this.calcs.bottom){
10602
10648
  this.calcs.bottom.detachElement();
10603
10649
  this.calcs.bottom.deleteCells();
10604
10650
  }
10605
-
10651
+
10606
10652
  this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
10607
10653
  output.push(this.calcs.bottom);
10608
10654
  }
10609
10655
  }
10610
10656
  }else {
10611
10657
  if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table"){
10612
-
10658
+
10613
10659
  if(this.groupManager.table.modExists("columnCalcs")){
10614
-
10660
+
10615
10661
  if(!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
10616
10662
  if(this.calcs.top){
10617
10663
  this.calcs.top.detachElement();
10618
10664
  this.calcs.top.deleteCells();
10619
10665
  }
10620
-
10666
+
10621
10667
  if(this.groupManager.table.options.groupClosedShowCalcs){
10622
10668
  this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
10623
10669
  output.push(this.calcs.top);
10624
10670
  }
10625
10671
  }
10626
-
10672
+
10627
10673
  if(!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
10628
10674
  if(this.calcs.bottom){
10629
10675
  this.calcs.bottom.detachElement();
10630
10676
  this.calcs.bottom.deleteCells();
10631
10677
  }
10632
-
10678
+
10633
10679
  if(this.groupManager.table.options.groupClosedShowCalcs){
10634
10680
  this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
10635
10681
  output.push(this.calcs.bottom);
@@ -10637,29 +10683,29 @@ class Group{
10637
10683
  }
10638
10684
  }
10639
10685
  }
10640
-
10686
+
10641
10687
  }
10642
-
10688
+
10643
10689
  return output;
10644
10690
  }
10645
-
10691
+
10646
10692
  getData(visible, transform){
10647
10693
  var output = [];
10648
-
10694
+
10649
10695
  this._visSet();
10650
-
10696
+
10651
10697
  if(!visible || (visible && this.visible)){
10652
10698
  this.rows.forEach((row) => {
10653
10699
  output.push(row.getData(transform || "data"));
10654
10700
  });
10655
10701
  }
10656
-
10702
+
10657
10703
  return output;
10658
10704
  }
10659
-
10705
+
10660
10706
  getRowCount(){
10661
10707
  var count = 0;
10662
-
10708
+
10663
10709
  if(this.groupList.length){
10664
10710
  this.groupList.forEach((group) => {
10665
10711
  count += group.getRowCount();
@@ -10669,7 +10715,7 @@ class Group{
10669
10715
  }
10670
10716
  return count;
10671
10717
  }
10672
-
10718
+
10673
10719
  toggleVisibility(){
10674
10720
  if(this.visible){
10675
10721
  this.hide();
@@ -10677,55 +10723,55 @@ class Group{
10677
10723
  this.show();
10678
10724
  }
10679
10725
  }
10680
-
10726
+
10681
10727
  hide(){
10682
10728
  this.visible = false;
10683
-
10729
+
10684
10730
  if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
10685
-
10731
+
10686
10732
  this.element.classList.remove("tabulator-group-visible");
10687
-
10733
+
10688
10734
  if(this.groupList.length){
10689
10735
  this.groupList.forEach((group) => {
10690
-
10736
+
10691
10737
  var rows = group.getHeadersAndRows();
10692
-
10738
+
10693
10739
  rows.forEach((row) => {
10694
10740
  row.detachElement();
10695
10741
  });
10696
10742
  });
10697
-
10743
+
10698
10744
  }else {
10699
10745
  this.rows.forEach((row) => {
10700
10746
  var rowEl = row.getElement();
10701
10747
  rowEl.parentNode.removeChild(rowEl);
10702
10748
  });
10703
10749
  }
10704
-
10750
+
10705
10751
  this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
10706
-
10752
+
10707
10753
  this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
10708
-
10754
+
10709
10755
  }else {
10710
10756
  this.groupManager.updateGroupRows(true);
10711
10757
  }
10712
-
10758
+
10713
10759
  this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), false);
10714
10760
  }
10715
-
10761
+
10716
10762
  show(){
10717
10763
  this.visible = true;
10718
-
10764
+
10719
10765
  if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
10720
-
10766
+
10721
10767
  this.element.classList.add("tabulator-group-visible");
10722
-
10768
+
10723
10769
  var prev = this.generateElement();
10724
-
10770
+
10725
10771
  if(this.groupList.length){
10726
10772
  this.groupList.forEach((group) => {
10727
10773
  var rows = group.getHeadersAndRows();
10728
-
10774
+
10729
10775
  rows.forEach((row) => {
10730
10776
  var rowEl = row.getElement();
10731
10777
  prev.parentNode.insertBefore(rowEl, prev.nextSibling);
@@ -10733,7 +10779,7 @@ class Group{
10733
10779
  prev = rowEl;
10734
10780
  });
10735
10781
  });
10736
-
10782
+
10737
10783
  }else {
10738
10784
  this.rows.forEach((row) => {
10739
10785
  var rowEl = row.getElement();
@@ -10742,36 +10788,36 @@ class Group{
10742
10788
  prev = rowEl;
10743
10789
  });
10744
10790
  }
10745
-
10791
+
10746
10792
  this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
10747
-
10793
+
10748
10794
  this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
10749
10795
  }else {
10750
10796
  this.groupManager.updateGroupRows(true);
10751
10797
  }
10752
-
10798
+
10753
10799
  this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), true);
10754
10800
  }
10755
-
10801
+
10756
10802
  _visSet(){
10757
10803
  var data = [];
10758
-
10804
+
10759
10805
  if(typeof this.visible == "function"){
10760
-
10806
+
10761
10807
  this.rows.forEach(function(row){
10762
10808
  data.push(row.getData());
10763
10809
  });
10764
-
10810
+
10765
10811
  this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent());
10766
10812
  }
10767
10813
  }
10768
-
10814
+
10769
10815
  getRowGroup(row){
10770
10816
  var match = false;
10771
10817
  if(this.groupList.length){
10772
10818
  this.groupList.forEach(function(group){
10773
10819
  var result = group.getRowGroup(row);
10774
-
10820
+
10775
10821
  if(result){
10776
10822
  match = result;
10777
10823
  }
@@ -10783,50 +10829,50 @@ class Group{
10783
10829
  match = this;
10784
10830
  }
10785
10831
  }
10786
-
10832
+
10787
10833
  return match;
10788
10834
  }
10789
-
10835
+
10790
10836
  getSubGroups(component){
10791
10837
  var output = [];
10792
-
10838
+
10793
10839
  this.groupList.forEach(function(child){
10794
10840
  output.push(component ? child.getComponent() : child);
10795
10841
  });
10796
-
10842
+
10797
10843
  return output;
10798
10844
  }
10799
-
10845
+
10800
10846
  getRows(compoment){
10801
10847
  var output = [];
10802
-
10848
+
10803
10849
  this.rows.forEach(function(row){
10804
10850
  output.push(compoment ? row.getComponent() : row);
10805
10851
  });
10806
-
10852
+
10807
10853
  return output;
10808
10854
  }
10809
-
10855
+
10810
10856
  generateGroupHeaderContents(){
10811
10857
  var data = [];
10812
-
10858
+
10813
10859
  this.rows.forEach(function(row){
10814
10860
  data.push(row.getData());
10815
10861
  });
10816
-
10862
+
10817
10863
  this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent());
10818
-
10864
+
10819
10865
  while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
10820
-
10866
+
10821
10867
  if(typeof this.elementContents === "string"){
10822
10868
  this.element.innerHTML = this.elementContents;
10823
10869
  }else {
10824
10870
  this.element.appendChild(this.elementContents);
10825
10871
  }
10826
-
10872
+
10827
10873
  this.element.insertBefore(this.arrowElement, this.element.firstChild);
10828
10874
  }
10829
-
10875
+
10830
10876
  getPath(path = []) {
10831
10877
  path.unshift(this.key);
10832
10878
  if(this.parent) {
@@ -10834,94 +10880,94 @@ class Group{
10834
10880
  }
10835
10881
  return path;
10836
10882
  }
10837
-
10883
+
10838
10884
  ////////////// Standard Row Functions //////////////
10839
-
10885
+
10840
10886
  getElement(){
10841
10887
  return this.elementContents ? this.element : this.generateElement();
10842
10888
  }
10843
-
10889
+
10844
10890
  generateElement(){
10845
10891
  this.addBindings = false;
10846
-
10892
+
10847
10893
  this._visSet();
10848
-
10894
+
10849
10895
  if(this.visible){
10850
10896
  this.element.classList.add("tabulator-group-visible");
10851
10897
  }else {
10852
10898
  this.element.classList.remove("tabulator-group-visible");
10853
10899
  }
10854
-
10900
+
10855
10901
  for(var i = 0; i < this.element.childNodes.length; ++i){
10856
10902
  this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]);
10857
10903
  }
10858
-
10904
+
10859
10905
  this.generateGroupHeaderContents();
10860
-
10906
+
10861
10907
  // this.addBindings();
10862
-
10908
+
10863
10909
  return this.element;
10864
10910
  }
10865
-
10911
+
10866
10912
  detachElement(){
10867
10913
  if (this.element && this.element.parentNode){
10868
10914
  this.element.parentNode.removeChild(this.element);
10869
10915
  }
10870
10916
  }
10871
-
10917
+
10872
10918
  //normalize the height of elements in the row
10873
10919
  normalizeHeight(){
10874
10920
  this.setHeight(this.element.clientHeight);
10875
10921
  }
10876
-
10922
+
10877
10923
  initialize(force){
10878
10924
  if(!this.initialized || force){
10879
10925
  this.normalizeHeight();
10880
10926
  this.initialized = true;
10881
10927
  }
10882
10928
  }
10883
-
10929
+
10884
10930
  reinitialize(){
10885
10931
  this.initialized = false;
10886
10932
  this.height = 0;
10887
-
10933
+
10888
10934
  if(Helpers.elVisible(this.element)){
10889
10935
  this.initialize(true);
10890
10936
  }
10891
10937
  }
10892
-
10938
+
10893
10939
  setHeight(height){
10894
10940
  if(this.height != height){
10895
10941
  this.height = height;
10896
10942
  this.outerHeight = this.element.offsetHeight;
10897
10943
  }
10898
10944
  }
10899
-
10945
+
10900
10946
  //return rows outer height
10901
10947
  getHeight(){
10902
10948
  return this.outerHeight;
10903
10949
  }
10904
-
10950
+
10905
10951
  getGroup(){
10906
10952
  return this;
10907
10953
  }
10908
-
10954
+
10909
10955
  reinitializeHeight(){}
10910
-
10956
+
10911
10957
  calcHeight(){}
10912
-
10958
+
10913
10959
  setCellHeight(){}
10914
-
10960
+
10915
10961
  clearCellHeight(){}
10916
-
10962
+
10917
10963
  deinitializeHeight(){}
10918
-
10964
+
10919
10965
  //////////////// Object Generation /////////////////
10920
10966
  getComponent(){
10921
10967
  if(!this.component){
10922
10968
  this.component = new GroupComponent(this);
10923
10969
  }
10924
-
10970
+
10925
10971
  return this.component;
10926
10972
  }
10927
10973
  }
@@ -14215,28 +14261,36 @@ function rows(pageSize, currentRow, currentPage, totalRows, totalPages){
14215
14261
  ofEl = document.createElement("span"),
14216
14262
  totalEl = document.createElement("span"),
14217
14263
  rowsEl = document.createElement("span");
14218
-
14264
+
14219
14265
  this.table.modules.localize.langBind("pagination|counter|showing", (value) => {
14220
14266
  showingEl.innerHTML = value;
14221
14267
  });
14222
-
14223
- valueEl.innerHTML = " " + currentRow + "-" + Math.min((currentRow + pageSize - 1), totalRows) + " ";
14224
-
14268
+
14225
14269
  this.table.modules.localize.langBind("pagination|counter|of", (value) => {
14226
14270
  ofEl.innerHTML = value;
14227
14271
  });
14228
-
14229
- totalEl.innerHTML = " " + totalRows + " ";
14230
-
14272
+
14231
14273
  this.table.modules.localize.langBind("pagination|counter|rows", (value) => {
14232
14274
  rowsEl.innerHTML = value;
14233
14275
  });
14234
-
14235
- el.appendChild(showingEl);
14236
- el.appendChild(valueEl);
14237
- el.appendChild(ofEl);
14238
- el.appendChild(totalEl);
14239
- el.appendChild(rowsEl);
14276
+
14277
+ if(totalRows){
14278
+ valueEl.innerHTML = " " + currentRow + "-" + Math.min((currentRow + pageSize - 1), totalRows) + " ";
14279
+
14280
+ totalEl.innerHTML = " " + totalRows + " ";
14281
+
14282
+ el.appendChild(showingEl);
14283
+ el.appendChild(valueEl);
14284
+ el.appendChild(ofEl);
14285
+ el.appendChild(totalEl);
14286
+ el.appendChild(rowsEl);
14287
+ }else {
14288
+ valueEl.innerHTML = " 0 ";
14289
+
14290
+ el.appendChild(showingEl);
14291
+ el.appendChild(valueEl);
14292
+ el.appendChild(rowsEl);
14293
+ }
14240
14294
 
14241
14295
  return el;
14242
14296
  }
@@ -14847,17 +14901,18 @@ class Page extends Module{
14847
14901
  this.trackChanges();
14848
14902
  }
14849
14903
 
14850
- _setPageCounter(totalRows){
14851
- var content, currentRow;
14904
+ _setPageCounter(totalRows, size, currentRow){
14905
+ var content;
14852
14906
 
14853
14907
  if(this.pageCounter){
14854
- currentRow = ((this.page - 1) * this.size) + 1;
14855
14908
 
14856
14909
  if(this.mode === "remote"){
14910
+ size = this.size;
14911
+ currentRow = ((this.page - 1) * this.size) + 1;
14857
14912
  totalRows = this.remoteRowCountEstimate;
14858
14913
  }
14859
14914
 
14860
- content = this.pageCounter.call(this, this.size, currentRow, this.page, totalRows, this.max);
14915
+ content = this.pageCounter.call(this, size, currentRow, this.page, totalRows, this.max);
14861
14916
 
14862
14917
  switch(typeof content){
14863
14918
  case "object":
@@ -14997,7 +15052,12 @@ class Page extends Module{
14997
15052
 
14998
15053
  //return appropriate rows for current page
14999
15054
  getRows(data){
15000
- var output, start, end;
15055
+ var actualRowPageSize = 0,
15056
+ output, start, end, actualStartRow;
15057
+
15058
+ var actualRows = data.filter((row) => {
15059
+ return row.type === "row";
15060
+ });
15001
15061
 
15002
15062
  if(this.mode == "local"){
15003
15063
  output = [];
@@ -15012,21 +15072,30 @@ class Page extends Module{
15012
15072
  end = start + parseInt(this.size);
15013
15073
  }
15014
15074
 
15015
-
15016
15075
  this._setPageButtons();
15017
15076
 
15018
15077
  for(let i = start; i < end; i++){
15019
- if(data[i]){
15020
- output.push(data[i]);
15078
+ let row = data[i];
15079
+
15080
+ if(row){
15081
+ output.push(row);
15082
+
15083
+ if(row.type === "row"){
15084
+ if(!actualStartRow){
15085
+ actualStartRow = row;
15086
+ }
15087
+
15088
+ actualRowPageSize++;
15089
+ }
15021
15090
  }
15022
15091
  }
15023
-
15024
- this._setPageCounter(data.length);
15092
+
15093
+ this._setPageCounter(actualRows.length, actualRowPageSize, actualStartRow ? (actualRows.indexOf(actualStartRow) + 1) : 0);
15025
15094
 
15026
15095
  return output;
15027
15096
  }else {
15028
15097
  this._setPageButtons();
15029
- this._setPageCounter(data.length);
15098
+ this._setPageCounter(actualRows.length);
15030
15099
 
15031
15100
  return data.slice(0);
15032
15101
  }
@@ -15126,8 +15195,8 @@ class Page extends Module{
15126
15195
 
15127
15196
  //handle the footer element being redrawn
15128
15197
  footerRedraw(){
15129
- var footer = this.table.footerManager.element;
15130
-
15198
+ var footer = this.table.footerManager.containerElement;
15199
+
15131
15200
  if((Math.ceil(footer.clientWidth) - footer.scrollWidth) < 0){
15132
15201
  this.pagesElement.style.display = 'none';
15133
15202
  }else {
@@ -15160,12 +15229,12 @@ var defaultReaders = {
15160
15229
 
15161
15230
  //if cookie exists, decode and load column data into tabulator
15162
15231
  if(cookiePos > -1){
15163
- cookie = cookie.substr(cookiePos);
15232
+ cookie = cookie.slice(cookiePos);
15164
15233
 
15165
15234
  end = cookie.indexOf(";");
15166
15235
 
15167
15236
  if(end > -1){
15168
- cookie = cookie.substr(0, end);
15237
+ cookie = cookie.slice(0, end);
15169
15238
  }
15170
15239
 
15171
15240
  data = cookie.replace(key + "=", "");
@@ -16102,186 +16171,196 @@ class ReactiveData extends Module{
16102
16171
  ReactiveData.moduleName = "reactiveData";
16103
16172
 
16104
16173
  class ResizeColumns extends Module{
16105
-
16174
+
16106
16175
  constructor(table){
16107
16176
  super(table);
16108
-
16177
+
16109
16178
  this.startColumn = false;
16110
16179
  this.startX = false;
16111
16180
  this.startWidth = false;
16112
16181
  this.handle = null;
16113
16182
  this.prevHandle = null;
16114
-
16183
+
16115
16184
  this.registerColumnOption("resizable", true);
16116
16185
  }
16117
-
16186
+
16118
16187
  initialize(){
16119
16188
  // if(this.table.options.resizableColumns){
16120
- this.subscribe("cell-layout", this.layoutCellHandles.bind(this));
16121
- this.subscribe("column-init", this.layoutColumnHeader.bind(this));
16189
+ this.subscribe("cell-layout", this.layoutCellHandles.bind(this));
16190
+ this.subscribe("column-init", this.layoutColumnHeader.bind(this));
16122
16191
  // }
16123
16192
  }
16124
-
16193
+
16125
16194
  layoutCellHandles(cell){
16126
16195
  if(cell.row.type === "row"){
16127
16196
  this.initializeColumn("cell", cell.column, cell.element);
16128
16197
  }
16129
16198
  }
16130
-
16199
+
16131
16200
  layoutColumnHeader(column){
16132
16201
  this.initializeColumn("header", column, column.element);
16133
16202
  }
16134
-
16203
+
16135
16204
  initializeColumn(type, column, element){
16136
16205
  var self = this,
16137
16206
  variableHeight = false,
16138
16207
  mode = column.definition.resizable;
16139
-
16208
+
16140
16209
  //set column resize mode
16141
16210
  if(type === "header"){
16142
16211
  variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight;
16143
16212
  column.modules.resize = {variableHeight:variableHeight};
16144
16213
  }
16145
-
16214
+
16146
16215
  if(mode === true || mode == type){
16147
-
16216
+
16148
16217
  var handle = document.createElement('div');
16149
16218
  handle.className = "tabulator-col-resize-handle";
16150
-
16151
-
16219
+
16220
+
16152
16221
  var prevHandle = document.createElement('div');
16153
16222
  prevHandle.className = "tabulator-col-resize-handle prev";
16154
-
16223
+
16155
16224
  handle.addEventListener("click", function(e){
16156
16225
  e.stopPropagation();
16157
16226
  });
16158
-
16227
+
16159
16228
  var handleDown = function(e){
16160
16229
  var nearestColumn = column.getLastColumn();
16161
-
16230
+
16162
16231
  if(nearestColumn && self._checkResizability(nearestColumn)){
16163
16232
  self.startColumn = column;
16164
16233
  self._mouseDown(e, nearestColumn, handle);
16165
16234
  }
16166
16235
  };
16167
-
16236
+
16168
16237
  handle.addEventListener("mousedown", handleDown);
16169
16238
  handle.addEventListener("touchstart", handleDown, {passive: true});
16170
-
16239
+
16171
16240
  //reszie column on double click
16172
16241
  handle.addEventListener("dblclick", function(e){
16173
- var col = column.getLastColumn();
16174
-
16242
+ var col = column.getLastColumn(),
16243
+ oldWidth;
16244
+
16175
16245
  if(col && self._checkResizability(col)){
16246
+ oldWidth = col.getWidth();
16247
+
16176
16248
  e.stopPropagation();
16177
16249
  col.reinitializeWidth(true);
16250
+
16251
+ if(oldWidth !== col.getWidth()){
16252
+ self.dispatch("column-resized", col);
16253
+ self.table.externalEvents.dispatch("columnResized", col.getComponent());
16254
+ }
16178
16255
  }
16179
16256
  });
16180
-
16181
-
16257
+
16258
+
16182
16259
  prevHandle.addEventListener("click", function(e){
16183
16260
  e.stopPropagation();
16184
16261
  });
16185
-
16262
+
16186
16263
  var prevHandleDown = function(e){
16187
16264
  var nearestColumn, colIndex, prevColumn;
16188
-
16265
+
16189
16266
  nearestColumn = column.getFirstColumn();
16190
-
16267
+
16191
16268
  if(nearestColumn){
16192
16269
  colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
16193
16270
  prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
16194
-
16271
+
16195
16272
  if(prevColumn && self._checkResizability(prevColumn)){
16196
16273
  self.startColumn = column;
16197
16274
  self._mouseDown(e, prevColumn, prevHandle);
16198
16275
  }
16199
16276
  }
16200
16277
  };
16201
-
16278
+
16202
16279
  prevHandle.addEventListener("mousedown", prevHandleDown);
16203
16280
  prevHandle.addEventListener("touchstart", prevHandleDown, {passive: true});
16204
-
16281
+
16205
16282
  //resize column on double click
16206
16283
  prevHandle.addEventListener("dblclick", function(e){
16207
16284
  var nearestColumn, colIndex, prevColumn;
16208
-
16285
+
16209
16286
  nearestColumn = column.getFirstColumn();
16210
-
16287
+
16211
16288
  if(nearestColumn){
16212
16289
  colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
16213
16290
  prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
16214
-
16291
+
16215
16292
  if(prevColumn && self._checkResizability(prevColumn)){
16216
16293
  e.stopPropagation();
16217
16294
  prevColumn.reinitializeWidth(true);
16218
16295
  }
16219
16296
  }
16220
16297
  });
16221
-
16298
+
16222
16299
  element.appendChild(handle);
16223
16300
  element.appendChild(prevHandle);
16224
16301
  }
16225
16302
  }
16226
-
16303
+
16227
16304
  _checkResizability(column){
16228
16305
  return column.definition.resizable;
16229
16306
  }
16230
-
16307
+
16231
16308
  _mouseDown(e, column, handle){
16232
16309
  var self = this;
16233
-
16310
+
16234
16311
  self.table.element.classList.add("tabulator-block-select");
16235
16312
 
16236
16313
  function mouseMove(e){
16237
16314
  // self.table.columnManager.tempScrollBlock();
16238
-
16315
+
16239
16316
  if(self.table.rtl){
16240
16317
  column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
16241
16318
  }else {
16242
16319
  column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
16243
16320
  }
16244
-
16321
+
16245
16322
  self.table.columnManager.renderer.rerenderColumns(true);
16246
-
16323
+
16247
16324
  if(!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
16248
16325
  column.checkCellHeights();
16249
16326
  }
16250
16327
  }
16251
-
16328
+
16252
16329
  function mouseUp(e){
16253
-
16330
+
16254
16331
  //block editor from taking action while resizing is taking place
16255
16332
  if(self.startColumn.modules.edit){
16256
16333
  self.startColumn.modules.edit.blocked = false;
16257
16334
  }
16258
-
16335
+
16259
16336
  if(self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
16260
16337
  column.checkCellHeights();
16261
16338
  }
16262
-
16339
+
16263
16340
  document.body.removeEventListener("mouseup", mouseUp);
16264
16341
  document.body.removeEventListener("mousemove", mouseMove);
16265
-
16342
+
16266
16343
  handle.removeEventListener("touchmove", mouseMove);
16267
16344
  handle.removeEventListener("touchend", mouseUp);
16268
-
16345
+
16269
16346
  self.table.element.classList.remove("tabulator-block-select");
16270
16347
 
16271
- self.dispatch("column-resized", column);
16272
- self.table.externalEvents.dispatch("columnResized", column.getComponent());
16348
+ if(self.startWidth !== column.getWidth()){
16349
+ self.dispatch("column-resized", column);
16350
+ self.table.externalEvents.dispatch("columnResized", column.getComponent());
16351
+ }
16273
16352
  }
16274
-
16353
+
16275
16354
  e.stopPropagation(); //prevent resize from interfereing with movable columns
16276
-
16355
+
16277
16356
  //block editor from taking action while resizing is taking place
16278
16357
  if(self.startColumn.modules.edit){
16279
16358
  self.startColumn.modules.edit.blocked = true;
16280
16359
  }
16281
-
16360
+
16282
16361
  self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX;
16283
16362
  self.startWidth = column.getWidth();
16284
-
16363
+
16285
16364
  document.body.addEventListener("mousemove", mouseMove);
16286
16365
  document.body.addEventListener("mouseup", mouseUp);
16287
16366
  handle.addEventListener("touchmove", mouseMove, {passive: true});
@@ -16870,179 +16949,130 @@ class ResponsiveLayout extends Module{
16870
16949
  ResponsiveLayout.moduleName = "responsiveLayout";
16871
16950
 
16872
16951
  class SelectRow extends Module{
16873
-
16952
+
16874
16953
  constructor(table){
16875
16954
  super(table);
16876
-
16955
+
16877
16956
  this.selecting = false; //flag selecting in progress
16878
16957
  this.lastClickedRow = false; //last clicked row
16879
16958
  this.selectPrev = []; //hold previously selected element for drag drop selection
16880
16959
  this.selectedRows = []; //hold selected rows
16881
16960
  this.headerCheckboxElement = null; // hold header select element
16882
-
16961
+
16883
16962
  this.registerTableOption("selectable", "highlight"); //highlight rows on hover
16884
16963
  this.registerTableOption("selectableRangeMode", "drag"); //highlight rows on hover
16885
16964
  this.registerTableOption("selectableRollingSelection", true); //roll selection once maximum number of selectable rows is reached
16886
16965
  this.registerTableOption("selectablePersistence", true); // maintain selection when table view is updated
16887
16966
  this.registerTableOption("selectableCheck", function(data, row){return true;}); //check wheather row is selectable
16888
-
16967
+
16889
16968
  this.registerTableFunction("selectRow", this.selectRows.bind(this));
16890
16969
  this.registerTableFunction("deselectRow", this.deselectRows.bind(this));
16891
16970
  this.registerTableFunction("toggleSelectRow", this.toggleRow.bind(this));
16892
16971
  this.registerTableFunction("getSelectedRows", this.getSelectedRows.bind(this));
16893
16972
  this.registerTableFunction("getSelectedData", this.getSelectedData.bind(this));
16894
-
16973
+
16895
16974
  //register component functions
16896
16975
  this.registerComponentFunction("row", "select", this.selectRows.bind(this));
16897
16976
  this.registerComponentFunction("row", "deselect", this.deselectRows.bind(this));
16898
16977
  this.registerComponentFunction("row", "toggleSelect", this.toggleRow.bind(this));
16899
16978
  this.registerComponentFunction("row", "isSelected", this.isRowSelected.bind(this));
16900
16979
  }
16901
-
16980
+
16902
16981
  initialize(){
16903
16982
  if(this.table.options.selectable !== false){
16904
16983
  this.subscribe("row-init", this.initializeRow.bind(this));
16905
16984
  this.subscribe("row-deleting", this.rowDeleted.bind(this));
16906
16985
  this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
16907
16986
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
16908
-
16987
+
16909
16988
  if(this.table.options.selectable && !this.table.options.selectablePersistence){
16910
16989
  this.subscribe("data-refreshing", this.deselectRows.bind(this));
16911
16990
  }
16912
16991
  }
16913
16992
  }
16914
-
16993
+
16915
16994
  rowRetrieve(type, prevValue){
16916
16995
  return type === "selected" ? this.selectedRows : prevValue;
16917
16996
  }
16918
-
16997
+
16919
16998
  rowDeleted(row){
16920
16999
  this._deselectRow(row, true);
16921
17000
  }
16922
-
17001
+
16923
17002
  clearSelectionData(silent){
16924
17003
  this.selecting = false;
16925
17004
  this.lastClickedRow = false;
16926
17005
  this.selectPrev = [];
16927
17006
  this.selectedRows = [];
16928
-
17007
+
16929
17008
  if(silent !== true){
16930
17009
  this._rowSelectionChanged();
16931
17010
  }
16932
17011
  }
16933
-
17012
+
16934
17013
  initializeRow(row){
16935
17014
  var self = this,
16936
17015
  element = row.getElement();
16937
-
17016
+
16938
17017
  // trigger end of row selection
16939
17018
  var endSelect = function(){
16940
-
17019
+
16941
17020
  setTimeout(function(){
16942
17021
  self.selecting = false;
16943
17022
  }, 50);
16944
-
17023
+
16945
17024
  document.body.removeEventListener("mouseup", endSelect);
16946
17025
  };
16947
-
17026
+
16948
17027
  row.modules.select = {selected:false};
16949
-
17028
+
16950
17029
  //set row selection class
16951
17030
  if(self.table.options.selectableCheck.call(this.table, row.getComponent())){
16952
17031
  element.classList.add("tabulator-selectable");
16953
17032
  element.classList.remove("tabulator-unselectable");
16954
-
17033
+
16955
17034
  if(self.table.options.selectable && self.table.options.selectable != "highlight"){
16956
17035
  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
- });
17036
+ element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
17007
17037
  }else {
17008
17038
  element.addEventListener("click", function(e){
17009
17039
  if(!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()){
17010
17040
  self.table._clearSelection();
17011
17041
  }
17012
-
17042
+
17013
17043
  if(!self.selecting){
17014
17044
  self.toggleRow(row);
17015
17045
  }
17016
17046
  });
17017
-
17047
+
17018
17048
  element.addEventListener("mousedown", function(e){
17019
17049
  if(e.shiftKey){
17020
17050
  self.table._clearSelection();
17021
-
17051
+
17022
17052
  self.selecting = true;
17023
-
17053
+
17024
17054
  self.selectPrev = [];
17025
-
17055
+
17026
17056
  document.body.addEventListener("mouseup", endSelect);
17027
17057
  document.body.addEventListener("keyup", endSelect);
17028
-
17058
+
17029
17059
  self.toggleRow(row);
17030
-
17060
+
17031
17061
  return false;
17032
17062
  }
17033
17063
  });
17034
-
17064
+
17035
17065
  element.addEventListener("mouseenter", function(e){
17036
17066
  if(self.selecting){
17037
17067
  self.table._clearSelection();
17038
17068
  self.toggleRow(row);
17039
-
17069
+
17040
17070
  if(self.selectPrev[1] == row){
17041
17071
  self.toggleRow(self.selectPrev[0]);
17042
17072
  }
17043
17073
  }
17044
17074
  });
17045
-
17075
+
17046
17076
  element.addEventListener("mouseout", function(e){
17047
17077
  if(self.selecting){
17048
17078
  self.table._clearSelection();
@@ -17051,13 +17081,64 @@ class SelectRow extends Module{
17051
17081
  });
17052
17082
  }
17053
17083
  }
17054
-
17084
+
17055
17085
  }else {
17056
17086
  element.classList.add("tabulator-unselectable");
17057
17087
  element.classList.remove("tabulator-selectable");
17058
17088
  }
17059
17089
  }
17060
-
17090
+
17091
+ handleComplexRowClick(row, e){
17092
+ if(e.shiftKey){
17093
+ this.table._clearSelection();
17094
+ this.lastClickedRow = this.lastClickedRow || row;
17095
+
17096
+ var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
17097
+ var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
17098
+
17099
+ var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
17100
+ var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
17101
+
17102
+ var rows = this.table.rowManager.getDisplayRows().slice(0);
17103
+ var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
17104
+
17105
+ if(e.ctrlKey || e.metaKey){
17106
+ toggledRows.forEach((toggledRow)=>{
17107
+ if(toggledRow !== this.lastClickedRow){
17108
+
17109
+ if(this.table.options.selectable !== true && !this.isRowSelected(row)){
17110
+ if(this.selectedRows.length < this.table.options.selectable){
17111
+ this.toggleRow(toggledRow);
17112
+ }
17113
+ }else {
17114
+ this.toggleRow(toggledRow);
17115
+ }
17116
+ }
17117
+ });
17118
+ this.lastClickedRow = row;
17119
+ }else {
17120
+ this.deselectRows(undefined, true);
17121
+
17122
+ if(this.table.options.selectable !== true){
17123
+ if(toggledRows.length > this.table.options.selectable){
17124
+ toggledRows = toggledRows.slice(0, this.table.options.selectable);
17125
+ }
17126
+ }
17127
+
17128
+ this.selectRows(toggledRows);
17129
+ }
17130
+ this.table._clearSelection();
17131
+ }
17132
+ else if(e.ctrlKey || e.metaKey){
17133
+ this.toggleRow(row);
17134
+ this.lastClickedRow = row;
17135
+ }else {
17136
+ this.deselectRows(undefined, true);
17137
+ this.selectRows(row);
17138
+ this.lastClickedRow = row;
17139
+ }
17140
+ }
17141
+
17061
17142
  //toggle row selection
17062
17143
  toggleRow(row){
17063
17144
  if(this.table.options.selectableCheck.call(this.table, row.getComponent())){
@@ -17068,24 +17149,24 @@ class SelectRow extends Module{
17068
17149
  }
17069
17150
  }
17070
17151
  }
17071
-
17152
+
17072
17153
  //select a number of rows
17073
17154
  selectRows(rows){
17074
17155
  var rowMatch;
17075
-
17156
+
17076
17157
  switch(typeof rows){
17077
17158
  case "undefined":
17078
17159
  this.table.rowManager.rows.forEach((row) => {
17079
17160
  this._selectRow(row, true, true);
17080
17161
  });
17081
-
17162
+
17082
17163
  this._rowSelectionChanged();
17083
17164
  break;
17084
-
17165
+
17085
17166
  case "string":
17086
-
17167
+
17087
17168
  rowMatch = this.table.rowManager.findRow(rows);
17088
-
17169
+
17089
17170
  if(rowMatch){
17090
17171
  this._selectRow(rowMatch, true, true);
17091
17172
  }else {
@@ -17093,16 +17174,16 @@ class SelectRow extends Module{
17093
17174
  this._selectRow(row, true, true);
17094
17175
  });
17095
17176
  }
17096
-
17177
+
17097
17178
  this._rowSelectionChanged();
17098
17179
  break;
17099
-
17180
+
17100
17181
  default:
17101
17182
  if(Array.isArray(rows)){
17102
17183
  rows.forEach((row) => {
17103
17184
  this._selectRow(row, true, true);
17104
17185
  });
17105
-
17186
+
17106
17187
  this._rowSelectionChanged();
17107
17188
  }else {
17108
17189
  this._selectRow(rows, false, true);
@@ -17110,10 +17191,10 @@ class SelectRow extends Module{
17110
17191
  break;
17111
17192
  }
17112
17193
  }
17113
-
17194
+
17114
17195
  //select an individual row
17115
17196
  _selectRow(rowInfo, silent, force){
17116
-
17197
+
17117
17198
  //handle max row count
17118
17199
  if(!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force){
17119
17200
  if(this.selectedRows.length >= this.table.options.selectable){
@@ -17124,29 +17205,29 @@ class SelectRow extends Module{
17124
17205
  }
17125
17206
  }
17126
17207
  }
17127
-
17208
+
17128
17209
  var row = this.table.rowManager.findRow(rowInfo);
17129
-
17210
+
17130
17211
  if(row){
17131
17212
  if(this.selectedRows.indexOf(row) == -1){
17132
17213
  row.getElement().classList.add("tabulator-selected");
17133
17214
  if(!row.modules.select){
17134
17215
  row.modules.select = {};
17135
17216
  }
17136
-
17217
+
17137
17218
  row.modules.select.selected = true;
17138
17219
  if(row.modules.select.checkboxEl){
17139
17220
  row.modules.select.checkboxEl.checked = true;
17140
17221
  }
17141
-
17222
+
17142
17223
  this.selectedRows.push(row);
17143
-
17224
+
17144
17225
  if(this.table.options.dataTreeSelectPropagate){
17145
17226
  this.childRowSelection(row, true);
17146
17227
  }
17147
-
17228
+
17148
17229
  this.dispatchExternal("rowSelected", row.getComponent());
17149
-
17230
+
17150
17231
  this._rowSelectionChanged(silent);
17151
17232
  }
17152
17233
  }else {
@@ -17155,69 +17236,71 @@ class SelectRow extends Module{
17155
17236
  }
17156
17237
  }
17157
17238
  }
17158
-
17239
+
17159
17240
  isRowSelected(row){
17160
17241
  return this.selectedRows.indexOf(row) !== -1;
17161
17242
  }
17162
-
17243
+
17163
17244
  //deselect a number of rows
17164
17245
  deselectRows(rows, silent){
17165
17246
  var self = this,
17166
17247
  rowCount;
17167
17248
 
17168
17249
  if(typeof rows == "undefined"){
17169
-
17250
+
17170
17251
  rowCount = self.selectedRows.length;
17171
-
17252
+
17172
17253
  for(let i = 0; i < rowCount; i++){
17173
17254
  self._deselectRow(self.selectedRows[0], true);
17174
17255
  }
17175
-
17176
- self._rowSelectionChanged(silent);
17177
-
17256
+
17257
+ if(rowCount){
17258
+ self._rowSelectionChanged(silent);
17259
+ }
17260
+
17178
17261
  }else {
17179
17262
  if(Array.isArray(rows)){
17180
17263
  rows.forEach(function(row){
17181
17264
  self._deselectRow(row, true);
17182
17265
  });
17183
-
17266
+
17184
17267
  self._rowSelectionChanged(silent);
17185
17268
  }else {
17186
17269
  self._deselectRow(rows, silent);
17187
17270
  }
17188
17271
  }
17189
17272
  }
17190
-
17273
+
17191
17274
  //deselect an individual row
17192
17275
  _deselectRow(rowInfo, silent){
17193
17276
  var self = this,
17194
17277
  row = self.table.rowManager.findRow(rowInfo),
17195
17278
  index;
17196
-
17279
+
17197
17280
  if(row){
17198
17281
  index = self.selectedRows.findIndex(function(selectedRow){
17199
17282
  return selectedRow == row;
17200
17283
  });
17201
-
17284
+
17202
17285
  if(index > -1){
17203
-
17286
+
17204
17287
  row.getElement().classList.remove("tabulator-selected");
17205
17288
  if(!row.modules.select){
17206
17289
  row.modules.select = {};
17207
17290
  }
17208
-
17291
+
17209
17292
  row.modules.select.selected = false;
17210
17293
  if(row.modules.select.checkboxEl){
17211
17294
  row.modules.select.checkboxEl.checked = false;
17212
17295
  }
17213
17296
  self.selectedRows.splice(index, 1);
17214
-
17297
+
17215
17298
  if(this.table.options.dataTreeSelectPropagate){
17216
17299
  this.childRowSelection(row, false);
17217
17300
  }
17218
-
17301
+
17219
17302
  this.dispatchExternal("rowDeselected", row.getComponent());
17220
-
17303
+
17221
17304
  self._rowSelectionChanged(silent);
17222
17305
  }
17223
17306
  }else {
@@ -17226,28 +17309,28 @@ class SelectRow extends Module{
17226
17309
  }
17227
17310
  }
17228
17311
  }
17229
-
17312
+
17230
17313
  getSelectedData(){
17231
17314
  var data = [];
17232
-
17315
+
17233
17316
  this.selectedRows.forEach(function(row){
17234
17317
  data.push(row.getData());
17235
17318
  });
17236
-
17319
+
17237
17320
  return data;
17238
17321
  }
17239
-
17322
+
17240
17323
  getSelectedRows(){
17241
-
17324
+
17242
17325
  var rows = [];
17243
-
17326
+
17244
17327
  this.selectedRows.forEach(function(row){
17245
17328
  rows.push(row.getComponent());
17246
17329
  });
17247
-
17330
+
17248
17331
  return rows;
17249
17332
  }
17250
-
17333
+
17251
17334
  _rowSelectionChanged(silent){
17252
17335
  if(this.headerCheckboxElement){
17253
17336
  if(this.selectedRows.length === 0){
@@ -17261,27 +17344,27 @@ class SelectRow extends Module{
17261
17344
  this.headerCheckboxElement.checked = false;
17262
17345
  }
17263
17346
  }
17264
-
17347
+
17265
17348
  if(!silent){
17266
17349
  this.dispatchExternal("rowSelectionChanged", this.getSelectedData(), this.getSelectedRows());
17267
17350
  }
17268
17351
  }
17269
-
17352
+
17270
17353
  registerRowSelectCheckbox (row, element) {
17271
17354
  if(!row._row.modules.select){
17272
17355
  row._row.modules.select = {};
17273
17356
  }
17274
-
17357
+
17275
17358
  row._row.modules.select.checkboxEl = element;
17276
17359
  }
17277
-
17360
+
17278
17361
  registerHeaderSelectCheckbox (element) {
17279
17362
  this.headerCheckboxElement = element;
17280
17363
  }
17281
-
17364
+
17282
17365
  childRowSelection(row, select){
17283
17366
  var children = this.table.modules.dataTree.getChildren(row, true);
17284
-
17367
+
17285
17368
  if(select){
17286
17369
  for(let child of children){
17287
17370
  this._selectRow(child, true);
@@ -18746,15 +18829,18 @@ class VirtualDomHorizontal extends Renderer{
18746
18829
 
18747
18830
  this.fitDataColAvg = 0;
18748
18831
 
18749
- this.window = 200; //pixel margin to make column visible before it is shown on screen
18832
+ this.windowBuffer = 200; //pixel margin to make column visible before it is shown on screen
18833
+
18750
18834
 
18751
18835
  this.initialized = false;
18836
+ this.isFitData = false;
18752
18837
 
18753
18838
  this.columns = [];
18754
18839
  }
18755
18840
 
18756
18841
  initialize(){
18757
18842
  this.compatibilityCheck();
18843
+ this.layoutCheck();
18758
18844
  }
18759
18845
 
18760
18846
  compatibilityCheck(){
@@ -18794,6 +18880,10 @@ class VirtualDomHorizontal extends Renderer{
18794
18880
 
18795
18881
  return ok;
18796
18882
  }
18883
+
18884
+ layoutCheck(){
18885
+ this.isFitData = this.options("layout").startsWith('fitData');
18886
+ }
18797
18887
 
18798
18888
  //////////////////////////////////////
18799
18889
  ///////// Public Functions ///////////
@@ -18807,42 +18897,60 @@ class VirtualDomHorizontal extends Renderer{
18807
18897
  if(this.scrollLeft != left){
18808
18898
  this.scrollLeft = left;
18809
18899
 
18810
- this.scroll(left - (this.vDomScrollPosLeft + this.window));
18900
+ this.scroll(left - (this.vDomScrollPosLeft + this.windowBuffer));
18811
18901
  }
18812
18902
  }
18903
+
18904
+ calcWindowBuffer(){
18905
+ var buffer = this.elementVertical.clientWidth;
18906
+
18907
+ this.table.columnManager.columnsByIndex.forEach((column) => {
18908
+ if(column.visible){
18909
+ var width = column.getWidth();
18910
+
18911
+ if(width > buffer){
18912
+ buffer = width;
18913
+ }
18914
+ }
18915
+ });
18916
+
18917
+ this.windowBuffer = buffer * 2;
18918
+ }
18813
18919
 
18814
18920
  rerenderColumns(update, blockRedraw){
18815
18921
  var old = {
18816
18922
  cols:this.columns,
18817
18923
  leftCol:this.leftCol,
18818
18924
  rightCol:this.rightCol,
18819
- };
18925
+ },
18926
+ colPos = 0;
18927
+
18820
18928
 
18821
18929
  if(update && !this.initialized){
18822
18930
  return;
18823
18931
  }
18824
18932
 
18825
18933
  this.clear();
18934
+
18935
+ this.calcWindowBuffer();
18826
18936
 
18827
18937
  this.scrollLeft = this.elementVertical.scrollLeft;
18828
18938
 
18829
- this.vDomScrollPosLeft = this.scrollLeft - this.window;
18830
- this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.window;
18831
-
18832
- var colPos = 0;
18833
-
18939
+ this.vDomScrollPosLeft = this.scrollLeft - this.windowBuffer;
18940
+ this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
18941
+
18834
18942
  this.table.columnManager.columnsByIndex.forEach((column) => {
18835
18943
  var config = {};
18836
18944
 
18837
18945
  if(column.visible){
18838
18946
  var width = column.getWidth();
18839
-
18947
+
18840
18948
  config.leftPos = colPos;
18841
18949
  config.rightPos = colPos + width;
18842
18950
 
18843
18951
  config.width = width;
18844
18952
 
18845
- if (this.options("layout") === "fitData") {
18953
+ if (this.isFitData) {
18846
18954
  config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
18847
18955
  }
18848
18956
 
@@ -18931,7 +19039,7 @@ class VirtualDomHorizontal extends Renderer{
18931
19039
  colEnd = 0,
18932
19040
  row, rowEl;
18933
19041
 
18934
- if(this.options("layout") === "fitData"){
19042
+ if(this.isFitData){
18935
19043
  this.table.columnManager.columnsByIndex.forEach((column) => {
18936
19044
  if(!column.definition.width && column.visible){
18937
19045
  change = true;
@@ -18941,10 +19049,10 @@ class VirtualDomHorizontal extends Renderer{
18941
19049
  if(change){
18942
19050
  if(change && this.table.rowManager.getDisplayRows().length){
18943
19051
 
18944
- this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.window;
19052
+ this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
18945
19053
 
18946
19054
  var row = this.chain("rows-sample", [1], [], () => {
18947
- return this.table.rowManager.getDisplayRows()[0];
19055
+ return this.table.rowManager.getDisplayRows();
18948
19056
  })[0];
18949
19057
 
18950
19058
  if(row){
@@ -21601,8 +21709,6 @@ class FooterManager extends CoreFeature{
21601
21709
  this.containerElement = this.createContainerElement(); //containing element
21602
21710
  this.external = false;
21603
21711
  this.links = [];
21604
-
21605
- this.initializeElement();
21606
21712
  }
21607
21713
 
21608
21714
  initialize(){
@@ -21634,10 +21740,10 @@ class FooterManager extends CoreFeature{
21634
21740
  switch(typeof this.table.options.footerElement){
21635
21741
  case "string":
21636
21742
  if(this.table.options.footerElement[0] === "<"){
21637
- this.element.innerHTML = this.table.options.footerElement;
21743
+ this.containerElement.innerHTML = this.table.options.footerElement;
21638
21744
  }else {
21639
21745
  this.external = true;
21640
- this.element = document.querySelector(this.table.options.footerElement);
21746
+ this.containerElement = document.querySelector(this.table.options.footerElement);
21641
21747
  }
21642
21748
  break;
21643
21749
 
@@ -21954,7 +22060,7 @@ class InteractionManager extends CoreFeature {
21954
22060
  return row.getElement() === target;
21955
22061
  });
21956
22062
 
21957
- if(targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
22063
+ if(targets["row"] && targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
21958
22064
  targets[key] = false;
21959
22065
  }
21960
22066
  }
@@ -22844,6 +22950,7 @@ class Layout extends Module{
22844
22950
 
22845
22951
  //trigger table layout
22846
22952
  layout(){
22953
+ this.dispatch("layout-refreshing");
22847
22954
  Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
22848
22955
 
22849
22956
  this.dispatch("layout-refreshed");
@@ -23264,7 +23371,7 @@ class Tabulator {
23264
23371
 
23265
23372
  if(this.initializeElement(element)){
23266
23373
 
23267
- this.initialzeCoreSystems(options);
23374
+ this.initializeCoreSystems(options);
23268
23375
 
23269
23376
  //delay table creation to allow event bindings immediately after the constructor
23270
23377
  setTimeout(() => {
@@ -23294,7 +23401,7 @@ class Tabulator {
23294
23401
  }
23295
23402
  }
23296
23403
 
23297
- initialzeCoreSystems(options){
23404
+ initializeCoreSystems(options){
23298
23405
  this.columnManager = new ColumnManager(this);
23299
23406
  this.rowManager = new RowManager(this);
23300
23407
  this.footerManager = new FooterManager(this);
@@ -23384,7 +23491,7 @@ class Tabulator {
23384
23491
  _clearObjectPointers(){
23385
23492
  this.options.columns = this.options.columns.slice(0);
23386
23493
 
23387
- if(this.options.data && !this.options.reactiveData){
23494
+ if(Array.isArray(this.options.data) && !this.options.reactiveData){
23388
23495
  this.options.data = this.options.data.slice(0);
23389
23496
  }
23390
23497
  }
@@ -23523,7 +23630,7 @@ class Tabulator {
23523
23630
  this.browserSlow = false;
23524
23631
  }
23525
23632
 
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));
23633
+ 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
23634
  }
23528
23635
 
23529
23636
  ////////////////// Data Handling //////////////////