@bento-core/table 1.0.0-c3dc.33 → 1.0.0-c3dc.34
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/dist/util/downloadTable.js +22 -13
- package/package.json +1 -1
- package/src/util/downloadTable.js +4 -2
|
@@ -76,18 +76,27 @@ function downloadData(tableData, table, downloadFileName) {
|
|
|
76
76
|
} = table;
|
|
77
77
|
const filterColumns = columns.filter(_ref => {
|
|
78
78
|
let {
|
|
79
|
-
cellType
|
|
80
|
-
doNotDownload
|
|
79
|
+
cellType
|
|
81
80
|
} = _ref;
|
|
82
|
-
return !_Types.actionCellTypes.includes(cellType)
|
|
81
|
+
return !_Types.actionCellTypes.includes(cellType);
|
|
82
|
+
}).filter(_ref2 => {
|
|
83
|
+
let {
|
|
84
|
+
doNotDownload
|
|
85
|
+
} = _ref2;
|
|
86
|
+
return !doNotDownload;
|
|
87
|
+
}).filter(_ref3 => {
|
|
88
|
+
let {
|
|
89
|
+
display
|
|
90
|
+
} = _ref3;
|
|
91
|
+
return display;
|
|
83
92
|
});
|
|
84
93
|
let formatDataVal = (0, _Dataformat.formatColumnValues)(filterColumns, tableData);
|
|
85
94
|
formatDataVal = formatDataVal.map(item => {
|
|
86
95
|
const updatedItem = {};
|
|
87
|
-
filterColumns.forEach(
|
|
96
|
+
filterColumns.forEach(_ref4 => {
|
|
88
97
|
let {
|
|
89
98
|
dataField
|
|
90
|
-
} =
|
|
99
|
+
} = _ref4;
|
|
91
100
|
updatedItem[dataField] = item[dataField];
|
|
92
101
|
});
|
|
93
102
|
return updatedItem;
|
|
@@ -112,27 +121,27 @@ function downloadData(tableData, table, downloadFileName) {
|
|
|
112
121
|
fileType = 'application/json';
|
|
113
122
|
} else {
|
|
114
123
|
const jsonse = JSON.stringify(formatDataVal);
|
|
115
|
-
const keysToInclude = filterColumns.filter(
|
|
124
|
+
const keysToInclude = filterColumns.filter(_ref5 => {
|
|
116
125
|
let {
|
|
117
126
|
dataField
|
|
118
|
-
} =
|
|
127
|
+
} = _ref5;
|
|
119
128
|
return dataField;
|
|
120
|
-
}).map(
|
|
129
|
+
}).map(_ref6 => {
|
|
121
130
|
let {
|
|
122
131
|
dataField
|
|
123
|
-
} =
|
|
132
|
+
} = _ref6;
|
|
124
133
|
return dataField;
|
|
125
134
|
});
|
|
126
|
-
const headers = filterColumns.filter(
|
|
135
|
+
const headers = filterColumns.filter(_ref7 => {
|
|
127
136
|
let {
|
|
128
137
|
dataField
|
|
129
|
-
} =
|
|
138
|
+
} = _ref7;
|
|
130
139
|
return dataField;
|
|
131
|
-
}).map(
|
|
140
|
+
}).map(_ref8 => {
|
|
132
141
|
let {
|
|
133
142
|
header,
|
|
134
143
|
downloadHeader
|
|
135
|
-
} =
|
|
144
|
+
} = _ref8;
|
|
136
145
|
return downloadHeader || header;
|
|
137
146
|
});
|
|
138
147
|
fileContent = convertToCSV(jsonse, keysToInclude, headers);
|
package/package.json
CHANGED
|
@@ -63,8 +63,10 @@ export function convertToCSV(jsonse, keysToInclude, header) {
|
|
|
63
63
|
|
|
64
64
|
export function downloadData(tableData, table, downloadFileName, format = 'csv') {
|
|
65
65
|
const { columns = [] } = table;
|
|
66
|
-
const filterColumns = columns
|
|
67
|
-
|
|
66
|
+
const filterColumns = columns
|
|
67
|
+
.filter(({ cellType }) => !actionCellTypes.includes(cellType))
|
|
68
|
+
.filter(({ doNotDownload }) => !doNotDownload)
|
|
69
|
+
.filter(({ display }) => display);
|
|
68
70
|
let formatDataVal = formatColumnValues(filterColumns, tableData);
|
|
69
71
|
|
|
70
72
|
formatDataVal = formatDataVal.map((item) => {
|