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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.4.
|
|
1
|
+
/* Tabulator v5.4.3 (c) Oliver Folkerd 2022 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -1470,6 +1470,16 @@
|
|
|
1470
1470
|
return width;
|
|
1471
1471
|
}
|
|
1472
1472
|
|
|
1473
|
+
getLeftOffset(){
|
|
1474
|
+
var offset = this.element.offsetLeft;
|
|
1475
|
+
|
|
1476
|
+
if(this.parent.isGroup){
|
|
1477
|
+
offset += this.parent.getLeftOffset();
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
return offset;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1473
1483
|
getHeight(){
|
|
1474
1484
|
return Math.ceil(this.element.getBoundingClientRect().height);
|
|
1475
1485
|
}
|
|
@@ -3099,10 +3109,11 @@
|
|
|
3099
3109
|
|
|
3100
3110
|
scrollToColumn(column, position, ifVisible){
|
|
3101
3111
|
var left = 0,
|
|
3102
|
-
offset =
|
|
3112
|
+
offset = column.getLeftOffset(),
|
|
3103
3113
|
adjust = 0,
|
|
3104
3114
|
colEl = column.getElement();
|
|
3105
3115
|
|
|
3116
|
+
|
|
3106
3117
|
return new Promise((resolve, reject) => {
|
|
3107
3118
|
|
|
3108
3119
|
if(typeof position === "undefined"){
|
|
@@ -3129,16 +3140,13 @@
|
|
|
3129
3140
|
|
|
3130
3141
|
//check column visibility
|
|
3131
3142
|
if(!ifVisible){
|
|
3132
|
-
|
|
3133
|
-
offset = colEl.offsetLeft;
|
|
3134
|
-
|
|
3135
3143
|
if(offset > 0 && offset + colEl.offsetWidth < this.element.clientWidth){
|
|
3136
3144
|
return false;
|
|
3137
3145
|
}
|
|
3138
3146
|
}
|
|
3139
3147
|
|
|
3140
3148
|
//calculate scroll position
|
|
3141
|
-
left =
|
|
3149
|
+
left = offset + adjust;
|
|
3142
3150
|
|
|
3143
3151
|
left = Math.max(Math.min(left, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth),0);
|
|
3144
3152
|
|
|
@@ -4560,18 +4568,32 @@
|
|
|
4560
4568
|
}
|
|
4561
4569
|
|
|
4562
4570
|
initializePlaceholder(){
|
|
4571
|
+
var placeholder = this.table.options.placeholder;
|
|
4572
|
+
|
|
4563
4573
|
//configure placeholder element
|
|
4564
|
-
if(
|
|
4574
|
+
if(placeholder){
|
|
4565
4575
|
let el = document.createElement("div");
|
|
4566
4576
|
el.classList.add("tabulator-placeholder");
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4577
|
+
|
|
4578
|
+
if(typeof placeholder == "string"){
|
|
4579
|
+
let contents = document.createElement("div");
|
|
4580
|
+
contents.classList.add("tabulator-placeholder-contents");
|
|
4581
|
+
contents.innerHTML = placeholder;
|
|
4582
|
+
|
|
4583
|
+
el.appendChild(contents);
|
|
4584
|
+
|
|
4585
|
+
this.placeholderContents = contents;
|
|
4586
|
+
|
|
4587
|
+
}else if(typeof HTMLElement !== "undefined" && placeholder instanceof HTMLElement){
|
|
4588
|
+
|
|
4589
|
+
el.appendChild(placeholder);
|
|
4590
|
+
this.placeholderContents = placeholder;
|
|
4591
|
+
}else {
|
|
4592
|
+
console.warn("Invalid placeholder provided, must be string or HTML Element", placeholder);
|
|
4593
|
+
|
|
4594
|
+
this.el = null;
|
|
4595
|
+
}
|
|
4596
|
+
|
|
4575
4597
|
this.placeholder = el;
|
|
4576
4598
|
}
|
|
4577
4599
|
}
|
|
@@ -4729,18 +4751,24 @@
|
|
|
4729
4751
|
_wipeElements(){
|
|
4730
4752
|
this.dispatch("rows-wipe");
|
|
4731
4753
|
|
|
4754
|
+
this.destroy();
|
|
4755
|
+
|
|
4756
|
+
this.adjustTableSize();
|
|
4757
|
+
|
|
4758
|
+
this.dispatch("rows-wiped");
|
|
4759
|
+
}
|
|
4760
|
+
|
|
4761
|
+
destroy(){
|
|
4732
4762
|
this.rows.forEach((row) => {
|
|
4733
4763
|
row.wipe();
|
|
4734
4764
|
});
|
|
4735
|
-
|
|
4765
|
+
|
|
4736
4766
|
this.rows = [];
|
|
4737
4767
|
this.activeRows = [];
|
|
4738
4768
|
this.activeRowsPipeline = [];
|
|
4739
4769
|
this.activeRowsCount = 0;
|
|
4740
4770
|
this.displayRows = [];
|
|
4741
4771
|
this.displayRowsCount = 0;
|
|
4742
|
-
|
|
4743
|
-
this.adjustTableSize();
|
|
4744
4772
|
}
|
|
4745
4773
|
|
|
4746
4774
|
deleteRow(row, blockRedraw){
|
|
@@ -4788,7 +4816,7 @@
|
|
|
4788
4816
|
}
|
|
4789
4817
|
|
|
4790
4818
|
//add multiple rows
|
|
4791
|
-
addRows(data, pos, index){
|
|
4819
|
+
addRows(data, pos, index, refreshDisplayOnly){
|
|
4792
4820
|
var rows = [];
|
|
4793
4821
|
|
|
4794
4822
|
return new Promise((resolve, reject) => {
|
|
@@ -4807,8 +4835,8 @@
|
|
|
4807
4835
|
rows.push(row);
|
|
4808
4836
|
this.dispatch("row-added", row, data, pos, index);
|
|
4809
4837
|
});
|
|
4810
|
-
|
|
4811
|
-
this.refreshActiveData(false, false, true);
|
|
4838
|
+
|
|
4839
|
+
this.refreshActiveData(refreshDisplayOnly ? "displayPipeline" : false, false, true);
|
|
4812
4840
|
|
|
4813
4841
|
this.regenerateRowPositions();
|
|
4814
4842
|
|
|
@@ -5288,22 +5316,21 @@
|
|
|
5288
5316
|
getRows(type){
|
|
5289
5317
|
var rows = [];
|
|
5290
5318
|
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5319
|
+
switch(type){
|
|
5320
|
+
case "active":
|
|
5321
|
+
rows = this.activeRows;
|
|
5322
|
+
break;
|
|
5323
|
+
|
|
5324
|
+
case "display":
|
|
5325
|
+
rows = this.table.rowManager.getDisplayRows();
|
|
5326
|
+
break;
|
|
5298
5327
|
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
break;
|
|
5306
|
-
}
|
|
5328
|
+
case "visible":
|
|
5329
|
+
rows = this.getVisibleRows(false, true);
|
|
5330
|
+
break;
|
|
5331
|
+
|
|
5332
|
+
default:
|
|
5333
|
+
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
5307
5334
|
}
|
|
5308
5335
|
|
|
5309
5336
|
return rows;
|
|
@@ -6546,7 +6573,7 @@
|
|
|
6546
6573
|
this.blurEvent = this.hide.bind(this, false);
|
|
6547
6574
|
this.escEvent = this._escapeCheck.bind(this);
|
|
6548
6575
|
|
|
6549
|
-
this.destroyBinding = this.tableDestroyed;
|
|
6576
|
+
this.destroyBinding = this.tableDestroyed.bind(this);
|
|
6550
6577
|
this.destroyed = false;
|
|
6551
6578
|
}
|
|
6552
6579
|
|
|
@@ -7326,15 +7353,6 @@
|
|
|
7326
7353
|
this.langList.default.headerFilters.default = placeholder;
|
|
7327
7354
|
}
|
|
7328
7355
|
|
|
7329
|
-
//set header filter placeholder by column
|
|
7330
|
-
setHeaderFilterColumnPlaceholder(column, placeholder){
|
|
7331
|
-
this.langList.default.headerFilters.columns[column] = placeholder;
|
|
7332
|
-
|
|
7333
|
-
if(this.lang && !this.lang.headerFilters.columns[column]){
|
|
7334
|
-
this.lang.headerFilters.columns[column] = placeholder;
|
|
7335
|
-
}
|
|
7336
|
-
}
|
|
7337
|
-
|
|
7338
7356
|
//setup a lang description object
|
|
7339
7357
|
installLang(locale, lang){
|
|
7340
7358
|
if(this.langList[locale]){
|
|
@@ -7964,13 +7982,7 @@
|
|
|
7964
7982
|
this.eventBus.dispatch("table-destroy");
|
|
7965
7983
|
|
|
7966
7984
|
//clear row data
|
|
7967
|
-
this.rowManager.
|
|
7968
|
-
row.wipe();
|
|
7969
|
-
});
|
|
7970
|
-
|
|
7971
|
-
this.rowManager.rows = [];
|
|
7972
|
-
this.rowManager.activeRows = [];
|
|
7973
|
-
this.rowManager.displayRows = [];
|
|
7985
|
+
this.rowManager.destroy();
|
|
7974
7986
|
|
|
7975
7987
|
//clear DOM
|
|
7976
7988
|
while(element.firstChild) element.removeChild(element.firstChild);
|
|
@@ -8105,7 +8117,12 @@
|
|
|
8105
8117
|
if(!responses){
|
|
8106
8118
|
resolve();
|
|
8107
8119
|
}
|
|
8120
|
+
})
|
|
8121
|
+
.catch((e) => {
|
|
8122
|
+
reject("Update Error - Unable to update row", item, e);
|
|
8108
8123
|
});
|
|
8124
|
+
}else {
|
|
8125
|
+
reject("Update Error - Unable to find row", item);
|
|
8109
8126
|
}
|
|
8110
8127
|
});
|
|
8111
8128
|
}else {
|
|
@@ -8261,7 +8278,7 @@
|
|
|
8261
8278
|
data = JSON.parse(data);
|
|
8262
8279
|
}
|
|
8263
8280
|
|
|
8264
|
-
return this.rowManager.addRows(data, pos, index)
|
|
8281
|
+
return this.rowManager.addRows(data, pos, index, true)
|
|
8265
8282
|
.then((rows)=>{
|
|
8266
8283
|
return rows[0].getComponent();
|
|
8267
8284
|
});
|
|
@@ -9733,6 +9750,16 @@
|
|
|
9733
9750
|
}
|
|
9734
9751
|
}
|
|
9735
9752
|
|
|
9753
|
+
reinitializeCalcs(){
|
|
9754
|
+
if(this.topCalcs.length){
|
|
9755
|
+
this.initializeTopRow();
|
|
9756
|
+
}
|
|
9757
|
+
|
|
9758
|
+
if(this.botCalcs.length){
|
|
9759
|
+
this.initializeBottomRow();
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
|
|
9736
9763
|
initializeTopRow(){
|
|
9737
9764
|
if(!this.topInitialized){
|
|
9738
9765
|
this.table.columnManager.getContentsElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
|
|
@@ -11153,7 +11180,7 @@
|
|
|
11153
11180
|
var index = el.value.length,
|
|
11154
11181
|
char = e.key;
|
|
11155
11182
|
|
|
11156
|
-
if(e.keyCode > 46){
|
|
11183
|
+
if(e.keyCode > 46 && !e.ctrlKey && !e.metaKey){
|
|
11157
11184
|
if(index >= mask.length){
|
|
11158
11185
|
e.preventDefault();
|
|
11159
11186
|
e.stopPropagation();
|
|
@@ -12904,7 +12931,7 @@
|
|
|
12904
12931
|
if(this.currentItems[0]){
|
|
12905
12932
|
output = this.currentItems[0].value;
|
|
12906
12933
|
}else {
|
|
12907
|
-
initialValue = this.initialValues[0];
|
|
12934
|
+
initialValue = Array.isArray(this.initialValues) ? this.initialValues[0] : this.initialValues;
|
|
12908
12935
|
|
|
12909
12936
|
if(initialValue === null || typeof initialValue === "undefined" || initialValue === ""){
|
|
12910
12937
|
output = initialValue;
|
|
@@ -14090,57 +14117,57 @@
|
|
|
14090
14117
|
}
|
|
14091
14118
|
|
|
14092
14119
|
class Export extends Module{
|
|
14093
|
-
|
|
14120
|
+
|
|
14094
14121
|
constructor(table){
|
|
14095
14122
|
super(table);
|
|
14096
|
-
|
|
14123
|
+
|
|
14097
14124
|
this.config = {};
|
|
14098
14125
|
this.cloneTableStyle = true;
|
|
14099
14126
|
this.colVisProp = "";
|
|
14100
|
-
|
|
14127
|
+
|
|
14101
14128
|
this.registerTableOption("htmlOutputConfig", false); //html output config
|
|
14102
|
-
|
|
14129
|
+
|
|
14103
14130
|
this.registerColumnOption("htmlOutput");
|
|
14104
14131
|
this.registerColumnOption("titleHtmlOutput");
|
|
14105
14132
|
}
|
|
14106
|
-
|
|
14133
|
+
|
|
14107
14134
|
initialize(){
|
|
14108
14135
|
this.registerTableFunction("getHtml", this.getHtml.bind(this));
|
|
14109
14136
|
}
|
|
14110
|
-
|
|
14137
|
+
|
|
14111
14138
|
///////////////////////////////////
|
|
14112
14139
|
///////// Table Functions /////////
|
|
14113
14140
|
///////////////////////////////////
|
|
14114
|
-
|
|
14115
|
-
|
|
14141
|
+
|
|
14142
|
+
|
|
14116
14143
|
///////////////////////////////////
|
|
14117
14144
|
///////// Internal Logic //////////
|
|
14118
14145
|
///////////////////////////////////
|
|
14119
|
-
|
|
14146
|
+
|
|
14120
14147
|
generateExportList(config, style, range, colVisProp){
|
|
14121
14148
|
this.cloneTableStyle = style;
|
|
14122
14149
|
this.config = config || {};
|
|
14123
14150
|
this.colVisProp = colVisProp;
|
|
14124
|
-
|
|
14151
|
+
|
|
14125
14152
|
var headers = this.config.columnHeaders !== false ? this.headersToExportRows(this.generateColumnGroupHeaders()) : [];
|
|
14126
14153
|
var body = this.bodyToExportRows(this.rowLookup(range));
|
|
14127
|
-
|
|
14154
|
+
|
|
14128
14155
|
return headers.concat(body);
|
|
14129
14156
|
}
|
|
14130
|
-
|
|
14157
|
+
|
|
14131
14158
|
generateTable(config, style, range, colVisProp){
|
|
14132
14159
|
var list = this.generateExportList(config, style, range, colVisProp);
|
|
14133
|
-
|
|
14160
|
+
|
|
14134
14161
|
return this.generateTableElement(list);
|
|
14135
14162
|
}
|
|
14136
|
-
|
|
14163
|
+
|
|
14137
14164
|
rowLookup(range){
|
|
14138
14165
|
var rows = [];
|
|
14139
|
-
|
|
14166
|
+
|
|
14140
14167
|
if(typeof range == "function"){
|
|
14141
14168
|
range.call(this.table).forEach((row) =>{
|
|
14142
14169
|
row = this.table.rowManager.findRow(row);
|
|
14143
|
-
|
|
14170
|
+
|
|
14144
14171
|
if(row){
|
|
14145
14172
|
rows.push(row);
|
|
14146
14173
|
}
|
|
@@ -14151,15 +14178,15 @@
|
|
|
14151
14178
|
case "visible":
|
|
14152
14179
|
rows = this.table.rowManager.getVisibleRows(false, true);
|
|
14153
14180
|
break;
|
|
14154
|
-
|
|
14181
|
+
|
|
14155
14182
|
case "all":
|
|
14156
14183
|
rows = this.table.rowManager.rows;
|
|
14157
14184
|
break;
|
|
14158
|
-
|
|
14185
|
+
|
|
14159
14186
|
case "selected":
|
|
14160
14187
|
rows = this.table.modules.selectRow.selectedRows;
|
|
14161
14188
|
break;
|
|
14162
|
-
|
|
14189
|
+
|
|
14163
14190
|
case "active":
|
|
14164
14191
|
default:
|
|
14165
14192
|
if(this.table.options.pagination){
|
|
@@ -14169,56 +14196,56 @@
|
|
|
14169
14196
|
}
|
|
14170
14197
|
}
|
|
14171
14198
|
}
|
|
14172
|
-
|
|
14199
|
+
|
|
14173
14200
|
return Object.assign([], rows);
|
|
14174
14201
|
}
|
|
14175
|
-
|
|
14202
|
+
|
|
14176
14203
|
generateColumnGroupHeaders(){
|
|
14177
14204
|
var output = [];
|
|
14178
|
-
|
|
14205
|
+
|
|
14179
14206
|
var columns = this.config.columnGroups !== false ? this.table.columnManager.columns : this.table.columnManager.columnsByIndex;
|
|
14180
|
-
|
|
14207
|
+
|
|
14181
14208
|
columns.forEach((column) => {
|
|
14182
14209
|
var colData = this.processColumnGroup(column);
|
|
14183
|
-
|
|
14210
|
+
|
|
14184
14211
|
if(colData){
|
|
14185
14212
|
output.push(colData);
|
|
14186
14213
|
}
|
|
14187
14214
|
});
|
|
14188
|
-
|
|
14215
|
+
|
|
14189
14216
|
return output;
|
|
14190
14217
|
}
|
|
14191
|
-
|
|
14218
|
+
|
|
14192
14219
|
processColumnGroup(column){
|
|
14193
14220
|
var subGroups = column.columns,
|
|
14194
14221
|
maxDepth = 0,
|
|
14195
14222
|
title = column.definition["title" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))] || column.definition.title;
|
|
14196
|
-
|
|
14223
|
+
|
|
14197
14224
|
var groupData = {
|
|
14198
14225
|
title:title,
|
|
14199
14226
|
column:column,
|
|
14200
14227
|
depth:1,
|
|
14201
14228
|
};
|
|
14202
|
-
|
|
14229
|
+
|
|
14203
14230
|
if(subGroups.length){
|
|
14204
14231
|
groupData.subGroups = [];
|
|
14205
14232
|
groupData.width = 0;
|
|
14206
|
-
|
|
14233
|
+
|
|
14207
14234
|
subGroups.forEach((subGroup) => {
|
|
14208
14235
|
var subGroupData = this.processColumnGroup(subGroup);
|
|
14209
|
-
|
|
14236
|
+
|
|
14210
14237
|
if(subGroupData){
|
|
14211
14238
|
groupData.width += subGroupData.width;
|
|
14212
14239
|
groupData.subGroups.push(subGroupData);
|
|
14213
|
-
|
|
14240
|
+
|
|
14214
14241
|
if(subGroupData.depth > maxDepth){
|
|
14215
14242
|
maxDepth = subGroupData.depth;
|
|
14216
14243
|
}
|
|
14217
14244
|
}
|
|
14218
14245
|
});
|
|
14219
|
-
|
|
14246
|
+
|
|
14220
14247
|
groupData.depth += maxDepth;
|
|
14221
|
-
|
|
14248
|
+
|
|
14222
14249
|
if(!groupData.width){
|
|
14223
14250
|
return false;
|
|
14224
14251
|
}
|
|
@@ -14229,75 +14256,75 @@
|
|
|
14229
14256
|
return false;
|
|
14230
14257
|
}
|
|
14231
14258
|
}
|
|
14232
|
-
|
|
14259
|
+
|
|
14233
14260
|
return groupData;
|
|
14234
14261
|
}
|
|
14235
|
-
|
|
14262
|
+
|
|
14236
14263
|
columnVisCheck(column){
|
|
14237
14264
|
var visProp = column.definition[this.colVisProp];
|
|
14238
|
-
|
|
14265
|
+
|
|
14239
14266
|
if(typeof visProp === "function"){
|
|
14240
14267
|
visProp = visProp.call(this.table, column.getComponent());
|
|
14241
14268
|
}
|
|
14242
|
-
|
|
14269
|
+
|
|
14243
14270
|
return visProp !== false && (column.visible || (!column.visible && visProp));
|
|
14244
14271
|
}
|
|
14245
|
-
|
|
14272
|
+
|
|
14246
14273
|
headersToExportRows(columns){
|
|
14247
14274
|
var headers = [],
|
|
14248
14275
|
headerDepth = 0,
|
|
14249
14276
|
exportRows = [];
|
|
14250
|
-
|
|
14277
|
+
|
|
14251
14278
|
function parseColumnGroup(column, level){
|
|
14252
|
-
|
|
14279
|
+
|
|
14253
14280
|
var depth = headerDepth - level;
|
|
14254
|
-
|
|
14281
|
+
|
|
14255
14282
|
if(typeof headers[level] === "undefined"){
|
|
14256
14283
|
headers[level] = [];
|
|
14257
14284
|
}
|
|
14258
|
-
|
|
14285
|
+
|
|
14259
14286
|
column.height = column.subGroups ? 1 : (depth - column.depth) + 1;
|
|
14260
|
-
|
|
14287
|
+
|
|
14261
14288
|
headers[level].push(column);
|
|
14262
|
-
|
|
14289
|
+
|
|
14263
14290
|
if(column.height > 1){
|
|
14264
14291
|
for(let i = 1; i < column.height; i ++){
|
|
14265
|
-
|
|
14292
|
+
|
|
14266
14293
|
if(typeof headers[level + i] === "undefined"){
|
|
14267
14294
|
headers[level + i] = [];
|
|
14268
14295
|
}
|
|
14269
|
-
|
|
14296
|
+
|
|
14270
14297
|
headers[level + i].push(false);
|
|
14271
14298
|
}
|
|
14272
14299
|
}
|
|
14273
|
-
|
|
14300
|
+
|
|
14274
14301
|
if(column.width > 1){
|
|
14275
14302
|
for(let i = 1; i < column.width; i ++){
|
|
14276
14303
|
headers[level].push(false);
|
|
14277
14304
|
}
|
|
14278
14305
|
}
|
|
14279
|
-
|
|
14306
|
+
|
|
14280
14307
|
if(column.subGroups){
|
|
14281
14308
|
column.subGroups.forEach(function(subGroup){
|
|
14282
14309
|
parseColumnGroup(subGroup, level+1);
|
|
14283
14310
|
});
|
|
14284
14311
|
}
|
|
14285
14312
|
}
|
|
14286
|
-
|
|
14313
|
+
|
|
14287
14314
|
//calculate maximum header depth
|
|
14288
14315
|
columns.forEach(function(column){
|
|
14289
14316
|
if(column.depth > headerDepth){
|
|
14290
14317
|
headerDepth = column.depth;
|
|
14291
14318
|
}
|
|
14292
14319
|
});
|
|
14293
|
-
|
|
14320
|
+
|
|
14294
14321
|
columns.forEach(function(column){
|
|
14295
14322
|
parseColumnGroup(column,0);
|
|
14296
14323
|
});
|
|
14297
|
-
|
|
14324
|
+
|
|
14298
14325
|
headers.forEach((header) => {
|
|
14299
14326
|
var columns = [];
|
|
14300
|
-
|
|
14327
|
+
|
|
14301
14328
|
header.forEach((col) => {
|
|
14302
14329
|
if(col){
|
|
14303
14330
|
let title = typeof col.title === "undefined" ? "" : col.title;
|
|
@@ -14306,78 +14333,78 @@
|
|
|
14306
14333
|
columns.push(null);
|
|
14307
14334
|
}
|
|
14308
14335
|
});
|
|
14309
|
-
|
|
14336
|
+
|
|
14310
14337
|
exportRows.push(new ExportRow("header", columns));
|
|
14311
14338
|
});
|
|
14312
|
-
|
|
14339
|
+
|
|
14313
14340
|
return exportRows;
|
|
14314
14341
|
}
|
|
14315
|
-
|
|
14342
|
+
|
|
14316
14343
|
bodyToExportRows(rows){
|
|
14317
|
-
|
|
14344
|
+
|
|
14318
14345
|
var columns = [];
|
|
14319
14346
|
var exportRows = [];
|
|
14320
|
-
|
|
14347
|
+
|
|
14321
14348
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
14322
14349
|
if (this.columnVisCheck(column)) {
|
|
14323
14350
|
columns.push(column.getComponent());
|
|
14324
14351
|
}
|
|
14325
14352
|
});
|
|
14326
|
-
|
|
14353
|
+
|
|
14327
14354
|
if(this.config.columnCalcs !== false && this.table.modExists("columnCalcs")){
|
|
14328
14355
|
if(this.table.modules.columnCalcs.topInitialized){
|
|
14329
14356
|
rows.unshift(this.table.modules.columnCalcs.topRow);
|
|
14330
14357
|
}
|
|
14331
|
-
|
|
14358
|
+
|
|
14332
14359
|
if(this.table.modules.columnCalcs.botInitialized){
|
|
14333
14360
|
rows.push(this.table.modules.columnCalcs.botRow);
|
|
14334
14361
|
}
|
|
14335
14362
|
}
|
|
14336
|
-
|
|
14363
|
+
|
|
14337
14364
|
rows = rows.filter((row) => {
|
|
14338
14365
|
switch(row.type){
|
|
14339
14366
|
case "group":
|
|
14340
14367
|
return this.config.rowGroups !== false;
|
|
14341
|
-
|
|
14368
|
+
|
|
14342
14369
|
case "calc":
|
|
14343
14370
|
return this.config.columnCalcs !== false;
|
|
14344
|
-
|
|
14371
|
+
|
|
14345
14372
|
case "row":
|
|
14346
14373
|
return !(this.table.options.dataTree && this.config.dataTree === false && row.modules.dataTree.parent);
|
|
14347
14374
|
}
|
|
14348
|
-
|
|
14375
|
+
|
|
14349
14376
|
return true;
|
|
14350
14377
|
});
|
|
14351
|
-
|
|
14378
|
+
|
|
14352
14379
|
rows.forEach((row, i) => {
|
|
14353
14380
|
var rowData = row.getData(this.colVisProp);
|
|
14354
14381
|
var exportCols = [];
|
|
14355
14382
|
var indent = 0;
|
|
14356
|
-
|
|
14383
|
+
|
|
14357
14384
|
switch(row.type){
|
|
14358
14385
|
case "group":
|
|
14359
14386
|
indent = row.level;
|
|
14360
14387
|
exportCols.push(new ExportColumn(row.key, row.getComponent(), columns.length, 1));
|
|
14361
14388
|
break;
|
|
14362
|
-
|
|
14389
|
+
|
|
14363
14390
|
case "calc" :
|
|
14364
14391
|
case "row" :
|
|
14365
14392
|
columns.forEach((col) => {
|
|
14366
14393
|
exportCols.push(new ExportColumn(col._column.getFieldValue(rowData), col, 1, 1));
|
|
14367
14394
|
});
|
|
14368
|
-
|
|
14395
|
+
|
|
14369
14396
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
14370
14397
|
indent = row.modules.dataTree.index;
|
|
14371
14398
|
}
|
|
14372
14399
|
break;
|
|
14373
14400
|
}
|
|
14374
|
-
|
|
14401
|
+
|
|
14375
14402
|
exportRows.push(new ExportRow(row.type, exportCols, row.getComponent(), indent));
|
|
14376
14403
|
});
|
|
14377
|
-
|
|
14404
|
+
|
|
14378
14405
|
return exportRows;
|
|
14379
14406
|
}
|
|
14380
|
-
|
|
14407
|
+
|
|
14381
14408
|
generateTableElement(list){
|
|
14382
14409
|
var table = document.createElement("table"),
|
|
14383
14410
|
headerEl = document.createElement("thead"),
|
|
@@ -14385,68 +14412,68 @@
|
|
|
14385
14412
|
styles = this.lookupTableStyles(),
|
|
14386
14413
|
rowFormatter = this.table.options["rowFormatter" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))],
|
|
14387
14414
|
setup = {};
|
|
14388
|
-
|
|
14415
|
+
|
|
14389
14416
|
setup.rowFormatter = rowFormatter !== null ? rowFormatter : this.table.options.rowFormatter;
|
|
14390
|
-
|
|
14417
|
+
|
|
14391
14418
|
if(this.table.options.dataTree &&this.config.dataTree !== false && this.table.modExists("columnCalcs")){
|
|
14392
14419
|
setup.treeElementField = this.table.modules.dataTree.elementField;
|
|
14393
14420
|
}
|
|
14394
|
-
|
|
14421
|
+
|
|
14395
14422
|
//assign group header formatter
|
|
14396
14423
|
setup.groupHeader = this.table.options["groupHeader" + (this.colVisProp.charAt(0).toUpperCase() + this.colVisProp.slice(1))];
|
|
14397
|
-
|
|
14424
|
+
|
|
14398
14425
|
if(setup.groupHeader && !Array.isArray(setup.groupHeader)){
|
|
14399
14426
|
setup.groupHeader = [setup.groupHeader];
|
|
14400
14427
|
}
|
|
14401
|
-
|
|
14428
|
+
|
|
14402
14429
|
table.classList.add("tabulator-print-table");
|
|
14403
|
-
|
|
14430
|
+
|
|
14404
14431
|
this.mapElementStyles(this.table.columnManager.getHeadersElement(), headerEl, ["border-top", "border-left", "border-right", "border-bottom", "background-color", "color", "font-weight", "font-family", "font-size"]);
|
|
14405
|
-
|
|
14406
|
-
|
|
14432
|
+
|
|
14433
|
+
|
|
14407
14434
|
if(list.length > 1000){
|
|
14408
14435
|
console.warn("It may take a long time to render an HTML table with more than 1000 rows");
|
|
14409
14436
|
}
|
|
14410
|
-
|
|
14437
|
+
|
|
14411
14438
|
list.forEach((row, i) => {
|
|
14412
14439
|
let rowEl;
|
|
14413
|
-
|
|
14440
|
+
|
|
14414
14441
|
switch(row.type){
|
|
14415
14442
|
case "header":
|
|
14416
14443
|
headerEl.appendChild(this.generateHeaderElement(row, setup, styles));
|
|
14417
14444
|
break;
|
|
14418
|
-
|
|
14445
|
+
|
|
14419
14446
|
case "group":
|
|
14420
14447
|
bodyEl.appendChild(this.generateGroupElement(row, setup, styles));
|
|
14421
14448
|
break;
|
|
14422
|
-
|
|
14449
|
+
|
|
14423
14450
|
case "calc":
|
|
14424
14451
|
bodyEl.appendChild(this.generateCalcElement(row, setup, styles));
|
|
14425
14452
|
break;
|
|
14426
|
-
|
|
14453
|
+
|
|
14427
14454
|
case "row":
|
|
14428
14455
|
rowEl = this.generateRowElement(row, setup, styles);
|
|
14429
|
-
|
|
14456
|
+
|
|
14430
14457
|
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"]);
|
|
14431
14458
|
bodyEl.appendChild(rowEl);
|
|
14432
14459
|
break;
|
|
14433
14460
|
}
|
|
14434
14461
|
});
|
|
14435
|
-
|
|
14462
|
+
|
|
14436
14463
|
if(headerEl.innerHTML){
|
|
14437
14464
|
table.appendChild(headerEl);
|
|
14438
14465
|
}
|
|
14439
|
-
|
|
14466
|
+
|
|
14440
14467
|
table.appendChild(bodyEl);
|
|
14441
|
-
|
|
14442
|
-
|
|
14468
|
+
|
|
14469
|
+
|
|
14443
14470
|
this.mapElementStyles(this.table.element, table, ["border-top", "border-left", "border-right", "border-bottom"]);
|
|
14444
14471
|
return table;
|
|
14445
14472
|
}
|
|
14446
|
-
|
|
14473
|
+
|
|
14447
14474
|
lookupTableStyles(){
|
|
14448
14475
|
var styles = {};
|
|
14449
|
-
|
|
14476
|
+
|
|
14450
14477
|
//lookup row styles
|
|
14451
14478
|
if(this.cloneTableStyle && window.getComputedStyle){
|
|
14452
14479
|
styles.oddRow = this.table.element.querySelector(".tabulator-row-odd:not(.tabulator-group):not(.tabulator-calcs)");
|
|
@@ -14454,41 +14481,41 @@
|
|
|
14454
14481
|
styles.calcRow = this.table.element.querySelector(".tabulator-row.tabulator-calcs");
|
|
14455
14482
|
styles.firstRow = this.table.element.querySelector(".tabulator-row:not(.tabulator-group):not(.tabulator-calcs)");
|
|
14456
14483
|
styles.firstGroup = this.table.element.getElementsByClassName("tabulator-group")[0];
|
|
14457
|
-
|
|
14484
|
+
|
|
14458
14485
|
if(styles.firstRow){
|
|
14459
14486
|
styles.styleCells = styles.firstRow.getElementsByClassName("tabulator-cell");
|
|
14460
14487
|
styles.firstCell = styles.styleCells[0];
|
|
14461
14488
|
styles.lastCell = styles.styleCells[styles.styleCells.length - 1];
|
|
14462
14489
|
}
|
|
14463
14490
|
}
|
|
14464
|
-
|
|
14491
|
+
|
|
14465
14492
|
return styles;
|
|
14466
14493
|
}
|
|
14467
|
-
|
|
14494
|
+
|
|
14468
14495
|
generateHeaderElement(row, setup, styles){
|
|
14469
14496
|
var rowEl = document.createElement("tr");
|
|
14470
|
-
|
|
14497
|
+
|
|
14471
14498
|
row.columns.forEach((column) => {
|
|
14472
14499
|
if(column){
|
|
14473
14500
|
var cellEl = document.createElement("th");
|
|
14474
14501
|
var classNames = column.component._column.definition.cssClass ? column.component._column.definition.cssClass.split(" ") : [];
|
|
14475
|
-
|
|
14502
|
+
|
|
14476
14503
|
cellEl.colSpan = column.width;
|
|
14477
14504
|
cellEl.rowSpan = column.height;
|
|
14478
|
-
|
|
14505
|
+
|
|
14479
14506
|
cellEl.innerHTML = column.value;
|
|
14480
|
-
|
|
14507
|
+
|
|
14481
14508
|
if(this.cloneTableStyle){
|
|
14482
14509
|
cellEl.style.boxSizing = "border-box";
|
|
14483
14510
|
}
|
|
14484
|
-
|
|
14511
|
+
|
|
14485
14512
|
classNames.forEach(function(className) {
|
|
14486
14513
|
cellEl.classList.add(className);
|
|
14487
14514
|
});
|
|
14488
|
-
|
|
14515
|
+
|
|
14489
14516
|
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"]);
|
|
14490
14517
|
this.mapElementStyles(column.component._column.contentElement, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
14491
|
-
|
|
14518
|
+
|
|
14492
14519
|
if(column.component._column.visible){
|
|
14493
14520
|
this.mapElementStyles(column.component.getElement(), cellEl, ["width"]);
|
|
14494
14521
|
}else {
|
|
@@ -14496,26 +14523,26 @@
|
|
|
14496
14523
|
cellEl.style.width = column.component._column.definition.width + "px";
|
|
14497
14524
|
}
|
|
14498
14525
|
}
|
|
14499
|
-
|
|
14526
|
+
|
|
14500
14527
|
if(column.component._column.parent){
|
|
14501
14528
|
this.mapElementStyles(column.component._column.parent.groupElement, cellEl, ["border-top"]);
|
|
14502
14529
|
}
|
|
14503
|
-
|
|
14530
|
+
|
|
14504
14531
|
rowEl.appendChild(cellEl);
|
|
14505
14532
|
}
|
|
14506
14533
|
});
|
|
14507
|
-
|
|
14534
|
+
|
|
14508
14535
|
return rowEl;
|
|
14509
14536
|
}
|
|
14510
|
-
|
|
14537
|
+
|
|
14511
14538
|
generateGroupElement(row, setup, styles){
|
|
14512
|
-
|
|
14539
|
+
|
|
14513
14540
|
var rowEl = document.createElement("tr"),
|
|
14514
14541
|
cellEl = document.createElement("td"),
|
|
14515
14542
|
group = row.columns[0];
|
|
14516
|
-
|
|
14543
|
+
|
|
14517
14544
|
rowEl.classList.add("tabulator-print-table-row");
|
|
14518
|
-
|
|
14545
|
+
|
|
14519
14546
|
if(setup.groupHeader && setup.groupHeader[row.indent]){
|
|
14520
14547
|
group.value = setup.groupHeader[row.indent](group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
14521
14548
|
}else {
|
|
@@ -14523,39 +14550,39 @@
|
|
|
14523
14550
|
group.value = row.component._group.generator(group.value, row.component._group.getRowCount(), row.component._group.getData(), row.component);
|
|
14524
14551
|
}
|
|
14525
14552
|
}
|
|
14526
|
-
|
|
14553
|
+
|
|
14527
14554
|
cellEl.colSpan = group.width;
|
|
14528
14555
|
cellEl.innerHTML = group.value;
|
|
14529
|
-
|
|
14556
|
+
|
|
14530
14557
|
rowEl.classList.add("tabulator-print-table-group");
|
|
14531
14558
|
rowEl.classList.add("tabulator-group-level-" + row.indent);
|
|
14532
|
-
|
|
14559
|
+
|
|
14533
14560
|
if(group.component.isVisible()){
|
|
14534
14561
|
rowEl.classList.add("tabulator-group-visible");
|
|
14535
14562
|
}
|
|
14536
|
-
|
|
14563
|
+
|
|
14537
14564
|
this.mapElementStyles(styles.firstGroup, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
14538
14565
|
this.mapElementStyles(styles.firstGroup, cellEl, ["padding-top", "padding-left", "padding-right", "padding-bottom"]);
|
|
14539
|
-
|
|
14566
|
+
|
|
14540
14567
|
rowEl.appendChild(cellEl);
|
|
14541
|
-
|
|
14568
|
+
|
|
14542
14569
|
return rowEl;
|
|
14543
14570
|
}
|
|
14544
|
-
|
|
14571
|
+
|
|
14545
14572
|
generateCalcElement(row, setup, styles){
|
|
14546
14573
|
var rowEl = this.generateRowElement(row, setup, styles);
|
|
14547
|
-
|
|
14574
|
+
|
|
14548
14575
|
rowEl.classList.add("tabulator-print-table-calcs");
|
|
14549
14576
|
this.mapElementStyles(styles.calcRow, rowEl, ["border-top", "border-left", "border-right", "border-bottom", "color", "font-weight", "font-family", "font-size", "background-color"]);
|
|
14550
|
-
|
|
14577
|
+
|
|
14551
14578
|
return rowEl;
|
|
14552
14579
|
}
|
|
14553
|
-
|
|
14580
|
+
|
|
14554
14581
|
generateRowElement(row, setup, styles){
|
|
14555
14582
|
var rowEl = document.createElement("tr");
|
|
14556
|
-
|
|
14583
|
+
|
|
14557
14584
|
rowEl.classList.add("tabulator-print-table-row");
|
|
14558
|
-
|
|
14585
|
+
|
|
14559
14586
|
row.columns.forEach((col, i) => {
|
|
14560
14587
|
if(col){
|
|
14561
14588
|
var cellEl = document.createElement("td"),
|
|
@@ -14563,7 +14590,7 @@
|
|
|
14563
14590
|
index = this.table.columnManager.findColumnIndex(column),
|
|
14564
14591
|
value = col.value,
|
|
14565
14592
|
cellStyle;
|
|
14566
|
-
|
|
14593
|
+
|
|
14567
14594
|
var cellWrapper = {
|
|
14568
14595
|
modules:{},
|
|
14569
14596
|
getValue:function(){
|
|
@@ -14589,13 +14616,13 @@
|
|
|
14589
14616
|
},
|
|
14590
14617
|
column:column,
|
|
14591
14618
|
};
|
|
14592
|
-
|
|
14619
|
+
|
|
14593
14620
|
var classNames = column.definition.cssClass ? column.definition.cssClass.split(" ") : [];
|
|
14594
|
-
|
|
14621
|
+
|
|
14595
14622
|
classNames.forEach(function(className) {
|
|
14596
14623
|
cellEl.classList.add(className);
|
|
14597
14624
|
});
|
|
14598
|
-
|
|
14625
|
+
|
|
14599
14626
|
if(this.table.modExists("format") && this.config.formatCells !== false){
|
|
14600
14627
|
value = this.table.modules.format.formatExportValue(cellWrapper, this.colVisProp);
|
|
14601
14628
|
}else {
|
|
@@ -14603,29 +14630,29 @@
|
|
|
14603
14630
|
case "object":
|
|
14604
14631
|
value = value !== null ? JSON.stringify(value) : "";
|
|
14605
14632
|
break;
|
|
14606
|
-
|
|
14633
|
+
|
|
14607
14634
|
case "undefined":
|
|
14608
14635
|
value = "";
|
|
14609
14636
|
break;
|
|
14610
14637
|
}
|
|
14611
14638
|
}
|
|
14612
|
-
|
|
14639
|
+
|
|
14613
14640
|
if(value instanceof Node){
|
|
14614
14641
|
cellEl.appendChild(value);
|
|
14615
14642
|
}else {
|
|
14616
14643
|
cellEl.innerHTML = value;
|
|
14617
14644
|
}
|
|
14618
|
-
|
|
14645
|
+
|
|
14619
14646
|
cellStyle = styles.styleCells && styles.styleCells[index] ? styles.styleCells[index] : styles.firstCell;
|
|
14620
|
-
|
|
14647
|
+
|
|
14621
14648
|
if(cellStyle){
|
|
14622
14649
|
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"]);
|
|
14623
|
-
|
|
14650
|
+
|
|
14624
14651
|
if(column.definition.align){
|
|
14625
14652
|
cellEl.style.textAlign = column.definition.align;
|
|
14626
14653
|
}
|
|
14627
14654
|
}
|
|
14628
|
-
|
|
14655
|
+
|
|
14629
14656
|
if(this.table.options.dataTree && this.config.dataTree !== false){
|
|
14630
14657
|
if((setup.treeElementField && setup.treeElementField == column.field) || (!setup.treeElementField && i == 0)){
|
|
14631
14658
|
if(row.component._row.modules.dataTree.controlEl){
|
|
@@ -14636,39 +14663,43 @@
|
|
|
14636
14663
|
}
|
|
14637
14664
|
}
|
|
14638
14665
|
}
|
|
14639
|
-
|
|
14666
|
+
|
|
14640
14667
|
rowEl.appendChild(cellEl);
|
|
14641
|
-
|
|
14668
|
+
|
|
14642
14669
|
if(cellWrapper.modules.format && cellWrapper.modules.format.renderedCallback){
|
|
14643
14670
|
cellWrapper.modules.format.renderedCallback();
|
|
14644
14671
|
}
|
|
14645
|
-
|
|
14646
|
-
if(setup.rowFormatter && this.config.formatCells !== false){
|
|
14647
|
-
setup.rowFormatter(row.component);
|
|
14648
|
-
}
|
|
14649
14672
|
}
|
|
14650
14673
|
});
|
|
14674
|
+
|
|
14675
|
+
if(setup.rowFormatter && row.type === "row" && this.config.formatCells !== false){
|
|
14676
|
+
let formatComponent = Object.assign(row.component);
|
|
14677
|
+
|
|
14678
|
+
formatComponent.getElement = function(){return rowEl;};
|
|
14651
14679
|
|
|
14680
|
+
setup.rowFormatter(row.component);
|
|
14681
|
+
}
|
|
14682
|
+
|
|
14652
14683
|
return rowEl;
|
|
14653
14684
|
}
|
|
14654
|
-
|
|
14685
|
+
|
|
14655
14686
|
generateHTMLTable(list){
|
|
14656
14687
|
var holder = document.createElement("div");
|
|
14657
|
-
|
|
14688
|
+
|
|
14658
14689
|
holder.appendChild(this.generateTableElement(list));
|
|
14659
|
-
|
|
14690
|
+
|
|
14660
14691
|
return holder.innerHTML;
|
|
14661
14692
|
}
|
|
14662
|
-
|
|
14693
|
+
|
|
14663
14694
|
getHtml(visible, style, config, colVisProp){
|
|
14664
14695
|
var list = this.generateExportList(config || this.table.options.htmlOutputConfig, style, visible, colVisProp || "htmlOutput");
|
|
14665
|
-
|
|
14696
|
+
|
|
14666
14697
|
return this.generateHTMLTable(list);
|
|
14667
14698
|
}
|
|
14668
|
-
|
|
14699
|
+
|
|
14669
14700
|
mapElementStyles(from, to, props){
|
|
14670
14701
|
if(this.cloneTableStyle && from && to){
|
|
14671
|
-
|
|
14702
|
+
|
|
14672
14703
|
var lookup = {
|
|
14673
14704
|
"background-color" : "backgroundColor",
|
|
14674
14705
|
"color" : "fontColor",
|
|
@@ -14686,12 +14717,14 @@
|
|
|
14686
14717
|
"padding-right" : "paddingRight",
|
|
14687
14718
|
"padding-bottom" : "paddingBottom",
|
|
14688
14719
|
};
|
|
14689
|
-
|
|
14720
|
+
|
|
14690
14721
|
if(window.getComputedStyle){
|
|
14691
14722
|
var fromStyle = window.getComputedStyle(from);
|
|
14692
|
-
|
|
14723
|
+
|
|
14693
14724
|
props.forEach(function(prop){
|
|
14694
|
-
to.style[lookup[prop]]
|
|
14725
|
+
if(!to.style[lookup[prop]]){
|
|
14726
|
+
to.style[lookup[prop]] = fromStyle.getPropertyValue(prop);
|
|
14727
|
+
}
|
|
14695
14728
|
});
|
|
14696
14729
|
}
|
|
14697
14730
|
}
|
|
@@ -14989,11 +15022,6 @@
|
|
|
14989
15022
|
var def = column.definition;
|
|
14990
15023
|
|
|
14991
15024
|
if(def.headerFilter){
|
|
14992
|
-
|
|
14993
|
-
if(typeof def.headerFilterPlaceholder !== "undefined" && def.field){
|
|
14994
|
-
this.module("localize").setHeaderFilterColumnPlaceholder(def.field, def.headerFilterPlaceholder);
|
|
14995
|
-
}
|
|
14996
|
-
|
|
14997
15025
|
this.initializeColumn(column);
|
|
14998
15026
|
}
|
|
14999
15027
|
}
|
|
@@ -15105,13 +15133,17 @@
|
|
|
15105
15133
|
var self = this,
|
|
15106
15134
|
success = column.modules.filter.success,
|
|
15107
15135
|
field = column.getField(),
|
|
15108
|
-
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params;
|
|
15136
|
+
filterElement, editor, editorElement, cellWrapper, typingTimer, searchTrigger, params, onRenderedCallback;
|
|
15109
15137
|
|
|
15110
15138
|
column.modules.filter.value = initialValue;
|
|
15111
15139
|
|
|
15112
15140
|
//handle aborted edit
|
|
15113
15141
|
function cancel(){}
|
|
15114
15142
|
|
|
15143
|
+
function onRendered(callback){
|
|
15144
|
+
onRenderedCallback = callback;
|
|
15145
|
+
}
|
|
15146
|
+
|
|
15115
15147
|
if(column.modules.filter.headerElement && column.modules.filter.headerElement.parentNode){
|
|
15116
15148
|
column.contentElement.removeChild(column.modules.filter.headerElement.parentNode);
|
|
15117
15149
|
}
|
|
@@ -15196,7 +15228,7 @@
|
|
|
15196
15228
|
|
|
15197
15229
|
params = typeof params === "function" ? params.call(self.table, cellWrapper) : params;
|
|
15198
15230
|
|
|
15199
|
-
editorElement = editor.call(this.table.modules.edit, cellWrapper,
|
|
15231
|
+
editorElement = editor.call(this.table.modules.edit, cellWrapper, onRendered, success, cancel, params);
|
|
15200
15232
|
|
|
15201
15233
|
if(!editorElement){
|
|
15202
15234
|
console.warn("Filter Error - Cannot add filter to " + field + " column, editor returned a value of false");
|
|
@@ -15210,7 +15242,7 @@
|
|
|
15210
15242
|
|
|
15211
15243
|
//set Placeholder Text
|
|
15212
15244
|
self.langBind("headerFilters|columns|" + column.definition.field, function(value){
|
|
15213
|
-
editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : self.langText("headerFilters|default"));
|
|
15245
|
+
editorElement.setAttribute("placeholder", typeof value !== "undefined" && value ? value : (column.definition.headerFilterPlaceholder || self.langText("headerFilters|default")));
|
|
15214
15246
|
});
|
|
15215
15247
|
|
|
15216
15248
|
//focus on element on click
|
|
@@ -15292,6 +15324,10 @@
|
|
|
15292
15324
|
if(!reinitialize){
|
|
15293
15325
|
self.headerFilterColumns.push(column);
|
|
15294
15326
|
}
|
|
15327
|
+
|
|
15328
|
+
if(onRenderedCallback){
|
|
15329
|
+
onRenderedCallback();
|
|
15330
|
+
}
|
|
15295
15331
|
}
|
|
15296
15332
|
}else {
|
|
15297
15333
|
console.warn("Filter Error - Cannot add header filter, column has no field set:", column.definition.title);
|
|
@@ -17119,17 +17155,19 @@
|
|
|
17119
17155
|
this.createValueGroups();
|
|
17120
17156
|
}
|
|
17121
17157
|
|
|
17122
|
-
wipe(){
|
|
17123
|
-
if(
|
|
17124
|
-
this.groupList.
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17158
|
+
wipe(elementsOnly){
|
|
17159
|
+
if(!elementsOnly){
|
|
17160
|
+
if(this.groupList.length){
|
|
17161
|
+
this.groupList.forEach(function(group){
|
|
17162
|
+
group.wipe();
|
|
17163
|
+
});
|
|
17164
|
+
}else {
|
|
17165
|
+
this.rows.forEach((row) => {
|
|
17166
|
+
if(row.modules){
|
|
17167
|
+
delete row.modules.group;
|
|
17168
|
+
}
|
|
17169
|
+
});
|
|
17170
|
+
}
|
|
17133
17171
|
}
|
|
17134
17172
|
|
|
17135
17173
|
this.element = false;
|
|
@@ -17150,7 +17188,7 @@
|
|
|
17150
17188
|
this.arrowElement = document.createElement("div");
|
|
17151
17189
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
17152
17190
|
this.arrowElement.appendChild(arrow);
|
|
17153
|
-
|
|
17191
|
+
|
|
17154
17192
|
//setup movable rows
|
|
17155
17193
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
17156
17194
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
@@ -17288,19 +17326,22 @@
|
|
|
17288
17326
|
this.parent.removeGroup(this);
|
|
17289
17327
|
}else {
|
|
17290
17328
|
this.groupManager.removeGroup(this);
|
|
17291
|
-
}
|
|
17329
|
+
}
|
|
17292
17330
|
|
|
17293
17331
|
this.groupManager.updateGroupRows(true);
|
|
17332
|
+
|
|
17294
17333
|
}else {
|
|
17295
17334
|
|
|
17296
17335
|
if(el.parentNode){
|
|
17297
17336
|
el.parentNode.removeChild(el);
|
|
17298
17337
|
}
|
|
17299
|
-
|
|
17300
|
-
this.
|
|
17301
|
-
|
|
17302
|
-
|
|
17303
|
-
this.groupManager.table.
|
|
17338
|
+
|
|
17339
|
+
if(!this.groupManager.blockRedraw){
|
|
17340
|
+
this.generateGroupHeaderContents();
|
|
17341
|
+
|
|
17342
|
+
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
17343
|
+
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
17344
|
+
}
|
|
17304
17345
|
}
|
|
17305
17346
|
|
|
17306
17347
|
}
|
|
@@ -17685,6 +17726,8 @@
|
|
|
17685
17726
|
this.groups = {}; //hold row groups
|
|
17686
17727
|
|
|
17687
17728
|
this.displayHandler = this.getRows.bind(this);
|
|
17729
|
+
|
|
17730
|
+
this.blockRedraw = false;
|
|
17688
17731
|
|
|
17689
17732
|
//register table options
|
|
17690
17733
|
this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
|
|
@@ -17713,6 +17756,10 @@
|
|
|
17713
17756
|
|
|
17714
17757
|
//initialize group configuration
|
|
17715
17758
|
initialize(){
|
|
17759
|
+
this.subscribe("table-destroy", this._blockRedrawing.bind(this));
|
|
17760
|
+
this.subscribe("rows-wipe", this._blockRedrawing.bind(this));
|
|
17761
|
+
this.subscribe("rows-wiped", this._restore_redrawing.bind(this));
|
|
17762
|
+
|
|
17716
17763
|
if(this.table.options.groupBy){
|
|
17717
17764
|
if(this.table.options.groupUpdateOnCellEdit){
|
|
17718
17765
|
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
@@ -17739,6 +17786,14 @@
|
|
|
17739
17786
|
}
|
|
17740
17787
|
}
|
|
17741
17788
|
|
|
17789
|
+
_blockRedrawing(){
|
|
17790
|
+
this.blockRedraw = true;
|
|
17791
|
+
}
|
|
17792
|
+
|
|
17793
|
+
_restore_redrawing(){
|
|
17794
|
+
this.blockRedraw = false;
|
|
17795
|
+
}
|
|
17796
|
+
|
|
17742
17797
|
configureGroupSetup(){
|
|
17743
17798
|
if(this.table.options.groupBy){
|
|
17744
17799
|
var groupBy = this.table.options.groupBy,
|
|
@@ -17762,7 +17817,7 @@
|
|
|
17762
17817
|
|
|
17763
17818
|
this.groupIDLookups = [];
|
|
17764
17819
|
|
|
17765
|
-
if(
|
|
17820
|
+
if(groupBy){
|
|
17766
17821
|
if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
|
|
17767
17822
|
this.table.modules.columnCalcs.removeCalcs();
|
|
17768
17823
|
}
|
|
@@ -17902,6 +17957,10 @@
|
|
|
17902
17957
|
}
|
|
17903
17958
|
|
|
17904
17959
|
this.configureGroupSetup();
|
|
17960
|
+
|
|
17961
|
+
if(!groups && this.table.modExists("columnCalcs") && this.table.options.columnCalcs === true){
|
|
17962
|
+
this.table.modules.columnCalcs.reinitializeCalcs();
|
|
17963
|
+
}
|
|
17905
17964
|
|
|
17906
17965
|
this.refreshData();
|
|
17907
17966
|
|
|
@@ -18148,7 +18207,7 @@
|
|
|
18148
18207
|
}
|
|
18149
18208
|
|
|
18150
18209
|
Object.values(oldGroups).forEach((group) => {
|
|
18151
|
-
group.wipe();
|
|
18210
|
+
group.wipe(true);
|
|
18152
18211
|
});
|
|
18153
18212
|
}
|
|
18154
18213
|
|
|
@@ -18220,13 +18279,15 @@
|
|
|
18220
18279
|
|
|
18221
18280
|
updateGroupRows(force){
|
|
18222
18281
|
var output = [];
|
|
18223
|
-
|
|
18224
|
-
this.
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18282
|
+
|
|
18283
|
+
if(!this.blockRedraw){
|
|
18284
|
+
this.groupList.forEach((group) => {
|
|
18285
|
+
output = output.concat(group.getHeadersAndRows());
|
|
18286
|
+
});
|
|
18287
|
+
|
|
18288
|
+
if(force){
|
|
18289
|
+
this.refreshData(true);
|
|
18290
|
+
}
|
|
18230
18291
|
}
|
|
18231
18292
|
|
|
18232
18293
|
return output;
|
|
@@ -19919,7 +19980,7 @@
|
|
|
19919
19980
|
|
|
19920
19981
|
config.mousemove = function(e){
|
|
19921
19982
|
if(column.parent === self.moving.parent){
|
|
19922
|
-
if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.
|
|
19983
|
+
if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.contentsElement.scrollLeft) > (column.getWidth() / 2)){
|
|
19923
19984
|
if(self.toCol !== column || !self.toColAfter){
|
|
19924
19985
|
colEl.parentNode.insertBefore(self.placeholderElement, colEl.nextSibling);
|
|
19925
19986
|
self.moveColumn(column, true);
|
|
@@ -22642,6 +22703,8 @@
|
|
|
22642
22703
|
|
|
22643
22704
|
this.element = false;
|
|
22644
22705
|
this.manualBlock = false;
|
|
22706
|
+
this.beforeprintEventHandler = null;
|
|
22707
|
+
this.afterprintEventHandler = null;
|
|
22645
22708
|
|
|
22646
22709
|
this.registerTableOption("printAsHtml", false); //enable print as html
|
|
22647
22710
|
this.registerTableOption("printFormatter", false); //printing page formatter
|
|
@@ -22657,13 +22720,24 @@
|
|
|
22657
22720
|
|
|
22658
22721
|
initialize(){
|
|
22659
22722
|
if(this.table.options.printAsHtml){
|
|
22660
|
-
|
|
22661
|
-
|
|
22723
|
+
this.beforeprintEventHandler = this.replaceTable.bind(this);
|
|
22724
|
+
this.afterprintEventHandler = this.cleanup.bind(this);
|
|
22725
|
+
|
|
22726
|
+
window.addEventListener("beforeprint", this.beforeprintEventHandler );
|
|
22727
|
+
window.addEventListener("afterprint", this.afterprintEventHandler);
|
|
22728
|
+
this.subscribe("table-destroy", this.destroy.bind(this));
|
|
22662
22729
|
}
|
|
22663
22730
|
|
|
22664
22731
|
this.registerTableFunction("print", this.printFullscreen.bind(this));
|
|
22665
22732
|
}
|
|
22666
22733
|
|
|
22734
|
+
destroy(){
|
|
22735
|
+
if(this.table.options.printAsHtml){
|
|
22736
|
+
window.removeEventListener( "beforeprint", this.beforeprintEventHandler );
|
|
22737
|
+
window.removeEventListener( "afterprint", this.afterprintEventHandler );
|
|
22738
|
+
}
|
|
22739
|
+
}
|
|
22740
|
+
|
|
22667
22741
|
///////////////////////////////////
|
|
22668
22742
|
///////// Table Functions /////////
|
|
22669
22743
|
///////////////////////////////////
|
|
@@ -24153,7 +24227,7 @@
|
|
|
24153
24227
|
row.modules.select = {selected:false};
|
|
24154
24228
|
|
|
24155
24229
|
//set row selection class
|
|
24156
|
-
if(self.
|
|
24230
|
+
if(self.checkRowSelectability(row)){
|
|
24157
24231
|
element.classList.add("tabulator-selectable");
|
|
24158
24232
|
element.classList.remove("tabulator-unselectable");
|
|
24159
24233
|
|
|
@@ -24264,10 +24338,18 @@
|
|
|
24264
24338
|
this.lastClickedRow = row;
|
|
24265
24339
|
}
|
|
24266
24340
|
}
|
|
24341
|
+
|
|
24342
|
+
checkRowSelectability(row){
|
|
24343
|
+
if(row.type === "row"){
|
|
24344
|
+
return this.table.options.selectableCheck.call(this.table, row.getComponent());
|
|
24345
|
+
}
|
|
24346
|
+
|
|
24347
|
+
return false;
|
|
24348
|
+
}
|
|
24267
24349
|
|
|
24268
24350
|
//toggle row selection
|
|
24269
24351
|
toggleRow(row){
|
|
24270
|
-
if(this.
|
|
24352
|
+
if(this.checkRowSelectability(row)){
|
|
24271
24353
|
if(row.modules.select && row.modules.select.selected){
|
|
24272
24354
|
this._deselectRow(row);
|
|
24273
24355
|
}else {
|