szld-libs 0.0.37 → 0.1.1

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.
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { UploadProps } from "antd";
2
+ import { ReactNode } from "react";
3
3
  export interface UploadFileProps extends UploadProps {
4
4
  maxSize?: number;
5
- uploadBtnName?: string;
5
+ uploadBtnName?: string | ReactNode;
6
6
  uploadHint?: any;
7
7
  }
8
8
  declare const UploadFile: (props: UploadFileProps) => JSX.Element;
@@ -4,7 +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";
7
+ import "react-dom";
8
8
  const defaultFileType = [FileSuffix.jpeg, FileSuffix.jpg, FileSuffix.png];
9
9
  const UploadFile = (props) => {
10
10
  const {
@@ -99,36 +99,21 @@ const UploadFile = (props) => {
99
99
  children: fileList.length >= maxCount ? null : uploadButton()
100
100
  }
101
101
  ),
102
- preview && /* @__PURE__ */ jsx(
103
- ImagePreview,
104
- {
105
- visible: preview,
106
- src: previewSrc,
107
- onVisibleChange: () => {
108
- setPreview(false);
109
- setPreviewSrc("");
110
- }
111
- }
112
- )
113
- ] });
114
- };
115
- const ImagePreview = (props) => {
116
- const { visible, src, onVisibleChange } = props;
117
- return ReactDOM.createPortal(
118
102
  /* @__PURE__ */ jsx(
119
103
  Image,
120
104
  {
121
105
  style: { display: "none" },
122
- src,
123
106
  preview: {
124
- visible,
125
- src,
126
- onVisibleChange
107
+ visible: preview,
108
+ src: previewSrc,
109
+ onVisibleChange: () => {
110
+ setPreview(false);
111
+ setPreviewSrc("");
112
+ }
127
113
  }
128
114
  }
129
- ),
130
- document.body
131
- );
115
+ )
116
+ ] });
132
117
  };
133
118
  export {
134
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" })
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import { UploadProps } from "antd";
2
+ import { ReactNode } from "react";
3
3
  export interface UploadFileProps extends UploadProps {
4
4
  maxSize?: number;
5
- uploadBtnName?: string;
5
+ uploadBtnName?: string | ReactNode;
6
6
  uploadHint?: any;
7
7
  }
8
8
  declare const UploadFile: (props: UploadFileProps) => JSX.Element;
@@ -5,7 +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");
8
+ require("react-dom");
9
9
  const defaultFileType = [filetype.FileSuffix.jpeg, filetype.FileSuffix.jpg, filetype.FileSuffix.png];
10
10
  const UploadFile = (props) => {
11
11
  const {
@@ -100,35 +100,20 @@ const UploadFile = (props) => {
100
100
  children: fileList.length >= maxCount ? null : uploadButton()
101
101
  }
102
102
  ),
103
- preview && /* @__PURE__ */ jsxRuntime.jsx(
104
- ImagePreview,
105
- {
106
- visible: preview,
107
- src: previewSrc,
108
- onVisibleChange: () => {
109
- setPreview(false);
110
- setPreviewSrc("");
111
- }
112
- }
113
- )
114
- ] });
115
- };
116
- const ImagePreview = (props) => {
117
- const { visible, src, onVisibleChange } = props;
118
- return ReactDOM.createPortal(
119
103
  /* @__PURE__ */ jsxRuntime.jsx(
120
104
  antd.Image,
121
105
  {
122
106
  style: { display: "none" },
123
- src,
124
107
  preview: {
125
- visible,
126
- src,
127
- onVisibleChange
108
+ visible: preview,
109
+ src: previewSrc,
110
+ onVisibleChange: () => {
111
+ setPreview(false);
112
+ setPreviewSrc("");
113
+ }
128
114
  }
129
115
  }
130
- ),
131
- document.body
132
- );
116
+ )
117
+ ] });
133
118
  };
134
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.37",
4
+ "version": "0.1.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",