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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import CoreFeature from '../CoreFeature.js';
|
|
2
2
|
import Helpers from './Helpers.js';
|
|
3
|
+
import Row from '../row/Row.js';
|
|
3
4
|
|
|
4
5
|
export default class InteractionManager extends CoreFeature {
|
|
5
6
|
|
|
@@ -31,20 +32,34 @@ export default class InteractionManager extends CoreFeature {
|
|
|
31
32
|
"tabulator-group":"group",
|
|
32
33
|
"tabulator-col":"column",
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
|
|
35
36
|
this.pseudoTrackers = {
|
|
36
|
-
"row":
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
"row":{
|
|
38
|
+
subscriber:null,
|
|
39
|
+
target:null,
|
|
40
|
+
},
|
|
41
|
+
"cell":{
|
|
42
|
+
subscriber:null,
|
|
43
|
+
target:null,
|
|
44
|
+
},
|
|
45
|
+
"group":{
|
|
46
|
+
subscriber:null,
|
|
47
|
+
target:null,
|
|
48
|
+
},
|
|
49
|
+
"column":{
|
|
50
|
+
subscriber:null,
|
|
51
|
+
target:null,
|
|
52
|
+
},
|
|
40
53
|
}
|
|
54
|
+
|
|
55
|
+
this.pseudoTracking = false;
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
initialize(){
|
|
44
59
|
this.el = this.table.element;
|
|
60
|
+
|
|
45
61
|
this.buildListenerMap();
|
|
46
62
|
this.bindSubscriptionWatchers();
|
|
47
|
-
this.bindPseudoEvents();
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
buildListenerMap(){
|
|
@@ -59,53 +74,55 @@ export default class InteractionManager extends CoreFeature {
|
|
|
59
74
|
|
|
60
75
|
this.listeners = listenerMap;
|
|
61
76
|
}
|
|
62
|
-
|
|
77
|
+
|
|
63
78
|
bindPseudoEvents(){
|
|
64
79
|
Object.keys(this.pseudoTrackers).forEach((key) => {
|
|
65
|
-
this.
|
|
66
|
-
|
|
80
|
+
this.pseudoTrackers[key].subscriber = this.pseudoMouseEnter.bind(this, key);
|
|
81
|
+
this.subscribe(key + "-mouseover", this.pseudoTrackers[key].subscriber);
|
|
67
82
|
});
|
|
83
|
+
|
|
84
|
+
this.pseudoTracking = true;
|
|
68
85
|
}
|
|
69
|
-
|
|
86
|
+
|
|
70
87
|
pseudoMouseEnter(key, e, target){
|
|
71
|
-
if(this.pseudoTrackers[key] !== target){
|
|
88
|
+
if(this.pseudoTrackers[key].target !== target){
|
|
72
89
|
|
|
73
|
-
if(this.pseudoTrackers[key]){
|
|
90
|
+
if(this.pseudoTrackers[key].target){
|
|
74
91
|
this.dispatch(key + "-mouseleave", e, target);
|
|
75
92
|
}
|
|
76
|
-
|
|
93
|
+
|
|
77
94
|
this.pseudoMouseLeave(key, e);
|
|
78
|
-
|
|
79
|
-
this.pseudoTrackers[key] = target;
|
|
80
|
-
|
|
95
|
+
|
|
96
|
+
this.pseudoTrackers[key].target = target;
|
|
97
|
+
|
|
81
98
|
this.dispatch(key + "-mouseenter", e, target);
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
|
|
101
|
+
|
|
85
102
|
pseudoMouseLeave(key, e){
|
|
86
103
|
var leaveList = Object.keys(this.pseudoTrackers),
|
|
87
104
|
linkedKeys = {
|
|
88
105
|
"row":["cell"],
|
|
89
106
|
"cell":["row"],
|
|
90
107
|
};
|
|
91
|
-
|
|
108
|
+
|
|
92
109
|
leaveList = leaveList.filter((item) => {
|
|
93
110
|
var links = linkedKeys[key];
|
|
94
111
|
return item !== key && (!links || (links && !links.includes(item)));
|
|
95
112
|
});
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
|
|
114
|
+
|
|
98
115
|
leaveList.forEach((key) => {
|
|
99
|
-
var target = this.pseudoTrackers[key];
|
|
100
|
-
|
|
101
|
-
if(this.pseudoTrackers[key]){
|
|
116
|
+
var target = this.pseudoTrackers[key].target;
|
|
117
|
+
|
|
118
|
+
if(this.pseudoTrackers[key].target){
|
|
102
119
|
this.dispatch(key + "-mouseleave", e, target);
|
|
103
|
-
|
|
104
|
-
this.pseudoTrackers[key] = null;
|
|
120
|
+
|
|
121
|
+
this.pseudoTrackers[key].target = null;
|
|
105
122
|
}
|
|
106
123
|
});
|
|
107
124
|
}
|
|
108
|
-
|
|
125
|
+
|
|
109
126
|
|
|
110
127
|
bindSubscriptionWatchers(){
|
|
111
128
|
var listeners = Object.keys(this.listeners),
|
|
@@ -141,6 +158,10 @@ export default class InteractionManager extends CoreFeature {
|
|
|
141
158
|
}
|
|
142
159
|
}
|
|
143
160
|
|
|
161
|
+
if((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking){
|
|
162
|
+
this.bindPseudoEvents();
|
|
163
|
+
}
|
|
164
|
+
|
|
144
165
|
if(changed){
|
|
145
166
|
this.updateEventListeners();
|
|
146
167
|
}
|
|
@@ -170,10 +191,10 @@ export default class InteractionManager extends CoreFeature {
|
|
|
170
191
|
|
|
171
192
|
var targets = this.findTargets(path);
|
|
172
193
|
targets = this.bindComponents(type, targets);
|
|
173
|
-
|
|
194
|
+
|
|
174
195
|
this.triggerEvents(type, e, targets);
|
|
175
|
-
|
|
176
|
-
if((type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
|
|
196
|
+
|
|
197
|
+
if(this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
|
|
177
198
|
this.pseudoMouseLeave("none", e);
|
|
178
199
|
}
|
|
179
200
|
}
|
|
@@ -227,12 +248,16 @@ export default class InteractionManager extends CoreFeature {
|
|
|
227
248
|
switch(key){
|
|
228
249
|
case "row":
|
|
229
250
|
case "group":
|
|
230
|
-
if(listener.components.includes("row") || listener.components.includes("cell")){
|
|
251
|
+
if(listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")){
|
|
231
252
|
let rows = this.table.rowManager.getVisibleRows(true);
|
|
232
253
|
|
|
233
254
|
component = rows.find((row) => {
|
|
234
255
|
return row.getElement() === target;
|
|
235
256
|
});
|
|
257
|
+
|
|
258
|
+
if(targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
|
|
259
|
+
targets[key] = false;
|
|
260
|
+
}
|
|
236
261
|
}
|
|
237
262
|
break;
|
|
238
263
|
|
|
@@ -244,7 +269,13 @@ export default class InteractionManager extends CoreFeature {
|
|
|
244
269
|
|
|
245
270
|
case "cell":
|
|
246
271
|
if(listener.components.includes("cell")){
|
|
247
|
-
|
|
272
|
+
if(targets["row"] instanceof Row){
|
|
273
|
+
component = targets["row"].findCell(target);
|
|
274
|
+
}else{
|
|
275
|
+
if(targets["row"]){
|
|
276
|
+
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?")
|
|
277
|
+
}
|
|
278
|
+
}
|
|
248
279
|
}
|
|
249
280
|
break;
|
|
250
281
|
}
|
|
@@ -277,7 +308,7 @@ export default class InteractionManager extends CoreFeature {
|
|
|
277
308
|
clearWatchers(){
|
|
278
309
|
for(let key in this.listeners){
|
|
279
310
|
let listener = this.listeners[key];
|
|
280
|
-
|
|
311
|
+
|
|
281
312
|
if(listener.handler){
|
|
282
313
|
this.el.removeEventListener(key, listener.handler)
|
|
283
314
|
listener.handler = null;
|
|
@@ -56,19 +56,31 @@ export default class ModuleBinder {
|
|
|
56
56
|
|
|
57
57
|
//ensure that module are bound to instantiated function
|
|
58
58
|
tabulator.prototype.bindModules = function(){
|
|
59
|
+
var orderedMods = [],
|
|
60
|
+
unOrderedMods = [];
|
|
61
|
+
|
|
59
62
|
this.modules = {};
|
|
60
63
|
|
|
61
64
|
for(var name in tabulator.moduleBindings){
|
|
62
65
|
let mod = tabulator.moduleBindings[name];
|
|
66
|
+
let module = new mod(this);
|
|
63
67
|
|
|
64
|
-
this.modules[name] =
|
|
68
|
+
this.modules[name] = module;
|
|
65
69
|
|
|
66
70
|
if(mod.prototype.moduleCore){
|
|
67
|
-
this.modulesCore
|
|
71
|
+
this.modulesCore.push(module);
|
|
68
72
|
}else{
|
|
69
|
-
|
|
73
|
+
if(mod.moduleInitOrder){
|
|
74
|
+
orderedMods.push(module);
|
|
75
|
+
}else{
|
|
76
|
+
unOrderedMods.push(module);
|
|
77
|
+
}
|
|
70
78
|
}
|
|
71
79
|
}
|
|
80
|
+
|
|
81
|
+
orderedMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
|
|
82
|
+
|
|
83
|
+
this.modulesRegular = orderedMods.concat(unOrderedMods);
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
|
|
@@ -6,145 +6,125 @@ import defaultLoaderPromise from './defaults/loaderPromise.js';
|
|
|
6
6
|
import defaultContentTypeFormatters from './defaults/contentTypeFormatters.js';
|
|
7
7
|
|
|
8
8
|
class Ajax extends Module{
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
constructor(table){
|
|
11
11
|
super(table);
|
|
12
|
-
|
|
13
|
-
this.config =
|
|
12
|
+
|
|
13
|
+
this.config = {}; //hold config object for ajax request
|
|
14
14
|
this.url = ""; //request URL
|
|
15
15
|
this.urlGenerator = false;
|
|
16
16
|
this.params = false; //request parameters
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
this.loaderPromise = false;
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
this.registerTableOption("ajaxURL", false); //url for ajax loading
|
|
21
21
|
this.registerTableOption("ajaxURLGenerator", false);
|
|
22
22
|
this.registerTableOption("ajaxParams", {}); //params for ajax loading
|
|
23
23
|
this.registerTableOption("ajaxConfig", "get"); //ajax request type
|
|
24
24
|
this.registerTableOption("ajaxContentType", "form"); //ajax request type
|
|
25
25
|
this.registerTableOption("ajaxRequestFunc", false); //promise function
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
this.registerTableOption("ajaxRequesting", function(){});
|
|
28
28
|
this.registerTableOption("ajaxResponse", false);
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
this.contentTypeFormatters = Ajax.contentTypeFormatters;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
//initialize setup options
|
|
34
34
|
initialize(){
|
|
35
35
|
this.loaderPromise = this.table.options.ajaxRequestFunc || Ajax.defaultLoaderPromise;
|
|
36
36
|
this.urlGenerator = this.table.options.ajaxURLGenerator || Ajax.defaultURLGenerator;
|
|
37
|
-
|
|
38
|
-
if(this.table.options.ajaxParams){
|
|
39
|
-
this.setParams(this.table.options.ajaxParams);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if(this.table.options.ajaxConfig){
|
|
43
|
-
this.setConfig(this.table.options.ajaxConfig);
|
|
44
|
-
}
|
|
45
|
-
|
|
37
|
+
|
|
46
38
|
if(this.table.options.ajaxURL){
|
|
47
39
|
this.setUrl(this.table.options.ajaxURL);
|
|
48
40
|
}
|
|
49
41
|
|
|
50
|
-
this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
|
|
51
42
|
|
|
43
|
+
this.setDefaultConfig(this.table.options.ajaxConfig);
|
|
44
|
+
|
|
45
|
+
this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
|
|
46
|
+
|
|
52
47
|
this.subscribe("data-loading", this.requestDataCheck.bind(this));
|
|
48
|
+
this.subscribe("data-params", this.requestParams.bind(this));
|
|
53
49
|
this.subscribe("data-load", this.requestData.bind(this));
|
|
54
50
|
}
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
|
|
52
|
+
requestParams(data, config, silent, params){
|
|
53
|
+
var ajaxParams = this.table.options.ajaxParams;
|
|
54
|
+
|
|
55
|
+
if(ajaxParams){
|
|
56
|
+
if(typeof ajaxParams === "function"){
|
|
57
|
+
ajaxParams = ajaxParams.call(this.table);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
params = Object.assign(params, ajaxParams);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return params;
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
requestDataCheck(data, params, config, silent){
|
|
58
67
|
return !!((!data && this.url) || typeof data === "string");
|
|
59
68
|
}
|
|
60
|
-
|
|
61
|
-
requestData(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if(params){
|
|
68
|
-
this.setParams(params, true);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if(config){
|
|
72
|
-
this.setConfig(config);
|
|
69
|
+
|
|
70
|
+
requestData(url, params, config, silent, previousData){
|
|
71
|
+
var ajaxConfig;
|
|
72
|
+
|
|
73
|
+
if(!previousData && this.requestDataCheck(url)){
|
|
74
|
+
if(url){
|
|
75
|
+
this.setUrl(url);
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
|
|
78
|
+
ajaxConfig = this.generateConfig(config);
|
|
79
|
+
|
|
80
|
+
return this.sendRequest(this.url, params, ajaxConfig);
|
|
76
81
|
}else{
|
|
77
82
|
return previousData;
|
|
78
83
|
}
|
|
79
84
|
}
|
|
85
|
+
|
|
86
|
+
setDefaultConfig(config = {}){
|
|
87
|
+
this.config = Object.assign({}, Ajax.defaultConfig);
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if(update){
|
|
84
|
-
this.params = this.params || {};
|
|
85
|
-
|
|
86
|
-
for(let key in params){
|
|
87
|
-
this.params[key] = params[key];
|
|
88
|
-
}
|
|
89
|
+
if(typeof config == "string"){
|
|
90
|
+
this.config.method = config;
|
|
89
91
|
}else{
|
|
90
|
-
this.
|
|
92
|
+
Object.assign(this.config, config);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
|
-
|
|
94
|
-
getParams(){
|
|
95
|
-
return this.params || {};
|
|
96
|
-
}
|
|
97
|
-
|
|
95
|
+
|
|
98
96
|
//load config object
|
|
99
|
-
|
|
100
|
-
this.
|
|
101
|
-
|
|
97
|
+
generateConfig(config = {}){
|
|
98
|
+
var ajaxConfig = Object.assign({}, this.config)
|
|
99
|
+
|
|
102
100
|
if(typeof config == "string"){
|
|
103
|
-
|
|
101
|
+
ajaxConfig.method = config;
|
|
104
102
|
}else{
|
|
105
|
-
|
|
106
|
-
this.config[key] = config[key];
|
|
107
|
-
}
|
|
103
|
+
Object.assign(ajaxConfig, config);
|
|
108
104
|
}
|
|
105
|
+
|
|
106
|
+
return ajaxConfig;
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
//create config object from default
|
|
112
|
-
_loadDefaultConfig(force){
|
|
113
|
-
if(!this.config || force){
|
|
114
|
-
|
|
115
|
-
this.config = {};
|
|
116
|
-
|
|
117
|
-
//load base config from defaults
|
|
118
|
-
for(let key in Ajax.defaultConfig){
|
|
119
|
-
this.config[key] = Ajax.defaultConfig[key];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
108
|
+
|
|
124
109
|
//set request url
|
|
125
110
|
setUrl(url){
|
|
126
111
|
this.url = url;
|
|
127
112
|
}
|
|
128
|
-
|
|
113
|
+
|
|
129
114
|
//get request url
|
|
130
115
|
getUrl(){
|
|
131
116
|
return this.url;
|
|
132
117
|
}
|
|
133
|
-
|
|
118
|
+
|
|
134
119
|
//send ajax request
|
|
135
|
-
sendRequest(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this._loadDefaultConfig();
|
|
140
|
-
|
|
141
|
-
if(this.table.options.ajaxRequesting.call(this.table, this.url, this.params) !== false){
|
|
142
|
-
return this.loaderPromise(url, this.config, this.params)
|
|
120
|
+
sendRequest(url, params, config){
|
|
121
|
+
if(this.table.options.ajaxRequesting.call(this.table, url, params) !== false){
|
|
122
|
+
return this.loaderPromise(url, config, params)
|
|
143
123
|
.then((data)=>{
|
|
144
124
|
if(this.table.options.ajaxResponse){
|
|
145
|
-
data = this.table.options.ajaxResponse.call(this.table,
|
|
125
|
+
data = this.table.options.ajaxResponse.call(this.table, url, params, data);
|
|
146
126
|
}
|
|
147
|
-
|
|
127
|
+
|
|
148
128
|
return data;
|
|
149
129
|
});
|
|
150
130
|
}else{
|
|
@@ -51,7 +51,7 @@ class ColumnCalcs extends Module{
|
|
|
51
51
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
52
52
|
this.subscribe("column-moved", this.recalcActiveRows.bind(this));
|
|
53
53
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
54
|
-
this.subscribe("data-
|
|
54
|
+
this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
|
|
55
55
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
56
56
|
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
57
57
|
|
|
@@ -331,12 +331,12 @@ class ColumnCalcs extends Module{
|
|
|
331
331
|
|
|
332
332
|
rowsToData(rows){
|
|
333
333
|
var data = [];
|
|
334
|
-
|
|
334
|
+
|
|
335
335
|
rows.forEach((row) => {
|
|
336
336
|
data.push(row.getData());
|
|
337
337
|
|
|
338
338
|
if(this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs){
|
|
339
|
-
if(row.modules.dataTree.open){
|
|
339
|
+
if(row.modules.dataTree && row.modules.dataTree.open){
|
|
340
340
|
var children = this.rowsToData(this.table.modules.dataTree.getFilteredTreeChildren(row));
|
|
341
341
|
data = data.concat(children);
|
|
342
342
|
}
|
|
@@ -38,6 +38,7 @@ class DataTree extends Module{
|
|
|
38
38
|
this.registerComponentFunction("row", "getTreeParent", this.getTreeParent.bind(this));
|
|
39
39
|
this.registerComponentFunction("row", "getTreeChildren", this.getRowChildren.bind(this));
|
|
40
40
|
this.registerComponentFunction("row", "addTreeChild", this.addTreeChildRow.bind(this));
|
|
41
|
+
this.registerComponentFunction("row", "isTreeExpanded", this.isRowExpanded.bind(this));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
initialize(){
|
|
@@ -410,6 +411,10 @@ class DataTree extends Module{
|
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
isRowExpanded(row){
|
|
415
|
+
return row.modules.dataTree.open;
|
|
416
|
+
}
|
|
417
|
+
|
|
413
418
|
getTreeParent(row){
|
|
414
419
|
return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false;
|
|
415
420
|
}
|
|
@@ -574,7 +579,6 @@ class DataTree extends Module{
|
|
|
574
579
|
}
|
|
575
580
|
|
|
576
581
|
redrawNeeded(data){
|
|
577
|
-
console.log("needed?", data)
|
|
578
582
|
return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
|
|
579
583
|
}
|
|
580
584
|
}
|
|
@@ -19,7 +19,7 @@ export default function(list, options, setFileContents){
|
|
|
19
19
|
case "row":
|
|
20
20
|
row.columns.forEach((col) => {
|
|
21
21
|
if(col){
|
|
22
|
-
item[col.component.getField()] = col.value;
|
|
22
|
+
item[col.component.getTitleDownload() || col.component.getField()] = col.value;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default function (list, options, setFileContents) {
|
|
2
|
+
const fileContents = [];
|
|
3
|
+
|
|
4
|
+
list.forEach((row) => {
|
|
5
|
+
const item = {};
|
|
6
|
+
|
|
7
|
+
switch (row.type) {
|
|
8
|
+
case "header":
|
|
9
|
+
break;
|
|
10
|
+
|
|
11
|
+
case "group":
|
|
12
|
+
console.warn("Download Warning - JSON downloader cannot process row groups");
|
|
13
|
+
break;
|
|
14
|
+
|
|
15
|
+
case "calc":
|
|
16
|
+
console.warn("Download Warning - JSON downloader cannot process column calculations");
|
|
17
|
+
break;
|
|
18
|
+
|
|
19
|
+
case "row":
|
|
20
|
+
row.columns.forEach((col) => {
|
|
21
|
+
if (col) {
|
|
22
|
+
item[col.component.getTitleDownload() || col.component.getField()] = col.value;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
fileContents.push(JSON.stringify(item));
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
setFileContents(fileContents.join("\n"), "application/x-ndjson");
|
|
32
|
+
};
|
|
@@ -3,10 +3,12 @@ import json from './downloaders/json.js';
|
|
|
3
3
|
import pdf from './downloaders/pdf.js';
|
|
4
4
|
import xlsx from './downloaders/xlsx.js';
|
|
5
5
|
import html from './downloaders/html.js';
|
|
6
|
+
import jsonLines from './downloaders/jsonLines.js';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
csv:csv,
|
|
9
10
|
json:json,
|
|
11
|
+
jsonLines:jsonLines,
|
|
10
12
|
pdf:pdf,
|
|
11
13
|
xlsx:xlsx,
|
|
12
14
|
html:html,
|
|
@@ -52,14 +52,14 @@ class Edit extends Module{
|
|
|
52
52
|
this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
|
|
53
53
|
this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
|
|
54
54
|
this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
|
|
55
|
-
this.subscribe("data-
|
|
55
|
+
this.subscribe("data-refreshing", this.cancelEdit.bind(this));
|
|
56
56
|
|
|
57
|
-
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this));
|
|
57
|
+
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
|
|
58
58
|
this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
|
|
59
|
-
this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this));
|
|
60
|
-
this.subscribe("keybinding-nav-right", this.navigateRight.bind(this));
|
|
61
|
-
this.subscribe("keybinding-nav-up", this.navigateUp.bind(this));
|
|
62
|
-
this.subscribe("keybinding-nav-down", this.navigateDown.bind(this));
|
|
59
|
+
this.subscribe("keybinding-nav-left", this.navigateLeft.bind(this, undefined));
|
|
60
|
+
this.subscribe("keybinding-nav-right", this.navigateRight.bind(this, undefined));
|
|
61
|
+
this.subscribe("keybinding-nav-up", this.navigateUp.bind(this, undefined));
|
|
62
|
+
this.subscribe("keybinding-nav-down", this.navigateDown.bind(this, undefined));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
|
|
@@ -72,7 +72,7 @@ class Edit extends Module{
|
|
|
72
72
|
newRow = this.options("tabEndNewRow");
|
|
73
73
|
|
|
74
74
|
if(cell){
|
|
75
|
-
if(!this.navigateNext(e)){
|
|
75
|
+
if(!this.navigateNext(cell, e)){
|
|
76
76
|
if(newRow){
|
|
77
77
|
cell.getElement().firstChild.blur();
|
|
78
78
|
|
|
@@ -88,7 +88,7 @@ class Edit extends Module{
|
|
|
88
88
|
|
|
89
89
|
newRow.then(() => {
|
|
90
90
|
setTimeout(() => {
|
|
91
|
-
|
|
91
|
+
cell.getComponent().navigateNext();
|
|
92
92
|
})
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -118,7 +118,7 @@ class Edit extends Module{
|
|
|
118
118
|
///////////////////////////////////
|
|
119
119
|
clearCellEdited(cells){
|
|
120
120
|
if(!cells){
|
|
121
|
-
cells = this.modules.edit.getEditedCells();
|
|
121
|
+
cells = this.table.modules.edit.getEditedCells();
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if(!Array.isArray(cells)){
|
|
@@ -126,13 +126,12 @@ class Edit extends Module{
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
cells.forEach((cell) => {
|
|
129
|
-
this.modules.edit.clearEdited(cell._getSelf());
|
|
129
|
+
this.table.modules.edit.clearEdited(cell._getSelf());
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
navigatePrev(e){
|
|
134
|
-
var
|
|
135
|
-
nextCell, prevRow;
|
|
133
|
+
navigatePrev(cell = this.currentCell, e){
|
|
134
|
+
var nextCell, prevRow;
|
|
136
135
|
|
|
137
136
|
if(cell){
|
|
138
137
|
|
|
@@ -161,9 +160,8 @@ class Edit extends Module{
|
|
|
161
160
|
return false;
|
|
162
161
|
}
|
|
163
162
|
|
|
164
|
-
navigateNext(e){
|
|
165
|
-
var
|
|
166
|
-
nextCell, nextRow;
|
|
163
|
+
navigateNext(cell = this.currentCell, e){
|
|
164
|
+
var nextCell, nextRow;
|
|
167
165
|
|
|
168
166
|
if(cell){
|
|
169
167
|
|
|
@@ -192,9 +190,8 @@ class Edit extends Module{
|
|
|
192
190
|
return false;
|
|
193
191
|
}
|
|
194
192
|
|
|
195
|
-
navigateLeft(e){
|
|
196
|
-
var
|
|
197
|
-
index, nextCell;
|
|
193
|
+
navigateLeft(cell = this.currentCell, e){
|
|
194
|
+
var index, nextCell;
|
|
198
195
|
|
|
199
196
|
if(cell){
|
|
200
197
|
|
|
@@ -214,9 +211,8 @@ class Edit extends Module{
|
|
|
214
211
|
return false;
|
|
215
212
|
}
|
|
216
213
|
|
|
217
|
-
navigateRight(e){
|
|
218
|
-
var
|
|
219
|
-
index, nextCell;
|
|
214
|
+
navigateRight(cell = this.currentCell, e){
|
|
215
|
+
var index, nextCell;
|
|
220
216
|
|
|
221
217
|
if(cell){
|
|
222
218
|
|
|
@@ -236,9 +232,8 @@ class Edit extends Module{
|
|
|
236
232
|
return false;
|
|
237
233
|
}
|
|
238
234
|
|
|
239
|
-
navigateUp(e){
|
|
240
|
-
var
|
|
241
|
-
index, nextRow;
|
|
235
|
+
navigateUp(cell = this.currentCell, e){
|
|
236
|
+
var index, nextRow;
|
|
242
237
|
|
|
243
238
|
if(cell){
|
|
244
239
|
|
|
@@ -258,9 +253,8 @@ class Edit extends Module{
|
|
|
258
253
|
return false;
|
|
259
254
|
}
|
|
260
255
|
|
|
261
|
-
navigateDown(e){
|
|
262
|
-
var
|
|
263
|
-
index, nextRow;
|
|
256
|
+
navigateDown(cell = this.currentCell, e){
|
|
257
|
+
var index, nextRow;
|
|
264
258
|
|
|
265
259
|
if(cell){
|
|
266
260
|
|
|
@@ -411,14 +405,15 @@ class Edit extends Module{
|
|
|
411
405
|
cellEl = cell.getElement();
|
|
412
406
|
|
|
413
407
|
if(cancel){
|
|
414
|
-
if(cell.validate){
|
|
415
|
-
|
|
408
|
+
if(cell.column.modules.validate && this.table.modExists("validate")){
|
|
409
|
+
this.table.modules.validate.cellValidate(cell);
|
|
416
410
|
}
|
|
417
411
|
}else{
|
|
418
412
|
cellEl.classList.remove("tabulator-validation-fail");
|
|
419
413
|
}
|
|
420
414
|
|
|
421
415
|
cellEl.classList.remove("tabulator-editing");
|
|
416
|
+
|
|
422
417
|
while(cellEl.firstChild) cellEl.removeChild(cellEl.firstChild);
|
|
423
418
|
|
|
424
419
|
cell.row.getElement().classList.remove("tabulator-row-editing");
|
|
@@ -728,4 +723,4 @@ Edit.moduleName = "edit";
|
|
|
728
723
|
Edit.editors = defaultEditors;
|
|
729
724
|
|
|
730
725
|
|
|
731
|
-
export default Edit;
|
|
726
|
+
export default Edit;
|