@ssplib/react-components 0.0.50 → 0.0.51
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.
|
@@ -3,9 +3,12 @@ interface ColumnData {
|
|
|
3
3
|
title: string;
|
|
4
4
|
keyName: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, isPublic, filters, statusKeyName, csvExcludeKeys, }: {
|
|
6
|
+
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, isPublic, filters, statusKeyName, csvExcludeKeys, csvCustomKeyNames, }: {
|
|
7
7
|
columns: ColumnData[];
|
|
8
8
|
tableName: string;
|
|
9
|
+
csvCustomKeyNames?: {
|
|
10
|
+
[key: string]: string;
|
|
11
|
+
};
|
|
9
12
|
csvExcludeKeys?: string[];
|
|
10
13
|
statusKeyName?: string;
|
|
11
14
|
action: (prop: any) => JSX.Element;
|
|
@@ -40,7 +40,7 @@ const auth_1 = require("../../../context/auth");
|
|
|
40
40
|
function Table({ columns, fetchFunc, emptyMsg = {
|
|
41
41
|
user: 'Nenhum dado encontrado',
|
|
42
42
|
public: 'Nenhum dado encontrado',
|
|
43
|
-
}, dataPath = '', tableName, csv, columnSize, action, isPublic = false, filters, statusKeyName = '', csvExcludeKeys = [], }) {
|
|
43
|
+
}, dataPath = '', tableName, csv, columnSize, action, isPublic = false, filters, statusKeyName = '', csvExcludeKeys = [], csvCustomKeyNames = {}, }) {
|
|
44
44
|
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
45
45
|
const [error, setError] = (0, react_1.useState)(null);
|
|
46
46
|
const [data, setData] = (0, react_1.useState)(null);
|
|
@@ -168,7 +168,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
168
168
|
if (list.length <= 0)
|
|
169
169
|
return;
|
|
170
170
|
const keys = Object.keys(list[0]).filter((k) => !csvExcludeKeys.includes(k));
|
|
171
|
-
const header = keys.join(',') + '\n';
|
|
171
|
+
const header = keys.map((k) => (csvCustomKeyNames[k] ? csvCustomKeyNames[k] : k)).join(',') + '\n';
|
|
172
172
|
const values = list
|
|
173
173
|
.map((x) => {
|
|
174
174
|
return keys
|