szld-libs 0.2.9 → 0.2.10
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 +1 -1
- package/dist/szld-components.es.js +2326 -2830
- package/dist/szld-components.umd.js +39 -103
- package/es/components/AuthButton/index.d.ts +2 -1
- package/es/components/BackHeader/index.d.ts +1 -1
- package/es/components/Captcha/index.d.ts +8 -0
- package/es/components/Captcha/index.js +30 -0
- package/es/components/Captcha/vite.svg +1 -0
- package/es/components/CoralButton/index.d.ts +2 -1
- package/es/components/CreateForm/index.d.ts +2 -2
- package/es/components/Echarts/index.d.ts +2 -1
- package/es/components/EditTable/index.d.ts +2 -1
- package/es/components/SearchTable/index.d.ts +2 -1
- package/es/components/Upload/index.d.ts +1 -1
- package/es/components/VirtualTable/index.d.ts +2 -1
- package/es/components/common/403.d.ts +2 -1
- package/es/components/common/404.d.ts +2 -1
- package/es/hooks/useChangePwd.d.ts +12 -0
- package/es/hooks/useChangePwd.js +61 -0
- package/es/hooks/vite.svg +1 -0
- package/es/main.d.ts +4 -2
- package/es/main.js +5 -1
- package/es/utils/formRules.d.ts +55 -0
- package/es/utils/formRules.js +57 -0
- package/es/utils/verify-code.js +0 -13
- package/lib/components/AuthButton/index.d.ts +2 -1
- package/lib/components/BackHeader/index.d.ts +1 -1
- package/lib/components/Captcha/index.d.ts +8 -0
- package/lib/components/Captcha/index.js +29 -0
- package/lib/components/Captcha/vite.svg +1 -0
- package/lib/components/CoralButton/index.d.ts +2 -1
- package/lib/components/CreateForm/index.d.ts +2 -2
- package/lib/components/Echarts/index.d.ts +2 -1
- package/lib/components/EditTable/index.d.ts +2 -1
- package/lib/components/SearchTable/index.d.ts +2 -1
- package/lib/components/Upload/index.d.ts +1 -1
- package/lib/components/VirtualTable/index.d.ts +2 -1
- package/lib/components/common/403.d.ts +2 -1
- package/lib/components/common/404.d.ts +2 -1
- package/lib/hooks/useChangePwd.d.ts +12 -0
- package/lib/hooks/useChangePwd.js +60 -0
- package/lib/hooks/vite.svg +1 -0
- package/lib/main.d.ts +4 -2
- package/lib/main.js +8 -3
- package/lib/utils/formRules.d.ts +55 -0
- package/lib/utils/formRules.js +56 -0
- package/lib/utils/verify-code.js +0 -13
- package/package.json +2 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const ahooks = require("ahooks");
|
|
4
|
+
const antd = require("antd");
|
|
5
|
+
const CreateForm = require("../components/CreateForm");
|
|
6
|
+
const formRules = require("../utils/formRules");
|
|
7
|
+
function useChangePwd(props) {
|
|
8
|
+
const { modal, message } = antd.App.useApp();
|
|
9
|
+
const [form] = antd.Form.useForm();
|
|
10
|
+
const items = [
|
|
11
|
+
{
|
|
12
|
+
dataIndex: "Password",
|
|
13
|
+
title: "新密码",
|
|
14
|
+
valueType: "password",
|
|
15
|
+
valueProps: {
|
|
16
|
+
placeholder: "请输入新密码"
|
|
17
|
+
},
|
|
18
|
+
formItemProps: {
|
|
19
|
+
rules: [{ required: true, message: "请输入新密码" }, formRules.passwordNewRule]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
dataIndex: "NewPassword",
|
|
24
|
+
title: "确认密码",
|
|
25
|
+
valueType: "password",
|
|
26
|
+
valueProps: {
|
|
27
|
+
placeholder: "请输入确认密码"
|
|
28
|
+
},
|
|
29
|
+
formItemProps: {
|
|
30
|
+
rules: [{ required: true, message: "请输入确认密码" }, ({ getFieldValue }) => ({
|
|
31
|
+
validator(_, value) {
|
|
32
|
+
if (!value || getFieldValue("Password") === value) {
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
return Promise.reject(new Error("两次密码输入不一致"));
|
|
36
|
+
}
|
|
37
|
+
})]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
const handleChangePwd = ahooks.useLockFn(async () => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
modal.confirm({
|
|
44
|
+
title: (props == null ? void 0 : props.title) || "默认账户及口令(密码),用户登录时需修改默认口令(密码),否则无法登录系统",
|
|
45
|
+
icon: null,
|
|
46
|
+
wrapClassName: "confirmWrapper",
|
|
47
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(CreateForm, { items, formProps: { form, layout: "vertical", labelCol: { span: 24 }, wrapperCol: { span: 24 } } }),
|
|
48
|
+
onOk() {
|
|
49
|
+
return new Promise((resolve2, reject2) => {
|
|
50
|
+
form.validateFields().then((values) => {
|
|
51
|
+
resolve({ values, resolve: resolve2, reject: reject2 });
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return { handleChangePwd };
|
|
59
|
+
}
|
|
60
|
+
module.exports = useChangePwd;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/lib/main.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import CoralButton from "./components/CoralButton";
|
|
|
8
8
|
import showWorkFlow from "./components/WorkFlowNode";
|
|
9
9
|
import * as download from "./utils/download";
|
|
10
10
|
import * as fileType from "./utils/filetype";
|
|
11
|
-
import * as
|
|
11
|
+
import * as FormRules from './utils/formRules';
|
|
12
12
|
import * as utils from "./utils/index";
|
|
13
|
-
|
|
13
|
+
import * as verfyCode from "./utils/verify-code";
|
|
14
|
+
import useChangePwd from "./hooks/useChangePwd";
|
|
15
|
+
export { AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, SearchTable, UploadFile, download, fileType, showWorkFlow, useChangePwd, utils, verfyCode };
|
package/lib/main.js
CHANGED
|
@@ -10,8 +10,10 @@ const CoralButton = require("./components/CoralButton");
|
|
|
10
10
|
const WorkFlowNode = require("./components/WorkFlowNode");
|
|
11
11
|
const download = require("./utils/download");
|
|
12
12
|
const filetype = require("./utils/filetype");
|
|
13
|
-
const
|
|
13
|
+
const formRules = require("./utils/formRules");
|
|
14
14
|
const index = require("./utils/index");
|
|
15
|
+
const verifyCode = require("./utils/verify-code");
|
|
16
|
+
const useChangePwd = require("./hooks/useChangePwd");
|
|
15
17
|
function _interopNamespaceDefault(e) {
|
|
16
18
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
17
19
|
if (e) {
|
|
@@ -30,8 +32,9 @@ function _interopNamespaceDefault(e) {
|
|
|
30
32
|
}
|
|
31
33
|
const download__namespace = /* @__PURE__ */ _interopNamespaceDefault(download);
|
|
32
34
|
const filetype__namespace = /* @__PURE__ */ _interopNamespaceDefault(filetype);
|
|
33
|
-
const
|
|
35
|
+
const formRules__namespace = /* @__PURE__ */ _interopNamespaceDefault(formRules);
|
|
34
36
|
const index__namespace = /* @__PURE__ */ _interopNamespaceDefault(index);
|
|
37
|
+
const verifyCode__namespace = /* @__PURE__ */ _interopNamespaceDefault(verifyCode);
|
|
35
38
|
exports.BackHeader = BackHeader;
|
|
36
39
|
exports.CreateForm = CreateForm;
|
|
37
40
|
exports.SearchTable = SearchTable;
|
|
@@ -42,5 +45,7 @@ exports.CoralButton = CoralButton;
|
|
|
42
45
|
exports.showWorkFlow = WorkFlowNode;
|
|
43
46
|
exports.download = download__namespace;
|
|
44
47
|
exports.fileType = filetype__namespace;
|
|
45
|
-
exports.
|
|
48
|
+
exports.FormRules = formRules__namespace;
|
|
46
49
|
exports.utils = index__namespace;
|
|
50
|
+
exports.verfyCode = verifyCode__namespace;
|
|
51
|
+
exports.useChangePwd = useChangePwd;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const formRules: {
|
|
2
|
+
phone: {
|
|
3
|
+
pattern: RegExp;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
telephone: {
|
|
7
|
+
pattern: RegExp;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
email: {
|
|
11
|
+
pattern: RegExp;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
httpUrl: {
|
|
15
|
+
pattern: RegExp;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
zipCode: {
|
|
19
|
+
pattern: RegExp;
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
specificKey: {
|
|
23
|
+
pattern: RegExp;
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
inputTextarea: {
|
|
27
|
+
pattern: RegExp;
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
backendRestrict: {
|
|
31
|
+
pattern: RegExp;
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
onetoNinetyNine: {
|
|
35
|
+
pattern: RegExp;
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
passwordRule: {
|
|
39
|
+
pattern: RegExp;
|
|
40
|
+
message: string;
|
|
41
|
+
};
|
|
42
|
+
passwordNewRule: {
|
|
43
|
+
pattern: RegExp;
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
pureNumber: {
|
|
47
|
+
pattern: RegExp;
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
50
|
+
onlyBlankRule: {
|
|
51
|
+
pattern: RegExp;
|
|
52
|
+
message: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export default formRules;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const formRules = {
|
|
3
|
+
phone: {
|
|
4
|
+
pattern: /^1[3456789]\d{9}$/,
|
|
5
|
+
message: "请输入正确的手机号码"
|
|
6
|
+
},
|
|
7
|
+
telephone: {
|
|
8
|
+
pattern: /^[\d -]+$/,
|
|
9
|
+
message: "请输入正确的电话号码"
|
|
10
|
+
},
|
|
11
|
+
email: {
|
|
12
|
+
pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
|
|
13
|
+
message: "请输入正确的邮箱地址"
|
|
14
|
+
},
|
|
15
|
+
httpUrl: {
|
|
16
|
+
pattern: /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/,
|
|
17
|
+
message: "请输入合法的URL"
|
|
18
|
+
},
|
|
19
|
+
zipCode: {
|
|
20
|
+
pattern: /^[0-9]{6}$/,
|
|
21
|
+
message: "请输入正确的邮政编码"
|
|
22
|
+
},
|
|
23
|
+
specificKey: {
|
|
24
|
+
pattern: /^[\w\u4E00-\u9FA5\uF900-\uFA2D()()]*$/,
|
|
25
|
+
message: "可输入字母、汉字、数字或()"
|
|
26
|
+
},
|
|
27
|
+
inputTextarea: {
|
|
28
|
+
pattern: /^[\w\u4E00-\u9FA5\uF900-\uFA2D-\u3002-\uff1f-\uff01-\uff0c-\u3001-\uff1b-\uff1a]*$/,
|
|
29
|
+
message: "请输入字母、汉字或数字和中文常用字符:?!,、;。"
|
|
30
|
+
},
|
|
31
|
+
backendRestrict: {
|
|
32
|
+
pattern: /^[^'"/\\]*$/,
|
|
33
|
+
message: `不能输入特殊字符\\'/"`
|
|
34
|
+
},
|
|
35
|
+
onetoNinetyNine: {
|
|
36
|
+
pattern: /^[1-9][0-9]{0,1}$/,
|
|
37
|
+
message: `请输入1-99的整数`
|
|
38
|
+
},
|
|
39
|
+
passwordRule: {
|
|
40
|
+
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z0-9]{8,12}$/,
|
|
41
|
+
message: `密码应为字母大小写+数字8-12位组合`
|
|
42
|
+
},
|
|
43
|
+
passwordNewRule: {
|
|
44
|
+
pattern: /^.*(?=.{8,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#¥%&*.()_+~/-]).*$/,
|
|
45
|
+
message: "密码应为字母大小写+数字+常见字符!@#¥%&*.()_+~/- 8-12位组合"
|
|
46
|
+
},
|
|
47
|
+
pureNumber: {
|
|
48
|
+
pattern: /^[1-9][0-9]*$/,
|
|
49
|
+
message: `请输入整数类型`
|
|
50
|
+
},
|
|
51
|
+
onlyBlankRule: {
|
|
52
|
+
pattern: /\S/,
|
|
53
|
+
message: "输入内容不能只有空格"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
module.exports = formRules;
|
package/lib/utils/verify-code.js
CHANGED
|
@@ -8,19 +8,12 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
9
|
class getGVerify {
|
|
10
10
|
constructor(options) {
|
|
11
|
-
//创建图形验证码
|
|
12
11
|
__publicField(this, "options", {
|
|
13
|
-
//默认值
|
|
14
12
|
id: "",
|
|
15
|
-
//容器Id
|
|
16
13
|
canvasId: "verifyCanvas",
|
|
17
|
-
//canvas的ID
|
|
18
14
|
width: 100,
|
|
19
|
-
//默认canvas宽度
|
|
20
15
|
height: 30,
|
|
21
|
-
//默认canvas高度
|
|
22
16
|
type: "blend",
|
|
23
|
-
//图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
|
|
24
17
|
code: ""
|
|
25
18
|
});
|
|
26
19
|
this.options = options;
|
|
@@ -31,7 +24,6 @@ class getGVerify {
|
|
|
31
24
|
this._init();
|
|
32
25
|
this.refresh();
|
|
33
26
|
}
|
|
34
|
-
/**初始化方法**/
|
|
35
27
|
_init() {
|
|
36
28
|
const con = document.getElementById(this.options.id);
|
|
37
29
|
const canvas = document.createElement("canvas");
|
|
@@ -47,7 +39,6 @@ class getGVerify {
|
|
|
47
39
|
this.refresh();
|
|
48
40
|
};
|
|
49
41
|
}
|
|
50
|
-
/**生成验证码**/
|
|
51
42
|
refresh() {
|
|
52
43
|
this.options.code = "";
|
|
53
44
|
const canvas = document.getElementById(this.options.canvasId);
|
|
@@ -98,7 +89,6 @@ class getGVerify {
|
|
|
98
89
|
ctx.fill();
|
|
99
90
|
}
|
|
100
91
|
}
|
|
101
|
-
/**验证验证码**/
|
|
102
92
|
validate(code) {
|
|
103
93
|
const verifyCode = code.toLowerCase();
|
|
104
94
|
const v_code = this.options.code.toLowerCase();
|
|
@@ -108,16 +98,13 @@ class getGVerify {
|
|
|
108
98
|
return false;
|
|
109
99
|
}
|
|
110
100
|
}
|
|
111
|
-
/**生成字母数组**/
|
|
112
101
|
getAllLetter() {
|
|
113
102
|
const letterStr = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
|
114
103
|
return letterStr.split(",");
|
|
115
104
|
}
|
|
116
|
-
/**生成一个随机数**/
|
|
117
105
|
randomNum(min, max) {
|
|
118
106
|
return Math.floor(Math.random() * (max - min) + min);
|
|
119
107
|
}
|
|
120
|
-
/**生成一个随机色**/
|
|
121
108
|
randomColor(min, max) {
|
|
122
109
|
const r = this.randomNum(min, max);
|
|
123
110
|
const g = this.randomNum(min, max);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "szld-libs",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"ahooks": "^3.7.4",
|
|
13
|
-
"antd": "^5.
|
|
13
|
+
"antd": "^5.12.2",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"react": "^18.2.0",
|
|
16
16
|
"react-dom": "^18.2.0",
|