@aehrc/smart-forms-renderer 0.15.0 → 0.15.2
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.
|
@@ -16,27 +16,19 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import React, { memo, useCallback } from 'react';
|
|
18
18
|
import { Box, IconButton, Stack, Tooltip } from '@mui/material';
|
|
19
|
-
import { useSnackbar } from 'notistack';
|
|
20
19
|
import AttachmentFileDropBox from './AttachmentFileDropBox';
|
|
21
20
|
import Iconify from '../../Iconify/Iconify';
|
|
22
21
|
const AttachmentFileCollector = memo(function AttachmentFileCollector(props) {
|
|
23
22
|
const { uploadedFile, isTabled, onUploadFile } = props;
|
|
24
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
25
23
|
const handleFileDrop = useCallback((item) => {
|
|
26
24
|
if (item) {
|
|
27
25
|
const files = item.files;
|
|
28
|
-
if (files.length > 1) {
|
|
29
|
-
enqueueSnackbar('Only one file allowed', {
|
|
30
|
-
variant: 'warning',
|
|
31
|
-
preventDuplicate: true
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
26
|
if (files[0] instanceof File) {
|
|
35
27
|
const file = files[0];
|
|
36
28
|
onUploadFile(file);
|
|
37
29
|
}
|
|
38
30
|
}
|
|
39
|
-
}, [onUploadFile
|
|
31
|
+
}, [onUploadFile]);
|
|
40
32
|
function handleAttachFile(event) {
|
|
41
33
|
var _a;
|
|
42
34
|
const file = (_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentFileCollector.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/AttachmentItem/AttachmentFileCollector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,
|
|
1
|
+
{"version":3,"file":"AttachmentFileCollector.js","sourceRoot":"","sources":["../../../../src/components/FormComponents/AttachmentItem/AttachmentFileCollector.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAQ5C,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,uBAAuB,CACnE,KAAmC;IAEnC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAEvD,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,IAAsB,EAAE,EAAE;QACzB,IAAI,IAAI,EAAE;YACR,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAEzB,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE;gBAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBAEtB,YAAY,CAAC,IAAI,CAAC,CAAC;aACpB;SACF;IACH,CAAC,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,SAAS,gBAAgB,CAAC,KAAoC;;QAC5D,MAAM,IAAI,GAAG,MAAA,KAAK,CAAC,MAAM,CAAC,KAAK,0CAAG,CAAC,CAAC,CAAC;QAErC,IAAI,IAAI,YAAY,IAAI,EAAE;YACxB,YAAY,CAAC,IAAI,CAAC,CAAC;SACpB;IACH,CAAC;IAED,OAAO,CACL;QACE,oBAAC,qBAAqB,IACpB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,EAAE,EAChB,QAAQ,EAAE,QAAQ,GAClB;QACF,oBAAC,KAAK,IAAC,SAAS,EAAC,KAAK,EAAC,cAAc,EAAC,eAAe,EAAC,EAAE,EAAE,GAAG;YAC3D,oBAAC,GAAG;gBACF,oBAAC,OAAO,IAAC,KAAK,EAAC,aAAa;oBAC1B,oBAAC,UAAU,IAAC,SAAS,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO;wBACxC,oBAAC,OAAO,IAAC,IAAI,EAAC,0BAA0B,GAAG;wBAC3C,+BAAO,IAAI,EAAC,MAAM,EAAC,MAAM,QAAC,QAAQ,EAAE,gBAAgB,GAAI,CAC7C,CACL;gBACV,oBAAC,OAAO,IAAC,KAAK,EAAC,aAAa;oBAC1B;wBACE,oBAAC,UAAU,IACT,QAAQ,EAAE,CAAC,YAAY,EACvB,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;4BACjC,oBAAC,OAAO,IAAC,IAAI,EAAC,mBAAmB,GAAG,CACzB,CACR,CACC,CACN,CACA,CACP,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
import type { ChangeEvent } from 'react';
|
|
19
19
|
import React, { memo, useCallback } from 'react';
|
|
20
20
|
import { Box, IconButton, Stack, Tooltip } from '@mui/material';
|
|
21
|
-
import { useSnackbar } from 'notistack';
|
|
22
21
|
import AttachmentFileDropBox from './AttachmentFileDropBox';
|
|
23
22
|
import Iconify from '../../Iconify/Iconify';
|
|
24
23
|
import type { PropsWithIsTabledAttribute } from '../../../interfaces/renderProps.interface';
|
|
@@ -33,20 +32,11 @@ const AttachmentFileCollector = memo(function AttachmentFileCollector(
|
|
|
33
32
|
) {
|
|
34
33
|
const { uploadedFile, isTabled, onUploadFile } = props;
|
|
35
34
|
|
|
36
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
37
|
-
|
|
38
35
|
const handleFileDrop = useCallback(
|
|
39
36
|
(item: { files: any[] }) => {
|
|
40
37
|
if (item) {
|
|
41
38
|
const files = item.files;
|
|
42
39
|
|
|
43
|
-
if (files.length > 1) {
|
|
44
|
-
enqueueSnackbar('Only one file allowed', {
|
|
45
|
-
variant: 'warning',
|
|
46
|
-
preventDuplicate: true
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
40
|
if (files[0] instanceof File) {
|
|
51
41
|
const file = files[0];
|
|
52
42
|
|
|
@@ -54,7 +44,7 @@ const AttachmentFileCollector = memo(function AttachmentFileCollector(
|
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
},
|
|
57
|
-
[onUploadFile
|
|
47
|
+
[onUploadFile]
|
|
58
48
|
);
|
|
59
49
|
|
|
60
50
|
function handleAttachFile(event: ChangeEvent<HTMLInputElement>) {
|