tabulator-tables 5.1.0 → 5.1.1
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 +124 -66
- 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 +380 -329
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +1 -1
- package/src/js/core/FooterManager.js +14 -2
- package/src/js/core/RowManager.js +312 -279
- package/src/js/core/column/ColumnComponent.js +2 -0
- package/src/js/core/tools/InteractionMonitor.js +31 -23
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +2 -2
- package/src/js/modules/DataTree/DataTree.js +0 -1
- package/src/js/modules/Edit/Edit.js +2 -2
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/Import/Import.js +1 -3
- package/src/js/modules/Page/Page.js +5 -3
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +4 -4
- package/src/js/modules/SelectRow/SelectRow.js +1 -1
- 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.1 (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));
|
|
@@ -3604,12 +3604,12 @@ class ColumnCalcs extends Module{
|
|
|
3604
3604
|
|
|
3605
3605
|
rowsToData(rows){
|
|
3606
3606
|
var data = [];
|
|
3607
|
-
|
|
3607
|
+
|
|
3608
3608
|
rows.forEach((row) => {
|
|
3609
3609
|
data.push(row.getData());
|
|
3610
3610
|
|
|
3611
3611
|
if(this.table.options.dataTree && this.table.options.dataTreeChildColumnCalcs){
|
|
3612
|
-
if(row.modules.dataTree.open){
|
|
3612
|
+
if(row.modules.dataTree && row.modules.dataTree.open){
|
|
3613
3613
|
var children = this.rowsToData(this.table.modules.dataTree.getFilteredTreeChildren(row));
|
|
3614
3614
|
data = data.concat(children);
|
|
3615
3615
|
}
|
|
@@ -4358,7 +4358,6 @@ class DataTree extends Module{
|
|
|
4358
4358
|
}
|
|
4359
4359
|
|
|
4360
4360
|
redrawNeeded(data){
|
|
4361
|
-
console.log("needed?", data);
|
|
4362
4361
|
return (this.field ? typeof data[this.field] !== "undefined" : false) || (this.elementField ? typeof data[this.elementField] !== "undefined" : false);
|
|
4363
4362
|
}
|
|
4364
4363
|
}
|
|
@@ -6757,7 +6756,7 @@ class Edit extends Module{
|
|
|
6757
6756
|
this.subscribe("column-layout", this.initializeColumnCheck.bind(this));
|
|
6758
6757
|
this.subscribe("column-delete", this.columnDeleteCheck.bind(this));
|
|
6759
6758
|
this.subscribe("row-deleting", this.rowDeleteCheck.bind(this));
|
|
6760
|
-
this.subscribe("data-
|
|
6759
|
+
this.subscribe("data-refreshing", this.cancelEdit.bind(this));
|
|
6761
6760
|
|
|
6762
6761
|
this.subscribe("keybinding-nav-prev", this.navigatePrev.bind(this, undefined));
|
|
6763
6762
|
this.subscribe("keybinding-nav-next", this.keybindingNavigateNext.bind(this));
|
|
@@ -6779,7 +6778,7 @@ class Edit extends Module{
|
|
|
6779
6778
|
if(cell){
|
|
6780
6779
|
if(!this.navigateNext(cell, e)){
|
|
6781
6780
|
if(newRow){
|
|
6782
|
-
|
|
6781
|
+
cell.getElement().firstChild.blur();
|
|
6783
6782
|
|
|
6784
6783
|
if(newRow === true){
|
|
6785
6784
|
newRow = this.table.addRow({});
|
|
@@ -10267,7 +10266,7 @@ class GroupComponent {
|
|
|
10267
10266
|
if (typeof target[name] !== "undefined") {
|
|
10268
10267
|
return target[name];
|
|
10269
10268
|
}else {
|
|
10270
|
-
return target._group.table.componentFunctionBinder.handle("row", target._group, name)
|
|
10269
|
+
return target._group.groupManager.table.componentFunctionBinder.handle("row", target._group, name)
|
|
10271
10270
|
}
|
|
10272
10271
|
}
|
|
10273
10272
|
})
|
|
@@ -12087,9 +12086,7 @@ class Import extends Module{
|
|
|
12087
12086
|
|
|
12088
12087
|
structureData(parsedData){
|
|
12089
12088
|
var data = [];
|
|
12090
|
-
|
|
12091
|
-
console.log("structure", parsedData);
|
|
12092
|
-
|
|
12089
|
+
|
|
12093
12090
|
if(Array.isArray(parsedData) && parsedData.length && Array.isArray(parsedData[0])){
|
|
12094
12091
|
if(this.table.options.autoColumns){
|
|
12095
12092
|
data = this.structureArrayToObject(parsedData);
|
|
@@ -12449,7 +12446,7 @@ class Interaction extends Module{
|
|
|
12449
12446
|
|
|
12450
12447
|
if(component instanceof Cell){
|
|
12451
12448
|
callback = component.column.definition[action];
|
|
12452
|
-
}else if(component instanceof Column
|
|
12449
|
+
}else if(component instanceof Column){
|
|
12453
12450
|
callback = component.definition[action];
|
|
12454
12451
|
}
|
|
12455
12452
|
|
|
@@ -15095,9 +15092,11 @@ class Page extends Module{
|
|
|
15095
15092
|
margin = this.table.options.progressiveLoadScrollMargin || (this.table.rowManager.element.clientHeight * 2);
|
|
15096
15093
|
|
|
15097
15094
|
if(this.table.rowManager.element.scrollHeight <= (this.table.rowManager.element.clientHeight + margin)){
|
|
15098
|
-
|
|
15099
|
-
|
|
15100
|
-
|
|
15095
|
+
if(this.page < this.max){
|
|
15096
|
+
setTimeout(() => {
|
|
15097
|
+
this.nextPage();
|
|
15098
|
+
});
|
|
15099
|
+
}
|
|
15101
15100
|
}
|
|
15102
15101
|
break;
|
|
15103
15102
|
}
|
|
@@ -16577,14 +16576,14 @@ class ResponsiveLayout extends Module{
|
|
|
16577
16576
|
this.hiddenColumns = [];
|
|
16578
16577
|
|
|
16579
16578
|
//determine level of responsivity for each column
|
|
16580
|
-
this.table.columnManager.columnsByIndex.forEach(
|
|
16579
|
+
this.table.columnManager.columnsByIndex.forEach((column, i) => {
|
|
16581
16580
|
if(column.modules.responsive){
|
|
16582
16581
|
if(column.modules.responsive.order && column.modules.responsive.visible){
|
|
16583
16582
|
column.modules.responsive.index = i;
|
|
16584
16583
|
columns.push(column);
|
|
16585
16584
|
|
|
16586
|
-
if(!column.visible &&
|
|
16587
|
-
|
|
16585
|
+
if(!column.visible && this.mode === "collapse"){
|
|
16586
|
+
this.hiddenColumns.push(column);
|
|
16588
16587
|
}
|
|
16589
16588
|
}
|
|
16590
16589
|
}
|
|
@@ -16592,7 +16591,7 @@ class ResponsiveLayout extends Module{
|
|
|
16592
16591
|
|
|
16593
16592
|
//sort list by responsivity
|
|
16594
16593
|
columns = columns.reverse();
|
|
16595
|
-
columns = columns.sort(
|
|
16594
|
+
columns = columns.sort((a, b) => {
|
|
16596
16595
|
var diff = b.modules.responsive.order - a.modules.responsive.order;
|
|
16597
16596
|
return diff || (b.modules.responsive.index - a.modules.responsive.index);
|
|
16598
16597
|
});
|
|
@@ -16898,7 +16897,7 @@ class SelectRow extends Module{
|
|
|
16898
16897
|
this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
|
|
16899
16898
|
|
|
16900
16899
|
if(this.table.options.selectable && !this.table.options.selectablePersistence){
|
|
16901
|
-
this.subscribe("data-
|
|
16900
|
+
this.subscribe("data-refreshing", this.deselectRows.bind(this));
|
|
16902
16901
|
}
|
|
16903
16902
|
}
|
|
16904
16903
|
}
|
|
@@ -19429,7 +19428,7 @@ class ColumnManager extends CoreFeature {
|
|
|
19429
19428
|
}
|
|
19430
19429
|
|
|
19431
19430
|
_addColumn(definition, before, nextToColumn){
|
|
19432
|
-
var column = new Column
|
|
19431
|
+
var column = new Column(definition, this),
|
|
19433
19432
|
colEl = column.getElement(),
|
|
19434
19433
|
index = nextToColumn ? this.findColumnIndex(nextToColumn) : nextToColumn;
|
|
19435
19434
|
|
|
@@ -19505,7 +19504,7 @@ class ColumnManager extends CoreFeature {
|
|
|
19505
19504
|
findColumn(subject){
|
|
19506
19505
|
if(typeof subject == "object"){
|
|
19507
19506
|
|
|
19508
|
-
if(subject instanceof Column
|
|
19507
|
+
if(subject instanceof Column){
|
|
19509
19508
|
//subject is column element
|
|
19510
19509
|
return subject;
|
|
19511
19510
|
}else if(subject instanceof ColumnComponent){
|
|
@@ -20522,72 +20521,91 @@ class VirtualDomVertical extends Renderer{
|
|
|
20522
20521
|
}
|
|
20523
20522
|
|
|
20524
20523
|
class RowManager extends CoreFeature{
|
|
20525
|
-
|
|
20524
|
+
|
|
20526
20525
|
constructor(table){
|
|
20527
20526
|
super(table);
|
|
20528
|
-
|
|
20527
|
+
|
|
20529
20528
|
this.element = this.createHolderElement(); //containing element
|
|
20530
20529
|
this.tableElement = this.createTableElement(); //table element
|
|
20531
20530
|
this.heightFixer = this.createTableElement(); //table element
|
|
20532
|
-
|
|
20531
|
+
this.placeholder = null; //placeholder element
|
|
20532
|
+
this.placeholderContents = null; //placeholder element
|
|
20533
|
+
|
|
20533
20534
|
this.firstRender = false; //handle first render
|
|
20534
20535
|
this.renderMode = "virtual"; //current rendering mode
|
|
20535
20536
|
this.fixedHeight = false; //current rendering mode
|
|
20536
|
-
|
|
20537
|
+
|
|
20537
20538
|
this.rows = []; //hold row data objects
|
|
20538
20539
|
this.activeRowsPipeline = []; //hold calculation of active rows
|
|
20539
20540
|
this.activeRows = []; //rows currently available to on display in the table
|
|
20540
20541
|
this.activeRowsCount = 0; //count of active rows
|
|
20541
|
-
|
|
20542
|
+
|
|
20542
20543
|
this.displayRows = []; //rows currently on display in the table
|
|
20543
20544
|
this.displayRowsCount = 0; //count of display rows
|
|
20544
|
-
|
|
20545
|
+
|
|
20545
20546
|
this.scrollTop = 0;
|
|
20546
20547
|
this.scrollLeft = 0;
|
|
20547
|
-
|
|
20548
|
+
|
|
20548
20549
|
this.rowNumColumn = false; //hold column component for row number column
|
|
20549
|
-
|
|
20550
|
+
|
|
20550
20551
|
this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
|
|
20551
20552
|
this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
|
|
20552
20553
|
this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
|
|
20553
|
-
|
|
20554
|
+
|
|
20554
20555
|
this.dataPipeline = []; //hold data pipeline tasks
|
|
20555
20556
|
this.displayPipeline = []; //hold data display pipeline tasks
|
|
20556
|
-
|
|
20557
|
+
|
|
20557
20558
|
this.renderer = null;
|
|
20558
20559
|
}
|
|
20559
|
-
|
|
20560
|
+
|
|
20560
20561
|
//////////////// Setup Functions /////////////////
|
|
20561
|
-
|
|
20562
|
+
|
|
20562
20563
|
createHolderElement (){
|
|
20563
20564
|
var el = document.createElement("div");
|
|
20564
|
-
|
|
20565
|
+
|
|
20565
20566
|
el.classList.add("tabulator-tableholder");
|
|
20566
20567
|
el.setAttribute("tabindex", 0);
|
|
20567
20568
|
el.setAttribute("role", "rowgroup");
|
|
20568
|
-
|
|
20569
|
+
|
|
20569
20570
|
return el;
|
|
20570
20571
|
}
|
|
20571
|
-
|
|
20572
|
+
|
|
20572
20573
|
createTableElement (){
|
|
20573
20574
|
var el = document.createElement("div");
|
|
20574
|
-
|
|
20575
|
+
|
|
20575
20576
|
el.classList.add("tabulator-table");
|
|
20576
20577
|
el.setAttribute("role", "rowgroup");
|
|
20577
|
-
|
|
20578
|
+
|
|
20578
20579
|
return el;
|
|
20579
20580
|
}
|
|
20580
|
-
|
|
20581
|
+
|
|
20582
|
+
initializePlaceholder(){
|
|
20583
|
+
//configure placeholder element
|
|
20584
|
+
if(typeof this.table.options.placeholder == "string"){
|
|
20585
|
+
let el = document.createElement("div");
|
|
20586
|
+
el.classList.add("tabulator-placeholder");
|
|
20587
|
+
|
|
20588
|
+
let contents = document.createElement("div");
|
|
20589
|
+
contents.classList.add("tabulator-placeholder-contents");
|
|
20590
|
+
contents.innerHTML = this.table.options.placeholder;
|
|
20591
|
+
|
|
20592
|
+
el.appendChild(contents);
|
|
20593
|
+
|
|
20594
|
+
this.placeholderContents = contents;
|
|
20595
|
+
this.placeholder = el;
|
|
20596
|
+
}
|
|
20597
|
+
}
|
|
20598
|
+
|
|
20581
20599
|
//return containing element
|
|
20582
20600
|
getElement(){
|
|
20583
20601
|
return this.element;
|
|
20584
20602
|
}
|
|
20585
|
-
|
|
20603
|
+
|
|
20586
20604
|
//return table element
|
|
20587
20605
|
getTableElement(){
|
|
20588
20606
|
return this.tableElement;
|
|
20589
20607
|
}
|
|
20590
|
-
|
|
20608
|
+
|
|
20591
20609
|
//return position of row in table
|
|
20592
20610
|
getRowPosition(row, active){
|
|
20593
20611
|
if(active){
|
|
@@ -20596,42 +20614,45 @@ class RowManager extends CoreFeature{
|
|
|
20596
20614
|
return this.rows.indexOf(row);
|
|
20597
20615
|
}
|
|
20598
20616
|
}
|
|
20599
|
-
|
|
20617
|
+
|
|
20600
20618
|
initialize(){
|
|
20619
|
+
this.initializePlaceholder();
|
|
20601
20620
|
this.initializeRenderer();
|
|
20602
|
-
|
|
20621
|
+
|
|
20603
20622
|
//initialize manager
|
|
20604
20623
|
this.element.appendChild(this.tableElement);
|
|
20605
|
-
|
|
20624
|
+
|
|
20606
20625
|
this.firstRender = true;
|
|
20607
|
-
|
|
20626
|
+
|
|
20608
20627
|
//scroll header along with table body
|
|
20609
20628
|
this.element.addEventListener("scroll", () => {
|
|
20610
20629
|
var left = this.element.scrollLeft,
|
|
20611
20630
|
leftDir = this.scrollLeft > left,
|
|
20612
20631
|
top = this.element.scrollTop,
|
|
20613
20632
|
topDir = this.scrollTop > top;
|
|
20614
|
-
|
|
20633
|
+
|
|
20615
20634
|
//handle horizontal scrolling
|
|
20616
20635
|
if(this.scrollLeft != left){
|
|
20617
20636
|
this.scrollLeft = left;
|
|
20618
|
-
|
|
20637
|
+
|
|
20619
20638
|
this.dispatch("scroll-horizontal", left, leftDir);
|
|
20620
20639
|
this.dispatchExternal("scrollHorizontal", left, leftDir);
|
|
20621
|
-
}
|
|
20622
20640
|
|
|
20623
|
-
|
|
20641
|
+
this._positionPlaceholder();
|
|
20642
|
+
}
|
|
20643
|
+
|
|
20644
|
+
//handle vertical scrolling
|
|
20624
20645
|
if(this.scrollTop != top){
|
|
20625
20646
|
this.scrollTop = top;
|
|
20626
|
-
|
|
20647
|
+
|
|
20627
20648
|
this.renderer.scrollRows(top, topDir);
|
|
20628
|
-
|
|
20649
|
+
|
|
20629
20650
|
this.dispatch("scroll-vertical", top, topDir);
|
|
20630
20651
|
this.dispatchExternal("scrollVertical", top, topDir);
|
|
20631
20652
|
}
|
|
20632
20653
|
});
|
|
20633
20654
|
}
|
|
20634
|
-
|
|
20655
|
+
|
|
20635
20656
|
////////////////// Row Manipulation //////////////////
|
|
20636
20657
|
findRow(subject){
|
|
20637
20658
|
if(typeof subject == "object"){
|
|
@@ -20646,7 +20667,7 @@ class RowManager extends CoreFeature{
|
|
|
20646
20667
|
let match = this.rows.find((row) => {
|
|
20647
20668
|
return row.getElement() === subject;
|
|
20648
20669
|
});
|
|
20649
|
-
|
|
20670
|
+
|
|
20650
20671
|
return match || false;
|
|
20651
20672
|
}
|
|
20652
20673
|
}else if(typeof subject == "undefined" || subject === null){
|
|
@@ -20656,22 +20677,22 @@ class RowManager extends CoreFeature{
|
|
|
20656
20677
|
let match = this.rows.find((row) => {
|
|
20657
20678
|
return row.data[this.table.options.index] == subject;
|
|
20658
20679
|
});
|
|
20659
|
-
|
|
20680
|
+
|
|
20660
20681
|
return match || false;
|
|
20661
20682
|
}
|
|
20662
|
-
|
|
20683
|
+
|
|
20663
20684
|
//catch all for any other type of input
|
|
20664
20685
|
return false;
|
|
20665
20686
|
}
|
|
20666
|
-
|
|
20687
|
+
|
|
20667
20688
|
getRowFromDataObject(data){
|
|
20668
20689
|
var match = this.rows.find((row) => {
|
|
20669
20690
|
return row.data === data;
|
|
20670
20691
|
});
|
|
20671
|
-
|
|
20692
|
+
|
|
20672
20693
|
return match || false;
|
|
20673
20694
|
}
|
|
20674
|
-
|
|
20695
|
+
|
|
20675
20696
|
getRowFromPosition(position, active){
|
|
20676
20697
|
if(active){
|
|
20677
20698
|
return this.activeRows[position];
|
|
@@ -20679,11 +20700,11 @@ class RowManager extends CoreFeature{
|
|
|
20679
20700
|
return this.rows[position];
|
|
20680
20701
|
}
|
|
20681
20702
|
}
|
|
20682
|
-
|
|
20703
|
+
|
|
20683
20704
|
scrollToRow(row, position, ifVisible){
|
|
20684
20705
|
return this.renderer.scrollToRowPosition(row, position, ifVisible);
|
|
20685
20706
|
}
|
|
20686
|
-
|
|
20707
|
+
|
|
20687
20708
|
////////////////// Data Handling //////////////////
|
|
20688
20709
|
setData(data, renderInPosition, columnsChanged){
|
|
20689
20710
|
return new Promise((resolve, reject)=>{
|
|
@@ -20700,22 +20721,22 @@ class RowManager extends CoreFeature{
|
|
|
20700
20721
|
this.table.columnManager.generateColumnsFromRowData(data);
|
|
20701
20722
|
}
|
|
20702
20723
|
this.resetScroll();
|
|
20703
|
-
|
|
20724
|
+
|
|
20704
20725
|
this._setDataActual(data);
|
|
20705
20726
|
}
|
|
20706
|
-
|
|
20727
|
+
|
|
20707
20728
|
resolve();
|
|
20708
20729
|
});
|
|
20709
20730
|
}
|
|
20710
|
-
|
|
20731
|
+
|
|
20711
20732
|
_setDataActual(data, renderInPosition){
|
|
20712
20733
|
this.dispatchExternal("dataProcessing", data);
|
|
20713
|
-
|
|
20734
|
+
|
|
20714
20735
|
this._wipeElements();
|
|
20715
|
-
|
|
20736
|
+
|
|
20716
20737
|
if(Array.isArray(data)){
|
|
20717
20738
|
this.dispatch("data-processing", data);
|
|
20718
|
-
|
|
20739
|
+
|
|
20719
20740
|
data.forEach((def, i) => {
|
|
20720
20741
|
if(def && typeof def === "object"){
|
|
20721
20742
|
var row = new Row(def, this);
|
|
@@ -20724,260 +20745,257 @@ class RowManager extends CoreFeature{
|
|
|
20724
20745
|
console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", def);
|
|
20725
20746
|
}
|
|
20726
20747
|
});
|
|
20727
|
-
|
|
20748
|
+
|
|
20728
20749
|
this.refreshActiveData(false, false, renderInPosition);
|
|
20729
|
-
|
|
20750
|
+
|
|
20730
20751
|
this.dispatch("data-processed", data);
|
|
20731
20752
|
this.dispatchExternal("dataProcessed", data);
|
|
20732
20753
|
}else {
|
|
20733
20754
|
console.error("Data Loading Error - Unable to process data due to invalid data type \nExpecting: array \nReceived: ", typeof data, "\nData: ", data);
|
|
20734
20755
|
}
|
|
20735
20756
|
}
|
|
20736
|
-
|
|
20757
|
+
|
|
20737
20758
|
_wipeElements(){
|
|
20738
20759
|
this.dispatch("rows-wipe");
|
|
20739
|
-
|
|
20760
|
+
|
|
20740
20761
|
this.rows.forEach((row) => {
|
|
20741
20762
|
row.wipe();
|
|
20742
20763
|
});
|
|
20743
|
-
|
|
20764
|
+
|
|
20744
20765
|
this.rows = [];
|
|
20745
20766
|
this.activeRows = [];
|
|
20746
20767
|
this.activeRowsPipeline = [];
|
|
20747
20768
|
this.activeRowsCount = 0;
|
|
20748
20769
|
this.displayRows = [];
|
|
20749
20770
|
this.displayRowsCount = 0;
|
|
20750
|
-
|
|
20771
|
+
|
|
20751
20772
|
this.adjustTableSize();
|
|
20752
20773
|
}
|
|
20753
|
-
|
|
20774
|
+
|
|
20754
20775
|
deleteRow(row, blockRedraw){
|
|
20755
20776
|
var allIndex = this.rows.indexOf(row),
|
|
20756
20777
|
activeIndex = this.activeRows.indexOf(row);
|
|
20757
|
-
|
|
20778
|
+
|
|
20758
20779
|
if(activeIndex > -1){
|
|
20759
20780
|
this.activeRows.splice(activeIndex, 1);
|
|
20760
20781
|
}
|
|
20761
|
-
|
|
20782
|
+
|
|
20762
20783
|
if(allIndex > -1){
|
|
20763
20784
|
this.rows.splice(allIndex, 1);
|
|
20764
20785
|
}
|
|
20765
|
-
|
|
20786
|
+
|
|
20766
20787
|
this.setActiveRows(this.activeRows);
|
|
20767
|
-
|
|
20788
|
+
|
|
20768
20789
|
this.displayRowIterator((rows) => {
|
|
20769
20790
|
var displayIndex = rows.indexOf(row);
|
|
20770
|
-
|
|
20791
|
+
|
|
20771
20792
|
if(displayIndex > -1){
|
|
20772
20793
|
rows.splice(displayIndex, 1);
|
|
20773
20794
|
}
|
|
20774
20795
|
});
|
|
20775
|
-
|
|
20796
|
+
|
|
20776
20797
|
if(!blockRedraw){
|
|
20777
20798
|
this.reRenderInPosition();
|
|
20778
20799
|
}
|
|
20779
|
-
|
|
20800
|
+
|
|
20780
20801
|
this.regenerateRowNumbers();
|
|
20781
|
-
|
|
20802
|
+
|
|
20782
20803
|
this.dispatchExternal("rowDeleted", row.getComponent());
|
|
20783
|
-
|
|
20804
|
+
|
|
20784
20805
|
if(!this.displayRowsCount){
|
|
20785
20806
|
this._showPlaceholder();
|
|
20786
20807
|
}
|
|
20787
|
-
|
|
20808
|
+
|
|
20788
20809
|
if(this.subscribedExternal("dataChanged")){
|
|
20789
20810
|
this.dispatchExternal("dataChanged", this.getData());
|
|
20790
20811
|
}
|
|
20791
20812
|
}
|
|
20792
|
-
|
|
20813
|
+
|
|
20793
20814
|
addRow(data, pos, index, blockRedraw){
|
|
20794
20815
|
var row = this.addRowActual(data, pos, index, blockRedraw);
|
|
20795
|
-
|
|
20796
|
-
this.dispatch("row-added", row, data, pos, index);
|
|
20797
|
-
|
|
20798
20816
|
return row;
|
|
20799
20817
|
}
|
|
20800
|
-
|
|
20818
|
+
|
|
20801
20819
|
//add multiple rows
|
|
20802
20820
|
addRows(data, pos, index){
|
|
20803
20821
|
var rows = [];
|
|
20804
|
-
|
|
20822
|
+
|
|
20805
20823
|
return new Promise((resolve, reject) => {
|
|
20806
20824
|
pos = this.findAddRowPos(pos);
|
|
20807
|
-
|
|
20825
|
+
|
|
20808
20826
|
if(!Array.isArray(data)){
|
|
20809
20827
|
data = [data];
|
|
20810
20828
|
}
|
|
20811
|
-
|
|
20829
|
+
|
|
20812
20830
|
data.length - 1;
|
|
20813
|
-
|
|
20831
|
+
|
|
20814
20832
|
if((typeof index == "undefined" && pos) || (typeof index !== "undefined" && !pos)){
|
|
20815
20833
|
data.reverse();
|
|
20816
20834
|
}
|
|
20817
|
-
|
|
20835
|
+
|
|
20818
20836
|
data.forEach((item, i) => {
|
|
20819
20837
|
var row = this.addRow(item, pos, index, true);
|
|
20820
20838
|
rows.push(row);
|
|
20821
20839
|
this.dispatch("row-added", row, data, pos, index);
|
|
20822
20840
|
});
|
|
20823
|
-
|
|
20841
|
+
|
|
20824
20842
|
this.refreshActiveData(false, false, true);
|
|
20825
|
-
|
|
20843
|
+
|
|
20826
20844
|
this.regenerateRowNumbers();
|
|
20827
|
-
|
|
20845
|
+
|
|
20828
20846
|
if(rows.length){
|
|
20829
20847
|
this._clearPlaceholder();
|
|
20830
20848
|
}
|
|
20831
|
-
|
|
20849
|
+
|
|
20832
20850
|
resolve(rows);
|
|
20833
20851
|
});
|
|
20834
20852
|
}
|
|
20835
|
-
|
|
20853
|
+
|
|
20836
20854
|
findAddRowPos(pos){
|
|
20837
20855
|
if(typeof pos === "undefined"){
|
|
20838
20856
|
pos = this.table.options.addRowPos;
|
|
20839
20857
|
}
|
|
20840
|
-
|
|
20858
|
+
|
|
20841
20859
|
if(pos === "pos"){
|
|
20842
20860
|
pos = true;
|
|
20843
20861
|
}
|
|
20844
|
-
|
|
20862
|
+
|
|
20845
20863
|
if(pos === "bottom"){
|
|
20846
20864
|
pos = false;
|
|
20847
20865
|
}
|
|
20848
|
-
|
|
20866
|
+
|
|
20849
20867
|
return pos;
|
|
20850
20868
|
}
|
|
20851
|
-
|
|
20869
|
+
|
|
20852
20870
|
addRowActual(data, pos, index, blockRedraw){
|
|
20853
20871
|
var row = data instanceof Row ? data : new Row(data || {}, this),
|
|
20854
20872
|
top = this.findAddRowPos(pos),
|
|
20855
20873
|
allIndex = -1,
|
|
20856
20874
|
activeIndex, chainResult;
|
|
20857
|
-
|
|
20875
|
+
|
|
20858
20876
|
if(!index){
|
|
20859
20877
|
chainResult = this.chain("row-adding-position", [row, top], null, {index, top});
|
|
20860
|
-
|
|
20878
|
+
|
|
20861
20879
|
index = chainResult.index;
|
|
20862
20880
|
top = chainResult.top;
|
|
20863
20881
|
}
|
|
20864
|
-
|
|
20882
|
+
|
|
20865
20883
|
if(typeof index !== "undefined"){
|
|
20866
20884
|
index = this.findRow(index);
|
|
20867
20885
|
}
|
|
20868
|
-
|
|
20886
|
+
|
|
20869
20887
|
index = this.chain("row-adding-index", [row, index, top], null, index);
|
|
20870
|
-
|
|
20888
|
+
|
|
20871
20889
|
if(index){
|
|
20872
20890
|
allIndex = this.rows.indexOf(index);
|
|
20873
20891
|
}
|
|
20874
|
-
|
|
20892
|
+
|
|
20875
20893
|
if(index && allIndex > -1){
|
|
20876
20894
|
activeIndex = this.activeRows.indexOf(index);
|
|
20877
|
-
|
|
20895
|
+
|
|
20878
20896
|
this.displayRowIterator(function(rows){
|
|
20879
20897
|
var displayIndex = rows.indexOf(index);
|
|
20880
|
-
|
|
20898
|
+
|
|
20881
20899
|
if(displayIndex > -1){
|
|
20882
20900
|
rows.splice((top ? displayIndex : displayIndex + 1), 0, row);
|
|
20883
20901
|
}
|
|
20884
20902
|
});
|
|
20885
|
-
|
|
20903
|
+
|
|
20886
20904
|
if(activeIndex > -1){
|
|
20887
20905
|
this.activeRows.splice((top ? activeIndex : activeIndex + 1), 0, row);
|
|
20888
20906
|
}
|
|
20889
|
-
|
|
20907
|
+
|
|
20890
20908
|
this.rows.splice((top ? allIndex : allIndex + 1), 0, row);
|
|
20891
|
-
|
|
20909
|
+
|
|
20892
20910
|
}else {
|
|
20893
|
-
|
|
20911
|
+
|
|
20894
20912
|
if(top){
|
|
20895
|
-
|
|
20913
|
+
|
|
20896
20914
|
this.displayRowIterator(function(rows){
|
|
20897
20915
|
rows.unshift(row);
|
|
20898
20916
|
});
|
|
20899
|
-
|
|
20917
|
+
|
|
20900
20918
|
this.activeRows.unshift(row);
|
|
20901
20919
|
this.rows.unshift(row);
|
|
20902
20920
|
}else {
|
|
20903
20921
|
this.displayRowIterator(function(rows){
|
|
20904
20922
|
rows.push(row);
|
|
20905
20923
|
});
|
|
20906
|
-
|
|
20924
|
+
|
|
20907
20925
|
this.activeRows.push(row);
|
|
20908
20926
|
this.rows.push(row);
|
|
20909
20927
|
}
|
|
20910
20928
|
}
|
|
20911
|
-
|
|
20929
|
+
|
|
20912
20930
|
this.setActiveRows(this.activeRows);
|
|
20913
|
-
|
|
20931
|
+
|
|
20914
20932
|
this.dispatchExternal("rowAdded", row.getComponent());
|
|
20915
|
-
|
|
20933
|
+
|
|
20916
20934
|
if(this.subscribedExternal("dataChanged")){
|
|
20917
20935
|
this.dispatchExternal("dataChanged", this.table.rowManager.getData());
|
|
20918
20936
|
}
|
|
20919
|
-
|
|
20937
|
+
|
|
20920
20938
|
if(!blockRedraw){
|
|
20921
20939
|
this.reRenderInPosition();
|
|
20922
20940
|
}
|
|
20923
|
-
|
|
20941
|
+
|
|
20924
20942
|
return row;
|
|
20925
20943
|
}
|
|
20926
|
-
|
|
20944
|
+
|
|
20927
20945
|
moveRow(from, to, after){
|
|
20928
20946
|
this.dispatch("row-move", from, to, after);
|
|
20929
|
-
|
|
20947
|
+
|
|
20930
20948
|
this.moveRowActual(from, to, after);
|
|
20931
|
-
|
|
20949
|
+
|
|
20932
20950
|
this.regenerateRowNumbers();
|
|
20933
|
-
|
|
20951
|
+
|
|
20934
20952
|
this.dispatch("row-moved", from, to, after);
|
|
20935
20953
|
this.dispatchExternal("rowMoved", from.getComponent());
|
|
20936
20954
|
}
|
|
20937
|
-
|
|
20955
|
+
|
|
20938
20956
|
moveRowActual(from, to, after){
|
|
20939
20957
|
this.moveRowInArray(this.rows, from, to, after);
|
|
20940
20958
|
this.moveRowInArray(this.activeRows, from, to, after);
|
|
20941
|
-
|
|
20959
|
+
|
|
20942
20960
|
this.displayRowIterator((rows) => {
|
|
20943
20961
|
this.moveRowInArray(rows, from, to, after);
|
|
20944
20962
|
});
|
|
20945
|
-
|
|
20963
|
+
|
|
20946
20964
|
this.dispatch("row-moving", from, to, after);
|
|
20947
20965
|
}
|
|
20948
|
-
|
|
20966
|
+
|
|
20949
20967
|
moveRowInArray(rows, from, to, after){
|
|
20950
20968
|
var fromIndex, toIndex, start, end;
|
|
20951
|
-
|
|
20969
|
+
|
|
20952
20970
|
if(from !== to){
|
|
20953
|
-
|
|
20971
|
+
|
|
20954
20972
|
fromIndex = rows.indexOf(from);
|
|
20955
|
-
|
|
20973
|
+
|
|
20956
20974
|
if (fromIndex > -1) {
|
|
20957
|
-
|
|
20975
|
+
|
|
20958
20976
|
rows.splice(fromIndex, 1);
|
|
20959
|
-
|
|
20977
|
+
|
|
20960
20978
|
toIndex = rows.indexOf(to);
|
|
20961
|
-
|
|
20979
|
+
|
|
20962
20980
|
if (toIndex > -1) {
|
|
20963
|
-
|
|
20981
|
+
|
|
20964
20982
|
if(after){
|
|
20965
20983
|
rows.splice(toIndex+1, 0, from);
|
|
20966
20984
|
}else {
|
|
20967
20985
|
rows.splice(toIndex, 0, from);
|
|
20968
20986
|
}
|
|
20969
|
-
|
|
20987
|
+
|
|
20970
20988
|
}else {
|
|
20971
20989
|
rows.splice(fromIndex, 0, from);
|
|
20972
20990
|
}
|
|
20973
20991
|
}
|
|
20974
|
-
|
|
20992
|
+
|
|
20975
20993
|
//restyle rows
|
|
20976
20994
|
if(rows === this.getDisplayRows()){
|
|
20977
|
-
|
|
20995
|
+
|
|
20978
20996
|
start = fromIndex < toIndex ? fromIndex : toIndex;
|
|
20979
20997
|
end = toIndex > fromIndex ? toIndex : fromIndex +1;
|
|
20980
|
-
|
|
20998
|
+
|
|
20981
20999
|
for(let i = start; i <= end; i++){
|
|
20982
21000
|
if(rows[i]){
|
|
20983
21001
|
this.styleRow(rows[i], i);
|
|
@@ -20986,104 +21004,104 @@ class RowManager extends CoreFeature{
|
|
|
20986
21004
|
}
|
|
20987
21005
|
}
|
|
20988
21006
|
}
|
|
20989
|
-
|
|
21007
|
+
|
|
20990
21008
|
clearData(){
|
|
20991
21009
|
this.setData([]);
|
|
20992
21010
|
}
|
|
20993
|
-
|
|
21011
|
+
|
|
20994
21012
|
getRowIndex(row){
|
|
20995
21013
|
return this.findRowIndex(row, this.rows);
|
|
20996
21014
|
}
|
|
20997
|
-
|
|
21015
|
+
|
|
20998
21016
|
getDisplayRowIndex(row){
|
|
20999
21017
|
var index = this.getDisplayRows().indexOf(row);
|
|
21000
21018
|
return index > -1 ? index : false;
|
|
21001
21019
|
}
|
|
21002
|
-
|
|
21020
|
+
|
|
21003
21021
|
nextDisplayRow(row, rowOnly){
|
|
21004
21022
|
var index = this.getDisplayRowIndex(row),
|
|
21005
21023
|
nextRow = false;
|
|
21006
|
-
|
|
21007
|
-
|
|
21024
|
+
|
|
21025
|
+
|
|
21008
21026
|
if(index !== false && index < this.displayRowsCount -1){
|
|
21009
21027
|
nextRow = this.getDisplayRows()[index+1];
|
|
21010
21028
|
}
|
|
21011
|
-
|
|
21029
|
+
|
|
21012
21030
|
if(nextRow && (!(nextRow instanceof Row) || nextRow.type != "row")){
|
|
21013
21031
|
return this.nextDisplayRow(nextRow, rowOnly);
|
|
21014
21032
|
}
|
|
21015
|
-
|
|
21033
|
+
|
|
21016
21034
|
return nextRow;
|
|
21017
21035
|
}
|
|
21018
|
-
|
|
21036
|
+
|
|
21019
21037
|
prevDisplayRow(row, rowOnly){
|
|
21020
21038
|
var index = this.getDisplayRowIndex(row),
|
|
21021
21039
|
prevRow = false;
|
|
21022
|
-
|
|
21040
|
+
|
|
21023
21041
|
if(index){
|
|
21024
21042
|
prevRow = this.getDisplayRows()[index-1];
|
|
21025
21043
|
}
|
|
21026
|
-
|
|
21044
|
+
|
|
21027
21045
|
if(rowOnly && prevRow && (!(prevRow instanceof Row) || prevRow.type != "row")){
|
|
21028
21046
|
return this.prevDisplayRow(prevRow, rowOnly);
|
|
21029
21047
|
}
|
|
21030
|
-
|
|
21048
|
+
|
|
21031
21049
|
return prevRow;
|
|
21032
21050
|
}
|
|
21033
|
-
|
|
21051
|
+
|
|
21034
21052
|
findRowIndex(row, list){
|
|
21035
21053
|
var rowIndex;
|
|
21036
|
-
|
|
21054
|
+
|
|
21037
21055
|
row = this.findRow(row);
|
|
21038
|
-
|
|
21056
|
+
|
|
21039
21057
|
if(row){
|
|
21040
21058
|
rowIndex = list.indexOf(row);
|
|
21041
|
-
|
|
21059
|
+
|
|
21042
21060
|
if(rowIndex > -1){
|
|
21043
21061
|
return rowIndex;
|
|
21044
21062
|
}
|
|
21045
21063
|
}
|
|
21046
|
-
|
|
21064
|
+
|
|
21047
21065
|
return false;
|
|
21048
21066
|
}
|
|
21049
|
-
|
|
21067
|
+
|
|
21050
21068
|
getData(active, transform){
|
|
21051
21069
|
var output = [],
|
|
21052
21070
|
rows = this.getRows(active);
|
|
21053
|
-
|
|
21071
|
+
|
|
21054
21072
|
rows.forEach(function(row){
|
|
21055
21073
|
if(row.type == "row"){
|
|
21056
21074
|
output.push(row.getData(transform || "data"));
|
|
21057
21075
|
}
|
|
21058
21076
|
});
|
|
21059
|
-
|
|
21077
|
+
|
|
21060
21078
|
return output;
|
|
21061
21079
|
}
|
|
21062
|
-
|
|
21080
|
+
|
|
21063
21081
|
getComponents(active){
|
|
21064
21082
|
var output = [],
|
|
21065
21083
|
rows = this.getRows(active);
|
|
21066
|
-
|
|
21084
|
+
|
|
21067
21085
|
rows.forEach(function(row){
|
|
21068
21086
|
output.push(row.getComponent());
|
|
21069
21087
|
});
|
|
21070
|
-
|
|
21088
|
+
|
|
21071
21089
|
return output;
|
|
21072
21090
|
}
|
|
21073
|
-
|
|
21091
|
+
|
|
21074
21092
|
getDataCount(active){
|
|
21075
21093
|
var rows = this.getRows(active);
|
|
21076
|
-
|
|
21094
|
+
|
|
21077
21095
|
return rows.length;
|
|
21078
21096
|
}
|
|
21079
|
-
|
|
21097
|
+
|
|
21080
21098
|
scrollHorizontal(left){
|
|
21081
21099
|
this.scrollLeft = left;
|
|
21082
21100
|
this.element.scrollLeft = left;
|
|
21083
|
-
|
|
21101
|
+
|
|
21084
21102
|
this.dispatch("scroll-horizontal", left);
|
|
21085
21103
|
}
|
|
21086
|
-
|
|
21104
|
+
|
|
21087
21105
|
registerDataPipelineHandler(handler, priority){
|
|
21088
21106
|
if(typeof priority !== "undefined"){
|
|
21089
21107
|
this.dataPipeline.push({handler, priority});
|
|
@@ -21094,7 +21112,7 @@ class RowManager extends CoreFeature{
|
|
|
21094
21112
|
console.error("Data pipeline handlers must have a priority in order to be registered");
|
|
21095
21113
|
}
|
|
21096
21114
|
}
|
|
21097
|
-
|
|
21115
|
+
|
|
21098
21116
|
registerDisplayPipelineHandler(handler, priority){
|
|
21099
21117
|
if(typeof priority !== "undefined"){
|
|
21100
21118
|
this.displayPipeline.push({handler, priority});
|
|
@@ -21105,23 +21123,23 @@ class RowManager extends CoreFeature{
|
|
|
21105
21123
|
console.error("Display pipeline handlers must have a priority in order to be registered");
|
|
21106
21124
|
}
|
|
21107
21125
|
}
|
|
21108
|
-
|
|
21126
|
+
|
|
21109
21127
|
//set active data set
|
|
21110
21128
|
refreshActiveData(handler, skipStage, renderInPosition){
|
|
21111
21129
|
var table = this.table,
|
|
21112
21130
|
stage = "",
|
|
21113
21131
|
index = 0,
|
|
21114
21132
|
cascadeOrder = ["all", "dataPipeline", "display", "displayPipeline", "end"];
|
|
21115
|
-
|
|
21116
|
-
|
|
21133
|
+
|
|
21134
|
+
|
|
21117
21135
|
if(typeof handler === "function"){
|
|
21118
21136
|
index = this.dataPipeline.findIndex((item) => {
|
|
21119
21137
|
return item.handler === handler;
|
|
21120
21138
|
});
|
|
21121
|
-
|
|
21139
|
+
|
|
21122
21140
|
if(index > -1){
|
|
21123
21141
|
stage = "dataPipeline";
|
|
21124
|
-
|
|
21142
|
+
|
|
21125
21143
|
if(skipStage){
|
|
21126
21144
|
if(index == this.dataPipeline.length - 1){
|
|
21127
21145
|
stage = "display";
|
|
@@ -21133,10 +21151,10 @@ class RowManager extends CoreFeature{
|
|
|
21133
21151
|
index = this.displayPipeline.findIndex((item) => {
|
|
21134
21152
|
return item.handler === handler;
|
|
21135
21153
|
});
|
|
21136
|
-
|
|
21154
|
+
|
|
21137
21155
|
if(index > -1){
|
|
21138
21156
|
stage = "displayPipeline";
|
|
21139
|
-
|
|
21157
|
+
|
|
21140
21158
|
if(skipStage){
|
|
21141
21159
|
if(index == this.displayPipeline.length - 1){
|
|
21142
21160
|
stage = "end";
|
|
@@ -21153,7 +21171,7 @@ class RowManager extends CoreFeature{
|
|
|
21153
21171
|
stage = handler || "all";
|
|
21154
21172
|
index = 0;
|
|
21155
21173
|
}
|
|
21156
|
-
|
|
21174
|
+
|
|
21157
21175
|
if(this.redrawBlock){
|
|
21158
21176
|
if(!this.redrawBlockRestoreConfig || (this.redrawBlockRestoreConfig && ((this.redrawBlockRestoreConfig.stage === stage && index < this.redrawBlockRestoreConfig.index) || (cascadeOrder.indexOf(stage) < cascadeOrder.indexOf(this.redrawBlockRestoreConfig.stage))))){
|
|
21159
21177
|
this.redrawBlockRestoreConfig = {
|
|
@@ -21164,102 +21182,107 @@ class RowManager extends CoreFeature{
|
|
|
21164
21182
|
index:index,
|
|
21165
21183
|
};
|
|
21166
21184
|
}
|
|
21167
|
-
|
|
21185
|
+
|
|
21168
21186
|
return;
|
|
21169
21187
|
}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
21188
|
if(Helpers.elVisible(this.element)){
|
|
21207
21189
|
if(renderInPosition){
|
|
21208
|
-
this.reRenderInPosition();
|
|
21190
|
+
this.reRenderInPosition(this.refreshPipelines.bind(this, handler, stage, index, renderInPosition));
|
|
21209
21191
|
}else {
|
|
21210
|
-
|
|
21192
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
21193
|
+
|
|
21211
21194
|
if(!handler){
|
|
21212
21195
|
this.table.columnManager.renderer.renderColumns();
|
|
21213
21196
|
}
|
|
21214
|
-
|
|
21197
|
+
|
|
21215
21198
|
this.renderTable();
|
|
21216
|
-
|
|
21199
|
+
|
|
21217
21200
|
if(table.options.layoutColumnsOnNewData){
|
|
21218
21201
|
this.table.columnManager.redraw(true);
|
|
21219
21202
|
}
|
|
21220
21203
|
}
|
|
21204
|
+
}else {
|
|
21205
|
+
this.refreshPipelines(handler, stage, index, renderInPosition);
|
|
21221
21206
|
}
|
|
21222
|
-
|
|
21207
|
+
|
|
21223
21208
|
this.dispatch("data-refreshed");
|
|
21224
21209
|
}
|
|
21225
21210
|
}
|
|
21226
|
-
|
|
21211
|
+
|
|
21212
|
+
refreshPipelines(handler, stage, index, renderInPosition){
|
|
21213
|
+
this.dispatch("data-refreshing");
|
|
21214
|
+
|
|
21215
|
+
if(!handler){
|
|
21216
|
+
this.activeRowsPipeline[0] = this.rows.slice(0);
|
|
21217
|
+
}
|
|
21218
|
+
|
|
21219
|
+
//cascade through data refresh stages
|
|
21220
|
+
switch(stage){
|
|
21221
|
+
case "all":
|
|
21222
|
+
//handle case where alldata needs refreshing
|
|
21223
|
+
|
|
21224
|
+
case "dataPipeline":
|
|
21225
|
+
|
|
21226
|
+
for(let i = index; i < this.dataPipeline.length; i++){
|
|
21227
|
+
let result = this.dataPipeline[i].handler(this.activeRowsPipeline[i].slice(0));
|
|
21228
|
+
|
|
21229
|
+
this.activeRowsPipeline[i + 1] = result || this.activeRowsPipeline[i].slice(0);
|
|
21230
|
+
}
|
|
21231
|
+
|
|
21232
|
+
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
21233
|
+
|
|
21234
|
+
this.regenerateRowNumbers();
|
|
21235
|
+
|
|
21236
|
+
case "display":
|
|
21237
|
+
index = 0;
|
|
21238
|
+
this.resetDisplayRows();
|
|
21239
|
+
|
|
21240
|
+
case "displayPipeline":
|
|
21241
|
+
for(let i = index; i < this.displayPipeline.length; i++){
|
|
21242
|
+
let result = this.displayPipeline[i].handler((i ? this.getDisplayRows(i - 1) : this.activeRows).slice(0), renderInPosition);
|
|
21243
|
+
|
|
21244
|
+
this.setDisplayRows(result || this.getDisplayRows(i - 1).slice(0), i);
|
|
21245
|
+
}
|
|
21246
|
+
//case to handle scenario when trying to skip past end stage
|
|
21247
|
+
}
|
|
21248
|
+
}
|
|
21249
|
+
|
|
21227
21250
|
//regenerate row numbers for row number formatter if in use
|
|
21228
21251
|
regenerateRowNumbers(){
|
|
21229
21252
|
if(this.rowNumColumn){
|
|
21230
21253
|
this.activeRows.forEach((row) => {
|
|
21231
21254
|
var cell = row.getCell(this.rowNumColumn);
|
|
21232
|
-
|
|
21255
|
+
|
|
21233
21256
|
if(cell){
|
|
21234
21257
|
cell._generateContents();
|
|
21235
21258
|
}
|
|
21236
21259
|
});
|
|
21237
21260
|
}
|
|
21238
21261
|
}
|
|
21239
|
-
|
|
21262
|
+
|
|
21240
21263
|
setActiveRows(activeRows){
|
|
21241
21264
|
this.activeRows = activeRows;
|
|
21242
21265
|
this.activeRowsCount = this.activeRows.length;
|
|
21243
21266
|
}
|
|
21244
|
-
|
|
21267
|
+
|
|
21245
21268
|
//reset display rows array
|
|
21246
21269
|
resetDisplayRows(){
|
|
21247
21270
|
this.displayRows = [];
|
|
21248
|
-
|
|
21271
|
+
|
|
21249
21272
|
this.displayRows.push(this.activeRows.slice(0));
|
|
21250
|
-
|
|
21273
|
+
|
|
21251
21274
|
this.displayRowsCount = this.displayRows[0].length;
|
|
21252
21275
|
}
|
|
21253
|
-
|
|
21276
|
+
|
|
21254
21277
|
getNextDisplayIndex(){
|
|
21255
21278
|
return this.displayRows.length;
|
|
21256
21279
|
}
|
|
21257
|
-
|
|
21280
|
+
|
|
21258
21281
|
//set display row pipeline data
|
|
21259
21282
|
setDisplayRows(displayRows, index){
|
|
21260
|
-
|
|
21283
|
+
|
|
21261
21284
|
var output = true;
|
|
21262
|
-
|
|
21285
|
+
|
|
21263
21286
|
if(index && typeof this.displayRows[index] != "undefined"){
|
|
21264
21287
|
this.displayRows[index] = displayRows;
|
|
21265
21288
|
output = true;
|
|
@@ -21267,14 +21290,14 @@ class RowManager extends CoreFeature{
|
|
|
21267
21290
|
this.displayRows.push(displayRows);
|
|
21268
21291
|
output = index = this.displayRows.length -1;
|
|
21269
21292
|
}
|
|
21270
|
-
|
|
21293
|
+
|
|
21271
21294
|
if(index == this.displayRows.length -1){
|
|
21272
21295
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
21273
21296
|
}
|
|
21274
|
-
|
|
21297
|
+
|
|
21275
21298
|
return output;
|
|
21276
21299
|
}
|
|
21277
|
-
|
|
21300
|
+
|
|
21278
21301
|
getDisplayRows(index){
|
|
21279
21302
|
if(typeof index == "undefined"){
|
|
21280
21303
|
return this.displayRows.length ? this.displayRows[this.displayRows.length -1] : [];
|
|
@@ -21282,49 +21305,49 @@ class RowManager extends CoreFeature{
|
|
|
21282
21305
|
return this.displayRows[index] || [];
|
|
21283
21306
|
}
|
|
21284
21307
|
}
|
|
21285
|
-
|
|
21308
|
+
|
|
21286
21309
|
getVisibleRows(chain, viewable){
|
|
21287
21310
|
var rows = Object.assign([], this.renderer.visibleRows(!viewable));
|
|
21288
|
-
|
|
21311
|
+
|
|
21289
21312
|
if(chain){
|
|
21290
21313
|
rows = this.chain("rows-visible", [viewable], rows, rows);
|
|
21291
21314
|
}
|
|
21292
|
-
|
|
21315
|
+
|
|
21293
21316
|
return rows;
|
|
21294
21317
|
}
|
|
21295
|
-
|
|
21318
|
+
|
|
21296
21319
|
//repeat action accross display rows
|
|
21297
21320
|
displayRowIterator(callback){
|
|
21298
21321
|
this.activeRowsPipeline.forEach(callback);
|
|
21299
21322
|
this.displayRows.forEach(callback);
|
|
21300
|
-
|
|
21323
|
+
|
|
21301
21324
|
this.displayRowsCount = this.displayRows[this.displayRows.length -1].length;
|
|
21302
21325
|
}
|
|
21303
|
-
|
|
21326
|
+
|
|
21304
21327
|
//return only actual rows (not group headers etc)
|
|
21305
21328
|
getRows(type){
|
|
21306
21329
|
var rows;
|
|
21307
|
-
|
|
21330
|
+
|
|
21308
21331
|
switch(type){
|
|
21309
21332
|
case "active":
|
|
21310
21333
|
rows = this.activeRows;
|
|
21311
21334
|
break;
|
|
21312
|
-
|
|
21335
|
+
|
|
21313
21336
|
case "display":
|
|
21314
21337
|
rows = this.table.rowManager.getDisplayRows();
|
|
21315
21338
|
break;
|
|
21316
|
-
|
|
21339
|
+
|
|
21317
21340
|
case "visible":
|
|
21318
|
-
rows = this.getVisibleRows(true);
|
|
21341
|
+
rows = this.getVisibleRows(false, true);
|
|
21319
21342
|
break;
|
|
21320
|
-
|
|
21343
|
+
|
|
21321
21344
|
default:
|
|
21322
21345
|
rows = this.chain("rows-retrieve", type, null, this.rows) || this.rows;
|
|
21323
21346
|
}
|
|
21324
|
-
|
|
21347
|
+
|
|
21325
21348
|
return rows;
|
|
21326
21349
|
}
|
|
21327
|
-
|
|
21350
|
+
|
|
21328
21351
|
///////////////// Table Rendering /////////////////
|
|
21329
21352
|
//trigger rerender of table in current position
|
|
21330
21353
|
reRenderInPosition(callback){
|
|
@@ -21338,25 +21361,25 @@ class RowManager extends CoreFeature{
|
|
|
21338
21361
|
this.renderer.rerenderRows(callback);
|
|
21339
21362
|
}
|
|
21340
21363
|
}
|
|
21341
|
-
|
|
21364
|
+
|
|
21342
21365
|
initializeRenderer(){
|
|
21343
21366
|
var renderClass;
|
|
21344
|
-
|
|
21367
|
+
|
|
21345
21368
|
var renderers = {
|
|
21346
21369
|
"virtual": VirtualDomVertical,
|
|
21347
21370
|
"basic": BaiscVertical,
|
|
21348
21371
|
};
|
|
21349
|
-
|
|
21372
|
+
|
|
21350
21373
|
if(typeof this.table.options.renderVertical === "string"){
|
|
21351
21374
|
renderClass = renderers[this.table.options.renderVertical];
|
|
21352
21375
|
}else {
|
|
21353
21376
|
renderClass = this.table.options.renderVertical;
|
|
21354
21377
|
}
|
|
21355
|
-
|
|
21378
|
+
|
|
21356
21379
|
if(renderClass){
|
|
21357
21380
|
this.renderer = new renderClass(this.table, this.element, this.tableElement);
|
|
21358
21381
|
this.renderer.initialize();
|
|
21359
|
-
|
|
21382
|
+
|
|
21360
21383
|
if((this.table.element.clientHeight || this.table.options.height)){
|
|
21361
21384
|
this.fixedHeight = true;
|
|
21362
21385
|
}else {
|
|
@@ -21366,21 +21389,21 @@ class RowManager extends CoreFeature{
|
|
|
21366
21389
|
console.error("Unable to find matching renderer:", table.options.renderVertical);
|
|
21367
21390
|
}
|
|
21368
21391
|
}
|
|
21369
|
-
|
|
21392
|
+
|
|
21370
21393
|
getRenderMode(){
|
|
21371
21394
|
return this.renderMode;
|
|
21372
21395
|
}
|
|
21373
|
-
|
|
21396
|
+
|
|
21374
21397
|
renderTable(){
|
|
21375
21398
|
this.dispatchExternal("renderStarted");
|
|
21376
|
-
|
|
21399
|
+
|
|
21377
21400
|
this.element.scrollTop = 0;
|
|
21378
|
-
|
|
21401
|
+
|
|
21379
21402
|
this._clearTable();
|
|
21380
|
-
|
|
21403
|
+
|
|
21381
21404
|
if(this.displayRowsCount){
|
|
21382
21405
|
this.renderer.renderRows();
|
|
21383
|
-
|
|
21406
|
+
|
|
21384
21407
|
if(this.firstRender){
|
|
21385
21408
|
this.firstRender = false;
|
|
21386
21409
|
this.layoutRefresh();
|
|
@@ -21388,23 +21411,23 @@ class RowManager extends CoreFeature{
|
|
|
21388
21411
|
}else {
|
|
21389
21412
|
this.renderEmptyScroll();
|
|
21390
21413
|
}
|
|
21391
|
-
|
|
21414
|
+
|
|
21392
21415
|
if(!this.fixedHeight){
|
|
21393
21416
|
this.adjustTableSize();
|
|
21394
21417
|
}
|
|
21395
|
-
|
|
21418
|
+
|
|
21396
21419
|
this.dispatch("table-layout");
|
|
21397
|
-
|
|
21420
|
+
|
|
21398
21421
|
if(!this.displayRowsCount){
|
|
21399
21422
|
this._showPlaceholder();
|
|
21400
21423
|
}
|
|
21401
|
-
|
|
21424
|
+
|
|
21402
21425
|
this.dispatchExternal("renderComplete");
|
|
21403
21426
|
}
|
|
21404
|
-
|
|
21427
|
+
|
|
21405
21428
|
//show scrollbars on empty table div
|
|
21406
21429
|
renderEmptyScroll(){
|
|
21407
|
-
if(this.
|
|
21430
|
+
if(this.placeholder){
|
|
21408
21431
|
this.tableElement.style.display = "none";
|
|
21409
21432
|
}else {
|
|
21410
21433
|
this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px";
|
|
@@ -21412,37 +21435,44 @@ class RowManager extends CoreFeature{
|
|
|
21412
21435
|
// this.tableElement.style.visibility = "hidden";
|
|
21413
21436
|
}
|
|
21414
21437
|
}
|
|
21415
|
-
|
|
21438
|
+
|
|
21416
21439
|
_clearTable(){
|
|
21417
21440
|
var element = this.tableElement;
|
|
21418
|
-
|
|
21441
|
+
|
|
21419
21442
|
this._clearPlaceholder();
|
|
21420
|
-
|
|
21443
|
+
|
|
21421
21444
|
this.scrollTop = 0;
|
|
21422
21445
|
this.scrollLeft = 0;
|
|
21423
|
-
|
|
21446
|
+
|
|
21424
21447
|
this.renderer.clearRows();
|
|
21425
21448
|
}
|
|
21426
|
-
|
|
21449
|
+
|
|
21427
21450
|
_showPlaceholder(){
|
|
21428
|
-
if(this.
|
|
21429
|
-
|
|
21430
|
-
|
|
21431
|
-
|
|
21432
|
-
this.
|
|
21433
|
-
this.table.options.placeholder.style.width = this.table.columnManager.getWidth() + "px";
|
|
21451
|
+
if(this.placeholder){
|
|
21452
|
+
this.placeholder.setAttribute("tabulator-render-mode", this.renderMode);
|
|
21453
|
+
|
|
21454
|
+
this.getElement().appendChild(this.placeholder);
|
|
21455
|
+
this._positionPlaceholder();
|
|
21434
21456
|
}
|
|
21435
21457
|
}
|
|
21436
|
-
|
|
21458
|
+
|
|
21437
21459
|
_clearPlaceholder(){
|
|
21438
|
-
if(this.
|
|
21439
|
-
this.
|
|
21460
|
+
if(this.placeholder && this.placeholder.parentNode){
|
|
21461
|
+
this.placeholder.parentNode.removeChild(this.placeholder);
|
|
21440
21462
|
}
|
|
21441
21463
|
}
|
|
21442
|
-
|
|
21464
|
+
|
|
21465
|
+
_positionPlaceholder(){
|
|
21466
|
+
if(this.placeholder && this.placeholder.parentNode){
|
|
21467
|
+
this.placeholder.style.width = this.table.columnManager.getWidth() + "px";
|
|
21468
|
+
this.placeholderContents.style.width = this.table.rowManager.element.clientWidth + "px";
|
|
21469
|
+
this.placeholderContents.style.marginLeft = this.scrollLeft + "px";
|
|
21470
|
+
}
|
|
21471
|
+
}
|
|
21472
|
+
|
|
21443
21473
|
styleRow(row, index){
|
|
21444
21474
|
var rowEl = row.getElement();
|
|
21445
|
-
|
|
21475
|
+
|
|
21446
21476
|
if(index % 2){
|
|
21447
21477
|
rowEl.classList.add("tabulator-row-even");
|
|
21448
21478
|
rowEl.classList.remove("tabulator-row-odd");
|
|
@@ -21451,21 +21481,21 @@ class RowManager extends CoreFeature{
|
|
|
21451
21481
|
rowEl.classList.remove("tabulator-row-even");
|
|
21452
21482
|
}
|
|
21453
21483
|
}
|
|
21454
|
-
|
|
21484
|
+
|
|
21455
21485
|
//normalize height of active rows
|
|
21456
21486
|
normalizeHeight(){
|
|
21457
21487
|
this.activeRows.forEach(function(row){
|
|
21458
21488
|
row.normalizeHeight();
|
|
21459
21489
|
});
|
|
21460
21490
|
}
|
|
21461
|
-
|
|
21491
|
+
|
|
21462
21492
|
//adjust the height of the table holder to fit in the Tabulator element
|
|
21463
21493
|
adjustTableSize(){
|
|
21464
21494
|
var initialHeight = this.element.clientHeight;
|
|
21465
|
-
|
|
21495
|
+
|
|
21466
21496
|
if(this.renderer.verticalFillMode === "fill"){
|
|
21467
21497
|
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
|
-
|
|
21498
|
+
|
|
21469
21499
|
if(this.fixedHeight){
|
|
21470
21500
|
this.element.style.minHeight = "calc(100% - " + otherHeight + "px)";
|
|
21471
21501
|
this.element.style.height = "calc(100% - " + otherHeight + "px)";
|
|
@@ -21475,9 +21505,9 @@ class RowManager extends CoreFeature{
|
|
|
21475
21505
|
this.element.style.height = (this.table.element.clientHeight - otherHeight) + "px";
|
|
21476
21506
|
this.element.scrollTop = this.scrollTop;
|
|
21477
21507
|
}
|
|
21478
|
-
|
|
21508
|
+
|
|
21479
21509
|
this.renderer.resize();
|
|
21480
|
-
|
|
21510
|
+
|
|
21481
21511
|
//check if the table has changed size when dealing with variable height tables
|
|
21482
21512
|
if(!this.fixedHeight && initialHeight != this.element.clientHeight){
|
|
21483
21513
|
if(this.subscribed("table-resize")){
|
|
@@ -21487,50 +21517,52 @@ class RowManager extends CoreFeature{
|
|
|
21487
21517
|
}
|
|
21488
21518
|
}
|
|
21489
21519
|
}
|
|
21490
|
-
}
|
|
21491
21520
|
|
|
21521
|
+
this._positionPlaceholder();
|
|
21522
|
+
}
|
|
21523
|
+
|
|
21492
21524
|
//renitialize all rows
|
|
21493
21525
|
reinitialize(){
|
|
21494
21526
|
this.rows.forEach(function(row){
|
|
21495
21527
|
row.reinitialize(true);
|
|
21496
21528
|
});
|
|
21497
21529
|
}
|
|
21498
|
-
|
|
21530
|
+
|
|
21499
21531
|
//prevent table from being redrawn
|
|
21500
21532
|
blockRedraw (){
|
|
21501
21533
|
this.redrawBlock = true;
|
|
21502
21534
|
this.redrawBlockRestoreConfig = false;
|
|
21503
21535
|
}
|
|
21504
|
-
|
|
21536
|
+
|
|
21505
21537
|
//restore table redrawing
|
|
21506
21538
|
restoreRedraw (){
|
|
21507
21539
|
this.redrawBlock = false;
|
|
21508
|
-
|
|
21540
|
+
|
|
21509
21541
|
if(this.redrawBlockRestoreConfig){
|
|
21510
21542
|
this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition);
|
|
21511
|
-
|
|
21543
|
+
|
|
21512
21544
|
this.redrawBlockRestoreConfig = false;
|
|
21513
21545
|
}else {
|
|
21514
21546
|
if(this.redrawBlockRenderInPosition){
|
|
21515
21547
|
this.reRenderInPosition();
|
|
21516
21548
|
}
|
|
21517
21549
|
}
|
|
21518
|
-
|
|
21550
|
+
|
|
21519
21551
|
this.redrawBlockRenderInPosition = false;
|
|
21520
21552
|
}
|
|
21521
|
-
|
|
21553
|
+
|
|
21522
21554
|
//redraw table
|
|
21523
21555
|
redraw (force){
|
|
21524
21556
|
var left = this.scrollLeft;
|
|
21525
|
-
|
|
21557
|
+
|
|
21526
21558
|
this.adjustTableSize();
|
|
21527
|
-
|
|
21559
|
+
|
|
21528
21560
|
this.table.tableWidth = this.table.element.clientWidth;
|
|
21529
|
-
|
|
21561
|
+
|
|
21530
21562
|
if(!force){
|
|
21531
21563
|
this.reRenderInPosition();
|
|
21532
21564
|
this.scrollHorizontal(left);
|
|
21533
|
-
|
|
21565
|
+
|
|
21534
21566
|
if(!this.displayRowsCount){
|
|
21535
21567
|
if(this.table.options.placeholder){
|
|
21536
21568
|
this.getElement().appendChild(this.table.options.placeholder);
|
|
@@ -21540,11 +21572,11 @@ class RowManager extends CoreFeature{
|
|
|
21540
21572
|
this.renderTable();
|
|
21541
21573
|
}
|
|
21542
21574
|
}
|
|
21543
|
-
|
|
21575
|
+
|
|
21544
21576
|
resetScroll(){
|
|
21545
21577
|
this.element.scrollLeft = 0;
|
|
21546
21578
|
this.element.scrollTop = 0;
|
|
21547
|
-
|
|
21579
|
+
|
|
21548
21580
|
if(this.table.browser === "ie"){
|
|
21549
21581
|
var event = document.createEvent("Event");
|
|
21550
21582
|
event.initEvent("scroll", false, true);
|
|
@@ -21562,6 +21594,7 @@ class FooterManager extends CoreFeature{
|
|
|
21562
21594
|
|
|
21563
21595
|
this.active = false;
|
|
21564
21596
|
this.element = this.createElement(); //containing element
|
|
21597
|
+
this.containerElement = this.createContainerElement(); //containing element
|
|
21565
21598
|
this.external = false;
|
|
21566
21599
|
this.links = [];
|
|
21567
21600
|
|
|
@@ -21572,7 +21605,7 @@ class FooterManager extends CoreFeature{
|
|
|
21572
21605
|
this.initializeElement();
|
|
21573
21606
|
}
|
|
21574
21607
|
|
|
21575
|
-
createElement
|
|
21608
|
+
createElement(){
|
|
21576
21609
|
var el = document.createElement("div");
|
|
21577
21610
|
|
|
21578
21611
|
el.classList.add("tabulator-footer");
|
|
@@ -21580,6 +21613,17 @@ class FooterManager extends CoreFeature{
|
|
|
21580
21613
|
return el;
|
|
21581
21614
|
}
|
|
21582
21615
|
|
|
21616
|
+
|
|
21617
|
+
createContainerElement(){
|
|
21618
|
+
var el = document.createElement("div");
|
|
21619
|
+
|
|
21620
|
+
el.classList.add("tabulator-footer-contents");
|
|
21621
|
+
|
|
21622
|
+
this.element.appendChild(el);
|
|
21623
|
+
|
|
21624
|
+
return el;
|
|
21625
|
+
}
|
|
21626
|
+
|
|
21583
21627
|
initializeElement(){
|
|
21584
21628
|
if(this.table.options.footerElement){
|
|
21585
21629
|
|
|
@@ -21607,7 +21651,7 @@ class FooterManager extends CoreFeature{
|
|
|
21607
21651
|
append(element, parent){
|
|
21608
21652
|
this.activate(parent);
|
|
21609
21653
|
|
|
21610
|
-
this.
|
|
21654
|
+
this.containerElement.appendChild(element);
|
|
21611
21655
|
this.table.rowManager.adjustTableSize();
|
|
21612
21656
|
}
|
|
21613
21657
|
|
|
@@ -21683,7 +21727,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21683
21727
|
"tabulator-group":"group",
|
|
21684
21728
|
"tabulator-col":"column",
|
|
21685
21729
|
};
|
|
21686
|
-
|
|
21730
|
+
|
|
21687
21731
|
this.pseudoTrackers = {
|
|
21688
21732
|
"row":{
|
|
21689
21733
|
subscriber:null,
|
|
@@ -21702,12 +21746,13 @@ class InteractionManager extends CoreFeature {
|
|
|
21702
21746
|
target:null,
|
|
21703
21747
|
},
|
|
21704
21748
|
};
|
|
21705
|
-
|
|
21749
|
+
|
|
21706
21750
|
this.pseudoTracking = false;
|
|
21707
21751
|
}
|
|
21708
21752
|
|
|
21709
21753
|
initialize(){
|
|
21710
21754
|
this.el = this.table.element;
|
|
21755
|
+
|
|
21711
21756
|
this.buildListenerMap();
|
|
21712
21757
|
this.bindSubscriptionWatchers();
|
|
21713
21758
|
}
|
|
@@ -21724,55 +21769,55 @@ class InteractionManager extends CoreFeature {
|
|
|
21724
21769
|
|
|
21725
21770
|
this.listeners = listenerMap;
|
|
21726
21771
|
}
|
|
21727
|
-
|
|
21772
|
+
|
|
21728
21773
|
bindPseudoEvents(){
|
|
21729
21774
|
Object.keys(this.pseudoTrackers).forEach((key) => {
|
|
21730
21775
|
this.pseudoTrackers[key].subscriber = this.pseudoMouseEnter.bind(this, key);
|
|
21731
21776
|
this.subscribe(key + "-mouseover", this.pseudoTrackers[key].subscriber);
|
|
21732
21777
|
});
|
|
21733
|
-
|
|
21778
|
+
|
|
21734
21779
|
this.pseudoTracking = true;
|
|
21735
21780
|
}
|
|
21736
|
-
|
|
21781
|
+
|
|
21737
21782
|
pseudoMouseEnter(key, e, target){
|
|
21738
21783
|
if(this.pseudoTrackers[key].target !== target){
|
|
21739
21784
|
|
|
21740
21785
|
if(this.pseudoTrackers[key].target){
|
|
21741
21786
|
this.dispatch(key + "-mouseleave", e, target);
|
|
21742
21787
|
}
|
|
21743
|
-
|
|
21788
|
+
|
|
21744
21789
|
this.pseudoMouseLeave(key, e);
|
|
21745
|
-
|
|
21790
|
+
|
|
21746
21791
|
this.pseudoTrackers[key].target = target;
|
|
21747
|
-
|
|
21792
|
+
|
|
21748
21793
|
this.dispatch(key + "-mouseenter", e, target);
|
|
21749
21794
|
}
|
|
21750
21795
|
}
|
|
21751
|
-
|
|
21796
|
+
|
|
21752
21797
|
pseudoMouseLeave(key, e){
|
|
21753
21798
|
var leaveList = Object.keys(this.pseudoTrackers),
|
|
21754
21799
|
linkedKeys = {
|
|
21755
21800
|
"row":["cell"],
|
|
21756
21801
|
"cell":["row"],
|
|
21757
21802
|
};
|
|
21758
|
-
|
|
21803
|
+
|
|
21759
21804
|
leaveList = leaveList.filter((item) => {
|
|
21760
21805
|
var links = linkedKeys[key];
|
|
21761
21806
|
return item !== key && (!links || (links && !links.includes(item)));
|
|
21762
21807
|
});
|
|
21763
|
-
|
|
21764
|
-
|
|
21808
|
+
|
|
21809
|
+
|
|
21765
21810
|
leaveList.forEach((key) => {
|
|
21766
21811
|
var target = this.pseudoTrackers[key].target;
|
|
21767
|
-
|
|
21812
|
+
|
|
21768
21813
|
if(this.pseudoTrackers[key].target){
|
|
21769
21814
|
this.dispatch(key + "-mouseleave", e, target);
|
|
21770
|
-
|
|
21815
|
+
|
|
21771
21816
|
this.pseudoTrackers[key].target = null;
|
|
21772
21817
|
}
|
|
21773
21818
|
});
|
|
21774
21819
|
}
|
|
21775
|
-
|
|
21820
|
+
|
|
21776
21821
|
|
|
21777
21822
|
bindSubscriptionWatchers(){
|
|
21778
21823
|
var listeners = Object.keys(this.listeners),
|
|
@@ -21793,7 +21838,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21793
21838
|
var listener = this.listeners[key].components,
|
|
21794
21839
|
index = listener.indexOf(component),
|
|
21795
21840
|
changed = false;
|
|
21796
|
-
|
|
21841
|
+
|
|
21797
21842
|
if(added){
|
|
21798
21843
|
if(index === -1){
|
|
21799
21844
|
listener.push(component);
|
|
@@ -21807,7 +21852,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21807
21852
|
}
|
|
21808
21853
|
}
|
|
21809
21854
|
}
|
|
21810
|
-
|
|
21855
|
+
|
|
21811
21856
|
if((key === "mouseenter" || key === "mouseleave") && !this.pseudoTracking){
|
|
21812
21857
|
this.bindPseudoEvents();
|
|
21813
21858
|
}
|
|
@@ -21841,9 +21886,9 @@ class InteractionManager extends CoreFeature {
|
|
|
21841
21886
|
|
|
21842
21887
|
var targets = this.findTargets(path);
|
|
21843
21888
|
targets = this.bindComponents(type, targets);
|
|
21844
|
-
|
|
21889
|
+
|
|
21845
21890
|
this.triggerEvents(type, e, targets);
|
|
21846
|
-
|
|
21891
|
+
|
|
21847
21892
|
if(this.pseudoTracking && (type == "mouseover" || type == "mouseleave") && !Object.keys(targets).length){
|
|
21848
21893
|
this.pseudoMouseLeave("none", e);
|
|
21849
21894
|
}
|
|
@@ -21904,6 +21949,10 @@ class InteractionManager extends CoreFeature {
|
|
|
21904
21949
|
component = rows.find((row) => {
|
|
21905
21950
|
return row.getElement() === target;
|
|
21906
21951
|
});
|
|
21952
|
+
|
|
21953
|
+
if(targets["row"].parentNode && targets["row"].parentNode.closest(".tabulator-row")){
|
|
21954
|
+
targets[key] = false;
|
|
21955
|
+
}
|
|
21907
21956
|
}
|
|
21908
21957
|
break;
|
|
21909
21958
|
|
|
@@ -21915,10 +21964,12 @@ class InteractionManager extends CoreFeature {
|
|
|
21915
21964
|
|
|
21916
21965
|
case "cell":
|
|
21917
21966
|
if(listener.components.includes("cell")){
|
|
21918
|
-
if(targets["row"]){
|
|
21967
|
+
if(targets["row"] instanceof Row){
|
|
21919
21968
|
component = targets["row"].findCell(target);
|
|
21920
|
-
}else {
|
|
21921
|
-
|
|
21969
|
+
}else {
|
|
21970
|
+
if(targets["row"]){
|
|
21971
|
+
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?");
|
|
21972
|
+
}
|
|
21922
21973
|
}
|
|
21923
21974
|
}
|
|
21924
21975
|
break;
|
|
@@ -21952,7 +22003,7 @@ class InteractionManager extends CoreFeature {
|
|
|
21952
22003
|
clearWatchers(){
|
|
21953
22004
|
for(let key in this.listeners){
|
|
21954
22005
|
let listener = this.listeners[key];
|
|
21955
|
-
|
|
22006
|
+
|
|
21956
22007
|
if(listener.handler){
|
|
21957
22008
|
this.el.removeEventListener(key, listener.handler);
|
|
21958
22009
|
listener.handler = null;
|