@ssplib/react-components 0.0.87 → 0.0.88

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.
@@ -1,8 +1,7 @@
1
1
  /// <reference types="react" />
2
- export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, xs, sm, md, clientDelete, }: {
2
+ export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, xs, sm, md, }: {
3
3
  name: string;
4
4
  tipoArquivo: string;
5
- clientDelete?: boolean;
6
5
  title: string;
7
6
  apiURL: string;
8
7
  required?: boolean;
@@ -38,7 +38,7 @@ const lodash_get_1 = __importDefault(require("lodash.get"));
38
38
  const react_1 = __importStar(require("react"));
39
39
  const auth_1 = require("../../../context/auth");
40
40
  const form_1 = require("../../../context/form");
41
- function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, xs = 12, sm, md, clientDelete = false, }) {
41
+ function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, xs = 12, sm, md, }) {
42
42
  const context = (0, react_1.useContext)(form_1.FormContext);
43
43
  const { user } = (0, react_1.useContext)(auth_1.AuthContext);
44
44
  const [files, setFiles] = (0, react_1.useState)([]);
@@ -88,8 +88,8 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
88
88
  }),
89
89
  ]);
90
90
  }, [files, context]);
91
- const deleteFile = (0, react_1.useCallback)((e, id) => {
92
- if (clientDelete) {
91
+ const deleteFile = (e, id) => {
92
+ if (filesError.includes(id)) {
93
93
  setFiles(files.filter((x) => x.id !== id));
94
94
  context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== id));
95
95
  return;
@@ -107,7 +107,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
107
107
  }
108
108
  });
109
109
  }
110
- }, [files, fileIds, user === null || user === void 0 ? void 0 : user.token]);
110
+ };
111
111
  (0, react_1.useEffect)(() => {
112
112
  const dt = new DataTransfer();
113
113
  files.forEach((x) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",