@apexcura/ui-components 0.0.13-Beta49 → 0.0.13-Beta50
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 +31 -10
- package/dist/index.mjs +31 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -792,12 +792,14 @@ var UploadElement = (props) => {
|
|
|
792
792
|
const [previewType, setPreviewType] = (0, import_react23.useState)(null);
|
|
793
793
|
const [previewImage, setPreviewImage] = (0, import_react23.useState)(null);
|
|
794
794
|
const uploadChange = (fileList) => {
|
|
795
|
-
console.log(fileList);
|
|
795
|
+
console.log(typeof fileList);
|
|
796
796
|
if (!fileList || fileList.length === 0) return;
|
|
797
|
-
const
|
|
798
|
-
|
|
797
|
+
const selectedFile = fileList[0];
|
|
798
|
+
console.log("selectedFile", selectedFile);
|
|
799
799
|
if (!selectedFile) return;
|
|
800
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
|
|
800
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
|
|
801
|
+
selectedFile.type
|
|
802
|
+
);
|
|
801
803
|
if (!isCorrectFile) {
|
|
802
804
|
import_antd17.Modal.error({
|
|
803
805
|
title: `(${selectedFile.name}) is an invalid file.`,
|
|
@@ -840,8 +842,12 @@ var UploadElement = (props) => {
|
|
|
840
842
|
if (!file.url && !file.preview) {
|
|
841
843
|
file.preview = await URL.createObjectURL(file.originFileObj);
|
|
842
844
|
}
|
|
843
|
-
setPreviewType(
|
|
844
|
-
|
|
845
|
+
setPreviewType(
|
|
846
|
+
file.type || file.name.substring(file.name.lastIndexOf(".") + 1)
|
|
847
|
+
);
|
|
848
|
+
setPreviewTitle(
|
|
849
|
+
file.name || (file.url || "").substring((file.url || "").lastIndexOf("/") + 1)
|
|
850
|
+
);
|
|
845
851
|
setPreviewOpen(true);
|
|
846
852
|
};
|
|
847
853
|
const handleCancel = () => {
|
|
@@ -871,8 +877,10 @@ var UploadElement = (props) => {
|
|
|
871
877
|
showUploadList: true
|
|
872
878
|
},
|
|
873
879
|
props.list_type === "picture-card" && /* @__PURE__ */ import_react23.default.createElement("div", null, /* @__PURE__ */ import_react23.default.createElement(import_icons5.PlusOutlined, null), /* @__PURE__ */ import_react23.default.createElement("div", { style: { marginTop: 8 } }, "Upload ", /* @__PURE__ */ import_react23.default.createElement("small", { className: "d-flex" }, "(Max:", props.max_count, ")"))),
|
|
874
|
-
props.list_type === "picture" && /* @__PURE__ */ import_react23.default.createElement(import_antd17.Button, { icon: /* @__PURE__ */ import_react23.default.createElement(import_icons5.UploadOutlined, null) }, props.max_count ? `Upload (Max:${props.max_count})` : "Upload")
|
|
875
|
-
), props.errors && props.errors.length > 0 && props.errors.map(
|
|
880
|
+
props.list_type === "picture" && /* @__PURE__ */ import_react23.default.createElement(import_antd17.Button, { icon: /* @__PURE__ */ import_react23.default.createElement(import_icons5.UploadOutlined, null) }, props.feildData.max_count ? `Upload (Max:${props.max_count})` : "Upload")
|
|
881
|
+
), props.errors && props.errors.length > 0 && props.errors.map(
|
|
882
|
+
(error, eKey) => /* @__PURE__ */ import_react23.default.createElement("small", { key: eKey, className: "text-danger animated flash" }, error.message)
|
|
883
|
+
), /* @__PURE__ */ import_react23.default.createElement(
|
|
876
884
|
import_antd17.Modal,
|
|
877
885
|
{
|
|
878
886
|
open: previewOpen,
|
|
@@ -885,7 +893,13 @@ var UploadElement = (props) => {
|
|
|
885
893
|
onCancel: handleCancel,
|
|
886
894
|
destroyOnClose: true
|
|
887
895
|
},
|
|
888
|
-
/* @__PURE__ */ import_react23.default.createElement(import_antd17.Tooltip, { title: "Close", placement: "bottom" }, /* @__PURE__ */ import_react23.default.createElement(
|
|
896
|
+
/* @__PURE__ */ import_react23.default.createElement(import_antd17.Tooltip, { title: "Close", placement: "bottom" }, /* @__PURE__ */ import_react23.default.createElement(
|
|
897
|
+
import_icons5.CloseOutlined,
|
|
898
|
+
{
|
|
899
|
+
className: "border popup-close",
|
|
900
|
+
onClick: handleCancel
|
|
901
|
+
}
|
|
902
|
+
)),
|
|
889
903
|
previewType === "application/pdf" || previewType === "pdf" ? /* @__PURE__ */ import_react23.default.createElement(
|
|
890
904
|
"iframe",
|
|
891
905
|
{
|
|
@@ -893,7 +907,14 @@ var UploadElement = (props) => {
|
|
|
893
907
|
style: { width: "95vw", height: "40vw" },
|
|
894
908
|
src: `${previewImage}#toolbar=0`
|
|
895
909
|
}
|
|
896
|
-
) : /* @__PURE__ */ import_react23.default.createElement(
|
|
910
|
+
) : /* @__PURE__ */ import_react23.default.createElement(
|
|
911
|
+
"img",
|
|
912
|
+
{
|
|
913
|
+
alt: "image",
|
|
914
|
+
src: previewImage || void 0,
|
|
915
|
+
className: "d-flex mx-auto w-100"
|
|
916
|
+
}
|
|
917
|
+
)
|
|
897
918
|
)));
|
|
898
919
|
};
|
|
899
920
|
|
package/dist/index.mjs
CHANGED
|
@@ -736,12 +736,14 @@ var UploadElement = (props) => {
|
|
|
736
736
|
const [previewType, setPreviewType] = useState7(null);
|
|
737
737
|
const [previewImage, setPreviewImage] = useState7(null);
|
|
738
738
|
const uploadChange = (fileList) => {
|
|
739
|
-
console.log(fileList);
|
|
739
|
+
console.log(typeof fileList);
|
|
740
740
|
if (!fileList || fileList.length === 0) return;
|
|
741
|
-
const
|
|
742
|
-
|
|
741
|
+
const selectedFile = fileList[0];
|
|
742
|
+
console.log("selectedFile", selectedFile);
|
|
743
743
|
if (!selectedFile) return;
|
|
744
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
|
|
744
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
|
|
745
|
+
selectedFile.type
|
|
746
|
+
);
|
|
745
747
|
if (!isCorrectFile) {
|
|
746
748
|
Modal2.error({
|
|
747
749
|
title: `(${selectedFile.name}) is an invalid file.`,
|
|
@@ -784,8 +786,12 @@ var UploadElement = (props) => {
|
|
|
784
786
|
if (!file.url && !file.preview) {
|
|
785
787
|
file.preview = await URL.createObjectURL(file.originFileObj);
|
|
786
788
|
}
|
|
787
|
-
setPreviewType(
|
|
788
|
-
|
|
789
|
+
setPreviewType(
|
|
790
|
+
file.type || file.name.substring(file.name.lastIndexOf(".") + 1)
|
|
791
|
+
);
|
|
792
|
+
setPreviewTitle(
|
|
793
|
+
file.name || (file.url || "").substring((file.url || "").lastIndexOf("/") + 1)
|
|
794
|
+
);
|
|
789
795
|
setPreviewOpen(true);
|
|
790
796
|
};
|
|
791
797
|
const handleCancel = () => {
|
|
@@ -815,8 +821,10 @@ var UploadElement = (props) => {
|
|
|
815
821
|
showUploadList: true
|
|
816
822
|
},
|
|
817
823
|
props.list_type === "picture-card" && /* @__PURE__ */ React23.createElement("div", null, /* @__PURE__ */ React23.createElement(PlusOutlined2, null), /* @__PURE__ */ React23.createElement("div", { style: { marginTop: 8 } }, "Upload ", /* @__PURE__ */ React23.createElement("small", { className: "d-flex" }, "(Max:", props.max_count, ")"))),
|
|
818
|
-
props.list_type === "picture" && /* @__PURE__ */ React23.createElement(Button3, { icon: /* @__PURE__ */ React23.createElement(UploadOutlined, null) }, props.max_count ? `Upload (Max:${props.max_count})` : "Upload")
|
|
819
|
-
), props.errors && props.errors.length > 0 && props.errors.map(
|
|
824
|
+
props.list_type === "picture" && /* @__PURE__ */ React23.createElement(Button3, { icon: /* @__PURE__ */ React23.createElement(UploadOutlined, null) }, props.feildData.max_count ? `Upload (Max:${props.max_count})` : "Upload")
|
|
825
|
+
), props.errors && props.errors.length > 0 && props.errors.map(
|
|
826
|
+
(error, eKey) => /* @__PURE__ */ React23.createElement("small", { key: eKey, className: "text-danger animated flash" }, error.message)
|
|
827
|
+
), /* @__PURE__ */ React23.createElement(
|
|
820
828
|
Modal2,
|
|
821
829
|
{
|
|
822
830
|
open: previewOpen,
|
|
@@ -829,7 +837,13 @@ var UploadElement = (props) => {
|
|
|
829
837
|
onCancel: handleCancel,
|
|
830
838
|
destroyOnClose: true
|
|
831
839
|
},
|
|
832
|
-
/* @__PURE__ */ React23.createElement(Tooltip, { title: "Close", placement: "bottom" }, /* @__PURE__ */ React23.createElement(
|
|
840
|
+
/* @__PURE__ */ React23.createElement(Tooltip, { title: "Close", placement: "bottom" }, /* @__PURE__ */ React23.createElement(
|
|
841
|
+
CloseOutlined,
|
|
842
|
+
{
|
|
843
|
+
className: "border popup-close",
|
|
844
|
+
onClick: handleCancel
|
|
845
|
+
}
|
|
846
|
+
)),
|
|
833
847
|
previewType === "application/pdf" || previewType === "pdf" ? /* @__PURE__ */ React23.createElement(
|
|
834
848
|
"iframe",
|
|
835
849
|
{
|
|
@@ -837,7 +851,14 @@ var UploadElement = (props) => {
|
|
|
837
851
|
style: { width: "95vw", height: "40vw" },
|
|
838
852
|
src: `${previewImage}#toolbar=0`
|
|
839
853
|
}
|
|
840
|
-
) : /* @__PURE__ */ React23.createElement(
|
|
854
|
+
) : /* @__PURE__ */ React23.createElement(
|
|
855
|
+
"img",
|
|
856
|
+
{
|
|
857
|
+
alt: "image",
|
|
858
|
+
src: previewImage || void 0,
|
|
859
|
+
className: "d-flex mx-auto w-100"
|
|
860
|
+
}
|
|
861
|
+
)
|
|
841
862
|
)));
|
|
842
863
|
};
|
|
843
864
|
|