@apexcura/ui-components 0.0.13-Beta64 → 0.0.13-Beta66

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 CHANGED
@@ -793,7 +793,9 @@ var UploadElement = (props) => {
793
793
  const [previewImage, setPreviewImage] = (0, import_react23.useState)(null);
794
794
  const uploadChange = (fileList) => {
795
795
  if (!fileList || fileList.length === 0) return;
796
- const newFileList = [];
796
+ const existingFiles = props.value;
797
+ const newFileList = [...existingFiles];
798
+ console.log(newFileList);
797
799
  for (let i = 0; i < fileList.length; i++) {
798
800
  const selectedFile = fileList[i];
799
801
  const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
@@ -825,29 +827,11 @@ var UploadElement = (props) => {
825
827
  reader.readAsDataURL(selectedFile);
826
828
  newFileList.push(newFile);
827
829
  }
828
- };
829
- const uploadChange2 = ({ file, fileList }) => {
830
- const existingFiles = Array.isArray(props.value) ? props.value : [];
831
- const newFileList = [...existingFiles, ...fileList];
832
- console.log(newFileList);
833
830
  props.onChange && props.onChange({
834
831
  name: props.name,
835
832
  value: newFileList
836
833
  });
837
834
  };
838
- const handlePreview = async (file) => {
839
- if (!file.url && !file.preview) {
840
- file.preview = await URL.createObjectURL(file.originFileObj);
841
- }
842
- setPreviewImage(file.url || file.preview);
843
- setPreviewType(
844
- file.type || file.name.substring(file.name.lastIndexOf(".") + 1)
845
- );
846
- setPreviewTitle(
847
- file.name || (file.url || "").substring((file.url || "").lastIndexOf("/") + 1)
848
- );
849
- setPreviewOpen(true);
850
- };
851
835
  const handleCancel = () => {
852
836
  setPreviewImage(null);
853
837
  setPreviewType(null);
@@ -865,18 +849,8 @@ var UploadElement = (props) => {
865
849
  }
866
850
  )), /* @__PURE__ */ import_react23.default.createElement(
867
851
  import_antd17.Upload,
868
- {
869
- accept: props.accept,
870
- listType: props.list_type,
871
- maxCount: props.max_count,
872
- multiple: true,
873
- fileList: Array.isArray(props.value) ? props.value : [],
874
- onChange: uploadChange2,
875
- onPreview: handlePreview,
876
- showUploadList: true
877
- },
878
- 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, ")"))),
879
- 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")
852
+ null,
853
+ 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, ")")))
880
854
  ), props.errors && props.errors.length > 0 && props.errors.map(
881
855
  (error, eKey) => /* @__PURE__ */ import_react23.default.createElement("small", { key: eKey, className: "text-danger animated flash" }, error.message)
882
856
  ), /* @__PURE__ */ import_react23.default.createElement(
package/dist/index.mjs CHANGED
@@ -728,7 +728,7 @@ var DateRangePickerElement = (props) => {
728
728
 
729
729
  // src/Components/UploadElement.tsx
730
730
  import React23, { useState as useState7 } from "react";
731
- import { Upload, Button as Button3, Modal as Modal2, Tooltip } from "antd";
731
+ import { Upload, Modal as Modal2, Tooltip } from "antd";
732
732
  import { UploadOutlined, PlusOutlined as PlusOutlined2, CloseOutlined } from "@ant-design/icons";
733
733
  var UploadElement = (props) => {
734
734
  const [previewTitle, setPreviewTitle] = useState7(null);
@@ -737,7 +737,9 @@ var UploadElement = (props) => {
737
737
  const [previewImage, setPreviewImage] = useState7(null);
738
738
  const uploadChange = (fileList) => {
739
739
  if (!fileList || fileList.length === 0) return;
740
- const newFileList = [];
740
+ const existingFiles = props.value;
741
+ const newFileList = [...existingFiles];
742
+ console.log(newFileList);
741
743
  for (let i = 0; i < fileList.length; i++) {
742
744
  const selectedFile = fileList[i];
743
745
  const isCorrectFile = ["image/png", "image/jpg", "image/jpeg"].includes(
@@ -769,29 +771,11 @@ var UploadElement = (props) => {
769
771
  reader.readAsDataURL(selectedFile);
770
772
  newFileList.push(newFile);
771
773
  }
772
- };
773
- const uploadChange2 = ({ file, fileList }) => {
774
- const existingFiles = Array.isArray(props.value) ? props.value : [];
775
- const newFileList = [...existingFiles, ...fileList];
776
- console.log(newFileList);
777
774
  props.onChange && props.onChange({
778
775
  name: props.name,
779
776
  value: newFileList
780
777
  });
781
778
  };
782
- const handlePreview = async (file) => {
783
- if (!file.url && !file.preview) {
784
- file.preview = await URL.createObjectURL(file.originFileObj);
785
- }
786
- setPreviewImage(file.url || file.preview);
787
- setPreviewType(
788
- file.type || file.name.substring(file.name.lastIndexOf(".") + 1)
789
- );
790
- setPreviewTitle(
791
- file.name || (file.url || "").substring((file.url || "").lastIndexOf("/") + 1)
792
- );
793
- setPreviewOpen(true);
794
- };
795
779
  const handleCancel = () => {
796
780
  setPreviewImage(null);
797
781
  setPreviewType(null);
@@ -809,18 +793,8 @@ var UploadElement = (props) => {
809
793
  }
810
794
  )), /* @__PURE__ */ React23.createElement(
811
795
  Upload,
812
- {
813
- accept: props.accept,
814
- listType: props.list_type,
815
- maxCount: props.max_count,
816
- multiple: true,
817
- fileList: Array.isArray(props.value) ? props.value : [],
818
- onChange: uploadChange2,
819
- onPreview: handlePreview,
820
- showUploadList: true
821
- },
822
- 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, ")"))),
823
- props.list_type === "picture" && /* @__PURE__ */ React23.createElement(Button3, { icon: /* @__PURE__ */ React23.createElement(UploadOutlined, null) }, props.feildData.max_count ? `Upload (Max:${props.max_count})` : "Upload")
796
+ null,
797
+ 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, ")")))
824
798
  ), props.errors && props.errors.length > 0 && props.errors.map(
825
799
  (error, eKey) => /* @__PURE__ */ React23.createElement("small", { key: eKey, className: "text-danger animated flash" }, error.message)
826
800
  ), /* @__PURE__ */ React23.createElement(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.13-Beta64",
3
+ "version": "0.0.13-Beta66",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",