@ssplib/react-components 0.0.70 → 0.0.72
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.
|
@@ -90,13 +90,12 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
90
90
|
}, [files, context]);
|
|
91
91
|
const deleteFile = (0, react_1.useCallback)((e, id) => {
|
|
92
92
|
if (clientDelete) {
|
|
93
|
-
console.log('aa');
|
|
94
93
|
setFiles(files.filter((x) => x.id !== id));
|
|
95
94
|
context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== id));
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
97
|
if (Object.keys(fileIds).includes(id.toString())) {
|
|
99
|
-
fetch(`${apiURL}
|
|
98
|
+
fetch(`${apiURL}/${fileIds[id]}`, {
|
|
100
99
|
method: 'DELETE',
|
|
101
100
|
headers: {
|
|
102
101
|
Authorization: `Bearer ${user === null || user === void 0 ? void 0 : user.token}`,
|
|
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
const material_1 = require("@mui/material");
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const react_imask_1 = require("react-imask");
|
|
40
|
+
const form_1 = require("../../../context/form");
|
|
40
41
|
const TextMaskCustom = react_1.default.forwardRef(function TextMaskCustom(props, ref) {
|
|
41
42
|
const { onChange, maskProps, onMask, maskValue, setMaskValue } = props, prop = __rest(props, ["onChange", "maskProps", "onMask", "maskValue", "setMaskValue"]);
|
|
42
43
|
const [mask, setMask] = (0, react_1.useState)(maskProps.mask);
|
|
@@ -49,12 +50,17 @@ const TextMaskCustom = react_1.default.forwardRef(function TextMaskCustom(props,
|
|
|
49
50
|
} })));
|
|
50
51
|
});
|
|
51
52
|
function MaskInput(props) {
|
|
53
|
+
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
52
54
|
const [inputValue, setInputValue] = react_1.default.useState('');
|
|
53
55
|
const [maskValue, setMaskValue] = (0, react_1.useState)('');
|
|
54
56
|
const onChangeInput = (0, react_1.useCallback)((e) => {
|
|
55
57
|
setInputValue(e.target.value);
|
|
56
58
|
}, []);
|
|
57
|
-
return (react_1.default.createElement(material_1.TextField, Object.assign({}, props.formConfig, {
|
|
59
|
+
return (react_1.default.createElement(material_1.TextField, Object.assign({}, props.formConfig, { value: inputValue, onInput: (e) => {
|
|
60
|
+
const name = props.formConfig.name;
|
|
61
|
+
const value = e.target.value;
|
|
62
|
+
context.formSetValue(name, value);
|
|
63
|
+
}, onFocus: (e) => setMaskValue(e.target.value), onChange: onChangeInput, InputProps: {
|
|
58
64
|
inputComponent: TextMaskCustom,
|
|
59
65
|
inputProps: { maskProps: props.maskProps, onMask: props.onMask, maskValue, setMaskValue },
|
|
60
66
|
}, disabled: props.disabled, fullWidth: true })));
|
|
@@ -42,6 +42,6 @@ function FormProvider({ children, onSubmit, formMethod = 'GET', submiting = fals
|
|
|
42
42
|
errors: errors,
|
|
43
43
|
submiting: submiting,
|
|
44
44
|
} },
|
|
45
|
-
react_1.default.createElement("form", { method: formMethod, onSubmit: handleSubmit((d) => onSubmit(d, filesUid))
|
|
45
|
+
react_1.default.createElement("form", { method: formMethod, onSubmit: handleSubmit((d) => onSubmit(d, filesUid)) }, children)));
|
|
46
46
|
}
|
|
47
47
|
exports.default = FormProvider;
|