@ssplib/react-components 0.0.281 → 0.0.282
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.
|
@@ -304,8 +304,10 @@ function downloadCSVFile(list, config, filters) {
|
|
|
304
304
|
const newData = list.map(x => {
|
|
305
305
|
const obj = {};
|
|
306
306
|
config.map.forEach(m => {
|
|
307
|
+
// opção de usar o valor do filtro no próprio campo
|
|
307
308
|
if (m.useFilterValue) {
|
|
308
|
-
const
|
|
309
|
+
const filterValueList = filters.filter(f => f.label == m.useFilterValue.label && m.useFilterValue.operators.includes(f.operator));
|
|
310
|
+
const filterValue = filterValueList.length > 0 ? (filterValueList.reduce(r => r.value).value || undefined) : undefined;
|
|
309
311
|
obj[m.name] = filterValue || (0, lodash_get_1.default)(x, m.key);
|
|
310
312
|
return;
|
|
311
313
|
}
|
|
@@ -315,7 +317,7 @@ function downloadCSVFile(list, config, filters) {
|
|
|
315
317
|
});
|
|
316
318
|
const worksheet = XLSX.utils.json_to_sheet(newData);
|
|
317
319
|
const workbook = XLSX.utils.book_new();
|
|
318
|
-
XLSX.utils.book_append_sheet(workbook, worksheet,
|
|
320
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, config.fileName);
|
|
319
321
|
XLSX.writeFile(workbook, `${config.fileName}.xlsx`);
|
|
320
322
|
});
|
|
321
323
|
}
|