tabulator-tables 5.0.9 → 5.1.2
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.
- package/.editorconfig +6 -0
- package/LICENSE +1 -1
- package/bower.json +1 -1
- package/build/rollup.js +2 -1
- package/dist/css/tabulator.css +26 -10
- package/dist/css/tabulator.css.map +1 -1
- package/dist/css/tabulator.min.css +1 -1
- package/dist/css/tabulator.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.css +26 -10
- package/dist/css/tabulator_bootstrap3.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.min.css +1 -1
- package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.css +26 -10
- package/dist/css/tabulator_bootstrap4.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.min.css +1 -1
- package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
- package/dist/css/tabulator_bulma.css +26 -10
- package/dist/css/tabulator_bulma.css.map +1 -1
- package/dist/css/tabulator_bulma.min.css +1 -1
- package/dist/css/tabulator_bulma.min.css.map +1 -1
- package/dist/css/tabulator_materialize.css +33 -14
- package/dist/css/tabulator_materialize.css.map +1 -1
- package/dist/css/tabulator_materialize.min.css +1 -1
- package/dist/css/tabulator_materialize.min.css.map +1 -1
- package/dist/css/tabulator_midnight.css +30 -10
- package/dist/css/tabulator_midnight.css.map +1 -1
- package/dist/css/tabulator_midnight.min.css +1 -1
- package/dist/css/tabulator_midnight.min.css.map +1 -1
- package/dist/css/tabulator_modern.css +26 -10
- package/dist/css/tabulator_modern.css.map +1 -1
- package/dist/css/tabulator_modern.min.css +1 -1
- package/dist/css/tabulator_modern.min.css.map +1 -1
- package/dist/css/tabulator_semanticui.css +26 -10
- package/dist/css/tabulator_semanticui.css.map +1 -1
- package/dist/css/tabulator_semanticui.min.css +1 -1
- package/dist/css/tabulator_semanticui.min.css.map +1 -1
- package/dist/css/tabulator_simple.css +26 -10
- package/dist/css/tabulator_simple.css.map +1 -1
- package/dist/css/tabulator_simple.min.css +1 -1
- package/dist/css/tabulator_simple.min.css.map +1 -1
- package/dist/css/tabulator_site.css +30 -10
- package/dist/css/tabulator_site.css.map +1 -1
- package/dist/css/tabulator_site.min.css +1 -1
- package/dist/css/tabulator_site.min.css.map +1 -1
- package/dist/js/tabulator.js +1077 -530
- package/dist/js/tabulator.js.map +1 -1
- package/dist/js/tabulator.min.js +2 -2
- package/dist/js/tabulator.min.js.map +1 -1
- package/dist/js/tabulator_esm.js +1696 -1171
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +1 -1
- package/src/js/core/FooterManager.js +14 -2
- package/src/js/core/RowManager.js +318 -291
- package/src/js/core/Tabulator.js +8 -68
- package/src/js/core/cell/Cell.js +5 -1
- package/src/js/core/column/Column.js +20 -5
- package/src/js/core/column/ColumnComponent.js +6 -0
- package/src/js/core/column/defaults/options.js +1 -0
- package/src/js/core/defaults/options.js +2 -2
- package/src/js/core/modules/optional.js +1 -0
- package/src/js/core/rendering/Renderer.js +1 -1
- package/src/js/core/rendering/renderers/BasicVertical.js +2 -1
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +165 -151
- package/src/js/core/row/Row.js +2 -2
- package/src/js/core/tools/DataLoader.js +5 -5
- package/src/js/core/tools/InteractionMonitor.js +63 -32
- package/src/js/core/tools/ModuleBinder.js +15 -3
- package/src/js/modules/Ajax/Ajax.js +62 -82
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +3 -3
- package/src/js/modules/DataTree/DataTree.js +5 -1
- package/src/js/modules/Download/defaults/downloaders/json.js +1 -1
- package/src/js/modules/Download/defaults/downloaders/jsonLines.js +32 -0
- package/src/js/modules/Download/defaults/downloaders.js +2 -0
- package/src/js/modules/Edit/Edit.js +26 -31
- package/src/js/modules/Export/Export.js +2 -1
- package/src/js/modules/Filter/Filter.js +2 -3
- package/src/js/modules/Format/defaults/formatters/datetime.js +1 -1
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +2 -1
- package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +1 -1
- package/src/js/modules/FrozenRows/FrozenRows.js +9 -0
- package/src/js/modules/GroupRows/Group.js +2 -61
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/GroupRows/GroupRows.js +2 -2
- package/src/js/modules/Import/Import.js +195 -0
- package/src/js/modules/Import/defaults/importers/csv.js +63 -0
- package/src/js/modules/Import/defaults/importers/json.js +8 -0
- package/src/js/modules/Import/defaults/importers.js +7 -0
- package/src/js/modules/Interaction/Interaction.js +5 -0
- package/src/js/modules/Keybindings/Keybindings.js +9 -14
- package/src/js/modules/Keybindings/defaults/bindings.js +3 -3
- package/src/js/modules/Localize/defaults/langs.js +6 -0
- package/src/js/modules/Menu/Menu.js +200 -155
- package/src/js/modules/MoveRows/MoveRows.js +4 -0
- package/src/js/modules/Page/Page.js +279 -176
- package/src/js/modules/Page/defaults/pageCounters/pages.js +33 -0
- package/src/js/modules/Page/defaults/pageCounters/rows.js +32 -0
- package/src/js/modules/Page/defaults/pageCounters.js +8 -0
- package/src/js/modules/Persistence/Persistence.js +6 -4
- package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +8 -10
- package/src/js/modules/SelectRow/SelectRow.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/datetime.js +2 -2
- package/src/js/modules/Validate/Validate.js +7 -5
- package/src/scss/tabulator.scss +31 -12
- package/src/scss/themes/materialize/tabulator_materialize.scss +5 -4
- package/src/scss/themes/tabulator_midnight.scss +4 -0
- package/src/scss/themes/tabulator_site.scss +4 -0
package/dist/js/tabulator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.
|
|
1
|
+
/* Tabulator v5.1.2 (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: [],
|
|
@@ -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
|
};
|
|
@@ -439,7 +438,6 @@
|
|
|
439
438
|
return CoreFeature;
|
|
440
439
|
}();
|
|
441
440
|
|
|
442
|
-
//public column object
|
|
443
441
|
var ColumnComponent = /*#__PURE__*/function () {
|
|
444
442
|
function ColumnComponent(column) {
|
|
445
443
|
_classCallCheck(this, ColumnComponent);
|
|
@@ -472,6 +470,11 @@
|
|
|
472
470
|
value: function getField() {
|
|
473
471
|
return this._column.getField();
|
|
474
472
|
}
|
|
473
|
+
}, {
|
|
474
|
+
key: "getTitleDownload",
|
|
475
|
+
value: function getTitleDownload() {
|
|
476
|
+
return this._column.getTitleDownload();
|
|
477
|
+
}
|
|
475
478
|
}, {
|
|
476
479
|
key: "getCells",
|
|
477
480
|
value: function getCells() {
|
|
@@ -622,6 +625,7 @@
|
|
|
622
625
|
"width": undefined,
|
|
623
626
|
"minWidth": 40,
|
|
624
627
|
"maxWidth": undefined,
|
|
628
|
+
"maxInitialWidth": undefined,
|
|
625
629
|
"tooltip": undefined,
|
|
626
630
|
"cssClass": undefined,
|
|
627
631
|
"variableHeight": undefined,
|
|
@@ -935,6 +939,11 @@
|
|
|
935
939
|
if (changed) {
|
|
936
940
|
this.dispatch("cell-value-updated", this);
|
|
937
941
|
this.cellRendered();
|
|
942
|
+
|
|
943
|
+
if (this.column.definition.cellEdited) {
|
|
944
|
+
this.column.definition.cellEdited.call(this.table, this.getComponent());
|
|
945
|
+
}
|
|
946
|
+
|
|
938
947
|
this.dispatchExternal("cellEdited", this.getComponent());
|
|
939
948
|
|
|
940
949
|
if (this.subscribedExternal("dataChanged")) {
|
|
@@ -947,7 +956,7 @@
|
|
|
947
956
|
value: function setValueProcessData(value, mutate) {
|
|
948
957
|
var changed = false;
|
|
949
958
|
|
|
950
|
-
if (this.value
|
|
959
|
+
if (this.value !== value) {
|
|
951
960
|
changed = true;
|
|
952
961
|
|
|
953
962
|
if (mutate) {
|
|
@@ -1081,7 +1090,7 @@
|
|
|
1081
1090
|
return Cell;
|
|
1082
1091
|
}(CoreFeature);
|
|
1083
1092
|
|
|
1084
|
-
var Column
|
|
1093
|
+
var Column = /*#__PURE__*/function (_CoreFeature) {
|
|
1085
1094
|
_inherits(Column, _CoreFeature);
|
|
1086
1095
|
|
|
1087
1096
|
var _super = _createSuper(Column);
|
|
@@ -1121,6 +1130,7 @@
|
|
|
1121
1130
|
_this.fieldStructure = "";
|
|
1122
1131
|
_this.getFieldValue = "";
|
|
1123
1132
|
_this.setFieldValue = "";
|
|
1133
|
+
_this.titleDownload = null;
|
|
1124
1134
|
_this.titleFormatterRendered = false;
|
|
1125
1135
|
|
|
1126
1136
|
_this.mapDefinitions();
|
|
@@ -1137,6 +1147,7 @@
|
|
|
1137
1147
|
|
|
1138
1148
|
_this.maxWidthStyled = ""; //column maximum prestyled to improve render efficiency
|
|
1139
1149
|
|
|
1150
|
+
_this.maxInitialWidth = null;
|
|
1140
1151
|
_this.minWidth = null; //column minimum width
|
|
1141
1152
|
|
|
1142
1153
|
_this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency
|
|
@@ -1429,6 +1440,10 @@
|
|
|
1429
1440
|
|
|
1430
1441
|
this.setMinWidth(parseInt(def.minWidth));
|
|
1431
1442
|
|
|
1443
|
+
if (def.maxInitialWidth) {
|
|
1444
|
+
this.maxInitialWidth = parseInt(def.maxInitialWidth);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1432
1447
|
if (def.maxWidth) {
|
|
1433
1448
|
this.setMaxWidth(parseInt(def.maxWidth));
|
|
1434
1449
|
}
|
|
@@ -1678,6 +1693,11 @@
|
|
|
1678
1693
|
key: "getField",
|
|
1679
1694
|
value: function getField() {
|
|
1680
1695
|
return this.field;
|
|
1696
|
+
}
|
|
1697
|
+
}, {
|
|
1698
|
+
key: "getTitleDownload",
|
|
1699
|
+
value: function getTitleDownload() {
|
|
1700
|
+
return this.titleDownload;
|
|
1681
1701
|
} //return the first column in a group
|
|
1682
1702
|
|
|
1683
1703
|
}, {
|
|
@@ -1814,7 +1834,7 @@
|
|
|
1814
1834
|
this.cells.forEach(function (cell) {
|
|
1815
1835
|
cell.hide();
|
|
1816
1836
|
});
|
|
1817
|
-
this.dispatch("column-hide", this);
|
|
1837
|
+
this.dispatch("column-hide", this, responsiveToggle);
|
|
1818
1838
|
|
|
1819
1839
|
if (!silent) {
|
|
1820
1840
|
this.dispatchExternal("columnVisibilityChanged", this.getComponent(), false);
|
|
@@ -1936,7 +1956,7 @@
|
|
|
1936
1956
|
}, {
|
|
1937
1957
|
key: "getHeight",
|
|
1938
1958
|
value: function getHeight() {
|
|
1939
|
-
return this.element.
|
|
1959
|
+
return Math.ceil(this.element.getBoundingClientRect().height);
|
|
1940
1960
|
}
|
|
1941
1961
|
}, {
|
|
1942
1962
|
key: "setMinWidth",
|
|
@@ -2045,17 +2065,18 @@
|
|
|
2045
2065
|
this.widthFixed = false; //set width if present
|
|
2046
2066
|
|
|
2047
2067
|
if (typeof this.definition.width !== "undefined" && !force) {
|
|
2068
|
+
// maxInitialWidth ignored here as width specified
|
|
2048
2069
|
this.setWidth(this.definition.width);
|
|
2049
2070
|
}
|
|
2050
2071
|
|
|
2051
2072
|
this.dispatch("column-width-fit-before", this);
|
|
2052
|
-
this.fitToData();
|
|
2073
|
+
this.fitToData(force);
|
|
2053
2074
|
this.dispatch("column-width-fit-after", this);
|
|
2054
2075
|
} //set column width to maximum cell width for non group columns
|
|
2055
2076
|
|
|
2056
2077
|
}, {
|
|
2057
2078
|
key: "fitToData",
|
|
2058
|
-
value: function fitToData() {
|
|
2079
|
+
value: function fitToData(force) {
|
|
2059
2080
|
if (this.isGroup) {
|
|
2060
2081
|
return;
|
|
2061
2082
|
}
|
|
@@ -2079,7 +2100,13 @@
|
|
|
2079
2100
|
});
|
|
2080
2101
|
|
|
2081
2102
|
if (maxWidth) {
|
|
2082
|
-
|
|
2103
|
+
var setTo = maxWidth + 1;
|
|
2104
|
+
|
|
2105
|
+
if (this.maxInitialWidth && !force) {
|
|
2106
|
+
setTo = Math.min(setTo, this.maxInitialWidth);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
this.setWidthActual(setTo);
|
|
2083
2110
|
}
|
|
2084
2111
|
}
|
|
2085
2112
|
}
|
|
@@ -2136,7 +2163,7 @@
|
|
|
2136
2163
|
return Column;
|
|
2137
2164
|
}(CoreFeature);
|
|
2138
2165
|
|
|
2139
|
-
Column
|
|
2166
|
+
Column.defaultOptionList = defaultColumnOptions;
|
|
2140
2167
|
|
|
2141
2168
|
var Helpers = /*#__PURE__*/function () {
|
|
2142
2169
|
function Helpers() {
|
|
@@ -2340,7 +2367,7 @@
|
|
|
2340
2367
|
}
|
|
2341
2368
|
}, {
|
|
2342
2369
|
key: "scrollToRowNearestTop",
|
|
2343
|
-
value: function scrollToRowNearestTop(row) {//
|
|
2370
|
+
value: function scrollToRowNearestTop(row) {//determine weather the row is nearest the top or bottom of the table, retur true for top or false for bottom
|
|
2344
2371
|
}
|
|
2345
2372
|
}, {
|
|
2346
2373
|
key: "visibleRows",
|
|
@@ -2525,27 +2552,27 @@
|
|
|
2525
2552
|
_createClass(VirtualDomHorizontal, [{
|
|
2526
2553
|
key: "initialize",
|
|
2527
2554
|
value: function initialize() {
|
|
2528
|
-
this.
|
|
2555
|
+
this.compatibilityCheck();
|
|
2529
2556
|
}
|
|
2530
2557
|
}, {
|
|
2531
|
-
key: "
|
|
2532
|
-
value: function
|
|
2558
|
+
key: "compatibilityCheck",
|
|
2559
|
+
value: function compatibilityCheck() {
|
|
2533
2560
|
var columns = this.options("columns"),
|
|
2534
2561
|
frozen = false,
|
|
2535
2562
|
ok = true;
|
|
2536
2563
|
|
|
2537
2564
|
if (this.options("layout") == "fitDataTable") {
|
|
2538
|
-
console.warn("Horizontal
|
|
2565
|
+
console.warn("Horizontal Virtual DOM is not compatible with fitDataTable layout mode");
|
|
2539
2566
|
ok = false;
|
|
2540
2567
|
}
|
|
2541
2568
|
|
|
2542
2569
|
if (this.options("responsiveLayout")) {
|
|
2543
|
-
console.warn("Horizontal
|
|
2570
|
+
console.warn("Horizontal Virtual DOM is not compatible with responsive columns");
|
|
2544
2571
|
ok = false;
|
|
2545
2572
|
}
|
|
2546
2573
|
|
|
2547
2574
|
if (this.options("rtl")) {
|
|
2548
|
-
console.warn("Horizontal
|
|
2575
|
+
console.warn("Horizontal Virtual DOM is not currently compatible with RTL text direction");
|
|
2549
2576
|
ok = false;
|
|
2550
2577
|
}
|
|
2551
2578
|
|
|
@@ -2555,7 +2582,7 @@
|
|
|
2555
2582
|
});
|
|
2556
2583
|
|
|
2557
2584
|
if (frozen) {
|
|
2558
|
-
console.warn("Horizontal
|
|
2585
|
+
console.warn("Horizontal Virtual DOM is not compatible with frozen columns");
|
|
2559
2586
|
ok = false;
|
|
2560
2587
|
}
|
|
2561
2588
|
} // if(!ok){
|
|
@@ -2611,7 +2638,7 @@
|
|
|
2611
2638
|
config.width = width;
|
|
2612
2639
|
|
|
2613
2640
|
if (_this2.options("layout") === "fitData") {
|
|
2614
|
-
config.fitDataCheck = true;
|
|
2641
|
+
config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
|
|
2615
2642
|
}
|
|
2616
2643
|
|
|
2617
2644
|
if (colPos + width > _this2.vDomScrollPosLeft && colPos < _this2.vDomScrollPosRight) {
|
|
@@ -2641,7 +2668,7 @@
|
|
|
2641
2668
|
|
|
2642
2669
|
if (!blockRedraw) {
|
|
2643
2670
|
if (!update || this.reinitChanged(old)) {
|
|
2644
|
-
this.
|
|
2671
|
+
this.reinitializeRows();
|
|
2645
2672
|
}
|
|
2646
2673
|
}
|
|
2647
2674
|
|
|
@@ -2768,8 +2795,8 @@
|
|
|
2768
2795
|
return !match;
|
|
2769
2796
|
}
|
|
2770
2797
|
}, {
|
|
2771
|
-
key: "
|
|
2772
|
-
value: function
|
|
2798
|
+
key: "reinitializeRows",
|
|
2799
|
+
value: function reinitializeRows() {
|
|
2773
2800
|
var _this5 = this;
|
|
2774
2801
|
|
|
2775
2802
|
var rows = this.table.rowManager.getVisibleRows();
|
|
@@ -2822,7 +2849,7 @@
|
|
|
2822
2849
|
}
|
|
2823
2850
|
});
|
|
2824
2851
|
this.fitDataColActualWidthCheck(column);
|
|
2825
|
-
this.rightCol++;
|
|
2852
|
+
this.rightCol++; // Don't move this below the >= check below
|
|
2826
2853
|
|
|
2827
2854
|
if (this.rightCol >= this.columns.length - 1) {
|
|
2828
2855
|
this.vDomPadRight = 0;
|
|
@@ -2850,15 +2877,16 @@
|
|
|
2850
2877
|
}
|
|
2851
2878
|
});
|
|
2852
2879
|
this.fitDataColActualWidthCheck(column);
|
|
2880
|
+
this.leftCol--; // don't move this below the <= check below
|
|
2853
2881
|
|
|
2854
|
-
if (
|
|
2882
|
+
if (this.leftCol <= 0) {
|
|
2883
|
+
// replicating logic in addColRight
|
|
2855
2884
|
this.vDomPadLeft = 0;
|
|
2856
2885
|
} else {
|
|
2857
2886
|
this.vDomPadLeft -= column.getWidth();
|
|
2858
2887
|
}
|
|
2859
2888
|
|
|
2860
2889
|
this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
|
|
2861
|
-
this.leftCol--;
|
|
2862
2890
|
this.addColLeft();
|
|
2863
2891
|
}
|
|
2864
2892
|
}
|
|
@@ -2874,7 +2902,12 @@
|
|
|
2874
2902
|
rows.forEach(function (row) {
|
|
2875
2903
|
if (row.type !== "group") {
|
|
2876
2904
|
var cell = row.getCell(column);
|
|
2877
|
-
|
|
2905
|
+
|
|
2906
|
+
try {
|
|
2907
|
+
row.getElement().removeChild(cell.getElement());
|
|
2908
|
+
} catch (ex) {
|
|
2909
|
+
console.warn("Could not removeColRight", ex.message);
|
|
2910
|
+
}
|
|
2878
2911
|
}
|
|
2879
2912
|
});
|
|
2880
2913
|
this.vDomPadRight += column.getWidth();
|
|
@@ -2892,11 +2925,21 @@
|
|
|
2892
2925
|
if (column && column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft) {
|
|
2893
2926
|
rows = this.table.rowManager.getVisibleRows();
|
|
2894
2927
|
rows.forEach(function (row) {
|
|
2928
|
+
var cell, el;
|
|
2929
|
+
|
|
2895
2930
|
if (row.type !== "group") {
|
|
2896
|
-
|
|
2931
|
+
cell = row.getCell(column);
|
|
2897
2932
|
|
|
2898
|
-
if (cell
|
|
2899
|
-
|
|
2933
|
+
if (cell) {
|
|
2934
|
+
el = cell.getElement();
|
|
2935
|
+
|
|
2936
|
+
if (el.parentNode) {
|
|
2937
|
+
try {
|
|
2938
|
+
row.getElement().removeChild(el);
|
|
2939
|
+
} catch (ex) {
|
|
2940
|
+
console.warn("Could not removeColLeft", ex.message);
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2900
2943
|
}
|
|
2901
2944
|
}
|
|
2902
2945
|
});
|
|
@@ -3192,7 +3235,7 @@
|
|
|
3192
3235
|
}, {
|
|
3193
3236
|
key: "_addColumn",
|
|
3194
3237
|
value: function _addColumn(definition, before, nextToColumn) {
|
|
3195
|
-
var column = new Column
|
|
3238
|
+
var column = new Column(definition, this),
|
|
3196
3239
|
colEl = column.getElement(),
|
|
3197
3240
|
index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
|
|
3198
3241
|
|
|
@@ -3267,7 +3310,7 @@
|
|
|
3267
3310
|
key: "findColumn",
|
|
3268
3311
|
value: function findColumn(subject) {
|
|
3269
3312
|
if (_typeof(subject) == "object") {
|
|
3270
|
-
if (subject instanceof Column
|
|
3313
|
+
if (subject instanceof Column) {
|
|
3271
3314
|
//subject is column element
|
|
3272
3315
|
return subject;
|
|
3273
3316
|
} else if (subject instanceof ColumnComponent) {
|
|
@@ -3848,12 +3891,12 @@
|
|
|
3848
3891
|
}
|
|
3849
3892
|
|
|
3850
3893
|
this.dispatch("row-layout", this);
|
|
3894
|
+
this.initialized = true;
|
|
3851
3895
|
|
|
3852
3896
|
if (this.table.options.rowFormatter) {
|
|
3853
3897
|
this.table.options.rowFormatter(this.getComponent());
|
|
3854
3898
|
}
|
|
3855
3899
|
|
|
3856
|
-
this.initialized = true;
|
|
3857
3900
|
this.dispatch("row-layout-after", this);
|
|
3858
3901
|
} else {
|
|
3859
3902
|
this.table.columnManager.renderer.rerenderRowCells(this);
|
|
@@ -4263,7 +4306,8 @@
|
|
|
4263
4306
|
}, {
|
|
4264
4307
|
key: "rerenderRows",
|
|
4265
4308
|
value: function rerenderRows(callback) {
|
|
4266
|
-
this.
|
|
4309
|
+
this.clearRows();
|
|
4310
|
+
this.renderRows();
|
|
4267
4311
|
|
|
4268
4312
|
if (callback) {
|
|
4269
4313
|
callback();
|
|
@@ -4912,6 +4956,10 @@
|
|
|
4912
4956
|
|
|
4913
4957
|
_this.heightFixer = _this.createTableElement(); //table element
|
|
4914
4958
|
|
|
4959
|
+
_this.placeholder = null; //placeholder element
|
|
4960
|
+
|
|
4961
|
+
_this.placeholderContents = null; //placeholder element
|
|
4962
|
+
|
|
4915
4963
|
_this.firstRender = false; //handle first render
|
|
4916
4964
|
|
|
4917
4965
|
_this.renderMode = "virtual"; //current rendering mode
|
|
@@ -4920,7 +4968,7 @@
|
|
|
4920
4968
|
|
|
4921
4969
|
_this.rows = []; //hold row data objects
|
|
4922
4970
|
|
|
4923
|
-
_this.activeRowsPipeline = []; //hold
|
|
4971
|
+
_this.activeRowsPipeline = []; //hold calculation of active rows
|
|
4924
4972
|
|
|
4925
4973
|
_this.activeRows = []; //rows currently available to on display in the table
|
|
4926
4974
|
|
|
@@ -4934,11 +4982,11 @@
|
|
|
4934
4982
|
_this.scrollLeft = 0;
|
|
4935
4983
|
_this.rowNumColumn = false; //hold column component for row number column
|
|
4936
4984
|
|
|
4937
|
-
_this.redrawBlock = false; //prevent redraws to allow multiple data manipulations
|
|
4985
|
+
_this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
|
|
4938
4986
|
|
|
4939
4987
|
_this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
|
|
4940
4988
|
|
|
4941
|
-
_this.
|
|
4989
|
+
_this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
|
|
4942
4990
|
|
|
4943
4991
|
_this.dataPipeline = []; //hold data pipeline tasks
|
|
4944
4992
|
|
|
@@ -4965,6 +5013,21 @@
|
|
|
4965
5013
|
el.classList.add("tabulator-table");
|
|
4966
5014
|
el.setAttribute("role", "rowgroup");
|
|
4967
5015
|
return el;
|
|
5016
|
+
}
|
|
5017
|
+
}, {
|
|
5018
|
+
key: "initializePlaceholder",
|
|
5019
|
+
value: function initializePlaceholder() {
|
|
5020
|
+
//configure placeholder element
|
|
5021
|
+
if (typeof this.table.options.placeholder == "string") {
|
|
5022
|
+
var el = document.createElement("div");
|
|
5023
|
+
el.classList.add("tabulator-placeholder");
|
|
5024
|
+
var contents = document.createElement("div");
|
|
5025
|
+
contents.classList.add("tabulator-placeholder-contents");
|
|
5026
|
+
contents.innerHTML = this.table.options.placeholder;
|
|
5027
|
+
el.appendChild(contents);
|
|
5028
|
+
this.placeholderContents = contents;
|
|
5029
|
+
this.placeholder = el;
|
|
5030
|
+
}
|
|
4968
5031
|
} //return containing element
|
|
4969
5032
|
|
|
4970
5033
|
}, {
|
|
@@ -4993,6 +5056,7 @@
|
|
|
4993
5056
|
value: function initialize() {
|
|
4994
5057
|
var _this2 = this;
|
|
4995
5058
|
|
|
5059
|
+
this.initializePlaceholder();
|
|
4996
5060
|
this.initializeRenderer(); //initialize manager
|
|
4997
5061
|
|
|
4998
5062
|
this.element.appendChild(this.tableElement);
|
|
@@ -5010,7 +5074,9 @@
|
|
|
5010
5074
|
_this2.dispatch("scroll-horizontal", left, leftDir);
|
|
5011
5075
|
|
|
5012
5076
|
_this2.dispatchExternal("scrollHorizontal", left, leftDir);
|
|
5013
|
-
|
|
5077
|
+
|
|
5078
|
+
_this2._positionPlaceholder();
|
|
5079
|
+
} //handle vertical scrolling
|
|
5014
5080
|
|
|
5015
5081
|
|
|
5016
5082
|
if (_this2.scrollTop != top) {
|
|
@@ -5192,7 +5258,6 @@
|
|
|
5192
5258
|
key: "addRow",
|
|
5193
5259
|
value: function addRow(data, pos, index, blockRedraw) {
|
|
5194
5260
|
var row = this.addRowActual(data, pos, index, blockRedraw);
|
|
5195
|
-
this.dispatch("row-added", row, data, pos, index);
|
|
5196
5261
|
return row;
|
|
5197
5262
|
} //add multiple rows
|
|
5198
5263
|
|
|
@@ -5571,42 +5636,12 @@
|
|
|
5571
5636
|
|
|
5572
5637
|
return;
|
|
5573
5638
|
} else {
|
|
5574
|
-
this.dispatch("data-refeshing");
|
|
5575
|
-
|
|
5576
|
-
if (!handler) {
|
|
5577
|
-
this.activeRowsPipeline[0] = this.rows.slice(0);
|
|
5578
|
-
} //cascade through data refresh stages
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
switch (stage) {
|
|
5582
|
-
case "all": //handle case where alldata needs refreshing
|
|
5583
|
-
|
|
5584
|
-
case "dataPipeline":
|
|
5585
|
-
for (var i = index; i < this.dataPipeline.length; i++) {
|
|
5586
|
-
var result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
|
|
5587
|
-
this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
|
|
5588
|
-
}
|
|
5589
|
-
|
|
5590
|
-
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
5591
|
-
this.regenerateRowNumbers();
|
|
5592
|
-
|
|
5593
|
-
case "display":
|
|
5594
|
-
index = 0;
|
|
5595
|
-
this.resetDisplayRows();
|
|
5596
|
-
|
|
5597
|
-
case "displayPipeline":
|
|
5598
|
-
for (var _i = index; _i < this.displayPipeline.length; _i++) {
|
|
5599
|
-
var _result = this.displayPipeline[_i].handler((_i ? this.getDisplayRows(_i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
5600
|
-
|
|
5601
|
-
this.setDisplayRows(_result || this.getDisplayRows(_i - 1).slice(0), _i);
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
|
-
}
|
|
5605
|
-
|
|
5606
5639
|
if (Helpers.elVisible(this.element)) {
|
|
5607
5640
|
if (renderInPosition) {
|
|
5608
|
-
this.reRenderInPosition();
|
|
5641
|
+
this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
|
|
5609
5642
|
} else {
|
|
5643
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
5644
|
+
|
|
5610
5645
|
if (!handler) {
|
|
5611
5646
|
this.table.columnManager.renderer.renderColumns();
|
|
5612
5647
|
}
|
|
@@ -5617,9 +5652,46 @@
|
|
|
5617
5652
|
this.table.columnManager.redraw(true);
|
|
5618
5653
|
}
|
|
5619
5654
|
}
|
|
5655
|
+
} else {
|
|
5656
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
5620
5657
|
}
|
|
5621
5658
|
|
|
5622
|
-
this.dispatch("data-
|
|
5659
|
+
this.dispatch("data-refreshed");
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
}, {
|
|
5663
|
+
key: "refreshPipelines",
|
|
5664
|
+
value: function refreshPipelines(handler, stage, index, renderInPosition) {
|
|
5665
|
+
this.dispatch("data-refreshing");
|
|
5666
|
+
|
|
5667
|
+
if (!handler) {
|
|
5668
|
+
this.activeRowsPipeline[0] = this.rows.slice(0);
|
|
5669
|
+
} //cascade through data refresh stages
|
|
5670
|
+
|
|
5671
|
+
|
|
5672
|
+
switch (stage) {
|
|
5673
|
+
case "all": //handle case where alldata needs refreshing
|
|
5674
|
+
|
|
5675
|
+
case "dataPipeline":
|
|
5676
|
+
for (var i = index; i < this.dataPipeline.length; i++) {
|
|
5677
|
+
var result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
|
|
5678
|
+
this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
|
|
5679
|
+
}
|
|
5680
|
+
|
|
5681
|
+
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
5682
|
+
this.regenerateRowNumbers();
|
|
5683
|
+
|
|
5684
|
+
case "display":
|
|
5685
|
+
index = 0;
|
|
5686
|
+
this.resetDisplayRows();
|
|
5687
|
+
|
|
5688
|
+
case "displayPipeline":
|
|
5689
|
+
for (var _i = index; _i < this.displayPipeline.length; _i++) {
|
|
5690
|
+
var _result = this.displayPipeline[_i].handler((_i ? this.getDisplayRows(_i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
5691
|
+
|
|
5692
|
+
this.setDisplayRows(_result || this.getDisplayRows(_i - 1).slice(0), _i);
|
|
5693
|
+
}
|
|
5694
|
+
|
|
5623
5695
|
}
|
|
5624
5696
|
} //regenerate row numbers for row number formatter if in use
|
|
5625
5697
|
|
|
@@ -5721,7 +5793,7 @@
|
|
|
5721
5793
|
break;
|
|
5722
5794
|
|
|
5723
5795
|
case "visible":
|
|
5724
|
-
rows = this.getVisibleRows(true);
|
|
5796
|
+
rows = this.getVisibleRows(false, true);
|
|
5725
5797
|
break;
|
|
5726
5798
|
|
|
5727
5799
|
default:
|
|
@@ -5739,7 +5811,7 @@
|
|
|
5739
5811
|
if (callback) {
|
|
5740
5812
|
callback();
|
|
5741
5813
|
} else {
|
|
5742
|
-
this.
|
|
5814
|
+
this.redrawBlockRenderInPosition = true;
|
|
5743
5815
|
}
|
|
5744
5816
|
} else {
|
|
5745
5817
|
this.renderer.rerenderRows(callback);
|
|
@@ -5813,7 +5885,7 @@
|
|
|
5813
5885
|
}, {
|
|
5814
5886
|
key: "renderEmptyScroll",
|
|
5815
5887
|
value: function renderEmptyScroll() {
|
|
5816
|
-
if (this.
|
|
5888
|
+
if (this.placeholder) {
|
|
5817
5889
|
this.tableElement.style.display = "none";
|
|
5818
5890
|
} else {
|
|
5819
5891
|
this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px"; // this.tableElement.style.minHeight = "1px";
|
|
@@ -5834,17 +5906,27 @@
|
|
|
5834
5906
|
}, {
|
|
5835
5907
|
key: "_showPlaceholder",
|
|
5836
5908
|
value: function _showPlaceholder() {
|
|
5837
|
-
if (this.
|
|
5838
|
-
this.
|
|
5839
|
-
this.getElement().appendChild(this.
|
|
5840
|
-
|
|
5909
|
+
if (this.placeholder) {
|
|
5910
|
+
this.placeholder.setAttribute("tabulator-render-mode", this.renderMode);
|
|
5911
|
+
this.getElement().appendChild(this.placeholder);
|
|
5912
|
+
|
|
5913
|
+
this._positionPlaceholder();
|
|
5841
5914
|
}
|
|
5842
5915
|
}
|
|
5843
5916
|
}, {
|
|
5844
5917
|
key: "_clearPlaceholder",
|
|
5845
5918
|
value: function _clearPlaceholder() {
|
|
5846
|
-
if (this.
|
|
5847
|
-
this.
|
|
5919
|
+
if (this.placeholder && this.placeholder.parentNode) {
|
|
5920
|
+
this.placeholder.parentNode.removeChild(this.placeholder);
|
|
5921
|
+
}
|
|
5922
|
+
}
|
|
5923
|
+
}, {
|
|
5924
|
+
key: "_positionPlaceholder",
|
|
5925
|
+
value: function _positionPlaceholder() {
|
|
5926
|
+
if (this.placeholder && this.placeholder.parentNode) {
|
|
5927
|
+
this.placeholder.style.width = this.table.columnManager.getWidth() + "px";
|
|
5928
|
+
this.placeholderContents.style.width = this.table.rowManager.element.clientWidth + "px";
|
|
5929
|
+
this.placeholderContents.style.marginLeft = this.scrollLeft + "px";
|
|
5848
5930
|
}
|
|
5849
5931
|
}
|
|
5850
5932
|
}, {
|
|
@@ -5897,6 +5979,8 @@
|
|
|
5897
5979
|
}
|
|
5898
5980
|
}
|
|
5899
5981
|
}
|
|
5982
|
+
|
|
5983
|
+
this._positionPlaceholder();
|
|
5900
5984
|
} //renitialize all rows
|
|
5901
5985
|
|
|
5902
5986
|
}, {
|
|
@@ -5923,12 +6007,12 @@
|
|
|
5923
6007
|
this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition);
|
|
5924
6008
|
this.redrawBlockRestoreConfig = false;
|
|
5925
6009
|
} else {
|
|
5926
|
-
if (this.
|
|
6010
|
+
if (this.redrawBlockRenderInPosition) {
|
|
5927
6011
|
this.reRenderInPosition();
|
|
5928
6012
|
}
|
|
5929
6013
|
}
|
|
5930
6014
|
|
|
5931
|
-
this.
|
|
6015
|
+
this.redrawBlockRenderInPosition = false;
|
|
5932
6016
|
} //redraw table
|
|
5933
6017
|
|
|
5934
6018
|
}, {
|
|
@@ -5941,12 +6025,6 @@
|
|
|
5941
6025
|
if (!force) {
|
|
5942
6026
|
this.reRenderInPosition();
|
|
5943
6027
|
this.scrollHorizontal(left);
|
|
5944
|
-
|
|
5945
|
-
if (!this.displayRowsCount) {
|
|
5946
|
-
if (this.table.options.placeholder) {
|
|
5947
|
-
this.getElement().appendChild(this.table.options.placeholder);
|
|
5948
|
-
}
|
|
5949
|
-
}
|
|
5950
6028
|
} else {
|
|
5951
6029
|
this.renderTable();
|
|
5952
6030
|
}
|
|
@@ -5984,6 +6062,8 @@
|
|
|
5984
6062
|
_this.active = false;
|
|
5985
6063
|
_this.element = _this.createElement(); //containing element
|
|
5986
6064
|
|
|
6065
|
+
_this.containerElement = _this.createContainerElement(); //containing element
|
|
6066
|
+
|
|
5987
6067
|
_this.external = false;
|
|
5988
6068
|
_this.links = [];
|
|
5989
6069
|
|
|
@@ -6004,6 +6084,14 @@
|
|
|
6004
6084
|
el.classList.add("tabulator-footer");
|
|
6005
6085
|
return el;
|
|
6006
6086
|
}
|
|
6087
|
+
}, {
|
|
6088
|
+
key: "createContainerElement",
|
|
6089
|
+
value: function createContainerElement() {
|
|
6090
|
+
var el = document.createElement("div");
|
|
6091
|
+
el.classList.add("tabulator-footer-contents");
|
|
6092
|
+
this.element.appendChild(el);
|
|
6093
|
+
return el;
|
|
6094
|
+
}
|
|
6007
6095
|
}, {
|
|
6008
6096
|
key: "initializeElement",
|
|
6009
6097
|
value: function initializeElement() {
|
|
@@ -6034,7 +6122,7 @@
|
|
|
6034
6122
|
key: "append",
|
|
6035
6123
|
value: function append(element, parent) {
|
|
6036
6124
|
this.activate(parent);
|
|
6037
|
-
this.
|
|
6125
|
+
this.containerElement.appendChild(element);
|
|
6038
6126
|
this.table.rowManager.adjustTableSize();
|
|
6039
6127
|
}
|
|
6040
6128
|
}, {
|
|
@@ -6111,11 +6199,24 @@
|
|
|
6111
6199
|
"tabulator-col": "column"
|
|
6112
6200
|
};
|
|
6113
6201
|
_this.pseudoTrackers = {
|
|
6114
|
-
"row":
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6202
|
+
"row": {
|
|
6203
|
+
subscriber: null,
|
|
6204
|
+
target: null
|
|
6205
|
+
},
|
|
6206
|
+
"cell": {
|
|
6207
|
+
subscriber: null,
|
|
6208
|
+
target: null
|
|
6209
|
+
},
|
|
6210
|
+
"group": {
|
|
6211
|
+
subscriber: null,
|
|
6212
|
+
target: null
|
|
6213
|
+
},
|
|
6214
|
+
"column": {
|
|
6215
|
+
subscriber: null,
|
|
6216
|
+
target: null
|
|
6217
|
+
}
|
|
6118
6218
|
};
|
|
6219
|
+
_this.pseudoTracking = false;
|
|
6119
6220
|
return _this;
|
|
6120
6221
|
}
|
|
6121
6222
|
|
|
@@ -6125,7 +6226,6 @@
|
|
|
6125
6226
|
this.el = this.table.element;
|
|
6126
6227
|
this.buildListenerMap();
|
|
6127
6228
|
this.bindSubscriptionWatchers();
|
|
6128
|
-
this.bindPseudoEvents();
|
|
6129
6229
|
}
|
|
6130
6230
|
}, {
|
|
6131
6231
|
key: "buildListenerMap",
|
|
@@ -6145,20 +6245,22 @@
|
|
|
6145
6245
|
var _this2 = this;
|
|
6146
6246
|
|
|
6147
6247
|
Object.keys(this.pseudoTrackers).forEach(function (key) {
|
|
6148
|
-
_this2.
|
|
6248
|
+
_this2.pseudoTrackers[key].subscriber = _this2.pseudoMouseEnter.bind(_this2, key);
|
|
6149
6249
|
|
|
6250
|
+
_this2.subscribe(key + "-mouseover", _this2.pseudoTrackers[key].subscriber);
|
|
6150
6251
|
});
|
|
6252
|
+
this.pseudoTracking = true;
|
|
6151
6253
|
}
|
|
6152
6254
|
}, {
|
|
6153
6255
|
key: "pseudoMouseEnter",
|
|
6154
6256
|
value: function pseudoMouseEnter(key, e, target) {
|
|
6155
|
-
if (this.pseudoTrackers[key] !== target) {
|
|
6156
|
-
if (this.pseudoTrackers[key]) {
|
|
6257
|
+
if (this.pseudoTrackers[key].target !== target) {
|
|
6258
|
+
if (this.pseudoTrackers[key].target) {
|
|
6157
6259
|
this.dispatch(key + "-mouseleave", e, target);
|
|
6158
6260
|
}
|
|
6159
6261
|
|
|
6160
6262
|
this.pseudoMouseLeave(key, e);
|
|
6161
|
-
this.pseudoTrackers[key] = target;
|
|
6263
|
+
this.pseudoTrackers[key].target = target;
|
|
6162
6264
|
this.dispatch(key + "-mouseenter", e, target);
|
|
6163
6265
|
}
|
|
6164
6266
|
}
|
|
@@ -6177,12 +6279,12 @@
|
|
|
6177
6279
|
return item !== key && (!links || links && !links.includes(item));
|
|
6178
6280
|
});
|
|
6179
6281
|
leaveList.forEach(function (key) {
|
|
6180
|
-
var target = _this3.pseudoTrackers[key];
|
|
6282
|
+
var target = _this3.pseudoTrackers[key].target;
|
|
6181
6283
|
|
|
6182
|
-
if (_this3.pseudoTrackers[key]) {
|
|
6284
|
+
if (_this3.pseudoTrackers[key].target) {
|
|
6183
6285
|
_this3.dispatch(key + "-mouseleave", e, target);
|
|
6184
6286
|
|
|
6185
|
-
_this3.pseudoTrackers[key] = null;
|
|
6287
|
+
_this3.pseudoTrackers[key].target = null;
|
|
6186
6288
|
}
|
|
6187
6289
|
});
|
|
6188
6290
|
}
|
|
@@ -6234,6 +6336,10 @@
|
|
|
6234
6336
|
}
|
|
6235
6337
|
}
|
|
6236
6338
|
|
|
6339
|
+
if ((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking) {
|
|
6340
|
+
this.bindPseudoEvents();
|
|
6341
|
+
}
|
|
6342
|
+
|
|
6237
6343
|
if (changed) {
|
|
6238
6344
|
this.updateEventListeners();
|
|
6239
6345
|
}
|
|
@@ -6265,7 +6371,7 @@
|
|
|
6265
6371
|
targets = this.bindComponents(type, targets);
|
|
6266
6372
|
this.triggerEvents(type, e, targets);
|
|
6267
6373
|
|
|
6268
|
-
if ((type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length) {
|
|
6374
|
+
if (this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length) {
|
|
6269
6375
|
this.pseudoMouseLeave("none", e);
|
|
6270
6376
|
}
|
|
6271
6377
|
}
|
|
@@ -6348,12 +6454,16 @@
|
|
|
6348
6454
|
switch (key) {
|
|
6349
6455
|
case "row":
|
|
6350
6456
|
case "group":
|
|
6351
|
-
if (listener.components.includes("row") || listener.components.includes("cell")) {
|
|
6457
|
+
if (listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")) {
|
|
6352
6458
|
var rows = _this5.table.rowManager.getVisibleRows(true);
|
|
6353
6459
|
|
|
6354
6460
|
component = rows.find(function (row) {
|
|
6355
6461
|
return row.getElement() === target;
|
|
6356
6462
|
});
|
|
6463
|
+
|
|
6464
|
+
if (targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")) {
|
|
6465
|
+
targets[key] = false;
|
|
6466
|
+
}
|
|
6357
6467
|
}
|
|
6358
6468
|
|
|
6359
6469
|
break;
|
|
@@ -6367,7 +6477,13 @@
|
|
|
6367
6477
|
|
|
6368
6478
|
case "cell":
|
|
6369
6479
|
if (listener.components.includes("cell")) {
|
|
6370
|
-
|
|
6480
|
+
if (targets["row"] instanceof Row) {
|
|
6481
|
+
component = targets["row"].findCell(target);
|
|
6482
|
+
} else {
|
|
6483
|
+
if (targets["row"]) {
|
|
6484
|
+
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?");
|
|
6485
|
+
}
|
|
6486
|
+
}
|
|
6371
6487
|
}
|
|
6372
6488
|
|
|
6373
6489
|
break;
|
|
@@ -6536,7 +6652,7 @@
|
|
|
6536
6652
|
data = JSON.parse(data);
|
|
6537
6653
|
}
|
|
6538
6654
|
|
|
6539
|
-
if (this.confirm("data-loading", data, params, config, silent)) {
|
|
6655
|
+
if (this.confirm("data-loading", [data, params, config, silent])) {
|
|
6540
6656
|
this.loading = true;
|
|
6541
6657
|
|
|
6542
6658
|
if (!silent) {
|
|
@@ -6546,7 +6662,7 @@
|
|
|
6546
6662
|
|
|
6547
6663
|
params = this.chain("data-params", [data, config, silent], params || {}, params || {});
|
|
6548
6664
|
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
6549
|
-
var result = this.chain("data-load", [data, params, config, silent], Promise.resolve([]));
|
|
6665
|
+
var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
|
|
6550
6666
|
return result.then(function (response) {
|
|
6551
6667
|
if (!Array.isArray(response) && _typeof(response) == "object") {
|
|
6552
6668
|
response = _this2.mapParams(response, _this2.objectInvert(_this2.table.options.dataReceiveParams));
|
|
@@ -6576,7 +6692,7 @@
|
|
|
6576
6692
|
|
|
6577
6693
|
setTimeout(function () {
|
|
6578
6694
|
_this2.hideLoader();
|
|
6579
|
-
},
|
|
6695
|
+
}, _this2.table.options.dataLoaderErrorTimeout);
|
|
6580
6696
|
})["finally"](function () {
|
|
6581
6697
|
_this2.loading = false;
|
|
6582
6698
|
});
|
|
@@ -7456,7 +7572,13 @@
|
|
|
7456
7572
|
"prev_title": "Prev Page",
|
|
7457
7573
|
"next": "Next",
|
|
7458
7574
|
"next_title": "Next Page",
|
|
7459
|
-
"all": "All"
|
|
7575
|
+
"all": "All",
|
|
7576
|
+
"counter": {
|
|
7577
|
+
"showing": "Showing",
|
|
7578
|
+
"of": "of",
|
|
7579
|
+
"rows": "rows",
|
|
7580
|
+
"pages": "pages"
|
|
7581
|
+
}
|
|
7460
7582
|
},
|
|
7461
7583
|
"headerFilters": {
|
|
7462
7584
|
"default": "filter column...",
|
|
@@ -7807,18 +7929,30 @@
|
|
|
7807
7929
|
|
|
7808
7930
|
|
|
7809
7931
|
tabulator.prototype.bindModules = function () {
|
|
7932
|
+
var orderedMods = [],
|
|
7933
|
+
unOrderedMods = [];
|
|
7810
7934
|
this.modules = {};
|
|
7811
7935
|
|
|
7812
7936
|
for (var name in tabulator.moduleBindings) {
|
|
7813
7937
|
var mod = tabulator.moduleBindings[name];
|
|
7814
|
-
|
|
7938
|
+
var module = new mod(this);
|
|
7939
|
+
this.modules[name] = module;
|
|
7815
7940
|
|
|
7816
7941
|
if (mod.prototype.moduleCore) {
|
|
7817
|
-
this.modulesCore
|
|
7942
|
+
this.modulesCore.push(module);
|
|
7818
7943
|
} else {
|
|
7819
|
-
|
|
7944
|
+
if (mod.moduleInitOrder) {
|
|
7945
|
+
orderedMods.push(module);
|
|
7946
|
+
} else {
|
|
7947
|
+
unOrderedMods.push(module);
|
|
7948
|
+
}
|
|
7820
7949
|
}
|
|
7821
7950
|
}
|
|
7951
|
+
|
|
7952
|
+
orderedMods.sort(function (a, b) {
|
|
7953
|
+
return a.moduleInitOrder > b.moduleInitOrder ? 1 : -1;
|
|
7954
|
+
});
|
|
7955
|
+
this.modulesRegular = orderedMods.concat(unOrderedMods);
|
|
7822
7956
|
};
|
|
7823
7957
|
}
|
|
7824
7958
|
}, {
|
|
@@ -7876,9 +8010,9 @@
|
|
|
7876
8010
|
|
|
7877
8011
|
this.modules = {}; //hold all modules bound to this table
|
|
7878
8012
|
|
|
7879
|
-
this.modulesCore =
|
|
8013
|
+
this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
|
|
7880
8014
|
|
|
7881
|
-
this.modulesRegular =
|
|
8015
|
+
this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
|
|
7882
8016
|
|
|
7883
8017
|
this.optionsList = new OptionsList(this, "table constructor");
|
|
7884
8018
|
this.initialized = false;
|
|
@@ -7931,9 +8065,9 @@
|
|
|
7931
8065
|
this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
|
|
7932
8066
|
this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
|
|
7933
8067
|
this.interactionMonitor = new InteractionManager(this);
|
|
7934
|
-
this.dataLoader.initialize();
|
|
7935
|
-
this.
|
|
7936
|
-
|
|
8068
|
+
this.dataLoader.initialize(); // this.columnManager.initialize();
|
|
8069
|
+
// this.rowManager.initialize();
|
|
8070
|
+
|
|
7937
8071
|
this.footerManager.initialize();
|
|
7938
8072
|
} //convert deprecated functionality to new functions
|
|
7939
8073
|
|
|
@@ -8075,21 +8209,9 @@
|
|
|
8075
8209
|
this._detectBrowser(); //initialize core modules
|
|
8076
8210
|
|
|
8077
8211
|
|
|
8078
|
-
|
|
8079
|
-
var mod = this.modulesCore[key];
|
|
8212
|
+
this.modulesCore.forEach(function (mod) {
|
|
8080
8213
|
mod.initialize();
|
|
8081
|
-
} //
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
if (typeof options.placeholder == "string") {
|
|
8085
|
-
var el = document.createElement("div");
|
|
8086
|
-
el.classList.add("tabulator-placeholder");
|
|
8087
|
-
var span = document.createElement("span");
|
|
8088
|
-
span.innerHTML = options.placeholder;
|
|
8089
|
-
el.appendChild(span);
|
|
8090
|
-
options.placeholder = el;
|
|
8091
|
-
} //build table elements
|
|
8092
|
-
|
|
8214
|
+
}); //build table elements
|
|
8093
8215
|
|
|
8094
8216
|
element.appendChild(this.columnManager.getElement());
|
|
8095
8217
|
element.appendChild(this.rowManager.getElement());
|
|
@@ -8103,12 +8225,9 @@
|
|
|
8103
8225
|
} //initialize regular modules
|
|
8104
8226
|
|
|
8105
8227
|
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
_mod.initialize();
|
|
8110
|
-
}
|
|
8111
|
-
|
|
8228
|
+
this.modulesRegular.forEach(function (mod) {
|
|
8229
|
+
mod.initialize();
|
|
8230
|
+
});
|
|
8112
8231
|
this.columnManager.setColumns(options.columns);
|
|
8113
8232
|
this.eventBus.dispatch("table-built");
|
|
8114
8233
|
}
|
|
@@ -8172,46 +8291,6 @@
|
|
|
8172
8291
|
key: "restoreRedraw",
|
|
8173
8292
|
value: function restoreRedraw() {
|
|
8174
8293
|
return this.rowManager.restoreRedraw();
|
|
8175
|
-
} //local data from local file
|
|
8176
|
-
|
|
8177
|
-
}, {
|
|
8178
|
-
key: "setDataFromLocalFile",
|
|
8179
|
-
value: function setDataFromLocalFile(extensions) {
|
|
8180
|
-
var _this2 = this;
|
|
8181
|
-
|
|
8182
|
-
return new Promise(function (resolve, reject) {
|
|
8183
|
-
var input = document.createElement("input");
|
|
8184
|
-
input.type = "file";
|
|
8185
|
-
input.accept = extensions || ".json,application/json";
|
|
8186
|
-
input.addEventListener("change", function (e) {
|
|
8187
|
-
var file = input.files[0],
|
|
8188
|
-
reader = new FileReader(),
|
|
8189
|
-
data;
|
|
8190
|
-
reader.readAsText(file);
|
|
8191
|
-
|
|
8192
|
-
reader.onload = function (e) {
|
|
8193
|
-
try {
|
|
8194
|
-
data = JSON.parse(reader.result);
|
|
8195
|
-
} catch (e) {
|
|
8196
|
-
console.warn("File Load Error - File contents is invalid JSON", e);
|
|
8197
|
-
reject(e);
|
|
8198
|
-
return;
|
|
8199
|
-
}
|
|
8200
|
-
|
|
8201
|
-
_this2.setData(data).then(function (data) {
|
|
8202
|
-
resolve(data);
|
|
8203
|
-
})["catch"](function (err) {
|
|
8204
|
-
resolve(err);
|
|
8205
|
-
});
|
|
8206
|
-
};
|
|
8207
|
-
|
|
8208
|
-
reader.onerror = function (e) {
|
|
8209
|
-
console.warn("File Load Error - Unable to read file");
|
|
8210
|
-
reject();
|
|
8211
|
-
};
|
|
8212
|
-
});
|
|
8213
|
-
input.click();
|
|
8214
|
-
});
|
|
8215
8294
|
} //load data
|
|
8216
8295
|
|
|
8217
8296
|
}, {
|
|
@@ -8256,13 +8335,13 @@
|
|
|
8256
8335
|
}, {
|
|
8257
8336
|
key: "updateData",
|
|
8258
8337
|
value: function updateData(data) {
|
|
8259
|
-
var
|
|
8338
|
+
var _this2 = this;
|
|
8260
8339
|
|
|
8261
8340
|
var responses = 0;
|
|
8262
8341
|
|
|
8263
8342
|
if (this.initialized) {
|
|
8264
8343
|
return new Promise(function (resolve, reject) {
|
|
8265
|
-
|
|
8344
|
+
_this2.dataLoader.blockActiveLoad();
|
|
8266
8345
|
|
|
8267
8346
|
if (typeof data === "string") {
|
|
8268
8347
|
data = JSON.parse(data);
|
|
@@ -8270,7 +8349,7 @@
|
|
|
8270
8349
|
|
|
8271
8350
|
if (data) {
|
|
8272
8351
|
data.forEach(function (item) {
|
|
8273
|
-
var row =
|
|
8352
|
+
var row = _this2.rowManager.findRow(item[_this2.options.index]);
|
|
8274
8353
|
|
|
8275
8354
|
if (row) {
|
|
8276
8355
|
responses++;
|
|
@@ -8295,18 +8374,18 @@
|
|
|
8295
8374
|
}, {
|
|
8296
8375
|
key: "addData",
|
|
8297
8376
|
value: function addData(data, pos, index) {
|
|
8298
|
-
var
|
|
8377
|
+
var _this3 = this;
|
|
8299
8378
|
|
|
8300
8379
|
if (this.initialized) {
|
|
8301
8380
|
return new Promise(function (resolve, reject) {
|
|
8302
|
-
|
|
8381
|
+
_this3.dataLoader.blockActiveLoad();
|
|
8303
8382
|
|
|
8304
8383
|
if (typeof data === "string") {
|
|
8305
8384
|
data = JSON.parse(data);
|
|
8306
8385
|
}
|
|
8307
8386
|
|
|
8308
8387
|
if (data) {
|
|
8309
|
-
|
|
8388
|
+
_this3.rowManager.addRows(data, pos, index).then(function (rows) {
|
|
8310
8389
|
var output = [];
|
|
8311
8390
|
rows.forEach(function (row) {
|
|
8312
8391
|
output.push(row.getComponent());
|
|
@@ -8326,14 +8405,14 @@
|
|
|
8326
8405
|
}, {
|
|
8327
8406
|
key: "updateOrAddData",
|
|
8328
8407
|
value: function updateOrAddData(data) {
|
|
8329
|
-
var
|
|
8408
|
+
var _this4 = this;
|
|
8330
8409
|
|
|
8331
8410
|
var rows = [],
|
|
8332
8411
|
responses = 0;
|
|
8333
8412
|
|
|
8334
8413
|
if (this.initialized) {
|
|
8335
8414
|
return new Promise(function (resolve, reject) {
|
|
8336
|
-
|
|
8415
|
+
_this4.dataLoader.blockActiveLoad();
|
|
8337
8416
|
|
|
8338
8417
|
if (typeof data === "string") {
|
|
8339
8418
|
data = JSON.parse(data);
|
|
@@ -8341,7 +8420,7 @@
|
|
|
8341
8420
|
|
|
8342
8421
|
if (data) {
|
|
8343
8422
|
data.forEach(function (item) {
|
|
8344
|
-
var row =
|
|
8423
|
+
var row = _this4.rowManager.findRow(item[_this4.options.index]);
|
|
8345
8424
|
|
|
8346
8425
|
responses++;
|
|
8347
8426
|
|
|
@@ -8355,7 +8434,7 @@
|
|
|
8355
8434
|
}
|
|
8356
8435
|
});
|
|
8357
8436
|
} else {
|
|
8358
|
-
|
|
8437
|
+
_this4.rowManager.addRows(item).then(function (newRows) {
|
|
8359
8438
|
responses--;
|
|
8360
8439
|
rows.push(newRows[0].getComponent());
|
|
8361
8440
|
|
|
@@ -8404,7 +8483,7 @@
|
|
|
8404
8483
|
}, {
|
|
8405
8484
|
key: "deleteRow",
|
|
8406
8485
|
value: function deleteRow(index) {
|
|
8407
|
-
var
|
|
8486
|
+
var _this5 = this;
|
|
8408
8487
|
|
|
8409
8488
|
var foundRows = [];
|
|
8410
8489
|
|
|
@@ -8437,7 +8516,7 @@
|
|
|
8437
8516
|
}
|
|
8438
8517
|
|
|
8439
8518
|
foundRows.sort(function (a, b) {
|
|
8440
|
-
return
|
|
8519
|
+
return _this5.rowManager.rows.indexOf(a) > _this5.rowManager.rows.indexOf(b) ? 1 : -1;
|
|
8441
8520
|
}); //delete rows
|
|
8442
8521
|
|
|
8443
8522
|
foundRows.forEach(function (row) {
|
|
@@ -8667,13 +8746,13 @@
|
|
|
8667
8746
|
}, {
|
|
8668
8747
|
key: "scrollToColumn",
|
|
8669
8748
|
value: function scrollToColumn(field, position, ifVisible) {
|
|
8670
|
-
var
|
|
8749
|
+
var _this6 = this;
|
|
8671
8750
|
|
|
8672
8751
|
return new Promise(function (resolve, reject) {
|
|
8673
|
-
var column =
|
|
8752
|
+
var column = _this6.columnManager.findColumn(field);
|
|
8674
8753
|
|
|
8675
8754
|
if (column) {
|
|
8676
|
-
return
|
|
8755
|
+
return _this6.columnManager.scrollToColumn(column, position, ifVisible);
|
|
8677
8756
|
} else {
|
|
8678
8757
|
console.warn("Scroll Error - No matching column found:", field);
|
|
8679
8758
|
return Promise.reject("Scroll Error - No matching column found");
|
|
@@ -9078,7 +9157,7 @@
|
|
|
9078
9157
|
_classCallCheck(this, Ajax);
|
|
9079
9158
|
|
|
9080
9159
|
_this = _super.call(this, table);
|
|
9081
|
-
_this.config =
|
|
9160
|
+
_this.config = {}; //hold config object for ajax request
|
|
9082
9161
|
|
|
9083
9162
|
_this.url = ""; //request URL
|
|
9084
9163
|
|
|
@@ -9119,22 +9198,31 @@
|
|
|
9119
9198
|
this.loaderPromise = this.table.options.ajaxRequestFunc || Ajax.defaultLoaderPromise;
|
|
9120
9199
|
this.urlGenerator = this.table.options.ajaxURLGenerator || Ajax.defaultURLGenerator;
|
|
9121
9200
|
|
|
9122
|
-
if (this.table.options.ajaxParams) {
|
|
9123
|
-
this.setParams(this.table.options.ajaxParams);
|
|
9124
|
-
}
|
|
9125
|
-
|
|
9126
|
-
if (this.table.options.ajaxConfig) {
|
|
9127
|
-
this.setConfig(this.table.options.ajaxConfig);
|
|
9128
|
-
}
|
|
9129
|
-
|
|
9130
9201
|
if (this.table.options.ajaxURL) {
|
|
9131
9202
|
this.setUrl(this.table.options.ajaxURL);
|
|
9132
9203
|
}
|
|
9133
9204
|
|
|
9205
|
+
this.setDefaultConfig(this.table.options.ajaxConfig);
|
|
9134
9206
|
this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
|
|
9135
9207
|
this.subscribe("data-loading", this.requestDataCheck.bind(this));
|
|
9208
|
+
this.subscribe("data-params", this.requestParams.bind(this));
|
|
9136
9209
|
this.subscribe("data-load", this.requestData.bind(this));
|
|
9137
9210
|
}
|
|
9211
|
+
}, {
|
|
9212
|
+
key: "requestParams",
|
|
9213
|
+
value: function requestParams(data, config, silent, params) {
|
|
9214
|
+
var ajaxParams = this.table.options.ajaxParams;
|
|
9215
|
+
|
|
9216
|
+
if (ajaxParams) {
|
|
9217
|
+
if (typeof ajaxParams === "function") {
|
|
9218
|
+
ajaxParams = ajaxParams.call(this.table);
|
|
9219
|
+
}
|
|
9220
|
+
|
|
9221
|
+
params = Object.assign(params, ajaxParams);
|
|
9222
|
+
}
|
|
9223
|
+
|
|
9224
|
+
return params;
|
|
9225
|
+
}
|
|
9138
9226
|
}, {
|
|
9139
9227
|
key: "requestDataCheck",
|
|
9140
9228
|
value: function requestDataCheck(data, params, config, silent) {
|
|
@@ -9142,69 +9230,46 @@
|
|
|
9142
9230
|
}
|
|
9143
9231
|
}, {
|
|
9144
9232
|
key: "requestData",
|
|
9145
|
-
value: function requestData(
|
|
9146
|
-
|
|
9147
|
-
if (data) {
|
|
9148
|
-
this.setUrl(data);
|
|
9149
|
-
}
|
|
9150
|
-
|
|
9151
|
-
if (params) {
|
|
9152
|
-
this.setParams(params, true);
|
|
9153
|
-
}
|
|
9233
|
+
value: function requestData(url, params, config, silent, previousData) {
|
|
9234
|
+
var ajaxConfig;
|
|
9154
9235
|
|
|
9155
|
-
|
|
9156
|
-
|
|
9236
|
+
if (!previousData && this.requestDataCheck(url)) {
|
|
9237
|
+
if (url) {
|
|
9238
|
+
this.setUrl(url);
|
|
9157
9239
|
}
|
|
9158
9240
|
|
|
9159
|
-
|
|
9241
|
+
ajaxConfig = this.generateConfig(config);
|
|
9242
|
+
return this.sendRequest(this.url, params, ajaxConfig);
|
|
9160
9243
|
} else {
|
|
9161
9244
|
return previousData;
|
|
9162
9245
|
}
|
|
9163
|
-
}
|
|
9164
|
-
|
|
9246
|
+
}
|
|
9165
9247
|
}, {
|
|
9166
|
-
key: "
|
|
9167
|
-
value: function
|
|
9168
|
-
|
|
9169
|
-
|
|
9248
|
+
key: "setDefaultConfig",
|
|
9249
|
+
value: function setDefaultConfig() {
|
|
9250
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9251
|
+
this.config = Object.assign({}, Ajax.defaultConfig);
|
|
9170
9252
|
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
}
|
|
9253
|
+
if (typeof config == "string") {
|
|
9254
|
+
this.config.method = config;
|
|
9174
9255
|
} else {
|
|
9175
|
-
this.
|
|
9256
|
+
Object.assign(this.config, config);
|
|
9176
9257
|
}
|
|
9177
|
-
}
|
|
9178
|
-
}, {
|
|
9179
|
-
key: "getParams",
|
|
9180
|
-
value: function getParams() {
|
|
9181
|
-
return this.params || {};
|
|
9182
9258
|
} //load config object
|
|
9183
9259
|
|
|
9184
9260
|
}, {
|
|
9185
|
-
key: "
|
|
9186
|
-
value: function
|
|
9187
|
-
|
|
9261
|
+
key: "generateConfig",
|
|
9262
|
+
value: function generateConfig() {
|
|
9263
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9264
|
+
var ajaxConfig = Object.assign({}, this.config);
|
|
9188
9265
|
|
|
9189
9266
|
if (typeof config == "string") {
|
|
9190
|
-
|
|
9267
|
+
ajaxConfig.method = config;
|
|
9191
9268
|
} else {
|
|
9192
|
-
|
|
9193
|
-
this.config[key] = config[key];
|
|
9194
|
-
}
|
|
9269
|
+
Object.assign(ajaxConfig, config);
|
|
9195
9270
|
}
|
|
9196
|
-
} //create config object from default
|
|
9197
|
-
|
|
9198
|
-
}, {
|
|
9199
|
-
key: "_loadDefaultConfig",
|
|
9200
|
-
value: function _loadDefaultConfig(force) {
|
|
9201
|
-
if (!this.config || force) {
|
|
9202
|
-
this.config = {}; //load base config from defaults
|
|
9203
9271
|
|
|
9204
|
-
|
|
9205
|
-
this.config[key] = Ajax.defaultConfig[key];
|
|
9206
|
-
}
|
|
9207
|
-
}
|
|
9272
|
+
return ajaxConfig;
|
|
9208
9273
|
} //set request url
|
|
9209
9274
|
|
|
9210
9275
|
}, {
|
|
@@ -9221,17 +9286,13 @@
|
|
|
9221
9286
|
|
|
9222
9287
|
}, {
|
|
9223
9288
|
key: "sendRequest",
|
|
9224
|
-
value: function sendRequest(
|
|
9289
|
+
value: function sendRequest(url, params, config) {
|
|
9225
9290
|
var _this2 = this;
|
|
9226
9291
|
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
this._loadDefaultConfig();
|
|
9230
|
-
|
|
9231
|
-
if (this.table.options.ajaxRequesting.call(this.table, this.url, this.params) !== false) {
|
|
9232
|
-
return this.loaderPromise(url, this.config, this.params).then(function (data) {
|
|
9292
|
+
if (this.table.options.ajaxRequesting.call(this.table, url, params) !== false) {
|
|
9293
|
+
return this.loaderPromise(url, config, params).then(function (data) {
|
|
9233
9294
|
if (_this2.table.options.ajaxResponse) {
|
|
9234
|
-
data = _this2.table.options.ajaxResponse.call(_this2.table,
|
|
9295
|
+
data = _this2.table.options.ajaxResponse.call(_this2.table, url, params, data);
|
|
9235
9296
|
}
|
|
9236
9297
|
|
|
9237
9298
|
return data;
|
|
@@ -9827,7 +9888,7 @@
|
|
|
9827
9888
|
}, {
|
|
9828
9889
|
key: "initialize",
|
|
9829
9890
|
value: function initialize() {
|
|
9830
|
-
this.genColumn = new Column
|
|
9891
|
+
this.genColumn = new Column({
|
|
9831
9892
|
field: "value"
|
|
9832
9893
|
}, this);
|
|
9833
9894
|
this.subscribe("cell-value-changed", this.cellValueChanged.bind(this));
|
|
@@ -9837,7 +9898,7 @@
|
|
|
9837
9898
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
9838
9899
|
this.subscribe("column-moved", this.recalcActiveRows.bind(this));
|
|
9839
9900
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
9840
|
-
this.subscribe("data-
|
|
9901
|
+
this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
|
|
9841
9902
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
9842
9903
|
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
9843
9904
|
this.registerTableFunction("getCalcResults", this.getResults.bind(this));
|
|
@@ -10139,7 +10200,7 @@
|
|
|
10139
10200
|
data.push(row.getData());
|
|
10140
10201
|
|
|
10141
10202
|
if (_this3.table.options.dataTree && _this3.table.options.dataTreeChildColumnCalcs) {
|
|
10142
|
-
if (row.modules.dataTree.open) {
|
|
10203
|
+
if (row.modules.dataTree && row.modules.dataTree.open) {
|
|
10143
10204
|
var children = _this3.rowsToData(_this3.table.modules.dataTree.getFilteredTreeChildren(row));
|
|
10144
10205
|
|
|
10145
10206
|
data = data.concat(children);
|
|
@@ -10386,6 +10447,8 @@
|
|
|
10386
10447
|
|
|
10387
10448
|
_this.registerComponentFunction("row", "addTreeChild", _this.addTreeChildRow.bind(_assertThisInitialized(_this)));
|
|
10388
10449
|
|
|
10450
|
+
_this.registerComponentFunction("row", "isTreeExpanded", _this.isRowExpanded.bind(_assertThisInitialized(_this)));
|
|
10451
|
+
|
|
10389
10452
|
return _this;
|
|
10390
10453
|
}
|
|
10391
10454
|
|
|
@@ -10766,6 +10829,11 @@
|
|
|
10766
10829
|
}
|
|
10767
10830
|
}
|
|
10768
10831
|
}
|
|
10832
|
+
}, {
|
|
10833
|
+
key: "isRowExpanded",
|
|
10834
|
+
value: function isRowExpanded(row) {
|
|
10835
|
+
return row.modules.dataTree.open;
|
|
10836
|
+
}
|
|
10769
10837
|
}, {
|
|
10770
10838
|
key: "getTreeParent",
|
|
10771
10839
|
value: function getTreeParent(row) {
|
|
@@ -10936,7 +11004,6 @@
|
|
|
10936
11004
|
}, {
|
|
10937
11005
|
key: "redrawNeeded",
|
|
10938
11006
|
value: function redrawNeeded(data) {
|
|
10939
|
-
console.log("needed?", data);
|
|
10940
11007
|
return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
|
|
10941
11008
|
}
|
|
10942
11009
|
}]);
|
|
@@ -11025,7 +11092,7 @@
|
|
|
11025
11092
|
case "row":
|
|
11026
11093
|
row.columns.forEach(function (col) {
|
|
11027
11094
|
if (col) {
|
|
11028
|
-
item[col.component.getField()] = col.value;
|
|
11095
|
+
item[col.component.getTitleDownload() || col.component.getField()] = col.value;
|
|
11029
11096
|
}
|
|
11030
11097
|
});
|
|
11031
11098
|
fileContents.push(item);
|
|
@@ -11268,9 +11335,40 @@
|
|
|
11268
11335
|
}
|
|
11269
11336
|
}
|
|
11270
11337
|
|
|
11338
|
+
function jsonLines (list, options, setFileContents) {
|
|
11339
|
+
var fileContents = [];
|
|
11340
|
+
list.forEach(function (row) {
|
|
11341
|
+
var item = {};
|
|
11342
|
+
|
|
11343
|
+
switch (row.type) {
|
|
11344
|
+
case "header":
|
|
11345
|
+
break;
|
|
11346
|
+
|
|
11347
|
+
case "group":
|
|
11348
|
+
console.warn("Download Warning - JSON downloader cannot process row groups");
|
|
11349
|
+
break;
|
|
11350
|
+
|
|
11351
|
+
case "calc":
|
|
11352
|
+
console.warn("Download Warning - JSON downloader cannot process column calculations");
|
|
11353
|
+
break;
|
|
11354
|
+
|
|
11355
|
+
case "row":
|
|
11356
|
+
row.columns.forEach(function (col) {
|
|
11357
|
+
if (col) {
|
|
11358
|
+
item[col.component.getTitleDownload() || col.component.getField()] = col.value;
|
|
11359
|
+
}
|
|
11360
|
+
});
|
|
11361
|
+
fileContents.push(JSON.stringify(item));
|
|
11362
|
+
break;
|
|
11363
|
+
}
|
|
11364
|
+
});
|
|
11365
|
+
setFileContents(fileContents.join("\n"), "application/x-ndjson");
|
|
11366
|
+
}
|
|
11367
|
+
|
|
11271
11368
|
var defaultDownloaders = {
|
|
11272
11369
|
csv: csv,
|
|
11273
11370
|
json: json,
|
|
11371
|
+
jsonLines: jsonLines,
|
|
11274
11372
|
pdf: pdf,
|
|
11275
11373
|
xlsx: xlsx,
|
|
11276
11374
|
html: html
|
|
@@ -13283,13 +13381,13 @@
|
|
|
13283
13381
|
this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
|
|
13284
13382
|
this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
|
|
13285
13383
|
this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
|
|
13286
|
-
this.subscribe("data-
|
|
13287
|
-
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this));
|
|
13384
|
+
this.subscribe("data-refreshing", this.cancelEdit.bind(this));
|
|
13385
|
+
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
|
|
13288
13386
|
this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
|
|
13289
|
-
this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this));
|
|
13290
|
-
this.subscribe("keybinding-nav-right", this.navigateRight.bind(this));
|
|
13291
|
-
this.subscribe("keybinding-nav-up", this.navigateUp.bind(this));
|
|
13292
|
-
this.subscribe("keybinding-nav-down", this.navigateDown.bind(this));
|
|
13387
|
+
this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this, undefined));
|
|
13388
|
+
this.subscribe("keybinding-nav-right", this.navigateRight.bind(this, undefined));
|
|
13389
|
+
this.subscribe("keybinding-nav-up", this.navigateUp.bind(this, undefined));
|
|
13390
|
+
this.subscribe("keybinding-nav-down", this.navigateDown.bind(this, undefined));
|
|
13293
13391
|
} ///////////////////////////////////
|
|
13294
13392
|
////// Keybinding Functions ///////
|
|
13295
13393
|
///////////////////////////////////
|
|
@@ -13301,7 +13399,7 @@
|
|
|
13301
13399
|
newRow = this.options("tabEndNewRow");
|
|
13302
13400
|
|
|
13303
13401
|
if (cell) {
|
|
13304
|
-
if (!this.navigateNext(e)) {
|
|
13402
|
+
if (!this.navigateNext(cell, e)) {
|
|
13305
13403
|
if (newRow) {
|
|
13306
13404
|
cell.getElement().firstChild.blur();
|
|
13307
13405
|
|
|
@@ -13317,7 +13415,7 @@
|
|
|
13317
13415
|
|
|
13318
13416
|
newRow.then(function () {
|
|
13319
13417
|
setTimeout(function () {
|
|
13320
|
-
|
|
13418
|
+
cell.getComponent().navigateNext();
|
|
13321
13419
|
});
|
|
13322
13420
|
});
|
|
13323
13421
|
}
|
|
@@ -13350,7 +13448,7 @@
|
|
|
13350
13448
|
var _this2 = this;
|
|
13351
13449
|
|
|
13352
13450
|
if (!cells) {
|
|
13353
|
-
cells = this.modules.edit.getEditedCells();
|
|
13451
|
+
cells = this.table.modules.edit.getEditedCells();
|
|
13354
13452
|
}
|
|
13355
13453
|
|
|
13356
13454
|
if (!Array.isArray(cells)) {
|
|
@@ -13358,15 +13456,15 @@
|
|
|
13358
13456
|
}
|
|
13359
13457
|
|
|
13360
13458
|
cells.forEach(function (cell) {
|
|
13361
|
-
_this2.modules.edit.clearEdited(cell._getSelf());
|
|
13459
|
+
_this2.table.modules.edit.clearEdited(cell._getSelf());
|
|
13362
13460
|
});
|
|
13363
13461
|
}
|
|
13364
13462
|
}, {
|
|
13365
13463
|
key: "navigatePrev",
|
|
13366
|
-
value: function navigatePrev(
|
|
13367
|
-
var cell = this.currentCell
|
|
13368
|
-
|
|
13369
|
-
|
|
13464
|
+
value: function navigatePrev() {
|
|
13465
|
+
var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
|
|
13466
|
+
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
13467
|
+
var nextCell, prevRow;
|
|
13370
13468
|
|
|
13371
13469
|
if (cell) {
|
|
13372
13470
|
if (e) {
|
|
@@ -13395,10 +13493,10 @@
|
|
|
13395
13493
|
}
|
|
13396
13494
|
}, {
|
|
13397
13495
|
key: "navigateNext",
|
|
13398
|
-
value: function navigateNext(
|
|
13399
|
-
var cell = this.currentCell
|
|
13400
|
-
|
|
13401
|
-
|
|
13496
|
+
value: function navigateNext() {
|
|
13497
|
+
var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
|
|
13498
|
+
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
13499
|
+
var nextCell, nextRow;
|
|
13402
13500
|
|
|
13403
13501
|
if (cell) {
|
|
13404
13502
|
if (e) {
|
|
@@ -13427,10 +13525,10 @@
|
|
|
13427
13525
|
}
|
|
13428
13526
|
}, {
|
|
13429
13527
|
key: "navigateLeft",
|
|
13430
|
-
value: function navigateLeft(
|
|
13431
|
-
var cell = this.currentCell
|
|
13432
|
-
|
|
13433
|
-
|
|
13528
|
+
value: function navigateLeft() {
|
|
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, nextCell;
|
|
13434
13532
|
|
|
13435
13533
|
if (cell) {
|
|
13436
13534
|
if (e) {
|
|
@@ -13450,10 +13548,10 @@
|
|
|
13450
13548
|
}
|
|
13451
13549
|
}, {
|
|
13452
13550
|
key: "navigateRight",
|
|
13453
|
-
value: function navigateRight(
|
|
13454
|
-
var cell = this.currentCell
|
|
13455
|
-
|
|
13456
|
-
|
|
13551
|
+
value: function navigateRight() {
|
|
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, nextCell;
|
|
13457
13555
|
|
|
13458
13556
|
if (cell) {
|
|
13459
13557
|
if (e) {
|
|
@@ -13473,10 +13571,10 @@
|
|
|
13473
13571
|
}
|
|
13474
13572
|
}, {
|
|
13475
13573
|
key: "navigateUp",
|
|
13476
|
-
value: function navigateUp(
|
|
13477
|
-
var cell = this.currentCell
|
|
13478
|
-
|
|
13479
|
-
|
|
13574
|
+
value: function navigateUp() {
|
|
13575
|
+
var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
|
|
13576
|
+
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
13577
|
+
var index, nextRow;
|
|
13480
13578
|
|
|
13481
13579
|
if (cell) {
|
|
13482
13580
|
if (e) {
|
|
@@ -13496,10 +13594,10 @@
|
|
|
13496
13594
|
}
|
|
13497
13595
|
}, {
|
|
13498
13596
|
key: "navigateDown",
|
|
13499
|
-
value: function navigateDown(
|
|
13500
|
-
var cell = this.currentCell
|
|
13501
|
-
|
|
13502
|
-
|
|
13597
|
+
value: function navigateDown() {
|
|
13598
|
+
var cell = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.currentCell;
|
|
13599
|
+
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
13600
|
+
var index, nextRow;
|
|
13503
13601
|
|
|
13504
13602
|
if (cell) {
|
|
13505
13603
|
if (e) {
|
|
@@ -13654,8 +13752,8 @@
|
|
|
13654
13752
|
cellEl = cell.getElement();
|
|
13655
13753
|
|
|
13656
13754
|
if (cancel) {
|
|
13657
|
-
if (cell.validate) {
|
|
13658
|
-
|
|
13755
|
+
if (cell.column.modules.validate && this.table.modExists("validate")) {
|
|
13756
|
+
this.table.modules.validate.cellValidate(cell);
|
|
13659
13757
|
}
|
|
13660
13758
|
} else {
|
|
13661
13759
|
cellEl.classList.remove("tabulator-validation-fail");
|
|
@@ -14202,7 +14300,8 @@
|
|
|
14202
14300
|
var columns = [];
|
|
14203
14301
|
header.forEach(function (col) {
|
|
14204
14302
|
if (col) {
|
|
14205
|
-
|
|
14303
|
+
var title = typeof col.title === "undefined" ? "" : col.title;
|
|
14304
|
+
columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
|
|
14206
14305
|
} else {
|
|
14207
14306
|
columns.push(null);
|
|
14208
14307
|
}
|
|
@@ -15116,7 +15215,7 @@
|
|
|
15116
15215
|
}
|
|
15117
15216
|
};
|
|
15118
15217
|
params = column.definition.headerFilterParams || {};
|
|
15119
|
-
params = typeof params === "function" ? params.call(self.table) : params;
|
|
15218
|
+
params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
|
|
15120
15219
|
editorElement = editor.call(this.table.modules.edit, cellWrapper, function () {}, success, cancel, params);
|
|
15121
15220
|
|
|
15122
15221
|
if (!editorElement) {
|
|
@@ -15323,6 +15422,8 @@
|
|
|
15323
15422
|
value: function addFilter(field, type, value, params) {
|
|
15324
15423
|
var _this4 = this;
|
|
15325
15424
|
|
|
15425
|
+
var changed = false;
|
|
15426
|
+
|
|
15326
15427
|
if (!Array.isArray(field)) {
|
|
15327
15428
|
field = [{
|
|
15328
15429
|
field: field,
|
|
@@ -15338,9 +15439,13 @@
|
|
|
15338
15439
|
if (filter) {
|
|
15339
15440
|
_this4.filterList.push(filter);
|
|
15340
15441
|
|
|
15341
|
-
|
|
15442
|
+
changed = true;
|
|
15342
15443
|
}
|
|
15343
15444
|
});
|
|
15445
|
+
|
|
15446
|
+
if (changed) {
|
|
15447
|
+
this.trackChanges();
|
|
15448
|
+
}
|
|
15344
15449
|
}
|
|
15345
15450
|
}, {
|
|
15346
15451
|
key: "findFilter",
|
|
@@ -15831,7 +15936,7 @@
|
|
|
15831
15936
|
var value = cell.getValue();
|
|
15832
15937
|
|
|
15833
15938
|
if (typeof DT != "undefined") {
|
|
15834
|
-
var newDatetime = DT.fromFormat(String(value), inputFormat);
|
|
15939
|
+
var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
|
|
15835
15940
|
|
|
15836
15941
|
if (newDatetime.isValid) {
|
|
15837
15942
|
if (formatterParams.timezone) {
|
|
@@ -15864,7 +15969,7 @@
|
|
|
15864
15969
|
var value = cell.getValue();
|
|
15865
15970
|
|
|
15866
15971
|
if (typeof DT != "undefined") {
|
|
15867
|
-
var newDatetime = DT.fromFormat(String(value), inputFormat);
|
|
15972
|
+
var newDatetime = inputFormat === "iso" ? DT.fromISO(String(value)) : DT.fromFormat(String(value), inputFormat);
|
|
15868
15973
|
|
|
15869
15974
|
if (newDatetime.isValid) {
|
|
15870
15975
|
if (humanize) ; else {
|
|
@@ -16124,7 +16229,7 @@
|
|
|
16124
16229
|
}
|
|
16125
16230
|
|
|
16126
16231
|
function rownum (cell, formatterParams, onRendered) {
|
|
16127
|
-
return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1;
|
|
16232
|
+
return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1 || "";
|
|
16128
16233
|
}
|
|
16129
16234
|
|
|
16130
16235
|
function handle (cell, formatterParams, onRendered) {
|
|
@@ -16499,7 +16604,7 @@
|
|
|
16499
16604
|
this.subscribe("cell-layout", this.layoutCell.bind(this));
|
|
16500
16605
|
this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
16501
16606
|
this.subscribe("column-width", this.layout.bind(this));
|
|
16502
|
-
this.subscribe("row-layout-
|
|
16607
|
+
this.subscribe("row-layout-after", this.layoutRow.bind(this));
|
|
16503
16608
|
this.subscribe("table-layout", this.layout.bind(this));
|
|
16504
16609
|
this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
|
|
16505
16610
|
this.subscribe("columns-loading", this.reset.bind(this));
|
|
@@ -16795,6 +16900,7 @@
|
|
|
16795
16900
|
|
|
16796
16901
|
this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
|
|
16797
16902
|
this.subscribe("row-deleting", this.detachRow.bind(this));
|
|
16903
|
+
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
16798
16904
|
this.registerDisplayHandler(this.getRows.bind(this), 10);
|
|
16799
16905
|
}
|
|
16800
16906
|
}, {
|
|
@@ -16807,6 +16913,14 @@
|
|
|
16807
16913
|
key: "isFrozen",
|
|
16808
16914
|
value: function isFrozen() {
|
|
16809
16915
|
return !!this.rows.length;
|
|
16916
|
+
}
|
|
16917
|
+
}, {
|
|
16918
|
+
key: "visibleRows",
|
|
16919
|
+
value: function visibleRows(viewable, rows) {
|
|
16920
|
+
this.rows.forEach(function (row) {
|
|
16921
|
+
rows.push(row);
|
|
16922
|
+
});
|
|
16923
|
+
return rows;
|
|
16810
16924
|
} //filter frozen rows out of display data
|
|
16811
16925
|
|
|
16812
16926
|
}, {
|
|
@@ -16899,7 +17013,7 @@
|
|
|
16899
17013
|
if (typeof target[name] !== "undefined") {
|
|
16900
17014
|
return target[name];
|
|
16901
17015
|
} else {
|
|
16902
|
-
return target._group.table.componentFunctionBinder.handle("row", target._group, name);
|
|
17016
|
+
return target._group.groupManager.table.componentFunctionBinder.handle("row", target._group, name);
|
|
16903
17017
|
}
|
|
16904
17018
|
}
|
|
16905
17019
|
});
|
|
@@ -16988,6 +17102,7 @@
|
|
|
16988
17102
|
this.groups = [];
|
|
16989
17103
|
this.groupList = [];
|
|
16990
17104
|
this.generator = generator;
|
|
17105
|
+
this.element = false;
|
|
16991
17106
|
this.elementContents = false;
|
|
16992
17107
|
this.height = 0;
|
|
16993
17108
|
this.outerHeight = 0;
|
|
@@ -17058,72 +17173,15 @@
|
|
|
17058
17173
|
value: function addBindings() {
|
|
17059
17174
|
var _this2 = this;
|
|
17060
17175
|
|
|
17061
|
-
var
|
|
17062
|
-
|
|
17063
|
-
if ((this.groupManager.table.options.groupContextMenu || this.groupManager.table.options.groupClickMenu) && this.groupManager.table.modExists("menu")) {
|
|
17064
|
-
this.groupManager.table.modules.menu.initializeGroup.call(this.groupManager.table.modules.menu, this);
|
|
17065
|
-
}
|
|
17176
|
+
var toggleElement;
|
|
17066
17177
|
|
|
17067
|
-
if (this.groupManager.table.options.
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
passive: true
|
|
17073
|
-
});
|
|
17074
|
-
this.element.addEventListener("touchend", function (e) {
|
|
17075
|
-
if (tap) {
|
|
17076
|
-
_this2.groupManager.table.options.groupTap(e, _this2.getComponent());
|
|
17077
|
-
}
|
|
17178
|
+
if (this.groupManager.table.options.groupToggleElement) {
|
|
17179
|
+
toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
|
|
17180
|
+
toggleElement.addEventListener("click", function (e) {
|
|
17181
|
+
e.stopPropagation();
|
|
17182
|
+
e.stopImmediatePropagation();
|
|
17078
17183
|
|
|
17079
|
-
|
|
17080
|
-
});
|
|
17081
|
-
}
|
|
17082
|
-
|
|
17083
|
-
if (this.groupManager.table.options.groupDblTap) {
|
|
17084
|
-
dblTap = null;
|
|
17085
|
-
this.element.addEventListener("touchend", function (e) {
|
|
17086
|
-
if (dblTap) {
|
|
17087
|
-
clearTimeout(dblTap);
|
|
17088
|
-
dblTap = null;
|
|
17089
|
-
|
|
17090
|
-
_this2.groupManager.table.options.groupDblTap(e, _this2.getComponent());
|
|
17091
|
-
} else {
|
|
17092
|
-
dblTap = setTimeout(function () {
|
|
17093
|
-
clearTimeout(dblTap);
|
|
17094
|
-
dblTap = null;
|
|
17095
|
-
}, 300);
|
|
17096
|
-
}
|
|
17097
|
-
});
|
|
17098
|
-
}
|
|
17099
|
-
|
|
17100
|
-
if (this.groupManager.table.options.groupTapHold) {
|
|
17101
|
-
tapHold = null;
|
|
17102
|
-
this.element.addEventListener("touchstart", function (e) {
|
|
17103
|
-
clearTimeout(tapHold);
|
|
17104
|
-
tapHold = setTimeout(function () {
|
|
17105
|
-
clearTimeout(tapHold);
|
|
17106
|
-
tapHold = null;
|
|
17107
|
-
tap = false;
|
|
17108
|
-
|
|
17109
|
-
_this2.groupManager.table.options.groupTapHold(e, _this2.getComponent());
|
|
17110
|
-
}, 1000);
|
|
17111
|
-
}, {
|
|
17112
|
-
passive: true
|
|
17113
|
-
});
|
|
17114
|
-
this.element.addEventListener("touchend", function (e) {
|
|
17115
|
-
clearTimeout(tapHold);
|
|
17116
|
-
tapHold = null;
|
|
17117
|
-
});
|
|
17118
|
-
}
|
|
17119
|
-
|
|
17120
|
-
if (this.groupManager.table.options.groupToggleElement) {
|
|
17121
|
-
toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
|
|
17122
|
-
toggleElement.addEventListener("click", function (e) {
|
|
17123
|
-
e.stopPropagation();
|
|
17124
|
-
e.stopImmediatePropagation();
|
|
17125
|
-
|
|
17126
|
-
_this2.toggleVisibility();
|
|
17184
|
+
_this2.toggleVisibility();
|
|
17127
17185
|
});
|
|
17128
17186
|
}
|
|
17129
17187
|
}
|
|
@@ -17717,13 +17775,12 @@
|
|
|
17717
17775
|
key: "initialize",
|
|
17718
17776
|
value: function initialize() {
|
|
17719
17777
|
if (this.table.options.groupBy) {
|
|
17720
|
-
this.configureGroupSetup();
|
|
17721
|
-
|
|
17722
17778
|
if (this.table.options.groupUpdateOnCellEdit) {
|
|
17723
17779
|
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
17724
17780
|
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
17725
17781
|
}
|
|
17726
17782
|
|
|
17783
|
+
this.subscribe("table-built", this.configureGroupSetup.bind(this));
|
|
17727
17784
|
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
17728
17785
|
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
17729
17786
|
this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
|
|
@@ -18675,6 +18732,279 @@
|
|
|
18675
18732
|
|
|
18676
18733
|
HtmlTableImport.moduleName = "htmlTableImport";
|
|
18677
18734
|
|
|
18735
|
+
function csvImporter(input) {
|
|
18736
|
+
var data = [],
|
|
18737
|
+
row = 0,
|
|
18738
|
+
col = 0,
|
|
18739
|
+
inQuote = false; //Iterate over each character
|
|
18740
|
+
|
|
18741
|
+
for (var index = 0; index < input.length; index++) {
|
|
18742
|
+
var _char = input[index],
|
|
18743
|
+
nextChar = input[index + 1]; //Initialize empty row
|
|
18744
|
+
|
|
18745
|
+
if (!data[row]) {
|
|
18746
|
+
data[row] = [];
|
|
18747
|
+
} //Initialize empty column
|
|
18748
|
+
|
|
18749
|
+
|
|
18750
|
+
if (!data[row][col]) {
|
|
18751
|
+
data[row][col] = "";
|
|
18752
|
+
} //Handle quotation mark inside string
|
|
18753
|
+
|
|
18754
|
+
|
|
18755
|
+
if (_char == '"' && inQuote && nextChar == '"') {
|
|
18756
|
+
data[row][col] += _char;
|
|
18757
|
+
index++;
|
|
18758
|
+
continue;
|
|
18759
|
+
} //Begin / End Quote
|
|
18760
|
+
|
|
18761
|
+
|
|
18762
|
+
if (_char == '"') {
|
|
18763
|
+
inQuote = !inQuote;
|
|
18764
|
+
continue;
|
|
18765
|
+
} //Next column (if not in quote)
|
|
18766
|
+
|
|
18767
|
+
|
|
18768
|
+
if (_char == ',' && !inQuote) {
|
|
18769
|
+
col++;
|
|
18770
|
+
continue;
|
|
18771
|
+
} //New row if new line and not in quote (CRLF)
|
|
18772
|
+
|
|
18773
|
+
|
|
18774
|
+
if (_char == '\r' && nextChar == '\n' && !inQuote) {
|
|
18775
|
+
col = 0;
|
|
18776
|
+
row++;
|
|
18777
|
+
index++;
|
|
18778
|
+
continue;
|
|
18779
|
+
} //New row if new line and not in quote (CR or LF)
|
|
18780
|
+
|
|
18781
|
+
|
|
18782
|
+
if ((_char == '\r' || _char == '\n') && !inQuote) {
|
|
18783
|
+
col = 0;
|
|
18784
|
+
row++;
|
|
18785
|
+
continue;
|
|
18786
|
+
} //Normal Character, append to column
|
|
18787
|
+
|
|
18788
|
+
|
|
18789
|
+
data[row][col] += _char;
|
|
18790
|
+
}
|
|
18791
|
+
|
|
18792
|
+
return data;
|
|
18793
|
+
}
|
|
18794
|
+
|
|
18795
|
+
function json$1 (input) {
|
|
18796
|
+
try {
|
|
18797
|
+
return JSON.parse(input);
|
|
18798
|
+
} catch (e) {
|
|
18799
|
+
console.warn("JSON Import Error - File contents is invalid JSON", e);
|
|
18800
|
+
return Promise.reject();
|
|
18801
|
+
}
|
|
18802
|
+
}
|
|
18803
|
+
|
|
18804
|
+
var defaultImporters = {
|
|
18805
|
+
csv: csvImporter,
|
|
18806
|
+
json: json$1
|
|
18807
|
+
};
|
|
18808
|
+
|
|
18809
|
+
var Import = /*#__PURE__*/function (_Module) {
|
|
18810
|
+
_inherits(Import, _Module);
|
|
18811
|
+
|
|
18812
|
+
var _super = _createSuper(Import);
|
|
18813
|
+
|
|
18814
|
+
function Import(table) {
|
|
18815
|
+
var _this;
|
|
18816
|
+
|
|
18817
|
+
_classCallCheck(this, Import);
|
|
18818
|
+
|
|
18819
|
+
_this = _super.call(this, table);
|
|
18820
|
+
|
|
18821
|
+
_this.registerTableOption("importFormat");
|
|
18822
|
+
|
|
18823
|
+
_this.registerTableOption("importReader", "text");
|
|
18824
|
+
|
|
18825
|
+
return _this;
|
|
18826
|
+
}
|
|
18827
|
+
|
|
18828
|
+
_createClass(Import, [{
|
|
18829
|
+
key: "initialize",
|
|
18830
|
+
value: function initialize() {
|
|
18831
|
+
this.registerTableFunction("import", this.importFromFile.bind(this));
|
|
18832
|
+
|
|
18833
|
+
if (this.table.options.importFormat) {
|
|
18834
|
+
this.subscribe("data-loading", this.loadDataCheck.bind(this), 10);
|
|
18835
|
+
this.subscribe("data-load", this.loadData.bind(this), 10);
|
|
18836
|
+
}
|
|
18837
|
+
}
|
|
18838
|
+
}, {
|
|
18839
|
+
key: "loadDataCheck",
|
|
18840
|
+
value: function loadDataCheck(data) {
|
|
18841
|
+
return typeof data === "string";
|
|
18842
|
+
}
|
|
18843
|
+
}, {
|
|
18844
|
+
key: "loadData",
|
|
18845
|
+
value: function loadData(data, params, config, silent, previousData) {
|
|
18846
|
+
return this.importData(this.lookupImporter(), data).then(this.structureData.bind(this))["catch"](function (err) {
|
|
18847
|
+
console.error("Import Error:", err || "Unable to import data");
|
|
18848
|
+
return Promise.reject(err);
|
|
18849
|
+
});
|
|
18850
|
+
}
|
|
18851
|
+
}, {
|
|
18852
|
+
key: "lookupImporter",
|
|
18853
|
+
value: function lookupImporter(importFormat) {
|
|
18854
|
+
var importer;
|
|
18855
|
+
|
|
18856
|
+
if (!importFormat) {
|
|
18857
|
+
importFormat = this.table.options.importFormat;
|
|
18858
|
+
}
|
|
18859
|
+
|
|
18860
|
+
if (typeof importFormat === "string") {
|
|
18861
|
+
importer = Import.importers[importFormat];
|
|
18862
|
+
} else {
|
|
18863
|
+
importer = importFormat;
|
|
18864
|
+
}
|
|
18865
|
+
|
|
18866
|
+
if (!importer) {
|
|
18867
|
+
console.error("Import Error - Importer not found:", importFormat);
|
|
18868
|
+
}
|
|
18869
|
+
|
|
18870
|
+
return importer;
|
|
18871
|
+
}
|
|
18872
|
+
}, {
|
|
18873
|
+
key: "importFromFile",
|
|
18874
|
+
value: function importFromFile(importFormat, extension) {
|
|
18875
|
+
var importer = this.lookupImporter(importFormat);
|
|
18876
|
+
|
|
18877
|
+
if (importer) {
|
|
18878
|
+
return this.pickFile(extension).then(this.importData.bind(this, importer)).then(this.structureData.bind(this)).then(this.setData.bind(this))["catch"](function (err) {
|
|
18879
|
+
console.error("Import Error:", err || "Unable to import file");
|
|
18880
|
+
return Promise.reject(err);
|
|
18881
|
+
});
|
|
18882
|
+
}
|
|
18883
|
+
}
|
|
18884
|
+
}, {
|
|
18885
|
+
key: "pickFile",
|
|
18886
|
+
value: function pickFile(extensions) {
|
|
18887
|
+
var _this2 = this;
|
|
18888
|
+
|
|
18889
|
+
return new Promise(function (resolve, reject) {
|
|
18890
|
+
var input = document.createElement("input");
|
|
18891
|
+
input.type = "file";
|
|
18892
|
+
input.accept = extensions;
|
|
18893
|
+
input.addEventListener("change", function (e) {
|
|
18894
|
+
var file = input.files[0],
|
|
18895
|
+
reader = new FileReader();
|
|
18896
|
+
|
|
18897
|
+
switch (_this2.table.options.importReader) {
|
|
18898
|
+
case "buffer":
|
|
18899
|
+
reader.readAsArrayBuffer(file);
|
|
18900
|
+
break;
|
|
18901
|
+
|
|
18902
|
+
case "binary":
|
|
18903
|
+
reader.readAsBinaryString(file);
|
|
18904
|
+
break;
|
|
18905
|
+
|
|
18906
|
+
case "url":
|
|
18907
|
+
reader.readAsDataURL(file);
|
|
18908
|
+
break;
|
|
18909
|
+
|
|
18910
|
+
case "text":
|
|
18911
|
+
default:
|
|
18912
|
+
reader.readAsText(file);
|
|
18913
|
+
}
|
|
18914
|
+
|
|
18915
|
+
reader.onload = function (e) {
|
|
18916
|
+
resolve(reader.result);
|
|
18917
|
+
};
|
|
18918
|
+
|
|
18919
|
+
reader.onerror = function (e) {
|
|
18920
|
+
console.warn("File Load Error - Unable to read file");
|
|
18921
|
+
reject();
|
|
18922
|
+
};
|
|
18923
|
+
});
|
|
18924
|
+
input.click();
|
|
18925
|
+
});
|
|
18926
|
+
}
|
|
18927
|
+
}, {
|
|
18928
|
+
key: "importData",
|
|
18929
|
+
value: function importData(importer, fileContents) {
|
|
18930
|
+
var data = importer.call(this.table, fileContents);
|
|
18931
|
+
|
|
18932
|
+
if (data instanceof Promise) {
|
|
18933
|
+
return data;
|
|
18934
|
+
} else {
|
|
18935
|
+
return data ? Promise.resolve(data) : Promise.reject();
|
|
18936
|
+
}
|
|
18937
|
+
}
|
|
18938
|
+
}, {
|
|
18939
|
+
key: "structureData",
|
|
18940
|
+
value: function structureData(parsedData) {
|
|
18941
|
+
var data = [];
|
|
18942
|
+
|
|
18943
|
+
if (Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])) {
|
|
18944
|
+
if (this.table.options.autoColumns) {
|
|
18945
|
+
data = this.structureArrayToObject(parsedData);
|
|
18946
|
+
} else {
|
|
18947
|
+
data = this.structureArrayToColumns(parsedData);
|
|
18948
|
+
}
|
|
18949
|
+
|
|
18950
|
+
return data;
|
|
18951
|
+
} else {
|
|
18952
|
+
return parsedData;
|
|
18953
|
+
}
|
|
18954
|
+
}
|
|
18955
|
+
}, {
|
|
18956
|
+
key: "structureArrayToObject",
|
|
18957
|
+
value: function structureArrayToObject(parsedData) {
|
|
18958
|
+
var columns = parsedData.shift();
|
|
18959
|
+
var data = parsedData.map(function (values) {
|
|
18960
|
+
var row = {};
|
|
18961
|
+
columns.forEach(function (key, i) {
|
|
18962
|
+
row[key] = values[i];
|
|
18963
|
+
});
|
|
18964
|
+
return row;
|
|
18965
|
+
});
|
|
18966
|
+
return data;
|
|
18967
|
+
}
|
|
18968
|
+
}, {
|
|
18969
|
+
key: "structureArrayToColumns",
|
|
18970
|
+
value: function structureArrayToColumns(parsedData) {
|
|
18971
|
+
var data = [],
|
|
18972
|
+
columns = this.table.getColumns(); //remove first row if it is the column names
|
|
18973
|
+
|
|
18974
|
+
if (columns[0] && parsedData[0][0]) {
|
|
18975
|
+
if (columns[0].getDefinition().title === parsedData[0][0]) {
|
|
18976
|
+
parsedData.shift();
|
|
18977
|
+
}
|
|
18978
|
+
} //convert row arrays to objects
|
|
18979
|
+
|
|
18980
|
+
|
|
18981
|
+
parsedData.forEach(function (rowData) {
|
|
18982
|
+
var row = {};
|
|
18983
|
+
rowData.forEach(function (value, index) {
|
|
18984
|
+
var column = columns[index];
|
|
18985
|
+
|
|
18986
|
+
if (column) {
|
|
18987
|
+
row[column.getField()] = value;
|
|
18988
|
+
}
|
|
18989
|
+
});
|
|
18990
|
+
data.push(row);
|
|
18991
|
+
});
|
|
18992
|
+
return data;
|
|
18993
|
+
}
|
|
18994
|
+
}, {
|
|
18995
|
+
key: "setData",
|
|
18996
|
+
value: function setData(data) {
|
|
18997
|
+
return this.table.setData(data);
|
|
18998
|
+
}
|
|
18999
|
+
}]);
|
|
19000
|
+
|
|
19001
|
+
return Import;
|
|
19002
|
+
}(Module);
|
|
19003
|
+
|
|
19004
|
+
Import.moduleName = "import"; //load defaults
|
|
19005
|
+
|
|
19006
|
+
Import.importers = defaultImporters;
|
|
19007
|
+
|
|
18678
19008
|
var Interaction = /*#__PURE__*/function (_Module) {
|
|
18679
19009
|
_inherits(Interaction, _Module);
|
|
18680
19010
|
|
|
@@ -18754,6 +19084,11 @@
|
|
|
18754
19084
|
tap: null,
|
|
18755
19085
|
tapDbl: null,
|
|
18756
19086
|
tapHold: null
|
|
19087
|
+
},
|
|
19088
|
+
group: {
|
|
19089
|
+
tap: null,
|
|
19090
|
+
tapDbl: null,
|
|
19091
|
+
tapHold: null
|
|
18757
19092
|
}
|
|
18758
19093
|
};
|
|
18759
19094
|
|
|
@@ -18985,7 +19320,7 @@
|
|
|
18985
19320
|
if (this.columnSubscribers[action]) {
|
|
18986
19321
|
if (component instanceof Cell) {
|
|
18987
19322
|
callback = component.column.definition[action];
|
|
18988
|
-
} else if (component instanceof Column
|
|
19323
|
+
} else if (component instanceof Column) {
|
|
18989
19324
|
callback = component.definition[action];
|
|
18990
19325
|
}
|
|
18991
19326
|
|
|
@@ -19012,9 +19347,9 @@
|
|
|
19012
19347
|
scrollPageDown: 34,
|
|
19013
19348
|
scrollToStart: 36,
|
|
19014
19349
|
scrollToEnd: 35,
|
|
19015
|
-
undo: "ctrl + 90",
|
|
19016
|
-
redo: "ctrl + 89",
|
|
19017
|
-
copyToClipboard: "ctrl + 67"
|
|
19350
|
+
undo: ["ctrl + 90", "meta + 90"],
|
|
19351
|
+
redo: ["ctrl + 89", "meta + 89"],
|
|
19352
|
+
copyToClipboard: ["ctrl + 67", "meta + 89"]
|
|
19018
19353
|
};
|
|
19019
19354
|
|
|
19020
19355
|
var defaultActions = {
|
|
@@ -19141,7 +19476,7 @@
|
|
|
19141
19476
|
_this.keyupBinding = false;
|
|
19142
19477
|
_this.keydownBinding = false;
|
|
19143
19478
|
|
|
19144
|
-
_this.registerTableOption("keybindings",
|
|
19479
|
+
_this.registerTableOption("keybindings", {}); //array for keybindings
|
|
19145
19480
|
|
|
19146
19481
|
|
|
19147
19482
|
_this.registerTableOption("tabEndNewRow", false); //create new row when tab to end of table
|
|
@@ -19159,16 +19494,8 @@
|
|
|
19159
19494
|
this.pressedKeys = [];
|
|
19160
19495
|
|
|
19161
19496
|
if (bindings !== false) {
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
}
|
|
19165
|
-
|
|
19166
|
-
if (Object.keys(bindings).length) {
|
|
19167
|
-
for (var _key in bindings) {
|
|
19168
|
-
mergedBindings[_key] = bindings[_key];
|
|
19169
|
-
}
|
|
19170
|
-
}
|
|
19171
|
-
|
|
19497
|
+
Object.assign(mergedBindings, Keybindings.bindings);
|
|
19498
|
+
Object.assign(mergedBindings, bindings);
|
|
19172
19499
|
this.mapBindings(mergedBindings);
|
|
19173
19500
|
this.bindEvents();
|
|
19174
19501
|
}
|
|
@@ -19188,7 +19515,10 @@
|
|
|
19188
19515
|
}
|
|
19189
19516
|
|
|
19190
19517
|
bindings[key].forEach(function (binding) {
|
|
19191
|
-
|
|
19518
|
+
var bindingList = Array.isArray(binding) ? binding : [binding];
|
|
19519
|
+
bindingList.forEach(function (item) {
|
|
19520
|
+
_this2.mapBinding(key, item);
|
|
19521
|
+
});
|
|
19192
19522
|
});
|
|
19193
19523
|
}
|
|
19194
19524
|
} else {
|
|
@@ -19228,7 +19558,7 @@
|
|
|
19228
19558
|
break;
|
|
19229
19559
|
|
|
19230
19560
|
default:
|
|
19231
|
-
symbol = parseInt(symbol);
|
|
19561
|
+
symbol = isNaN(symbol) ? symbol.toUpperCase().charCodeAt(0) : parseInt(symbol);
|
|
19232
19562
|
binding.keys.push(symbol);
|
|
19233
19563
|
|
|
19234
19564
|
if (!_this3.watchKeys[symbol]) {
|
|
@@ -19330,11 +19660,14 @@
|
|
|
19330
19660
|
_classCallCheck(this, Menu);
|
|
19331
19661
|
|
|
19332
19662
|
_this = _super.call(this, table);
|
|
19663
|
+
_this.menuContainer = null;
|
|
19333
19664
|
_this.menuElements = [];
|
|
19334
19665
|
_this.blurEvent = _this.hideMenu.bind(_assertThisInitialized(_this));
|
|
19335
19666
|
_this.escEvent = _this.escMenu.bind(_assertThisInitialized(_this));
|
|
19336
19667
|
_this.nestedMenuBlock = false;
|
|
19337
19668
|
_this.positionReversedX = false;
|
|
19669
|
+
_this.currentComponent = null;
|
|
19670
|
+
_this.columnSubscribers = {};
|
|
19338
19671
|
|
|
19339
19672
|
_this.registerTableOption("rowContextMenu", false);
|
|
19340
19673
|
|
|
@@ -19344,8 +19677,12 @@
|
|
|
19344
19677
|
|
|
19345
19678
|
_this.registerTableOption("groupClickMenu", false);
|
|
19346
19679
|
|
|
19680
|
+
_this.registerTableOption("menuContainer", false);
|
|
19681
|
+
|
|
19347
19682
|
_this.registerColumnOption("headerContextMenu");
|
|
19348
19683
|
|
|
19684
|
+
_this.registerColumnOption("headerClickMenu");
|
|
19685
|
+
|
|
19349
19686
|
_this.registerColumnOption("headerMenu");
|
|
19350
19687
|
|
|
19351
19688
|
_this.registerColumnOption("contextMenu");
|
|
@@ -19358,133 +19695,157 @@
|
|
|
19358
19695
|
_createClass(Menu, [{
|
|
19359
19696
|
key: "initialize",
|
|
19360
19697
|
value: function initialize() {
|
|
19361
|
-
this.
|
|
19698
|
+
this.lookupMenuContainer();
|
|
19699
|
+
this.initializeRowWatchers();
|
|
19700
|
+
this.initializeGroupWatchers();
|
|
19362
19701
|
this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
19363
|
-
this.subscribe("row-init", this.initializeRow.bind(this));
|
|
19364
19702
|
}
|
|
19365
19703
|
}, {
|
|
19366
|
-
key: "
|
|
19367
|
-
value: function
|
|
19368
|
-
|
|
19369
|
-
|
|
19704
|
+
key: "lookupMenuContainer",
|
|
19705
|
+
value: function lookupMenuContainer() {
|
|
19706
|
+
this.menuContainer = this.table.options.menuContainer;
|
|
19707
|
+
|
|
19708
|
+
if (typeof this.menuContainer === "string") {
|
|
19709
|
+
this.menuContainer = document.querySelector(this.menuContainer);
|
|
19710
|
+
|
|
19711
|
+
if (!this.menuContainer) {
|
|
19712
|
+
console.warn("Menu Error - no container element found matching selector:", this.table.options.menuContainer, "(defaulting to document body)");
|
|
19713
|
+
}
|
|
19714
|
+
} else if (this.menuContainer === true) {
|
|
19715
|
+
this.menuContainer = this.table.element;
|
|
19716
|
+
}
|
|
19717
|
+
|
|
19718
|
+
if (this.menuContainer && !this.checkMenuContainerIsParent(this.menuContainer)) {
|
|
19719
|
+
this.menuContainer = false;
|
|
19720
|
+
console.warn("Menu Error - container element does not contain this table:", this.table.options.menuContainer, "(defaulting to document body)");
|
|
19721
|
+
}
|
|
19722
|
+
|
|
19723
|
+
if (!this.menuContainer) {
|
|
19724
|
+
this.menuContainer = document.body;
|
|
19370
19725
|
}
|
|
19371
19726
|
}
|
|
19372
19727
|
}, {
|
|
19373
|
-
key: "
|
|
19374
|
-
value: function
|
|
19375
|
-
var
|
|
19728
|
+
key: "checkMenuContainerIsParent",
|
|
19729
|
+
value: function checkMenuContainerIsParent(container) {
|
|
19730
|
+
var element = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.table.element;
|
|
19376
19731
|
|
|
19377
|
-
if (
|
|
19378
|
-
|
|
19732
|
+
if (container === element) {
|
|
19733
|
+
return true;
|
|
19734
|
+
} else {
|
|
19735
|
+
return element.parentNode ? this.checkMenuContainerIsParent(container, element.parentNode) : false;
|
|
19379
19736
|
}
|
|
19380
19737
|
}
|
|
19381
19738
|
}, {
|
|
19382
|
-
key: "
|
|
19383
|
-
value: function
|
|
19384
|
-
|
|
19739
|
+
key: "initializeRowWatchers",
|
|
19740
|
+
value: function initializeRowWatchers() {
|
|
19741
|
+
if (this.table.options.rowContextMenu) {
|
|
19742
|
+
this.subscribe("row-contextmenu", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
|
|
19743
|
+
this.table.on("rowTapHold", this.loadMenuEvent.bind(this, this.table.options.rowContextMenu));
|
|
19744
|
+
}
|
|
19385
19745
|
|
|
19386
|
-
|
|
19746
|
+
if (this.table.options.rowClickMenu) {
|
|
19747
|
+
this.subscribe("row-click", this.loadMenuEvent.bind(this, this.table.options.rowClickMenu));
|
|
19748
|
+
}
|
|
19749
|
+
}
|
|
19750
|
+
}, {
|
|
19751
|
+
key: "initializeGroupWatchers",
|
|
19752
|
+
value: function initializeGroupWatchers() {
|
|
19753
|
+
if (this.table.options.groupContextMenu) {
|
|
19754
|
+
this.subscribe("group-contextmenu", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
|
|
19755
|
+
this.table.on("groupTapHold", this.loadMenuEvent.bind(this, this.table.options.groupContextMenu));
|
|
19756
|
+
}
|
|
19387
19757
|
|
|
19388
|
-
if (
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
|
|
19393
|
-
|
|
19758
|
+
if (this.table.options.groupClickMenu) {
|
|
19759
|
+
this.subscribe("group-click", this.loadMenuEvent.bind(this, this.table.options.groupClickMenu));
|
|
19760
|
+
}
|
|
19761
|
+
}
|
|
19762
|
+
}, {
|
|
19763
|
+
key: "initializeColumn",
|
|
19764
|
+
value: function initializeColumn(column) {
|
|
19765
|
+
var def = column.definition; //handle column events
|
|
19394
19766
|
|
|
19767
|
+
if (def.headerContextMenu && !this.columnSubscribers.headerContextMenu) {
|
|
19768
|
+
this.columnSubscribers.headerContextMenu = this.loadMenuTableColumnEvent.bind(this, "headerContextMenu");
|
|
19769
|
+
this.subscribe("column-contextmenu", this.columnSubscribers.headerContextMenu);
|
|
19770
|
+
this.table.on("headerTapHold", this.loadMenuTableColumnEvent.bind(this, "headerContextMenu"));
|
|
19771
|
+
}
|
|
19395
19772
|
|
|
19396
|
-
if (
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
headerMenuEl.addEventListener("click", function (e) {
|
|
19401
|
-
e.stopPropagation();
|
|
19402
|
-
e.preventDefault();
|
|
19773
|
+
if (def.headerClickMenu && !this.columnSubscribers.headerClickMenu) {
|
|
19774
|
+
this.columnSubscribers.headerClickMenu = this.loadMenuTableColumnEvent.bind(this, "headerClickMenu");
|
|
19775
|
+
this.subscribe("column-click", this.columnSubscribers.headerClickMenu);
|
|
19776
|
+
}
|
|
19403
19777
|
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19778
|
+
if (def.headerMenu) {
|
|
19779
|
+
this.initializeColumnHeaderMenu(column);
|
|
19780
|
+
} //handle cell events
|
|
19781
|
+
|
|
19782
|
+
|
|
19783
|
+
if (def.contextMenu && !this.columnSubscribers.contextMenu) {
|
|
19784
|
+
this.columnSubscribers.contextMenu = this.loadMenuTableCellEvent.bind(this, "contextMenu");
|
|
19785
|
+
this.subscribe("cell-contextmenu", this.columnSubscribers.contextMenu);
|
|
19786
|
+
this.table.on("cellTapHold", this.loadMenuTableCellEvent.bind(this, "contextMenu"));
|
|
19407
19787
|
}
|
|
19408
|
-
}
|
|
19409
|
-
}, {
|
|
19410
|
-
key: "LoadMenuEvent",
|
|
19411
|
-
value: function LoadMenuEvent(component, menu, e) {
|
|
19412
|
-
menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu; // if(component instanceof Cell){
|
|
19413
|
-
// e.stopImmediatePropagation();
|
|
19414
|
-
// }
|
|
19415
19788
|
|
|
19416
|
-
|
|
19789
|
+
if (def.clickMenu && !this.columnSubscribers.clickMenu) {
|
|
19790
|
+
this.columnSubscribers.clickMenu = this.loadMenuTableCellEvent.bind(this, "clickMenu");
|
|
19791
|
+
this.subscribe("cell-click", this.columnSubscribers.clickMenu);
|
|
19792
|
+
}
|
|
19417
19793
|
}
|
|
19418
19794
|
}, {
|
|
19419
|
-
key: "
|
|
19420
|
-
value: function
|
|
19421
|
-
var
|
|
19422
|
-
|
|
19423
|
-
var element = component.getElement(),
|
|
19424
|
-
tapHold = null,
|
|
19425
|
-
loaded = false;
|
|
19426
|
-
element.addEventListener("touchstart", function (e) {
|
|
19427
|
-
clearTimeout(tapHold);
|
|
19428
|
-
loaded = false;
|
|
19429
|
-
tapHold = setTimeout(function () {
|
|
19430
|
-
clearTimeout(tapHold);
|
|
19431
|
-
tapHold = null;
|
|
19432
|
-
loaded = true;
|
|
19795
|
+
key: "initializeColumnHeaderMenu",
|
|
19796
|
+
value: function initializeColumnHeaderMenu(column) {
|
|
19797
|
+
var _this2 = this;
|
|
19433
19798
|
|
|
19434
|
-
|
|
19435
|
-
|
|
19436
|
-
|
|
19437
|
-
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
|
|
19441
|
-
tapHold = null;
|
|
19799
|
+
var headerMenuEl;
|
|
19800
|
+
headerMenuEl = document.createElement("span");
|
|
19801
|
+
headerMenuEl.classList.add("tabulator-header-menu-button");
|
|
19802
|
+
headerMenuEl.innerHTML = "⋮";
|
|
19803
|
+
headerMenuEl.addEventListener("click", function (e) {
|
|
19804
|
+
e.stopPropagation();
|
|
19805
|
+
e.preventDefault();
|
|
19442
19806
|
|
|
19443
|
-
|
|
19444
|
-
e.preventDefault();
|
|
19445
|
-
}
|
|
19807
|
+
_this2.loadMenuEvent(column.definition.headerMenu, e, column);
|
|
19446
19808
|
});
|
|
19809
|
+
column.titleElement.insertBefore(headerMenuEl, column.titleElement.firstChild);
|
|
19447
19810
|
}
|
|
19448
19811
|
}, {
|
|
19449
|
-
key: "
|
|
19450
|
-
value: function
|
|
19451
|
-
if (cell.
|
|
19452
|
-
cell
|
|
19453
|
-
this.tapHold(cell, cell.column.definition.contextMenu);
|
|
19812
|
+
key: "loadMenuTableCellEvent",
|
|
19813
|
+
value: function loadMenuTableCellEvent(option, e, cell) {
|
|
19814
|
+
if (cell._cell) {
|
|
19815
|
+
cell = cell._cell;
|
|
19454
19816
|
}
|
|
19455
19817
|
|
|
19456
|
-
if (cell.column.definition
|
|
19457
|
-
|
|
19818
|
+
if (cell.column.definition[option]) {
|
|
19819
|
+
this.loadMenuEvent(cell.column.definition[option], e, cell);
|
|
19458
19820
|
}
|
|
19459
19821
|
}
|
|
19460
19822
|
}, {
|
|
19461
|
-
key: "
|
|
19462
|
-
value: function
|
|
19463
|
-
if (
|
|
19464
|
-
|
|
19465
|
-
this.tapHold(row, this.table.options.rowContextMenu);
|
|
19823
|
+
key: "loadMenuTableColumnEvent",
|
|
19824
|
+
value: function loadMenuTableColumnEvent(option, e, column) {
|
|
19825
|
+
if (column._column) {
|
|
19826
|
+
column = column._column;
|
|
19466
19827
|
}
|
|
19467
19828
|
|
|
19468
|
-
if (
|
|
19469
|
-
|
|
19829
|
+
if (column.definition[option]) {
|
|
19830
|
+
this.loadMenuEvent(column.definition[option], e, column);
|
|
19470
19831
|
}
|
|
19471
19832
|
}
|
|
19472
19833
|
}, {
|
|
19473
|
-
key: "
|
|
19474
|
-
value: function
|
|
19475
|
-
if (
|
|
19476
|
-
|
|
19477
|
-
|
|
19834
|
+
key: "loadMenuEvent",
|
|
19835
|
+
value: function loadMenuEvent(menu, e, component) {
|
|
19836
|
+
if (component._group) {
|
|
19837
|
+
component = component._group;
|
|
19838
|
+
} else if (component._row) {
|
|
19839
|
+
component = component._row;
|
|
19478
19840
|
}
|
|
19479
19841
|
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
}
|
|
19842
|
+
menu = typeof menu == "function" ? menu.call(this.table, component.getComponent(), e) : menu;
|
|
19843
|
+
this.loadMenu(e, component, menu);
|
|
19483
19844
|
}
|
|
19484
19845
|
}, {
|
|
19485
19846
|
key: "loadMenu",
|
|
19486
19847
|
value: function loadMenu(e, component, menu, parentEl) {
|
|
19487
|
-
var
|
|
19848
|
+
var _this3 = this;
|
|
19488
19849
|
|
|
19489
19850
|
var touch = !(e instanceof MouseEvent);
|
|
19490
19851
|
var menuEl = document.createElement("div");
|
|
@@ -19507,7 +19868,7 @@
|
|
|
19507
19868
|
}
|
|
19508
19869
|
} else {
|
|
19509
19870
|
this.nestedMenuBlock = setTimeout(function () {
|
|
19510
|
-
|
|
19871
|
+
_this3.nestedMenuBlock = false;
|
|
19511
19872
|
}, 100);
|
|
19512
19873
|
}
|
|
19513
19874
|
|
|
@@ -19526,7 +19887,7 @@
|
|
|
19526
19887
|
itemEl.classList.add("tabulator-menu-item");
|
|
19527
19888
|
|
|
19528
19889
|
if (typeof label == "function") {
|
|
19529
|
-
label = label.call(
|
|
19890
|
+
label = label.call(_this3.table, component.getComponent());
|
|
19530
19891
|
}
|
|
19531
19892
|
|
|
19532
19893
|
if (label instanceof Node) {
|
|
@@ -19536,7 +19897,7 @@
|
|
|
19536
19897
|
}
|
|
19537
19898
|
|
|
19538
19899
|
if (typeof disabled == "function") {
|
|
19539
|
-
disabled = disabled.call(
|
|
19900
|
+
disabled = disabled.call(_this3.table, component.getComponent());
|
|
19540
19901
|
}
|
|
19541
19902
|
|
|
19542
19903
|
if (disabled) {
|
|
@@ -19549,9 +19910,9 @@
|
|
|
19549
19910
|
itemEl.addEventListener("click", function (e) {
|
|
19550
19911
|
e.stopPropagation();
|
|
19551
19912
|
|
|
19552
|
-
|
|
19913
|
+
_this3.hideOldSubMenus(menuEl);
|
|
19553
19914
|
|
|
19554
|
-
|
|
19915
|
+
_this3.loadMenu(e, component, item.menu, itemEl);
|
|
19555
19916
|
});
|
|
19556
19917
|
} else {
|
|
19557
19918
|
if (item.action) {
|
|
@@ -19570,10 +19931,12 @@
|
|
|
19570
19931
|
menuEl.appendChild(itemEl);
|
|
19571
19932
|
});
|
|
19572
19933
|
menuEl.addEventListener("click", function (e) {
|
|
19573
|
-
|
|
19934
|
+
_this3.hideMenu();
|
|
19574
19935
|
});
|
|
19575
19936
|
this.menuElements.push(menuEl);
|
|
19576
19937
|
this.positionMenu(menuEl, parentEl, touch, e);
|
|
19938
|
+
this.currentComponent = component;
|
|
19939
|
+
this.dispatchExternal("menuOpened", component.getComponent());
|
|
19577
19940
|
}
|
|
19578
19941
|
}, {
|
|
19579
19942
|
key: "hideOldSubMenus",
|
|
@@ -19595,16 +19958,20 @@
|
|
|
19595
19958
|
}, {
|
|
19596
19959
|
key: "positionMenu",
|
|
19597
19960
|
value: function positionMenu(element, parentEl, touch, e) {
|
|
19598
|
-
var
|
|
19961
|
+
var _this4 = this;
|
|
19599
19962
|
|
|
19600
|
-
var
|
|
19601
|
-
x,
|
|
19602
|
-
y,
|
|
19603
|
-
parentOffset;
|
|
19963
|
+
var x, y, parentOffset;
|
|
19604
19964
|
|
|
19605
19965
|
if (!parentEl) {
|
|
19606
19966
|
x = touch ? e.touches[0].pageX : e.pageX;
|
|
19607
19967
|
y = touch ? e.touches[0].pageY : e.pageY;
|
|
19968
|
+
|
|
19969
|
+
if (this.menuContainer !== document.body) {
|
|
19970
|
+
parentOffset = Helpers.elOffset(this.menuContainer);
|
|
19971
|
+
x -= parentOffset.left;
|
|
19972
|
+
y -= parentOffset.top;
|
|
19973
|
+
}
|
|
19974
|
+
|
|
19608
19975
|
this.positionReversedX = false;
|
|
19609
19976
|
} else {
|
|
19610
19977
|
parentOffset = Helpers.elOffset(parentEl);
|
|
@@ -19615,36 +19982,36 @@
|
|
|
19615
19982
|
element.style.top = y + "px";
|
|
19616
19983
|
element.style.left = x + "px";
|
|
19617
19984
|
setTimeout(function () {
|
|
19618
|
-
|
|
19985
|
+
_this4.table.rowManager.element.addEventListener("scroll", _this4.blurEvent);
|
|
19619
19986
|
|
|
19620
|
-
document.body.addEventListener("click",
|
|
19621
|
-
document.body.addEventListener("contextmenu",
|
|
19622
|
-
window.addEventListener("resize",
|
|
19623
|
-
document.body.addEventListener("keydown",
|
|
19987
|
+
document.body.addEventListener("click", _this4.blurEvent);
|
|
19988
|
+
document.body.addEventListener("contextmenu", _this4.blurEvent);
|
|
19989
|
+
window.addEventListener("resize", _this4.blurEvent);
|
|
19990
|
+
document.body.addEventListener("keydown", _this4.escEvent);
|
|
19624
19991
|
}, 100);
|
|
19625
|
-
|
|
19992
|
+
this.menuContainer.appendChild(element); //move menu to start on right edge if it is too close to the edge of the screen
|
|
19626
19993
|
|
|
19627
|
-
if (
|
|
19628
|
-
element.style.
|
|
19994
|
+
if (x + element.offsetWidth >= this.menuContainer.offsetWidth || this.positionReversedX) {
|
|
19995
|
+
element.style.left = "";
|
|
19629
19996
|
|
|
19630
19997
|
if (parentEl) {
|
|
19631
|
-
element.style.
|
|
19998
|
+
element.style.right = this.menuContainer.offsetWidth - parentOffset.left + "px";
|
|
19632
19999
|
} else {
|
|
19633
|
-
element.style.
|
|
20000
|
+
element.style.right = this.menuContainer.offsetWidth - x + "px";
|
|
19634
20001
|
}
|
|
19635
|
-
} //move menu to start on right edge if it is too close to the edge of the screen
|
|
19636
20002
|
|
|
20003
|
+
this.positionReversedX = true;
|
|
20004
|
+
} //move menu to start on bottom edge if it is too close to the edge of the screen
|
|
19637
20005
|
|
|
19638
|
-
|
|
19639
|
-
|
|
20006
|
+
|
|
20007
|
+
if (y + element.offsetHeight >= this.menuContainer.offsetHeight) {
|
|
20008
|
+
element.style.top = "";
|
|
19640
20009
|
|
|
19641
20010
|
if (parentEl) {
|
|
19642
|
-
element.style.
|
|
20011
|
+
element.style.bottom = this.menuContainer.offsetHeight - parentOffset.top - parentEl.offsetHeight - 1 + "px";
|
|
19643
20012
|
} else {
|
|
19644
|
-
element.style.
|
|
20013
|
+
element.style.bottom = this.menuContainer.offsetHeight - y + "px";
|
|
19645
20014
|
}
|
|
19646
|
-
|
|
19647
|
-
this.positionReversedX = true;
|
|
19648
20015
|
}
|
|
19649
20016
|
}
|
|
19650
20017
|
}, {
|
|
@@ -19672,6 +20039,11 @@
|
|
|
19672
20039
|
document.body.removeEventListener("contextmenu", this.blurEvent);
|
|
19673
20040
|
window.removeEventListener("resize", this.blurEvent);
|
|
19674
20041
|
this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
|
|
20042
|
+
|
|
20043
|
+
if (this.currentComponent) {
|
|
20044
|
+
this.dispatchExternal("menuClosed", this.currentComponent.getComponent());
|
|
20045
|
+
this.currentComponent = null;
|
|
20046
|
+
}
|
|
19675
20047
|
}
|
|
19676
20048
|
}]);
|
|
19677
20049
|
|
|
@@ -20347,6 +20719,7 @@
|
|
|
20347
20719
|
|
|
20348
20720
|
document.body.addEventListener("mousemove", this.moveHover);
|
|
20349
20721
|
document.body.addEventListener("mouseup", this.endMove);
|
|
20722
|
+
this.dispatchExternal("rowMoving", row.getComponent());
|
|
20350
20723
|
this.moveHover(e);
|
|
20351
20724
|
}
|
|
20352
20725
|
}, {
|
|
@@ -20382,6 +20755,8 @@
|
|
|
20382
20755
|
|
|
20383
20756
|
if (this.toRow) {
|
|
20384
20757
|
this.table.rowManager.moveRow(this.moving, this.toRow, this.toRowAfter);
|
|
20758
|
+
} else {
|
|
20759
|
+
this.dispatchExternal("rowMoveCancelled", this.moving.getComponent());
|
|
20385
20760
|
}
|
|
20386
20761
|
|
|
20387
20762
|
this.moving = false;
|
|
@@ -20813,6 +21188,63 @@
|
|
|
20813
21188
|
|
|
20814
21189
|
Mutator.mutators = defaultMutators;
|
|
20815
21190
|
|
|
21191
|
+
function rows (pageSize, currentRow, currentPage, totalRows, totalPages) {
|
|
21192
|
+
var el = document.createElement("span"),
|
|
21193
|
+
showingEl = document.createElement("span"),
|
|
21194
|
+
valueEl = document.createElement("span"),
|
|
21195
|
+
ofEl = document.createElement("span"),
|
|
21196
|
+
totalEl = document.createElement("span"),
|
|
21197
|
+
rowsEl = document.createElement("span");
|
|
21198
|
+
this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
|
|
21199
|
+
showingEl.innerHTML = value;
|
|
21200
|
+
});
|
|
21201
|
+
valueEl.innerHTML = " " + currentRow + "-" + Math.min(currentRow + pageSize - 1, totalRows) + " ";
|
|
21202
|
+
this.table.modules.localize.langBind("pagination|counter|of", function (value) {
|
|
21203
|
+
ofEl.innerHTML = value;
|
|
21204
|
+
});
|
|
21205
|
+
totalEl.innerHTML = " " + totalRows + " ";
|
|
21206
|
+
this.table.modules.localize.langBind("pagination|counter|rows", function (value) {
|
|
21207
|
+
rowsEl.innerHTML = value;
|
|
21208
|
+
});
|
|
21209
|
+
el.appendChild(showingEl);
|
|
21210
|
+
el.appendChild(valueEl);
|
|
21211
|
+
el.appendChild(ofEl);
|
|
21212
|
+
el.appendChild(totalEl);
|
|
21213
|
+
el.appendChild(rowsEl);
|
|
21214
|
+
return el;
|
|
21215
|
+
}
|
|
21216
|
+
|
|
21217
|
+
function pages (pageSize, currentRow, currentPage, totalRows, totalPages) {
|
|
21218
|
+
var el = document.createElement("span"),
|
|
21219
|
+
showingEl = document.createElement("span"),
|
|
21220
|
+
valueEl = document.createElement("span"),
|
|
21221
|
+
ofEl = document.createElement("span"),
|
|
21222
|
+
totalEl = document.createElement("span"),
|
|
21223
|
+
rowsEl = document.createElement("span");
|
|
21224
|
+
this.table.modules.localize.langBind("pagination|counter|showing", function (value) {
|
|
21225
|
+
showingEl.innerHTML = value;
|
|
21226
|
+
});
|
|
21227
|
+
valueEl.innerHTML = " " + currentPage + " ";
|
|
21228
|
+
this.table.modules.localize.langBind("pagination|counter|of", function (value) {
|
|
21229
|
+
ofEl.innerHTML = value;
|
|
21230
|
+
});
|
|
21231
|
+
totalEl.innerHTML = " " + totalPages + " ";
|
|
21232
|
+
this.table.modules.localize.langBind("pagination|counter|pages", function (value) {
|
|
21233
|
+
rowsEl.innerHTML = value;
|
|
21234
|
+
});
|
|
21235
|
+
el.appendChild(showingEl);
|
|
21236
|
+
el.appendChild(valueEl);
|
|
21237
|
+
el.appendChild(ofEl);
|
|
21238
|
+
el.appendChild(totalEl);
|
|
21239
|
+
el.appendChild(rowsEl);
|
|
21240
|
+
return el;
|
|
21241
|
+
}
|
|
21242
|
+
|
|
21243
|
+
var defaultPageCounters = {
|
|
21244
|
+
rows: rows,
|
|
21245
|
+
pages: pages
|
|
21246
|
+
};
|
|
21247
|
+
|
|
20816
21248
|
var Page = /*#__PURE__*/function (_Module) {
|
|
20817
21249
|
_inherits(Page, _Module);
|
|
20818
21250
|
|
|
@@ -20826,10 +21258,14 @@
|
|
|
20826
21258
|
_this = _super.call(this, table);
|
|
20827
21259
|
_this.mode = "local";
|
|
20828
21260
|
_this.progressiveLoad = false;
|
|
21261
|
+
_this.element = null;
|
|
21262
|
+
_this.pageCounterElement = null;
|
|
21263
|
+
_this.pageCounter = null;
|
|
20829
21264
|
_this.size = 0;
|
|
20830
21265
|
_this.page = 1;
|
|
20831
21266
|
_this.count = 5;
|
|
20832
21267
|
_this.max = 1;
|
|
21268
|
+
_this.remoteRowCountEstimate = null;
|
|
20833
21269
|
_this.displayIndex = 0; //index in display pipeline
|
|
20834
21270
|
|
|
20835
21271
|
_this.initialLoad = true;
|
|
@@ -20849,6 +21285,12 @@
|
|
|
20849
21285
|
_this.registerTableOption("paginationInitialPage", 1); //initial page to show on load
|
|
20850
21286
|
|
|
20851
21287
|
|
|
21288
|
+
_this.registerTableOption("paginationCounter", false); // set pagination counter
|
|
21289
|
+
|
|
21290
|
+
|
|
21291
|
+
_this.registerTableOption("paginationCounterElement", false); // set pagination counter
|
|
21292
|
+
|
|
21293
|
+
|
|
20852
21294
|
_this.registerTableOption("paginationButtonCount", 5); // set count of page button
|
|
20853
21295
|
|
|
20854
21296
|
|
|
@@ -20901,11 +21343,14 @@
|
|
|
20901
21343
|
value: function initialize() {
|
|
20902
21344
|
if (this.table.options.pagination) {
|
|
20903
21345
|
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
20904
|
-
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
20905
21346
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
20906
21347
|
this.subscribe("data-processed", this.initialLoadComplete.bind(this));
|
|
20907
21348
|
this.subscribe("table-built", this.calculatePageSizes.bind(this));
|
|
20908
21349
|
|
|
21350
|
+
if (this.table.options.paginationAddRow == "page") {
|
|
21351
|
+
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
21352
|
+
}
|
|
21353
|
+
|
|
20909
21354
|
if (this.table.options.paginationMode === "remote") {
|
|
20910
21355
|
this.subscribe("data-params", this.remotePageParams.bind(this));
|
|
20911
21356
|
this.subscribe("data-loaded", this._parseRemoteData.bind(this));
|
|
@@ -20918,6 +21363,7 @@
|
|
|
20918
21363
|
this.registerDisplayHandler(this.restOnRenderBefore.bind(this), 40);
|
|
20919
21364
|
this.registerDisplayHandler(this.getRows.bind(this), 50);
|
|
20920
21365
|
this.createElements();
|
|
21366
|
+
this.initializePageCounter();
|
|
20921
21367
|
this.initializePaginator();
|
|
20922
21368
|
} else if (this.table.options.progressiveLoad) {
|
|
20923
21369
|
this.subscribe("data-params", this.remotePageParams.bind(this));
|
|
@@ -21141,14 +21587,36 @@
|
|
|
21141
21587
|
});
|
|
21142
21588
|
this.pageSizeSelect.value = this.size;
|
|
21143
21589
|
}
|
|
21144
|
-
}
|
|
21590
|
+
}
|
|
21591
|
+
}, {
|
|
21592
|
+
key: "initializePageCounter",
|
|
21593
|
+
value: function initializePageCounter() {
|
|
21594
|
+
var counter = this.table.options.paginationCounter,
|
|
21595
|
+
pageCounter = null;
|
|
21596
|
+
|
|
21597
|
+
if (counter) {
|
|
21598
|
+
if (typeof counter === "function") {
|
|
21599
|
+
pageCounter = counter;
|
|
21600
|
+
} else {
|
|
21601
|
+
pageCounter = Page.pageCounters[counter];
|
|
21602
|
+
}
|
|
21603
|
+
|
|
21604
|
+
if (pageCounter) {
|
|
21605
|
+
this.pageCounter = pageCounter;
|
|
21606
|
+
this.pageCounterElement = document.createElement("span");
|
|
21607
|
+
this.pageCounterElement.classList.add("tabulator-page-counter");
|
|
21608
|
+
} else {
|
|
21609
|
+
console.warn("Pagination Error - No such page counter found: ", counter);
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21612
|
+
} //setup pagination
|
|
21145
21613
|
|
|
21146
21614
|
}, {
|
|
21147
21615
|
key: "initializePaginator",
|
|
21148
21616
|
value: function initializePaginator(hidden) {
|
|
21149
21617
|
var _this3 = this;
|
|
21150
21618
|
|
|
21151
|
-
var pageSelectLabel;
|
|
21619
|
+
var pageSelectLabel, paginationCounterHolder;
|
|
21152
21620
|
|
|
21153
21621
|
if (!hidden) {
|
|
21154
21622
|
//build pagination element
|
|
@@ -21229,6 +21697,25 @@
|
|
|
21229
21697
|
this.element.appendChild(this.lastBut);
|
|
21230
21698
|
|
|
21231
21699
|
if (!this.table.options.paginationElement && !hidden) {
|
|
21700
|
+
if (this.table.options.paginationCounter) {
|
|
21701
|
+
|
|
21702
|
+
if (this.table.options.paginationCounterElement) {
|
|
21703
|
+
if (this.table.options.paginationCounterElement instanceof HTMLElement) {
|
|
21704
|
+
this.table.options.paginationCounterElement.appendChild(this.pageCounterElement);
|
|
21705
|
+
} else if (typeof this.table.options.paginationCounterElement === "string") {
|
|
21706
|
+
paginationCounterHolder = document.querySelector(this.table.options.paginationCounterElement);
|
|
21707
|
+
|
|
21708
|
+
if (paginationCounterHolder) {
|
|
21709
|
+
paginationCounterHolder.appendChild(this.pageCounterElement);
|
|
21710
|
+
} else {
|
|
21711
|
+
console.warn("Pagination Error - Unable to find element matching paginationCounterElement selector:", this.table.options.paginationCounterElement);
|
|
21712
|
+
}
|
|
21713
|
+
}
|
|
21714
|
+
} else {
|
|
21715
|
+
this.table.footerManager.append(this.pageCounterElement);
|
|
21716
|
+
}
|
|
21717
|
+
}
|
|
21718
|
+
|
|
21232
21719
|
this.table.footerManager.append(this.element, this);
|
|
21233
21720
|
}
|
|
21234
21721
|
|
|
@@ -21357,6 +21844,49 @@
|
|
|
21357
21844
|
}
|
|
21358
21845
|
|
|
21359
21846
|
this.trackChanges();
|
|
21847
|
+
}
|
|
21848
|
+
}, {
|
|
21849
|
+
key: "_setPageCounter",
|
|
21850
|
+
value: function _setPageCounter(totalRows) {
|
|
21851
|
+
var content, currentRow;
|
|
21852
|
+
|
|
21853
|
+
if (this.pageCounter) {
|
|
21854
|
+
currentRow = (this.page - 1) * this.size + 1;
|
|
21855
|
+
|
|
21856
|
+
if (this.mode === "remote") {
|
|
21857
|
+
totalRows = this.remoteRowCountEstimate;
|
|
21858
|
+
}
|
|
21859
|
+
|
|
21860
|
+
content = this.pageCounter.call(this, this.size, currentRow, this.page, totalRows, this.max);
|
|
21861
|
+
|
|
21862
|
+
switch (_typeof(content)) {
|
|
21863
|
+
case "object":
|
|
21864
|
+
if (content instanceof Node) {
|
|
21865
|
+
//clear previous cell contents
|
|
21866
|
+
while (this.pageCounterElement.firstChild) {
|
|
21867
|
+
this.pageCounterElement.removeChild(this.pageCounterElement.firstChild);
|
|
21868
|
+
}
|
|
21869
|
+
|
|
21870
|
+
this.pageCounterElement.appendChild(content);
|
|
21871
|
+
} else {
|
|
21872
|
+
this.pageCounterElement.innerHTML = "";
|
|
21873
|
+
|
|
21874
|
+
if (content != null) {
|
|
21875
|
+
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);
|
|
21876
|
+
}
|
|
21877
|
+
}
|
|
21878
|
+
|
|
21879
|
+
break;
|
|
21880
|
+
|
|
21881
|
+
case "undefined":
|
|
21882
|
+
case "null":
|
|
21883
|
+
this.pageCounterElement.innerHTML = "";
|
|
21884
|
+
break;
|
|
21885
|
+
|
|
21886
|
+
default:
|
|
21887
|
+
this.pageCounterElement.innerHTML = content;
|
|
21888
|
+
}
|
|
21889
|
+
}
|
|
21360
21890
|
} //setup the pagination buttons
|
|
21361
21891
|
|
|
21362
21892
|
}, {
|
|
@@ -21497,10 +22027,14 @@
|
|
|
21497
22027
|
}
|
|
21498
22028
|
}
|
|
21499
22029
|
|
|
22030
|
+
this._setPageCounter(data.length);
|
|
22031
|
+
|
|
21500
22032
|
return output;
|
|
21501
22033
|
} else {
|
|
21502
22034
|
this._setPageButtons();
|
|
21503
22035
|
|
|
22036
|
+
this._setPageCounter(data.length);
|
|
22037
|
+
|
|
21504
22038
|
return data.slice(0);
|
|
21505
22039
|
}
|
|
21506
22040
|
}
|
|
@@ -21547,6 +22081,7 @@
|
|
|
21547
22081
|
|
|
21548
22082
|
if (data.data) {
|
|
21549
22083
|
this.max = parseInt(data.last_page) || 1;
|
|
22084
|
+
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);
|
|
21550
22085
|
|
|
21551
22086
|
if (this.progressiveLoad) {
|
|
21552
22087
|
switch (this.mode) {
|
|
@@ -21571,9 +22106,11 @@
|
|
|
21571
22106
|
margin = this.table.options.progressiveLoadScrollMargin || this.table.rowManager.element.clientHeight * 2;
|
|
21572
22107
|
|
|
21573
22108
|
if (this.table.rowManager.element.scrollHeight <= this.table.rowManager.element.clientHeight + margin) {
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
22109
|
+
if (this.page < this.max) {
|
|
22110
|
+
setTimeout(function () {
|
|
22111
|
+
_this6.nextPage();
|
|
22112
|
+
});
|
|
22113
|
+
}
|
|
21577
22114
|
}
|
|
21578
22115
|
|
|
21579
22116
|
break;
|
|
@@ -21612,7 +22149,9 @@
|
|
|
21612
22149
|
return Page;
|
|
21613
22150
|
}(Module);
|
|
21614
22151
|
|
|
21615
|
-
Page.moduleName = "page";
|
|
22152
|
+
Page.moduleName = "page"; //load defaults
|
|
22153
|
+
|
|
22154
|
+
Page.pageCounters = defaultPageCounters;
|
|
21616
22155
|
|
|
21617
22156
|
// read peristence information from storage
|
|
21618
22157
|
var defaultReaders = {
|
|
@@ -21800,9 +22339,9 @@
|
|
|
21800
22339
|
this.subscribe("column-show", this.save.bind(this, "columns"));
|
|
21801
22340
|
this.subscribe("column-hide", this.save.bind(this, "columns"));
|
|
21802
22341
|
this.subscribe("column-moved", this.save.bind(this, "columns"));
|
|
21803
|
-
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
21804
22342
|
}
|
|
21805
22343
|
|
|
22344
|
+
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
21806
22345
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
21807
22346
|
this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
|
|
21808
22347
|
this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
|
|
@@ -21833,7 +22372,7 @@
|
|
|
21833
22372
|
sorters = this.load("sort");
|
|
21834
22373
|
|
|
21835
22374
|
if (!sorters === false) {
|
|
21836
|
-
this.table.initialSort = sorters;
|
|
22375
|
+
this.table.options.initialSort = sorters;
|
|
21837
22376
|
}
|
|
21838
22377
|
}
|
|
21839
22378
|
|
|
@@ -21841,7 +22380,7 @@
|
|
|
21841
22380
|
filters = this.load("filter");
|
|
21842
22381
|
|
|
21843
22382
|
if (!filters === false) {
|
|
21844
|
-
this.table.initialFilter = filters;
|
|
22383
|
+
this.table.options.initialFilter = filters;
|
|
21845
22384
|
}
|
|
21846
22385
|
}
|
|
21847
22386
|
}
|
|
@@ -22124,7 +22663,8 @@
|
|
|
22124
22663
|
return Persistence;
|
|
22125
22664
|
}(Module);
|
|
22126
22665
|
|
|
22127
|
-
Persistence.moduleName = "persistence";
|
|
22666
|
+
Persistence.moduleName = "persistence";
|
|
22667
|
+
Persistence.moduleInitOrder = 1; //load defaults
|
|
22128
22668
|
|
|
22129
22669
|
Persistence.readers = defaultReaders;
|
|
22130
22670
|
Persistence.writers = defaultWriters;
|
|
@@ -22888,7 +23428,7 @@
|
|
|
22888
23428
|
handle.removeEventListener("touchmove", mouseMove);
|
|
22889
23429
|
handle.removeEventListener("touchend", mouseUp);
|
|
22890
23430
|
self.table.element.classList.remove("tabulator-block-select");
|
|
22891
|
-
|
|
23431
|
+
self.dispatchExternal("rowResized", row.getComponent());
|
|
22892
23432
|
}
|
|
22893
23433
|
|
|
22894
23434
|
e.stopPropagation(); //prevent resize from interfereing with movable columns
|
|
@@ -23076,7 +23616,7 @@
|
|
|
23076
23616
|
_this.registerColumnOption("responsive");
|
|
23077
23617
|
|
|
23078
23618
|
return _this;
|
|
23079
|
-
} //generate
|
|
23619
|
+
} //generate responsive columns list
|
|
23080
23620
|
|
|
23081
23621
|
|
|
23082
23622
|
_createClass(ResponsiveLayout, [{
|
|
@@ -23111,11 +23651,13 @@
|
|
|
23111
23651
|
}, {
|
|
23112
23652
|
key: "initializeResponsivity",
|
|
23113
23653
|
value: function initializeResponsivity() {
|
|
23654
|
+
var _this2 = this;
|
|
23655
|
+
|
|
23114
23656
|
var columns = [];
|
|
23115
23657
|
this.mode = this.table.options.responsiveLayout;
|
|
23116
23658
|
this.collapseFormatter = this.table.options.responsiveLayoutCollapseFormatter || this.formatCollapsedData;
|
|
23117
23659
|
this.collapseStartOpen = this.table.options.responsiveLayoutCollapseStartOpen;
|
|
23118
|
-
this.hiddenColumns = []; //
|
|
23660
|
+
this.hiddenColumns = []; //determine level of responsivity for each column
|
|
23119
23661
|
|
|
23120
23662
|
this.table.columnManager.columnsByIndex.forEach(function (column, i) {
|
|
23121
23663
|
if (column.modules.responsive) {
|
|
@@ -23123,8 +23665,8 @@
|
|
|
23123
23665
|
column.modules.responsive.index = i;
|
|
23124
23666
|
columns.push(column);
|
|
23125
23667
|
|
|
23126
|
-
if (!column.visible &&
|
|
23127
|
-
|
|
23668
|
+
if (!column.visible && _this2.mode === "collapse") {
|
|
23669
|
+
_this2.hiddenColumns.push(column);
|
|
23128
23670
|
}
|
|
23129
23671
|
}
|
|
23130
23672
|
}
|
|
@@ -23212,9 +23754,8 @@
|
|
|
23212
23754
|
value: function updateColumnVisibility(column, responsiveToggle) {
|
|
23213
23755
|
if (!responsiveToggle && column.modules.responsive) {
|
|
23214
23756
|
column.modules.responsive.visible = column.visible;
|
|
23215
|
-
this.
|
|
23216
|
-
}
|
|
23217
|
-
|
|
23757
|
+
this.initializeResponsivity();
|
|
23758
|
+
}
|
|
23218
23759
|
}
|
|
23219
23760
|
}, {
|
|
23220
23761
|
key: "hideColumn",
|
|
@@ -23390,7 +23931,7 @@
|
|
|
23390
23931
|
var titleHighlight = document.createElement("strong");
|
|
23391
23932
|
titleData.appendChild(titleHighlight);
|
|
23392
23933
|
this.langBind("columns|" + item.field, function (text) {
|
|
23393
|
-
titleHighlight.
|
|
23934
|
+
titleHighlight.innerHTML = text || item.title;
|
|
23394
23935
|
});
|
|
23395
23936
|
|
|
23396
23937
|
if (item.value instanceof Node) {
|
|
@@ -23484,7 +24025,7 @@
|
|
|
23484
24025
|
this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
|
|
23485
24026
|
|
|
23486
24027
|
if (this.table.options.selectable && !this.table.options.selectablePersistence) {
|
|
23487
|
-
this.subscribe("data-
|
|
24028
|
+
this.subscribe("data-refreshing", this.deselectRows.bind(this));
|
|
23488
24029
|
}
|
|
23489
24030
|
}
|
|
23490
24031
|
}
|
|
@@ -23986,8 +24527,8 @@
|
|
|
23986
24527
|
emptyAlign = 0;
|
|
23987
24528
|
|
|
23988
24529
|
if (typeof DT != "undefined") {
|
|
23989
|
-
a = DT.fromFormat(String(a), format);
|
|
23990
|
-
b = DT.fromFormat(String(b), format);
|
|
24530
|
+
a = format === "iso" ? DT.fromISO(String(a)) : DT.fromFormat(String(a), format);
|
|
24531
|
+
b = format === "iso" ? DT.fromISO(String(b)) : DT.fromFormat(String(b), format);
|
|
23991
24532
|
|
|
23992
24533
|
if (!a.isValid) {
|
|
23993
24534
|
emptyAlign = !b.isValid ? 0 : -1;
|
|
@@ -24791,9 +25332,11 @@
|
|
|
24791
25332
|
}, {
|
|
24792
25333
|
key: "columnValidate",
|
|
24793
25334
|
value: function columnValidate(column) {
|
|
25335
|
+
var _this2 = this;
|
|
25336
|
+
|
|
24794
25337
|
var invalid = [];
|
|
24795
25338
|
column.cells.forEach(function (cell) {
|
|
24796
|
-
if (!
|
|
25339
|
+
if (!_this2.cellValidate(cell)) {
|
|
24797
25340
|
invalid.push(cell.getComponent());
|
|
24798
25341
|
}
|
|
24799
25342
|
});
|
|
@@ -24805,9 +25348,11 @@
|
|
|
24805
25348
|
}, {
|
|
24806
25349
|
key: "rowValidate",
|
|
24807
25350
|
value: function rowValidate(row) {
|
|
25351
|
+
var _this3 = this;
|
|
25352
|
+
|
|
24808
25353
|
var invalid = [];
|
|
24809
25354
|
row.cells.forEach(function (cell) {
|
|
24810
|
-
if (!
|
|
25355
|
+
if (!_this3.cellValidate(cell)) {
|
|
24811
25356
|
invalid.push(cell.getComponent());
|
|
24812
25357
|
}
|
|
24813
25358
|
});
|
|
@@ -24819,7 +25364,7 @@
|
|
|
24819
25364
|
}, {
|
|
24820
25365
|
key: "userClearCellValidation",
|
|
24821
25366
|
value: function userClearCellValidation(cells) {
|
|
24822
|
-
var
|
|
25367
|
+
var _this4 = this;
|
|
24823
25368
|
|
|
24824
25369
|
if (!cells) {
|
|
24825
25370
|
cells = this.getInvalidCells();
|
|
@@ -24830,7 +25375,7 @@
|
|
|
24830
25375
|
}
|
|
24831
25376
|
|
|
24832
25377
|
cells.forEach(function (cell) {
|
|
24833
|
-
|
|
25378
|
+
_this4.clearValidation(cell._getSelf());
|
|
24834
25379
|
});
|
|
24835
25380
|
}
|
|
24836
25381
|
}, {
|
|
@@ -24839,6 +25384,7 @@
|
|
|
24839
25384
|
var output = []; //clear row data
|
|
24840
25385
|
|
|
24841
25386
|
this.table.rowManager.rows.forEach(function (row) {
|
|
25387
|
+
row = row.getComponent();
|
|
24842
25388
|
var valid = row.validate();
|
|
24843
25389
|
|
|
24844
25390
|
if (valid !== true) {
|
|
@@ -25021,6 +25567,7 @@
|
|
|
25021
25567
|
GroupRowsModule: GroupRows,
|
|
25022
25568
|
HistoryModule: History,
|
|
25023
25569
|
HtmlTableImportModule: HtmlTableImport,
|
|
25570
|
+
ImportModule: Import,
|
|
25024
25571
|
InteractionModule: Interaction,
|
|
25025
25572
|
KeybindingsModule: Keybindings,
|
|
25026
25573
|
MenuModule: Menu,
|