szld-libs 0.0.36 → 0.1.0

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.
@@ -4,11 +4,7 @@ import { PlusOutlined, UploadOutlined } from "@ant-design/icons";
4
4
  import { FileSuffix } from "../../utils/filetype";
5
5
  import { useState } from "react";
6
6
  import { getFileSuffix, getBase64 } from "../../utils";
7
- import ReactDOM from "react-dom";
8
- const preview = "upload-module_preview_49f16";
9
- const styles = {
10
- preview
11
- };
7
+ import "react-dom";
12
8
  const defaultFileType = [FileSuffix.jpeg, FileSuffix.jpg, FileSuffix.png];
13
9
  const UploadFile = (props) => {
14
10
  const {
@@ -20,7 +16,7 @@ const UploadFile = (props) => {
20
16
  uploadBtnName = "上传",
21
17
  uploadHint = null
22
18
  } = props;
23
- const [preview2, setPreview] = useState(false);
19
+ const [preview, setPreview] = useState(false);
24
20
  const [previewSrc, setPreviewSrc] = useState("");
25
21
  const uploadButton = () => {
26
22
  if (listType !== "text") {
@@ -103,37 +99,21 @@ const UploadFile = (props) => {
103
99
  children: fileList.length >= maxCount ? null : uploadButton()
104
100
  }
105
101
  ),
106
- /* @__PURE__ */ jsx(
107
- ImagePreview,
108
- {
109
- visible: preview2,
110
- src: previewSrc,
111
- onVisibleChange: () => {
112
- setPreview(false);
113
- setPreviewSrc("");
114
- }
115
- }
116
- )
117
- ] });
118
- };
119
- const ImagePreview = (props) => {
120
- const { visible, src, onVisibleChange } = props;
121
- return ReactDOM.createPortal(
122
102
  /* @__PURE__ */ jsx(
123
103
  Image,
124
104
  {
125
105
  style: { display: "none" },
126
- src,
127
- rootClassName: styles.preview,
128
106
  preview: {
129
- visible,
130
- src,
131
- onVisibleChange
107
+ visible: preview,
108
+ src: previewSrc,
109
+ onVisibleChange: () => {
110
+ setPreview(false);
111
+ setPreviewSrc("");
112
+ }
132
113
  }
133
114
  }
134
- ),
135
- document.body
136
- );
115
+ )
116
+ ] });
137
117
  };
138
118
  export {
139
119
  UploadFile as default
package/es/index.js CHANGED
@@ -35,7 +35,7 @@ const Demo = () => {
35
35
  }))
36
36
  );
37
37
  useState(false);
38
- const [fileList, setFileList] = useState([
38
+ useState([
39
39
  {
40
40
  uid: "-1",
41
41
  name: "image.png",
@@ -55,7 +55,7 @@ const Demo = () => {
55
55
  url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
56
56
  }
57
57
  ]);
58
- return /* @__PURE__ */ jsxs("div", { children: [
58
+ return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
59
59
  /* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
60
60
  /* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
61
61
  /* @__PURE__ */ jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
@@ -92,6 +92,31 @@ const Demo = () => {
92
92
  span: 6
93
93
  }
94
94
  },
95
+ {
96
+ dataIndex: "pic",
97
+ valueType: "upload",
98
+ valueProps: {
99
+ maxCount: 1
100
+ },
101
+ colProps: {
102
+ span: 12
103
+ }
104
+ },
105
+ {
106
+ dataIndex: "pic2",
107
+ colProps: {
108
+ span: 12
109
+ }
110
+ },
111
+ {
112
+ dataIndex: "qwe",
113
+ valueProps: {
114
+ placeholder: "name"
115
+ },
116
+ colProps: {
117
+ span: 12
118
+ }
119
+ },
95
120
  {
96
121
  dataIndex: "btns",
97
122
  valueType: "btns",
@@ -121,7 +146,6 @@ const Demo = () => {
121
146
  /* @__PURE__ */ jsx(
122
147
  UploadFile,
123
148
  {
124
- fileList,
125
149
  uploadBtnName: "上传图片",
126
150
  accept: ".zip,.jpg,.png",
127
151
  uploadHint: /* @__PURE__ */ jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
@@ -5,11 +5,7 @@ const icons = require("@ant-design/icons");
5
5
  const filetype = require("../../utils/filetype");
6
6
  const react = require("react");
7
7
  const utils = require("../../utils");
8
- const ReactDOM = require("react-dom");
9
- const preview = "upload-module_preview_49f16";
10
- const styles = {
11
- preview
12
- };
8
+ require("react-dom");
13
9
  const defaultFileType = [filetype.FileSuffix.jpeg, filetype.FileSuffix.jpg, filetype.FileSuffix.png];
14
10
  const UploadFile = (props) => {
15
11
  const {
@@ -21,7 +17,7 @@ const UploadFile = (props) => {
21
17
  uploadBtnName = "上传",
22
18
  uploadHint = null
23
19
  } = props;
24
- const [preview2, setPreview] = react.useState(false);
20
+ const [preview, setPreview] = react.useState(false);
25
21
  const [previewSrc, setPreviewSrc] = react.useState("");
26
22
  const uploadButton = () => {
27
23
  if (listType !== "text") {
@@ -104,36 +100,20 @@ const UploadFile = (props) => {
104
100
  children: fileList.length >= maxCount ? null : uploadButton()
105
101
  }
106
102
  ),
107
- /* @__PURE__ */ jsxRuntime.jsx(
108
- ImagePreview,
109
- {
110
- visible: preview2,
111
- src: previewSrc,
112
- onVisibleChange: () => {
113
- setPreview(false);
114
- setPreviewSrc("");
115
- }
116
- }
117
- )
118
- ] });
119
- };
120
- const ImagePreview = (props) => {
121
- const { visible, src, onVisibleChange } = props;
122
- return ReactDOM.createPortal(
123
103
  /* @__PURE__ */ jsxRuntime.jsx(
124
104
  antd.Image,
125
105
  {
126
106
  style: { display: "none" },
127
- src,
128
- rootClassName: styles.preview,
129
107
  preview: {
130
- visible,
131
- src,
132
- onVisibleChange
108
+ visible: preview,
109
+ src: previewSrc,
110
+ onVisibleChange: () => {
111
+ setPreview(false);
112
+ setPreviewSrc("");
113
+ }
133
114
  }
134
115
  }
135
- ),
136
- document.body
137
- );
116
+ )
117
+ ] });
138
118
  };
139
119
  module.exports = UploadFile;
package/lib/index.js CHANGED
@@ -36,7 +36,7 @@ const Demo = () => {
36
36
  }))
37
37
  );
38
38
  react.useState(false);
39
- const [fileList, setFileList] = react.useState([
39
+ react.useState([
40
40
  {
41
41
  uid: "-1",
42
42
  name: "image.png",
@@ -56,7 +56,7 @@ const Demo = () => {
56
56
  url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
57
57
  }
58
58
  ]);
59
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
59
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh" }, children: [
60
60
  /* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "副标题" }) }),
61
61
  /* @__PURE__ */ jsxRuntime.jsx(main.AuthButton, { type: "primary", children: "按钮1" }),
62
62
  /* @__PURE__ */ jsxRuntime.jsx(CoralButton, { PId: 100, auths: [{ PId: 100 }], children: "123" }),
@@ -93,6 +93,31 @@ const Demo = () => {
93
93
  span: 6
94
94
  }
95
95
  },
96
+ {
97
+ dataIndex: "pic",
98
+ valueType: "upload",
99
+ valueProps: {
100
+ maxCount: 1
101
+ },
102
+ colProps: {
103
+ span: 12
104
+ }
105
+ },
106
+ {
107
+ dataIndex: "pic2",
108
+ colProps: {
109
+ span: 12
110
+ }
111
+ },
112
+ {
113
+ dataIndex: "qwe",
114
+ valueProps: {
115
+ placeholder: "name"
116
+ },
117
+ colProps: {
118
+ span: 12
119
+ }
120
+ },
96
121
  {
97
122
  dataIndex: "btns",
98
123
  valueType: "btns",
@@ -122,7 +147,6 @@ const Demo = () => {
122
147
  /* @__PURE__ */ jsxRuntime.jsx(
123
148
  main.UploadFile,
124
149
  {
125
- fileList,
126
150
  uploadBtnName: "上传图片",
127
151
  accept: ".zip,.jpg,.png",
128
152
  uploadHint: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { position: "absolute", left: "100px", top: "20px" }, children: "11111111111111111111111111111" })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.0.36",
4
+ "version": "0.1.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -1,3 +0,0 @@
1
- .upload-module_preview_49f16 {
2
- display: none;
3
- }
@@ -1,3 +0,0 @@
1
- .upload-module_preview_49f16 {
2
- display: none;
3
- }