tycho-components 0.15.5 → 0.15.7
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.
|
@@ -9,6 +9,8 @@ export type AppDropzoneBodyProps = {
|
|
|
9
9
|
keepName?: boolean;
|
|
10
10
|
/** When false, the confirm button is hidden (e.g. when used inside modal with its own confirm) */
|
|
11
11
|
showConfirmButton?: boolean;
|
|
12
|
+
/** When true, image preview is not rendered and filename message is shown instead */
|
|
13
|
+
disablePreview?: boolean;
|
|
12
14
|
};
|
|
13
15
|
export type AppDropzoneBodyRef = {
|
|
14
16
|
upload: () => Promise<void>;
|
|
@@ -8,7 +8,7 @@ import { toastLoading } from '../configs/store/actions';
|
|
|
8
8
|
import { useMessageUtils } from '../configs/useMessageUtils';
|
|
9
9
|
import UploadService from './UploadService';
|
|
10
10
|
import './style.scss';
|
|
11
|
-
function AppDropzoneBodyInner({ folder, onSuccess, onError, accept, onDrop, keepName, showConfirmButton = true, }, ref) {
|
|
11
|
+
function AppDropzoneBodyInner({ folder, onSuccess, onError, accept, onDrop, keepName, showConfirmButton = true, disablePreview = false, }, ref) {
|
|
12
12
|
const { t } = useTranslation('upload');
|
|
13
13
|
const { state, dispatch } = useContext(CommonContext);
|
|
14
14
|
const { dispatchError } = useMessageUtils();
|
|
@@ -24,13 +24,13 @@ function AppDropzoneBodyInner({ folder, onSuccess, onError, accept, onDrop, keep
|
|
|
24
24
|
setPreview(undefined);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
if (isImageFile(file)) {
|
|
27
|
+
if (!disablePreview && isImageFile(file)) {
|
|
28
28
|
const url = URL.createObjectURL(file);
|
|
29
29
|
setPreview(url);
|
|
30
30
|
return () => URL.revokeObjectURL(url);
|
|
31
31
|
}
|
|
32
32
|
setPreview(undefined);
|
|
33
|
-
}, [file]);
|
|
33
|
+
}, [file, disablePreview]);
|
|
34
34
|
const upload = async () => {
|
|
35
35
|
const currentFile = fileRef.current;
|
|
36
36
|
if (!currentFile || state.toastLoading)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tycho-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.7",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-hook-form": "^7.45.2",
|
|
50
50
|
"react-i18next": "^13.0.2",
|
|
51
51
|
"react-router-dom": "^6.14.2",
|
|
52
|
-
"tycho-storybook": "0.6.
|
|
52
|
+
"tycho-storybook": "0.6.2",
|
|
53
53
|
"yup": "^1.2.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|