tabulator-tables 5.1.5 → 5.1.6
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 +202 -106
- 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 +166 -115
- 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 +162 -109
- package/src/js/modules/Menu/Menu.js +3 -5
package/dist/js/tabulator_esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.1.
|
|
1
|
+
/* Tabulator v5.1.6 (c) Oliver Folkerd 2022 */
|
|
2
2
|
class CoreFeature{
|
|
3
3
|
|
|
4
4
|
constructor(table){
|
|
@@ -13147,13 +13147,11 @@ class Menu extends Module{
|
|
|
13147
13147
|
}
|
|
13148
13148
|
|
|
13149
13149
|
//move menu to start on bottom edge if it is too close to the edge of the screen
|
|
13150
|
-
if((y + element.offsetHeight)
|
|
13151
|
-
element.style.top = "";
|
|
13152
|
-
|
|
13150
|
+
if((y + element.offsetHeight) > this.menuContainer.offsetHeight) {
|
|
13153
13151
|
if(parentEl){
|
|
13154
|
-
element.style.
|
|
13152
|
+
element.style.top = (parseInt(element.style.top) - element.offsetHeight + parentEl.offsetHeight + 1) + "px";
|
|
13155
13153
|
}else {
|
|
13156
|
-
element.style.
|
|
13154
|
+
element.style.top = (parseInt(element.style.top) - element.offsetHeight) + "px";
|
|
13157
13155
|
}
|
|
13158
13156
|
}
|
|
13159
13157
|
}
|
|
@@ -18830,8 +18828,9 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18830
18828
|
this.fitDataColAvg = 0;
|
|
18831
18829
|
|
|
18832
18830
|
this.windowBuffer = 200; //pixel margin to make column visible before it is shown on screen
|
|
18833
|
-
|
|
18834
18831
|
|
|
18832
|
+
this.visibleRows = null;
|
|
18833
|
+
|
|
18835
18834
|
this.initialized = false;
|
|
18836
18835
|
this.isFitData = false;
|
|
18837
18836
|
|
|
@@ -18841,6 +18840,7 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18841
18840
|
initialize(){
|
|
18842
18841
|
this.compatibilityCheck();
|
|
18843
18842
|
this.layoutCheck();
|
|
18843
|
+
this.vertScrollListen();
|
|
18844
18844
|
}
|
|
18845
18845
|
|
|
18846
18846
|
compatibilityCheck(){
|
|
@@ -18880,10 +18880,16 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18880
18880
|
|
|
18881
18881
|
return ok;
|
|
18882
18882
|
}
|
|
18883
|
-
|
|
18883
|
+
|
|
18884
18884
|
layoutCheck(){
|
|
18885
18885
|
this.isFitData = this.options("layout").startsWith('fitData');
|
|
18886
18886
|
}
|
|
18887
|
+
|
|
18888
|
+
vertScrollListen(){
|
|
18889
|
+
this.subscribe("scroll-vertical", () => {
|
|
18890
|
+
this.visibleRows = null;
|
|
18891
|
+
});
|
|
18892
|
+
}
|
|
18887
18893
|
|
|
18888
18894
|
//////////////////////////////////////
|
|
18889
18895
|
///////// Public Functions ///////////
|
|
@@ -18892,6 +18898,7 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18892
18898
|
renderColumns(row, force){
|
|
18893
18899
|
this.dataChange();
|
|
18894
18900
|
}
|
|
18901
|
+
|
|
18895
18902
|
|
|
18896
18903
|
scrollColumns(left, dir){
|
|
18897
18904
|
if(this.scrollLeft != left){
|
|
@@ -18900,20 +18907,20 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18900
18907
|
this.scroll(left - (this.vDomScrollPosLeft + this.windowBuffer));
|
|
18901
18908
|
}
|
|
18902
18909
|
}
|
|
18903
|
-
|
|
18910
|
+
|
|
18904
18911
|
calcWindowBuffer(){
|
|
18905
18912
|
var buffer = this.elementVertical.clientWidth;
|
|
18906
|
-
|
|
18913
|
+
|
|
18907
18914
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
18908
18915
|
if(column.visible){
|
|
18909
18916
|
var width = column.getWidth();
|
|
18910
|
-
|
|
18917
|
+
|
|
18911
18918
|
if(width > buffer){
|
|
18912
18919
|
buffer = width;
|
|
18913
18920
|
}
|
|
18914
18921
|
}
|
|
18915
18922
|
});
|
|
18916
|
-
|
|
18923
|
+
|
|
18917
18924
|
this.windowBuffer = buffer * 2;
|
|
18918
18925
|
}
|
|
18919
18926
|
|
|
@@ -18931,20 +18938,20 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
18931
18938
|
}
|
|
18932
18939
|
|
|
18933
18940
|
this.clear();
|
|
18934
|
-
|
|
18941
|
+
|
|
18935
18942
|
this.calcWindowBuffer();
|
|
18936
18943
|
|
|
18937
18944
|
this.scrollLeft = this.elementVertical.scrollLeft;
|
|
18938
18945
|
|
|
18939
18946
|
this.vDomScrollPosLeft = this.scrollLeft - this.windowBuffer;
|
|
18940
18947
|
this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer;
|
|
18941
|
-
|
|
18948
|
+
|
|
18942
18949
|
this.table.columnManager.columnsByIndex.forEach((column) => {
|
|
18943
18950
|
var config = {};
|
|
18944
18951
|
|
|
18945
18952
|
if(column.visible){
|
|
18946
18953
|
var width = column.getWidth();
|
|
18947
|
-
|
|
18954
|
+
|
|
18948
18955
|
config.leftPos = colPos;
|
|
18949
18956
|
config.rightPos = colPos + width;
|
|
18950
18957
|
|
|
@@ -19071,18 +19078,18 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
19071
19078
|
|
|
19072
19079
|
collsWidth += cell.column.getWidth();
|
|
19073
19080
|
|
|
19074
|
-
if(collsWidth > this.vDomScrollPosRight){
|
|
19075
|
-
|
|
19076
|
-
}
|
|
19081
|
+
// if(collsWidth > this.vDomScrollPosRight){
|
|
19082
|
+
// break;
|
|
19083
|
+
// }
|
|
19077
19084
|
}
|
|
19078
19085
|
|
|
19079
19086
|
rowEl.parentNode.removeChild(rowEl);
|
|
19080
19087
|
|
|
19081
|
-
this.fitDataColAvg = Math.floor(collsWidth / (colEnd + 1));
|
|
19088
|
+
// this.fitDataColAvg = Math.floor(collsWidth / (colEnd + 1));
|
|
19082
19089
|
|
|
19083
|
-
for(colEnd; colEnd < this.table.columnManager.columnsByIndex.length; colEnd++){
|
|
19084
|
-
|
|
19085
|
-
}
|
|
19090
|
+
// for(colEnd; colEnd < this.table.columnManager.columnsByIndex.length; colEnd++){
|
|
19091
|
+
// this.table.columnManager.columnsByIndex[colEnd].setWidth(this.fitDataColAvg);
|
|
19092
|
+
// }
|
|
19086
19093
|
|
|
19087
19094
|
this.rerenderColumns(false, true);
|
|
19088
19095
|
}
|
|
@@ -19113,17 +19120,25 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
19113
19120
|
}
|
|
19114
19121
|
|
|
19115
19122
|
reinitializeRows(){
|
|
19116
|
-
var rows = this.
|
|
19123
|
+
var rows = this.getVisibleRows();
|
|
19117
19124
|
rows.forEach((row) => {
|
|
19118
19125
|
this.reinitializeRow(row, true);
|
|
19119
19126
|
});
|
|
19120
19127
|
}
|
|
19121
19128
|
|
|
19129
|
+
getVisibleRows(){
|
|
19130
|
+
if (!this.visibleRows){
|
|
19131
|
+
this.visibleRows = this.table.rowManager.getVisibleRows();
|
|
19132
|
+
}
|
|
19133
|
+
|
|
19134
|
+
return this.visibleRows;
|
|
19135
|
+
}
|
|
19136
|
+
|
|
19122
19137
|
scroll(diff){
|
|
19123
19138
|
this.vDomScrollPosLeft += diff;
|
|
19124
19139
|
this.vDomScrollPosRight += diff;
|
|
19125
|
-
|
|
19126
|
-
if(diff > (this.
|
|
19140
|
+
|
|
19141
|
+
if(Math.abs(diff) > (this.windowBuffer / 2)){
|
|
19127
19142
|
this.rerenderColumns();
|
|
19128
19143
|
}else {
|
|
19129
19144
|
if(diff > 0){
|
|
@@ -19148,131 +19163,165 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
19148
19163
|
}
|
|
19149
19164
|
|
|
19150
19165
|
addColRight(){
|
|
19151
|
-
var
|
|
19152
|
-
rows;
|
|
19166
|
+
var changes = false;
|
|
19153
19167
|
|
|
19154
|
-
|
|
19155
|
-
rows = this.table.rowManager.getVisibleRows();
|
|
19156
|
-
|
|
19157
|
-
rows.forEach((row) => {
|
|
19158
|
-
if(row.type !== "group"){
|
|
19159
|
-
var cell = row.getCell(column);
|
|
19160
|
-
row.getElement().appendChild(cell.getElement());
|
|
19161
|
-
cell.cellRendered();
|
|
19162
|
-
}
|
|
19163
|
-
});
|
|
19164
|
-
|
|
19165
|
-
this.fitDataColActualWidthCheck(column);
|
|
19168
|
+
while(true){
|
|
19166
19169
|
|
|
19167
|
-
|
|
19170
|
+
let column = this.columns[this.rightCol + 1];
|
|
19168
19171
|
|
|
19169
|
-
if(
|
|
19170
|
-
|
|
19172
|
+
if(column){
|
|
19173
|
+
if(column.modules.vdomHoz.leftPos <= this.vDomScrollPosRight){
|
|
19174
|
+
changes = true;
|
|
19175
|
+
|
|
19176
|
+
this.getVisibleRows().forEach((row) => {
|
|
19177
|
+
if(row.type !== "group"){
|
|
19178
|
+
var cell = row.getCell(column);
|
|
19179
|
+
row.getElement().appendChild(cell.getElement());
|
|
19180
|
+
cell.cellRendered();
|
|
19181
|
+
}
|
|
19182
|
+
});
|
|
19183
|
+
|
|
19184
|
+
this.fitDataColActualWidthCheck(column);
|
|
19185
|
+
|
|
19186
|
+
this.rightCol++; // Don't move this below the >= check below
|
|
19187
|
+
|
|
19188
|
+
if(this.rightCol >= (this.columns.length - 1)){
|
|
19189
|
+
this.vDomPadRight = 0;
|
|
19190
|
+
}else {
|
|
19191
|
+
this.vDomPadRight -= column.getWidth();
|
|
19192
|
+
}
|
|
19193
|
+
}else {
|
|
19194
|
+
break;
|
|
19195
|
+
}
|
|
19171
19196
|
}else {
|
|
19172
|
-
|
|
19197
|
+
break;
|
|
19173
19198
|
}
|
|
19174
|
-
|
|
19199
|
+
}
|
|
19200
|
+
|
|
19201
|
+
if(changes){
|
|
19175
19202
|
this.tableElement.style.paddingRight = this.vDomPadRight + "px";
|
|
19176
|
-
|
|
19177
|
-
this.addColRight();
|
|
19178
19203
|
}
|
|
19179
19204
|
}
|
|
19180
19205
|
|
|
19181
19206
|
addColLeft(){
|
|
19182
|
-
var
|
|
19183
|
-
rows;
|
|
19207
|
+
var changes = false;
|
|
19184
19208
|
|
|
19185
|
-
|
|
19186
|
-
|
|
19209
|
+
while(true){
|
|
19210
|
+
let column = this.columns[this.leftCol - 1];
|
|
19187
19211
|
|
|
19188
|
-
|
|
19189
|
-
if(
|
|
19190
|
-
|
|
19191
|
-
|
|
19192
|
-
|
|
19212
|
+
if(column){
|
|
19213
|
+
if(column.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft){
|
|
19214
|
+
changes = true;
|
|
19215
|
+
|
|
19216
|
+
this.getVisibleRows().forEach((row) => {
|
|
19217
|
+
if(row.type !== "group"){
|
|
19218
|
+
var cell = row.getCell(column);
|
|
19219
|
+
row.getElement().prepend(cell.getElement());
|
|
19220
|
+
cell.cellRendered();
|
|
19221
|
+
}
|
|
19222
|
+
});
|
|
19223
|
+
|
|
19224
|
+
this.leftCol--; // don't move this below the <= check below
|
|
19225
|
+
|
|
19226
|
+
if(this.leftCol <= 0){ // replicating logic in addColRight
|
|
19227
|
+
this.vDomPadLeft = 0;
|
|
19228
|
+
}else {
|
|
19229
|
+
this.vDomPadLeft -= column.getWidth();
|
|
19230
|
+
}
|
|
19231
|
+
|
|
19232
|
+
let diff = this.fitDataColActualWidthCheck(column);
|
|
19233
|
+
|
|
19234
|
+
if(diff){
|
|
19235
|
+
this.scrollLeft = this.elementVertical.scrollLeft = this.elementVertical.scrollLeft + diff;
|
|
19236
|
+
this.vDomPadRight -= diff;
|
|
19237
|
+
}
|
|
19238
|
+
|
|
19239
|
+
}else {
|
|
19240
|
+
break;
|
|
19193
19241
|
}
|
|
19194
|
-
});
|
|
19195
|
-
|
|
19196
|
-
this.fitDataColActualWidthCheck(column);
|
|
19197
|
-
|
|
19198
|
-
this.leftCol--; // don't move this below the <= check below
|
|
19199
|
-
|
|
19200
|
-
if(this.leftCol <= 0){ // replicating logic in addColRight
|
|
19201
|
-
this.vDomPadLeft = 0;
|
|
19202
19242
|
}else {
|
|
19203
|
-
|
|
19243
|
+
break;
|
|
19204
19244
|
}
|
|
19205
|
-
|
|
19245
|
+
}
|
|
19246
|
+
|
|
19247
|
+
if(changes){
|
|
19206
19248
|
this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
this.addColLeft();
|
|
19210
19249
|
}
|
|
19211
19250
|
}
|
|
19212
19251
|
|
|
19213
|
-
removeColRight(
|
|
19214
|
-
var
|
|
19215
|
-
rows;
|
|
19252
|
+
removeColRight(){
|
|
19253
|
+
var changes = false;
|
|
19216
19254
|
|
|
19217
|
-
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
column.modules.vdomHoz.visible = false;
|
|
19255
|
+
while(true){
|
|
19256
|
+
let column = this.columns[this.rightCol];
|
|
19221
19257
|
|
|
19222
|
-
|
|
19223
|
-
if(
|
|
19224
|
-
|
|
19225
|
-
|
|
19226
|
-
|
|
19227
|
-
|
|
19228
|
-
|
|
19229
|
-
|
|
19258
|
+
if(column){
|
|
19259
|
+
if(column.modules.vdomHoz.leftPos > this.vDomScrollPosRight){
|
|
19260
|
+
changes = true;
|
|
19261
|
+
|
|
19262
|
+
this.getVisibleRows().forEach((row) => {
|
|
19263
|
+
if(row.type !== "group"){
|
|
19264
|
+
var cell = row.getCell(column);
|
|
19265
|
+
|
|
19266
|
+
try {
|
|
19267
|
+
row.getElement().removeChild(cell.getElement());
|
|
19268
|
+
} catch (ex) {
|
|
19269
|
+
console.warn("Could not removeColRight", ex.message);
|
|
19270
|
+
}
|
|
19271
|
+
}
|
|
19272
|
+
});
|
|
19273
|
+
|
|
19274
|
+
this.vDomPadRight += column.getWidth();
|
|
19275
|
+
this.rightCol --;
|
|
19276
|
+
}else {
|
|
19277
|
+
break;
|
|
19230
19278
|
}
|
|
19231
|
-
}
|
|
19232
|
-
|
|
19233
|
-
|
|
19279
|
+
}else {
|
|
19280
|
+
break;
|
|
19281
|
+
}
|
|
19282
|
+
}
|
|
19283
|
+
|
|
19284
|
+
if(changes){
|
|
19234
19285
|
this.tableElement.style.paddingRight = this.vDomPadRight + "px";
|
|
19235
|
-
|
|
19236
|
-
this.rightCol --;
|
|
19237
|
-
|
|
19238
|
-
this.removeColRight();
|
|
19239
19286
|
}
|
|
19240
19287
|
}
|
|
19241
19288
|
|
|
19242
19289
|
removeColLeft(){
|
|
19243
|
-
var
|
|
19244
|
-
rows;
|
|
19290
|
+
var changes = false;
|
|
19245
19291
|
|
|
19246
|
-
|
|
19247
|
-
|
|
19292
|
+
while(true){
|
|
19293
|
+
let column = this.columns[this.leftCol];
|
|
19248
19294
|
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
if(el.parentNode){
|
|
19295
|
+
if(column){
|
|
19296
|
+
if(column.modules.vdomHoz.rightPos < this.vDomScrollPosLeft){
|
|
19297
|
+
changes = true;
|
|
19298
|
+
|
|
19299
|
+
this.getVisibleRows().forEach((row) => {
|
|
19300
|
+
if(row.type !== "group"){
|
|
19301
|
+
var cell = row.getCell(column);
|
|
19302
|
+
|
|
19259
19303
|
try {
|
|
19260
|
-
row.getElement().removeChild(
|
|
19304
|
+
row.getElement().removeChild(cell.getElement());
|
|
19261
19305
|
} catch (ex) {
|
|
19262
19306
|
console.warn("Could not removeColLeft", ex.message);
|
|
19263
19307
|
}
|
|
19264
19308
|
}
|
|
19265
|
-
}
|
|
19309
|
+
});
|
|
19310
|
+
|
|
19311
|
+
this.vDomPadLeft += column.getWidth();
|
|
19312
|
+
this.leftCol ++;
|
|
19313
|
+
}else {
|
|
19314
|
+
break;
|
|
19266
19315
|
}
|
|
19267
|
-
}
|
|
19268
|
-
|
|
19269
|
-
|
|
19316
|
+
}else {
|
|
19317
|
+
break;
|
|
19318
|
+
}
|
|
19319
|
+
}
|
|
19320
|
+
|
|
19321
|
+
if(changes){
|
|
19270
19322
|
this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
|
|
19271
|
-
|
|
19272
|
-
this.leftCol ++;
|
|
19273
|
-
|
|
19274
|
-
this.removeColLeft();
|
|
19275
19323
|
}
|
|
19324
|
+
|
|
19276
19325
|
}
|
|
19277
19326
|
|
|
19278
19327
|
fitDataColActualWidthCheck(column){
|
|
@@ -19287,12 +19336,14 @@ class VirtualDomHorizontal extends Renderer{
|
|
|
19287
19336
|
if(widthDiff){
|
|
19288
19337
|
column.modules.vdomHoz.rightPos += widthDiff;
|
|
19289
19338
|
column.modules.vdomHoz.width = newWidth;
|
|
19290
|
-
this.colPositionAdjust(this.
|
|
19339
|
+
this.colPositionAdjust(this.columns.indexOf(column) + 1, this.columns.length, widthDiff);
|
|
19291
19340
|
}
|
|
19292
19341
|
|
|
19293
19342
|
column.modules.vdomHoz.fitDataCheck = false;
|
|
19294
19343
|
}
|
|
19295
|
-
|
|
19344
|
+
|
|
19345
|
+
return widthDiff;
|
|
19346
|
+
}
|
|
19296
19347
|
|
|
19297
19348
|
initializeRow(row){
|
|
19298
19349
|
if(row.type !== "group"){
|