tabulator-tables 5.1.1 → 5.1.2
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/dist/js/tabulator.js +46 -44
- 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 +44 -45
- 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/RowManager.js +0 -6
- package/src/js/core/Tabulator.js +8 -25
- package/src/js/core/tools/ModuleBinder.js +15 -3
- package/src/js/modules/Export/Export.js +2 -1
- package/src/js/modules/Filter/Filter.js +1 -2
- package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
- package/src/js/modules/Page/Page.js +4 -1
- package/src/js/modules/Persistence/Persistence.js +6 -4
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +1 -1
package/package.json
CHANGED
|
@@ -1054,12 +1054,6 @@ export default class RowManager extends CoreFeature{
|
|
|
1054
1054
|
if(!force){
|
|
1055
1055
|
this.reRenderInPosition();
|
|
1056
1056
|
this.scrollHorizontal(left);
|
|
1057
|
-
|
|
1058
|
-
if(!this.displayRowsCount){
|
|
1059
|
-
if(this.table.options.placeholder){
|
|
1060
|
-
this.getElement().appendChild(this.table.options.placeholder);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
1057
|
}else{
|
|
1064
1058
|
this.renderTable();
|
|
1065
1059
|
}
|
package/src/js/core/Tabulator.js
CHANGED
|
@@ -41,8 +41,8 @@ class Tabulator {
|
|
|
41
41
|
this.dataLoader = false; //bind component functions
|
|
42
42
|
|
|
43
43
|
this.modules = {}; //hold all modules bound to this table
|
|
44
|
-
this.modulesCore =
|
|
45
|
-
this.modulesRegular =
|
|
44
|
+
this.modulesCore = []; //hold core modules bound to this table (for initialization purposes)
|
|
45
|
+
this.modulesRegular = []; //hold regular modules bound to this table (for initialization purposes)
|
|
46
46
|
|
|
47
47
|
this.optionsList = new OptionsList(this, "table constructor");
|
|
48
48
|
|
|
@@ -100,8 +100,8 @@ class Tabulator {
|
|
|
100
100
|
this.interactionMonitor = new InteractionMonitor(this);
|
|
101
101
|
|
|
102
102
|
this.dataLoader.initialize();
|
|
103
|
-
this.columnManager.initialize();
|
|
104
|
-
this.rowManager.initialize();
|
|
103
|
+
// this.columnManager.initialize();
|
|
104
|
+
// this.rowManager.initialize();
|
|
105
105
|
this.footerManager.initialize();
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -240,24 +240,9 @@ class Tabulator {
|
|
|
240
240
|
this._detectBrowser();
|
|
241
241
|
|
|
242
242
|
//initialize core modules
|
|
243
|
-
|
|
244
|
-
let mod = this.modulesCore[key];
|
|
245
|
-
|
|
243
|
+
this.modulesCore.forEach((mod) => {
|
|
246
244
|
mod.initialize();
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
//configure placeholder element
|
|
250
|
-
if(typeof options.placeholder == "string"){
|
|
251
|
-
var el = document.createElement("div");
|
|
252
|
-
el.classList.add("tabulator-placeholder");
|
|
253
|
-
|
|
254
|
-
var span = document.createElement("span");
|
|
255
|
-
span.innerHTML = options.placeholder;
|
|
256
|
-
|
|
257
|
-
el.appendChild(span);
|
|
258
|
-
|
|
259
|
-
options.placeholder = el;
|
|
260
|
-
}
|
|
245
|
+
})
|
|
261
246
|
|
|
262
247
|
//build table elements
|
|
263
248
|
element.appendChild(this.columnManager.getElement());
|
|
@@ -273,11 +258,9 @@ class Tabulator {
|
|
|
273
258
|
}
|
|
274
259
|
|
|
275
260
|
//initialize regular modules
|
|
276
|
-
|
|
277
|
-
let mod = this.modulesRegular[key];
|
|
278
|
-
|
|
261
|
+
this.modulesRegular.forEach((mod) => {
|
|
279
262
|
mod.initialize();
|
|
280
|
-
}
|
|
263
|
+
});
|
|
281
264
|
|
|
282
265
|
this.columnManager.setColumns(options.columns);
|
|
283
266
|
|
|
@@ -56,19 +56,31 @@ export default class ModuleBinder {
|
|
|
56
56
|
|
|
57
57
|
//ensure that module are bound to instantiated function
|
|
58
58
|
tabulator.prototype.bindModules = function(){
|
|
59
|
+
var orderedMods = [],
|
|
60
|
+
unOrderedMods = [];
|
|
61
|
+
|
|
59
62
|
this.modules = {};
|
|
60
63
|
|
|
61
64
|
for(var name in tabulator.moduleBindings){
|
|
62
65
|
let mod = tabulator.moduleBindings[name];
|
|
66
|
+
let module = new mod(this);
|
|
63
67
|
|
|
64
|
-
this.modules[name] =
|
|
68
|
+
this.modules[name] = module;
|
|
65
69
|
|
|
66
70
|
if(mod.prototype.moduleCore){
|
|
67
|
-
this.modulesCore
|
|
71
|
+
this.modulesCore.push(module);
|
|
68
72
|
}else{
|
|
69
|
-
|
|
73
|
+
if(mod.moduleInitOrder){
|
|
74
|
+
orderedMods.push(module);
|
|
75
|
+
}else{
|
|
76
|
+
unOrderedMods.push(module);
|
|
77
|
+
}
|
|
70
78
|
}
|
|
71
79
|
}
|
|
80
|
+
|
|
81
|
+
orderedMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
|
|
82
|
+
|
|
83
|
+
this.modulesRegular = orderedMods.concat(unOrderedMods);
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
|
|
@@ -208,7 +208,8 @@ class Export extends Module{
|
|
|
208
208
|
|
|
209
209
|
header.forEach((col) => {
|
|
210
210
|
if(col){
|
|
211
|
-
|
|
211
|
+
let title = typeof col.title === "undefined" ? "" : col.title;
|
|
212
|
+
columns.push(new ExportColumn(title, col.column.getComponent(), col.width, col.height, col.depth));
|
|
212
213
|
}else{
|
|
213
214
|
columns.push(null);
|
|
214
215
|
}
|
|
@@ -62,10 +62,13 @@ class Page extends Module{
|
|
|
62
62
|
initialize(){
|
|
63
63
|
if(this.table.options.pagination){
|
|
64
64
|
this.subscribe("row-deleted", this.rowsUpdated.bind(this));
|
|
65
|
-
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
66
65
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
67
66
|
this.subscribe("data-processed", this.initialLoadComplete.bind(this));
|
|
68
67
|
this.subscribe("table-built", this.calculatePageSizes.bind(this));
|
|
68
|
+
|
|
69
|
+
if(this.table.options.paginationAddRow == "page"){
|
|
70
|
+
this.subscribe("row-adding-position", this.rowAddingPosition.bind(this));
|
|
71
|
+
}
|
|
69
72
|
|
|
70
73
|
if(this.table.options.paginationMode === "remote"){
|
|
71
74
|
this.subscribe("data-params", this.remotePageParams.bind(this));
|
|
@@ -131,11 +131,11 @@ class Persistence extends Module{
|
|
|
131
131
|
this.subscribe("column-show", this.save.bind(this, "columns"));
|
|
132
132
|
this.subscribe("column-hide", this.save.bind(this, "columns"));
|
|
133
133
|
this.subscribe("column-moved", this.save.bind(this, "columns"));
|
|
134
|
-
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
this.subscribe("table-
|
|
136
|
+
this.subscribe("table-built", this.tableBuilt.bind(this), 0);
|
|
138
137
|
|
|
138
|
+
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
139
139
|
|
|
140
140
|
this.subscribe("filter-changed", this.eventSave.bind(this, "filter"));
|
|
141
141
|
this.subscribe("sort-changed", this.eventSave.bind(this, "sort"));
|
|
@@ -163,7 +163,7 @@ class Persistence extends Module{
|
|
|
163
163
|
sorters = this.load("sort");
|
|
164
164
|
|
|
165
165
|
if(!sorters === false){
|
|
166
|
-
this.table.initialSort = sorters;
|
|
166
|
+
this.table.options.initialSort = sorters;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -171,7 +171,7 @@ class Persistence extends Module{
|
|
|
171
171
|
filters = this.load("filter");
|
|
172
172
|
|
|
173
173
|
if(!filters === false){
|
|
174
|
-
this.table.initialFilter = filters;
|
|
174
|
+
this.table.options.initialFilter = filters;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -451,6 +451,8 @@ class Persistence extends Module{
|
|
|
451
451
|
|
|
452
452
|
Persistence.moduleName = "persistence";
|
|
453
453
|
|
|
454
|
+
Persistence.moduleInitOrder = 1;
|
|
455
|
+
|
|
454
456
|
//load defaults
|
|
455
457
|
Persistence.readers = defaultReaders;
|
|
456
458
|
Persistence.writers = defaultWriters;
|
|
@@ -322,7 +322,7 @@ class ResponsiveLayout extends Module{
|
|
|
322
322
|
var titleHighlight = document.createElement("strong");
|
|
323
323
|
titleData.appendChild(titleHighlight);
|
|
324
324
|
this.langBind("columns|" + item.field, function(text){
|
|
325
|
-
titleHighlight.
|
|
325
|
+
titleHighlight.innerHTML = text || item.title;
|
|
326
326
|
});
|
|
327
327
|
|
|
328
328
|
if(item.value instanceof Node){
|