@ssplib/react-components 0.0.14 → 0.0.15
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/date/TimePicker.d.ts +1 -1
- package/components/form/date/TimePicker.js +1 -13
- package/components/form/file/FileUpload.d.ts +1 -3
- package/components/form/file/FileUpload.js +3 -1
- package/components/form/input/AutoComplete.d.ts +1 -3
- package/components/form/input/AutoComplete.js +3 -13
- package/components/form/table/Table.d.ts +1 -3
- package/components/form/table/Table.js +3 -2
- package/components/navbar/NavBar.d.ts +1 -3
- package/components/navbar/NavBar.js +3 -2
- package/package.json +2 -8
|
@@ -22,17 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
27
|
};
|
|
@@ -44,8 +33,7 @@ const pt_br_1 = __importDefault(require("dayjs/locale/pt-br"));
|
|
|
44
33
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
45
34
|
const react_1 = __importStar(require("react"));
|
|
46
35
|
const form_1 = __importDefault(require("../../../context/form"));
|
|
47
|
-
function TimePicker(
|
|
48
|
-
var { name, required = false, title, xs = 12, sm, md } = _a, props = __rest(_a, ["name", "required", "title", "xs", "sm", "md"]);
|
|
36
|
+
function TimePicker({ name, required = false, title, xs = 12, sm, md }) {
|
|
49
37
|
const context = (0, react_1.useContext)(form_1.default);
|
|
50
38
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
51
39
|
const handleChange = (newValue) => {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export default function FileUpload({ name, tipoArquivo, title, required, multiple, user, apiURL, xs, sm, md, }: {
|
|
2
|
+
export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, xs, sm, md, }: {
|
|
4
3
|
name: string;
|
|
5
4
|
tipoArquivo: string;
|
|
6
5
|
title: string;
|
|
7
6
|
apiURL: string;
|
|
8
|
-
user?: User;
|
|
9
7
|
required?: boolean;
|
|
10
8
|
multiple?: boolean;
|
|
11
9
|
xs?: number;
|
|
@@ -36,9 +36,11 @@ const material_1 = require("@mui/material");
|
|
|
36
36
|
const system_1 = require("@mui/system");
|
|
37
37
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
+
const auth_1 = require("../../../context/auth");
|
|
39
40
|
const form_1 = __importDefault(require("../../../context/form"));
|
|
40
|
-
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false,
|
|
41
|
+
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, xs = 12, sm, md, }) {
|
|
41
42
|
const context = (0, react_1.useContext)(form_1.default);
|
|
43
|
+
const { user } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
42
44
|
const [files, setFiles] = (0, react_1.useState)([]);
|
|
43
45
|
const [filesLoaded, setFilesLoaded] = (0, react_1.useState)([]);
|
|
44
46
|
const [fileIds, setFilesIds] = (0, react_1.useState)({});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export default function AutoComplete({ name, required, title, customPlaceholder, user, url, xs, sm, md, ...props }: {
|
|
2
|
+
export default function AutoComplete({ name, required, title, customPlaceholder, url, xs, sm, md, }: {
|
|
4
3
|
url: string;
|
|
5
4
|
name: string;
|
|
6
|
-
user?: User;
|
|
7
5
|
title?: string;
|
|
8
6
|
customPlaceholder?: string;
|
|
9
7
|
required?: boolean;
|
|
@@ -22,17 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
27
|
};
|
|
@@ -42,10 +31,11 @@ const InputLabel_1 = __importDefault(require("@mui/material/InputLabel"));
|
|
|
42
31
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
43
32
|
const react_1 = __importStar(require("react"));
|
|
44
33
|
const react_query_1 = require("react-query");
|
|
34
|
+
const auth_1 = require("../../../context/auth");
|
|
45
35
|
const form_1 = __importDefault(require("../../../context/form"));
|
|
46
|
-
function AutoComplete(
|
|
47
|
-
var { name, required = false, title, customPlaceholder, user, url, xs = 12, sm, md } = _a, props = __rest(_a, ["name", "required", "title", "customPlaceholder", "user", "url", "xs", "sm", "md"]);
|
|
36
|
+
function AutoComplete({ name, required = false, title, customPlaceholder, url, xs = 12, sm, md, }) {
|
|
48
37
|
const context = (0, react_1.useContext)(form_1.default);
|
|
38
|
+
const { user } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
49
39
|
const [options, setOptions] = (0, react_1.useState)([]);
|
|
50
40
|
const { isLoading, data, error } = (0, react_query_1.useQuery)(`autocomplete-${name}`, () => fetch(url, {
|
|
51
41
|
headers: {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AuthData } from '../../../types/auth';
|
|
3
2
|
interface ColumnData {
|
|
4
3
|
title: string;
|
|
5
4
|
keyName: string;
|
|
6
5
|
}
|
|
7
|
-
export declare function Table({ columns,
|
|
6
|
+
export declare function Table({ columns, fetchFunc, emptyMsg, dataPath, tableName, csv, columnSize, action, }: {
|
|
8
7
|
columns: ColumnData[];
|
|
9
|
-
auth: AuthData;
|
|
10
8
|
tableName: string;
|
|
11
9
|
action: (prop: any) => JSX.Element;
|
|
12
10
|
csv?: {
|
|
@@ -37,14 +37,15 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
|
37
37
|
const Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
38
38
|
const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
39
39
|
const react_1 = __importStar(require("react"));
|
|
40
|
-
|
|
40
|
+
const auth_1 = require("../../../context/auth");
|
|
41
|
+
function Table({ columns, fetchFunc, emptyMsg = {
|
|
41
42
|
user: 'Nenhum dado encontrado',
|
|
42
43
|
public: 'Nenhum dado encontrado',
|
|
43
44
|
}, dataPath = '', tableName, csv, columnSize, action, }) {
|
|
44
45
|
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
45
46
|
const [error, setError] = (0, react_1.useState)(null);
|
|
46
47
|
const [data, setData] = (0, react_1.useState)(null);
|
|
47
|
-
const { user, userLoaded } =
|
|
48
|
+
const { user, userLoaded } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
48
49
|
(0, react_1.useEffect)(() => {
|
|
49
50
|
if (userLoaded)
|
|
50
51
|
fetchFunc().then((res) => res.json().then((j) => {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export default function NavBar({ auth, links, title, img, pos, next, el, }: {
|
|
2
|
+
export default function NavBar({ links, title, img, pos, next, el, }: {
|
|
4
3
|
links: {
|
|
5
4
|
name: string;
|
|
6
5
|
path: string;
|
|
7
6
|
}[];
|
|
8
7
|
title: string;
|
|
9
8
|
img: string;
|
|
10
|
-
auth: AuthData;
|
|
11
9
|
next?: boolean;
|
|
12
10
|
el?: JSX.Element;
|
|
13
11
|
pos?: 'fixed' | 'inherit';
|
|
@@ -36,11 +36,12 @@ const image_1 = __importDefault(require("next/image"));
|
|
|
36
36
|
const link_1 = __importDefault(require("next/link"));
|
|
37
37
|
const router_1 = require("next/router");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
-
|
|
39
|
+
const auth_1 = require("../../context/auth");
|
|
40
|
+
function NavBar({ links, title, img, pos = 'fixed', next = true, el, }) {
|
|
40
41
|
let router = undefined;
|
|
41
42
|
if (next)
|
|
42
43
|
router = (0, router_1.useRouter)();
|
|
43
|
-
const { user, login, logout, userLoaded } =
|
|
44
|
+
const { user, login, logout, userLoaded } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
44
45
|
const [anchor, setAnchor] = (0, react_1.useState)(null);
|
|
45
46
|
const [avatarAnchor, setAvatarAnchor] = (0, react_1.useState)(null);
|
|
46
47
|
const menuOpen = Boolean(anchor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssplib/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "SSP React Components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Pedro Henrique <sr.hudrick@gmail.com>",
|
|
@@ -45,13 +45,7 @@
|
|
|
45
45
|
"type": "git",
|
|
46
46
|
"url": "git+https://github.com/SSPDF/ssp-components.git"
|
|
47
47
|
},
|
|
48
|
-
"keywords": [
|
|
49
|
-
"front",
|
|
50
|
-
"react",
|
|
51
|
-
"components",
|
|
52
|
-
"ssp",
|
|
53
|
-
"df"
|
|
54
|
-
],
|
|
48
|
+
"keywords": ["front", "react", "components", "ssp", "df"],
|
|
55
49
|
"bugs": {
|
|
56
50
|
"url": "https://github.com/SSPDF/ssp-components/issues"
|
|
57
51
|
},
|