@ssplib/react-components 0.0.181 → 0.0.183
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.
- package/components/form/input/FetchAutoComplete.js +2 -0
- package/components/form/input/FixedAutoComplete.js +3 -1
- package/components/form/input/Input.js +4 -2
- package/components/form/input/MultInput.js +3 -1
- package/components/form/stepper/Stepper.js +5 -2
- package/components/form/table/Table.d.ts +2 -2
- package/components/form/table/Table.js +4 -3
- package/components/navbar/NavBar.js +1 -1
- package/package.json +1 -1
|
@@ -107,6 +107,8 @@ function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch
|
|
|
107
107
|
react_1.default.createElement(material_1.Autocomplete, { loading: loading, loadingText: loadingText, options: list, defaultValue: dValue, isOptionEqualToValue: (op, value) => op.id === value.id, onChange: (e, v) => handleAutoCompleteChange(v), renderInput: (params) => {
|
|
108
108
|
var _a;
|
|
109
109
|
return (react_1.default.createElement(material_1.TextField, Object.assign({}, params, { size: 'small', fullWidth: true, placeholder: title, onFocus: onFocus, error: (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name) ? true : false, helperText: (_a = (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name)) === null || _a === void 0 ? void 0 : _a.message })));
|
|
110
|
+
}, sx: {
|
|
111
|
+
bgcolor: 'white',
|
|
110
112
|
}, size: 'small', fullWidth: true })));
|
|
111
113
|
}
|
|
112
114
|
exports.default = FetchAutoComplete;
|
|
@@ -53,6 +53,8 @@ function FixedAutoComplete({ name, title, required = false, list, defaultValue,
|
|
|
53
53
|
react_1.default.createElement(material_1.Autocomplete, { options: list, defaultValue: defaultValue, isOptionEqualToValue: (op, value) => op.id === value.id, onChange: (e, v) => handleAutoCompleteChange(v), renderInput: (params) => {
|
|
54
54
|
var _a;
|
|
55
55
|
return (react_1.default.createElement(material_1.TextField, Object.assign({}, params, { size: 'small', fullWidth: true, placeholder: title, error: (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name) ? true : false, helperText: (_a = (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name)) === null || _a === void 0 ? void 0 : _a.message })));
|
|
56
|
-
}, size: 'small',
|
|
56
|
+
}, size: 'small', sx: {
|
|
57
|
+
bgcolor: 'white',
|
|
58
|
+
}, fullWidth: true })));
|
|
57
59
|
}
|
|
58
60
|
exports.FixedAutoComplete = FixedAutoComplete;
|
|
@@ -56,7 +56,7 @@ function Input(_a) {
|
|
|
56
56
|
const errorData = (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, props.name);
|
|
57
57
|
const helperText = errorData === null || errorData === void 0 ? void 0 : errorData.message;
|
|
58
58
|
const error = errorData ? true : false;
|
|
59
|
-
const formConfig = Object.assign(Object.assign(Object.assign({}, context === null || context === void 0 ? void 0 : context.formRegister(name, {
|
|
59
|
+
const formConfig = Object.assign(Object.assign(Object.assign(Object.assign({}, context === null || context === void 0 ? void 0 : context.formRegister(name, {
|
|
60
60
|
validate: (v, f) => {
|
|
61
61
|
if (v.length <= 0 && props.required)
|
|
62
62
|
return 'Este campo é obrigatório';
|
|
@@ -100,7 +100,9 @@ function Input(_a) {
|
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
})), { error,
|
|
103
|
-
helperText }), inputConfig)
|
|
103
|
+
helperText }), inputConfig), { sx: {
|
|
104
|
+
backgroundColor: 'white',
|
|
105
|
+
} });
|
|
104
106
|
switch (type) {
|
|
105
107
|
case 'input':
|
|
106
108
|
case 'email':
|
|
@@ -57,6 +57,8 @@ function MultInput(_a) {
|
|
|
57
57
|
if (v.length < inputMinLength && required)
|
|
58
58
|
return `Limite mínimo de ${inputMinLength} caracteres`;
|
|
59
59
|
},
|
|
60
|
-
}), { error: (0, lodash_get_1.default)(context.errors, name) ? true : false, helperText: (_b = (0, lodash_get_1.default)(context.errors, name)) === null || _b === void 0 ? void 0 : _b.message,
|
|
60
|
+
}), { error: (0, lodash_get_1.default)(context.errors, name) ? true : false, helperText: (_b = (0, lodash_get_1.default)(context.errors, name)) === null || _b === void 0 ? void 0 : _b.message, sx: {
|
|
61
|
+
bgcolor: 'white',
|
|
62
|
+
}, placeholder: customPlaceholder ? customPlaceholder : title }))));
|
|
61
63
|
}
|
|
62
64
|
exports.default = MultInput;
|
|
@@ -57,6 +57,7 @@ const form_1 = require("../../../context/form");
|
|
|
57
57
|
const StepperBlock_1 = require("./StepperBlock");
|
|
58
58
|
const Input_1 = require("../input/Input");
|
|
59
59
|
const FixedAutoComplete_1 = require("../input/FixedAutoComplete");
|
|
60
|
+
const MultInput_1 = __importDefault(require("../input/MultInput"));
|
|
60
61
|
const getKeys = (values, id) => {
|
|
61
62
|
if (!values || Object.keys(values).length <= 0)
|
|
62
63
|
return [];
|
|
@@ -84,8 +85,10 @@ function Teste() {
|
|
|
84
85
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
86
|
react_1.default.createElement(Stepper, null,
|
|
86
87
|
react_1.default.createElement(StepperBlock_1.StepperBlock, { title: 'Testando' },
|
|
87
|
-
react_1.default.createElement(
|
|
88
|
-
|
|
88
|
+
react_1.default.createElement(material_1.Box, { bgcolor: 'pink' },
|
|
89
|
+
react_1.default.createElement(Input_1.Input, { name: 'teste', type: 'input' }),
|
|
90
|
+
react_1.default.createElement(FixedAutoComplete_1.FixedAutoComplete, { name: 'haha', title: 'Testing', list: list, required: true }),
|
|
91
|
+
react_1.default.createElement(MultInput_1.default, { name: 'haha' }))))));
|
|
89
92
|
}
|
|
90
93
|
exports.Teste = Teste;
|
|
91
94
|
function Stepper(_a) {
|
|
@@ -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 },
|
|
@@ -96,7 +96,7 @@ function NavBar(_a) {
|
|
|
96
96
|
react_1.default.createElement(material_1.AppBar, { position: 'relative', elevation: 0, sx: { backgroundColor: '#F1F5F9', color: 'black', paddingY: 1, paddingX: { xs: 1, md: 4 } } },
|
|
97
97
|
react_1.default.createElement(material_1.Stack, { direction: 'row', justifyContent: 'space-between' },
|
|
98
98
|
react_1.default.createElement(material_1.Stack, { direction: 'row', alignItems: 'center', spacing: 2, marginRight: 2, sx: { display: { xs: 'none', md: 'flex' }, width: '100%' } },
|
|
99
|
-
react_1.default.createElement(link_1.default, { href: '/' }, next ? react_1.default.createElement(image_1.default, { src: img, alt:
|
|
99
|
+
react_1.default.createElement(link_1.default, { href: '/' }, next ? react_1.default.createElement(image_1.default, { src: img, alt: title, width: 40, height: 40 }) : react_1.default.createElement("img", { src: img, height: 35 })),
|
|
100
100
|
react_1.default.createElement(material_1.Box, null,
|
|
101
101
|
react_1.default.createElement(material_1.Typography, { variant: 'subtitle1', fontWeight: 600 }, title))),
|
|
102
102
|
react_1.default.createElement(material_1.Box, { sx: {
|