@bento-core/table 1.0.0-c3dc.22 → 1.0.0-c3dc.24
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.
|
@@ -96,7 +96,11 @@ function downloadData(tableData, table, downloadFileName) {
|
|
|
96
96
|
let fileType;
|
|
97
97
|
if (format === 'json') {
|
|
98
98
|
filterColumns.forEach(column => {
|
|
99
|
-
|
|
99
|
+
let jsonKey = column.dataField;
|
|
100
|
+
if (column.useKey) {
|
|
101
|
+
jsonKey = column.header;
|
|
102
|
+
}
|
|
103
|
+
formatDataVal = JSON.parse(JSON.stringify(formatDataVal).split("\"".concat(jsonKey, "\":")).join("\"".concat(column.header, "\":")));
|
|
100
104
|
});
|
|
101
105
|
fileContent = JSON.stringify(formatDataVal);
|
|
102
106
|
fileType = 'application/json';
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.0-c3dc.
|
|
3
|
+
"version": "1.0.0-c3dc.24",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
6
|
+
"build": "cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
8
|
"lint": "eslint src"
|
|
9
9
|
},
|
|
@@ -80,8 +80,13 @@ export function downloadData(tableData, table, downloadFileName, format = 'csv')
|
|
|
80
80
|
|
|
81
81
|
if (format === 'json') {
|
|
82
82
|
filterColumns.forEach((column) => {
|
|
83
|
+
let jsonKey = column.dataField;
|
|
84
|
+
|
|
85
|
+
if (column.useKey) {
|
|
86
|
+
jsonKey = column.header;
|
|
87
|
+
}
|
|
83
88
|
formatDataVal = JSON.parse(
|
|
84
|
-
JSON.stringify(formatDataVal).split(`"${
|
|
89
|
+
JSON.stringify(formatDataVal).split(`"${jsonKey}":`).join(`"${column.header}":`),
|
|
85
90
|
);
|
|
86
91
|
});
|
|
87
92
|
fileContent = JSON.stringify(formatDataVal);
|