tabulator-tables 5.4.3 → 5.4.4
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/.babelrc.json +3 -3
- package/.editorconfig +6 -6
- package/.eslintignore +3 -3
- package/.eslintrc.js +28 -28
- package/.github/ISSUE_TEMPLATE/bug_report.md +58 -58
- package/.github/ISSUE_TEMPLATE/documentation.md +14 -14
- package/.github/ISSUE_TEMPLATE/feature_request.md +24 -24
- package/.github/ISSUE_TEMPLATE/question.md +12 -12
- package/.github/workflows/bad-files-check.yml +39 -39
- package/.github/workflows/lint-and-test.yml +30 -30
- package/CODE_OF_CONDUCT.md +46 -46
- package/CONTRIBUTING.md +22 -22
- package/LICENSE +20 -20
- package/README.md +76 -76
- package/bower.json +40 -40
- package/build/Bundler.js +185 -185
- package/build/rollup.js +6 -6
- package/dist/css/tabulator.css +0 -5
- 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 +0 -5
- 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 +0 -5
- 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_bootstrap5.css +0 -5
- package/dist/css/tabulator_bootstrap5.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.min.css +1 -1
- package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
- package/dist/css/tabulator_bulma.css +0 -5
- 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 +0 -5
- 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 +0 -5
- 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 +0 -5
- 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 +102 -107
- 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 +0 -5
- 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 +0 -5
- 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/jquery_wrapper.js +55 -55
- package/dist/js/tabulator.js +25847 -25711
- 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 +25926 -25790
- 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 +65 -65
- package/src/js/builds/esm.js +14 -14
- package/src/js/builds/jquery_wrapper.js +55 -55
- package/src/js/core/ColumnManager.js +730 -730
- package/src/js/core/CoreFeature.js +138 -138
- package/src/js/core/FooterManager.js +101 -101
- package/src/js/core/Module.js +141 -141
- package/src/js/core/RowManager.js +1112 -1101
- package/src/js/core/Tabulator.js +895 -892
- package/src/js/core/TabulatorFull.js +10 -10
- package/src/js/core/cell/Cell.js +295 -295
- package/src/js/core/cell/CellComponent.js +76 -76
- package/src/js/core/column/Column.js +949 -949
- package/src/js/core/column/ColumnComponent.js +152 -152
- package/src/js/core/column/defaults/options.js +17 -17
- package/src/js/core/defaults/options.js +65 -65
- package/src/js/core/modules/core.js +2 -2
- package/src/js/core/modules/optional.js +34 -34
- package/src/js/core/rendering/Renderer.js +203 -203
- package/src/js/core/rendering/renderers/BasicHorizontal.js +19 -19
- package/src/js/core/rendering/renderers/BasicVertical.js +79 -78
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +577 -577
- package/src/js/core/rendering/renderers/VirtualDomVertical.js +579 -579
- package/src/js/core/row/PseudoRow.js +44 -44
- package/src/js/core/row/Row.js +457 -457
- package/src/js/core/row/RowComponent.js +93 -93
- package/src/js/core/tools/Alert.js +61 -61
- package/src/js/core/tools/ComponentFunctionBinder.js +32 -32
- package/src/js/core/tools/DataLoader.js +119 -119
- package/src/js/core/tools/DeprecationAdvisor.js +46 -46
- package/src/js/core/tools/ExternalEventBus.js +104 -104
- package/src/js/core/tools/Helpers.js +46 -46
- package/src/js/core/tools/InteractionMonitor.js +321 -321
- package/src/js/core/tools/InternalEventBus.js +161 -161
- package/src/js/core/tools/ModuleBinder.js +104 -104
- package/src/js/core/tools/OptionsList.js +44 -40
- package/src/js/core/tools/Popup.js +304 -304
- package/src/js/core/tools/TableRegistry.js +61 -61
- package/src/js/modules/Accessor/Accessor.js +115 -115
- package/src/js/modules/Ajax/Ajax.js +143 -143
- package/src/js/modules/Ajax/defaults/config.js +2 -2
- package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +44 -44
- package/src/js/modules/Ajax/defaults/loaderPromise.js +86 -86
- package/src/js/modules/Ajax/defaults/urlGenerator.js +43 -43
- package/src/js/modules/Clipboard/Clipboard.js +279 -279
- package/src/js/modules/Clipboard/defaults/pasteActions.js +10 -10
- package/src/js/modules/Clipboard/defaults/pasteParsers.js +74 -74
- package/src/js/modules/ColumnCalcs/CalcComponent.js +47 -47
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +581 -568
- package/src/js/modules/ColumnCalcs/defaults/calculations.js +85 -85
- package/src/js/modules/Comms/Comms.js +51 -51
- package/src/js/modules/DataTree/DataTree.js +603 -603
- package/src/js/modules/Download/Download.js +148 -148
- package/src/js/modules/Download/defaults/downloaders/csv.js +61 -61
- package/src/js/modules/Download/defaults/downloaders/html.js +4 -4
- package/src/js/modules/Download/defaults/downloaders/json.js +33 -33
- package/src/js/modules/Download/defaults/downloaders/jsonLines.js +31 -31
- package/src/js/modules/Download/defaults/downloaders/pdf.js +111 -111
- package/src/js/modules/Download/defaults/downloaders/xlsx.js +98 -98
- package/src/js/modules/Download/defaults/downloaders.js +14 -14
- package/src/js/modules/Edit/Edit.js +735 -736
- package/src/js/modules/Edit/List.js +1037 -1033
- package/src/js/modules/Edit/defaults/editors/autocomplete.js +11 -11
- package/src/js/modules/Edit/defaults/editors/date.js +138 -110
- package/src/js/modules/Edit/defaults/editors/datetime.js +125 -97
- package/src/js/modules/Edit/defaults/editors/input.js +76 -74
- package/src/js/modules/Edit/defaults/editors/list.js +6 -6
- package/src/js/modules/Edit/defaults/editors/number.js +109 -107
- package/src/js/modules/Edit/defaults/editors/progress.js +126 -126
- package/src/js/modules/Edit/defaults/editors/range.js +80 -78
- package/src/js/modules/Edit/defaults/editors/select.js +9 -9
- package/src/js/modules/Edit/defaults/editors/star.js +145 -145
- package/src/js/modules/Edit/defaults/editors/textarea.js +122 -120
- package/src/js/modules/Edit/defaults/editors/tickCross.js +94 -96
- package/src/js/modules/Edit/defaults/editors/time.js +126 -98
- package/src/js/modules/Edit/defaults/editors.js +28 -28
- package/src/js/modules/Edit/inputMask.js +73 -73
- package/src/js/modules/Export/Export.js +623 -623
- package/src/js/modules/Export/ExportColumn.js +10 -10
- package/src/js/modules/Export/ExportRow.js +9 -9
- package/src/js/modules/Filter/Filter.js +892 -892
- package/src/js/modules/Filter/defaults/filters.js +107 -107
- package/src/js/modules/Format/Format.js +212 -212
- package/src/js/modules/Format/defaults/formatters/buttonCross.js +2 -2
- package/src/js/modules/Format/defaults/formatters/buttonTick.js +2 -2
- package/src/js/modules/Format/defaults/formatters/color.js +3 -3
- package/src/js/modules/Format/defaults/formatters/datetime.js +36 -36
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +40 -40
- package/src/js/modules/Format/defaults/formatters/handle.js +3 -3
- package/src/js/modules/Format/defaults/formatters/html.js +2 -2
- package/src/js/modules/Format/defaults/formatters/image.js +39 -39
- package/src/js/modules/Format/defaults/formatters/link.js +77 -77
- package/src/js/modules/Format/defaults/formatters/lookup.js +9 -9
- package/src/js/modules/Format/defaults/formatters/money.js +36 -36
- package/src/js/modules/Format/defaults/formatters/plaintext.js +2 -2
- package/src/js/modules/Format/defaults/formatters/progress.js +132 -132
- package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +43 -43
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +59 -59
- package/src/js/modules/Format/defaults/formatters/rownum.js +9 -9
- package/src/js/modules/Format/defaults/formatters/star.js +37 -37
- package/src/js/modules/Format/defaults/formatters/textarea.js +3 -3
- package/src/js/modules/Format/defaults/formatters/tickCross.js +21 -21
- package/src/js/modules/Format/defaults/formatters/traffic.js +46 -46
- package/src/js/modules/Format/defaults/formatters.js +42 -42
- package/src/js/modules/FrozenColumns/FrozenColumns.js +299 -299
- package/src/js/modules/FrozenRows/FrozenRows.js +169 -159
- package/src/js/modules/GroupRows/Group.js +597 -598
- package/src/js/modules/GroupRows/GroupComponent.js +66 -66
- package/src/js/modules/GroupRows/GroupRows.js +639 -639
- package/src/js/modules/History/History.js +171 -171
- package/src/js/modules/History/defaults/redoers.js +24 -24
- package/src/js/modules/History/defaults/undoers.js +24 -24
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +181 -181
- package/src/js/modules/Import/Import.js +193 -193
- package/src/js/modules/Import/defaults/importers/array.js +4 -4
- package/src/js/modules/Import/defaults/importers/csv.js +62 -62
- package/src/js/modules/Import/defaults/importers/json.js +7 -7
- package/src/js/modules/Import/defaults/importers.js +8 -8
- package/src/js/modules/Interaction/Interaction.js +325 -325
- package/src/js/modules/Keybindings/Keybindings.js +172 -172
- package/src/js/modules/Keybindings/defaults/actions.js +118 -118
- package/src/js/modules/Keybindings/defaults/bindings.js +12 -12
- package/src/js/modules/Layout/Layout.js +49 -49
- package/src/js/modules/Layout/defaults/modes/fitColumns.js +171 -171
- package/src/js/modules/Layout/defaults/modes/fitData.js +9 -9
- package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +9 -9
- package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +39 -39
- package/src/js/modules/Layout/defaults/modes.js +11 -11
- package/src/js/modules/Localize/Localize.js +185 -185
- package/src/js/modules/Localize/defaults/langs.js +36 -36
- package/src/js/modules/Menu/Menu.js +302 -302
- package/src/js/modules/MoveColumns/MoveColumns.js +299 -299
- package/src/js/modules/MoveRows/MoveRows.js +635 -635
- package/src/js/modules/Mutator/Mutator.js +161 -161
- package/src/js/modules/Page/Page.js +881 -881
- package/src/js/modules/Page/defaults/pageCounters/pages.js +32 -32
- package/src/js/modules/Page/defaults/pageCounters/rows.js +39 -39
- package/src/js/modules/Page/defaults/pageCounters.js +7 -7
- package/src/js/modules/Persistence/Persistence.js +458 -458
- package/src/js/modules/Persistence/defaults/readers.js +29 -29
- package/src/js/modules/Persistence/defaults/writers.js +12 -12
- package/src/js/modules/Popup/Popup.js +231 -231
- package/src/js/modules/Print/Print.js +137 -137
- package/src/js/modules/ReactiveData/ReactiveData.js +408 -408
- package/src/js/modules/ResizeColumns/ResizeColumns.js +309 -309
- package/src/js/modules/ResizeRows/ResizeRows.js +111 -111
- package/src/js/modules/ResizeTable/ResizeTable.js +159 -159
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +345 -345
- package/src/js/modules/SelectRow/SelectRow.js +446 -444
- package/src/js/modules/Sort/Sort.js +470 -470
- package/src/js/modules/Sort/defaults/sorters/alphanum.js +43 -43
- package/src/js/modules/Sort/defaults/sorters/array.js +53 -53
- package/src/js/modules/Sort/defaults/sorters/boolean.js +6 -6
- package/src/js/modules/Sort/defaults/sorters/date.js +9 -9
- package/src/js/modules/Sort/defaults/sorters/datetime.js +43 -43
- package/src/js/modules/Sort/defaults/sorters/exists.js +6 -6
- package/src/js/modules/Sort/defaults/sorters/number.js +39 -39
- package/src/js/modules/Sort/defaults/sorters/string.js +33 -33
- package/src/js/modules/Sort/defaults/sorters/time.js +9 -9
- package/src/js/modules/Sort/defaults/sorters.js +20 -20
- package/src/js/modules/Tooltip/Tooltip.js +130 -130
- package/src/js/modules/Validate/Validate.js +305 -305
- package/src/js/modules/Validate/defaults/validators.js +138 -138
- package/src/scss/tabulator.scss +1464 -1467
- package/src/scss/themes/bootstrap/functions4.scss +118 -118
- package/src/scss/themes/bootstrap/functions5.scss +302 -302
- package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +284 -284
- package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +544 -544
- package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +574 -574
- package/src/scss/themes/bootstrap/variables3.scss +870 -870
- package/src/scss/themes/bootstrap/variables4.scss +930 -930
- package/src/scss/themes/bootstrap/variables5.scss +1641 -1641
- package/src/scss/themes/bulma/tabulator_bulma.scss +252 -252
- package/src/scss/themes/bulma/variables.scss +197 -197
- package/src/scss/themes/materialize/tabulator_materialize.scss +265 -265
- package/src/scss/themes/materialize/variables.scss +70 -70
- package/src/scss/themes/semanticui/tabulator_semanticui.scss +561 -561
- package/src/scss/themes/semanticui/variables.scss +839 -839
- package/src/scss/themes/semanticui/variables_table.scss +247 -247
- package/src/scss/themes/tabulator_midnight.scss +158 -158
- package/src/scss/themes/tabulator_modern.scss +231 -231
- package/src/scss/themes/tabulator_simple.scss +102 -102
- package/src/scss/themes/tabulator_site.scss +189 -189
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
//public row object
|
|
2
|
-
export default class RowComponent {
|
|
3
|
-
|
|
4
|
-
constructor (row){
|
|
5
|
-
this._row = row;
|
|
6
|
-
|
|
7
|
-
return new Proxy(this, {
|
|
8
|
-
get: function(target, name, receiver) {
|
|
9
|
-
if (typeof target[name] !== "undefined") {
|
|
10
|
-
return target[name];
|
|
11
|
-
}else{
|
|
12
|
-
return target._row.table.componentFunctionBinder.handle("row", target._row, name);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getData(transform){
|
|
19
|
-
return this._row.getData(transform);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getElement(){
|
|
23
|
-
return this._row.getElement();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getCells(){
|
|
27
|
-
var cells = [];
|
|
28
|
-
|
|
29
|
-
this._row.getCells().forEach(function(cell){
|
|
30
|
-
cells.push(cell.getComponent());
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return cells;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getCell(column){
|
|
37
|
-
var cell = this._row.getCell(column);
|
|
38
|
-
return cell ? cell.getComponent() : false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getIndex(){
|
|
42
|
-
return this._row.getData("data")[this._row.table.options.index];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getPosition(){
|
|
46
|
-
return this._row.getPosition();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
watchPosition(callback){
|
|
50
|
-
return this._row.watchPosition(callback);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
delete(){
|
|
54
|
-
return this._row.delete();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
scrollTo(){
|
|
58
|
-
return this._row.table.rowManager.scrollToRow(this._row);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
move(to, after){
|
|
62
|
-
this._row.moveToRow(to, after);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
update(data){
|
|
66
|
-
return this._row.updateData(data);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
normalizeHeight(){
|
|
70
|
-
this._row.normalizeHeight(true);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
_getSelf(){
|
|
74
|
-
return this._row;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
reformat(){
|
|
78
|
-
return this._row.reinitialize();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getTable(){
|
|
82
|
-
return this._row.table;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
getNextRow(){
|
|
86
|
-
var row = this._row.nextRow();
|
|
87
|
-
return row ? row.getComponent() : row;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
getPrevRow(){
|
|
91
|
-
var row = this._row.prevRow();
|
|
92
|
-
return row ? row.getComponent() : row;
|
|
93
|
-
}
|
|
1
|
+
//public row object
|
|
2
|
+
export default class RowComponent {
|
|
3
|
+
|
|
4
|
+
constructor (row){
|
|
5
|
+
this._row = row;
|
|
6
|
+
|
|
7
|
+
return new Proxy(this, {
|
|
8
|
+
get: function(target, name, receiver) {
|
|
9
|
+
if (typeof target[name] !== "undefined") {
|
|
10
|
+
return target[name];
|
|
11
|
+
}else{
|
|
12
|
+
return target._row.table.componentFunctionBinder.handle("row", target._row, name);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getData(transform){
|
|
19
|
+
return this._row.getData(transform);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getElement(){
|
|
23
|
+
return this._row.getElement();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getCells(){
|
|
27
|
+
var cells = [];
|
|
28
|
+
|
|
29
|
+
this._row.getCells().forEach(function(cell){
|
|
30
|
+
cells.push(cell.getComponent());
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return cells;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getCell(column){
|
|
37
|
+
var cell = this._row.getCell(column);
|
|
38
|
+
return cell ? cell.getComponent() : false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getIndex(){
|
|
42
|
+
return this._row.getData("data")[this._row.table.options.index];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getPosition(){
|
|
46
|
+
return this._row.getPosition();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
watchPosition(callback){
|
|
50
|
+
return this._row.watchPosition(callback);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
delete(){
|
|
54
|
+
return this._row.delete();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
scrollTo(){
|
|
58
|
+
return this._row.table.rowManager.scrollToRow(this._row);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
move(to, after){
|
|
62
|
+
this._row.moveToRow(to, after);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
update(data){
|
|
66
|
+
return this._row.updateData(data);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
normalizeHeight(){
|
|
70
|
+
this._row.normalizeHeight(true);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_getSelf(){
|
|
74
|
+
return this._row;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
reformat(){
|
|
78
|
+
return this._row.reinitialize();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getTable(){
|
|
82
|
+
return this._row.table;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getNextRow(){
|
|
86
|
+
var row = this._row.nextRow();
|
|
87
|
+
return row ? row.getComponent() : row;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getPrevRow(){
|
|
91
|
+
var row = this._row.prevRow();
|
|
92
|
+
return row ? row.getComponent() : row;
|
|
93
|
+
}
|
|
94
94
|
}
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import CoreFeature from '../CoreFeature.js';
|
|
2
|
-
|
|
3
|
-
export default class Alert extends CoreFeature{
|
|
4
|
-
constructor(table){
|
|
5
|
-
super(table);
|
|
6
|
-
|
|
7
|
-
this.element = this._createAlertElement();
|
|
8
|
-
this.msgElement = this._createMsgElement();
|
|
9
|
-
this.type = null;
|
|
10
|
-
|
|
11
|
-
this.element.appendChild(this.msgElement);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
_createAlertElement(){
|
|
15
|
-
var el = document.createElement("div");
|
|
16
|
-
el.classList.add("tabulator-alert");
|
|
17
|
-
return el;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
_createMsgElement(){
|
|
21
|
-
var el = document.createElement("div");
|
|
22
|
-
el.classList.add("tabulator-alert-msg");
|
|
23
|
-
el.setAttribute("role", "alert");
|
|
24
|
-
return el;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
_typeClass(){
|
|
28
|
-
return "tabulator-alert-state-" + this.type;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
alert(content, type = "msg"){
|
|
32
|
-
if(content){
|
|
33
|
-
this.clear();
|
|
34
|
-
|
|
35
|
-
this.type = type;
|
|
36
|
-
|
|
37
|
-
while(this.msgElement.firstChild) this.msgElement.removeChild(this.msgElement.firstChild);
|
|
38
|
-
|
|
39
|
-
this.msgElement.classList.add(this._typeClass());
|
|
40
|
-
|
|
41
|
-
if(typeof content === "function"){
|
|
42
|
-
content = content();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if(content instanceof HTMLElement){
|
|
46
|
-
this.msgElement.appendChild(content);
|
|
47
|
-
}else{
|
|
48
|
-
this.msgElement.innerHTML = content;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
this.table.element.appendChild(this.element);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
clear(){
|
|
56
|
-
if(this.element.parentNode){
|
|
57
|
-
this.element.parentNode.removeChild(this.element);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
this.msgElement.classList.remove(this._typeClass());
|
|
61
|
-
}
|
|
1
|
+
import CoreFeature from '../CoreFeature.js';
|
|
2
|
+
|
|
3
|
+
export default class Alert extends CoreFeature{
|
|
4
|
+
constructor(table){
|
|
5
|
+
super(table);
|
|
6
|
+
|
|
7
|
+
this.element = this._createAlertElement();
|
|
8
|
+
this.msgElement = this._createMsgElement();
|
|
9
|
+
this.type = null;
|
|
10
|
+
|
|
11
|
+
this.element.appendChild(this.msgElement);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_createAlertElement(){
|
|
15
|
+
var el = document.createElement("div");
|
|
16
|
+
el.classList.add("tabulator-alert");
|
|
17
|
+
return el;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_createMsgElement(){
|
|
21
|
+
var el = document.createElement("div");
|
|
22
|
+
el.classList.add("tabulator-alert-msg");
|
|
23
|
+
el.setAttribute("role", "alert");
|
|
24
|
+
return el;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_typeClass(){
|
|
28
|
+
return "tabulator-alert-state-" + this.type;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
alert(content, type = "msg"){
|
|
32
|
+
if(content){
|
|
33
|
+
this.clear();
|
|
34
|
+
|
|
35
|
+
this.type = type;
|
|
36
|
+
|
|
37
|
+
while(this.msgElement.firstChild) this.msgElement.removeChild(this.msgElement.firstChild);
|
|
38
|
+
|
|
39
|
+
this.msgElement.classList.add(this._typeClass());
|
|
40
|
+
|
|
41
|
+
if(typeof content === "function"){
|
|
42
|
+
content = content();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if(content instanceof HTMLElement){
|
|
46
|
+
this.msgElement.appendChild(content);
|
|
47
|
+
}else{
|
|
48
|
+
this.msgElement.innerHTML = content;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.table.element.appendChild(this.element);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
clear(){
|
|
56
|
+
if(this.element.parentNode){
|
|
57
|
+
this.element.parentNode.removeChild(this.element);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.msgElement.classList.remove(this._typeClass());
|
|
61
|
+
}
|
|
62
62
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export default class ComponentFunctionBinder{
|
|
2
|
-
|
|
3
|
-
constructor(table){
|
|
4
|
-
this.table = table;
|
|
5
|
-
|
|
6
|
-
this.bindings = {};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
bind(type, funcName, handler){
|
|
10
|
-
if(!this.bindings[type]){
|
|
11
|
-
this.bindings[type] = {};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if(this.bindings[type][funcName]){
|
|
15
|
-
console.warn("Unable to bind component handler, a matching function name is already bound", type, funcName, handler);
|
|
16
|
-
}else{
|
|
17
|
-
this.bindings[type][funcName] = handler;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
handle(type, component, name){
|
|
22
|
-
if(this.bindings[type] && this.bindings[type][name] && typeof this.bindings[type][name].bind === 'function'){
|
|
23
|
-
return this.bindings[type][name].bind(null, component);
|
|
24
|
-
}else{
|
|
25
|
-
if(name !== "then" && typeof name === "string" && !name.startsWith("_")){
|
|
26
|
-
if(this.table.options.debugInvalidComponentFuncs){
|
|
27
|
-
console.error("The " + type + " component does not have a " + name + " function, have you checked that you have the correct Tabulator module installed?");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
export default class ComponentFunctionBinder{
|
|
2
|
+
|
|
3
|
+
constructor(table){
|
|
4
|
+
this.table = table;
|
|
5
|
+
|
|
6
|
+
this.bindings = {};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
bind(type, funcName, handler){
|
|
10
|
+
if(!this.bindings[type]){
|
|
11
|
+
this.bindings[type] = {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if(this.bindings[type][funcName]){
|
|
15
|
+
console.warn("Unable to bind component handler, a matching function name is already bound", type, funcName, handler);
|
|
16
|
+
}else{
|
|
17
|
+
this.bindings[type][funcName] = handler;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
handle(type, component, name){
|
|
22
|
+
if(this.bindings[type] && this.bindings[type][name] && typeof this.bindings[type][name].bind === 'function'){
|
|
23
|
+
return this.bindings[type][name].bind(null, component);
|
|
24
|
+
}else{
|
|
25
|
+
if(name !== "then" && typeof name === "string" && !name.startsWith("_")){
|
|
26
|
+
if(this.table.options.debugInvalidComponentFuncs){
|
|
27
|
+
console.error("The " + type + " component does not have a " + name + " function, have you checked that you have the correct Tabulator module installed?");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
import CoreFeature from '../CoreFeature.js';
|
|
2
|
-
|
|
3
|
-
export default class DataLoader extends CoreFeature{
|
|
4
|
-
constructor(table){
|
|
5
|
-
super(table);
|
|
6
|
-
|
|
7
|
-
this.requestOrder = 0; //prevent requests coming out of sequence if overridden by another load request
|
|
8
|
-
this.loading = false;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
initialize(){}
|
|
12
|
-
|
|
13
|
-
load(data, params, config, replace, silent, columnsChanged){
|
|
14
|
-
var requestNo = ++this.requestOrder;
|
|
15
|
-
|
|
16
|
-
this.dispatchExternal("dataLoading", data);
|
|
17
|
-
|
|
18
|
-
//parse json data to array
|
|
19
|
-
if (data && (data.indexOf("{") == 0 || data.indexOf("[") == 0)){
|
|
20
|
-
data = JSON.parse(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if(this.confirm("data-loading", [data, params, config, silent])){
|
|
24
|
-
this.loading = true;
|
|
25
|
-
|
|
26
|
-
if(!silent){
|
|
27
|
-
this.alertLoader();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
//get params for request
|
|
31
|
-
params = this.chain("data-params", [data, config, silent], params || {}, params || {});
|
|
32
|
-
|
|
33
|
-
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
34
|
-
|
|
35
|
-
var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
|
|
36
|
-
|
|
37
|
-
return result.then((response) => {
|
|
38
|
-
if(!Array.isArray(response) && typeof response == "object"){
|
|
39
|
-
response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var rowData = this.chain("data-loaded", response, null, response);
|
|
43
|
-
|
|
44
|
-
if(requestNo == this.requestOrder){
|
|
45
|
-
this.clearAlert();
|
|
46
|
-
|
|
47
|
-
if(rowData !== false){
|
|
48
|
-
this.dispatchExternal("dataLoaded", rowData);
|
|
49
|
-
this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
50
|
-
}
|
|
51
|
-
}else{
|
|
52
|
-
console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
|
|
53
|
-
}
|
|
54
|
-
}).catch((error) => {
|
|
55
|
-
console.error("Data Load Error: ", error);
|
|
56
|
-
this.dispatchExternal("dataLoadError", error);
|
|
57
|
-
|
|
58
|
-
if(!silent){
|
|
59
|
-
this.alertError();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
this.clearAlert();
|
|
64
|
-
}, this.table.options.dataLoaderErrorTimeout);
|
|
65
|
-
})
|
|
66
|
-
.finally(() => {
|
|
67
|
-
this.loading = false;
|
|
68
|
-
});
|
|
69
|
-
}else{
|
|
70
|
-
this.dispatchExternal("dataLoaded", data);
|
|
71
|
-
|
|
72
|
-
if(!data){
|
|
73
|
-
data = [];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
77
|
-
return Promise.resolve();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
mapParams(params, map){
|
|
82
|
-
var output = {};
|
|
83
|
-
|
|
84
|
-
for(let key in params){
|
|
85
|
-
output[map.hasOwnProperty(key) ? map[key] : key] = params[key];
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return output;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
objectInvert(obj){
|
|
92
|
-
var output = {};
|
|
93
|
-
|
|
94
|
-
for(let key in obj){
|
|
95
|
-
output[obj[key]] = key;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return output;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
blockActiveLoad(){
|
|
102
|
-
this.requestOrder++;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
alertLoader(){
|
|
106
|
-
var shouldLoad = typeof this.table.options.dataLoader === "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
|
|
107
|
-
|
|
108
|
-
if(shouldLoad){
|
|
109
|
-
this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
alertError(){
|
|
114
|
-
this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
clearAlert(){
|
|
118
|
-
this.table.alertManager.clear();
|
|
119
|
-
}
|
|
1
|
+
import CoreFeature from '../CoreFeature.js';
|
|
2
|
+
|
|
3
|
+
export default class DataLoader extends CoreFeature{
|
|
4
|
+
constructor(table){
|
|
5
|
+
super(table);
|
|
6
|
+
|
|
7
|
+
this.requestOrder = 0; //prevent requests coming out of sequence if overridden by another load request
|
|
8
|
+
this.loading = false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
initialize(){}
|
|
12
|
+
|
|
13
|
+
load(data, params, config, replace, silent, columnsChanged){
|
|
14
|
+
var requestNo = ++this.requestOrder;
|
|
15
|
+
|
|
16
|
+
this.dispatchExternal("dataLoading", data);
|
|
17
|
+
|
|
18
|
+
//parse json data to array
|
|
19
|
+
if (data && (data.indexOf("{") == 0 || data.indexOf("[") == 0)){
|
|
20
|
+
data = JSON.parse(data);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if(this.confirm("data-loading", [data, params, config, silent])){
|
|
24
|
+
this.loading = true;
|
|
25
|
+
|
|
26
|
+
if(!silent){
|
|
27
|
+
this.alertLoader();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//get params for request
|
|
31
|
+
params = this.chain("data-params", [data, config, silent], params || {}, params || {});
|
|
32
|
+
|
|
33
|
+
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
34
|
+
|
|
35
|
+
var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
|
|
36
|
+
|
|
37
|
+
return result.then((response) => {
|
|
38
|
+
if(!Array.isArray(response) && typeof response == "object"){
|
|
39
|
+
response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var rowData = this.chain("data-loaded", response, null, response);
|
|
43
|
+
|
|
44
|
+
if(requestNo == this.requestOrder){
|
|
45
|
+
this.clearAlert();
|
|
46
|
+
|
|
47
|
+
if(rowData !== false){
|
|
48
|
+
this.dispatchExternal("dataLoaded", rowData);
|
|
49
|
+
this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
50
|
+
}
|
|
51
|
+
}else{
|
|
52
|
+
console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
|
|
53
|
+
}
|
|
54
|
+
}).catch((error) => {
|
|
55
|
+
console.error("Data Load Error: ", error);
|
|
56
|
+
this.dispatchExternal("dataLoadError", error);
|
|
57
|
+
|
|
58
|
+
if(!silent){
|
|
59
|
+
this.alertError();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.clearAlert();
|
|
64
|
+
}, this.table.options.dataLoaderErrorTimeout);
|
|
65
|
+
})
|
|
66
|
+
.finally(() => {
|
|
67
|
+
this.loading = false;
|
|
68
|
+
});
|
|
69
|
+
}else{
|
|
70
|
+
this.dispatchExternal("dataLoaded", data);
|
|
71
|
+
|
|
72
|
+
if(!data){
|
|
73
|
+
data = [];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
77
|
+
return Promise.resolve();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
mapParams(params, map){
|
|
82
|
+
var output = {};
|
|
83
|
+
|
|
84
|
+
for(let key in params){
|
|
85
|
+
output[map.hasOwnProperty(key) ? map[key] : key] = params[key];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return output;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
objectInvert(obj){
|
|
92
|
+
var output = {};
|
|
93
|
+
|
|
94
|
+
for(let key in obj){
|
|
95
|
+
output[obj[key]] = key;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return output;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
blockActiveLoad(){
|
|
102
|
+
this.requestOrder++;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
alertLoader(){
|
|
106
|
+
var shouldLoad = typeof this.table.options.dataLoader === "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
|
|
107
|
+
|
|
108
|
+
if(shouldLoad){
|
|
109
|
+
this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
alertError(){
|
|
114
|
+
this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
clearAlert(){
|
|
118
|
+
this.table.alertManager.clear();
|
|
119
|
+
}
|
|
120
120
|
}
|