tabulator-tables 5.3.0 → 5.3.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_bootstrap3.css +1 -1
- 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 +4 -4
- 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 +4 -4
- 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/js/tabulator.js +304 -233
- 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 +456 -388
- 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/ColumnManager.js +18 -4
- package/src/js/core/Module.js +54 -23
- package/src/js/core/RowManager.js +83 -94
- package/src/js/core/Tabulator.js +2 -2
- package/src/js/core/column/Column.js +26 -2
- package/src/js/core/tools/InteractionMonitor.js +12 -9
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
- package/src/js/modules/DataTree/DataTree.js +5 -11
- package/src/js/modules/Edit/List.js +1 -1
- package/src/js/modules/Filter/Filter.js +3 -0
- package/src/js/modules/GroupRows/Group.js +5 -9
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/GroupRows/GroupRows.js +217 -194
- package/src/js/modules/History/History.js +1 -1
- package/src/js/modules/Interaction/Interaction.js +3 -3
- package/src/js/modules/Layout/defaults/modes/fitColumns.js +4 -6
- package/src/js/modules/Page/Page.js +2 -12
- package/src/js/modules/Persistence/Persistence.js +3 -2
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +3 -2
- package/src/js/modules/SelectRow/SelectRow.js +8 -4
- package/src/js/modules/Sort/Sort.js +4 -7
- package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +1 -1
- package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +1 -1
- package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +1 -1
package/package.json
CHANGED
|
@@ -286,6 +286,8 @@ export default class ColumnManager extends CoreFeature {
|
|
|
286
286
|
var minHeight = 0;
|
|
287
287
|
|
|
288
288
|
if(!this.redrawBlock){
|
|
289
|
+
|
|
290
|
+
this.element.style.height="";
|
|
289
291
|
|
|
290
292
|
this.columns.forEach((column) => {
|
|
291
293
|
column.clearVerticalAlign();
|
|
@@ -298,7 +300,9 @@ export default class ColumnManager extends CoreFeature {
|
|
|
298
300
|
minHeight = height;
|
|
299
301
|
}
|
|
300
302
|
});
|
|
301
|
-
|
|
303
|
+
|
|
304
|
+
this.element.style.height = minHeight + "px";
|
|
305
|
+
|
|
302
306
|
this.columns.forEach((column) => {
|
|
303
307
|
column.verticalAlign(this.table.options.columnHeaderVertAlign, minHeight);
|
|
304
308
|
});
|
|
@@ -309,6 +313,8 @@ export default class ColumnManager extends CoreFeature {
|
|
|
309
313
|
|
|
310
314
|
//////////////// Column Details /////////////////
|
|
311
315
|
findColumn(subject){
|
|
316
|
+
var columns;
|
|
317
|
+
|
|
312
318
|
if(typeof subject == "object"){
|
|
313
319
|
|
|
314
320
|
if(subject instanceof Column){
|
|
@@ -318,8 +324,16 @@ export default class ColumnManager extends CoreFeature {
|
|
|
318
324
|
//subject is public column component
|
|
319
325
|
return subject._getSelf() || false;
|
|
320
326
|
}else if(typeof HTMLElement !== "undefined" && subject instanceof HTMLElement){
|
|
327
|
+
|
|
328
|
+
columns = [];
|
|
329
|
+
|
|
330
|
+
this.columns.forEach((column) => {
|
|
331
|
+
columns.push(column);
|
|
332
|
+
columns = columns.concat(column.getColumns(true));
|
|
333
|
+
});
|
|
334
|
+
|
|
321
335
|
//subject is a HTML element of the column header
|
|
322
|
-
let match =
|
|
336
|
+
let match = columns.find((column) => {
|
|
323
337
|
return column.element === subject;
|
|
324
338
|
});
|
|
325
339
|
|
|
@@ -434,14 +448,14 @@ export default class ColumnManager extends CoreFeature {
|
|
|
434
448
|
}
|
|
435
449
|
|
|
436
450
|
moveColumn(from, to, after){
|
|
437
|
-
this.moveColumnActual(from, to, after);
|
|
438
|
-
|
|
439
451
|
to.element.parentNode.insertBefore(from.element, to.element);
|
|
440
452
|
|
|
441
453
|
if(after){
|
|
442
454
|
to.element.parentNode.insertBefore(to.element, from.element);
|
|
443
455
|
}
|
|
444
456
|
|
|
457
|
+
this.moveColumnActual(from, to, after);
|
|
458
|
+
|
|
445
459
|
this.verticalAlignHeaders();
|
|
446
460
|
|
|
447
461
|
this.table.rowManager.reinitialize();
|
package/src/js/core/Module.js
CHANGED
|
@@ -2,90 +2,121 @@ import CoreFeature from './CoreFeature.js';
|
|
|
2
2
|
import Popup from './tools/Popup.js';
|
|
3
3
|
|
|
4
4
|
class Module extends CoreFeature{
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
constructor(table, name){
|
|
7
7
|
super(table);
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
this._handler = null;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
initialize(){
|
|
13
13
|
// setup module when table is initialized, to be overridden in module
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
|
|
17
17
|
///////////////////////////////////
|
|
18
18
|
////// Options Registration ///////
|
|
19
19
|
///////////////////////////////////
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
registerTableOption(key, value){
|
|
22
22
|
this.table.optionsList.register(key, value);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
registerColumnOption(key, value){
|
|
26
26
|
this.table.columnManager.optionsList.register(key, value);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
///////////////////////////////////
|
|
30
30
|
/// Public Function Registration ///
|
|
31
31
|
///////////////////////////////////
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
registerTableFunction(name, func){
|
|
34
34
|
if(typeof this.table[name] === "undefined"){
|
|
35
35
|
this.table[name] = (...args) => {
|
|
36
36
|
this.table.initGuard(name);
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
return func(...args);
|
|
39
39
|
};
|
|
40
40
|
}else{
|
|
41
41
|
console.warn("Unable to bind table function, name already in use", name);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
registerComponentFunction(component, func, handler){
|
|
46
46
|
return this.table.componentFunctionBinder.bind(component, func, handler);
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
///////////////////////////////////
|
|
50
50
|
////////// Data Pipeline //////////
|
|
51
51
|
///////////////////////////////////
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
registerDataHandler(handler, priority){
|
|
54
54
|
this.table.rowManager.registerDataPipelineHandler(handler, priority);
|
|
55
55
|
this._handler = handler;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
registerDisplayHandler(handler, priority){
|
|
59
59
|
this.table.rowManager.registerDisplayPipelineHandler(handler, priority);
|
|
60
60
|
this._handler = handler;
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
displayRows(adjust){
|
|
64
|
+
var index = this.table.rowManager.displayRows.length - 1,
|
|
65
|
+
lookupIndex;
|
|
66
|
+
|
|
67
|
+
if(this._handler){
|
|
68
|
+
lookupIndex = this.table.rowManager.displayPipeline.findIndex((item) => {
|
|
69
|
+
return item.handler === this._handler;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if(lookupIndex > -1){
|
|
73
|
+
index = lookupIndex;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if(adjust){
|
|
78
|
+
index = index + adjust;
|
|
79
|
+
}
|
|
62
80
|
|
|
81
|
+
if(this._handler){
|
|
82
|
+
if(index > -1){
|
|
83
|
+
return this.table.rowManager.getDisplayRows(index);
|
|
84
|
+
}else{
|
|
85
|
+
return this.activeRows();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
activeRows(){
|
|
91
|
+
return this.table.rowManager.activeRows;
|
|
92
|
+
}
|
|
93
|
+
|
|
63
94
|
refreshData(renderInPosition, handler){
|
|
64
95
|
if(!handler){
|
|
65
96
|
handler = this._handler;
|
|
66
97
|
}
|
|
67
|
-
|
|
98
|
+
|
|
68
99
|
if(handler){
|
|
69
100
|
this.table.rowManager.refreshActiveData(handler, false, renderInPosition);
|
|
70
101
|
}
|
|
71
102
|
}
|
|
72
|
-
|
|
103
|
+
|
|
73
104
|
///////////////////////////////////
|
|
74
105
|
//////// Footer Management ////////
|
|
75
106
|
///////////////////////////////////
|
|
76
|
-
|
|
107
|
+
|
|
77
108
|
footerAppend(element){
|
|
78
109
|
return this.table.footerManager.append(element);
|
|
79
110
|
}
|
|
80
|
-
|
|
111
|
+
|
|
81
112
|
footerPrepend(element){
|
|
82
113
|
return this.table.footerManager.prepend(element);
|
|
83
114
|
}
|
|
84
|
-
|
|
115
|
+
|
|
85
116
|
footerRemove(element){
|
|
86
117
|
return this.table.footerManager.remove(element);
|
|
87
118
|
}
|
|
88
|
-
|
|
119
|
+
|
|
89
120
|
///////////////////////////////////
|
|
90
121
|
//////// Popups Management ////////
|
|
91
122
|
///////////////////////////////////
|
|
@@ -93,15 +124,15 @@ class Module extends CoreFeature{
|
|
|
93
124
|
popup(menuEl, menuContainer){
|
|
94
125
|
return new Popup(this.table, menuEl, menuContainer);
|
|
95
126
|
}
|
|
96
|
-
|
|
127
|
+
|
|
97
128
|
///////////////////////////////////
|
|
98
129
|
//////// Alert Management ////////
|
|
99
130
|
///////////////////////////////////
|
|
100
|
-
|
|
131
|
+
|
|
101
132
|
alert(content, type){
|
|
102
133
|
return this.table.alertManager.alert(content, type);
|
|
103
134
|
}
|
|
104
|
-
|
|
135
|
+
|
|
105
136
|
clearAlert(){
|
|
106
137
|
return this.table.alertManager.clear();
|
|
107
138
|
}
|
|
@@ -604,81 +604,82 @@ export default class RowManager extends CoreFeature{
|
|
|
604
604
|
index = 0,
|
|
605
605
|
cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
|
|
606
606
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
return item.handler === handler;
|
|
611
|
-
});
|
|
612
|
-
|
|
613
|
-
if(index > -1){
|
|
614
|
-
stage = "dataPipeline";
|
|
615
|
-
|
|
616
|
-
if(skipStage){
|
|
617
|
-
if(index == this.dataPipeline.length - 1){
|
|
618
|
-
stage = "display";
|
|
619
|
-
}else{
|
|
620
|
-
index++;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}else{
|
|
624
|
-
index = this.displayPipeline.findIndex((item) => {
|
|
607
|
+
if(!this.table.destroyed){
|
|
608
|
+
if(typeof handler === "function"){
|
|
609
|
+
index = this.dataPipeline.findIndex((item) => {
|
|
625
610
|
return item.handler === handler;
|
|
626
611
|
});
|
|
627
612
|
|
|
628
613
|
if(index > -1){
|
|
629
|
-
stage = "
|
|
614
|
+
stage = "dataPipeline";
|
|
630
615
|
|
|
631
616
|
if(skipStage){
|
|
632
|
-
if(index == this.
|
|
633
|
-
stage = "
|
|
617
|
+
if(index == this.dataPipeline.length - 1){
|
|
618
|
+
stage = "display";
|
|
634
619
|
}else{
|
|
635
620
|
index++;
|
|
636
621
|
}
|
|
637
622
|
}
|
|
638
623
|
}else{
|
|
639
|
-
|
|
640
|
-
|
|
624
|
+
index = this.displayPipeline.findIndex((item) => {
|
|
625
|
+
return item.handler === handler;
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
if(index > -1){
|
|
629
|
+
stage = "displayPipeline";
|
|
630
|
+
|
|
631
|
+
if(skipStage){
|
|
632
|
+
if(index == this.displayPipeline.length - 1){
|
|
633
|
+
stage = "end";
|
|
634
|
+
}else{
|
|
635
|
+
index++;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}else{
|
|
639
|
+
console.error("Unable to refresh data, invalid handler provided", handler);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
641
642
|
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
index = 0;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
if(this.redrawBlock){
|
|
649
|
-
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
650
|
-
this.redrawBlockRestoreConfig = {
|
|
651
|
-
handler: handler,
|
|
652
|
-
skipStage: skipStage,
|
|
653
|
-
renderInPosition: renderInPosition,
|
|
654
|
-
stage:stage,
|
|
655
|
-
index:index,
|
|
656
|
-
};
|
|
643
|
+
}else{
|
|
644
|
+
stage = handler || "all";
|
|
645
|
+
index = 0;
|
|
657
646
|
}
|
|
658
647
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
648
|
+
if(this.redrawBlock){
|
|
649
|
+
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
650
|
+
this.redrawBlockRestoreConfig = {
|
|
651
|
+
handler: handler,
|
|
652
|
+
skipStage: skipStage,
|
|
653
|
+
renderInPosition: renderInPosition,
|
|
654
|
+
stage:stage,
|
|
655
|
+
index:index,
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
return;
|
|
660
|
+
}else{
|
|
661
|
+
if(Helpers.elVisible(this.element)){
|
|
662
|
+
if(renderInPosition){
|
|
663
|
+
this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
|
|
664
|
+
}else{
|
|
665
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
666
|
+
|
|
667
|
+
if(!handler){
|
|
668
|
+
this.table.columnManager.renderer.renderColumns();
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
this.renderTable();
|
|
672
|
+
|
|
673
|
+
if(table.options.layoutColumnsOnNewData){
|
|
674
|
+
this.table.columnManager.redraw(true);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
664
677
|
}else{
|
|
665
678
|
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
666
|
-
|
|
667
|
-
if(!handler){
|
|
668
|
-
this.table.columnManager.renderer.renderColumns();
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
this.renderTable();
|
|
672
|
-
|
|
673
|
-
if(table.options.layoutColumnsOnNewData){
|
|
674
|
-
this.table.columnManager.redraw(true);
|
|
675
|
-
}
|
|
676
679
|
}
|
|
677
|
-
|
|
678
|
-
this.
|
|
680
|
+
|
|
681
|
+
this.dispatch("data-refreshed");
|
|
679
682
|
}
|
|
680
|
-
|
|
681
|
-
this.dispatch("data-refreshed");
|
|
682
683
|
}
|
|
683
684
|
}
|
|
684
685
|
|
|
@@ -711,7 +712,7 @@ export default class RowManager extends CoreFeature{
|
|
|
711
712
|
case "displayPipeline":
|
|
712
713
|
for(let i = index; i < this.displayPipeline.length; i++){
|
|
713
714
|
let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
714
|
-
|
|
715
|
+
|
|
715
716
|
this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
|
|
716
717
|
}
|
|
717
718
|
|
|
@@ -748,28 +749,13 @@ export default class RowManager extends CoreFeature{
|
|
|
748
749
|
this.displayRowsCount = this.displayRows[0].length;
|
|
749
750
|
}
|
|
750
751
|
|
|
751
|
-
getNextDisplayIndex(){
|
|
752
|
-
return this.displayRows.length;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
752
|
//set display row pipeline data
|
|
756
753
|
setDisplayRows(displayRows, index){
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
if(index && typeof this.displayRows[index] != "undefined"){
|
|
761
|
-
this.displayRows[index] = displayRows;
|
|
762
|
-
output = true;
|
|
763
|
-
}else{
|
|
764
|
-
this.displayRows.push(displayRows);
|
|
765
|
-
output = index = this.displayRows.length -1;
|
|
766
|
-
}
|
|
767
|
-
|
|
754
|
+
this.displayRows[index] = displayRows;
|
|
755
|
+
|
|
768
756
|
if(index == this.displayRows.length -1){
|
|
769
757
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
770
758
|
}
|
|
771
|
-
|
|
772
|
-
return output;
|
|
773
759
|
}
|
|
774
760
|
|
|
775
761
|
getDisplayRows(index){
|
|
@@ -800,23 +786,24 @@ export default class RowManager extends CoreFeature{
|
|
|
800
786
|
|
|
801
787
|
//return only actual rows (not group headers etc)
|
|
802
788
|
getRows(type){
|
|
803
|
-
var rows;
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
break;
|
|
813
|
-
|
|
814
|
-
case "visible":
|
|
815
|
-
rows = this.getVisibleRows(false, true);
|
|
816
|
-
break;
|
|
789
|
+
var rows = [];
|
|
790
|
+
|
|
791
|
+
if(!type){
|
|
792
|
+
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
793
|
+
}else{
|
|
794
|
+
switch(type){
|
|
795
|
+
case "active":
|
|
796
|
+
rows = this.activeRows;
|
|
797
|
+
break;
|
|
817
798
|
|
|
818
|
-
|
|
819
|
-
|
|
799
|
+
case "display":
|
|
800
|
+
rows = this.table.rowManager.getDisplayRows();
|
|
801
|
+
break;
|
|
802
|
+
|
|
803
|
+
case "visible":
|
|
804
|
+
rows = this.getVisibleRows(false, true);
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
820
807
|
}
|
|
821
808
|
|
|
822
809
|
return rows;
|
|
@@ -859,6 +846,8 @@ export default class RowManager extends CoreFeature{
|
|
|
859
846
|
}
|
|
860
847
|
|
|
861
848
|
if(renderClass){
|
|
849
|
+
this.renderMode = this.table.options.renderVertical;
|
|
850
|
+
|
|
862
851
|
this.renderer = new renderClass(this.table, this.element, this.tableElement);
|
|
863
852
|
this.renderer.initialize();
|
|
864
853
|
|
|
@@ -923,9 +912,6 @@ export default class RowManager extends CoreFeature{
|
|
|
923
912
|
|
|
924
913
|
this.scrollTop = 0;
|
|
925
914
|
this.scrollLeft = 0;
|
|
926
|
-
|
|
927
|
-
// clear empty table placeholder min
|
|
928
|
-
this.tableElement.style.minWidth = "";
|
|
929
915
|
|
|
930
916
|
this.renderer.clearRows();
|
|
931
917
|
}
|
|
@@ -942,6 +928,9 @@ export default class RowManager extends CoreFeature{
|
|
|
942
928
|
_clearPlaceholder(){
|
|
943
929
|
if(this.placeholder && this.placeholder.parentNode){
|
|
944
930
|
this.placeholder.parentNode.removeChild(this.placeholder);
|
|
931
|
+
|
|
932
|
+
// clear empty table placeholder min
|
|
933
|
+
this.tableElement.style.minWidth = "";
|
|
945
934
|
}
|
|
946
935
|
}
|
|
947
936
|
|
package/src/js/core/Tabulator.js
CHANGED
|
@@ -417,7 +417,7 @@ class Tabulator {
|
|
|
417
417
|
data = JSON.parse(data);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
if(data){
|
|
420
|
+
if(data && data.length > 0){
|
|
421
421
|
data.forEach((item) => {
|
|
422
422
|
var row = this.rowManager.findRow(item[this.options.index]);
|
|
423
423
|
|
|
@@ -483,7 +483,7 @@ class Tabulator {
|
|
|
483
483
|
data = JSON.parse(data);
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
if(data){
|
|
486
|
+
if(data && data.length > 0){
|
|
487
487
|
data.forEach((item) => {
|
|
488
488
|
var row = this.rowManager.findRow(item[this.options.index]);
|
|
489
489
|
|
|
@@ -481,8 +481,20 @@ class Column extends CoreFeature{
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
//return all columns in a group
|
|
484
|
-
getColumns(){
|
|
485
|
-
|
|
484
|
+
getColumns(traverse){
|
|
485
|
+
var columns = [];
|
|
486
|
+
|
|
487
|
+
if(traverse){
|
|
488
|
+
this.columns.forEach((column) => {
|
|
489
|
+
columns.push(column);
|
|
490
|
+
|
|
491
|
+
columns = columns.concat(column.getColumns(true));
|
|
492
|
+
});
|
|
493
|
+
}else{
|
|
494
|
+
columns = this.columns;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return columns;
|
|
486
498
|
}
|
|
487
499
|
|
|
488
500
|
//return all columns in a group
|
|
@@ -710,6 +722,12 @@ class Column extends CoreFeature{
|
|
|
710
722
|
}
|
|
711
723
|
|
|
712
724
|
setMinWidth(minWidth){
|
|
725
|
+
if(this.maxWidth && minWidth > this.maxWidth){
|
|
726
|
+
minWidth = this.maxWidth;
|
|
727
|
+
|
|
728
|
+
console.warn("the minWidth ("+ minWidth + "px) for column '" + this.field + "' cannot be bigger that its maxWidth ("+ this.maxWidthStyled + ")");
|
|
729
|
+
}
|
|
730
|
+
|
|
713
731
|
this.minWidth = minWidth;
|
|
714
732
|
this.minWidthStyled = minWidth ? minWidth + "px" : "";
|
|
715
733
|
|
|
@@ -721,6 +739,12 @@ class Column extends CoreFeature{
|
|
|
721
739
|
}
|
|
722
740
|
|
|
723
741
|
setMaxWidth(maxWidth){
|
|
742
|
+
if(this.minWidth && maxWidth < this.minWidth){
|
|
743
|
+
maxWidth = this.minWidth;
|
|
744
|
+
|
|
745
|
+
console.warn("the maxWidth ("+ maxWidth + "px) for column '" + this.field + "' cannot be smaller that its minWidth ("+ this.minWidthStyled + ")");
|
|
746
|
+
}
|
|
747
|
+
|
|
724
748
|
this.maxWidth = maxWidth;
|
|
725
749
|
this.maxWidthStyled = maxWidth ? maxWidth + "px" : "";
|
|
726
750
|
|
|
@@ -219,7 +219,9 @@ export default class InteractionManager extends CoreFeature {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
for (let target of elTargets) {
|
|
222
|
-
targets[this.componentMap[target]]
|
|
222
|
+
if(!targets[this.componentMap[target]]){
|
|
223
|
+
targets[this.componentMap[target]] = el;
|
|
224
|
+
}
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
|
|
@@ -234,12 +236,13 @@ export default class InteractionManager extends CoreFeature {
|
|
|
234
236
|
//ensure row component is looked up before cell
|
|
235
237
|
var keys = Object.keys(targets).reverse(),
|
|
236
238
|
listener = this.listeners[type],
|
|
239
|
+
matches = {},
|
|
237
240
|
targetMatches = {};
|
|
238
241
|
|
|
239
242
|
for(let key of keys){
|
|
240
|
-
let component
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
let component,
|
|
244
|
+
target = targets[key],
|
|
245
|
+
previousTarget = this.previousTargets[key];
|
|
243
246
|
|
|
244
247
|
if(previousTarget && previousTarget.target === target){
|
|
245
248
|
component = previousTarget.component;
|
|
@@ -268,8 +271,8 @@ export default class InteractionManager extends CoreFeature {
|
|
|
268
271
|
|
|
269
272
|
case "cell":
|
|
270
273
|
if(listener.components.includes("cell")){
|
|
271
|
-
if(
|
|
272
|
-
component =
|
|
274
|
+
if(matches["row"] instanceof Row){
|
|
275
|
+
component = matches["row"].findCell(target);
|
|
273
276
|
}else{
|
|
274
277
|
if(targets["row"]){
|
|
275
278
|
console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?");
|
|
@@ -281,7 +284,7 @@ export default class InteractionManager extends CoreFeature {
|
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
if(component){
|
|
284
|
-
|
|
287
|
+
matches[key] = component;
|
|
285
288
|
targetMatches[key] = {
|
|
286
289
|
target:target,
|
|
287
290
|
component:component,
|
|
@@ -291,12 +294,12 @@ export default class InteractionManager extends CoreFeature {
|
|
|
291
294
|
|
|
292
295
|
this.previousTargets = targetMatches;
|
|
293
296
|
|
|
294
|
-
return
|
|
297
|
+
return matches;
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
triggerEvents(type, e, targets){
|
|
298
301
|
var listener = this.listeners[type];
|
|
299
|
-
|
|
302
|
+
|
|
300
303
|
for(let key in targets){
|
|
301
304
|
if(targets[key] && listener.components.includes(key)){
|
|
302
305
|
this.dispatch(key + "-" + type, e, targets[key]);
|
|
@@ -18,8 +18,6 @@ class DataTree extends Module{
|
|
|
18
18
|
|
|
19
19
|
this.startOpen = function(){};
|
|
20
20
|
|
|
21
|
-
this.displayIndex = 0;
|
|
22
|
-
|
|
23
21
|
this.registerTableOption("dataTree", false); //enable data tree
|
|
24
22
|
this.registerTableOption("dataTreeFilter", true); //filter child rows
|
|
25
23
|
this.registerTableOption("dataTreeSort", true); //sort child rows
|
|
@@ -51,6 +49,10 @@ class DataTree extends Module{
|
|
|
51
49
|
this.field = options.dataTreeChildField;
|
|
52
50
|
this.indent = options.dataTreeChildIndent;
|
|
53
51
|
|
|
52
|
+
if(this.options("movableRows")){
|
|
53
|
+
console.warn("The movableRows option is not available with dataTree enabled, moving of child rows could result in unpredictable behavior");
|
|
54
|
+
}
|
|
55
|
+
|
|
54
56
|
if(options.dataTreeBranchElement){
|
|
55
57
|
|
|
56
58
|
if(options.dataTreeBranchElement === true){
|
|
@@ -291,14 +293,6 @@ class DataTree extends Module{
|
|
|
291
293
|
}
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
setDisplayIndex (index) {
|
|
295
|
-
this.displayIndex = index;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
getDisplayIndex () {
|
|
299
|
-
return this.displayIndex;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
296
|
getRows(rows){
|
|
303
297
|
var output = [];
|
|
304
298
|
|
|
@@ -436,7 +430,7 @@ class DataTree extends Module{
|
|
|
436
430
|
}
|
|
437
431
|
|
|
438
432
|
getTreeParentRoot(row){
|
|
439
|
-
return row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
|
|
433
|
+
return row.modules.dataTree && row.modules.dataTree.parent ? this.getTreeParentRoot(row.modules.dataTree.parent) : row;
|
|
440
434
|
}
|
|
441
435
|
|
|
442
436
|
getFilteredTreeChildren(row){
|