@ssplib/react-components 0.0.182 → 0.0.184
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,
|
|
8
|
+
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, useKC, statusKeyName, csvExcludeKeys, csvExcludeKeysCSV, csvExcludeKeysAll, csvCustomKeyNames, csvExcludeValidate, csvButtonTitle, csvNoZipText, csvAllButtonTitle, removeQuotes, normalize, csvShowAllButton, csvWithoutZip, itemCount, csvUpper, csvZipFileNamesKey, generateCsvZip, filters, hideTitleCSV, csvExcludeUpper, filterSeparator, filterStorageName, multipleDataPath, }: {
|
|
9
9
|
normalize?: boolean;
|
|
10
10
|
csvUpper?: boolean;
|
|
11
11
|
multipleDataPath?: string;
|
|
@@ -42,7 +42,7 @@ export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableNam
|
|
|
42
42
|
public: string;
|
|
43
43
|
};
|
|
44
44
|
dataPath?: string;
|
|
45
|
-
|
|
45
|
+
useKC?: boolean;
|
|
46
46
|
filters?: {
|
|
47
47
|
[key: string]: {
|
|
48
48
|
type: FilterTypes;
|
|
@@ -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,
|
|
49
|
+
}, dataPath = '', tableName = 'Dados', csv, columnSize, action, useKC = true, statusKeyName = '', csvExcludeKeys = [], csvExcludeKeysCSV = [], csvExcludeKeysAll = [], csvCustomKeyNames = {}, csvExcludeValidate = (key, value) => false, csvButtonTitle = 'Salvar .CSV', csvNoZipText = 'Salvar .CSV', csvAllButtonTitle = 'Salvar todos em CSV', removeQuotes = false, normalize = false, csvShowAllButton = false, csvWithoutZip = false, itemCount = 10, csvUpper = false, csvZipFileNamesKey = '', generateCsvZip = false, filters = {}, hideTitleCSV = false, csvExcludeUpper = [], filterSeparator = '|', filterStorageName = 'tableFilters', multipleDataPath = '', }) {
|
|
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);
|
|
@@ -64,7 +64,8 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
64
64
|
const theme = (0, material_1.useTheme)();
|
|
65
65
|
const isSmall = (0, material_1.useMediaQuery)(theme.breakpoints.only('xs'));
|
|
66
66
|
(0, react_1.useEffect)(() => {
|
|
67
|
-
|
|
67
|
+
setError(null);
|
|
68
|
+
if (userLoaded || !useKC)
|
|
68
69
|
fetchFunc()
|
|
69
70
|
.then((res) => {
|
|
70
71
|
if (!res.ok)
|
|
@@ -682,7 +683,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
682
683
|
"Carregando ",
|
|
683
684
|
tableName),
|
|
684
685
|
react_1.default.createElement(material_1.CircularProgress, null)));
|
|
685
|
-
if (!userLoaded &&
|
|
686
|
+
if (!userLoaded && useKC)
|
|
686
687
|
return react_1.default.createElement(material_1.LinearProgress, null);
|
|
687
688
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
688
689
|
react_1.default.createElement(material_1.Box, { marginX: isSmall ? 0 : 4 },
|
|
@@ -699,7 +700,7 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
699
700
|
react_1.default.createElement(material_1.Box, { sx: { width: 'max-content', paddingX: 1 } },
|
|
700
701
|
react_1.default.createElement(Typography_1.default, { fontSize: 16, fontWeight: 700, color: '#1E293B', fontFamily: 'Inter' }, c.title)),
|
|
701
702
|
react_1.default.createElement(material_1.Box, { paddingLeft: 1 },
|
|
702
|
-
react_1.default.createElement(
|
|
703
|
+
react_1.default.createElement(material_1.Box, { sx: { wordWrap: 'break-word', color: '#1E293B', fontSize: 16 }, fontFamily: 'Inter' }, c.keyName === statusKeyName ? getStatusMsg((0, lodash_get_1.default)(x, c.keyName)) : react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: (0, lodash_get_1.default)(x, c.keyName) } })))))),
|
|
703
704
|
react_1.default.createElement(Grid_1.default, { item: true, xs: 12, md: 12 / columnSize },
|
|
704
705
|
react_1.default.createElement(material_1.Stack, { direction: 'row', alignItems: 'center', justifyContent: isSmall ? 'start' : 'flex-end', sx: { height: '100%', paddingBottom: isSmall ? 2 : 0 } }, action(x)))))))),
|
|
705
706
|
react_1.default.createElement(material_1.Stack, { bgcolor: '#F8FAFC', direction: 'row', justifyContent: 'center', paddingY: 1, borderTop: 3, borderColor: '#b4bfcf' },
|