@apexcura/ui-components 0.0.13-Beta61 → 0.0.13-Beta63

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 = [...props.value];
796
+ const existingFiles = Array.isArray(props.value) ? props.value : [];
797
+ const newFileList = [...existingFiles];
798
+ console.log("newFileList-------------", 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(
@@ -831,8 +833,8 @@ var UploadElement = (props) => {
831
833
  });
832
834
  };
833
835
  const uploadChange2 = ({ file, fileList }) => {
834
- const newFileList = fileList.filter((f) => f.name !== file.name);
835
- console.log("newFileList---------------", newFileList);
836
+ const existingFiles = Array.isArray(props.value) ? props.value : [];
837
+ const newFileList = [...existingFiles, ...fileList];
836
838
  props.onChange && props.onChange({
837
839
  name: props.name,
838
840
  value: newFileList
@@ -873,7 +875,7 @@ var UploadElement = (props) => {
873
875
  listType: props.list_type,
874
876
  maxCount: props.max_count,
875
877
  multiple: true,
876
- fileList: props.value,
878
+ fileList: Array.isArray(props.value) ? props.value : [],
877
879
  onChange: uploadChange2,
878
880
  onPreview: handlePreview,
879
881
  showUploadList: true
package/dist/index.mjs CHANGED
@@ -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 = [...props.value];
740
+ const existingFiles = Array.isArray(props.value) ? props.value : [];
741
+ const newFileList = [...existingFiles];
742
+ console.log("newFileList-------------", 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(
@@ -775,8 +777,8 @@ var UploadElement = (props) => {
775
777
  });
776
778
  };
777
779
  const uploadChange2 = ({ file, fileList }) => {
778
- const newFileList = fileList.filter((f) => f.name !== file.name);
779
- console.log("newFileList---------------", newFileList);
780
+ const existingFiles = Array.isArray(props.value) ? props.value : [];
781
+ const newFileList = [...existingFiles, ...fileList];
780
782
  props.onChange && props.onChange({
781
783
  name: props.name,
782
784
  value: newFileList
@@ -817,7 +819,7 @@ var UploadElement = (props) => {
817
819
  listType: props.list_type,
818
820
  maxCount: props.max_count,
819
821
  multiple: true,
820
- fileList: props.value,
822
+ fileList: Array.isArray(props.value) ? props.value : [],
821
823
  onChange: uploadChange2,
822
824
  onPreview: handlePreview,
823
825
  showUploadList: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.13-Beta61",
3
+ "version": "0.0.13-Beta63",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",