tabulator-tables 5.0.9 → 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/.editorconfig +6 -0
- package/LICENSE +1 -1
- package/bower.json +1 -1
- package/build/rollup.js +2 -1
- package/dist/css/tabulator.css +26 -10
- 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 +26 -10
- 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 +26 -10
- 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 +26 -10
- 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 +33 -14
- 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 +30 -10
- 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 +26 -10
- 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 +26 -10
- 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 +26 -10
- 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 +30 -10
- 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 +1077 -530
- 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 +1696 -1171
- 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 +318 -291
- package/src/js/core/Tabulator.js +8 -68
- package/src/js/core/cell/Cell.js +5 -1
- package/src/js/core/column/Column.js +20 -5
- package/src/js/core/column/ColumnComponent.js +6 -0
- package/src/js/core/column/defaults/options.js +1 -0
- package/src/js/core/defaults/options.js +2 -2
- package/src/js/core/modules/optional.js +1 -0
- package/src/js/core/rendering/Renderer.js +1 -1
- package/src/js/core/rendering/renderers/BasicVertical.js +2 -1
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +165 -151
- package/src/js/core/row/Row.js +2 -2
- package/src/js/core/tools/DataLoader.js +5 -5
- package/src/js/core/tools/InteractionMonitor.js +63 -32
- package/src/js/core/tools/ModuleBinder.js +15 -3
- package/src/js/modules/Ajax/Ajax.js +62 -82
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +3 -3
- package/src/js/modules/DataTree/DataTree.js +5 -1
- package/src/js/modules/Download/defaults/downloaders/json.js +1 -1
- package/src/js/modules/Download/defaults/downloaders/jsonLines.js +32 -0
- package/src/js/modules/Download/defaults/downloaders.js +2 -0
- package/src/js/modules/Edit/Edit.js +26 -31
- package/src/js/modules/Export/Export.js +2 -1
- package/src/js/modules/Filter/Filter.js +2 -3
- package/src/js/modules/Format/defaults/formatters/datetime.js +1 -1
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +2 -1
- package/src/js/modules/Format/defaults/formatters/rownum.js +1 -1
- package/src/js/modules/FrozenColumns/FrozenColumns.js +1 -1
- package/src/js/modules/FrozenRows/FrozenRows.js +9 -0
- package/src/js/modules/GroupRows/Group.js +2 -61
- package/src/js/modules/GroupRows/GroupComponent.js +1 -1
- package/src/js/modules/GroupRows/GroupRows.js +2 -2
- package/src/js/modules/Import/Import.js +195 -0
- package/src/js/modules/Import/defaults/importers/csv.js +63 -0
- package/src/js/modules/Import/defaults/importers/json.js +8 -0
- package/src/js/modules/Import/defaults/importers.js +7 -0
- package/src/js/modules/Interaction/Interaction.js +5 -0
- package/src/js/modules/Keybindings/Keybindings.js +9 -14
- package/src/js/modules/Keybindings/defaults/bindings.js +3 -3
- package/src/js/modules/Localize/defaults/langs.js +6 -0
- package/src/js/modules/Menu/Menu.js +200 -155
- package/src/js/modules/MoveRows/MoveRows.js +4 -0
- package/src/js/modules/Page/Page.js +279 -176
- package/src/js/modules/Page/defaults/pageCounters/pages.js +33 -0
- package/src/js/modules/Page/defaults/pageCounters/rows.js +32 -0
- package/src/js/modules/Page/defaults/pageCounters.js +8 -0
- package/src/js/modules/Persistence/Persistence.js +6 -4
- package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +8 -10
- package/src/js/modules/SelectRow/SelectRow.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/datetime.js +2 -2
- package/src/js/modules/Validate/Validate.js +7 -5
- package/src/scss/tabulator.scss +31 -12
- package/src/scss/themes/materialize/tabulator_materialize.scss +5 -4
- package/src/scss/themes/tabulator_midnight.scss +4 -0
- package/src/scss/themes/tabulator_site.scss +4 -0
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
|
|
|
@@ -341,49 +324,6 @@ class Tabulator {
|
|
|
341
324
|
return this.rowManager.restoreRedraw();
|
|
342
325
|
}
|
|
343
326
|
|
|
344
|
-
//local data from local file
|
|
345
|
-
setDataFromLocalFile(extensions){
|
|
346
|
-
return new Promise((resolve, reject) => {
|
|
347
|
-
var input = document.createElement("input");
|
|
348
|
-
input.type = "file";
|
|
349
|
-
input.accept = extensions || ".json,application/json";
|
|
350
|
-
|
|
351
|
-
input.addEventListener("change", (e) => {
|
|
352
|
-
var file = input.files[0],
|
|
353
|
-
reader = new FileReader(),
|
|
354
|
-
data;
|
|
355
|
-
|
|
356
|
-
reader.readAsText(file);
|
|
357
|
-
|
|
358
|
-
reader.onload = (e) => {
|
|
359
|
-
|
|
360
|
-
try {
|
|
361
|
-
data = JSON.parse(reader.result);
|
|
362
|
-
} catch(e) {
|
|
363
|
-
console.warn("File Load Error - File contents is invalid JSON", e);
|
|
364
|
-
reject(e);
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
this.setData(data)
|
|
369
|
-
.then((data) => {
|
|
370
|
-
resolve(data);
|
|
371
|
-
})
|
|
372
|
-
.catch((err) => {
|
|
373
|
-
resolve(err);
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
reader.onerror = (e) => {
|
|
378
|
-
console.warn("File Load Error - Unable to read file");
|
|
379
|
-
reject();
|
|
380
|
-
};
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
input.click();
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
|
|
387
327
|
//load data
|
|
388
328
|
setData(data, params, config){
|
|
389
329
|
if(this.initialized){
|
package/src/js/core/cell/Cell.js
CHANGED
|
@@ -191,6 +191,10 @@ export default class Cell extends CoreFeature{
|
|
|
191
191
|
|
|
192
192
|
this.cellRendered();
|
|
193
193
|
|
|
194
|
+
if(this.column.definition.cellEdited){
|
|
195
|
+
this.column.definition.cellEdited.call(this.table, this.getComponent());
|
|
196
|
+
}
|
|
197
|
+
|
|
194
198
|
this.dispatchExternal("cellEdited", this.getComponent());
|
|
195
199
|
|
|
196
200
|
if(this.subscribedExternal("dataChanged")){
|
|
@@ -202,7 +206,7 @@ export default class Cell extends CoreFeature{
|
|
|
202
206
|
setValueProcessData(value, mutate){
|
|
203
207
|
var changed = false;
|
|
204
208
|
|
|
205
|
-
if(this.value
|
|
209
|
+
if(this.value !== value){
|
|
206
210
|
|
|
207
211
|
changed = true;
|
|
208
212
|
|
|
@@ -30,6 +30,7 @@ class Column extends CoreFeature{
|
|
|
30
30
|
this.getFieldValue = "";
|
|
31
31
|
this.setFieldValue = "";
|
|
32
32
|
|
|
33
|
+
this.titleDownload = null;
|
|
33
34
|
this.titleFormatterRendered = false;
|
|
34
35
|
|
|
35
36
|
this.mapDefinitions();
|
|
@@ -42,6 +43,7 @@ class Column extends CoreFeature{
|
|
|
42
43
|
this.widthStyled = ""; //column width prestyled to improve render efficiency
|
|
43
44
|
this.maxWidth = null; //column maximum width
|
|
44
45
|
this.maxWidthStyled = ""; //column maximum prestyled to improve render efficiency
|
|
46
|
+
this.maxInitialWidth = null;
|
|
45
47
|
this.minWidth = null; //column minimum width
|
|
46
48
|
this.minWidthStyled = ""; //column minimum prestyled to improve render efficiency
|
|
47
49
|
this.widthFixed = false; //user has specified a width for this column
|
|
@@ -320,6 +322,10 @@ class Column extends CoreFeature{
|
|
|
320
322
|
//set min width if present
|
|
321
323
|
this.setMinWidth(parseInt(def.minWidth));
|
|
322
324
|
|
|
325
|
+
if (def.maxInitialWidth) {
|
|
326
|
+
this.maxInitialWidth = parseInt(def.maxInitialWidth);
|
|
327
|
+
}
|
|
328
|
+
|
|
323
329
|
if(def.maxWidth){
|
|
324
330
|
this.setMaxWidth(parseInt(def.maxWidth));
|
|
325
331
|
}
|
|
@@ -571,6 +577,10 @@ class Column extends CoreFeature{
|
|
|
571
577
|
return this.field;
|
|
572
578
|
}
|
|
573
579
|
|
|
580
|
+
getTitleDownload() {
|
|
581
|
+
return this.titleDownload;
|
|
582
|
+
}
|
|
583
|
+
|
|
574
584
|
//return the first column in a group
|
|
575
585
|
getFirstColumn(){
|
|
576
586
|
if(!this.isGroup){
|
|
@@ -703,7 +713,7 @@ class Column extends CoreFeature{
|
|
|
703
713
|
cell.hide();
|
|
704
714
|
});
|
|
705
715
|
|
|
706
|
-
this.dispatch("column-hide", this);
|
|
716
|
+
this.dispatch("column-hide", this, responsiveToggle);
|
|
707
717
|
|
|
708
718
|
if(!silent){
|
|
709
719
|
this.dispatchExternal("columnVisibilityChanged", this.getComponent(), false);
|
|
@@ -823,7 +833,7 @@ class Column extends CoreFeature{
|
|
|
823
833
|
}
|
|
824
834
|
|
|
825
835
|
getHeight(){
|
|
826
|
-
return this.element.
|
|
836
|
+
return Math.ceil(this.element.getBoundingClientRect().height);
|
|
827
837
|
}
|
|
828
838
|
|
|
829
839
|
setMinWidth(minWidth){
|
|
@@ -928,18 +938,19 @@ class Column extends CoreFeature{
|
|
|
928
938
|
|
|
929
939
|
//set width if present
|
|
930
940
|
if(typeof this.definition.width !== "undefined" && !force){
|
|
941
|
+
// maxInitialWidth ignored here as width specified
|
|
931
942
|
this.setWidth(this.definition.width);
|
|
932
943
|
}
|
|
933
944
|
|
|
934
945
|
this.dispatch("column-width-fit-before", this);
|
|
935
946
|
|
|
936
|
-
this.fitToData();
|
|
947
|
+
this.fitToData(force);
|
|
937
948
|
|
|
938
949
|
this.dispatch("column-width-fit-after", this);
|
|
939
950
|
}
|
|
940
951
|
|
|
941
952
|
//set column width to maximum cell width for non group columns
|
|
942
|
-
fitToData(){
|
|
953
|
+
fitToData(force){
|
|
943
954
|
if(this.isGroup){
|
|
944
955
|
return;
|
|
945
956
|
}
|
|
@@ -964,7 +975,11 @@ class Column extends CoreFeature{
|
|
|
964
975
|
});
|
|
965
976
|
|
|
966
977
|
if(maxWidth){
|
|
967
|
-
|
|
978
|
+
var setTo = maxWidth + 1;
|
|
979
|
+
if (this.maxInitialWidth && !force) {
|
|
980
|
+
setTo = Math.min(setTo, this.maxInitialWidth);
|
|
981
|
+
}
|
|
982
|
+
this.setWidthActual(setTo);
|
|
968
983
|
}
|
|
969
984
|
}
|
|
970
985
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Column from './Column.js';
|
|
2
|
+
|
|
1
3
|
//public column object
|
|
2
4
|
export default class ColumnComponent {
|
|
3
5
|
constructor (column){
|
|
@@ -27,6 +29,10 @@ export default class ColumnComponent {
|
|
|
27
29
|
return this._column.getField();
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
getTitleDownload() {
|
|
33
|
+
return this._column.getTitleDownload();
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
getCells(){
|
|
31
37
|
var cells = [];
|
|
32
38
|
|
|
@@ -8,7 +8,6 @@ export default {
|
|
|
8
8
|
minHeight:false, //minimum height of tabulator
|
|
9
9
|
maxHeight:false, //maximum height of tabulator
|
|
10
10
|
|
|
11
|
-
columnMaxWidth:false, //minimum global width for a column
|
|
12
11
|
columnHeaderVertAlign:"top", //vertical alignment of column headers
|
|
13
12
|
|
|
14
13
|
columns:[],//store for colum header info
|
|
@@ -53,8 +52,9 @@ export default {
|
|
|
53
52
|
dataLoader:true,
|
|
54
53
|
dataLoaderLoading:false,
|
|
55
54
|
dataLoaderError:false,
|
|
55
|
+
dataLoaderErrorTimeout:3000,
|
|
56
56
|
|
|
57
57
|
dataSendParams:{},
|
|
58
58
|
|
|
59
59
|
dataReceiveParams:{},
|
|
60
|
-
}
|
|
60
|
+
}
|
|
@@ -13,6 +13,7 @@ export {default as FrozenRowsModule} from '../../modules/FrozenRows/FrozenRows.j
|
|
|
13
13
|
export {default as GroupRowsModule} from '../../modules/GroupRows/GroupRows.js';
|
|
14
14
|
export {default as HistoryModule} from '../../modules/History/History.js';
|
|
15
15
|
export {default as HtmlTableImportModule} from '../../modules/HtmlTableImport/HtmlTableImport.js';
|
|
16
|
+
export {default as ImportModule} from '../../modules/Import/Import.js';
|
|
16
17
|
export {default as InteractionModule} from '../../modules/Interaction/Interaction.js';
|
|
17
18
|
export {default as KeybindingsModule} from '../../modules/Keybindings/Keybindings.js';
|
|
18
19
|
export {default as MenuModule} from '../../modules/Menu/Menu.js';
|
|
@@ -79,7 +79,7 @@ export default class Renderer extends CoreFeature{
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
scrollToRowNearestTop(row){
|
|
82
|
-
//
|
|
82
|
+
//determine weather the row is nearest the top or bottom of the table, retur true for top or false for bottom
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
visibleRows(includingBuffer){
|