tabulator-tables 5.3.1 → 5.3.4
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 +225 -216
- 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 +379 -377
- 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 +7 -3
- package/src/js/core/Module.js +54 -23
- package/src/js/core/RowManager.js +81 -94
- package/src/js/core/Tabulator.js +2 -2
- package/src/js/core/tools/InteractionMonitor.js +9 -8
- package/src/js/modules/DataTree/DataTree.js +0 -10
- package/src/js/modules/FrozenRows/FrozenRows.js +3 -2
- package/src/js/modules/GroupRows/Group.js +3 -7
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/GroupRows/GroupRows.js +200 -200
- package/src/js/modules/Interaction/Interaction.js +1 -1
- package/src/js/modules/Page/Page.js +2 -12
- package/src/js/modules/Persistence/Persistence.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/dist/js/tabulator_esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.3.
|
|
1
|
+
/* Tabulator v5.3.4 (c) Oliver Folkerd 2022 */
|
|
2
2
|
class CoreFeature{
|
|
3
3
|
|
|
4
4
|
constructor(table){
|
|
@@ -469,90 +469,121 @@ class Popup extends CoreFeature{
|
|
|
469
469
|
}
|
|
470
470
|
|
|
471
471
|
class Module extends CoreFeature{
|
|
472
|
-
|
|
472
|
+
|
|
473
473
|
constructor(table, name){
|
|
474
474
|
super(table);
|
|
475
|
-
|
|
475
|
+
|
|
476
476
|
this._handler = null;
|
|
477
477
|
}
|
|
478
|
-
|
|
478
|
+
|
|
479
479
|
initialize(){
|
|
480
480
|
// setup module when table is initialized, to be overridden in module
|
|
481
481
|
}
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
|
|
483
|
+
|
|
484
484
|
///////////////////////////////////
|
|
485
485
|
////// Options Registration ///////
|
|
486
486
|
///////////////////////////////////
|
|
487
|
-
|
|
487
|
+
|
|
488
488
|
registerTableOption(key, value){
|
|
489
489
|
this.table.optionsList.register(key, value);
|
|
490
490
|
}
|
|
491
|
-
|
|
491
|
+
|
|
492
492
|
registerColumnOption(key, value){
|
|
493
493
|
this.table.columnManager.optionsList.register(key, value);
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
|
|
496
496
|
///////////////////////////////////
|
|
497
497
|
/// Public Function Registration ///
|
|
498
498
|
///////////////////////////////////
|
|
499
|
-
|
|
499
|
+
|
|
500
500
|
registerTableFunction(name, func){
|
|
501
501
|
if(typeof this.table[name] === "undefined"){
|
|
502
502
|
this.table[name] = (...args) => {
|
|
503
503
|
this.table.initGuard(name);
|
|
504
|
-
|
|
504
|
+
|
|
505
505
|
return func(...args);
|
|
506
506
|
};
|
|
507
507
|
}else {
|
|
508
508
|
console.warn("Unable to bind table function, name already in use", name);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
|
|
511
|
+
|
|
512
512
|
registerComponentFunction(component, func, handler){
|
|
513
513
|
return this.table.componentFunctionBinder.bind(component, func, handler);
|
|
514
514
|
}
|
|
515
|
-
|
|
515
|
+
|
|
516
516
|
///////////////////////////////////
|
|
517
517
|
////////// Data Pipeline //////////
|
|
518
518
|
///////////////////////////////////
|
|
519
|
-
|
|
519
|
+
|
|
520
520
|
registerDataHandler(handler, priority){
|
|
521
521
|
this.table.rowManager.registerDataPipelineHandler(handler, priority);
|
|
522
522
|
this._handler = handler;
|
|
523
523
|
}
|
|
524
|
-
|
|
524
|
+
|
|
525
525
|
registerDisplayHandler(handler, priority){
|
|
526
526
|
this.table.rowManager.registerDisplayPipelineHandler(handler, priority);
|
|
527
527
|
this._handler = handler;
|
|
528
528
|
}
|
|
529
|
+
|
|
530
|
+
displayRows(adjust){
|
|
531
|
+
var index = this.table.rowManager.displayRows.length - 1,
|
|
532
|
+
lookupIndex;
|
|
533
|
+
|
|
534
|
+
if(this._handler){
|
|
535
|
+
lookupIndex = this.table.rowManager.displayPipeline.findIndex((item) => {
|
|
536
|
+
return item.handler === this._handler;
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
if(lookupIndex > -1){
|
|
540
|
+
index = lookupIndex;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
if(adjust){
|
|
545
|
+
index = index + adjust;
|
|
546
|
+
}
|
|
529
547
|
|
|
548
|
+
if(this._handler){
|
|
549
|
+
if(index > -1){
|
|
550
|
+
return this.table.rowManager.getDisplayRows(index);
|
|
551
|
+
}else {
|
|
552
|
+
return this.activeRows();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
activeRows(){
|
|
558
|
+
return this.table.rowManager.activeRows;
|
|
559
|
+
}
|
|
560
|
+
|
|
530
561
|
refreshData(renderInPosition, handler){
|
|
531
562
|
if(!handler){
|
|
532
563
|
handler = this._handler;
|
|
533
564
|
}
|
|
534
|
-
|
|
565
|
+
|
|
535
566
|
if(handler){
|
|
536
567
|
this.table.rowManager.refreshActiveData(handler, false, renderInPosition);
|
|
537
568
|
}
|
|
538
569
|
}
|
|
539
|
-
|
|
570
|
+
|
|
540
571
|
///////////////////////////////////
|
|
541
572
|
//////// Footer Management ////////
|
|
542
573
|
///////////////////////////////////
|
|
543
|
-
|
|
574
|
+
|
|
544
575
|
footerAppend(element){
|
|
545
576
|
return this.table.footerManager.append(element);
|
|
546
577
|
}
|
|
547
|
-
|
|
578
|
+
|
|
548
579
|
footerPrepend(element){
|
|
549
580
|
return this.table.footerManager.prepend(element);
|
|
550
581
|
}
|
|
551
|
-
|
|
582
|
+
|
|
552
583
|
footerRemove(element){
|
|
553
584
|
return this.table.footerManager.remove(element);
|
|
554
585
|
}
|
|
555
|
-
|
|
586
|
+
|
|
556
587
|
///////////////////////////////////
|
|
557
588
|
//////// Popups Management ////////
|
|
558
589
|
///////////////////////////////////
|
|
@@ -560,15 +591,15 @@ class Module extends CoreFeature{
|
|
|
560
591
|
popup(menuEl, menuContainer){
|
|
561
592
|
return new Popup(this.table, menuEl, menuContainer);
|
|
562
593
|
}
|
|
563
|
-
|
|
594
|
+
|
|
564
595
|
///////////////////////////////////
|
|
565
596
|
//////// Alert Management ////////
|
|
566
597
|
///////////////////////////////////
|
|
567
|
-
|
|
598
|
+
|
|
568
599
|
alert(content, type){
|
|
569
600
|
return this.table.alertManager.alert(content, type);
|
|
570
601
|
}
|
|
571
|
-
|
|
602
|
+
|
|
572
603
|
clearAlert(){
|
|
573
604
|
return this.table.alertManager.clear();
|
|
574
605
|
}
|
|
@@ -4043,8 +4074,6 @@ class DataTree extends Module{
|
|
|
4043
4074
|
|
|
4044
4075
|
this.startOpen = function(){};
|
|
4045
4076
|
|
|
4046
|
-
this.displayIndex = 0;
|
|
4047
|
-
|
|
4048
4077
|
this.registerTableOption("dataTree", false); //enable data tree
|
|
4049
4078
|
this.registerTableOption("dataTreeFilter", true); //filter child rows
|
|
4050
4079
|
this.registerTableOption("dataTreeSort", true); //sort child rows
|
|
@@ -4320,14 +4349,6 @@ class DataTree extends Module{
|
|
|
4320
4349
|
}
|
|
4321
4350
|
}
|
|
4322
4351
|
|
|
4323
|
-
setDisplayIndex (index) {
|
|
4324
|
-
this.displayIndex = index;
|
|
4325
|
-
}
|
|
4326
|
-
|
|
4327
|
-
getDisplayIndex () {
|
|
4328
|
-
return this.displayIndex;
|
|
4329
|
-
}
|
|
4330
|
-
|
|
4331
4352
|
getRows(rows){
|
|
4332
4353
|
var output = [];
|
|
4333
4354
|
|
|
@@ -10965,12 +10986,13 @@ class FrozenRows extends Module{
|
|
|
10965
10986
|
this.topElement.appendChild(row.getElement());
|
|
10966
10987
|
row.initialize();
|
|
10967
10988
|
row.normalizeHeight();
|
|
10968
|
-
|
|
10969
|
-
|
|
10989
|
+
|
|
10970
10990
|
this.rows.push(row);
|
|
10971
10991
|
|
|
10972
10992
|
this.refreshData(false, "display");
|
|
10973
10993
|
|
|
10994
|
+
this.table.rowManager.adjustTableSize();
|
|
10995
|
+
|
|
10974
10996
|
this.styleRows();
|
|
10975
10997
|
|
|
10976
10998
|
}else {
|
|
@@ -11063,7 +11085,7 @@ class GroupComponent {
|
|
|
11063
11085
|
}
|
|
11064
11086
|
|
|
11065
11087
|
isVisible(){
|
|
11066
|
-
return this._group.
|
|
11088
|
+
return this._group._visible;
|
|
11067
11089
|
}
|
|
11068
11090
|
|
|
11069
11091
|
show(){
|
|
@@ -11465,9 +11487,7 @@ class Group{
|
|
|
11465
11487
|
});
|
|
11466
11488
|
}
|
|
11467
11489
|
|
|
11468
|
-
this.groupManager.
|
|
11469
|
-
|
|
11470
|
-
this.groupManager.checkBasicModeGroupHeaderWidth();
|
|
11490
|
+
this.groupManager.updateGroupRows(true);
|
|
11471
11491
|
|
|
11472
11492
|
}else {
|
|
11473
11493
|
this.groupManager.updateGroupRows(true);
|
|
@@ -11505,10 +11525,8 @@ class Group{
|
|
|
11505
11525
|
prev = rowEl;
|
|
11506
11526
|
});
|
|
11507
11527
|
}
|
|
11508
|
-
|
|
11509
|
-
this.groupManager.
|
|
11510
|
-
|
|
11511
|
-
this.groupManager.checkBasicModeGroupHeaderWidth();
|
|
11528
|
+
|
|
11529
|
+
this.groupManager.updateGroupRows(true);
|
|
11512
11530
|
}else {
|
|
11513
11531
|
this.groupManager.updateGroupRows(true);
|
|
11514
11532
|
}
|
|
@@ -11690,20 +11708,19 @@ class Group{
|
|
|
11690
11708
|
}
|
|
11691
11709
|
|
|
11692
11710
|
class GroupRows extends Module{
|
|
11693
|
-
|
|
11711
|
+
|
|
11694
11712
|
constructor(table){
|
|
11695
11713
|
super(table);
|
|
11696
|
-
|
|
11714
|
+
|
|
11697
11715
|
this.groupIDLookups = false; //enable table grouping and set field to group by
|
|
11698
11716
|
this.startOpen = [function(){return false;}]; //starting state of group
|
|
11699
11717
|
this.headerGenerator = [function(){return "";}];
|
|
11700
11718
|
this.groupList = []; //ordered list of groups
|
|
11701
11719
|
this.allowedValues = false;
|
|
11702
11720
|
this.groups = {}; //hold row groups
|
|
11703
|
-
|
|
11704
|
-
|
|
11721
|
+
|
|
11705
11722
|
this.displayHandler = this.getRows.bind(this);
|
|
11706
|
-
|
|
11723
|
+
|
|
11707
11724
|
//register table options
|
|
11708
11725
|
this.registerTableOption("groupBy", false); //enable table grouping and set field to group by
|
|
11709
11726
|
this.registerTableOption("groupStartOpen", true); //starting state of group
|
|
@@ -11716,7 +11733,7 @@ class GroupRows extends Module{
|
|
|
11716
11733
|
this.registerTableOption("groupHeaderDownload", null);
|
|
11717
11734
|
this.registerTableOption("groupToggleElement", "arrow");
|
|
11718
11735
|
this.registerTableOption("groupClosedShowCalcs", false);
|
|
11719
|
-
|
|
11736
|
+
|
|
11720
11737
|
//register table functions
|
|
11721
11738
|
this.registerTableFunction("setGroupBy", this.setGroupBy.bind(this));
|
|
11722
11739
|
this.registerTableFunction("setGroupValues", this.setGroupValues.bind(this));
|
|
@@ -11724,11 +11741,11 @@ class GroupRows extends Module{
|
|
|
11724
11741
|
this.registerTableFunction("setGroupHeader", this.setGroupHeader.bind(this));
|
|
11725
11742
|
this.registerTableFunction("getGroups", this.userGetGroups.bind(this));
|
|
11726
11743
|
this.registerTableFunction("getGroupedData", this.userGetGroupedData.bind(this));
|
|
11727
|
-
|
|
11744
|
+
|
|
11728
11745
|
//register component functions
|
|
11729
11746
|
this.registerComponentFunction("row", "getGroup", this.rowGetGroup.bind(this));
|
|
11730
11747
|
}
|
|
11731
|
-
|
|
11748
|
+
|
|
11732
11749
|
//initialize group configuration
|
|
11733
11750
|
initialize(){
|
|
11734
11751
|
if(this.table.options.groupBy){
|
|
@@ -11736,7 +11753,7 @@ class GroupRows extends Module{
|
|
|
11736
11753
|
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
11737
11754
|
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
11738
11755
|
}
|
|
11739
|
-
|
|
11756
|
+
|
|
11740
11757
|
this.subscribe("table-built", this.configureGroupSetup.bind(this));
|
|
11741
11758
|
|
|
11742
11759
|
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
@@ -11746,73 +11763,73 @@ class GroupRows extends Module{
|
|
|
11746
11763
|
this.subscribe("rows-added", this.rowsUpdated.bind(this));
|
|
11747
11764
|
this.subscribe("row-moving", this.rowMoving.bind(this));
|
|
11748
11765
|
this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
|
|
11749
|
-
|
|
11766
|
+
|
|
11750
11767
|
this.subscribe("rows-sample", this.rowSample.bind(this));
|
|
11751
|
-
|
|
11768
|
+
|
|
11752
11769
|
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
|
|
11753
|
-
|
|
11770
|
+
|
|
11754
11771
|
this.registerDisplayHandler(this.displayHandler, 20);
|
|
11755
|
-
|
|
11772
|
+
|
|
11756
11773
|
this.initialized = true;
|
|
11757
11774
|
}
|
|
11758
11775
|
}
|
|
11759
|
-
|
|
11776
|
+
|
|
11760
11777
|
configureGroupSetup(){
|
|
11761
11778
|
if(this.table.options.groupBy){
|
|
11762
11779
|
var groupBy = this.table.options.groupBy,
|
|
11763
11780
|
startOpen = this.table.options.groupStartOpen,
|
|
11764
11781
|
groupHeader = this.table.options.groupHeader;
|
|
11765
|
-
|
|
11782
|
+
|
|
11766
11783
|
this.allowedValues = this.table.options.groupValues;
|
|
11767
|
-
|
|
11784
|
+
|
|
11768
11785
|
if(Array.isArray(groupBy) && Array.isArray(groupHeader) && groupBy.length > groupHeader.length){
|
|
11769
11786
|
console.warn("Error creating group headers, groupHeader array is shorter than groupBy array");
|
|
11770
11787
|
}
|
|
11771
|
-
|
|
11788
|
+
|
|
11772
11789
|
this.headerGenerator = [function(){return "";}];
|
|
11773
11790
|
this.startOpen = [function(){return false;}]; //starting state of group
|
|
11774
|
-
|
|
11791
|
+
|
|
11775
11792
|
this.langBind("groups|item", (langValue, lang) => {
|
|
11776
11793
|
this.headerGenerator[0] = (value, count, data) => { //header layout function
|
|
11777
11794
|
return (typeof value === "undefined" ? "" : value) + "<span>(" + count + " " + ((count === 1) ? langValue : lang.groups.items) + ")</span>";
|
|
11778
11795
|
};
|
|
11779
11796
|
});
|
|
11780
|
-
|
|
11797
|
+
|
|
11781
11798
|
this.groupIDLookups = [];
|
|
11782
|
-
|
|
11799
|
+
|
|
11783
11800
|
if(Array.isArray(groupBy)){
|
|
11784
11801
|
if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "table" && this.table.options.columnCalcs != "both"){
|
|
11785
11802
|
this.table.modules.columnCalcs.removeCalcs();
|
|
11786
11803
|
}
|
|
11787
11804
|
}else {
|
|
11788
11805
|
if(this.table.modExists("columnCalcs") && this.table.options.columnCalcs != "group"){
|
|
11789
|
-
|
|
11806
|
+
|
|
11790
11807
|
var cols = this.table.columnManager.getRealColumns();
|
|
11791
|
-
|
|
11808
|
+
|
|
11792
11809
|
cols.forEach((col) => {
|
|
11793
11810
|
if(col.definition.topCalc){
|
|
11794
11811
|
this.table.modules.columnCalcs.initializeTopRow();
|
|
11795
11812
|
}
|
|
11796
|
-
|
|
11813
|
+
|
|
11797
11814
|
if(col.definition.bottomCalc){
|
|
11798
11815
|
this.table.modules.columnCalcs.initializeBottomRow();
|
|
11799
11816
|
}
|
|
11800
11817
|
});
|
|
11801
11818
|
}
|
|
11802
11819
|
}
|
|
11803
|
-
|
|
11820
|
+
|
|
11804
11821
|
if(!Array.isArray(groupBy)){
|
|
11805
11822
|
groupBy = [groupBy];
|
|
11806
11823
|
}
|
|
11807
|
-
|
|
11824
|
+
|
|
11808
11825
|
groupBy.forEach((group, i) => {
|
|
11809
11826
|
var lookupFunc, column;
|
|
11810
|
-
|
|
11827
|
+
|
|
11811
11828
|
if(typeof group == "function"){
|
|
11812
11829
|
lookupFunc = group;
|
|
11813
11830
|
}else {
|
|
11814
11831
|
column = this.table.columnManager.getColumnByField(group);
|
|
11815
|
-
|
|
11832
|
+
|
|
11816
11833
|
if(column){
|
|
11817
11834
|
lookupFunc = function(data){
|
|
11818
11835
|
return column.getFieldValue(data);
|
|
@@ -11823,25 +11840,25 @@ class GroupRows extends Module{
|
|
|
11823
11840
|
};
|
|
11824
11841
|
}
|
|
11825
11842
|
}
|
|
11826
|
-
|
|
11843
|
+
|
|
11827
11844
|
this.groupIDLookups.push({
|
|
11828
11845
|
field: typeof group === "function" ? false : group,
|
|
11829
11846
|
func:lookupFunc,
|
|
11830
11847
|
values:this.allowedValues ? this.allowedValues[i] : false,
|
|
11831
11848
|
});
|
|
11832
11849
|
});
|
|
11833
|
-
|
|
11850
|
+
|
|
11834
11851
|
if(startOpen){
|
|
11835
11852
|
if(!Array.isArray(startOpen)){
|
|
11836
11853
|
startOpen = [startOpen];
|
|
11837
11854
|
}
|
|
11838
|
-
|
|
11855
|
+
|
|
11839
11856
|
startOpen.forEach((level) => {
|
|
11840
11857
|
});
|
|
11841
|
-
|
|
11858
|
+
|
|
11842
11859
|
this.startOpen = startOpen;
|
|
11843
11860
|
}
|
|
11844
|
-
|
|
11861
|
+
|
|
11845
11862
|
if(groupHeader){
|
|
11846
11863
|
this.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader];
|
|
11847
11864
|
}
|
|
@@ -11850,218 +11867,215 @@ class GroupRows extends Module{
|
|
|
11850
11867
|
this.groups = {};
|
|
11851
11868
|
}
|
|
11852
11869
|
}
|
|
11853
|
-
|
|
11870
|
+
|
|
11854
11871
|
rowSample(rows, prevValue){
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11872
|
+
if(this.table.options.groupBy){
|
|
11873
|
+
var group = this.getGroups(false)[0];
|
|
11874
|
+
|
|
11875
|
+
prevValue.push(group.getRows(false)[0]);
|
|
11876
|
+
}
|
|
11877
|
+
|
|
11859
11878
|
return prevValue;
|
|
11860
11879
|
}
|
|
11861
|
-
|
|
11880
|
+
|
|
11862
11881
|
virtualRenderFill(){
|
|
11863
11882
|
var el = this.table.rowManager.tableElement;
|
|
11864
11883
|
var rows = this.table.rowManager.getVisibleRows();
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
// }
|
|
11876
|
-
// }
|
|
11884
|
+
|
|
11885
|
+
if(this.table.options.groupBy){
|
|
11886
|
+
rows = rows.filter((row) => {
|
|
11887
|
+
return row.type !== "group";
|
|
11888
|
+
});
|
|
11889
|
+
|
|
11890
|
+
el.style.minWidth = !rows.length ? this.table.columnManager.getWidth() + "px" : "";
|
|
11891
|
+
}else {
|
|
11892
|
+
return rows;
|
|
11893
|
+
}
|
|
11877
11894
|
}
|
|
11878
|
-
|
|
11895
|
+
|
|
11879
11896
|
rowAddingIndex(row, index, top){
|
|
11880
|
-
this.
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
if(
|
|
11886
|
-
if(
|
|
11887
|
-
if(
|
|
11888
|
-
|
|
11889
|
-
|
|
11897
|
+
if(this.table.options.groupBy){
|
|
11898
|
+
this.assignRowToGroup(row);
|
|
11899
|
+
|
|
11900
|
+
var groupRows = row.modules.group.rows;
|
|
11901
|
+
|
|
11902
|
+
if(groupRows.length > 1){
|
|
11903
|
+
if(!index || (index && groupRows.indexOf(index) == -1)){
|
|
11904
|
+
if(top){
|
|
11905
|
+
if(groupRows[0] !== row){
|
|
11906
|
+
index = groupRows[0];
|
|
11907
|
+
this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
|
|
11908
|
+
}
|
|
11909
|
+
}else {
|
|
11910
|
+
if(groupRows[groupRows.length -1] !== row){
|
|
11911
|
+
index = groupRows[groupRows.length -1];
|
|
11912
|
+
this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
|
|
11913
|
+
}
|
|
11890
11914
|
}
|
|
11891
11915
|
}else {
|
|
11892
|
-
|
|
11893
|
-
index = groupRows[groupRows.length -1];
|
|
11894
|
-
this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
|
|
11895
|
-
}
|
|
11916
|
+
this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
|
|
11896
11917
|
}
|
|
11897
|
-
}else {
|
|
11898
|
-
this.table.rowManager.moveRowInArray(row.modules.group.rows, row, index, !top);
|
|
11899
11918
|
}
|
|
11919
|
+
|
|
11920
|
+
return index;
|
|
11900
11921
|
}
|
|
11901
|
-
|
|
11902
|
-
return index;
|
|
11903
11922
|
}
|
|
11904
|
-
|
|
11923
|
+
|
|
11905
11924
|
trackChanges(){
|
|
11906
11925
|
this.dispatch("group-changed");
|
|
11907
11926
|
}
|
|
11908
|
-
|
|
11927
|
+
|
|
11909
11928
|
///////////////////////////////////
|
|
11910
11929
|
///////// Table Functions /////////
|
|
11911
11930
|
///////////////////////////////////
|
|
11912
|
-
|
|
11931
|
+
|
|
11913
11932
|
setGroupBy(groups){
|
|
11914
11933
|
this.table.options.groupBy = groups;
|
|
11915
|
-
|
|
11934
|
+
|
|
11916
11935
|
if(!this.initialized){
|
|
11917
11936
|
this.initialize();
|
|
11918
11937
|
}
|
|
11919
|
-
|
|
11938
|
+
|
|
11920
11939
|
this.configureGroupSetup();
|
|
11921
|
-
|
|
11940
|
+
|
|
11922
11941
|
this.refreshData();
|
|
11923
|
-
|
|
11942
|
+
|
|
11924
11943
|
this.trackChanges();
|
|
11925
11944
|
}
|
|
11926
|
-
|
|
11945
|
+
|
|
11927
11946
|
setGroupValues(groupValues){
|
|
11928
11947
|
this.table.options.groupValues = groupValues;
|
|
11929
11948
|
this.configureGroupSetup();
|
|
11930
11949
|
this.refreshData();
|
|
11931
|
-
|
|
11950
|
+
|
|
11932
11951
|
this.trackChanges();
|
|
11933
11952
|
}
|
|
11934
|
-
|
|
11953
|
+
|
|
11935
11954
|
setGroupStartOpen(values){
|
|
11936
11955
|
this.table.options.groupStartOpen = values;
|
|
11937
11956
|
this.configureGroupSetup();
|
|
11938
|
-
|
|
11957
|
+
|
|
11939
11958
|
if(this.table.options.groupBy){
|
|
11940
11959
|
this.refreshData();
|
|
11941
|
-
|
|
11960
|
+
|
|
11942
11961
|
this.trackChanges();
|
|
11943
11962
|
}else {
|
|
11944
11963
|
console.warn("Grouping Update - cant refresh view, no groups have been set");
|
|
11945
11964
|
}
|
|
11946
11965
|
}
|
|
11947
|
-
|
|
11966
|
+
|
|
11948
11967
|
setGroupHeader(values){
|
|
11949
11968
|
this.table.options.groupHeader = values;
|
|
11950
11969
|
this.configureGroupSetup();
|
|
11951
|
-
|
|
11970
|
+
|
|
11952
11971
|
if(this.table.options.groupBy){
|
|
11953
11972
|
this.refreshData();
|
|
11954
|
-
|
|
11973
|
+
|
|
11955
11974
|
this.trackChanges();
|
|
11956
11975
|
}else {
|
|
11957
11976
|
console.warn("Grouping Update - cant refresh view, no groups have been set");
|
|
11958
11977
|
}
|
|
11959
11978
|
}
|
|
11960
|
-
|
|
11979
|
+
|
|
11961
11980
|
userGetGroups(values){
|
|
11962
11981
|
return this.getGroups(true);
|
|
11963
11982
|
}
|
|
11964
|
-
|
|
11983
|
+
|
|
11965
11984
|
// get grouped table data in the same format as getData()
|
|
11966
11985
|
userGetGroupedData(){
|
|
11967
|
-
return this.table.options.groupBy ?
|
|
11968
|
-
this.getGroupedData() : this.getData();
|
|
11986
|
+
return this.table.options.groupBy ? this.getGroupedData() : this.getData();
|
|
11969
11987
|
}
|
|
11970
|
-
|
|
11971
|
-
|
|
11988
|
+
|
|
11989
|
+
|
|
11972
11990
|
///////////////////////////////////////
|
|
11973
11991
|
///////// Component Functions /////////
|
|
11974
11992
|
///////////////////////////////////////
|
|
11975
|
-
|
|
11993
|
+
|
|
11976
11994
|
rowGetGroup(row){
|
|
11977
11995
|
return row.modules.group ? row.modules.group.getComponent() : false;
|
|
11978
11996
|
}
|
|
11979
|
-
|
|
11997
|
+
|
|
11980
11998
|
///////////////////////////////////
|
|
11981
11999
|
///////// Internal Logic //////////
|
|
11982
12000
|
///////////////////////////////////
|
|
11983
|
-
|
|
12001
|
+
|
|
11984
12002
|
rowMoving(from, to, after){
|
|
11985
|
-
if(
|
|
11986
|
-
to
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
|
|
11995
|
-
|
|
11996
|
-
fromGroup
|
|
12003
|
+
if(this.table.options.groupBy){
|
|
12004
|
+
if(!after && to instanceof Group){
|
|
12005
|
+
to = this.table.rowManager.prevDisplayRow(from) || to;
|
|
12006
|
+
}
|
|
12007
|
+
|
|
12008
|
+
var toGroup = to instanceof Group ? to : to.modules.group;
|
|
12009
|
+
var fromGroup = from instanceof Group ? from : from.modules.group;
|
|
12010
|
+
|
|
12011
|
+
if(toGroup === fromGroup){
|
|
12012
|
+
this.table.rowManager.moveRowInArray(toGroup.rows, from, to, after);
|
|
12013
|
+
}else {
|
|
12014
|
+
if(fromGroup){
|
|
12015
|
+
fromGroup.removeRow(from);
|
|
12016
|
+
}
|
|
12017
|
+
|
|
12018
|
+
toGroup.insertRow(from, to, after);
|
|
11997
12019
|
}
|
|
11998
|
-
|
|
11999
|
-
toGroup.insertRow(from, to, after);
|
|
12000
12020
|
}
|
|
12001
12021
|
}
|
|
12002
|
-
|
|
12003
|
-
|
|
12022
|
+
|
|
12023
|
+
|
|
12004
12024
|
rowDeleting(row){
|
|
12005
12025
|
//remove from group
|
|
12006
|
-
if(row.modules.group){
|
|
12026
|
+
if(this.table.options.groupBy && row.modules.group){
|
|
12007
12027
|
row.modules.group.removeRow(row);
|
|
12008
12028
|
}
|
|
12009
12029
|
}
|
|
12010
|
-
|
|
12011
|
-
|
|
12030
|
+
|
|
12012
12031
|
rowsUpdated(row){
|
|
12013
|
-
this.
|
|
12032
|
+
if(this.table.options.groupBy){
|
|
12033
|
+
this.updateGroupRows(true);
|
|
12034
|
+
}
|
|
12014
12035
|
}
|
|
12015
|
-
|
|
12036
|
+
|
|
12016
12037
|
cellUpdated(cell){
|
|
12017
|
-
this.
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
setDisplayIndex(index){
|
|
12022
|
-
this.displayIndex = index;
|
|
12023
|
-
}
|
|
12024
|
-
|
|
12025
|
-
getDisplayIndex(){
|
|
12026
|
-
return this.displayIndex;
|
|
12038
|
+
if(this.table.options.groupBy){
|
|
12039
|
+
this.reassignRowToGroup(cell.row);
|
|
12040
|
+
}
|
|
12027
12041
|
}
|
|
12028
|
-
|
|
12042
|
+
|
|
12029
12043
|
//return appropriate rows with group headers
|
|
12030
12044
|
getRows(rows){
|
|
12031
12045
|
if(this.table.options.groupBy && this.groupIDLookups.length){
|
|
12032
|
-
|
|
12046
|
+
|
|
12033
12047
|
this.dispatchExternal("dataGrouping");
|
|
12034
|
-
|
|
12048
|
+
|
|
12035
12049
|
this.generateGroups(rows);
|
|
12036
|
-
|
|
12050
|
+
|
|
12037
12051
|
if(this.subscribedExternal("dataGrouped")){
|
|
12038
12052
|
this.dispatchExternal("dataGrouped", this.getGroups(true));
|
|
12039
12053
|
}
|
|
12040
|
-
|
|
12054
|
+
|
|
12041
12055
|
return this.updateGroupRows();
|
|
12042
|
-
|
|
12056
|
+
|
|
12043
12057
|
}else {
|
|
12044
12058
|
return rows.slice(0);
|
|
12045
12059
|
}
|
|
12046
12060
|
}
|
|
12047
|
-
|
|
12061
|
+
|
|
12048
12062
|
getGroups(component){
|
|
12049
12063
|
var groupComponents = [];
|
|
12050
|
-
|
|
12064
|
+
|
|
12051
12065
|
this.groupList.forEach(function(group){
|
|
12052
12066
|
groupComponents.push(component ? group.getComponent() : group);
|
|
12053
12067
|
});
|
|
12054
|
-
|
|
12068
|
+
|
|
12055
12069
|
return groupComponents;
|
|
12056
12070
|
}
|
|
12057
|
-
|
|
12071
|
+
|
|
12058
12072
|
getChildGroups(group){
|
|
12059
12073
|
var groupComponents = [];
|
|
12060
|
-
|
|
12074
|
+
|
|
12061
12075
|
if(!group){
|
|
12062
12076
|
group = this;
|
|
12063
12077
|
}
|
|
12064
|
-
|
|
12078
|
+
|
|
12065
12079
|
group.groupList.forEach((child) => {
|
|
12066
12080
|
if(child.groupList.length){
|
|
12067
12081
|
groupComponents = groupComponents.concat(this.getChildGroups(child));
|
|
@@ -12069,91 +12083,93 @@ class GroupRows extends Module{
|
|
|
12069
12083
|
groupComponents.push(child);
|
|
12070
12084
|
}
|
|
12071
12085
|
});
|
|
12072
|
-
|
|
12086
|
+
|
|
12073
12087
|
return groupComponents;
|
|
12074
12088
|
}
|
|
12075
|
-
|
|
12089
|
+
|
|
12076
12090
|
wipe(){
|
|
12077
|
-
this.
|
|
12078
|
-
|
|
12079
|
-
|
|
12091
|
+
if(this.table.options.groupBy){
|
|
12092
|
+
this.groupList.forEach(function(group){
|
|
12093
|
+
group.wipe();
|
|
12094
|
+
});
|
|
12095
|
+
}
|
|
12080
12096
|
}
|
|
12081
|
-
|
|
12097
|
+
|
|
12082
12098
|
pullGroupListData(groupList) {
|
|
12083
12099
|
var groupListData = [];
|
|
12084
|
-
|
|
12100
|
+
|
|
12085
12101
|
groupList.forEach((group) => {
|
|
12086
12102
|
var groupHeader = {};
|
|
12087
12103
|
groupHeader.level = 0;
|
|
12088
12104
|
groupHeader.rowCount = 0;
|
|
12089
12105
|
groupHeader.headerContent = "";
|
|
12090
12106
|
var childData = [];
|
|
12091
|
-
|
|
12107
|
+
|
|
12092
12108
|
if (group.hasSubGroups) {
|
|
12093
12109
|
childData = this.pullGroupListData(group.groupList);
|
|
12094
|
-
|
|
12110
|
+
|
|
12095
12111
|
groupHeader.level = group.level;
|
|
12096
12112
|
groupHeader.rowCount = childData.length - group.groupList.length; // data length minus number of sub-headers
|
|
12097
12113
|
groupHeader.headerContent = group.generator(group.key, groupHeader.rowCount, group.rows, group);
|
|
12098
|
-
|
|
12114
|
+
|
|
12099
12115
|
groupListData.push(groupHeader);
|
|
12100
12116
|
groupListData = groupListData.concat(childData);
|
|
12101
12117
|
}
|
|
12102
|
-
|
|
12118
|
+
|
|
12103
12119
|
else {
|
|
12104
12120
|
groupHeader.level = group.level;
|
|
12105
12121
|
groupHeader.headerContent = group.generator(group.key, group.rows.length, group.rows, group);
|
|
12106
12122
|
groupHeader.rowCount = group.getRows().length;
|
|
12107
|
-
|
|
12123
|
+
|
|
12108
12124
|
groupListData.push(groupHeader);
|
|
12109
|
-
|
|
12125
|
+
|
|
12110
12126
|
group.getRows().forEach((row) => {
|
|
12111
12127
|
groupListData.push(row.getData("data"));
|
|
12112
12128
|
});
|
|
12113
12129
|
}
|
|
12114
12130
|
});
|
|
12115
|
-
|
|
12131
|
+
|
|
12116
12132
|
return groupListData;
|
|
12117
12133
|
}
|
|
12118
|
-
|
|
12134
|
+
|
|
12119
12135
|
getGroupedData(){
|
|
12120
|
-
|
|
12136
|
+
|
|
12121
12137
|
return this.pullGroupListData(this.groupList);
|
|
12122
12138
|
}
|
|
12123
|
-
|
|
12139
|
+
|
|
12124
12140
|
getRowGroup(row){
|
|
12125
12141
|
var match = false;
|
|
12126
|
-
|
|
12142
|
+
|
|
12127
12143
|
if(this.options("dataTree")){
|
|
12128
12144
|
row = this.table.modules.dataTree.getTreeParentRoot(row);
|
|
12129
12145
|
}
|
|
12130
|
-
|
|
12146
|
+
|
|
12131
12147
|
this.groupList.forEach((group) => {
|
|
12132
12148
|
var result = group.getRowGroup(row);
|
|
12133
|
-
|
|
12149
|
+
|
|
12134
12150
|
if(result){
|
|
12135
12151
|
match = result;
|
|
12136
12152
|
}
|
|
12137
12153
|
});
|
|
12138
|
-
|
|
12154
|
+
|
|
12139
12155
|
return match;
|
|
12140
12156
|
}
|
|
12141
|
-
|
|
12157
|
+
|
|
12142
12158
|
countGroups(){
|
|
12143
12159
|
return this.groupList.length;
|
|
12144
12160
|
}
|
|
12145
|
-
|
|
12161
|
+
|
|
12146
12162
|
generateGroups(rows){
|
|
12147
12163
|
var oldGroups = this.groups;
|
|
12148
|
-
|
|
12164
|
+
|
|
12149
12165
|
this.groups = {};
|
|
12150
12166
|
this.groupList = [];
|
|
12151
|
-
|
|
12167
|
+
|
|
12152
12168
|
if(this.allowedValues && this.allowedValues[0]){
|
|
12153
12169
|
this.allowedValues[0].forEach((value) => {
|
|
12154
12170
|
this.createGroup(value, 0, oldGroups);
|
|
12155
12171
|
});
|
|
12156
|
-
|
|
12172
|
+
|
|
12157
12173
|
rows.forEach((row) => {
|
|
12158
12174
|
this.assignRowToExistingGroup(row, oldGroups);
|
|
12159
12175
|
});
|
|
@@ -12163,53 +12179,53 @@ class GroupRows extends Module{
|
|
|
12163
12179
|
});
|
|
12164
12180
|
}
|
|
12165
12181
|
}
|
|
12166
|
-
|
|
12182
|
+
|
|
12167
12183
|
createGroup(groupID, level, oldGroups){
|
|
12168
12184
|
var groupKey = level + "_" + groupID,
|
|
12169
12185
|
group;
|
|
12170
|
-
|
|
12186
|
+
|
|
12171
12187
|
oldGroups = oldGroups || [];
|
|
12172
|
-
|
|
12188
|
+
|
|
12173
12189
|
group = new Group(this, false, level, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupKey]);
|
|
12174
|
-
|
|
12190
|
+
|
|
12175
12191
|
this.groups[groupKey] = group;
|
|
12176
12192
|
this.groupList.push(group);
|
|
12177
12193
|
}
|
|
12178
|
-
|
|
12194
|
+
|
|
12179
12195
|
assignRowToExistingGroup(row, oldGroups){
|
|
12180
12196
|
var groupID = this.groupIDLookups[0].func(row.getData()),
|
|
12181
12197
|
groupKey = "0_" + groupID;
|
|
12182
|
-
|
|
12198
|
+
|
|
12183
12199
|
if(this.groups[groupKey]){
|
|
12184
12200
|
this.groups[groupKey].addRow(row);
|
|
12185
12201
|
}
|
|
12186
12202
|
}
|
|
12187
|
-
|
|
12203
|
+
|
|
12188
12204
|
assignRowToGroup(row, oldGroups){
|
|
12189
12205
|
var groupID = this.groupIDLookups[0].func(row.getData()),
|
|
12190
12206
|
newGroupNeeded = !this.groups["0_" + groupID];
|
|
12191
|
-
|
|
12207
|
+
|
|
12192
12208
|
if(newGroupNeeded){
|
|
12193
12209
|
this.createGroup(groupID, 0, oldGroups);
|
|
12194
12210
|
}
|
|
12195
|
-
|
|
12211
|
+
|
|
12196
12212
|
this.groups["0_" + groupID].addRow(row);
|
|
12197
|
-
|
|
12213
|
+
|
|
12198
12214
|
return !newGroupNeeded;
|
|
12199
12215
|
}
|
|
12200
|
-
|
|
12216
|
+
|
|
12201
12217
|
reassignRowToGroup(row){
|
|
12202
12218
|
if(row.type === "row"){
|
|
12203
12219
|
var oldRowGroup = row.modules.group,
|
|
12204
12220
|
oldGroupPath = oldRowGroup.getPath(),
|
|
12205
12221
|
newGroupPath = this.getExpectedPath(row),
|
|
12206
12222
|
samePath;
|
|
12207
|
-
|
|
12223
|
+
|
|
12208
12224
|
// figure out if new group path is the same as old group path
|
|
12209
12225
|
samePath = (oldGroupPath.length == newGroupPath.length) && oldGroupPath.every((element, index) => {
|
|
12210
12226
|
return element === newGroupPath[index];
|
|
12211
12227
|
});
|
|
12212
|
-
|
|
12228
|
+
|
|
12213
12229
|
// refresh if they new path and old path aren't the same (aka the row's groupings have changed)
|
|
12214
12230
|
if(!samePath) {
|
|
12215
12231
|
oldRowGroup.removeRow(row);
|
|
@@ -12218,79 +12234,81 @@ class GroupRows extends Module{
|
|
|
12218
12234
|
}
|
|
12219
12235
|
}
|
|
12220
12236
|
}
|
|
12221
|
-
|
|
12237
|
+
|
|
12222
12238
|
getExpectedPath(row) {
|
|
12223
12239
|
var groupPath = [], rowData = row.getData();
|
|
12224
|
-
|
|
12240
|
+
|
|
12225
12241
|
this.groupIDLookups.forEach((groupId) => {
|
|
12226
12242
|
groupPath.push(groupId.func(rowData));
|
|
12227
12243
|
});
|
|
12228
|
-
|
|
12244
|
+
|
|
12229
12245
|
return groupPath;
|
|
12230
12246
|
}
|
|
12231
|
-
|
|
12247
|
+
|
|
12232
12248
|
updateGroupRows(force){
|
|
12233
12249
|
var output = [];
|
|
12234
|
-
|
|
12250
|
+
|
|
12235
12251
|
this.groupList.forEach((group) => {
|
|
12236
12252
|
output = output.concat(group.getHeadersAndRows());
|
|
12237
12253
|
});
|
|
12238
|
-
|
|
12254
|
+
|
|
12239
12255
|
if(force){
|
|
12240
12256
|
this.refreshData(true, this.displayHandler);
|
|
12241
12257
|
}
|
|
12242
|
-
|
|
12258
|
+
|
|
12243
12259
|
return output;
|
|
12244
12260
|
}
|
|
12245
|
-
|
|
12261
|
+
|
|
12246
12262
|
scrollHeaders(left){
|
|
12247
|
-
if(this.table.options.
|
|
12248
|
-
|
|
12263
|
+
if(this.table.options.groupBy){
|
|
12264
|
+
if(this.table.options.renderHorizontal === "virtual"){
|
|
12265
|
+
left -= this.table.columnManager.renderer.vDomPadLeft;
|
|
12266
|
+
}
|
|
12267
|
+
|
|
12268
|
+
left = left + "px";
|
|
12269
|
+
|
|
12270
|
+
this.groupList.forEach((group) => {
|
|
12271
|
+
group.scrollHeader(left);
|
|
12272
|
+
});
|
|
12249
12273
|
}
|
|
12250
|
-
|
|
12251
|
-
left = left + "px";
|
|
12252
|
-
|
|
12253
|
-
this.groupList.forEach((group) => {
|
|
12254
|
-
group.scrollHeader(left);
|
|
12255
|
-
});
|
|
12256
12274
|
}
|
|
12257
|
-
|
|
12275
|
+
|
|
12258
12276
|
removeGroup(group){
|
|
12259
12277
|
var groupKey = group.level + "_" + group.key,
|
|
12260
12278
|
index;
|
|
12261
|
-
|
|
12279
|
+
|
|
12262
12280
|
if(this.groups[groupKey]){
|
|
12263
12281
|
delete this.groups[groupKey];
|
|
12264
|
-
|
|
12282
|
+
|
|
12265
12283
|
index = this.groupList.indexOf(group);
|
|
12266
|
-
|
|
12284
|
+
|
|
12267
12285
|
if(index > -1){
|
|
12268
12286
|
this.groupList.splice(index, 1);
|
|
12269
12287
|
}
|
|
12270
12288
|
}
|
|
12271
12289
|
}
|
|
12272
|
-
|
|
12290
|
+
|
|
12273
12291
|
checkBasicModeGroupHeaderWidth(){
|
|
12274
12292
|
var element = this.table.rowManager.tableElement,
|
|
12275
12293
|
onlyGroupHeaders = true;
|
|
12276
|
-
|
|
12294
|
+
|
|
12277
12295
|
this.table.rowManager.getDisplayRows().forEach((row, index) =>{
|
|
12278
12296
|
this.table.rowManager.styleRow(row, index);
|
|
12279
12297
|
element.appendChild(row.getElement());
|
|
12280
12298
|
row.initialize(true);
|
|
12281
|
-
|
|
12299
|
+
|
|
12282
12300
|
if(row.type !== "group"){
|
|
12283
12301
|
onlyGroupHeaders = false;
|
|
12284
12302
|
}
|
|
12285
12303
|
});
|
|
12286
|
-
|
|
12304
|
+
|
|
12287
12305
|
if(onlyGroupHeaders){
|
|
12288
12306
|
element.style.minWidth = this.table.columnManager.getWidth() + "px";
|
|
12289
12307
|
}else {
|
|
12290
12308
|
element.style.minWidth = "";
|
|
12291
12309
|
}
|
|
12292
12310
|
}
|
|
12293
|
-
|
|
12311
|
+
|
|
12294
12312
|
}
|
|
12295
12313
|
|
|
12296
12314
|
GroupRows.moduleName = "groupRows";
|
|
@@ -13085,7 +13103,7 @@ class Interaction extends Module{
|
|
|
13085
13103
|
var range;
|
|
13086
13104
|
|
|
13087
13105
|
if(this.table.modExists("edit")){
|
|
13088
|
-
if (this.table.modules.edit.currentCell ===
|
|
13106
|
+
if (this.table.modules.edit.currentCell === cell){
|
|
13089
13107
|
return; //prevent instant selection of editor content
|
|
13090
13108
|
}
|
|
13091
13109
|
}
|
|
@@ -15028,8 +15046,6 @@ class Page extends Module{
|
|
|
15028
15046
|
|
|
15029
15047
|
this.remoteRowCountEstimate = null;
|
|
15030
15048
|
|
|
15031
|
-
this.displayIndex = 0; //index in display pipeline
|
|
15032
|
-
|
|
15033
15049
|
this.initialLoad = true;
|
|
15034
15050
|
this.dataChanging = false; //flag to check if data is being changed by this module
|
|
15035
15051
|
|
|
@@ -15475,14 +15491,6 @@ class Page extends Module{
|
|
|
15475
15491
|
this.dispatch("page-changed");
|
|
15476
15492
|
}
|
|
15477
15493
|
|
|
15478
|
-
setDisplayIndex(index){
|
|
15479
|
-
this.displayIndex = index;
|
|
15480
|
-
}
|
|
15481
|
-
|
|
15482
|
-
getDisplayIndex(){
|
|
15483
|
-
return this.displayIndex;
|
|
15484
|
-
}
|
|
15485
|
-
|
|
15486
15494
|
//calculate maximum page from number of rows
|
|
15487
15495
|
setMaxRows(rowCount){
|
|
15488
15496
|
if(!rowCount){
|
|
@@ -15549,9 +15557,9 @@ class Page extends Module{
|
|
|
15549
15557
|
}
|
|
15550
15558
|
|
|
15551
15559
|
setPageToRow(row){
|
|
15552
|
-
var rows = this.
|
|
15560
|
+
var rows = this.displayRows(-1);
|
|
15553
15561
|
var index = rows.indexOf(row);
|
|
15554
|
-
|
|
15562
|
+
|
|
15555
15563
|
if(index > -1){
|
|
15556
15564
|
var page = this.size === true ? 1 : Math.ceil((index + 1) / this.size);
|
|
15557
15565
|
|
|
@@ -16144,9 +16152,10 @@ class Persistence extends Module{
|
|
|
16144
16152
|
keys.forEach((key)=>{
|
|
16145
16153
|
var props = Object.getOwnPropertyDescriptor(def, key);
|
|
16146
16154
|
var value = def[key];
|
|
16155
|
+
|
|
16147
16156
|
if(props){
|
|
16148
16157
|
Object.defineProperty(def, key, {
|
|
16149
|
-
set:
|
|
16158
|
+
set: (newValue) => {
|
|
16150
16159
|
value = newValue;
|
|
16151
16160
|
|
|
16152
16161
|
if(!this.defWatcherBlock){
|
|
@@ -16157,7 +16166,7 @@ class Persistence extends Module{
|
|
|
16157
16166
|
props.set(newValue);
|
|
16158
16167
|
}
|
|
16159
16168
|
},
|
|
16160
|
-
get:
|
|
16169
|
+
get:() => {
|
|
16161
16170
|
if(props.get){
|
|
16162
16171
|
props.get();
|
|
16163
16172
|
}
|
|
@@ -18214,18 +18223,22 @@ class SelectRow extends Module{
|
|
|
18214
18223
|
break;
|
|
18215
18224
|
|
|
18216
18225
|
case "string":
|
|
18217
|
-
|
|
18218
18226
|
rowMatch = this.table.rowManager.findRow(rows);
|
|
18219
18227
|
|
|
18220
18228
|
if(rowMatch){
|
|
18221
18229
|
this._selectRow(rowMatch, true, true);
|
|
18230
|
+
this._rowSelectionChanged();
|
|
18222
18231
|
}else {
|
|
18223
|
-
this.table.rowManager.getRows(rows)
|
|
18232
|
+
rowMatch = this.table.rowManager.getRows(rows);
|
|
18233
|
+
|
|
18234
|
+
rowMatch.forEach((row) => {
|
|
18224
18235
|
this._selectRow(row, true, true);
|
|
18225
18236
|
});
|
|
18237
|
+
|
|
18238
|
+
if(rowMatch.length){
|
|
18239
|
+
this._rowSelectionChanged();
|
|
18240
|
+
}
|
|
18226
18241
|
}
|
|
18227
|
-
|
|
18228
|
-
this._rowSelectionChanged();
|
|
18229
18242
|
break;
|
|
18230
18243
|
|
|
18231
18244
|
default:
|
|
@@ -18862,7 +18875,6 @@ class Sort extends Module{
|
|
|
18862
18875
|
}
|
|
18863
18876
|
}
|
|
18864
18877
|
|
|
18865
|
-
|
|
18866
18878
|
if (this.table.options.columnHeaderSortMulti && (e.shiftKey || e.ctrlKey)) {
|
|
18867
18879
|
sorters = this.getSort();
|
|
18868
18880
|
|
|
@@ -18873,11 +18885,9 @@ class Sort extends Module{
|
|
|
18873
18885
|
if(match > -1){
|
|
18874
18886
|
sorters[match].dir = dir;
|
|
18875
18887
|
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
sorters.push(match);
|
|
18880
|
-
}
|
|
18888
|
+
match = sorters.splice(match, 1)[0];
|
|
18889
|
+
if(dir != "none"){
|
|
18890
|
+
sorters.push(match);
|
|
18881
18891
|
}
|
|
18882
18892
|
}else {
|
|
18883
18893
|
if(dir != "none"){
|
|
@@ -19092,7 +19102,7 @@ class Sort extends Module{
|
|
|
19092
19102
|
var sortEl = column.modules.sort.element,
|
|
19093
19103
|
arrowEl;
|
|
19094
19104
|
|
|
19095
|
-
if(typeof this.table.options.headerSortElement === "function"){
|
|
19105
|
+
if(column.definition.headerSort && typeof this.table.options.headerSortElement === "function"){
|
|
19096
19106
|
while(sortEl.firstChild) sortEl.removeChild(sortEl.firstChild);
|
|
19097
19107
|
|
|
19098
19108
|
arrowEl = this.table.options.headerSortElement.call(this.table, column.getComponent(), dir);
|
|
@@ -20917,6 +20927,8 @@ class ColumnManager extends CoreFeature {
|
|
|
20917
20927
|
var minHeight = 0;
|
|
20918
20928
|
|
|
20919
20929
|
if(!this.redrawBlock){
|
|
20930
|
+
|
|
20931
|
+
this.headersElement.style.height="";
|
|
20920
20932
|
|
|
20921
20933
|
this.columns.forEach((column) => {
|
|
20922
20934
|
column.clearVerticalAlign();
|
|
@@ -20929,7 +20941,9 @@ class ColumnManager extends CoreFeature {
|
|
|
20929
20941
|
minHeight = height;
|
|
20930
20942
|
}
|
|
20931
20943
|
});
|
|
20932
|
-
|
|
20944
|
+
|
|
20945
|
+
this.headersElement.style.height = minHeight + "px";
|
|
20946
|
+
|
|
20933
20947
|
this.columns.forEach((column) => {
|
|
20934
20948
|
column.verticalAlign(this.table.options.columnHeaderVertAlign, minHeight);
|
|
20935
20949
|
});
|
|
@@ -21075,14 +21089,14 @@ class ColumnManager extends CoreFeature {
|
|
|
21075
21089
|
}
|
|
21076
21090
|
|
|
21077
21091
|
moveColumn(from, to, after){
|
|
21078
|
-
this.moveColumnActual(from, to, after);
|
|
21079
|
-
|
|
21080
21092
|
to.element.parentNode.insertBefore(from.element, to.element);
|
|
21081
21093
|
|
|
21082
21094
|
if(after){
|
|
21083
21095
|
to.element.parentNode.insertBefore(to.element, from.element);
|
|
21084
21096
|
}
|
|
21085
21097
|
|
|
21098
|
+
this.moveColumnActual(from, to, after);
|
|
21099
|
+
|
|
21086
21100
|
this.verticalAlignHeaders();
|
|
21087
21101
|
|
|
21088
21102
|
this.table.rowManager.reinitialize();
|
|
@@ -22597,81 +22611,82 @@ class RowManager extends CoreFeature{
|
|
|
22597
22611
|
index = 0,
|
|
22598
22612
|
cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
|
|
22599
22613
|
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
return item.handler === handler;
|
|
22604
|
-
});
|
|
22605
|
-
|
|
22606
|
-
if(index > -1){
|
|
22607
|
-
stage = "dataPipeline";
|
|
22608
|
-
|
|
22609
|
-
if(skipStage){
|
|
22610
|
-
if(index == this.dataPipeline.length - 1){
|
|
22611
|
-
stage = "display";
|
|
22612
|
-
}else {
|
|
22613
|
-
index++;
|
|
22614
|
-
}
|
|
22615
|
-
}
|
|
22616
|
-
}else {
|
|
22617
|
-
index = this.displayPipeline.findIndex((item) => {
|
|
22614
|
+
if(!this.table.destroyed){
|
|
22615
|
+
if(typeof handler === "function"){
|
|
22616
|
+
index = this.dataPipeline.findIndex((item) => {
|
|
22618
22617
|
return item.handler === handler;
|
|
22619
22618
|
});
|
|
22620
22619
|
|
|
22621
22620
|
if(index > -1){
|
|
22622
|
-
stage = "
|
|
22621
|
+
stage = "dataPipeline";
|
|
22623
22622
|
|
|
22624
22623
|
if(skipStage){
|
|
22625
|
-
if(index == this.
|
|
22626
|
-
stage = "
|
|
22624
|
+
if(index == this.dataPipeline.length - 1){
|
|
22625
|
+
stage = "display";
|
|
22627
22626
|
}else {
|
|
22628
22627
|
index++;
|
|
22629
22628
|
}
|
|
22630
22629
|
}
|
|
22631
22630
|
}else {
|
|
22632
|
-
|
|
22633
|
-
|
|
22631
|
+
index = this.displayPipeline.findIndex((item) => {
|
|
22632
|
+
return item.handler === handler;
|
|
22633
|
+
});
|
|
22634
|
+
|
|
22635
|
+
if(index > -1){
|
|
22636
|
+
stage = "displayPipeline";
|
|
22637
|
+
|
|
22638
|
+
if(skipStage){
|
|
22639
|
+
if(index == this.displayPipeline.length - 1){
|
|
22640
|
+
stage = "end";
|
|
22641
|
+
}else {
|
|
22642
|
+
index++;
|
|
22643
|
+
}
|
|
22644
|
+
}
|
|
22645
|
+
}else {
|
|
22646
|
+
console.error("Unable to refresh data, invalid handler provided", handler);
|
|
22647
|
+
return;
|
|
22648
|
+
}
|
|
22634
22649
|
}
|
|
22635
|
-
}
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
index = 0;
|
|
22639
|
-
}
|
|
22640
|
-
|
|
22641
|
-
if(this.redrawBlock){
|
|
22642
|
-
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
22643
|
-
this.redrawBlockRestoreConfig = {
|
|
22644
|
-
handler: handler,
|
|
22645
|
-
skipStage: skipStage,
|
|
22646
|
-
renderInPosition: renderInPosition,
|
|
22647
|
-
stage:stage,
|
|
22648
|
-
index:index,
|
|
22649
|
-
};
|
|
22650
|
+
}else {
|
|
22651
|
+
stage = handler || "all";
|
|
22652
|
+
index = 0;
|
|
22650
22653
|
}
|
|
22651
22654
|
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
|
|
22655
|
+
if(this.redrawBlock){
|
|
22656
|
+
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
22657
|
+
this.redrawBlockRestoreConfig = {
|
|
22658
|
+
handler: handler,
|
|
22659
|
+
skipStage: skipStage,
|
|
22660
|
+
renderInPosition: renderInPosition,
|
|
22661
|
+
stage:stage,
|
|
22662
|
+
index:index,
|
|
22663
|
+
};
|
|
22664
|
+
}
|
|
22665
|
+
|
|
22666
|
+
return;
|
|
22667
|
+
}else {
|
|
22668
|
+
if(Helpers.elVisible(this.element)){
|
|
22669
|
+
if(renderInPosition){
|
|
22670
|
+
this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
|
|
22671
|
+
}else {
|
|
22672
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
22673
|
+
|
|
22674
|
+
if(!handler){
|
|
22675
|
+
this.table.columnManager.renderer.renderColumns();
|
|
22676
|
+
}
|
|
22677
|
+
|
|
22678
|
+
this.renderTable();
|
|
22679
|
+
|
|
22680
|
+
if(table.options.layoutColumnsOnNewData){
|
|
22681
|
+
this.table.columnManager.redraw(true);
|
|
22682
|
+
}
|
|
22683
|
+
}
|
|
22657
22684
|
}else {
|
|
22658
22685
|
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
22659
|
-
|
|
22660
|
-
if(!handler){
|
|
22661
|
-
this.table.columnManager.renderer.renderColumns();
|
|
22662
|
-
}
|
|
22663
|
-
|
|
22664
|
-
this.renderTable();
|
|
22665
|
-
|
|
22666
|
-
if(table.options.layoutColumnsOnNewData){
|
|
22667
|
-
this.table.columnManager.redraw(true);
|
|
22668
|
-
}
|
|
22669
22686
|
}
|
|
22670
|
-
|
|
22671
|
-
this.
|
|
22687
|
+
|
|
22688
|
+
this.dispatch("data-refreshed");
|
|
22672
22689
|
}
|
|
22673
|
-
|
|
22674
|
-
this.dispatch("data-refreshed");
|
|
22675
22690
|
}
|
|
22676
22691
|
}
|
|
22677
22692
|
|
|
@@ -22704,7 +22719,7 @@ class RowManager extends CoreFeature{
|
|
|
22704
22719
|
case "displayPipeline":
|
|
22705
22720
|
for(let i = index; i < this.displayPipeline.length; i++){
|
|
22706
22721
|
let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
22707
|
-
|
|
22722
|
+
|
|
22708
22723
|
this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
|
|
22709
22724
|
}
|
|
22710
22725
|
|
|
@@ -22741,28 +22756,13 @@ class RowManager extends CoreFeature{
|
|
|
22741
22756
|
this.displayRowsCount = this.displayRows[0].length;
|
|
22742
22757
|
}
|
|
22743
22758
|
|
|
22744
|
-
getNextDisplayIndex(){
|
|
22745
|
-
return this.displayRows.length;
|
|
22746
|
-
}
|
|
22747
|
-
|
|
22748
22759
|
//set display row pipeline data
|
|
22749
22760
|
setDisplayRows(displayRows, index){
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
if(index && typeof this.displayRows[index] != "undefined"){
|
|
22754
|
-
this.displayRows[index] = displayRows;
|
|
22755
|
-
output = true;
|
|
22756
|
-
}else {
|
|
22757
|
-
this.displayRows.push(displayRows);
|
|
22758
|
-
output = index = this.displayRows.length -1;
|
|
22759
|
-
}
|
|
22760
|
-
|
|
22761
|
+
this.displayRows[index] = displayRows;
|
|
22762
|
+
|
|
22761
22763
|
if(index == this.displayRows.length -1){
|
|
22762
22764
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
22763
22765
|
}
|
|
22764
|
-
|
|
22765
|
-
return output;
|
|
22766
22766
|
}
|
|
22767
22767
|
|
|
22768
22768
|
getDisplayRows(index){
|
|
@@ -22793,23 +22793,24 @@ class RowManager extends CoreFeature{
|
|
|
22793
22793
|
|
|
22794
22794
|
//return only actual rows (not group headers etc)
|
|
22795
22795
|
getRows(type){
|
|
22796
|
-
var rows;
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
|
|
22800
|
-
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
break;
|
|
22806
|
-
|
|
22807
|
-
case "visible":
|
|
22808
|
-
rows = this.getVisibleRows(false, true);
|
|
22809
|
-
break;
|
|
22796
|
+
var rows = [];
|
|
22797
|
+
|
|
22798
|
+
if(!type || type === true){
|
|
22799
|
+
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
22800
|
+
}else {
|
|
22801
|
+
switch(type){
|
|
22802
|
+
case "active":
|
|
22803
|
+
rows = this.activeRows;
|
|
22804
|
+
break;
|
|
22810
22805
|
|
|
22811
|
-
|
|
22812
|
-
|
|
22806
|
+
case "display":
|
|
22807
|
+
rows = this.table.rowManager.getDisplayRows();
|
|
22808
|
+
break;
|
|
22809
|
+
|
|
22810
|
+
case "visible":
|
|
22811
|
+
rows = this.getVisibleRows(false, true);
|
|
22812
|
+
break;
|
|
22813
|
+
}
|
|
22813
22814
|
}
|
|
22814
22815
|
|
|
22815
22816
|
return rows;
|
|
@@ -22918,9 +22919,6 @@ class RowManager extends CoreFeature{
|
|
|
22918
22919
|
|
|
22919
22920
|
this.scrollTop = 0;
|
|
22920
22921
|
this.scrollLeft = 0;
|
|
22921
|
-
|
|
22922
|
-
// clear empty table placeholder min
|
|
22923
|
-
this.tableElement.style.minWidth = "";
|
|
22924
22922
|
|
|
22925
22923
|
this.renderer.clearRows();
|
|
22926
22924
|
}
|
|
@@ -22938,6 +22936,9 @@ class RowManager extends CoreFeature{
|
|
|
22938
22936
|
if(this.placeholder && this.placeholder.parentNode){
|
|
22939
22937
|
this.placeholder.parentNode.removeChild(this.placeholder);
|
|
22940
22938
|
}
|
|
22939
|
+
|
|
22940
|
+
// clear empty table placeholder min
|
|
22941
|
+
this.tableElement.style.minWidth = "";
|
|
22941
22942
|
}
|
|
22942
22943
|
|
|
22943
22944
|
_positionPlaceholder(){
|
|
@@ -23397,12 +23398,13 @@ class InteractionManager extends CoreFeature {
|
|
|
23397
23398
|
//ensure row component is looked up before cell
|
|
23398
23399
|
var keys = Object.keys(targets).reverse(),
|
|
23399
23400
|
listener = this.listeners[type],
|
|
23401
|
+
matches = {},
|
|
23400
23402
|
targetMatches = {};
|
|
23401
23403
|
|
|
23402
23404
|
for(let key of keys){
|
|
23403
|
-
let component
|
|
23404
|
-
|
|
23405
|
-
|
|
23405
|
+
let component,
|
|
23406
|
+
target = targets[key],
|
|
23407
|
+
previousTarget = this.previousTargets[key];
|
|
23406
23408
|
|
|
23407
23409
|
if(previousTarget && previousTarget.target === target){
|
|
23408
23410
|
component = previousTarget.component;
|
|
@@ -23431,8 +23433,8 @@ class InteractionManager extends CoreFeature {
|
|
|
23431
23433
|
|
|
23432
23434
|
case "cell":
|
|
23433
23435
|
if(listener.components.includes("cell")){
|
|
23434
|
-
if(
|
|
23435
|
-
component =
|
|
23436
|
+
if(matches["row"] instanceof Row){
|
|
23437
|
+
component = matches["row"].findCell(target);
|
|
23436
23438
|
}else {
|
|
23437
23439
|
if(targets["row"]){
|
|
23438
23440
|
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?");
|
|
@@ -23444,7 +23446,7 @@ class InteractionManager extends CoreFeature {
|
|
|
23444
23446
|
}
|
|
23445
23447
|
|
|
23446
23448
|
if(component){
|
|
23447
|
-
|
|
23449
|
+
matches[key] = component;
|
|
23448
23450
|
targetMatches[key] = {
|
|
23449
23451
|
target:target,
|
|
23450
23452
|
component:component,
|
|
@@ -23454,12 +23456,12 @@ class InteractionManager extends CoreFeature {
|
|
|
23454
23456
|
|
|
23455
23457
|
this.previousTargets = targetMatches;
|
|
23456
23458
|
|
|
23457
|
-
return
|
|
23459
|
+
return matches;
|
|
23458
23460
|
}
|
|
23459
23461
|
|
|
23460
23462
|
triggerEvents(type, e, targets){
|
|
23461
23463
|
var listener = this.listeners[type];
|
|
23462
|
-
|
|
23464
|
+
|
|
23463
23465
|
for(let key in targets){
|
|
23464
23466
|
if(targets[key] && listener.components.includes(key)){
|
|
23465
23467
|
this.dispatch(key + "-" + type, e, targets[key]);
|
|
@@ -25133,7 +25135,7 @@ class Tabulator {
|
|
|
25133
25135
|
data = JSON.parse(data);
|
|
25134
25136
|
}
|
|
25135
25137
|
|
|
25136
|
-
if(data){
|
|
25138
|
+
if(data && data.length > 0){
|
|
25137
25139
|
data.forEach((item) => {
|
|
25138
25140
|
var row = this.rowManager.findRow(item[this.options.index]);
|
|
25139
25141
|
|
|
@@ -25199,7 +25201,7 @@ class Tabulator {
|
|
|
25199
25201
|
data = JSON.parse(data);
|
|
25200
25202
|
}
|
|
25201
25203
|
|
|
25202
|
-
if(data){
|
|
25204
|
+
if(data && data.length > 0){
|
|
25203
25205
|
data.forEach((item) => {
|
|
25204
25206
|
var row = this.rowManager.findRow(item[this.options.index]);
|
|
25205
25207
|
|