@ssplib/react-components 0.0.130 → 0.0.132
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.
|
@@ -5,7 +5,7 @@ interface ColumnData {
|
|
|
5
5
|
size?: number;
|
|
6
6
|
}
|
|
7
7
|
type FilterTypes = 'a-z' | 'z-a' | 'items' | 'date-interval' | 'data-a-z' | 'data-z-a';
|
|
8
|
-
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, isPublic, statusKeyName, csvExcludeKeys, csvCustomKeyNames, csvExcludeValidate, csvButtonTitle, csvAllButtonTitle, removeQuotes, normalize, csvShowAllButton, itemCount, csvUpper, csvZipFileNamesKey, generateCsvZip, filters, filterSeparator, }: {
|
|
8
|
+
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, isPublic, statusKeyName, csvExcludeKeys, csvExcludeKeysAll, csvCustomKeyNames, csvExcludeValidate, csvButtonTitle, csvAllButtonTitle, removeQuotes, normalize, csvShowAllButton, itemCount, csvUpper, csvZipFileNamesKey, generateCsvZip, filters, filterSeparator, }: {
|
|
9
9
|
normalize?: boolean;
|
|
10
10
|
csvUpper?: boolean;
|
|
11
11
|
removeQuotes?: boolean;
|
|
@@ -21,6 +21,7 @@ export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableNam
|
|
|
21
21
|
[key: string]: string;
|
|
22
22
|
};
|
|
23
23
|
csvExcludeKeys?: string[];
|
|
24
|
+
csvExcludeKeysAll?: string[];
|
|
24
25
|
statusKeyName?: string;
|
|
25
26
|
itemCount?: number;
|
|
26
27
|
action: (prop: any) => JSX.Element;
|
|
@@ -46,7 +46,7 @@ let startData = [];
|
|
|
46
46
|
function Table({ columns, fetchFunc, emptyMsg = {
|
|
47
47
|
user: 'Nenhum dado encontrado',
|
|
48
48
|
public: 'Nenhum dado encontrado',
|
|
49
|
-
}, dataPath = '', tableName = 'Dados', csv, columnSize, action, isPublic = false, statusKeyName = '', csvExcludeKeys = [], csvCustomKeyNames = {}, csvExcludeValidate = (key, value) => false, csvButtonTitle = 'Salvar .CSV', csvAllButtonTitle = 'Salvar todos em CSV', removeQuotes = false, normalize = false, csvShowAllButton = false, itemCount = 10, csvUpper = false, csvZipFileNamesKey = '', generateCsvZip = false, filters = {}, filterSeparator = '|', }) {
|
|
49
|
+
}, dataPath = '', tableName = 'Dados', csv, columnSize, action, isPublic = false, statusKeyName = '', csvExcludeKeys = [], csvExcludeKeysAll = [], csvCustomKeyNames = {}, csvExcludeValidate = (key, value) => false, csvButtonTitle = 'Salvar .CSV', csvAllButtonTitle = 'Salvar todos em CSV', removeQuotes = false, normalize = false, csvShowAllButton = false, itemCount = 10, csvUpper = false, csvZipFileNamesKey = '', generateCsvZip = false, filters = {}, filterSeparator = '|', }) {
|
|
50
50
|
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
51
51
|
const [error, setError] = (0, react_1.useState)(null);
|
|
52
52
|
const [data, setData] = (0, react_1.useState)(null);
|
|
@@ -242,7 +242,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
242
242
|
});
|
|
243
243
|
const csvData = '\uFEFF' + header + values.join('\n');
|
|
244
244
|
if (values.length > 0)
|
|
245
|
-
zip.file(`${objKey}.csv`, csvData);
|
|
245
|
+
zip.file(`${objKey.normalize('NFD').replace(/[\u0300-\u036f]/g, '')}.csv`, csvData);
|
|
246
246
|
});
|
|
247
247
|
// // download
|
|
248
248
|
var link = window.document.createElement('a');
|
|
@@ -292,7 +292,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
292
292
|
e.preventDefault();
|
|
293
293
|
if (list.length <= 0)
|
|
294
294
|
return;
|
|
295
|
-
const keys = Object.keys(list[0]);
|
|
295
|
+
const keys = Object.keys(list[0]).filter((k) => !csvExcludeKeysAll.includes(k));
|
|
296
296
|
const header = keys.join(',') + '\n';
|
|
297
297
|
const values = list
|
|
298
298
|
.map((x) => {
|