@ssplib/react-components 0.0.190 → 0.0.192
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/file/DropFileUpload.d.ts +2 -1
- package/components/form/file/DropFileUpload.js +2 -2
- package/components/form/file/FileUpload.d.ts +2 -1
- package/components/form/file/FileUpload.js +2 -2
- package/components/form/input/FetchAutoComplete.d.ts +2 -1
- package/components/form/input/FetchAutoComplete.js +5 -4
- package/components/form/stepper/Stepper.d.ts +0 -1
- package/components/form/stepper/Stepper.js +1 -40
- package/components/providers/SspComponentsProvider.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function DropFileUpload({ name, tipoArquivo, title, required, multiple, apiURL, sizeLimit, xs, sm, md, tstToken, }: {
|
|
2
|
+
export default function DropFileUpload({ name, tipoArquivo, title, required, multiple, apiURL, sizeLimit, xs, sm, md, route, tstToken, }: {
|
|
3
3
|
name: string;
|
|
4
4
|
tipoArquivo: string;
|
|
5
5
|
title: string;
|
|
6
6
|
apiURL: string;
|
|
7
|
+
route?: string;
|
|
7
8
|
tstToken?: string;
|
|
8
9
|
required?: boolean;
|
|
9
10
|
multiple?: boolean;
|
|
@@ -57,7 +57,7 @@ function LinearProgressWithLabel(props) {
|
|
|
57
57
|
react_1.default.createElement(material_1.Box, { sx: { minWidth: 3 } },
|
|
58
58
|
react_1.default.createElement(material_1.Typography, { variant: 'body2', color: 'text.secondary' }, `${Math.round(props.value)}%`))));
|
|
59
59
|
}
|
|
60
|
-
function DropFileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, sizeLimit = 4, xs = 12, sm, md, tstToken = '', }) {
|
|
60
|
+
function DropFileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, sizeLimit = 4, xs = 12, sm, md, route = '', tstToken = '', }) {
|
|
61
61
|
const { getRootProps, getInputProps } = (0, react_dropzone_1.useDropzone)({
|
|
62
62
|
multiple,
|
|
63
63
|
onDrop: (dropFiles) => {
|
|
@@ -93,7 +93,7 @@ function DropFileUpload({ name, tipoArquivo, title, required = false, multiple =
|
|
|
93
93
|
})
|
|
94
94
|
.then((res) => {
|
|
95
95
|
if (res.status > 200) {
|
|
96
|
-
const fileIdFromApi = res.data.data[0];
|
|
96
|
+
const fileIdFromApi = (0, lodash_get_1.default)(res.data, route, res.data)[0];
|
|
97
97
|
const fileId = fileIdFromApi['coSeqArquivo'];
|
|
98
98
|
context.setFilesUid((fId) => [
|
|
99
99
|
...fId,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, sizeLimit, xs, sm, md, }: {
|
|
2
|
+
export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, route, sizeLimit, xs, sm, md, }: {
|
|
3
3
|
name: string;
|
|
4
4
|
tipoArquivo: string;
|
|
5
5
|
title: string;
|
|
6
6
|
apiURL: string;
|
|
7
|
+
route?: string;
|
|
7
8
|
required?: boolean;
|
|
8
9
|
multiple?: boolean;
|
|
9
10
|
sizeLimit?: number;
|
|
@@ -41,7 +41,7 @@ function bytesToMegabytes(bytes) {
|
|
|
41
41
|
const megabytes = bytes / (1024 * 1024);
|
|
42
42
|
return megabytes;
|
|
43
43
|
}
|
|
44
|
-
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, sizeLimit = 4, xs = 12, sm, md, }) {
|
|
44
|
+
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, route = '', sizeLimit = 4, xs = 12, sm, md, }) {
|
|
45
45
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
46
46
|
const { user } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
47
47
|
const theme = (0, material_1.useTheme)();
|
|
@@ -87,7 +87,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
87
87
|
}
|
|
88
88
|
res.json().then((j) => {
|
|
89
89
|
if (j.status && j.status.status === 200) {
|
|
90
|
-
const fileIdFromApi = j
|
|
90
|
+
const fileIdFromApi = (0, lodash_get_1.default)(j, route, j)[0];
|
|
91
91
|
const fileId = fileIdFromApi['coSeqArquivo'];
|
|
92
92
|
context.setFilesUid((fId) => [
|
|
93
93
|
...fId,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch, required, defaultValue, onChange, xs, sm, md, }: {
|
|
2
|
+
export default function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch, required, defaultValue, route, onChange, xs, sm, md, }: {
|
|
3
3
|
name: string;
|
|
4
4
|
url: string;
|
|
5
5
|
title: string;
|
|
6
6
|
customLoadingText?: string;
|
|
7
7
|
defaultValue?: number;
|
|
8
8
|
required?: boolean;
|
|
9
|
+
route?: string;
|
|
9
10
|
onChange?: (id: number | undefined) => void;
|
|
10
11
|
shouldRefetch?: boolean;
|
|
11
12
|
xs?: number;
|
|
@@ -31,7 +31,7 @@ const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
32
|
const auth_1 = require("../../../context/auth");
|
|
33
33
|
const form_1 = require("../../../context/form");
|
|
34
|
-
function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch = true, required = false, defaultValue, onChange = () => { }, xs = 12, sm, md, }) {
|
|
34
|
+
function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch = true, required = false, defaultValue, route = '', onChange = () => { }, xs = 12, sm, md, }) {
|
|
35
35
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
36
36
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
37
37
|
const [list, setList] = (0, react_1.useState)([]);
|
|
@@ -47,10 +47,11 @@ function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch
|
|
|
47
47
|
},
|
|
48
48
|
}).then((res) => {
|
|
49
49
|
if (res.ok) {
|
|
50
|
+
console.log('llll');
|
|
50
51
|
res.json().then((j) => {
|
|
51
|
-
let value = j.
|
|
52
|
+
let value = (0, lodash_get_1.default)(j, route, j).filter((x) => x.id === defaultValue);
|
|
52
53
|
if (value.length > 0) {
|
|
53
|
-
setList(
|
|
54
|
+
setList((0, lodash_get_1.default)(j, route, j));
|
|
54
55
|
setLoading(false);
|
|
55
56
|
context === null || context === void 0 ? void 0 : context.formSetValue(name, defaultValue);
|
|
56
57
|
setDValue(value[0]);
|
|
@@ -80,7 +81,7 @@ function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch
|
|
|
80
81
|
}).then((res) => {
|
|
81
82
|
if (res.ok) {
|
|
82
83
|
res.json().then((j) => {
|
|
83
|
-
setList(
|
|
84
|
+
setList((0, lodash_get_1.default)(j, route, j));
|
|
84
85
|
setLoading(false);
|
|
85
86
|
});
|
|
86
87
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
|
-
export declare function Teste(): JSX.Element;
|
|
4
3
|
export declare function Stepper({ debugLog, test, testConfig, ...props }: {
|
|
5
4
|
children: ReactElement | ReactElement[];
|
|
6
5
|
debugData?: (data: FieldValues) => void;
|
|
@@ -46,7 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
46
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
47
|
};
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.Stepper =
|
|
49
|
+
exports.Stepper = void 0;
|
|
50
50
|
const KeyboardArrowLeft_1 = __importDefault(require("@mui/icons-material/KeyboardArrowLeft"));
|
|
51
51
|
const KeyboardArrowRight_1 = __importDefault(require("@mui/icons-material/KeyboardArrowRight"));
|
|
52
52
|
const Save_1 = __importDefault(require("@mui/icons-material/Save"));
|
|
@@ -55,7 +55,6 @@ const material_1 = require("@mui/material");
|
|
|
55
55
|
const react_1 = __importStar(require("react"));
|
|
56
56
|
const react_toastify_1 = require("react-toastify");
|
|
57
57
|
const form_1 = require("../../../context/form");
|
|
58
|
-
const Table_1 = __importDefault(require("../table/Table"));
|
|
59
58
|
const getKeys = (values, id) => {
|
|
60
59
|
if (!values || Object.keys(values).length <= 0)
|
|
61
60
|
return [];
|
|
@@ -69,44 +68,6 @@ const getKeys = (values, id) => {
|
|
|
69
68
|
function sleep(ms) {
|
|
70
69
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
70
|
}
|
|
72
|
-
function Teste() {
|
|
73
|
-
return (react_1.default.createElement(material_1.Box, { bgcolor: '#F9F9F9', py: 4 },
|
|
74
|
-
react_1.default.createElement(Table_1.default, { fetchFunc: () => fetch('http://localhost:7171/table'), useKC: false, tableName: 'Teste', columns: [
|
|
75
|
-
{
|
|
76
|
-
keyName: 'protocolo',
|
|
77
|
-
title: 'Procolo',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
keyName: 'titulo',
|
|
81
|
-
title: 'Titulo',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
keyName: 'local',
|
|
85
|
-
title: 'Local',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
keyName: 'data_abertura',
|
|
89
|
-
title: 'Data Abertura',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
keyName: 'movimentacao_ultimo_estado',
|
|
93
|
-
title: 'Movimentacao_ultimo_estado',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
keyName: 'estado',
|
|
97
|
-
title: 'Estado',
|
|
98
|
-
},
|
|
99
|
-
], action: () => react_1.default.createElement(react_1.default.Fragment, null), filters: {
|
|
100
|
-
protocolo: [
|
|
101
|
-
{
|
|
102
|
-
keyName: 'protocolo',
|
|
103
|
-
name: 'Protocolo',
|
|
104
|
-
type: 'a-z',
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
}, columnSize: 6 })));
|
|
108
|
-
}
|
|
109
|
-
exports.Teste = Teste;
|
|
110
71
|
function Stepper(_a) {
|
|
111
72
|
var { debugLog = false, test = false, testConfig = {} } = _a, props = __rest(_a, ["debugLog", "test", "testConfig"]);
|
|
112
73
|
const length = Array.isArray(props.children) ? props.children.length : 1;
|
|
@@ -7,7 +7,7 @@ exports.SspComponentsProvider = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_toastify_1 = require("react-toastify");
|
|
9
9
|
const Modal_1 = require("../modal/Modal");
|
|
10
|
-
// import '
|
|
10
|
+
// import '../../css/ReactToastify.css'
|
|
11
11
|
//components principal da aplicação
|
|
12
12
|
function SspComponentsProvider(props) {
|
|
13
13
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|