tabulator-tables 5.0.7 → 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/js/tabulator.js +69 -57
- 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 +119 -106
- 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 +3 -1
- package/src/js/core/Tabulator.js +14 -16
- package/src/js/core/tools/{ComponentFuctionBinder.js → ComponentFunctionBinder.js} +1 -1
- package/src/js/core/tools/InteractionMonitor.js +4 -1
- package/src/js/core/tools/OptionsList.js +2 -2
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
- package/src/js/modules/Edit/defaults/editors/progress.js +2 -2
- package/src/js/modules/Filter/Filter.js +1 -1
- 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/GroupRows/Group.js +10 -4
- package/src/js/modules/GroupRows/GroupRows.js +6 -1
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +4 -7
- package/src/js/modules/MoveColumns/MoveColumns.js +58 -57
- package/src/js/modules/Page/Page.js +2 -1
- package/src/js/modules/SelectRow/SelectRow.js +2 -1
- package/src/js/modules/Sort/Sort.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/datetime.js +3 -2
package/package.json
CHANGED
|
@@ -7,6 +7,8 @@ import OptionsList from './tools/OptionsList.js';
|
|
|
7
7
|
import RendererBasicHorizontal from './rendering/renderers/BasicHorizontal.js';
|
|
8
8
|
import RendererVirtualDomHorizontal from './rendering/renderers/VirtualDomHorizontal.js';
|
|
9
9
|
|
|
10
|
+
import defaultColumnOptions from './column/defaults/options.js';
|
|
11
|
+
|
|
10
12
|
export default class ColumnManager extends CoreFeature {
|
|
11
13
|
|
|
12
14
|
constructor (table){
|
|
@@ -19,7 +21,7 @@ export default class ColumnManager extends CoreFeature {
|
|
|
19
21
|
this.columnsByIndex = []; //columns by index
|
|
20
22
|
this.columnsByField = {}; //columns by field
|
|
21
23
|
this.scrollLeft = 0;
|
|
22
|
-
this.optionsList = new OptionsList(this.table, "column definition");
|
|
24
|
+
this.optionsList = new OptionsList(this.table, "column definition", defaultColumnOptions);
|
|
23
25
|
|
|
24
26
|
this.renderer = null;
|
|
25
27
|
}
|
package/src/js/core/Tabulator.js
CHANGED
|
@@ -7,7 +7,7 @@ import RowManager from './RowManager.js';
|
|
|
7
7
|
import FooterManager from './FooterManager.js';
|
|
8
8
|
|
|
9
9
|
import InteractionMonitor from './tools/InteractionMonitor.js';
|
|
10
|
-
import
|
|
10
|
+
import ComponentFunctionBinder from './tools/ComponentFunctionBinder.js';
|
|
11
11
|
import DataLoader from './tools/DataLoader.js';
|
|
12
12
|
|
|
13
13
|
import ExternalEventBus from './tools/ExternalEventBus.js';
|
|
@@ -33,11 +33,11 @@ class Tabulator {
|
|
|
33
33
|
this.interactionMonitor = false; //track user interaction
|
|
34
34
|
this.browser = ""; //hold current browser type
|
|
35
35
|
this.browserSlow = false; //handle reduced functionality for slower browsers
|
|
36
|
-
this.browserMobile = false; //check if running on
|
|
36
|
+
this.browserMobile = false; //check if running on mobile, prevent resize cancelling edit on keyboard appearance
|
|
37
37
|
this.rtl = false; //check if the table is in RTL mode
|
|
38
38
|
this.originalElement = null; //hold original table element if it has been replaced
|
|
39
39
|
|
|
40
|
-
this.componentFunctionBinder = new
|
|
40
|
+
this.componentFunctionBinder = new ComponentFunctionBinder(this); //bind component functions
|
|
41
41
|
this.dataLoader = false; //bind component functions
|
|
42
42
|
|
|
43
43
|
this.modules = {}; //hold all modules bound to this table
|
|
@@ -52,13 +52,13 @@ class Tabulator {
|
|
|
52
52
|
|
|
53
53
|
this.initialzeCoreSystems(options);
|
|
54
54
|
|
|
55
|
-
//delay table creation to allow event bindings
|
|
55
|
+
//delay table creation to allow event bindings immediately after the constructor
|
|
56
56
|
setTimeout(() => {
|
|
57
57
|
this._create();
|
|
58
58
|
})
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
TableRegistry.register(this); //register table for
|
|
61
|
+
TableRegistry.register(this); //register table for inter-device communication
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
initializeElement(element){
|
|
@@ -92,7 +92,7 @@ class Tabulator {
|
|
|
92
92
|
|
|
93
93
|
this._clearObjectPointers();
|
|
94
94
|
|
|
95
|
-
this.
|
|
95
|
+
this._mapDeprecatedFunctionality();
|
|
96
96
|
|
|
97
97
|
this.externalEvents = new ExternalEventBus(this, this.options, this.options.debugEventsExternal);
|
|
98
98
|
this.eventBus = new InternalEventBus(this.options.debugEventsInternal);
|
|
@@ -105,8 +105,8 @@ class Tabulator {
|
|
|
105
105
|
this.footerManager.initialize();
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
//convert
|
|
109
|
-
|
|
108
|
+
//convert deprecated functionality to new functions
|
|
109
|
+
_mapDeprecatedFunctionality(){
|
|
110
110
|
//all previously deprecated functionality removed in the 5.0 release
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -127,7 +127,7 @@ class Tabulator {
|
|
|
127
127
|
this.element.classList.remove("tabulator-block-select");
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
//
|
|
130
|
+
//create table
|
|
131
131
|
_create(){
|
|
132
132
|
this.externalEvents.dispatch("tableBuilding");
|
|
133
133
|
this.eventBus.dispatch("table-building");
|
|
@@ -232,6 +232,8 @@ class Tabulator {
|
|
|
232
232
|
var element = this.element,
|
|
233
233
|
options = this.options;
|
|
234
234
|
|
|
235
|
+
this.interactionMonitor.initialize();
|
|
236
|
+
|
|
235
237
|
this.columnManager.initialize();
|
|
236
238
|
this.rowManager.initialize();
|
|
237
239
|
|
|
@@ -290,7 +292,7 @@ class Tabulator {
|
|
|
290
292
|
destroy(){
|
|
291
293
|
var element = this.element;
|
|
292
294
|
|
|
293
|
-
TableRegistry.deregister(this); //deregister table from
|
|
295
|
+
TableRegistry.deregister(this); //deregister table from inter-device communication
|
|
294
296
|
|
|
295
297
|
this.eventBus.dispatch("table-destroy");
|
|
296
298
|
|
|
@@ -644,7 +646,7 @@ class Tabulator {
|
|
|
644
646
|
if(row){
|
|
645
647
|
return row.updateData(data)
|
|
646
648
|
.then(()=>{
|
|
647
|
-
resolve(row.getComponent());
|
|
649
|
+
return Promise.resolve(row.getComponent());
|
|
648
650
|
})
|
|
649
651
|
}else{
|
|
650
652
|
console.warn("Update Error - No matching row found:", index);
|
|
@@ -675,11 +677,7 @@ class Tabulator {
|
|
|
675
677
|
}
|
|
676
678
|
|
|
677
679
|
getRows(active){
|
|
678
|
-
|
|
679
|
-
return this.rowManager.getComponents(active);
|
|
680
|
-
}else{
|
|
681
|
-
console.warn("getRows failed - table not yet initialized. Please wait for the `tableBuilt` event before calling this function.");
|
|
682
|
-
}
|
|
680
|
+
return this.rowManager.getComponents(active);
|
|
683
681
|
}
|
|
684
682
|
|
|
685
683
|
//get position of row in table
|
|
@@ -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,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]
|
|
5
|
-
min = typeof editorParams.min === "undefined" ? ( element.getElementsByTagName("div")[0]
|
|
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"),
|
|
@@ -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){
|
|
@@ -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
|
}
|
|
@@ -225,7 +225,12 @@ class GroupRows extends Module{
|
|
|
225
225
|
|
|
226
226
|
setGroupBy(groups){
|
|
227
227
|
this.table.options.groupBy = groups;
|
|
228
|
-
this.
|
|
228
|
+
if(!this.initialized){
|
|
229
|
+
this.initialize();
|
|
230
|
+
}else{
|
|
231
|
+
this.configureGroupSetup();
|
|
232
|
+
}
|
|
233
|
+
|
|
229
234
|
this.refreshData();
|
|
230
235
|
|
|
231
236
|
this.trackChanges();
|
|
@@ -35,7 +35,7 @@ class HtmlTableImport extends Module{
|
|
|
35
35
|
|
|
36
36
|
rows = rows ? rows.getElementsByTagName("tr") : [];
|
|
37
37
|
|
|
38
|
-
//check for
|
|
38
|
+
//check for Tabulator inline options
|
|
39
39
|
this._extractOptions(element, options);
|
|
40
40
|
|
|
41
41
|
if(headers.length){
|
|
@@ -74,7 +74,7 @@ class HtmlTableImport extends Module{
|
|
|
74
74
|
//extract tabulator attribute options
|
|
75
75
|
_extractOptions(element, options, defaultOptions){
|
|
76
76
|
var attributes = element.attributes;
|
|
77
|
-
var optionsArr = defaultOptions ? Object.
|
|
77
|
+
var optionsArr = defaultOptions ? Object.keys(defaultOptions) : Object.keys(options);
|
|
78
78
|
var optionsList = {};
|
|
79
79
|
|
|
80
80
|
optionsArr.forEach((item) => {
|
|
@@ -141,11 +141,8 @@ class HtmlTableImport extends Module{
|
|
|
141
141
|
col.width = width;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
//check for
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// //check for tablator inline options
|
|
148
|
-
this._extractOptions(header, col, Column.prototype.defaultOptionList);
|
|
144
|
+
//check for Tabulator inline options
|
|
145
|
+
this._extractOptions(header, col, this.table.columnManager.optionsList.registeredDefaults);
|
|
149
146
|
|
|
150
147
|
this.fieldIndex[index] = col.field;
|
|
151
148
|
|
|
@@ -2,10 +2,10 @@ import Module from '../../core/Module.js';
|
|
|
2
2
|
import Helpers from '../../core/tools/Helpers.js';
|
|
3
3
|
|
|
4
4
|
class MoveColumns extends Module{
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
constructor(table){
|
|
7
7
|
super(table);
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
this.placeholderElement = this.createPlaceholderElement();
|
|
10
10
|
this.hoverElement = false; //floating column header element
|
|
11
11
|
this.checkTimeout = false; //click check timeout holder
|
|
@@ -18,35 +18,36 @@ class MoveColumns extends Module{
|
|
|
18
18
|
this.autoScrollStep = 5; //auto scroll distance in pixels
|
|
19
19
|
this.autoScrollTimeout = false; //auto scroll timeout
|
|
20
20
|
this.touchMove = false;
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
this.moveHover = this.moveHover.bind(this);
|
|
23
23
|
this.endMove = this.endMove.bind(this);
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
this.registerTableOption("movableColumns", false); //enable movable columns
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
createPlaceholderElement(){
|
|
29
29
|
var el = document.createElement("div");
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
el.classList.add("tabulator-col");
|
|
32
32
|
el.classList.add("tabulator-col-placeholder");
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
return el;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
initialize(){
|
|
38
|
-
|
|
38
|
+
if(this.table.options.movableColumns){
|
|
39
|
+
this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
|
-
|
|
42
|
+
|
|
41
43
|
initializeColumn(column){
|
|
42
44
|
var self = this,
|
|
43
45
|
config = {},
|
|
44
46
|
colEl;
|
|
45
|
-
|
|
47
|
+
|
|
46
48
|
if(!column.modules.frozen){
|
|
47
|
-
|
|
48
49
|
colEl = column.getElement();
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
config.mousemove = function(e){
|
|
51
52
|
if(column.parent === self.moving.parent){
|
|
52
53
|
if((((self.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(colEl).left) + self.table.columnManager.element.scrollLeft) > (column.getWidth() / 2)){
|
|
@@ -62,7 +63,7 @@ class MoveColumns extends Module{
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
}.bind(self);
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
colEl.addEventListener("mousedown", function(e){
|
|
67
68
|
self.touchMove = false;
|
|
68
69
|
if(e.which === 1){
|
|
@@ -71,7 +72,7 @@ class MoveColumns extends Module{
|
|
|
71
72
|
}, self.checkPeriod);
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
+
|
|
75
76
|
colEl.addEventListener("mouseup", function(e){
|
|
76
77
|
if(e.which === 1){
|
|
77
78
|
if(self.checkTimeout){
|
|
@@ -79,19 +80,19 @@ class MoveColumns extends Module{
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
});
|
|
82
|
-
|
|
83
|
+
|
|
83
84
|
self.bindTouchEvents(column);
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
|
|
86
87
|
column.modules.moveColumn = config;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
|
|
89
90
|
bindTouchEvents(column){
|
|
90
91
|
var colEl = column.getElement(),
|
|
91
92
|
startXMove = false, //shifting center position of the cell
|
|
92
93
|
dir = false,
|
|
93
94
|
currentCol, nextCol, prevCol, nextColWidth, prevColWidth, nextColWidthLast, prevColWidthLast;
|
|
94
|
-
|
|
95
|
+
|
|
95
96
|
colEl.addEventListener("touchstart", (e) => {
|
|
96
97
|
this.checkTimeout = setTimeout(() => {
|
|
97
98
|
this.touchMove = true;
|
|
@@ -103,27 +104,27 @@ class MoveColumns extends Module{
|
|
|
103
104
|
nextColWidthLast = 0;
|
|
104
105
|
prevColWidthLast = 0;
|
|
105
106
|
startXMove = false;
|
|
106
|
-
|
|
107
|
+
|
|
107
108
|
this.startMove(e, column);
|
|
108
109
|
}, this.checkPeriod);
|
|
109
110
|
}, {passive: true});
|
|
110
|
-
|
|
111
|
+
|
|
111
112
|
colEl.addEventListener("touchmove", (e) => {
|
|
112
113
|
var halfCol, diff, moveToCol;
|
|
113
|
-
|
|
114
|
+
|
|
114
115
|
if(this.moving){
|
|
115
116
|
this.moveHover(e);
|
|
116
|
-
|
|
117
|
+
|
|
117
118
|
if(!startXMove){
|
|
118
119
|
startXMove = e.touches[0].pageX;
|
|
119
120
|
}
|
|
120
|
-
|
|
121
|
+
|
|
121
122
|
diff = e.touches[0].pageX - startXMove;
|
|
122
|
-
|
|
123
|
+
|
|
123
124
|
if(diff > 0){
|
|
124
125
|
if(nextCol && diff - nextColWidthLast > nextColWidth){
|
|
125
126
|
moveToCol = nextCol;
|
|
126
|
-
|
|
127
|
+
|
|
127
128
|
if(moveToCol !== column){
|
|
128
129
|
startXMove = e.touches[0].pageX;
|
|
129
130
|
moveToCol.getElement().parentNode.insertBefore(this.placeholderElement, moveToCol.getElement().nextSibling);
|
|
@@ -133,7 +134,7 @@ class MoveColumns extends Module{
|
|
|
133
134
|
}else{
|
|
134
135
|
if(prevCol && -diff - prevColWidthLast > prevColWidth){
|
|
135
136
|
moveToCol = prevCol;
|
|
136
|
-
|
|
137
|
+
|
|
137
138
|
if(moveToCol !== column){
|
|
138
139
|
startXMove = e.touches[0].pageX;
|
|
139
140
|
moveToCol.getElement().parentNode.insertBefore(this.placeholderElement, moveToCol.getElement());
|
|
@@ -141,7 +142,7 @@ class MoveColumns extends Module{
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
+
|
|
145
146
|
if(moveToCol){
|
|
146
147
|
currentCol = moveToCol;
|
|
147
148
|
nextCol = moveToCol.nextColumn();
|
|
@@ -153,7 +154,7 @@ class MoveColumns extends Module{
|
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
}, {passive: true});
|
|
156
|
-
|
|
157
|
+
|
|
157
158
|
colEl.addEventListener("touchend", (e) => {
|
|
158
159
|
if(this.checkTimeout){
|
|
159
160
|
clearTimeout(this.checkTimeout);
|
|
@@ -163,43 +164,43 @@ class MoveColumns extends Module{
|
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
+
|
|
167
168
|
startMove(e, column){
|
|
168
169
|
var element = column.getElement(),
|
|
169
170
|
headerElement = this.table.columnManager.getElement(),
|
|
170
171
|
headersElement = this.table.columnManager.getHeadersElement();
|
|
171
|
-
|
|
172
|
+
|
|
172
173
|
this.moving = column;
|
|
173
174
|
this.startX = (this.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(element).left;
|
|
174
|
-
|
|
175
|
+
|
|
175
176
|
this.table.element.classList.add("tabulator-block-select");
|
|
176
|
-
|
|
177
|
+
|
|
177
178
|
//create placeholder
|
|
178
179
|
this.placeholderElement.style.width = column.getWidth() + "px";
|
|
179
180
|
this.placeholderElement.style.height = column.getHeight() + "px";
|
|
180
|
-
|
|
181
|
+
|
|
181
182
|
element.parentNode.insertBefore(this.placeholderElement, element);
|
|
182
183
|
element.parentNode.removeChild(element);
|
|
183
|
-
|
|
184
|
+
|
|
184
185
|
//create hover element
|
|
185
186
|
this.hoverElement = element.cloneNode(true);
|
|
186
187
|
this.hoverElement.classList.add("tabulator-moving");
|
|
187
|
-
|
|
188
|
+
|
|
188
189
|
this.table.columnManager.getElement().appendChild(this.hoverElement);
|
|
189
|
-
|
|
190
|
+
|
|
190
191
|
this.hoverElement.style.left = "0";
|
|
191
192
|
this.hoverElement.style.bottom = (headerElement.clientHeight - headersElement.offsetHeight) + "px";
|
|
192
|
-
|
|
193
|
+
|
|
193
194
|
if(!this.touchMove){
|
|
194
195
|
this._bindMouseMove();
|
|
195
|
-
|
|
196
|
+
|
|
196
197
|
document.body.addEventListener("mousemove", this.moveHover);
|
|
197
198
|
document.body.addEventListener("mouseup", this.endMove);
|
|
198
199
|
}
|
|
199
|
-
|
|
200
|
+
|
|
200
201
|
this.moveHover(e);
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
+
|
|
203
204
|
_bindMouseMove(){
|
|
204
205
|
this.table.columnManager.columnsByIndex.forEach(function(column){
|
|
205
206
|
if(column.modules.moveColumn.mousemove){
|
|
@@ -207,7 +208,7 @@ class MoveColumns extends Module{
|
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
+
|
|
211
212
|
_unbindMouseMove(){
|
|
212
213
|
this.table.columnManager.columnsByIndex.forEach(function(column){
|
|
213
214
|
if(column.modules.moveColumn.mousemove){
|
|
@@ -215,17 +216,17 @@ class MoveColumns extends Module{
|
|
|
215
216
|
}
|
|
216
217
|
});
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
+
|
|
219
220
|
moveColumn(column, after){
|
|
220
221
|
var movingCells = this.moving.getCells();
|
|
221
|
-
|
|
222
|
+
|
|
222
223
|
this.toCol = column;
|
|
223
224
|
this.toColAfter = after;
|
|
224
|
-
|
|
225
|
+
|
|
225
226
|
if(after){
|
|
226
227
|
column.getCells().forEach(function(cell, i){
|
|
227
228
|
var cellEl = cell.getElement(true);
|
|
228
|
-
|
|
229
|
+
|
|
229
230
|
if(cellEl.parentNode && movingCells[i]){
|
|
230
231
|
cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl.nextSibling);
|
|
231
232
|
}
|
|
@@ -233,47 +234,47 @@ class MoveColumns extends Module{
|
|
|
233
234
|
}else{
|
|
234
235
|
column.getCells().forEach(function(cell, i){
|
|
235
236
|
var cellEl = cell.getElement(true);
|
|
236
|
-
|
|
237
|
+
|
|
237
238
|
if(cellEl.parentNode && movingCells[i]){
|
|
238
239
|
cellEl.parentNode.insertBefore(movingCells[i].getElement(), cellEl);
|
|
239
240
|
}
|
|
240
241
|
});
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
|
-
|
|
244
|
+
|
|
244
245
|
endMove(e){
|
|
245
246
|
if(e.which === 1 || this.touchMove){
|
|
246
247
|
this._unbindMouseMove();
|
|
247
|
-
|
|
248
|
+
|
|
248
249
|
this.placeholderElement.parentNode.insertBefore(this.moving.getElement(), this.placeholderElement.nextSibling);
|
|
249
250
|
this.placeholderElement.parentNode.removeChild(this.placeholderElement);
|
|
250
251
|
this.hoverElement.parentNode.removeChild(this.hoverElement);
|
|
251
|
-
|
|
252
|
+
|
|
252
253
|
this.table.element.classList.remove("tabulator-block-select");
|
|
253
|
-
|
|
254
|
+
|
|
254
255
|
if(this.toCol){
|
|
255
256
|
this.table.columnManager.moveColumnActual(this.moving, this.toCol, this.toColAfter);
|
|
256
257
|
}
|
|
257
|
-
|
|
258
|
+
|
|
258
259
|
this.moving = false;
|
|
259
260
|
this.toCol = false;
|
|
260
261
|
this.toColAfter = false;
|
|
261
|
-
|
|
262
|
+
|
|
262
263
|
if(!this.touchMove){
|
|
263
264
|
document.body.removeEventListener("mousemove", this.moveHover);
|
|
264
265
|
document.body.removeEventListener("mouseup", this.endMove);
|
|
265
266
|
}
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
|
-
|
|
269
|
+
|
|
269
270
|
moveHover(e){
|
|
270
271
|
var columnHolder = this.table.columnManager.getElement(),
|
|
271
272
|
scrollLeft = columnHolder.scrollLeft,
|
|
272
273
|
xPos = ((this.touchMove ? e.touches[0].pageX : e.pageX) - Helpers.elOffset(columnHolder).left) + scrollLeft,
|
|
273
274
|
scrollPos;
|
|
274
|
-
|
|
275
|
+
|
|
275
276
|
this.hoverElement.style.left = (xPos - this.startX) + "px";
|
|
276
|
-
|
|
277
|
+
|
|
277
278
|
if(xPos - scrollLeft < this.autoScrollMargin){
|
|
278
279
|
if(!this.autoScrollTimeout){
|
|
279
280
|
this.autoScrollTimeout = setTimeout(() => {
|
|
@@ -283,7 +284,7 @@ class MoveColumns extends Module{
|
|
|
283
284
|
}, 1);
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
|
-
|
|
287
|
+
|
|
287
288
|
if(scrollLeft + columnHolder.clientWidth - xPos < this.autoScrollMargin){
|
|
288
289
|
if(!this.autoScrollTimeout){
|
|
289
290
|
this.autoScrollTimeout = setTimeout(() => {
|
|
@@ -198,7 +198,8 @@ class Page extends Module{
|
|
|
198
198
|
margin = this.table.options.progressiveLoadScrollMargin || (element.clientHeight * 2);
|
|
199
199
|
|
|
200
200
|
if(diff < margin){
|
|
201
|
-
this.nextPage()
|
|
201
|
+
this.nextPage()
|
|
202
|
+
.catch(() => {}); //consume the exception thrown when on the last page
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
}
|
|
@@ -37,7 +37,7 @@ class SelectRow extends Module{
|
|
|
37
37
|
this.subscribe("rows-wipe", this.clearSelectionData.bind(this));
|
|
38
38
|
this.subscribe("rows-retrieve", this.rowRetrieve.bind(this));
|
|
39
39
|
|
|
40
|
-
if(this.table.options.selectable && this.table.options.selectablePersistence){
|
|
40
|
+
if(this.table.options.selectable && !this.table.options.selectablePersistence){
|
|
41
41
|
this.subscribe("data-refeshing", this.deselectRows.bind(this));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -299,6 +299,7 @@ class SelectRow extends Module{
|
|
|
299
299
|
var self = this,
|
|
300
300
|
rowCount;
|
|
301
301
|
|
|
302
|
+
console.trace("deselect")
|
|
302
303
|
if(typeof rows == "undefined"){
|
|
303
304
|
|
|
304
305
|
rowCount = self.selectedRows.length;
|
|
@@ -6,8 +6,9 @@ export default function(a, b, aRow, bRow, column, dir, params){
|
|
|
6
6
|
emptyAlign = 0;
|
|
7
7
|
|
|
8
8
|
if(typeof DT != "undefined"){
|
|
9
|
-
a = DT.fromFormat(a, format);
|
|
10
|
-
b = DT.fromFormat(b, format);
|
|
9
|
+
a = DT.fromFormat(String(a), format);
|
|
10
|
+
b = DT.fromFormat(String(b), format);
|
|
11
|
+
|
|
11
12
|
if(!a.isValid){
|
|
12
13
|
emptyAlign = !b.isValid ? 0 : -1;
|
|
13
14
|
}else if(!b.isValid){
|