tabulator-tables 5.0.8 → 5.0.9
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/bower.json +1 -1
- package/build/rollup.js +1 -1
- package/dist/css/tabulator.css +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +4 -0
- 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 +158 -69
- 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 +191 -104
- 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/ColumnManager.js +1 -1
- package/src/js/core/CoreFeature.js +1 -5
- package/src/js/core/RowManager.js +8 -2
- package/src/js/core/column/Column.js +1 -1
- package/src/js/core/defaults/options.js +1 -1
- package/src/js/core/rendering/Renderer.js +2 -1
- package/src/js/core/rendering/renderers/VirtualDomVertical.js +1 -1
- package/src/js/core/tools/DataLoader.js +1 -1
- package/src/js/core/tools/InteractionMonitor.js +123 -49
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +13 -0
- package/src/js/modules/DataTree/DataTree.js +18 -9
- package/src/js/modules/Download/defaults/downloaders/pdf.js +0 -2
- package/src/js/modules/Download/defaults/downloaders/xlsx.js +3 -2
- package/src/js/modules/Edit/Edit.js +1 -8
- package/src/js/modules/Export/Export.js +1 -1
- package/src/js/modules/GroupRows/Group.js +6 -2
- package/src/js/modules/Page/Page.js +6 -9
- package/src/js/modules/SelectRow/SelectRow.js +3 -8
- package/src/scss/tabulator.scss +4 -0
package/package.json
CHANGED
|
@@ -350,7 +350,7 @@ export default class ColumnManager extends CoreFeature {
|
|
|
350
350
|
return this.columnsByIndex[index];
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
|
|
353
|
+
getFirstVisibleColumn(index){
|
|
354
354
|
var index = this.columnsByIndex.findIndex((col) => {
|
|
355
355
|
return col.visible;
|
|
356
356
|
});
|
|
@@ -102,11 +102,7 @@ export default class CoreFeature{
|
|
|
102
102
|
//////////////// Options /////////////////
|
|
103
103
|
//////////////////////////////////////////
|
|
104
104
|
|
|
105
|
-
options(key
|
|
106
|
-
if(typeof value !== "undefined"){
|
|
107
|
-
this.table.options[key] = value;
|
|
108
|
-
}
|
|
109
|
-
|
|
105
|
+
options(key){
|
|
110
106
|
return this.table.options[key];
|
|
111
107
|
}
|
|
112
108
|
|
|
@@ -772,8 +772,14 @@ export default class RowManager extends CoreFeature{
|
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
|
|
775
|
-
getVisibleRows(viewable){
|
|
776
|
-
|
|
775
|
+
getVisibleRows(chain, viewable){
|
|
776
|
+
var rows = Object.assign([], this.renderer.visibleRows(!viewable));
|
|
777
|
+
|
|
778
|
+
if(chain){
|
|
779
|
+
rows = this.chain("rows-visible", [viewable], rows, rows);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return rows;
|
|
777
783
|
}
|
|
778
784
|
|
|
779
785
|
//repeat action accross display rows
|
|
@@ -147,7 +147,7 @@ class Column extends CoreFeature{
|
|
|
147
147
|
var def = this.definition;
|
|
148
148
|
|
|
149
149
|
//set header tooltips
|
|
150
|
-
var tooltip =
|
|
150
|
+
var tooltip = def.headerTooltip;
|
|
151
151
|
|
|
152
152
|
if(tooltip){
|
|
153
153
|
if(tooltip === true){
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
autoColumns:false, //build columns from data row structure
|
|
20
20
|
autoColumnsDefinitions:false,
|
|
21
21
|
|
|
22
|
-
nestedFieldSeparator:".", //
|
|
22
|
+
nestedFieldSeparator:".", //separator for nested data
|
|
23
23
|
|
|
24
24
|
tooltipGenerationMode:"load", //when to generate tooltips
|
|
25
25
|
|
|
@@ -146,8 +146,9 @@ export default class Renderer extends CoreFeature{
|
|
|
146
146
|
if(!ifVisible){
|
|
147
147
|
if(Helpers.elVisible(rowEl)){
|
|
148
148
|
offset = Helpers.elOffset(rowEl).top - Helpers.elOffset(this.elementVertical).top;
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
if(offset > 0 && offset < this.elementVertical.clientHeight - rowEl.offsetHeight){
|
|
151
|
+
resolve();
|
|
151
152
|
return false;
|
|
152
153
|
}
|
|
153
154
|
}
|
|
@@ -44,7 +44,7 @@ export default class VirtualDomVertical extends Renderer{
|
|
|
44
44
|
|
|
45
45
|
element.style.paddingTop = "";
|
|
46
46
|
element.style.paddingBottom = "";
|
|
47
|
-
element.style.minWidth = "";
|
|
47
|
+
// element.style.minWidth = "";
|
|
48
48
|
element.style.minHeight = "";
|
|
49
49
|
element.style.display = "";
|
|
50
50
|
element.style.visibility = "";
|
|
@@ -72,7 +72,7 @@ export default class DataLoader extends CoreFeature{
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
//get params for request
|
|
75
|
-
|
|
75
|
+
params = this.chain("data-params", [data, config, silent], params || {}, params || {});
|
|
76
76
|
|
|
77
77
|
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
78
78
|
|
|
@@ -2,74 +2,131 @@ import CoreFeature from '../CoreFeature.js';
|
|
|
2
2
|
import Helpers from './Helpers.js';
|
|
3
3
|
|
|
4
4
|
export default class InteractionManager extends CoreFeature {
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
constructor (table){
|
|
7
7
|
super(table);
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
this.el = null;
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
this.abortClasses = ["tabulator-headers", "tabulator-table"];
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
this.previousTargets = {};
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
this.listeners = [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
"click",
|
|
17
|
+
"dblclick",
|
|
18
|
+
"contextmenu",
|
|
19
|
+
"mouseenter",
|
|
20
|
+
"mouseleave",
|
|
21
|
+
"mouseover",
|
|
22
|
+
"mouseout",
|
|
23
|
+
"mousemove",
|
|
24
|
+
"touchstart",
|
|
25
|
+
"touchend",
|
|
26
26
|
];
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
this.componentMap = {
|
|
29
29
|
"tabulator-cell":"cell",
|
|
30
30
|
"tabulator-row":"row",
|
|
31
31
|
"tabulator-group":"group",
|
|
32
32
|
"tabulator-col":"column",
|
|
33
33
|
};
|
|
34
|
-
}
|
|
35
34
|
|
|
35
|
+
this.pseudoTrackers = {
|
|
36
|
+
"row":null,
|
|
37
|
+
"cell":null,
|
|
38
|
+
"group":null,
|
|
39
|
+
"column":null,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
initialize(){
|
|
37
44
|
this.el = this.table.element;
|
|
38
45
|
this.buildListenerMap();
|
|
39
46
|
this.bindSubscriptionWatchers();
|
|
47
|
+
this.bindPseudoEvents();
|
|
40
48
|
}
|
|
41
|
-
|
|
49
|
+
|
|
42
50
|
buildListenerMap(){
|
|
43
51
|
var listenerMap = {};
|
|
44
|
-
|
|
52
|
+
|
|
45
53
|
this.listeners.forEach((listener) => {
|
|
46
54
|
listenerMap[listener] = {
|
|
47
55
|
handler:null,
|
|
48
56
|
components:[],
|
|
49
57
|
}
|
|
50
58
|
})
|
|
51
|
-
|
|
59
|
+
|
|
52
60
|
this.listeners = listenerMap;
|
|
53
61
|
}
|
|
54
62
|
|
|
63
|
+
bindPseudoEvents(){
|
|
64
|
+
Object.keys(this.pseudoTrackers).forEach((key) => {
|
|
65
|
+
this.subscribe(key + "-mouseover", this.pseudoMouseEnter.bind(this, key));
|
|
66
|
+
// this.subscribe(key + "-mouseout", this.pseudoMouseLeave.bind(this, key));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pseudoMouseEnter(key, e, target){
|
|
71
|
+
if(this.pseudoTrackers[key] !== target){
|
|
72
|
+
|
|
73
|
+
if(this.pseudoTrackers[key]){
|
|
74
|
+
this.dispatch(key + "-mouseleave", e, target);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.pseudoMouseLeave(key, e);
|
|
78
|
+
|
|
79
|
+
this.pseudoTrackers[key] = target;
|
|
80
|
+
|
|
81
|
+
this.dispatch(key + "-mouseenter", e, target);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
pseudoMouseLeave(key, e){
|
|
86
|
+
var leaveList = Object.keys(this.pseudoTrackers),
|
|
87
|
+
linkedKeys = {
|
|
88
|
+
"row":["cell"],
|
|
89
|
+
"cell":["row"],
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
leaveList = leaveList.filter((item) => {
|
|
93
|
+
var links = linkedKeys[key];
|
|
94
|
+
return item !== key && (!links || (links && !links.includes(item)));
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
leaveList.forEach((key) => {
|
|
99
|
+
var target = this.pseudoTrackers[key];
|
|
100
|
+
|
|
101
|
+
if(this.pseudoTrackers[key]){
|
|
102
|
+
this.dispatch(key + "-mouseleave", e, target);
|
|
103
|
+
|
|
104
|
+
this.pseudoTrackers[key] = null;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
55
110
|
bindSubscriptionWatchers(){
|
|
56
111
|
var listeners = Object.keys(this.listeners),
|
|
57
112
|
components = Object.values(this.componentMap);
|
|
58
|
-
|
|
113
|
+
|
|
59
114
|
for(let comp of components){
|
|
60
115
|
for(let listener of listeners){
|
|
61
116
|
let key = comp + "-" + listener;
|
|
62
|
-
|
|
117
|
+
|
|
63
118
|
this.subscriptionChange(key, this.subscriptionChanged.bind(this, comp, listener));
|
|
64
119
|
}
|
|
65
120
|
}
|
|
121
|
+
|
|
122
|
+
this.subscribe("table-destroy", this.clearWatchers.bind(this))
|
|
66
123
|
}
|
|
67
|
-
|
|
124
|
+
|
|
68
125
|
subscriptionChanged(component, key, added){
|
|
69
126
|
var listener = this.listeners[key].components,
|
|
70
127
|
index = listener.indexOf(component),
|
|
71
128
|
changed = false;
|
|
72
|
-
|
|
129
|
+
|
|
73
130
|
if(added){
|
|
74
131
|
if(index === -1){
|
|
75
132
|
listener.push(component);
|
|
@@ -83,16 +140,16 @@ export default class InteractionManager extends CoreFeature {
|
|
|
83
140
|
}
|
|
84
141
|
}
|
|
85
142
|
}
|
|
86
|
-
|
|
143
|
+
|
|
87
144
|
if(changed){
|
|
88
145
|
this.updateEventListeners();
|
|
89
146
|
}
|
|
90
147
|
}
|
|
91
|
-
|
|
148
|
+
|
|
92
149
|
updateEventListeners(){
|
|
93
150
|
for(let key in this.listeners){
|
|
94
151
|
let listener = this.listeners[key];
|
|
95
|
-
|
|
152
|
+
|
|
96
153
|
if(listener.components.length){
|
|
97
154
|
if(!listener.handler){
|
|
98
155
|
listener.handler = this.track.bind(this, key);
|
|
@@ -107,57 +164,63 @@ export default class InteractionManager extends CoreFeature {
|
|
|
107
164
|
}
|
|
108
165
|
}
|
|
109
166
|
}
|
|
110
|
-
|
|
167
|
+
|
|
111
168
|
track(type, e){
|
|
112
169
|
var path = (e.composedPath && e.composedPath()) || e.path;
|
|
170
|
+
|
|
113
171
|
var targets = this.findTargets(path);
|
|
114
172
|
targets = this.bindComponents(type, targets);
|
|
173
|
+
|
|
115
174
|
this.triggerEvents(type, e, targets);
|
|
116
|
-
}
|
|
117
175
|
|
|
176
|
+
if((type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
|
|
177
|
+
this.pseudoMouseLeave("none", e);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
118
181
|
findTargets(path){
|
|
119
182
|
var targets = {};
|
|
120
|
-
|
|
183
|
+
|
|
121
184
|
let componentMap = Object.keys(this.componentMap);
|
|
122
|
-
|
|
185
|
+
|
|
123
186
|
for (let el of path) {
|
|
124
187
|
let classList = el.classList ? [...el.classList] : [];
|
|
125
|
-
|
|
188
|
+
|
|
126
189
|
let abort = classList.filter((item) => {
|
|
127
190
|
return this.abortClasses.includes(item);
|
|
128
191
|
})
|
|
129
|
-
|
|
192
|
+
|
|
130
193
|
if(abort.length){
|
|
131
194
|
break;
|
|
132
195
|
}
|
|
133
|
-
|
|
196
|
+
|
|
134
197
|
let elTargets = classList.filter((item) => {
|
|
135
198
|
return componentMap.includes(item);
|
|
136
199
|
})
|
|
137
|
-
|
|
200
|
+
|
|
138
201
|
for (let target of elTargets) {
|
|
139
202
|
targets[this.componentMap[target]] = el;
|
|
140
203
|
}
|
|
141
204
|
}
|
|
142
|
-
|
|
205
|
+
|
|
143
206
|
if(targets.group && targets.group === targets.row){
|
|
144
207
|
delete targets.row;
|
|
145
208
|
}
|
|
146
|
-
|
|
209
|
+
|
|
147
210
|
return targets;
|
|
148
211
|
}
|
|
149
|
-
|
|
212
|
+
|
|
150
213
|
bindComponents(type, targets){
|
|
151
214
|
//ensure row component is looked up before cell
|
|
152
215
|
var keys = Object.keys(targets).reverse(),
|
|
153
216
|
listener = this.listeners[type],
|
|
154
217
|
targetMatches = {};
|
|
155
|
-
|
|
218
|
+
|
|
156
219
|
for(let key of keys){
|
|
157
220
|
let component;
|
|
158
221
|
let target = targets[key];
|
|
159
222
|
let previousTarget = this.previousTargets[key];
|
|
160
|
-
|
|
223
|
+
|
|
161
224
|
if(previousTarget && previousTarget.target === target){
|
|
162
225
|
component = previousTarget.component;
|
|
163
226
|
}else{
|
|
@@ -165,20 +228,20 @@ export default class InteractionManager extends CoreFeature {
|
|
|
165
228
|
case "row":
|
|
166
229
|
case "group":
|
|
167
230
|
if(listener.components.includes("row") || listener.components.includes("cell")){
|
|
168
|
-
let rows = this.table.rowManager.getVisibleRows();
|
|
169
|
-
|
|
231
|
+
let rows = this.table.rowManager.getVisibleRows(true);
|
|
232
|
+
|
|
170
233
|
component = rows.find((row) => {
|
|
171
234
|
return row.getElement() === target;
|
|
172
235
|
});
|
|
173
236
|
}
|
|
174
237
|
break;
|
|
175
|
-
|
|
238
|
+
|
|
176
239
|
case "column":
|
|
177
240
|
if(listener.components.includes("column")){
|
|
178
241
|
component = this.table.columnManager.findColumn(target);
|
|
179
242
|
}
|
|
180
243
|
break
|
|
181
|
-
|
|
244
|
+
|
|
182
245
|
case "cell":
|
|
183
246
|
if(listener.components.includes("cell")){
|
|
184
247
|
component = targets["row"].findCell(target);
|
|
@@ -186,7 +249,7 @@ export default class InteractionManager extends CoreFeature {
|
|
|
186
249
|
break;
|
|
187
250
|
}
|
|
188
251
|
}
|
|
189
|
-
|
|
252
|
+
|
|
190
253
|
if(component){
|
|
191
254
|
targets[key] = component;
|
|
192
255
|
targetMatches[key] = {
|
|
@@ -195,19 +258,30 @@ export default class InteractionManager extends CoreFeature {
|
|
|
195
258
|
}
|
|
196
259
|
}
|
|
197
260
|
}
|
|
198
|
-
|
|
261
|
+
|
|
199
262
|
this.previousTargets = targetMatches;
|
|
200
|
-
|
|
263
|
+
|
|
201
264
|
return targets;
|
|
202
265
|
}
|
|
203
|
-
|
|
266
|
+
|
|
204
267
|
triggerEvents(type, e, targets){
|
|
205
268
|
var listener = this.listeners[type];
|
|
206
|
-
|
|
269
|
+
|
|
207
270
|
for(let key in targets){
|
|
208
271
|
if(targets[key] && listener.components.includes(key)){
|
|
209
272
|
this.dispatch(key + "-" + type, e, targets[key]);
|
|
210
273
|
}
|
|
211
274
|
}
|
|
212
275
|
}
|
|
276
|
+
|
|
277
|
+
clearWatchers(){
|
|
278
|
+
for(let key in this.listeners){
|
|
279
|
+
let listener = this.listeners[key];
|
|
280
|
+
|
|
281
|
+
if(listener.handler){
|
|
282
|
+
this.el.removeEventListener(key, listener.handler)
|
|
283
|
+
listener.handler = null;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
213
287
|
}
|
|
@@ -53,6 +53,7 @@ class ColumnCalcs extends Module{
|
|
|
53
53
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
54
54
|
this.subscribe("data-refeshed", this.recalcActiveRows.bind(this));
|
|
55
55
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
56
|
+
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
56
57
|
|
|
57
58
|
this.registerTableFunction("getCalcResults", this.getResults.bind(this));
|
|
58
59
|
this.registerTableFunction("recalc", this.userRecalc.bind(this));
|
|
@@ -78,6 +79,18 @@ class ColumnCalcs extends Module{
|
|
|
78
79
|
///////// Internal Logic //////////
|
|
79
80
|
///////////////////////////////////
|
|
80
81
|
|
|
82
|
+
visibleRows(viewable, rows){
|
|
83
|
+
if(this.topRow){
|
|
84
|
+
rows.unshift(this.topRow);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if(this.botRow){
|
|
88
|
+
rows.push(this.botRow);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return rows;
|
|
92
|
+
}
|
|
93
|
+
|
|
81
94
|
rowsUpdated(row){
|
|
82
95
|
if(this.table.options.groupBy){
|
|
83
96
|
this.recalcRowGroup(this);
|
|
@@ -43,12 +43,10 @@ class DataTree extends Module{
|
|
|
43
43
|
initialize(){
|
|
44
44
|
if(this.table.options.dataTree){
|
|
45
45
|
var dummyEl = null,
|
|
46
|
-
firstCol = this.table.columnManager.getFirstVisibileColumn(),
|
|
47
46
|
options = this.table.options;
|
|
48
47
|
|
|
49
48
|
this.field = options.dataTreeChildField;
|
|
50
49
|
this.indent = options.dataTreeChildIndent;
|
|
51
|
-
this.elementField = options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
|
|
52
50
|
|
|
53
51
|
if(options.dataTreeBranchElement){
|
|
54
52
|
|
|
@@ -117,15 +115,23 @@ class DataTree extends Module{
|
|
|
117
115
|
|
|
118
116
|
this.subscribe("row-init", this.initializeRow.bind(this));
|
|
119
117
|
this.subscribe("row-layout-after", this.layoutRow.bind(this));
|
|
120
|
-
this.subscribe("row-relayout", this.layoutRow.bind(this));
|
|
121
118
|
this.subscribe("row-deleted", this.rowDelete.bind(this),0);
|
|
122
119
|
this.subscribe("row-data-changed", this.rowDataChanged.bind(this), 10);
|
|
120
|
+
this.subscribe("cell-value-updated", this.cellValueChanged.bind(this));
|
|
121
|
+
this.subscribe("edit-cancelled", this.cellValueChanged.bind(this));
|
|
123
122
|
this.subscribe("column-moving-rows", this.columnMoving.bind(this));
|
|
123
|
+
this.subscribe("table-built", this.initializeElementField.bind(this));
|
|
124
124
|
|
|
125
125
|
this.registerDisplayHandler(this.getRows.bind(this), 30);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
initializeElementField(){
|
|
130
|
+
var firstCol = this.table.columnManager.getFirstVisibleColumn();
|
|
131
|
+
|
|
132
|
+
this.elementField = this.table.options.dataTreeElementColumn || (firstCol ? firstCol.field : false);
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
getRowChildren(row){
|
|
130
136
|
return this.getTreeChildren(row, true);
|
|
131
137
|
}
|
|
@@ -151,6 +157,14 @@ class DataTree extends Module{
|
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
|
160
|
+
cellValueChanged(cell){
|
|
161
|
+
var field = cell.column.getField();
|
|
162
|
+
|
|
163
|
+
if(field === this.elementField){
|
|
164
|
+
this.layoutRow(cell.row);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
initializeRow(row){
|
|
155
169
|
var childArray = row.getData()[this.field];
|
|
156
170
|
var isArray = Array.isArray(childArray);
|
|
@@ -555,17 +569,12 @@ class DataTree extends Module{
|
|
|
555
569
|
return output;
|
|
556
570
|
}
|
|
557
571
|
|
|
558
|
-
checkForRestyle(cell){
|
|
559
|
-
if(!cell.row.cells.indexOf(cell)){
|
|
560
|
-
this.layoutRow(cell.row);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
572
|
getChildField(){
|
|
565
573
|
return this.field;
|
|
566
574
|
}
|
|
567
575
|
|
|
568
576
|
redrawNeeded(data){
|
|
577
|
+
console.log("needed?", data)
|
|
569
578
|
return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
|
|
570
579
|
}
|
|
571
580
|
}
|
|
@@ -26,7 +26,9 @@ export default function(list, options, setFileContents){
|
|
|
26
26
|
rowData.push(!(col.value instanceof Date) && typeof col.value === "object" ? JSON.stringify(col.value) : col.value);
|
|
27
27
|
|
|
28
28
|
if(col.width > 1 || col.height > -1){
|
|
29
|
-
|
|
29
|
+
if(col.height > 1 || col.width > 1){
|
|
30
|
+
merges.push({s:{r:i,c:j},e:{r:i + col.height - 1,c:j + col.width - 1}});
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
}else{
|
|
32
34
|
rowData.push("");
|
|
@@ -36,7 +38,6 @@ export default function(list, options, setFileContents){
|
|
|
36
38
|
rows.push(rowData);
|
|
37
39
|
});
|
|
38
40
|
|
|
39
|
-
|
|
40
41
|
//convert rows to worksheet
|
|
41
42
|
XLSX.utils.sheet_add_aoa(worksheet, rows);
|
|
42
43
|
|
|
@@ -442,6 +442,7 @@ class Edit extends Module{
|
|
|
442
442
|
cell.column.definition.cellEditCancelled.call(this.table, component);
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
this.dispatch("edit-cancelled", cell);
|
|
445
446
|
this.dispatchExternal("cellEditCancelled", component);
|
|
446
447
|
}
|
|
447
448
|
}
|
|
@@ -572,10 +573,6 @@ class Edit extends Module{
|
|
|
572
573
|
|
|
573
574
|
cell.setValue(value, true);
|
|
574
575
|
|
|
575
|
-
if(self.table.options.dataTree && self.table.modExists("dataTree")){
|
|
576
|
-
self.table.modules.dataTree.checkForRestyle(cell);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
576
|
if(valid !== true){
|
|
580
577
|
element.classList.add("tabulator-validation-fail");
|
|
581
578
|
self.table.externalEvents.dispatch("validationFailed", cell.getComponent(), value, valid);
|
|
@@ -600,10 +597,6 @@ class Edit extends Module{
|
|
|
600
597
|
function cancel(){
|
|
601
598
|
if(self.currentCell === cell){
|
|
602
599
|
self.cancelEdit();
|
|
603
|
-
|
|
604
|
-
if(self.table.options.dataTree && self.table.modExists("dataTree")){
|
|
605
|
-
self.table.modules.dataTree.checkForRestyle(cell);
|
|
606
|
-
}
|
|
607
600
|
}else{
|
|
608
601
|
// console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited");
|
|
609
602
|
}
|
|
@@ -454,7 +454,7 @@ class Group{
|
|
|
454
454
|
|
|
455
455
|
this.element.classList.add("tabulator-group-visible");
|
|
456
456
|
|
|
457
|
-
var prev = this.
|
|
457
|
+
var prev = this.generateElement();
|
|
458
458
|
|
|
459
459
|
if(this.groupList.length){
|
|
460
460
|
this.groupList.forEach((group) => {
|
|
@@ -572,7 +572,11 @@ class Group{
|
|
|
572
572
|
////////////// Standard Row Functions //////////////
|
|
573
573
|
|
|
574
574
|
getElement(){
|
|
575
|
-
this.
|
|
575
|
+
return this.elementContents ? this.element : this.generateElement();
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
generateElement(){
|
|
579
|
+
this.addBindings = false;
|
|
576
580
|
|
|
577
581
|
this._visSet();
|
|
578
582
|
|
|
@@ -22,13 +22,10 @@ class Page extends Module{
|
|
|
22
22
|
|
|
23
23
|
this.pageSizes = [];
|
|
24
24
|
|
|
25
|
-
this.dataReceivedNames = {}; //TODO - remove once pagimation update is complete
|
|
26
|
-
this.dataSentNames = {}; //TODO - remove once pagimation update is complete
|
|
27
|
-
|
|
28
25
|
this.registerTableOption("pagination", false); //set pagination type
|
|
29
26
|
this.registerTableOption("paginationMode", "local"); //local or remote pagination
|
|
30
27
|
this.registerTableOption("paginationSize", false); //set number of rows to a page
|
|
31
|
-
this.registerTableOption("paginationInitialPage", 1); //
|
|
28
|
+
this.registerTableOption("paginationInitialPage", 1); //initial page to show on load
|
|
32
29
|
this.registerTableOption("paginationButtonCount", 5); // set count of page button
|
|
33
30
|
this.registerTableOption("paginationSizeSelector", false); //add pagination size selector element
|
|
34
31
|
this.registerTableOption("paginationElement", false); //element to hold pagination numbers
|
|
@@ -77,10 +74,10 @@ class Page extends Module{
|
|
|
77
74
|
this.createElements();
|
|
78
75
|
this.initializePaginator();
|
|
79
76
|
}else if(this.table.options.progressiveLoad){
|
|
80
|
-
|
|
81
77
|
this.subscribe("data-params", this.remotePageParams.bind(this));
|
|
82
78
|
this.subscribe("data-loaded", this._parseRemoteData.bind(this));
|
|
83
79
|
this.subscribe("table-built", this.calculatePageSizes.bind(this));
|
|
80
|
+
this.subscribe("data-processed", this.initialLoadComplete.bind(this));
|
|
84
81
|
|
|
85
82
|
this.initializeProgressive(this.table.options.progressiveLoad)
|
|
86
83
|
|
|
@@ -444,7 +441,7 @@ class Page extends Module{
|
|
|
444
441
|
}
|
|
445
442
|
}
|
|
446
443
|
|
|
447
|
-
//set the
|
|
444
|
+
//set the maximum page
|
|
448
445
|
setMaxPage(max){
|
|
449
446
|
|
|
450
447
|
max = parseInt(max);
|
|
@@ -705,7 +702,7 @@ class Page extends Module{
|
|
|
705
702
|
var left, data, margin;
|
|
706
703
|
|
|
707
704
|
if(typeof data.last_page === "undefined"){
|
|
708
|
-
console.warn("Remote Pagination Error - Server response missing '" + this.
|
|
705
|
+
console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").last_page || "last_page") + "' property");
|
|
709
706
|
}
|
|
710
707
|
|
|
711
708
|
if(data.data){
|
|
@@ -729,7 +726,7 @@ class Page extends Module{
|
|
|
729
726
|
break;
|
|
730
727
|
|
|
731
728
|
case "progressive_scroll":
|
|
732
|
-
data = this.table.rowManager.getData().concat(data.data);
|
|
729
|
+
data = this.page === 1 ? data.data : this.table.rowManager.getData().concat(data.data);
|
|
733
730
|
|
|
734
731
|
this.table.rowManager.setData(data, this.page !== 1, this.page == 1);
|
|
735
732
|
|
|
@@ -752,7 +749,7 @@ class Page extends Module{
|
|
|
752
749
|
}
|
|
753
750
|
|
|
754
751
|
}else{
|
|
755
|
-
console.warn("Remote Pagination Error - Server response missing '" + this.
|
|
752
|
+
console.warn("Remote Pagination Error - Server response missing '" + (this.options("dataReceiveParams").data || "data") + "' property");
|
|
756
753
|
}
|
|
757
754
|
|
|
758
755
|
return data.data;
|