@arquimedes.co/eureka-forms 2.0.84 → 2.0.85
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/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +2 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +3 -3
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +4 -6
- package/package.json +1 -1
package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ interface FileComponentProps {
|
|
|
5
5
|
file: FileObject | UploadedFileObject;
|
|
6
6
|
formStyle: FormStyle;
|
|
7
7
|
error: boolean;
|
|
8
|
+
editable: boolean;
|
|
8
9
|
handleRemove: () => void;
|
|
9
10
|
/** Function to call on postview to fetch the download url of a file */
|
|
10
11
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
11
12
|
}
|
|
12
|
-
declare function FileUploadComponent({ file, formStyle, error, handleRemove, fetchDownloadUrl, }: FileComponentProps): JSX.Element;
|
|
13
|
+
declare function FileUploadComponent({ file, formStyle, error, editable, handleRemove, fetchDownloadUrl, }: FileComponentProps): JSX.Element;
|
|
13
14
|
export default FileUploadComponent;
|
|
@@ -56,7 +56,7 @@ import { useState } from 'react';
|
|
|
56
56
|
function FileUploadComponent(_a) {
|
|
57
57
|
var _this = this;
|
|
58
58
|
var _b, _c;
|
|
59
|
-
var file = _a.file, formStyle = _a.formStyle, error = _a.error, handleRemove = _a.handleRemove, fetchDownloadUrl = _a.fetchDownloadUrl;
|
|
59
|
+
var file = _a.file, formStyle = _a.formStyle, error = _a.error, editable = _a.editable, handleRemove = _a.handleRemove, fetchDownloadUrl = _a.fetchDownloadUrl;
|
|
60
60
|
var _d = useState(false), downloading = _d[0], setDownloading = _d[1];
|
|
61
61
|
if (!file) {
|
|
62
62
|
return _jsx("div", {});
|
|
@@ -124,8 +124,8 @@ function FileUploadComponent(_a) {
|
|
|
124
124
|
else if (fetchDownloadUrl !== undefined && file.S3Key) {
|
|
125
125
|
downloadFile();
|
|
126
126
|
}
|
|
127
|
-
} }, { children: (_c = (_b = file.file) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : file.fileName })), _jsx("div", __assign({ className: styles.deletBtn, onClick: function () {
|
|
127
|
+
} }, { children: (_c = (_b = file.file) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : file.fileName })), editable && (_jsx("div", __assign({ className: styles.deletBtn, onClick: function () {
|
|
128
128
|
handleRemove();
|
|
129
|
-
} }, { children:
|
|
129
|
+
} }, { children: _jsx(ClearRoundedIcon, { fontSize: "inherit" }) })))] })));
|
|
130
130
|
}
|
|
131
131
|
export default FileUploadComponent;
|
|
@@ -247,18 +247,16 @@ function FileUploadStep(_a) {
|
|
|
247
247
|
}
|
|
248
248
|
} })] })), _jsx("div", __assign({ className: styles.filesContainer }, { children: value.map(function (file, index) { return (_jsx(FileComponent, { formStyle: formStyle, file: file, error: (!!fieldError &&
|
|
249
249
|
file.state !== 'DONE') ||
|
|
250
|
-
file.state === 'ERROR', handleRemove: function () {
|
|
250
|
+
file.state === 'ERROR', editable: editable && !postview, handleRemove: function () {
|
|
251
251
|
if (value.filter(function (val) {
|
|
252
252
|
return val.state === 'ERROR';
|
|
253
253
|
}).length === 1) {
|
|
254
254
|
clearErrors(step.id);
|
|
255
255
|
setError(undefined);
|
|
256
256
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
]);
|
|
261
|
-
}
|
|
257
|
+
setFileChange([
|
|
258
|
+
__assign(__assign({}, file), { state: 'CANCEL' }),
|
|
259
|
+
]);
|
|
262
260
|
}, fetchDownloadUrl: fetchDownloadUrl }, index)); }) })), _jsx("div", __assign({ className: styles.errorMsg, style: { color: formStyle.errorColor } }, { children: error !== null && error !== void 0 ? error : calcErrorMsg() }))] })));
|
|
263
261
|
}
|
|
264
262
|
export default FileUploadStep;
|