tabulator-tables 5.0.8 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.editorconfig +6 -0
  2. package/LICENSE +1 -1
  3. package/bower.json +1 -1
  4. package/build/rollup.js +2 -1
  5. package/dist/css/tabulator.css +26 -6
  6. package/dist/css/tabulator.css.map +1 -1
  7. package/dist/css/tabulator.min.css +1 -1
  8. package/dist/css/tabulator.min.css.map +1 -1
  9. package/dist/css/tabulator_bootstrap3.css +26 -6
  10. package/dist/css/tabulator_bootstrap3.css.map +1 -1
  11. package/dist/css/tabulator_bootstrap3.min.css +1 -1
  12. package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
  13. package/dist/css/tabulator_bootstrap4.css +26 -6
  14. package/dist/css/tabulator_bootstrap4.css.map +1 -1
  15. package/dist/css/tabulator_bootstrap4.min.css +1 -1
  16. package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
  17. package/dist/css/tabulator_bulma.css +26 -6
  18. package/dist/css/tabulator_bulma.css.map +1 -1
  19. package/dist/css/tabulator_bulma.min.css +1 -1
  20. package/dist/css/tabulator_bulma.min.css.map +1 -1
  21. package/dist/css/tabulator_materialize.css +33 -10
  22. package/dist/css/tabulator_materialize.css.map +1 -1
  23. package/dist/css/tabulator_materialize.min.css +1 -1
  24. package/dist/css/tabulator_materialize.min.css.map +1 -1
  25. package/dist/css/tabulator_midnight.css +30 -6
  26. package/dist/css/tabulator_midnight.css.map +1 -1
  27. package/dist/css/tabulator_midnight.min.css +1 -1
  28. package/dist/css/tabulator_midnight.min.css.map +1 -1
  29. package/dist/css/tabulator_modern.css +26 -6
  30. package/dist/css/tabulator_modern.css.map +1 -1
  31. package/dist/css/tabulator_modern.min.css +1 -1
  32. package/dist/css/tabulator_modern.min.css.map +1 -1
  33. package/dist/css/tabulator_semanticui.css +26 -6
  34. package/dist/css/tabulator_semanticui.css.map +1 -1
  35. package/dist/css/tabulator_semanticui.min.css +1 -1
  36. package/dist/css/tabulator_semanticui.min.css.map +1 -1
  37. package/dist/css/tabulator_simple.css +26 -6
  38. package/dist/css/tabulator_simple.css.map +1 -1
  39. package/dist/css/tabulator_simple.min.css +1 -1
  40. package/dist/css/tabulator_simple.min.css.map +1 -1
  41. package/dist/css/tabulator_site.css +30 -6
  42. package/dist/css/tabulator_site.css.map +1 -1
  43. package/dist/css/tabulator_site.min.css +1 -1
  44. package/dist/css/tabulator_site.min.css.map +1 -1
  45. package/dist/js/tabulator.js +1182 -548
  46. package/dist/js/tabulator.js.map +1 -1
  47. package/dist/js/tabulator.min.js +2 -2
  48. package/dist/js/tabulator.min.js.map +1 -1
  49. package/dist/js/tabulator_esm.js +1797 -1184
  50. package/dist/js/tabulator_esm.js.map +1 -1
  51. package/dist/js/tabulator_esm.min.js +2 -2
  52. package/dist/js/tabulator_esm.min.js.map +1 -1
  53. package/package.json +1 -1
  54. package/src/js/core/ColumnManager.js +1 -1
  55. package/src/js/core/CoreFeature.js +1 -5
  56. package/src/js/core/FooterManager.js +14 -2
  57. package/src/js/core/RowManager.js +325 -286
  58. package/src/js/core/Tabulator.js +0 -43
  59. package/src/js/core/cell/Cell.js +5 -1
  60. package/src/js/core/column/Column.js +21 -6
  61. package/src/js/core/column/ColumnComponent.js +6 -0
  62. package/src/js/core/column/defaults/options.js +1 -0
  63. package/src/js/core/defaults/options.js +3 -3
  64. package/src/js/core/modules/optional.js +1 -0
  65. package/src/js/core/rendering/Renderer.js +3 -2
  66. package/src/js/core/rendering/renderers/BasicVertical.js +2 -1
  67. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +165 -151
  68. package/src/js/core/rendering/renderers/VirtualDomVertical.js +1 -1
  69. package/src/js/core/row/Row.js +2 -2
  70. package/src/js/core/tools/DataLoader.js +6 -6
  71. package/src/js/core/tools/InteractionMonitor.js +157 -52
  72. package/src/js/modules/Ajax/Ajax.js +62 -82
  73. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +16 -3
  74. package/src/js/modules/DataTree/DataTree.js +22 -9
  75. package/src/js/modules/Download/defaults/downloaders/json.js +1 -1
  76. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +32 -0
  77. package/src/js/modules/Download/defaults/downloaders/pdf.js +0 -2
  78. package/src/js/modules/Download/defaults/downloaders/xlsx.js +3 -2
  79. package/src/js/modules/Download/defaults/downloaders.js +2 -0
  80. package/src/js/modules/Edit/Edit.js +27 -39
  81. package/src/js/modules/Export/Export.js +1 -1
  82. package/src/js/modules/Filter/Filter.js +1 -1
  83. package/src/js/modules/Format/defaults/formatters/datetime.js +1 -1
  84. package/src/js/modules/Format/defaults/formatters/datetimediff.js +2 -1
  85. package/src/js/modules/FrozenColumns/FrozenColumns.js +1 -1
  86. package/src/js/modules/FrozenRows/FrozenRows.js +9 -0
  87. package/src/js/modules/GroupRows/Group.js +8 -63
  88. package/src/js/modules/GroupRows/GroupComponent.js +1 -1
  89. package/src/js/modules/GroupRows/GroupRows.js +2 -2
  90. package/src/js/modules/Import/Import.js +195 -0
  91. package/src/js/modules/Import/defaults/importers/csv.js +63 -0
  92. package/src/js/modules/Import/defaults/importers/json.js +8 -0
  93. package/src/js/modules/Import/defaults/importers.js +7 -0
  94. package/src/js/modules/Interaction/Interaction.js +5 -0
  95. package/src/js/modules/Keybindings/Keybindings.js +9 -14
  96. package/src/js/modules/Keybindings/defaults/bindings.js +3 -3
  97. package/src/js/modules/Localize/defaults/langs.js +6 -0
  98. package/src/js/modules/Menu/Menu.js +200 -155
  99. package/src/js/modules/MoveRows/MoveRows.js +4 -0
  100. package/src/js/modules/Page/Page.js +282 -185
  101. package/src/js/modules/Page/defaults/pageCounters/pages.js +33 -0
  102. package/src/js/modules/Page/defaults/pageCounters/rows.js +32 -0
  103. package/src/js/modules/Page/defaults/pageCounters.js +8 -0
  104. package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
  105. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +7 -9
  106. package/src/js/modules/SelectRow/SelectRow.js +4 -9
  107. package/src/js/modules/Sort/defaults/sorters/datetime.js +2 -2
  108. package/src/js/modules/Validate/Validate.js +7 -5
  109. package/src/scss/tabulator.scss +31 -8
  110. package/src/scss/themes/materialize/tabulator_materialize.scss +5 -4
  111. package/src/scss/themes/tabulator_midnight.scss +4 -0
  112. package/src/scss/themes/tabulator_site.scss +4 -0
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.0.8 (c) Oliver Folkerd 2021 */
1
+ /* Tabulator v5.1.1 (c) Oliver Folkerd 2022 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -225,8 +225,6 @@
225
225
  //minimum height of tabulator
226
226
  maxHeight: false,
227
227
  //maximum height of tabulator
228
- columnMaxWidth: false,
229
- //minimum global width for a column
230
228
  columnHeaderVertAlign: "top",
231
229
  //vertical alignment of column headers
232
230
  columns: [],
@@ -239,7 +237,7 @@
239
237
  //build columns from data row structure
240
238
  autoColumnsDefinitions: false,
241
239
  nestedFieldSeparator: ".",
242
- //seperatpr for nested data
240
+ //separator for nested data
243
241
  tooltipGenerationMode: "load",
244
242
  //when to generate tooltips
245
243
  footerElement: false,
@@ -267,6 +265,7 @@
267
265
  dataLoader: true,
268
266
  dataLoaderLoading: false,
269
267
  dataLoaderError: false,
268
+ dataLoaderErrorTimeout: 3000,
270
269
  dataSendParams: {},
271
270
  dataReceiveParams: {}
272
271
  };
@@ -414,11 +413,7 @@
414
413
 
415
414
  }, {
416
415
  key: "options",
417
- value: function options(key, value) {
418
- if (typeof value !== "undefined") {
419
- this.table.options[key] = value;
420
- }
421
-
416
+ value: function options(key) {
422
417
  return this.table.options[key];
423
418
  }
424
419
  }, {
@@ -443,7 +438,6 @@
443
438
  return CoreFeature;
444
439
  }();
445
440
 
446
- //public column object
447
441
  var ColumnComponent = /*#__PURE__*/function () {
448
442
  function ColumnComponent(column) {
449
443
  _classCallCheck(this, ColumnComponent);
@@ -476,6 +470,11 @@
476
470
  value: function getField() {
477
471
  return this._column.getField();
478
472
  }
473
+ }, {
474
+ key: "getTitleDownload",
475
+ value: function getTitleDownload() {
476
+ return this._column.getTitleDownload();
477
+ }
479
478
  }, {
480
479
  key: "getCells",
481
480
  value: function getCells() {
@@ -626,6 +625,7 @@
626
625
  "width": undefined,
627
626
  "minWidth": 40,
628
627
  "maxWidth": undefined,
628
+ "maxInitialWidth": undefined,
629
629
  "tooltip": undefined,
630
630
  "cssClass": undefined,
631
631
  "variableHeight": undefined,
@@ -939,6 +939,11 @@
939
939
  if (changed) {
940
940
  this.dispatch("cell-value-updated", this);
941
941
  this.cellRendered();
942
+
943
+ if (this.column.definition.cellEdited) {
944
+ this.column.definition.cellEdited.call(this.table, this.getComponent());
945
+ }
946
+
942
947
  this.dispatchExternal("cellEdited", this.getComponent());
943
948
 
944
949
  if (this.subscribedExternal("dataChanged")) {
@@ -951,7 +956,7 @@
951
956
  value: function setValueProcessData(value, mutate) {
952
957
  var changed = false;
953
958
 
954
- if (this.value != value) {
959
+ if (this.value !== value) {
955
960
  changed = true;
956
961
 
957
962
  if (mutate) {
@@ -1085,7 +1090,7 @@
1085
1090
  return Cell;
1086
1091
  }(CoreFeature);
1087
1092
 
1088
- var Column$1 = /*#__PURE__*/function (_CoreFeature) {
1093
+ var Column = /*#__PURE__*/function (_CoreFeature) {
1089
1094
  _inherits(Column, _CoreFeature);
1090
1095
 
1091
1096
  var _super = _createSuper(Column);
@@ -1125,6 +1130,7 @@
1125
1130
  _this.fieldStructure = "";
1126
1131
  _this.getFieldValue = "";
1127
1132
  _this.setFieldValue = "";
1133
+ _this.titleDownload = null;
1128
1134
  _this.titleFormatterRendered = false;
1129
1135
 
1130
1136
  _this.mapDefinitions();
@@ -1141,6 +1147,7 @@
1141
1147
 
1142
1148
  _this.maxWidthStyled = ""; //column maximum prestyled to improve render efficiency
1143
1149
 
1150
+ _this.maxInitialWidth = null;
1144
1151
  _this.minWidth = null; //column minimum width
1145
1152
 
1146
1153
  _this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency
@@ -1257,7 +1264,7 @@
1257
1264
 
1258
1265
  var def = this.definition; //set header tooltips
1259
1266
 
1260
- var tooltip = typeof def.headerTooltip === "undefined" ? def.tooltip : def.headerTooltip;
1267
+ var tooltip = def.headerTooltip;
1261
1268
 
1262
1269
  if (tooltip) {
1263
1270
  if (tooltip === true) {
@@ -1433,6 +1440,10 @@
1433
1440
 
1434
1441
  this.setMinWidth(parseInt(def.minWidth));
1435
1442
 
1443
+ if (def.maxInitialWidth) {
1444
+ this.maxInitialWidth = parseInt(def.maxInitialWidth);
1445
+ }
1446
+
1436
1447
  if (def.maxWidth) {
1437
1448
  this.setMaxWidth(parseInt(def.maxWidth));
1438
1449
  }
@@ -1682,6 +1693,11 @@
1682
1693
  key: "getField",
1683
1694
  value: function getField() {
1684
1695
  return this.field;
1696
+ }
1697
+ }, {
1698
+ key: "getTitleDownload",
1699
+ value: function getTitleDownload() {
1700
+ return this.titleDownload;
1685
1701
  } //return the first column in a group
1686
1702
 
1687
1703
  }, {
@@ -1818,7 +1834,7 @@
1818
1834
  this.cells.forEach(function (cell) {
1819
1835
  cell.hide();
1820
1836
  });
1821
- this.dispatch("column-hide", this);
1837
+ this.dispatch("column-hide", this, responsiveToggle);
1822
1838
 
1823
1839
  if (!silent) {
1824
1840
  this.dispatchExternal("columnVisibilityChanged", this.getComponent(), false);
@@ -1940,7 +1956,7 @@
1940
1956
  }, {
1941
1957
  key: "getHeight",
1942
1958
  value: function getHeight() {
1943
- return this.element.offsetHeight;
1959
+ return Math.ceil(this.element.getBoundingClientRect().height);
1944
1960
  }
1945
1961
  }, {
1946
1962
  key: "setMinWidth",
@@ -2049,17 +2065,18 @@
2049
2065
  this.widthFixed = false; //set width if present
2050
2066
 
2051
2067
  if (typeof this.definition.width !== "undefined" && !force) {
2068
+ // maxInitialWidth ignored here as width specified
2052
2069
  this.setWidth(this.definition.width);
2053
2070
  }
2054
2071
 
2055
2072
  this.dispatch("column-width-fit-before", this);
2056
- this.fitToData();
2073
+ this.fitToData(force);
2057
2074
  this.dispatch("column-width-fit-after", this);
2058
2075
  } //set column width to maximum cell width for non group columns
2059
2076
 
2060
2077
  }, {
2061
2078
  key: "fitToData",
2062
- value: function fitToData() {
2079
+ value: function fitToData(force) {
2063
2080
  if (this.isGroup) {
2064
2081
  return;
2065
2082
  }
@@ -2083,7 +2100,13 @@
2083
2100
  });
2084
2101
 
2085
2102
  if (maxWidth) {
2086
- this.setWidthActual(maxWidth + 1);
2103
+ var setTo = maxWidth + 1;
2104
+
2105
+ if (this.maxInitialWidth && !force) {
2106
+ setTo = Math.min(setTo, this.maxInitialWidth);
2107
+ }
2108
+
2109
+ this.setWidthActual(setTo);
2087
2110
  }
2088
2111
  }
2089
2112
  }
@@ -2140,7 +2163,7 @@
2140
2163
  return Column;
2141
2164
  }(CoreFeature);
2142
2165
 
2143
- Column$1.defaultOptionList = defaultColumnOptions;
2166
+ Column.defaultOptionList = defaultColumnOptions;
2144
2167
 
2145
2168
  var Helpers = /*#__PURE__*/function () {
2146
2169
  function Helpers() {
@@ -2344,7 +2367,7 @@
2344
2367
  }
2345
2368
  }, {
2346
2369
  key: "scrollToRowNearestTop",
2347
- value: function scrollToRowNearestTop(row) {//determin weather the row is nearest the top or bottom of the table, retur true for top or false for bottom
2370
+ value: function scrollToRowNearestTop(row) {//determine weather the row is nearest the top or bottom of the table, retur true for top or false for bottom
2348
2371
  }
2349
2372
  }, {
2350
2373
  key: "visibleRows",
@@ -2418,6 +2441,7 @@
2418
2441
  offset = Helpers.elOffset(rowEl).top - Helpers.elOffset(_this2.elementVertical).top;
2419
2442
 
2420
2443
  if (offset > 0 && offset < _this2.elementVertical.clientHeight - rowEl.offsetHeight) {
2444
+ resolve();
2421
2445
  return false;
2422
2446
  }
2423
2447
  }
@@ -2528,27 +2552,27 @@
2528
2552
  _createClass(VirtualDomHorizontal, [{
2529
2553
  key: "initialize",
2530
2554
  value: function initialize() {
2531
- this.compatabilityCheck();
2555
+ this.compatibilityCheck();
2532
2556
  }
2533
2557
  }, {
2534
- key: "compatabilityCheck",
2535
- value: function compatabilityCheck() {
2558
+ key: "compatibilityCheck",
2559
+ value: function compatibilityCheck() {
2536
2560
  var columns = this.options("columns"),
2537
2561
  frozen = false,
2538
2562
  ok = true;
2539
2563
 
2540
2564
  if (this.options("layout") == "fitDataTable") {
2541
- console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode");
2565
+ console.warn("Horizontal Virtual DOM is not compatible with fitDataTable layout mode");
2542
2566
  ok = false;
2543
2567
  }
2544
2568
 
2545
2569
  if (this.options("responsiveLayout")) {
2546
- console.warn("Horizontal Vitrual DOM is not compatible with responsive columns");
2570
+ console.warn("Horizontal Virtual DOM is not compatible with responsive columns");
2547
2571
  ok = false;
2548
2572
  }
2549
2573
 
2550
2574
  if (this.options("rtl")) {
2551
- console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction");
2575
+ console.warn("Horizontal Virtual DOM is not currently compatible with RTL text direction");
2552
2576
  ok = false;
2553
2577
  }
2554
2578
 
@@ -2558,7 +2582,7 @@
2558
2582
  });
2559
2583
 
2560
2584
  if (frozen) {
2561
- console.warn("Horizontal Vitrual DOM is not compatible with frozen columns");
2585
+ console.warn("Horizontal Virtual DOM is not compatible with frozen columns");
2562
2586
  ok = false;
2563
2587
  }
2564
2588
  } // if(!ok){
@@ -2614,7 +2638,7 @@
2614
2638
  config.width = width;
2615
2639
 
2616
2640
  if (_this2.options("layout") === "fitData") {
2617
- config.fitDataCheck = true;
2641
+ config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
2618
2642
  }
2619
2643
 
2620
2644
  if (colPos + width > _this2.vDomScrollPosLeft && colPos < _this2.vDomScrollPosRight) {
@@ -2644,7 +2668,7 @@
2644
2668
 
2645
2669
  if (!blockRedraw) {
2646
2670
  if (!update || this.reinitChanged(old)) {
2647
- this.renitializeRows();
2671
+ this.reinitializeRows();
2648
2672
  }
2649
2673
  }
2650
2674
 
@@ -2771,8 +2795,8 @@
2771
2795
  return !match;
2772
2796
  }
2773
2797
  }, {
2774
- key: "renitializeRows",
2775
- value: function renitializeRows() {
2798
+ key: "reinitializeRows",
2799
+ value: function reinitializeRows() {
2776
2800
  var _this5 = this;
2777
2801
 
2778
2802
  var rows = this.table.rowManager.getVisibleRows();
@@ -2825,7 +2849,7 @@
2825
2849
  }
2826
2850
  });
2827
2851
  this.fitDataColActualWidthCheck(column);
2828
- this.rightCol++;
2852
+ this.rightCol++; // Don't move this below the >= check below
2829
2853
 
2830
2854
  if (this.rightCol >= this.columns.length - 1) {
2831
2855
  this.vDomPadRight = 0;
@@ -2853,15 +2877,16 @@
2853
2877
  }
2854
2878
  });
2855
2879
  this.fitDataColActualWidthCheck(column);
2880
+ this.leftCol--; // don't move this below the <= check below
2856
2881
 
2857
- if (!this.leftCol) {
2882
+ if (this.leftCol <= 0) {
2883
+ // replicating logic in addColRight
2858
2884
  this.vDomPadLeft = 0;
2859
2885
  } else {
2860
2886
  this.vDomPadLeft -= column.getWidth();
2861
2887
  }
2862
2888
 
2863
2889
  this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
2864
- this.leftCol--;
2865
2890
  this.addColLeft();
2866
2891
  }
2867
2892
  }
@@ -2877,7 +2902,12 @@
2877
2902
  rows.forEach(function (row) {
2878
2903
  if (row.type !== "group") {
2879
2904
  var cell = row.getCell(column);
2880
- row.getElement().removeChild(cell.getElement());
2905
+
2906
+ try {
2907
+ row.getElement().removeChild(cell.getElement());
2908
+ } catch (ex) {
2909
+ console.warn("Could not removeColRight", ex.message);
2910
+ }
2881
2911
  }
2882
2912
  });
2883
2913
  this.vDomPadRight += column.getWidth();
@@ -2895,11 +2925,21 @@
2895
2925
  if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) {
2896
2926
  rows = this.table.rowManager.getVisibleRows();
2897
2927
  rows.forEach(function (row) {
2928
+ var cell, el;
2929
+
2898
2930
  if (row.type !== "group") {
2899
- var cell = row.getCell(column);
2931
+ cell = row.getCell(column);
2900
2932
 
2901
- if (cell.parentNode) {
2902
- row.getElement().removeChild(cell.getElement());
2933
+ if (cell) {
2934
+ el = cell.getElement();
2935
+
2936
+ if (el.parentNode) {
2937
+ try {
2938
+ row.getElement().removeChild(el);
2939
+ } catch (ex) {
2940
+ console.warn("Could not removeColLeft", ex.message);
2941
+ }
2942
+ }
2903
2943
  }
2904
2944
  }
2905
2945
  });
@@ -3195,7 +3235,7 @@
3195
3235
  }, {
3196
3236
  key: "_addColumn",
3197
3237
  value: function _addColumn(definition, before, nextToColumn) {
3198
- var column = new Column$1(definition, this),
3238
+ var column = new Column(definition, this),
3199
3239
  colEl = column.getElement(),
3200
3240
  index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
3201
3241
 
@@ -3270,7 +3310,7 @@
3270
3310
  key: "findColumn",
3271
3311
  value: function findColumn(subject) {
3272
3312
  if (_typeof(subject) == "object") {
3273
- if (subject instanceof Column$1) {
3313
+ if (subject instanceof Column) {
3274
3314
  //subject is column element
3275
3315
  return subject;
3276
3316
  } else if (subject instanceof ColumnComponent) {
@@ -3317,8 +3357,8 @@
3317
3357
  return this.columnsByIndex[index];
3318
3358
  }
3319
3359
  }, {
3320
- key: "getFirstVisibileColumn",
3321
- value: function getFirstVisibileColumn(index) {
3360
+ key: "getFirstVisibleColumn",
3361
+ value: function getFirstVisibleColumn(index) {
3322
3362
  var index = this.columnsByIndex.findIndex(function (col) {
3323
3363
  return col.visible;
3324
3364
  });
@@ -3851,12 +3891,12 @@
3851
3891
  }
3852
3892
 
3853
3893
  this.dispatch("row-layout", this);
3894
+ this.initialized = true;
3854
3895
 
3855
3896
  if (this.table.options.rowFormatter) {
3856
3897
  this.table.options.rowFormatter(this.getComponent());
3857
3898
  }
3858
3899
 
3859
- this.initialized = true;
3860
3900
  this.dispatch("row-layout-after", this);
3861
3901
  } else {
3862
3902
  this.table.columnManager.renderer.rerenderRowCells(this);
@@ -4266,7 +4306,8 @@
4266
4306
  }, {
4267
4307
  key: "rerenderRows",
4268
4308
  value: function rerenderRows(callback) {
4269
- this.render();
4309
+ this.clearRows();
4310
+ this.renderRows();
4270
4311
 
4271
4312
  if (callback) {
4272
4313
  callback();
@@ -4350,8 +4391,8 @@
4350
4391
  }
4351
4392
 
4352
4393
  element.style.paddingTop = "";
4353
- element.style.paddingBottom = "";
4354
- element.style.minWidth = "";
4394
+ element.style.paddingBottom = ""; // element.style.minWidth = "";
4395
+
4355
4396
  element.style.minHeight = "";
4356
4397
  element.style.display = "";
4357
4398
  element.style.visibility = "";
@@ -4915,6 +4956,10 @@
4915
4956
 
4916
4957
  _this.heightFixer = _this.createTableElement(); //table element
4917
4958
 
4959
+ _this.placeholder = null; //placeholder element
4960
+
4961
+ _this.placeholderContents = null; //placeholder element
4962
+
4918
4963
  _this.firstRender = false; //handle first render
4919
4964
 
4920
4965
  _this.renderMode = "virtual"; //current rendering mode
@@ -4923,7 +4968,7 @@
4923
4968
 
4924
4969
  _this.rows = []; //hold row data objects
4925
4970
 
4926
- _this.activeRowsPipeline = []; //hold caluclation of active rows
4971
+ _this.activeRowsPipeline = []; //hold calculation of active rows
4927
4972
 
4928
4973
  _this.activeRows = []; //rows currently available to on display in the table
4929
4974
 
@@ -4937,11 +4982,11 @@
4937
4982
  _this.scrollLeft = 0;
4938
4983
  _this.rowNumColumn = false; //hold column component for row number column
4939
4984
 
4940
- _this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing
4985
+ _this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
4941
4986
 
4942
4987
  _this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
4943
4988
 
4944
- _this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed
4989
+ _this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
4945
4990
 
4946
4991
  _this.dataPipeline = []; //hold data pipeline tasks
4947
4992
 
@@ -4968,6 +5013,21 @@
4968
5013
  el.classList.add("tabulator-table");
4969
5014
  el.setAttribute("role", "rowgroup");
4970
5015
  return el;
5016
+ }
5017
+ }, {
5018
+ key: "initializePlaceholder",
5019
+ value: function initializePlaceholder() {
5020
+ //configure placeholder element
5021
+ if (typeof this.table.options.placeholder == "string") {
5022
+ var el = document.createElement("div");
5023
+ el.classList.add("tabulator-placeholder");
5024
+ var contents = document.createElement("div");
5025
+ contents.classList.add("tabulator-placeholder-contents");
5026
+ contents.innerHTML = this.table.options.placeholder;
5027
+ el.appendChild(contents);
5028
+ this.placeholderContents = contents;
5029
+ this.placeholder = el;
5030
+ }
4971
5031
  } //return containing element
4972
5032
 
4973
5033
  }, {
@@ -4996,6 +5056,7 @@
4996
5056
  value: function initialize() {
4997
5057
  var _this2 = this;
4998
5058
 
5059
+ this.initializePlaceholder();
4999
5060
  this.initializeRenderer(); //initialize manager
5000
5061
 
5001
5062
  this.element.appendChild(this.tableElement);
@@ -5013,7 +5074,9 @@
5013
5074
  _this2.dispatch("scroll-horizontal", left, leftDir);
5014
5075
 
5015
5076
  _this2.dispatchExternal("scrollHorizontal", left, leftDir);
5016
- } //handle verical scrolling
5077
+
5078
+ _this2._positionPlaceholder();
5079
+ } //handle vertical scrolling
5017
5080
 
5018
5081
 
5019
5082
  if (_this2.scrollTop != top) {
@@ -5195,7 +5258,6 @@
5195
5258
  key: "addRow",
5196
5259
  value: function addRow(data, pos, index, blockRedraw) {
5197
5260
  var row = this.addRowActual(data, pos, index, blockRedraw);
5198
- this.dispatch("row-added", row, data, pos, index);
5199
5261
  return row;
5200
5262
  } //add multiple rows
5201
5263
 
@@ -5574,42 +5636,12 @@
5574
5636
 
5575
5637
  return;
5576
5638
  } else {
5577
- this.dispatch("data-refeshing");
5578
-
5579
- if (!handler) {
5580
- this.activeRowsPipeline[0] = this.rows.slice(0);
5581
- } //cascade through data refresh stages
5582
-
5583
-
5584
- switch (stage) {
5585
- case "all": //handle case where alldata needs refreshing
5586
-
5587
- case "dataPipeline":
5588
- for (var i = index; i < this.dataPipeline.length; i++) {
5589
- var result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
5590
- this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
5591
- }
5592
-
5593
- this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
5594
- this.regenerateRowNumbers();
5595
-
5596
- case "display":
5597
- index = 0;
5598
- this.resetDisplayRows();
5599
-
5600
- case "displayPipeline":
5601
- for (var _i = index; _i < this.displayPipeline.length; _i++) {
5602
- var _result = this.displayPipeline[_i].handler((_i ? this.getDisplayRows(_i - 1) : this.activeRows).slice(0), renderInPosition);
5603
-
5604
- this.setDisplayRows(_result || this.getDisplayRows(_i - 1).slice(0), _i);
5605
- }
5606
-
5607
- }
5608
-
5609
5639
  if (Helpers.elVisible(this.element)) {
5610
5640
  if (renderInPosition) {
5611
- this.reRenderInPosition();
5641
+ this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
5612
5642
  } else {
5643
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5644
+
5613
5645
  if (!handler) {
5614
5646
  this.table.columnManager.renderer.renderColumns();
5615
5647
  }
@@ -5620,9 +5652,46 @@
5620
5652
  this.table.columnManager.redraw(true);
5621
5653
  }
5622
5654
  }
5655
+ } else {
5656
+ this.refreshPipelines(handler, stage, index, renderInPosition);
5623
5657
  }
5624
5658
 
5625
- this.dispatch("data-refeshed");
5659
+ this.dispatch("data-refreshed");
5660
+ }
5661
+ }
5662
+ }, {
5663
+ key: "refreshPipelines",
5664
+ value: function refreshPipelines(handler, stage, index, renderInPosition) {
5665
+ this.dispatch("data-refreshing");
5666
+
5667
+ if (!handler) {
5668
+ this.activeRowsPipeline[0] = this.rows.slice(0);
5669
+ } //cascade through data refresh stages
5670
+
5671
+
5672
+ switch (stage) {
5673
+ case "all": //handle case where alldata needs refreshing
5674
+
5675
+ case "dataPipeline":
5676
+ for (var i = index; i < this.dataPipeline.length; i++) {
5677
+ var result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
5678
+ this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
5679
+ }
5680
+
5681
+ this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
5682
+ this.regenerateRowNumbers();
5683
+
5684
+ case "display":
5685
+ index = 0;
5686
+ this.resetDisplayRows();
5687
+
5688
+ case "displayPipeline":
5689
+ for (var _i = index; _i < this.displayPipeline.length; _i++) {
5690
+ var _result = this.displayPipeline[_i].handler((_i ? this.getDisplayRows(_i - 1) : this.activeRows).slice(0), renderInPosition);
5691
+
5692
+ this.setDisplayRows(_result || this.getDisplayRows(_i - 1).slice(0), _i);
5693
+ }
5694
+
5626
5695
  }
5627
5696
  } //regenerate row numbers for row number formatter if in use
5628
5697
 
@@ -5691,8 +5760,14 @@
5691
5760
  }
5692
5761
  }, {
5693
5762
  key: "getVisibleRows",
5694
- value: function getVisibleRows(viewable) {
5695
- return this.renderer.visibleRows(!viewable);
5763
+ value: function getVisibleRows(chain, viewable) {
5764
+ var rows = Object.assign([], this.renderer.visibleRows(!viewable));
5765
+
5766
+ if (chain) {
5767
+ rows = this.chain("rows-visible", [viewable], rows, rows);
5768
+ }
5769
+
5770
+ return rows;
5696
5771
  } //repeat action accross display rows
5697
5772
 
5698
5773
  }, {
@@ -5718,7 +5793,7 @@
5718
5793
  break;
5719
5794
 
5720
5795
  case "visible":
5721
- rows = this.getVisibleRows(true);
5796
+ rows = this.getVisibleRows(false, true);
5722
5797
  break;
5723
5798
 
5724
5799
  default:
@@ -5736,7 +5811,7 @@
5736
5811
  if (callback) {
5737
5812
  callback();
5738
5813
  } else {
5739
- this.redrawBlockRederInPosition = true;
5814
+ this.redrawBlockRenderInPosition = true;
5740
5815
  }
5741
5816
  } else {
5742
5817
  this.renderer.rerenderRows(callback);
@@ -5810,7 +5885,7 @@
5810
5885
  }, {
5811
5886
  key: "renderEmptyScroll",
5812
5887
  value: function renderEmptyScroll() {
5813
- if (this.table.options.placeholder) {
5888
+ if (this.placeholder) {
5814
5889
  this.tableElement.style.display = "none";
5815
5890
  } else {
5816
5891
  this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; // this.tableElement.style.minHeight = "1px";
@@ -5831,17 +5906,27 @@
5831
5906
  }, {
5832
5907
  key: "_showPlaceholder",
5833
5908
  value: function _showPlaceholder() {
5834
- if (this.table.options.placeholder) {
5835
- this.table.options.placeholder.setAttribute("tabulator-render-mode", this.renderMode);
5836
- this.getElement().appendChild(this.table.options.placeholder);
5837
- this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px";
5909
+ if (this.placeholder) {
5910
+ this.placeholder.setAttribute("tabulator-render-mode", this.renderMode);
5911
+ this.getElement().appendChild(this.placeholder);
5912
+
5913
+ this._positionPlaceholder();
5838
5914
  }
5839
5915
  }
5840
5916
  }, {
5841
5917
  key: "_clearPlaceholder",
5842
5918
  value: function _clearPlaceholder() {
5843
- if (this.table.options.placeholder && this.table.options.placeholder.parentNode) {
5844
- this.table.options.placeholder.parentNode.removeChild(this.table.options.placeholder);
5919
+ if (this.placeholder && this.placeholder.parentNode) {
5920
+ this.placeholder.parentNode.removeChild(this.placeholder);
5921
+ }
5922
+ }
5923
+ }, {
5924
+ key: "_positionPlaceholder",
5925
+ value: function _positionPlaceholder() {
5926
+ if (this.placeholder && this.placeholder.parentNode) {
5927
+ this.placeholder.style.width = this.table.columnManager.getWidth() + "px";
5928
+ this.placeholderContents.style.width = this.table.rowManager.element.clientWidth + "px";
5929
+ this.placeholderContents.style.marginLeft = this.scrollLeft + "px";
5845
5930
  }
5846
5931
  }
5847
5932
  }, {
@@ -5894,6 +5979,8 @@
5894
5979
  }
5895
5980
  }
5896
5981
  }
5982
+
5983
+ this._positionPlaceholder();
5897
5984
  } //renitialize all rows
5898
5985
 
5899
5986
  }, {
@@ -5920,12 +6007,12 @@
5920
6007
  this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition);
5921
6008
  this.redrawBlockRestoreConfig = false;
5922
6009
  } else {
5923
- if (this.redrawBlockRederInPosition) {
6010
+ if (this.redrawBlockRenderInPosition) {
5924
6011
  this.reRenderInPosition();
5925
6012
  }
5926
6013
  }
5927
6014
 
5928
- this.redrawBlockRederInPosition = false;
6015
+ this.redrawBlockRenderInPosition = false;
5929
6016
  } //redraw table
5930
6017
 
5931
6018
  }, {
@@ -5981,6 +6068,8 @@
5981
6068
  _this.active = false;
5982
6069
  _this.element = _this.createElement(); //containing element
5983
6070
 
6071
+ _this.containerElement = _this.createContainerElement(); //containing element
6072
+
5984
6073
  _this.external = false;
5985
6074
  _this.links = [];
5986
6075
 
@@ -6001,6 +6090,14 @@
6001
6090
  el.classList.add("tabulator-footer");
6002
6091
  return el;
6003
6092
  }
6093
+ }, {
6094
+ key: "createContainerElement",
6095
+ value: function createContainerElement() {
6096
+ var el = document.createElement("div");
6097
+ el.classList.add("tabulator-footer-contents");
6098
+ this.element.appendChild(el);
6099
+ return el;
6100
+ }
6004
6101
  }, {
6005
6102
  key: "initializeElement",
6006
6103
  value: function initializeElement() {
@@ -6031,7 +6128,7 @@
6031
6128
  key: "append",
6032
6129
  value: function append(element, parent) {
6033
6130
  this.activate(parent);
6034
- this.element.appendChild(element);
6131
+ this.containerElement.appendChild(element);
6035
6132
  this.table.rowManager.adjustTableSize();
6036
6133
  }
6037
6134
  }, {
@@ -6107,6 +6204,25 @@
6107
6204
  "tabulator-group": "group",
6108
6205
  "tabulator-col": "column"
6109
6206
  };
6207
+ _this.pseudoTrackers = {
6208
+ "row": {
6209
+ subscriber: null,
6210
+ target: null
6211
+ },
6212
+ "cell": {
6213
+ subscriber: null,
6214
+ target: null
6215
+ },
6216
+ "group": {
6217
+ subscriber: null,
6218
+ target: null
6219
+ },
6220
+ "column": {
6221
+ subscriber: null,
6222
+ target: null
6223
+ }
6224
+ };
6225
+ _this.pseudoTracking = false;
6110
6226
  return _this;
6111
6227
  }
6112
6228
 
@@ -6129,6 +6245,55 @@
6129
6245
  });
6130
6246
  this.listeners = listenerMap;
6131
6247
  }
6248
+ }, {
6249
+ key: "bindPseudoEvents",
6250
+ value: function bindPseudoEvents() {
6251
+ var _this2 = this;
6252
+
6253
+ Object.keys(this.pseudoTrackers).forEach(function (key) {
6254
+ _this2.pseudoTrackers[key].subscriber = _this2.pseudoMouseEnter.bind(_this2, key);
6255
+
6256
+ _this2.subscribe(key + "-mouseover", _this2.pseudoTrackers[key].subscriber);
6257
+ });
6258
+ this.pseudoTracking = true;
6259
+ }
6260
+ }, {
6261
+ key: "pseudoMouseEnter",
6262
+ value: function pseudoMouseEnter(key, e, target) {
6263
+ if (this.pseudoTrackers[key].target !== target) {
6264
+ if (this.pseudoTrackers[key].target) {
6265
+ this.dispatch(key + "-mouseleave", e, target);
6266
+ }
6267
+
6268
+ this.pseudoMouseLeave(key, e);
6269
+ this.pseudoTrackers[key].target = target;
6270
+ this.dispatch(key + "-mouseenter", e, target);
6271
+ }
6272
+ }
6273
+ }, {
6274
+ key: "pseudoMouseLeave",
6275
+ value: function pseudoMouseLeave(key, e) {
6276
+ var _this3 = this;
6277
+
6278
+ var leaveList = Object.keys(this.pseudoTrackers),
6279
+ linkedKeys = {
6280
+ "row": ["cell"],
6281
+ "cell": ["row"]
6282
+ };
6283
+ leaveList = leaveList.filter(function (item) {
6284
+ var links = linkedKeys[key];
6285
+ return item !== key && (!links || links && !links.includes(item));
6286
+ });
6287
+ leaveList.forEach(function (key) {
6288
+ var target = _this3.pseudoTrackers[key].target;
6289
+
6290
+ if (_this3.pseudoTrackers[key].target) {
6291
+ _this3.dispatch(key + "-mouseleave", e, target);
6292
+
6293
+ _this3.pseudoTrackers[key].target = null;
6294
+ }
6295
+ });
6296
+ }
6132
6297
  }, {
6133
6298
  key: "bindSubscriptionWatchers",
6134
6299
  value: function bindSubscriptionWatchers() {
@@ -6153,6 +6318,8 @@
6153
6318
  _iterator.f();
6154
6319
  }
6155
6320
  }
6321
+
6322
+ this.subscribe("table-destroy", this.clearWatchers.bind(this));
6156
6323
  }
6157
6324
  }, {
6158
6325
  key: "subscriptionChanged",
@@ -6175,6 +6342,10 @@
6175
6342
  }
6176
6343
  }
6177
6344
 
6345
+ if ((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking) {
6346
+ this.bindPseudoEvents();
6347
+ }
6348
+
6178
6349
  if (changed) {
6179
6350
  this.updateEventListeners();
6180
6351
  }
@@ -6205,11 +6376,15 @@
6205
6376
  var targets = this.findTargets(path);
6206
6377
  targets = this.bindComponents(type, targets);
6207
6378
  this.triggerEvents(type, e, targets);
6379
+
6380
+ if (this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length) {
6381
+ this.pseudoMouseLeave("none", e);
6382
+ }
6208
6383
  }
6209
6384
  }, {
6210
6385
  key: "findTargets",
6211
6386
  value: function findTargets(path) {
6212
- var _this2 = this;
6387
+ var _this4 = this;
6213
6388
 
6214
6389
  var targets = {};
6215
6390
  var componentMap = Object.keys(this.componentMap);
@@ -6222,7 +6397,7 @@
6222
6397
  var el = _step2.value;
6223
6398
  var classList = el.classList ? _toConsumableArray(el.classList) : [];
6224
6399
  var abort = classList.filter(function (item) {
6225
- return _this2.abortClasses.includes(item);
6400
+ return _this4.abortClasses.includes(item);
6226
6401
  });
6227
6402
 
6228
6403
  if (abort.length) {
@@ -6262,7 +6437,7 @@
6262
6437
  }, {
6263
6438
  key: "bindComponents",
6264
6439
  value: function bindComponents(type, targets) {
6265
- var _this3 = this;
6440
+ var _this5 = this;
6266
6441
 
6267
6442
  //ensure row component is looked up before cell
6268
6443
  var keys = Object.keys(targets).reverse(),
@@ -6277,7 +6452,7 @@
6277
6452
  var key = _step4.value;
6278
6453
  var component = void 0;
6279
6454
  var target = targets[key];
6280
- var previousTarget = _this3.previousTargets[key];
6455
+ var previousTarget = _this5.previousTargets[key];
6281
6456
 
6282
6457
  if (previousTarget && previousTarget.target === target) {
6283
6458
  component = previousTarget.component;
@@ -6285,26 +6460,36 @@
6285
6460
  switch (key) {
6286
6461
  case "row":
6287
6462
  case "group":
6288
- if (listener.components.includes("row") || listener.components.includes("cell")) {
6289
- var rows = _this3.table.rowManager.getVisibleRows();
6463
+ if (listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")) {
6464
+ var rows = _this5.table.rowManager.getVisibleRows(true);
6290
6465
 
6291
6466
  component = rows.find(function (row) {
6292
6467
  return row.getElement() === target;
6293
6468
  });
6469
+
6470
+ if (targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
6471
+ targets[key] = false;
6472
+ }
6294
6473
  }
6295
6474
 
6296
6475
  break;
6297
6476
 
6298
6477
  case "column":
6299
6478
  if (listener.components.includes("column")) {
6300
- component = _this3.table.columnManager.findColumn(target);
6479
+ component = _this5.table.columnManager.findColumn(target);
6301
6480
  }
6302
6481
 
6303
6482
  break;
6304
6483
 
6305
6484
  case "cell":
6306
6485
  if (listener.components.includes("cell")) {
6307
- component = targets["row"].findCell(target);
6486
+ if (targets["row"] instanceof Row) {
6487
+ component = targets["row"].findCell(target);
6488
+ } else {
6489
+ if (targets["row"]) {
6490
+ console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?");
6491
+ }
6492
+ }
6308
6493
  }
6309
6494
 
6310
6495
  break;
@@ -6343,6 +6528,18 @@
6343
6528
  }
6344
6529
  }
6345
6530
  }
6531
+ }, {
6532
+ key: "clearWatchers",
6533
+ value: function clearWatchers() {
6534
+ for (var key in this.listeners) {
6535
+ var listener = this.listeners[key];
6536
+
6537
+ if (listener.handler) {
6538
+ this.el.removeEventListener(key, listener.handler);
6539
+ listener.handler = null;
6540
+ }
6541
+ }
6542
+ }
6346
6543
  }]);
6347
6544
 
6348
6545
  return InteractionManager;
@@ -6461,7 +6658,7 @@
6461
6658
  data = JSON.parse(data);
6462
6659
  }
6463
6660
 
6464
- if (this.confirm("data-loading", data, params, config, silent)) {
6661
+ if (this.confirm("data-loading", [data, params, config, silent])) {
6465
6662
  this.loading = true;
6466
6663
 
6467
6664
  if (!silent) {
@@ -6469,9 +6666,9 @@
6469
6666
  } //get params for request
6470
6667
 
6471
6668
 
6472
- var params = this.chain("data-params", [data, config, silent], params || {}, {});
6669
+ params = this.chain("data-params", [data, config, silent], params || {}, params || {});
6473
6670
  params = this.mapParams(params, this.table.options.dataSendParams);
6474
- var result = this.chain("data-load", [data, params, config, silent], Promise.resolve([]));
6671
+ var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
6475
6672
  return result.then(function (response) {
6476
6673
  if (!Array.isArray(response) && _typeof(response) == "object") {
6477
6674
  response = _this2.mapParams(response, _this2.objectInvert(_this2.table.options.dataReceiveParams));
@@ -6501,7 +6698,7 @@
6501
6698
 
6502
6699
  setTimeout(function () {
6503
6700
  _this2.hideLoader();
6504
- }, 3000);
6701
+ }, _this2.table.options.dataLoaderErrorTimeout);
6505
6702
  })["finally"](function () {
6506
6703
  _this2.loading = false;
6507
6704
  });
@@ -7381,7 +7578,13 @@
7381
7578
  "prev_title": "Prev Page",
7382
7579
  "next": "Next",
7383
7580
  "next_title": "Next Page",
7384
- "all": "All"
7581
+ "all": "All",
7582
+ "counter": {
7583
+ "showing": "Showing",
7584
+ "of": "of",
7585
+ "rows": "rows",
7586
+ "pages": "pages"
7587
+ }
7385
7588
  },
7386
7589
  "headerFilters": {
7387
7590
  "default": "filter column...",
@@ -8097,46 +8300,6 @@
8097
8300
  key: "restoreRedraw",
8098
8301
  value: function restoreRedraw() {
8099
8302
  return this.rowManager.restoreRedraw();
8100
- } //local data from local file
8101
-
8102
- }, {
8103
- key: "setDataFromLocalFile",
8104
- value: function setDataFromLocalFile(extensions) {
8105
- var _this2 = this;
8106
-
8107
- return new Promise(function (resolve, reject) {
8108
- var input = document.createElement("input");
8109
- input.type = "file";
8110
- input.accept = extensions || ".json,application/json";
8111
- input.addEventListener("change", function (e) {
8112
- var file = input.files[0],
8113
- reader = new FileReader(),
8114
- data;
8115
- reader.readAsText(file);
8116
-
8117
- reader.onload = function (e) {
8118
- try {
8119
- data = JSON.parse(reader.result);
8120
- } catch (e) {
8121
- console.warn("File Load Error - File contents is invalid JSON", e);
8122
- reject(e);
8123
- return;
8124
- }
8125
-
8126
- _this2.setData(data).then(function (data) {
8127
- resolve(data);
8128
- })["catch"](function (err) {
8129
- resolve(err);
8130
- });
8131
- };
8132
-
8133
- reader.onerror = function (e) {
8134
- console.warn("File Load Error - Unable to read file");
8135
- reject();
8136
- };
8137
- });
8138
- input.click();
8139
- });
8140
8303
  } //load data
8141
8304
 
8142
8305
  }, {
@@ -8181,13 +8344,13 @@
8181
8344
  }, {
8182
8345
  key: "updateData",
8183
8346
  value: function updateData(data) {
8184
- var _this3 = this;
8347
+ var _this2 = this;
8185
8348
 
8186
8349
  var responses = 0;
8187
8350
 
8188
8351
  if (this.initialized) {
8189
8352
  return new Promise(function (resolve, reject) {
8190
- _this3.dataLoader.blockActiveLoad();
8353
+ _this2.dataLoader.blockActiveLoad();
8191
8354
 
8192
8355
  if (typeof data === "string") {
8193
8356
  data = JSON.parse(data);
@@ -8195,7 +8358,7 @@
8195
8358
 
8196
8359
  if (data) {
8197
8360
  data.forEach(function (item) {
8198
- var row = _this3.rowManager.findRow(item[_this3.options.index]);
8361
+ var row = _this2.rowManager.findRow(item[_this2.options.index]);
8199
8362
 
8200
8363
  if (row) {
8201
8364
  responses++;
@@ -8220,18 +8383,18 @@
8220
8383
  }, {
8221
8384
  key: "addData",
8222
8385
  value: function addData(data, pos, index) {
8223
- var _this4 = this;
8386
+ var _this3 = this;
8224
8387
 
8225
8388
  if (this.initialized) {
8226
8389
  return new Promise(function (resolve, reject) {
8227
- _this4.dataLoader.blockActiveLoad();
8390
+ _this3.dataLoader.blockActiveLoad();
8228
8391
 
8229
8392
  if (typeof data === "string") {
8230
8393
  data = JSON.parse(data);
8231
8394
  }
8232
8395
 
8233
8396
  if (data) {
8234
- _this4.rowManager.addRows(data, pos, index).then(function (rows) {
8397
+ _this3.rowManager.addRows(data, pos, index).then(function (rows) {
8235
8398
  var output = [];
8236
8399
  rows.forEach(function (row) {
8237
8400
  output.push(row.getComponent());
@@ -8251,14 +8414,14 @@
8251
8414
  }, {
8252
8415
  key: "updateOrAddData",
8253
8416
  value: function updateOrAddData(data) {
8254
- var _this5 = this;
8417
+ var _this4 = this;
8255
8418
 
8256
8419
  var rows = [],
8257
8420
  responses = 0;
8258
8421
 
8259
8422
  if (this.initialized) {
8260
8423
  return new Promise(function (resolve, reject) {
8261
- _this5.dataLoader.blockActiveLoad();
8424
+ _this4.dataLoader.blockActiveLoad();
8262
8425
 
8263
8426
  if (typeof data === "string") {
8264
8427
  data = JSON.parse(data);
@@ -8266,7 +8429,7 @@
8266
8429
 
8267
8430
  if (data) {
8268
8431
  data.forEach(function (item) {
8269
- var row = _this5.rowManager.findRow(item[_this5.options.index]);
8432
+ var row = _this4.rowManager.findRow(item[_this4.options.index]);
8270
8433
 
8271
8434
  responses++;
8272
8435
 
@@ -8280,7 +8443,7 @@
8280
8443
  }
8281
8444
  });
8282
8445
  } else {
8283
- _this5.rowManager.addRows(item).then(function (newRows) {
8446
+ _this4.rowManager.addRows(item).then(function (newRows) {
8284
8447
  responses--;
8285
8448
  rows.push(newRows[0].getComponent());
8286
8449
 
@@ -8329,7 +8492,7 @@
8329
8492
  }, {
8330
8493
  key: "deleteRow",
8331
8494
  value: function deleteRow(index) {
8332
- var _this6 = this;
8495
+ var _this5 = this;
8333
8496
 
8334
8497
  var foundRows = [];
8335
8498
 
@@ -8362,7 +8525,7 @@
8362
8525
  }
8363
8526
 
8364
8527
  foundRows.sort(function (a, b) {
8365
- return _this6.rowManager.rows.indexOf(a) > _this6.rowManager.rows.indexOf(b) ? 1 : -1;
8528
+ return _this5.rowManager.rows.indexOf(a) > _this5.rowManager.rows.indexOf(b) ? 1 : -1;
8366
8529
  }); //delete rows
8367
8530
 
8368
8531
  foundRows.forEach(function (row) {
@@ -8592,13 +8755,13 @@
8592
8755
  }, {
8593
8756
  key: "scrollToColumn",
8594
8757
  value: function scrollToColumn(field, position, ifVisible) {
8595
- var _this7 = this;
8758
+ var _this6 = this;
8596
8759
 
8597
8760
  return new Promise(function (resolve, reject) {
8598
- var column = _this7.columnManager.findColumn(field);
8761
+ var column = _this6.columnManager.findColumn(field);
8599
8762
 
8600
8763
  if (column) {
8601
- return _this7.columnManager.scrollToColumn(column, position, ifVisible);
8764
+ return _this6.columnManager.scrollToColumn(column, position, ifVisible);
8602
8765
  } else {
8603
8766
  console.warn("Scroll Error - No matching column found:", field);
8604
8767
  return Promise.reject("Scroll Error - No matching column found");
@@ -9003,7 +9166,7 @@
9003
9166
  _classCallCheck(this, Ajax);
9004
9167
 
9005
9168
  _this = _super.call(this, table);
9006
- _this.config = false; //hold config object for ajax request
9169
+ _this.config = {}; //hold config object for ajax request
9007
9170
 
9008
9171
  _this.url = ""; //request URL
9009
9172
 
@@ -9044,22 +9207,31 @@
9044
9207
  this.loaderPromise = this.table.options.ajaxRequestFunc || Ajax.defaultLoaderPromise;
9045
9208
  this.urlGenerator = this.table.options.ajaxURLGenerator || Ajax.defaultURLGenerator;
9046
9209
 
9047
- if (this.table.options.ajaxParams) {
9048
- this.setParams(this.table.options.ajaxParams);
9049
- }
9050
-
9051
- if (this.table.options.ajaxConfig) {
9052
- this.setConfig(this.table.options.ajaxConfig);
9053
- }
9054
-
9055
9210
  if (this.table.options.ajaxURL) {
9056
9211
  this.setUrl(this.table.options.ajaxURL);
9057
9212
  }
9058
9213
 
9214
+ this.setDefaultConfig(this.table.options.ajaxConfig);
9059
9215
  this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
9060
9216
  this.subscribe("data-loading", this.requestDataCheck.bind(this));
9217
+ this.subscribe("data-params", this.requestParams.bind(this));
9061
9218
  this.subscribe("data-load", this.requestData.bind(this));
9062
9219
  }
9220
+ }, {
9221
+ key: "requestParams",
9222
+ value: function requestParams(data, config, silent, params) {
9223
+ var ajaxParams = this.table.options.ajaxParams;
9224
+
9225
+ if (ajaxParams) {
9226
+ if (typeof ajaxParams === "function") {
9227
+ ajaxParams = ajaxParams.call(this.table);
9228
+ }
9229
+
9230
+ params = Object.assign(params, ajaxParams);
9231
+ }
9232
+
9233
+ return params;
9234
+ }
9063
9235
  }, {
9064
9236
  key: "requestDataCheck",
9065
9237
  value: function requestDataCheck(data, params, config, silent) {
@@ -9067,69 +9239,46 @@
9067
9239
  }
9068
9240
  }, {
9069
9241
  key: "requestData",
9070
- value: function requestData(data, params, config, silent, previousData) {
9071
- if (this.requestDataCheck(data)) {
9072
- if (data) {
9073
- this.setUrl(data);
9074
- }
9242
+ value: function requestData(url, params, config, silent, previousData) {
9243
+ var ajaxConfig;
9075
9244
 
9076
- if (params) {
9077
- this.setParams(params, true);
9245
+ if (!previousData && this.requestDataCheck(url)) {
9246
+ if (url) {
9247
+ this.setUrl(url);
9078
9248
  }
9079
9249
 
9080
- if (config) {
9081
- this.setConfig(config);
9082
- }
9083
-
9084
- return this.sendRequest();
9250
+ ajaxConfig = this.generateConfig(config);
9251
+ return this.sendRequest(this.url, params, ajaxConfig);
9085
9252
  } else {
9086
9253
  return previousData;
9087
9254
  }
9088
- } //set ajax params
9089
-
9255
+ }
9090
9256
  }, {
9091
- key: "setParams",
9092
- value: function setParams(params, update) {
9093
- if (update) {
9094
- this.params = this.params || {};
9257
+ key: "setDefaultConfig",
9258
+ value: function setDefaultConfig() {
9259
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9260
+ this.config = Object.assign({}, Ajax.defaultConfig);
9095
9261
 
9096
- for (var key in params) {
9097
- this.params[key] = params[key];
9098
- }
9262
+ if (typeof config == "string") {
9263
+ this.config.method = config;
9099
9264
  } else {
9100
- this.params = params;
9265
+ Object.assign(this.config, config);
9101
9266
  }
9102
- }
9103
- }, {
9104
- key: "getParams",
9105
- value: function getParams() {
9106
- return this.params || {};
9107
9267
  } //load config object
9108
9268
 
9109
9269
  }, {
9110
- key: "setConfig",
9111
- value: function setConfig(config) {
9112
- this._loadDefaultConfig();
9270
+ key: "generateConfig",
9271
+ value: function generateConfig() {
9272
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9273
+ var ajaxConfig = Object.assign({}, this.config);
9113
9274
 
9114
9275
  if (typeof config == "string") {
9115
- this.config.method = config;
9276
+ ajaxConfig.method = config;
9116
9277
  } else {
9117
- for (var key in config) {
9118
- this.config[key] = config[key];
9119
- }
9278
+ Object.assign(ajaxConfig, config);
9120
9279
  }
9121
- } //create config object from default
9122
-
9123
- }, {
9124
- key: "_loadDefaultConfig",
9125
- value: function _loadDefaultConfig(force) {
9126
- if (!this.config || force) {
9127
- this.config = {}; //load base config from defaults
9128
9280
 
9129
- for (var key in Ajax.defaultConfig) {
9130
- this.config[key] = Ajax.defaultConfig[key];
9131
- }
9132
- }
9281
+ return ajaxConfig;
9133
9282
  } //set request url
9134
9283
 
9135
9284
  }, {
@@ -9146,17 +9295,13 @@
9146
9295
 
9147
9296
  }, {
9148
9297
  key: "sendRequest",
9149
- value: function sendRequest(silent) {
9298
+ value: function sendRequest(url, params, config) {
9150
9299
  var _this2 = this;
9151
9300
 
9152
- var url = this.url;
9153
-
9154
- this._loadDefaultConfig();
9155
-
9156
- if (this.table.options.ajaxRequesting.call(this.table, this.url, this.params) !== false) {
9157
- return this.loaderPromise(url, this.config, this.params).then(function (data) {
9301
+ if (this.table.options.ajaxRequesting.call(this.table, url, params) !== false) {
9302
+ return this.loaderPromise(url, config, params).then(function (data) {
9158
9303
  if (_this2.table.options.ajaxResponse) {
9159
- data = _this2.table.options.ajaxResponse.call(_this2.table, _this2.url, _this2.params, data);
9304
+ data = _this2.table.options.ajaxResponse.call(_this2.table, url, params, data);
9160
9305
  }
9161
9306
 
9162
9307
  return data;
@@ -9752,7 +9897,7 @@
9752
9897
  }, {
9753
9898
  key: "initialize",
9754
9899
  value: function initialize() {
9755
- this.genColumn = new Column$1({
9900
+ this.genColumn = new Column({
9756
9901
  field: "value"
9757
9902
  }, this);
9758
9903
  this.subscribe("cell-value-changed", this.cellValueChanged.bind(this));
@@ -9762,8 +9907,9 @@
9762
9907
  this.subscribe("row-added", this.rowsUpdated.bind(this));
9763
9908
  this.subscribe("column-moved", this.recalcActiveRows.bind(this));
9764
9909
  this.subscribe("column-add", this.recalcActiveRows.bind(this));
9765
- this.subscribe("data-refeshed", this.recalcActiveRows.bind(this));
9910
+ this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
9766
9911
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
9912
+ this.subscribe("rows-visible", this.visibleRows.bind(this));
9767
9913
  this.registerTableFunction("getCalcResults", this.getResults.bind(this));
9768
9914
  this.registerTableFunction("recalc", this.userRecalc.bind(this));
9769
9915
  }
@@ -9787,6 +9933,19 @@
9787
9933
  ///////// Internal Logic //////////
9788
9934
  ///////////////////////////////////
9789
9935
 
9936
+ }, {
9937
+ key: "visibleRows",
9938
+ value: function visibleRows(viewable, rows) {
9939
+ if (this.topRow) {
9940
+ rows.unshift(this.topRow);
9941
+ }
9942
+
9943
+ if (this.botRow) {
9944
+ rows.push(this.botRow);
9945
+ }
9946
+
9947
+ return rows;
9948
+ }
9790
9949
  }, {
9791
9950
  key: "rowsUpdated",
9792
9951
  value: function rowsUpdated(row) {
@@ -10050,7 +10209,7 @@
10050
10209
  data.push(row.getData());
10051
10210
 
10052
10211
  if (_this3.table.options.dataTree && _this3.table.options.dataTreeChildColumnCalcs) {
10053
- if (row.modules.dataTree.open) {
10212
+ if (row.modules.dataTree && row.modules.dataTree.open) {
10054
10213
  var children = _this3.rowsToData(_this3.table.modules.dataTree.getFilteredTreeChildren(row));
10055
10214
 
10056
10215
  data = data.concat(children);
@@ -10297,6 +10456,8 @@
10297
10456
 
10298
10457
  _this.registerComponentFunction("row", "addTreeChild", _this.addTreeChildRow.bind(_assertThisInitialized(_this)));
10299
10458
 
10459
+ _this.registerComponentFunction("row", "isTreeExpanded", _this.isRowExpanded.bind(_assertThisInitialized(_this)));
10460
+
10300
10461
  return _this;
10301
10462
  }
10302
10463
 
@@ -10305,11 +10466,9 @@
10305
10466
  value: function initialize() {
10306
10467
  if (this.table.options.dataTree) {
10307
10468
  var dummyEl = null,
10308
- firstCol = this.table.columnManager.getFirstVisibileColumn(),
10309
10469
  options = this.table.options;
10310
10470
  this.field = options.dataTreeChildField;
10311
10471
  this.indent = options.dataTreeChildIndent;
10312
- this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
10313
10472
 
10314
10473
  if (options.dataTreeBranchElement) {
10315
10474
  if (options.dataTreeBranchElement === true) {
@@ -10378,13 +10537,21 @@
10378
10537
 
10379
10538
  this.subscribe("row-init", this.initializeRow.bind(this));
10380
10539
  this.subscribe("row-layout-after", this.layoutRow.bind(this));
10381
- this.subscribe("row-relayout", this.layoutRow.bind(this));
10382
10540
  this.subscribe("row-deleted", this.rowDelete.bind(this), 0);
10383
10541
  this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
10542
+ this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
10543
+ this.subscribe("edit-cancelled", this.cellValueChanged.bind(this));
10384
10544
  this.subscribe("column-moving-rows", this.columnMoving.bind(this));
10545
+ this.subscribe("table-built", this.initializeElementField.bind(this));
10385
10546
  this.registerDisplayHandler(this.getRows.bind(this), 30);
10386
10547
  }
10387
10548
  }
10549
+ }, {
10550
+ key: "initializeElementField",
10551
+ value: function initializeElementField() {
10552
+ var firstCol = this.table.columnManager.getFirstVisibleColumn();
10553
+ this.elementField = this.table.options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
10554
+ }
10388
10555
  }, {
10389
10556
  key: "getRowChildren",
10390
10557
  value: function getRowChildren(row) {
@@ -10413,6 +10580,15 @@
10413
10580
  }
10414
10581
  }
10415
10582
  }
10583
+ }, {
10584
+ key: "cellValueChanged",
10585
+ value: function cellValueChanged(cell) {
10586
+ var field = cell.column.getField();
10587
+
10588
+ if (field === this.elementField) {
10589
+ this.layoutRow(cell.row);
10590
+ }
10591
+ }
10416
10592
  }, {
10417
10593
  key: "initializeRow",
10418
10594
  value: function initializeRow(row) {
@@ -10662,6 +10838,11 @@
10662
10838
  }
10663
10839
  }
10664
10840
  }
10841
+ }, {
10842
+ key: "isRowExpanded",
10843
+ value: function isRowExpanded(row) {
10844
+ return row.modules.dataTree.open;
10845
+ }
10665
10846
  }, {
10666
10847
  key: "getTreeParent",
10667
10848
  value: function getTreeParent(row) {
@@ -10824,13 +11005,6 @@
10824
11005
 
10825
11006
  return output;
10826
11007
  }
10827
- }, {
10828
- key: "checkForRestyle",
10829
- value: function checkForRestyle(cell) {
10830
- if (!cell.row.cells.indexOf(cell)) {
10831
- this.layoutRow(cell.row);
10832
- }
10833
- }
10834
11008
  }, {
10835
11009
  key: "getChildField",
10836
11010
  value: function getChildField() {
@@ -10927,7 +11101,7 @@
10927
11101
  case "row":
10928
11102
  row.columns.forEach(function (col) {
10929
11103
  if (col) {
10930
- item[col.component.getField()] = col.value;
11104
+ item[col.component.getTitleDownload() || col.component.getField()] = col.value;
10931
11105
  }
10932
11106
  });
10933
11107
  fileContents.push(item);
@@ -11015,8 +11189,6 @@
11015
11189
  }
11016
11190
 
11017
11191
  rowData.push(cell);
11018
- } else {
11019
- rowData.push("");
11020
11192
  }
11021
11193
  });
11022
11194
  return rowData;
@@ -11083,16 +11255,18 @@
11083
11255
  rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value);
11084
11256
 
11085
11257
  if (col.width > 1 || col.height > -1) {
11086
- merges.push({
11087
- s: {
11088
- r: i,
11089
- c: j
11090
- },
11091
- e: {
11092
- r: i + col.height - 1,
11093
- c: j + col.width - 1
11094
- }
11095
- });
11258
+ if (col.height > 1 || col.width > 1) {
11259
+ merges.push({
11260
+ s: {
11261
+ r: i,
11262
+ c: j
11263
+ },
11264
+ e: {
11265
+ r: i + col.height - 1,
11266
+ c: j + col.width - 1
11267
+ }
11268
+ });
11269
+ }
11096
11270
  }
11097
11271
  } else {
11098
11272
  rowData.push("");
@@ -11170,21 +11344,52 @@
11170
11344
  }
11171
11345
  }
11172
11346
 
11173
- var defaultDownloaders = {
11174
- csv: csv,
11175
- json: json,
11176
- pdf: pdf,
11177
- xlsx: xlsx,
11178
- html: html
11179
- };
11180
-
11181
- var Download = /*#__PURE__*/function (_Module) {
11182
- _inherits(Download, _Module);
11347
+ function jsonLines (list, options, setFileContents) {
11348
+ var fileContents = [];
11349
+ list.forEach(function (row) {
11350
+ var item = {};
11183
11351
 
11184
- var _super = _createSuper(Download);
11352
+ switch (row.type) {
11353
+ case "header":
11354
+ break;
11185
11355
 
11186
- function Download(table) {
11187
- var _this;
11356
+ case "group":
11357
+ console.warn("Download Warning - JSON downloader cannot process row groups");
11358
+ break;
11359
+
11360
+ case "calc":
11361
+ console.warn("Download Warning - JSON downloader cannot process column calculations");
11362
+ break;
11363
+
11364
+ case "row":
11365
+ row.columns.forEach(function (col) {
11366
+ if (col) {
11367
+ item[col.component.getTitleDownload() || col.component.getField()] = col.value;
11368
+ }
11369
+ });
11370
+ fileContents.push(JSON.stringify(item));
11371
+ break;
11372
+ }
11373
+ });
11374
+ setFileContents(fileContents.join("\n"), "application/x-ndjson");
11375
+ }
11376
+
11377
+ var defaultDownloaders = {
11378
+ csv: csv,
11379
+ json: json,
11380
+ jsonLines: jsonLines,
11381
+ pdf: pdf,
11382
+ xlsx: xlsx,
11383
+ html: html
11384
+ };
11385
+
11386
+ var Download = /*#__PURE__*/function (_Module) {
11387
+ _inherits(Download, _Module);
11388
+
11389
+ var _super = _createSuper(Download);
11390
+
11391
+ function Download(table) {
11392
+ var _this;
11188
11393
 
11189
11394
  _classCallCheck(this, Download);
11190
11395
 
@@ -13185,13 +13390,13 @@
13185
13390
  this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
13186
13391
  this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
13187
13392
  this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
13188
- this.subscribe("data-refeshing", this.cancelEdit.bind(this));
13189
- this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this));
13393
+ this.subscribe("data-refreshing", this.cancelEdit.bind(this));
13394
+ this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
13190
13395
  this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
13191
- this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this));
13192
- this.subscribe("keybinding-nav-right", this.navigateRight.bind(this));
13193
- this.subscribe("keybinding-nav-up", this.navigateUp.bind(this));
13194
- this.subscribe("keybinding-nav-down", this.navigateDown.bind(this));
13396
+ this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this, undefined));
13397
+ this.subscribe("keybinding-nav-right", this.navigateRight.bind(this, undefined));
13398
+ this.subscribe("keybinding-nav-up", this.navigateUp.bind(this, undefined));
13399
+ this.subscribe("keybinding-nav-down", this.navigateDown.bind(this, undefined));
13195
13400
  } ///////////////////////////////////
13196
13401
  ////// Keybinding Functions ///////
13197
13402
  ///////////////////////////////////
@@ -13203,7 +13408,7 @@
13203
13408
  newRow = this.options("tabEndNewRow");
13204
13409
 
13205
13410
  if (cell) {
13206
- if (!this.navigateNext(e)) {
13411
+ if (!this.navigateNext(cell, e)) {
13207
13412
  if (newRow) {
13208
13413
  cell.getElement().firstChild.blur();
13209
13414
 
@@ -13219,7 +13424,7 @@
13219
13424
 
13220
13425
  newRow.then(function () {
13221
13426
  setTimeout(function () {
13222
- nav.next();
13427
+ cell.getComponent().navigateNext();
13223
13428
  });
13224
13429
  });
13225
13430
  }
@@ -13252,7 +13457,7 @@
13252
13457
  var _this2 = this;
13253
13458
 
13254
13459
  if (!cells) {
13255
- cells = this.modules.edit.getEditedCells();
13460
+ cells = this.table.modules.edit.getEditedCells();
13256
13461
  }
13257
13462
 
13258
13463
  if (!Array.isArray(cells)) {
@@ -13260,15 +13465,15 @@
13260
13465
  }
13261
13466
 
13262
13467
  cells.forEach(function (cell) {
13263
- _this2.modules.edit.clearEdited(cell._getSelf());
13468
+ _this2.table.modules.edit.clearEdited(cell._getSelf());
13264
13469
  });
13265
13470
  }
13266
13471
  }, {
13267
13472
  key: "navigatePrev",
13268
- value: function navigatePrev(e) {
13269
- var cell = this.currentCell,
13270
- nextCell,
13271
- prevRow;
13473
+ value: function navigatePrev() {
13474
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13475
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13476
+ var nextCell, prevRow;
13272
13477
 
13273
13478
  if (cell) {
13274
13479
  if (e) {
@@ -13297,10 +13502,10 @@
13297
13502
  }
13298
13503
  }, {
13299
13504
  key: "navigateNext",
13300
- value: function navigateNext(e) {
13301
- var cell = this.currentCell,
13302
- nextCell,
13303
- nextRow;
13505
+ value: function navigateNext() {
13506
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13507
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13508
+ var nextCell, nextRow;
13304
13509
 
13305
13510
  if (cell) {
13306
13511
  if (e) {
@@ -13329,10 +13534,10 @@
13329
13534
  }
13330
13535
  }, {
13331
13536
  key: "navigateLeft",
13332
- value: function navigateLeft(e) {
13333
- var cell = this.currentCell,
13334
- index,
13335
- nextCell;
13537
+ value: function navigateLeft() {
13538
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13539
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13540
+ var index, nextCell;
13336
13541
 
13337
13542
  if (cell) {
13338
13543
  if (e) {
@@ -13352,10 +13557,10 @@
13352
13557
  }
13353
13558
  }, {
13354
13559
  key: "navigateRight",
13355
- value: function navigateRight(e) {
13356
- var cell = this.currentCell,
13357
- index,
13358
- nextCell;
13560
+ value: function navigateRight() {
13561
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13562
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13563
+ var index, nextCell;
13359
13564
 
13360
13565
  if (cell) {
13361
13566
  if (e) {
@@ -13375,10 +13580,10 @@
13375
13580
  }
13376
13581
  }, {
13377
13582
  key: "navigateUp",
13378
- value: function navigateUp(e) {
13379
- var cell = this.currentCell,
13380
- index,
13381
- nextRow;
13583
+ value: function navigateUp() {
13584
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13585
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13586
+ var index, nextRow;
13382
13587
 
13383
13588
  if (cell) {
13384
13589
  if (e) {
@@ -13398,10 +13603,10 @@
13398
13603
  }
13399
13604
  }, {
13400
13605
  key: "navigateDown",
13401
- value: function navigateDown(e) {
13402
- var cell = this.currentCell,
13403
- index,
13404
- nextRow;
13606
+ value: function navigateDown() {
13607
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13608
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13609
+ var index, nextRow;
13405
13610
 
13406
13611
  if (cell) {
13407
13612
  if (e) {
@@ -13556,8 +13761,8 @@
13556
13761
  cellEl = cell.getElement();
13557
13762
 
13558
13763
  if (cancel) {
13559
- if (cell.validate) {
13560
- cell.validate();
13764
+ if (cell.column.modules.validate && this.table.modExists("validate")) {
13765
+ this.table.modules.validate.cellValidate(cell);
13561
13766
  }
13562
13767
  } else {
13563
13768
  cellEl.classList.remove("tabulator-validation-fail");
@@ -13590,6 +13795,7 @@
13590
13795
  cell.column.definition.cellEditCancelled.call(this.table, component);
13591
13796
  }
13592
13797
 
13798
+ this.dispatch("edit-cancelled", cell);
13593
13799
  this.dispatchExternal("cellEditCancelled", component);
13594
13800
  }
13595
13801
  } //return a formatted value for a cell
@@ -13726,10 +13932,6 @@
13726
13932
 
13727
13933
  cell.setValue(value, true);
13728
13934
 
13729
- if (self.table.options.dataTree && self.table.modExists("dataTree")) {
13730
- self.table.modules.dataTree.checkForRestyle(cell);
13731
- }
13732
-
13733
13935
  if (valid !== true) {
13734
13936
  element.classList.add("tabulator-validation-fail");
13735
13937
  self.table.externalEvents.dispatch("validationFailed", cell.getComponent(), value, valid);
@@ -13752,10 +13954,6 @@
13752
13954
  function cancel() {
13753
13955
  if (self.currentCell === cell) {
13754
13956
  self.cancelEdit();
13755
-
13756
- if (self.table.options.dataTree && self.table.modExists("dataTree")) {
13757
- self.table.modules.dataTree.checkForRestyle(cell);
13758
- }
13759
13957
  }
13760
13958
  }
13761
13959
 
@@ -13969,7 +14167,7 @@
13969
14167
  switch (range) {
13970
14168
  case true:
13971
14169
  case "visible":
13972
- rows = this.table.rowManager.getVisibleRows(true);
14170
+ rows = this.table.rowManager.getVisibleRows(false, true);
13973
14171
  break;
13974
14172
 
13975
14173
  case "all":
@@ -15025,7 +15223,7 @@
15025
15223
  }
15026
15224
  };
15027
15225
  params = column.definition.headerFilterParams || {};
15028
- params = typeof params === "function" ? params.call(self.table) : params;
15226
+ params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
15029
15227
  editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params);
15030
15228
 
15031
15229
  if (!editorElement) {
@@ -15740,7 +15938,7 @@
15740
15938
  var value = cell.getValue();
15741
15939
 
15742
15940
  if (typeof DT != "undefined") {
15743
- var newDatetime = DT.fromFormat(String(value), inputFormat);
15941
+ var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
15744
15942
 
15745
15943
  if (newDatetime.isValid) {
15746
15944
  if (formatterParams.timezone) {
@@ -15773,7 +15971,7 @@
15773
15971
  var value = cell.getValue();
15774
15972
 
15775
15973
  if (typeof DT != "undefined") {
15776
- var newDatetime = DT.fromFormat(String(value), inputFormat);
15974
+ var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
15777
15975
 
15778
15976
  if (newDatetime.isValid) {
15779
15977
  if (humanize) ; else {
@@ -16408,7 +16606,7 @@
16408
16606
  this.subscribe("cell-layout", this.layoutCell.bind(this));
16409
16607
  this.subscribe("column-init", this.initializeColumn.bind(this));
16410
16608
  this.subscribe("column-width", this.layout.bind(this));
16411
- this.subscribe("row-layout-before", this.layoutRow.bind(this));
16609
+ this.subscribe("row-layout-after", this.layoutRow.bind(this));
16412
16610
  this.subscribe("table-layout", this.layout.bind(this));
16413
16611
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
16414
16612
  this.subscribe("columns-loading", this.reset.bind(this));
@@ -16704,6 +16902,7 @@
16704
16902
 
16705
16903
  this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
16706
16904
  this.subscribe("row-deleting", this.detachRow.bind(this));
16905
+ this.subscribe("rows-visible", this.visibleRows.bind(this));
16707
16906
  this.registerDisplayHandler(this.getRows.bind(this), 10);
16708
16907
  }
16709
16908
  }, {
@@ -16716,6 +16915,14 @@
16716
16915
  key: "isFrozen",
16717
16916
  value: function isFrozen() {
16718
16917
  return !!this.rows.length;
16918
+ }
16919
+ }, {
16920
+ key: "visibleRows",
16921
+ value: function visibleRows(viewable, rows) {
16922
+ this.rows.forEach(function (row) {
16923
+ rows.push(row);
16924
+ });
16925
+ return rows;
16719
16926
  } //filter frozen rows out of display data
16720
16927
 
16721
16928
  }, {
@@ -16808,7 +17015,7 @@
16808
17015
  if (typeof target[name] !== "undefined") {
16809
17016
  return target[name];
16810
17017
  } else {
16811
- return target._group.table.componentFunctionBinder.handle("row", target._group, name);
17018
+ return target._group.groupManager.table.componentFunctionBinder.handle("row", target._group, name);
16812
17019
  }
16813
17020
  }
16814
17021
  });
@@ -16897,6 +17104,7 @@
16897
17104
  this.groups = [];
16898
17105
  this.groupList = [];
16899
17106
  this.generator = generator;
17107
+ this.element = false;
16900
17108
  this.elementContents = false;
16901
17109
  this.height = 0;
16902
17110
  this.outerHeight = 0;
@@ -16967,64 +17175,7 @@
16967
17175
  value: function addBindings() {
16968
17176
  var _this2 = this;
16969
17177
 
16970
- var dblTap, tapHold, tap, toggleElement;
16971
-
16972
- if ((this.groupManager.table.options.groupContextMenu || this.groupManager.table.options.groupClickMenu) && this.groupManager.table.modExists("menu")) {
16973
- this.groupManager.table.modules.menu.initializeGroup.call(this.groupManager.table.modules.menu, this);
16974
- }
16975
-
16976
- if (this.groupManager.table.options.groupTap) {
16977
- tap = false;
16978
- this.element.addEventListener("touchstart", function (e) {
16979
- tap = true;
16980
- }, {
16981
- passive: true
16982
- });
16983
- this.element.addEventListener("touchend", function (e) {
16984
- if (tap) {
16985
- _this2.groupManager.table.options.groupTap(e, _this2.getComponent());
16986
- }
16987
-
16988
- tap = false;
16989
- });
16990
- }
16991
-
16992
- if (this.groupManager.table.options.groupDblTap) {
16993
- dblTap = null;
16994
- this.element.addEventListener("touchend", function (e) {
16995
- if (dblTap) {
16996
- clearTimeout(dblTap);
16997
- dblTap = null;
16998
-
16999
- _this2.groupManager.table.options.groupDblTap(e, _this2.getComponent());
17000
- } else {
17001
- dblTap = setTimeout(function () {
17002
- clearTimeout(dblTap);
17003
- dblTap = null;
17004
- }, 300);
17005
- }
17006
- });
17007
- }
17008
-
17009
- if (this.groupManager.table.options.groupTapHold) {
17010
- tapHold = null;
17011
- this.element.addEventListener("touchstart", function (e) {
17012
- clearTimeout(tapHold);
17013
- tapHold = setTimeout(function () {
17014
- clearTimeout(tapHold);
17015
- tapHold = null;
17016
- tap = false;
17017
-
17018
- _this2.groupManager.table.options.groupTapHold(e, _this2.getComponent());
17019
- }, 1000);
17020
- }, {
17021
- passive: true
17022
- });
17023
- this.element.addEventListener("touchend", function (e) {
17024
- clearTimeout(tapHold);
17025
- tapHold = null;
17026
- });
17027
- }
17178
+ var toggleElement;
17028
17179
 
17029
17180
  if (this.groupManager.table.options.groupToggleElement) {
17030
17181
  toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
@@ -17326,7 +17477,7 @@
17326
17477
 
17327
17478
  if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) {
17328
17479
  this.element.classList.add("tabulator-group-visible");
17329
- var prev = this.getElement();
17480
+ var prev = this.generateElement();
17330
17481
 
17331
17482
  if (this.groupList.length) {
17332
17483
  this.groupList.forEach(function (group) {
@@ -17445,7 +17596,12 @@
17445
17596
  }, {
17446
17597
  key: "getElement",
17447
17598
  value: function getElement() {
17448
- this.addBindingsd = false;
17599
+ return this.elementContents ? this.element : this.generateElement();
17600
+ }
17601
+ }, {
17602
+ key: "generateElement",
17603
+ value: function generateElement() {
17604
+ this.addBindings = false;
17449
17605
 
17450
17606
  this._visSet();
17451
17607
 
@@ -17621,13 +17777,12 @@
17621
17777
  key: "initialize",
17622
17778
  value: function initialize() {
17623
17779
  if (this.table.options.groupBy) {
17624
- this.configureGroupSetup();
17625
-
17626
17780
  if (this.table.options.groupUpdateOnCellEdit) {
17627
17781
  this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
17628
17782
  this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
17629
17783
  }
17630
17784
 
17785
+ this.subscribe("table-built", this.configureGroupSetup.bind(this));
17631
17786
  this.subscribe("row-deleting", this.rowDeleting.bind(this));
17632
17787
  this.subscribe("row-deleted", this.rowsUpdated.bind(this));
17633
17788
  this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
@@ -18579,6 +18734,279 @@
18579
18734
 
18580
18735
  HtmlTableImport.moduleName = "htmlTableImport";
18581
18736
 
18737
+ function csvImporter(input) {
18738
+ var data = [],
18739
+ row = 0,
18740
+ col = 0,
18741
+ inQuote = false; //Iterate over each character
18742
+
18743
+ for (var index = 0; index < input.length; index++) {
18744
+ var _char = input[index],
18745
+ nextChar = input[index + 1]; //Initialize empty row
18746
+
18747
+ if (!data[row]) {
18748
+ data[row] = [];
18749
+ } //Initialize empty column
18750
+
18751
+
18752
+ if (!data[row][col]) {
18753
+ data[row][col] = "";
18754
+ } //Handle quotation mark inside string
18755
+
18756
+
18757
+ if (_char == '"' && inQuote && nextChar == '"') {
18758
+ data[row][col] += _char;
18759
+ index++;
18760
+ continue;
18761
+ } //Begin / End Quote
18762
+
18763
+
18764
+ if (_char == '"') {
18765
+ inQuote = !inQuote;
18766
+ continue;
18767
+ } //Next column (if not in quote)
18768
+
18769
+
18770
+ if (_char == ',' && !inQuote) {
18771
+ col++;
18772
+ continue;
18773
+ } //New row if new line and not in quote (CRLF)
18774
+
18775
+
18776
+ if (_char == '\r' && nextChar == '\n' && !inQuote) {
18777
+ col = 0;
18778
+ row++;
18779
+ index++;
18780
+ continue;
18781
+ } //New row if new line and not in quote (CR or LF)
18782
+
18783
+
18784
+ if ((_char == '\r' || _char == '\n') && !inQuote) {
18785
+ col = 0;
18786
+ row++;
18787
+ continue;
18788
+ } //Normal Character, append to column
18789
+
18790
+
18791
+ data[row][col] += _char;
18792
+ }
18793
+
18794
+ return data;
18795
+ }
18796
+
18797
+ function json$1 (input) {
18798
+ try {
18799
+ return JSON.parse(input);
18800
+ } catch (e) {
18801
+ console.warn("JSON Import Error - File contents is invalid JSON", e);
18802
+ return Promise.reject();
18803
+ }
18804
+ }
18805
+
18806
+ var defaultImporters = {
18807
+ csv: csvImporter,
18808
+ json: json$1
18809
+ };
18810
+
18811
+ var Import = /*#__PURE__*/function (_Module) {
18812
+ _inherits(Import, _Module);
18813
+
18814
+ var _super = _createSuper(Import);
18815
+
18816
+ function Import(table) {
18817
+ var _this;
18818
+
18819
+ _classCallCheck(this, Import);
18820
+
18821
+ _this = _super.call(this, table);
18822
+
18823
+ _this.registerTableOption("importFormat");
18824
+
18825
+ _this.registerTableOption("importReader", "text");
18826
+
18827
+ return _this;
18828
+ }
18829
+
18830
+ _createClass(Import, [{
18831
+ key: "initialize",
18832
+ value: function initialize() {
18833
+ this.registerTableFunction("import", this.importFromFile.bind(this));
18834
+
18835
+ if (this.table.options.importFormat) {
18836
+ this.subscribe("data-loading", this.loadDataCheck.bind(this), 10);
18837
+ this.subscribe("data-load", this.loadData.bind(this), 10);
18838
+ }
18839
+ }
18840
+ }, {
18841
+ key: "loadDataCheck",
18842
+ value: function loadDataCheck(data) {
18843
+ return typeof data === "string";
18844
+ }
18845
+ }, {
18846
+ key: "loadData",
18847
+ value: function loadData(data, params, config, silent, previousData) {
18848
+ return this.importData(this.lookupImporter(), data).then(this.structureData.bind(this))["catch"](function (err) {
18849
+ console.error("Import Error:", err || "Unable to import data");
18850
+ return Promise.reject(err);
18851
+ });
18852
+ }
18853
+ }, {
18854
+ key: "lookupImporter",
18855
+ value: function lookupImporter(importFormat) {
18856
+ var importer;
18857
+
18858
+ if (!importFormat) {
18859
+ importFormat = this.table.options.importFormat;
18860
+ }
18861
+
18862
+ if (typeof importFormat === "string") {
18863
+ importer = Import.importers[importFormat];
18864
+ } else {
18865
+ importer = importFormat;
18866
+ }
18867
+
18868
+ if (!importer) {
18869
+ console.error("Import Error - Importer not found:", importFormat);
18870
+ }
18871
+
18872
+ return importer;
18873
+ }
18874
+ }, {
18875
+ key: "importFromFile",
18876
+ value: function importFromFile(importFormat, extension) {
18877
+ var importer = this.lookupImporter(importFormat);
18878
+
18879
+ if (importer) {
18880
+ return this.pickFile(extension).then(this.importData.bind(this, importer)).then(this.structureData.bind(this)).then(this.setData.bind(this))["catch"](function (err) {
18881
+ console.error("Import Error:", err || "Unable to import file");
18882
+ return Promise.reject(err);
18883
+ });
18884
+ }
18885
+ }
18886
+ }, {
18887
+ key: "pickFile",
18888
+ value: function pickFile(extensions) {
18889
+ var _this2 = this;
18890
+
18891
+ return new Promise(function (resolve, reject) {
18892
+ var input = document.createElement("input");
18893
+ input.type = "file";
18894
+ input.accept = extensions;
18895
+ input.addEventListener("change", function (e) {
18896
+ var file = input.files[0],
18897
+ reader = new FileReader();
18898
+
18899
+ switch (_this2.table.options.importReader) {
18900
+ case "buffer":
18901
+ reader.readAsArrayBuffer(file);
18902
+ break;
18903
+
18904
+ case "binary":
18905
+ reader.readAsBinaryString(file);
18906
+ break;
18907
+
18908
+ case "url":
18909
+ reader.readAsDataURL(file);
18910
+ break;
18911
+
18912
+ case "text":
18913
+ default:
18914
+ reader.readAsText(file);
18915
+ }
18916
+
18917
+ reader.onload = function (e) {
18918
+ resolve(reader.result);
18919
+ };
18920
+
18921
+ reader.onerror = function (e) {
18922
+ console.warn("File Load Error - Unable to read file");
18923
+ reject();
18924
+ };
18925
+ });
18926
+ input.click();
18927
+ });
18928
+ }
18929
+ }, {
18930
+ key: "importData",
18931
+ value: function importData(importer, fileContents) {
18932
+ var data = importer.call(this.table, fileContents);
18933
+
18934
+ if (data instanceof Promise) {
18935
+ return data;
18936
+ } else {
18937
+ return data ? Promise.resolve(data) : Promise.reject();
18938
+ }
18939
+ }
18940
+ }, {
18941
+ key: "structureData",
18942
+ value: function structureData(parsedData) {
18943
+ var data = [];
18944
+
18945
+ if (Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])) {
18946
+ if (this.table.options.autoColumns) {
18947
+ data = this.structureArrayToObject(parsedData);
18948
+ } else {
18949
+ data = this.structureArrayToColumns(parsedData);
18950
+ }
18951
+
18952
+ return data;
18953
+ } else {
18954
+ return parsedData;
18955
+ }
18956
+ }
18957
+ }, {
18958
+ key: "structureArrayToObject",
18959
+ value: function structureArrayToObject(parsedData) {
18960
+ var columns = parsedData.shift();
18961
+ var data = parsedData.map(function (values) {
18962
+ var row = {};
18963
+ columns.forEach(function (key, i) {
18964
+ row[key] = values[i];
18965
+ });
18966
+ return row;
18967
+ });
18968
+ return data;
18969
+ }
18970
+ }, {
18971
+ key: "structureArrayToColumns",
18972
+ value: function structureArrayToColumns(parsedData) {
18973
+ var data = [],
18974
+ columns = this.table.getColumns(); //remove first row if it is the column names
18975
+
18976
+ if (columns[0] && parsedData[0][0]) {
18977
+ if (columns[0].getDefinition().title === parsedData[0][0]) {
18978
+ parsedData.shift();
18979
+ }
18980
+ } //convert row arrays to objects
18981
+
18982
+
18983
+ parsedData.forEach(function (rowData) {
18984
+ var row = {};
18985
+ rowData.forEach(function (value, index) {
18986
+ var column = columns[index];
18987
+
18988
+ if (column) {
18989
+ row[column.getField()] = value;
18990
+ }
18991
+ });
18992
+ data.push(row);
18993
+ });
18994
+ return data;
18995
+ }
18996
+ }, {
18997
+ key: "setData",
18998
+ value: function setData(data) {
18999
+ return this.table.setData(data);
19000
+ }
19001
+ }]);
19002
+
19003
+ return Import;
19004
+ }(Module);
19005
+
19006
+ Import.moduleName = "import"; //load defaults
19007
+
19008
+ Import.importers = defaultImporters;
19009
+
18582
19010
  var Interaction = /*#__PURE__*/function (_Module) {
18583
19011
  _inherits(Interaction, _Module);
18584
19012
 
@@ -18658,6 +19086,11 @@
18658
19086
  tap: null,
18659
19087
  tapDbl: null,
18660
19088
  tapHold: null
19089
+ },
19090
+ group: {
19091
+ tap: null,
19092
+ tapDbl: null,
19093
+ tapHold: null
18661
19094
  }
18662
19095
  };
18663
19096
 
@@ -18889,7 +19322,7 @@
18889
19322
  if (this.columnSubscribers[action]) {
18890
19323
  if (component instanceof Cell) {
18891
19324
  callback = component.column.definition[action];
18892
- } else if (component instanceof Column$1) {
19325
+ } else if (component instanceof Column) {
18893
19326
  callback = component.definition[action];
18894
19327
  }
18895
19328
 
@@ -18916,9 +19349,9 @@
18916
19349
  scrollPageDown: 34,
18917
19350
  scrollToStart: 36,
18918
19351
  scrollToEnd: 35,
18919
- undo: "ctrl + 90",
18920
- redo: "ctrl + 89",
18921
- copyToClipboard: "ctrl + 67"
19352
+ undo: ["ctrl + 90", "meta + 90"],
19353
+ redo: ["ctrl + 89", "meta + 89"],
19354
+ copyToClipboard: ["ctrl + 67", "meta + 89"]
18922
19355
  };
18923
19356
 
18924
19357
  var defaultActions = {
@@ -19045,7 +19478,7 @@
19045
19478
  _this.keyupBinding = false;
19046
19479
  _this.keydownBinding = false;
19047
19480
 
19048
- _this.registerTableOption("keybindings", []); //array for keybindings
19481
+ _this.registerTableOption("keybindings", {}); //array for keybindings
19049
19482
 
19050
19483
 
19051
19484
  _this.registerTableOption("tabEndNewRow", false); //create new row when tab to end of table
@@ -19063,16 +19496,8 @@
19063
19496
  this.pressedKeys = [];
19064
19497
 
19065
19498
  if (bindings !== false) {
19066
- for (var key in Keybindings.bindings) {
19067
- mergedBindings[key] = Keybindings.bindings[key];
19068
- }
19069
-
19070
- if (Object.keys(bindings).length) {
19071
- for (var _key in bindings) {
19072
- mergedBindings[_key] = bindings[_key];
19073
- }
19074
- }
19075
-
19499
+ Object.assign(mergedBindings, Keybindings.bindings);
19500
+ Object.assign(mergedBindings, bindings);
19076
19501
  this.mapBindings(mergedBindings);
19077
19502
  this.bindEvents();
19078
19503
  }
@@ -19092,7 +19517,10 @@
19092
19517
  }
19093
19518
 
19094
19519
  bindings[key].forEach(function (binding) {
19095
- _this2.mapBinding(key, binding);
19520
+ var bindingList = Array.isArray(binding) ? binding : [binding];
19521
+ bindingList.forEach(function (item) {
19522
+ _this2.mapBinding(key, item);
19523
+ });
19096
19524
  });
19097
19525
  }
19098
19526
  } else {
@@ -19132,7 +19560,7 @@
19132
19560
  break;
19133
19561
 
19134
19562
  default:
19135
- symbol = parseInt(symbol);
19563
+ symbol = isNaN(symbol) ? symbol.toUpperCase().charCodeAt(0) : parseInt(symbol);
19136
19564
  binding.keys.push(symbol);
19137
19565
 
19138
19566
  if (!_this3.watchKeys[symbol]) {
@@ -19234,11 +19662,14 @@
19234
19662
  _classCallCheck(this, Menu);
19235
19663
 
19236
19664
  _this = _super.call(this, table);
19665
+ _this.menuContainer = null;
19237
19666
  _this.menuElements = [];
19238
19667
  _this.blurEvent = _this.hideMenu.bind(_assertThisInitialized(_this));
19239
19668
  _this.escEvent = _this.escMenu.bind(_assertThisInitialized(_this));
19240
19669
  _this.nestedMenuBlock = false;
19241
19670
  _this.positionReversedX = false;
19671
+ _this.currentComponent = null;
19672
+ _this.columnSubscribers = {};
19242
19673
 
19243
19674
  _this.registerTableOption("rowContextMenu", false);
19244
19675
 
@@ -19248,8 +19679,12 @@
19248
19679
 
19249
19680
  _this.registerTableOption("groupClickMenu", false);
19250
19681
 
19682
+ _this.registerTableOption("menuContainer", false);
19683
+
19251
19684
  _this.registerColumnOption("headerContextMenu");
19252
19685
 
19686
+ _this.registerColumnOption("headerClickMenu");
19687
+
19253
19688
  _this.registerColumnOption("headerMenu");
19254
19689
 
19255
19690
  _this.registerColumnOption("contextMenu");
@@ -19262,133 +19697,157 @@
19262
19697
  _createClass(Menu, [{
19263
19698
  key: "initialize",
19264
19699
  value: function initialize() {
19265
- this.subscribe("cell-layout", this.layoutCell.bind(this));
19700
+ this.lookupMenuContainer();
19701
+ this.initializeRowWatchers();
19702
+ this.initializeGroupWatchers();
19266
19703
  this.subscribe("column-init", this.initializeColumn.bind(this));
19267
- this.subscribe("row-init", this.initializeRow.bind(this));
19268
19704
  }
19269
19705
  }, {
19270
- key: "layoutCell",
19271
- value: function layoutCell(cell) {
19272
- if (cell.column.definition.contextMenu || cell.column.definition.clickMenu) {
19273
- this.initializeCell(cell);
19706
+ key: "lookupMenuContainer",
19707
+ value: function lookupMenuContainer() {
19708
+ this.menuContainer = this.table.options.menuContainer;
19709
+
19710
+ if (typeof this.menuContainer === "string") {
19711
+ this.menuContainer = document.querySelector(this.menuContainer);
19712
+
19713
+ if (!this.menuContainer) {
19714
+ console.warn("Menu Error - no container element found matching selector:", this.table.options.menuContainer, "(defaulting to document body)");
19715
+ }
19716
+ } else if (this.menuContainer === true) {
19717
+ this.menuContainer = this.table.element;
19718
+ }
19719
+
19720
+ if (this.menuContainer && !this.checkMenuContainerIsParent(this.menuContainer)) {
19721
+ this.menuContainer = false;
19722
+ console.warn("Menu Error - container element does not contain this table:", this.table.options.menuContainer, "(defaulting to document body)");
19723
+ }
19724
+
19725
+ if (!this.menuContainer) {
19726
+ this.menuContainer = document.body;
19274
19727
  }
19275
19728
  }
19276
19729
  }, {
19277
- key: "initializeColumn",
19278
- value: function initializeColumn(column) {
19279
- var def = column.definition;
19730
+ key: "checkMenuContainerIsParent",
19731
+ value: function checkMenuContainerIsParent(container) {
19732
+ var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.table.element;
19733
+
19734
+ if (container === element) {
19735
+ return true;
19736
+ } else {
19737
+ return element.parentNode ? this.checkMenuContainerIsParent(container, element.parentNode) : false;
19738
+ }
19739
+ }
19740
+ }, {
19741
+ key: "initializeRowWatchers",
19742
+ value: function initializeRowWatchers() {
19743
+ if (this.table.options.rowContextMenu) {
19744
+ this.subscribe("row-contextmenu", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
19745
+ this.table.on("rowTapHold", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
19746
+ }
19280
19747
 
19281
- if (def.headerContextMenu || def.headerClickMenu || def.headerMenu) {
19282
- this.initializeColumnHeader(column);
19748
+ if (this.table.options.rowClickMenu) {
19749
+ this.subscribe("row-click", this.loadMenuEvent.bind(this, this.table.options.rowClickMenu));
19283
19750
  }
19284
19751
  }
19285
19752
  }, {
19286
- key: "initializeColumnHeader",
19287
- value: function initializeColumnHeader(column) {
19288
- var _this2 = this;
19753
+ key: "initializeGroupWatchers",
19754
+ value: function initializeGroupWatchers() {
19755
+ if (this.table.options.groupContextMenu) {
19756
+ this.subscribe("group-contextmenu", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
19757
+ this.table.on("groupTapHold", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
19758
+ }
19289
19759
 
19290
- var headerMenuEl;
19760
+ if (this.table.options.groupClickMenu) {
19761
+ this.subscribe("group-click", this.loadMenuEvent.bind(this, this.table.options.groupClickMenu));
19762
+ }
19763
+ }
19764
+ }, {
19765
+ key: "initializeColumn",
19766
+ value: function initializeColumn(column) {
19767
+ var def = column.definition; //handle column events
19291
19768
 
19292
- if (column.definition.headerContextMenu) {
19293
- column.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, column, column.definition.headerContextMenu));
19294
- this.tapHold(column, column.definition.headerContextMenu);
19295
- } // if(column.definition.headerClickMenu){
19296
- // column.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, column, column.definition.headerClickMenu));
19297
- // }
19769
+ if (def.headerContextMenu && !this.columnSubscribers.headerContextMenu) {
19770
+ this.columnSubscribers.headerContextMenu = this.loadMenuTableColumnEvent.bind(this, "headerContextMenu");
19771
+ this.subscribe("column-contextmenu", this.columnSubscribers.headerContextMenu);
19772
+ this.table.on("headerTapHold", this.loadMenuTableColumnEvent.bind(this, "headerContextMenu"));
19773
+ }
19298
19774
 
19775
+ if (def.headerClickMenu && !this.columnSubscribers.headerClickMenu) {
19776
+ this.columnSubscribers.headerClickMenu = this.loadMenuTableColumnEvent.bind(this, "headerClickMenu");
19777
+ this.subscribe("column-click", this.columnSubscribers.headerClickMenu);
19778
+ }
19299
19779
 
19300
- if (column.definition.headerMenu) {
19301
- headerMenuEl = document.createElement("span");
19302
- headerMenuEl.classList.add("tabulator-header-menu-button");
19303
- headerMenuEl.innerHTML = "&vellip;";
19304
- headerMenuEl.addEventListener("click", function (e) {
19305
- e.stopPropagation();
19306
- e.preventDefault();
19780
+ if (def.headerMenu) {
19781
+ this.initializeColumnHeaderMenu(column);
19782
+ } //handle cell events
19307
19783
 
19308
- _this2.LoadMenuEvent(column, column.definition.headerMenu, e);
19309
- });
19310
- column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild);
19784
+
19785
+ if (def.contextMenu && !this.columnSubscribers.contextMenu) {
19786
+ this.columnSubscribers.contextMenu = this.loadMenuTableCellEvent.bind(this, "contextMenu");
19787
+ this.subscribe("cell-contextmenu", this.columnSubscribers.contextMenu);
19788
+ this.table.on("cellTapHold", this.loadMenuTableCellEvent.bind(this, "contextMenu"));
19311
19789
  }
19312
- }
19313
- }, {
19314
- key: "LoadMenuEvent",
19315
- value: function LoadMenuEvent(component, menu, e) {
19316
- menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu; // if(component instanceof Cell){
19317
- // e.stopImmediatePropagation();
19318
- // }
19319
19790
 
19320
- this.loadMenu(e, component, menu);
19791
+ if (def.clickMenu && !this.columnSubscribers.clickMenu) {
19792
+ this.columnSubscribers.clickMenu = this.loadMenuTableCellEvent.bind(this, "clickMenu");
19793
+ this.subscribe("cell-click", this.columnSubscribers.clickMenu);
19794
+ }
19321
19795
  }
19322
19796
  }, {
19323
- key: "tapHold",
19324
- value: function tapHold(component, menu) {
19325
- var _this3 = this;
19326
-
19327
- var element = component.getElement(),
19328
- tapHold = null,
19329
- loaded = false;
19330
- element.addEventListener("touchstart", function (e) {
19331
- clearTimeout(tapHold);
19332
- loaded = false;
19333
- tapHold = setTimeout(function () {
19334
- clearTimeout(tapHold);
19335
- tapHold = null;
19336
- loaded = true;
19797
+ key: "initializeColumnHeaderMenu",
19798
+ value: function initializeColumnHeaderMenu(column) {
19799
+ var _this2 = this;
19337
19800
 
19338
- _this3.LoadMenuEvent(component, menu, e);
19339
- }, 1000);
19340
- }, {
19341
- passive: true
19342
- });
19343
- element.addEventListener("touchend", function (e) {
19344
- clearTimeout(tapHold);
19345
- tapHold = null;
19801
+ var headerMenuEl;
19802
+ headerMenuEl = document.createElement("span");
19803
+ headerMenuEl.classList.add("tabulator-header-menu-button");
19804
+ headerMenuEl.innerHTML = "&vellip;";
19805
+ headerMenuEl.addEventListener("click", function (e) {
19806
+ e.stopPropagation();
19807
+ e.preventDefault();
19346
19808
 
19347
- if (loaded) {
19348
- e.preventDefault();
19349
- }
19809
+ _this2.loadMenuEvent(column.definition.headerMenu, e, column);
19350
19810
  });
19811
+ column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild);
19351
19812
  }
19352
19813
  }, {
19353
- key: "initializeCell",
19354
- value: function initializeCell(cell) {
19355
- if (cell.column.definition.contextMenu) {
19356
- cell.getElement(true).addEventListener("contextmenu", this.LoadMenuEvent.bind(this, cell, cell.column.definition.contextMenu));
19357
- this.tapHold(cell, cell.column.definition.contextMenu);
19814
+ key: "loadMenuTableCellEvent",
19815
+ value: function loadMenuTableCellEvent(option, e, cell) {
19816
+ if (cell._cell) {
19817
+ cell = cell._cell;
19358
19818
  }
19359
19819
 
19360
- if (cell.column.definition.clickMenu) {
19361
- cell.getElement(true).addEventListener("click", this.LoadMenuEvent.bind(this, cell, cell.column.definition.clickMenu));
19820
+ if (cell.column.definition[option]) {
19821
+ this.loadMenuEvent(cell.column.definition[option], e, cell);
19362
19822
  }
19363
19823
  }
19364
19824
  }, {
19365
- key: "initializeRow",
19366
- value: function initializeRow(row) {
19367
- if (this.table.options.rowContextMenu) {
19368
- row.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, row, this.table.options.rowContextMenu));
19369
- this.tapHold(row, this.table.options.rowContextMenu);
19825
+ key: "loadMenuTableColumnEvent",
19826
+ value: function loadMenuTableColumnEvent(option, e, column) {
19827
+ if (column._column) {
19828
+ column = column._column;
19370
19829
  }
19371
19830
 
19372
- if (this.table.options.rowClickMenu) {
19373
- row.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, row, this.table.options.rowClickMenu));
19831
+ if (column.definition[option]) {
19832
+ this.loadMenuEvent(column.definition[option], e, column);
19374
19833
  }
19375
19834
  }
19376
19835
  }, {
19377
- key: "initializeGroup",
19378
- value: function initializeGroup(group) {
19379
- if (this.table.options.groupContextMenu) {
19380
- group.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, group, this.table.options.groupContextMenu));
19381
- this.tapHold(group, this.table.options.groupContextMenu);
19836
+ key: "loadMenuEvent",
19837
+ value: function loadMenuEvent(menu, e, component) {
19838
+ if (component._group) {
19839
+ component = component._group;
19840
+ } else if (component._row) {
19841
+ component = component._row;
19382
19842
  }
19383
19843
 
19384
- if (this.table.options.groupClickMenu) {
19385
- group.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, group, this.table.options.groupClickMenu));
19386
- }
19844
+ menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu;
19845
+ this.loadMenu(e, component, menu);
19387
19846
  }
19388
19847
  }, {
19389
19848
  key: "loadMenu",
19390
19849
  value: function loadMenu(e, component, menu, parentEl) {
19391
- var _this4 = this;
19850
+ var _this3 = this;
19392
19851
 
19393
19852
  var touch = !(e instanceof MouseEvent);
19394
19853
  var menuEl = document.createElement("div");
@@ -19411,7 +19870,7 @@
19411
19870
  }
19412
19871
  } else {
19413
19872
  this.nestedMenuBlock = setTimeout(function () {
19414
- _this4.nestedMenuBlock = false;
19873
+ _this3.nestedMenuBlock = false;
19415
19874
  }, 100);
19416
19875
  }
19417
19876
 
@@ -19430,7 +19889,7 @@
19430
19889
  itemEl.classList.add("tabulator-menu-item");
19431
19890
 
19432
19891
  if (typeof label == "function") {
19433
- label = label.call(_this4.table, component.getComponent());
19892
+ label = label.call(_this3.table, component.getComponent());
19434
19893
  }
19435
19894
 
19436
19895
  if (label instanceof Node) {
@@ -19440,7 +19899,7 @@
19440
19899
  }
19441
19900
 
19442
19901
  if (typeof disabled == "function") {
19443
- disabled = disabled.call(_this4.table, component.getComponent());
19902
+ disabled = disabled.call(_this3.table, component.getComponent());
19444
19903
  }
19445
19904
 
19446
19905
  if (disabled) {
@@ -19453,9 +19912,9 @@
19453
19912
  itemEl.addEventListener("click", function (e) {
19454
19913
  e.stopPropagation();
19455
19914
 
19456
- _this4.hideOldSubMenus(menuEl);
19915
+ _this3.hideOldSubMenus(menuEl);
19457
19916
 
19458
- _this4.loadMenu(e, component, item.menu, itemEl);
19917
+ _this3.loadMenu(e, component, item.menu, itemEl);
19459
19918
  });
19460
19919
  } else {
19461
19920
  if (item.action) {
@@ -19474,10 +19933,12 @@
19474
19933
  menuEl.appendChild(itemEl);
19475
19934
  });
19476
19935
  menuEl.addEventListener("click", function (e) {
19477
- _this4.hideMenu();
19936
+ _this3.hideMenu();
19478
19937
  });
19479
19938
  this.menuElements.push(menuEl);
19480
19939
  this.positionMenu(menuEl, parentEl, touch, e);
19940
+ this.currentComponent = component;
19941
+ this.dispatchExternal("menuOpened", component.getComponent());
19481
19942
  }
19482
19943
  }, {
19483
19944
  key: "hideOldSubMenus",
@@ -19499,16 +19960,20 @@
19499
19960
  }, {
19500
19961
  key: "positionMenu",
19501
19962
  value: function positionMenu(element, parentEl, touch, e) {
19502
- var _this5 = this;
19963
+ var _this4 = this;
19503
19964
 
19504
- var docHeight = Math.max(document.body.offsetHeight, window.innerHeight),
19505
- x,
19506
- y,
19507
- parentOffset;
19965
+ var x, y, parentOffset;
19508
19966
 
19509
19967
  if (!parentEl) {
19510
19968
  x = touch ? e.touches[0].pageX : e.pageX;
19511
19969
  y = touch ? e.touches[0].pageY : e.pageY;
19970
+
19971
+ if (this.menuContainer !== document.body) {
19972
+ parentOffset = Helpers.elOffset(this.menuContainer);
19973
+ x -= parentOffset.left;
19974
+ y -= parentOffset.top;
19975
+ }
19976
+
19512
19977
  this.positionReversedX = false;
19513
19978
  } else {
19514
19979
  parentOffset = Helpers.elOffset(parentEl);
@@ -19519,36 +19984,36 @@
19519
19984
  element.style.top = y + "px";
19520
19985
  element.style.left = x + "px";
19521
19986
  setTimeout(function () {
19522
- _this5.table.rowManager.element.addEventListener("scroll", _this5.blurEvent);
19987
+ _this4.table.rowManager.element.addEventListener("scroll", _this4.blurEvent);
19523
19988
 
19524
- document.body.addEventListener("click", _this5.blurEvent);
19525
- document.body.addEventListener("contextmenu", _this5.blurEvent);
19526
- window.addEventListener("resize", _this5.blurEvent);
19527
- document.body.addEventListener("keydown", _this5.escEvent);
19989
+ document.body.addEventListener("click", _this4.blurEvent);
19990
+ document.body.addEventListener("contextmenu", _this4.blurEvent);
19991
+ window.addEventListener("resize", _this4.blurEvent);
19992
+ document.body.addEventListener("keydown", _this4.escEvent);
19528
19993
  }, 100);
19529
- document.body.appendChild(element); //move menu to start on bottom edge if it is too close to the edge of the screen
19994
+ this.menuContainer.appendChild(element); //move menu to start on right edge if it is too close to the edge of the screen
19530
19995
 
19531
- if (y + element.offsetHeight >= docHeight) {
19532
- element.style.top = "";
19996
+ if (x + element.offsetWidth >= this.menuContainer.offsetWidth || this.positionReversedX) {
19997
+ element.style.left = "";
19533
19998
 
19534
19999
  if (parentEl) {
19535
- element.style.bottom = docHeight - parentOffset.top - parentEl.offsetHeight - 1 + "px";
20000
+ element.style.right = this.menuContainer.offsetWidth - parentOffset.left + "px";
19536
20001
  } else {
19537
- element.style.bottom = docHeight - y + "px";
20002
+ element.style.right = this.menuContainer.offsetWidth - x + "px";
19538
20003
  }
19539
- } //move menu to start on right edge if it is too close to the edge of the screen
19540
20004
 
20005
+ this.positionReversedX = true;
20006
+ } //move menu to start on bottom edge if it is too close to the edge of the screen
19541
20007
 
19542
- if (x + element.offsetWidth >= document.body.offsetWidth || this.positionReversedX) {
19543
- element.style.left = "";
20008
+
20009
+ if (y + element.offsetHeight >= this.menuContainer.offsetHeight) {
20010
+ element.style.top = "";
19544
20011
 
19545
20012
  if (parentEl) {
19546
- element.style.right = document.documentElement.offsetWidth - parentOffset.left + "px";
20013
+ element.style.bottom = this.menuContainer.offsetHeight - parentOffset.top - parentEl.offsetHeight - 1 + "px";
19547
20014
  } else {
19548
- element.style.right = document.documentElement.offsetWidth - x + "px";
20015
+ element.style.bottom = this.menuContainer.offsetHeight - y + "px";
19549
20016
  }
19550
-
19551
- this.positionReversedX = true;
19552
20017
  }
19553
20018
  }
19554
20019
  }, {
@@ -19576,6 +20041,11 @@
19576
20041
  document.body.removeEventListener("contextmenu", this.blurEvent);
19577
20042
  window.removeEventListener("resize", this.blurEvent);
19578
20043
  this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
20044
+
20045
+ if (this.currentComponent) {
20046
+ this.dispatchExternal("menuClosed", this.currentComponent.getComponent());
20047
+ this.currentComponent = null;
20048
+ }
19579
20049
  }
19580
20050
  }]);
19581
20051
 
@@ -20251,6 +20721,7 @@
20251
20721
 
20252
20722
  document.body.addEventListener("mousemove", this.moveHover);
20253
20723
  document.body.addEventListener("mouseup", this.endMove);
20724
+ this.dispatchExternal("rowMoving", row.getComponent());
20254
20725
  this.moveHover(e);
20255
20726
  }
20256
20727
  }, {
@@ -20286,6 +20757,8 @@
20286
20757
 
20287
20758
  if (this.toRow) {
20288
20759
  this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter);
20760
+ } else {
20761
+ this.dispatchExternal("rowMoveCancelled", this.moving.getComponent());
20289
20762
  }
20290
20763
 
20291
20764
  this.moving = false;
@@ -20717,6 +21190,63 @@
20717
21190
 
20718
21191
  Mutator.mutators = defaultMutators;
20719
21192
 
21193
+ function rows (pageSize, currentRow, currentPage, totalRows, totalPages) {
21194
+ var el = document.createElement("span"),
21195
+ showingEl = document.createElement("span"),
21196
+ valueEl = document.createElement("span"),
21197
+ ofEl = document.createElement("span"),
21198
+ totalEl = document.createElement("span"),
21199
+ rowsEl = document.createElement("span");
21200
+ this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21201
+ showingEl.innerHTML = value;
21202
+ });
21203
+ valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21204
+ this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21205
+ ofEl.innerHTML = value;
21206
+ });
21207
+ totalEl.innerHTML = " " + totalRows + " ";
21208
+ this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
21209
+ rowsEl.innerHTML = value;
21210
+ });
21211
+ el.appendChild(showingEl);
21212
+ el.appendChild(valueEl);
21213
+ el.appendChild(ofEl);
21214
+ el.appendChild(totalEl);
21215
+ el.appendChild(rowsEl);
21216
+ return el;
21217
+ }
21218
+
21219
+ function pages (pageSize, currentRow, currentPage, totalRows, totalPages) {
21220
+ var el = document.createElement("span"),
21221
+ showingEl = document.createElement("span"),
21222
+ valueEl = document.createElement("span"),
21223
+ ofEl = document.createElement("span"),
21224
+ totalEl = document.createElement("span"),
21225
+ rowsEl = document.createElement("span");
21226
+ this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21227
+ showingEl.innerHTML = value;
21228
+ });
21229
+ valueEl.innerHTML = " " + currentPage + " ";
21230
+ this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21231
+ ofEl.innerHTML = value;
21232
+ });
21233
+ totalEl.innerHTML = " " + totalPages + " ";
21234
+ this.table.modules.localize.langBind("pagination|counter|pages", function (value) {
21235
+ rowsEl.innerHTML = value;
21236
+ });
21237
+ el.appendChild(showingEl);
21238
+ el.appendChild(valueEl);
21239
+ el.appendChild(ofEl);
21240
+ el.appendChild(totalEl);
21241
+ el.appendChild(rowsEl);
21242
+ return el;
21243
+ }
21244
+
21245
+ var defaultPageCounters = {
21246
+ rows: rows,
21247
+ pages: pages
21248
+ };
21249
+
20720
21250
  var Page = /*#__PURE__*/function (_Module) {
20721
21251
  _inherits(Page, _Module);
20722
21252
 
@@ -20730,19 +21260,20 @@
20730
21260
  _this = _super.call(this, table);
20731
21261
  _this.mode = "local";
20732
21262
  _this.progressiveLoad = false;
21263
+ _this.element = null;
21264
+ _this.pageCounterElement = null;
21265
+ _this.pageCounter = null;
20733
21266
  _this.size = 0;
20734
21267
  _this.page = 1;
20735
21268
  _this.count = 5;
20736
21269
  _this.max = 1;
21270
+ _this.remoteRowCountEstimate = null;
20737
21271
  _this.displayIndex = 0; //index in display pipeline
20738
21272
 
20739
21273
  _this.initialLoad = true;
20740
21274
  _this.dataChanging = false; //flag to check if data is being changed by this module
20741
21275
 
20742
21276
  _this.pageSizes = [];
20743
- _this.dataReceivedNames = {}; //TODO - remove once pagimation update is complete
20744
-
20745
- _this.dataSentNames = {}; //TODO - remove once pagimation update is complete
20746
21277
 
20747
21278
  _this.registerTableOption("pagination", false); //set pagination type
20748
21279
 
@@ -20753,7 +21284,13 @@
20753
21284
  _this.registerTableOption("paginationSize", false); //set number of rows to a page
20754
21285
 
20755
21286
 
20756
- _this.registerTableOption("paginationInitialPage", 1); //initail page to show on load
21287
+ _this.registerTableOption("paginationInitialPage", 1); //initial page to show on load
21288
+
21289
+
21290
+ _this.registerTableOption("paginationCounter", false); // set pagination counter
21291
+
21292
+
21293
+ _this.registerTableOption("paginationCounterElement", false); // set pagination counter
20757
21294
 
20758
21295
 
20759
21296
  _this.registerTableOption("paginationButtonCount", 5); // set count of page button
@@ -20825,11 +21362,13 @@
20825
21362
  this.registerDisplayHandler(this.restOnRenderBefore.bind(this), 40);
20826
21363
  this.registerDisplayHandler(this.getRows.bind(this), 50);
20827
21364
  this.createElements();
21365
+ this.initializePageCounter();
20828
21366
  this.initializePaginator();
20829
21367
  } else if (this.table.options.progressiveLoad) {
20830
21368
  this.subscribe("data-params", this.remotePageParams.bind(this));
20831
21369
  this.subscribe("data-loaded", this._parseRemoteData.bind(this));
20832
21370
  this.subscribe("table-built", this.calculatePageSizes.bind(this));
21371
+ this.subscribe("data-processed", this.initialLoadComplete.bind(this));
20833
21372
  this.initializeProgressive(this.table.options.progressiveLoad);
20834
21373
 
20835
21374
  if (this.table.options.progressiveLoad === "scroll") {
@@ -21047,14 +21586,36 @@
21047
21586
  });
21048
21587
  this.pageSizeSelect.value = this.size;
21049
21588
  }
21050
- } //setup pageination
21589
+ }
21590
+ }, {
21591
+ key: "initializePageCounter",
21592
+ value: function initializePageCounter() {
21593
+ var counter = this.table.options.paginationCounter,
21594
+ pageCounter = null;
21595
+
21596
+ if (counter) {
21597
+ if (typeof counter === "function") {
21598
+ pageCounter = counter;
21599
+ } else {
21600
+ pageCounter = Page.pageCounters[counter];
21601
+ }
21602
+
21603
+ if (pageCounter) {
21604
+ this.pageCounter = pageCounter;
21605
+ this.pageCounterElement = document.createElement("span");
21606
+ this.pageCounterElement.classList.add("tabulator-page-counter");
21607
+ } else {
21608
+ console.warn("Pagination Error - No such page counter found: ", counter);
21609
+ }
21610
+ }
21611
+ } //setup pagination
21051
21612
 
21052
21613
  }, {
21053
21614
  key: "initializePaginator",
21054
21615
  value: function initializePaginator(hidden) {
21055
21616
  var _this3 = this;
21056
21617
 
21057
- var pageSelectLabel;
21618
+ var pageSelectLabel, paginationCounterHolder;
21058
21619
 
21059
21620
  if (!hidden) {
21060
21621
  //build pagination element
@@ -21135,6 +21696,25 @@
21135
21696
  this.element.appendChild(this.lastBut);
21136
21697
 
21137
21698
  if (!this.table.options.paginationElement && !hidden) {
21699
+ if (this.table.options.paginationCounter) {
21700
+
21701
+ if (this.table.options.paginationCounterElement) {
21702
+ if (this.table.options.paginationCounterElement instanceof HTMLElement) {
21703
+ this.table.options.paginationCounterElement.appendChild(this.pageCounterElement);
21704
+ } else if (typeof this.table.options.paginationCounterElement === "string") {
21705
+ paginationCounterHolder = document.querySelector(this.table.options.paginationCounterElement);
21706
+
21707
+ if (paginationCounterHolder) {
21708
+ paginationCounterHolder.appendChild(this.pageCounterElement);
21709
+ } else {
21710
+ console.warn("Pagination Error - Unable to find element matching paginationCounterElement selector:", this.table.options.paginationCounterElement);
21711
+ }
21712
+ }
21713
+ } else {
21714
+ this.table.footerManager.append(this.pageCounterElement);
21715
+ }
21716
+ }
21717
+
21138
21718
  this.table.footerManager.append(this.element, this);
21139
21719
  }
21140
21720
 
@@ -21190,7 +21770,7 @@
21190
21770
  this.page = 1;
21191
21771
  }
21192
21772
  }
21193
- } //set the maxmum page
21773
+ } //set the maximum page
21194
21774
 
21195
21775
  }, {
21196
21776
  key: "setMaxPage",
@@ -21263,6 +21843,49 @@
21263
21843
  }
21264
21844
 
21265
21845
  this.trackChanges();
21846
+ }
21847
+ }, {
21848
+ key: "_setPageCounter",
21849
+ value: function _setPageCounter(totalRows) {
21850
+ var content, currentRow;
21851
+
21852
+ if (this.pageCounter) {
21853
+ currentRow = (this.page - 1) * this.size + 1;
21854
+
21855
+ if (this.mode === "remote") {
21856
+ totalRows = this.remoteRowCountEstimate;
21857
+ }
21858
+
21859
+ content = this.pageCounter.call(this, this.size, currentRow, this.page, totalRows, this.max);
21860
+
21861
+ switch (_typeof(content)) {
21862
+ case "object":
21863
+ if (content instanceof Node) {
21864
+ //clear previous cell contents
21865
+ while (this.pageCounterElement.firstChild) {
21866
+ this.pageCounterElement.removeChild(this.pageCounterElement.firstChild);
21867
+ }
21868
+
21869
+ this.pageCounterElement.appendChild(content);
21870
+ } else {
21871
+ this.pageCounterElement.innerHTML = "";
21872
+
21873
+ if (content != null) {
21874
+ console.warn("Page Counter Error - Page Counter has returned a type of object, the only valid page counter object return is an instance of Node, the page counter returned:", content);
21875
+ }
21876
+ }
21877
+
21878
+ break;
21879
+
21880
+ case "undefined":
21881
+ case "null":
21882
+ this.pageCounterElement.innerHTML = "";
21883
+ break;
21884
+
21885
+ default:
21886
+ this.pageCounterElement.innerHTML = content;
21887
+ }
21888
+ }
21266
21889
  } //setup the pagination buttons
21267
21890
 
21268
21891
  }, {
@@ -21403,10 +22026,14 @@
21403
22026
  }
21404
22027
  }
21405
22028
 
22029
+ this._setPageCounter(data.length);
22030
+
21406
22031
  return output;
21407
22032
  } else {
21408
22033
  this._setPageButtons();
21409
22034
 
22035
+ this._setPageCounter(data.length);
22036
+
21410
22037
  return data.slice(0);
21411
22038
  }
21412
22039
  }
@@ -21448,11 +22075,12 @@
21448
22075
  var data, margin;
21449
22076
 
21450
22077
  if (typeof data.last_page === "undefined") {
21451
- console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property");
22078
+ console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").last_page || "last_page") + "' property");
21452
22079
  }
21453
22080
 
21454
22081
  if (data.data) {
21455
22082
  this.max = parseInt(data.last_page) || 1;
22083
+ this.remoteRowCountEstimate = typeof data.last_row !== "undefined" ? data.last_row : data.last_page * this.size - (this.page == data.last_page ? this.size - data.data.length : 0);
21456
22084
 
21457
22085
  if (this.progressiveLoad) {
21458
22086
  switch (this.mode) {
@@ -21472,14 +22100,16 @@
21472
22100
  break;
21473
22101
 
21474
22102
  case "progressive_scroll":
21475
- data = this.table.rowManager.getData().concat(data.data);
22103
+ data = this.page === 1 ? data.data : this.table.rowManager.getData().concat(data.data);
21476
22104
  this.table.rowManager.setData(data, this.page !== 1, this.page == 1);
21477
22105
  margin = this.table.options.progressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2;
21478
22106
 
21479
22107
  if (this.table.rowManager.element.scrollHeight <= this.table.rowManager.element.clientHeight + margin) {
21480
- setTimeout(function () {
21481
- _this6.nextPage();
21482
- });
22108
+ if (this.page < this.max) {
22109
+ setTimeout(function () {
22110
+ _this6.nextPage();
22111
+ });
22112
+ }
21483
22113
  }
21484
22114
 
21485
22115
  break;
@@ -21492,7 +22122,7 @@
21492
22122
  // this.table.columnManager.scrollHorizontal(left);
21493
22123
  }
21494
22124
  } else {
21495
- console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property");
22125
+ console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").data || "data") + "' property");
21496
22126
  }
21497
22127
 
21498
22128
  return data.data;
@@ -21518,7 +22148,9 @@
21518
22148
  return Page;
21519
22149
  }(Module);
21520
22150
 
21521
- Page.moduleName = "page";
22151
+ Page.moduleName = "page"; //load defaults
22152
+
22153
+ Page.pageCounters = defaultPageCounters;
21522
22154
 
21523
22155
  // read peristence information from storage
21524
22156
  var defaultReaders = {
@@ -22794,7 +23426,7 @@
22794
23426
  handle.removeEventListener("touchmove", mouseMove);
22795
23427
  handle.removeEventListener("touchend", mouseUp);
22796
23428
  self.table.element.classList.remove("tabulator-block-select");
22797
- this.dispatchExternal("rowResized", row.getComponent());
23429
+ self.dispatchExternal("rowResized", row.getComponent());
22798
23430
  }
22799
23431
 
22800
23432
  e.stopPropagation(); //prevent resize from interfereing with movable columns
@@ -22982,7 +23614,7 @@
22982
23614
  _this.registerColumnOption("responsive");
22983
23615
 
22984
23616
  return _this;
22985
- } //generate resposive columns list
23617
+ } //generate responsive columns list
22986
23618
 
22987
23619
 
22988
23620
  _createClass(ResponsiveLayout, [{
@@ -23017,11 +23649,13 @@
23017
23649
  }, {
23018
23650
  key: "initializeResponsivity",
23019
23651
  value: function initializeResponsivity() {
23652
+ var _this2 = this;
23653
+
23020
23654
  var columns = [];
23021
23655
  this.mode = this.table.options.responsiveLayout;
23022
23656
  this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData;
23023
23657
  this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen;
23024
- this.hiddenColumns = []; //detemine level of responsivity for each column
23658
+ this.hiddenColumns = []; //determine level of responsivity for each column
23025
23659
 
23026
23660
  this.table.columnManager.columnsByIndex.forEach(function (column, i) {
23027
23661
  if (column.modules.responsive) {
@@ -23029,8 +23663,8 @@
23029
23663
  column.modules.responsive.index = i;
23030
23664
  columns.push(column);
23031
23665
 
23032
- if (!column.visible && self.mode === "collapse") {
23033
- self.hiddenColumns.push(column);
23666
+ if (!column.visible && _this2.mode === "collapse") {
23667
+ _this2.hiddenColumns.push(column);
23034
23668
  }
23035
23669
  }
23036
23670
  }
@@ -23118,9 +23752,8 @@
23118
23752
  value: function updateColumnVisibility(column, responsiveToggle) {
23119
23753
  if (!responsiveToggle && column.modules.responsive) {
23120
23754
  column.modules.responsive.visible = column.visible;
23121
- this.initialize();
23122
- } //this.update();
23123
-
23755
+ this.initializeResponsivity();
23756
+ }
23124
23757
  }
23125
23758
  }, {
23126
23759
  key: "hideColumn",
@@ -23390,7 +24023,7 @@
23390
24023
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
23391
24024
 
23392
24025
  if (this.table.options.selectable && !this.table.options.selectablePersistence) {
23393
- this.subscribe("data-refeshing", this.deselectRows.bind(this));
24026
+ this.subscribe("data-refreshing", this.deselectRows.bind(this));
23394
24027
  }
23395
24028
  }
23396
24029
  }
@@ -23629,9 +24262,7 @@
23629
24262
  this.childRowSelection(row, true);
23630
24263
  }
23631
24264
 
23632
- if (!silent) {
23633
- this.dispatchExternal("rowSelected", row.getComponent());
23634
- }
24265
+ this.dispatchExternal("rowSelected", row.getComponent());
23635
24266
 
23636
24267
  this._rowSelectionChanged(silent);
23637
24268
  }
@@ -23652,7 +24283,6 @@
23652
24283
  value: function deselectRows(rows, silent) {
23653
24284
  var self = this,
23654
24285
  rowCount;
23655
- console.trace("deselect");
23656
24286
 
23657
24287
  if (typeof rows == "undefined") {
23658
24288
  rowCount = self.selectedRows.length;
@@ -23706,9 +24336,7 @@
23706
24336
  this.childRowSelection(row, false);
23707
24337
  }
23708
24338
 
23709
- if (!silent) {
23710
- this.dispatchExternal("rowDeselected", row.getComponent());
23711
- }
24339
+ this.dispatchExternal("rowDeselected", row.getComponent());
23712
24340
 
23713
24341
  self._rowSelectionChanged(silent);
23714
24342
  }
@@ -23897,8 +24525,8 @@
23897
24525
  emptyAlign = 0;
23898
24526
 
23899
24527
  if (typeof DT != "undefined") {
23900
- a = DT.fromFormat(String(a), format);
23901
- b = DT.fromFormat(String(b), format);
24528
+ a = format === "iso" ? DT.fromISO(String(a)) : DT.fromFormat(String(a), format);
24529
+ b = format === "iso" ? DT.fromISO(String(b)) : DT.fromFormat(String(b), format);
23902
24530
 
23903
24531
  if (!a.isValid) {
23904
24532
  emptyAlign = !b.isValid ? 0 : -1;
@@ -24702,9 +25330,11 @@
24702
25330
  }, {
24703
25331
  key: "columnValidate",
24704
25332
  value: function columnValidate(column) {
25333
+ var _this2 = this;
25334
+
24705
25335
  var invalid = [];
24706
25336
  column.cells.forEach(function (cell) {
24707
- if (!this.cellValidate(cell)) {
25337
+ if (!_this2.cellValidate(cell)) {
24708
25338
  invalid.push(cell.getComponent());
24709
25339
  }
24710
25340
  });
@@ -24716,9 +25346,11 @@
24716
25346
  }, {
24717
25347
  key: "rowValidate",
24718
25348
  value: function rowValidate(row) {
25349
+ var _this3 = this;
25350
+
24719
25351
  var invalid = [];
24720
25352
  row.cells.forEach(function (cell) {
24721
- if (!this.cellValidate(cell)) {
25353
+ if (!_this3.cellValidate(cell)) {
24722
25354
  invalid.push(cell.getComponent());
24723
25355
  }
24724
25356
  });
@@ -24730,7 +25362,7 @@
24730
25362
  }, {
24731
25363
  key: "userClearCellValidation",
24732
25364
  value: function userClearCellValidation(cells) {
24733
- var _this2 = this;
25365
+ var _this4 = this;
24734
25366
 
24735
25367
  if (!cells) {
24736
25368
  cells = this.getInvalidCells();
@@ -24741,7 +25373,7 @@
24741
25373
  }
24742
25374
 
24743
25375
  cells.forEach(function (cell) {
24744
- _this2.clearValidation(cell._getSelf());
25376
+ _this4.clearValidation(cell._getSelf());
24745
25377
  });
24746
25378
  }
24747
25379
  }, {
@@ -24750,6 +25382,7 @@
24750
25382
  var output = []; //clear row data
24751
25383
 
24752
25384
  this.table.rowManager.rows.forEach(function (row) {
25385
+ row = row.getComponent();
24753
25386
  var valid = row.validate();
24754
25387
 
24755
25388
  if (valid !== true) {
@@ -24932,6 +25565,7 @@
24932
25565
  GroupRowsModule: GroupRows,
24933
25566
  HistoryModule: History,
24934
25567
  HtmlTableImportModule: HtmlTableImport,
25568
+ ImportModule: Import,
24935
25569
  InteractionModule: Interaction,
24936
25570
  KeybindingsModule: Keybindings,
24937
25571
  MenuModule: Menu,