lu-lowcode-package-form 0.8.9 → 0.9.2

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/style.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.frelative{position:relative}.fmb-5{margin-bottom:1.25rem}.fflex{display:flex}.fh-11{height:2.75rem}.fh-8{height:2rem}.fh-full{height:100%}.fmin-h-5{min-height:1.25rem}.fw-\[960px\]{width:960px}.fw-full{width:100%}.fmin-w-36{min-width:9rem}.fcursor-pointer{cursor:pointer}.fflex-col{flex-direction:column}.fitems-center{align-items:center}.fitems-stretch{align-items:stretch}.fjustify-center{justify-content:center}.fjustify-between{justify-content:space-between}.fgap-1{gap:.25rem}.frounded{border-radius:.25rem}.fborder{border-width:1px}.fborder-l-4{border-left-width:4px}.fborder-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.fborder-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.fbg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.fbg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fp-4{padding:1rem}.fp-6{padding:1.5rem}.fpb-10{padding-bottom:2.5rem}.fpl-2{padding-left:.5rem}.ftext-lg{font-size:1.125rem;line-height:1.75rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ffont-medium{font-weight:500}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.hover\:fborder-\[\#3e92f8\]:hover{--tw-border-opacity: 1;border-color:rgb(62 146 248 / var(--tw-border-opacity))}.hover\:ftext-\[\#3e92f8\]:hover{--tw-text-opacity: 1;color:rgb(62 146 248 / var(--tw-text-opacity))}
1
+ *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.fabsolute{position:absolute}.frelative{position:relative}.fleft-0{left:0}.ftop-0{top:0}.fz-10{z-index:10}.fmb-5{margin-bottom:1.25rem}.fmt-2{margin-top:.5rem}.fflex{display:flex}.fhidden{display:none}.fh-11{height:2.75rem}.fh-24{height:6rem}.fh-8{height:2rem}.fh-full{height:100%}.fmax-h-full{max-height:100%}.fmin-h-5{min-height:1.25rem}.fw-24{width:6rem}.fw-\[960px\]{width:960px}.fw-full{width:100%}.fmin-w-36{min-width:9rem}.fmax-w-full{max-width:100%}.fcursor-pointer{cursor:pointer}.fflex-col{flex-direction:column}.fflex-wrap{flex-wrap:wrap}.fitems-center{align-items:center}.fitems-stretch{align-items:stretch}.fjustify-center{justify-content:center}.fjustify-between{justify-content:space-between}.fgap-1{gap:.25rem}.fgap-2{gap:.5rem}.fgap-3{gap:.75rem}.foverflow-hidden{overflow:hidden}.frounded{border-radius:.25rem}.fborder{border-width:1px}.fborder-l-4{border-left-width:4px}.fborder-dashed{border-style:dashed}.fborder-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.fborder-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity))}.fborder-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.fbg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.fbg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.fbg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.fbg-transparent{background-color:transparent}.fbg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fbg-opacity-50{--tw-bg-opacity: .5}.fobject-contain{object-fit:contain}.fp-4{padding:1rem}.fp-6{padding:1.5rem}.fpb-10{padding-bottom:2.5rem}.fpl-2{padding-left:.5rem}.ftext-lg{font-size:1.125rem;line-height:1.75rem}.ftext-sm{font-size:.875rem;line-height:1.25rem}.ftext-xs{font-size:.75rem;line-height:1rem}.ffont-medium{font-weight:500}.ftext-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.ftext-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:fborder-\[\#3e92f8\]:hover{--tw-border-opacity: 1;border-color:rgb(62 146 248 / var(--tw-border-opacity))}.hover\:ftext-\[\#3e92f8\]:hover{--tw-text-opacity: 1;color:rgb(62 146 248 / var(--tw-text-opacity))}.hover\:ftext-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.fgroup:hover .group-hover\:fflex{display:flex}.fgroup:hover .group-hover\:fbg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.8.9",
3
+ "version": "0.9.2",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@testing-library/jest-dom": "^5.17.0",
package/src/App.jsx CHANGED
@@ -32,7 +32,7 @@ function App() {
32
32
  formRef?.current?.formRef?.setFieldsValue({
33
33
  CheckboxGroup:"[\"1\",\"2\"]",
34
34
  UploadFile:"[{\"uid\":\"rc-upload-1718779211228-3\",\"url\":\"/files/20240619/ZmUznJfquBeSmOUC_pdf/17204092_43b027e81a384b0590f0f453288544dd-040624-1533-978.pdf\",\"name\":\"17204092_43b027e81a384b0590f0f453288544dd-040624-1533-978.pdf\",\"status\":\"done\"}]",
35
- UploadImage:"[{\"uid\":\"rc-upload-1718779211228-5\",\"url\":\"/files/20240619/chwbgVsNfgSzCXyn_png/nouser.png\",\"name\":\"nouser.png\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-7\",\"url\":\"/files/20240619/bRbnpmseaGyCxpWZ_jpg/1717032062027(1).jpg\",\"name\":\"1717032062027(1).jpg\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-9\",\"url\":\"/files/20240619/TlomGohpkBxXyRqN_png/logo-adg.png\",\"name\":\"logo-adg.png\",\"status\":\"done\"}]",
35
+ UploadImage:"[{\"uid\":\"rc-upload-1718779211228-5\",\"url\":\"https://imgs.699pic.com/images/501/361/351.jpg!list1x.v2\",\"name\":\"nouser.png\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-7\",\"url\":\"https://avatars.githubusercontent.com/u/4323180?s=80&u=f6ec6f10c061cf179610c5afd8b120ca2c29ea7f&v=4\",\"name\":\"1717032062027(1).jpg\",\"status\":\"done\"},{\"uid\":\"rc-upload-1718779211228-9\",\"url\":\"/files/20240619/TlomGohpkBxXyRqN_png/logo-adg.png\",\"name\":\"logo-adg.png\",\"status\":\"done\"}]",
36
36
  select1:"1",
37
37
  select2:"[\"1\",\"2\"]",
38
38
  switch:"1",
@@ -88,7 +88,11 @@ function App() {
88
88
  <Field.UploadImage _componentName="Field.UploadImage" label="上传图片" __id="UploadImage" ></Field.UploadImage>
89
89
 
90
90
  </FormContainerWrapper>
91
-
91
+ <div class="fgroup">11111
92
+ <div class="fbg-red-500 group-hover:fbg-blue-500">
93
+ Hover over me or my parent!
94
+ </div>
95
+ </div>
92
96
  <Button type="primary" onClick={getFormFields}>GetValues</Button>
93
97
  <Button type="primary" onClick={setFormFields}>SetValues</Button>
94
98
  <Button type="primary" onClick={handleCols}>UpdateCol</Button>
@@ -36,7 +36,8 @@ const UploadFile = ({ value, maxCount, onChange, ...props }) => {
36
36
  uid: file.uid,
37
37
  name: file.name,
38
38
  status: file.status,
39
- url: file.url || file.response || ""
39
+ url: file.url || file.response || "",
40
+ error: file.error,
40
41
  }
41
42
  }))
42
43
  setFileList(newFileList);
@@ -1,83 +1,150 @@
1
- import { Upload as OriginalUpload, Button } from "antd";
1
+ import { Upload as OriginalUpload, Button, Image, Spin } from "antd";
2
2
 
3
3
  import { BaseWrapper } from "../base.jsx"
4
- import { PlusOutlined } from "@ant-design/icons";
5
- import React,{ useEffect, useState} from "react";
4
+ import { DeleteOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
5
+ import React, { useEffect, useState } from "react";
6
6
 
7
7
  const UploadImage = ({ maxCount, value, onChange, ...props }) => {
8
8
  useEffect(() => {
9
- if (value){
10
- console.log("value" ,value)
11
- if ( typeof value == 'string') {
9
+ if (value) {
10
+ console.log("value", value)
11
+ if (typeof value == 'string') {
12
12
  try {
13
13
  value = JSON.parse(value)
14
14
  onChange(value)
15
15
  } catch (error) {
16
-
16
+
17
17
  }
18
18
  }
19
-
20
- if(Array.isArray(value))
19
+
20
+ if ((!fileList || fileList.length == 0 ) && Array.isArray(value))
21
21
  setFileList(value)
22
22
  }
23
23
  }, [value]);
24
24
  maxCount = maxCount || 9;
25
25
  const [fileList, setFileList] = React.useState([]);
26
26
  const [previewImage, setPreviewImage] = useState('');
27
+ const [previewImageIndex, setPreviewImageIndex] = useState(0);
27
28
  const [previewOpen, setPreviewOpen] = useState(false);
28
- const handlePreview = async (file) => {
29
+
30
+ const getBase64 = (file) =>
31
+ new Promise((resolve, reject) => {
32
+ const reader = new FileReader();
33
+ reader.readAsDataURL(file);
34
+ reader.onload = () => resolve(reader.result);
35
+ reader.onerror = (error) => reject(error);
36
+ });
37
+
38
+ const handlePreview = async (file, index) => {
29
39
  if (!file.url && !file.preview) {
30
40
  file.preview = await getBase64(file.originFileObj);
31
41
  }
32
42
 
33
43
  setPreviewImage(file.url || (file.preview));
44
+ setPreviewImageIndex(index)
34
45
  setPreviewOpen(true);
35
46
  };
36
- const uploadButton = (
37
- <button style={{ border: 0, background: 'none' }} type="button">
47
+
48
+ const handleDelete = async (file, index) => {
49
+
50
+ setFileList(fileList.filter((item, i) => i !== index))
51
+ }
52
+
53
+ const uploadButton = (<>
54
+ <div className="fw-full fh-full fflex fflex-col fitems-center fjustify-center fborder fborder-dashed fcursor-pointer frounded">
38
55
  <PlusOutlined />
39
- <div style={{ marginTop: 8 }}>点击上传</div>
40
- </button>
56
+ <div className="fmt-2">点击上传</div>
57
+ </div>
58
+ </>
59
+
41
60
  );
42
- const handleChange= ({ fileList: newFileList }) => {
43
- newFileList = newFileList.map((file) => {
61
+ const handleChange = async ({ fileList: newFileList }) => {
62
+ for (let i = 0; i < newFileList.length; i++) {
63
+ var file = newFileList[i];
44
64
  if (file.status == "done" && file.response) {
45
65
  file.url = file.response;
46
66
  }
47
- return file;
48
- })
67
+ if (!file.url && file.originFileObj)
68
+ file.base64 = await getBase64(file.originFileObj)
69
+ newFileList[i] = file
70
+ }
71
+ console.log("newFileList", JSON.parse(JSON.stringify(newFileList)))
49
72
  onChange(newFileList.map((file) => {
50
73
  return {
51
74
  uid: file.uid,
52
75
  name: file.name,
53
76
  status: file.status,
54
- url: file.url || file.response || ""
77
+ url: file.url || file.response || "",
78
+ error: file.error,
55
79
  }
56
80
  }))
57
81
  setFileList(newFileList);
58
82
  }
59
83
  return (
60
84
  <BaseWrapper {...props}>
61
- <OriginalUpload
62
- {...props}
63
- maxCount={maxCount}
64
- listType="picture-card"
65
- fileList={fileList}
66
- onPreview={handlePreview}
67
- onChange={handleChange}
68
- >
69
- {fileList.length >= maxCount ? null : uploadButton}
70
- </OriginalUpload>
85
+ <div className="fflex fgap-3 fflex-wrap">
86
+ {/* {fileList.map((file, index) => {
87
+ console.log("file.base64",file.base64)
88
+ return (
89
+ <>
90
+ <div key={`file-${file.uid}`} className={"fgroup fw-24 fh-24 fbg-transparent fborder frounded fflex fitems-center fjustify-center foverflow-hidden fcursor-pointer frelative" + (file.status == "error" ?" fborder-red-500":"")}>
91
+ <div className=" fhidden fabsolute fw-full fh-full fbg-gray-900 fbg-opacity-50 fitems-center fjustify-center fz-10 group-hover:fflex ftext-white ftext-lg fgap-2">
92
+ {file.status == "done" && <EyeOutlined onClick={() => { handlePreview(file, index) }} className="hover:ftext-gray-200" />}
93
+ <DeleteOutlined onClick={() => { handleDelete(file, index) }} className="hover:ftext-gray-200" />
94
+ </div>
95
+ <img src={file.url || file.base64} alt="Example Image" class="fmax-w-full fmax-h-full fobject-contain " />
96
+ </div>
97
+ </>
98
+ )
99
+ })} */}
100
+ <OriginalUpload
101
+ {...props}
102
+ itemRender={
103
+ (originNode, file, fileList) => {
104
+ console.log("file", file)
105
+ let index = fileList.findIndex((item) => item.uid === file.uid)
106
+ return (
107
+ <>
108
+ <div key={`file-${file.uid}`} className={"fgroup fw-full fh-full fbg-transparent fborder frounded fflex fitems-center fjustify-center foverflow-hidden fcursor-pointer frelative" + (file.status == "error" ?" fborder-red-500":"")}>
109
+ <div className=" fhidden fabsolute fw-full fh-full fbg-gray-900 fbg-opacity-50 fitems-center fjustify-center fz-10 group-hover:fflex ftext-white ftext-lg fgap-2">
110
+ {file.status == "done" && <EyeOutlined onClick={() => { handlePreview(file, index) }} className="hover:ftext-gray-200" />}
111
+ <DeleteOutlined onClick={() => { handleDelete(file, index) }} className="hover:ftext-gray-200" />
112
+
113
+ </div>
114
+ {file.status == "uploading" && <div className=" fw-full fh-full fflex fitems-center fjustify-center fabsolute ftop-0 fleft-0 "><Spin></Spin></div>}
115
+ <img src={file.url || file.base64} alt="Example Image" class="fmax-w-full fmax-h-full fobject-contain " />
116
+ </div>
117
+ </>
118
+ )
119
+ // console.log("originNode", originNode)
120
+ // console.log("index", index)
121
+ // console.log("file", file)
122
+ // console.log("fileList", fileList)
123
+ return null
124
+ }
125
+ }
126
+ listType="picture-card"
127
+ fileList={fileList}
128
+ maxCount={maxCount}
129
+ onPreview={handlePreview}
130
+ onChange={handleChange}
131
+ >
132
+ {fileList.length >= maxCount ? null : uploadButton}
133
+ </OriginalUpload>
134
+ </div>
135
+
71
136
  {previewImage && (
72
- <Image
73
- wrapperStyle={{ display: 'none' }}
74
- preview={{
75
- visible: previewOpen,
76
- onVisibleChange: (visible) => setPreviewOpen(visible),
77
- afterOpenChange: (visible) => !visible && setPreviewImage(''),
78
- }}
79
- src={previewImage}
80
- />
137
+ <Image.PreviewGroup preview={{
138
+ visible: previewOpen,
139
+ current: previewImageIndex,
140
+ onVisibleChange: (visible) => setPreviewOpen(visible),
141
+ onChange: (index) => { setPreviewImageIndex(index) }
142
+ }}>
143
+ {fileList.map((file, index) => <><Image
144
+ wrapperStyle={{ display: 'none' }}
145
+ src={file.url}
146
+ /></>)}
147
+ </Image.PreviewGroup>
81
148
  )}
82
149
  </BaseWrapper>
83
150
  );
@@ -11,7 +11,11 @@ module.exports = {
11
11
  extend: {},
12
12
  },
13
13
  variants: {
14
- extend: {},
14
+ extend: {
15
+ backgroundColor: ['hover', 'group-hover'],
16
+ textColor: ['hover', 'group-hover'],
17
+ scale: ['group-hover'],
18
+ },
15
19
  },
16
20
  plugins: [],
17
21
  }