@apexcura/ui-components 0.0.13-Beta74 → 0.0.13-Beta75
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/index.js +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -909,15 +909,14 @@ var import_icons6 = require("@ant-design/icons");
|
|
|
909
909
|
var FileUpload = (props) => {
|
|
910
910
|
const [files, setFiles] = (0, import_react27.useState)([]);
|
|
911
911
|
const beforeUpload = (file) => {
|
|
912
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "
|
|
912
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
913
913
|
if (!isCorrectFile) {
|
|
914
|
-
import_antd20.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg)`);
|
|
914
|
+
import_antd20.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
915
915
|
return import_antd20.Upload.LIST_IGNORE;
|
|
916
916
|
}
|
|
917
917
|
return true;
|
|
918
918
|
};
|
|
919
919
|
const handleChange = ({ fileList }) => {
|
|
920
|
-
console.log(fileList);
|
|
921
920
|
setFiles(fileList);
|
|
922
921
|
if (props.onChange) {
|
|
923
922
|
props.onChange({
|
|
@@ -926,9 +925,15 @@ var FileUpload = (props) => {
|
|
|
926
925
|
});
|
|
927
926
|
}
|
|
928
927
|
};
|
|
928
|
+
const customRequest = ({ file, onSuccess }) => {
|
|
929
|
+
setTimeout(() => {
|
|
930
|
+
onSuccess("ok");
|
|
931
|
+
}, 0);
|
|
932
|
+
};
|
|
929
933
|
return /* @__PURE__ */ import_react27.default.createElement("div", null, /* @__PURE__ */ import_react27.default.createElement(
|
|
930
934
|
import_antd20.Upload,
|
|
931
935
|
{
|
|
936
|
+
action: "",
|
|
932
937
|
accept: props.accept,
|
|
933
938
|
listType: "picture",
|
|
934
939
|
maxCount: props.max_count,
|
|
@@ -936,7 +941,8 @@ var FileUpload = (props) => {
|
|
|
936
941
|
fileList: files,
|
|
937
942
|
beforeUpload,
|
|
938
943
|
onChange: handleChange,
|
|
939
|
-
showUploadList: true
|
|
944
|
+
showUploadList: true,
|
|
945
|
+
customRequest
|
|
940
946
|
},
|
|
941
947
|
/* @__PURE__ */ import_react27.default.createElement(import_antd20.Button, { icon: /* @__PURE__ */ import_react27.default.createElement(import_icons6.UploadOutlined, null) }, "Click to Upload")
|
|
942
948
|
));
|
package/dist/index.mjs
CHANGED
|
@@ -852,15 +852,14 @@ import { UploadOutlined } from "@ant-design/icons";
|
|
|
852
852
|
var FileUpload = (props) => {
|
|
853
853
|
const [files, setFiles] = useState9([]);
|
|
854
854
|
const beforeUpload = (file) => {
|
|
855
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "
|
|
855
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
856
856
|
if (!isCorrectFile) {
|
|
857
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg)`);
|
|
857
|
+
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
858
858
|
return Upload2.LIST_IGNORE;
|
|
859
859
|
}
|
|
860
860
|
return true;
|
|
861
861
|
};
|
|
862
862
|
const handleChange = ({ fileList }) => {
|
|
863
|
-
console.log(fileList);
|
|
864
863
|
setFiles(fileList);
|
|
865
864
|
if (props.onChange) {
|
|
866
865
|
props.onChange({
|
|
@@ -869,9 +868,15 @@ var FileUpload = (props) => {
|
|
|
869
868
|
});
|
|
870
869
|
}
|
|
871
870
|
};
|
|
871
|
+
const customRequest = ({ file, onSuccess }) => {
|
|
872
|
+
setTimeout(() => {
|
|
873
|
+
onSuccess("ok");
|
|
874
|
+
}, 0);
|
|
875
|
+
};
|
|
872
876
|
return /* @__PURE__ */ React27.createElement("div", null, /* @__PURE__ */ React27.createElement(
|
|
873
877
|
Upload2,
|
|
874
878
|
{
|
|
879
|
+
action: "",
|
|
875
880
|
accept: props.accept,
|
|
876
881
|
listType: "picture",
|
|
877
882
|
maxCount: props.max_count,
|
|
@@ -879,7 +884,8 @@ var FileUpload = (props) => {
|
|
|
879
884
|
fileList: files,
|
|
880
885
|
beforeUpload,
|
|
881
886
|
onChange: handleChange,
|
|
882
|
-
showUploadList: true
|
|
887
|
+
showUploadList: true,
|
|
888
|
+
customRequest
|
|
883
889
|
},
|
|
884
890
|
/* @__PURE__ */ React27.createElement(Button3, { icon: /* @__PURE__ */ React27.createElement(UploadOutlined, null) }, "Click to Upload")
|
|
885
891
|
));
|