@banmao/blocks 0.0.1-alpha.2 → 0.0.1-alpha.4
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/README.md +16 -37
- package/dist/components/Login/index.d.ts +3 -0
- package/dist/components/Login/src/components/LoginForm.d.ts +70 -0
- package/dist/components/Login/src/index.d.ts +94 -0
- package/dist/components/Login/src/types.d.ts +110 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +194 -120
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# @banmao/
|
|
1
|
+
# @banmao/blocks
|
|
2
2
|
|
|
3
|
-
基于 Naive UI
|
|
3
|
+
基于 Naive UI 封装的登录组件。
|
|
4
4
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
@@ -12,52 +12,31 @@
|
|
|
12
12
|
## 安装
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
# 安装
|
|
16
|
-
pnpm add
|
|
17
|
-
|
|
18
|
-
# 安装 @banmao/procomponent
|
|
19
|
-
pnpm add @banmao/procomponent
|
|
15
|
+
# 安装 @banmao/blocks
|
|
16
|
+
pnpm add @banmao/blocks
|
|
20
17
|
```
|
|
21
18
|
|
|
22
19
|
## 使用
|
|
23
20
|
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const app = createApp()
|
|
35
|
-
|
|
36
|
-
// 注册需要使用的组件
|
|
37
|
-
app.use(ProLayout)
|
|
38
|
-
app.use(ProTable)
|
|
39
|
-
app.use(ProForm)
|
|
40
|
-
app.use(DrawerForm)
|
|
41
|
-
app.use(ModalForm)
|
|
21
|
+
```vue
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { Login } from '@banmao/blocks'
|
|
24
|
+
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<Login />
|
|
29
|
+
</template>
|
|
42
30
|
```
|
|
43
31
|
|
|
44
32
|
## 组件列表
|
|
45
33
|
|
|
46
|
-
-
|
|
47
|
-
- ModalForm - 弹窗表单组件
|
|
48
|
-
- ProForm - 表单组件
|
|
49
|
-
- ProLayout - 布局组件
|
|
50
|
-
- ProTable - 表格组件
|
|
51
|
-
- ProText - 文本组件
|
|
52
|
-
- ProDescriptions - 描述列表组件
|
|
53
|
-
- ProList - 列表组件
|
|
54
|
-
- Tour - 漫游式引导组件
|
|
55
|
-
- Watermark - 水印组件
|
|
34
|
+
- Login - 登录表单组件
|
|
56
35
|
|
|
57
36
|
## 文档
|
|
58
37
|
|
|
59
|
-
访问 [ProComponent 文档](https://procomponent.banmao.cc/) 了解更多使用细节。
|
|
38
|
+
访问 [ProComponent 文档](https://procomponent.banmao.cc/blocks) 了解更多使用细节。
|
|
60
39
|
|
|
61
40
|
## License
|
|
62
41
|
|
|
63
|
-
[MIT](./LICENSE)
|
|
42
|
+
[MIT](./LICENSE)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
2
|
+
title: {
|
|
3
|
+
type: PropType<LoginProps["title"]>;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
subTitle: {
|
|
7
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
forgotUrl: {
|
|
11
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
signUpUrl: {
|
|
15
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
radius: {
|
|
19
|
+
type: (BooleanConstructor | NumberConstructor)[];
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
22
|
+
shadow: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
actions: {
|
|
27
|
+
type: PropType<LoginProps["actions"]>;
|
|
28
|
+
};
|
|
29
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, (keyof globalThis.LoginEmits)[], keyof globalThis.LoginEmits, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
30
|
+
title: {
|
|
31
|
+
type: PropType<LoginProps["title"]>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
subTitle: {
|
|
35
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
forgotUrl: {
|
|
39
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
signUpUrl: {
|
|
43
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
radius: {
|
|
47
|
+
type: (BooleanConstructor | NumberConstructor)[];
|
|
48
|
+
default: number;
|
|
49
|
+
};
|
|
50
|
+
shadow: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: boolean;
|
|
53
|
+
};
|
|
54
|
+
actions: {
|
|
55
|
+
type: PropType<LoginProps["actions"]>;
|
|
56
|
+
};
|
|
57
|
+
}>> & Readonly<{
|
|
58
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
59
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
60
|
+
onCaptcha?: ((...args: any[]) => any) | undefined;
|
|
61
|
+
onWechatFinish?: ((...args: any[]) => any) | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
title: string | undefined;
|
|
64
|
+
subTitle: string | undefined;
|
|
65
|
+
forgotUrl: string | undefined;
|
|
66
|
+
signUpUrl: string | undefined;
|
|
67
|
+
radius: number | boolean;
|
|
68
|
+
shadow: boolean;
|
|
69
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
70
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
|
|
2
|
+
title: {
|
|
3
|
+
type: PropType<LoginProps["title"]>;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
subTitle: {
|
|
7
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
layout: {
|
|
11
|
+
type: PropType<LoginProps["layout"]>;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
bg: {
|
|
15
|
+
type: PropType<LoginProps["bg"]>;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
forgotUrl: {
|
|
19
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
signUpUrl: {
|
|
23
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
bgImageUrl: {
|
|
27
|
+
type: PropType<LoginProps["bgImageUrl"]>;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
logo: {
|
|
31
|
+
type: PropType<LoginProps["logo"]>;
|
|
32
|
+
};
|
|
33
|
+
imagePosition: {
|
|
34
|
+
type: PropType<LoginProps["imagePosition"]>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
actions: {
|
|
38
|
+
type: PropType<LoginProps["actions"]>;
|
|
39
|
+
};
|
|
40
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, (keyof globalThis.LoginEmits)[], keyof globalThis.LoginEmits, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
41
|
+
title: {
|
|
42
|
+
type: PropType<LoginProps["title"]>;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
subTitle: {
|
|
46
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
49
|
+
layout: {
|
|
50
|
+
type: PropType<LoginProps["layout"]>;
|
|
51
|
+
default: string;
|
|
52
|
+
};
|
|
53
|
+
bg: {
|
|
54
|
+
type: PropType<LoginProps["bg"]>;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
forgotUrl: {
|
|
58
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
59
|
+
default: string;
|
|
60
|
+
};
|
|
61
|
+
signUpUrl: {
|
|
62
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
bgImageUrl: {
|
|
66
|
+
type: PropType<LoginProps["bgImageUrl"]>;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
logo: {
|
|
70
|
+
type: PropType<LoginProps["logo"]>;
|
|
71
|
+
};
|
|
72
|
+
imagePosition: {
|
|
73
|
+
type: PropType<LoginProps["imagePosition"]>;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
actions: {
|
|
77
|
+
type: PropType<LoginProps["actions"]>;
|
|
78
|
+
};
|
|
79
|
+
}>> & Readonly<{
|
|
80
|
+
onFinish?: ((...args: any[]) => any) | undefined;
|
|
81
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
82
|
+
onCaptcha?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
onWechatFinish?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
}>, {
|
|
85
|
+
title: string | undefined;
|
|
86
|
+
subTitle: string | undefined;
|
|
87
|
+
layout: globalThis.LoginLayout | undefined;
|
|
88
|
+
bg: string | undefined;
|
|
89
|
+
forgotUrl: string | undefined;
|
|
90
|
+
signUpUrl: string | undefined;
|
|
91
|
+
bgImageUrl: string | undefined;
|
|
92
|
+
imagePosition: "left" | "right" | undefined;
|
|
93
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
94
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { PropType, VNodeChild } from 'vue';
|
|
2
|
+
export type LoginLayout = "simple" | "column" | "muted" | "card";
|
|
3
|
+
export interface Action {
|
|
4
|
+
name: "Weixin";
|
|
5
|
+
label: string;
|
|
6
|
+
config: Record<string, any>;
|
|
7
|
+
}
|
|
8
|
+
export interface LoginProps {
|
|
9
|
+
/**
|
|
10
|
+
* 登录页方式,默认为 simple
|
|
11
|
+
* - simple: 一个简单的登录样式,表单居中,无背景图片
|
|
12
|
+
* - column: 两列布局的登录页面,需要配合 bg 属性
|
|
13
|
+
* - muted: 在简单样式基础上,使用柔和的颜色作为背景图,需要配合 bg 属性
|
|
14
|
+
* - card: 以卡片的形式展示两列布局的登录布局,需要配合 bg 属性
|
|
15
|
+
*/
|
|
16
|
+
layout?: LoginLayout;
|
|
17
|
+
/** 登录页的背景图,仅当 layout = column 或 card */
|
|
18
|
+
bg?: string;
|
|
19
|
+
/** 登录页的描述语,默认为 Login to your account */
|
|
20
|
+
subTitle?: string;
|
|
21
|
+
/** title 登录页标题, 默认为 Welcome back */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** 忘记登录密码,当设置了忘记登录密码,显示 "忘记密码?" 超链接 */
|
|
24
|
+
forgotUrl?: string;
|
|
25
|
+
/** 立即注册的地址,默认为 /signup */
|
|
26
|
+
signUpUrl?: string;
|
|
27
|
+
/** 授权登录 */
|
|
28
|
+
actions?: Action[];
|
|
29
|
+
bgImageUrl?: string;
|
|
30
|
+
logo?: () => VNodeChild;
|
|
31
|
+
imagePosition?: 'left' | 'right';
|
|
32
|
+
}
|
|
33
|
+
export interface LoginEmits {
|
|
34
|
+
/** 表单登录提交 */
|
|
35
|
+
finish: (values: Record<string, string>) => void;
|
|
36
|
+
error: (error: any) => void;
|
|
37
|
+
captcha: () => Record<string, string>;
|
|
38
|
+
wechatFinish: (values: Record<string, any>) => void;
|
|
39
|
+
}
|
|
40
|
+
export type LoginEmitsType = keyof LoginEmits;
|
|
41
|
+
export declare const loginEmits: LoginEmitsType[];
|
|
42
|
+
export declare const loginProps: {
|
|
43
|
+
title: {
|
|
44
|
+
type: PropType<LoginProps["title"]>;
|
|
45
|
+
default: string;
|
|
46
|
+
};
|
|
47
|
+
subTitle: {
|
|
48
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
49
|
+
default: string;
|
|
50
|
+
};
|
|
51
|
+
layout: {
|
|
52
|
+
type: PropType<LoginProps["layout"]>;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
bg: {
|
|
56
|
+
type: PropType<LoginProps["bg"]>;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
forgotUrl: {
|
|
60
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
signUpUrl: {
|
|
64
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
bgImageUrl: {
|
|
68
|
+
type: PropType<LoginProps["bgImageUrl"]>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
logo: {
|
|
72
|
+
type: PropType<LoginProps["logo"]>;
|
|
73
|
+
};
|
|
74
|
+
imagePosition: {
|
|
75
|
+
type: PropType<LoginProps["imagePosition"]>;
|
|
76
|
+
default: string;
|
|
77
|
+
};
|
|
78
|
+
actions: {
|
|
79
|
+
type: PropType<LoginProps["actions"]>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare const loginFormProps: {
|
|
83
|
+
title: {
|
|
84
|
+
type: PropType<LoginProps["title"]>;
|
|
85
|
+
default: string;
|
|
86
|
+
};
|
|
87
|
+
subTitle: {
|
|
88
|
+
type: PropType<LoginProps["subTitle"]>;
|
|
89
|
+
default: string;
|
|
90
|
+
};
|
|
91
|
+
forgotUrl: {
|
|
92
|
+
type: PropType<LoginProps["forgotUrl"]>;
|
|
93
|
+
default: string;
|
|
94
|
+
};
|
|
95
|
+
signUpUrl: {
|
|
96
|
+
type: PropType<LoginProps["signUpUrl"]>;
|
|
97
|
+
default: string;
|
|
98
|
+
};
|
|
99
|
+
radius: {
|
|
100
|
+
type: (BooleanConstructor | NumberConstructor)[];
|
|
101
|
+
default: number;
|
|
102
|
+
};
|
|
103
|
+
shadow: {
|
|
104
|
+
type: BooleanConstructor;
|
|
105
|
+
default: boolean;
|
|
106
|
+
};
|
|
107
|
+
actions: {
|
|
108
|
+
type: PropType<LoginProps["actions"]>;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Login';
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require('./index.css');"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),
|
|
1
|
+
require('./index.css');"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("naive-ui"),w=["finish","error","captcha","wechatFinish"],I={title:{type:String,default:"Welcome back"},subTitle:{type:String,default:"Login to your account"},layout:{type:String,default:"simple"},bg:{type:String,default:""},forgotUrl:{type:String,default:""},signUpUrl:{type:String,default:""},bgImageUrl:{type:String,default:""},logo:{type:Function},imagePosition:{type:String,default:"right"},actions:{type:Array}},S={title:{type:String,default:"Welcome back"},subTitle:{type:String,default:"Login to your account"},forgotUrl:{type:String,default:""},signUpUrl:{type:String,default:""},radius:{type:[Number,Boolean],default:8},shadow:{type:Boolean,default:!0},actions:{type:Array}},f=e.defineComponent({name:"LoginForm",props:S,emits:w,setup(r,{emit:l,slots:a}){const{actions:g,title:U,subTitle:d,signUpUrl:y,forgotUrl:c,shadow:s,radius:N}=r,i=e.reactive({username:"",password:""}),p=e.ref(!1),v={username:[{required:!0,message:"请输入用户名",trigger:"blur"},{min:3,max:10,message:"长度在 3 到 10 个字符",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:6,max:20,message:"长度在 6 到 20 个字符",trigger:"blur"}]},V=e.ref(null),h=()=>{var t;(t=V.value)==null||t.validate(m=>{m?(console.error(m),l("error",m)):l("finish",e.toRaw(i))})},b=()=>{console.error("Weixin login is not supported yet."),l("wechatFinish")};return()=>e.createVNode("div",{class:["login-form",{"login-form-shadow":s}],style:[{borderRadius:N?`${N}px`:"none"}]},[e.createVNode("div",{class:"title"},[U]),e.createVNode("div",{class:"sub-title"},[d]),a.default?a.default():e.createVNode(o.NForm,{ref:V,model:i,rules:v,size:"large","show-require-mark":!1},{default:()=>[e.createVNode(o.NFormItem,{label:"用户名",path:"username"},{default:()=>[e.createVNode(o.NInput,{value:i.username,"onUpdate:value":t=>i.username=t,placeholder:"请输入用户名"},null)]}),e.createVNode(o.NFormItem,{label:"密码",path:"password"},{default:()=>[e.createVNode(o.NInput,{value:i.password,"onUpdate:value":t=>i.password=t,placeholder:"请输入密码",type:"password"},null)]}),e.createVNode("div",{class:"password-forgot"},[e.createVNode(o.NCheckbox,{checked:p.value,"onUpdate:checked":t=>p.value=t,label:"记住密码"},null),c&&e.createVNode("a",{href:c},[e.createTextVNode("忘记密码?")])]),e.createVNode(o.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(o.NButton,{"attr-type":"button",type:"primary",block:!0,onClick:()=>h()},{default:()=>[e.createTextVNode("登录")]})]}),g&&e.createVNode(o.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(o.NButton,{color:"#02E16E",ghost:!0,block:!0,onClick:()=>b()},{default:()=>[e.createTextVNode("微信登录")]})]})]}),y&&e.createVNode("div",{class:"signUp"},[e.createTextVNode("还没有账号?"),e.createVNode("a",{href:y},[e.createTextVNode("立即注册")])])])}});function x(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!e.isVNode(r)}const P=e.defineComponent({name:"LoginPage",props:I,emits:w,setup(r,{emit:l,slots:a}){const{layout:g,bg:U,bgImageUrl:d,logo:y,...c}=r,s=e.computed(()=>r.imagePosition==="right");return()=>{var N,i,p,v,V,h,b,t,m;if((N=a.default)!=null&&N.call(a),console.log(a.default),a.default){let u;if(g==="column"){let n;return e.createVNode("div",{class:["container","column",{"column-reverse":r.imagePosition==="left"}]},[e.createVNode("div",{class:"column-item"},[s.value&&e.createVNode("div",{class:"logo"},[(i=a.logo)==null?void 0:i.call(a)]),e.createVNode(f,e.mergeProps(c,{shadow:!1,radius:!1,onFinish:F=>l("finish",F)}),x(n=a.default())?n:{default:()=>[n]})]),e.createVNode("div",{class:"column-muted"},[!s.value&&e.createVNode("div",{class:"logo"},[(p=a.logo)==null?void 0:p.call(a)]),r.bgImageUrl&&e.createVNode("img",{src:r.bgImageUrl,alt:"Image",class:"column-muted-image"},null)])])}if(g==="card"){let n;return e.createVNode("div",{class:["container","flex-center"]},[e.createVNode("div",{class:"logo"},[(v=a.logo)==null?void 0:v.call(a)]),e.createVNode("div",{class:"card"},[e.createVNode("div",{class:["card-column-item","flex-1"]},[e.createVNode(f,e.mergeProps(c,{shadow:!1,radius:!1,onFinish:F=>l("finish",F)}),x(n=a.default())?n:{default:()=>[n]})]),e.createVNode("div",{class:["card-column-muted","flex-1"],style:{width:"350px"}},[d&&e.createVNode("img",{src:d,alt:"Image",class:"column-muted-image"},null)])])])}return e.createVNode("div",{class:["container","flex-center"],style:{backgroundImage:`url(${d})`,backgroundSize:"cover"}},[e.createVNode("div",{class:["flex-col","space-y-4"]},[(V=a.logo)==null?void 0:V.call(a),e.createVNode(f,e.mergeProps(c,{onFinish:n=>l("finish",n)}),x(u=a.default())?u:{default:()=>[u]})])])}else return g==="column"?e.createVNode("div",{class:["container","column",{"column-reverse":r.imagePosition==="left"}]},[e.createVNode("div",{class:"column-item"},[s.value&&e.createVNode("div",{class:"logo"},[(h=a.logo)==null?void 0:h.call(a)]),e.createVNode(f,e.mergeProps(c,{shadow:!1,radius:!1,onFinish:u=>l("finish",u)}),null)]),e.createVNode("div",{class:"column-muted"},[!s.value&&e.createVNode("div",{class:"logo"},[(b=a.logo)==null?void 0:b.call(a)]),r.bgImageUrl&&e.createVNode("img",{src:r.bgImageUrl,alt:"Image",class:"column-muted-image"},null)])]):g==="card"?e.createVNode("div",{class:["container","flex-center"]},[e.createVNode("div",{class:"logo"},[(t=a.logo)==null?void 0:t.call(a)]),e.createVNode("div",{class:"card"},[e.createVNode("div",{class:["card-column-item","flex-1"]},[e.createVNode(f,e.mergeProps(c,{shadow:!1,radius:!1,onFinish:u=>l("finish",u)}),null)]),e.createVNode("div",{class:["card-column-muted","flex-1"],style:{width:"350px"}},[d&&e.createVNode("img",{src:d,alt:"Image",class:"column-muted-image"},null)])])]):e.createVNode("div",{class:["container","flex-center"],style:{backgroundImage:`url(${d})`,backgroundSize:"cover"}},[e.createVNode("div",{class:["flex-col","space-y-4"]},[(m=a.logo)==null?void 0:m.call(a),e.createVNode(f,c,null)])])}}});exports.Login=P;exports.loginEmits=w;exports.loginFormProps=S;exports.loginProps=I;
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.container{position:relative;width:100%;height:100svh}.flex-center{display:flex;align-items:center;justify-content:center}.flex-col{display:flex;flex-direction:column;justify-content:center;align-items:center}.space-y-4{gap:16px}.login-form{padding:32px 32px 24px;min-width:350px;background:#fffc;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-sizing:border-box}.card .login-form{width:100%}.column .login-form,.dark .column .login-form{background:transparent}
|
|
1
|
+
:root{--color-link: #2563eb;--color-text: #f4f4f5;--color-section-text: #e4e4e7}.container{position:relative;width:100%;height:100svh}.flex-center{display:flex;align-items:center;justify-content:center}.flex-col{display:flex;flex-direction:column;justify-content:center;align-items:center}.space-y-4{gap:16px}.login-form{padding:32px 32px 24px;min-width:350px;background:#fffc;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-sizing:border-box}.card .login-form{width:100%}.column .login-form,.dark .column .login-form{background:transparent}.login-form-shadow{box-shadow:0 2px 12px #0000001a}.title{font-size:20px;font-weight:700;color:var(--color-text)}.sub-title{font-size:16px;color:var(--color-section-text);margin-bottom:32px}.signUp{text-align:center;color:var(--color-text)}.signUp a,.link{color:var(--color-link);text-decoration:none}.password-forgot{width:100%;display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.password-forgot a{color:var(--color-link);text-decoration:none}.column,.grid{display:grid}.column-reverse{direction:rtl}.column-reverse>*{direction:ltr}.card{width:100%;max-width:48rem;display:flex;box-sizing:border-box;box-shadow:0 2px 12px #0000001a;border-radius:.5rem;overflow:hidden}.card-column-item{display:flex;flex-direction:column;justify-content:center;align-items:center}.card-column-muted{width:100%;position:relative;display:none;background-color:#27272a}.flex-1{flex:1}.logo{position:absolute;top:20px;left:20px;z-index:inherit;height:64px;min-width:64px}.column-item{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1rem}.column-muted{width:100%;position:relative;display:none;background-color:#27272a}.column-muted-image{position:absolute;top:0;right:0;bottom:0;left:0;height:100%;width:100%;object-fit:cover}@media screen and (max-width: 1199px){.column-item{padding:40px}}@media screen and (max-width: 1200){.card{max-width:24rem}}@media screen and (min-width: 1200px){.column{grid-template-columns:repeat(2,minmax(0,1fr))}.column-muted,.card-column-muted{display:block}}.dark .column-muted-image{filter:brightness(.2)}.dark .column-muted-image{filter:grayscale(40%)}.dark .login-form{background-color:#0006}@media (prefers-color-scheme: light){:root{--color-text: #333;--color-section-text: #4f4f4f}.login-form{background:#fffc}.sub-title{color:var(--color-section-text)}}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import './index.css';import { defineComponent as
|
|
2
|
-
import { NForm as
|
|
3
|
-
const
|
|
1
|
+
import './index.css';import { defineComponent as N, reactive as E, ref as B, createVNode as e, createTextVNode as v, toRaw as A, computed as D, mergeProps as b, isVNode as W } from "vue";
|
|
2
|
+
import { NForm as R, NFormItem as x, NInput as C, NCheckbox as T, NButton as L } from "naive-ui";
|
|
3
|
+
const P = ["finish", "error", "captcha", "wechatFinish"], _ = {
|
|
4
4
|
title: {
|
|
5
5
|
type: String,
|
|
6
6
|
default: "Welcome back"
|
|
@@ -39,7 +39,7 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
39
39
|
actions: {
|
|
40
40
|
type: Array
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, j = {
|
|
43
43
|
title: {
|
|
44
44
|
type: String,
|
|
45
45
|
default: "Welcome back"
|
|
@@ -67,25 +67,26 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
67
67
|
actions: {
|
|
68
68
|
type: Array
|
|
69
69
|
}
|
|
70
|
-
},
|
|
70
|
+
}, m = /* @__PURE__ */ N({
|
|
71
71
|
name: "LoginForm",
|
|
72
|
-
props:
|
|
73
|
-
emits:
|
|
74
|
-
setup(
|
|
75
|
-
emit:
|
|
72
|
+
props: j,
|
|
73
|
+
emits: P,
|
|
74
|
+
setup(l, {
|
|
75
|
+
emit: r,
|
|
76
|
+
slots: a
|
|
76
77
|
}) {
|
|
77
78
|
const {
|
|
78
|
-
actions:
|
|
79
|
-
title:
|
|
80
|
-
subTitle:
|
|
81
|
-
signUpUrl:
|
|
82
|
-
forgotUrl:
|
|
83
|
-
shadow:
|
|
84
|
-
radius:
|
|
85
|
-
} =
|
|
79
|
+
actions: d,
|
|
80
|
+
title: k,
|
|
81
|
+
subTitle: o,
|
|
82
|
+
signUpUrl: U,
|
|
83
|
+
forgotUrl: u,
|
|
84
|
+
shadow: g,
|
|
85
|
+
radius: f
|
|
86
|
+
} = l, n = E({
|
|
86
87
|
username: "",
|
|
87
88
|
password: ""
|
|
88
|
-
}),
|
|
89
|
+
}), p = B(!1), y = {
|
|
89
90
|
username: [{
|
|
90
91
|
required: !0,
|
|
91
92
|
message: "请输入用户名",
|
|
@@ -106,161 +107,234 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
106
107
|
message: "长度在 6 到 20 个字符",
|
|
107
108
|
trigger: "blur"
|
|
108
109
|
}]
|
|
109
|
-
},
|
|
110
|
-
var
|
|
111
|
-
(
|
|
112
|
-
|
|
110
|
+
}, h = B(null), F = () => {
|
|
111
|
+
var i;
|
|
112
|
+
(i = h.value) == null || i.validate((s) => {
|
|
113
|
+
s ? (console.error(s), r("error", s)) : r("finish", A(n));
|
|
113
114
|
});
|
|
114
|
-
},
|
|
115
|
-
console.error("Weixin login is not supported yet."),
|
|
115
|
+
}, w = () => {
|
|
116
|
+
console.error("Weixin login is not supported yet."), r("wechatFinish");
|
|
116
117
|
};
|
|
117
118
|
return () => e("div", {
|
|
118
119
|
class: ["login-form", {
|
|
119
|
-
"login-form-shadow":
|
|
120
|
+
"login-form-shadow": g
|
|
120
121
|
}],
|
|
121
122
|
style: [{
|
|
122
|
-
borderRadius:
|
|
123
|
+
borderRadius: f ? `${f}px` : "none"
|
|
123
124
|
}]
|
|
124
125
|
}, [e("div", {
|
|
125
126
|
class: "title"
|
|
126
|
-
}, [
|
|
127
|
+
}, [k]), e("div", {
|
|
127
128
|
class: "sub-title"
|
|
128
|
-
}, [
|
|
129
|
-
ref:
|
|
130
|
-
model:
|
|
131
|
-
rules:
|
|
129
|
+
}, [o]), a.default ? a.default() : e(R, {
|
|
130
|
+
ref: h,
|
|
131
|
+
model: n,
|
|
132
|
+
rules: y,
|
|
132
133
|
size: "large",
|
|
133
134
|
"show-require-mark": !1
|
|
134
135
|
}, {
|
|
135
|
-
default: () => [e(
|
|
136
|
+
default: () => [e(x, {
|
|
136
137
|
label: "用户名",
|
|
137
138
|
path: "username"
|
|
138
139
|
}, {
|
|
139
|
-
default: () => [e(
|
|
140
|
-
value:
|
|
141
|
-
"onUpdate:value": (
|
|
140
|
+
default: () => [e(C, {
|
|
141
|
+
value: n.username,
|
|
142
|
+
"onUpdate:value": (i) => n.username = i,
|
|
142
143
|
placeholder: "请输入用户名"
|
|
143
144
|
}, null)]
|
|
144
|
-
}), e(
|
|
145
|
+
}), e(x, {
|
|
145
146
|
label: "密码",
|
|
146
147
|
path: "password"
|
|
147
148
|
}, {
|
|
148
|
-
default: () => [e(
|
|
149
|
-
value:
|
|
150
|
-
"onUpdate:value": (
|
|
149
|
+
default: () => [e(C, {
|
|
150
|
+
value: n.password,
|
|
151
|
+
"onUpdate:value": (i) => n.password = i,
|
|
151
152
|
placeholder: "请输入密码",
|
|
152
153
|
type: "password"
|
|
153
154
|
}, null)]
|
|
154
155
|
}), e("div", {
|
|
155
156
|
class: "password-forgot"
|
|
156
|
-
}, [e(
|
|
157
|
-
checked:
|
|
158
|
-
"onUpdate:checked": (
|
|
157
|
+
}, [e(T, {
|
|
158
|
+
checked: p.value,
|
|
159
|
+
"onUpdate:checked": (i) => p.value = i,
|
|
159
160
|
label: "记住密码"
|
|
160
|
-
}, null),
|
|
161
|
-
href:
|
|
162
|
-
}, [
|
|
161
|
+
}, null), u && e("a", {
|
|
162
|
+
href: u
|
|
163
|
+
}, [v("忘记密码?")])]), e(x, {
|
|
163
164
|
showLabel: !1
|
|
164
165
|
}, {
|
|
165
|
-
default: () => [e(
|
|
166
|
+
default: () => [e(L, {
|
|
166
167
|
"attr-type": "button",
|
|
167
168
|
type: "primary",
|
|
168
169
|
block: !0,
|
|
169
|
-
onClick: () =>
|
|
170
|
+
onClick: () => F()
|
|
170
171
|
}, {
|
|
171
|
-
default: () => [
|
|
172
|
+
default: () => [v("登录")]
|
|
172
173
|
})]
|
|
173
|
-
}),
|
|
174
|
+
}), d && e(x, {
|
|
174
175
|
showLabel: !1
|
|
175
176
|
}, {
|
|
176
|
-
default: () => [e(
|
|
177
|
+
default: () => [e(L, {
|
|
177
178
|
color: "#02E16E",
|
|
178
179
|
ghost: !0,
|
|
179
180
|
block: !0,
|
|
180
|
-
onClick: () =>
|
|
181
|
+
onClick: () => w()
|
|
181
182
|
}, {
|
|
182
|
-
default: () => [
|
|
183
|
+
default: () => [v("微信登录")]
|
|
183
184
|
})]
|
|
184
185
|
})]
|
|
185
|
-
}),
|
|
186
|
+
}), U && e("div", {
|
|
186
187
|
class: "signUp"
|
|
187
|
-
}, [
|
|
188
|
-
href:
|
|
189
|
-
}, [
|
|
188
|
+
}, [v("还没有账号?"), e("a", {
|
|
189
|
+
href: U
|
|
190
|
+
}, [v("立即注册")])])]);
|
|
190
191
|
}
|
|
191
|
-
})
|
|
192
|
+
});
|
|
193
|
+
function I(l) {
|
|
194
|
+
return typeof l == "function" || Object.prototype.toString.call(l) === "[object Object]" && !W(l);
|
|
195
|
+
}
|
|
196
|
+
const V = /* @__PURE__ */ N({
|
|
192
197
|
name: "LoginPage",
|
|
193
|
-
props:
|
|
194
|
-
emits:
|
|
195
|
-
setup(
|
|
196
|
-
emit:
|
|
198
|
+
props: _,
|
|
199
|
+
emits: P,
|
|
200
|
+
setup(l, {
|
|
201
|
+
emit: r,
|
|
197
202
|
slots: a
|
|
198
203
|
}) {
|
|
199
204
|
const {
|
|
200
|
-
layout:
|
|
201
|
-
bg:
|
|
202
|
-
bgImageUrl:
|
|
203
|
-
logo:
|
|
204
|
-
...
|
|
205
|
-
} =
|
|
205
|
+
layout: d,
|
|
206
|
+
bg: k,
|
|
207
|
+
bgImageUrl: o,
|
|
208
|
+
logo: U,
|
|
209
|
+
...u
|
|
210
|
+
} = l, g = D(() => l.imagePosition === "right");
|
|
206
211
|
return () => {
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
class: ["card-column-item", "flex-1"]
|
|
236
|
-
}, [e(b, w(i, {
|
|
237
|
-
shadow: !1,
|
|
238
|
-
radius: !1,
|
|
239
|
-
onFinish: (d) => o("finish", d)
|
|
240
|
-
}), null)]), e("div", {
|
|
241
|
-
class: ["card-column-muted", "flex-1"],
|
|
242
|
-
style: {
|
|
243
|
-
width: "350px"
|
|
212
|
+
var f, n, p, y, h, F, w, i, s;
|
|
213
|
+
if ((f = a.default) != null && f.call(a), console.log(a.default), a.default) {
|
|
214
|
+
let c;
|
|
215
|
+
if (d === "column") {
|
|
216
|
+
let t;
|
|
217
|
+
return e("div", {
|
|
218
|
+
class: ["container", "column", {
|
|
219
|
+
"column-reverse": l.imagePosition === "left"
|
|
220
|
+
}]
|
|
221
|
+
}, [e("div", {
|
|
222
|
+
class: "column-item"
|
|
223
|
+
}, [g.value && e("div", {
|
|
224
|
+
class: "logo"
|
|
225
|
+
}, [(n = a.logo) == null ? void 0 : n.call(a)]), e(m, b(u, {
|
|
226
|
+
shadow: !1,
|
|
227
|
+
radius: !1,
|
|
228
|
+
onFinish: (S) => r("finish", S)
|
|
229
|
+
}), I(t = a.default()) ? t : {
|
|
230
|
+
default: () => [t]
|
|
231
|
+
})]), e("div", {
|
|
232
|
+
class: "column-muted"
|
|
233
|
+
}, [!g.value && e("div", {
|
|
234
|
+
class: "logo"
|
|
235
|
+
}, [(p = a.logo) == null ? void 0 : p.call(a)]), l.bgImageUrl && e("img", {
|
|
236
|
+
src: l.bgImageUrl,
|
|
237
|
+
alt: "Image",
|
|
238
|
+
class: "column-muted-image"
|
|
239
|
+
}, null)])]);
|
|
244
240
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
if (d === "card") {
|
|
242
|
+
let t;
|
|
243
|
+
return e("div", {
|
|
244
|
+
class: ["container", "flex-center"]
|
|
245
|
+
}, [e("div", {
|
|
246
|
+
class: "logo"
|
|
247
|
+
}, [(y = a.logo) == null ? void 0 : y.call(a)]), e("div", {
|
|
248
|
+
class: "card"
|
|
249
|
+
}, [e("div", {
|
|
250
|
+
class: ["card-column-item", "flex-1"]
|
|
251
|
+
}, [e(m, b(u, {
|
|
252
|
+
shadow: !1,
|
|
253
|
+
radius: !1,
|
|
254
|
+
onFinish: (S) => r("finish", S)
|
|
255
|
+
}), I(t = a.default()) ? t : {
|
|
256
|
+
default: () => [t]
|
|
257
|
+
})]), e("div", {
|
|
258
|
+
class: ["card-column-muted", "flex-1"],
|
|
259
|
+
style: {
|
|
260
|
+
width: "350px"
|
|
261
|
+
}
|
|
262
|
+
}, [o && e("img", {
|
|
263
|
+
src: o,
|
|
264
|
+
alt: "Image",
|
|
265
|
+
class: "column-muted-image"
|
|
266
|
+
}, null)])])]);
|
|
254
267
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
268
|
+
return e("div", {
|
|
269
|
+
class: ["container", "flex-center"],
|
|
270
|
+
style: {
|
|
271
|
+
backgroundImage: `url(${o})`,
|
|
272
|
+
backgroundSize: "cover"
|
|
273
|
+
}
|
|
274
|
+
}, [e("div", {
|
|
275
|
+
class: ["flex-col", "space-y-4"]
|
|
276
|
+
}, [(h = a.logo) == null ? void 0 : h.call(a), e(m, b(u, {
|
|
277
|
+
onFinish: (t) => r("finish", t)
|
|
278
|
+
}), I(c = a.default()) ? c : {
|
|
279
|
+
default: () => [c]
|
|
280
|
+
})])]);
|
|
281
|
+
} else
|
|
282
|
+
return d === "column" ? e("div", {
|
|
283
|
+
class: ["container", "column", {
|
|
284
|
+
"column-reverse": l.imagePosition === "left"
|
|
285
|
+
}]
|
|
286
|
+
}, [e("div", {
|
|
287
|
+
class: "column-item"
|
|
288
|
+
}, [g.value && e("div", {
|
|
289
|
+
class: "logo"
|
|
290
|
+
}, [(F = a.logo) == null ? void 0 : F.call(a)]), e(m, b(u, {
|
|
291
|
+
shadow: !1,
|
|
292
|
+
radius: !1,
|
|
293
|
+
onFinish: (c) => r("finish", c)
|
|
294
|
+
}), null)]), e("div", {
|
|
295
|
+
class: "column-muted"
|
|
296
|
+
}, [!g.value && e("div", {
|
|
297
|
+
class: "logo"
|
|
298
|
+
}, [(w = a.logo) == null ? void 0 : w.call(a)]), l.bgImageUrl && e("img", {
|
|
299
|
+
src: l.bgImageUrl,
|
|
300
|
+
alt: "Image",
|
|
301
|
+
class: "column-muted-image"
|
|
302
|
+
}, null)])]) : d === "card" ? e("div", {
|
|
303
|
+
class: ["container", "flex-center"]
|
|
304
|
+
}, [e("div", {
|
|
305
|
+
class: "logo"
|
|
306
|
+
}, [(i = a.logo) == null ? void 0 : i.call(a)]), e("div", {
|
|
307
|
+
class: "card"
|
|
308
|
+
}, [e("div", {
|
|
309
|
+
class: ["card-column-item", "flex-1"]
|
|
310
|
+
}, [e(m, b(u, {
|
|
311
|
+
shadow: !1,
|
|
312
|
+
radius: !1,
|
|
313
|
+
onFinish: (c) => r("finish", c)
|
|
314
|
+
}), null)]), e("div", {
|
|
315
|
+
class: ["card-column-muted", "flex-1"],
|
|
316
|
+
style: {
|
|
317
|
+
width: "350px"
|
|
318
|
+
}
|
|
319
|
+
}, [o && e("img", {
|
|
320
|
+
src: o,
|
|
321
|
+
alt: "Image",
|
|
322
|
+
class: "column-muted-image"
|
|
323
|
+
}, null)])])]) : e("div", {
|
|
324
|
+
class: ["container", "flex-center"],
|
|
325
|
+
style: {
|
|
326
|
+
backgroundImage: `url(${o})`,
|
|
327
|
+
backgroundSize: "cover"
|
|
328
|
+
}
|
|
329
|
+
}, [e("div", {
|
|
330
|
+
class: ["flex-col", "space-y-4"]
|
|
331
|
+
}, [(s = a.logo) == null ? void 0 : s.call(a), e(m, u, null)])]);
|
|
258
332
|
};
|
|
259
333
|
}
|
|
260
334
|
});
|
|
261
335
|
export {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
336
|
+
V as Login,
|
|
337
|
+
P as loginEmits,
|
|
338
|
+
j as loginFormProps,
|
|
339
|
+
_ as loginProps
|
|
266
340
|
};
|