@apexcura/ui-components 0.0.13-Beta73 → 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 -5
- package/dist/index.mjs +10 -5
- 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,18 +925,24 @@ 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
|
{
|
|
932
936
|
action: "",
|
|
933
937
|
accept: props.accept,
|
|
934
|
-
listType:
|
|
938
|
+
listType: "picture",
|
|
935
939
|
maxCount: props.max_count,
|
|
936
940
|
multiple: true,
|
|
937
941
|
fileList: files,
|
|
938
942
|
beforeUpload,
|
|
939
943
|
onChange: handleChange,
|
|
940
|
-
showUploadList: true
|
|
944
|
+
showUploadList: true,
|
|
945
|
+
customRequest
|
|
941
946
|
},
|
|
942
947
|
/* @__PURE__ */ import_react27.default.createElement(import_antd20.Button, { icon: /* @__PURE__ */ import_react27.default.createElement(import_icons6.UploadOutlined, null) }, "Click to Upload")
|
|
943
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,18 +868,24 @@ 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
|
{
|
|
875
879
|
action: "",
|
|
876
880
|
accept: props.accept,
|
|
877
|
-
listType:
|
|
881
|
+
listType: "picture",
|
|
878
882
|
maxCount: props.max_count,
|
|
879
883
|
multiple: true,
|
|
880
884
|
fileList: files,
|
|
881
885
|
beforeUpload,
|
|
882
886
|
onChange: handleChange,
|
|
883
|
-
showUploadList: true
|
|
887
|
+
showUploadList: true,
|
|
888
|
+
customRequest
|
|
884
889
|
},
|
|
885
890
|
/* @__PURE__ */ React27.createElement(Button3, { icon: /* @__PURE__ */ React27.createElement(UploadOutlined, null) }, "Click to Upload")
|
|
886
891
|
));
|