tabulator-tables 5.1.0 → 5.1.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/build/rollup.js +2 -1
- package/dist/css/tabulator.css +15 -8
- package/dist/css/tabulator.css.map +1 -1
- package/dist/css/tabulator.min.css +1 -1
- package/dist/css/tabulator.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.css +15 -8
- 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 +15 -8
- 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_bulma.css +15 -8
- package/dist/css/tabulator_bulma.css.map +1 -1
- package/dist/css/tabulator_bulma.min.css +1 -1
- package/dist/css/tabulator_bulma.min.css.map +1 -1
- package/dist/css/tabulator_materialize.css +15 -8
- package/dist/css/tabulator_materialize.css.map +1 -1
- package/dist/css/tabulator_materialize.min.css +1 -1
- package/dist/css/tabulator_materialize.min.css.map +1 -1
- package/dist/css/tabulator_midnight.css +15 -8
- package/dist/css/tabulator_midnight.css.map +1 -1
- package/dist/css/tabulator_midnight.min.css +1 -1
- package/dist/css/tabulator_midnight.min.css.map +1 -1
- package/dist/css/tabulator_modern.css +15 -8
- package/dist/css/tabulator_modern.css.map +1 -1
- package/dist/css/tabulator_modern.min.css +1 -1
- package/dist/css/tabulator_modern.min.css.map +1 -1
- package/dist/css/tabulator_semanticui.css +15 -8
- package/dist/css/tabulator_semanticui.css.map +1 -1
- package/dist/css/tabulator_semanticui.min.css +1 -1
- package/dist/css/tabulator_semanticui.min.css.map +1 -1
- package/dist/css/tabulator_simple.css +15 -8
- package/dist/css/tabulator_simple.css.map +1 -1
- package/dist/css/tabulator_simple.min.css +1 -1
- package/dist/css/tabulator_simple.min.css.map +1 -1
- package/dist/css/tabulator_site.css +15 -8
- package/dist/css/tabulator_site.css.map +1 -1
- package/dist/css/tabulator_site.min.css +1 -1
- package/dist/css/tabulator_site.min.css.map +1 -1
- package/dist/js/tabulator.js +301 -181
- 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 +820 -721
- 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 +5 -2
- package/src/js/core/FooterManager.js +15 -5
- package/src/js/core/RowManager.js +311 -284
- package/src/js/core/Tabulator.js +12 -29
- package/src/js/core/column/ColumnComponent.js +2 -0
- package/src/js/core/tools/InteractionMonitor.js +31 -23
- package/src/js/core/tools/ModuleBinder.js +15 -3
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +11 -6
- package/src/js/modules/DataTree/DataTree.js +0 -1
- package/src/js/modules/Edit/Edit.js +2 -2
- package/src/js/modules/Export/Export.js +2 -1
- package/src/js/modules/Filter/Filter.js +1 -2
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +18 -1
- package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +17 -3
- package/src/js/modules/GroupRows/Group.js +144 -142
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/Import/Import.js +1 -3
- package/src/js/modules/Layout/Layout.js +1 -0
- package/src/js/modules/Page/Page.js +9 -4
- package/src/js/modules/Persistence/Persistence.js +6 -4
- package/src/js/modules/Persistence/defaults/readers.js +3 -3
- package/src/js/modules/ResizeColumns/ResizeColumns.js +61 -51
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +5 -5
- package/src/js/modules/SelectRow/SelectRow.js +130 -128
- package/src/scss/tabulator.scss +17 -12
package/dist/js/tabulator_esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Tabulator v5.1.
|
|
1
|
+
/* Tabulator v5.1.3 (c) Oliver Folkerd 2022 */
|
|
2
2
|
class CoreFeature{
|
|
3
3
|
|
|
4
4
|
constructor(table){
|
|
@@ -1653,7 +1653,7 @@ var defaultColumnOptions = {
|
|
|
1653
1653
|
"editableTitle": undefined,
|
|
1654
1654
|
};
|
|
1655
1655
|
|
|
1656
|
-
class Column
|
|
1656
|
+
class Column extends CoreFeature{
|
|
1657
1657
|
|
|
1658
1658
|
constructor(def, parent){
|
|
1659
1659
|
super(parent.table);
|
|
@@ -1707,7 +1707,7 @@ class Column$1 extends CoreFeature{
|
|
|
1707
1707
|
this.isGroup = true;
|
|
1708
1708
|
|
|
1709
1709
|
this.definition.columns.forEach((def, i) => {
|
|
1710
|
-
var newCol = new Column
|
|
1710
|
+
var newCol = new Column(def, this);
|
|
1711
1711
|
this.attachColumn(newCol);
|
|
1712
1712
|
});
|
|
1713
1713
|
|
|
@@ -1751,12 +1751,12 @@ class Column$1 extends CoreFeature{
|
|
|
1751
1751
|
}
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
|
-
this.definition = this.table.columnManager.optionsList.generate(Column
|
|
1754
|
+
this.definition = this.table.columnManager.optionsList.generate(Column.defaultOptionList, this.definition);
|
|
1755
1755
|
}
|
|
1756
1756
|
|
|
1757
1757
|
checkDefinition(){
|
|
1758
1758
|
Object.keys(this.definition).forEach((key) => {
|
|
1759
|
-
if(Column
|
|
1759
|
+
if(Column.defaultOptionList.indexOf(key) === -1){
|
|
1760
1760
|
console.warn("Invalid column definition option in '" + (this.field || this.definition.title) + "' column:", key);
|
|
1761
1761
|
}
|
|
1762
1762
|
});
|
|
@@ -2680,7 +2680,7 @@ class Column$1 extends CoreFeature{
|
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
2682
|
|
|
2683
|
-
Column
|
|
2683
|
+
Column.defaultOptionList = defaultColumnOptions;
|
|
2684
2684
|
|
|
2685
2685
|
//public row object
|
|
2686
2686
|
class RowComponent$1 {
|
|
@@ -3315,7 +3315,7 @@ class ColumnCalcs extends Module{
|
|
|
3315
3315
|
}
|
|
3316
3316
|
|
|
3317
3317
|
initialize(){
|
|
3318
|
-
this.genColumn = new Column
|
|
3318
|
+
this.genColumn = new Column({field:"value"}, this);
|
|
3319
3319
|
|
|
3320
3320
|
this.subscribe("cell-value-changed", this.cellValueChanged.bind(this));
|
|
3321
3321
|
this.subscribe("column-init", this.initializeColumnCheck.bind(this));
|
|
@@ -3324,7 +3324,7 @@ class ColumnCalcs extends Module{
|
|
|
3324
3324
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
3325
3325
|
this.subscribe("column-moved", this.recalcActiveRows.bind(this));
|
|
3326
3326
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
3327
|
-
this.subscribe("data-refreshed", this.
|
|
3327
|
+
this.subscribe("data-refreshed", this.recalcActiveRowsRefresh.bind(this));
|
|
3328
3328
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
3329
3329
|
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
3330
3330
|
|
|
@@ -3372,6 +3372,14 @@ class ColumnCalcs extends Module{
|
|
|
3372
3372
|
}
|
|
3373
3373
|
}
|
|
3374
3374
|
|
|
3375
|
+
recalcActiveRowsRefresh(){
|
|
3376
|
+
if(this.table.options.groupBy && this.table.options.dataTreeStartExpanded && this.table.options.dataTree){
|
|
3377
|
+
this.recalcAll();
|
|
3378
|
+
}else {
|
|
3379
|
+
this.recalcActiveRows();
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3375
3383
|
recalcActiveRows(){
|
|
3376
3384
|
this.recalc(this.table.rowManager.activeRows);
|
|
3377
3385
|
}
|
|
@@ -3379,7 +3387,6 @@ class ColumnCalcs extends Module{
|
|
|
3379
3387
|
cellValueChanged(cell){
|
|
3380
3388
|
if(cell.column.definition.topCalc || cell.column.definition.bottomCalc){
|
|
3381
3389
|
if(this.table.options.groupBy){
|
|
3382
|
-
|
|
3383
3390
|
if(this.table.options.columnCalcs == "table" || this.table.options.columnCalcs == "both"){
|
|
3384
3391
|
this.recalcActiveRows();
|
|
3385
3392
|
}
|
|
@@ -3387,7 +3394,6 @@ class ColumnCalcs extends Module{
|
|
|
3387
3394
|
if(this.table.options.columnCalcs != "table"){
|
|
3388
3395
|
this.recalcRowGroup(cell.row);
|
|
3389
3396
|
}
|
|
3390
|
-
|
|
3391
3397
|
}else {
|
|
3392
3398
|
this.recalcActiveRows();
|
|
3393
3399
|
}
|
|
@@ -3559,7 +3565,6 @@ class ColumnCalcs extends Module{
|
|
|
3559
3565
|
|
|
3560
3566
|
if(this.table.options.groupBy && this.table.options.columnCalcs !== "table"){
|
|
3561
3567
|
|
|
3562
|
-
|
|
3563
3568
|
var groups = this.table.modules.groupRows.getChildGroups();
|
|
3564
3569
|
|
|
3565
3570
|
groups.forEach((group) => {
|
|
@@ -3604,12 +3609,12 @@ class ColumnCalcs extends Module{
|
|
|
3604
3609
|
|
|
3605
3610
|
rowsToData(rows){
|
|
3606
3611
|
var data = [];
|
|
3607
|
-
|
|
3612
|
+
|
|
3608
3613
|
rows.forEach((row) => {
|
|
3609
3614
|
data.push(row.getData());
|
|
3610
3615
|
|
|
3611
3616
|
if(this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs){
|
|
3612
|
-
if(row.modules.dataTree.open){
|
|
3617
|
+
if(row.modules.dataTree && row.modules.dataTree.open){
|
|
3613
3618
|
var children = this.rowsToData(this.table.modules.dataTree.getFilteredTreeChildren(row));
|
|
3614
3619
|
data = data.concat(children);
|
|
3615
3620
|
}
|
|
@@ -4358,7 +4363,6 @@ class DataTree extends Module{
|
|
|
4358
4363
|
}
|
|
4359
4364
|
|
|
4360
4365
|
redrawNeeded(data){
|
|
4361
|
-
console.log("needed?", data);
|
|
4362
4366
|
return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
|
|
4363
4367
|
}
|
|
4364
4368
|
}
|
|
@@ -6757,7 +6761,7 @@ class Edit extends Module{
|
|
|
6757
6761
|
this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
|
|
6758
6762
|
this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
|
|
6759
6763
|
this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
|
|
6760
|
-
this.subscribe("data-
|
|
6764
|
+
this.subscribe("data-refreshing", this.cancelEdit.bind(this));
|
|
6761
6765
|
|
|
6762
6766
|
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
|
|
6763
6767
|
this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
|
|
@@ -6779,7 +6783,7 @@ class Edit extends Module{
|
|
|
6779
6783
|
if(cell){
|
|
6780
6784
|
if(!this.navigateNext(cell, e)){
|
|
6781
6785
|
if(newRow){
|
|
6782
|
-
|
|
6786
|
+
cell.getElement().firstChild.blur();
|
|
6783
6787
|
|
|
6784
6788
|
if(newRow === true){
|
|
6785
6789
|
newRow = this.table.addRow({});
|
|
@@ -7646,7 +7650,8 @@ class Export extends Module{
|
|
|
7646
7650
|
|
|
7647
7651
|
header.forEach((col) => {
|
|
7648
7652
|
if(col){
|
|
7649
|
-
|
|
7653
|
+
let title = typeof col.title === "undefined" ? "" : col.title;
|
|
7654
|
+
columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
|
|
7650
7655
|
}else {
|
|
7651
7656
|
columns.push(null);
|
|
7652
7657
|
}
|
|
@@ -8739,20 +8744,24 @@ class Filter extends Module{
|
|
|
8739
8744
|
|
|
8740
8745
|
//add filter to array
|
|
8741
8746
|
addFilter(field, type, value, params){
|
|
8747
|
+
var changed = false;
|
|
8742
8748
|
|
|
8743
8749
|
if(!Array.isArray(field)){
|
|
8744
8750
|
field = [{field:field, type:type, value:value, params:params}];
|
|
8745
8751
|
}
|
|
8746
8752
|
|
|
8747
8753
|
field.forEach((filter) => {
|
|
8748
|
-
|
|
8749
8754
|
filter = this.findFilter(filter);
|
|
8750
8755
|
|
|
8751
8756
|
if(filter){
|
|
8752
8757
|
this.filterList.push(filter);
|
|
8753
|
-
|
|
8758
|
+
changed = true;
|
|
8754
8759
|
}
|
|
8755
8760
|
});
|
|
8761
|
+
|
|
8762
|
+
if(changed){
|
|
8763
|
+
this.trackChanges();
|
|
8764
|
+
}
|
|
8756
8765
|
}
|
|
8757
8766
|
|
|
8758
8767
|
findFilter(filter){
|
|
@@ -9524,7 +9533,7 @@ function buttonCross(cell, formatterParams, onRendered){
|
|
|
9524
9533
|
}
|
|
9525
9534
|
|
|
9526
9535
|
function rownum(cell, formatterParams, onRendered){
|
|
9527
|
-
return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1;
|
|
9536
|
+
return this.table.rowManager.activeRows.indexOf(cell.getRow()._getSelf()) + 1 || "";
|
|
9528
9537
|
}
|
|
9529
9538
|
|
|
9530
9539
|
function handle(cell, formatterParams, onRendered){
|
|
@@ -9570,8 +9579,10 @@ function responsiveCollapse(cell, formatterParams, onRendered){
|
|
|
9570
9579
|
|
|
9571
9580
|
function rowSelection(cell, formatterParams, onRendered){
|
|
9572
9581
|
var checkbox = document.createElement("input");
|
|
9582
|
+
var blocked = false;
|
|
9573
9583
|
|
|
9574
9584
|
checkbox.type = 'checkbox';
|
|
9585
|
+
|
|
9575
9586
|
|
|
9576
9587
|
if(this.table.modExists("selectRow", true)){
|
|
9577
9588
|
|
|
@@ -9585,9 +9596,24 @@ function rowSelection(cell, formatterParams, onRendered){
|
|
|
9585
9596
|
if(row instanceof RowComponent$1){
|
|
9586
9597
|
|
|
9587
9598
|
checkbox.addEventListener("change", (e) => {
|
|
9588
|
-
|
|
9599
|
+
if(this.table.options.selectableRangeMode === "click"){
|
|
9600
|
+
if(!blocked){
|
|
9601
|
+
row.toggleSelect();
|
|
9602
|
+
}else {
|
|
9603
|
+
blocked = false;
|
|
9604
|
+
}
|
|
9605
|
+
}else {
|
|
9606
|
+
row.toggleSelect();
|
|
9607
|
+
}
|
|
9589
9608
|
});
|
|
9590
9609
|
|
|
9610
|
+
if(this.table.options.selectableRangeMode === "click"){
|
|
9611
|
+
checkbox.addEventListener("click", (e) => {
|
|
9612
|
+
blocked = true;
|
|
9613
|
+
this.table.modules.selectRow.handleComplexRowClick(row._row, e);
|
|
9614
|
+
});
|
|
9615
|
+
}
|
|
9616
|
+
|
|
9591
9617
|
checkbox.checked = row.isSelected && row.isSelected();
|
|
9592
9618
|
this.table.modules.selectRow.registerRowSelectCheckbox(row, checkbox);
|
|
9593
9619
|
}else {
|
|
@@ -9849,6 +9875,7 @@ class FrozenColumns extends Module{
|
|
|
9849
9875
|
this.initializationMode = "left";
|
|
9850
9876
|
this.active = false;
|
|
9851
9877
|
this.scrollEndTimer = false;
|
|
9878
|
+
this.blocked = true;
|
|
9852
9879
|
|
|
9853
9880
|
this.registerColumnOption("frozen");
|
|
9854
9881
|
}
|
|
@@ -9876,6 +9903,16 @@ class FrozenColumns extends Module{
|
|
|
9876
9903
|
this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this));
|
|
9877
9904
|
this.subscribe("columns-loading", this.reset.bind(this));
|
|
9878
9905
|
this.subscribe("table-redraw", this.layout.bind(this));
|
|
9906
|
+
this.subscribe("layout-refreshing", this.blockLayout.bind(this));
|
|
9907
|
+
this.subscribe("layout-refreshed", this.unblockLayout.bind(this));
|
|
9908
|
+
}
|
|
9909
|
+
|
|
9910
|
+
blockLayout(){
|
|
9911
|
+
this.blocked = true;
|
|
9912
|
+
}
|
|
9913
|
+
|
|
9914
|
+
unblockLayout(){
|
|
9915
|
+
this.blocked = false;
|
|
9879
9916
|
}
|
|
9880
9917
|
|
|
9881
9918
|
layoutCell(cell){
|
|
@@ -10058,11 +10095,10 @@ class FrozenColumns extends Module{
|
|
|
10058
10095
|
return column.parent.isGroup ? this.getColGroupParentElement(column.parent) : column.getElement();
|
|
10059
10096
|
}
|
|
10060
10097
|
|
|
10061
|
-
//layout columns
|
|
10098
|
+
//layout columns appropriately
|
|
10062
10099
|
layout(){
|
|
10063
10100
|
|
|
10064
|
-
if(this.active){
|
|
10065
|
-
|
|
10101
|
+
if(this.active && !this.blocked){
|
|
10066
10102
|
//calculate row padding
|
|
10067
10103
|
this.calcMargins();
|
|
10068
10104
|
|
|
@@ -10086,6 +10122,10 @@ class FrozenColumns extends Module{
|
|
|
10086
10122
|
|
|
10087
10123
|
rowEl.style.paddingLeft = this.leftMargin;
|
|
10088
10124
|
|
|
10125
|
+
if(this.table.options.layout === "fitDataFill" && this.rightColumns.length){
|
|
10126
|
+
this.table.rowManager.getTableElement().style.minWidth = "calc(100% - " + this.rightMargin + ")";
|
|
10127
|
+
}
|
|
10128
|
+
|
|
10089
10129
|
this.leftColumns.forEach((column) => {
|
|
10090
10130
|
var cell = row.getCell(column);
|
|
10091
10131
|
|
|
@@ -10267,7 +10307,7 @@ class GroupComponent {
|
|
|
10267
10307
|
if (typeof target[name] !== "undefined") {
|
|
10268
10308
|
return target[name];
|
|
10269
10309
|
}else {
|
|
10270
|
-
return target._group.table.componentFunctionBinder.handle("row", target._group, name)
|
|
10310
|
+
return target._group.groupManager.table.componentFunctionBinder.handle("row", target._group, name)
|
|
10271
10311
|
}
|
|
10272
10312
|
}
|
|
10273
10313
|
})
|
|
@@ -10324,7 +10364,7 @@ class GroupComponent {
|
|
|
10324
10364
|
|
|
10325
10365
|
//Group functions
|
|
10326
10366
|
class Group{
|
|
10327
|
-
|
|
10367
|
+
|
|
10328
10368
|
constructor(groupManager, parent, level, key, field, generator, oldGroup){
|
|
10329
10369
|
this.groupManager = groupManager;
|
|
10330
10370
|
this.parent = parent;
|
|
@@ -10348,17 +10388,17 @@ class Group{
|
|
|
10348
10388
|
this.initialized = false;
|
|
10349
10389
|
this.modules = {};
|
|
10350
10390
|
this.arrowElement = false;
|
|
10351
|
-
|
|
10391
|
+
|
|
10352
10392
|
this.visible = oldGroup ? oldGroup.visible : (typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0]);
|
|
10353
|
-
|
|
10393
|
+
|
|
10354
10394
|
this.component = null;
|
|
10355
|
-
|
|
10395
|
+
|
|
10356
10396
|
this.createElements();
|
|
10357
10397
|
this.addBindings();
|
|
10358
|
-
|
|
10398
|
+
|
|
10359
10399
|
this.createValueGroups();
|
|
10360
10400
|
}
|
|
10361
|
-
|
|
10401
|
+
|
|
10362
10402
|
wipe(){
|
|
10363
10403
|
if(this.groupList.length){
|
|
10364
10404
|
this.groupList.forEach(function(group){
|
|
@@ -10371,32 +10411,32 @@ class Group{
|
|
|
10371
10411
|
}
|
|
10372
10412
|
});
|
|
10373
10413
|
}
|
|
10374
|
-
|
|
10414
|
+
|
|
10375
10415
|
this.element = false;
|
|
10376
10416
|
this.arrowElement = false;
|
|
10377
10417
|
this.elementContents = false;
|
|
10378
10418
|
}
|
|
10379
|
-
|
|
10419
|
+
|
|
10380
10420
|
createElements(){
|
|
10381
10421
|
var arrow = document.createElement("div");
|
|
10382
10422
|
arrow.classList.add("tabulator-arrow");
|
|
10383
|
-
|
|
10423
|
+
|
|
10384
10424
|
this.element = document.createElement("div");
|
|
10385
10425
|
this.element.classList.add("tabulator-row");
|
|
10386
10426
|
this.element.classList.add("tabulator-group");
|
|
10387
10427
|
this.element.classList.add("tabulator-group-level-" + this.level);
|
|
10388
10428
|
this.element.setAttribute("role", "rowgroup");
|
|
10389
|
-
|
|
10429
|
+
|
|
10390
10430
|
this.arrowElement = document.createElement("div");
|
|
10391
10431
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
10392
10432
|
this.arrowElement.appendChild(arrow);
|
|
10393
|
-
|
|
10433
|
+
|
|
10394
10434
|
//setup movable rows
|
|
10395
10435
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
10396
10436
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
10397
10437
|
}
|
|
10398
10438
|
}
|
|
10399
|
-
|
|
10439
|
+
|
|
10400
10440
|
createValueGroups(){
|
|
10401
10441
|
var level = this.level + 1;
|
|
10402
10442
|
if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
|
|
@@ -10405,13 +10445,13 @@ class Group{
|
|
|
10405
10445
|
});
|
|
10406
10446
|
}
|
|
10407
10447
|
}
|
|
10408
|
-
|
|
10448
|
+
|
|
10409
10449
|
addBindings(){
|
|
10410
10450
|
var toggleElement;
|
|
10411
|
-
|
|
10451
|
+
|
|
10412
10452
|
if(this.groupManager.table.options.groupToggleElement){
|
|
10413
10453
|
toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
|
|
10414
|
-
|
|
10454
|
+
|
|
10415
10455
|
toggleElement.addEventListener("click", (e) => {
|
|
10416
10456
|
e.stopPropagation();
|
|
10417
10457
|
e.stopImmediatePropagation();
|
|
@@ -10419,23 +10459,23 @@ class Group{
|
|
|
10419
10459
|
});
|
|
10420
10460
|
}
|
|
10421
10461
|
}
|
|
10422
|
-
|
|
10462
|
+
|
|
10423
10463
|
_createGroup(groupID, level){
|
|
10424
10464
|
var groupKey = level + "_" + groupID;
|
|
10425
10465
|
var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupKey] : false);
|
|
10426
|
-
|
|
10466
|
+
|
|
10427
10467
|
this.groups[groupKey] = group;
|
|
10428
10468
|
this.groupList.push(group);
|
|
10429
10469
|
}
|
|
10430
|
-
|
|
10470
|
+
|
|
10431
10471
|
_addRowToGroup(row){
|
|
10432
|
-
|
|
10472
|
+
|
|
10433
10473
|
var level = this.level + 1;
|
|
10434
|
-
|
|
10474
|
+
|
|
10435
10475
|
if(this.hasSubGroups){
|
|
10436
10476
|
var groupID = this.groupManager.groupIDLookups[level].func(row.getData()),
|
|
10437
10477
|
groupKey = level + "_" + groupID;
|
|
10438
|
-
|
|
10478
|
+
|
|
10439
10479
|
if(this.groupManager.allowedValues && this.groupManager.allowedValues[level]){
|
|
10440
10480
|
if(this.groups[groupKey]){
|
|
10441
10481
|
this.groups[groupKey].addRow(row);
|
|
@@ -10444,24 +10484,24 @@ class Group{
|
|
|
10444
10484
|
if(!this.groups[groupKey]){
|
|
10445
10485
|
this._createGroup(groupID, level);
|
|
10446
10486
|
}
|
|
10447
|
-
|
|
10487
|
+
|
|
10448
10488
|
this.groups[groupKey].addRow(row);
|
|
10449
10489
|
}
|
|
10450
10490
|
}
|
|
10451
10491
|
}
|
|
10452
|
-
|
|
10492
|
+
|
|
10453
10493
|
_addRow(row){
|
|
10454
10494
|
this.rows.push(row);
|
|
10455
10495
|
row.modules.group = this;
|
|
10456
10496
|
}
|
|
10457
|
-
|
|
10497
|
+
|
|
10458
10498
|
insertRow(row, to, after){
|
|
10459
10499
|
var data = this.conformRowData({});
|
|
10460
|
-
|
|
10500
|
+
|
|
10461
10501
|
row.updateData(data);
|
|
10462
|
-
|
|
10502
|
+
|
|
10463
10503
|
var toIndex = this.rows.indexOf(to);
|
|
10464
|
-
|
|
10504
|
+
|
|
10465
10505
|
if(toIndex > -1){
|
|
10466
10506
|
if(after){
|
|
10467
10507
|
this.rows.splice(toIndex+1, 0, row);
|
|
@@ -10475,28 +10515,30 @@ class Group{
|
|
|
10475
10515
|
this.rows.unshift(row);
|
|
10476
10516
|
}
|
|
10477
10517
|
}
|
|
10478
|
-
|
|
10518
|
+
|
|
10479
10519
|
row.modules.group = this;
|
|
10480
|
-
|
|
10520
|
+
|
|
10481
10521
|
this.generateGroupHeaderContents();
|
|
10482
|
-
|
|
10522
|
+
|
|
10483
10523
|
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
10484
10524
|
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
10485
10525
|
}
|
|
10486
|
-
|
|
10526
|
+
|
|
10487
10527
|
this.groupManager.updateGroupRows(true);
|
|
10488
10528
|
}
|
|
10489
|
-
|
|
10529
|
+
|
|
10490
10530
|
scrollHeader(left){
|
|
10491
|
-
this.arrowElement
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10531
|
+
if(this.arrowElement){
|
|
10532
|
+
this.arrowElement.style.marginLeft = left;
|
|
10533
|
+
|
|
10534
|
+
this.groupList.forEach(function(child){
|
|
10535
|
+
child.scrollHeader(left);
|
|
10536
|
+
});
|
|
10537
|
+
}
|
|
10496
10538
|
}
|
|
10497
|
-
|
|
10539
|
+
|
|
10498
10540
|
getRowIndex(row){}
|
|
10499
|
-
|
|
10541
|
+
|
|
10500
10542
|
//update row data to match grouping contraints
|
|
10501
10543
|
conformRowData(data){
|
|
10502
10544
|
if(this.field){
|
|
@@ -10504,59 +10546,59 @@ class Group{
|
|
|
10504
10546
|
}else {
|
|
10505
10547
|
console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function");
|
|
10506
10548
|
}
|
|
10507
|
-
|
|
10549
|
+
|
|
10508
10550
|
if(this.parent){
|
|
10509
10551
|
data = this.parent.conformRowData(data);
|
|
10510
10552
|
}
|
|
10511
|
-
|
|
10553
|
+
|
|
10512
10554
|
return data;
|
|
10513
10555
|
}
|
|
10514
|
-
|
|
10556
|
+
|
|
10515
10557
|
removeRow(row){
|
|
10516
10558
|
var index = this.rows.indexOf(row);
|
|
10517
10559
|
var el = row.getElement();
|
|
10518
|
-
|
|
10519
|
-
|
|
10560
|
+
|
|
10561
|
+
|
|
10520
10562
|
if(index > -1){
|
|
10521
10563
|
this.rows.splice(index, 1);
|
|
10522
10564
|
}
|
|
10523
|
-
|
|
10565
|
+
|
|
10524
10566
|
if(!this.groupManager.table.options.groupValues && !this.rows.length){
|
|
10525
10567
|
if(this.parent){
|
|
10526
10568
|
this.parent.removeGroup(this);
|
|
10527
10569
|
}else {
|
|
10528
10570
|
this.groupManager.removeGroup(this);
|
|
10529
10571
|
}
|
|
10530
|
-
|
|
10572
|
+
|
|
10531
10573
|
this.groupManager.updateGroupRows(true);
|
|
10532
10574
|
}else {
|
|
10533
|
-
|
|
10575
|
+
|
|
10534
10576
|
if(el.parentNode){
|
|
10535
10577
|
el.parentNode.removeChild(el);
|
|
10536
10578
|
}
|
|
10537
|
-
|
|
10579
|
+
|
|
10538
10580
|
this.generateGroupHeaderContents();
|
|
10539
10581
|
|
|
10540
10582
|
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
10541
10583
|
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
10542
10584
|
}
|
|
10543
|
-
|
|
10585
|
+
|
|
10544
10586
|
}
|
|
10545
10587
|
}
|
|
10546
|
-
|
|
10588
|
+
|
|
10547
10589
|
removeGroup(group){
|
|
10548
10590
|
var groupKey = group.level + "_" + group.key,
|
|
10549
10591
|
index;
|
|
10550
|
-
|
|
10592
|
+
|
|
10551
10593
|
if(this.groups[groupKey]){
|
|
10552
10594
|
delete this.groups[groupKey];
|
|
10553
|
-
|
|
10595
|
+
|
|
10554
10596
|
index = this.groupList.indexOf(group);
|
|
10555
|
-
|
|
10597
|
+
|
|
10556
10598
|
if(index > -1){
|
|
10557
10599
|
this.groupList.splice(index, 1);
|
|
10558
10600
|
}
|
|
10559
|
-
|
|
10601
|
+
|
|
10560
10602
|
if(!this.groupList.length){
|
|
10561
10603
|
if(this.parent){
|
|
10562
10604
|
this.parent.removeGroup(this);
|
|
@@ -10566,66 +10608,66 @@ class Group{
|
|
|
10566
10608
|
}
|
|
10567
10609
|
}
|
|
10568
10610
|
}
|
|
10569
|
-
|
|
10611
|
+
|
|
10570
10612
|
getHeadersAndRows(noCalc){
|
|
10571
10613
|
var output = [];
|
|
10572
|
-
|
|
10614
|
+
|
|
10573
10615
|
output.push(this);
|
|
10574
|
-
|
|
10616
|
+
|
|
10575
10617
|
this._visSet();
|
|
10576
|
-
|
|
10618
|
+
|
|
10577
10619
|
if(this.visible){
|
|
10578
10620
|
if(this.groupList.length){
|
|
10579
10621
|
this.groupList.forEach(function(group){
|
|
10580
10622
|
output = output.concat(group.getHeadersAndRows(noCalc));
|
|
10581
10623
|
});
|
|
10582
|
-
|
|
10624
|
+
|
|
10583
10625
|
}else {
|
|
10584
10626
|
if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
|
|
10585
10627
|
if(this.calcs.top){
|
|
10586
10628
|
this.calcs.top.detachElement();
|
|
10587
10629
|
this.calcs.top.deleteCells();
|
|
10588
10630
|
}
|
|
10589
|
-
|
|
10631
|
+
|
|
10590
10632
|
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
|
|
10591
10633
|
output.push(this.calcs.top);
|
|
10592
10634
|
}
|
|
10593
|
-
|
|
10635
|
+
|
|
10594
10636
|
output = output.concat(this.rows);
|
|
10595
|
-
|
|
10637
|
+
|
|
10596
10638
|
if(!noCalc && this.groupManager.table.options.columnCalcs != "table" && this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
|
|
10597
10639
|
if(this.calcs.bottom){
|
|
10598
10640
|
this.calcs.bottom.detachElement();
|
|
10599
10641
|
this.calcs.bottom.deleteCells();
|
|
10600
10642
|
}
|
|
10601
|
-
|
|
10643
|
+
|
|
10602
10644
|
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
|
|
10603
10645
|
output.push(this.calcs.bottom);
|
|
10604
10646
|
}
|
|
10605
10647
|
}
|
|
10606
10648
|
}else {
|
|
10607
10649
|
if(!this.groupList.length && this.groupManager.table.options.columnCalcs != "table"){
|
|
10608
|
-
|
|
10650
|
+
|
|
10609
10651
|
if(this.groupManager.table.modExists("columnCalcs")){
|
|
10610
|
-
|
|
10652
|
+
|
|
10611
10653
|
if(!noCalc && this.groupManager.table.modules.columnCalcs.hasTopCalcs()){
|
|
10612
10654
|
if(this.calcs.top){
|
|
10613
10655
|
this.calcs.top.detachElement();
|
|
10614
10656
|
this.calcs.top.deleteCells();
|
|
10615
10657
|
}
|
|
10616
|
-
|
|
10658
|
+
|
|
10617
10659
|
if(this.groupManager.table.options.groupClosedShowCalcs){
|
|
10618
10660
|
this.calcs.top = this.groupManager.table.modules.columnCalcs.generateTopRow(this.rows);
|
|
10619
10661
|
output.push(this.calcs.top);
|
|
10620
10662
|
}
|
|
10621
10663
|
}
|
|
10622
|
-
|
|
10664
|
+
|
|
10623
10665
|
if(!noCalc && this.groupManager.table.modules.columnCalcs.hasBottomCalcs()){
|
|
10624
10666
|
if(this.calcs.bottom){
|
|
10625
10667
|
this.calcs.bottom.detachElement();
|
|
10626
10668
|
this.calcs.bottom.deleteCells();
|
|
10627
10669
|
}
|
|
10628
|
-
|
|
10670
|
+
|
|
10629
10671
|
if(this.groupManager.table.options.groupClosedShowCalcs){
|
|
10630
10672
|
this.calcs.bottom = this.groupManager.table.modules.columnCalcs.generateBottomRow(this.rows);
|
|
10631
10673
|
output.push(this.calcs.bottom);
|
|
@@ -10633,29 +10675,29 @@ class Group{
|
|
|
10633
10675
|
}
|
|
10634
10676
|
}
|
|
10635
10677
|
}
|
|
10636
|
-
|
|
10678
|
+
|
|
10637
10679
|
}
|
|
10638
|
-
|
|
10680
|
+
|
|
10639
10681
|
return output;
|
|
10640
10682
|
}
|
|
10641
|
-
|
|
10683
|
+
|
|
10642
10684
|
getData(visible, transform){
|
|
10643
10685
|
var output = [];
|
|
10644
|
-
|
|
10686
|
+
|
|
10645
10687
|
this._visSet();
|
|
10646
|
-
|
|
10688
|
+
|
|
10647
10689
|
if(!visible || (visible && this.visible)){
|
|
10648
10690
|
this.rows.forEach((row) => {
|
|
10649
10691
|
output.push(row.getData(transform || "data"));
|
|
10650
10692
|
});
|
|
10651
10693
|
}
|
|
10652
|
-
|
|
10694
|
+
|
|
10653
10695
|
return output;
|
|
10654
10696
|
}
|
|
10655
|
-
|
|
10697
|
+
|
|
10656
10698
|
getRowCount(){
|
|
10657
10699
|
var count = 0;
|
|
10658
|
-
|
|
10700
|
+
|
|
10659
10701
|
if(this.groupList.length){
|
|
10660
10702
|
this.groupList.forEach((group) => {
|
|
10661
10703
|
count += group.getRowCount();
|
|
@@ -10665,7 +10707,7 @@ class Group{
|
|
|
10665
10707
|
}
|
|
10666
10708
|
return count;
|
|
10667
10709
|
}
|
|
10668
|
-
|
|
10710
|
+
|
|
10669
10711
|
toggleVisibility(){
|
|
10670
10712
|
if(this.visible){
|
|
10671
10713
|
this.hide();
|
|
@@ -10673,55 +10715,55 @@ class Group{
|
|
|
10673
10715
|
this.show();
|
|
10674
10716
|
}
|
|
10675
10717
|
}
|
|
10676
|
-
|
|
10718
|
+
|
|
10677
10719
|
hide(){
|
|
10678
10720
|
this.visible = false;
|
|
10679
|
-
|
|
10721
|
+
|
|
10680
10722
|
if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
|
|
10681
|
-
|
|
10723
|
+
|
|
10682
10724
|
this.element.classList.remove("tabulator-group-visible");
|
|
10683
|
-
|
|
10725
|
+
|
|
10684
10726
|
if(this.groupList.length){
|
|
10685
10727
|
this.groupList.forEach((group) => {
|
|
10686
|
-
|
|
10728
|
+
|
|
10687
10729
|
var rows = group.getHeadersAndRows();
|
|
10688
|
-
|
|
10730
|
+
|
|
10689
10731
|
rows.forEach((row) => {
|
|
10690
10732
|
row.detachElement();
|
|
10691
10733
|
});
|
|
10692
10734
|
});
|
|
10693
|
-
|
|
10735
|
+
|
|
10694
10736
|
}else {
|
|
10695
10737
|
this.rows.forEach((row) => {
|
|
10696
10738
|
var rowEl = row.getElement();
|
|
10697
10739
|
rowEl.parentNode.removeChild(rowEl);
|
|
10698
10740
|
});
|
|
10699
10741
|
}
|
|
10700
|
-
|
|
10742
|
+
|
|
10701
10743
|
this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
|
|
10702
|
-
|
|
10744
|
+
|
|
10703
10745
|
this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
|
|
10704
|
-
|
|
10746
|
+
|
|
10705
10747
|
}else {
|
|
10706
10748
|
this.groupManager.updateGroupRows(true);
|
|
10707
10749
|
}
|
|
10708
|
-
|
|
10750
|
+
|
|
10709
10751
|
this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), false);
|
|
10710
10752
|
}
|
|
10711
|
-
|
|
10753
|
+
|
|
10712
10754
|
show(){
|
|
10713
10755
|
this.visible = true;
|
|
10714
|
-
|
|
10756
|
+
|
|
10715
10757
|
if(this.groupManager.table.rowManager.getRenderMode() == "classic" && !this.groupManager.table.options.pagination){
|
|
10716
|
-
|
|
10758
|
+
|
|
10717
10759
|
this.element.classList.add("tabulator-group-visible");
|
|
10718
|
-
|
|
10760
|
+
|
|
10719
10761
|
var prev = this.generateElement();
|
|
10720
|
-
|
|
10762
|
+
|
|
10721
10763
|
if(this.groupList.length){
|
|
10722
10764
|
this.groupList.forEach((group) => {
|
|
10723
10765
|
var rows = group.getHeadersAndRows();
|
|
10724
|
-
|
|
10766
|
+
|
|
10725
10767
|
rows.forEach((row) => {
|
|
10726
10768
|
var rowEl = row.getElement();
|
|
10727
10769
|
prev.parentNode.insertBefore(rowEl, prev.nextSibling);
|
|
@@ -10729,7 +10771,7 @@ class Group{
|
|
|
10729
10771
|
prev = rowEl;
|
|
10730
10772
|
});
|
|
10731
10773
|
});
|
|
10732
|
-
|
|
10774
|
+
|
|
10733
10775
|
}else {
|
|
10734
10776
|
this.rows.forEach((row) => {
|
|
10735
10777
|
var rowEl = row.getElement();
|
|
@@ -10738,36 +10780,36 @@ class Group{
|
|
|
10738
10780
|
prev = rowEl;
|
|
10739
10781
|
});
|
|
10740
10782
|
}
|
|
10741
|
-
|
|
10783
|
+
|
|
10742
10784
|
this.groupManager.table.rowManager.setDisplayRows(this.groupManager.updateGroupRows(), this.groupManager.getDisplayIndex());
|
|
10743
|
-
|
|
10785
|
+
|
|
10744
10786
|
this.groupManager.table.rowManager.checkClassicModeGroupHeaderWidth();
|
|
10745
10787
|
}else {
|
|
10746
10788
|
this.groupManager.updateGroupRows(true);
|
|
10747
10789
|
}
|
|
10748
|
-
|
|
10790
|
+
|
|
10749
10791
|
this.groupManager.table.externalEvents.dispatch("groupVisibilityChanged", this.getComponent(), true);
|
|
10750
10792
|
}
|
|
10751
|
-
|
|
10793
|
+
|
|
10752
10794
|
_visSet(){
|
|
10753
10795
|
var data = [];
|
|
10754
|
-
|
|
10796
|
+
|
|
10755
10797
|
if(typeof this.visible == "function"){
|
|
10756
|
-
|
|
10798
|
+
|
|
10757
10799
|
this.rows.forEach(function(row){
|
|
10758
10800
|
data.push(row.getData());
|
|
10759
10801
|
});
|
|
10760
|
-
|
|
10802
|
+
|
|
10761
10803
|
this.visible = this.visible(this.key, this.getRowCount(), data, this.getComponent());
|
|
10762
10804
|
}
|
|
10763
10805
|
}
|
|
10764
|
-
|
|
10806
|
+
|
|
10765
10807
|
getRowGroup(row){
|
|
10766
10808
|
var match = false;
|
|
10767
10809
|
if(this.groupList.length){
|
|
10768
10810
|
this.groupList.forEach(function(group){
|
|
10769
10811
|
var result = group.getRowGroup(row);
|
|
10770
|
-
|
|
10812
|
+
|
|
10771
10813
|
if(result){
|
|
10772
10814
|
match = result;
|
|
10773
10815
|
}
|
|
@@ -10779,50 +10821,50 @@ class Group{
|
|
|
10779
10821
|
match = this;
|
|
10780
10822
|
}
|
|
10781
10823
|
}
|
|
10782
|
-
|
|
10824
|
+
|
|
10783
10825
|
return match;
|
|
10784
10826
|
}
|
|
10785
|
-
|
|
10827
|
+
|
|
10786
10828
|
getSubGroups(component){
|
|
10787
10829
|
var output = [];
|
|
10788
|
-
|
|
10830
|
+
|
|
10789
10831
|
this.groupList.forEach(function(child){
|
|
10790
10832
|
output.push(component ? child.getComponent() : child);
|
|
10791
10833
|
});
|
|
10792
|
-
|
|
10834
|
+
|
|
10793
10835
|
return output;
|
|
10794
10836
|
}
|
|
10795
|
-
|
|
10837
|
+
|
|
10796
10838
|
getRows(compoment){
|
|
10797
10839
|
var output = [];
|
|
10798
|
-
|
|
10840
|
+
|
|
10799
10841
|
this.rows.forEach(function(row){
|
|
10800
10842
|
output.push(compoment ? row.getComponent() : row);
|
|
10801
10843
|
});
|
|
10802
|
-
|
|
10844
|
+
|
|
10803
10845
|
return output;
|
|
10804
10846
|
}
|
|
10805
|
-
|
|
10847
|
+
|
|
10806
10848
|
generateGroupHeaderContents(){
|
|
10807
10849
|
var data = [];
|
|
10808
|
-
|
|
10850
|
+
|
|
10809
10851
|
this.rows.forEach(function(row){
|
|
10810
10852
|
data.push(row.getData());
|
|
10811
10853
|
});
|
|
10812
|
-
|
|
10854
|
+
|
|
10813
10855
|
this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent());
|
|
10814
|
-
|
|
10856
|
+
|
|
10815
10857
|
while(this.element.firstChild) this.element.removeChild(this.element.firstChild);
|
|
10816
|
-
|
|
10858
|
+
|
|
10817
10859
|
if(typeof this.elementContents === "string"){
|
|
10818
10860
|
this.element.innerHTML = this.elementContents;
|
|
10819
10861
|
}else {
|
|
10820
10862
|
this.element.appendChild(this.elementContents);
|
|
10821
10863
|
}
|
|
10822
|
-
|
|
10864
|
+
|
|
10823
10865
|
this.element.insertBefore(this.arrowElement, this.element.firstChild);
|
|
10824
10866
|
}
|
|
10825
|
-
|
|
10867
|
+
|
|
10826
10868
|
getPath(path = []) {
|
|
10827
10869
|
path.unshift(this.key);
|
|
10828
10870
|
if(this.parent) {
|
|
@@ -10830,94 +10872,94 @@ class Group{
|
|
|
10830
10872
|
}
|
|
10831
10873
|
return path;
|
|
10832
10874
|
}
|
|
10833
|
-
|
|
10875
|
+
|
|
10834
10876
|
////////////// Standard Row Functions //////////////
|
|
10835
|
-
|
|
10877
|
+
|
|
10836
10878
|
getElement(){
|
|
10837
10879
|
return this.elementContents ? this.element : this.generateElement();
|
|
10838
10880
|
}
|
|
10839
|
-
|
|
10881
|
+
|
|
10840
10882
|
generateElement(){
|
|
10841
10883
|
this.addBindings = false;
|
|
10842
|
-
|
|
10884
|
+
|
|
10843
10885
|
this._visSet();
|
|
10844
|
-
|
|
10886
|
+
|
|
10845
10887
|
if(this.visible){
|
|
10846
10888
|
this.element.classList.add("tabulator-group-visible");
|
|
10847
10889
|
}else {
|
|
10848
10890
|
this.element.classList.remove("tabulator-group-visible");
|
|
10849
10891
|
}
|
|
10850
|
-
|
|
10892
|
+
|
|
10851
10893
|
for(var i = 0; i < this.element.childNodes.length; ++i){
|
|
10852
10894
|
this.element.childNodes[i].parentNode.removeChild(this.element.childNodes[i]);
|
|
10853
10895
|
}
|
|
10854
|
-
|
|
10896
|
+
|
|
10855
10897
|
this.generateGroupHeaderContents();
|
|
10856
|
-
|
|
10898
|
+
|
|
10857
10899
|
// this.addBindings();
|
|
10858
|
-
|
|
10900
|
+
|
|
10859
10901
|
return this.element;
|
|
10860
10902
|
}
|
|
10861
|
-
|
|
10903
|
+
|
|
10862
10904
|
detachElement(){
|
|
10863
10905
|
if (this.element && this.element.parentNode){
|
|
10864
10906
|
this.element.parentNode.removeChild(this.element);
|
|
10865
10907
|
}
|
|
10866
10908
|
}
|
|
10867
|
-
|
|
10909
|
+
|
|
10868
10910
|
//normalize the height of elements in the row
|
|
10869
10911
|
normalizeHeight(){
|
|
10870
10912
|
this.setHeight(this.element.clientHeight);
|
|
10871
10913
|
}
|
|
10872
|
-
|
|
10914
|
+
|
|
10873
10915
|
initialize(force){
|
|
10874
10916
|
if(!this.initialized || force){
|
|
10875
10917
|
this.normalizeHeight();
|
|
10876
10918
|
this.initialized = true;
|
|
10877
10919
|
}
|
|
10878
10920
|
}
|
|
10879
|
-
|
|
10921
|
+
|
|
10880
10922
|
reinitialize(){
|
|
10881
10923
|
this.initialized = false;
|
|
10882
10924
|
this.height = 0;
|
|
10883
|
-
|
|
10925
|
+
|
|
10884
10926
|
if(Helpers.elVisible(this.element)){
|
|
10885
10927
|
this.initialize(true);
|
|
10886
10928
|
}
|
|
10887
10929
|
}
|
|
10888
|
-
|
|
10930
|
+
|
|
10889
10931
|
setHeight(height){
|
|
10890
10932
|
if(this.height != height){
|
|
10891
10933
|
this.height = height;
|
|
10892
10934
|
this.outerHeight = this.element.offsetHeight;
|
|
10893
10935
|
}
|
|
10894
10936
|
}
|
|
10895
|
-
|
|
10937
|
+
|
|
10896
10938
|
//return rows outer height
|
|
10897
10939
|
getHeight(){
|
|
10898
10940
|
return this.outerHeight;
|
|
10899
10941
|
}
|
|
10900
|
-
|
|
10942
|
+
|
|
10901
10943
|
getGroup(){
|
|
10902
10944
|
return this;
|
|
10903
10945
|
}
|
|
10904
|
-
|
|
10946
|
+
|
|
10905
10947
|
reinitializeHeight(){}
|
|
10906
|
-
|
|
10948
|
+
|
|
10907
10949
|
calcHeight(){}
|
|
10908
|
-
|
|
10950
|
+
|
|
10909
10951
|
setCellHeight(){}
|
|
10910
|
-
|
|
10952
|
+
|
|
10911
10953
|
clearCellHeight(){}
|
|
10912
|
-
|
|
10954
|
+
|
|
10913
10955
|
deinitializeHeight(){}
|
|
10914
|
-
|
|
10956
|
+
|
|
10915
10957
|
//////////////// Object Generation /////////////////
|
|
10916
10958
|
getComponent(){
|
|
10917
10959
|
if(!this.component){
|
|
10918
10960
|
this.component = new GroupComponent(this);
|
|
10919
10961
|
}
|
|
10920
|
-
|
|
10962
|
+
|
|
10921
10963
|
return this.component;
|
|
10922
10964
|
}
|
|
10923
10965
|
}
|
|
@@ -12087,9 +12129,7 @@ class Import extends Module{
|
|
|
12087
12129
|
|
|
12088
12130
|
structureData(parsedData){
|
|
12089
12131
|
var data = [];
|
|
12090
|
-
|
|
12091
|
-
console.log("structure", parsedData);
|
|
12092
|
-
|
|
12132
|
+
|
|
12093
12133
|
if(Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])){
|
|
12094
12134
|
if(this.table.options.autoColumns){
|
|
12095
12135
|
data = this.structureArrayToObject(parsedData);
|
|
@@ -12449,7 +12489,7 @@ class Interaction extends Module{
|
|
|
12449
12489
|
|
|
12450
12490
|
if(component instanceof Cell){
|
|
12451
12491
|
callback = component.column.definition[action];
|
|
12452
|
-
}else if(component instanceof Column
|
|
12492
|
+
}else if(component instanceof Column){
|
|
12453
12493
|
callback = component.definition[action];
|
|
12454
12494
|
}
|
|
12455
12495
|
|
|
@@ -14338,10 +14378,13 @@ class Page extends Module{
|
|
|
14338
14378
|
initialize(){
|
|
14339
14379
|
if(this.table.options.pagination){
|
|
14340
14380
|
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
14341
|
-
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
14342
14381
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
14343
14382
|
this.subscribe("data-processed", this.initialLoadComplete.bind(this));
|
|
14344
14383
|
this.subscribe("table-built", this.calculatePageSizes.bind(this));
|
|
14384
|
+
|
|
14385
|
+
if(this.table.options.paginationAddRow == "page"){
|
|
14386
|
+
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
14387
|
+
}
|
|
14345
14388
|
|
|
14346
14389
|
if(this.table.options.paginationMode === "remote"){
|
|
14347
14390
|
this.subscribe("data-params", this.remotePageParams.bind(this));
|
|
@@ -15095,9 +15138,11 @@ class Page extends Module{
|
|
|
15095
15138
|
margin = this.table.options.progressiveLoadScrollMargin || (this.table.rowManager.element.clientHeight * 2);
|
|
15096
15139
|
|
|
15097
15140
|
if(this.table.rowManager.element.scrollHeight <= (this.table.rowManager.element.clientHeight + margin)){
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15141
|
+
if(this.page < this.max){
|
|
15142
|
+
setTimeout(() => {
|
|
15143
|
+
this.nextPage();
|
|
15144
|
+
});
|
|
15145
|
+
}
|
|
15101
15146
|
}
|
|
15102
15147
|
break;
|
|
15103
15148
|
}
|
|
@@ -15153,12 +15198,12 @@ var defaultReaders = {
|
|
|
15153
15198
|
|
|
15154
15199
|
//if cookie exists, decode and load column data into tabulator
|
|
15155
15200
|
if(cookiePos > -1){
|
|
15156
|
-
cookie = cookie.
|
|
15201
|
+
cookie = cookie.slice(cookiePos);
|
|
15157
15202
|
|
|
15158
15203
|
end = cookie.indexOf(";");
|
|
15159
15204
|
|
|
15160
15205
|
if(end > -1){
|
|
15161
|
-
cookie = cookie.
|
|
15206
|
+
cookie = cookie.slice(0, end);
|
|
15162
15207
|
}
|
|
15163
15208
|
|
|
15164
15209
|
data = cookie.replace(key + "=", "");
|
|
@@ -15310,11 +15355,11 @@ class Persistence extends Module{
|
|
|
15310
15355
|
this.subscribe("column-show", this.save.bind(this, "columns"));
|
|
15311
15356
|
this.subscribe("column-hide", this.save.bind(this, "columns"));
|
|
15312
15357
|
this.subscribe("column-moved", this.save.bind(this, "columns"));
|
|
15313
|
-
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
15314
15358
|
}
|
|
15315
15359
|
|
|
15316
|
-
this.subscribe("table-
|
|
15360
|
+
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
15317
15361
|
|
|
15362
|
+
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
15318
15363
|
|
|
15319
15364
|
this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
|
|
15320
15365
|
this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
|
|
@@ -15342,7 +15387,7 @@ class Persistence extends Module{
|
|
|
15342
15387
|
sorters = this.load("sort");
|
|
15343
15388
|
|
|
15344
15389
|
if(!sorters === false){
|
|
15345
|
-
this.table.initialSort = sorters;
|
|
15390
|
+
this.table.options.initialSort = sorters;
|
|
15346
15391
|
}
|
|
15347
15392
|
}
|
|
15348
15393
|
|
|
@@ -15350,7 +15395,7 @@ class Persistence extends Module{
|
|
|
15350
15395
|
filters = this.load("filter");
|
|
15351
15396
|
|
|
15352
15397
|
if(!filters === false){
|
|
15353
|
-
this.table.initialFilter = filters;
|
|
15398
|
+
this.table.options.initialFilter = filters;
|
|
15354
15399
|
}
|
|
15355
15400
|
}
|
|
15356
15401
|
}
|
|
@@ -15627,6 +15672,8 @@ class Persistence extends Module{
|
|
|
15627
15672
|
|
|
15628
15673
|
Persistence.moduleName = "persistence";
|
|
15629
15674
|
|
|
15675
|
+
Persistence.moduleInitOrder = 1;
|
|
15676
|
+
|
|
15630
15677
|
//load defaults
|
|
15631
15678
|
Persistence.readers = defaultReaders;
|
|
15632
15679
|
Persistence.writers = defaultWriters;
|
|
@@ -16093,186 +16140,196 @@ class ReactiveData extends Module{
|
|
|
16093
16140
|
ReactiveData.moduleName = "reactiveData";
|
|
16094
16141
|
|
|
16095
16142
|
class ResizeColumns extends Module{
|
|
16096
|
-
|
|
16143
|
+
|
|
16097
16144
|
constructor(table){
|
|
16098
16145
|
super(table);
|
|
16099
|
-
|
|
16146
|
+
|
|
16100
16147
|
this.startColumn = false;
|
|
16101
16148
|
this.startX = false;
|
|
16102
16149
|
this.startWidth = false;
|
|
16103
16150
|
this.handle = null;
|
|
16104
16151
|
this.prevHandle = null;
|
|
16105
|
-
|
|
16152
|
+
|
|
16106
16153
|
this.registerColumnOption("resizable", true);
|
|
16107
16154
|
}
|
|
16108
|
-
|
|
16155
|
+
|
|
16109
16156
|
initialize(){
|
|
16110
16157
|
// if(this.table.options.resizableColumns){
|
|
16111
|
-
|
|
16112
|
-
|
|
16158
|
+
this.subscribe("cell-layout", this.layoutCellHandles.bind(this));
|
|
16159
|
+
this.subscribe("column-init", this.layoutColumnHeader.bind(this));
|
|
16113
16160
|
// }
|
|
16114
16161
|
}
|
|
16115
|
-
|
|
16162
|
+
|
|
16116
16163
|
layoutCellHandles(cell){
|
|
16117
16164
|
if(cell.row.type === "row"){
|
|
16118
16165
|
this.initializeColumn("cell", cell.column, cell.element);
|
|
16119
16166
|
}
|
|
16120
16167
|
}
|
|
16121
|
-
|
|
16168
|
+
|
|
16122
16169
|
layoutColumnHeader(column){
|
|
16123
16170
|
this.initializeColumn("header", column, column.element);
|
|
16124
16171
|
}
|
|
16125
|
-
|
|
16172
|
+
|
|
16126
16173
|
initializeColumn(type, column, element){
|
|
16127
16174
|
var self = this,
|
|
16128
16175
|
variableHeight = false,
|
|
16129
16176
|
mode = column.definition.resizable;
|
|
16130
|
-
|
|
16177
|
+
|
|
16131
16178
|
//set column resize mode
|
|
16132
16179
|
if(type === "header"){
|
|
16133
16180
|
variableHeight = column.definition.formatter == "textarea" || column.definition.variableHeight;
|
|
16134
16181
|
column.modules.resize = {variableHeight:variableHeight};
|
|
16135
16182
|
}
|
|
16136
|
-
|
|
16183
|
+
|
|
16137
16184
|
if(mode === true || mode == type){
|
|
16138
|
-
|
|
16185
|
+
|
|
16139
16186
|
var handle = document.createElement('div');
|
|
16140
16187
|
handle.className = "tabulator-col-resize-handle";
|
|
16141
|
-
|
|
16142
|
-
|
|
16188
|
+
|
|
16189
|
+
|
|
16143
16190
|
var prevHandle = document.createElement('div');
|
|
16144
16191
|
prevHandle.className = "tabulator-col-resize-handle prev";
|
|
16145
|
-
|
|
16192
|
+
|
|
16146
16193
|
handle.addEventListener("click", function(e){
|
|
16147
16194
|
e.stopPropagation();
|
|
16148
16195
|
});
|
|
16149
|
-
|
|
16196
|
+
|
|
16150
16197
|
var handleDown = function(e){
|
|
16151
16198
|
var nearestColumn = column.getLastColumn();
|
|
16152
|
-
|
|
16199
|
+
|
|
16153
16200
|
if(nearestColumn && self._checkResizability(nearestColumn)){
|
|
16154
16201
|
self.startColumn = column;
|
|
16155
16202
|
self._mouseDown(e, nearestColumn, handle);
|
|
16156
16203
|
}
|
|
16157
16204
|
};
|
|
16158
|
-
|
|
16205
|
+
|
|
16159
16206
|
handle.addEventListener("mousedown", handleDown);
|
|
16160
16207
|
handle.addEventListener("touchstart", handleDown, {passive: true});
|
|
16161
|
-
|
|
16208
|
+
|
|
16162
16209
|
//reszie column on double click
|
|
16163
16210
|
handle.addEventListener("dblclick", function(e){
|
|
16164
|
-
var col = column.getLastColumn()
|
|
16165
|
-
|
|
16211
|
+
var col = column.getLastColumn(),
|
|
16212
|
+
oldWidth;
|
|
16213
|
+
|
|
16166
16214
|
if(col && self._checkResizability(col)){
|
|
16215
|
+
oldWidth = col.getWidth();
|
|
16216
|
+
|
|
16167
16217
|
e.stopPropagation();
|
|
16168
16218
|
col.reinitializeWidth(true);
|
|
16219
|
+
|
|
16220
|
+
if(oldWidth !== col.getWidth()){
|
|
16221
|
+
self.dispatch("column-resized", col);
|
|
16222
|
+
self.table.externalEvents.dispatch("columnResized", col.getComponent());
|
|
16223
|
+
}
|
|
16169
16224
|
}
|
|
16170
16225
|
});
|
|
16171
|
-
|
|
16172
|
-
|
|
16226
|
+
|
|
16227
|
+
|
|
16173
16228
|
prevHandle.addEventListener("click", function(e){
|
|
16174
16229
|
e.stopPropagation();
|
|
16175
16230
|
});
|
|
16176
|
-
|
|
16231
|
+
|
|
16177
16232
|
var prevHandleDown = function(e){
|
|
16178
16233
|
var nearestColumn, colIndex, prevColumn;
|
|
16179
|
-
|
|
16234
|
+
|
|
16180
16235
|
nearestColumn = column.getFirstColumn();
|
|
16181
|
-
|
|
16236
|
+
|
|
16182
16237
|
if(nearestColumn){
|
|
16183
16238
|
colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
|
|
16184
16239
|
prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
|
|
16185
|
-
|
|
16240
|
+
|
|
16186
16241
|
if(prevColumn && self._checkResizability(prevColumn)){
|
|
16187
16242
|
self.startColumn = column;
|
|
16188
16243
|
self._mouseDown(e, prevColumn, prevHandle);
|
|
16189
16244
|
}
|
|
16190
16245
|
}
|
|
16191
16246
|
};
|
|
16192
|
-
|
|
16247
|
+
|
|
16193
16248
|
prevHandle.addEventListener("mousedown", prevHandleDown);
|
|
16194
16249
|
prevHandle.addEventListener("touchstart", prevHandleDown, {passive: true});
|
|
16195
|
-
|
|
16250
|
+
|
|
16196
16251
|
//resize column on double click
|
|
16197
16252
|
prevHandle.addEventListener("dblclick", function(e){
|
|
16198
16253
|
var nearestColumn, colIndex, prevColumn;
|
|
16199
|
-
|
|
16254
|
+
|
|
16200
16255
|
nearestColumn = column.getFirstColumn();
|
|
16201
|
-
|
|
16256
|
+
|
|
16202
16257
|
if(nearestColumn){
|
|
16203
16258
|
colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
|
|
16204
16259
|
prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
|
|
16205
|
-
|
|
16260
|
+
|
|
16206
16261
|
if(prevColumn && self._checkResizability(prevColumn)){
|
|
16207
16262
|
e.stopPropagation();
|
|
16208
16263
|
prevColumn.reinitializeWidth(true);
|
|
16209
16264
|
}
|
|
16210
16265
|
}
|
|
16211
16266
|
});
|
|
16212
|
-
|
|
16267
|
+
|
|
16213
16268
|
element.appendChild(handle);
|
|
16214
16269
|
element.appendChild(prevHandle);
|
|
16215
16270
|
}
|
|
16216
16271
|
}
|
|
16217
|
-
|
|
16272
|
+
|
|
16218
16273
|
_checkResizability(column){
|
|
16219
16274
|
return column.definition.resizable;
|
|
16220
16275
|
}
|
|
16221
|
-
|
|
16276
|
+
|
|
16222
16277
|
_mouseDown(e, column, handle){
|
|
16223
16278
|
var self = this;
|
|
16224
|
-
|
|
16279
|
+
|
|
16225
16280
|
self.table.element.classList.add("tabulator-block-select");
|
|
16226
16281
|
|
|
16227
16282
|
function mouseMove(e){
|
|
16228
16283
|
// self.table.columnManager.tempScrollBlock();
|
|
16229
|
-
|
|
16284
|
+
|
|
16230
16285
|
if(self.table.rtl){
|
|
16231
16286
|
column.setWidth(self.startWidth - ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
|
|
16232
16287
|
}else {
|
|
16233
16288
|
column.setWidth(self.startWidth + ((typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX) - self.startX));
|
|
16234
16289
|
}
|
|
16235
|
-
|
|
16290
|
+
|
|
16236
16291
|
self.table.columnManager.renderer.rerenderColumns(true);
|
|
16237
|
-
|
|
16292
|
+
|
|
16238
16293
|
if(!self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
|
|
16239
16294
|
column.checkCellHeights();
|
|
16240
16295
|
}
|
|
16241
16296
|
}
|
|
16242
|
-
|
|
16297
|
+
|
|
16243
16298
|
function mouseUp(e){
|
|
16244
|
-
|
|
16299
|
+
|
|
16245
16300
|
//block editor from taking action while resizing is taking place
|
|
16246
16301
|
if(self.startColumn.modules.edit){
|
|
16247
16302
|
self.startColumn.modules.edit.blocked = false;
|
|
16248
16303
|
}
|
|
16249
|
-
|
|
16304
|
+
|
|
16250
16305
|
if(self.table.browserSlow && column.modules.resize && column.modules.resize.variableHeight){
|
|
16251
16306
|
column.checkCellHeights();
|
|
16252
16307
|
}
|
|
16253
|
-
|
|
16308
|
+
|
|
16254
16309
|
document.body.removeEventListener("mouseup", mouseUp);
|
|
16255
16310
|
document.body.removeEventListener("mousemove", mouseMove);
|
|
16256
|
-
|
|
16311
|
+
|
|
16257
16312
|
handle.removeEventListener("touchmove", mouseMove);
|
|
16258
16313
|
handle.removeEventListener("touchend", mouseUp);
|
|
16259
|
-
|
|
16314
|
+
|
|
16260
16315
|
self.table.element.classList.remove("tabulator-block-select");
|
|
16261
16316
|
|
|
16262
|
-
self.
|
|
16263
|
-
|
|
16317
|
+
if(self.startWidth !== column.getWidth()){
|
|
16318
|
+
self.dispatch("column-resized", column);
|
|
16319
|
+
self.table.externalEvents.dispatch("columnResized", column.getComponent());
|
|
16320
|
+
}
|
|
16264
16321
|
}
|
|
16265
|
-
|
|
16322
|
+
|
|
16266
16323
|
e.stopPropagation(); //prevent resize from interfereing with movable columns
|
|
16267
|
-
|
|
16324
|
+
|
|
16268
16325
|
//block editor from taking action while resizing is taking place
|
|
16269
16326
|
if(self.startColumn.modules.edit){
|
|
16270
16327
|
self.startColumn.modules.edit.blocked = true;
|
|
16271
16328
|
}
|
|
16272
|
-
|
|
16329
|
+
|
|
16273
16330
|
self.startX = typeof e.screenX === "undefined" ? e.touches[0].screenX : e.screenX;
|
|
16274
16331
|
self.startWidth = column.getWidth();
|
|
16275
|
-
|
|
16332
|
+
|
|
16276
16333
|
document.body.addEventListener("mousemove", mouseMove);
|
|
16277
16334
|
document.body.addEventListener("mouseup", mouseUp);
|
|
16278
16335
|
handle.addEventListener("touchmove", mouseMove, {passive: true});
|
|
@@ -16577,14 +16634,14 @@ class ResponsiveLayout extends Module{
|
|
|
16577
16634
|
this.hiddenColumns = [];
|
|
16578
16635
|
|
|
16579
16636
|
//determine level of responsivity for each column
|
|
16580
|
-
this.table.columnManager.columnsByIndex.forEach(
|
|
16637
|
+
this.table.columnManager.columnsByIndex.forEach((column, i) => {
|
|
16581
16638
|
if(column.modules.responsive){
|
|
16582
16639
|
if(column.modules.responsive.order && column.modules.responsive.visible){
|
|
16583
16640
|
column.modules.responsive.index = i;
|
|
16584
16641
|
columns.push(column);
|
|
16585
16642
|
|
|
16586
|
-
if(!column.visible &&
|
|
16587
|
-
|
|
16643
|
+
if(!column.visible && this.mode === "collapse"){
|
|
16644
|
+
this.hiddenColumns.push(column);
|
|
16588
16645
|
}
|
|
16589
16646
|
}
|
|
16590
16647
|
}
|
|
@@ -16592,7 +16649,7 @@ class ResponsiveLayout extends Module{
|
|
|
16592
16649
|
|
|
16593
16650
|
//sort list by responsivity
|
|
16594
16651
|
columns = columns.reverse();
|
|
16595
|
-
columns = columns.sort(
|
|
16652
|
+
columns = columns.sort((a, b) => {
|
|
16596
16653
|
var diff = b.modules.responsive.order - a.modules.responsive.order;
|
|
16597
16654
|
return diff || (b.modules.responsive.index - a.modules.responsive.index);
|
|
16598
16655
|
});
|
|
@@ -16838,7 +16895,7 @@ class ResponsiveLayout extends Module{
|
|
|
16838
16895
|
var titleHighlight = document.createElement("strong");
|
|
16839
16896
|
titleData.appendChild(titleHighlight);
|
|
16840
16897
|
this.langBind("columns|" + item.field, function(text){
|
|
16841
|
-
titleHighlight.
|
|
16898
|
+
titleHighlight.innerHTML = text || item.title;
|
|
16842
16899
|
});
|
|
16843
16900
|
|
|
16844
16901
|
if(item.value instanceof Node){
|
|
@@ -16861,179 +16918,130 @@ class ResponsiveLayout extends Module{
|
|
|
16861
16918
|
ResponsiveLayout.moduleName = "responsiveLayout";
|
|
16862
16919
|
|
|
16863
16920
|
class SelectRow extends Module{
|
|
16864
|
-
|
|
16921
|
+
|
|
16865
16922
|
constructor(table){
|
|
16866
16923
|
super(table);
|
|
16867
|
-
|
|
16924
|
+
|
|
16868
16925
|
this.selecting = false; //flag selecting in progress
|
|
16869
16926
|
this.lastClickedRow = false; //last clicked row
|
|
16870
16927
|
this.selectPrev = []; //hold previously selected element for drag drop selection
|
|
16871
16928
|
this.selectedRows = []; //hold selected rows
|
|
16872
16929
|
this.headerCheckboxElement = null; // hold header select element
|
|
16873
|
-
|
|
16930
|
+
|
|
16874
16931
|
this.registerTableOption("selectable", "highlight"); //highlight rows on hover
|
|
16875
16932
|
this.registerTableOption("selectableRangeMode", "drag"); //highlight rows on hover
|
|
16876
16933
|
this.registerTableOption("selectableRollingSelection", true); //roll selection once maximum number of selectable rows is reached
|
|
16877
16934
|
this.registerTableOption("selectablePersistence", true); // maintain selection when table view is updated
|
|
16878
16935
|
this.registerTableOption("selectableCheck", function(data, row){return true;}); //check wheather row is selectable
|
|
16879
|
-
|
|
16936
|
+
|
|
16880
16937
|
this.registerTableFunction("selectRow", this.selectRows.bind(this));
|
|
16881
16938
|
this.registerTableFunction("deselectRow", this.deselectRows.bind(this));
|
|
16882
16939
|
this.registerTableFunction("toggleSelectRow", this.toggleRow.bind(this));
|
|
16883
16940
|
this.registerTableFunction("getSelectedRows", this.getSelectedRows.bind(this));
|
|
16884
16941
|
this.registerTableFunction("getSelectedData", this.getSelectedData.bind(this));
|
|
16885
|
-
|
|
16942
|
+
|
|
16886
16943
|
//register component functions
|
|
16887
16944
|
this.registerComponentFunction("row", "select", this.selectRows.bind(this));
|
|
16888
16945
|
this.registerComponentFunction("row", "deselect", this.deselectRows.bind(this));
|
|
16889
16946
|
this.registerComponentFunction("row", "toggleSelect", this.toggleRow.bind(this));
|
|
16890
16947
|
this.registerComponentFunction("row", "isSelected", this.isRowSelected.bind(this));
|
|
16891
16948
|
}
|
|
16892
|
-
|
|
16949
|
+
|
|
16893
16950
|
initialize(){
|
|
16894
16951
|
if(this.table.options.selectable !== false){
|
|
16895
16952
|
this.subscribe("row-init", this.initializeRow.bind(this));
|
|
16896
16953
|
this.subscribe("row-deleting", this.rowDeleted.bind(this));
|
|
16897
16954
|
this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
|
|
16898
16955
|
this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
|
|
16899
|
-
|
|
16956
|
+
|
|
16900
16957
|
if(this.table.options.selectable && !this.table.options.selectablePersistence){
|
|
16901
|
-
this.subscribe("data-
|
|
16958
|
+
this.subscribe("data-refreshing", this.deselectRows.bind(this));
|
|
16902
16959
|
}
|
|
16903
16960
|
}
|
|
16904
16961
|
}
|
|
16905
|
-
|
|
16962
|
+
|
|
16906
16963
|
rowRetrieve(type, prevValue){
|
|
16907
16964
|
return type === "selected" ? this.selectedRows : prevValue;
|
|
16908
16965
|
}
|
|
16909
|
-
|
|
16966
|
+
|
|
16910
16967
|
rowDeleted(row){
|
|
16911
16968
|
this._deselectRow(row, true);
|
|
16912
16969
|
}
|
|
16913
|
-
|
|
16970
|
+
|
|
16914
16971
|
clearSelectionData(silent){
|
|
16915
16972
|
this.selecting = false;
|
|
16916
16973
|
this.lastClickedRow = false;
|
|
16917
16974
|
this.selectPrev = [];
|
|
16918
16975
|
this.selectedRows = [];
|
|
16919
|
-
|
|
16976
|
+
|
|
16920
16977
|
if(silent !== true){
|
|
16921
16978
|
this._rowSelectionChanged();
|
|
16922
16979
|
}
|
|
16923
16980
|
}
|
|
16924
|
-
|
|
16981
|
+
|
|
16925
16982
|
initializeRow(row){
|
|
16926
16983
|
var self = this,
|
|
16927
16984
|
element = row.getElement();
|
|
16928
|
-
|
|
16985
|
+
|
|
16929
16986
|
// trigger end of row selection
|
|
16930
16987
|
var endSelect = function(){
|
|
16931
|
-
|
|
16988
|
+
|
|
16932
16989
|
setTimeout(function(){
|
|
16933
16990
|
self.selecting = false;
|
|
16934
16991
|
}, 50);
|
|
16935
|
-
|
|
16992
|
+
|
|
16936
16993
|
document.body.removeEventListener("mouseup", endSelect);
|
|
16937
16994
|
};
|
|
16938
|
-
|
|
16995
|
+
|
|
16939
16996
|
row.modules.select = {selected:false};
|
|
16940
|
-
|
|
16997
|
+
|
|
16941
16998
|
//set row selection class
|
|
16942
16999
|
if(self.table.options.selectableCheck.call(this.table, row.getComponent())){
|
|
16943
17000
|
element.classList.add("tabulator-selectable");
|
|
16944
17001
|
element.classList.remove("tabulator-unselectable");
|
|
16945
|
-
|
|
17002
|
+
|
|
16946
17003
|
if(self.table.options.selectable && self.table.options.selectable != "highlight"){
|
|
16947
17004
|
if(self.table.options.selectableRangeMode === "click"){
|
|
16948
|
-
element.addEventListener("click",
|
|
16949
|
-
if(e.shiftKey){
|
|
16950
|
-
self.table._clearSelection();
|
|
16951
|
-
self.lastClickedRow = self.lastClickedRow || row;
|
|
16952
|
-
|
|
16953
|
-
var lastClickedRowIdx = self.table.rowManager.getDisplayRowIndex(self.lastClickedRow);
|
|
16954
|
-
var rowIdx = self.table.rowManager.getDisplayRowIndex(row);
|
|
16955
|
-
|
|
16956
|
-
var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
16957
|
-
var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
16958
|
-
|
|
16959
|
-
var rows = self.table.rowManager.getDisplayRows().slice(0);
|
|
16960
|
-
var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
|
|
16961
|
-
|
|
16962
|
-
if(e.ctrlKey || e.metaKey){
|
|
16963
|
-
toggledRows.forEach(function(toggledRow){
|
|
16964
|
-
if(toggledRow !== self.lastClickedRow){
|
|
16965
|
-
|
|
16966
|
-
if(self.table.options.selectable !== true && !self.isRowSelected(row)){
|
|
16967
|
-
if(self.selectedRows.length < self.table.options.selectable){
|
|
16968
|
-
self.toggleRow(toggledRow);
|
|
16969
|
-
}
|
|
16970
|
-
}else {
|
|
16971
|
-
self.toggleRow(toggledRow);
|
|
16972
|
-
}
|
|
16973
|
-
}
|
|
16974
|
-
});
|
|
16975
|
-
self.lastClickedRow = row;
|
|
16976
|
-
}else {
|
|
16977
|
-
self.deselectRows(undefined, true);
|
|
16978
|
-
|
|
16979
|
-
if(self.table.options.selectable !== true){
|
|
16980
|
-
if(toggledRows.length > self.table.options.selectable){
|
|
16981
|
-
toggledRows = toggledRows.slice(0, self.table.options.selectable);
|
|
16982
|
-
}
|
|
16983
|
-
}
|
|
16984
|
-
|
|
16985
|
-
self.selectRows(toggledRows);
|
|
16986
|
-
}
|
|
16987
|
-
self.table._clearSelection();
|
|
16988
|
-
}
|
|
16989
|
-
else if(e.ctrlKey || e.metaKey){
|
|
16990
|
-
self.toggleRow(row);
|
|
16991
|
-
self.lastClickedRow = row;
|
|
16992
|
-
}else {
|
|
16993
|
-
self.deselectRows(undefined, true);
|
|
16994
|
-
self.selectRows(row);
|
|
16995
|
-
self.lastClickedRow = row;
|
|
16996
|
-
}
|
|
16997
|
-
});
|
|
17005
|
+
element.addEventListener("click", this.handleComplexRowClick.bind(this, row));
|
|
16998
17006
|
}else {
|
|
16999
17007
|
element.addEventListener("click", function(e){
|
|
17000
17008
|
if(!self.table.modExists("edit") || !self.table.modules.edit.getCurrentCell()){
|
|
17001
17009
|
self.table._clearSelection();
|
|
17002
17010
|
}
|
|
17003
|
-
|
|
17011
|
+
|
|
17004
17012
|
if(!self.selecting){
|
|
17005
17013
|
self.toggleRow(row);
|
|
17006
17014
|
}
|
|
17007
17015
|
});
|
|
17008
|
-
|
|
17016
|
+
|
|
17009
17017
|
element.addEventListener("mousedown", function(e){
|
|
17010
17018
|
if(e.shiftKey){
|
|
17011
17019
|
self.table._clearSelection();
|
|
17012
|
-
|
|
17020
|
+
|
|
17013
17021
|
self.selecting = true;
|
|
17014
|
-
|
|
17022
|
+
|
|
17015
17023
|
self.selectPrev = [];
|
|
17016
|
-
|
|
17024
|
+
|
|
17017
17025
|
document.body.addEventListener("mouseup", endSelect);
|
|
17018
17026
|
document.body.addEventListener("keyup", endSelect);
|
|
17019
|
-
|
|
17027
|
+
|
|
17020
17028
|
self.toggleRow(row);
|
|
17021
|
-
|
|
17029
|
+
|
|
17022
17030
|
return false;
|
|
17023
17031
|
}
|
|
17024
17032
|
});
|
|
17025
|
-
|
|
17033
|
+
|
|
17026
17034
|
element.addEventListener("mouseenter", function(e){
|
|
17027
17035
|
if(self.selecting){
|
|
17028
17036
|
self.table._clearSelection();
|
|
17029
17037
|
self.toggleRow(row);
|
|
17030
|
-
|
|
17038
|
+
|
|
17031
17039
|
if(self.selectPrev[1] == row){
|
|
17032
17040
|
self.toggleRow(self.selectPrev[0]);
|
|
17033
17041
|
}
|
|
17034
17042
|
}
|
|
17035
17043
|
});
|
|
17036
|
-
|
|
17044
|
+
|
|
17037
17045
|
element.addEventListener("mouseout", function(e){
|
|
17038
17046
|
if(self.selecting){
|
|
17039
17047
|
self.table._clearSelection();
|
|
@@ -17042,41 +17050,92 @@ class SelectRow extends Module{
|
|
|
17042
17050
|
});
|
|
17043
17051
|
}
|
|
17044
17052
|
}
|
|
17045
|
-
|
|
17053
|
+
|
|
17046
17054
|
}else {
|
|
17047
17055
|
element.classList.add("tabulator-unselectable");
|
|
17048
17056
|
element.classList.remove("tabulator-selectable");
|
|
17049
17057
|
}
|
|
17050
17058
|
}
|
|
17051
|
-
|
|
17052
|
-
|
|
17053
|
-
|
|
17054
|
-
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17059
|
+
|
|
17060
|
+
handleComplexRowClick(row, e){
|
|
17061
|
+
if(e.shiftKey){
|
|
17062
|
+
this.table._clearSelection();
|
|
17063
|
+
this.lastClickedRow = this.lastClickedRow || row;
|
|
17064
|
+
|
|
17065
|
+
var lastClickedRowIdx = this.table.rowManager.getDisplayRowIndex(this.lastClickedRow);
|
|
17066
|
+
var rowIdx = this.table.rowManager.getDisplayRowIndex(row);
|
|
17067
|
+
|
|
17068
|
+
var fromRowIdx = lastClickedRowIdx <= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
17069
|
+
var toRowIdx = lastClickedRowIdx >= rowIdx ? lastClickedRowIdx : rowIdx;
|
|
17070
|
+
|
|
17071
|
+
var rows = this.table.rowManager.getDisplayRows().slice(0);
|
|
17072
|
+
var toggledRows = rows.splice(fromRowIdx, toRowIdx - fromRowIdx + 1);
|
|
17073
|
+
|
|
17074
|
+
if(e.ctrlKey || e.metaKey){
|
|
17075
|
+
toggledRows.forEach((toggledRow)=>{
|
|
17076
|
+
if(toggledRow !== this.lastClickedRow){
|
|
17077
|
+
|
|
17078
|
+
if(this.table.options.selectable !== true && !this.isRowSelected(row)){
|
|
17079
|
+
if(this.selectedRows.length < this.table.options.selectable){
|
|
17080
|
+
this.toggleRow(toggledRow);
|
|
17081
|
+
}
|
|
17082
|
+
}else {
|
|
17083
|
+
this.toggleRow(toggledRow);
|
|
17084
|
+
}
|
|
17085
|
+
}
|
|
17086
|
+
});
|
|
17087
|
+
this.lastClickedRow = row;
|
|
17088
|
+
}else {
|
|
17089
|
+
this.deselectRows(undefined, true);
|
|
17090
|
+
|
|
17091
|
+
if(this.table.options.selectable !== true){
|
|
17092
|
+
if(toggledRows.length > this.table.options.selectable){
|
|
17093
|
+
toggledRows = toggledRows.slice(0, this.table.options.selectable);
|
|
17094
|
+
}
|
|
17095
|
+
}
|
|
17096
|
+
|
|
17097
|
+
this.selectRows(toggledRows);
|
|
17098
|
+
}
|
|
17099
|
+
this.table._clearSelection();
|
|
17100
|
+
}
|
|
17101
|
+
else if(e.ctrlKey || e.metaKey){
|
|
17102
|
+
this.toggleRow(row);
|
|
17103
|
+
this.lastClickedRow = row;
|
|
17104
|
+
}else {
|
|
17105
|
+
this.deselectRows(undefined, true);
|
|
17106
|
+
this.selectRows(row);
|
|
17107
|
+
this.lastClickedRow = row;
|
|
17108
|
+
}
|
|
17109
|
+
}
|
|
17110
|
+
|
|
17111
|
+
//toggle row selection
|
|
17112
|
+
toggleRow(row){
|
|
17113
|
+
if(this.table.options.selectableCheck.call(this.table, row.getComponent())){
|
|
17114
|
+
if(row.modules.select && row.modules.select.selected){
|
|
17115
|
+
this._deselectRow(row);
|
|
17116
|
+
}else {
|
|
17117
|
+
this._selectRow(row);
|
|
17118
|
+
}
|
|
17119
|
+
}
|
|
17120
|
+
}
|
|
17121
|
+
|
|
17122
|
+
//select a number of rows
|
|
17123
|
+
selectRows(rows){
|
|
17124
|
+
var rowMatch;
|
|
17125
|
+
|
|
17067
17126
|
switch(typeof rows){
|
|
17068
17127
|
case "undefined":
|
|
17069
17128
|
this.table.rowManager.rows.forEach((row) => {
|
|
17070
17129
|
this._selectRow(row, true, true);
|
|
17071
17130
|
});
|
|
17072
|
-
|
|
17131
|
+
|
|
17073
17132
|
this._rowSelectionChanged();
|
|
17074
17133
|
break;
|
|
17075
|
-
|
|
17134
|
+
|
|
17076
17135
|
case "string":
|
|
17077
|
-
|
|
17136
|
+
|
|
17078
17137
|
rowMatch = this.table.rowManager.findRow(rows);
|
|
17079
|
-
|
|
17138
|
+
|
|
17080
17139
|
if(rowMatch){
|
|
17081
17140
|
this._selectRow(rowMatch, true, true);
|
|
17082
17141
|
}else {
|
|
@@ -17084,16 +17143,16 @@ class SelectRow extends Module{
|
|
|
17084
17143
|
this._selectRow(row, true, true);
|
|
17085
17144
|
});
|
|
17086
17145
|
}
|
|
17087
|
-
|
|
17146
|
+
|
|
17088
17147
|
this._rowSelectionChanged();
|
|
17089
17148
|
break;
|
|
17090
|
-
|
|
17149
|
+
|
|
17091
17150
|
default:
|
|
17092
17151
|
if(Array.isArray(rows)){
|
|
17093
17152
|
rows.forEach((row) => {
|
|
17094
17153
|
this._selectRow(row, true, true);
|
|
17095
17154
|
});
|
|
17096
|
-
|
|
17155
|
+
|
|
17097
17156
|
this._rowSelectionChanged();
|
|
17098
17157
|
}else {
|
|
17099
17158
|
this._selectRow(rows, false, true);
|
|
@@ -17101,10 +17160,10 @@ class SelectRow extends Module{
|
|
|
17101
17160
|
break;
|
|
17102
17161
|
}
|
|
17103
17162
|
}
|
|
17104
|
-
|
|
17163
|
+
|
|
17105
17164
|
//select an individual row
|
|
17106
17165
|
_selectRow(rowInfo, silent, force){
|
|
17107
|
-
|
|
17166
|
+
|
|
17108
17167
|
//handle max row count
|
|
17109
17168
|
if(!isNaN(this.table.options.selectable) && this.table.options.selectable !== true && !force){
|
|
17110
17169
|
if(this.selectedRows.length >= this.table.options.selectable){
|
|
@@ -17115,29 +17174,29 @@ class SelectRow extends Module{
|
|
|
17115
17174
|
}
|
|
17116
17175
|
}
|
|
17117
17176
|
}
|
|
17118
|
-
|
|
17177
|
+
|
|
17119
17178
|
var row = this.table.rowManager.findRow(rowInfo);
|
|
17120
|
-
|
|
17179
|
+
|
|
17121
17180
|
if(row){
|
|
17122
17181
|
if(this.selectedRows.indexOf(row) == -1){
|
|
17123
17182
|
row.getElement().classList.add("tabulator-selected");
|
|
17124
17183
|
if(!row.modules.select){
|
|
17125
17184
|
row.modules.select = {};
|
|
17126
17185
|
}
|
|
17127
|
-
|
|
17186
|
+
|
|
17128
17187
|
row.modules.select.selected = true;
|
|
17129
17188
|
if(row.modules.select.checkboxEl){
|
|
17130
17189
|
row.modules.select.checkboxEl.checked = true;
|
|
17131
17190
|
}
|
|
17132
|
-
|
|
17191
|
+
|
|
17133
17192
|
this.selectedRows.push(row);
|
|
17134
|
-
|
|
17193
|
+
|
|
17135
17194
|
if(this.table.options.dataTreeSelectPropagate){
|
|
17136
17195
|
this.childRowSelection(row, true);
|
|
17137
17196
|
}
|
|
17138
|
-
|
|
17197
|
+
|
|
17139
17198
|
this.dispatchExternal("rowSelected", row.getComponent());
|
|
17140
|
-
|
|
17199
|
+
|
|
17141
17200
|
this._rowSelectionChanged(silent);
|
|
17142
17201
|
}
|
|
17143
17202
|
}else {
|
|
@@ -17146,69 +17205,69 @@ class SelectRow extends Module{
|
|
|
17146
17205
|
}
|
|
17147
17206
|
}
|
|
17148
17207
|
}
|
|
17149
|
-
|
|
17208
|
+
|
|
17150
17209
|
isRowSelected(row){
|
|
17151
17210
|
return this.selectedRows.indexOf(row) !== -1;
|
|
17152
17211
|
}
|
|
17153
|
-
|
|
17212
|
+
|
|
17154
17213
|
//deselect a number of rows
|
|
17155
17214
|
deselectRows(rows, silent){
|
|
17156
17215
|
var self = this,
|
|
17157
17216
|
rowCount;
|
|
17158
17217
|
|
|
17159
17218
|
if(typeof rows == "undefined"){
|
|
17160
|
-
|
|
17219
|
+
|
|
17161
17220
|
rowCount = self.selectedRows.length;
|
|
17162
|
-
|
|
17221
|
+
|
|
17163
17222
|
for(let i = 0; i < rowCount; i++){
|
|
17164
17223
|
self._deselectRow(self.selectedRows[0], true);
|
|
17165
17224
|
}
|
|
17166
|
-
|
|
17225
|
+
|
|
17167
17226
|
self._rowSelectionChanged(silent);
|
|
17168
|
-
|
|
17227
|
+
|
|
17169
17228
|
}else {
|
|
17170
17229
|
if(Array.isArray(rows)){
|
|
17171
17230
|
rows.forEach(function(row){
|
|
17172
17231
|
self._deselectRow(row, true);
|
|
17173
17232
|
});
|
|
17174
|
-
|
|
17233
|
+
|
|
17175
17234
|
self._rowSelectionChanged(silent);
|
|
17176
17235
|
}else {
|
|
17177
17236
|
self._deselectRow(rows, silent);
|
|
17178
17237
|
}
|
|
17179
17238
|
}
|
|
17180
17239
|
}
|
|
17181
|
-
|
|
17240
|
+
|
|
17182
17241
|
//deselect an individual row
|
|
17183
17242
|
_deselectRow(rowInfo, silent){
|
|
17184
17243
|
var self = this,
|
|
17185
17244
|
row = self.table.rowManager.findRow(rowInfo),
|
|
17186
17245
|
index;
|
|
17187
|
-
|
|
17246
|
+
|
|
17188
17247
|
if(row){
|
|
17189
17248
|
index = self.selectedRows.findIndex(function(selectedRow){
|
|
17190
17249
|
return selectedRow == row;
|
|
17191
17250
|
});
|
|
17192
|
-
|
|
17251
|
+
|
|
17193
17252
|
if(index > -1){
|
|
17194
|
-
|
|
17253
|
+
|
|
17195
17254
|
row.getElement().classList.remove("tabulator-selected");
|
|
17196
17255
|
if(!row.modules.select){
|
|
17197
17256
|
row.modules.select = {};
|
|
17198
17257
|
}
|
|
17199
|
-
|
|
17258
|
+
|
|
17200
17259
|
row.modules.select.selected = false;
|
|
17201
17260
|
if(row.modules.select.checkboxEl){
|
|
17202
17261
|
row.modules.select.checkboxEl.checked = false;
|
|
17203
17262
|
}
|
|
17204
17263
|
self.selectedRows.splice(index, 1);
|
|
17205
|
-
|
|
17264
|
+
|
|
17206
17265
|
if(this.table.options.dataTreeSelectPropagate){
|
|
17207
17266
|
this.childRowSelection(row, false);
|
|
17208
17267
|
}
|
|
17209
|
-
|
|
17268
|
+
|
|
17210
17269
|
this.dispatchExternal("rowDeselected", row.getComponent());
|
|
17211
|
-
|
|
17270
|
+
|
|
17212
17271
|
self._rowSelectionChanged(silent);
|
|
17213
17272
|
}
|
|
17214
17273
|
}else {
|
|
@@ -17217,28 +17276,28 @@ class SelectRow extends Module{
|
|
|
17217
17276
|
}
|
|
17218
17277
|
}
|
|
17219
17278
|
}
|
|
17220
|
-
|
|
17279
|
+
|
|
17221
17280
|
getSelectedData(){
|
|
17222
17281
|
var data = [];
|
|
17223
|
-
|
|
17282
|
+
|
|
17224
17283
|
this.selectedRows.forEach(function(row){
|
|
17225
17284
|
data.push(row.getData());
|
|
17226
17285
|
});
|
|
17227
|
-
|
|
17286
|
+
|
|
17228
17287
|
return data;
|
|
17229
17288
|
}
|
|
17230
|
-
|
|
17289
|
+
|
|
17231
17290
|
getSelectedRows(){
|
|
17232
|
-
|
|
17291
|
+
|
|
17233
17292
|
var rows = [];
|
|
17234
|
-
|
|
17293
|
+
|
|
17235
17294
|
this.selectedRows.forEach(function(row){
|
|
17236
17295
|
rows.push(row.getComponent());
|
|
17237
17296
|
});
|
|
17238
|
-
|
|
17297
|
+
|
|
17239
17298
|
return rows;
|
|
17240
17299
|
}
|
|
17241
|
-
|
|
17300
|
+
|
|
17242
17301
|
_rowSelectionChanged(silent){
|
|
17243
17302
|
if(this.headerCheckboxElement){
|
|
17244
17303
|
if(this.selectedRows.length === 0){
|
|
@@ -17252,27 +17311,27 @@ class SelectRow extends Module{
|
|
|
17252
17311
|
this.headerCheckboxElement.checked = false;
|
|
17253
17312
|
}
|
|
17254
17313
|
}
|
|
17255
|
-
|
|
17314
|
+
|
|
17256
17315
|
if(!silent){
|
|
17257
17316
|
this.dispatchExternal("rowSelectionChanged", this.getSelectedData(), this.getSelectedRows());
|
|
17258
17317
|
}
|
|
17259
17318
|
}
|
|
17260
|
-
|
|
17319
|
+
|
|
17261
17320
|
registerRowSelectCheckbox (row, element) {
|
|
17262
17321
|
if(!row._row.modules.select){
|
|
17263
17322
|
row._row.modules.select = {};
|
|
17264
17323
|
}
|
|
17265
|
-
|
|
17324
|
+
|
|
17266
17325
|
row._row.modules.select.checkboxEl = element;
|
|
17267
17326
|
}
|
|
17268
|
-
|
|
17327
|
+
|
|
17269
17328
|
registerHeaderSelectCheckbox (element) {
|
|
17270
17329
|
this.headerCheckboxElement = element;
|
|
17271
17330
|
}
|
|
17272
|
-
|
|
17331
|
+
|
|
17273
17332
|
childRowSelection(row, select){
|
|
17274
17333
|
var children = this.table.modules.dataTree.getChildren(row, true);
|
|
17275
|
-
|
|
17334
|
+
|
|
17276
17335
|
if(select){
|
|
17277
17336
|
for(let child of children){
|
|
17278
17337
|
this._selectRow(child, true);
|
|
@@ -19429,7 +19488,7 @@ class ColumnManager extends CoreFeature {
|
|
|
19429
19488
|
}
|
|
19430
19489
|
|
|
19431
19490
|
_addColumn(definition, before, nextToColumn){
|
|
19432
|
-
var column = new Column
|
|
19491
|
+
var column = new Column(definition, this),
|
|
19433
19492
|
colEl = column.getElement(),
|
|
19434
19493
|
index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
|
|
19435
19494
|
|
|
@@ -19505,7 +19564,7 @@ class ColumnManager extends CoreFeature {
|
|
|
19505
19564
|
findColumn(subject){
|
|
19506
19565
|
if(typeof subject == "object"){
|
|
19507
19566
|
|
|
19508
|
-
if(subject instanceof Column
|
|
19567
|
+
if(subject instanceof Column){
|
|
19509
19568
|
//subject is column element
|
|
19510
19569
|
return subject;
|
|
19511
19570
|
}else if(subject instanceof ColumnComponent){
|
|
@@ -20522,72 +20581,91 @@ class VirtualDomVertical extends Renderer{
|
|
|
20522
20581
|
}
|
|
20523
20582
|
|
|
20524
20583
|
class RowManager extends CoreFeature{
|
|
20525
|
-
|
|
20584
|
+
|
|
20526
20585
|
constructor(table){
|
|
20527
20586
|
super(table);
|
|
20528
|
-
|
|
20587
|
+
|
|
20529
20588
|
this.element = this.createHolderElement(); //containing element
|
|
20530
20589
|
this.tableElement = this.createTableElement(); //table element
|
|
20531
20590
|
this.heightFixer = this.createTableElement(); //table element
|
|
20532
|
-
|
|
20591
|
+
this.placeholder = null; //placeholder element
|
|
20592
|
+
this.placeholderContents = null; //placeholder element
|
|
20593
|
+
|
|
20533
20594
|
this.firstRender = false; //handle first render
|
|
20534
20595
|
this.renderMode = "virtual"; //current rendering mode
|
|
20535
20596
|
this.fixedHeight = false; //current rendering mode
|
|
20536
|
-
|
|
20597
|
+
|
|
20537
20598
|
this.rows = []; //hold row data objects
|
|
20538
20599
|
this.activeRowsPipeline = []; //hold calculation of active rows
|
|
20539
20600
|
this.activeRows = []; //rows currently available to on display in the table
|
|
20540
20601
|
this.activeRowsCount = 0; //count of active rows
|
|
20541
|
-
|
|
20602
|
+
|
|
20542
20603
|
this.displayRows = []; //rows currently on display in the table
|
|
20543
20604
|
this.displayRowsCount = 0; //count of display rows
|
|
20544
|
-
|
|
20605
|
+
|
|
20545
20606
|
this.scrollTop = 0;
|
|
20546
20607
|
this.scrollLeft = 0;
|
|
20547
|
-
|
|
20608
|
+
|
|
20548
20609
|
this.rowNumColumn = false; //hold column component for row number column
|
|
20549
|
-
|
|
20610
|
+
|
|
20550
20611
|
this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
|
|
20551
20612
|
this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
|
|
20552
20613
|
this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
|
|
20553
|
-
|
|
20614
|
+
|
|
20554
20615
|
this.dataPipeline = []; //hold data pipeline tasks
|
|
20555
20616
|
this.displayPipeline = []; //hold data display pipeline tasks
|
|
20556
|
-
|
|
20617
|
+
|
|
20557
20618
|
this.renderer = null;
|
|
20558
20619
|
}
|
|
20559
|
-
|
|
20620
|
+
|
|
20560
20621
|
//////////////// Setup Functions /////////////////
|
|
20561
|
-
|
|
20622
|
+
|
|
20562
20623
|
createHolderElement (){
|
|
20563
20624
|
var el = document.createElement("div");
|
|
20564
|
-
|
|
20625
|
+
|
|
20565
20626
|
el.classList.add("tabulator-tableholder");
|
|
20566
20627
|
el.setAttribute("tabindex", 0);
|
|
20567
20628
|
el.setAttribute("role", "rowgroup");
|
|
20568
|
-
|
|
20629
|
+
|
|
20569
20630
|
return el;
|
|
20570
20631
|
}
|
|
20571
|
-
|
|
20632
|
+
|
|
20572
20633
|
createTableElement (){
|
|
20573
20634
|
var el = document.createElement("div");
|
|
20574
|
-
|
|
20635
|
+
|
|
20575
20636
|
el.classList.add("tabulator-table");
|
|
20576
20637
|
el.setAttribute("role", "rowgroup");
|
|
20577
|
-
|
|
20638
|
+
|
|
20578
20639
|
return el;
|
|
20579
20640
|
}
|
|
20580
|
-
|
|
20641
|
+
|
|
20642
|
+
initializePlaceholder(){
|
|
20643
|
+
//configure placeholder element
|
|
20644
|
+
if(typeof this.table.options.placeholder == "string"){
|
|
20645
|
+
let el = document.createElement("div");
|
|
20646
|
+
el.classList.add("tabulator-placeholder");
|
|
20647
|
+
|
|
20648
|
+
let contents = document.createElement("div");
|
|
20649
|
+
contents.classList.add("tabulator-placeholder-contents");
|
|
20650
|
+
contents.innerHTML = this.table.options.placeholder;
|
|
20651
|
+
|
|
20652
|
+
el.appendChild(contents);
|
|
20653
|
+
|
|
20654
|
+
this.placeholderContents = contents;
|
|
20655
|
+
this.placeholder = el;
|
|
20656
|
+
}
|
|
20657
|
+
}
|
|
20658
|
+
|
|
20581
20659
|
//return containing element
|
|
20582
20660
|
getElement(){
|
|
20583
20661
|
return this.element;
|
|
20584
20662
|
}
|
|
20585
|
-
|
|
20663
|
+
|
|
20586
20664
|
//return table element
|
|
20587
20665
|
getTableElement(){
|
|
20588
20666
|
return this.tableElement;
|
|
20589
20667
|
}
|
|
20590
|
-
|
|
20668
|
+
|
|
20591
20669
|
//return position of row in table
|
|
20592
20670
|
getRowPosition(row, active){
|
|
20593
20671
|
if(active){
|
|
@@ -20596,42 +20674,45 @@ class RowManager extends CoreFeature{
|
|
|
20596
20674
|
return this.rows.indexOf(row);
|
|
20597
20675
|
}
|
|
20598
20676
|
}
|
|
20599
|
-
|
|
20677
|
+
|
|
20600
20678
|
initialize(){
|
|
20679
|
+
this.initializePlaceholder();
|
|
20601
20680
|
this.initializeRenderer();
|
|
20602
|
-
|
|
20681
|
+
|
|
20603
20682
|
//initialize manager
|
|
20604
20683
|
this.element.appendChild(this.tableElement);
|
|
20605
|
-
|
|
20684
|
+
|
|
20606
20685
|
this.firstRender = true;
|
|
20607
|
-
|
|
20686
|
+
|
|
20608
20687
|
//scroll header along with table body
|
|
20609
20688
|
this.element.addEventListener("scroll", () => {
|
|
20610
20689
|
var left = this.element.scrollLeft,
|
|
20611
20690
|
leftDir = this.scrollLeft > left,
|
|
20612
20691
|
top = this.element.scrollTop,
|
|
20613
20692
|
topDir = this.scrollTop > top;
|
|
20614
|
-
|
|
20693
|
+
|
|
20615
20694
|
//handle horizontal scrolling
|
|
20616
20695
|
if(this.scrollLeft != left){
|
|
20617
20696
|
this.scrollLeft = left;
|
|
20618
|
-
|
|
20697
|
+
|
|
20619
20698
|
this.dispatch("scroll-horizontal", left, leftDir);
|
|
20620
20699
|
this.dispatchExternal("scrollHorizontal", left, leftDir);
|
|
20621
|
-
}
|
|
20622
20700
|
|
|
20623
|
-
|
|
20701
|
+
this._positionPlaceholder();
|
|
20702
|
+
}
|
|
20703
|
+
|
|
20704
|
+
//handle vertical scrolling
|
|
20624
20705
|
if(this.scrollTop != top){
|
|
20625
20706
|
this.scrollTop = top;
|
|
20626
|
-
|
|
20707
|
+
|
|
20627
20708
|
this.renderer.scrollRows(top, topDir);
|
|
20628
|
-
|
|
20709
|
+
|
|
20629
20710
|
this.dispatch("scroll-vertical", top, topDir);
|
|
20630
20711
|
this.dispatchExternal("scrollVertical", top, topDir);
|
|
20631
20712
|
}
|
|
20632
20713
|
});
|
|
20633
20714
|
}
|
|
20634
|
-
|
|
20715
|
+
|
|
20635
20716
|
////////////////// Row Manipulation //////////////////
|
|
20636
20717
|
findRow(subject){
|
|
20637
20718
|
if(typeof subject == "object"){
|
|
@@ -20646,7 +20727,7 @@ class RowManager extends CoreFeature{
|
|
|
20646
20727
|
let match = this.rows.find((row) => {
|
|
20647
20728
|
return row.getElement() === subject;
|
|
20648
20729
|
});
|
|
20649
|
-
|
|
20730
|
+
|
|
20650
20731
|
return match || false;
|
|
20651
20732
|
}
|
|
20652
20733
|
}else if(typeof subject == "undefined" || subject === null){
|
|
@@ -20656,22 +20737,22 @@ class RowManager extends CoreFeature{
|
|
|
20656
20737
|
let match = this.rows.find((row) => {
|
|
20657
20738
|
return row.data[this.table.options.index] == subject;
|
|
20658
20739
|
});
|
|
20659
|
-
|
|
20740
|
+
|
|
20660
20741
|
return match || false;
|
|
20661
20742
|
}
|
|
20662
|
-
|
|
20743
|
+
|
|
20663
20744
|
//catch all for any other type of input
|
|
20664
20745
|
return false;
|
|
20665
20746
|
}
|
|
20666
|
-
|
|
20747
|
+
|
|
20667
20748
|
getRowFromDataObject(data){
|
|
20668
20749
|
var match = this.rows.find((row) => {
|
|
20669
20750
|
return row.data === data;
|
|
20670
20751
|
});
|
|
20671
|
-
|
|
20752
|
+
|
|
20672
20753
|
return match || false;
|
|
20673
20754
|
}
|
|
20674
|
-
|
|
20755
|
+
|
|
20675
20756
|
getRowFromPosition(position, active){
|
|
20676
20757
|
if(active){
|
|
20677
20758
|
return this.activeRows[position];
|
|
@@ -20679,11 +20760,11 @@ class RowManager extends CoreFeature{
|
|
|
20679
20760
|
return this.rows[position];
|
|
20680
20761
|
}
|
|
20681
20762
|
}
|
|
20682
|
-
|
|
20763
|
+
|
|
20683
20764
|
scrollToRow(row, position, ifVisible){
|
|
20684
20765
|
return this.renderer.scrollToRowPosition(row, position, ifVisible);
|
|
20685
20766
|
}
|
|
20686
|
-
|
|
20767
|
+
|
|
20687
20768
|
////////////////// Data Handling //////////////////
|
|
20688
20769
|
setData(data, renderInPosition, columnsChanged){
|
|
20689
20770
|
return new Promise((resolve, reject)=>{
|
|
@@ -20700,22 +20781,22 @@ class RowManager extends CoreFeature{
|
|
|
20700
20781
|
this.table.columnManager.generateColumnsFromRowData(data);
|
|
20701
20782
|
}
|
|
20702
20783
|
this.resetScroll();
|
|
20703
|
-
|
|
20784
|
+
|
|
20704
20785
|
this._setDataActual(data);
|
|
20705
20786
|
}
|
|
20706
|
-
|
|
20787
|
+
|
|
20707
20788
|
resolve();
|
|
20708
20789
|
});
|
|
20709
20790
|
}
|
|
20710
|
-
|
|
20791
|
+
|
|
20711
20792
|
_setDataActual(data, renderInPosition){
|
|
20712
20793
|
this.dispatchExternal("dataProcessing", data);
|
|
20713
|
-
|
|
20794
|
+
|
|
20714
20795
|
this._wipeElements();
|
|
20715
|
-
|
|
20796
|
+
|
|
20716
20797
|
if(Array.isArray(data)){
|
|
20717
20798
|
this.dispatch("data-processing", data);
|
|
20718
|
-
|
|
20799
|
+
|
|
20719
20800
|
data.forEach((def, i) => {
|
|
20720
20801
|
if(def && typeof def === "object"){
|
|
20721
20802
|
var row = new Row(def, this);
|
|
@@ -20724,260 +20805,257 @@ class RowManager extends CoreFeature{
|
|
|
20724
20805
|
console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def);
|
|
20725
20806
|
}
|
|
20726
20807
|
});
|
|
20727
|
-
|
|
20808
|
+
|
|
20728
20809
|
this.refreshActiveData(false, false, renderInPosition);
|
|
20729
|
-
|
|
20810
|
+
|
|
20730
20811
|
this.dispatch("data-processed", data);
|
|
20731
20812
|
this.dispatchExternal("dataProcessed", data);
|
|
20732
20813
|
}else {
|
|
20733
20814
|
console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data, "\nData: ", data);
|
|
20734
20815
|
}
|
|
20735
20816
|
}
|
|
20736
|
-
|
|
20817
|
+
|
|
20737
20818
|
_wipeElements(){
|
|
20738
20819
|
this.dispatch("rows-wipe");
|
|
20739
|
-
|
|
20820
|
+
|
|
20740
20821
|
this.rows.forEach((row) => {
|
|
20741
20822
|
row.wipe();
|
|
20742
20823
|
});
|
|
20743
|
-
|
|
20824
|
+
|
|
20744
20825
|
this.rows = [];
|
|
20745
20826
|
this.activeRows = [];
|
|
20746
20827
|
this.activeRowsPipeline = [];
|
|
20747
20828
|
this.activeRowsCount = 0;
|
|
20748
20829
|
this.displayRows = [];
|
|
20749
20830
|
this.displayRowsCount = 0;
|
|
20750
|
-
|
|
20831
|
+
|
|
20751
20832
|
this.adjustTableSize();
|
|
20752
20833
|
}
|
|
20753
|
-
|
|
20834
|
+
|
|
20754
20835
|
deleteRow(row, blockRedraw){
|
|
20755
20836
|
var allIndex = this.rows.indexOf(row),
|
|
20756
20837
|
activeIndex = this.activeRows.indexOf(row);
|
|
20757
|
-
|
|
20838
|
+
|
|
20758
20839
|
if(activeIndex > -1){
|
|
20759
20840
|
this.activeRows.splice(activeIndex, 1);
|
|
20760
20841
|
}
|
|
20761
|
-
|
|
20842
|
+
|
|
20762
20843
|
if(allIndex > -1){
|
|
20763
20844
|
this.rows.splice(allIndex, 1);
|
|
20764
20845
|
}
|
|
20765
|
-
|
|
20846
|
+
|
|
20766
20847
|
this.setActiveRows(this.activeRows);
|
|
20767
|
-
|
|
20848
|
+
|
|
20768
20849
|
this.displayRowIterator((rows) => {
|
|
20769
20850
|
var displayIndex = rows.indexOf(row);
|
|
20770
|
-
|
|
20851
|
+
|
|
20771
20852
|
if(displayIndex > -1){
|
|
20772
20853
|
rows.splice(displayIndex, 1);
|
|
20773
20854
|
}
|
|
20774
20855
|
});
|
|
20775
|
-
|
|
20856
|
+
|
|
20776
20857
|
if(!blockRedraw){
|
|
20777
20858
|
this.reRenderInPosition();
|
|
20778
20859
|
}
|
|
20779
|
-
|
|
20860
|
+
|
|
20780
20861
|
this.regenerateRowNumbers();
|
|
20781
|
-
|
|
20862
|
+
|
|
20782
20863
|
this.dispatchExternal("rowDeleted", row.getComponent());
|
|
20783
|
-
|
|
20864
|
+
|
|
20784
20865
|
if(!this.displayRowsCount){
|
|
20785
20866
|
this._showPlaceholder();
|
|
20786
20867
|
}
|
|
20787
|
-
|
|
20868
|
+
|
|
20788
20869
|
if(this.subscribedExternal("dataChanged")){
|
|
20789
20870
|
this.dispatchExternal("dataChanged", this.getData());
|
|
20790
20871
|
}
|
|
20791
20872
|
}
|
|
20792
|
-
|
|
20873
|
+
|
|
20793
20874
|
addRow(data, pos, index, blockRedraw){
|
|
20794
20875
|
var row = this.addRowActual(data, pos, index, blockRedraw);
|
|
20795
|
-
|
|
20796
|
-
this.dispatch("row-added", row, data, pos, index);
|
|
20797
|
-
|
|
20798
20876
|
return row;
|
|
20799
20877
|
}
|
|
20800
|
-
|
|
20878
|
+
|
|
20801
20879
|
//add multiple rows
|
|
20802
20880
|
addRows(data, pos, index){
|
|
20803
20881
|
var rows = [];
|
|
20804
|
-
|
|
20882
|
+
|
|
20805
20883
|
return new Promise((resolve, reject) => {
|
|
20806
20884
|
pos = this.findAddRowPos(pos);
|
|
20807
|
-
|
|
20885
|
+
|
|
20808
20886
|
if(!Array.isArray(data)){
|
|
20809
20887
|
data = [data];
|
|
20810
20888
|
}
|
|
20811
|
-
|
|
20889
|
+
|
|
20812
20890
|
data.length - 1;
|
|
20813
|
-
|
|
20891
|
+
|
|
20814
20892
|
if((typeof index == "undefined" && pos) || (typeof index !== "undefined" && !pos)){
|
|
20815
20893
|
data.reverse();
|
|
20816
20894
|
}
|
|
20817
|
-
|
|
20895
|
+
|
|
20818
20896
|
data.forEach((item, i) => {
|
|
20819
20897
|
var row = this.addRow(item, pos, index, true);
|
|
20820
20898
|
rows.push(row);
|
|
20821
20899
|
this.dispatch("row-added", row, data, pos, index);
|
|
20822
20900
|
});
|
|
20823
|
-
|
|
20901
|
+
|
|
20824
20902
|
this.refreshActiveData(false, false, true);
|
|
20825
|
-
|
|
20903
|
+
|
|
20826
20904
|
this.regenerateRowNumbers();
|
|
20827
|
-
|
|
20905
|
+
|
|
20828
20906
|
if(rows.length){
|
|
20829
20907
|
this._clearPlaceholder();
|
|
20830
20908
|
}
|
|
20831
|
-
|
|
20909
|
+
|
|
20832
20910
|
resolve(rows);
|
|
20833
20911
|
});
|
|
20834
20912
|
}
|
|
20835
|
-
|
|
20913
|
+
|
|
20836
20914
|
findAddRowPos(pos){
|
|
20837
20915
|
if(typeof pos === "undefined"){
|
|
20838
20916
|
pos = this.table.options.addRowPos;
|
|
20839
20917
|
}
|
|
20840
|
-
|
|
20918
|
+
|
|
20841
20919
|
if(pos === "pos"){
|
|
20842
20920
|
pos = true;
|
|
20843
20921
|
}
|
|
20844
|
-
|
|
20922
|
+
|
|
20845
20923
|
if(pos === "bottom"){
|
|
20846
20924
|
pos = false;
|
|
20847
20925
|
}
|
|
20848
|
-
|
|
20926
|
+
|
|
20849
20927
|
return pos;
|
|
20850
20928
|
}
|
|
20851
|
-
|
|
20929
|
+
|
|
20852
20930
|
addRowActual(data, pos, index, blockRedraw){
|
|
20853
20931
|
var row = data instanceof Row ? data : new Row(data || {}, this),
|
|
20854
20932
|
top = this.findAddRowPos(pos),
|
|
20855
20933
|
allIndex = -1,
|
|
20856
20934
|
activeIndex, chainResult;
|
|
20857
|
-
|
|
20935
|
+
|
|
20858
20936
|
if(!index){
|
|
20859
20937
|
chainResult = this.chain("row-adding-position", [row, top], null, {index, top});
|
|
20860
|
-
|
|
20938
|
+
|
|
20861
20939
|
index = chainResult.index;
|
|
20862
20940
|
top = chainResult.top;
|
|
20863
20941
|
}
|
|
20864
|
-
|
|
20942
|
+
|
|
20865
20943
|
if(typeof index !== "undefined"){
|
|
20866
20944
|
index = this.findRow(index);
|
|
20867
20945
|
}
|
|
20868
|
-
|
|
20946
|
+
|
|
20869
20947
|
index = this.chain("row-adding-index", [row, index, top], null, index);
|
|
20870
|
-
|
|
20948
|
+
|
|
20871
20949
|
if(index){
|
|
20872
20950
|
allIndex = this.rows.indexOf(index);
|
|
20873
20951
|
}
|
|
20874
|
-
|
|
20952
|
+
|
|
20875
20953
|
if(index && allIndex > -1){
|
|
20876
20954
|
activeIndex = this.activeRows.indexOf(index);
|
|
20877
|
-
|
|
20955
|
+
|
|
20878
20956
|
this.displayRowIterator(function(rows){
|
|
20879
20957
|
var displayIndex = rows.indexOf(index);
|
|
20880
|
-
|
|
20958
|
+
|
|
20881
20959
|
if(displayIndex > -1){
|
|
20882
20960
|
rows.splice((top ? displayIndex : displayIndex + 1), 0, row);
|
|
20883
20961
|
}
|
|
20884
20962
|
});
|
|
20885
|
-
|
|
20963
|
+
|
|
20886
20964
|
if(activeIndex > -1){
|
|
20887
20965
|
this.activeRows.splice((top ? activeIndex : activeIndex + 1), 0, row);
|
|
20888
20966
|
}
|
|
20889
|
-
|
|
20967
|
+
|
|
20890
20968
|
this.rows.splice((top ? allIndex : allIndex + 1), 0, row);
|
|
20891
|
-
|
|
20969
|
+
|
|
20892
20970
|
}else {
|
|
20893
|
-
|
|
20971
|
+
|
|
20894
20972
|
if(top){
|
|
20895
|
-
|
|
20973
|
+
|
|
20896
20974
|
this.displayRowIterator(function(rows){
|
|
20897
20975
|
rows.unshift(row);
|
|
20898
20976
|
});
|
|
20899
|
-
|
|
20977
|
+
|
|
20900
20978
|
this.activeRows.unshift(row);
|
|
20901
20979
|
this.rows.unshift(row);
|
|
20902
20980
|
}else {
|
|
20903
20981
|
this.displayRowIterator(function(rows){
|
|
20904
20982
|
rows.push(row);
|
|
20905
20983
|
});
|
|
20906
|
-
|
|
20984
|
+
|
|
20907
20985
|
this.activeRows.push(row);
|
|
20908
20986
|
this.rows.push(row);
|
|
20909
20987
|
}
|
|
20910
20988
|
}
|
|
20911
|
-
|
|
20989
|
+
|
|
20912
20990
|
this.setActiveRows(this.activeRows);
|
|
20913
|
-
|
|
20991
|
+
|
|
20914
20992
|
this.dispatchExternal("rowAdded", row.getComponent());
|
|
20915
|
-
|
|
20993
|
+
|
|
20916
20994
|
if(this.subscribedExternal("dataChanged")){
|
|
20917
20995
|
this.dispatchExternal("dataChanged", this.table.rowManager.getData());
|
|
20918
20996
|
}
|
|
20919
|
-
|
|
20997
|
+
|
|
20920
20998
|
if(!blockRedraw){
|
|
20921
20999
|
this.reRenderInPosition();
|
|
20922
21000
|
}
|
|
20923
|
-
|
|
21001
|
+
|
|
20924
21002
|
return row;
|
|
20925
21003
|
}
|
|
20926
|
-
|
|
21004
|
+
|
|
20927
21005
|
moveRow(from, to, after){
|
|
20928
21006
|
this.dispatch("row-move", from, to, after);
|
|
20929
|
-
|
|
21007
|
+
|
|
20930
21008
|
this.moveRowActual(from, to, after);
|
|
20931
|
-
|
|
21009
|
+
|
|
20932
21010
|
this.regenerateRowNumbers();
|
|
20933
|
-
|
|
21011
|
+
|
|
20934
21012
|
this.dispatch("row-moved", from, to, after);
|
|
20935
21013
|
this.dispatchExternal("rowMoved", from.getComponent());
|
|
20936
21014
|
}
|
|
20937
|
-
|
|
21015
|
+
|
|
20938
21016
|
moveRowActual(from, to, after){
|
|
20939
21017
|
this.moveRowInArray(this.rows, from, to, after);
|
|
20940
21018
|
this.moveRowInArray(this.activeRows, from, to, after);
|
|
20941
|
-
|
|
21019
|
+
|
|
20942
21020
|
this.displayRowIterator((rows) => {
|
|
20943
21021
|
this.moveRowInArray(rows, from, to, after);
|
|
20944
21022
|
});
|
|
20945
|
-
|
|
21023
|
+
|
|
20946
21024
|
this.dispatch("row-moving", from, to, after);
|
|
20947
21025
|
}
|
|
20948
|
-
|
|
21026
|
+
|
|
20949
21027
|
moveRowInArray(rows, from, to, after){
|
|
20950
21028
|
var fromIndex, toIndex, start, end;
|
|
20951
|
-
|
|
21029
|
+
|
|
20952
21030
|
if(from !== to){
|
|
20953
|
-
|
|
21031
|
+
|
|
20954
21032
|
fromIndex = rows.indexOf(from);
|
|
20955
|
-
|
|
21033
|
+
|
|
20956
21034
|
if (fromIndex > -1) {
|
|
20957
|
-
|
|
21035
|
+
|
|
20958
21036
|
rows.splice(fromIndex, 1);
|
|
20959
|
-
|
|
21037
|
+
|
|
20960
21038
|
toIndex = rows.indexOf(to);
|
|
20961
|
-
|
|
21039
|
+
|
|
20962
21040
|
if (toIndex > -1) {
|
|
20963
|
-
|
|
21041
|
+
|
|
20964
21042
|
if(after){
|
|
20965
21043
|
rows.splice(toIndex+1, 0, from);
|
|
20966
21044
|
}else {
|
|
20967
21045
|
rows.splice(toIndex, 0, from);
|
|
20968
21046
|
}
|
|
20969
|
-
|
|
21047
|
+
|
|
20970
21048
|
}else {
|
|
20971
21049
|
rows.splice(fromIndex, 0, from);
|
|
20972
21050
|
}
|
|
20973
21051
|
}
|
|
20974
|
-
|
|
21052
|
+
|
|
20975
21053
|
//restyle rows
|
|
20976
21054
|
if(rows === this.getDisplayRows()){
|
|
20977
|
-
|
|
21055
|
+
|
|
20978
21056
|
start = fromIndex < toIndex ? fromIndex : toIndex;
|
|
20979
21057
|
end = toIndex > fromIndex ? toIndex : fromIndex +1;
|
|
20980
|
-
|
|
21058
|
+
|
|
20981
21059
|
for(let i = start; i <= end; i++){
|
|
20982
21060
|
if(rows[i]){
|
|
20983
21061
|
this.styleRow(rows[i], i);
|
|
@@ -20986,104 +21064,104 @@ class RowManager extends CoreFeature{
|
|
|
20986
21064
|
}
|
|
20987
21065
|
}
|
|
20988
21066
|
}
|
|
20989
|
-
|
|
21067
|
+
|
|
20990
21068
|
clearData(){
|
|
20991
21069
|
this.setData([]);
|
|
20992
21070
|
}
|
|
20993
|
-
|
|
21071
|
+
|
|
20994
21072
|
getRowIndex(row){
|
|
20995
21073
|
return this.findRowIndex(row, this.rows);
|
|
20996
21074
|
}
|
|
20997
|
-
|
|
21075
|
+
|
|
20998
21076
|
getDisplayRowIndex(row){
|
|
20999
21077
|
var index = this.getDisplayRows().indexOf(row);
|
|
21000
21078
|
return index > -1 ? index : false;
|
|
21001
21079
|
}
|
|
21002
|
-
|
|
21080
|
+
|
|
21003
21081
|
nextDisplayRow(row, rowOnly){
|
|
21004
21082
|
var index = this.getDisplayRowIndex(row),
|
|
21005
21083
|
nextRow = false;
|
|
21006
|
-
|
|
21007
|
-
|
|
21084
|
+
|
|
21085
|
+
|
|
21008
21086
|
if(index !== false && index < this.displayRowsCount -1){
|
|
21009
21087
|
nextRow = this.getDisplayRows()[index+1];
|
|
21010
21088
|
}
|
|
21011
|
-
|
|
21089
|
+
|
|
21012
21090
|
if(nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")){
|
|
21013
21091
|
return this.nextDisplayRow(nextRow, rowOnly);
|
|
21014
21092
|
}
|
|
21015
|
-
|
|
21093
|
+
|
|
21016
21094
|
return nextRow;
|
|
21017
21095
|
}
|
|
21018
|
-
|
|
21096
|
+
|
|
21019
21097
|
prevDisplayRow(row, rowOnly){
|
|
21020
21098
|
var index = this.getDisplayRowIndex(row),
|
|
21021
21099
|
prevRow = false;
|
|
21022
|
-
|
|
21100
|
+
|
|
21023
21101
|
if(index){
|
|
21024
21102
|
prevRow = this.getDisplayRows()[index-1];
|
|
21025
21103
|
}
|
|
21026
|
-
|
|
21104
|
+
|
|
21027
21105
|
if(rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")){
|
|
21028
21106
|
return this.prevDisplayRow(prevRow, rowOnly);
|
|
21029
21107
|
}
|
|
21030
|
-
|
|
21108
|
+
|
|
21031
21109
|
return prevRow;
|
|
21032
21110
|
}
|
|
21033
|
-
|
|
21111
|
+
|
|
21034
21112
|
findRowIndex(row, list){
|
|
21035
21113
|
var rowIndex;
|
|
21036
|
-
|
|
21114
|
+
|
|
21037
21115
|
row = this.findRow(row);
|
|
21038
|
-
|
|
21116
|
+
|
|
21039
21117
|
if(row){
|
|
21040
21118
|
rowIndex = list.indexOf(row);
|
|
21041
|
-
|
|
21119
|
+
|
|
21042
21120
|
if(rowIndex > -1){
|
|
21043
21121
|
return rowIndex;
|
|
21044
21122
|
}
|
|
21045
21123
|
}
|
|
21046
|
-
|
|
21124
|
+
|
|
21047
21125
|
return false;
|
|
21048
21126
|
}
|
|
21049
|
-
|
|
21127
|
+
|
|
21050
21128
|
getData(active, transform){
|
|
21051
21129
|
var output = [],
|
|
21052
21130
|
rows = this.getRows(active);
|
|
21053
|
-
|
|
21131
|
+
|
|
21054
21132
|
rows.forEach(function(row){
|
|
21055
21133
|
if(row.type == "row"){
|
|
21056
21134
|
output.push(row.getData(transform || "data"));
|
|
21057
21135
|
}
|
|
21058
21136
|
});
|
|
21059
|
-
|
|
21137
|
+
|
|
21060
21138
|
return output;
|
|
21061
21139
|
}
|
|
21062
|
-
|
|
21140
|
+
|
|
21063
21141
|
getComponents(active){
|
|
21064
21142
|
var output = [],
|
|
21065
21143
|
rows = this.getRows(active);
|
|
21066
|
-
|
|
21144
|
+
|
|
21067
21145
|
rows.forEach(function(row){
|
|
21068
21146
|
output.push(row.getComponent());
|
|
21069
21147
|
});
|
|
21070
|
-
|
|
21148
|
+
|
|
21071
21149
|
return output;
|
|
21072
21150
|
}
|
|
21073
|
-
|
|
21151
|
+
|
|
21074
21152
|
getDataCount(active){
|
|
21075
21153
|
var rows = this.getRows(active);
|
|
21076
|
-
|
|
21154
|
+
|
|
21077
21155
|
return rows.length;
|
|
21078
21156
|
}
|
|
21079
|
-
|
|
21157
|
+
|
|
21080
21158
|
scrollHorizontal(left){
|
|
21081
21159
|
this.scrollLeft = left;
|
|
21082
21160
|
this.element.scrollLeft = left;
|
|
21083
|
-
|
|
21161
|
+
|
|
21084
21162
|
this.dispatch("scroll-horizontal", left);
|
|
21085
21163
|
}
|
|
21086
|
-
|
|
21164
|
+
|
|
21087
21165
|
registerDataPipelineHandler(handler, priority){
|
|
21088
21166
|
if(typeof priority !== "undefined"){
|
|
21089
21167
|
this.dataPipeline.push({handler, priority});
|
|
@@ -21094,7 +21172,7 @@ class RowManager extends CoreFeature{
|
|
|
21094
21172
|
console.error("Data pipeline handlers must have a priority in order to be registered");
|
|
21095
21173
|
}
|
|
21096
21174
|
}
|
|
21097
|
-
|
|
21175
|
+
|
|
21098
21176
|
registerDisplayPipelineHandler(handler, priority){
|
|
21099
21177
|
if(typeof priority !== "undefined"){
|
|
21100
21178
|
this.displayPipeline.push({handler, priority});
|
|
@@ -21105,23 +21183,23 @@ class RowManager extends CoreFeature{
|
|
|
21105
21183
|
console.error("Display pipeline handlers must have a priority in order to be registered");
|
|
21106
21184
|
}
|
|
21107
21185
|
}
|
|
21108
|
-
|
|
21186
|
+
|
|
21109
21187
|
//set active data set
|
|
21110
21188
|
refreshActiveData(handler, skipStage, renderInPosition){
|
|
21111
21189
|
var table = this.table,
|
|
21112
21190
|
stage = "",
|
|
21113
21191
|
index = 0,
|
|
21114
21192
|
cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
|
|
21115
|
-
|
|
21116
|
-
|
|
21193
|
+
|
|
21194
|
+
|
|
21117
21195
|
if(typeof handler === "function"){
|
|
21118
21196
|
index = this.dataPipeline.findIndex((item) => {
|
|
21119
21197
|
return item.handler === handler;
|
|
21120
21198
|
});
|
|
21121
|
-
|
|
21199
|
+
|
|
21122
21200
|
if(index > -1){
|
|
21123
21201
|
stage = "dataPipeline";
|
|
21124
|
-
|
|
21202
|
+
|
|
21125
21203
|
if(skipStage){
|
|
21126
21204
|
if(index == this.dataPipeline.length - 1){
|
|
21127
21205
|
stage = "display";
|
|
@@ -21133,10 +21211,10 @@ class RowManager extends CoreFeature{
|
|
|
21133
21211
|
index = this.displayPipeline.findIndex((item) => {
|
|
21134
21212
|
return item.handler === handler;
|
|
21135
21213
|
});
|
|
21136
|
-
|
|
21214
|
+
|
|
21137
21215
|
if(index > -1){
|
|
21138
21216
|
stage = "displayPipeline";
|
|
21139
|
-
|
|
21217
|
+
|
|
21140
21218
|
if(skipStage){
|
|
21141
21219
|
if(index == this.displayPipeline.length - 1){
|
|
21142
21220
|
stage = "end";
|
|
@@ -21153,7 +21231,7 @@ class RowManager extends CoreFeature{
|
|
|
21153
21231
|
stage = handler || "all";
|
|
21154
21232
|
index = 0;
|
|
21155
21233
|
}
|
|
21156
|
-
|
|
21234
|
+
|
|
21157
21235
|
if(this.redrawBlock){
|
|
21158
21236
|
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
21159
21237
|
this.redrawBlockRestoreConfig = {
|
|
@@ -21164,102 +21242,107 @@ class RowManager extends CoreFeature{
|
|
|
21164
21242
|
index:index,
|
|
21165
21243
|
};
|
|
21166
21244
|
}
|
|
21167
|
-
|
|
21245
|
+
|
|
21168
21246
|
return;
|
|
21169
21247
|
}else {
|
|
21170
|
-
this.dispatch("data-refeshing");
|
|
21171
|
-
|
|
21172
|
-
if(!handler){
|
|
21173
|
-
this.activeRowsPipeline[0] = this.rows.slice(0);
|
|
21174
|
-
}
|
|
21175
|
-
|
|
21176
|
-
//cascade through data refresh stages
|
|
21177
|
-
switch(stage){
|
|
21178
|
-
case "all":
|
|
21179
|
-
//handle case where alldata needs refreshing
|
|
21180
|
-
|
|
21181
|
-
case "dataPipeline":
|
|
21182
|
-
|
|
21183
|
-
for(let i = index; i < this.dataPipeline.length; i++){
|
|
21184
|
-
let result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
|
|
21185
|
-
|
|
21186
|
-
this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
|
|
21187
|
-
}
|
|
21188
|
-
|
|
21189
|
-
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
21190
|
-
|
|
21191
|
-
this.regenerateRowNumbers();
|
|
21192
|
-
|
|
21193
|
-
case "display":
|
|
21194
|
-
index = 0;
|
|
21195
|
-
this.resetDisplayRows();
|
|
21196
|
-
|
|
21197
|
-
case "displayPipeline":
|
|
21198
|
-
for(let i = index; i < this.displayPipeline.length; i++){
|
|
21199
|
-
let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
21200
|
-
|
|
21201
|
-
this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
|
|
21202
|
-
}
|
|
21203
|
-
//case to handle scenario when trying to skip past end stage
|
|
21204
|
-
}
|
|
21205
|
-
|
|
21206
21248
|
if(Helpers.elVisible(this.element)){
|
|
21207
21249
|
if(renderInPosition){
|
|
21208
|
-
this.reRenderInPosition();
|
|
21250
|
+
this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
|
|
21209
21251
|
}else {
|
|
21210
|
-
|
|
21252
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
21253
|
+
|
|
21211
21254
|
if(!handler){
|
|
21212
21255
|
this.table.columnManager.renderer.renderColumns();
|
|
21213
21256
|
}
|
|
21214
|
-
|
|
21257
|
+
|
|
21215
21258
|
this.renderTable();
|
|
21216
|
-
|
|
21259
|
+
|
|
21217
21260
|
if(table.options.layoutColumnsOnNewData){
|
|
21218
21261
|
this.table.columnManager.redraw(true);
|
|
21219
21262
|
}
|
|
21220
21263
|
}
|
|
21264
|
+
}else {
|
|
21265
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
21221
21266
|
}
|
|
21222
|
-
|
|
21267
|
+
|
|
21223
21268
|
this.dispatch("data-refreshed");
|
|
21224
21269
|
}
|
|
21225
21270
|
}
|
|
21226
|
-
|
|
21271
|
+
|
|
21272
|
+
refreshPipelines(handler, stage, index, renderInPosition){
|
|
21273
|
+
this.dispatch("data-refreshing");
|
|
21274
|
+
|
|
21275
|
+
if(!handler){
|
|
21276
|
+
this.activeRowsPipeline[0] = this.rows.slice(0);
|
|
21277
|
+
}
|
|
21278
|
+
|
|
21279
|
+
//cascade through data refresh stages
|
|
21280
|
+
switch(stage){
|
|
21281
|
+
case "all":
|
|
21282
|
+
//handle case where alldata needs refreshing
|
|
21283
|
+
|
|
21284
|
+
case "dataPipeline":
|
|
21285
|
+
|
|
21286
|
+
for(let i = index; i < this.dataPipeline.length; i++){
|
|
21287
|
+
let result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
|
|
21288
|
+
|
|
21289
|
+
this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
|
|
21290
|
+
}
|
|
21291
|
+
|
|
21292
|
+
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
21293
|
+
|
|
21294
|
+
this.regenerateRowNumbers();
|
|
21295
|
+
|
|
21296
|
+
case "display":
|
|
21297
|
+
index = 0;
|
|
21298
|
+
this.resetDisplayRows();
|
|
21299
|
+
|
|
21300
|
+
case "displayPipeline":
|
|
21301
|
+
for(let i = index; i < this.displayPipeline.length; i++){
|
|
21302
|
+
let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
21303
|
+
|
|
21304
|
+
this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
|
|
21305
|
+
}
|
|
21306
|
+
//case to handle scenario when trying to skip past end stage
|
|
21307
|
+
}
|
|
21308
|
+
}
|
|
21309
|
+
|
|
21227
21310
|
//regenerate row numbers for row number formatter if in use
|
|
21228
21311
|
regenerateRowNumbers(){
|
|
21229
21312
|
if(this.rowNumColumn){
|
|
21230
21313
|
this.activeRows.forEach((row) => {
|
|
21231
21314
|
var cell = row.getCell(this.rowNumColumn);
|
|
21232
|
-
|
|
21315
|
+
|
|
21233
21316
|
if(cell){
|
|
21234
21317
|
cell._generateContents();
|
|
21235
21318
|
}
|
|
21236
21319
|
});
|
|
21237
21320
|
}
|
|
21238
21321
|
}
|
|
21239
|
-
|
|
21322
|
+
|
|
21240
21323
|
setActiveRows(activeRows){
|
|
21241
21324
|
this.activeRows = activeRows;
|
|
21242
21325
|
this.activeRowsCount = this.activeRows.length;
|
|
21243
21326
|
}
|
|
21244
|
-
|
|
21327
|
+
|
|
21245
21328
|
//reset display rows array
|
|
21246
21329
|
resetDisplayRows(){
|
|
21247
21330
|
this.displayRows = [];
|
|
21248
|
-
|
|
21331
|
+
|
|
21249
21332
|
this.displayRows.push(this.activeRows.slice(0));
|
|
21250
|
-
|
|
21333
|
+
|
|
21251
21334
|
this.displayRowsCount = this.displayRows[0].length;
|
|
21252
21335
|
}
|
|
21253
|
-
|
|
21336
|
+
|
|
21254
21337
|
getNextDisplayIndex(){
|
|
21255
21338
|
return this.displayRows.length;
|
|
21256
21339
|
}
|
|
21257
|
-
|
|
21340
|
+
|
|
21258
21341
|
//set display row pipeline data
|
|
21259
21342
|
setDisplayRows(displayRows, index){
|
|
21260
|
-
|
|
21343
|
+
|
|
21261
21344
|
var output = true;
|
|
21262
|
-
|
|
21345
|
+
|
|
21263
21346
|
if(index && typeof this.displayRows[index] != "undefined"){
|
|
21264
21347
|
this.displayRows[index] = displayRows;
|
|
21265
21348
|
output = true;
|
|
@@ -21267,14 +21350,14 @@ class RowManager extends CoreFeature{
|
|
|
21267
21350
|
this.displayRows.push(displayRows);
|
|
21268
21351
|
output = index = this.displayRows.length -1;
|
|
21269
21352
|
}
|
|
21270
|
-
|
|
21353
|
+
|
|
21271
21354
|
if(index == this.displayRows.length -1){
|
|
21272
21355
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
21273
21356
|
}
|
|
21274
|
-
|
|
21357
|
+
|
|
21275
21358
|
return output;
|
|
21276
21359
|
}
|
|
21277
|
-
|
|
21360
|
+
|
|
21278
21361
|
getDisplayRows(index){
|
|
21279
21362
|
if(typeof index == "undefined"){
|
|
21280
21363
|
return this.displayRows.length ? this.displayRows[this.displayRows.length -1] : [];
|
|
@@ -21282,49 +21365,49 @@ class RowManager extends CoreFeature{
|
|
|
21282
21365
|
return this.displayRows[index] || [];
|
|
21283
21366
|
}
|
|
21284
21367
|
}
|
|
21285
|
-
|
|
21368
|
+
|
|
21286
21369
|
getVisibleRows(chain, viewable){
|
|
21287
21370
|
var rows = Object.assign([], this.renderer.visibleRows(!viewable));
|
|
21288
|
-
|
|
21371
|
+
|
|
21289
21372
|
if(chain){
|
|
21290
21373
|
rows = this.chain("rows-visible", [viewable], rows, rows);
|
|
21291
21374
|
}
|
|
21292
|
-
|
|
21375
|
+
|
|
21293
21376
|
return rows;
|
|
21294
21377
|
}
|
|
21295
|
-
|
|
21378
|
+
|
|
21296
21379
|
//repeat action accross display rows
|
|
21297
21380
|
displayRowIterator(callback){
|
|
21298
21381
|
this.activeRowsPipeline.forEach(callback);
|
|
21299
21382
|
this.displayRows.forEach(callback);
|
|
21300
|
-
|
|
21383
|
+
|
|
21301
21384
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
21302
21385
|
}
|
|
21303
|
-
|
|
21386
|
+
|
|
21304
21387
|
//return only actual rows (not group headers etc)
|
|
21305
21388
|
getRows(type){
|
|
21306
21389
|
var rows;
|
|
21307
|
-
|
|
21390
|
+
|
|
21308
21391
|
switch(type){
|
|
21309
21392
|
case "active":
|
|
21310
21393
|
rows = this.activeRows;
|
|
21311
21394
|
break;
|
|
21312
|
-
|
|
21395
|
+
|
|
21313
21396
|
case "display":
|
|
21314
21397
|
rows = this.table.rowManager.getDisplayRows();
|
|
21315
21398
|
break;
|
|
21316
|
-
|
|
21399
|
+
|
|
21317
21400
|
case "visible":
|
|
21318
|
-
rows = this.getVisibleRows(true);
|
|
21401
|
+
rows = this.getVisibleRows(false, true);
|
|
21319
21402
|
break;
|
|
21320
|
-
|
|
21403
|
+
|
|
21321
21404
|
default:
|
|
21322
21405
|
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
21323
21406
|
}
|
|
21324
|
-
|
|
21407
|
+
|
|
21325
21408
|
return rows;
|
|
21326
21409
|
}
|
|
21327
|
-
|
|
21410
|
+
|
|
21328
21411
|
///////////////// Table Rendering /////////////////
|
|
21329
21412
|
//trigger rerender of table in current position
|
|
21330
21413
|
reRenderInPosition(callback){
|
|
@@ -21338,25 +21421,25 @@ class RowManager extends CoreFeature{
|
|
|
21338
21421
|
this.renderer.rerenderRows(callback);
|
|
21339
21422
|
}
|
|
21340
21423
|
}
|
|
21341
|
-
|
|
21424
|
+
|
|
21342
21425
|
initializeRenderer(){
|
|
21343
21426
|
var renderClass;
|
|
21344
|
-
|
|
21427
|
+
|
|
21345
21428
|
var renderers = {
|
|
21346
21429
|
"virtual": VirtualDomVertical,
|
|
21347
21430
|
"basic": BaiscVertical,
|
|
21348
21431
|
};
|
|
21349
|
-
|
|
21432
|
+
|
|
21350
21433
|
if(typeof this.table.options.renderVertical === "string"){
|
|
21351
21434
|
renderClass = renderers[this.table.options.renderVertical];
|
|
21352
21435
|
}else {
|
|
21353
21436
|
renderClass = this.table.options.renderVertical;
|
|
21354
21437
|
}
|
|
21355
|
-
|
|
21438
|
+
|
|
21356
21439
|
if(renderClass){
|
|
21357
21440
|
this.renderer = new renderClass(this.table, this.element, this.tableElement);
|
|
21358
21441
|
this.renderer.initialize();
|
|
21359
|
-
|
|
21442
|
+
|
|
21360
21443
|
if((this.table.element.clientHeight || this.table.options.height)){
|
|
21361
21444
|
this.fixedHeight = true;
|
|
21362
21445
|
}else {
|
|
@@ -21366,21 +21449,21 @@ class RowManager extends CoreFeature{
|
|
|
21366
21449
|
console.error("Unable to find matching renderer:", table.options.renderVertical);
|
|
21367
21450
|
}
|
|
21368
21451
|
}
|
|
21369
|
-
|
|
21452
|
+
|
|
21370
21453
|
getRenderMode(){
|
|
21371
21454
|
return this.renderMode;
|
|
21372
21455
|
}
|
|
21373
|
-
|
|
21456
|
+
|
|
21374
21457
|
renderTable(){
|
|
21375
21458
|
this.dispatchExternal("renderStarted");
|
|
21376
|
-
|
|
21459
|
+
|
|
21377
21460
|
this.element.scrollTop = 0;
|
|
21378
|
-
|
|
21461
|
+
|
|
21379
21462
|
this._clearTable();
|
|
21380
|
-
|
|
21463
|
+
|
|
21381
21464
|
if(this.displayRowsCount){
|
|
21382
21465
|
this.renderer.renderRows();
|
|
21383
|
-
|
|
21466
|
+
|
|
21384
21467
|
if(this.firstRender){
|
|
21385
21468
|
this.firstRender = false;
|
|
21386
21469
|
this.layoutRefresh();
|
|
@@ -21388,23 +21471,23 @@ class RowManager extends CoreFeature{
|
|
|
21388
21471
|
}else {
|
|
21389
21472
|
this.renderEmptyScroll();
|
|
21390
21473
|
}
|
|
21391
|
-
|
|
21474
|
+
|
|
21392
21475
|
if(!this.fixedHeight){
|
|
21393
21476
|
this.adjustTableSize();
|
|
21394
21477
|
}
|
|
21395
|
-
|
|
21478
|
+
|
|
21396
21479
|
this.dispatch("table-layout");
|
|
21397
|
-
|
|
21480
|
+
|
|
21398
21481
|
if(!this.displayRowsCount){
|
|
21399
21482
|
this._showPlaceholder();
|
|
21400
21483
|
}
|
|
21401
|
-
|
|
21484
|
+
|
|
21402
21485
|
this.dispatchExternal("renderComplete");
|
|
21403
21486
|
}
|
|
21404
|
-
|
|
21487
|
+
|
|
21405
21488
|
//show scrollbars on empty table div
|
|
21406
21489
|
renderEmptyScroll(){
|
|
21407
|
-
if(this.
|
|
21490
|
+
if(this.placeholder){
|
|
21408
21491
|
this.tableElement.style.display = "none";
|
|
21409
21492
|
}else {
|
|
21410
21493
|
this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px";
|
|
@@ -21412,37 +21495,44 @@ class RowManager extends CoreFeature{
|
|
|
21412
21495
|
// this.tableElement.style.visibility = "hidden";
|
|
21413
21496
|
}
|
|
21414
21497
|
}
|
|
21415
|
-
|
|
21498
|
+
|
|
21416
21499
|
_clearTable(){
|
|
21417
21500
|
var element = this.tableElement;
|
|
21418
|
-
|
|
21501
|
+
|
|
21419
21502
|
this._clearPlaceholder();
|
|
21420
|
-
|
|
21503
|
+
|
|
21421
21504
|
this.scrollTop = 0;
|
|
21422
21505
|
this.scrollLeft = 0;
|
|
21423
|
-
|
|
21506
|
+
|
|
21424
21507
|
this.renderer.clearRows();
|
|
21425
21508
|
}
|
|
21426
|
-
|
|
21509
|
+
|
|
21427
21510
|
_showPlaceholder(){
|
|
21428
|
-
if(this.
|
|
21429
|
-
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
this.
|
|
21433
|
-
this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px";
|
|
21511
|
+
if(this.placeholder){
|
|
21512
|
+
this.placeholder.setAttribute("tabulator-render-mode", this.renderMode);
|
|
21513
|
+
|
|
21514
|
+
this.getElement().appendChild(this.placeholder);
|
|
21515
|
+
this._positionPlaceholder();
|
|
21434
21516
|
}
|
|
21435
21517
|
}
|
|
21436
|
-
|
|
21518
|
+
|
|
21437
21519
|
_clearPlaceholder(){
|
|
21438
|
-
if(this.
|
|
21439
|
-
this.
|
|
21520
|
+
if(this.placeholder && this.placeholder.parentNode){
|
|
21521
|
+
this.placeholder.parentNode.removeChild(this.placeholder);
|
|
21440
21522
|
}
|
|
21441
21523
|
}
|
|
21442
|
-
|
|
21524
|
+
|
|
21525
|
+
_positionPlaceholder(){
|
|
21526
|
+
if(this.placeholder && this.placeholder.parentNode){
|
|
21527
|
+
this.placeholder.style.width = this.table.columnManager.getWidth() + "px";
|
|
21528
|
+
this.placeholderContents.style.width = this.table.rowManager.element.clientWidth + "px";
|
|
21529
|
+
this.placeholderContents.style.marginLeft = this.scrollLeft + "px";
|
|
21530
|
+
}
|
|
21531
|
+
}
|
|
21532
|
+
|
|
21443
21533
|
styleRow(row, index){
|
|
21444
21534
|
var rowEl = row.getElement();
|
|
21445
|
-
|
|
21535
|
+
|
|
21446
21536
|
if(index % 2){
|
|
21447
21537
|
rowEl.classList.add("tabulator-row-even");
|
|
21448
21538
|
rowEl.classList.remove("tabulator-row-odd");
|
|
@@ -21451,21 +21541,21 @@ class RowManager extends CoreFeature{
|
|
|
21451
21541
|
rowEl.classList.remove("tabulator-row-even");
|
|
21452
21542
|
}
|
|
21453
21543
|
}
|
|
21454
|
-
|
|
21544
|
+
|
|
21455
21545
|
//normalize height of active rows
|
|
21456
21546
|
normalizeHeight(){
|
|
21457
21547
|
this.activeRows.forEach(function(row){
|
|
21458
21548
|
row.normalizeHeight();
|
|
21459
21549
|
});
|
|
21460
21550
|
}
|
|
21461
|
-
|
|
21551
|
+
|
|
21462
21552
|
//adjust the height of the table holder to fit in the Tabulator element
|
|
21463
21553
|
adjustTableSize(){
|
|
21464
21554
|
var initialHeight = this.element.clientHeight;
|
|
21465
|
-
|
|
21555
|
+
|
|
21466
21556
|
if(this.renderer.verticalFillMode === "fill"){
|
|
21467
21557
|
let otherHeight = Math.floor(this.table.columnManager.getElement().getBoundingClientRect().height + (this.table.footerManager && this.table.footerManager.active && !this.table.footerManager.external ? this.table.footerManager.getElement().getBoundingClientRect().height : 0));
|
|
21468
|
-
|
|
21558
|
+
|
|
21469
21559
|
if(this.fixedHeight){
|
|
21470
21560
|
this.element.style.minHeight = "calc(100% - " + otherHeight + "px)";
|
|
21471
21561
|
this.element.style.height = "calc(100% - " + otherHeight + "px)";
|
|
@@ -21475,9 +21565,9 @@ class RowManager extends CoreFeature{
|
|
|
21475
21565
|
this.element.style.height = (this.table.element.clientHeight - otherHeight) + "px";
|
|
21476
21566
|
this.element.scrollTop = this.scrollTop;
|
|
21477
21567
|
}
|
|
21478
|
-
|
|
21568
|
+
|
|
21479
21569
|
this.renderer.resize();
|
|
21480
|
-
|
|
21570
|
+
|
|
21481
21571
|
//check if the table has changed size when dealing with variable height tables
|
|
21482
21572
|
if(!this.fixedHeight && initialHeight != this.element.clientHeight){
|
|
21483
21573
|
if(this.subscribed("table-resize")){
|
|
@@ -21487,64 +21577,60 @@ class RowManager extends CoreFeature{
|
|
|
21487
21577
|
}
|
|
21488
21578
|
}
|
|
21489
21579
|
}
|
|
21490
|
-
}
|
|
21491
21580
|
|
|
21581
|
+
this._positionPlaceholder();
|
|
21582
|
+
}
|
|
21583
|
+
|
|
21492
21584
|
//renitialize all rows
|
|
21493
21585
|
reinitialize(){
|
|
21494
21586
|
this.rows.forEach(function(row){
|
|
21495
21587
|
row.reinitialize(true);
|
|
21496
21588
|
});
|
|
21497
21589
|
}
|
|
21498
|
-
|
|
21590
|
+
|
|
21499
21591
|
//prevent table from being redrawn
|
|
21500
21592
|
blockRedraw (){
|
|
21501
21593
|
this.redrawBlock = true;
|
|
21502
21594
|
this.redrawBlockRestoreConfig = false;
|
|
21503
21595
|
}
|
|
21504
|
-
|
|
21596
|
+
|
|
21505
21597
|
//restore table redrawing
|
|
21506
21598
|
restoreRedraw (){
|
|
21507
21599
|
this.redrawBlock = false;
|
|
21508
|
-
|
|
21600
|
+
|
|
21509
21601
|
if(this.redrawBlockRestoreConfig){
|
|
21510
21602
|
this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition);
|
|
21511
|
-
|
|
21603
|
+
|
|
21512
21604
|
this.redrawBlockRestoreConfig = false;
|
|
21513
21605
|
}else {
|
|
21514
21606
|
if(this.redrawBlockRenderInPosition){
|
|
21515
21607
|
this.reRenderInPosition();
|
|
21516
21608
|
}
|
|
21517
21609
|
}
|
|
21518
|
-
|
|
21610
|
+
|
|
21519
21611
|
this.redrawBlockRenderInPosition = false;
|
|
21520
21612
|
}
|
|
21521
|
-
|
|
21613
|
+
|
|
21522
21614
|
//redraw table
|
|
21523
21615
|
redraw (force){
|
|
21524
21616
|
var left = this.scrollLeft;
|
|
21525
|
-
|
|
21617
|
+
|
|
21526
21618
|
this.adjustTableSize();
|
|
21527
|
-
|
|
21619
|
+
|
|
21528
21620
|
this.table.tableWidth = this.table.element.clientWidth;
|
|
21529
|
-
|
|
21621
|
+
|
|
21530
21622
|
if(!force){
|
|
21531
21623
|
this.reRenderInPosition();
|
|
21532
21624
|
this.scrollHorizontal(left);
|
|
21533
|
-
|
|
21534
|
-
if(!this.displayRowsCount){
|
|
21535
|
-
if(this.table.options.placeholder){
|
|
21536
|
-
this.getElement().appendChild(this.table.options.placeholder);
|
|
21537
|
-
}
|
|
21538
|
-
}
|
|
21539
21625
|
}else {
|
|
21540
21626
|
this.renderTable();
|
|
21541
21627
|
}
|
|
21542
21628
|
}
|
|
21543
|
-
|
|
21629
|
+
|
|
21544
21630
|
resetScroll(){
|
|
21545
21631
|
this.element.scrollLeft = 0;
|
|
21546
21632
|
this.element.scrollTop = 0;
|
|
21547
|
-
|
|
21633
|
+
|
|
21548
21634
|
if(this.table.browser === "ie"){
|
|
21549
21635
|
var event = document.createEvent("Event");
|
|
21550
21636
|
event.initEvent("scroll", false, true);
|
|
@@ -21562,17 +21648,16 @@ class FooterManager extends CoreFeature{
|
|
|
21562
21648
|
|
|
21563
21649
|
this.active = false;
|
|
21564
21650
|
this.element = this.createElement(); //containing element
|
|
21651
|
+
this.containerElement = this.createContainerElement(); //containing element
|
|
21565
21652
|
this.external = false;
|
|
21566
21653
|
this.links = [];
|
|
21567
|
-
|
|
21568
|
-
this.initializeElement();
|
|
21569
21654
|
}
|
|
21570
21655
|
|
|
21571
21656
|
initialize(){
|
|
21572
21657
|
this.initializeElement();
|
|
21573
21658
|
}
|
|
21574
21659
|
|
|
21575
|
-
createElement
|
|
21660
|
+
createElement(){
|
|
21576
21661
|
var el = document.createElement("div");
|
|
21577
21662
|
|
|
21578
21663
|
el.classList.add("tabulator-footer");
|
|
@@ -21580,13 +21665,24 @@ class FooterManager extends CoreFeature{
|
|
|
21580
21665
|
return el;
|
|
21581
21666
|
}
|
|
21582
21667
|
|
|
21668
|
+
|
|
21669
|
+
createContainerElement(){
|
|
21670
|
+
var el = document.createElement("div");
|
|
21671
|
+
|
|
21672
|
+
el.classList.add("tabulator-footer-contents");
|
|
21673
|
+
|
|
21674
|
+
this.element.appendChild(el);
|
|
21675
|
+
|
|
21676
|
+
return el;
|
|
21677
|
+
}
|
|
21678
|
+
|
|
21583
21679
|
initializeElement(){
|
|
21584
21680
|
if(this.table.options.footerElement){
|
|
21585
21681
|
|
|
21586
21682
|
switch(typeof this.table.options.footerElement){
|
|
21587
21683
|
case "string":
|
|
21588
21684
|
if(this.table.options.footerElement[0] === "<"){
|
|
21589
|
-
this.
|
|
21685
|
+
this.containerElement.innerHTML = this.table.options.footerElement;
|
|
21590
21686
|
}else {
|
|
21591
21687
|
this.external = true;
|
|
21592
21688
|
this.element = document.querySelector(this.table.options.footerElement);
|
|
@@ -21607,7 +21703,7 @@ class FooterManager extends CoreFeature{
|
|
|
21607
21703
|
append(element, parent){
|
|
21608
21704
|
this.activate(parent);
|
|
21609
21705
|
|
|
21610
|
-
this.
|
|
21706
|
+
this.containerElement.appendChild(element);
|
|
21611
21707
|
this.table.rowManager.adjustTableSize();
|
|
21612
21708
|
}
|
|
21613
21709
|
|
|
@@ -21683,7 +21779,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21683
21779
|
"tabulator-group":"group",
|
|
21684
21780
|
"tabulator-col":"column",
|
|
21685
21781
|
};
|
|
21686
|
-
|
|
21782
|
+
|
|
21687
21783
|
this.pseudoTrackers = {
|
|
21688
21784
|
"row":{
|
|
21689
21785
|
subscriber:null,
|
|
@@ -21702,12 +21798,13 @@ class InteractionManager extends CoreFeature {
|
|
|
21702
21798
|
target:null,
|
|
21703
21799
|
},
|
|
21704
21800
|
};
|
|
21705
|
-
|
|
21801
|
+
|
|
21706
21802
|
this.pseudoTracking = false;
|
|
21707
21803
|
}
|
|
21708
21804
|
|
|
21709
21805
|
initialize(){
|
|
21710
21806
|
this.el = this.table.element;
|
|
21807
|
+
|
|
21711
21808
|
this.buildListenerMap();
|
|
21712
21809
|
this.bindSubscriptionWatchers();
|
|
21713
21810
|
}
|
|
@@ -21724,55 +21821,55 @@ class InteractionManager extends CoreFeature {
|
|
|
21724
21821
|
|
|
21725
21822
|
this.listeners = listenerMap;
|
|
21726
21823
|
}
|
|
21727
|
-
|
|
21824
|
+
|
|
21728
21825
|
bindPseudoEvents(){
|
|
21729
21826
|
Object.keys(this.pseudoTrackers).forEach((key) => {
|
|
21730
21827
|
this.pseudoTrackers[key].subscriber = this.pseudoMouseEnter.bind(this, key);
|
|
21731
21828
|
this.subscribe(key + "-mouseover", this.pseudoTrackers[key].subscriber);
|
|
21732
21829
|
});
|
|
21733
|
-
|
|
21830
|
+
|
|
21734
21831
|
this.pseudoTracking = true;
|
|
21735
21832
|
}
|
|
21736
|
-
|
|
21833
|
+
|
|
21737
21834
|
pseudoMouseEnter(key, e, target){
|
|
21738
21835
|
if(this.pseudoTrackers[key].target !== target){
|
|
21739
21836
|
|
|
21740
21837
|
if(this.pseudoTrackers[key].target){
|
|
21741
21838
|
this.dispatch(key + "-mouseleave", e, target);
|
|
21742
21839
|
}
|
|
21743
|
-
|
|
21840
|
+
|
|
21744
21841
|
this.pseudoMouseLeave(key, e);
|
|
21745
|
-
|
|
21842
|
+
|
|
21746
21843
|
this.pseudoTrackers[key].target = target;
|
|
21747
|
-
|
|
21844
|
+
|
|
21748
21845
|
this.dispatch(key + "-mouseenter", e, target);
|
|
21749
21846
|
}
|
|
21750
21847
|
}
|
|
21751
|
-
|
|
21848
|
+
|
|
21752
21849
|
pseudoMouseLeave(key, e){
|
|
21753
21850
|
var leaveList = Object.keys(this.pseudoTrackers),
|
|
21754
21851
|
linkedKeys = {
|
|
21755
21852
|
"row":["cell"],
|
|
21756
21853
|
"cell":["row"],
|
|
21757
21854
|
};
|
|
21758
|
-
|
|
21855
|
+
|
|
21759
21856
|
leaveList = leaveList.filter((item) => {
|
|
21760
21857
|
var links = linkedKeys[key];
|
|
21761
21858
|
return item !== key && (!links || (links && !links.includes(item)));
|
|
21762
21859
|
});
|
|
21763
|
-
|
|
21764
|
-
|
|
21860
|
+
|
|
21861
|
+
|
|
21765
21862
|
leaveList.forEach((key) => {
|
|
21766
21863
|
var target = this.pseudoTrackers[key].target;
|
|
21767
|
-
|
|
21864
|
+
|
|
21768
21865
|
if(this.pseudoTrackers[key].target){
|
|
21769
21866
|
this.dispatch(key + "-mouseleave", e, target);
|
|
21770
|
-
|
|
21867
|
+
|
|
21771
21868
|
this.pseudoTrackers[key].target = null;
|
|
21772
21869
|
}
|
|
21773
21870
|
});
|
|
21774
21871
|
}
|
|
21775
|
-
|
|
21872
|
+
|
|
21776
21873
|
|
|
21777
21874
|
bindSubscriptionWatchers(){
|
|
21778
21875
|
var listeners = Object.keys(this.listeners),
|
|
@@ -21793,7 +21890,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21793
21890
|
var listener = this.listeners[key].components,
|
|
21794
21891
|
index = listener.indexOf(component),
|
|
21795
21892
|
changed = false;
|
|
21796
|
-
|
|
21893
|
+
|
|
21797
21894
|
if(added){
|
|
21798
21895
|
if(index === -1){
|
|
21799
21896
|
listener.push(component);
|
|
@@ -21807,7 +21904,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21807
21904
|
}
|
|
21808
21905
|
}
|
|
21809
21906
|
}
|
|
21810
|
-
|
|
21907
|
+
|
|
21811
21908
|
if((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking){
|
|
21812
21909
|
this.bindPseudoEvents();
|
|
21813
21910
|
}
|
|
@@ -21841,9 +21938,9 @@ class InteractionManager extends CoreFeature {
|
|
|
21841
21938
|
|
|
21842
21939
|
var targets = this.findTargets(path);
|
|
21843
21940
|
targets = this.bindComponents(type, targets);
|
|
21844
|
-
|
|
21941
|
+
|
|
21845
21942
|
this.triggerEvents(type, e, targets);
|
|
21846
|
-
|
|
21943
|
+
|
|
21847
21944
|
if(this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
|
|
21848
21945
|
this.pseudoMouseLeave("none", e);
|
|
21849
21946
|
}
|
|
@@ -21904,6 +22001,10 @@ class InteractionManager extends CoreFeature {
|
|
|
21904
22001
|
component = rows.find((row) => {
|
|
21905
22002
|
return row.getElement() === target;
|
|
21906
22003
|
});
|
|
22004
|
+
|
|
22005
|
+
if(targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
|
|
22006
|
+
targets[key] = false;
|
|
22007
|
+
}
|
|
21907
22008
|
}
|
|
21908
22009
|
break;
|
|
21909
22010
|
|
|
@@ -21915,10 +22016,12 @@ class InteractionManager extends CoreFeature {
|
|
|
21915
22016
|
|
|
21916
22017
|
case "cell":
|
|
21917
22018
|
if(listener.components.includes("cell")){
|
|
21918
|
-
if(targets["row"]){
|
|
22019
|
+
if(targets["row"] instanceof Row){
|
|
21919
22020
|
component = targets["row"].findCell(target);
|
|
21920
|
-
}else {
|
|
21921
|
-
|
|
22021
|
+
}else {
|
|
22022
|
+
if(targets["row"]){
|
|
22023
|
+
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?");
|
|
22024
|
+
}
|
|
21922
22025
|
}
|
|
21923
22026
|
}
|
|
21924
22027
|
break;
|
|
@@ -21952,7 +22055,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21952
22055
|
clearWatchers(){
|
|
21953
22056
|
for(let key in this.listeners){
|
|
21954
22057
|
let listener = this.listeners[key];
|
|
21955
|
-
|
|
22058
|
+
|
|
21956
22059
|
if(listener.handler){
|
|
21957
22060
|
this.el.removeEventListener(key, listener.handler);
|
|
21958
22061
|
listener.handler = null;
|
|
@@ -22789,6 +22892,7 @@ class Layout extends Module{
|
|
|
22789
22892
|
|
|
22790
22893
|
//trigger table layout
|
|
22791
22894
|
layout(){
|
|
22895
|
+
this.dispatch("layout-refreshing");
|
|
22792
22896
|
Layout.modes[this.mode].call(this, this.table.columnManager.columnsByIndex);
|
|
22793
22897
|
|
|
22794
22898
|
this.dispatch("layout-refreshed");
|
|
@@ -23136,19 +23240,31 @@ class ModuleBinder {
|
|
|
23136
23240
|
|
|
23137
23241
|
//ensure that module are bound to instantiated function
|
|
23138
23242
|
tabulator.prototype.bindModules = function(){
|
|
23243
|
+
var orderedMods = [],
|
|
23244
|
+
unOrderedMods = [];
|
|
23245
|
+
|
|
23139
23246
|
this.modules = {};
|
|
23140
23247
|
|
|
23141
23248
|
for(var name in tabulator.moduleBindings){
|
|
23142
23249
|
let mod = tabulator.moduleBindings[name];
|
|
23250
|
+
let module = new mod(this);
|
|
23143
23251
|
|
|
23144
|
-
this.modules[name] =
|
|
23252
|
+
this.modules[name] = module;
|
|
23145
23253
|
|
|
23146
23254
|
if(mod.prototype.moduleCore){
|
|
23147
|
-
this.modulesCore
|
|
23255
|
+
this.modulesCore.push(module);
|
|
23148
23256
|
}else {
|
|
23149
|
-
|
|
23257
|
+
if(mod.moduleInitOrder){
|
|
23258
|
+
orderedMods.push(module);
|
|
23259
|
+
}else {
|
|
23260
|
+
unOrderedMods.push(module);
|
|
23261
|
+
}
|
|
23150
23262
|
}
|
|
23151
23263
|
}
|
|
23264
|
+
|
|
23265
|
+
orderedMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
|
|
23266
|
+
|
|
23267
|
+
this.modulesRegular = orderedMods.concat(unOrderedMods);
|
|
23152
23268
|
};
|
|
23153
23269
|
}
|
|
23154
23270
|
|
|
@@ -23188,8 +23304,8 @@ class Tabulator {
|
|
|
23188
23304
|
this.dataLoader = false; //bind component functions
|
|
23189
23305
|
|
|
23190
23306
|
this.modules = {}; //hold all modules bound to this table
|
|
23191
|
-
this.modulesCore =
|
|
23192
|
-
this.modulesRegular =
|
|
23307
|
+
this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
|
|
23308
|
+
this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
|
|
23193
23309
|
|
|
23194
23310
|
this.optionsList = new OptionsList(this, "table constructor");
|
|
23195
23311
|
|
|
@@ -23197,7 +23313,7 @@ class Tabulator {
|
|
|
23197
23313
|
|
|
23198
23314
|
if(this.initializeElement(element)){
|
|
23199
23315
|
|
|
23200
|
-
this.
|
|
23316
|
+
this.initializeCoreSystems(options);
|
|
23201
23317
|
|
|
23202
23318
|
//delay table creation to allow event bindings immediately after the constructor
|
|
23203
23319
|
setTimeout(() => {
|
|
@@ -23227,7 +23343,7 @@ class Tabulator {
|
|
|
23227
23343
|
}
|
|
23228
23344
|
}
|
|
23229
23345
|
|
|
23230
|
-
|
|
23346
|
+
initializeCoreSystems(options){
|
|
23231
23347
|
this.columnManager = new ColumnManager(this);
|
|
23232
23348
|
this.rowManager = new RowManager(this);
|
|
23233
23349
|
this.footerManager = new FooterManager(this);
|
|
@@ -23247,8 +23363,8 @@ class Tabulator {
|
|
|
23247
23363
|
this.interactionMonitor = new InteractionManager(this);
|
|
23248
23364
|
|
|
23249
23365
|
this.dataLoader.initialize();
|
|
23250
|
-
this.columnManager.initialize();
|
|
23251
|
-
this.rowManager.initialize();
|
|
23366
|
+
// this.columnManager.initialize();
|
|
23367
|
+
// this.rowManager.initialize();
|
|
23252
23368
|
this.footerManager.initialize();
|
|
23253
23369
|
}
|
|
23254
23370
|
|
|
@@ -23386,24 +23502,9 @@ class Tabulator {
|
|
|
23386
23502
|
this._detectBrowser();
|
|
23387
23503
|
|
|
23388
23504
|
//initialize core modules
|
|
23389
|
-
|
|
23390
|
-
let mod = this.modulesCore[key];
|
|
23391
|
-
|
|
23505
|
+
this.modulesCore.forEach((mod) => {
|
|
23392
23506
|
mod.initialize();
|
|
23393
|
-
}
|
|
23394
|
-
|
|
23395
|
-
//configure placeholder element
|
|
23396
|
-
if(typeof options.placeholder == "string"){
|
|
23397
|
-
var el = document.createElement("div");
|
|
23398
|
-
el.classList.add("tabulator-placeholder");
|
|
23399
|
-
|
|
23400
|
-
var span = document.createElement("span");
|
|
23401
|
-
span.innerHTML = options.placeholder;
|
|
23402
|
-
|
|
23403
|
-
el.appendChild(span);
|
|
23404
|
-
|
|
23405
|
-
options.placeholder = el;
|
|
23406
|
-
}
|
|
23507
|
+
});
|
|
23407
23508
|
|
|
23408
23509
|
//build table elements
|
|
23409
23510
|
element.appendChild(this.columnManager.getElement());
|
|
@@ -23419,11 +23520,9 @@ class Tabulator {
|
|
|
23419
23520
|
}
|
|
23420
23521
|
|
|
23421
23522
|
//initialize regular modules
|
|
23422
|
-
|
|
23423
|
-
let mod = this.modulesRegular[key];
|
|
23424
|
-
|
|
23523
|
+
this.modulesRegular.forEach((mod) => {
|
|
23425
23524
|
mod.initialize();
|
|
23426
|
-
}
|
|
23525
|
+
});
|
|
23427
23526
|
|
|
23428
23527
|
this.columnManager.setColumns(options.columns);
|
|
23429
23528
|
|
|
@@ -23473,7 +23572,7 @@ class Tabulator {
|
|
|
23473
23572
|
this.browserSlow = false;
|
|
23474
23573
|
}
|
|
23475
23574
|
|
|
23476
|
-
this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.
|
|
23575
|
+
this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(ua)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(ua.slice(0,4));
|
|
23477
23576
|
}
|
|
23478
23577
|
|
|
23479
23578
|
////////////////// Data Handling //////////////////
|