tabulator-tables 5.0.10 → 5.1.0
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 +1 -1
- package/dist/css/tabulator.css +15 -6
- 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 +15 -6
- 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 +15 -6
- 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 +15 -6
- 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 +22 -10
- 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 +19 -6
- 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 +15 -6
- 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 +15 -6
- 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 +15 -6
- 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 +19 -6
- 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 +853 -390
- 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 +1106 -656
- 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 +7 -7
- package/src/js/core/Tabulator.js +0 -43
- package/src/js/core/cell/Cell.js +5 -1
- package/src/js/core/column/Column.js +19 -4
- package/src/js/core/column/ColumnComponent.js +4 -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/renderers/BasicVertical.js +2 -1
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +17 -8
- package/src/js/core/row/Row.js +2 -2
- package/src/js/core/tools/DataLoader.js +4 -4
- package/src/js/core/tools/InteractionMonitor.js +6 -2
- package/src/js/modules/Ajax/Ajax.js +62 -82
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +1 -1
- package/src/js/modules/DataTree/DataTree.js +5 -0
- 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 +23 -31
- package/src/js/modules/Filter/Filter.js +1 -1
- 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/FrozenRows/FrozenRows.js +9 -0
- package/src/js/modules/GroupRows/Group.js +2 -61
- package/src/js/modules/GroupRows/GroupRows.js +2 -2
- package/src/js/modules/Import/Import.js +197 -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 +271 -173
- 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/ResizeRows/ResizeRows.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 +20 -6
- 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/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export default class RowManager extends CoreFeature{
|
|
|
20
20
|
this.fixedHeight = false; //current rendering mode
|
|
21
21
|
|
|
22
22
|
this.rows = []; //hold row data objects
|
|
23
|
-
this.activeRowsPipeline = []; //hold
|
|
23
|
+
this.activeRowsPipeline = []; //hold calculation of active rows
|
|
24
24
|
this.activeRows = []; //rows currently available to on display in the table
|
|
25
25
|
this.activeRowsCount = 0; //count of active rows
|
|
26
26
|
|
|
@@ -32,9 +32,9 @@ export default class RowManager extends CoreFeature{
|
|
|
32
32
|
|
|
33
33
|
this.rowNumColumn = false; //hold column component for row number column
|
|
34
34
|
|
|
35
|
-
this.redrawBlock = false; //prevent redraws to allow multiple data manipulations
|
|
35
|
+
this.redrawBlock = false; //prevent redraws to allow multiple data manipulations before continuing
|
|
36
36
|
this.redrawBlockRestoreConfig = false; //store latest redraw function calls for when redraw is needed
|
|
37
|
-
this.
|
|
37
|
+
this.redrawBlockRenderInPosition = false; //store latest redraw function calls for when redraw is needed
|
|
38
38
|
|
|
39
39
|
this.dataPipeline = []; //hold data pipeline tasks
|
|
40
40
|
this.displayPipeline = []; //hold data display pipeline tasks
|
|
@@ -709,7 +709,7 @@ export default class RowManager extends CoreFeature{
|
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
|
|
712
|
-
this.dispatch("data-
|
|
712
|
+
this.dispatch("data-refreshed");
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
|
|
@@ -821,7 +821,7 @@ export default class RowManager extends CoreFeature{
|
|
|
821
821
|
if(callback){
|
|
822
822
|
callback();
|
|
823
823
|
}else{
|
|
824
|
-
this.
|
|
824
|
+
this.redrawBlockRenderInPosition = true;
|
|
825
825
|
}
|
|
826
826
|
}else{
|
|
827
827
|
this.renderer.rerenderRows(callback);
|
|
@@ -1001,12 +1001,12 @@ export default class RowManager extends CoreFeature{
|
|
|
1001
1001
|
|
|
1002
1002
|
this.redrawBlockRestoreConfig = false;
|
|
1003
1003
|
}else{
|
|
1004
|
-
if(this.
|
|
1004
|
+
if(this.redrawBlockRenderInPosition){
|
|
1005
1005
|
this.reRenderInPosition();
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
1009
|
-
this.
|
|
1009
|
+
this.redrawBlockRenderInPosition = false;
|
|
1010
1010
|
}
|
|
1011
1011
|
|
|
1012
1012
|
//redraw table
|
package/src/js/core/Tabulator.js
CHANGED
|
@@ -341,49 +341,6 @@ class Tabulator {
|
|
|
341
341
|
return this.rowManager.restoreRedraw();
|
|
342
342
|
}
|
|
343
343
|
|
|
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
344
|
//load data
|
|
388
345
|
setData(data, params, config){
|
|
389
346
|
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){
|
|
@@ -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
|
}
|
|
@@ -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';
|
|
@@ -25,10 +25,10 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
initialize(){
|
|
28
|
-
this.
|
|
28
|
+
this.compatibilityCheck();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
compatibilityCheck(){
|
|
32
32
|
var columns = this.options("columns"),
|
|
33
33
|
frozen = false,
|
|
34
34
|
ok = true;
|
|
@@ -114,7 +114,7 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
114
114
|
config.width = width;
|
|
115
115
|
|
|
116
116
|
if (this.options("layout") === "fitData") {
|
|
117
|
-
config.fitDataCheck = true;
|
|
117
|
+
config.fitDataCheck = column.modules.vdomHoz ? column.modules.vdomHoz.fitDataCheck : true;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
if((colPos + width > this.vDomScrollPosLeft) && (colPos < this.vDomScrollPosRight)){
|
|
@@ -327,7 +327,7 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
327
327
|
|
|
328
328
|
this.fitDataColActualWidthCheck(column);
|
|
329
329
|
|
|
330
|
-
this.rightCol++;
|
|
330
|
+
this.rightCol++; // Don't move this below the >= check below
|
|
331
331
|
|
|
332
332
|
if(this.rightCol >= (this.columns.length - 1)){
|
|
333
333
|
this.vDomPadRight = 0;
|
|
@@ -358,7 +358,9 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
358
358
|
|
|
359
359
|
this.fitDataColActualWidthCheck(column);
|
|
360
360
|
|
|
361
|
-
|
|
361
|
+
this.leftCol--; // don't move this below the <= check below
|
|
362
|
+
|
|
363
|
+
if(this.leftCol <= 0){ // replicating logic in addColRight
|
|
362
364
|
this.vDomPadLeft = 0;
|
|
363
365
|
}else{
|
|
364
366
|
this.vDomPadLeft -= column.getWidth();
|
|
@@ -366,7 +368,6 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
366
368
|
|
|
367
369
|
this.tableElement.style.paddingLeft = this.vDomPadLeft + "px";
|
|
368
370
|
|
|
369
|
-
this.leftCol--;
|
|
370
371
|
|
|
371
372
|
this.addColLeft();
|
|
372
373
|
}
|
|
@@ -384,7 +385,11 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
384
385
|
rows.forEach((row) => {
|
|
385
386
|
if(row.type !== "group"){
|
|
386
387
|
var cell = row.getCell(column);
|
|
387
|
-
|
|
388
|
+
try {
|
|
389
|
+
row.getElement().removeChild(cell.getElement());
|
|
390
|
+
} catch (ex) {
|
|
391
|
+
console.warn("Could not removeColRight", ex.message)
|
|
392
|
+
}
|
|
388
393
|
}
|
|
389
394
|
});
|
|
390
395
|
|
|
@@ -414,7 +419,11 @@ export default class VirtualDomHorizontal extends Renderer{
|
|
|
414
419
|
el = cell.getElement();
|
|
415
420
|
|
|
416
421
|
if(el.parentNode){
|
|
417
|
-
|
|
422
|
+
try {
|
|
423
|
+
row.getElement().removeChild(el);
|
|
424
|
+
} catch (ex) {
|
|
425
|
+
console.warn("Could not removeColLeft", ex.message)
|
|
426
|
+
}
|
|
418
427
|
}
|
|
419
428
|
}
|
|
420
429
|
}
|
package/src/js/core/row/Row.js
CHANGED
|
@@ -84,12 +84,12 @@ export default class Row extends CoreFeature{
|
|
|
84
84
|
|
|
85
85
|
this.dispatch("row-layout", this);
|
|
86
86
|
|
|
87
|
+
this.initialized = true;
|
|
88
|
+
|
|
87
89
|
if(this.table.options.rowFormatter){
|
|
88
90
|
this.table.options.rowFormatter(this.getComponent());
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
this.initialized = true;
|
|
92
|
-
|
|
93
93
|
this.dispatch("row-layout-after", this);
|
|
94
94
|
}else{
|
|
95
95
|
this.table.columnManager.renderer.rerenderRowCells(this);
|
|
@@ -76,8 +76,8 @@ export default class DataLoader extends CoreFeature{
|
|
|
76
76
|
|
|
77
77
|
params = this.mapParams(params, this.table.options.dataSendParams);
|
|
78
78
|
|
|
79
|
-
var result = this.chain("data-load", [data, params, config, silent], Promise.resolve([]));
|
|
80
|
-
|
|
79
|
+
var result = this.chain("data-load", [data, params, config, silent], false, Promise.resolve([]));
|
|
80
|
+
|
|
81
81
|
return result.then((response) => {
|
|
82
82
|
if(!Array.isArray(response) && typeof response == "object"){
|
|
83
83
|
response = this.mapParams(response, this.objectInvert(this.table.options.dataReceiveParams));
|
|
@@ -102,10 +102,10 @@ export default class DataLoader extends CoreFeature{
|
|
|
102
102
|
if(!silent){
|
|
103
103
|
this.showError();
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
|
|
106
106
|
setTimeout(() => {
|
|
107
107
|
this.hideLoader();
|
|
108
|
-
},
|
|
108
|
+
}, this.table.options.dataLoaderErrorTimeout);
|
|
109
109
|
})
|
|
110
110
|
.finally(() => {
|
|
111
111
|
this.loading = false;
|
|
@@ -246,7 +246,7 @@ export default class InteractionManager extends CoreFeature {
|
|
|
246
246
|
switch(key){
|
|
247
247
|
case "row":
|
|
248
248
|
case "group":
|
|
249
|
-
if(listener.components.includes("row") || listener.components.includes("cell")){
|
|
249
|
+
if(listener.components.includes("row") || listener.components.includes("cell") || listener.components.includes("group")){
|
|
250
250
|
let rows = this.table.rowManager.getVisibleRows(true);
|
|
251
251
|
|
|
252
252
|
component = rows.find((row) => {
|
|
@@ -263,7 +263,11 @@ export default class InteractionManager extends CoreFeature {
|
|
|
263
263
|
|
|
264
264
|
case "cell":
|
|
265
265
|
if(listener.components.includes("cell")){
|
|
266
|
-
|
|
266
|
+
if(targets["row"]){
|
|
267
|
+
component = targets["row"].findCell(target);
|
|
268
|
+
}else{
|
|
269
|
+
console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?")
|
|
270
|
+
}
|
|
267
271
|
}
|
|
268
272
|
break;
|
|
269
273
|
}
|
|
@@ -6,145 +6,125 @@ import defaultLoaderPromise from './defaults/loaderPromise.js';
|
|
|
6
6
|
import defaultContentTypeFormatters from './defaults/contentTypeFormatters.js';
|
|
7
7
|
|
|
8
8
|
class Ajax extends Module{
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
constructor(table){
|
|
11
11
|
super(table);
|
|
12
|
-
|
|
13
|
-
this.config =
|
|
12
|
+
|
|
13
|
+
this.config = {}; //hold config object for ajax request
|
|
14
14
|
this.url = ""; //request URL
|
|
15
15
|
this.urlGenerator = false;
|
|
16
16
|
this.params = false; //request parameters
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
this.loaderPromise = false;
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
this.registerTableOption("ajaxURL", false); //url for ajax loading
|
|
21
21
|
this.registerTableOption("ajaxURLGenerator", false);
|
|
22
22
|
this.registerTableOption("ajaxParams", {}); //params for ajax loading
|
|
23
23
|
this.registerTableOption("ajaxConfig", "get"); //ajax request type
|
|
24
24
|
this.registerTableOption("ajaxContentType", "form"); //ajax request type
|
|
25
25
|
this.registerTableOption("ajaxRequestFunc", false); //promise function
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
this.registerTableOption("ajaxRequesting", function(){});
|
|
28
28
|
this.registerTableOption("ajaxResponse", false);
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
this.contentTypeFormatters = Ajax.contentTypeFormatters;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
//initialize setup options
|
|
34
34
|
initialize(){
|
|
35
35
|
this.loaderPromise = this.table.options.ajaxRequestFunc || Ajax.defaultLoaderPromise;
|
|
36
36
|
this.urlGenerator = this.table.options.ajaxURLGenerator || Ajax.defaultURLGenerator;
|
|
37
|
-
|
|
38
|
-
if(this.table.options.ajaxParams){
|
|
39
|
-
this.setParams(this.table.options.ajaxParams);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if(this.table.options.ajaxConfig){
|
|
43
|
-
this.setConfig(this.table.options.ajaxConfig);
|
|
44
|
-
}
|
|
45
|
-
|
|
37
|
+
|
|
46
38
|
if(this.table.options.ajaxURL){
|
|
47
39
|
this.setUrl(this.table.options.ajaxURL);
|
|
48
40
|
}
|
|
49
41
|
|
|
50
|
-
this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
|
|
51
42
|
|
|
43
|
+
this.setDefaultConfig(this.table.options.ajaxConfig);
|
|
44
|
+
|
|
45
|
+
this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this));
|
|
46
|
+
|
|
52
47
|
this.subscribe("data-loading", this.requestDataCheck.bind(this));
|
|
48
|
+
this.subscribe("data-params", this.requestParams.bind(this));
|
|
53
49
|
this.subscribe("data-load", this.requestData.bind(this));
|
|
54
50
|
}
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
|
|
52
|
+
requestParams(data, config, silent, params){
|
|
53
|
+
var ajaxParams = this.table.options.ajaxParams;
|
|
54
|
+
|
|
55
|
+
if(ajaxParams){
|
|
56
|
+
if(typeof ajaxParams === "function"){
|
|
57
|
+
ajaxParams = ajaxParams.call(this.table);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
params = Object.assign(params, ajaxParams);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return params;
|
|
64
|
+
}
|
|
65
|
+
|
|
57
66
|
requestDataCheck(data, params, config, silent){
|
|
58
67
|
return !!((!data && this.url) || typeof data === "string");
|
|
59
68
|
}
|
|
60
|
-
|
|
61
|
-
requestData(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if(params){
|
|
68
|
-
this.setParams(params, true);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if(config){
|
|
72
|
-
this.setConfig(config);
|
|
69
|
+
|
|
70
|
+
requestData(url, params, config, silent, previousData){
|
|
71
|
+
var ajaxConfig;
|
|
72
|
+
|
|
73
|
+
if(!previousData && this.requestDataCheck(url)){
|
|
74
|
+
if(url){
|
|
75
|
+
this.setUrl(url);
|
|
73
76
|
}
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
|
|
78
|
+
ajaxConfig = this.generateConfig(config);
|
|
79
|
+
|
|
80
|
+
return this.sendRequest(this.url, params, ajaxConfig);
|
|
76
81
|
}else{
|
|
77
82
|
return previousData;
|
|
78
83
|
}
|
|
79
84
|
}
|
|
85
|
+
|
|
86
|
+
setDefaultConfig(config = {}){
|
|
87
|
+
this.config = Object.assign({}, Ajax.defaultConfig);
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if(update){
|
|
84
|
-
this.params = this.params || {};
|
|
85
|
-
|
|
86
|
-
for(let key in params){
|
|
87
|
-
this.params[key] = params[key];
|
|
88
|
-
}
|
|
89
|
+
if(typeof config == "string"){
|
|
90
|
+
this.config.method = config;
|
|
89
91
|
}else{
|
|
90
|
-
this.
|
|
92
|
+
Object.assign(this.config, config);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
|
-
|
|
94
|
-
getParams(){
|
|
95
|
-
return this.params || {};
|
|
96
|
-
}
|
|
97
|
-
|
|
95
|
+
|
|
98
96
|
//load config object
|
|
99
|
-
|
|
100
|
-
this.
|
|
101
|
-
|
|
97
|
+
generateConfig(config = {}){
|
|
98
|
+
var ajaxConfig = Object.assign({}, this.config)
|
|
99
|
+
|
|
102
100
|
if(typeof config == "string"){
|
|
103
|
-
|
|
101
|
+
ajaxConfig.method = config;
|
|
104
102
|
}else{
|
|
105
|
-
|
|
106
|
-
this.config[key] = config[key];
|
|
107
|
-
}
|
|
103
|
+
Object.assign(ajaxConfig, config);
|
|
108
104
|
}
|
|
105
|
+
|
|
106
|
+
return ajaxConfig;
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
//create config object from default
|
|
112
|
-
_loadDefaultConfig(force){
|
|
113
|
-
if(!this.config || force){
|
|
114
|
-
|
|
115
|
-
this.config = {};
|
|
116
|
-
|
|
117
|
-
//load base config from defaults
|
|
118
|
-
for(let key in Ajax.defaultConfig){
|
|
119
|
-
this.config[key] = Ajax.defaultConfig[key];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
108
|
+
|
|
124
109
|
//set request url
|
|
125
110
|
setUrl(url){
|
|
126
111
|
this.url = url;
|
|
127
112
|
}
|
|
128
|
-
|
|
113
|
+
|
|
129
114
|
//get request url
|
|
130
115
|
getUrl(){
|
|
131
116
|
return this.url;
|
|
132
117
|
}
|
|
133
|
-
|
|
118
|
+
|
|
134
119
|
//send ajax request
|
|
135
|
-
sendRequest(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
this._loadDefaultConfig();
|
|
140
|
-
|
|
141
|
-
if(this.table.options.ajaxRequesting.call(this.table, this.url, this.params) !== false){
|
|
142
|
-
return this.loaderPromise(url, this.config, this.params)
|
|
120
|
+
sendRequest(url, params, config){
|
|
121
|
+
if(this.table.options.ajaxRequesting.call(this.table, url, params) !== false){
|
|
122
|
+
return this.loaderPromise(url, config, params)
|
|
143
123
|
.then((data)=>{
|
|
144
124
|
if(this.table.options.ajaxResponse){
|
|
145
|
-
data = this.table.options.ajaxResponse.call(this.table,
|
|
125
|
+
data = this.table.options.ajaxResponse.call(this.table, url, params, data);
|
|
146
126
|
}
|
|
147
|
-
|
|
127
|
+
|
|
148
128
|
return data;
|
|
149
129
|
});
|
|
150
130
|
}else{
|
|
@@ -51,7 +51,7 @@ class ColumnCalcs extends Module{
|
|
|
51
51
|
this.subscribe("row-added", this.rowsUpdated.bind(this));
|
|
52
52
|
this.subscribe("column-moved", this.recalcActiveRows.bind(this));
|
|
53
53
|
this.subscribe("column-add", this.recalcActiveRows.bind(this));
|
|
54
|
-
this.subscribe("data-
|
|
54
|
+
this.subscribe("data-refreshed", this.recalcActiveRows.bind(this));
|
|
55
55
|
this.subscribe("table-redraw", this.tableRedraw.bind(this));
|
|
56
56
|
this.subscribe("rows-visible", this.visibleRows.bind(this));
|
|
57
57
|
|
|
@@ -38,6 +38,7 @@ class DataTree extends Module{
|
|
|
38
38
|
this.registerComponentFunction("row", "getTreeParent", this.getTreeParent.bind(this));
|
|
39
39
|
this.registerComponentFunction("row", "getTreeChildren", this.getRowChildren.bind(this));
|
|
40
40
|
this.registerComponentFunction("row", "addTreeChild", this.addTreeChildRow.bind(this));
|
|
41
|
+
this.registerComponentFunction("row", "isTreeExpanded", this.isRowExpanded.bind(this));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
initialize(){
|
|
@@ -410,6 +411,10 @@ class DataTree extends Module{
|
|
|
410
411
|
}
|
|
411
412
|
}
|
|
412
413
|
|
|
414
|
+
isRowExpanded(row){
|
|
415
|
+
return row.modules.dataTree.open;
|
|
416
|
+
}
|
|
417
|
+
|
|
413
418
|
getTreeParent(row){
|
|
414
419
|
return row.modules.dataTree.parent ? row.modules.dataTree.parent.getComponent() : false;
|
|
415
420
|
}
|
|
@@ -19,7 +19,7 @@ export default function(list, options, setFileContents){
|
|
|
19
19
|
case "row":
|
|
20
20
|
row.columns.forEach((col) => {
|
|
21
21
|
if(col){
|
|
22
|
-
item[col.component.getField()] = col.value;
|
|
22
|
+
item[col.component.getTitleDownload() || col.component.getField()] = col.value;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|