@ssplib/react-components 0.0.283 → 0.0.284
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.
|
@@ -302,9 +302,9 @@ function Table({ mediaQueryLG, columns, fetchFunc, emptyMsg = {
|
|
|
302
302
|
localStorage.removeItem(localTableName);
|
|
303
303
|
setFilterKey(new Date().getTime().toString());
|
|
304
304
|
}
|
|
305
|
-
const handleCSVDownload = (list) => {
|
|
305
|
+
const handleCSVDownload = (list, all = false) => {
|
|
306
306
|
var _a;
|
|
307
|
-
(0, utils_1.downloadCSVFile)(list, csvConfig, JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]') || []);
|
|
307
|
+
(0, utils_1.downloadCSVFile)(list, Object.assign(Object.assign({}, csvConfig), (all ? { downloadAll: true } : {})), JSON.parse((_a = localStorage.getItem(localTableName)) !== null && _a !== void 0 ? _a : '[]') || []);
|
|
308
308
|
};
|
|
309
309
|
const handleFiltrarDados = (dt) => {
|
|
310
310
|
(0, utils_1.filtrarDados)({
|
|
@@ -472,7 +472,7 @@ function Table({ mediaQueryLG, columns, fetchFunc, emptyMsg = {
|
|
|
472
472
|
JSON.parse((_b = localStorage.getItem(localTableName)) !== null && _b !== void 0 ? _b : '[]')
|
|
473
473
|
.filter((x) => x.value || (x.operator === 'entre' && (x.value || x.value2))).length > 0 &&
|
|
474
474
|
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: (e) => handleCSVDownload(list), sx: { backgroundColor: '#a5a5a5', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, "Baixar Filtrados"),
|
|
475
|
-
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: (e) => handleCSVDownload(startData.current), sx: { backgroundColor: '#22C55E', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, "Baixar Tabela")))))),
|
|
475
|
+
react_1.default.createElement(material_1.Button, { startIcon: react_1.default.createElement(FileDownload_1.default, null), variant: 'contained', size: 'small', onClick: (e) => handleCSVDownload(startData.current, true), sx: { backgroundColor: '#22C55E', marginRight: { xs: 2, md: 0 }, width: { xs: '100%', md: 'fit-content' } } }, "Baixar Tabela")))))),
|
|
476
476
|
react_1.default.createElement(material_1.Stack, { direction: 'row', justifyContent: 'center', paddingY: 1, paddingTop: 2 },
|
|
477
477
|
react_1.default.createElement(material_1.Stack, { direction: 'row', justifyContent: 'center', alignItems: 'center', spacing: 2 },
|
|
478
478
|
react_1.default.createElement(material_1.Button, { onClick: (e) => setListPage((s) => {
|
|
@@ -305,7 +305,7 @@ function downloadCSVFile(list, config, filters) {
|
|
|
305
305
|
const obj = {};
|
|
306
306
|
config.map.forEach(m => {
|
|
307
307
|
// opção de usar o valor do filtro no próprio campo
|
|
308
|
-
if (m.useFilterValue) {
|
|
308
|
+
if (m.useFilterValue && !config.downloadAll) {
|
|
309
309
|
const filterValueList = filters.filter(f => f.label == m.useFilterValue.label && m.useFilterValue.operators.includes(f.operator));
|
|
310
310
|
const filterValue = filterValueList.length > 0 ? (filterValueList.reduce(r => r.value).value || undefined) : undefined;
|
|
311
311
|
obj[m.name] = filterValue || (0, lodash_get_1.default)(x, m.key);
|