szld-libs 0.2.8 → 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 +2976 -3479
- package/dist/szld-components.umd.js +40 -104
- 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 +3 -1
- package/es/components/EditTable/index.js +3 -2
- 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/index.js +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 +3 -1
- package/lib/components/EditTable/index.js +3 -2
- 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/index.js +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
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from "antd";
|
|
2
3
|
export interface AuthButtonProps extends ButtonProps {
|
|
3
4
|
auth?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const AuthButton: (props: AuthButtonProps) =>
|
|
6
|
+
declare const AuthButton: (props: AuthButtonProps) => JSX.Element | null;
|
|
6
7
|
export default AuthButton;
|
|
@@ -9,5 +9,5 @@ interface BackHeaderProps {
|
|
|
9
9
|
titleStyle?: CSSProperties;
|
|
10
10
|
level?: 1 | 2 | 3 | 4 | 5;
|
|
11
11
|
}
|
|
12
|
-
declare const BackHeader: (props: BackHeaderProps) =>
|
|
12
|
+
declare const BackHeader: (props: BackHeaderProps) => JSX.Element;
|
|
13
13
|
export default BackHeader;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CaptchaProps {
|
|
3
|
+
style?: React.CSSProperties;
|
|
4
|
+
className?: string;
|
|
5
|
+
api: string;
|
|
6
|
+
}
|
|
7
|
+
declare const Captcha: import("react").ForwardRefExoticComponent<CaptchaProps & import("react").RefAttributes<unknown>>;
|
|
8
|
+
export default Captcha;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRequest, useCountDown } from "ahooks";
|
|
3
|
+
import { forwardRef, useState, useEffect, useImperativeHandle } from "react";
|
|
4
|
+
const request = async (url) => {
|
|
5
|
+
return fetch(url, { method: "post" });
|
|
6
|
+
};
|
|
7
|
+
const Captcha = forwardRef((props, ref) => {
|
|
8
|
+
const { style, className, api } = props;
|
|
9
|
+
const [targetDate, setTargetDate] = useState();
|
|
10
|
+
const { data, loading, error, refresh } = useRequest(() => request(api), {
|
|
11
|
+
ready: api !== void 0
|
|
12
|
+
});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (data) {
|
|
15
|
+
setTargetDate(Date.now() + 5 * 60 * 1e3);
|
|
16
|
+
}
|
|
17
|
+
}, [data]);
|
|
18
|
+
useCountDown({
|
|
19
|
+
targetDate,
|
|
20
|
+
onEnd: () => {
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
useImperativeHandle(ref, () => ({
|
|
24
|
+
onRefresh: refresh
|
|
25
|
+
}));
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className, style });
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
Captcha as default
|
|
30
|
+
};
|
|
@@ -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>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from "antd";
|
|
2
3
|
interface AuthProps {
|
|
3
4
|
PId: number;
|
|
@@ -6,5 +7,5 @@ export interface CoralButtonProps extends ButtonProps {
|
|
|
6
7
|
PId: number;
|
|
7
8
|
auths?: AuthProps[];
|
|
8
9
|
}
|
|
9
|
-
declare const CoralButton: (props: CoralButtonProps) =>
|
|
10
|
+
declare const CoralButton: (props: CoralButtonProps) => JSX.Element;
|
|
10
11
|
export default CoralButton;
|
|
@@ -44,12 +44,12 @@ export interface CreateFormProps {
|
|
|
44
44
|
readonly?: boolean;
|
|
45
45
|
hiddenTitle?: boolean;
|
|
46
46
|
}
|
|
47
|
-
declare const CreateForm: (props: CreateFormProps) =>
|
|
47
|
+
declare const CreateForm: (props: CreateFormProps) => JSX.Element;
|
|
48
48
|
interface FormFieldsProps extends Pick<CreateFormItemProps<ValueType>, "valueType" | "valueProps"> {
|
|
49
49
|
onChange?: (e: any) => void;
|
|
50
50
|
value?: any;
|
|
51
51
|
onBtnClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, item: ValueBtnProps) => void;
|
|
52
52
|
inputRef?: any;
|
|
53
53
|
}
|
|
54
|
-
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any
|
|
54
|
+
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<any>;
|
|
55
55
|
export default CreateForm;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as echarts from 'echarts/core';
|
|
2
3
|
import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
3
4
|
import { TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';
|
|
@@ -9,5 +10,5 @@ export interface EchartsProps {
|
|
|
9
10
|
* @param props : EchartsProps 传入图标配置项
|
|
10
11
|
* 外部包裹一层dom元素定义width和height,内部自动占满
|
|
11
12
|
*/
|
|
12
|
-
declare const Echarts: (props: EchartsProps) =>
|
|
13
|
+
declare const Echarts: (props: EchartsProps) => JSX.Element;
|
|
13
14
|
export default Echarts;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps } from "antd";
|
|
2
3
|
import { Rule } from "antd/es/form";
|
|
3
4
|
import { ColumnType } from "antd/es/table";
|
|
@@ -5,6 +6,7 @@ import { ValueProps, ValueType } from "../CreateForm";
|
|
|
5
6
|
export type ColumnsType<RecordType> = ColumnType<RecordType> & {
|
|
6
7
|
editable?: boolean;
|
|
7
8
|
rules?: Rule[];
|
|
9
|
+
initialValue?: any;
|
|
8
10
|
type?: ValueType;
|
|
9
11
|
valueProps?: ValueProps<RecordType>;
|
|
10
12
|
};
|
|
@@ -12,5 +14,5 @@ export interface EditTableProps<RecordType> extends Omit<TableProps<RecordType>,
|
|
|
12
14
|
columns: ColumnsType<RecordType>[];
|
|
13
15
|
onChange?: (row: RecordType) => void;
|
|
14
16
|
}
|
|
15
|
-
declare function EditTable<DataType extends object = any>(props: EditTableProps<DataType>):
|
|
17
|
+
declare function EditTable<DataType extends object = any>(props: EditTableProps<DataType>): JSX.Element;
|
|
16
18
|
export default EditTable;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Table, Form } from "antd";
|
|
3
|
+
import _ from "lodash";
|
|
3
4
|
import React, { useRef, useContext } from "react";
|
|
4
5
|
import { FormFields } from "../CreateForm";
|
|
5
|
-
import _ from "lodash";
|
|
6
6
|
const editableCellValueWrap = "editable-module_editableCellValueWrap_3b3d9";
|
|
7
7
|
const classes = {
|
|
8
8
|
editableCellValueWrap
|
|
@@ -23,6 +23,7 @@ function EditableCell(props) {
|
|
|
23
23
|
onChange,
|
|
24
24
|
type = "input",
|
|
25
25
|
valueProps,
|
|
26
|
+
initialValue,
|
|
26
27
|
...restProps
|
|
27
28
|
} = props;
|
|
28
29
|
const inputRef = useRef(null);
|
|
@@ -54,7 +55,7 @@ function EditableCell(props) {
|
|
|
54
55
|
Form.Item,
|
|
55
56
|
{
|
|
56
57
|
style: { margin: 0 },
|
|
57
|
-
initialValue: _.get(record, dataIndex),
|
|
58
|
+
initialValue: initialValue || _.get(record, dataIndex),
|
|
58
59
|
name: dataIndex,
|
|
59
60
|
rules,
|
|
60
61
|
children: renderItem()
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps } from "antd";
|
|
2
3
|
import { ColumnType } from "antd/es/table";
|
|
3
4
|
import { CreateFormProps } from "../CreateForm";
|
|
@@ -13,5 +14,5 @@ export interface SearchTableProps<RecordType> {
|
|
|
13
14
|
searchProps?: CreateFormProps;
|
|
14
15
|
tableProps?: MTableProps<RecordType>;
|
|
15
16
|
}
|
|
16
|
-
declare function SearchTable<RecordType extends object = any>(props: SearchTableProps<RecordType>):
|
|
17
|
+
declare function SearchTable<RecordType extends object = any>(props: SearchTableProps<RecordType>): JSX.Element;
|
|
17
18
|
export default SearchTable;
|
|
@@ -10,5 +10,5 @@ export interface UploadFileProps extends UploadProps {
|
|
|
10
10
|
limit?: number;
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
declare const UploadFile: (props: UploadFileProps) =>
|
|
13
|
+
declare const UploadFile: (props: UploadFileProps) => JSX.Element;
|
|
14
14
|
export default UploadFile;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { EditTableProps } from "../EditTable";
|
|
2
|
-
declare function VirtualTable<DataType extends object = any>(props: EditTableProps<DataType>):
|
|
3
|
+
declare function VirtualTable<DataType extends object = any>(props: EditTableProps<DataType>): JSX.Element;
|
|
3
4
|
export default VirtualTable;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface ChangePwdResolveProps {
|
|
2
|
+
values: any;
|
|
3
|
+
resolve: (value: any) => void;
|
|
4
|
+
reject: (reason?: any) => void;
|
|
5
|
+
}
|
|
6
|
+
interface ChangePwdHookProps {
|
|
7
|
+
title: string;
|
|
8
|
+
}
|
|
9
|
+
export default function useChangePwd(props?: ChangePwdHookProps): {
|
|
10
|
+
handleChangePwd: () => Promise<ChangePwdResolveProps | undefined>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useLockFn } from "ahooks";
|
|
3
|
+
import { App, Form } from "antd";
|
|
4
|
+
import CreateForm from "../components/CreateForm";
|
|
5
|
+
import formRules from "../utils/formRules";
|
|
6
|
+
function useChangePwd(props) {
|
|
7
|
+
const { modal, message } = App.useApp();
|
|
8
|
+
const [form] = Form.useForm();
|
|
9
|
+
const items = [
|
|
10
|
+
{
|
|
11
|
+
dataIndex: "Password",
|
|
12
|
+
title: "新密码",
|
|
13
|
+
valueType: "password",
|
|
14
|
+
valueProps: {
|
|
15
|
+
placeholder: "请输入新密码"
|
|
16
|
+
},
|
|
17
|
+
formItemProps: {
|
|
18
|
+
rules: [{ required: true, message: "请输入新密码" }, formRules.passwordNewRule]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
dataIndex: "NewPassword",
|
|
23
|
+
title: "确认密码",
|
|
24
|
+
valueType: "password",
|
|
25
|
+
valueProps: {
|
|
26
|
+
placeholder: "请输入确认密码"
|
|
27
|
+
},
|
|
28
|
+
formItemProps: {
|
|
29
|
+
rules: [{ required: true, message: "请输入确认密码" }, ({ getFieldValue }) => ({
|
|
30
|
+
validator(_, value) {
|
|
31
|
+
if (!value || getFieldValue("Password") === value) {
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
}
|
|
34
|
+
return Promise.reject(new Error("两次密码输入不一致"));
|
|
35
|
+
}
|
|
36
|
+
})]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
const handleChangePwd = useLockFn(async () => {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
modal.confirm({
|
|
43
|
+
title: (props == null ? void 0 : props.title) || "默认账户及口令(密码),用户登录时需修改默认口令(密码),否则无法登录系统",
|
|
44
|
+
icon: null,
|
|
45
|
+
wrapClassName: "confirmWrapper",
|
|
46
|
+
content: /* @__PURE__ */ jsx(CreateForm, { items, formProps: { form, layout: "vertical", labelCol: { span: 24 }, wrapperCol: { span: 24 } } }),
|
|
47
|
+
onOk() {
|
|
48
|
+
return new Promise((resolve2, reject2) => {
|
|
49
|
+
form.validateFields().then((values) => {
|
|
50
|
+
resolve({ values, resolve: resolve2, reject: reject2 });
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return { handleChangePwd };
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
useChangePwd as default
|
|
61
|
+
};
|
|
@@ -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/es/index.js
CHANGED
package/es/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/es/main.js
CHANGED
|
@@ -8,19 +8,23 @@ import { default as default8 } from "./components/CoralButton";
|
|
|
8
8
|
import { default as default9 } 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 index from "./utils/index";
|
|
13
|
+
import * as verifyCode from "./utils/verify-code";
|
|
14
|
+
import { default as default10 } from "./hooks/useChangePwd";
|
|
13
15
|
export {
|
|
14
16
|
default7 as AuthButton,
|
|
15
17
|
default2 as BackHeader,
|
|
16
18
|
default8 as CoralButton,
|
|
17
19
|
default3 as CreateForm,
|
|
18
20
|
default6 as EditTable,
|
|
21
|
+
formRules as FormRules,
|
|
19
22
|
default4 as SearchTable,
|
|
20
23
|
default5 as UploadFile,
|
|
21
24
|
download,
|
|
22
25
|
filetype as fileType,
|
|
23
26
|
default9 as showWorkFlow,
|
|
27
|
+
default10 as useChangePwd,
|
|
24
28
|
index as utils,
|
|
25
29
|
verifyCode as verfyCode
|
|
26
30
|
};
|
|
@@ -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,57 @@
|
|
|
1
|
+
const formRules = {
|
|
2
|
+
phone: {
|
|
3
|
+
pattern: /^1[3456789]\d{9}$/,
|
|
4
|
+
message: "请输入正确的手机号码"
|
|
5
|
+
},
|
|
6
|
+
telephone: {
|
|
7
|
+
pattern: /^[\d -]+$/,
|
|
8
|
+
message: "请输入正确的电话号码"
|
|
9
|
+
},
|
|
10
|
+
email: {
|
|
11
|
+
pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
|
|
12
|
+
message: "请输入正确的邮箱地址"
|
|
13
|
+
},
|
|
14
|
+
httpUrl: {
|
|
15
|
+
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.,?'\\+&%$#=~_-]+))*$/,
|
|
16
|
+
message: "请输入合法的URL"
|
|
17
|
+
},
|
|
18
|
+
zipCode: {
|
|
19
|
+
pattern: /^[0-9]{6}$/,
|
|
20
|
+
message: "请输入正确的邮政编码"
|
|
21
|
+
},
|
|
22
|
+
specificKey: {
|
|
23
|
+
pattern: /^[\w\u4E00-\u9FA5\uF900-\uFA2D()()]*$/,
|
|
24
|
+
message: "可输入字母、汉字、数字或()"
|
|
25
|
+
},
|
|
26
|
+
inputTextarea: {
|
|
27
|
+
pattern: /^[\w\u4E00-\u9FA5\uF900-\uFA2D-\u3002-\uff1f-\uff01-\uff0c-\u3001-\uff1b-\uff1a]*$/,
|
|
28
|
+
message: "请输入字母、汉字或数字和中文常用字符:?!,、;。"
|
|
29
|
+
},
|
|
30
|
+
backendRestrict: {
|
|
31
|
+
pattern: /^[^'"/\\]*$/,
|
|
32
|
+
message: `不能输入特殊字符\\'/"`
|
|
33
|
+
},
|
|
34
|
+
onetoNinetyNine: {
|
|
35
|
+
pattern: /^[1-9][0-9]{0,1}$/,
|
|
36
|
+
message: `请输入1-99的整数`
|
|
37
|
+
},
|
|
38
|
+
passwordRule: {
|
|
39
|
+
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z0-9]{8,12}$/,
|
|
40
|
+
message: `密码应为字母大小写+数字8-12位组合`
|
|
41
|
+
},
|
|
42
|
+
passwordNewRule: {
|
|
43
|
+
pattern: /^.*(?=.{8,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#¥%&*.()_+~/-]).*$/,
|
|
44
|
+
message: "密码应为字母大小写+数字+常见字符!@#¥%&*.()_+~/- 8-12位组合"
|
|
45
|
+
},
|
|
46
|
+
pureNumber: {
|
|
47
|
+
pattern: /^[1-9][0-9]*$/,
|
|
48
|
+
message: `请输入整数类型`
|
|
49
|
+
},
|
|
50
|
+
onlyBlankRule: {
|
|
51
|
+
pattern: /\S/,
|
|
52
|
+
message: "输入内容不能只有空格"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
formRules as default
|
|
57
|
+
};
|
package/es/utils/verify-code.js
CHANGED
|
@@ -6,19 +6,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
class getGVerify {
|
|
8
8
|
constructor(options) {
|
|
9
|
-
//创建图形验证码
|
|
10
9
|
__publicField(this, "options", {
|
|
11
|
-
//默认值
|
|
12
10
|
id: "",
|
|
13
|
-
//容器Id
|
|
14
11
|
canvasId: "verifyCanvas",
|
|
15
|
-
//canvas的ID
|
|
16
12
|
width: 100,
|
|
17
|
-
//默认canvas宽度
|
|
18
13
|
height: 30,
|
|
19
|
-
//默认canvas高度
|
|
20
14
|
type: "blend",
|
|
21
|
-
//图形验证码默认类型blend:数字字母混合类型、number:纯数字、letter:纯字母
|
|
22
15
|
code: ""
|
|
23
16
|
});
|
|
24
17
|
this.options = options;
|
|
@@ -29,7 +22,6 @@ class getGVerify {
|
|
|
29
22
|
this._init();
|
|
30
23
|
this.refresh();
|
|
31
24
|
}
|
|
32
|
-
/**初始化方法**/
|
|
33
25
|
_init() {
|
|
34
26
|
const con = document.getElementById(this.options.id);
|
|
35
27
|
const canvas = document.createElement("canvas");
|
|
@@ -45,7 +37,6 @@ class getGVerify {
|
|
|
45
37
|
this.refresh();
|
|
46
38
|
};
|
|
47
39
|
}
|
|
48
|
-
/**生成验证码**/
|
|
49
40
|
refresh() {
|
|
50
41
|
this.options.code = "";
|
|
51
42
|
const canvas = document.getElementById(this.options.canvasId);
|
|
@@ -96,7 +87,6 @@ class getGVerify {
|
|
|
96
87
|
ctx.fill();
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
|
-
/**验证验证码**/
|
|
100
90
|
validate(code) {
|
|
101
91
|
const verifyCode = code.toLowerCase();
|
|
102
92
|
const v_code = this.options.code.toLowerCase();
|
|
@@ -106,16 +96,13 @@ class getGVerify {
|
|
|
106
96
|
return false;
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
|
-
/**生成字母数组**/
|
|
110
99
|
getAllLetter() {
|
|
111
100
|
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";
|
|
112
101
|
return letterStr.split(",");
|
|
113
102
|
}
|
|
114
|
-
/**生成一个随机数**/
|
|
115
103
|
randomNum(min, max) {
|
|
116
104
|
return Math.floor(Math.random() * (max - min) + min);
|
|
117
105
|
}
|
|
118
|
-
/**生成一个随机色**/
|
|
119
106
|
randomColor(min, max) {
|
|
120
107
|
const r = this.randomNum(min, max);
|
|
121
108
|
const g = this.randomNum(min, max);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from "antd";
|
|
2
3
|
export interface AuthButtonProps extends ButtonProps {
|
|
3
4
|
auth?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const AuthButton: (props: AuthButtonProps) =>
|
|
6
|
+
declare const AuthButton: (props: AuthButtonProps) => JSX.Element | null;
|
|
6
7
|
export default AuthButton;
|
|
@@ -9,5 +9,5 @@ interface BackHeaderProps {
|
|
|
9
9
|
titleStyle?: CSSProperties;
|
|
10
10
|
level?: 1 | 2 | 3 | 4 | 5;
|
|
11
11
|
}
|
|
12
|
-
declare const BackHeader: (props: BackHeaderProps) =>
|
|
12
|
+
declare const BackHeader: (props: BackHeaderProps) => JSX.Element;
|
|
13
13
|
export default BackHeader;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CaptchaProps {
|
|
3
|
+
style?: React.CSSProperties;
|
|
4
|
+
className?: string;
|
|
5
|
+
api: string;
|
|
6
|
+
}
|
|
7
|
+
declare const Captcha: import("react").ForwardRefExoticComponent<CaptchaProps & import("react").RefAttributes<unknown>>;
|
|
8
|
+
export default Captcha;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const ahooks = require("ahooks");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const request = async (url) => {
|
|
6
|
+
return fetch(url, { method: "post" });
|
|
7
|
+
};
|
|
8
|
+
const Captcha = react.forwardRef((props, ref) => {
|
|
9
|
+
const { style, className, api } = props;
|
|
10
|
+
const [targetDate, setTargetDate] = react.useState();
|
|
11
|
+
const { data, loading, error, refresh } = ahooks.useRequest(() => request(api), {
|
|
12
|
+
ready: api !== void 0
|
|
13
|
+
});
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
if (data) {
|
|
16
|
+
setTargetDate(Date.now() + 5 * 60 * 1e3);
|
|
17
|
+
}
|
|
18
|
+
}, [data]);
|
|
19
|
+
ahooks.useCountDown({
|
|
20
|
+
targetDate,
|
|
21
|
+
onEnd: () => {
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
react.useImperativeHandle(ref, () => ({
|
|
25
|
+
onRefresh: refresh
|
|
26
|
+
}));
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style });
|
|
28
|
+
});
|
|
29
|
+
module.exports = Captcha;
|
|
@@ -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>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from "antd";
|
|
2
3
|
interface AuthProps {
|
|
3
4
|
PId: number;
|
|
@@ -6,5 +7,5 @@ export interface CoralButtonProps extends ButtonProps {
|
|
|
6
7
|
PId: number;
|
|
7
8
|
auths?: AuthProps[];
|
|
8
9
|
}
|
|
9
|
-
declare const CoralButton: (props: CoralButtonProps) =>
|
|
10
|
+
declare const CoralButton: (props: CoralButtonProps) => JSX.Element;
|
|
10
11
|
export default CoralButton;
|
|
@@ -44,12 +44,12 @@ export interface CreateFormProps {
|
|
|
44
44
|
readonly?: boolean;
|
|
45
45
|
hiddenTitle?: boolean;
|
|
46
46
|
}
|
|
47
|
-
declare const CreateForm: (props: CreateFormProps) =>
|
|
47
|
+
declare const CreateForm: (props: CreateFormProps) => JSX.Element;
|
|
48
48
|
interface FormFieldsProps extends Pick<CreateFormItemProps<ValueType>, "valueType" | "valueProps"> {
|
|
49
49
|
onChange?: (e: any) => void;
|
|
50
50
|
value?: any;
|
|
51
51
|
onBtnClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, item: ValueBtnProps) => void;
|
|
52
52
|
inputRef?: any;
|
|
53
53
|
}
|
|
54
|
-
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any
|
|
54
|
+
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<any>;
|
|
55
55
|
export default CreateForm;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import * as echarts from 'echarts/core';
|
|
2
3
|
import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
|
|
3
4
|
import { TitleComponentOption, TooltipComponentOption, GridComponentOption, DatasetComponentOption } from 'echarts/components';
|
|
@@ -9,5 +10,5 @@ export interface EchartsProps {
|
|
|
9
10
|
* @param props : EchartsProps 传入图标配置项
|
|
10
11
|
* 外部包裹一层dom元素定义width和height,内部自动占满
|
|
11
12
|
*/
|
|
12
|
-
declare const Echarts: (props: EchartsProps) =>
|
|
13
|
+
declare const Echarts: (props: EchartsProps) => JSX.Element;
|
|
13
14
|
export default Echarts;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableProps } from "antd";
|
|
2
3
|
import { Rule } from "antd/es/form";
|
|
3
4
|
import { ColumnType } from "antd/es/table";
|
|
@@ -5,6 +6,7 @@ import { ValueProps, ValueType } from "../CreateForm";
|
|
|
5
6
|
export type ColumnsType<RecordType> = ColumnType<RecordType> & {
|
|
6
7
|
editable?: boolean;
|
|
7
8
|
rules?: Rule[];
|
|
9
|
+
initialValue?: any;
|
|
8
10
|
type?: ValueType;
|
|
9
11
|
valueProps?: ValueProps<RecordType>;
|
|
10
12
|
};
|
|
@@ -12,5 +14,5 @@ export interface EditTableProps<RecordType> extends Omit<TableProps<RecordType>,
|
|
|
12
14
|
columns: ColumnsType<RecordType>[];
|
|
13
15
|
onChange?: (row: RecordType) => void;
|
|
14
16
|
}
|
|
15
|
-
declare function EditTable<DataType extends object = any>(props: EditTableProps<DataType>):
|
|
17
|
+
declare function EditTable<DataType extends object = any>(props: EditTableProps<DataType>): JSX.Element;
|
|
16
18
|
export default EditTable;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const antd = require("antd");
|
|
4
|
+
const _ = require("lodash");
|
|
4
5
|
const React = require("react");
|
|
5
6
|
const CreateForm = require("../CreateForm");
|
|
6
|
-
const _ = require("lodash");
|
|
7
7
|
const editableCellValueWrap = "editable-module_editableCellValueWrap_3b3d9";
|
|
8
8
|
const classes = {
|
|
9
9
|
editableCellValueWrap
|
|
@@ -24,6 +24,7 @@ function EditableCell(props) {
|
|
|
24
24
|
onChange,
|
|
25
25
|
type = "input",
|
|
26
26
|
valueProps,
|
|
27
|
+
initialValue,
|
|
27
28
|
...restProps
|
|
28
29
|
} = props;
|
|
29
30
|
const inputRef = React.useRef(null);
|
|
@@ -55,7 +56,7 @@ function EditableCell(props) {
|
|
|
55
56
|
antd.Form.Item,
|
|
56
57
|
{
|
|
57
58
|
style: { margin: 0 },
|
|
58
|
-
initialValue: _.get(record, dataIndex),
|
|
59
|
+
initialValue: initialValue || _.get(record, dataIndex),
|
|
59
60
|
name: dataIndex,
|
|
60
61
|
rules,
|
|
61
62
|
children: renderItem()
|