tabulator-tables 5.1.1 → 5.1.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/bower.json +1 -1
- package/dist/js/tabulator.js +233 -148
- 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 +551 -485
- 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 +5 -2
- package/src/js/core/FooterManager.js +2 -4
- package/src/js/core/RowManager.js +0 -6
- package/src/js/core/Tabulator.js +13 -30
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +1 -1
- package/src/js/core/row/Row.js +2 -2
- package/src/js/core/tools/InteractionMonitor.js +1 -1
- package/src/js/core/tools/ModuleBinder.js +15 -3
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +9 -4
- package/src/js/modules/Export/Export.js +5 -4
- package/src/js/modules/Filter/Filter.js +4 -3
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +19 -1
- package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +101 -83
- package/src/js/modules/GroupRows/Group.js +144 -142
- package/src/js/modules/Layout/Layout.js +1 -0
- package/src/js/modules/Page/Page.js +6 -3
- package/src/js/modules/Page/defaults/pageCounters/rows.js +21 -13
- package/src/js/modules/Persistence/Persistence.js +6 -4
- package/src/js/modules/Persistence/defaults/readers.js +3 -3
- package/src/js/modules/ResizeColumns/ResizeColumns.js +61 -51
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +1 -1
- package/src/js/modules/SelectRow/SelectRow.js +132 -128
|
@@ -3,7 +3,7 @@ import GroupComponent from './GroupComponent.js';
|
|
|
3
3
|
|
|
4
4
|
//Group functions
|
|
5
5
|
class Group{
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
constructor(groupManager, parent, level, key, field, generator, oldGroup){
|
|
8
8
|
this.groupManager = groupManager;
|
|
9
9
|
this.parent = parent;
|
|
@@ -27,17 +27,17 @@ class Group{
|
|
|
27
27
|
this.initialized = false;
|
|
28
28
|
this.modules = {};
|
|
29
29
|
this.arrowElement = false;
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
this.visible = oldGroup ? oldGroup.visible : (typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]);
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
this.component = null;
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
this.createElements();
|
|
36
36
|
this.addBindings();
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
this.createValueGroups();
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
wipe(){
|
|
42
42
|
if(this.groupList.length){
|
|
43
43
|
this.groupList.forEach(function(group){
|
|
@@ -50,32 +50,32 @@ class Group{
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
this.element = false;
|
|
55
55
|
this.arrowElement = false;
|
|
56
56
|
this.elementContents = false;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
createElements(){
|
|
60
60
|
var arrow = document.createElement("div");
|
|
61
61
|
arrow.classList.add("tabulator-arrow");
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
this.element = document.createElement("div");
|
|
64
64
|
this.element.classList.add("tabulator-row");
|
|
65
65
|
this.element.classList.add("tabulator-group");
|
|
66
66
|
this.element.classList.add("tabulator-group-level-" + this.level);
|
|
67
67
|
this.element.setAttribute("role", "rowgroup");
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
this.arrowElement = document.createElement("div");
|
|
70
70
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
71
71
|
this.arrowElement.appendChild(arrow);
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
//setup movable rows
|
|
74
74
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
75
75
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
createValueGroups(){
|
|
80
80
|
var level = this.level + 1;
|
|
81
81
|
if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
|
|
@@ -84,13 +84,13 @@ class Group{
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
addBindings(){
|
|
89
89
|
var toggleElement;
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
if(this.groupManager.table.options.groupToggleElement){
|
|
92
92
|
toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
toggleElement.addEventListener("click", (e) => {
|
|
95
95
|
e.stopPropagation();
|
|
96
96
|
e.stopImmediatePropagation();
|
|
@@ -98,23 +98,23 @@ class Group{
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
_createGroup(groupID, level){
|
|
103
103
|
var groupKey = level + "_" + groupID;
|
|
104
104
|
var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false);
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
this.groups[groupKey] = group;
|
|
107
107
|
this.groupList.push(group);
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
_addRowToGroup(row){
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
var level = this.level + 1;
|
|
113
|
-
|
|
113
|
+
|
|
114
114
|
if(this.hasSubGroups){
|
|
115
115
|
var groupID = this.groupManager.groupIDLookups[level].func(row.getData()),
|
|
116
116
|
groupKey = level + "_" + groupID;
|
|
117
|
-
|
|
117
|
+
|
|
118
118
|
if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
|
|
119
119
|
if(this.groups[groupKey]){
|
|
120
120
|
this.groups[groupKey].addRow(row);
|
|
@@ -123,24 +123,24 @@ class Group{
|
|
|
123
123
|
if(!this.groups[groupKey]){
|
|
124
124
|
this._createGroup(groupID, level);
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
this.groups[groupKey].addRow(row);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
_addRow(row){
|
|
133
133
|
this.rows.push(row);
|
|
134
134
|
row.modules.group = this;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
insertRow(row, to, after){
|
|
138
138
|
var data = this.conformRowData({});
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
row.updateData(data);
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
var toIndex = this.rows.indexOf(to);
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
if(toIndex > -1){
|
|
145
145
|
if(after){
|
|
146
146
|
this.rows.splice(toIndex+1, 0, row);
|
|
@@ -154,28 +154,30 @@ class Group{
|
|
|
154
154
|
this.rows.unshift(row);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
row.modules.group = this;
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
this.generateGroupHeaderContents();
|
|
161
|
-
|
|
161
|
+
|
|
162
162
|
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
163
163
|
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
|
|
166
166
|
this.groupManager.updateGroupRows(true);
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
scrollHeader(left){
|
|
170
|
-
this.arrowElement
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
if(this.arrowElement){
|
|
171
|
+
this.arrowElement.style.marginLeft = left;
|
|
172
|
+
|
|
173
|
+
this.groupList.forEach(function(child){
|
|
174
|
+
child.scrollHeader(left);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
175
177
|
}
|
|
176
|
-
|
|
178
|
+
|
|
177
179
|
getRowIndex(row){}
|
|
178
|
-
|
|
180
|
+
|
|
179
181
|
//update row data to match grouping contraints
|
|
180
182
|
conformRowData(data){
|
|
181
183
|
if(this.field){
|
|
@@ -183,59 +185,59 @@ class Group{
|
|
|
183
185
|
}else{
|
|
184
186
|
console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function");
|
|
185
187
|
}
|
|
186
|
-
|
|
188
|
+
|
|
187
189
|
if(this.parent){
|
|
188
190
|
data = this.parent.conformRowData(data);
|
|
189
191
|
}
|
|
190
|
-
|
|
192
|
+
|
|
191
193
|
return data;
|
|
192
194
|
}
|
|
193
|
-
|
|
195
|
+
|
|
194
196
|
removeRow(row){
|
|
195
197
|
var index = this.rows.indexOf(row);
|
|
196
198
|
var el = row.getElement();
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
|
|
200
|
+
|
|
199
201
|
if(index > -1){
|
|
200
202
|
this.rows.splice(index, 1);
|
|
201
203
|
}
|
|
202
|
-
|
|
204
|
+
|
|
203
205
|
if(!this.groupManager.table.options.groupValues && !this.rows.length){
|
|
204
206
|
if(this.parent){
|
|
205
207
|
this.parent.removeGroup(this);
|
|
206
208
|
}else{
|
|
207
209
|
this.groupManager.removeGroup(this);
|
|
208
210
|
}
|
|
209
|
-
|
|
211
|
+
|
|
210
212
|
this.groupManager.updateGroupRows(true);
|
|
211
213
|
}else{
|
|
212
|
-
|
|
214
|
+
|
|
213
215
|
if(el.parentNode){
|
|
214
216
|
el.parentNode.removeChild(el);
|
|
215
217
|
}
|
|
216
|
-
|
|
218
|
+
|
|
217
219
|
this.generateGroupHeaderContents();
|
|
218
220
|
|
|
219
221
|
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
220
222
|
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
221
223
|
}
|
|
222
|
-
|
|
224
|
+
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
|
-
|
|
227
|
+
|
|
226
228
|
removeGroup(group){
|
|
227
229
|
var groupKey = group.level + "_" + group.key,
|
|
228
230
|
index;
|
|
229
|
-
|
|
231
|
+
|
|
230
232
|
if(this.groups[groupKey]){
|
|
231
233
|
delete this.groups[groupKey];
|
|
232
|
-
|
|
234
|
+
|
|
233
235
|
index = this.groupList.indexOf(group);
|
|
234
|
-
|
|
236
|
+
|
|
235
237
|
if(index > -1){
|
|
236
238
|
this.groupList.splice(index, 1);
|
|
237
239
|
}
|
|
238
|
-
|
|
240
|
+
|
|
239
241
|
if(!this.groupList.length){
|
|
240
242
|
if(this.parent){
|
|
241
243
|
this.parent.removeGroup(this);
|
|
@@ -245,66 +247,66 @@ class Group{
|
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
|
-
|
|
250
|
+
|
|
249
251
|
getHeadersAndRows(noCalc){
|
|
250
252
|
var output = [];
|
|
251
|
-
|
|
253
|
+
|
|
252
254
|
output.push(this);
|
|
253
|
-
|
|
255
|
+
|
|
254
256
|
this._visSet();
|
|
255
|
-
|
|
257
|
+
|
|
256
258
|
if(this.visible){
|
|
257
259
|
if(this.groupList.length){
|
|
258
260
|
this.groupList.forEach(function(group){
|
|
259
261
|
output = output.concat(group.getHeadersAndRows(noCalc));
|
|
260
262
|
});
|
|
261
|
-
|
|
263
|
+
|
|
262
264
|
}else{
|
|
263
265
|
if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
|
|
264
266
|
if(this.calcs.top){
|
|
265
267
|
this.calcs.top.detachElement();
|
|
266
268
|
this.calcs.top.deleteCells();
|
|
267
269
|
}
|
|
268
|
-
|
|
270
|
+
|
|
269
271
|
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
|
|
270
272
|
output.push(this.calcs.top);
|
|
271
273
|
}
|
|
272
|
-
|
|
274
|
+
|
|
273
275
|
output = output.concat(this.rows);
|
|
274
|
-
|
|
276
|
+
|
|
275
277
|
if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
|
|
276
278
|
if(this.calcs.bottom){
|
|
277
279
|
this.calcs.bottom.detachElement();
|
|
278
280
|
this.calcs.bottom.deleteCells();
|
|
279
281
|
}
|
|
280
|
-
|
|
282
|
+
|
|
281
283
|
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
|
|
282
284
|
output.push(this.calcs.bottom);
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
}else{
|
|
286
288
|
if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table"){
|
|
287
|
-
|
|
289
|
+
|
|
288
290
|
if(this.groupManager.table.modExists("columnCalcs")){
|
|
289
|
-
|
|
291
|
+
|
|
290
292
|
if(!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
|
|
291
293
|
if(this.calcs.top){
|
|
292
294
|
this.calcs.top.detachElement();
|
|
293
295
|
this.calcs.top.deleteCells();
|
|
294
296
|
}
|
|
295
|
-
|
|
297
|
+
|
|
296
298
|
if(this.groupManager.table.options.groupClosedShowCalcs){
|
|
297
299
|
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
|
|
298
300
|
output.push(this.calcs.top);
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
|
-
|
|
303
|
+
|
|
302
304
|
if(!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
|
|
303
305
|
if(this.calcs.bottom){
|
|
304
306
|
this.calcs.bottom.detachElement();
|
|
305
307
|
this.calcs.bottom.deleteCells();
|
|
306
308
|
}
|
|
307
|
-
|
|
309
|
+
|
|
308
310
|
if(this.groupManager.table.options.groupClosedShowCalcs){
|
|
309
311
|
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
|
|
310
312
|
output.push(this.calcs.bottom);
|
|
@@ -312,29 +314,29 @@ class Group{
|
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
316
|
}
|
|
315
|
-
|
|
317
|
+
|
|
316
318
|
}
|
|
317
|
-
|
|
319
|
+
|
|
318
320
|
return output;
|
|
319
321
|
}
|
|
320
|
-
|
|
322
|
+
|
|
321
323
|
getData(visible, transform){
|
|
322
324
|
var output = [];
|
|
323
|
-
|
|
325
|
+
|
|
324
326
|
this._visSet();
|
|
325
|
-
|
|
327
|
+
|
|
326
328
|
if(!visible || (visible && this.visible)){
|
|
327
329
|
this.rows.forEach((row) => {
|
|
328
330
|
output.push(row.getData(transform || "data"));
|
|
329
331
|
});
|
|
330
332
|
}
|
|
331
|
-
|
|
333
|
+
|
|
332
334
|
return output;
|
|
333
335
|
}
|
|
334
|
-
|
|
336
|
+
|
|
335
337
|
getRowCount(){
|
|
336
338
|
var count = 0;
|
|
337
|
-
|
|
339
|
+
|
|
338
340
|
if(this.groupList.length){
|
|
339
341
|
this.groupList.forEach((group) => {
|
|
340
342
|
count += group.getRowCount();
|
|
@@ -344,7 +346,7 @@ class Group{
|
|
|
344
346
|
}
|
|
345
347
|
return count;
|
|
346
348
|
}
|
|
347
|
-
|
|
349
|
+
|
|
348
350
|
toggleVisibility(){
|
|
349
351
|
if(this.visible){
|
|
350
352
|
this.hide();
|
|
@@ -352,55 +354,55 @@ class Group{
|
|
|
352
354
|
this.show();
|
|
353
355
|
}
|
|
354
356
|
}
|
|
355
|
-
|
|
357
|
+
|
|
356
358
|
hide(){
|
|
357
359
|
this.visible = false;
|
|
358
|
-
|
|
360
|
+
|
|
359
361
|
if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
|
|
360
|
-
|
|
362
|
+
|
|
361
363
|
this.element.classList.remove("tabulator-group-visible");
|
|
362
|
-
|
|
364
|
+
|
|
363
365
|
if(this.groupList.length){
|
|
364
366
|
this.groupList.forEach((group) => {
|
|
365
|
-
|
|
367
|
+
|
|
366
368
|
var rows = group.getHeadersAndRows();
|
|
367
|
-
|
|
369
|
+
|
|
368
370
|
rows.forEach((row) => {
|
|
369
371
|
row.detachElement();
|
|
370
372
|
});
|
|
371
373
|
});
|
|
372
|
-
|
|
374
|
+
|
|
373
375
|
}else{
|
|
374
376
|
this.rows.forEach((row) => {
|
|
375
377
|
var rowEl = row.getElement();
|
|
376
378
|
rowEl.parentNode.removeChild(rowEl);
|
|
377
379
|
});
|
|
378
380
|
}
|
|
379
|
-
|
|
381
|
+
|
|
380
382
|
this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
|
|
381
|
-
|
|
383
|
+
|
|
382
384
|
this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
|
|
383
|
-
|
|
385
|
+
|
|
384
386
|
}else{
|
|
385
387
|
this.groupManager.updateGroupRows(true);
|
|
386
388
|
}
|
|
387
|
-
|
|
389
|
+
|
|
388
390
|
this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), false);
|
|
389
391
|
}
|
|
390
|
-
|
|
392
|
+
|
|
391
393
|
show(){
|
|
392
394
|
this.visible = true;
|
|
393
|
-
|
|
395
|
+
|
|
394
396
|
if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
|
|
395
|
-
|
|
397
|
+
|
|
396
398
|
this.element.classList.add("tabulator-group-visible");
|
|
397
|
-
|
|
399
|
+
|
|
398
400
|
var prev = this.generateElement();
|
|
399
|
-
|
|
401
|
+
|
|
400
402
|
if(this.groupList.length){
|
|
401
403
|
this.groupList.forEach((group) => {
|
|
402
404
|
var rows = group.getHeadersAndRows();
|
|
403
|
-
|
|
405
|
+
|
|
404
406
|
rows.forEach((row) => {
|
|
405
407
|
var rowEl = row.getElement();
|
|
406
408
|
prev.parentNode.insertBefore(rowEl, prev.nextSibling);
|
|
@@ -408,7 +410,7 @@ class Group{
|
|
|
408
410
|
prev = rowEl;
|
|
409
411
|
});
|
|
410
412
|
});
|
|
411
|
-
|
|
413
|
+
|
|
412
414
|
}else{
|
|
413
415
|
this.rows.forEach((row) => {
|
|
414
416
|
var rowEl = row.getElement();
|
|
@@ -417,36 +419,36 @@ class Group{
|
|
|
417
419
|
prev = rowEl;
|
|
418
420
|
});
|
|
419
421
|
}
|
|
420
|
-
|
|
422
|
+
|
|
421
423
|
this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
|
|
422
|
-
|
|
424
|
+
|
|
423
425
|
this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
|
|
424
426
|
}else{
|
|
425
427
|
this.groupManager.updateGroupRows(true);
|
|
426
428
|
}
|
|
427
|
-
|
|
429
|
+
|
|
428
430
|
this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), true);
|
|
429
431
|
}
|
|
430
|
-
|
|
432
|
+
|
|
431
433
|
_visSet(){
|
|
432
434
|
var data = [];
|
|
433
|
-
|
|
435
|
+
|
|
434
436
|
if(typeof this.visible == "function"){
|
|
435
|
-
|
|
437
|
+
|
|
436
438
|
this.rows.forEach(function(row){
|
|
437
439
|
data.push(row.getData());
|
|
438
440
|
});
|
|
439
|
-
|
|
441
|
+
|
|
440
442
|
this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent());
|
|
441
443
|
}
|
|
442
444
|
}
|
|
443
|
-
|
|
445
|
+
|
|
444
446
|
getRowGroup(row){
|
|
445
447
|
var match = false;
|
|
446
448
|
if(this.groupList.length){
|
|
447
449
|
this.groupList.forEach(function(group){
|
|
448
450
|
var result = group.getRowGroup(row);
|
|
449
|
-
|
|
451
|
+
|
|
450
452
|
if(result){
|
|
451
453
|
match = result;
|
|
452
454
|
}
|
|
@@ -458,50 +460,50 @@ class Group{
|
|
|
458
460
|
match = this;
|
|
459
461
|
}
|
|
460
462
|
}
|
|
461
|
-
|
|
463
|
+
|
|
462
464
|
return match;
|
|
463
465
|
}
|
|
464
|
-
|
|
466
|
+
|
|
465
467
|
getSubGroups(component){
|
|
466
468
|
var output = [];
|
|
467
|
-
|
|
469
|
+
|
|
468
470
|
this.groupList.forEach(function(child){
|
|
469
471
|
output.push(component ? child.getComponent() : child);
|
|
470
472
|
});
|
|
471
|
-
|
|
473
|
+
|
|
472
474
|
return output;
|
|
473
475
|
}
|
|
474
|
-
|
|
476
|
+
|
|
475
477
|
getRows(compoment){
|
|
476
478
|
var output = [];
|
|
477
|
-
|
|
479
|
+
|
|
478
480
|
this.rows.forEach(function(row){
|
|
479
481
|
output.push(compoment ? row.getComponent() : row);
|
|
480
482
|
});
|
|
481
|
-
|
|
483
|
+
|
|
482
484
|
return output;
|
|
483
485
|
}
|
|
484
|
-
|
|
486
|
+
|
|
485
487
|
generateGroupHeaderContents(){
|
|
486
488
|
var data = [];
|
|
487
|
-
|
|
489
|
+
|
|
488
490
|
this.rows.forEach(function(row){
|
|
489
491
|
data.push(row.getData());
|
|
490
492
|
});
|
|
491
|
-
|
|
493
|
+
|
|
492
494
|
this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent());
|
|
493
|
-
|
|
495
|
+
|
|
494
496
|
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
|
|
495
|
-
|
|
497
|
+
|
|
496
498
|
if(typeof this.elementContents === "string"){
|
|
497
499
|
this.element.innerHTML = this.elementContents;
|
|
498
500
|
}else{
|
|
499
501
|
this.element.appendChild(this.elementContents);
|
|
500
502
|
}
|
|
501
|
-
|
|
503
|
+
|
|
502
504
|
this.element.insertBefore(this.arrowElement, this.element.firstChild);
|
|
503
505
|
}
|
|
504
|
-
|
|
506
|
+
|
|
505
507
|
getPath(path = []) {
|
|
506
508
|
path.unshift(this.key);
|
|
507
509
|
if(this.parent) {
|
|
@@ -509,94 +511,94 @@ class Group{
|
|
|
509
511
|
}
|
|
510
512
|
return path;
|
|
511
513
|
}
|
|
512
|
-
|
|
514
|
+
|
|
513
515
|
////////////// Standard Row Functions //////////////
|
|
514
|
-
|
|
516
|
+
|
|
515
517
|
getElement(){
|
|
516
518
|
return this.elementContents ? this.element : this.generateElement();
|
|
517
519
|
}
|
|
518
|
-
|
|
520
|
+
|
|
519
521
|
generateElement(){
|
|
520
522
|
this.addBindings = false;
|
|
521
|
-
|
|
523
|
+
|
|
522
524
|
this._visSet();
|
|
523
|
-
|
|
525
|
+
|
|
524
526
|
if(this.visible){
|
|
525
527
|
this.element.classList.add("tabulator-group-visible");
|
|
526
528
|
}else{
|
|
527
529
|
this.element.classList.remove("tabulator-group-visible");
|
|
528
530
|
}
|
|
529
|
-
|
|
531
|
+
|
|
530
532
|
for(var i = 0; i < this.element.childNodes.length; ++i){
|
|
531
533
|
this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]);
|
|
532
534
|
}
|
|
533
|
-
|
|
535
|
+
|
|
534
536
|
this.generateGroupHeaderContents();
|
|
535
|
-
|
|
537
|
+
|
|
536
538
|
// this.addBindings();
|
|
537
|
-
|
|
539
|
+
|
|
538
540
|
return this.element;
|
|
539
541
|
}
|
|
540
|
-
|
|
542
|
+
|
|
541
543
|
detachElement(){
|
|
542
544
|
if (this.element && this.element.parentNode){
|
|
543
545
|
this.element.parentNode.removeChild(this.element);
|
|
544
546
|
}
|
|
545
547
|
}
|
|
546
|
-
|
|
548
|
+
|
|
547
549
|
//normalize the height of elements in the row
|
|
548
550
|
normalizeHeight(){
|
|
549
551
|
this.setHeight(this.element.clientHeight);
|
|
550
552
|
}
|
|
551
|
-
|
|
553
|
+
|
|
552
554
|
initialize(force){
|
|
553
555
|
if(!this.initialized || force){
|
|
554
556
|
this.normalizeHeight();
|
|
555
557
|
this.initialized = true;
|
|
556
558
|
}
|
|
557
559
|
}
|
|
558
|
-
|
|
560
|
+
|
|
559
561
|
reinitialize(){
|
|
560
562
|
this.initialized = false;
|
|
561
563
|
this.height = 0;
|
|
562
|
-
|
|
564
|
+
|
|
563
565
|
if(Helpers.elVisible(this.element)){
|
|
564
566
|
this.initialize(true);
|
|
565
567
|
}
|
|
566
568
|
}
|
|
567
|
-
|
|
569
|
+
|
|
568
570
|
setHeight(height){
|
|
569
571
|
if(this.height != height){
|
|
570
572
|
this.height = height;
|
|
571
573
|
this.outerHeight = this.element.offsetHeight;
|
|
572
574
|
}
|
|
573
575
|
}
|
|
574
|
-
|
|
576
|
+
|
|
575
577
|
//return rows outer height
|
|
576
578
|
getHeight(){
|
|
577
579
|
return this.outerHeight;
|
|
578
580
|
}
|
|
579
|
-
|
|
581
|
+
|
|
580
582
|
getGroup(){
|
|
581
583
|
return this;
|
|
582
584
|
}
|
|
583
|
-
|
|
585
|
+
|
|
584
586
|
reinitializeHeight(){}
|
|
585
|
-
|
|
587
|
+
|
|
586
588
|
calcHeight(){}
|
|
587
|
-
|
|
589
|
+
|
|
588
590
|
setCellHeight(){}
|
|
589
|
-
|
|
591
|
+
|
|
590
592
|
clearCellHeight(){}
|
|
591
|
-
|
|
593
|
+
|
|
592
594
|
deinitializeHeight(){}
|
|
593
|
-
|
|
595
|
+
|
|
594
596
|
//////////////// Object Generation /////////////////
|
|
595
597
|
getComponent(){
|
|
596
598
|
if(!this.component){
|
|
597
599
|
this.component = new GroupComponent(this);
|
|
598
600
|
}
|
|
599
|
-
|
|
601
|
+
|
|
600
602
|
return this.component;
|
|
601
603
|
}
|
|
602
604
|
}
|