tabulator-tables 5.4.2 → 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/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 +280 -222
- 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 +280 -222
- 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/RowManager.js +49 -30
- package/src/js/core/Tabulator.js +7 -8
- package/src/js/core/tools/Popup.js +1 -1
- 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 +10 -7
- package/src/js/modules/GroupRows/GroupRows.js +23 -7
- package/src/js/modules/Localize/Localize.js +0 -9
- 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
|
|
|
@@ -5260,7 +5260,7 @@ function maskInput(el, options){
|
|
|
5260
5260
|
var index = el.value.length,
|
|
5261
5261
|
char = e.key;
|
|
5262
5262
|
|
|
5263
|
-
if(e.keyCode > 46){
|
|
5263
|
+
if(e.keyCode > 46 && !e.ctrlKey && !e.metaKey){
|
|
5264
5264
|
if(index >= mask.length){
|
|
5265
5265
|
e.preventDefault();
|
|
5266
5266
|
e.stopPropagation();
|
|
@@ -7011,7 +7011,7 @@ class Edit{
|
|
|
7011
7011
|
if(this.currentItems[0]){
|
|
7012
7012
|
output = this.currentItems[0].value;
|
|
7013
7013
|
}else {
|
|
7014
|
-
initialValue = this.initialValues[0];
|
|
7014
|
+
initialValue = Array.isArray(this.initialValues) ? this.initialValues[0] : this.initialValues;
|
|
7015
7015
|
|
|
7016
7016
|
if(initialValue === null || typeof initialValue === "undefined" || initialValue === ""){
|
|
7017
7017
|
output = initialValue;
|
|
@@ -8197,57 +8197,57 @@ class ExportColumn{
|
|
|
8197
8197
|
}
|
|
8198
8198
|
|
|
8199
8199
|
class Export extends Module{
|
|
8200
|
-
|
|
8200
|
+
|
|
8201
8201
|
constructor(table){
|
|
8202
8202
|
super(table);
|
|
8203
|
-
|
|
8203
|
+
|
|
8204
8204
|
this.config = {};
|
|
8205
8205
|
this.cloneTableStyle = true;
|
|
8206
8206
|
this.colVisProp = "";
|
|
8207
|
-
|
|
8207
|
+
|
|
8208
8208
|
this.registerTableOption("htmlOutputConfig", false); //html output config
|
|
8209
|
-
|
|
8209
|
+
|
|
8210
8210
|
this.registerColumnOption("htmlOutput");
|
|
8211
8211
|
this.registerColumnOption("titleHtmlOutput");
|
|
8212
8212
|
}
|
|
8213
|
-
|
|
8213
|
+
|
|
8214
8214
|
initialize(){
|
|
8215
8215
|
this.registerTableFunction("getHtml", this.getHtml.bind(this));
|
|
8216
8216
|
}
|
|
8217
|
-
|
|
8217
|
+
|
|
8218
8218
|
///////////////////////////////////
|
|
8219
8219
|
///////// Table Functions /////////
|
|
8220
8220
|
///////////////////////////////////
|
|
8221
|
-
|
|
8222
|
-
|
|
8221
|
+
|
|
8222
|
+
|
|
8223
8223
|
///////////////////////////////////
|
|
8224
8224
|
///////// Internal Logic //////////
|
|
8225
8225
|
///////////////////////////////////
|
|
8226
|
-
|
|
8226
|
+
|
|
8227
8227
|
generateExportList(config, style, range, colVisProp){
|
|
8228
8228
|
this.cloneTableStyle = style;
|
|
8229
8229
|
this.config = config || {};
|
|
8230
8230
|
this.colVisProp = colVisProp;
|
|
8231
|
-
|
|
8231
|
+
|
|
8232
8232
|
var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : [];
|
|
8233
8233
|
var body = this.bodyToExportRows(this.rowLookup(range));
|
|
8234
|
-
|
|
8234
|
+
|
|
8235
8235
|
return headers.concat(body);
|
|
8236
8236
|
}
|
|
8237
|
-
|
|
8237
|
+
|
|
8238
8238
|
generateTable(config, style, range, colVisProp){
|
|
8239
8239
|
var list = this.generateExportList(config, style, range, colVisProp);
|
|
8240
|
-
|
|
8240
|
+
|
|
8241
8241
|
return this.generateTableElement(list);
|
|
8242
8242
|
}
|
|
8243
|
-
|
|
8243
|
+
|
|
8244
8244
|
rowLookup(range){
|
|
8245
8245
|
var rows = [];
|
|
8246
|
-
|
|
8246
|
+
|
|
8247
8247
|
if(typeof range == "function"){
|
|
8248
8248
|
range.call(this.table).forEach((row) =>{
|
|
8249
8249
|
row = this.table.rowManager.findRow(row);
|
|
8250
|
-
|
|
8250
|
+
|
|
8251
8251
|
if(row){
|
|
8252
8252
|
rows.push(row);
|
|
8253
8253
|
}
|
|
@@ -8258,15 +8258,15 @@ class Export extends Module{
|
|
|
8258
8258
|
case "visible":
|
|
8259
8259
|
rows = this.table.rowManager.getVisibleRows(false, true);
|
|
8260
8260
|
break;
|
|
8261
|
-
|
|
8261
|
+
|
|
8262
8262
|
case "all":
|
|
8263
8263
|
rows = this.table.rowManager.rows;
|
|
8264
8264
|
break;
|
|
8265
|
-
|
|
8265
|
+
|
|
8266
8266
|
case "selected":
|
|
8267
8267
|
rows = this.table.modules.selectRow.selectedRows;
|
|
8268
8268
|
break;
|
|
8269
|
-
|
|
8269
|
+
|
|
8270
8270
|
case "active":
|
|
8271
8271
|
default:
|
|
8272
8272
|
if(this.table.options.pagination){
|
|
@@ -8276,56 +8276,56 @@ class Export extends Module{
|
|
|
8276
8276
|
}
|
|
8277
8277
|
}
|
|
8278
8278
|
}
|
|
8279
|
-
|
|
8279
|
+
|
|
8280
8280
|
return Object.assign([], rows);
|
|
8281
8281
|
}
|
|
8282
|
-
|
|
8282
|
+
|
|
8283
8283
|
generateColumnGroupHeaders(){
|
|
8284
8284
|
var output = [];
|
|
8285
|
-
|
|
8285
|
+
|
|
8286
8286
|
var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex;
|
|
8287
|
-
|
|
8287
|
+
|
|
8288
8288
|
columns.forEach((column) => {
|
|
8289
8289
|
var colData = this.processColumnGroup(column);
|
|
8290
|
-
|
|
8290
|
+
|
|
8291
8291
|
if(colData){
|
|
8292
8292
|
output.push(colData);
|
|
8293
8293
|
}
|
|
8294
8294
|
});
|
|
8295
|
-
|
|
8295
|
+
|
|
8296
8296
|
return output;
|
|
8297
8297
|
}
|
|
8298
|
-
|
|
8298
|
+
|
|
8299
8299
|
processColumnGroup(column){
|
|
8300
8300
|
var subGroups = column.columns,
|
|
8301
8301
|
maxDepth = 0,
|
|
8302
8302
|
title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title;
|
|
8303
|
-
|
|
8303
|
+
|
|
8304
8304
|
var groupData = {
|
|
8305
8305
|
title:title,
|
|
8306
8306
|
column:column,
|
|
8307
8307
|
depth:1,
|
|
8308
8308
|
};
|
|
8309
|
-
|
|
8309
|
+
|
|
8310
8310
|
if(subGroups.length){
|
|
8311
8311
|
groupData.subGroups = [];
|
|
8312
8312
|
groupData.width = 0;
|
|
8313
|
-
|
|
8313
|
+
|
|
8314
8314
|
subGroups.forEach((subGroup) => {
|
|
8315
8315
|
var subGroupData = this.processColumnGroup(subGroup);
|
|
8316
|
-
|
|
8316
|
+
|
|
8317
8317
|
if(subGroupData){
|
|
8318
8318
|
groupData.width += subGroupData.width;
|
|
8319
8319
|
groupData.subGroups.push(subGroupData);
|
|
8320
|
-
|
|
8320
|
+
|
|
8321
8321
|
if(subGroupData.depth > maxDepth){
|
|
8322
8322
|
maxDepth = subGroupData.depth;
|
|
8323
8323
|
}
|
|
8324
8324
|
}
|
|
8325
8325
|
});
|
|
8326
|
-
|
|
8326
|
+
|
|
8327
8327
|
groupData.depth += maxDepth;
|
|
8328
|
-
|
|
8328
|
+
|
|
8329
8329
|
if(!groupData.width){
|
|
8330
8330
|
return false;
|
|
8331
8331
|
}
|
|
@@ -8336,75 +8336,75 @@ class Export extends Module{
|
|
|
8336
8336
|
return false;
|
|
8337
8337
|
}
|
|
8338
8338
|
}
|
|
8339
|
-
|
|
8339
|
+
|
|
8340
8340
|
return groupData;
|
|
8341
8341
|
}
|
|
8342
|
-
|
|
8342
|
+
|
|
8343
8343
|
columnVisCheck(column){
|
|
8344
8344
|
var visProp = column.definition[this.colVisProp];
|
|
8345
|
-
|
|
8345
|
+
|
|
8346
8346
|
if(typeof visProp === "function"){
|
|
8347
8347
|
visProp = visProp.call(this.table, column.getComponent());
|
|
8348
8348
|
}
|
|
8349
|
-
|
|
8349
|
+
|
|
8350
8350
|
return visProp !== false && (column.visible || (!column.visible && visProp));
|
|
8351
8351
|
}
|
|
8352
|
-
|
|
8352
|
+
|
|
8353
8353
|
headersToExportRows(columns){
|
|
8354
8354
|
var headers = [],
|
|
8355
8355
|
headerDepth = 0,
|
|
8356
8356
|
exportRows = [];
|
|
8357
|
-
|
|
8357
|
+
|
|
8358
8358
|
function parseColumnGroup(column, level){
|
|
8359
|
-
|
|
8359
|
+
|
|
8360
8360
|
var depth = headerDepth - level;
|
|
8361
|
-
|
|
8361
|
+
|
|
8362
8362
|
if(typeof headers[level] === "undefined"){
|
|
8363
8363
|
headers[level] = [];
|
|
8364
8364
|
}
|
|
8365
|
-
|
|
8365
|
+
|
|
8366
8366
|
column.height = column.subGroups ? 1 : (depth - column.depth) + 1;
|
|
8367
|
-
|
|
8367
|
+
|
|
8368
8368
|
headers[level].push(column);
|
|
8369
|
-
|
|
8369
|
+
|
|
8370
8370
|
if(column.height > 1){
|
|
8371
8371
|
for(let i = 1; i < column.height; i ++){
|
|
8372
|
-
|
|
8372
|
+
|
|
8373
8373
|
if(typeof headers[level + i] === "undefined"){
|
|
8374
8374
|
headers[level + i] = [];
|
|
8375
8375
|
}
|
|
8376
|
-
|
|
8376
|
+
|
|
8377
8377
|
headers[level + i].push(false);
|
|
8378
8378
|
}
|
|
8379
8379
|
}
|
|
8380
|
-
|
|
8380
|
+
|
|
8381
8381
|
if(column.width > 1){
|
|
8382
8382
|
for(let i = 1; i < column.width; i ++){
|
|
8383
8383
|
headers[level].push(false);
|
|
8384
8384
|
}
|
|
8385
8385
|
}
|
|
8386
|
-
|
|
8386
|
+
|
|
8387
8387
|
if(column.subGroups){
|
|
8388
8388
|
column.subGroups.forEach(function(subGroup){
|
|
8389
8389
|
parseColumnGroup(subGroup, level+1);
|
|
8390
8390
|
});
|
|
8391
8391
|
}
|
|
8392
8392
|
}
|
|
8393
|
-
|
|
8393
|
+
|
|
8394
8394
|
//calculate maximum header depth
|
|
8395
8395
|
columns.forEach(function(column){
|
|
8396
8396
|
if(column.depth > headerDepth){
|
|
8397
8397
|
headerDepth = column.depth;
|
|
8398
8398
|
}
|
|
8399
8399
|
});
|
|
8400
|
-
|
|
8400
|
+
|
|
8401
8401
|
columns.forEach(function(column){
|
|
8402
8402
|
parseColumnGroup(column,0);
|
|
8403
8403
|
});
|
|
8404
|
-
|
|
8404
|
+
|
|
8405
8405
|
headers.forEach((header) => {
|
|
8406
8406
|
var columns = [];
|
|
8407
|
-
|
|
8407
|
+
|
|
8408
8408
|
header.forEach((col) => {
|
|
8409
8409
|
if(col){
|
|
8410
8410
|
let title = typeof col.title === "undefined" ? "" : col.title;
|
|
@@ -8413,78 +8413,78 @@ class Export extends Module{
|
|
|
8413
8413
|
columns.push(null);
|
|
8414
8414
|
}
|
|
8415
8415
|
});
|
|
8416
|
-
|
|
8416
|
+
|
|
8417
8417
|
exportRows.push(new ExportRow("header", columns));
|
|
8418
8418
|
});
|
|
8419
|
-
|
|
8419
|
+
|
|
8420
8420
|
return exportRows;
|
|
8421
8421
|
}
|
|
8422
|
-
|
|
8422
|
+
|
|
8423
8423
|
bodyToExportRows(rows){
|
|
8424
|
-
|
|
8424
|
+
|
|
8425
8425
|
var columns = [];
|
|
8426
8426
|
var exportRows = [];
|
|
8427
|
-
|
|
8427
|
+
|
|
8428
8428
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
8429
8429
|
if (this.columnVisCheck(column)) {
|
|
8430
8430
|
columns.push(column.getComponent());
|
|
8431
8431
|
}
|
|
8432
8432
|
});
|
|
8433
|
-
|
|
8433
|
+
|
|
8434
8434
|
if(this.config.columnCalcs !== false && this.table.modExists("columnCalcs")){
|
|
8435
8435
|
if(this.table.modules.columnCalcs.topInitialized){
|
|
8436
8436
|
rows.unshift(this.table.modules.columnCalcs.topRow);
|
|
8437
8437
|
}
|
|
8438
|
-
|
|
8438
|
+
|
|
8439
8439
|
if(this.table.modules.columnCalcs.botInitialized){
|
|
8440
8440
|
rows.push(this.table.modules.columnCalcs.botRow);
|
|
8441
8441
|
}
|
|
8442
8442
|
}
|
|
8443
|
-
|
|
8443
|
+
|
|
8444
8444
|
rows = rows.filter((row) => {
|
|
8445
8445
|
switch(row.type){
|
|
8446
8446
|
case "group":
|
|
8447
8447
|
return this.config.rowGroups !== false;
|
|
8448
|
-
|
|
8448
|
+
|
|
8449
8449
|
case "calc":
|
|
8450
8450
|
return this.config.columnCalcs !== false;
|
|
8451
|
-
|
|
8451
|
+
|
|
8452
8452
|
case "row":
|
|
8453
8453
|
return !(this.table.options.dataTree && this.config.dataTree === false && row.modules.dataTree.parent);
|
|
8454
8454
|
}
|
|
8455
|
-
|
|
8455
|
+
|
|
8456
8456
|
return true;
|
|
8457
8457
|
});
|
|
8458
|
-
|
|
8458
|
+
|
|
8459
8459
|
rows.forEach((row, i) => {
|
|
8460
8460
|
var rowData = row.getData(this.colVisProp);
|
|
8461
8461
|
var exportCols = [];
|
|
8462
8462
|
var indent = 0;
|
|
8463
|
-
|
|
8463
|
+
|
|
8464
8464
|
switch(row.type){
|
|
8465
8465
|
case "group":
|
|
8466
8466
|
indent = row.level;
|
|
8467
8467
|
exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1));
|
|
8468
8468
|
break;
|
|
8469
|
-
|
|
8469
|
+
|
|
8470
8470
|
case "calc" :
|
|
8471
8471
|
case "row" :
|
|
8472
8472
|
columns.forEach((col) => {
|
|
8473
8473
|
exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1));
|
|
8474
8474
|
});
|
|
8475
|
-
|
|
8475
|
+
|
|
8476
8476
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
8477
8477
|
indent = row.modules.dataTree.index;
|
|
8478
8478
|
}
|
|
8479
8479
|
break;
|
|
8480
8480
|
}
|
|
8481
|
-
|
|
8481
|
+
|
|
8482
8482
|
exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent));
|
|
8483
8483
|
});
|
|
8484
|
-
|
|
8484
|
+
|
|
8485
8485
|
return exportRows;
|
|
8486
8486
|
}
|
|
8487
|
-
|
|
8487
|
+
|
|
8488
8488
|
generateTableElement(list){
|
|
8489
8489
|
var table = document.createElement("table"),
|
|
8490
8490
|
headerEl = document.createElement("thead"),
|
|
@@ -8492,68 +8492,68 @@ class Export extends Module{
|
|
|
8492
8492
|
styles = this.lookupTableStyles(),
|
|
8493
8493
|
rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))],
|
|
8494
8494
|
setup = {};
|
|
8495
|
-
|
|
8495
|
+
|
|
8496
8496
|
setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter;
|
|
8497
|
-
|
|
8497
|
+
|
|
8498
8498
|
if(this.table.options.dataTree &&this.config.dataTree !== false && this.table.modExists("columnCalcs")){
|
|
8499
8499
|
setup.treeElementField = this.table.modules.dataTree.elementField;
|
|
8500
8500
|
}
|
|
8501
|
-
|
|
8501
|
+
|
|
8502
8502
|
//assign group header formatter
|
|
8503
8503
|
setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))];
|
|
8504
|
-
|
|
8504
|
+
|
|
8505
8505
|
if(setup.groupHeader && !Array.isArray(setup.groupHeader)){
|
|
8506
8506
|
setup.groupHeader = [setup.groupHeader];
|
|
8507
8507
|
}
|
|
8508
|
-
|
|
8508
|
+
|
|
8509
8509
|
table.classList.add("tabulator-print-table");
|
|
8510
|
-
|
|
8510
|
+
|
|
8511
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"]);
|
|
8512
|
-
|
|
8513
|
-
|
|
8512
|
+
|
|
8513
|
+
|
|
8514
8514
|
if(list.length > 1000){
|
|
8515
8515
|
console.warn("It may take a long time to render an HTML table with more than 1000 rows");
|
|
8516
8516
|
}
|
|
8517
|
-
|
|
8517
|
+
|
|
8518
8518
|
list.forEach((row, i) => {
|
|
8519
8519
|
let rowEl;
|
|
8520
|
-
|
|
8520
|
+
|
|
8521
8521
|
switch(row.type){
|
|
8522
8522
|
case "header":
|
|
8523
8523
|
headerEl.appendChild(this.generateHeaderElement(row, setup, styles));
|
|
8524
8524
|
break;
|
|
8525
|
-
|
|
8525
|
+
|
|
8526
8526
|
case "group":
|
|
8527
8527
|
bodyEl.appendChild(this.generateGroupElement(row, setup, styles));
|
|
8528
8528
|
break;
|
|
8529
|
-
|
|
8529
|
+
|
|
8530
8530
|
case "calc":
|
|
8531
8531
|
bodyEl.appendChild(this.generateCalcElement(row, setup, styles));
|
|
8532
8532
|
break;
|
|
8533
|
-
|
|
8533
|
+
|
|
8534
8534
|
case "row":
|
|
8535
8535
|
rowEl = this.generateRowElement(row, setup, styles);
|
|
8536
|
-
|
|
8536
|
+
|
|
8537
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"]);
|
|
8538
8538
|
bodyEl.appendChild(rowEl);
|
|
8539
8539
|
break;
|
|
8540
8540
|
}
|
|
8541
8541
|
});
|
|
8542
|
-
|
|
8542
|
+
|
|
8543
8543
|
if(headerEl.innerHTML){
|
|
8544
8544
|
table.appendChild(headerEl);
|
|
8545
8545
|
}
|
|
8546
|
-
|
|
8546
|
+
|
|
8547
8547
|
table.appendChild(bodyEl);
|
|
8548
|
-
|
|
8549
|
-
|
|
8548
|
+
|
|
8549
|
+
|
|
8550
8550
|
this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]);
|
|
8551
8551
|
return table;
|
|
8552
8552
|
}
|
|
8553
|
-
|
|
8553
|
+
|
|
8554
8554
|
lookupTableStyles(){
|
|
8555
8555
|
var styles = {};
|
|
8556
|
-
|
|
8556
|
+
|
|
8557
8557
|
//lookup row styles
|
|
8558
8558
|
if(this.cloneTableStyle && window.getComputedStyle){
|
|
8559
8559
|
styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)");
|
|
@@ -8561,41 +8561,41 @@ class Export extends Module{
|
|
|
8561
8561
|
styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs");
|
|
8562
8562
|
styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)");
|
|
8563
8563
|
styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0];
|
|
8564
|
-
|
|
8564
|
+
|
|
8565
8565
|
if(styles.firstRow){
|
|
8566
8566
|
styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell");
|
|
8567
8567
|
styles.firstCell = styles.styleCells[0];
|
|
8568
8568
|
styles.lastCell = styles.styleCells[styles.styleCells.length - 1];
|
|
8569
8569
|
}
|
|
8570
8570
|
}
|
|
8571
|
-
|
|
8571
|
+
|
|
8572
8572
|
return styles;
|
|
8573
8573
|
}
|
|
8574
|
-
|
|
8574
|
+
|
|
8575
8575
|
generateHeaderElement(row, setup, styles){
|
|
8576
8576
|
var rowEl = document.createElement("tr");
|
|
8577
|
-
|
|
8577
|
+
|
|
8578
8578
|
row.columns.forEach((column) => {
|
|
8579
8579
|
if(column){
|
|
8580
8580
|
var cellEl = document.createElement("th");
|
|
8581
8581
|
var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : [];
|
|
8582
|
-
|
|
8582
|
+
|
|
8583
8583
|
cellEl.colSpan = column.width;
|
|
8584
8584
|
cellEl.rowSpan = column.height;
|
|
8585
|
-
|
|
8585
|
+
|
|
8586
8586
|
cellEl.innerHTML = column.value;
|
|
8587
|
-
|
|
8587
|
+
|
|
8588
8588
|
if(this.cloneTableStyle){
|
|
8589
8589
|
cellEl.style.boxSizing = "border-box";
|
|
8590
8590
|
}
|
|
8591
|
-
|
|
8591
|
+
|
|
8592
8592
|
classNames.forEach(function(className) {
|
|
8593
8593
|
cellEl.classList.add(className);
|
|
8594
8594
|
});
|
|
8595
|
-
|
|
8595
|
+
|
|
8596
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"]);
|
|
8597
8597
|
this.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
8598
|
-
|
|
8598
|
+
|
|
8599
8599
|
if(column.component._column.visible){
|
|
8600
8600
|
this.mapElementStyles(column.component.getElement(), cellEl, ["width"]);
|
|
8601
8601
|
}else {
|
|
@@ -8603,26 +8603,26 @@ class Export extends Module{
|
|
|
8603
8603
|
cellEl.style.width = column.component._column.definition.width + "px";
|
|
8604
8604
|
}
|
|
8605
8605
|
}
|
|
8606
|
-
|
|
8606
|
+
|
|
8607
8607
|
if(column.component._column.parent){
|
|
8608
8608
|
this.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]);
|
|
8609
8609
|
}
|
|
8610
|
-
|
|
8610
|
+
|
|
8611
8611
|
rowEl.appendChild(cellEl);
|
|
8612
8612
|
}
|
|
8613
8613
|
});
|
|
8614
|
-
|
|
8614
|
+
|
|
8615
8615
|
return rowEl;
|
|
8616
8616
|
}
|
|
8617
|
-
|
|
8617
|
+
|
|
8618
8618
|
generateGroupElement(row, setup, styles){
|
|
8619
|
-
|
|
8619
|
+
|
|
8620
8620
|
var rowEl = document.createElement("tr"),
|
|
8621
8621
|
cellEl = document.createElement("td"),
|
|
8622
8622
|
group = row.columns[0];
|
|
8623
|
-
|
|
8623
|
+
|
|
8624
8624
|
rowEl.classList.add("tabulator-print-table-row");
|
|
8625
|
-
|
|
8625
|
+
|
|
8626
8626
|
if(setup.groupHeader && setup.groupHeader[row.indent]){
|
|
8627
8627
|
group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
8628
8628
|
}else {
|
|
@@ -8630,39 +8630,39 @@ class Export extends Module{
|
|
|
8630
8630
|
group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
8631
8631
|
}
|
|
8632
8632
|
}
|
|
8633
|
-
|
|
8633
|
+
|
|
8634
8634
|
cellEl.colSpan = group.width;
|
|
8635
8635
|
cellEl.innerHTML = group.value;
|
|
8636
|
-
|
|
8636
|
+
|
|
8637
8637
|
rowEl.classList.add("tabulator-print-table-group");
|
|
8638
8638
|
rowEl.classList.add("tabulator-group-level-" + row.indent);
|
|
8639
|
-
|
|
8639
|
+
|
|
8640
8640
|
if(group.component.isVisible()){
|
|
8641
8641
|
rowEl.classList.add("tabulator-group-visible");
|
|
8642
8642
|
}
|
|
8643
|
-
|
|
8643
|
+
|
|
8644
8644
|
this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
8645
8645
|
this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
8646
|
-
|
|
8646
|
+
|
|
8647
8647
|
rowEl.appendChild(cellEl);
|
|
8648
|
-
|
|
8648
|
+
|
|
8649
8649
|
return rowEl;
|
|
8650
8650
|
}
|
|
8651
|
-
|
|
8651
|
+
|
|
8652
8652
|
generateCalcElement(row, setup, styles){
|
|
8653
8653
|
var rowEl = this.generateRowElement(row, setup, styles);
|
|
8654
|
-
|
|
8654
|
+
|
|
8655
8655
|
rowEl.classList.add("tabulator-print-table-calcs");
|
|
8656
8656
|
this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
8657
|
-
|
|
8657
|
+
|
|
8658
8658
|
return rowEl;
|
|
8659
8659
|
}
|
|
8660
|
-
|
|
8660
|
+
|
|
8661
8661
|
generateRowElement(row, setup, styles){
|
|
8662
8662
|
var rowEl = document.createElement("tr");
|
|
8663
|
-
|
|
8663
|
+
|
|
8664
8664
|
rowEl.classList.add("tabulator-print-table-row");
|
|
8665
|
-
|
|
8665
|
+
|
|
8666
8666
|
row.columns.forEach((col, i) => {
|
|
8667
8667
|
if(col){
|
|
8668
8668
|
var cellEl = document.createElement("td"),
|
|
@@ -8670,7 +8670,7 @@ class Export extends Module{
|
|
|
8670
8670
|
index = this.table.columnManager.findColumnIndex(column),
|
|
8671
8671
|
value = col.value,
|
|
8672
8672
|
cellStyle;
|
|
8673
|
-
|
|
8673
|
+
|
|
8674
8674
|
var cellWrapper = {
|
|
8675
8675
|
modules:{},
|
|
8676
8676
|
getValue:function(){
|
|
@@ -8696,13 +8696,13 @@ class Export extends Module{
|
|
|
8696
8696
|
},
|
|
8697
8697
|
column:column,
|
|
8698
8698
|
};
|
|
8699
|
-
|
|
8699
|
+
|
|
8700
8700
|
var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : [];
|
|
8701
|
-
|
|
8701
|
+
|
|
8702
8702
|
classNames.forEach(function(className) {
|
|
8703
8703
|
cellEl.classList.add(className);
|
|
8704
8704
|
});
|
|
8705
|
-
|
|
8705
|
+
|
|
8706
8706
|
if(this.table.modExists("format") && this.config.formatCells !== false){
|
|
8707
8707
|
value = this.table.modules.format.formatExportValue(cellWrapper, this.colVisProp);
|
|
8708
8708
|
}else {
|
|
@@ -8710,29 +8710,29 @@ class Export extends Module{
|
|
|
8710
8710
|
case "object":
|
|
8711
8711
|
value = value !== null ? JSON.stringify(value) : "";
|
|
8712
8712
|
break;
|
|
8713
|
-
|
|
8713
|
+
|
|
8714
8714
|
case "undefined":
|
|
8715
8715
|
value = "";
|
|
8716
8716
|
break;
|
|
8717
8717
|
}
|
|
8718
8718
|
}
|
|
8719
|
-
|
|
8719
|
+
|
|
8720
8720
|
if(value instanceof Node){
|
|
8721
8721
|
cellEl.appendChild(value);
|
|
8722
8722
|
}else {
|
|
8723
8723
|
cellEl.innerHTML = value;
|
|
8724
8724
|
}
|
|
8725
|
-
|
|
8725
|
+
|
|
8726
8726
|
cellStyle = styles.styleCells && styles.styleCells[index] ? styles.styleCells[index] : styles.firstCell;
|
|
8727
|
-
|
|
8727
|
+
|
|
8728
8728
|
if(cellStyle){
|
|
8729
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"]);
|
|
8730
|
-
|
|
8730
|
+
|
|
8731
8731
|
if(column.definition.align){
|
|
8732
8732
|
cellEl.style.textAlign = column.definition.align;
|
|
8733
8733
|
}
|
|
8734
8734
|
}
|
|
8735
|
-
|
|
8735
|
+
|
|
8736
8736
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
8737
8737
|
if((setup.treeElementField && setup.treeElementField == column.field) || (!setup.treeElementField && i == 0)){
|
|
8738
8738
|
if(row.component._row.modules.dataTree.controlEl){
|
|
@@ -8743,39 +8743,43 @@ class Export extends Module{
|
|
|
8743
8743
|
}
|
|
8744
8744
|
}
|
|
8745
8745
|
}
|
|
8746
|
-
|
|
8746
|
+
|
|
8747
8747
|
rowEl.appendChild(cellEl);
|
|
8748
|
-
|
|
8748
|
+
|
|
8749
8749
|
if(cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback){
|
|
8750
8750
|
cellWrapper.modules.format.renderedCallback();
|
|
8751
8751
|
}
|
|
8752
|
-
|
|
8753
|
-
if(setup.rowFormatter && this.config.formatCells !== false){
|
|
8754
|
-
setup.rowFormatter(row.component);
|
|
8755
|
-
}
|
|
8756
8752
|
}
|
|
8757
8753
|
});
|
|
8754
|
+
|
|
8755
|
+
if(setup.rowFormatter && row.type === "row" && this.config.formatCells !== false){
|
|
8756
|
+
let formatComponent = Object.assign(row.component);
|
|
8758
8757
|
|
|
8758
|
+
formatComponent.getElement = function(){return rowEl;};
|
|
8759
|
+
|
|
8760
|
+
setup.rowFormatter(row.component);
|
|
8761
|
+
}
|
|
8762
|
+
|
|
8759
8763
|
return rowEl;
|
|
8760
8764
|
}
|
|
8761
|
-
|
|
8765
|
+
|
|
8762
8766
|
generateHTMLTable(list){
|
|
8763
8767
|
var holder = document.createElement("div");
|
|
8764
|
-
|
|
8768
|
+
|
|
8765
8769
|
holder.appendChild(this.generateTableElement(list));
|
|
8766
|
-
|
|
8770
|
+
|
|
8767
8771
|
return holder.innerHTML;
|
|
8768
8772
|
}
|
|
8769
|
-
|
|
8773
|
+
|
|
8770
8774
|
getHtml(visible, style, config, colVisProp){
|
|
8771
8775
|
var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput");
|
|
8772
|
-
|
|
8776
|
+
|
|
8773
8777
|
return this.generateHTMLTable(list);
|
|
8774
8778
|
}
|
|
8775
|
-
|
|
8779
|
+
|
|
8776
8780
|
mapElementStyles(from, to, props){
|
|
8777
8781
|
if(this.cloneTableStyle && from && to){
|
|
8778
|
-
|
|
8782
|
+
|
|
8779
8783
|
var lookup = {
|
|
8780
8784
|
"background-color" : "backgroundColor",
|
|
8781
8785
|
"color" : "fontColor",
|
|
@@ -8793,12 +8797,14 @@ class Export extends Module{
|
|
|
8793
8797
|
"padding-right" : "paddingRight",
|
|
8794
8798
|
"padding-bottom" : "paddingBottom",
|
|
8795
8799
|
};
|
|
8796
|
-
|
|
8800
|
+
|
|
8797
8801
|
if(window.getComputedStyle){
|
|
8798
8802
|
var fromStyle = window.getComputedStyle(from);
|
|
8799
|
-
|
|
8803
|
+
|
|
8800
8804
|
props.forEach(function(prop){
|
|
8801
|
-
to.style[lookup[prop]]
|
|
8805
|
+
if(!to.style[lookup[prop]]){
|
|
8806
|
+
to.style[lookup[prop]] = fromStyle.getPropertyValue(prop);
|
|
8807
|
+
}
|
|
8802
8808
|
});
|
|
8803
8809
|
}
|
|
8804
8810
|
}
|
|
@@ -9096,11 +9102,6 @@ class Filter extends Module{
|
|
|
9096
9102
|
var def = column.definition;
|
|
9097
9103
|
|
|
9098
9104
|
if(def.headerFilter){
|
|
9099
|
-
|
|
9100
|
-
if(typeof def.headerFilterPlaceholder !== "undefined" && def.field){
|
|
9101
|
-
this.module("localize").setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder);
|
|
9102
|
-
}
|
|
9103
|
-
|
|
9104
9105
|
this.initializeColumn(column);
|
|
9105
9106
|
}
|
|
9106
9107
|
}
|
|
@@ -9212,13 +9213,17 @@ class Filter extends Module{
|
|
|
9212
9213
|
var self = this,
|
|
9213
9214
|
success = column.modules.filter.success,
|
|
9214
9215
|
field = column.getField(),
|
|
9215
|
-
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params;
|
|
9216
|
+
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params, onRenderedCallback;
|
|
9216
9217
|
|
|
9217
9218
|
column.modules.filter.value = initialValue;
|
|
9218
9219
|
|
|
9219
9220
|
//handle aborted edit
|
|
9220
9221
|
function cancel(){}
|
|
9221
9222
|
|
|
9223
|
+
function onRendered(callback){
|
|
9224
|
+
onRenderedCallback = callback;
|
|
9225
|
+
}
|
|
9226
|
+
|
|
9222
9227
|
if(column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode){
|
|
9223
9228
|
column.contentElement.removeChild(column.modules.filter.headerElement.parentNode);
|
|
9224
9229
|
}
|
|
@@ -9303,7 +9308,7 @@ class Filter extends Module{
|
|
|
9303
9308
|
|
|
9304
9309
|
params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
|
|
9305
9310
|
|
|
9306
|
-
editorElement = editor.call(this.table.modules.edit, cellWrapper,
|
|
9311
|
+
editorElement = editor.call(this.table.modules.edit, cellWrapper, onRendered, success, cancel, params);
|
|
9307
9312
|
|
|
9308
9313
|
if(!editorElement){
|
|
9309
9314
|
console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false");
|
|
@@ -9317,7 +9322,7 @@ class Filter extends Module{
|
|
|
9317
9322
|
|
|
9318
9323
|
//set Placeholder Text
|
|
9319
9324
|
self.langBind("headerFilters|columns|" + column.definition.field, function(value){
|
|
9320
|
-
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")));
|
|
9321
9326
|
});
|
|
9322
9327
|
|
|
9323
9328
|
//focus on element on click
|
|
@@ -9399,6 +9404,10 @@ class Filter extends Module{
|
|
|
9399
9404
|
if(!reinitialize){
|
|
9400
9405
|
self.headerFilterColumns.push(column);
|
|
9401
9406
|
}
|
|
9407
|
+
|
|
9408
|
+
if(onRenderedCallback){
|
|
9409
|
+
onRenderedCallback();
|
|
9410
|
+
}
|
|
9402
9411
|
}
|
|
9403
9412
|
}else {
|
|
9404
9413
|
console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title);
|
|
@@ -11259,7 +11268,7 @@ class Group{
|
|
|
11259
11268
|
this.arrowElement = document.createElement("div");
|
|
11260
11269
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
11261
11270
|
this.arrowElement.appendChild(arrow);
|
|
11262
|
-
|
|
11271
|
+
|
|
11263
11272
|
//setup movable rows
|
|
11264
11273
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
11265
11274
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
@@ -11397,19 +11406,22 @@ class Group{
|
|
|
11397
11406
|
this.parent.removeGroup(this);
|
|
11398
11407
|
}else {
|
|
11399
11408
|
this.groupManager.removeGroup(this);
|
|
11400
|
-
}
|
|
11409
|
+
}
|
|
11401
11410
|
|
|
11402
11411
|
this.groupManager.updateGroupRows(true);
|
|
11412
|
+
|
|
11403
11413
|
}else {
|
|
11404
11414
|
|
|
11405
11415
|
if(el.parentNode){
|
|
11406
11416
|
el.parentNode.removeChild(el);
|
|
11407
11417
|
}
|
|
11408
|
-
|
|
11409
|
-
this.
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
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
|
+
}
|
|
11413
11425
|
}
|
|
11414
11426
|
|
|
11415
11427
|
}
|
|
@@ -11794,6 +11806,8 @@ class GroupRows extends Module{
|
|
|
11794
11806
|
this.groups = {}; //hold row groups
|
|
11795
11807
|
|
|
11796
11808
|
this.displayHandler = this.getRows.bind(this);
|
|
11809
|
+
|
|
11810
|
+
this.blockRedraw = false;
|
|
11797
11811
|
|
|
11798
11812
|
//register table options
|
|
11799
11813
|
this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
|
|
@@ -11822,6 +11836,10 @@ class GroupRows extends Module{
|
|
|
11822
11836
|
|
|
11823
11837
|
//initialize group configuration
|
|
11824
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
|
+
|
|
11825
11843
|
if(this.table.options.groupBy){
|
|
11826
11844
|
if(this.table.options.groupUpdateOnCellEdit){
|
|
11827
11845
|
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
@@ -11848,6 +11866,14 @@ class GroupRows extends Module{
|
|
|
11848
11866
|
}
|
|
11849
11867
|
}
|
|
11850
11868
|
|
|
11869
|
+
_blockRedrawing(){
|
|
11870
|
+
this.blockRedraw = true;
|
|
11871
|
+
}
|
|
11872
|
+
|
|
11873
|
+
_restore_redrawing(){
|
|
11874
|
+
this.blockRedraw = false;
|
|
11875
|
+
}
|
|
11876
|
+
|
|
11851
11877
|
configureGroupSetup(){
|
|
11852
11878
|
if(this.table.options.groupBy){
|
|
11853
11879
|
var groupBy = this.table.options.groupBy,
|
|
@@ -12333,13 +12359,15 @@ class GroupRows extends Module{
|
|
|
12333
12359
|
|
|
12334
12360
|
updateGroupRows(force){
|
|
12335
12361
|
var output = [];
|
|
12336
|
-
|
|
12337
|
-
this.
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
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
|
+
}
|
|
12343
12371
|
}
|
|
12344
12372
|
|
|
12345
12373
|
return output;
|
|
@@ -16755,6 +16783,8 @@ class Print extends Module{
|
|
|
16755
16783
|
|
|
16756
16784
|
this.element = false;
|
|
16757
16785
|
this.manualBlock = false;
|
|
16786
|
+
this.beforeprintEventHandler = null;
|
|
16787
|
+
this.afterprintEventHandler = null;
|
|
16758
16788
|
|
|
16759
16789
|
this.registerTableOption("printAsHtml", false); //enable print as html
|
|
16760
16790
|
this.registerTableOption("printFormatter", false); //printing page formatter
|
|
@@ -16770,13 +16800,24 @@ class Print extends Module{
|
|
|
16770
16800
|
|
|
16771
16801
|
initialize(){
|
|
16772
16802
|
if(this.table.options.printAsHtml){
|
|
16773
|
-
|
|
16774
|
-
|
|
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));
|
|
16775
16809
|
}
|
|
16776
16810
|
|
|
16777
16811
|
this.registerTableFunction("print", this.printFullscreen.bind(this));
|
|
16778
16812
|
}
|
|
16779
16813
|
|
|
16814
|
+
destroy(){
|
|
16815
|
+
if(this.table.options.printAsHtml){
|
|
16816
|
+
window.removeEventListener( "beforeprint", this.beforeprintEventHandler );
|
|
16817
|
+
window.removeEventListener( "afterprint", this.afterprintEventHandler );
|
|
16818
|
+
}
|
|
16819
|
+
}
|
|
16820
|
+
|
|
16780
16821
|
///////////////////////////////////
|
|
16781
16822
|
///////// Table Functions /////////
|
|
16782
16823
|
///////////////////////////////////
|
|
@@ -18266,7 +18307,7 @@ class SelectRow extends Module{
|
|
|
18266
18307
|
row.modules.select = {selected:false};
|
|
18267
18308
|
|
|
18268
18309
|
//set row selection class
|
|
18269
|
-
if(self.
|
|
18310
|
+
if(self.checkRowSelectability(row)){
|
|
18270
18311
|
element.classList.add("tabulator-selectable");
|
|
18271
18312
|
element.classList.remove("tabulator-unselectable");
|
|
18272
18313
|
|
|
@@ -18377,10 +18418,18 @@ class SelectRow extends Module{
|
|
|
18377
18418
|
this.lastClickedRow = row;
|
|
18378
18419
|
}
|
|
18379
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
|
+
}
|
|
18380
18429
|
|
|
18381
18430
|
//toggle row selection
|
|
18382
18431
|
toggleRow(row){
|
|
18383
|
-
if(this.
|
|
18432
|
+
if(this.checkRowSelectability(row)){
|
|
18384
18433
|
if(row.modules.select && row.modules.select.selected){
|
|
18385
18434
|
this._deselectRow(row);
|
|
18386
18435
|
}else {
|
|
@@ -22301,18 +22350,32 @@ class RowManager extends CoreFeature{
|
|
|
22301
22350
|
}
|
|
22302
22351
|
|
|
22303
22352
|
initializePlaceholder(){
|
|
22353
|
+
var placeholder = this.table.options.placeholder;
|
|
22354
|
+
|
|
22304
22355
|
//configure placeholder element
|
|
22305
|
-
if(
|
|
22356
|
+
if(placeholder){
|
|
22306
22357
|
let el = document.createElement("div");
|
|
22307
22358
|
el.classList.add("tabulator-placeholder");
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
|
|
22311
|
-
|
|
22312
|
-
|
|
22313
|
-
|
|
22314
|
-
|
|
22315
|
-
|
|
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
|
+
|
|
22316
22379
|
this.placeholder = el;
|
|
22317
22380
|
}
|
|
22318
22381
|
}
|
|
@@ -22470,18 +22533,24 @@ class RowManager extends CoreFeature{
|
|
|
22470
22533
|
_wipeElements(){
|
|
22471
22534
|
this.dispatch("rows-wipe");
|
|
22472
22535
|
|
|
22536
|
+
this.destroy();
|
|
22537
|
+
|
|
22538
|
+
this.adjustTableSize();
|
|
22539
|
+
|
|
22540
|
+
this.dispatch("rows-wiped");
|
|
22541
|
+
}
|
|
22542
|
+
|
|
22543
|
+
destroy(){
|
|
22473
22544
|
this.rows.forEach((row) => {
|
|
22474
22545
|
row.wipe();
|
|
22475
22546
|
});
|
|
22476
|
-
|
|
22547
|
+
|
|
22477
22548
|
this.rows = [];
|
|
22478
22549
|
this.activeRows = [];
|
|
22479
22550
|
this.activeRowsPipeline = [];
|
|
22480
22551
|
this.activeRowsCount = 0;
|
|
22481
22552
|
this.displayRows = [];
|
|
22482
22553
|
this.displayRowsCount = 0;
|
|
22483
|
-
|
|
22484
|
-
this.adjustTableSize();
|
|
22485
22554
|
}
|
|
22486
22555
|
|
|
22487
22556
|
deleteRow(row, blockRedraw){
|
|
@@ -22529,7 +22598,7 @@ class RowManager extends CoreFeature{
|
|
|
22529
22598
|
}
|
|
22530
22599
|
|
|
22531
22600
|
//add multiple rows
|
|
22532
|
-
addRows(data, pos, index){
|
|
22601
|
+
addRows(data, pos, index, refreshDisplayOnly){
|
|
22533
22602
|
var rows = [];
|
|
22534
22603
|
|
|
22535
22604
|
return new Promise((resolve, reject) => {
|
|
@@ -22548,8 +22617,8 @@ class RowManager extends CoreFeature{
|
|
|
22548
22617
|
rows.push(row);
|
|
22549
22618
|
this.dispatch("row-added", row, data, pos, index);
|
|
22550
22619
|
});
|
|
22551
|
-
|
|
22552
|
-
this.refreshActiveData(false, false, true);
|
|
22620
|
+
|
|
22621
|
+
this.refreshActiveData(refreshDisplayOnly ? "displayPipeline" : false, false, true);
|
|
22553
22622
|
|
|
22554
22623
|
this.regenerateRowPositions();
|
|
22555
22624
|
|
|
@@ -23029,22 +23098,21 @@ class RowManager extends CoreFeature{
|
|
|
23029
23098
|
getRows(type){
|
|
23030
23099
|
var rows = [];
|
|
23031
23100
|
|
|
23032
|
-
|
|
23033
|
-
|
|
23034
|
-
|
|
23035
|
-
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
|
|
23101
|
+
switch(type){
|
|
23102
|
+
case "active":
|
|
23103
|
+
rows = this.activeRows;
|
|
23104
|
+
break;
|
|
23105
|
+
|
|
23106
|
+
case "display":
|
|
23107
|
+
rows = this.table.rowManager.getDisplayRows();
|
|
23108
|
+
break;
|
|
23039
23109
|
|
|
23040
|
-
|
|
23041
|
-
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
break;
|
|
23047
|
-
}
|
|
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;
|
|
23048
23116
|
}
|
|
23049
23117
|
|
|
23050
23118
|
return rows;
|
|
@@ -24626,15 +24694,6 @@ class Localize extends Module{
|
|
|
24626
24694
|
this.langList.default.headerFilters.default = placeholder;
|
|
24627
24695
|
}
|
|
24628
24696
|
|
|
24629
|
-
//set header filter placeholder by column
|
|
24630
|
-
setHeaderFilterColumnPlaceholder(column, placeholder){
|
|
24631
|
-
this.langList.default.headerFilters.columns[column] = placeholder;
|
|
24632
|
-
|
|
24633
|
-
if(this.lang && !this.lang.headerFilters.columns[column]){
|
|
24634
|
-
this.lang.headerFilters.columns[column] = placeholder;
|
|
24635
|
-
}
|
|
24636
|
-
}
|
|
24637
|
-
|
|
24638
24697
|
//setup a lang description object
|
|
24639
24698
|
installLang(locale, lang){
|
|
24640
24699
|
if(this.langList[locale]){
|
|
@@ -25264,13 +25323,7 @@ class Tabulator {
|
|
|
25264
25323
|
this.eventBus.dispatch("table-destroy");
|
|
25265
25324
|
|
|
25266
25325
|
//clear row data
|
|
25267
|
-
this.rowManager.
|
|
25268
|
-
row.wipe();
|
|
25269
|
-
});
|
|
25270
|
-
|
|
25271
|
-
this.rowManager.rows = [];
|
|
25272
|
-
this.rowManager.activeRows = [];
|
|
25273
|
-
this.rowManager.displayRows = [];
|
|
25326
|
+
this.rowManager.destroy();
|
|
25274
25327
|
|
|
25275
25328
|
//clear DOM
|
|
25276
25329
|
while(element.firstChild) element.removeChild(element.firstChild);
|
|
@@ -25405,7 +25458,12 @@ class Tabulator {
|
|
|
25405
25458
|
if(!responses){
|
|
25406
25459
|
resolve();
|
|
25407
25460
|
}
|
|
25461
|
+
})
|
|
25462
|
+
.catch((e) => {
|
|
25463
|
+
reject("Update Error - Unable to update row", item, e);
|
|
25408
25464
|
});
|
|
25465
|
+
}else {
|
|
25466
|
+
reject("Update Error - Unable to find row", item);
|
|
25409
25467
|
}
|
|
25410
25468
|
});
|
|
25411
25469
|
}else {
|
|
@@ -25561,7 +25619,7 @@ class Tabulator {
|
|
|
25561
25619
|
data = JSON.parse(data);
|
|
25562
25620
|
}
|
|
25563
25621
|
|
|
25564
|
-
return this.rowManager.addRows(data, pos, index)
|
|
25622
|
+
return this.rowManager.addRows(data, pos, index, true)
|
|
25565
25623
|
.then((rows)=>{
|
|
25566
25624
|
return rows[0].getComponent();
|
|
25567
25625
|
});
|