szld-libs 0.0.31 → 0.0.33

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.
@@ -20,9 +20,12 @@ const UploadFile = (props) => {
20
20
  const [previewSrc, setPreviewSrc] = useState("");
21
21
  const uploadButton = () => {
22
22
  if (listType !== "text") {
23
- return /* @__PURE__ */ jsxs("div", { children: [
24
- /* @__PURE__ */ jsx(PlusOutlined, {}),
25
- /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: uploadBtnName })
23
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
24
+ /* @__PURE__ */ jsxs("div", { children: [
25
+ /* @__PURE__ */ jsx(PlusOutlined, {}),
26
+ /* @__PURE__ */ jsx("div", { style: { marginTop: 8 }, children: uploadBtnName })
27
+ ] }),
28
+ uploadHint
26
29
  ] });
27
30
  }
28
31
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -47,6 +50,13 @@ const UploadFile = (props) => {
47
50
  const onChange = (info) => {
48
51
  props.onChange && props.onChange(info);
49
52
  };
53
+ const isPropsPreview = (file) => {
54
+ if (props.onPreview) {
55
+ props.onPreview(file);
56
+ } else {
57
+ onPreview(file);
58
+ }
59
+ };
50
60
  const onPreview = async (file) => {
51
61
  let suffix = getFileSuffix(file.name) || "";
52
62
  if (!suffix) {
@@ -82,7 +92,7 @@ const UploadFile = (props) => {
82
92
  Upload,
83
93
  {
84
94
  ...props,
85
- onPreview,
95
+ onPreview: isPropsPreview,
86
96
  beforeUpload,
87
97
  onChange,
88
98
  listType,
package/es/index.js CHANGED
@@ -35,6 +35,26 @@ const Demo = () => {
35
35
  }))
36
36
  );
37
37
  useState(false);
38
+ const [fileList, setFileList] = useState([
39
+ {
40
+ uid: "-1",
41
+ name: "image.png",
42
+ status: "done",
43
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
44
+ },
45
+ {
46
+ uid: "-2",
47
+ name: "image.png",
48
+ status: "done",
49
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
50
+ },
51
+ {
52
+ uid: "-3",
53
+ name: "image.png",
54
+ status: "done",
55
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
56
+ }
57
+ ]);
38
58
  return /* @__PURE__ */ jsxs("div", { children: [
39
59
  /* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
40
60
  /* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
@@ -101,9 +121,10 @@ const Demo = () => {
101
121
  /* @__PURE__ */ jsx(
102
122
  UploadFile,
103
123
  {
104
- uploadBtnName: "上传文件",
124
+ fileList,
125
+ uploadBtnName: "上传图片",
105
126
  accept: ".zip,.jpg,.png",
106
- uploadHint: /* @__PURE__ */ jsx("span", { style: { marginLeft: "10px" }, children: "11111111111111111111111111111" })
127
+ uploadHint: /* @__PURE__ */ jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
107
128
  }
108
129
  )
109
130
  ] });
@@ -21,9 +21,12 @@ const UploadFile = (props) => {
21
21
  const [previewSrc, setPreviewSrc] = react.useState("");
22
22
  const uploadButton = () => {
23
23
  if (listType !== "text") {
24
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
25
- /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
26
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8 }, children: uploadBtnName })
24
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
25
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
26
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
27
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8 }, children: uploadBtnName })
28
+ ] }),
29
+ uploadHint
27
30
  ] });
28
31
  }
29
32
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -48,6 +51,13 @@ const UploadFile = (props) => {
48
51
  const onChange = (info) => {
49
52
  props.onChange && props.onChange(info);
50
53
  };
54
+ const isPropsPreview = (file) => {
55
+ if (props.onPreview) {
56
+ props.onPreview(file);
57
+ } else {
58
+ onPreview(file);
59
+ }
60
+ };
51
61
  const onPreview = async (file) => {
52
62
  let suffix = utils.getFileSuffix(file.name) || "";
53
63
  if (!suffix) {
@@ -83,7 +93,7 @@ const UploadFile = (props) => {
83
93
  antd.Upload,
84
94
  {
85
95
  ...props,
86
- onPreview,
96
+ onPreview: isPropsPreview,
87
97
  beforeUpload,
88
98
  onChange,
89
99
  listType,
package/lib/index.js CHANGED
@@ -36,6 +36,26 @@ const Demo = () => {
36
36
  }))
37
37
  );
38
38
  react.useState(false);
39
+ const [fileList, setFileList] = react.useState([
40
+ {
41
+ uid: "-1",
42
+ name: "image.png",
43
+ status: "done",
44
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
45
+ },
46
+ {
47
+ uid: "-2",
48
+ name: "image.png",
49
+ status: "done",
50
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
51
+ },
52
+ {
53
+ uid: "-3",
54
+ name: "image.png",
55
+ status: "done",
56
+ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
57
+ }
58
+ ]);
39
59
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
40
60
  /* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "副标题" }) }),
41
61
  /* @__PURE__ */ jsxRuntime.jsx(main.AuthButton, { type: "primary", children: "按钮1" }),
@@ -102,9 +122,10 @@ const Demo = () => {
102
122
  /* @__PURE__ */ jsxRuntime.jsx(
103
123
  main.UploadFile,
104
124
  {
105
- uploadBtnName: "上传文件",
125
+ fileList,
126
+ uploadBtnName: "上传图片",
106
127
  accept: ".zip,.jpg,.png",
107
- uploadHint: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginLeft: "10px" }, children: "11111111111111111111111111111" })
128
+ uploadHint: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
108
129
  }
109
130
  )
110
131
  ] });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -11,15 +11,13 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "ahooks": "^3.7.4",
14
- "antd": "^5.1.2",
14
+ "antd": "^5.4.0",
15
15
  "lodash": "^4.17.21",
16
16
  "react": "^18.2.0",
17
17
  "react-dom": "^18.2.0",
18
18
  "react-router-dom": "^6.6.1"
19
19
  },
20
20
  "devDependencies": {
21
- "vite-plugin-build": "^0.7.0",
22
- "rimraf": "^4.1.2",
23
21
  "@types/lodash": "^4.14.191",
24
22
  "@types/node": "^18.11.15",
25
23
  "@types/react": "^18.0.26",
@@ -27,8 +25,10 @@
27
25
  "@types/react-window": "^1.8.5",
28
26
  "@vitejs/plugin-react": "^3.0.0",
29
27
  "less": "^4.1.3",
28
+ "rimraf": "^4.1.2",
30
29
  "typescript": "^4.9.3",
31
- "vite": "^4.0.0"
30
+ "vite": "^4.0.0",
31
+ "vite-plugin-build": "^0.7.0"
32
32
  },
33
33
  "main": "lib/main.js",
34
34
  "module": "es/main.js",