tabulator-tables 5.0.3 → 5.0.8
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 +1 -1
- package/dist/css/tabulator_bootstrap3.css +9 -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_bulma.css +5 -1
- 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_semanticui.css +11 -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/js/tabulator.js +456 -307
- 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 +483 -354
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +1 -1
- package/src/js/core/ColumnManager.js +18 -17
- package/src/js/core/RowManager.js +5 -3
- package/src/js/core/Tabulator.js +180 -125
- package/src/js/core/column/Column.js +2 -2
- package/src/js/core/tools/{ComponentFuctionBinder.js → ComponentFunctionBinder.js} +1 -1
- package/src/js/core/tools/Helpers.js +19 -13
- package/src/js/core/tools/InteractionMonitor.js +4 -1
- package/src/js/core/tools/OptionsList.js +2 -2
- package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +22 -1
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
- package/src/js/modules/DataTree/DataTree.js +1 -1
- package/src/js/modules/Edit/Edit.js +7 -6
- package/src/js/modules/Edit/defaults/editors/progress.js +2 -2
- package/src/js/modules/Filter/Filter.js +9 -4
- package/src/js/modules/Format/defaults/formatters/datetime.js +2 -2
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +1 -1
- package/src/js/modules/Format/defaults/formatters/money.js +8 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +21 -0
- package/src/js/modules/FrozenRows/FrozenRows.js +4 -1
- package/src/js/modules/GroupRows/Group.js +10 -4
- package/src/js/modules/GroupRows/GroupRows.js +41 -29
- package/src/js/modules/History/History.js +3 -1
- package/src/js/modules/History/defaults/redoers.js +1 -0
- package/src/js/modules/History/defaults/undoers.js +1 -0
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +8 -29
- package/src/js/modules/MoveColumns/MoveColumns.js +64 -61
- package/src/js/modules/Page/Page.js +2 -1
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +5 -1
- package/src/js/modules/SelectRow/SelectRow.js +3 -3
- package/src/js/modules/Sort/Sort.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/datetime.js +3 -2
- package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +9 -0
- package/src/scss/themes/bulma/tabulator_bulma.scss +5 -1
- package/src/scss/themes/semanticui/tabulator_semanticui.scss +12 -7
|
@@ -6,7 +6,7 @@ export default class InteractionManager extends CoreFeature {
|
|
|
6
6
|
constructor (table){
|
|
7
7
|
super(table);
|
|
8
8
|
|
|
9
|
-
this.el =
|
|
9
|
+
this.el = null;
|
|
10
10
|
|
|
11
11
|
this.abortClasses = ["tabulator-headers", "tabulator-table"];
|
|
12
12
|
|
|
@@ -31,7 +31,10 @@ export default class InteractionManager extends CoreFeature {
|
|
|
31
31
|
"tabulator-group":"group",
|
|
32
32
|
"tabulator-col":"column",
|
|
33
33
|
};
|
|
34
|
+
}
|
|
34
35
|
|
|
36
|
+
initialize(){
|
|
37
|
+
this.el = this.table.element;
|
|
35
38
|
this.buildListenerMap();
|
|
36
39
|
this.bindSubscriptionWatchers();
|
|
37
40
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class OptionsList {
|
|
2
|
-
constructor(table, msgType){
|
|
2
|
+
constructor(table, msgType, defaults = {}){
|
|
3
3
|
this.table = table;
|
|
4
4
|
this.msgType = msgType;
|
|
5
|
-
this.registeredDefaults = {}
|
|
5
|
+
this.registeredDefaults = Object.assign({}, defaults)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
register(option, value){
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
function generateParamsList(data, prefix){
|
|
2
|
+
var output = [];
|
|
3
|
+
|
|
4
|
+
prefix = prefix || "";
|
|
5
|
+
|
|
6
|
+
if(Array.isArray(data)){
|
|
7
|
+
data.forEach((item, i) => {
|
|
8
|
+
output = output.concat(generateParamsList(item, prefix ? prefix + "[" + i + "]" : i));
|
|
9
|
+
});
|
|
10
|
+
}else if (typeof data === "object"){
|
|
11
|
+
for (var key in data){
|
|
12
|
+
output = output.concat(generateParamsList(data[key], prefix ? prefix + "[" + key + "]" : key));
|
|
13
|
+
}
|
|
14
|
+
}else{
|
|
15
|
+
output.push({key:prefix, value:data});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return output;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
export default {
|
|
2
22
|
"json":{
|
|
3
23
|
headers:{
|
|
@@ -11,7 +31,8 @@ export default {
|
|
|
11
31
|
headers:{
|
|
12
32
|
},
|
|
13
33
|
body:function(url, config, params){
|
|
14
|
-
|
|
34
|
+
|
|
35
|
+
var output = generateParamsList(params),
|
|
15
36
|
form = new FormData();
|
|
16
37
|
|
|
17
38
|
output.forEach(function(item){
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Module from '../../core/Module.js';
|
|
2
|
+
import Helpers from '../../core/tools/Helpers.js';
|
|
2
3
|
|
|
3
4
|
import defaultEditors from './defaults/editors.js';
|
|
4
5
|
|
|
@@ -150,7 +151,7 @@ class Edit extends Module{
|
|
|
150
151
|
nextCell = this.findNextEditableCell(prevRow, prevRow.cells.length);
|
|
151
152
|
|
|
152
153
|
if(nextCell){
|
|
153
|
-
nextCell.edit();
|
|
154
|
+
nextCell.getComponent().edit();
|
|
154
155
|
return true;
|
|
155
156
|
}
|
|
156
157
|
}
|
|
@@ -181,7 +182,7 @@ class Edit extends Module{
|
|
|
181
182
|
nextCell = this.findNextEditableCell(nextRow, -1);
|
|
182
183
|
|
|
183
184
|
if(nextCell){
|
|
184
|
-
nextCell.edit();
|
|
185
|
+
nextCell.getComponent().edit();
|
|
185
186
|
return true;
|
|
186
187
|
}
|
|
187
188
|
}
|
|
@@ -205,7 +206,7 @@ class Edit extends Module{
|
|
|
205
206
|
nextCell = this.findPrevEditableCell(cell.row, index);
|
|
206
207
|
|
|
207
208
|
if(nextCell){
|
|
208
|
-
nextCell.edit();
|
|
209
|
+
nextCell.getComponent().edit();
|
|
209
210
|
return true;
|
|
210
211
|
}
|
|
211
212
|
}
|
|
@@ -227,7 +228,7 @@ class Edit extends Module{
|
|
|
227
228
|
nextCell = this.findNextEditableCell(cell.row, index);
|
|
228
229
|
|
|
229
230
|
if(nextCell){
|
|
230
|
-
nextCell.edit();
|
|
231
|
+
nextCell.getComponent().edit();
|
|
231
232
|
return true;
|
|
232
233
|
}
|
|
233
234
|
}
|
|
@@ -249,7 +250,7 @@ class Edit extends Module{
|
|
|
249
250
|
nextRow = this.table.rowManager.prevDisplayRow(cell.row, true);
|
|
250
251
|
|
|
251
252
|
if(nextRow){
|
|
252
|
-
nextRow.cells[index].edit();
|
|
253
|
+
nextRow.cells[index].getComponent().edit();
|
|
253
254
|
return true;
|
|
254
255
|
}
|
|
255
256
|
}
|
|
@@ -271,7 +272,7 @@ class Edit extends Module{
|
|
|
271
272
|
nextRow = this.table.rowManager.nextDisplayRow(cell.row, true);
|
|
272
273
|
|
|
273
274
|
if(nextRow){
|
|
274
|
-
nextRow.cells[index].edit();
|
|
275
|
+
nextRow.cells[index].getComponent().edit();
|
|
275
276
|
return true;
|
|
276
277
|
}
|
|
277
278
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
//draggable progress bar
|
|
2
2
|
export default function(cell, onRendered, success, cancel, editorParams){
|
|
3
3
|
var element = cell.getElement(),
|
|
4
|
-
max = typeof editorParams.max === "undefined" ? ( element.getElementsByTagName("div")[0].getAttribute("max") || 100) : editorParams.max,
|
|
5
|
-
min = typeof editorParams.min === "undefined" ? ( element.getElementsByTagName("div")[0].getAttribute("min") || 0) : editorParams.min,
|
|
4
|
+
max = typeof editorParams.max === "undefined" ? ((element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("max")) || 100) : editorParams.max,
|
|
5
|
+
min = typeof editorParams.min === "undefined" ? ((element.getElementsByTagName("div")[0] && element.getElementsByTagName("div")[0].getAttribute("min")) || 0) : editorParams.min,
|
|
6
6
|
percent = (max - min) / 100,
|
|
7
7
|
value = cell.getValue() || 0,
|
|
8
8
|
handle = document.createElement("div"),
|
|
@@ -15,6 +15,7 @@ class Filter extends Module{
|
|
|
15
15
|
this.prevHeaderFilterChangeCheck = "{}";
|
|
16
16
|
|
|
17
17
|
this.changed = false; //has filtering changed since last render
|
|
18
|
+
this.tableInitialized = false;
|
|
18
19
|
|
|
19
20
|
this.registerTableOption("filterMode", "local"); //local or remote filtering
|
|
20
21
|
|
|
@@ -82,6 +83,8 @@ class Filter extends Module{
|
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
this.tableInitialized = true;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
remoteFilterParams(data, config, silent, params){
|
|
@@ -546,10 +549,12 @@ class Filter extends Module{
|
|
|
546
549
|
}
|
|
547
550
|
|
|
548
551
|
refreshFilter(){
|
|
549
|
-
if(this.
|
|
550
|
-
this.
|
|
551
|
-
|
|
552
|
-
|
|
552
|
+
if(this.tableInitialized){
|
|
553
|
+
if(this.table.options.filterMode === "remote"){
|
|
554
|
+
this.reloadData();
|
|
555
|
+
}else{
|
|
556
|
+
this.refreshData(true);
|
|
557
|
+
}
|
|
553
558
|
}
|
|
554
559
|
|
|
555
560
|
//TODO - Persist left position of row manager
|
|
@@ -6,7 +6,7 @@ export default function(cell, formatterParams, onRendered){
|
|
|
6
6
|
var value = cell.getValue();
|
|
7
7
|
|
|
8
8
|
if(typeof DT != "undefined"){
|
|
9
|
-
var newDatetime =
|
|
9
|
+
var newDatetime = DT.fromFormat(String(value), inputFormat);
|
|
10
10
|
|
|
11
11
|
if(newDatetime.isValid){
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ export default function(cell, formatterParams, onRendered){
|
|
|
17
17
|
return newDatetime.toFormat(outputFormat);
|
|
18
18
|
}else{
|
|
19
19
|
|
|
20
|
-
if(invalid === true){
|
|
20
|
+
if(invalid === true || !value){
|
|
21
21
|
return value;
|
|
22
22
|
}else if(typeof invalid === "function"){
|
|
23
23
|
return invalid(value);
|
|
@@ -9,7 +9,7 @@ export default function (cell, formatterParams, onRendered) {
|
|
|
9
9
|
var value = cell.getValue();
|
|
10
10
|
|
|
11
11
|
if(typeof DT != "undefined"){
|
|
12
|
-
var newDatetime = DT.fromFormat(value, inputFormat);
|
|
12
|
+
var newDatetime = DT.fromFormat(String(value), inputFormat);
|
|
13
13
|
|
|
14
14
|
if (newDatetime.isValid){
|
|
15
15
|
if(humanize){
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export default function(cell, formatterParams, onRendered){
|
|
2
2
|
var floatVal = parseFloat(cell.getValue()),
|
|
3
|
+
sign = "",
|
|
3
4
|
number, integer, decimal, rgx;
|
|
4
5
|
|
|
5
6
|
var decimalSym = formatterParams.decimal || ".";
|
|
6
7
|
var thousandSym = formatterParams.thousand || ",";
|
|
8
|
+
var negativeSign = formatterParams.negativeSign || "-";
|
|
7
9
|
var symbol = formatterParams.symbol || "";
|
|
8
10
|
var after = !!formatterParams.symbolAfter;
|
|
9
11
|
var precision = typeof formatterParams.precision !== "undefined" ? formatterParams.precision : 2;
|
|
@@ -12,6 +14,11 @@ export default function(cell, formatterParams, onRendered){
|
|
|
12
14
|
return this.emptyToSpace(this.sanitizeHTML(cell.getValue()));
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
if(floatVal < 0){
|
|
18
|
+
floatVal = Math.abs(floatVal);
|
|
19
|
+
sign = negativeSign;
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
number = precision !== false ? floatVal.toFixed(precision) : floatVal;
|
|
16
23
|
number = String(number).split(".");
|
|
17
24
|
|
|
@@ -24,5 +31,5 @@ export default function(cell, formatterParams, onRendered){
|
|
|
24
31
|
integer = integer.replace(rgx, "$1" + thousandSym + "$2");
|
|
25
32
|
}
|
|
26
33
|
|
|
27
|
-
return after ? integer + decimal + symbol : symbol + integer + decimal;
|
|
34
|
+
return after ? sign + integer + decimal + symbol : sign + symbol + integer + decimal;
|
|
28
35
|
};
|
|
@@ -135,12 +135,33 @@ class FrozenColumns extends Module{
|
|
|
135
135
|
if(this.table.modules.columnCalcs.topInitialized && this.table.modules.columnCalcs.topRow){
|
|
136
136
|
this.layoutRow(this.table.modules.columnCalcs.topRow);
|
|
137
137
|
}
|
|
138
|
+
|
|
138
139
|
if(this.table.modules.columnCalcs.botInitialized && this.table.modules.columnCalcs.botRow){
|
|
139
140
|
this.layoutRow(this.table.modules.columnCalcs.botRow);
|
|
140
141
|
}
|
|
142
|
+
|
|
143
|
+
if(this.table.modExists("groupRows")){
|
|
144
|
+
this.layoutGroupCalcs(this.table.modules.groupRows.getGroups())
|
|
145
|
+
}
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
148
|
|
|
149
|
+
layoutGroupCalcs(groups){
|
|
150
|
+
groups.forEach((group) => {
|
|
151
|
+
if(group.calcs.top){
|
|
152
|
+
this.layoutRow(group.calcs.top);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if(group.calcs.bottom){
|
|
156
|
+
this.layoutRow(group.calcs.bottom);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if(group.groupList && group.groupList.length){
|
|
160
|
+
this.layoutGroupCalcs(group.groupList && group.groupList);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
144
165
|
//calculate column positions and layout headers
|
|
145
166
|
layoutColumnPosition(allCells){
|
|
146
167
|
|
|
@@ -99,7 +99,10 @@ class FrozenRows extends Module{
|
|
|
99
99
|
|
|
100
100
|
if(index > -1){
|
|
101
101
|
var rowEl = row.getElement();
|
|
102
|
-
|
|
102
|
+
|
|
103
|
+
if(rowEl.parentNode){
|
|
104
|
+
rowEl.parentNode.removeChild(rowEl);
|
|
105
|
+
}
|
|
103
106
|
|
|
104
107
|
this.rows.splice(index, 1);
|
|
105
108
|
}
|
|
@@ -43,10 +43,16 @@ class Group{
|
|
|
43
43
|
group.wipe();
|
|
44
44
|
});
|
|
45
45
|
}else{
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
this.rows.forEach((row) => {
|
|
47
|
+
if(row.modules){
|
|
48
|
+
delete row.modules.group;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
49
51
|
}
|
|
52
|
+
|
|
53
|
+
this.element = false;
|
|
54
|
+
this.arrowElement = false;
|
|
55
|
+
this.elementContents = false;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
createElements(){
|
|
@@ -268,7 +274,7 @@ class Group{
|
|
|
268
274
|
}
|
|
269
275
|
|
|
270
276
|
this.generateGroupHeaderContents();
|
|
271
|
-
|
|
277
|
+
|
|
272
278
|
if(this.groupManager.table.modExists("columnCalcs") && this.groupManager.table.options.columnCalcs != "table"){
|
|
273
279
|
this.groupManager.table.modules.columnCalcs.recalcGroup(this);
|
|
274
280
|
}
|
|
@@ -45,6 +45,34 @@ class GroupRows extends Module{
|
|
|
45
45
|
|
|
46
46
|
//initialize group configuration
|
|
47
47
|
initialize(){
|
|
48
|
+
if(this.table.options.groupBy){
|
|
49
|
+
|
|
50
|
+
this.configureGroupSetup();
|
|
51
|
+
|
|
52
|
+
if(this.table.options.groupUpdateOnCellEdit){
|
|
53
|
+
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
54
|
+
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
58
|
+
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
59
|
+
this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
|
|
60
|
+
this.subscribe("rows-wipe", this.wipe.bind(this));
|
|
61
|
+
this.subscribe("rows-added", this.rowsUpdated.bind(this));
|
|
62
|
+
this.subscribe("row-moving", this.rowMoving.bind(this));
|
|
63
|
+
this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
|
|
64
|
+
|
|
65
|
+
this.subscribe("rows-sample", this.rowSample.bind(this));
|
|
66
|
+
|
|
67
|
+
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
|
|
68
|
+
|
|
69
|
+
this.registerDisplayHandler(this.displayHandler, 20);
|
|
70
|
+
|
|
71
|
+
this.initialized = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
configureGroupSetup(){
|
|
48
76
|
if(this.table.options.groupBy){
|
|
49
77
|
var groupBy = this.table.options.groupBy,
|
|
50
78
|
startOpen = this.table.options.groupStartOpen,
|
|
@@ -133,27 +161,6 @@ class GroupRows extends Module{
|
|
|
133
161
|
if(groupHeader){
|
|
134
162
|
this.headerGenerator = Array.isArray(groupHeader) ? groupHeader : [groupHeader];
|
|
135
163
|
}
|
|
136
|
-
|
|
137
|
-
if(this.table.options.groupUpdateOnCellEdit){
|
|
138
|
-
this.subscribe("cell-value-updated", this.cellUpdated.bind(this));
|
|
139
|
-
this.subscribe("row-data-changed", this.reassignRowToGroup.bind(this), 0);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.subscribe("row-deleting", this.rowDeleting.bind(this));
|
|
143
|
-
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
144
|
-
this.subscribe("scroll-horizontal", this.scrollHeaders.bind(this));
|
|
145
|
-
this.subscribe("rows-wipe", this.wipe.bind(this));
|
|
146
|
-
this.subscribe("rows-added", this.rowsUpdated.bind(this));
|
|
147
|
-
this.subscribe("row-moving", this.rowMoving.bind(this));
|
|
148
|
-
this.subscribe("row-adding-index", this.rowAddingIndex.bind(this));
|
|
149
|
-
|
|
150
|
-
this.subscribe("rows-sample", this.rowSample.bind(this));
|
|
151
|
-
|
|
152
|
-
this.subscribe("render-virtual-fill", this.virtualRenderFill.bind(this));
|
|
153
|
-
|
|
154
|
-
this.registerDisplayHandler(this.displayHandler, 20);
|
|
155
|
-
|
|
156
|
-
this.initialized = true;
|
|
157
164
|
}
|
|
158
165
|
}
|
|
159
166
|
|
|
@@ -218,23 +225,28 @@ class GroupRows extends Module{
|
|
|
218
225
|
|
|
219
226
|
setGroupBy(groups){
|
|
220
227
|
this.table.options.groupBy = groups;
|
|
221
|
-
this.
|
|
222
|
-
|
|
228
|
+
if(!this.initialized){
|
|
229
|
+
this.initialize();
|
|
230
|
+
}else{
|
|
231
|
+
this.configureGroupSetup();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this.refreshData();
|
|
223
235
|
|
|
224
236
|
this.trackChanges();
|
|
225
237
|
}
|
|
226
238
|
|
|
227
239
|
setGroupValues(groupValues){
|
|
228
240
|
this.table.options.groupValues = groupValues;
|
|
229
|
-
this.
|
|
230
|
-
this.refreshData(
|
|
241
|
+
this.configureGroupSetup();
|
|
242
|
+
this.refreshData();
|
|
231
243
|
|
|
232
244
|
this.trackChanges();
|
|
233
245
|
}
|
|
234
246
|
|
|
235
247
|
setGroupStartOpen(values){
|
|
236
248
|
this.table.options.groupStartOpen = values;
|
|
237
|
-
this.
|
|
249
|
+
this.configureGroupSetup();
|
|
238
250
|
|
|
239
251
|
if(this.table.options.groupBy){
|
|
240
252
|
this.refreshData();
|
|
@@ -247,7 +259,7 @@ class GroupRows extends Module{
|
|
|
247
259
|
|
|
248
260
|
setGroupHeader(values){
|
|
249
261
|
this.table.options.groupHeader = values;
|
|
250
|
-
this.
|
|
262
|
+
this.configureGroupSetup();
|
|
251
263
|
|
|
252
264
|
if(this.table.options.groupBy){
|
|
253
265
|
this.refreshData();
|
|
@@ -328,7 +340,7 @@ class GroupRows extends Module{
|
|
|
328
340
|
|
|
329
341
|
//return appropriate rows with group headers
|
|
330
342
|
getRows(rows){
|
|
331
|
-
if(this.groupIDLookups.length){
|
|
343
|
+
if(this.table.options.groupBy && this.groupIDLookups.length){
|
|
332
344
|
|
|
333
345
|
this.dispatchExternal("dataGrouping");
|
|
334
346
|
|
|
@@ -443,7 +455,7 @@ class GroupRows extends Module{
|
|
|
443
455
|
var oldGroups = this.groups;
|
|
444
456
|
|
|
445
457
|
this.groups = {};
|
|
446
|
-
this.groupList =[];
|
|
458
|
+
this.groupList = [];
|
|
447
459
|
|
|
448
460
|
if(this.allowedValues && this.allowedValues[0]){
|
|
449
461
|
this.allowedValues[0].forEach((value) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import Module from '../../core/Module.js';
|
|
2
|
+
import Row from '../../core/row/Row.js';
|
|
3
|
+
import Cell from '../../core/cell/Cell.js';
|
|
2
4
|
|
|
3
5
|
import defaultUndoers from './defaults/undoers.js';
|
|
4
6
|
import defaultRedoers from './defaults/redoers.js';
|
|
@@ -58,7 +60,7 @@ class History extends Module{
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
this.
|
|
63
|
+
this.action("rowDelete", row, {data:row.getData(), pos:!index, index:index});
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
cellUpdated(cell){
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Module from '../../core/Module.js';
|
|
2
|
+
import Column from '../../core/column/Column.js';
|
|
2
3
|
|
|
3
4
|
class HtmlTableImport extends Module{
|
|
4
5
|
|
|
@@ -10,17 +11,17 @@ class HtmlTableImport extends Module{
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
initialize(){
|
|
13
|
-
this.
|
|
14
|
+
this.tableElementCheck();
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
tableElementCheck(){
|
|
17
|
-
if(this.table.
|
|
18
|
+
if(this.table.originalElement && this.table.originalElement.tagName === "TABLE"){
|
|
18
19
|
this.parseTable();
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
parseTable(){
|
|
23
|
-
var element = this.table.
|
|
24
|
+
var element = this.table.originalElement,
|
|
24
25
|
options = this.table.options,
|
|
25
26
|
columns = options.columns,
|
|
26
27
|
headers = element.getElementsByTagName("th"),
|
|
@@ -34,7 +35,7 @@ class HtmlTableImport extends Module{
|
|
|
34
35
|
|
|
35
36
|
rows = rows ? rows.getElementsByTagName("tr") : [];
|
|
36
37
|
|
|
37
|
-
//check for
|
|
38
|
+
//check for Tabulator inline options
|
|
38
39
|
this._extractOptions(element, options);
|
|
39
40
|
|
|
40
41
|
if(headers.length){
|
|
@@ -65,34 +66,15 @@ class HtmlTableImport extends Module{
|
|
|
65
66
|
data.push(item);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
//create new element
|
|
69
|
-
var newElement = document.createElement("div");
|
|
70
|
-
|
|
71
|
-
//transfer attributes to new element
|
|
72
|
-
var attributes = element.attributes;
|
|
73
|
-
|
|
74
|
-
// loop through attributes and apply them on div
|
|
75
|
-
|
|
76
|
-
for(var i in attributes){
|
|
77
|
-
if(typeof attributes[i] == "object"){
|
|
78
|
-
newElement.setAttribute(attributes[i].name, attributes[i].value);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// replace table with div element
|
|
83
|
-
element.parentNode.replaceChild(newElement, element);
|
|
84
|
-
|
|
85
69
|
options.data = data;
|
|
86
70
|
|
|
87
71
|
this.dispatchExternal("htmlImported");
|
|
88
|
-
|
|
89
|
-
this.table.element = newElement;
|
|
90
72
|
}
|
|
91
73
|
|
|
92
74
|
//extract tabulator attribute options
|
|
93
75
|
_extractOptions(element, options, defaultOptions){
|
|
94
76
|
var attributes = element.attributes;
|
|
95
|
-
var optionsArr = defaultOptions ? Object.
|
|
77
|
+
var optionsArr = defaultOptions ? Object.keys(defaultOptions) : Object.keys(options);
|
|
96
78
|
var optionsList = {};
|
|
97
79
|
|
|
98
80
|
optionsArr.forEach((item) => {
|
|
@@ -159,11 +141,8 @@ class HtmlTableImport extends Module{
|
|
|
159
141
|
col.width = width;
|
|
160
142
|
}
|
|
161
143
|
|
|
162
|
-
//check for
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// //check for tablator inline options
|
|
166
|
-
this._extractOptions(header, col, Column.prototype.defaultOptionList);
|
|
144
|
+
//check for Tabulator inline options
|
|
145
|
+
this._extractOptions(header, col, this.table.columnManager.optionsList.registeredDefaults);
|
|
167
146
|
|
|
168
147
|
this.fieldIndex[index] = col.field;
|
|
169
148
|
|