tabulator-tables 5.4.1 → 5.4.3
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/css/tabulator.css +1 -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 +1 -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 +1 -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_bootstrap5.css +1 -0
- 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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +323 -241
- 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 +323 -241
- 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 +2 -2
- package/src/js/core/ColumnManager.js +3 -5
- package/src/js/core/RowManager.js +49 -30
- package/src/js/core/Tabulator.js +7 -8
- package/src/js/core/column/Column.js +10 -0
- package/src/js/core/tools/Popup.js +1 -1
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +10 -0
- package/src/js/modules/Edit/List.js +1 -1
- package/src/js/modules/Edit/inputMask.js +1 -1
- package/src/js/modules/Export/Export.js +151 -145
- package/src/js/modules/Filter/Filter.js +11 -8
- package/src/js/modules/GroupRows/Group.js +23 -18
- package/src/js/modules/GroupRows/GroupRows.js +29 -9
- package/src/js/modules/Localize/Localize.js +0 -9
- package/src/js/modules/MoveColumns/MoveColumns.js +1 -1
- package/src/js/modules/Print/Print.js +15 -2
- package/src/js/modules/SelectRow/SelectRow.js +10 -2
- package/src/scss/tabulator.scss +1 -0
package/dist/js/tabulator_esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.4.
|
|
1
|
+
/* Tabulator v5.4.3 (c) Oliver Folkerd 2022 */
|
|
2
2
|
class CoreFeature{
|
|
3
3
|
|
|
4
4
|
constructor(table){
|
|
@@ -211,7 +211,7 @@ class Popup extends CoreFeature{
|
|
|
211
211
|
this.blurEvent = this.hide.bind(this, false);
|
|
212
212
|
this.escEvent = this._escapeCheck.bind(this);
|
|
213
213
|
|
|
214
|
-
this.destroyBinding = this.tableDestroyed;
|
|
214
|
+
this.destroyBinding = this.tableDestroyed.bind(this);
|
|
215
215
|
this.destroyed = false;
|
|
216
216
|
}
|
|
217
217
|
|
|
@@ -2727,6 +2727,16 @@ class Column extends CoreFeature{
|
|
|
2727
2727
|
return width;
|
|
2728
2728
|
}
|
|
2729
2729
|
|
|
2730
|
+
getLeftOffset(){
|
|
2731
|
+
var offset = this.element.offsetLeft;
|
|
2732
|
+
|
|
2733
|
+
if(this.parent.isGroup){
|
|
2734
|
+
offset += this.parent.getLeftOffset();
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
return offset;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2730
2740
|
getHeight(){
|
|
2731
2741
|
return Math.ceil(this.element.getBoundingClientRect().height);
|
|
2732
2742
|
}
|
|
@@ -3820,6 +3830,16 @@ class ColumnCalcs extends Module{
|
|
|
3820
3830
|
}
|
|
3821
3831
|
}
|
|
3822
3832
|
|
|
3833
|
+
reinitializeCalcs(){
|
|
3834
|
+
if(this.topCalcs.length){
|
|
3835
|
+
this.initializeTopRow();
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
if(this.botCalcs.length){
|
|
3839
|
+
this.initializeBottomRow();
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3823
3843
|
initializeTopRow(){
|
|
3824
3844
|
if(!this.topInitialized){
|
|
3825
3845
|
this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
|
|
@@ -5240,7 +5260,7 @@ function maskInput(el, options){
|
|
|
5240
5260
|
var index = el.value.length,
|
|
5241
5261
|
char = e.key;
|
|
5242
5262
|
|
|
5243
|
-
if(e.keyCode > 46){
|
|
5263
|
+
if(e.keyCode > 46 && !e.ctrlKey && !e.metaKey){
|
|
5244
5264
|
if(index >= mask.length){
|
|
5245
5265
|
e.preventDefault();
|
|
5246
5266
|
e.stopPropagation();
|
|
@@ -6991,7 +7011,7 @@ class Edit{
|
|
|
6991
7011
|
if(this.currentItems[0]){
|
|
6992
7012
|
output = this.currentItems[0].value;
|
|
6993
7013
|
}else {
|
|
6994
|
-
initialValue = this.initialValues[0];
|
|
7014
|
+
initialValue = Array.isArray(this.initialValues) ? this.initialValues[0] : this.initialValues;
|
|
6995
7015
|
|
|
6996
7016
|
if(initialValue === null || typeof initialValue === "undefined" || initialValue === ""){
|
|
6997
7017
|
output = initialValue;
|
|
@@ -8177,57 +8197,57 @@ class ExportColumn{
|
|
|
8177
8197
|
}
|
|
8178
8198
|
|
|
8179
8199
|
class Export extends Module{
|
|
8180
|
-
|
|
8200
|
+
|
|
8181
8201
|
constructor(table){
|
|
8182
8202
|
super(table);
|
|
8183
|
-
|
|
8203
|
+
|
|
8184
8204
|
this.config = {};
|
|
8185
8205
|
this.cloneTableStyle = true;
|
|
8186
8206
|
this.colVisProp = "";
|
|
8187
|
-
|
|
8207
|
+
|
|
8188
8208
|
this.registerTableOption("htmlOutputConfig", false); //html output config
|
|
8189
|
-
|
|
8209
|
+
|
|
8190
8210
|
this.registerColumnOption("htmlOutput");
|
|
8191
8211
|
this.registerColumnOption("titleHtmlOutput");
|
|
8192
8212
|
}
|
|
8193
|
-
|
|
8213
|
+
|
|
8194
8214
|
initialize(){
|
|
8195
8215
|
this.registerTableFunction("getHtml", this.getHtml.bind(this));
|
|
8196
8216
|
}
|
|
8197
|
-
|
|
8217
|
+
|
|
8198
8218
|
///////////////////////////////////
|
|
8199
8219
|
///////// Table Functions /////////
|
|
8200
8220
|
///////////////////////////////////
|
|
8201
|
-
|
|
8202
|
-
|
|
8221
|
+
|
|
8222
|
+
|
|
8203
8223
|
///////////////////////////////////
|
|
8204
8224
|
///////// Internal Logic //////////
|
|
8205
8225
|
///////////////////////////////////
|
|
8206
|
-
|
|
8226
|
+
|
|
8207
8227
|
generateExportList(config, style, range, colVisProp){
|
|
8208
8228
|
this.cloneTableStyle = style;
|
|
8209
8229
|
this.config = config || {};
|
|
8210
8230
|
this.colVisProp = colVisProp;
|
|
8211
|
-
|
|
8231
|
+
|
|
8212
8232
|
var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : [];
|
|
8213
8233
|
var body = this.bodyToExportRows(this.rowLookup(range));
|
|
8214
|
-
|
|
8234
|
+
|
|
8215
8235
|
return headers.concat(body);
|
|
8216
8236
|
}
|
|
8217
|
-
|
|
8237
|
+
|
|
8218
8238
|
generateTable(config, style, range, colVisProp){
|
|
8219
8239
|
var list = this.generateExportList(config, style, range, colVisProp);
|
|
8220
|
-
|
|
8240
|
+
|
|
8221
8241
|
return this.generateTableElement(list);
|
|
8222
8242
|
}
|
|
8223
|
-
|
|
8243
|
+
|
|
8224
8244
|
rowLookup(range){
|
|
8225
8245
|
var rows = [];
|
|
8226
|
-
|
|
8246
|
+
|
|
8227
8247
|
if(typeof range == "function"){
|
|
8228
8248
|
range.call(this.table).forEach((row) =>{
|
|
8229
8249
|
row = this.table.rowManager.findRow(row);
|
|
8230
|
-
|
|
8250
|
+
|
|
8231
8251
|
if(row){
|
|
8232
8252
|
rows.push(row);
|
|
8233
8253
|
}
|
|
@@ -8238,15 +8258,15 @@ class Export extends Module{
|
|
|
8238
8258
|
case "visible":
|
|
8239
8259
|
rows = this.table.rowManager.getVisibleRows(false, true);
|
|
8240
8260
|
break;
|
|
8241
|
-
|
|
8261
|
+
|
|
8242
8262
|
case "all":
|
|
8243
8263
|
rows = this.table.rowManager.rows;
|
|
8244
8264
|
break;
|
|
8245
|
-
|
|
8265
|
+
|
|
8246
8266
|
case "selected":
|
|
8247
8267
|
rows = this.table.modules.selectRow.selectedRows;
|
|
8248
8268
|
break;
|
|
8249
|
-
|
|
8269
|
+
|
|
8250
8270
|
case "active":
|
|
8251
8271
|
default:
|
|
8252
8272
|
if(this.table.options.pagination){
|
|
@@ -8256,56 +8276,56 @@ class Export extends Module{
|
|
|
8256
8276
|
}
|
|
8257
8277
|
}
|
|
8258
8278
|
}
|
|
8259
|
-
|
|
8279
|
+
|
|
8260
8280
|
return Object.assign([], rows);
|
|
8261
8281
|
}
|
|
8262
|
-
|
|
8282
|
+
|
|
8263
8283
|
generateColumnGroupHeaders(){
|
|
8264
8284
|
var output = [];
|
|
8265
|
-
|
|
8285
|
+
|
|
8266
8286
|
var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex;
|
|
8267
|
-
|
|
8287
|
+
|
|
8268
8288
|
columns.forEach((column) => {
|
|
8269
8289
|
var colData = this.processColumnGroup(column);
|
|
8270
|
-
|
|
8290
|
+
|
|
8271
8291
|
if(colData){
|
|
8272
8292
|
output.push(colData);
|
|
8273
8293
|
}
|
|
8274
8294
|
});
|
|
8275
|
-
|
|
8295
|
+
|
|
8276
8296
|
return output;
|
|
8277
8297
|
}
|
|
8278
|
-
|
|
8298
|
+
|
|
8279
8299
|
processColumnGroup(column){
|
|
8280
8300
|
var subGroups = column.columns,
|
|
8281
8301
|
maxDepth = 0,
|
|
8282
8302
|
title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title;
|
|
8283
|
-
|
|
8303
|
+
|
|
8284
8304
|
var groupData = {
|
|
8285
8305
|
title:title,
|
|
8286
8306
|
column:column,
|
|
8287
8307
|
depth:1,
|
|
8288
8308
|
};
|
|
8289
|
-
|
|
8309
|
+
|
|
8290
8310
|
if(subGroups.length){
|
|
8291
8311
|
groupData.subGroups = [];
|
|
8292
8312
|
groupData.width = 0;
|
|
8293
|
-
|
|
8313
|
+
|
|
8294
8314
|
subGroups.forEach((subGroup) => {
|
|
8295
8315
|
var subGroupData = this.processColumnGroup(subGroup);
|
|
8296
|
-
|
|
8316
|
+
|
|
8297
8317
|
if(subGroupData){
|
|
8298
8318
|
groupData.width += subGroupData.width;
|
|
8299
8319
|
groupData.subGroups.push(subGroupData);
|
|
8300
|
-
|
|
8320
|
+
|
|
8301
8321
|
if(subGroupData.depth > maxDepth){
|
|
8302
8322
|
maxDepth = subGroupData.depth;
|
|
8303
8323
|
}
|
|
8304
8324
|
}
|
|
8305
8325
|
});
|
|
8306
|
-
|
|
8326
|
+
|
|
8307
8327
|
groupData.depth += maxDepth;
|
|
8308
|
-
|
|
8328
|
+
|
|
8309
8329
|
if(!groupData.width){
|
|
8310
8330
|
return false;
|
|
8311
8331
|
}
|
|
@@ -8316,75 +8336,75 @@ class Export extends Module{
|
|
|
8316
8336
|
return false;
|
|
8317
8337
|
}
|
|
8318
8338
|
}
|
|
8319
|
-
|
|
8339
|
+
|
|
8320
8340
|
return groupData;
|
|
8321
8341
|
}
|
|
8322
|
-
|
|
8342
|
+
|
|
8323
8343
|
columnVisCheck(column){
|
|
8324
8344
|
var visProp = column.definition[this.colVisProp];
|
|
8325
|
-
|
|
8345
|
+
|
|
8326
8346
|
if(typeof visProp === "function"){
|
|
8327
8347
|
visProp = visProp.call(this.table, column.getComponent());
|
|
8328
8348
|
}
|
|
8329
|
-
|
|
8349
|
+
|
|
8330
8350
|
return visProp !== false && (column.visible || (!column.visible && visProp));
|
|
8331
8351
|
}
|
|
8332
|
-
|
|
8352
|
+
|
|
8333
8353
|
headersToExportRows(columns){
|
|
8334
8354
|
var headers = [],
|
|
8335
8355
|
headerDepth = 0,
|
|
8336
8356
|
exportRows = [];
|
|
8337
|
-
|
|
8357
|
+
|
|
8338
8358
|
function parseColumnGroup(column, level){
|
|
8339
|
-
|
|
8359
|
+
|
|
8340
8360
|
var depth = headerDepth - level;
|
|
8341
|
-
|
|
8361
|
+
|
|
8342
8362
|
if(typeof headers[level] === "undefined"){
|
|
8343
8363
|
headers[level] = [];
|
|
8344
8364
|
}
|
|
8345
|
-
|
|
8365
|
+
|
|
8346
8366
|
column.height = column.subGroups ? 1 : (depth - column.depth) + 1;
|
|
8347
|
-
|
|
8367
|
+
|
|
8348
8368
|
headers[level].push(column);
|
|
8349
|
-
|
|
8369
|
+
|
|
8350
8370
|
if(column.height > 1){
|
|
8351
8371
|
for(let i = 1; i < column.height; i ++){
|
|
8352
|
-
|
|
8372
|
+
|
|
8353
8373
|
if(typeof headers[level + i] === "undefined"){
|
|
8354
8374
|
headers[level + i] = [];
|
|
8355
8375
|
}
|
|
8356
|
-
|
|
8376
|
+
|
|
8357
8377
|
headers[level + i].push(false);
|
|
8358
8378
|
}
|
|
8359
8379
|
}
|
|
8360
|
-
|
|
8380
|
+
|
|
8361
8381
|
if(column.width > 1){
|
|
8362
8382
|
for(let i = 1; i < column.width; i ++){
|
|
8363
8383
|
headers[level].push(false);
|
|
8364
8384
|
}
|
|
8365
8385
|
}
|
|
8366
|
-
|
|
8386
|
+
|
|
8367
8387
|
if(column.subGroups){
|
|
8368
8388
|
column.subGroups.forEach(function(subGroup){
|
|
8369
8389
|
parseColumnGroup(subGroup, level+1);
|
|
8370
8390
|
});
|
|
8371
8391
|
}
|
|
8372
8392
|
}
|
|
8373
|
-
|
|
8393
|
+
|
|
8374
8394
|
//calculate maximum header depth
|
|
8375
8395
|
columns.forEach(function(column){
|
|
8376
8396
|
if(column.depth > headerDepth){
|
|
8377
8397
|
headerDepth = column.depth;
|
|
8378
8398
|
}
|
|
8379
8399
|
});
|
|
8380
|
-
|
|
8400
|
+
|
|
8381
8401
|
columns.forEach(function(column){
|
|
8382
8402
|
parseColumnGroup(column,0);
|
|
8383
8403
|
});
|
|
8384
|
-
|
|
8404
|
+
|
|
8385
8405
|
headers.forEach((header) => {
|
|
8386
8406
|
var columns = [];
|
|
8387
|
-
|
|
8407
|
+
|
|
8388
8408
|
header.forEach((col) => {
|
|
8389
8409
|
if(col){
|
|
8390
8410
|
let title = typeof col.title === "undefined" ? "" : col.title;
|
|
@@ -8393,78 +8413,78 @@ class Export extends Module{
|
|
|
8393
8413
|
columns.push(null);
|
|
8394
8414
|
}
|
|
8395
8415
|
});
|
|
8396
|
-
|
|
8416
|
+
|
|
8397
8417
|
exportRows.push(new ExportRow("header", columns));
|
|
8398
8418
|
});
|
|
8399
|
-
|
|
8419
|
+
|
|
8400
8420
|
return exportRows;
|
|
8401
8421
|
}
|
|
8402
|
-
|
|
8422
|
+
|
|
8403
8423
|
bodyToExportRows(rows){
|
|
8404
|
-
|
|
8424
|
+
|
|
8405
8425
|
var columns = [];
|
|
8406
8426
|
var exportRows = [];
|
|
8407
|
-
|
|
8427
|
+
|
|
8408
8428
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
8409
8429
|
if (this.columnVisCheck(column)) {
|
|
8410
8430
|
columns.push(column.getComponent());
|
|
8411
8431
|
}
|
|
8412
8432
|
});
|
|
8413
|
-
|
|
8433
|
+
|
|
8414
8434
|
if(this.config.columnCalcs !== false && this.table.modExists("columnCalcs")){
|
|
8415
8435
|
if(this.table.modules.columnCalcs.topInitialized){
|
|
8416
8436
|
rows.unshift(this.table.modules.columnCalcs.topRow);
|
|
8417
8437
|
}
|
|
8418
|
-
|
|
8438
|
+
|
|
8419
8439
|
if(this.table.modules.columnCalcs.botInitialized){
|
|
8420
8440
|
rows.push(this.table.modules.columnCalcs.botRow);
|
|
8421
8441
|
}
|
|
8422
8442
|
}
|
|
8423
|
-
|
|
8443
|
+
|
|
8424
8444
|
rows = rows.filter((row) => {
|
|
8425
8445
|
switch(row.type){
|
|
8426
8446
|
case "group":
|
|
8427
8447
|
return this.config.rowGroups !== false;
|
|
8428
|
-
|
|
8448
|
+
|
|
8429
8449
|
case "calc":
|
|
8430
8450
|
return this.config.columnCalcs !== false;
|
|
8431
|
-
|
|
8451
|
+
|
|
8432
8452
|
case "row":
|
|
8433
8453
|
return !(this.table.options.dataTree && this.config.dataTree === false && row.modules.dataTree.parent);
|
|
8434
8454
|
}
|
|
8435
|
-
|
|
8455
|
+
|
|
8436
8456
|
return true;
|
|
8437
8457
|
});
|
|
8438
|
-
|
|
8458
|
+
|
|
8439
8459
|
rows.forEach((row, i) => {
|
|
8440
8460
|
var rowData = row.getData(this.colVisProp);
|
|
8441
8461
|
var exportCols = [];
|
|
8442
8462
|
var indent = 0;
|
|
8443
|
-
|
|
8463
|
+
|
|
8444
8464
|
switch(row.type){
|
|
8445
8465
|
case "group":
|
|
8446
8466
|
indent = row.level;
|
|
8447
8467
|
exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1));
|
|
8448
8468
|
break;
|
|
8449
|
-
|
|
8469
|
+
|
|
8450
8470
|
case "calc" :
|
|
8451
8471
|
case "row" :
|
|
8452
8472
|
columns.forEach((col) => {
|
|
8453
8473
|
exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1));
|
|
8454
8474
|
});
|
|
8455
|
-
|
|
8475
|
+
|
|
8456
8476
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
8457
8477
|
indent = row.modules.dataTree.index;
|
|
8458
8478
|
}
|
|
8459
8479
|
break;
|
|
8460
8480
|
}
|
|
8461
|
-
|
|
8481
|
+
|
|
8462
8482
|
exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent));
|
|
8463
8483
|
});
|
|
8464
|
-
|
|
8484
|
+
|
|
8465
8485
|
return exportRows;
|
|
8466
8486
|
}
|
|
8467
|
-
|
|
8487
|
+
|
|
8468
8488
|
generateTableElement(list){
|
|
8469
8489
|
var table = document.createElement("table"),
|
|
8470
8490
|
headerEl = document.createElement("thead"),
|
|
@@ -8472,68 +8492,68 @@ class Export extends Module{
|
|
|
8472
8492
|
styles = this.lookupTableStyles(),
|
|
8473
8493
|
rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))],
|
|
8474
8494
|
setup = {};
|
|
8475
|
-
|
|
8495
|
+
|
|
8476
8496
|
setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter;
|
|
8477
|
-
|
|
8497
|
+
|
|
8478
8498
|
if(this.table.options.dataTree &&this.config.dataTree !== false && this.table.modExists("columnCalcs")){
|
|
8479
8499
|
setup.treeElementField = this.table.modules.dataTree.elementField;
|
|
8480
8500
|
}
|
|
8481
|
-
|
|
8501
|
+
|
|
8482
8502
|
//assign group header formatter
|
|
8483
8503
|
setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))];
|
|
8484
|
-
|
|
8504
|
+
|
|
8485
8505
|
if(setup.groupHeader && !Array.isArray(setup.groupHeader)){
|
|
8486
8506
|
setup.groupHeader = [setup.groupHeader];
|
|
8487
8507
|
}
|
|
8488
|
-
|
|
8508
|
+
|
|
8489
8509
|
table.classList.add("tabulator-print-table");
|
|
8490
|
-
|
|
8510
|
+
|
|
8491
8511
|
this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]);
|
|
8492
|
-
|
|
8493
|
-
|
|
8512
|
+
|
|
8513
|
+
|
|
8494
8514
|
if(list.length > 1000){
|
|
8495
8515
|
console.warn("It may take a long time to render an HTML table with more than 1000 rows");
|
|
8496
8516
|
}
|
|
8497
|
-
|
|
8517
|
+
|
|
8498
8518
|
list.forEach((row, i) => {
|
|
8499
8519
|
let rowEl;
|
|
8500
|
-
|
|
8520
|
+
|
|
8501
8521
|
switch(row.type){
|
|
8502
8522
|
case "header":
|
|
8503
8523
|
headerEl.appendChild(this.generateHeaderElement(row, setup, styles));
|
|
8504
8524
|
break;
|
|
8505
|
-
|
|
8525
|
+
|
|
8506
8526
|
case "group":
|
|
8507
8527
|
bodyEl.appendChild(this.generateGroupElement(row, setup, styles));
|
|
8508
8528
|
break;
|
|
8509
|
-
|
|
8529
|
+
|
|
8510
8530
|
case "calc":
|
|
8511
8531
|
bodyEl.appendChild(this.generateCalcElement(row, setup, styles));
|
|
8512
8532
|
break;
|
|
8513
|
-
|
|
8533
|
+
|
|
8514
8534
|
case "row":
|
|
8515
8535
|
rowEl = this.generateRowElement(row, setup, styles);
|
|
8516
|
-
|
|
8536
|
+
|
|
8517
8537
|
this.mapElementStyles(((i % 2) && styles.evenRow) ? styles.evenRow : styles.oddRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
8518
8538
|
bodyEl.appendChild(rowEl);
|
|
8519
8539
|
break;
|
|
8520
8540
|
}
|
|
8521
8541
|
});
|
|
8522
|
-
|
|
8542
|
+
|
|
8523
8543
|
if(headerEl.innerHTML){
|
|
8524
8544
|
table.appendChild(headerEl);
|
|
8525
8545
|
}
|
|
8526
|
-
|
|
8546
|
+
|
|
8527
8547
|
table.appendChild(bodyEl);
|
|
8528
|
-
|
|
8529
|
-
|
|
8548
|
+
|
|
8549
|
+
|
|
8530
8550
|
this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]);
|
|
8531
8551
|
return table;
|
|
8532
8552
|
}
|
|
8533
|
-
|
|
8553
|
+
|
|
8534
8554
|
lookupTableStyles(){
|
|
8535
8555
|
var styles = {};
|
|
8536
|
-
|
|
8556
|
+
|
|
8537
8557
|
//lookup row styles
|
|
8538
8558
|
if(this.cloneTableStyle && window.getComputedStyle){
|
|
8539
8559
|
styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)");
|
|
@@ -8541,41 +8561,41 @@ class Export extends Module{
|
|
|
8541
8561
|
styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs");
|
|
8542
8562
|
styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)");
|
|
8543
8563
|
styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0];
|
|
8544
|
-
|
|
8564
|
+
|
|
8545
8565
|
if(styles.firstRow){
|
|
8546
8566
|
styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell");
|
|
8547
8567
|
styles.firstCell = styles.styleCells[0];
|
|
8548
8568
|
styles.lastCell = styles.styleCells[styles.styleCells.length - 1];
|
|
8549
8569
|
}
|
|
8550
8570
|
}
|
|
8551
|
-
|
|
8571
|
+
|
|
8552
8572
|
return styles;
|
|
8553
8573
|
}
|
|
8554
|
-
|
|
8574
|
+
|
|
8555
8575
|
generateHeaderElement(row, setup, styles){
|
|
8556
8576
|
var rowEl = document.createElement("tr");
|
|
8557
|
-
|
|
8577
|
+
|
|
8558
8578
|
row.columns.forEach((column) => {
|
|
8559
8579
|
if(column){
|
|
8560
8580
|
var cellEl = document.createElement("th");
|
|
8561
8581
|
var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : [];
|
|
8562
|
-
|
|
8582
|
+
|
|
8563
8583
|
cellEl.colSpan = column.width;
|
|
8564
8584
|
cellEl.rowSpan = column.height;
|
|
8565
|
-
|
|
8585
|
+
|
|
8566
8586
|
cellEl.innerHTML = column.value;
|
|
8567
|
-
|
|
8587
|
+
|
|
8568
8588
|
if(this.cloneTableStyle){
|
|
8569
8589
|
cellEl.style.boxSizing = "border-box";
|
|
8570
8590
|
}
|
|
8571
|
-
|
|
8591
|
+
|
|
8572
8592
|
classNames.forEach(function(className) {
|
|
8573
8593
|
cellEl.classList.add(className);
|
|
8574
8594
|
});
|
|
8575
|
-
|
|
8595
|
+
|
|
8576
8596
|
this.mapElementStyles(column.component.getElement(), cellEl, ["text-align", "border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]);
|
|
8577
8597
|
this.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
8578
|
-
|
|
8598
|
+
|
|
8579
8599
|
if(column.component._column.visible){
|
|
8580
8600
|
this.mapElementStyles(column.component.getElement(), cellEl, ["width"]);
|
|
8581
8601
|
}else {
|
|
@@ -8583,26 +8603,26 @@ class Export extends Module{
|
|
|
8583
8603
|
cellEl.style.width = column.component._column.definition.width + "px";
|
|
8584
8604
|
}
|
|
8585
8605
|
}
|
|
8586
|
-
|
|
8606
|
+
|
|
8587
8607
|
if(column.component._column.parent){
|
|
8588
8608
|
this.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]);
|
|
8589
8609
|
}
|
|
8590
|
-
|
|
8610
|
+
|
|
8591
8611
|
rowEl.appendChild(cellEl);
|
|
8592
8612
|
}
|
|
8593
8613
|
});
|
|
8594
|
-
|
|
8614
|
+
|
|
8595
8615
|
return rowEl;
|
|
8596
8616
|
}
|
|
8597
|
-
|
|
8617
|
+
|
|
8598
8618
|
generateGroupElement(row, setup, styles){
|
|
8599
|
-
|
|
8619
|
+
|
|
8600
8620
|
var rowEl = document.createElement("tr"),
|
|
8601
8621
|
cellEl = document.createElement("td"),
|
|
8602
8622
|
group = row.columns[0];
|
|
8603
|
-
|
|
8623
|
+
|
|
8604
8624
|
rowEl.classList.add("tabulator-print-table-row");
|
|
8605
|
-
|
|
8625
|
+
|
|
8606
8626
|
if(setup.groupHeader && setup.groupHeader[row.indent]){
|
|
8607
8627
|
group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
8608
8628
|
}else {
|
|
@@ -8610,39 +8630,39 @@ class Export extends Module{
|
|
|
8610
8630
|
group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
8611
8631
|
}
|
|
8612
8632
|
}
|
|
8613
|
-
|
|
8633
|
+
|
|
8614
8634
|
cellEl.colSpan = group.width;
|
|
8615
8635
|
cellEl.innerHTML = group.value;
|
|
8616
|
-
|
|
8636
|
+
|
|
8617
8637
|
rowEl.classList.add("tabulator-print-table-group");
|
|
8618
8638
|
rowEl.classList.add("tabulator-group-level-" + row.indent);
|
|
8619
|
-
|
|
8639
|
+
|
|
8620
8640
|
if(group.component.isVisible()){
|
|
8621
8641
|
rowEl.classList.add("tabulator-group-visible");
|
|
8622
8642
|
}
|
|
8623
|
-
|
|
8643
|
+
|
|
8624
8644
|
this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
8625
8645
|
this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
8626
|
-
|
|
8646
|
+
|
|
8627
8647
|
rowEl.appendChild(cellEl);
|
|
8628
|
-
|
|
8648
|
+
|
|
8629
8649
|
return rowEl;
|
|
8630
8650
|
}
|
|
8631
|
-
|
|
8651
|
+
|
|
8632
8652
|
generateCalcElement(row, setup, styles){
|
|
8633
8653
|
var rowEl = this.generateRowElement(row, setup, styles);
|
|
8634
|
-
|
|
8654
|
+
|
|
8635
8655
|
rowEl.classList.add("tabulator-print-table-calcs");
|
|
8636
8656
|
this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
8637
|
-
|
|
8657
|
+
|
|
8638
8658
|
return rowEl;
|
|
8639
8659
|
}
|
|
8640
|
-
|
|
8660
|
+
|
|
8641
8661
|
generateRowElement(row, setup, styles){
|
|
8642
8662
|
var rowEl = document.createElement("tr");
|
|
8643
|
-
|
|
8663
|
+
|
|
8644
8664
|
rowEl.classList.add("tabulator-print-table-row");
|
|
8645
|
-
|
|
8665
|
+
|
|
8646
8666
|
row.columns.forEach((col, i) => {
|
|
8647
8667
|
if(col){
|
|
8648
8668
|
var cellEl = document.createElement("td"),
|
|
@@ -8650,7 +8670,7 @@ class Export extends Module{
|
|
|
8650
8670
|
index = this.table.columnManager.findColumnIndex(column),
|
|
8651
8671
|
value = col.value,
|
|
8652
8672
|
cellStyle;
|
|
8653
|
-
|
|
8673
|
+
|
|
8654
8674
|
var cellWrapper = {
|
|
8655
8675
|
modules:{},
|
|
8656
8676
|
getValue:function(){
|
|
@@ -8676,13 +8696,13 @@ class Export extends Module{
|
|
|
8676
8696
|
},
|
|
8677
8697
|
column:column,
|
|
8678
8698
|
};
|
|
8679
|
-
|
|
8699
|
+
|
|
8680
8700
|
var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : [];
|
|
8681
|
-
|
|
8701
|
+
|
|
8682
8702
|
classNames.forEach(function(className) {
|
|
8683
8703
|
cellEl.classList.add(className);
|
|
8684
8704
|
});
|
|
8685
|
-
|
|
8705
|
+
|
|
8686
8706
|
if(this.table.modExists("format") && this.config.formatCells !== false){
|
|
8687
8707
|
value = this.table.modules.format.formatExportValue(cellWrapper, this.colVisProp);
|
|
8688
8708
|
}else {
|
|
@@ -8690,29 +8710,29 @@ class Export extends Module{
|
|
|
8690
8710
|
case "object":
|
|
8691
8711
|
value = value !== null ? JSON.stringify(value) : "";
|
|
8692
8712
|
break;
|
|
8693
|
-
|
|
8713
|
+
|
|
8694
8714
|
case "undefined":
|
|
8695
8715
|
value = "";
|
|
8696
8716
|
break;
|
|
8697
8717
|
}
|
|
8698
8718
|
}
|
|
8699
|
-
|
|
8719
|
+
|
|
8700
8720
|
if(value instanceof Node){
|
|
8701
8721
|
cellEl.appendChild(value);
|
|
8702
8722
|
}else {
|
|
8703
8723
|
cellEl.innerHTML = value;
|
|
8704
8724
|
}
|
|
8705
|
-
|
|
8725
|
+
|
|
8706
8726
|
cellStyle = styles.styleCells && styles.styleCells[index] ? styles.styleCells[index] : styles.firstCell;
|
|
8707
|
-
|
|
8727
|
+
|
|
8708
8728
|
if(cellStyle){
|
|
8709
8729
|
this.mapElementStyles(cellStyle, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom", "border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "text-align"]);
|
|
8710
|
-
|
|
8730
|
+
|
|
8711
8731
|
if(column.definition.align){
|
|
8712
8732
|
cellEl.style.textAlign = column.definition.align;
|
|
8713
8733
|
}
|
|
8714
8734
|
}
|
|
8715
|
-
|
|
8735
|
+
|
|
8716
8736
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
8717
8737
|
if((setup.treeElementField && setup.treeElementField == column.field) || (!setup.treeElementField && i == 0)){
|
|
8718
8738
|
if(row.component._row.modules.dataTree.controlEl){
|
|
@@ -8723,39 +8743,43 @@ class Export extends Module{
|
|
|
8723
8743
|
}
|
|
8724
8744
|
}
|
|
8725
8745
|
}
|
|
8726
|
-
|
|
8746
|
+
|
|
8727
8747
|
rowEl.appendChild(cellEl);
|
|
8728
|
-
|
|
8748
|
+
|
|
8729
8749
|
if(cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback){
|
|
8730
8750
|
cellWrapper.modules.format.renderedCallback();
|
|
8731
8751
|
}
|
|
8732
|
-
|
|
8733
|
-
if(setup.rowFormatter && this.config.formatCells !== false){
|
|
8734
|
-
setup.rowFormatter(row.component);
|
|
8735
|
-
}
|
|
8736
8752
|
}
|
|
8737
8753
|
});
|
|
8754
|
+
|
|
8755
|
+
if(setup.rowFormatter && row.type === "row" && this.config.formatCells !== false){
|
|
8756
|
+
let formatComponent = Object.assign(row.component);
|
|
8757
|
+
|
|
8758
|
+
formatComponent.getElement = function(){return rowEl;};
|
|
8738
8759
|
|
|
8760
|
+
setup.rowFormatter(row.component);
|
|
8761
|
+
}
|
|
8762
|
+
|
|
8739
8763
|
return rowEl;
|
|
8740
8764
|
}
|
|
8741
|
-
|
|
8765
|
+
|
|
8742
8766
|
generateHTMLTable(list){
|
|
8743
8767
|
var holder = document.createElement("div");
|
|
8744
|
-
|
|
8768
|
+
|
|
8745
8769
|
holder.appendChild(this.generateTableElement(list));
|
|
8746
|
-
|
|
8770
|
+
|
|
8747
8771
|
return holder.innerHTML;
|
|
8748
8772
|
}
|
|
8749
|
-
|
|
8773
|
+
|
|
8750
8774
|
getHtml(visible, style, config, colVisProp){
|
|
8751
8775
|
var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput");
|
|
8752
|
-
|
|
8776
|
+
|
|
8753
8777
|
return this.generateHTMLTable(list);
|
|
8754
8778
|
}
|
|
8755
|
-
|
|
8779
|
+
|
|
8756
8780
|
mapElementStyles(from, to, props){
|
|
8757
8781
|
if(this.cloneTableStyle && from && to){
|
|
8758
|
-
|
|
8782
|
+
|
|
8759
8783
|
var lookup = {
|
|
8760
8784
|
"background-color" : "backgroundColor",
|
|
8761
8785
|
"color" : "fontColor",
|
|
@@ -8773,12 +8797,14 @@ class Export extends Module{
|
|
|
8773
8797
|
"padding-right" : "paddingRight",
|
|
8774
8798
|
"padding-bottom" : "paddingBottom",
|
|
8775
8799
|
};
|
|
8776
|
-
|
|
8800
|
+
|
|
8777
8801
|
if(window.getComputedStyle){
|
|
8778
8802
|
var fromStyle = window.getComputedStyle(from);
|
|
8779
|
-
|
|
8803
|
+
|
|
8780
8804
|
props.forEach(function(prop){
|
|
8781
|
-
to.style[lookup[prop]]
|
|
8805
|
+
if(!to.style[lookup[prop]]){
|
|
8806
|
+
to.style[lookup[prop]] = fromStyle.getPropertyValue(prop);
|
|
8807
|
+
}
|
|
8782
8808
|
});
|
|
8783
8809
|
}
|
|
8784
8810
|
}
|
|
@@ -9076,11 +9102,6 @@ class Filter extends Module{
|
|
|
9076
9102
|
var def = column.definition;
|
|
9077
9103
|
|
|
9078
9104
|
if(def.headerFilter){
|
|
9079
|
-
|
|
9080
|
-
if(typeof def.headerFilterPlaceholder !== "undefined" && def.field){
|
|
9081
|
-
this.module("localize").setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder);
|
|
9082
|
-
}
|
|
9083
|
-
|
|
9084
9105
|
this.initializeColumn(column);
|
|
9085
9106
|
}
|
|
9086
9107
|
}
|
|
@@ -9192,13 +9213,17 @@ class Filter extends Module{
|
|
|
9192
9213
|
var self = this,
|
|
9193
9214
|
success = column.modules.filter.success,
|
|
9194
9215
|
field = column.getField(),
|
|
9195
|
-
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params;
|
|
9216
|
+
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params, onRenderedCallback;
|
|
9196
9217
|
|
|
9197
9218
|
column.modules.filter.value = initialValue;
|
|
9198
9219
|
|
|
9199
9220
|
//handle aborted edit
|
|
9200
9221
|
function cancel(){}
|
|
9201
9222
|
|
|
9223
|
+
function onRendered(callback){
|
|
9224
|
+
onRenderedCallback = callback;
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9202
9227
|
if(column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode){
|
|
9203
9228
|
column.contentElement.removeChild(column.modules.filter.headerElement.parentNode);
|
|
9204
9229
|
}
|
|
@@ -9283,7 +9308,7 @@ class Filter extends Module{
|
|
|
9283
9308
|
|
|
9284
9309
|
params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
|
|
9285
9310
|
|
|
9286
|
-
editorElement = editor.call(this.table.modules.edit, cellWrapper,
|
|
9311
|
+
editorElement = editor.call(this.table.modules.edit, cellWrapper, onRendered, success, cancel, params);
|
|
9287
9312
|
|
|
9288
9313
|
if(!editorElement){
|
|
9289
9314
|
console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false");
|
|
@@ -9297,7 +9322,7 @@ class Filter extends Module{
|
|
|
9297
9322
|
|
|
9298
9323
|
//set Placeholder Text
|
|
9299
9324
|
self.langBind("headerFilters|columns|" + column.definition.field, function(value){
|
|
9300
|
-
editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.langText("headerFilters|default"));
|
|
9325
|
+
editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : (column.definition.headerFilterPlaceholder || self.langText("headerFilters|default")));
|
|
9301
9326
|
});
|
|
9302
9327
|
|
|
9303
9328
|
//focus on element on click
|
|
@@ -9379,6 +9404,10 @@ class Filter extends Module{
|
|
|
9379
9404
|
if(!reinitialize){
|
|
9380
9405
|
self.headerFilterColumns.push(column);
|
|
9381
9406
|
}
|
|
9407
|
+
|
|
9408
|
+
if(onRenderedCallback){
|
|
9409
|
+
onRenderedCallback();
|
|
9410
|
+
}
|
|
9382
9411
|
}
|
|
9383
9412
|
}else {
|
|
9384
9413
|
console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title);
|
|
@@ -11206,17 +11235,19 @@ class Group{
|
|
|
11206
11235
|
this.createValueGroups();
|
|
11207
11236
|
}
|
|
11208
11237
|
|
|
11209
|
-
wipe(){
|
|
11210
|
-
if(
|
|
11211
|
-
this.groupList.
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11238
|
+
wipe(elementsOnly){
|
|
11239
|
+
if(!elementsOnly){
|
|
11240
|
+
if(this.groupList.length){
|
|
11241
|
+
this.groupList.forEach(function(group){
|
|
11242
|
+
group.wipe();
|
|
11243
|
+
});
|
|
11244
|
+
}else {
|
|
11245
|
+
this.rows.forEach((row) => {
|
|
11246
|
+
if(row.modules){
|
|
11247
|
+
delete row.modules.group;
|
|
11248
|
+
}
|
|
11249
|
+
});
|
|
11250
|
+
}
|
|
11220
11251
|
}
|
|
11221
11252
|
|
|
11222
11253
|
this.element = false;
|
|
@@ -11237,7 +11268,7 @@ class Group{
|
|
|
11237
11268
|
this.arrowElement = document.createElement("div");
|
|
11238
11269
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
11239
11270
|
this.arrowElement.appendChild(arrow);
|
|
11240
|
-
|
|
11271
|
+
|
|
11241
11272
|
//setup movable rows
|
|
11242
11273
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
11243
11274
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
@@ -11375,19 +11406,22 @@ class Group{
|
|
|
11375
11406
|
this.parent.removeGroup(this);
|
|
11376
11407
|
}else {
|
|
11377
11408
|
this.groupManager.removeGroup(this);
|
|
11378
|
-
}
|
|
11409
|
+
}
|
|
11379
11410
|
|
|
11380
11411
|
this.groupManager.updateGroupRows(true);
|
|
11412
|
+
|
|
11381
11413
|
}else {
|
|
11382
11414
|
|
|
11383
11415
|
if(el.parentNode){
|
|
11384
11416
|
el.parentNode.removeChild(el);
|
|
11385
11417
|
}
|
|
11386
|
-
|
|
11387
|
-
this.
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
this.groupManager.table.
|
|
11418
|
+
|
|
11419
|
+
if(!this.groupManager.blockRedraw){
|
|
11420
|
+
this.generateGroupHeaderContents();
|
|
11421
|
+
|
|
11422
|
+
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
11423
|
+
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
11424
|
+
}
|
|
11391
11425
|
}
|
|
11392
11426
|
|
|
11393
11427
|
}
|
|
@@ -11772,6 +11806,8 @@ class GroupRows extends Module{
|
|
|
11772
11806
|
this.groups = {}; //hold row groups
|
|
11773
11807
|
|
|
11774
11808
|
this.displayHandler = this.getRows.bind(this);
|
|
11809
|
+
|
|
11810
|
+
this.blockRedraw = false;
|
|
11775
11811
|
|
|
11776
11812
|
//register table options
|
|
11777
11813
|
this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
|
|
@@ -11800,6 +11836,10 @@ class GroupRows extends Module{
|
|
|
11800
11836
|
|
|
11801
11837
|
//initialize group configuration
|
|
11802
11838
|
initialize(){
|
|
11839
|
+
this.subscribe("table-destroy", this._blockRedrawing.bind(this));
|
|
11840
|
+
this.subscribe("rows-wipe", this._blockRedrawing.bind(this));
|
|
11841
|
+
this.subscribe("rows-wiped", this._restore_redrawing.bind(this));
|
|
11842
|
+
|
|
11803
11843
|
if(this.table.options.groupBy){
|
|
11804
11844
|
if(this.table.options.groupUpdateOnCellEdit){
|
|
11805
11845
|
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
@@ -11826,6 +11866,14 @@ class GroupRows extends Module{
|
|
|
11826
11866
|
}
|
|
11827
11867
|
}
|
|
11828
11868
|
|
|
11869
|
+
_blockRedrawing(){
|
|
11870
|
+
this.blockRedraw = true;
|
|
11871
|
+
}
|
|
11872
|
+
|
|
11873
|
+
_restore_redrawing(){
|
|
11874
|
+
this.blockRedraw = false;
|
|
11875
|
+
}
|
|
11876
|
+
|
|
11829
11877
|
configureGroupSetup(){
|
|
11830
11878
|
if(this.table.options.groupBy){
|
|
11831
11879
|
var groupBy = this.table.options.groupBy,
|
|
@@ -11849,7 +11897,7 @@ class GroupRows extends Module{
|
|
|
11849
11897
|
|
|
11850
11898
|
this.groupIDLookups = [];
|
|
11851
11899
|
|
|
11852
|
-
if(
|
|
11900
|
+
if(groupBy){
|
|
11853
11901
|
if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
|
|
11854
11902
|
this.table.modules.columnCalcs.removeCalcs();
|
|
11855
11903
|
}
|
|
@@ -11989,6 +12037,10 @@ class GroupRows extends Module{
|
|
|
11989
12037
|
}
|
|
11990
12038
|
|
|
11991
12039
|
this.configureGroupSetup();
|
|
12040
|
+
|
|
12041
|
+
if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
|
|
12042
|
+
this.table.modules.columnCalcs.reinitializeCalcs();
|
|
12043
|
+
}
|
|
11992
12044
|
|
|
11993
12045
|
this.refreshData();
|
|
11994
12046
|
|
|
@@ -12235,7 +12287,7 @@ class GroupRows extends Module{
|
|
|
12235
12287
|
}
|
|
12236
12288
|
|
|
12237
12289
|
Object.values(oldGroups).forEach((group) => {
|
|
12238
|
-
group.wipe();
|
|
12290
|
+
group.wipe(true);
|
|
12239
12291
|
});
|
|
12240
12292
|
}
|
|
12241
12293
|
|
|
@@ -12307,13 +12359,15 @@ class GroupRows extends Module{
|
|
|
12307
12359
|
|
|
12308
12360
|
updateGroupRows(force){
|
|
12309
12361
|
var output = [];
|
|
12310
|
-
|
|
12311
|
-
this.
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12362
|
+
|
|
12363
|
+
if(!this.blockRedraw){
|
|
12364
|
+
this.groupList.forEach((group) => {
|
|
12365
|
+
output = output.concat(group.getHeadersAndRows());
|
|
12366
|
+
});
|
|
12367
|
+
|
|
12368
|
+
if(force){
|
|
12369
|
+
this.refreshData(true);
|
|
12370
|
+
}
|
|
12317
12371
|
}
|
|
12318
12372
|
|
|
12319
12373
|
return output;
|
|
@@ -14006,7 +14060,7 @@ class MoveColumns extends Module{
|
|
|
14006
14060
|
|
|
14007
14061
|
config.mousemove = function(e){
|
|
14008
14062
|
if(column.parent === self.moving.parent){
|
|
14009
|
-
if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.
|
|
14063
|
+
if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.contentsElement.scrollLeft) > (column.getWidth() / 2)){
|
|
14010
14064
|
if(self.toCol !== column || !self.toColAfter){
|
|
14011
14065
|
colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
|
|
14012
14066
|
self.moveColumn(column, true);
|
|
@@ -16729,6 +16783,8 @@ class Print extends Module{
|
|
|
16729
16783
|
|
|
16730
16784
|
this.element = false;
|
|
16731
16785
|
this.manualBlock = false;
|
|
16786
|
+
this.beforeprintEventHandler = null;
|
|
16787
|
+
this.afterprintEventHandler = null;
|
|
16732
16788
|
|
|
16733
16789
|
this.registerTableOption("printAsHtml", false); //enable print as html
|
|
16734
16790
|
this.registerTableOption("printFormatter", false); //printing page formatter
|
|
@@ -16744,13 +16800,24 @@ class Print extends Module{
|
|
|
16744
16800
|
|
|
16745
16801
|
initialize(){
|
|
16746
16802
|
if(this.table.options.printAsHtml){
|
|
16747
|
-
|
|
16748
|
-
|
|
16803
|
+
this.beforeprintEventHandler = this.replaceTable.bind(this);
|
|
16804
|
+
this.afterprintEventHandler = this.cleanup.bind(this);
|
|
16805
|
+
|
|
16806
|
+
window.addEventListener("beforeprint", this.beforeprintEventHandler );
|
|
16807
|
+
window.addEventListener("afterprint", this.afterprintEventHandler);
|
|
16808
|
+
this.subscribe("table-destroy", this.destroy.bind(this));
|
|
16749
16809
|
}
|
|
16750
16810
|
|
|
16751
16811
|
this.registerTableFunction("print", this.printFullscreen.bind(this));
|
|
16752
16812
|
}
|
|
16753
16813
|
|
|
16814
|
+
destroy(){
|
|
16815
|
+
if(this.table.options.printAsHtml){
|
|
16816
|
+
window.removeEventListener( "beforeprint", this.beforeprintEventHandler );
|
|
16817
|
+
window.removeEventListener( "afterprint", this.afterprintEventHandler );
|
|
16818
|
+
}
|
|
16819
|
+
}
|
|
16820
|
+
|
|
16754
16821
|
///////////////////////////////////
|
|
16755
16822
|
///////// Table Functions /////////
|
|
16756
16823
|
///////////////////////////////////
|
|
@@ -18240,7 +18307,7 @@ class SelectRow extends Module{
|
|
|
18240
18307
|
row.modules.select = {selected:false};
|
|
18241
18308
|
|
|
18242
18309
|
//set row selection class
|
|
18243
|
-
if(self.
|
|
18310
|
+
if(self.checkRowSelectability(row)){
|
|
18244
18311
|
element.classList.add("tabulator-selectable");
|
|
18245
18312
|
element.classList.remove("tabulator-unselectable");
|
|
18246
18313
|
|
|
@@ -18351,10 +18418,18 @@ class SelectRow extends Module{
|
|
|
18351
18418
|
this.lastClickedRow = row;
|
|
18352
18419
|
}
|
|
18353
18420
|
}
|
|
18421
|
+
|
|
18422
|
+
checkRowSelectability(row){
|
|
18423
|
+
if(row.type === "row"){
|
|
18424
|
+
return this.table.options.selectableCheck.call(this.table, row.getComponent());
|
|
18425
|
+
}
|
|
18426
|
+
|
|
18427
|
+
return false;
|
|
18428
|
+
}
|
|
18354
18429
|
|
|
18355
18430
|
//toggle row selection
|
|
18356
18431
|
toggleRow(row){
|
|
18357
|
-
if(this.
|
|
18432
|
+
if(this.checkRowSelectability(row)){
|
|
18358
18433
|
if(row.modules.select && row.modules.select.selected){
|
|
18359
18434
|
this._deselectRow(row);
|
|
18360
18435
|
}else {
|
|
@@ -21365,10 +21440,11 @@ class ColumnManager extends CoreFeature {
|
|
|
21365
21440
|
|
|
21366
21441
|
scrollToColumn(column, position, ifVisible){
|
|
21367
21442
|
var left = 0,
|
|
21368
|
-
offset =
|
|
21443
|
+
offset = column.getLeftOffset(),
|
|
21369
21444
|
adjust = 0,
|
|
21370
21445
|
colEl = column.getElement();
|
|
21371
21446
|
|
|
21447
|
+
|
|
21372
21448
|
return new Promise((resolve, reject) => {
|
|
21373
21449
|
|
|
21374
21450
|
if(typeof position === "undefined"){
|
|
@@ -21395,16 +21471,13 @@ class ColumnManager extends CoreFeature {
|
|
|
21395
21471
|
|
|
21396
21472
|
//check column visibility
|
|
21397
21473
|
if(!ifVisible){
|
|
21398
|
-
|
|
21399
|
-
offset = colEl.offsetLeft;
|
|
21400
|
-
|
|
21401
21474
|
if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
|
|
21402
21475
|
return false;
|
|
21403
21476
|
}
|
|
21404
21477
|
}
|
|
21405
21478
|
|
|
21406
21479
|
//calculate scroll position
|
|
21407
|
-
left =
|
|
21480
|
+
left = offset + adjust;
|
|
21408
21481
|
|
|
21409
21482
|
left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
|
|
21410
21483
|
|
|
@@ -22277,18 +22350,32 @@ class RowManager extends CoreFeature{
|
|
|
22277
22350
|
}
|
|
22278
22351
|
|
|
22279
22352
|
initializePlaceholder(){
|
|
22353
|
+
var placeholder = this.table.options.placeholder;
|
|
22354
|
+
|
|
22280
22355
|
//configure placeholder element
|
|
22281
|
-
if(
|
|
22356
|
+
if(placeholder){
|
|
22282
22357
|
let el = document.createElement("div");
|
|
22283
22358
|
el.classList.add("tabulator-placeholder");
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
22291
|
-
|
|
22359
|
+
|
|
22360
|
+
if(typeof placeholder == "string"){
|
|
22361
|
+
let contents = document.createElement("div");
|
|
22362
|
+
contents.classList.add("tabulator-placeholder-contents");
|
|
22363
|
+
contents.innerHTML = placeholder;
|
|
22364
|
+
|
|
22365
|
+
el.appendChild(contents);
|
|
22366
|
+
|
|
22367
|
+
this.placeholderContents = contents;
|
|
22368
|
+
|
|
22369
|
+
}else if(typeof HTMLElement !== "undefined" && placeholder instanceof HTMLElement){
|
|
22370
|
+
|
|
22371
|
+
el.appendChild(placeholder);
|
|
22372
|
+
this.placeholderContents = placeholder;
|
|
22373
|
+
}else {
|
|
22374
|
+
console.warn("Invalid placeholder provided, must be string or HTML Element", placeholder);
|
|
22375
|
+
|
|
22376
|
+
this.el = null;
|
|
22377
|
+
}
|
|
22378
|
+
|
|
22292
22379
|
this.placeholder = el;
|
|
22293
22380
|
}
|
|
22294
22381
|
}
|
|
@@ -22446,18 +22533,24 @@ class RowManager extends CoreFeature{
|
|
|
22446
22533
|
_wipeElements(){
|
|
22447
22534
|
this.dispatch("rows-wipe");
|
|
22448
22535
|
|
|
22536
|
+
this.destroy();
|
|
22537
|
+
|
|
22538
|
+
this.adjustTableSize();
|
|
22539
|
+
|
|
22540
|
+
this.dispatch("rows-wiped");
|
|
22541
|
+
}
|
|
22542
|
+
|
|
22543
|
+
destroy(){
|
|
22449
22544
|
this.rows.forEach((row) => {
|
|
22450
22545
|
row.wipe();
|
|
22451
22546
|
});
|
|
22452
|
-
|
|
22547
|
+
|
|
22453
22548
|
this.rows = [];
|
|
22454
22549
|
this.activeRows = [];
|
|
22455
22550
|
this.activeRowsPipeline = [];
|
|
22456
22551
|
this.activeRowsCount = 0;
|
|
22457
22552
|
this.displayRows = [];
|
|
22458
22553
|
this.displayRowsCount = 0;
|
|
22459
|
-
|
|
22460
|
-
this.adjustTableSize();
|
|
22461
22554
|
}
|
|
22462
22555
|
|
|
22463
22556
|
deleteRow(row, blockRedraw){
|
|
@@ -22505,7 +22598,7 @@ class RowManager extends CoreFeature{
|
|
|
22505
22598
|
}
|
|
22506
22599
|
|
|
22507
22600
|
//add multiple rows
|
|
22508
|
-
addRows(data, pos, index){
|
|
22601
|
+
addRows(data, pos, index, refreshDisplayOnly){
|
|
22509
22602
|
var rows = [];
|
|
22510
22603
|
|
|
22511
22604
|
return new Promise((resolve, reject) => {
|
|
@@ -22524,8 +22617,8 @@ class RowManager extends CoreFeature{
|
|
|
22524
22617
|
rows.push(row);
|
|
22525
22618
|
this.dispatch("row-added", row, data, pos, index);
|
|
22526
22619
|
});
|
|
22527
|
-
|
|
22528
|
-
this.refreshActiveData(false, false, true);
|
|
22620
|
+
|
|
22621
|
+
this.refreshActiveData(refreshDisplayOnly ? "displayPipeline" : false, false, true);
|
|
22529
22622
|
|
|
22530
22623
|
this.regenerateRowPositions();
|
|
22531
22624
|
|
|
@@ -23005,22 +23098,21 @@ class RowManager extends CoreFeature{
|
|
|
23005
23098
|
getRows(type){
|
|
23006
23099
|
var rows = [];
|
|
23007
23100
|
|
|
23008
|
-
|
|
23009
|
-
|
|
23010
|
-
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23101
|
+
switch(type){
|
|
23102
|
+
case "active":
|
|
23103
|
+
rows = this.activeRows;
|
|
23104
|
+
break;
|
|
23105
|
+
|
|
23106
|
+
case "display":
|
|
23107
|
+
rows = this.table.rowManager.getDisplayRows();
|
|
23108
|
+
break;
|
|
23015
23109
|
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
break;
|
|
23023
|
-
}
|
|
23110
|
+
case "visible":
|
|
23111
|
+
rows = this.getVisibleRows(false, true);
|
|
23112
|
+
break;
|
|
23113
|
+
|
|
23114
|
+
default:
|
|
23115
|
+
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
23024
23116
|
}
|
|
23025
23117
|
|
|
23026
23118
|
return rows;
|
|
@@ -24602,15 +24694,6 @@ class Localize extends Module{
|
|
|
24602
24694
|
this.langList.default.headerFilters.default = placeholder;
|
|
24603
24695
|
}
|
|
24604
24696
|
|
|
24605
|
-
//set header filter placeholder by column
|
|
24606
|
-
setHeaderFilterColumnPlaceholder(column, placeholder){
|
|
24607
|
-
this.langList.default.headerFilters.columns[column] = placeholder;
|
|
24608
|
-
|
|
24609
|
-
if(this.lang && !this.lang.headerFilters.columns[column]){
|
|
24610
|
-
this.lang.headerFilters.columns[column] = placeholder;
|
|
24611
|
-
}
|
|
24612
|
-
}
|
|
24613
|
-
|
|
24614
24697
|
//setup a lang description object
|
|
24615
24698
|
installLang(locale, lang){
|
|
24616
24699
|
if(this.langList[locale]){
|
|
@@ -25240,13 +25323,7 @@ class Tabulator {
|
|
|
25240
25323
|
this.eventBus.dispatch("table-destroy");
|
|
25241
25324
|
|
|
25242
25325
|
//clear row data
|
|
25243
|
-
this.rowManager.
|
|
25244
|
-
row.wipe();
|
|
25245
|
-
});
|
|
25246
|
-
|
|
25247
|
-
this.rowManager.rows = [];
|
|
25248
|
-
this.rowManager.activeRows = [];
|
|
25249
|
-
this.rowManager.displayRows = [];
|
|
25326
|
+
this.rowManager.destroy();
|
|
25250
25327
|
|
|
25251
25328
|
//clear DOM
|
|
25252
25329
|
while(element.firstChild) element.removeChild(element.firstChild);
|
|
@@ -25381,7 +25458,12 @@ class Tabulator {
|
|
|
25381
25458
|
if(!responses){
|
|
25382
25459
|
resolve();
|
|
25383
25460
|
}
|
|
25461
|
+
})
|
|
25462
|
+
.catch((e) => {
|
|
25463
|
+
reject("Update Error - Unable to update row", item, e);
|
|
25384
25464
|
});
|
|
25465
|
+
}else {
|
|
25466
|
+
reject("Update Error - Unable to find row", item);
|
|
25385
25467
|
}
|
|
25386
25468
|
});
|
|
25387
25469
|
}else {
|
|
@@ -25537,7 +25619,7 @@ class Tabulator {
|
|
|
25537
25619
|
data = JSON.parse(data);
|
|
25538
25620
|
}
|
|
25539
25621
|
|
|
25540
|
-
return this.rowManager.addRows(data, pos, index)
|
|
25622
|
+
return this.rowManager.addRows(data, pos, index, true)
|
|
25541
25623
|
.then((rows)=>{
|
|
25542
25624
|
return rows[0].getComponent();
|
|
25543
25625
|
});
|