tabulator-tables 5.5.0 → 5.5.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/Bundler.js +7 -3
- package/dist/css/tabulator.css +5 -0
- 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 +5 -0
- 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 +5 -0
- package/dist/css/tabulator_bootstrap4.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.min.css +1 -1
- package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.css +5 -0
- package/dist/css/tabulator_bootstrap5.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.min.css +1 -1
- package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
- package/dist/css/tabulator_bulma.css +5 -0
- 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 +20 -15
- 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 +5 -0
- 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 +5 -0
- 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 +7 -2
- 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 +5 -0
- 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 +5 -0
- 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/jquery_wrapper.js +10 -2
- package/dist/js/tabulator.js +155 -90
- 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 +155 -90
- 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 +3 -2
- package/src/js/builds/jquery_wrapper.js +10 -2
- package/src/js/core/RowManager.js +2 -0
- package/src/js/core/rendering/renderers/BasicHorizontal.js +9 -7
- package/src/js/core/rendering/renderers/BasicVertical.js +43 -25
- package/src/js/core/rendering/renderers/VirtualDomVertical.js +6 -3
- package/src/js/core/row/Row.js +9 -3
- package/src/js/core/tools/DataLoader.js +44 -36
- package/src/js/modules/DataTree/DataTree.js +4 -1
- package/src/js/modules/GroupRows/Group.js +27 -10
- package/src/js/modules/History/defaults/redoers.js +4 -2
- package/src/js/modules/History/defaults/undoers.js +6 -2
- package/src/scss/tabulator.scss +5 -0
- package/src/scss/themes/materialize/tabulator_materialize.scss +2 -2
- package/src/scss/themes/materialize/variables.scss +1 -1
- package/src/scss/themes/semanticui/tabulator_semanticui.scss +1 -1
- package/src/scss/themes/semanticui/variables_table.scss +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tabulator-tables",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.1",
|
|
4
4
|
"description": "Interactive table generation JavaScript library",
|
|
5
5
|
"style": "dist/css/tabulator.css",
|
|
6
6
|
"main": "dist/js/tabulator.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"dev": "rollup -c build/rollup.js -w --environment TARGET:dev",
|
|
17
17
|
"dev:css": "rollup -c build/rollup.js -w --environment TARGET:css",
|
|
18
18
|
"dev:esm": "rollup -c build/rollup.js -w --environment TARGET:esm",
|
|
19
|
-
"dev:umd": "rollup -c build/rollup.js -w --environment TARGET:umd"
|
|
19
|
+
"dev:umd": "rollup -c build/rollup.js -w --environment TARGET:umd",
|
|
20
|
+
"dev:wrappers": "rollup -c build/rollup.js -w --environment TARGET:wrappers"
|
|
20
21
|
},
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|
|
@@ -30,15 +30,23 @@
|
|
|
30
30
|
$.widget("ui.tabulator", {
|
|
31
31
|
_create:function(){
|
|
32
32
|
var options = Object.assign({}, this.options);
|
|
33
|
+
var props = [];
|
|
33
34
|
|
|
34
35
|
delete options.create;
|
|
35
36
|
delete options.disabled;
|
|
36
37
|
|
|
37
38
|
this.table = new Tabulator(this.element[0], options);
|
|
39
|
+
window.table = this.table;
|
|
40
|
+
|
|
41
|
+
//retrieve properties on prototype
|
|
42
|
+
props = Object.getOwnPropertyNames(Object.getPrototypeOf(Object.getPrototypeOf(this.table)));
|
|
43
|
+
|
|
44
|
+
//retrieve properties added by modules
|
|
45
|
+
props = props.concat(Object.getOwnPropertyNames(this.table));
|
|
38
46
|
|
|
39
47
|
//map tabulator functions to jquery wrapper
|
|
40
|
-
for(
|
|
41
|
-
if(typeof
|
|
48
|
+
for(let key of props){
|
|
49
|
+
if(typeof this.table[key] === "function" && key.charAt(0) !== "_"){
|
|
42
50
|
this[key] = this.table[key].bind(this.table);
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -4,19 +4,21 @@ export default class BasicHorizontal extends Renderer{
|
|
|
4
4
|
constructor(table){
|
|
5
5
|
super(table);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
renderRowCells(row) {
|
|
7
|
+
|
|
8
|
+
renderRowCells(row, inFragment) {
|
|
9
9
|
const rowFrag = document.createDocumentFragment();
|
|
10
10
|
row.cells.forEach((cell) => {
|
|
11
11
|
rowFrag.appendChild(cell.getElement());
|
|
12
12
|
});
|
|
13
13
|
row.element.appendChild(rowFrag);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
|
|
15
|
+
if(!inFragment){
|
|
16
|
+
row.cells.forEach((cell) => {
|
|
17
|
+
cell.cellRendered();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
|
|
20
22
|
reinitializeColumnWidths(columns){
|
|
21
23
|
columns.forEach(function(column){
|
|
22
24
|
column.reinitializeWidth();
|
|
@@ -4,80 +4,98 @@ import Helpers from '../../tools/Helpers.js';
|
|
|
4
4
|
export default class BasicVertical extends Renderer{
|
|
5
5
|
constructor(table){
|
|
6
6
|
super(table);
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
this.verticalFillMode = "fill";
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
this.scrollTop = 0;
|
|
11
11
|
this.scrollLeft = 0;
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
this.scrollTop = 0;
|
|
14
14
|
this.scrollLeft = 0;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
clearRows(){
|
|
18
18
|
var element = this.tableElement;
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
// element.children.detach();
|
|
21
21
|
while(element.firstChild) element.removeChild(element.firstChild);
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
element.scrollTop = 0;
|
|
24
24
|
element.scrollLeft = 0;
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
element.style.minWidth = "";
|
|
27
27
|
element.style.minHeight = "";
|
|
28
28
|
element.style.display = "";
|
|
29
29
|
element.style.visibility = "";
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
renderRows() {
|
|
33
33
|
var element = this.tableElement,
|
|
34
34
|
onlyGroupHeaders = true,
|
|
35
|
-
tableFrag = document.createDocumentFragment()
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
tableFrag = document.createDocumentFragment(),
|
|
36
|
+
rows = this.rows();
|
|
37
|
+
|
|
38
|
+
rows.forEach((row, index) => {
|
|
38
39
|
this.styleRow(row, index);
|
|
39
|
-
row.initialize(true);
|
|
40
|
-
|
|
40
|
+
row.initialize(false, true);
|
|
41
|
+
|
|
41
42
|
if (row.type !== "group") {
|
|
42
43
|
onlyGroupHeaders = false;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
|
|
45
46
|
tableFrag.appendChild(row.getElement());
|
|
46
47
|
});
|
|
48
|
+
|
|
47
49
|
element.appendChild(tableFrag);
|
|
48
|
-
|
|
50
|
+
|
|
51
|
+
rows.forEach((row) => {
|
|
52
|
+
row.rendered();
|
|
53
|
+
|
|
54
|
+
if(!row.heightInitialized) {
|
|
55
|
+
row.calcHeight(true);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
rows.forEach((row) => {
|
|
60
|
+
if(!row.heightInitialized) {
|
|
61
|
+
row.setCellHeight();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
49
67
|
if(onlyGroupHeaders){
|
|
50
68
|
element.style.minWidth = this.table.columnManager.getWidth() + "px";
|
|
51
69
|
}else{
|
|
52
70
|
element.style.minWidth = "";
|
|
53
71
|
}
|
|
54
72
|
}
|
|
55
|
-
|
|
56
|
-
|
|
73
|
+
|
|
74
|
+
|
|
57
75
|
rerenderRows(callback){
|
|
58
76
|
this.clearRows();
|
|
59
|
-
|
|
77
|
+
|
|
60
78
|
if(callback){
|
|
61
79
|
callback();
|
|
62
80
|
}
|
|
63
|
-
|
|
81
|
+
|
|
64
82
|
this.renderRows();
|
|
65
83
|
}
|
|
66
|
-
|
|
84
|
+
|
|
67
85
|
scrollToRowNearestTop(row){
|
|
68
86
|
var rowTop = Helpers.elOffset(row.getElement()).top;
|
|
69
|
-
|
|
87
|
+
|
|
70
88
|
return !(Math.abs(this.elementVertical.scrollTop - rowTop) > Math.abs(this.elementVertical.scrollTop + this.elementVertical.clientHeight - rowTop));
|
|
71
89
|
}
|
|
72
|
-
|
|
90
|
+
|
|
73
91
|
scrollToRow(row){
|
|
74
92
|
var rowEl = row.getElement();
|
|
75
|
-
|
|
93
|
+
|
|
76
94
|
this.elementVertical.scrollTop = Helpers.elOffset(rowEl).top - Helpers.elOffset(this.elementVertical).top + this.elementVertical.scrollTop;
|
|
77
95
|
}
|
|
78
|
-
|
|
96
|
+
|
|
79
97
|
visibleRows(includingBuffer){
|
|
80
98
|
return this.rows();
|
|
81
99
|
}
|
|
82
|
-
|
|
100
|
+
|
|
83
101
|
}
|
|
@@ -287,13 +287,14 @@ export default class VirtualDomVertical extends Renderer{
|
|
|
287
287
|
rowFragment = document.createDocumentFragment();
|
|
288
288
|
|
|
289
289
|
i = 0;
|
|
290
|
+
|
|
290
291
|
while ((i < rowsToRender) && this.vDomBottom < rowsCount -1) {
|
|
291
292
|
index = this.vDomBottom + 1,
|
|
292
293
|
row = rows[index];
|
|
293
294
|
|
|
294
295
|
this.styleRow(row, index);
|
|
295
296
|
|
|
296
|
-
row.initialize();
|
|
297
|
+
row.initialize(false, true);
|
|
297
298
|
if(!row.heightInitialized && !this.table.options.rowHeight){
|
|
298
299
|
row.clearCellHeight();
|
|
299
300
|
}
|
|
@@ -307,21 +308,23 @@ export default class VirtualDomVertical extends Renderer{
|
|
|
307
308
|
if(!renderedRows.length){
|
|
308
309
|
break;
|
|
309
310
|
}
|
|
311
|
+
|
|
310
312
|
element.appendChild(rowFragment);
|
|
311
313
|
|
|
312
314
|
// NOTE: The next 3 loops are separate on purpose
|
|
313
315
|
// This is to batch up the dom writes and reads which drastically improves performance
|
|
316
|
+
|
|
314
317
|
renderedRows.forEach((row) => {
|
|
318
|
+
row.rendered();
|
|
319
|
+
|
|
315
320
|
if(!row.heightInitialized) {
|
|
316
321
|
row.calcHeight(true);
|
|
317
|
-
|
|
318
322
|
}
|
|
319
323
|
});
|
|
320
324
|
|
|
321
325
|
renderedRows.forEach((row) => {
|
|
322
326
|
if(!row.heightInitialized) {
|
|
323
327
|
row.setCellHeight();
|
|
324
|
-
|
|
325
328
|
}
|
|
326
329
|
});
|
|
327
330
|
|
package/src/js/core/row/Row.js
CHANGED
|
@@ -65,7 +65,7 @@ export default class Row extends CoreFeature{
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//functions to setup on first render
|
|
68
|
-
initialize(force){
|
|
68
|
+
initialize(force, inFragment){
|
|
69
69
|
this.create();
|
|
70
70
|
|
|
71
71
|
if(!this.initialized || force){
|
|
@@ -80,7 +80,7 @@ export default class Row extends CoreFeature{
|
|
|
80
80
|
|
|
81
81
|
this.initialized = true;
|
|
82
82
|
|
|
83
|
-
this.table.columnManager.renderer.renderRowCells(this);
|
|
83
|
+
this.table.columnManager.renderer.renderRowCells(this, inFragment);
|
|
84
84
|
|
|
85
85
|
if(force){
|
|
86
86
|
this.normalizeHeight();
|
|
@@ -94,9 +94,15 @@ export default class Row extends CoreFeature{
|
|
|
94
94
|
|
|
95
95
|
this.dispatch("row-layout-after", this);
|
|
96
96
|
}else{
|
|
97
|
-
this.table.columnManager.renderer.rerenderRowCells(this);
|
|
97
|
+
this.table.columnManager.renderer.rerenderRowCells(this, inFragment);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
+
|
|
101
|
+
rendered(){
|
|
102
|
+
this.cells.forEach((cell) => {
|
|
103
|
+
cell.cellRendered();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
100
106
|
|
|
101
107
|
reinitializeHeight(){
|
|
102
108
|
this.heightInitialized = false;
|
|
@@ -3,58 +3,66 @@ import CoreFeature from '../CoreFeature.js';
|
|
|
3
3
|
export default class DataLoader extends CoreFeature{
|
|
4
4
|
constructor(table){
|
|
5
5
|
super(table);
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
this.requestOrder = 0; //prevent requests coming out of sequence if overridden by another load request
|
|
8
8
|
this.loading = false;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
initialize(){}
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
load(data, params, config, replace, silent, columnsChanged){
|
|
14
14
|
var requestNo = ++this.requestOrder;
|
|
15
15
|
|
|
16
|
+
if(this.table.destroyed){
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
this.dispatchExternal("dataLoading", data);
|
|
17
|
-
|
|
21
|
+
|
|
18
22
|
//parse json data to array
|
|
19
23
|
if (data && (data.indexOf("{") == 0 || data.indexOf("[") == 0)){
|
|
20
24
|
data = JSON.parse(data);
|
|
21
25
|
}
|
|
22
|
-
|
|
26
|
+
|
|
23
27
|
if(this.confirm("data-loading", [data, params, config, silent])){
|
|
24
28
|
this.loading = true;
|
|
25
|
-
|
|
29
|
+
|
|
26
30
|
if(!silent){
|
|
27
31
|
this.alertLoader();
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
|
|
30
34
|
//get params for request
|
|
31
35
|
params = this.chain("data-params", [data, config, silent], params || {}, params || {});
|
|
32
|
-
|
|
36
|
+
|
|
33
37
|
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
34
|
-
|
|
38
|
+
|
|
35
39
|
var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
|
|
36
40
|
|
|
37
41
|
return result.then((response) => {
|
|
38
|
-
if(!
|
|
39
|
-
response
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
if(!this.table.destroyed){
|
|
43
|
+
if(!Array.isArray(response) && typeof response == "object"){
|
|
44
|
+
response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var rowData = this.chain("data-loaded", response, null, response);
|
|
48
|
+
|
|
49
|
+
if(requestNo == this.requestOrder){
|
|
50
|
+
this.clearAlert();
|
|
51
|
+
|
|
52
|
+
if(rowData !== false){
|
|
53
|
+
this.dispatchExternal("dataLoaded", rowData);
|
|
54
|
+
this.table.rowManager.setData(rowData, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
55
|
+
}
|
|
56
|
+
}else{
|
|
57
|
+
console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
|
|
50
58
|
}
|
|
51
59
|
}else{
|
|
52
|
-
console.warn("Data Load Response Blocked -
|
|
60
|
+
console.warn("Data Load Response Blocked - Table has been destroyed");
|
|
53
61
|
}
|
|
54
62
|
}).catch((error) => {
|
|
55
63
|
console.error("Data Load Error: ", error);
|
|
56
64
|
this.dispatchExternal("dataLoadError", error);
|
|
57
|
-
|
|
65
|
+
|
|
58
66
|
if(!silent){
|
|
59
67
|
this.alertError();
|
|
60
68
|
}
|
|
@@ -68,52 +76,52 @@ export default class DataLoader extends CoreFeature{
|
|
|
68
76
|
});
|
|
69
77
|
}else{
|
|
70
78
|
this.dispatchExternal("dataLoaded", data);
|
|
71
|
-
|
|
79
|
+
|
|
72
80
|
if(!data){
|
|
73
81
|
data = [];
|
|
74
82
|
}
|
|
75
|
-
|
|
83
|
+
|
|
76
84
|
this.table.rowManager.setData(data, replace, typeof columnsChanged === "undefined" ? !replace : columnsChanged);
|
|
77
85
|
return Promise.resolve();
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
|
-
|
|
88
|
+
|
|
81
89
|
mapParams(params, map){
|
|
82
90
|
var output = {};
|
|
83
|
-
|
|
91
|
+
|
|
84
92
|
for(let key in params){
|
|
85
93
|
output[map.hasOwnProperty(key) ? map[key] : key] = params[key];
|
|
86
94
|
}
|
|
87
|
-
|
|
95
|
+
|
|
88
96
|
return output;
|
|
89
97
|
}
|
|
90
|
-
|
|
98
|
+
|
|
91
99
|
objectInvert(obj){
|
|
92
100
|
var output = {};
|
|
93
|
-
|
|
101
|
+
|
|
94
102
|
for(let key in obj){
|
|
95
103
|
output[obj[key]] = key;
|
|
96
104
|
}
|
|
97
|
-
|
|
105
|
+
|
|
98
106
|
return output;
|
|
99
107
|
}
|
|
100
|
-
|
|
108
|
+
|
|
101
109
|
blockActiveLoad(){
|
|
102
110
|
this.requestOrder++;
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
|
|
105
113
|
alertLoader(){
|
|
106
114
|
var shouldLoad = typeof this.table.options.dataLoader === "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
|
|
107
|
-
|
|
115
|
+
|
|
108
116
|
if(shouldLoad){
|
|
109
117
|
this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
|
-
|
|
120
|
+
|
|
113
121
|
alertError(){
|
|
114
122
|
this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
|
|
115
123
|
}
|
|
116
|
-
|
|
124
|
+
|
|
117
125
|
clearAlert(){
|
|
118
126
|
this.table.alertManager.clear();
|
|
119
127
|
}
|
|
@@ -67,6 +67,9 @@ class DataTree extends Module{
|
|
|
67
67
|
this.branchEl = options.dataTreeBranchElement;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
}else{
|
|
71
|
+
this.branchEl = document.createElement("div");
|
|
72
|
+
this.branchEl.classList.add("tabulator-data-tree-branch-empty");
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
if(options.dataTreeCollapseElement){
|
|
@@ -570,7 +573,7 @@ class DataTree extends Module{
|
|
|
570
573
|
var config = row.modules.dataTree,
|
|
571
574
|
output = [];
|
|
572
575
|
|
|
573
|
-
if(config.children){
|
|
576
|
+
if(config && config.children){
|
|
574
577
|
|
|
575
578
|
if(!Array.isArray(config.children)){
|
|
576
579
|
config.children = this.generateChildren(row);
|
|
@@ -71,7 +71,7 @@ class Group{
|
|
|
71
71
|
this.arrowElement = document.createElement("div");
|
|
72
72
|
this.arrowElement.classList.add("tabulator-group-toggle");
|
|
73
73
|
this.arrowElement.appendChild(arrow);
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
//setup movable rows
|
|
76
76
|
if(this.groupManager.table.options.movableRows !== false && this.groupManager.table.modExists("moveRow")){
|
|
77
77
|
this.groupManager.table.modules.moveRow.initializeGroupHeader(this);
|
|
@@ -94,9 +94,15 @@ class Group{
|
|
|
94
94
|
toggleElement = this.groupManager.table.options.groupToggleElement == "arrow" ? this.arrowElement : this.element;
|
|
95
95
|
|
|
96
96
|
toggleElement.addEventListener("click", (e) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
if(this.groupManager.table.options.groupToggleElement === "arrow"){
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
e.stopImmediatePropagation();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//allow click event to propagate before toggling visibility
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
this.toggleVisibility();
|
|
105
|
+
});
|
|
100
106
|
});
|
|
101
107
|
}
|
|
102
108
|
}
|
|
@@ -217,7 +223,7 @@ class Group{
|
|
|
217
223
|
if(el.parentNode){
|
|
218
224
|
el.parentNode.removeChild(el);
|
|
219
225
|
}
|
|
220
|
-
|
|
226
|
+
|
|
221
227
|
if(!this.groupManager.blockRedraw){
|
|
222
228
|
this.generateGroupHeaderContents();
|
|
223
229
|
|
|
@@ -342,6 +348,7 @@ class Group{
|
|
|
342
348
|
}
|
|
343
349
|
return count;
|
|
344
350
|
}
|
|
351
|
+
|
|
345
352
|
|
|
346
353
|
toggleVisibility(){
|
|
347
354
|
if(this.visible){
|
|
@@ -466,12 +473,18 @@ class Group{
|
|
|
466
473
|
return output;
|
|
467
474
|
}
|
|
468
475
|
|
|
469
|
-
getRows(component){
|
|
476
|
+
getRows(component, includeChildren){
|
|
470
477
|
var output = [];
|
|
471
478
|
|
|
472
|
-
this.
|
|
473
|
-
|
|
474
|
-
|
|
479
|
+
if(includeChildren && this.groupList.length){
|
|
480
|
+
this.groupList.forEach((group) => {
|
|
481
|
+
output = output.concat(group.getRows(component, includeChildren));
|
|
482
|
+
});
|
|
483
|
+
}else{
|
|
484
|
+
this.rows.forEach(function(row){
|
|
485
|
+
output.push(component ? row.getComponent() : row);
|
|
486
|
+
});
|
|
487
|
+
}
|
|
475
488
|
|
|
476
489
|
return output;
|
|
477
490
|
}
|
|
@@ -479,7 +492,9 @@ class Group{
|
|
|
479
492
|
generateGroupHeaderContents(){
|
|
480
493
|
var data = [];
|
|
481
494
|
|
|
482
|
-
this.
|
|
495
|
+
var rows = this.getRows(false, true);
|
|
496
|
+
|
|
497
|
+
rows.forEach(function(row){
|
|
483
498
|
data.push(row.getData());
|
|
484
499
|
});
|
|
485
500
|
|
|
@@ -584,6 +599,8 @@ class Group{
|
|
|
584
599
|
clearCellHeight(){}
|
|
585
600
|
|
|
586
601
|
deinitializeHeight(){}
|
|
602
|
+
|
|
603
|
+
rendered(){}
|
|
587
604
|
|
|
588
605
|
//////////////// Object Generation /////////////////
|
|
589
606
|
getComponent(){
|
|
@@ -19,7 +19,9 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
rowMove: function(action){
|
|
22
|
-
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.
|
|
23
|
-
|
|
22
|
+
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posTo), action.data.after);
|
|
23
|
+
|
|
24
|
+
this.table.rowManager.regenerateRowPositions();
|
|
25
|
+
this.table.rowManager.reRenderInPosition();
|
|
24
26
|
},
|
|
25
27
|
};
|
|
@@ -19,7 +19,11 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
rowMove: function(action){
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var after = (action.data.posFrom - action.data.posTo) > 0;
|
|
23
|
+
|
|
24
|
+
this.table.rowManager.moveRowActual(action.component, this.table.rowManager.getRowFromPosition(action.data.posFrom), after);
|
|
25
|
+
|
|
26
|
+
this.table.rowManager.regenerateRowPositions();
|
|
27
|
+
this.table.rowManager.reRenderInPosition();
|
|
24
28
|
},
|
|
25
29
|
};
|
package/src/scss/tabulator.scss
CHANGED
|
@@ -18,7 +18,7 @@ $sortArrowActive: #666 !default;
|
|
|
18
18
|
$sortArrowInactive: #bbb !default;
|
|
19
19
|
|
|
20
20
|
//row theming
|
|
21
|
-
$rowBackgroundColor
|
|
21
|
+
$rowBackgroundColor:#fff !default; //table row background color
|
|
22
22
|
$rowAltBackgroundColor: $table-striped-color !default; //table row background color
|
|
23
23
|
$rowBorderColor:$table-border-color !default; //table border color
|
|
24
24
|
$rowHoverBackground:$table-striped-color !default; //row background color on hover
|
|
@@ -159,7 +159,7 @@ $footerActiveColor:$primary-color !default; //footer bottom active text color
|
|
|
159
159
|
border-bottom:1px solid $rowBorderColor;
|
|
160
160
|
|
|
161
161
|
&.tabulator-row-even{
|
|
162
|
-
background-color:
|
|
162
|
+
background-color: $rowBackgroundColor;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.tabulator-cell{
|
|
@@ -492,7 +492,7 @@ $footerActiveColor:#d00 !default; //footer bottom active text color
|
|
|
492
492
|
border-bottom: $rowBorder;
|
|
493
493
|
|
|
494
494
|
&.tabulator-row-even{
|
|
495
|
-
background-color:
|
|
495
|
+
background-color: $rowBackgroundColor;
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
@media (hover:hover) and (pointer:fine){
|
|
@@ -226,7 +226,7 @@ $basicTableCellBackground: transparent !default;
|
|
|
226
226
|
$basicTableHeaderDivider: none !default;
|
|
227
227
|
$basicTableCellBorder: 1px solid rgba(0, 0, 0, 0.1) !default;
|
|
228
228
|
$basicTableCellPadding: '' !default;
|
|
229
|
-
$basicTableStripedBackground:
|
|
229
|
+
$basicTableStripedBackground: #f2f2f2 !default;
|
|
230
230
|
|
|
231
231
|
/* Padded */
|
|
232
232
|
$paddedVerticalPadding: 1em !default;
|