tabulator-tables 5.0.7 → 5.1.0

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 (116) hide show
  1. package/.editorconfig +6 -0
  2. package/LICENSE +1 -1
  3. package/bower.json +1 -1
  4. package/build/rollup.js +1 -1
  5. package/dist/css/tabulator.css +15 -2
  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 +15 -2
  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 +15 -2
  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 +15 -2
  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 +22 -6
  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 +19 -2
  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 +15 -2
  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 +15 -2
  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 +15 -2
  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 +19 -2
  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 +1121 -533
  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 +1566 -991
  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 +4 -2
  55. package/src/js/core/CoreFeature.js +1 -5
  56. package/src/js/core/RowManager.js +15 -9
  57. package/src/js/core/Tabulator.js +14 -59
  58. package/src/js/core/cell/Cell.js +5 -1
  59. package/src/js/core/column/Column.js +21 -6
  60. package/src/js/core/column/ColumnComponent.js +4 -0
  61. package/src/js/core/column/defaults/options.js +1 -0
  62. package/src/js/core/defaults/options.js +3 -3
  63. package/src/js/core/modules/optional.js +1 -0
  64. package/src/js/core/rendering/Renderer.js +3 -2
  65. package/src/js/core/rendering/renderers/BasicVertical.js +2 -1
  66. package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +165 -151
  67. package/src/js/core/rendering/renderers/VirtualDomVertical.js +1 -1
  68. package/src/js/core/row/Row.js +2 -2
  69. package/src/js/core/tools/{ComponentFuctionBinder.js → ComponentFunctionBinder.js} +1 -1
  70. package/src/js/core/tools/DataLoader.js +6 -6
  71. package/src/js/core/tools/InteractionMonitor.js +149 -49
  72. package/src/js/core/tools/OptionsList.js +2 -2
  73. package/src/js/modules/Ajax/Ajax.js +62 -82
  74. package/src/js/modules/ColumnCalcs/ColumnCalcs.js +15 -2
  75. package/src/js/modules/DataTree/DataTree.js +23 -9
  76. package/src/js/modules/Download/defaults/downloaders/json.js +1 -1
  77. package/src/js/modules/Download/defaults/downloaders/jsonLines.js +32 -0
  78. package/src/js/modules/Download/defaults/downloaders/pdf.js +0 -2
  79. package/src/js/modules/Download/defaults/downloaders/xlsx.js +3 -2
  80. package/src/js/modules/Download/defaults/downloaders.js +2 -0
  81. package/src/js/modules/Edit/Edit.js +27 -39
  82. package/src/js/modules/Edit/defaults/editors/progress.js +2 -2
  83. package/src/js/modules/Export/Export.js +1 -1
  84. package/src/js/modules/Filter/Filter.js +2 -2
  85. package/src/js/modules/Format/defaults/formatters/datetime.js +2 -2
  86. package/src/js/modules/Format/defaults/formatters/datetimediff.js +2 -1
  87. package/src/js/modules/FrozenColumns/FrozenColumns.js +1 -1
  88. package/src/js/modules/FrozenRows/FrozenRows.js +9 -0
  89. package/src/js/modules/GroupRows/Group.js +18 -67
  90. package/src/js/modules/GroupRows/GroupRows.js +8 -3
  91. package/src/js/modules/HtmlTableImport/HtmlTableImport.js +4 -7
  92. package/src/js/modules/Import/Import.js +197 -0
  93. package/src/js/modules/Import/defaults/importers/csv.js +63 -0
  94. package/src/js/modules/Import/defaults/importers/json.js +8 -0
  95. package/src/js/modules/Import/defaults/importers.js +7 -0
  96. package/src/js/modules/Interaction/Interaction.js +5 -0
  97. package/src/js/modules/Keybindings/Keybindings.js +9 -14
  98. package/src/js/modules/Keybindings/defaults/bindings.js +3 -3
  99. package/src/js/modules/Localize/defaults/langs.js +6 -0
  100. package/src/js/modules/Menu/Menu.js +200 -155
  101. package/src/js/modules/MoveColumns/MoveColumns.js +58 -57
  102. package/src/js/modules/MoveRows/MoveRows.js +4 -0
  103. package/src/js/modules/Page/Page.js +279 -183
  104. package/src/js/modules/Page/defaults/pageCounters/pages.js +33 -0
  105. package/src/js/modules/Page/defaults/pageCounters/rows.js +32 -0
  106. package/src/js/modules/Page/defaults/pageCounters.js +8 -0
  107. package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
  108. package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +3 -5
  109. package/src/js/modules/SelectRow/SelectRow.js +4 -8
  110. package/src/js/modules/Sort/Sort.js +1 -1
  111. package/src/js/modules/Sort/defaults/sorters/datetime.js +3 -2
  112. package/src/js/modules/Validate/Validate.js +7 -5
  113. package/src/scss/tabulator.scss +20 -2
  114. package/src/scss/themes/materialize/tabulator_materialize.scss +5 -4
  115. package/src/scss/themes/tabulator_midnight.scss +4 -0
  116. package/src/scss/themes/tabulator_site.scss +4 -0
@@ -1,4 +1,4 @@
1
- /* Tabulator v5.0.7 (c) Oliver Folkerd 2021 */
1
+ /* Tabulator v5.1.0 (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
  }, {
@@ -476,6 +471,11 @@
476
471
  value: function getField() {
477
472
  return this._column.getField();
478
473
  }
474
+ }, {
475
+ key: "getTitleDownload",
476
+ value: function getTitleDownload() {
477
+ return this._column.getTitleDownload();
478
+ }
479
479
  }, {
480
480
  key: "getCells",
481
481
  value: function getCells() {
@@ -616,7 +616,7 @@
616
616
  return ColumnComponent;
617
617
  }();
618
618
 
619
- var defaultOptions$1 = {
619
+ var defaultColumnOptions = {
620
620
  "title": undefined,
621
621
  "field": undefined,
622
622
  "columns": undefined,
@@ -626,6 +626,7 @@
626
626
  "width": undefined,
627
627
  "minWidth": 40,
628
628
  "maxWidth": undefined,
629
+ "maxInitialWidth": undefined,
629
630
  "tooltip": undefined,
630
631
  "cssClass": undefined,
631
632
  "variableHeight": undefined,
@@ -939,6 +940,11 @@
939
940
  if (changed) {
940
941
  this.dispatch("cell-value-updated", this);
941
942
  this.cellRendered();
943
+
944
+ if (this.column.definition.cellEdited) {
945
+ this.column.definition.cellEdited.call(this.table, this.getComponent());
946
+ }
947
+
942
948
  this.dispatchExternal("cellEdited", this.getComponent());
943
949
 
944
950
  if (this.subscribedExternal("dataChanged")) {
@@ -951,7 +957,7 @@
951
957
  value: function setValueProcessData(value, mutate) {
952
958
  var changed = false;
953
959
 
954
- if (this.value != value) {
960
+ if (this.value !== value) {
955
961
  changed = true;
956
962
 
957
963
  if (mutate) {
@@ -1125,6 +1131,7 @@
1125
1131
  _this.fieldStructure = "";
1126
1132
  _this.getFieldValue = "";
1127
1133
  _this.setFieldValue = "";
1134
+ _this.titleDownload = null;
1128
1135
  _this.titleFormatterRendered = false;
1129
1136
 
1130
1137
  _this.mapDefinitions();
@@ -1141,6 +1148,7 @@
1141
1148
 
1142
1149
  _this.maxWidthStyled = ""; //column maximum prestyled to improve render efficiency
1143
1150
 
1151
+ _this.maxInitialWidth = null;
1144
1152
  _this.minWidth = null; //column minimum width
1145
1153
 
1146
1154
  _this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency
@@ -1257,7 +1265,7 @@
1257
1265
 
1258
1266
  var def = this.definition; //set header tooltips
1259
1267
 
1260
- var tooltip = typeof def.headerTooltip === "undefined" ? def.tooltip : def.headerTooltip;
1268
+ var tooltip = def.headerTooltip;
1261
1269
 
1262
1270
  if (tooltip) {
1263
1271
  if (tooltip === true) {
@@ -1433,6 +1441,10 @@
1433
1441
 
1434
1442
  this.setMinWidth(parseInt(def.minWidth));
1435
1443
 
1444
+ if (def.maxInitialWidth) {
1445
+ this.maxInitialWidth = parseInt(def.maxInitialWidth);
1446
+ }
1447
+
1436
1448
  if (def.maxWidth) {
1437
1449
  this.setMaxWidth(parseInt(def.maxWidth));
1438
1450
  }
@@ -1682,6 +1694,11 @@
1682
1694
  key: "getField",
1683
1695
  value: function getField() {
1684
1696
  return this.field;
1697
+ }
1698
+ }, {
1699
+ key: "getTitleDownload",
1700
+ value: function getTitleDownload() {
1701
+ return this.titleDownload;
1685
1702
  } //return the first column in a group
1686
1703
 
1687
1704
  }, {
@@ -1818,7 +1835,7 @@
1818
1835
  this.cells.forEach(function (cell) {
1819
1836
  cell.hide();
1820
1837
  });
1821
- this.dispatch("column-hide", this);
1838
+ this.dispatch("column-hide", this, responsiveToggle);
1822
1839
 
1823
1840
  if (!silent) {
1824
1841
  this.dispatchExternal("columnVisibilityChanged", this.getComponent(), false);
@@ -1940,7 +1957,7 @@
1940
1957
  }, {
1941
1958
  key: "getHeight",
1942
1959
  value: function getHeight() {
1943
- return this.element.offsetHeight;
1960
+ return Math.ceil(this.element.getBoundingClientRect().height);
1944
1961
  }
1945
1962
  }, {
1946
1963
  key: "setMinWidth",
@@ -2049,17 +2066,18 @@
2049
2066
  this.widthFixed = false; //set width if present
2050
2067
 
2051
2068
  if (typeof this.definition.width !== "undefined" && !force) {
2069
+ // maxInitialWidth ignored here as width specified
2052
2070
  this.setWidth(this.definition.width);
2053
2071
  }
2054
2072
 
2055
2073
  this.dispatch("column-width-fit-before", this);
2056
- this.fitToData();
2074
+ this.fitToData(force);
2057
2075
  this.dispatch("column-width-fit-after", this);
2058
2076
  } //set column width to maximum cell width for non group columns
2059
2077
 
2060
2078
  }, {
2061
2079
  key: "fitToData",
2062
- value: function fitToData() {
2080
+ value: function fitToData(force) {
2063
2081
  if (this.isGroup) {
2064
2082
  return;
2065
2083
  }
@@ -2083,7 +2101,13 @@
2083
2101
  });
2084
2102
 
2085
2103
  if (maxWidth) {
2086
- this.setWidthActual(maxWidth + 1);
2104
+ var setTo = maxWidth + 1;
2105
+
2106
+ if (this.maxInitialWidth && !force) {
2107
+ setTo = Math.min(setTo, this.maxInitialWidth);
2108
+ }
2109
+
2110
+ this.setWidthActual(setTo);
2087
2111
  }
2088
2112
  }
2089
2113
  }
@@ -2140,7 +2164,7 @@
2140
2164
  return Column;
2141
2165
  }(CoreFeature);
2142
2166
 
2143
- Column$1.defaultOptionList = defaultOptions$1;
2167
+ Column$1.defaultOptionList = defaultColumnOptions;
2144
2168
 
2145
2169
  var Helpers = /*#__PURE__*/function () {
2146
2170
  function Helpers() {
@@ -2210,11 +2234,13 @@
2210
2234
 
2211
2235
  var OptionsList = /*#__PURE__*/function () {
2212
2236
  function OptionsList(table, msgType) {
2237
+ var defaults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2238
+
2213
2239
  _classCallCheck(this, OptionsList);
2214
2240
 
2215
2241
  this.table = table;
2216
2242
  this.msgType = msgType;
2217
- this.registeredDefaults = {};
2243
+ this.registeredDefaults = Object.assign({}, defaults);
2218
2244
  }
2219
2245
 
2220
2246
  _createClass(OptionsList, [{
@@ -2342,7 +2368,7 @@
2342
2368
  }
2343
2369
  }, {
2344
2370
  key: "scrollToRowNearestTop",
2345
- 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
2371
+ 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
2346
2372
  }
2347
2373
  }, {
2348
2374
  key: "visibleRows",
@@ -2416,6 +2442,7 @@
2416
2442
  offset = Helpers.elOffset(rowEl).top - Helpers.elOffset(_this2.elementVertical).top;
2417
2443
 
2418
2444
  if (offset > 0 && offset < _this2.elementVertical.clientHeight - rowEl.offsetHeight) {
2445
+ resolve();
2419
2446
  return false;
2420
2447
  }
2421
2448
  }
@@ -2526,27 +2553,27 @@
2526
2553
  _createClass(VirtualDomHorizontal, [{
2527
2554
  key: "initialize",
2528
2555
  value: function initialize() {
2529
- this.compatabilityCheck();
2556
+ this.compatibilityCheck();
2530
2557
  }
2531
2558
  }, {
2532
- key: "compatabilityCheck",
2533
- value: function compatabilityCheck() {
2559
+ key: "compatibilityCheck",
2560
+ value: function compatibilityCheck() {
2534
2561
  var columns = this.options("columns"),
2535
2562
  frozen = false,
2536
2563
  ok = true;
2537
2564
 
2538
2565
  if (this.options("layout") == "fitDataTable") {
2539
- console.warn("Horizontal Vitrual DOM is not compatible with fitDataTable layout mode");
2566
+ console.warn("Horizontal Virtual DOM is not compatible with fitDataTable layout mode");
2540
2567
  ok = false;
2541
2568
  }
2542
2569
 
2543
2570
  if (this.options("responsiveLayout")) {
2544
- console.warn("Horizontal Vitrual DOM is not compatible with responsive columns");
2571
+ console.warn("Horizontal Virtual DOM is not compatible with responsive columns");
2545
2572
  ok = false;
2546
2573
  }
2547
2574
 
2548
2575
  if (this.options("rtl")) {
2549
- console.warn("Horizontal Vitrual DOM is not currently compatible with RTL text direction");
2576
+ console.warn("Horizontal Virtual DOM is not currently compatible with RTL text direction");
2550
2577
  ok = false;
2551
2578
  }
2552
2579
 
@@ -2556,7 +2583,7 @@
2556
2583
  });
2557
2584
 
2558
2585
  if (frozen) {
2559
- console.warn("Horizontal Vitrual DOM is not compatible with frozen columns");
2586
+ console.warn("Horizontal Virtual DOM is not compatible with frozen columns");
2560
2587
  ok = false;
2561
2588
  }
2562
2589
  } // if(!ok){
@@ -2612,7 +2639,7 @@
2612
2639
  config.width = width;
2613
2640
 
2614
2641
  if (_this2.options("layout") === "fitData") {
2615
- config.fitDataCheck = true;
2642
+ config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
2616
2643
  }
2617
2644
 
2618
2645
  if (colPos + width > _this2.vDomScrollPosLeft && colPos < _this2.vDomScrollPosRight) {
@@ -2642,7 +2669,7 @@
2642
2669
 
2643
2670
  if (!blockRedraw) {
2644
2671
  if (!update || this.reinitChanged(old)) {
2645
- this.renitializeRows();
2672
+ this.reinitializeRows();
2646
2673
  }
2647
2674
  }
2648
2675
 
@@ -2769,8 +2796,8 @@
2769
2796
  return !match;
2770
2797
  }
2771
2798
  }, {
2772
- key: "renitializeRows",
2773
- value: function renitializeRows() {
2799
+ key: "reinitializeRows",
2800
+ value: function reinitializeRows() {
2774
2801
  var _this5 = this;
2775
2802
 
2776
2803
  var rows = this.table.rowManager.getVisibleRows();
@@ -2823,7 +2850,7 @@
2823
2850
  }
2824
2851
  });
2825
2852
  this.fitDataColActualWidthCheck(column);
2826
- this.rightCol++;
2853
+ this.rightCol++; // Don't move this below the >= check below
2827
2854
 
2828
2855
  if (this.rightCol >= this.columns.length - 1) {
2829
2856
  this.vDomPadRight = 0;
@@ -2851,15 +2878,16 @@
2851
2878
  }
2852
2879
  });
2853
2880
  this.fitDataColActualWidthCheck(column);
2881
+ this.leftCol--; // don't move this below the <= check below
2854
2882
 
2855
- if (!this.leftCol) {
2883
+ if (this.leftCol <= 0) {
2884
+ // replicating logic in addColRight
2856
2885
  this.vDomPadLeft = 0;
2857
2886
  } else {
2858
2887
  this.vDomPadLeft -= column.getWidth();
2859
2888
  }
2860
2889
 
2861
2890
  this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
2862
- this.leftCol--;
2863
2891
  this.addColLeft();
2864
2892
  }
2865
2893
  }
@@ -2875,7 +2903,12 @@
2875
2903
  rows.forEach(function (row) {
2876
2904
  if (row.type !== "group") {
2877
2905
  var cell = row.getCell(column);
2878
- row.getElement().removeChild(cell.getElement());
2906
+
2907
+ try {
2908
+ row.getElement().removeChild(cell.getElement());
2909
+ } catch (ex) {
2910
+ console.warn("Could not removeColRight", ex.message);
2911
+ }
2879
2912
  }
2880
2913
  });
2881
2914
  this.vDomPadRight += column.getWidth();
@@ -2893,11 +2926,21 @@
2893
2926
  if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) {
2894
2927
  rows = this.table.rowManager.getVisibleRows();
2895
2928
  rows.forEach(function (row) {
2929
+ var cell, el;
2930
+
2896
2931
  if (row.type !== "group") {
2897
- var cell = row.getCell(column);
2932
+ cell = row.getCell(column);
2898
2933
 
2899
- if (cell.parentNode) {
2900
- row.getElement().removeChild(cell.getElement());
2934
+ if (cell) {
2935
+ el = cell.getElement();
2936
+
2937
+ if (el.parentNode) {
2938
+ try {
2939
+ row.getElement().removeChild(el);
2940
+ } catch (ex) {
2941
+ console.warn("Could not removeColLeft", ex.message);
2942
+ }
2943
+ }
2901
2944
  }
2902
2945
  }
2903
2946
  });
@@ -2988,7 +3031,7 @@
2988
3031
  _this.columnsByField = {}; //columns by field
2989
3032
 
2990
3033
  _this.scrollLeft = 0;
2991
- _this.optionsList = new OptionsList(_this.table, "column definition");
3034
+ _this.optionsList = new OptionsList(_this.table, "column definition", defaultColumnOptions);
2992
3035
  _this.renderer = null;
2993
3036
  return _this;
2994
3037
  } ////////////// Setup Functions /////////////////
@@ -3315,8 +3358,8 @@
3315
3358
  return this.columnsByIndex[index];
3316
3359
  }
3317
3360
  }, {
3318
- key: "getFirstVisibileColumn",
3319
- value: function getFirstVisibileColumn(index) {
3361
+ key: "getFirstVisibleColumn",
3362
+ value: function getFirstVisibleColumn(index) {
3320
3363
  var index = this.columnsByIndex.findIndex(function (col) {
3321
3364
  return col.visible;
3322
3365
  });
@@ -3849,12 +3892,12 @@
3849
3892
  }
3850
3893
 
3851
3894
  this.dispatch("row-layout", this);
3895
+ this.initialized = true;
3852
3896
 
3853
3897
  if (this.table.options.rowFormatter) {
3854
3898
  this.table.options.rowFormatter(this.getComponent());
3855
3899
  }
3856
3900
 
3857
- this.initialized = true;
3858
3901
  this.dispatch("row-layout-after", this);
3859
3902
  } else {
3860
3903
  this.table.columnManager.renderer.rerenderRowCells(this);
@@ -4264,7 +4307,8 @@
4264
4307
  }, {
4265
4308
  key: "rerenderRows",
4266
4309
  value: function rerenderRows(callback) {
4267
- this.render();
4310
+ this.clearRows();
4311
+ this.renderRows();
4268
4312
 
4269
4313
  if (callback) {
4270
4314
  callback();
@@ -4348,8 +4392,8 @@
4348
4392
  }
4349
4393
 
4350
4394
  element.style.paddingTop = "";
4351
- element.style.paddingBottom = "";
4352
- element.style.minWidth = "";
4395
+ element.style.paddingBottom = ""; // element.style.minWidth = "";
4396
+
4353
4397
  element.style.minHeight = "";
4354
4398
  element.style.display = "";
4355
4399
  element.style.visibility = "";
@@ -4921,7 +4965,7 @@
4921
4965
 
4922
4966
  _this.rows = []; //hold row data objects
4923
4967
 
4924
- _this.activeRowsPipeline = []; //hold caluclation of active rows
4968
+ _this.activeRowsPipeline = []; //hold calculation of active rows
4925
4969
 
4926
4970
  _this.activeRows = []; //rows currently available to on display in the table
4927
4971
 
@@ -4935,11 +4979,11 @@
4935
4979
  _this.scrollLeft = 0;
4936
4980
  _this.rowNumColumn = false; //hold column component for row number column
4937
4981
 
4938
- _this.redrawBlock = false; //prevent redraws to allow multiple data manipulations becore continuing
4982
+ _this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
4939
4983
 
4940
4984
  _this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
4941
4985
 
4942
- _this.redrawBlockRederInPosition = false; //store latest redraw function calls for when redraw is needed
4986
+ _this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
4943
4987
 
4944
4988
  _this.dataPipeline = []; //hold data pipeline tasks
4945
4989
 
@@ -5620,7 +5664,7 @@
5620
5664
  }
5621
5665
  }
5622
5666
 
5623
- this.dispatch("data-refeshed");
5667
+ this.dispatch("data-refreshed");
5624
5668
  }
5625
5669
  } //regenerate row numbers for row number formatter if in use
5626
5670
 
@@ -5689,8 +5733,14 @@
5689
5733
  }
5690
5734
  }, {
5691
5735
  key: "getVisibleRows",
5692
- value: function getVisibleRows(viewable) {
5693
- return this.renderer.visibleRows(!viewable);
5736
+ value: function getVisibleRows(chain, viewable) {
5737
+ var rows = Object.assign([], this.renderer.visibleRows(!viewable));
5738
+
5739
+ if (chain) {
5740
+ rows = this.chain("rows-visible", [viewable], rows, rows);
5741
+ }
5742
+
5743
+ return rows;
5694
5744
  } //repeat action accross display rows
5695
5745
 
5696
5746
  }, {
@@ -5734,7 +5784,7 @@
5734
5784
  if (callback) {
5735
5785
  callback();
5736
5786
  } else {
5737
- this.redrawBlockRederInPosition = true;
5787
+ this.redrawBlockRenderInPosition = true;
5738
5788
  }
5739
5789
  } else {
5740
5790
  this.renderer.rerenderRows(callback);
@@ -5918,12 +5968,12 @@
5918
5968
  this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition);
5919
5969
  this.redrawBlockRestoreConfig = false;
5920
5970
  } else {
5921
- if (this.redrawBlockRederInPosition) {
5971
+ if (this.redrawBlockRenderInPosition) {
5922
5972
  this.reRenderInPosition();
5923
5973
  }
5924
5974
  }
5925
5975
 
5926
- this.redrawBlockRederInPosition = false;
5976
+ this.redrawBlockRenderInPosition = false;
5927
5977
  } //redraw table
5928
5978
 
5929
5979
  }, {
@@ -6095,7 +6145,7 @@
6095
6145
  _classCallCheck(this, InteractionManager);
6096
6146
 
6097
6147
  _this = _super.call(this, table);
6098
- _this.el = _this.table.element;
6148
+ _this.el = null;
6099
6149
  _this.abortClasses = ["tabulator-headers", "tabulator-table"];
6100
6150
  _this.previousTargets = {};
6101
6151
  _this.listeners = ["click", "dblclick", "contextmenu", "mouseenter", "mouseleave", "mouseover", "mouseout", "mousemove", "touchstart", "touchend"];
@@ -6105,15 +6155,36 @@
6105
6155
  "tabulator-group": "group",
6106
6156
  "tabulator-col": "column"
6107
6157
  };
6108
-
6109
- _this.buildListenerMap();
6110
-
6111
- _this.bindSubscriptionWatchers();
6112
-
6158
+ _this.pseudoTrackers = {
6159
+ "row": {
6160
+ subscriber: null,
6161
+ target: null
6162
+ },
6163
+ "cell": {
6164
+ subscriber: null,
6165
+ target: null
6166
+ },
6167
+ "group": {
6168
+ subscriber: null,
6169
+ target: null
6170
+ },
6171
+ "column": {
6172
+ subscriber: null,
6173
+ target: null
6174
+ }
6175
+ };
6176
+ _this.pseudoTracking = false;
6113
6177
  return _this;
6114
6178
  }
6115
6179
 
6116
6180
  _createClass(InteractionManager, [{
6181
+ key: "initialize",
6182
+ value: function initialize() {
6183
+ this.el = this.table.element;
6184
+ this.buildListenerMap();
6185
+ this.bindSubscriptionWatchers();
6186
+ }
6187
+ }, {
6117
6188
  key: "buildListenerMap",
6118
6189
  value: function buildListenerMap() {
6119
6190
  var listenerMap = {};
@@ -6125,6 +6196,55 @@
6125
6196
  });
6126
6197
  this.listeners = listenerMap;
6127
6198
  }
6199
+ }, {
6200
+ key: "bindPseudoEvents",
6201
+ value: function bindPseudoEvents() {
6202
+ var _this2 = this;
6203
+
6204
+ Object.keys(this.pseudoTrackers).forEach(function (key) {
6205
+ _this2.pseudoTrackers[key].subscriber = _this2.pseudoMouseEnter.bind(_this2, key);
6206
+
6207
+ _this2.subscribe(key + "-mouseover", _this2.pseudoTrackers[key].subscriber);
6208
+ });
6209
+ this.pseudoTracking = true;
6210
+ }
6211
+ }, {
6212
+ key: "pseudoMouseEnter",
6213
+ value: function pseudoMouseEnter(key, e, target) {
6214
+ if (this.pseudoTrackers[key].target !== target) {
6215
+ if (this.pseudoTrackers[key].target) {
6216
+ this.dispatch(key + "-mouseleave", e, target);
6217
+ }
6218
+
6219
+ this.pseudoMouseLeave(key, e);
6220
+ this.pseudoTrackers[key].target = target;
6221
+ this.dispatch(key + "-mouseenter", e, target);
6222
+ }
6223
+ }
6224
+ }, {
6225
+ key: "pseudoMouseLeave",
6226
+ value: function pseudoMouseLeave(key, e) {
6227
+ var _this3 = this;
6228
+
6229
+ var leaveList = Object.keys(this.pseudoTrackers),
6230
+ linkedKeys = {
6231
+ "row": ["cell"],
6232
+ "cell": ["row"]
6233
+ };
6234
+ leaveList = leaveList.filter(function (item) {
6235
+ var links = linkedKeys[key];
6236
+ return item !== key && (!links || links && !links.includes(item));
6237
+ });
6238
+ leaveList.forEach(function (key) {
6239
+ var target = _this3.pseudoTrackers[key].target;
6240
+
6241
+ if (_this3.pseudoTrackers[key].target) {
6242
+ _this3.dispatch(key + "-mouseleave", e, target);
6243
+
6244
+ _this3.pseudoTrackers[key].target = null;
6245
+ }
6246
+ });
6247
+ }
6128
6248
  }, {
6129
6249
  key: "bindSubscriptionWatchers",
6130
6250
  value: function bindSubscriptionWatchers() {
@@ -6149,6 +6269,8 @@
6149
6269
  _iterator.f();
6150
6270
  }
6151
6271
  }
6272
+
6273
+ this.subscribe("table-destroy", this.clearWatchers.bind(this));
6152
6274
  }
6153
6275
  }, {
6154
6276
  key: "subscriptionChanged",
@@ -6171,6 +6293,10 @@
6171
6293
  }
6172
6294
  }
6173
6295
 
6296
+ if ((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking) {
6297
+ this.bindPseudoEvents();
6298
+ }
6299
+
6174
6300
  if (changed) {
6175
6301
  this.updateEventListeners();
6176
6302
  }
@@ -6201,11 +6327,15 @@
6201
6327
  var targets = this.findTargets(path);
6202
6328
  targets = this.bindComponents(type, targets);
6203
6329
  this.triggerEvents(type, e, targets);
6330
+
6331
+ if (this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length) {
6332
+ this.pseudoMouseLeave("none", e);
6333
+ }
6204
6334
  }
6205
6335
  }, {
6206
6336
  key: "findTargets",
6207
6337
  value: function findTargets(path) {
6208
- var _this2 = this;
6338
+ var _this4 = this;
6209
6339
 
6210
6340
  var targets = {};
6211
6341
  var componentMap = Object.keys(this.componentMap);
@@ -6218,7 +6348,7 @@
6218
6348
  var el = _step2.value;
6219
6349
  var classList = el.classList ? _toConsumableArray(el.classList) : [];
6220
6350
  var abort = classList.filter(function (item) {
6221
- return _this2.abortClasses.includes(item);
6351
+ return _this4.abortClasses.includes(item);
6222
6352
  });
6223
6353
 
6224
6354
  if (abort.length) {
@@ -6258,7 +6388,7 @@
6258
6388
  }, {
6259
6389
  key: "bindComponents",
6260
6390
  value: function bindComponents(type, targets) {
6261
- var _this3 = this;
6391
+ var _this5 = this;
6262
6392
 
6263
6393
  //ensure row component is looked up before cell
6264
6394
  var keys = Object.keys(targets).reverse(),
@@ -6273,7 +6403,7 @@
6273
6403
  var key = _step4.value;
6274
6404
  var component = void 0;
6275
6405
  var target = targets[key];
6276
- var previousTarget = _this3.previousTargets[key];
6406
+ var previousTarget = _this5.previousTargets[key];
6277
6407
 
6278
6408
  if (previousTarget && previousTarget.target === target) {
6279
6409
  component = previousTarget.component;
@@ -6281,8 +6411,8 @@
6281
6411
  switch (key) {
6282
6412
  case "row":
6283
6413
  case "group":
6284
- if (listener.components.includes("row") || listener.components.includes("cell")) {
6285
- var rows = _this3.table.rowManager.getVisibleRows();
6414
+ if (listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")) {
6415
+ var rows = _this5.table.rowManager.getVisibleRows(true);
6286
6416
 
6287
6417
  component = rows.find(function (row) {
6288
6418
  return row.getElement() === target;
@@ -6293,14 +6423,18 @@
6293
6423
 
6294
6424
  case "column":
6295
6425
  if (listener.components.includes("column")) {
6296
- component = _this3.table.columnManager.findColumn(target);
6426
+ component = _this5.table.columnManager.findColumn(target);
6297
6427
  }
6298
6428
 
6299
6429
  break;
6300
6430
 
6301
6431
  case "cell":
6302
6432
  if (listener.components.includes("cell")) {
6303
- component = targets["row"].findCell(target);
6433
+ if (targets["row"]) {
6434
+ component = targets["row"].findCell(target);
6435
+ } else {
6436
+ 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?");
6437
+ }
6304
6438
  }
6305
6439
 
6306
6440
  break;
@@ -6339,20 +6473,32 @@
6339
6473
  }
6340
6474
  }
6341
6475
  }
6476
+ }, {
6477
+ key: "clearWatchers",
6478
+ value: function clearWatchers() {
6479
+ for (var key in this.listeners) {
6480
+ var listener = this.listeners[key];
6481
+
6482
+ if (listener.handler) {
6483
+ this.el.removeEventListener(key, listener.handler);
6484
+ listener.handler = null;
6485
+ }
6486
+ }
6487
+ }
6342
6488
  }]);
6343
6489
 
6344
6490
  return InteractionManager;
6345
6491
  }(CoreFeature);
6346
6492
 
6347
- var ComponentFuctionBinder = /*#__PURE__*/function () {
6348
- function ComponentFuctionBinder(table) {
6349
- _classCallCheck(this, ComponentFuctionBinder);
6493
+ var ComponentFunctionBinder = /*#__PURE__*/function () {
6494
+ function ComponentFunctionBinder(table) {
6495
+ _classCallCheck(this, ComponentFunctionBinder);
6350
6496
 
6351
6497
  this.table = table;
6352
6498
  this.bindings = {};
6353
6499
  }
6354
6500
 
6355
- _createClass(ComponentFuctionBinder, [{
6501
+ _createClass(ComponentFunctionBinder, [{
6356
6502
  key: "bind",
6357
6503
  value: function bind(type, funcName, handler) {
6358
6504
  if (!this.bindings[type]) {
@@ -6378,7 +6524,7 @@
6378
6524
  }
6379
6525
  }]);
6380
6526
 
6381
- return ComponentFuctionBinder;
6527
+ return ComponentFunctionBinder;
6382
6528
  }();
6383
6529
 
6384
6530
  var DataLoader = /*#__PURE__*/function (_CoreFeature) {
@@ -6457,7 +6603,7 @@
6457
6603
  data = JSON.parse(data);
6458
6604
  }
6459
6605
 
6460
- if (this.confirm("data-loading", data, params, config, silent)) {
6606
+ if (this.confirm("data-loading", [data, params, config, silent])) {
6461
6607
  this.loading = true;
6462
6608
 
6463
6609
  if (!silent) {
@@ -6465,9 +6611,9 @@
6465
6611
  } //get params for request
6466
6612
 
6467
6613
 
6468
- var params = this.chain("data-params", [data, config, silent], params || {}, {});
6614
+ params = this.chain("data-params", [data, config, silent], params || {}, params || {});
6469
6615
  params = this.mapParams(params, this.table.options.dataSendParams);
6470
- var result = this.chain("data-load", [data, params, config, silent], Promise.resolve([]));
6616
+ var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
6471
6617
  return result.then(function (response) {
6472
6618
  if (!Array.isArray(response) && _typeof(response) == "object") {
6473
6619
  response = _this2.mapParams(response, _this2.objectInvert(_this2.table.options.dataReceiveParams));
@@ -6497,7 +6643,7 @@
6497
6643
 
6498
6644
  setTimeout(function () {
6499
6645
  _this2.hideLoader();
6500
- }, 3000);
6646
+ }, _this2.table.options.dataLoaderErrorTimeout);
6501
6647
  })["finally"](function () {
6502
6648
  _this2.loading = false;
6503
6649
  });
@@ -7377,7 +7523,13 @@
7377
7523
  "prev_title": "Prev Page",
7378
7524
  "next": "Next",
7379
7525
  "next_title": "Next Page",
7380
- "all": "All"
7526
+ "all": "All",
7527
+ "counter": {
7528
+ "showing": "Showing",
7529
+ "of": "of",
7530
+ "rows": "rows",
7531
+ "pages": "pages"
7532
+ }
7381
7533
  },
7382
7534
  "headerFilters": {
7383
7535
  "default": "filter column...",
@@ -7785,13 +7937,13 @@
7785
7937
 
7786
7938
  this.browserSlow = false; //handle reduced functionality for slower browsers
7787
7939
 
7788
- this.browserMobile = false; //check if running on moble, prevent resize cancelling edit on keyboard appearence
7940
+ this.browserMobile = false; //check if running on mobile, prevent resize cancelling edit on keyboard appearance
7789
7941
 
7790
7942
  this.rtl = false; //check if the table is in RTL mode
7791
7943
 
7792
7944
  this.originalElement = null; //hold original table element if it has been replaced
7793
7945
 
7794
- this.componentFunctionBinder = new ComponentFuctionBinder(this); //bind component functions
7946
+ this.componentFunctionBinder = new ComponentFunctionBinder(this); //bind component functions
7795
7947
 
7796
7948
  this.dataLoader = false; //bind component functions
7797
7949
 
@@ -7805,14 +7957,14 @@
7805
7957
  this.initialized = false;
7806
7958
 
7807
7959
  if (this.initializeElement(element)) {
7808
- this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediatly after the constructor
7960
+ this.initialzeCoreSystems(options); //delay table creation to allow event bindings immediately after the constructor
7809
7961
 
7810
7962
  setTimeout(function () {
7811
7963
  _this._create();
7812
7964
  });
7813
7965
  }
7814
7966
 
7815
- TableRegistry.register(this); //register table for inderdevice communication
7967
+ TableRegistry.register(this); //register table for inter-device communication
7816
7968
  }
7817
7969
 
7818
7970
  _createClass(Tabulator, [{
@@ -7847,7 +7999,7 @@
7847
7999
 
7848
8000
  this._clearObjectPointers();
7849
8001
 
7850
- this._mapDepricatedFunctionality();
8002
+ this._mapDeprecatedFunctionality();
7851
8003
 
7852
8004
  this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
7853
8005
  this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
@@ -7856,11 +8008,11 @@
7856
8008
  this.columnManager.initialize();
7857
8009
  this.rowManager.initialize();
7858
8010
  this.footerManager.initialize();
7859
- } //convert depricated functionality to new functions
8011
+ } //convert deprecated functionality to new functions
7860
8012
 
7861
8013
  }, {
7862
- key: "_mapDepricatedFunctionality",
7863
- value: function _mapDepricatedFunctionality() {//all previously deprecated functionality removed in the 5.0 release
8014
+ key: "_mapDeprecatedFunctionality",
8015
+ value: function _mapDeprecatedFunctionality() {//all previously deprecated functionality removed in the 5.0 release
7864
8016
  }
7865
8017
  }, {
7866
8018
  key: "_clearSelection",
@@ -7881,7 +8033,7 @@
7881
8033
  }
7882
8034
 
7883
8035
  this.element.classList.remove("tabulator-block-select");
7884
- } //concreate table
8036
+ } //create table
7885
8037
 
7886
8038
  }, {
7887
8039
  key: "_create",
@@ -7989,6 +8141,7 @@
7989
8141
  value: function _initializeTable() {
7990
8142
  var element = this.element,
7991
8143
  options = this.options;
8144
+ this.interactionMonitor.initialize();
7992
8145
  this.columnManager.initialize();
7993
8146
  this.rowManager.initialize();
7994
8147
 
@@ -8042,7 +8195,7 @@
8042
8195
  key: "destroy",
8043
8196
  value: function destroy() {
8044
8197
  var element = this.element;
8045
- TableRegistry.deregister(this); //deregister table from inderdevice communication
8198
+ TableRegistry.deregister(this); //deregister table from inter-device communication
8046
8199
 
8047
8200
  this.eventBus.dispatch("table-destroy"); //clear row data
8048
8201
 
@@ -8092,46 +8245,6 @@
8092
8245
  key: "restoreRedraw",
8093
8246
  value: function restoreRedraw() {
8094
8247
  return this.rowManager.restoreRedraw();
8095
- } //local data from local file
8096
-
8097
- }, {
8098
- key: "setDataFromLocalFile",
8099
- value: function setDataFromLocalFile(extensions) {
8100
- var _this2 = this;
8101
-
8102
- return new Promise(function (resolve, reject) {
8103
- var input = document.createElement("input");
8104
- input.type = "file";
8105
- input.accept = extensions || ".json,application/json";
8106
- input.addEventListener("change", function (e) {
8107
- var file = input.files[0],
8108
- reader = new FileReader(),
8109
- data;
8110
- reader.readAsText(file);
8111
-
8112
- reader.onload = function (e) {
8113
- try {
8114
- data = JSON.parse(reader.result);
8115
- } catch (e) {
8116
- console.warn("File Load Error - File contents is invalid JSON", e);
8117
- reject(e);
8118
- return;
8119
- }
8120
-
8121
- _this2.setData(data).then(function (data) {
8122
- resolve(data);
8123
- })["catch"](function (err) {
8124
- resolve(err);
8125
- });
8126
- };
8127
-
8128
- reader.onerror = function (e) {
8129
- console.warn("File Load Error - Unable to read file");
8130
- reject();
8131
- };
8132
- });
8133
- input.click();
8134
- });
8135
8248
  } //load data
8136
8249
 
8137
8250
  }, {
@@ -8176,13 +8289,13 @@
8176
8289
  }, {
8177
8290
  key: "updateData",
8178
8291
  value: function updateData(data) {
8179
- var _this3 = this;
8292
+ var _this2 = this;
8180
8293
 
8181
8294
  var responses = 0;
8182
8295
 
8183
8296
  if (this.initialized) {
8184
8297
  return new Promise(function (resolve, reject) {
8185
- _this3.dataLoader.blockActiveLoad();
8298
+ _this2.dataLoader.blockActiveLoad();
8186
8299
 
8187
8300
  if (typeof data === "string") {
8188
8301
  data = JSON.parse(data);
@@ -8190,7 +8303,7 @@
8190
8303
 
8191
8304
  if (data) {
8192
8305
  data.forEach(function (item) {
8193
- var row = _this3.rowManager.findRow(item[_this3.options.index]);
8306
+ var row = _this2.rowManager.findRow(item[_this2.options.index]);
8194
8307
 
8195
8308
  if (row) {
8196
8309
  responses++;
@@ -8215,18 +8328,18 @@
8215
8328
  }, {
8216
8329
  key: "addData",
8217
8330
  value: function addData(data, pos, index) {
8218
- var _this4 = this;
8331
+ var _this3 = this;
8219
8332
 
8220
8333
  if (this.initialized) {
8221
8334
  return new Promise(function (resolve, reject) {
8222
- _this4.dataLoader.blockActiveLoad();
8335
+ _this3.dataLoader.blockActiveLoad();
8223
8336
 
8224
8337
  if (typeof data === "string") {
8225
8338
  data = JSON.parse(data);
8226
8339
  }
8227
8340
 
8228
8341
  if (data) {
8229
- _this4.rowManager.addRows(data, pos, index).then(function (rows) {
8342
+ _this3.rowManager.addRows(data, pos, index).then(function (rows) {
8230
8343
  var output = [];
8231
8344
  rows.forEach(function (row) {
8232
8345
  output.push(row.getComponent());
@@ -8246,14 +8359,14 @@
8246
8359
  }, {
8247
8360
  key: "updateOrAddData",
8248
8361
  value: function updateOrAddData(data) {
8249
- var _this5 = this;
8362
+ var _this4 = this;
8250
8363
 
8251
8364
  var rows = [],
8252
8365
  responses = 0;
8253
8366
 
8254
8367
  if (this.initialized) {
8255
8368
  return new Promise(function (resolve, reject) {
8256
- _this5.dataLoader.blockActiveLoad();
8369
+ _this4.dataLoader.blockActiveLoad();
8257
8370
 
8258
8371
  if (typeof data === "string") {
8259
8372
  data = JSON.parse(data);
@@ -8261,7 +8374,7 @@
8261
8374
 
8262
8375
  if (data) {
8263
8376
  data.forEach(function (item) {
8264
- var row = _this5.rowManager.findRow(item[_this5.options.index]);
8377
+ var row = _this4.rowManager.findRow(item[_this4.options.index]);
8265
8378
 
8266
8379
  responses++;
8267
8380
 
@@ -8275,7 +8388,7 @@
8275
8388
  }
8276
8389
  });
8277
8390
  } else {
8278
- _this5.rowManager.addRows(item).then(function (newRows) {
8391
+ _this4.rowManager.addRows(item).then(function (newRows) {
8279
8392
  responses--;
8280
8393
  rows.push(newRows[0].getComponent());
8281
8394
 
@@ -8324,7 +8437,7 @@
8324
8437
  }, {
8325
8438
  key: "deleteRow",
8326
8439
  value: function deleteRow(index) {
8327
- var _this6 = this;
8440
+ var _this5 = this;
8328
8441
 
8329
8442
  var foundRows = [];
8330
8443
 
@@ -8357,7 +8470,7 @@
8357
8470
  }
8358
8471
 
8359
8472
  foundRows.sort(function (a, b) {
8360
- return _this6.rowManager.rows.indexOf(a) > _this6.rowManager.rows.indexOf(b) ? 1 : -1;
8473
+ return _this5.rowManager.rows.indexOf(a) > _this5.rowManager.rows.indexOf(b) ? 1 : -1;
8361
8474
  }); //delete rows
8362
8475
 
8363
8476
  foundRows.forEach(function (row) {
@@ -8414,7 +8527,7 @@
8414
8527
 
8415
8528
  if (row) {
8416
8529
  return row.updateData(data).then(function () {
8417
- resolve(row.getComponent());
8530
+ return Promise.resolve(row.getComponent());
8418
8531
  });
8419
8532
  } else {
8420
8533
  console.warn("Update Error - No matching row found:", index);
@@ -8448,11 +8561,7 @@
8448
8561
  }, {
8449
8562
  key: "getRows",
8450
8563
  value: function getRows(active) {
8451
- if (this.initialized) {
8452
- return this.rowManager.getComponents(active);
8453
- } else {
8454
- console.warn("getRows failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
8455
- }
8564
+ return this.rowManager.getComponents(active);
8456
8565
  } //get position of row in table
8457
8566
 
8458
8567
  }, {
@@ -8591,13 +8700,13 @@
8591
8700
  }, {
8592
8701
  key: "scrollToColumn",
8593
8702
  value: function scrollToColumn(field, position, ifVisible) {
8594
- var _this7 = this;
8703
+ var _this6 = this;
8595
8704
 
8596
8705
  return new Promise(function (resolve, reject) {
8597
- var column = _this7.columnManager.findColumn(field);
8706
+ var column = _this6.columnManager.findColumn(field);
8598
8707
 
8599
8708
  if (column) {
8600
- return _this7.columnManager.scrollToColumn(column, position, ifVisible);
8709
+ return _this6.columnManager.scrollToColumn(column, position, ifVisible);
8601
8710
  } else {
8602
8711
  console.warn("Scroll Error - No matching column found:", field);
8603
8712
  return Promise.reject("Scroll Error - No matching column found");
@@ -9002,7 +9111,7 @@
9002
9111
  _classCallCheck(this, Ajax);
9003
9112
 
9004
9113
  _this = _super.call(this, table);
9005
- _this.config = false; //hold config object for ajax request
9114
+ _this.config = {}; //hold config object for ajax request
9006
9115
 
9007
9116
  _this.url = ""; //request URL
9008
9117
 
@@ -9043,22 +9152,31 @@
9043
9152
  this.loaderPromise = this.table.options.ajaxRequestFunc || Ajax.defaultLoaderPromise;
9044
9153
  this.urlGenerator = this.table.options.ajaxURLGenerator || Ajax.defaultURLGenerator;
9045
9154
 
9046
- if (this.table.options.ajaxParams) {
9047
- this.setParams(this.table.options.ajaxParams);
9048
- }
9049
-
9050
- if (this.table.options.ajaxConfig) {
9051
- this.setConfig(this.table.options.ajaxConfig);
9052
- }
9053
-
9054
9155
  if (this.table.options.ajaxURL) {
9055
9156
  this.setUrl(this.table.options.ajaxURL);
9056
9157
  }
9057
9158
 
9159
+ this.setDefaultConfig(this.table.options.ajaxConfig);
9058
9160
  this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
9059
9161
  this.subscribe("data-loading", this.requestDataCheck.bind(this));
9162
+ this.subscribe("data-params", this.requestParams.bind(this));
9060
9163
  this.subscribe("data-load", this.requestData.bind(this));
9061
9164
  }
9165
+ }, {
9166
+ key: "requestParams",
9167
+ value: function requestParams(data, config, silent, params) {
9168
+ var ajaxParams = this.table.options.ajaxParams;
9169
+
9170
+ if (ajaxParams) {
9171
+ if (typeof ajaxParams === "function") {
9172
+ ajaxParams = ajaxParams.call(this.table);
9173
+ }
9174
+
9175
+ params = Object.assign(params, ajaxParams);
9176
+ }
9177
+
9178
+ return params;
9179
+ }
9062
9180
  }, {
9063
9181
  key: "requestDataCheck",
9064
9182
  value: function requestDataCheck(data, params, config, silent) {
@@ -9066,69 +9184,46 @@
9066
9184
  }
9067
9185
  }, {
9068
9186
  key: "requestData",
9069
- value: function requestData(data, params, config, silent, previousData) {
9070
- if (this.requestDataCheck(data)) {
9071
- if (data) {
9072
- this.setUrl(data);
9073
- }
9074
-
9075
- if (params) {
9076
- this.setParams(params, true);
9077
- }
9187
+ value: function requestData(url, params, config, silent, previousData) {
9188
+ var ajaxConfig;
9078
9189
 
9079
- if (config) {
9080
- this.setConfig(config);
9190
+ if (!previousData && this.requestDataCheck(url)) {
9191
+ if (url) {
9192
+ this.setUrl(url);
9081
9193
  }
9082
9194
 
9083
- return this.sendRequest();
9195
+ ajaxConfig = this.generateConfig(config);
9196
+ return this.sendRequest(this.url, params, ajaxConfig);
9084
9197
  } else {
9085
9198
  return previousData;
9086
9199
  }
9087
- } //set ajax params
9088
-
9200
+ }
9089
9201
  }, {
9090
- key: "setParams",
9091
- value: function setParams(params, update) {
9092
- if (update) {
9093
- this.params = this.params || {};
9202
+ key: "setDefaultConfig",
9203
+ value: function setDefaultConfig() {
9204
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9205
+ this.config = Object.assign({}, Ajax.defaultConfig);
9094
9206
 
9095
- for (var key in params) {
9096
- this.params[key] = params[key];
9097
- }
9207
+ if (typeof config == "string") {
9208
+ this.config.method = config;
9098
9209
  } else {
9099
- this.params = params;
9210
+ Object.assign(this.config, config);
9100
9211
  }
9101
- }
9102
- }, {
9103
- key: "getParams",
9104
- value: function getParams() {
9105
- return this.params || {};
9106
9212
  } //load config object
9107
9213
 
9108
9214
  }, {
9109
- key: "setConfig",
9110
- value: function setConfig(config) {
9111
- this._loadDefaultConfig();
9215
+ key: "generateConfig",
9216
+ value: function generateConfig() {
9217
+ var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9218
+ var ajaxConfig = Object.assign({}, this.config);
9112
9219
 
9113
9220
  if (typeof config == "string") {
9114
- this.config.method = config;
9221
+ ajaxConfig.method = config;
9115
9222
  } else {
9116
- for (var key in config) {
9117
- this.config[key] = config[key];
9118
- }
9223
+ Object.assign(ajaxConfig, config);
9119
9224
  }
9120
- } //create config object from default
9121
9225
 
9122
- }, {
9123
- key: "_loadDefaultConfig",
9124
- value: function _loadDefaultConfig(force) {
9125
- if (!this.config || force) {
9126
- this.config = {}; //load base config from defaults
9127
-
9128
- for (var key in Ajax.defaultConfig) {
9129
- this.config[key] = Ajax.defaultConfig[key];
9130
- }
9131
- }
9226
+ return ajaxConfig;
9132
9227
  } //set request url
9133
9228
 
9134
9229
  }, {
@@ -9145,17 +9240,13 @@
9145
9240
 
9146
9241
  }, {
9147
9242
  key: "sendRequest",
9148
- value: function sendRequest(silent) {
9243
+ value: function sendRequest(url, params, config) {
9149
9244
  var _this2 = this;
9150
9245
 
9151
- var url = this.url;
9152
-
9153
- this._loadDefaultConfig();
9154
-
9155
- if (this.table.options.ajaxRequesting.call(this.table, this.url, this.params) !== false) {
9156
- return this.loaderPromise(url, this.config, this.params).then(function (data) {
9246
+ if (this.table.options.ajaxRequesting.call(this.table, url, params) !== false) {
9247
+ return this.loaderPromise(url, config, params).then(function (data) {
9157
9248
  if (_this2.table.options.ajaxResponse) {
9158
- data = _this2.table.options.ajaxResponse.call(_this2.table, _this2.url, _this2.params, data);
9249
+ data = _this2.table.options.ajaxResponse.call(_this2.table, url, params, data);
9159
9250
  }
9160
9251
 
9161
9252
  return data;
@@ -9761,8 +9852,9 @@
9761
9852
  this.subscribe("row-added", this.rowsUpdated.bind(this));
9762
9853
  this.subscribe("column-moved", this.recalcActiveRows.bind(this));
9763
9854
  this.subscribe("column-add", this.recalcActiveRows.bind(this));
9764
- this.subscribe("data-refeshed", this.recalcActiveRows.bind(this));
9855
+ this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
9765
9856
  this.subscribe("table-redraw", this.tableRedraw.bind(this));
9857
+ this.subscribe("rows-visible", this.visibleRows.bind(this));
9766
9858
  this.registerTableFunction("getCalcResults", this.getResults.bind(this));
9767
9859
  this.registerTableFunction("recalc", this.userRecalc.bind(this));
9768
9860
  }
@@ -9786,6 +9878,19 @@
9786
9878
  ///////// Internal Logic //////////
9787
9879
  ///////////////////////////////////
9788
9880
 
9881
+ }, {
9882
+ key: "visibleRows",
9883
+ value: function visibleRows(viewable, rows) {
9884
+ if (this.topRow) {
9885
+ rows.unshift(this.topRow);
9886
+ }
9887
+
9888
+ if (this.botRow) {
9889
+ rows.push(this.botRow);
9890
+ }
9891
+
9892
+ return rows;
9893
+ }
9789
9894
  }, {
9790
9895
  key: "rowsUpdated",
9791
9896
  value: function rowsUpdated(row) {
@@ -10082,7 +10187,7 @@
10082
10187
 
10083
10188
  row.getComponent = function () {
10084
10189
  if (!row.component) {
10085
- row.component = new CalcComponent(_this4);
10190
+ row.component = new CalcComponent(row);
10086
10191
  }
10087
10192
 
10088
10193
  return row.component;
@@ -10296,6 +10401,8 @@
10296
10401
 
10297
10402
  _this.registerComponentFunction("row", "addTreeChild", _this.addTreeChildRow.bind(_assertThisInitialized(_this)));
10298
10403
 
10404
+ _this.registerComponentFunction("row", "isTreeExpanded", _this.isRowExpanded.bind(_assertThisInitialized(_this)));
10405
+
10299
10406
  return _this;
10300
10407
  }
10301
10408
 
@@ -10304,11 +10411,9 @@
10304
10411
  value: function initialize() {
10305
10412
  if (this.table.options.dataTree) {
10306
10413
  var dummyEl = null,
10307
- firstCol = this.table.columnManager.getFirstVisibileColumn(),
10308
10414
  options = this.table.options;
10309
10415
  this.field = options.dataTreeChildField;
10310
10416
  this.indent = options.dataTreeChildIndent;
10311
- this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
10312
10417
 
10313
10418
  if (options.dataTreeBranchElement) {
10314
10419
  if (options.dataTreeBranchElement === true) {
@@ -10377,13 +10482,21 @@
10377
10482
 
10378
10483
  this.subscribe("row-init", this.initializeRow.bind(this));
10379
10484
  this.subscribe("row-layout-after", this.layoutRow.bind(this));
10380
- this.subscribe("row-relayout", this.layoutRow.bind(this));
10381
10485
  this.subscribe("row-deleted", this.rowDelete.bind(this), 0);
10382
10486
  this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
10487
+ this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
10488
+ this.subscribe("edit-cancelled", this.cellValueChanged.bind(this));
10383
10489
  this.subscribe("column-moving-rows", this.columnMoving.bind(this));
10490
+ this.subscribe("table-built", this.initializeElementField.bind(this));
10384
10491
  this.registerDisplayHandler(this.getRows.bind(this), 30);
10385
10492
  }
10386
10493
  }
10494
+ }, {
10495
+ key: "initializeElementField",
10496
+ value: function initializeElementField() {
10497
+ var firstCol = this.table.columnManager.getFirstVisibleColumn();
10498
+ this.elementField = this.table.options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
10499
+ }
10387
10500
  }, {
10388
10501
  key: "getRowChildren",
10389
10502
  value: function getRowChildren(row) {
@@ -10412,6 +10525,15 @@
10412
10525
  }
10413
10526
  }
10414
10527
  }
10528
+ }, {
10529
+ key: "cellValueChanged",
10530
+ value: function cellValueChanged(cell) {
10531
+ var field = cell.column.getField();
10532
+
10533
+ if (field === this.elementField) {
10534
+ this.layoutRow(cell.row);
10535
+ }
10536
+ }
10415
10537
  }, {
10416
10538
  key: "initializeRow",
10417
10539
  value: function initializeRow(row) {
@@ -10661,6 +10783,11 @@
10661
10783
  }
10662
10784
  }
10663
10785
  }
10786
+ }, {
10787
+ key: "isRowExpanded",
10788
+ value: function isRowExpanded(row) {
10789
+ return row.modules.dataTree.open;
10790
+ }
10664
10791
  }, {
10665
10792
  key: "getTreeParent",
10666
10793
  value: function getTreeParent(row) {
@@ -10823,13 +10950,6 @@
10823
10950
 
10824
10951
  return output;
10825
10952
  }
10826
- }, {
10827
- key: "checkForRestyle",
10828
- value: function checkForRestyle(cell) {
10829
- if (!cell.row.cells.indexOf(cell)) {
10830
- this.layoutRow(cell.row);
10831
- }
10832
- }
10833
10953
  }, {
10834
10954
  key: "getChildField",
10835
10955
  value: function getChildField() {
@@ -10838,6 +10958,7 @@
10838
10958
  }, {
10839
10959
  key: "redrawNeeded",
10840
10960
  value: function redrawNeeded(data) {
10961
+ console.log("needed?", data);
10841
10962
  return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
10842
10963
  }
10843
10964
  }]);
@@ -10926,7 +11047,7 @@
10926
11047
  case "row":
10927
11048
  row.columns.forEach(function (col) {
10928
11049
  if (col) {
10929
- item[col.component.getField()] = col.value;
11050
+ item[col.component.getTitleDownload() || col.component.getField()] = col.value;
10930
11051
  }
10931
11052
  });
10932
11053
  fileContents.push(item);
@@ -11014,8 +11135,6 @@
11014
11135
  }
11015
11136
 
11016
11137
  rowData.push(cell);
11017
- } else {
11018
- rowData.push("");
11019
11138
  }
11020
11139
  });
11021
11140
  return rowData;
@@ -11082,16 +11201,18 @@
11082
11201
  rowData.push(!(col.value instanceof Date) && _typeof(col.value) === "object" ? JSON.stringify(col.value) : col.value);
11083
11202
 
11084
11203
  if (col.width > 1 || col.height > -1) {
11085
- merges.push({
11086
- s: {
11087
- r: i,
11088
- c: j
11089
- },
11090
- e: {
11091
- r: i + col.height - 1,
11092
- c: j + col.width - 1
11093
- }
11094
- });
11204
+ if (col.height > 1 || col.width > 1) {
11205
+ merges.push({
11206
+ s: {
11207
+ r: i,
11208
+ c: j
11209
+ },
11210
+ e: {
11211
+ r: i + col.height - 1,
11212
+ c: j + col.width - 1
11213
+ }
11214
+ });
11215
+ }
11095
11216
  }
11096
11217
  } else {
11097
11218
  rowData.push("");
@@ -11169,9 +11290,40 @@
11169
11290
  }
11170
11291
  }
11171
11292
 
11293
+ function jsonLines (list, options, setFileContents) {
11294
+ var fileContents = [];
11295
+ list.forEach(function (row) {
11296
+ var item = {};
11297
+
11298
+ switch (row.type) {
11299
+ case "header":
11300
+ break;
11301
+
11302
+ case "group":
11303
+ console.warn("Download Warning - JSON downloader cannot process row groups");
11304
+ break;
11305
+
11306
+ case "calc":
11307
+ console.warn("Download Warning - JSON downloader cannot process column calculations");
11308
+ break;
11309
+
11310
+ case "row":
11311
+ row.columns.forEach(function (col) {
11312
+ if (col) {
11313
+ item[col.component.getTitleDownload() || col.component.getField()] = col.value;
11314
+ }
11315
+ });
11316
+ fileContents.push(JSON.stringify(item));
11317
+ break;
11318
+ }
11319
+ });
11320
+ setFileContents(fileContents.join("\n"), "application/x-ndjson");
11321
+ }
11322
+
11172
11323
  var defaultDownloaders = {
11173
11324
  csv: csv,
11174
11325
  json: json,
11326
+ jsonLines: jsonLines,
11175
11327
  pdf: pdf,
11176
11328
  xlsx: xlsx,
11177
11329
  html: html
@@ -12890,11 +13042,9 @@
12890
13042
 
12891
13043
  //draggable progress bar
12892
13044
  function progress (cell, onRendered, success, cancel, editorParams) {
12893
- var _element$getElementsB, _element$getElementsB2;
12894
-
12895
13045
  var element = cell.getElement(),
12896
- max = typeof editorParams.max === "undefined" ? ((_element$getElementsB = element.getElementsByTagName("div")[0]) === null || _element$getElementsB === void 0 ? void 0 : _element$getElementsB.getAttribute("max")) || 100 : editorParams.max,
12897
- min = typeof editorParams.min === "undefined" ? ((_element$getElementsB2 = element.getElementsByTagName("div")[0]) === null || _element$getElementsB2 === void 0 ? void 0 : _element$getElementsB2.getAttribute("min")) || 0 : editorParams.min,
13046
+ max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max,
13047
+ min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min,
12898
13048
  percent = (max - min) / 100,
12899
13049
  value = cell.getValue() || 0,
12900
13050
  handle = document.createElement("div"),
@@ -13187,12 +13337,12 @@
13187
13337
  this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
13188
13338
  this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
13189
13339
  this.subscribe("data-refeshing", this.cancelEdit.bind(this));
13190
- this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this));
13340
+ this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
13191
13341
  this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
13192
- this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this));
13193
- this.subscribe("keybinding-nav-right", this.navigateRight.bind(this));
13194
- this.subscribe("keybinding-nav-up", this.navigateUp.bind(this));
13195
- this.subscribe("keybinding-nav-down", this.navigateDown.bind(this));
13342
+ this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this, undefined));
13343
+ this.subscribe("keybinding-nav-right", this.navigateRight.bind(this, undefined));
13344
+ this.subscribe("keybinding-nav-up", this.navigateUp.bind(this, undefined));
13345
+ this.subscribe("keybinding-nav-down", this.navigateDown.bind(this, undefined));
13196
13346
  } ///////////////////////////////////
13197
13347
  ////// Keybinding Functions ///////
13198
13348
  ///////////////////////////////////
@@ -13204,10 +13354,9 @@
13204
13354
  newRow = this.options("tabEndNewRow");
13205
13355
 
13206
13356
  if (cell) {
13207
- if (!this.navigateNext(e)) {
13357
+ if (!this.navigateNext(cell, e)) {
13208
13358
  if (newRow) {
13209
- cell.getElement().firstChild.blur();
13210
-
13359
+ // cell.getElement().firstChild.blur();
13211
13360
  if (newRow === true) {
13212
13361
  newRow = this.table.addRow({});
13213
13362
  } else {
@@ -13220,7 +13369,7 @@
13220
13369
 
13221
13370
  newRow.then(function () {
13222
13371
  setTimeout(function () {
13223
- nav.next();
13372
+ cell.getComponent().navigateNext();
13224
13373
  });
13225
13374
  });
13226
13375
  }
@@ -13253,7 +13402,7 @@
13253
13402
  var _this2 = this;
13254
13403
 
13255
13404
  if (!cells) {
13256
- cells = this.modules.edit.getEditedCells();
13405
+ cells = this.table.modules.edit.getEditedCells();
13257
13406
  }
13258
13407
 
13259
13408
  if (!Array.isArray(cells)) {
@@ -13261,15 +13410,15 @@
13261
13410
  }
13262
13411
 
13263
13412
  cells.forEach(function (cell) {
13264
- _this2.modules.edit.clearEdited(cell._getSelf());
13413
+ _this2.table.modules.edit.clearEdited(cell._getSelf());
13265
13414
  });
13266
13415
  }
13267
13416
  }, {
13268
13417
  key: "navigatePrev",
13269
- value: function navigatePrev(e) {
13270
- var cell = this.currentCell,
13271
- nextCell,
13272
- prevRow;
13418
+ value: function navigatePrev() {
13419
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13420
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13421
+ var nextCell, prevRow;
13273
13422
 
13274
13423
  if (cell) {
13275
13424
  if (e) {
@@ -13298,10 +13447,10 @@
13298
13447
  }
13299
13448
  }, {
13300
13449
  key: "navigateNext",
13301
- value: function navigateNext(e) {
13302
- var cell = this.currentCell,
13303
- nextCell,
13304
- nextRow;
13450
+ value: function navigateNext() {
13451
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13452
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13453
+ var nextCell, nextRow;
13305
13454
 
13306
13455
  if (cell) {
13307
13456
  if (e) {
@@ -13330,10 +13479,10 @@
13330
13479
  }
13331
13480
  }, {
13332
13481
  key: "navigateLeft",
13333
- value: function navigateLeft(e) {
13334
- var cell = this.currentCell,
13335
- index,
13336
- nextCell;
13482
+ value: function navigateLeft() {
13483
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13484
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13485
+ var index, nextCell;
13337
13486
 
13338
13487
  if (cell) {
13339
13488
  if (e) {
@@ -13353,10 +13502,10 @@
13353
13502
  }
13354
13503
  }, {
13355
13504
  key: "navigateRight",
13356
- value: function navigateRight(e) {
13357
- var cell = this.currentCell,
13358
- index,
13359
- nextCell;
13505
+ value: function navigateRight() {
13506
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13507
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13508
+ var index, nextCell;
13360
13509
 
13361
13510
  if (cell) {
13362
13511
  if (e) {
@@ -13376,10 +13525,10 @@
13376
13525
  }
13377
13526
  }, {
13378
13527
  key: "navigateUp",
13379
- value: function navigateUp(e) {
13380
- var cell = this.currentCell,
13381
- index,
13382
- nextRow;
13528
+ value: function navigateUp() {
13529
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13530
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13531
+ var index, nextRow;
13383
13532
 
13384
13533
  if (cell) {
13385
13534
  if (e) {
@@ -13399,10 +13548,10 @@
13399
13548
  }
13400
13549
  }, {
13401
13550
  key: "navigateDown",
13402
- value: function navigateDown(e) {
13403
- var cell = this.currentCell,
13404
- index,
13405
- nextRow;
13551
+ value: function navigateDown() {
13552
+ var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
13553
+ var e = arguments.length > 1 ? arguments[1] : undefined;
13554
+ var index, nextRow;
13406
13555
 
13407
13556
  if (cell) {
13408
13557
  if (e) {
@@ -13557,8 +13706,8 @@
13557
13706
  cellEl = cell.getElement();
13558
13707
 
13559
13708
  if (cancel) {
13560
- if (cell.validate) {
13561
- cell.validate();
13709
+ if (cell.column.modules.validate && this.table.modExists("validate")) {
13710
+ this.table.modules.validate.cellValidate(cell);
13562
13711
  }
13563
13712
  } else {
13564
13713
  cellEl.classList.remove("tabulator-validation-fail");
@@ -13591,6 +13740,7 @@
13591
13740
  cell.column.definition.cellEditCancelled.call(this.table, component);
13592
13741
  }
13593
13742
 
13743
+ this.dispatch("edit-cancelled", cell);
13594
13744
  this.dispatchExternal("cellEditCancelled", component);
13595
13745
  }
13596
13746
  } //return a formatted value for a cell
@@ -13727,10 +13877,6 @@
13727
13877
 
13728
13878
  cell.setValue(value, true);
13729
13879
 
13730
- if (self.table.options.dataTree && self.table.modExists("dataTree")) {
13731
- self.table.modules.dataTree.checkForRestyle(cell);
13732
- }
13733
-
13734
13880
  if (valid !== true) {
13735
13881
  element.classList.add("tabulator-validation-fail");
13736
13882
  self.table.externalEvents.dispatch("validationFailed", cell.getComponent(), value, valid);
@@ -13753,10 +13899,6 @@
13753
13899
  function cancel() {
13754
13900
  if (self.currentCell === cell) {
13755
13901
  self.cancelEdit();
13756
-
13757
- if (self.table.options.dataTree && self.table.modExists("dataTree")) {
13758
- self.table.modules.dataTree.checkForRestyle(cell);
13759
- }
13760
13902
  }
13761
13903
  }
13762
13904
 
@@ -13970,7 +14112,7 @@
13970
14112
  switch (range) {
13971
14113
  case true:
13972
14114
  case "visible":
13973
- rows = this.table.rowManager.getVisibleRows(true);
14115
+ rows = this.table.rowManager.getVisibleRows(false, true);
13974
14116
  break;
13975
14117
 
13976
14118
  case "all":
@@ -15026,7 +15168,7 @@
15026
15168
  }
15027
15169
  };
15028
15170
  params = column.definition.headerFilterParams || {};
15029
- params = typeof params === "function" ? params.call(self.table) : params;
15171
+ params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
15030
15172
  editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params);
15031
15173
 
15032
15174
  if (!editorElement) {
@@ -15188,7 +15330,7 @@
15188
15330
  if (this.table.options.filterMode === "remote") {
15189
15331
  this.reloadData();
15190
15332
  } else {
15191
- this.refreshData();
15333
+ this.refreshData(true);
15192
15334
  }
15193
15335
  } //TODO - Persist left position of row manager
15194
15336
  // left = this.scrollLeft;
@@ -15741,7 +15883,7 @@
15741
15883
  var value = cell.getValue();
15742
15884
 
15743
15885
  if (typeof DT != "undefined") {
15744
- var newDatetime = (window.DateTime || luxon.DateTime).fromFormat(value, inputFormat);
15886
+ var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
15745
15887
 
15746
15888
  if (newDatetime.isValid) {
15747
15889
  if (formatterParams.timezone) {
@@ -15750,7 +15892,7 @@
15750
15892
 
15751
15893
  return newDatetime.toFormat(outputFormat);
15752
15894
  } else {
15753
- if (invalid === true) {
15895
+ if (invalid === true || !value) {
15754
15896
  return value;
15755
15897
  } else if (typeof invalid === "function") {
15756
15898
  return invalid(value);
@@ -15774,7 +15916,7 @@
15774
15916
  var value = cell.getValue();
15775
15917
 
15776
15918
  if (typeof DT != "undefined") {
15777
- var newDatetime = DT.fromFormat(value, inputFormat);
15919
+ var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
15778
15920
 
15779
15921
  if (newDatetime.isValid) {
15780
15922
  if (humanize) ; else {
@@ -16409,7 +16551,7 @@
16409
16551
  this.subscribe("cell-layout", this.layoutCell.bind(this));
16410
16552
  this.subscribe("column-init", this.initializeColumn.bind(this));
16411
16553
  this.subscribe("column-width", this.layout.bind(this));
16412
- this.subscribe("row-layout-before", this.layoutRow.bind(this));
16554
+ this.subscribe("row-layout-after", this.layoutRow.bind(this));
16413
16555
  this.subscribe("table-layout", this.layout.bind(this));
16414
16556
  this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
16415
16557
  this.subscribe("columns-loading", this.reset.bind(this));
@@ -16705,6 +16847,7 @@
16705
16847
 
16706
16848
  this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
16707
16849
  this.subscribe("row-deleting", this.detachRow.bind(this));
16850
+ this.subscribe("rows-visible", this.visibleRows.bind(this));
16708
16851
  this.registerDisplayHandler(this.getRows.bind(this), 10);
16709
16852
  }
16710
16853
  }, {
@@ -16717,6 +16860,14 @@
16717
16860
  key: "isFrozen",
16718
16861
  value: function isFrozen() {
16719
16862
  return !!this.rows.length;
16863
+ }
16864
+ }, {
16865
+ key: "visibleRows",
16866
+ value: function visibleRows(viewable, rows) {
16867
+ this.rows.forEach(function (row) {
16868
+ rows.push(row);
16869
+ });
16870
+ return rows;
16720
16871
  } //filter frozen rows out of display data
16721
16872
 
16722
16873
  }, {
@@ -16898,6 +17049,7 @@
16898
17049
  this.groups = [];
16899
17050
  this.groupList = [];
16900
17051
  this.generator = generator;
17052
+ this.element = false;
16901
17053
  this.elementContents = false;
16902
17054
  this.height = 0;
16903
17055
  this.outerHeight = 0;
@@ -16921,10 +17073,16 @@
16921
17073
  group.wipe();
16922
17074
  });
16923
17075
  } else {
16924
- this.element = false;
16925
- this.arrowElement = false;
16926
- this.elementContents = false;
17076
+ this.rows.forEach(function (row) {
17077
+ if (row.modules) {
17078
+ delete row.modules.group;
17079
+ }
17080
+ });
16927
17081
  }
17082
+
17083
+ this.element = false;
17084
+ this.arrowElement = false;
17085
+ this.elementContents = false;
16928
17086
  }
16929
17087
  }, {
16930
17088
  key: "createElements",
@@ -16962,70 +17120,13 @@
16962
17120
  value: function addBindings() {
16963
17121
  var _this2 = this;
16964
17122
 
16965
- var dblTap, tapHold, tap, toggleElement;
17123
+ var toggleElement;
16966
17124
 
16967
- if ((this.groupManager.table.options.groupContextMenu || this.groupManager.table.options.groupClickMenu) && this.groupManager.table.modExists("menu")) {
16968
- this.groupManager.table.modules.menu.initializeGroup.call(this.groupManager.table.modules.menu, this);
16969
- }
16970
-
16971
- if (this.groupManager.table.options.groupTap) {
16972
- tap = false;
16973
- this.element.addEventListener("touchstart", function (e) {
16974
- tap = true;
16975
- }, {
16976
- passive: true
16977
- });
16978
- this.element.addEventListener("touchend", function (e) {
16979
- if (tap) {
16980
- _this2.groupManager.table.options.groupTap(e, _this2.getComponent());
16981
- }
16982
-
16983
- tap = false;
16984
- });
16985
- }
16986
-
16987
- if (this.groupManager.table.options.groupDblTap) {
16988
- dblTap = null;
16989
- this.element.addEventListener("touchend", function (e) {
16990
- if (dblTap) {
16991
- clearTimeout(dblTap);
16992
- dblTap = null;
16993
-
16994
- _this2.groupManager.table.options.groupDblTap(e, _this2.getComponent());
16995
- } else {
16996
- dblTap = setTimeout(function () {
16997
- clearTimeout(dblTap);
16998
- dblTap = null;
16999
- }, 300);
17000
- }
17001
- });
17002
- }
17003
-
17004
- if (this.groupManager.table.options.groupTapHold) {
17005
- tapHold = null;
17006
- this.element.addEventListener("touchstart", function (e) {
17007
- clearTimeout(tapHold);
17008
- tapHold = setTimeout(function () {
17009
- clearTimeout(tapHold);
17010
- tapHold = null;
17011
- tap = false;
17012
-
17013
- _this2.groupManager.table.options.groupTapHold(e, _this2.getComponent());
17014
- }, 1000);
17015
- }, {
17016
- passive: true
17017
- });
17018
- this.element.addEventListener("touchend", function (e) {
17019
- clearTimeout(tapHold);
17020
- tapHold = null;
17021
- });
17022
- }
17023
-
17024
- if (this.groupManager.table.options.groupToggleElement) {
17025
- toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
17026
- toggleElement.addEventListener("click", function (e) {
17027
- e.stopPropagation();
17028
- e.stopImmediatePropagation();
17125
+ if (this.groupManager.table.options.groupToggleElement) {
17126
+ toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
17127
+ toggleElement.addEventListener("click", function (e) {
17128
+ e.stopPropagation();
17129
+ e.stopImmediatePropagation();
17029
17130
 
17030
17131
  _this2.toggleVisibility();
17031
17132
  });
@@ -17321,7 +17422,7 @@
17321
17422
 
17322
17423
  if (this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination) {
17323
17424
  this.element.classList.add("tabulator-group-visible");
17324
- var prev = this.getElement();
17425
+ var prev = this.generateElement();
17325
17426
 
17326
17427
  if (this.groupList.length) {
17327
17428
  this.groupList.forEach(function (group) {
@@ -17440,7 +17541,12 @@
17440
17541
  }, {
17441
17542
  key: "getElement",
17442
17543
  value: function getElement() {
17443
- this.addBindingsd = false;
17544
+ return this.elementContents ? this.element : this.generateElement();
17545
+ }
17546
+ }, {
17547
+ key: "generateElement",
17548
+ value: function generateElement() {
17549
+ this.addBindings = false;
17444
17550
 
17445
17551
  this._visSet();
17446
17552
 
@@ -17616,13 +17722,12 @@
17616
17722
  key: "initialize",
17617
17723
  value: function initialize() {
17618
17724
  if (this.table.options.groupBy) {
17619
- this.configureGroupSetup();
17620
-
17621
17725
  if (this.table.options.groupUpdateOnCellEdit) {
17622
17726
  this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
17623
17727
  this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
17624
17728
  }
17625
17729
 
17730
+ this.subscribe("table-built", this.configureGroupSetup.bind(this));
17626
17731
  this.subscribe("row-deleting", this.rowDeleting.bind(this));
17627
17732
  this.subscribe("row-deleted", this.rowsUpdated.bind(this));
17628
17733
  this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
@@ -17789,7 +17894,13 @@
17789
17894
  key: "setGroupBy",
17790
17895
  value: function setGroupBy(groups) {
17791
17896
  this.table.options.groupBy = groups;
17792
- this.configureGroupSetup();
17897
+
17898
+ if (!this.initialized) {
17899
+ this.initialize();
17900
+ } else {
17901
+ this.configureGroupSetup();
17902
+ }
17903
+
17793
17904
  this.refreshData();
17794
17905
  this.trackChanges();
17795
17906
  }
@@ -18417,7 +18528,7 @@
18417
18528
  data = [];
18418
18529
  this.hasIndex = false;
18419
18530
  this.dispatchExternal("htmlImporting");
18420
- rows = rows ? rows.getElementsByTagName("tr") : []; //check for tablator inline options
18531
+ rows = rows ? rows.getElementsByTagName("tr") : []; //check for Tabulator inline options
18421
18532
 
18422
18533
  this._extractOptions(element, options);
18423
18534
 
@@ -18457,7 +18568,7 @@
18457
18568
  key: "_extractOptions",
18458
18569
  value: function _extractOptions(element, options, defaultOptions) {
18459
18570
  var attributes = element.attributes;
18460
- var optionsArr = defaultOptions ? Object.assign([], defaultOptions) : Object.keys(options);
18571
+ var optionsArr = defaultOptions ? Object.keys(defaultOptions) : Object.keys(options);
18461
18572
  var optionsList = {};
18462
18573
  optionsArr.forEach(function (item) {
18463
18574
  optionsList[item.toLowerCase()] = item;
@@ -18525,12 +18636,10 @@
18525
18636
 
18526
18637
  if (width && !col.width) {
18527
18638
  col.width = width;
18528
- } //check for tablator inline options
18529
-
18639
+ } //check for Tabulator inline options
18530
18640
 
18531
- header.attributes; // //check for tablator inline options
18532
18641
 
18533
- this._extractOptions(header, col, Column$1.prototype.defaultOptionList);
18642
+ this._extractOptions(header, col, this.table.columnManager.optionsList.registeredDefaults);
18534
18643
 
18535
18644
  this.fieldIndex[index] = col.field;
18536
18645
 
@@ -18570,6 +18679,280 @@
18570
18679
 
18571
18680
  HtmlTableImport.moduleName = "htmlTableImport";
18572
18681
 
18682
+ function csvImporter(input) {
18683
+ var data = [],
18684
+ row = 0,
18685
+ col = 0,
18686
+ inQuote = false; //Iterate over each character
18687
+
18688
+ for (var index = 0; index < input.length; index++) {
18689
+ var _char = input[index],
18690
+ nextChar = input[index + 1]; //Initialize empty row
18691
+
18692
+ if (!data[row]) {
18693
+ data[row] = [];
18694
+ } //Initialize empty column
18695
+
18696
+
18697
+ if (!data[row][col]) {
18698
+ data[row][col] = "";
18699
+ } //Handle quotation mark inside string
18700
+
18701
+
18702
+ if (_char == '"' && inQuote && nextChar == '"') {
18703
+ data[row][col] += _char;
18704
+ index++;
18705
+ continue;
18706
+ } //Begin / End Quote
18707
+
18708
+
18709
+ if (_char == '"') {
18710
+ inQuote = !inQuote;
18711
+ continue;
18712
+ } //Next column (if not in quote)
18713
+
18714
+
18715
+ if (_char == ',' && !inQuote) {
18716
+ col++;
18717
+ continue;
18718
+ } //New row if new line and not in quote (CRLF)
18719
+
18720
+
18721
+ if (_char == '\r' && nextChar == '\n' && !inQuote) {
18722
+ col = 0;
18723
+ row++;
18724
+ index++;
18725
+ continue;
18726
+ } //New row if new line and not in quote (CR or LF)
18727
+
18728
+
18729
+ if ((_char == '\r' || _char == '\n') && !inQuote) {
18730
+ col = 0;
18731
+ row++;
18732
+ continue;
18733
+ } //Normal Character, append to column
18734
+
18735
+
18736
+ data[row][col] += _char;
18737
+ }
18738
+
18739
+ return data;
18740
+ }
18741
+
18742
+ function json$1 (input) {
18743
+ try {
18744
+ return JSON.parse(input);
18745
+ } catch (e) {
18746
+ console.warn("JSON Import Error - File contents is invalid JSON", e);
18747
+ return Promise.reject();
18748
+ }
18749
+ }
18750
+
18751
+ var defaultImporters = {
18752
+ csv: csvImporter,
18753
+ json: json$1
18754
+ };
18755
+
18756
+ var Import = /*#__PURE__*/function (_Module) {
18757
+ _inherits(Import, _Module);
18758
+
18759
+ var _super = _createSuper(Import);
18760
+
18761
+ function Import(table) {
18762
+ var _this;
18763
+
18764
+ _classCallCheck(this, Import);
18765
+
18766
+ _this = _super.call(this, table);
18767
+
18768
+ _this.registerTableOption("importFormat");
18769
+
18770
+ _this.registerTableOption("importReader", "text");
18771
+
18772
+ return _this;
18773
+ }
18774
+
18775
+ _createClass(Import, [{
18776
+ key: "initialize",
18777
+ value: function initialize() {
18778
+ this.registerTableFunction("import", this.importFromFile.bind(this));
18779
+
18780
+ if (this.table.options.importFormat) {
18781
+ this.subscribe("data-loading", this.loadDataCheck.bind(this), 10);
18782
+ this.subscribe("data-load", this.loadData.bind(this), 10);
18783
+ }
18784
+ }
18785
+ }, {
18786
+ key: "loadDataCheck",
18787
+ value: function loadDataCheck(data) {
18788
+ return typeof data === "string";
18789
+ }
18790
+ }, {
18791
+ key: "loadData",
18792
+ value: function loadData(data, params, config, silent, previousData) {
18793
+ return this.importData(this.lookupImporter(), data).then(this.structureData.bind(this))["catch"](function (err) {
18794
+ console.error("Import Error:", err || "Unable to import data");
18795
+ return Promise.reject(err);
18796
+ });
18797
+ }
18798
+ }, {
18799
+ key: "lookupImporter",
18800
+ value: function lookupImporter(importFormat) {
18801
+ var importer;
18802
+
18803
+ if (!importFormat) {
18804
+ importFormat = this.table.options.importFormat;
18805
+ }
18806
+
18807
+ if (typeof importFormat === "string") {
18808
+ importer = Import.importers[importFormat];
18809
+ } else {
18810
+ importer = importFormat;
18811
+ }
18812
+
18813
+ if (!importer) {
18814
+ console.error("Import Error - Importer not found:", importFormat);
18815
+ }
18816
+
18817
+ return importer;
18818
+ }
18819
+ }, {
18820
+ key: "importFromFile",
18821
+ value: function importFromFile(importFormat, extension) {
18822
+ var importer = this.lookupImporter(importFormat);
18823
+
18824
+ if (importer) {
18825
+ return this.pickFile(extension).then(this.importData.bind(this, importer)).then(this.structureData.bind(this)).then(this.setData.bind(this))["catch"](function (err) {
18826
+ console.error("Import Error:", err || "Unable to import file");
18827
+ return Promise.reject(err);
18828
+ });
18829
+ }
18830
+ }
18831
+ }, {
18832
+ key: "pickFile",
18833
+ value: function pickFile(extensions) {
18834
+ var _this2 = this;
18835
+
18836
+ return new Promise(function (resolve, reject) {
18837
+ var input = document.createElement("input");
18838
+ input.type = "file";
18839
+ input.accept = extensions;
18840
+ input.addEventListener("change", function (e) {
18841
+ var file = input.files[0],
18842
+ reader = new FileReader();
18843
+
18844
+ switch (_this2.table.options.importReader) {
18845
+ case "buffer":
18846
+ reader.readAsArrayBuffer(file);
18847
+ break;
18848
+
18849
+ case "binary":
18850
+ reader.readAsBinaryString(file);
18851
+ break;
18852
+
18853
+ case "url":
18854
+ reader.readAsDataURL(file);
18855
+ break;
18856
+
18857
+ case "text":
18858
+ default:
18859
+ reader.readAsText(file);
18860
+ }
18861
+
18862
+ reader.onload = function (e) {
18863
+ resolve(reader.result);
18864
+ };
18865
+
18866
+ reader.onerror = function (e) {
18867
+ console.warn("File Load Error - Unable to read file");
18868
+ reject();
18869
+ };
18870
+ });
18871
+ input.click();
18872
+ });
18873
+ }
18874
+ }, {
18875
+ key: "importData",
18876
+ value: function importData(importer, fileContents) {
18877
+ var data = importer.call(this.table, fileContents);
18878
+
18879
+ if (data instanceof Promise) {
18880
+ return data;
18881
+ } else {
18882
+ return data ? Promise.resolve(data) : Promise.reject();
18883
+ }
18884
+ }
18885
+ }, {
18886
+ key: "structureData",
18887
+ value: function structureData(parsedData) {
18888
+ var data = [];
18889
+ console.log("structure", parsedData);
18890
+
18891
+ if (Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])) {
18892
+ if (this.table.options.autoColumns) {
18893
+ data = this.structureArrayToObject(parsedData);
18894
+ } else {
18895
+ data = this.structureArrayToColumns(parsedData);
18896
+ }
18897
+
18898
+ return data;
18899
+ } else {
18900
+ return parsedData;
18901
+ }
18902
+ }
18903
+ }, {
18904
+ key: "structureArrayToObject",
18905
+ value: function structureArrayToObject(parsedData) {
18906
+ var columns = parsedData.shift();
18907
+ var data = parsedData.map(function (values) {
18908
+ var row = {};
18909
+ columns.forEach(function (key, i) {
18910
+ row[key] = values[i];
18911
+ });
18912
+ return row;
18913
+ });
18914
+ return data;
18915
+ }
18916
+ }, {
18917
+ key: "structureArrayToColumns",
18918
+ value: function structureArrayToColumns(parsedData) {
18919
+ var data = [],
18920
+ columns = this.table.getColumns(); //remove first row if it is the column names
18921
+
18922
+ if (columns[0] && parsedData[0][0]) {
18923
+ if (columns[0].getDefinition().title === parsedData[0][0]) {
18924
+ parsedData.shift();
18925
+ }
18926
+ } //convert row arrays to objects
18927
+
18928
+
18929
+ parsedData.forEach(function (rowData) {
18930
+ var row = {};
18931
+ rowData.forEach(function (value, index) {
18932
+ var column = columns[index];
18933
+
18934
+ if (column) {
18935
+ row[column.getField()] = value;
18936
+ }
18937
+ });
18938
+ data.push(row);
18939
+ });
18940
+ return data;
18941
+ }
18942
+ }, {
18943
+ key: "setData",
18944
+ value: function setData(data) {
18945
+ return this.table.setData(data);
18946
+ }
18947
+ }]);
18948
+
18949
+ return Import;
18950
+ }(Module);
18951
+
18952
+ Import.moduleName = "import"; //load defaults
18953
+
18954
+ Import.importers = defaultImporters;
18955
+
18573
18956
  var Interaction = /*#__PURE__*/function (_Module) {
18574
18957
  _inherits(Interaction, _Module);
18575
18958
 
@@ -18649,6 +19032,11 @@
18649
19032
  tap: null,
18650
19033
  tapDbl: null,
18651
19034
  tapHold: null
19035
+ },
19036
+ group: {
19037
+ tap: null,
19038
+ tapDbl: null,
19039
+ tapHold: null
18652
19040
  }
18653
19041
  };
18654
19042
 
@@ -18907,9 +19295,9 @@
18907
19295
  scrollPageDown: 34,
18908
19296
  scrollToStart: 36,
18909
19297
  scrollToEnd: 35,
18910
- undo: "ctrl + 90",
18911
- redo: "ctrl + 89",
18912
- copyToClipboard: "ctrl + 67"
19298
+ undo: ["ctrl + 90", "meta + 90"],
19299
+ redo: ["ctrl + 89", "meta + 89"],
19300
+ copyToClipboard: ["ctrl + 67", "meta + 89"]
18913
19301
  };
18914
19302
 
18915
19303
  var defaultActions = {
@@ -19036,7 +19424,7 @@
19036
19424
  _this.keyupBinding = false;
19037
19425
  _this.keydownBinding = false;
19038
19426
 
19039
- _this.registerTableOption("keybindings", []); //array for keybindings
19427
+ _this.registerTableOption("keybindings", {}); //array for keybindings
19040
19428
 
19041
19429
 
19042
19430
  _this.registerTableOption("tabEndNewRow", false); //create new row when tab to end of table
@@ -19054,16 +19442,8 @@
19054
19442
  this.pressedKeys = [];
19055
19443
 
19056
19444
  if (bindings !== false) {
19057
- for (var key in Keybindings.bindings) {
19058
- mergedBindings[key] = Keybindings.bindings[key];
19059
- }
19060
-
19061
- if (Object.keys(bindings).length) {
19062
- for (var _key in bindings) {
19063
- mergedBindings[_key] = bindings[_key];
19064
- }
19065
- }
19066
-
19445
+ Object.assign(mergedBindings, Keybindings.bindings);
19446
+ Object.assign(mergedBindings, bindings);
19067
19447
  this.mapBindings(mergedBindings);
19068
19448
  this.bindEvents();
19069
19449
  }
@@ -19083,7 +19463,10 @@
19083
19463
  }
19084
19464
 
19085
19465
  bindings[key].forEach(function (binding) {
19086
- _this2.mapBinding(key, binding);
19466
+ var bindingList = Array.isArray(binding) ? binding : [binding];
19467
+ bindingList.forEach(function (item) {
19468
+ _this2.mapBinding(key, item);
19469
+ });
19087
19470
  });
19088
19471
  }
19089
19472
  } else {
@@ -19123,7 +19506,7 @@
19123
19506
  break;
19124
19507
 
19125
19508
  default:
19126
- symbol = parseInt(symbol);
19509
+ symbol = isNaN(symbol) ? symbol.toUpperCase().charCodeAt(0) : parseInt(symbol);
19127
19510
  binding.keys.push(symbol);
19128
19511
 
19129
19512
  if (!_this3.watchKeys[symbol]) {
@@ -19225,11 +19608,14 @@
19225
19608
  _classCallCheck(this, Menu);
19226
19609
 
19227
19610
  _this = _super.call(this, table);
19611
+ _this.menuContainer = null;
19228
19612
  _this.menuElements = [];
19229
19613
  _this.blurEvent = _this.hideMenu.bind(_assertThisInitialized(_this));
19230
19614
  _this.escEvent = _this.escMenu.bind(_assertThisInitialized(_this));
19231
19615
  _this.nestedMenuBlock = false;
19232
19616
  _this.positionReversedX = false;
19617
+ _this.currentComponent = null;
19618
+ _this.columnSubscribers = {};
19233
19619
 
19234
19620
  _this.registerTableOption("rowContextMenu", false);
19235
19621
 
@@ -19239,8 +19625,12 @@
19239
19625
 
19240
19626
  _this.registerTableOption("groupClickMenu", false);
19241
19627
 
19628
+ _this.registerTableOption("menuContainer", false);
19629
+
19242
19630
  _this.registerColumnOption("headerContextMenu");
19243
19631
 
19632
+ _this.registerColumnOption("headerClickMenu");
19633
+
19244
19634
  _this.registerColumnOption("headerMenu");
19245
19635
 
19246
19636
  _this.registerColumnOption("contextMenu");
@@ -19253,133 +19643,157 @@
19253
19643
  _createClass(Menu, [{
19254
19644
  key: "initialize",
19255
19645
  value: function initialize() {
19256
- this.subscribe("cell-layout", this.layoutCell.bind(this));
19646
+ this.lookupMenuContainer();
19647
+ this.initializeRowWatchers();
19648
+ this.initializeGroupWatchers();
19257
19649
  this.subscribe("column-init", this.initializeColumn.bind(this));
19258
- this.subscribe("row-init", this.initializeRow.bind(this));
19259
19650
  }
19260
19651
  }, {
19261
- key: "layoutCell",
19262
- value: function layoutCell(cell) {
19263
- if (cell.column.definition.contextMenu || cell.column.definition.clickMenu) {
19264
- this.initializeCell(cell);
19652
+ key: "lookupMenuContainer",
19653
+ value: function lookupMenuContainer() {
19654
+ this.menuContainer = this.table.options.menuContainer;
19655
+
19656
+ if (typeof this.menuContainer === "string") {
19657
+ this.menuContainer = document.querySelector(this.menuContainer);
19658
+
19659
+ if (!this.menuContainer) {
19660
+ console.warn("Menu Error - no container element found matching selector:", this.table.options.menuContainer, "(defaulting to document body)");
19661
+ }
19662
+ } else if (this.menuContainer === true) {
19663
+ this.menuContainer = this.table.element;
19664
+ }
19665
+
19666
+ if (this.menuContainer && !this.checkMenuContainerIsParent(this.menuContainer)) {
19667
+ this.menuContainer = false;
19668
+ console.warn("Menu Error - container element does not contain this table:", this.table.options.menuContainer, "(defaulting to document body)");
19669
+ }
19670
+
19671
+ if (!this.menuContainer) {
19672
+ this.menuContainer = document.body;
19265
19673
  }
19266
19674
  }
19267
19675
  }, {
19268
- key: "initializeColumn",
19269
- value: function initializeColumn(column) {
19270
- var def = column.definition;
19676
+ key: "checkMenuContainerIsParent",
19677
+ value: function checkMenuContainerIsParent(container) {
19678
+ var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.table.element;
19271
19679
 
19272
- if (def.headerContextMenu || def.headerClickMenu || def.headerMenu) {
19273
- this.initializeColumnHeader(column);
19680
+ if (container === element) {
19681
+ return true;
19682
+ } else {
19683
+ return element.parentNode ? this.checkMenuContainerIsParent(container, element.parentNode) : false;
19274
19684
  }
19275
19685
  }
19276
19686
  }, {
19277
- key: "initializeColumnHeader",
19278
- value: function initializeColumnHeader(column) {
19279
- var _this2 = this;
19687
+ key: "initializeRowWatchers",
19688
+ value: function initializeRowWatchers() {
19689
+ if (this.table.options.rowContextMenu) {
19690
+ this.subscribe("row-contextmenu", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
19691
+ this.table.on("rowTapHold", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
19692
+ }
19280
19693
 
19281
- var headerMenuEl;
19694
+ if (this.table.options.rowClickMenu) {
19695
+ this.subscribe("row-click", this.loadMenuEvent.bind(this, this.table.options.rowClickMenu));
19696
+ }
19697
+ }
19698
+ }, {
19699
+ key: "initializeGroupWatchers",
19700
+ value: function initializeGroupWatchers() {
19701
+ if (this.table.options.groupContextMenu) {
19702
+ this.subscribe("group-contextmenu", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
19703
+ this.table.on("groupTapHold", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
19704
+ }
19282
19705
 
19283
- if (column.definition.headerContextMenu) {
19284
- column.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, column, column.definition.headerContextMenu));
19285
- this.tapHold(column, column.definition.headerContextMenu);
19286
- } // if(column.definition.headerClickMenu){
19287
- // column.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, column, column.definition.headerClickMenu));
19288
- // }
19706
+ if (this.table.options.groupClickMenu) {
19707
+ this.subscribe("group-click", this.loadMenuEvent.bind(this, this.table.options.groupClickMenu));
19708
+ }
19709
+ }
19710
+ }, {
19711
+ key: "initializeColumn",
19712
+ value: function initializeColumn(column) {
19713
+ var def = column.definition; //handle column events
19289
19714
 
19715
+ if (def.headerContextMenu && !this.columnSubscribers.headerContextMenu) {
19716
+ this.columnSubscribers.headerContextMenu = this.loadMenuTableColumnEvent.bind(this, "headerContextMenu");
19717
+ this.subscribe("column-contextmenu", this.columnSubscribers.headerContextMenu);
19718
+ this.table.on("headerTapHold", this.loadMenuTableColumnEvent.bind(this, "headerContextMenu"));
19719
+ }
19290
19720
 
19291
- if (column.definition.headerMenu) {
19292
- headerMenuEl = document.createElement("span");
19293
- headerMenuEl.classList.add("tabulator-header-menu-button");
19294
- headerMenuEl.innerHTML = "&vellip;";
19295
- headerMenuEl.addEventListener("click", function (e) {
19296
- e.stopPropagation();
19297
- e.preventDefault();
19721
+ if (def.headerClickMenu && !this.columnSubscribers.headerClickMenu) {
19722
+ this.columnSubscribers.headerClickMenu = this.loadMenuTableColumnEvent.bind(this, "headerClickMenu");
19723
+ this.subscribe("column-click", this.columnSubscribers.headerClickMenu);
19724
+ }
19298
19725
 
19299
- _this2.LoadMenuEvent(column, column.definition.headerMenu, e);
19300
- });
19301
- column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild);
19726
+ if (def.headerMenu) {
19727
+ this.initializeColumnHeaderMenu(column);
19728
+ } //handle cell events
19729
+
19730
+
19731
+ if (def.contextMenu && !this.columnSubscribers.contextMenu) {
19732
+ this.columnSubscribers.contextMenu = this.loadMenuTableCellEvent.bind(this, "contextMenu");
19733
+ this.subscribe("cell-contextmenu", this.columnSubscribers.contextMenu);
19734
+ this.table.on("cellTapHold", this.loadMenuTableCellEvent.bind(this, "contextMenu"));
19302
19735
  }
19303
- }
19304
- }, {
19305
- key: "LoadMenuEvent",
19306
- value: function LoadMenuEvent(component, menu, e) {
19307
- menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu; // if(component instanceof Cell){
19308
- // e.stopImmediatePropagation();
19309
- // }
19310
19736
 
19311
- this.loadMenu(e, component, menu);
19737
+ if (def.clickMenu && !this.columnSubscribers.clickMenu) {
19738
+ this.columnSubscribers.clickMenu = this.loadMenuTableCellEvent.bind(this, "clickMenu");
19739
+ this.subscribe("cell-click", this.columnSubscribers.clickMenu);
19740
+ }
19312
19741
  }
19313
19742
  }, {
19314
- key: "tapHold",
19315
- value: function tapHold(component, menu) {
19316
- var _this3 = this;
19317
-
19318
- var element = component.getElement(),
19319
- tapHold = null,
19320
- loaded = false;
19321
- element.addEventListener("touchstart", function (e) {
19322
- clearTimeout(tapHold);
19323
- loaded = false;
19324
- tapHold = setTimeout(function () {
19325
- clearTimeout(tapHold);
19326
- tapHold = null;
19327
- loaded = true;
19743
+ key: "initializeColumnHeaderMenu",
19744
+ value: function initializeColumnHeaderMenu(column) {
19745
+ var _this2 = this;
19328
19746
 
19329
- _this3.LoadMenuEvent(component, menu, e);
19330
- }, 1000);
19331
- }, {
19332
- passive: true
19333
- });
19334
- element.addEventListener("touchend", function (e) {
19335
- clearTimeout(tapHold);
19336
- tapHold = null;
19747
+ var headerMenuEl;
19748
+ headerMenuEl = document.createElement("span");
19749
+ headerMenuEl.classList.add("tabulator-header-menu-button");
19750
+ headerMenuEl.innerHTML = "&vellip;";
19751
+ headerMenuEl.addEventListener("click", function (e) {
19752
+ e.stopPropagation();
19753
+ e.preventDefault();
19337
19754
 
19338
- if (loaded) {
19339
- e.preventDefault();
19340
- }
19755
+ _this2.loadMenuEvent(column.definition.headerMenu, e, column);
19341
19756
  });
19757
+ column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild);
19342
19758
  }
19343
19759
  }, {
19344
- key: "initializeCell",
19345
- value: function initializeCell(cell) {
19346
- if (cell.column.definition.contextMenu) {
19347
- cell.getElement(true).addEventListener("contextmenu", this.LoadMenuEvent.bind(this, cell, cell.column.definition.contextMenu));
19348
- this.tapHold(cell, cell.column.definition.contextMenu);
19760
+ key: "loadMenuTableCellEvent",
19761
+ value: function loadMenuTableCellEvent(option, e, cell) {
19762
+ if (cell._cell) {
19763
+ cell = cell._cell;
19349
19764
  }
19350
19765
 
19351
- if (cell.column.definition.clickMenu) {
19352
- cell.getElement(true).addEventListener("click", this.LoadMenuEvent.bind(this, cell, cell.column.definition.clickMenu));
19766
+ if (cell.column.definition[option]) {
19767
+ this.loadMenuEvent(cell.column.definition[option], e, cell);
19353
19768
  }
19354
19769
  }
19355
19770
  }, {
19356
- key: "initializeRow",
19357
- value: function initializeRow(row) {
19358
- if (this.table.options.rowContextMenu) {
19359
- row.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, row, this.table.options.rowContextMenu));
19360
- this.tapHold(row, this.table.options.rowContextMenu);
19771
+ key: "loadMenuTableColumnEvent",
19772
+ value: function loadMenuTableColumnEvent(option, e, column) {
19773
+ if (column._column) {
19774
+ column = column._column;
19361
19775
  }
19362
19776
 
19363
- if (this.table.options.rowClickMenu) {
19364
- row.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, row, this.table.options.rowClickMenu));
19777
+ if (column.definition[option]) {
19778
+ this.loadMenuEvent(column.definition[option], e, column);
19365
19779
  }
19366
19780
  }
19367
19781
  }, {
19368
- key: "initializeGroup",
19369
- value: function initializeGroup(group) {
19370
- if (this.table.options.groupContextMenu) {
19371
- group.getElement().addEventListener("contextmenu", this.LoadMenuEvent.bind(this, group, this.table.options.groupContextMenu));
19372
- this.tapHold(group, this.table.options.groupContextMenu);
19782
+ key: "loadMenuEvent",
19783
+ value: function loadMenuEvent(menu, e, component) {
19784
+ if (component._group) {
19785
+ component = component._group;
19786
+ } else if (component._row) {
19787
+ component = component._row;
19373
19788
  }
19374
19789
 
19375
- if (this.table.options.groupClickMenu) {
19376
- group.getElement().addEventListener("click", this.LoadMenuEvent.bind(this, group, this.table.options.groupClickMenu));
19377
- }
19790
+ menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu;
19791
+ this.loadMenu(e, component, menu);
19378
19792
  }
19379
19793
  }, {
19380
19794
  key: "loadMenu",
19381
19795
  value: function loadMenu(e, component, menu, parentEl) {
19382
- var _this4 = this;
19796
+ var _this3 = this;
19383
19797
 
19384
19798
  var touch = !(e instanceof MouseEvent);
19385
19799
  var menuEl = document.createElement("div");
@@ -19402,7 +19816,7 @@
19402
19816
  }
19403
19817
  } else {
19404
19818
  this.nestedMenuBlock = setTimeout(function () {
19405
- _this4.nestedMenuBlock = false;
19819
+ _this3.nestedMenuBlock = false;
19406
19820
  }, 100);
19407
19821
  }
19408
19822
 
@@ -19421,7 +19835,7 @@
19421
19835
  itemEl.classList.add("tabulator-menu-item");
19422
19836
 
19423
19837
  if (typeof label == "function") {
19424
- label = label.call(_this4.table, component.getComponent());
19838
+ label = label.call(_this3.table, component.getComponent());
19425
19839
  }
19426
19840
 
19427
19841
  if (label instanceof Node) {
@@ -19431,7 +19845,7 @@
19431
19845
  }
19432
19846
 
19433
19847
  if (typeof disabled == "function") {
19434
- disabled = disabled.call(_this4.table, component.getComponent());
19848
+ disabled = disabled.call(_this3.table, component.getComponent());
19435
19849
  }
19436
19850
 
19437
19851
  if (disabled) {
@@ -19444,9 +19858,9 @@
19444
19858
  itemEl.addEventListener("click", function (e) {
19445
19859
  e.stopPropagation();
19446
19860
 
19447
- _this4.hideOldSubMenus(menuEl);
19861
+ _this3.hideOldSubMenus(menuEl);
19448
19862
 
19449
- _this4.loadMenu(e, component, item.menu, itemEl);
19863
+ _this3.loadMenu(e, component, item.menu, itemEl);
19450
19864
  });
19451
19865
  } else {
19452
19866
  if (item.action) {
@@ -19465,10 +19879,12 @@
19465
19879
  menuEl.appendChild(itemEl);
19466
19880
  });
19467
19881
  menuEl.addEventListener("click", function (e) {
19468
- _this4.hideMenu();
19882
+ _this3.hideMenu();
19469
19883
  });
19470
19884
  this.menuElements.push(menuEl);
19471
19885
  this.positionMenu(menuEl, parentEl, touch, e);
19886
+ this.currentComponent = component;
19887
+ this.dispatchExternal("menuOpened", component.getComponent());
19472
19888
  }
19473
19889
  }, {
19474
19890
  key: "hideOldSubMenus",
@@ -19490,16 +19906,20 @@
19490
19906
  }, {
19491
19907
  key: "positionMenu",
19492
19908
  value: function positionMenu(element, parentEl, touch, e) {
19493
- var _this5 = this;
19909
+ var _this4 = this;
19494
19910
 
19495
- var docHeight = Math.max(document.body.offsetHeight, window.innerHeight),
19496
- x,
19497
- y,
19498
- parentOffset;
19911
+ var x, y, parentOffset;
19499
19912
 
19500
19913
  if (!parentEl) {
19501
19914
  x = touch ? e.touches[0].pageX : e.pageX;
19502
19915
  y = touch ? e.touches[0].pageY : e.pageY;
19916
+
19917
+ if (this.menuContainer !== document.body) {
19918
+ parentOffset = Helpers.elOffset(this.menuContainer);
19919
+ x -= parentOffset.left;
19920
+ y -= parentOffset.top;
19921
+ }
19922
+
19503
19923
  this.positionReversedX = false;
19504
19924
  } else {
19505
19925
  parentOffset = Helpers.elOffset(parentEl);
@@ -19510,36 +19930,36 @@
19510
19930
  element.style.top = y + "px";
19511
19931
  element.style.left = x + "px";
19512
19932
  setTimeout(function () {
19513
- _this5.table.rowManager.element.addEventListener("scroll", _this5.blurEvent);
19933
+ _this4.table.rowManager.element.addEventListener("scroll", _this4.blurEvent);
19514
19934
 
19515
- document.body.addEventListener("click", _this5.blurEvent);
19516
- document.body.addEventListener("contextmenu", _this5.blurEvent);
19517
- window.addEventListener("resize", _this5.blurEvent);
19518
- document.body.addEventListener("keydown", _this5.escEvent);
19935
+ document.body.addEventListener("click", _this4.blurEvent);
19936
+ document.body.addEventListener("contextmenu", _this4.blurEvent);
19937
+ window.addEventListener("resize", _this4.blurEvent);
19938
+ document.body.addEventListener("keydown", _this4.escEvent);
19519
19939
  }, 100);
19520
- document.body.appendChild(element); //move menu to start on bottom edge if it is too close to the edge of the screen
19940
+ this.menuContainer.appendChild(element); //move menu to start on right edge if it is too close to the edge of the screen
19521
19941
 
19522
- if (y + element.offsetHeight >= docHeight) {
19523
- element.style.top = "";
19942
+ if (x + element.offsetWidth >= this.menuContainer.offsetWidth || this.positionReversedX) {
19943
+ element.style.left = "";
19524
19944
 
19525
19945
  if (parentEl) {
19526
- element.style.bottom = docHeight - parentOffset.top - parentEl.offsetHeight - 1 + "px";
19946
+ element.style.right = this.menuContainer.offsetWidth - parentOffset.left + "px";
19527
19947
  } else {
19528
- element.style.bottom = docHeight - y + "px";
19948
+ element.style.right = this.menuContainer.offsetWidth - x + "px";
19529
19949
  }
19530
- } //move menu to start on right edge if it is too close to the edge of the screen
19531
19950
 
19951
+ this.positionReversedX = true;
19952
+ } //move menu to start on bottom edge if it is too close to the edge of the screen
19532
19953
 
19533
- if (x + element.offsetWidth >= document.body.offsetWidth || this.positionReversedX) {
19534
- element.style.left = "";
19954
+
19955
+ if (y + element.offsetHeight >= this.menuContainer.offsetHeight) {
19956
+ element.style.top = "";
19535
19957
 
19536
19958
  if (parentEl) {
19537
- element.style.right = document.documentElement.offsetWidth - parentOffset.left + "px";
19959
+ element.style.bottom = this.menuContainer.offsetHeight - parentOffset.top - parentEl.offsetHeight - 1 + "px";
19538
19960
  } else {
19539
- element.style.right = document.documentElement.offsetWidth - x + "px";
19961
+ element.style.bottom = this.menuContainer.offsetHeight - y + "px";
19540
19962
  }
19541
-
19542
- this.positionReversedX = true;
19543
19963
  }
19544
19964
  }
19545
19965
  }, {
@@ -19567,6 +19987,11 @@
19567
19987
  document.body.removeEventListener("contextmenu", this.blurEvent);
19568
19988
  window.removeEventListener("resize", this.blurEvent);
19569
19989
  this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
19990
+
19991
+ if (this.currentComponent) {
19992
+ this.dispatchExternal("menuClosed", this.currentComponent.getComponent());
19993
+ this.currentComponent = null;
19994
+ }
19570
19995
  }
19571
19996
  }]);
19572
19997
 
@@ -19628,7 +20053,9 @@
19628
20053
  }, {
19629
20054
  key: "initialize",
19630
20055
  value: function initialize() {
19631
- this.subscribe("column-init", this.initializeColumn.bind(this));
20056
+ if (this.table.options.movableColumns) {
20057
+ this.subscribe("column-init", this.initializeColumn.bind(this));
20058
+ }
19632
20059
  }
19633
20060
  }, {
19634
20061
  key: "initializeColumn",
@@ -20240,6 +20667,7 @@
20240
20667
 
20241
20668
  document.body.addEventListener("mousemove", this.moveHover);
20242
20669
  document.body.addEventListener("mouseup", this.endMove);
20670
+ this.dispatchExternal("rowMoving", row.getComponent());
20243
20671
  this.moveHover(e);
20244
20672
  }
20245
20673
  }, {
@@ -20275,6 +20703,8 @@
20275
20703
 
20276
20704
  if (this.toRow) {
20277
20705
  this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter);
20706
+ } else {
20707
+ this.dispatchExternal("rowMoveCancelled", this.moving.getComponent());
20278
20708
  }
20279
20709
 
20280
20710
  this.moving = false;
@@ -20706,6 +21136,63 @@
20706
21136
 
20707
21137
  Mutator.mutators = defaultMutators;
20708
21138
 
21139
+ function rows (pageSize, currentRow, currentPage, totalRows, totalPages) {
21140
+ var el = document.createElement("span"),
21141
+ showingEl = document.createElement("span"),
21142
+ valueEl = document.createElement("span"),
21143
+ ofEl = document.createElement("span"),
21144
+ totalEl = document.createElement("span"),
21145
+ rowsEl = document.createElement("span");
21146
+ this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21147
+ showingEl.innerHTML = value;
21148
+ });
21149
+ valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
21150
+ this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21151
+ ofEl.innerHTML = value;
21152
+ });
21153
+ totalEl.innerHTML = " " + totalRows + " ";
21154
+ this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
21155
+ rowsEl.innerHTML = value;
21156
+ });
21157
+ el.appendChild(showingEl);
21158
+ el.appendChild(valueEl);
21159
+ el.appendChild(ofEl);
21160
+ el.appendChild(totalEl);
21161
+ el.appendChild(rowsEl);
21162
+ return el;
21163
+ }
21164
+
21165
+ function pages (pageSize, currentRow, currentPage, totalRows, totalPages) {
21166
+ var el = document.createElement("span"),
21167
+ showingEl = document.createElement("span"),
21168
+ valueEl = document.createElement("span"),
21169
+ ofEl = document.createElement("span"),
21170
+ totalEl = document.createElement("span"),
21171
+ rowsEl = document.createElement("span");
21172
+ this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
21173
+ showingEl.innerHTML = value;
21174
+ });
21175
+ valueEl.innerHTML = " " + currentPage + " ";
21176
+ this.table.modules.localize.langBind("pagination|counter|of", function (value) {
21177
+ ofEl.innerHTML = value;
21178
+ });
21179
+ totalEl.innerHTML = " " + totalPages + " ";
21180
+ this.table.modules.localize.langBind("pagination|counter|pages", function (value) {
21181
+ rowsEl.innerHTML = value;
21182
+ });
21183
+ el.appendChild(showingEl);
21184
+ el.appendChild(valueEl);
21185
+ el.appendChild(ofEl);
21186
+ el.appendChild(totalEl);
21187
+ el.appendChild(rowsEl);
21188
+ return el;
21189
+ }
21190
+
21191
+ var defaultPageCounters = {
21192
+ rows: rows,
21193
+ pages: pages
21194
+ };
21195
+
20709
21196
  var Page = /*#__PURE__*/function (_Module) {
20710
21197
  _inherits(Page, _Module);
20711
21198
 
@@ -20719,19 +21206,20 @@
20719
21206
  _this = _super.call(this, table);
20720
21207
  _this.mode = "local";
20721
21208
  _this.progressiveLoad = false;
21209
+ _this.element = null;
21210
+ _this.pageCounterElement = null;
21211
+ _this.pageCounter = null;
20722
21212
  _this.size = 0;
20723
21213
  _this.page = 1;
20724
21214
  _this.count = 5;
20725
21215
  _this.max = 1;
21216
+ _this.remoteRowCountEstimate = null;
20726
21217
  _this.displayIndex = 0; //index in display pipeline
20727
21218
 
20728
21219
  _this.initialLoad = true;
20729
21220
  _this.dataChanging = false; //flag to check if data is being changed by this module
20730
21221
 
20731
21222
  _this.pageSizes = [];
20732
- _this.dataReceivedNames = {}; //TODO - remove once pagimation update is complete
20733
-
20734
- _this.dataSentNames = {}; //TODO - remove once pagimation update is complete
20735
21223
 
20736
21224
  _this.registerTableOption("pagination", false); //set pagination type
20737
21225
 
@@ -20742,7 +21230,13 @@
20742
21230
  _this.registerTableOption("paginationSize", false); //set number of rows to a page
20743
21231
 
20744
21232
 
20745
- _this.registerTableOption("paginationInitialPage", 1); //initail page to show on load
21233
+ _this.registerTableOption("paginationInitialPage", 1); //initial page to show on load
21234
+
21235
+
21236
+ _this.registerTableOption("paginationCounter", false); // set pagination counter
21237
+
21238
+
21239
+ _this.registerTableOption("paginationCounterElement", false); // set pagination counter
20746
21240
 
20747
21241
 
20748
21242
  _this.registerTableOption("paginationButtonCount", 5); // set count of page button
@@ -20814,11 +21308,13 @@
20814
21308
  this.registerDisplayHandler(this.restOnRenderBefore.bind(this), 40);
20815
21309
  this.registerDisplayHandler(this.getRows.bind(this), 50);
20816
21310
  this.createElements();
21311
+ this.initializePageCounter();
20817
21312
  this.initializePaginator();
20818
21313
  } else if (this.table.options.progressiveLoad) {
20819
21314
  this.subscribe("data-params", this.remotePageParams.bind(this));
20820
21315
  this.subscribe("data-loaded", this._parseRemoteData.bind(this));
20821
21316
  this.subscribe("table-built", this.calculatePageSizes.bind(this));
21317
+ this.subscribe("data-processed", this.initialLoadComplete.bind(this));
20822
21318
  this.initializeProgressive(this.table.options.progressiveLoad);
20823
21319
 
20824
21320
  if (this.table.options.progressiveLoad === "scroll") {
@@ -20939,7 +21435,7 @@
20939
21435
  margin = this.table.options.progressiveLoadScrollMargin || element.clientHeight * 2;
20940
21436
 
20941
21437
  if (diff < margin) {
20942
- this.nextPage();
21438
+ this.nextPage()["catch"](function () {}); //consume the exception thrown when on the last page
20943
21439
  }
20944
21440
  }
20945
21441
  }
@@ -21036,14 +21532,36 @@
21036
21532
  });
21037
21533
  this.pageSizeSelect.value = this.size;
21038
21534
  }
21039
- } //setup pageination
21535
+ }
21536
+ }, {
21537
+ key: "initializePageCounter",
21538
+ value: function initializePageCounter() {
21539
+ var counter = this.table.options.paginationCounter,
21540
+ pageCounter = null;
21541
+
21542
+ if (counter) {
21543
+ if (typeof counter === "function") {
21544
+ pageCounter = counter;
21545
+ } else {
21546
+ pageCounter = Page.pageCounters[counter];
21547
+ }
21548
+
21549
+ if (pageCounter) {
21550
+ this.pageCounter = pageCounter;
21551
+ this.pageCounterElement = document.createElement("span");
21552
+ this.pageCounterElement.classList.add("tabulator-page-counter");
21553
+ } else {
21554
+ console.warn("Pagination Error - No such page counter found: ", counter);
21555
+ }
21556
+ }
21557
+ } //setup pagination
21040
21558
 
21041
21559
  }, {
21042
21560
  key: "initializePaginator",
21043
21561
  value: function initializePaginator(hidden) {
21044
21562
  var _this3 = this;
21045
21563
 
21046
- var pageSelectLabel;
21564
+ var pageSelectLabel, paginationCounterHolder;
21047
21565
 
21048
21566
  if (!hidden) {
21049
21567
  //build pagination element
@@ -21124,6 +21642,25 @@
21124
21642
  this.element.appendChild(this.lastBut);
21125
21643
 
21126
21644
  if (!this.table.options.paginationElement && !hidden) {
21645
+ if (this.table.options.paginationCounter) {
21646
+
21647
+ if (this.table.options.paginationCounterElement) {
21648
+ if (this.table.options.paginationCounterElement instanceof HTMLElement) {
21649
+ this.table.options.paginationCounterElement.appendChild(this.pageCounterElement);
21650
+ } else if (typeof this.table.options.paginationCounterElement === "string") {
21651
+ paginationCounterHolder = document.querySelector(this.table.options.paginationCounterElement);
21652
+
21653
+ if (paginationCounterHolder) {
21654
+ paginationCounterHolder.appendChild(this.pageCounterElement);
21655
+ } else {
21656
+ console.warn("Pagination Error - Unable to find element matching paginationCounterElement selector:", this.table.options.paginationCounterElement);
21657
+ }
21658
+ }
21659
+ } else {
21660
+ this.table.footerManager.append(this.pageCounterElement);
21661
+ }
21662
+ }
21663
+
21127
21664
  this.table.footerManager.append(this.element, this);
21128
21665
  }
21129
21666
 
@@ -21179,7 +21716,7 @@
21179
21716
  this.page = 1;
21180
21717
  }
21181
21718
  }
21182
- } //set the maxmum page
21719
+ } //set the maximum page
21183
21720
 
21184
21721
  }, {
21185
21722
  key: "setMaxPage",
@@ -21252,6 +21789,49 @@
21252
21789
  }
21253
21790
 
21254
21791
  this.trackChanges();
21792
+ }
21793
+ }, {
21794
+ key: "_setPageCounter",
21795
+ value: function _setPageCounter(totalRows) {
21796
+ var content, currentRow;
21797
+
21798
+ if (this.pageCounter) {
21799
+ currentRow = (this.page - 1) * this.size + 1;
21800
+
21801
+ if (this.mode === "remote") {
21802
+ totalRows = this.remoteRowCountEstimate;
21803
+ }
21804
+
21805
+ content = this.pageCounter.call(this, this.size, currentRow, this.page, totalRows, this.max);
21806
+
21807
+ switch (_typeof(content)) {
21808
+ case "object":
21809
+ if (content instanceof Node) {
21810
+ //clear previous cell contents
21811
+ while (this.pageCounterElement.firstChild) {
21812
+ this.pageCounterElement.removeChild(this.pageCounterElement.firstChild);
21813
+ }
21814
+
21815
+ this.pageCounterElement.appendChild(content);
21816
+ } else {
21817
+ this.pageCounterElement.innerHTML = "";
21818
+
21819
+ if (content != null) {
21820
+ 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);
21821
+ }
21822
+ }
21823
+
21824
+ break;
21825
+
21826
+ case "undefined":
21827
+ case "null":
21828
+ this.pageCounterElement.innerHTML = "";
21829
+ break;
21830
+
21831
+ default:
21832
+ this.pageCounterElement.innerHTML = content;
21833
+ }
21834
+ }
21255
21835
  } //setup the pagination buttons
21256
21836
 
21257
21837
  }, {
@@ -21392,10 +21972,14 @@
21392
21972
  }
21393
21973
  }
21394
21974
 
21975
+ this._setPageCounter(data.length);
21976
+
21395
21977
  return output;
21396
21978
  } else {
21397
21979
  this._setPageButtons();
21398
21980
 
21981
+ this._setPageCounter(data.length);
21982
+
21399
21983
  return data.slice(0);
21400
21984
  }
21401
21985
  }
@@ -21437,11 +22021,12 @@
21437
22021
  var data, margin;
21438
22022
 
21439
22023
  if (typeof data.last_page === "undefined") {
21440
- console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.last_page + "' property");
22024
+ console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").last_page || "last_page") + "' property");
21441
22025
  }
21442
22026
 
21443
22027
  if (data.data) {
21444
22028
  this.max = parseInt(data.last_page) || 1;
22029
+ 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);
21445
22030
 
21446
22031
  if (this.progressiveLoad) {
21447
22032
  switch (this.mode) {
@@ -21461,7 +22046,7 @@
21461
22046
  break;
21462
22047
 
21463
22048
  case "progressive_scroll":
21464
- data = this.table.rowManager.getData().concat(data.data);
22049
+ data = this.page === 1 ? data.data : this.table.rowManager.getData().concat(data.data);
21465
22050
  this.table.rowManager.setData(data, this.page !== 1, this.page == 1);
21466
22051
  margin = this.table.options.progressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2;
21467
22052
 
@@ -21481,7 +22066,7 @@
21481
22066
  // this.table.columnManager.scrollHorizontal(left);
21482
22067
  }
21483
22068
  } else {
21484
- console.warn("Remote Pagination Error - Server response missing '" + this.dataReceivedNames.data + "' property");
22069
+ console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").data || "data") + "' property");
21485
22070
  }
21486
22071
 
21487
22072
  return data.data;
@@ -21507,7 +22092,9 @@
21507
22092
  return Page;
21508
22093
  }(Module);
21509
22094
 
21510
- Page.moduleName = "page";
22095
+ Page.moduleName = "page"; //load defaults
22096
+
22097
+ Page.pageCounters = defaultPageCounters;
21511
22098
 
21512
22099
  // read peristence information from storage
21513
22100
  var defaultReaders = {
@@ -22783,7 +23370,7 @@
22783
23370
  handle.removeEventListener("touchmove", mouseMove);
22784
23371
  handle.removeEventListener("touchend", mouseUp);
22785
23372
  self.table.element.classList.remove("tabulator-block-select");
22786
- this.dispatchExternal("rowResized", row.getComponent());
23373
+ self.dispatchExternal("rowResized", row.getComponent());
22787
23374
  }
22788
23375
 
22789
23376
  e.stopPropagation(); //prevent resize from interfereing with movable columns
@@ -22971,7 +23558,7 @@
22971
23558
  _this.registerColumnOption("responsive");
22972
23559
 
22973
23560
  return _this;
22974
- } //generate resposive columns list
23561
+ } //generate responsive columns list
22975
23562
 
22976
23563
 
22977
23564
  _createClass(ResponsiveLayout, [{
@@ -23010,7 +23597,7 @@
23010
23597
  this.mode = this.table.options.responsiveLayout;
23011
23598
  this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData;
23012
23599
  this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen;
23013
- this.hiddenColumns = []; //detemine level of responsivity for each column
23600
+ this.hiddenColumns = []; //determine level of responsivity for each column
23014
23601
 
23015
23602
  this.table.columnManager.columnsByIndex.forEach(function (column, i) {
23016
23603
  if (column.modules.responsive) {
@@ -23107,9 +23694,8 @@
23107
23694
  value: function updateColumnVisibility(column, responsiveToggle) {
23108
23695
  if (!responsiveToggle && column.modules.responsive) {
23109
23696
  column.modules.responsive.visible = column.visible;
23110
- this.initialize();
23111
- } //this.update();
23112
-
23697
+ this.initializeResponsivity();
23698
+ }
23113
23699
  }
23114
23700
  }, {
23115
23701
  key: "hideColumn",
@@ -23378,7 +23964,7 @@
23378
23964
  this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
23379
23965
  this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
23380
23966
 
23381
- if (this.table.options.selectable && this.table.options.selectablePersistence) {
23967
+ if (this.table.options.selectable && !this.table.options.selectablePersistence) {
23382
23968
  this.subscribe("data-refeshing", this.deselectRows.bind(this));
23383
23969
  }
23384
23970
  }
@@ -23618,9 +24204,7 @@
23618
24204
  this.childRowSelection(row, true);
23619
24205
  }
23620
24206
 
23621
- if (!silent) {
23622
- this.dispatchExternal("rowSelected", row.getComponent());
23623
- }
24207
+ this.dispatchExternal("rowSelected", row.getComponent());
23624
24208
 
23625
24209
  this._rowSelectionChanged(silent);
23626
24210
  }
@@ -23694,9 +24278,7 @@
23694
24278
  this.childRowSelection(row, false);
23695
24279
  }
23696
24280
 
23697
- if (!silent) {
23698
- this.dispatchExternal("rowDeselected", row.getComponent());
23699
- }
24281
+ this.dispatchExternal("rowDeselected", row.getComponent());
23700
24282
 
23701
24283
  self._rowSelectionChanged(silent);
23702
24284
  }
@@ -23885,8 +24467,8 @@
23885
24467
  emptyAlign = 0;
23886
24468
 
23887
24469
  if (typeof DT != "undefined") {
23888
- a = DT.fromFormat(a, format);
23889
- b = DT.fromFormat(b, format);
24470
+ a = format === "iso" ? DT.fromISO(String(a)) : DT.fromFormat(String(a), format);
24471
+ b = format === "iso" ? DT.fromISO(String(b)) : DT.fromFormat(String(b), format);
23890
24472
 
23891
24473
  if (!a.isValid) {
23892
24474
  emptyAlign = !b.isValid ? 0 : -1;
@@ -24274,7 +24856,7 @@
24274
24856
  if (this.table.options.sortMode === "remote") {
24275
24857
  this.reloadData();
24276
24858
  } else {
24277
- this.refreshData();
24859
+ this.refreshData(true);
24278
24860
  } //TODO - Persist left position of row manager
24279
24861
  // left = this.scrollLeft;
24280
24862
  // this.scrollHorizontal(left);
@@ -24690,9 +25272,11 @@
24690
25272
  }, {
24691
25273
  key: "columnValidate",
24692
25274
  value: function columnValidate(column) {
25275
+ var _this2 = this;
25276
+
24693
25277
  var invalid = [];
24694
25278
  column.cells.forEach(function (cell) {
24695
- if (!this.cellValidate(cell)) {
25279
+ if (!_this2.cellValidate(cell)) {
24696
25280
  invalid.push(cell.getComponent());
24697
25281
  }
24698
25282
  });
@@ -24704,9 +25288,11 @@
24704
25288
  }, {
24705
25289
  key: "rowValidate",
24706
25290
  value: function rowValidate(row) {
25291
+ var _this3 = this;
25292
+
24707
25293
  var invalid = [];
24708
25294
  row.cells.forEach(function (cell) {
24709
- if (!this.cellValidate(cell)) {
25295
+ if (!_this3.cellValidate(cell)) {
24710
25296
  invalid.push(cell.getComponent());
24711
25297
  }
24712
25298
  });
@@ -24718,7 +25304,7 @@
24718
25304
  }, {
24719
25305
  key: "userClearCellValidation",
24720
25306
  value: function userClearCellValidation(cells) {
24721
- var _this2 = this;
25307
+ var _this4 = this;
24722
25308
 
24723
25309
  if (!cells) {
24724
25310
  cells = this.getInvalidCells();
@@ -24729,7 +25315,7 @@
24729
25315
  }
24730
25316
 
24731
25317
  cells.forEach(function (cell) {
24732
- _this2.clearValidation(cell._getSelf());
25318
+ _this4.clearValidation(cell._getSelf());
24733
25319
  });
24734
25320
  }
24735
25321
  }, {
@@ -24738,6 +25324,7 @@
24738
25324
  var output = []; //clear row data
24739
25325
 
24740
25326
  this.table.rowManager.rows.forEach(function (row) {
25327
+ row = row.getComponent();
24741
25328
  var valid = row.validate();
24742
25329
 
24743
25330
  if (valid !== true) {
@@ -24920,6 +25507,7 @@
24920
25507
  GroupRowsModule: GroupRows,
24921
25508
  HistoryModule: History,
24922
25509
  HtmlTableImportModule: HtmlTableImport,
25510
+ ImportModule: Import,
24923
25511
  InteractionModule: Interaction,
24924
25512
  KeybindingsModule: Keybindings,
24925
25513
  MenuModule: Menu,