tabulator-tables 5.1.4 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/dist/js/tabulator.js +60 -20
- 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 +64 -24
- 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/rendering/renderers/VirtualDomHorizontal.js +37 -12
- package/src/js/modules/Page/Page.js +26 -11
package/package.json
CHANGED
|
@@ -17,15 +17,18 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
17
17
|
|
|
18
18
|
this.fitDataColAvg = 0;
|
|
19
19
|
|
|
20
|
-
this.
|
|
20
|
+
this.windowBuffer = 200; //pixel margin to make column visible before it is shown on screen
|
|
21
|
+
|
|
21
22
|
|
|
22
23
|
this.initialized = false;
|
|
24
|
+
this.isFitData = false;
|
|
23
25
|
|
|
24
26
|
this.columns = [];
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
initialize(){
|
|
28
30
|
this.compatibilityCheck();
|
|
31
|
+
this.layoutCheck();
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
compatibilityCheck(){
|
|
@@ -65,6 +68,10 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
65
68
|
|
|
66
69
|
return ok;
|
|
67
70
|
}
|
|
71
|
+
|
|
72
|
+
layoutCheck(){
|
|
73
|
+
this.isFitData = this.options("layout").startsWith('fitData');
|
|
74
|
+
}
|
|
68
75
|
|
|
69
76
|
//////////////////////////////////////
|
|
70
77
|
///////// Public Functions ///////////
|
|
@@ -78,42 +85,60 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
78
85
|
if(this.scrollLeft != left){
|
|
79
86
|
this.scrollLeft = left;
|
|
80
87
|
|
|
81
|
-
this.scroll(left - (this.vDomScrollPosLeft + this.
|
|
88
|
+
this.scroll(left - (this.vDomScrollPosLeft + this.windowBuffer));
|
|
82
89
|
}
|
|
83
90
|
}
|
|
91
|
+
|
|
92
|
+
calcWindowBuffer(){
|
|
93
|
+
var buffer = this.elementVertical.clientWidth;
|
|
94
|
+
|
|
95
|
+
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
96
|
+
if(column.visible){
|
|
97
|
+
var width = column.getWidth();
|
|
98
|
+
|
|
99
|
+
if(width > buffer){
|
|
100
|
+
buffer = width;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
this.windowBuffer = buffer * 2;
|
|
106
|
+
}
|
|
84
107
|
|
|
85
108
|
rerenderColumns(update, blockRedraw){
|
|
86
109
|
var old = {
|
|
87
110
|
cols:this.columns,
|
|
88
111
|
leftCol:this.leftCol,
|
|
89
112
|
rightCol:this.rightCol,
|
|
90
|
-
}
|
|
113
|
+
},
|
|
114
|
+
colPos = 0;
|
|
115
|
+
|
|
91
116
|
|
|
92
117
|
if(update && !this.initialized){
|
|
93
118
|
return;
|
|
94
119
|
}
|
|
95
120
|
|
|
96
121
|
this.clear();
|
|
122
|
+
|
|
123
|
+
this.calcWindowBuffer();
|
|
97
124
|
|
|
98
125
|
this.scrollLeft = this.elementVertical.scrollLeft;
|
|
99
126
|
|
|
100
|
-
this.vDomScrollPosLeft = this.scrollLeft - this.
|
|
101
|
-
this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.
|
|
102
|
-
|
|
103
|
-
var colPos = 0;
|
|
104
|
-
|
|
127
|
+
this.vDomScrollPosLeft = this.scrollLeft - this.windowBuffer;
|
|
128
|
+
this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
|
|
129
|
+
|
|
105
130
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
106
131
|
var config = {};
|
|
107
132
|
|
|
108
133
|
if(column.visible){
|
|
109
134
|
var width = column.getWidth();
|
|
110
|
-
|
|
135
|
+
|
|
111
136
|
config.leftPos = colPos;
|
|
112
137
|
config.rightPos = colPos + width;
|
|
113
138
|
|
|
114
139
|
config.width = width;
|
|
115
140
|
|
|
116
|
-
if (this.
|
|
141
|
+
if (this.isFitData) {
|
|
117
142
|
config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
|
|
118
143
|
}
|
|
119
144
|
|
|
@@ -202,7 +227,7 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
202
227
|
colEnd = 0,
|
|
203
228
|
group, row, rowEl;
|
|
204
229
|
|
|
205
|
-
if(this.
|
|
230
|
+
if(this.isFitData){
|
|
206
231
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
207
232
|
if(!column.definition.width && column.visible){
|
|
208
233
|
change = true;
|
|
@@ -212,7 +237,7 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
212
237
|
if(change){
|
|
213
238
|
if(change && this.table.rowManager.getDisplayRows().length){
|
|
214
239
|
|
|
215
|
-
this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.
|
|
240
|
+
this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
|
|
216
241
|
|
|
217
242
|
var row = this.chain("rows-sample", [1], [], () => {
|
|
218
243
|
return this.table.rowManager.getDisplayRows();
|
|
@@ -575,17 +575,18 @@ class Page extends Module{
|
|
|
575
575
|
this.trackChanges();
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
_setPageCounter(totalRows){
|
|
579
|
-
var content
|
|
578
|
+
_setPageCounter(totalRows, size, currentRow){
|
|
579
|
+
var content;
|
|
580
580
|
|
|
581
581
|
if(this.pageCounter){
|
|
582
|
-
currentRow = ((this.page - 1) * this.size) + 1;
|
|
583
582
|
|
|
584
583
|
if(this.mode === "remote"){
|
|
584
|
+
size = this.size;
|
|
585
|
+
currentRow = ((this.page - 1) * this.size) + 1;
|
|
585
586
|
totalRows = this.remoteRowCountEstimate;
|
|
586
587
|
}
|
|
587
588
|
|
|
588
|
-
content = this.pageCounter.call(this,
|
|
589
|
+
content = this.pageCounter.call(this, size, currentRow, this.page, totalRows, this.max);
|
|
589
590
|
|
|
590
591
|
switch(typeof content){
|
|
591
592
|
case "object":
|
|
@@ -725,7 +726,12 @@ class Page extends Module{
|
|
|
725
726
|
|
|
726
727
|
//return appropriate rows for current page
|
|
727
728
|
getRows(data){
|
|
728
|
-
var
|
|
729
|
+
var actualRowPageSize = 0,
|
|
730
|
+
output, start, end, actualStartRow;
|
|
731
|
+
|
|
732
|
+
var actualRows = data.filter((row) => {
|
|
733
|
+
return row.type === "row";
|
|
734
|
+
});
|
|
729
735
|
|
|
730
736
|
if(this.mode == "local"){
|
|
731
737
|
output = [];
|
|
@@ -740,21 +746,30 @@ class Page extends Module{
|
|
|
740
746
|
end = start + parseInt(this.size);
|
|
741
747
|
}
|
|
742
748
|
|
|
743
|
-
|
|
744
749
|
this._setPageButtons();
|
|
745
750
|
|
|
746
751
|
for(let i = start; i < end; i++){
|
|
747
|
-
|
|
748
|
-
|
|
752
|
+
let row = data[i];
|
|
753
|
+
|
|
754
|
+
if(row){
|
|
755
|
+
output.push(row);
|
|
756
|
+
|
|
757
|
+
if(row.type === "row"){
|
|
758
|
+
if(!actualStartRow){
|
|
759
|
+
actualStartRow = row;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
actualRowPageSize++;
|
|
763
|
+
}
|
|
749
764
|
}
|
|
750
765
|
}
|
|
751
|
-
|
|
752
|
-
this._setPageCounter(
|
|
766
|
+
|
|
767
|
+
this._setPageCounter(actualRows.length, actualRowPageSize, actualStartRow ? (actualRows.indexOf(actualStartRow) + 1) : 0);
|
|
753
768
|
|
|
754
769
|
return output;
|
|
755
770
|
}else{
|
|
756
771
|
this._setPageButtons();
|
|
757
|
-
this._setPageCounter(
|
|
772
|
+
this._setPageCounter(actualRows.length);
|
|
758
773
|
|
|
759
774
|
return data.slice(0);
|
|
760
775
|
}
|