@banmao/blocks 0.0.1-alpha.1 → 0.0.1-alpha.3
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/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +22 -20
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require('./index.css');"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("naive-ui"),h=["finish","error","captcha","wechatFinish"],v={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}},b={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}},V=e.defineComponent({name:"LoginForm",props:b,emits:h,setup(l,{emit:
|
|
1
|
+
require('./index.css');"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("naive-ui"),h=["finish","error","captcha","wechatFinish"],v={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}},b={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}},V=e.defineComponent({name:"LoginForm",props:b,emits:h,setup(l,{emit:i}){const{actions:t,title:m,subTitle:y,signUpUrl:n,forgotUrl:p,shadow:u,radius:c}=l,r=e.reactive({username:"",password:""}),d=e.ref(!1),f={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"}]},s=e.ref(null),g=()=>{var o;(o=s.value)==null||o.validate(N=>{N?(console.error(N),i("error",N)):i("finish",e.toRaw(r))})},F=()=>{console.error("Weixin login is not supported yet."),i("wechatFinish")};return()=>e.createVNode("div",{class:["login-form",{"login-form-shadow":u}],style:[{borderRadius:c?`${c}px`:"none"}]},[e.createVNode("div",{class:"title"},[m]),e.createVNode("div",{class:"sub-title"},[y]),e.createVNode(a.NForm,{ref:s,model:r,rules:f,size:"large","show-require-mark":!1},{default:()=>[e.createVNode(a.NFormItem,{label:"用户名",path:"username"},{default:()=>[e.createVNode(a.NInput,{value:r.username,"onUpdate:value":o=>r.username=o,placeholder:"请输入用户名"},null)]}),e.createVNode(a.NFormItem,{label:"密码",path:"password"},{default:()=>[e.createVNode(a.NInput,{value:r.password,"onUpdate:value":o=>r.password=o,placeholder:"请输入密码",type:"password"},null)]}),e.createVNode("div",{class:"password-forgot"},[e.createVNode(a.NCheckbox,{checked:d.value,"onUpdate:checked":o=>d.value=o,label:"记住密码"},null),p&&e.createVNode("a",{href:p},[e.createTextVNode("忘记密码?")])]),e.createVNode(a.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(a.NButton,{"attr-type":"button",type:"primary",block:!0,onClick:()=>g()},{default:()=>[e.createTextVNode("登录")]})]}),t&&e.createVNode(a.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(a.NButton,{color:"#02E16E",ghost:!0,block:!0,onClick:()=>F()},{default:()=>[e.createTextVNode("微信登录")]})]})]}),n&&e.createVNode("div",{class:"signUp"},[e.createTextVNode("还没有账号?"),e.createVNode("a",{href:n},[e.createTextVNode("立即注册")])])])}}),w=e.defineComponent({name:"LoginPage",props:v,emits:h,setup(l,{emit:i,slots:t}){const{layout:m,bg:y,bgImageUrl:n,logo:p,...u}=l,c=e.computed(()=>l.imagePosition==="right");return()=>{var r,d,f,s;return m==="column"?e.createVNode("div",{class:["container","column",{"column-reverse":l.imagePosition==="left"}]},[e.createVNode("div",{class:"column-item"},[c.value&&e.createVNode("div",{class:"logo"},[(r=t.logo)==null?void 0:r.call(t)]),e.createVNode(V,e.mergeProps(u,{shadow:!1,radius:!1,onFinish:g=>i("finish",g)}),null)]),e.createVNode("div",{class:"column-muted"},[!c.value&&e.createVNode("div",{class:"logo"},[(d=t.logo)==null?void 0:d.call(t)]),l.bgImageUrl&&e.createVNode("img",{src:l.bgImageUrl,alt:"Image",class:"column-muted-image"},null)])]):m==="card"?e.createVNode("div",{class:["container","flex-center"]},[e.createVNode("div",{class:"logo"},[(f=t.logo)==null?void 0:f.call(t)]),e.createVNode("div",{class:"card"},[e.createVNode("div",{class:["card-column-item","flex-1"]},[e.createVNode(V,e.mergeProps(u,{shadow:!1,radius:!1,onFinish:g=>i("finish",g)}),null)]),e.createVNode("div",{class:["card-column-muted","flex-1"],style:{width:"350px"}},[n&&e.createVNode("img",{src:n,alt:"Image",class:"column-muted-image"},null)])])]):e.createVNode("div",{class:["container","flex-center"],style:{backgroundImage:`url(${n})`,backgroundSize:"cover"}},[e.createVNode("div",{class:["flex-col","space-y-4"]},[(s=t.logo)==null?void 0:s.call(t),e.createVNode(V,u,null)])])}}});exports.Login=w;exports.loginEmits=h;exports.loginFormProps=b;exports.loginProps=v;
|
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}
|
|
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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './index.css';import { defineComponent as B, reactive as C, ref as F, createVNode as e, createTextVNode as
|
|
1
|
+
import './index.css';import { defineComponent as B, reactive as C, ref as F, createVNode as e, createTextVNode as g, toRaw as I, computed as L, mergeProps as w } from "vue";
|
|
2
2
|
import { NForm as N, NFormItem as p, NInput as U, NCheckbox as P, NButton as x } from "naive-ui";
|
|
3
3
|
const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
4
4
|
title: {
|
|
@@ -106,7 +106,7 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
106
106
|
message: "长度在 6 到 20 个字符",
|
|
107
107
|
trigger: "blur"
|
|
108
108
|
}]
|
|
109
|
-
}, c = F(null),
|
|
109
|
+
}, c = F(null), d = () => {
|
|
110
110
|
var t;
|
|
111
111
|
(t = c.value) == null || t.validate((y) => {
|
|
112
112
|
y ? (console.error(y), o("error", y)) : o("finish", I(l));
|
|
@@ -159,16 +159,16 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
159
159
|
label: "记住密码"
|
|
160
160
|
}, null), h && e("a", {
|
|
161
161
|
href: h
|
|
162
|
-
}, [
|
|
162
|
+
}, [g("忘记密码?")])]), e(p, {
|
|
163
163
|
showLabel: !1
|
|
164
164
|
}, {
|
|
165
165
|
default: () => [e(x, {
|
|
166
166
|
"attr-type": "button",
|
|
167
167
|
type: "primary",
|
|
168
168
|
block: !0,
|
|
169
|
-
onClick: () =>
|
|
169
|
+
onClick: () => d()
|
|
170
170
|
}, {
|
|
171
|
-
default: () => [
|
|
171
|
+
default: () => [g("登录")]
|
|
172
172
|
})]
|
|
173
173
|
}), a && e(p, {
|
|
174
174
|
showLabel: !1
|
|
@@ -179,14 +179,14 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
179
179
|
block: !0,
|
|
180
180
|
onClick: () => k()
|
|
181
181
|
}, {
|
|
182
|
-
default: () => [
|
|
182
|
+
default: () => [g("微信登录")]
|
|
183
183
|
})]
|
|
184
184
|
})]
|
|
185
185
|
}), u && e("div", {
|
|
186
186
|
class: "signUp"
|
|
187
|
-
}, [
|
|
187
|
+
}, [g("还没有账号?"), e("a", {
|
|
188
188
|
href: u
|
|
189
|
-
}, [
|
|
189
|
+
}, [g("立即注册")])])]);
|
|
190
190
|
}
|
|
191
191
|
}), R = /* @__PURE__ */ B({
|
|
192
192
|
name: "LoginPage",
|
|
@@ -212,38 +212,40 @@ const S = ["finish", "error", "captcha", "wechatFinish"], E = {
|
|
|
212
212
|
}, [e("div", {
|
|
213
213
|
class: "column-item"
|
|
214
214
|
}, [n.value && e("div", {
|
|
215
|
-
class:
|
|
215
|
+
class: "logo"
|
|
216
216
|
}, [(l = a.logo) == null ? void 0 : l.call(a)]), e(b, w(i, {
|
|
217
217
|
shadow: !1,
|
|
218
218
|
radius: !1,
|
|
219
|
-
onFinish: (
|
|
219
|
+
onFinish: (d) => o("finish", d)
|
|
220
220
|
}), null)]), e("div", {
|
|
221
|
-
class:
|
|
221
|
+
class: "column-muted"
|
|
222
222
|
}, [!n.value && e("div", {
|
|
223
|
-
class:
|
|
223
|
+
class: "logo"
|
|
224
224
|
}, [(s = a.logo) == null ? void 0 : s.call(a)]), r.bgImageUrl && e("img", {
|
|
225
225
|
src: r.bgImageUrl,
|
|
226
226
|
alt: "Image",
|
|
227
|
-
class:
|
|
227
|
+
class: "column-muted-image"
|
|
228
228
|
}, null)])]) : m === "card" ? e("div", {
|
|
229
229
|
class: ["container", "flex-center"]
|
|
230
230
|
}, [e("div", {
|
|
231
|
-
class:
|
|
231
|
+
class: "logo"
|
|
232
232
|
}, [(f = a.logo) == null ? void 0 : f.call(a)]), e("div", {
|
|
233
|
-
class:
|
|
233
|
+
class: "card"
|
|
234
234
|
}, [e("div", {
|
|
235
|
-
class: ["column-item", "flex-1"]
|
|
235
|
+
class: ["card-column-item", "flex-1"]
|
|
236
236
|
}, [e(b, w(i, {
|
|
237
237
|
shadow: !1,
|
|
238
238
|
radius: !1,
|
|
239
|
-
onFinish: (
|
|
239
|
+
onFinish: (d) => o("finish", d)
|
|
240
240
|
}), null)]), e("div", {
|
|
241
|
-
class: ["column-muted", "flex-1"],
|
|
242
|
-
style: {
|
|
241
|
+
class: ["card-column-muted", "flex-1"],
|
|
242
|
+
style: {
|
|
243
|
+
width: "350px"
|
|
244
|
+
}
|
|
243
245
|
}, [u && e("img", {
|
|
244
246
|
src: u,
|
|
245
247
|
alt: "Image",
|
|
246
|
-
class:
|
|
248
|
+
class: "column-muted-image"
|
|
247
249
|
}, null)])])]) : e("div", {
|
|
248
250
|
class: ["container", "flex-center"],
|
|
249
251
|
style: {
|