@banmao/blocks 0.0.1-alpha.10 → 0.0.1-alpha.11
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.js +27 -28
- 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"),
|
|
1
|
+
require('./index.css');"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=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}},U={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}},m=e.defineComponent({name:"LoginForm",props:U,emits:w,setup(r,{emit:i,slots:a}){const{actions:g,title:x,subTitle:l,signUpUrl:V,forgotUrl:d,shadow:n,radius:f}=r,u=e.reactive({username:"",password:""}),N=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"}]},p=e.ref(null),h=()=>{var t;(t=p.value)==null||t.validate(o=>{o?(console.error(o),i("error",o)):i("finish",e.toRaw(u))})},y=()=>{console.error("Weixin login is not supported yet."),i("wechatFinish")};return()=>e.createVNode("div",{class:["login-form",{"login-form-shadow":n}],style:[{borderRadius:f?`${f}px`:"none"}]},[e.createVNode("div",{class:"title"},[x]),e.createVNode("div",{class:"sub-title"},[l]),a.default?a.default():e.createVNode(c.NForm,{ref:p,model:u,rules:v,size:"large","show-require-mark":!1},{default:()=>[e.createVNode(c.NFormItem,{label:"用户名",path:"username"},{default:()=>[e.createVNode(c.NInput,{value:u.username,"onUpdate:value":t=>u.username=t,placeholder:"请输入用户名"},null)]}),e.createVNode(c.NFormItem,{label:"密码",path:"password"},{default:()=>[e.createVNode(c.NInput,{value:u.password,"onUpdate:value":t=>u.password=t,placeholder:"请输入密码",type:"password"},null)]}),e.createVNode("div",{class:"password-forgot"},[e.createVNode(c.NCheckbox,{checked:N.value,"onUpdate:checked":t=>N.value=t,label:"记住密码"},null),d&&e.createVNode("a",{href:d},[e.createTextVNode("忘记密码?")])]),e.createVNode(c.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(c.NButton,{"attr-type":"button",type:"primary",block:!0,onClick:()=>h()},{default:()=>[e.createTextVNode("登录")]})]}),g&&e.createVNode(c.NFormItem,{showLabel:!1},{default:()=>[e.createVNode(c.NButton,{color:"#02E16E",ghost:!0,block:!0,onClick:()=>y()},{default:()=>[e.createTextVNode("微信登录")]})]})]}),V&&e.createVNode("div",{class:"signUp"},[e.createTextVNode("还没有账号?"),e.createVNode("a",{href:V},[e.createTextVNode("立即注册")])])])}});function F(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!e.isVNode(r)}const S=e.defineComponent({name:"LoginPage",props:I,emits:w,setup(r,{emit:i,slots:a}){const{layout:g,bg:x,bgImageUrl:l,imagePosition:V,...d}=r,n=e.computed(()=>V==="right");return()=>{var f,u,N,v,p,h,y,t;if(a.default){let o;if(g==="column"){let s;return e.createVNode("div",{class:["container","column"]},[e.createVNode("div",{class:"column-item",style:{order:n.value?1:2}},[n.value&&e.createVNode("div",{class:"logo"},[(f=a.logo)==null?void 0:f.call(a)]),e.createVNode(m,e.mergeProps(d,{shadow:!1,radius:!1,onFinish:b=>i("finish",b)}),F(s=a.default())?s:{default:()=>[s]})]),e.createVNode("div",{class:"column-muted",style:{order:n.value?2:1}},[!n.value&&e.createVNode("div",{class:"logo"},[(u=a.logo)==null?void 0:u.call(a)]),r.bgImageUrl&&e.createVNode("img",{src:r.bgImageUrl,alt:"Image",class:"column-muted-image"},null)])])}if(g==="card"){let s;return e.createVNode("div",{class:["container","flex-center","card-login-wrapper"],style:{backgroundImage:l?`url(${l})`:"transparent"}},[e.createVNode("div",{class:"logo"},[(N=a.logo)==null?void 0:N.call(a)]),e.createVNode("div",{class:"card-img-cover"},null),e.createVNode("div",{class:"card",style:{flexDirection:n.value?"row":"row-reverse"}},[e.createVNode("div",{class:["card-column-item","flex-1"]},[e.createVNode(m,e.mergeProps(d,{shadow:!1,radius:!1,onFinish:b=>i("finish",b)}),F(s=a.default())?s:{default:()=>[s]})]),e.createVNode("div",{class:["card-column-muted","flex-1"],style:{width:"350px"}},[l&&e.createVNode("img",{src:l,alt:"Image",class:"column-muted-image"},null)])])])}return e.createVNode("div",{class:["container","flex-center"],style:{backgroundImage:`url(${l})`,backgroundSize:"cover"}},[e.createVNode("div",{class:["flex-col","space-y-4"]},[(v=a.logo)==null?void 0:v.call(a),e.createVNode(m,e.mergeProps(d,{onFinish:s=>i("finish",s)}),F(o=a.default())?o:{default:()=>[o]})])])}else return g==="column"?e.createVNode("div",{class:["container","column",{"column-reverse":r.imagePosition==="left"}]},[e.createVNode("div",{class:"column-item"},[n.value&&e.createVNode("div",{class:"logo"},[(p=a.logo)==null?void 0:p.call(a)]),e.createVNode(m,e.mergeProps(d,{shadow:!1,radius:!1,onFinish:o=>i("finish",o)}),null)]),e.createVNode("div",{class:"column-muted"},[!n.value&&e.createVNode("div",{class:"logo"},[(h=a.logo)==null?void 0:h.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"},[(y=a.logo)==null?void 0:y.call(a)]),e.createVNode("div",{class:"card"},[e.createVNode("div",{class:["card-column-item","flex-1"]},[e.createVNode(m,e.mergeProps(d,{shadow:!1,radius:!1,onFinish:o=>i("finish",o)}),null)]),e.createVNode("div",{class:["card-column-muted","flex-1"],style:{width:"350px"}},[l&&e.createVNode("img",{src:l,alt:"Image",class:"column-muted-image"},null)])])]):e.createVNode("div",{class:["container","flex-center"],style:{backgroundImage:`url(${l})`,backgroundSize:"cover"}},[e.createVNode("div",{class:["flex-col","space-y-4"]},[(t=a.logo)==null?void 0:t.call(a),e.createVNode(m,d,null)])])}}});exports.Login=S;exports.loginEmits=w;exports.loginFormProps=U;exports.loginProps=I;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './index.css';import { defineComponent as L, reactive as P, ref as k, createVNode as e, createTextVNode as v, toRaw as
|
|
1
|
+
import './index.css';import { defineComponent as L, reactive as P, ref as k, createVNode as e, createTextVNode as v, toRaw as D, computed as E, mergeProps as h, isVNode as A } from "vue";
|
|
2
2
|
import { NForm as W, NFormItem as x, NInput as B, NCheckbox as R, NButton as C } from "naive-ui";
|
|
3
3
|
const N = ["finish", "error", "captcha", "wechatFinish"], T = {
|
|
4
4
|
title: {
|
|
@@ -80,8 +80,8 @@ const N = ["finish", "error", "captcha", "wechatFinish"], T = {
|
|
|
80
80
|
title: S,
|
|
81
81
|
subTitle: u,
|
|
82
82
|
signUpUrl: y,
|
|
83
|
-
forgotUrl:
|
|
84
|
-
shadow:
|
|
83
|
+
forgotUrl: n,
|
|
84
|
+
shadow: o,
|
|
85
85
|
radius: m
|
|
86
86
|
} = l, c = P({
|
|
87
87
|
username: "",
|
|
@@ -110,14 +110,14 @@ const N = ["finish", "error", "captcha", "wechatFinish"], T = {
|
|
|
110
110
|
}, p = k(null), F = () => {
|
|
111
111
|
var r;
|
|
112
112
|
(r = p.value) == null || r.validate((i) => {
|
|
113
|
-
i ? (console.error(i), t("error", i)) : t("finish",
|
|
113
|
+
i ? (console.error(i), t("error", i)) : t("finish", D(c));
|
|
114
114
|
});
|
|
115
115
|
}, w = () => {
|
|
116
116
|
console.error("Weixin login is not supported yet."), t("wechatFinish");
|
|
117
117
|
};
|
|
118
118
|
return () => e("div", {
|
|
119
119
|
class: ["login-form", {
|
|
120
|
-
"login-form-shadow":
|
|
120
|
+
"login-form-shadow": o
|
|
121
121
|
}],
|
|
122
122
|
style: [{
|
|
123
123
|
borderRadius: m ? `${m}px` : "none"
|
|
@@ -158,8 +158,8 @@ const N = ["finish", "error", "captcha", "wechatFinish"], T = {
|
|
|
158
158
|
checked: f.value,
|
|
159
159
|
"onUpdate:checked": (r) => f.value = r,
|
|
160
160
|
label: "记住密码"
|
|
161
|
-
}, null),
|
|
162
|
-
href:
|
|
161
|
+
}, null), n && e("a", {
|
|
162
|
+
href: n
|
|
163
163
|
}, [v("忘记密码?")])]), e(x, {
|
|
164
164
|
showLabel: !1
|
|
165
165
|
}, {
|
|
@@ -191,7 +191,7 @@ const N = ["finish", "error", "captcha", "wechatFinish"], T = {
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
function I(l) {
|
|
194
|
-
return typeof l == "function" || Object.prototype.toString.call(l) === "[object Object]" && !
|
|
194
|
+
return typeof l == "function" || Object.prototype.toString.call(l) === "[object Object]" && !A(l);
|
|
195
195
|
}
|
|
196
196
|
const q = /* @__PURE__ */ L({
|
|
197
197
|
name: "LoginPage",
|
|
@@ -206,8 +206,8 @@ const q = /* @__PURE__ */ L({
|
|
|
206
206
|
bg: S,
|
|
207
207
|
bgImageUrl: u,
|
|
208
208
|
imagePosition: y,
|
|
209
|
-
...
|
|
210
|
-
} = l,
|
|
209
|
+
...n
|
|
210
|
+
} = l, o = E(() => y === "right");
|
|
211
211
|
return () => {
|
|
212
212
|
var m, c, f, b, p, F, w, r;
|
|
213
213
|
if (a.default) {
|
|
@@ -219,11 +219,11 @@ const q = /* @__PURE__ */ L({
|
|
|
219
219
|
}, [e("div", {
|
|
220
220
|
class: "column-item",
|
|
221
221
|
style: {
|
|
222
|
-
order:
|
|
222
|
+
order: o.value ? 1 : 2
|
|
223
223
|
}
|
|
224
|
-
}, [
|
|
224
|
+
}, [o.value && e("div", {
|
|
225
225
|
class: "logo"
|
|
226
|
-
}, [(m = a.logo) == null ? void 0 : m.call(a)]), e(g, h(
|
|
226
|
+
}, [(m = a.logo) == null ? void 0 : m.call(a)]), e(g, h(n, {
|
|
227
227
|
shadow: !1,
|
|
228
228
|
radius: !1,
|
|
229
229
|
onFinish: (U) => t("finish", U)
|
|
@@ -232,9 +232,9 @@ const q = /* @__PURE__ */ L({
|
|
|
232
232
|
})]), e("div", {
|
|
233
233
|
class: "column-muted",
|
|
234
234
|
style: {
|
|
235
|
-
order:
|
|
235
|
+
order: o.value ? 2 : 1
|
|
236
236
|
}
|
|
237
|
-
}, [!
|
|
237
|
+
}, [!o.value && e("div", {
|
|
238
238
|
class: "logo"
|
|
239
239
|
}, [(c = a.logo) == null ? void 0 : c.call(a)]), l.bgImageUrl && e("img", {
|
|
240
240
|
src: l.bgImageUrl,
|
|
@@ -254,13 +254,13 @@ const q = /* @__PURE__ */ L({
|
|
|
254
254
|
}, [(f = a.logo) == null ? void 0 : f.call(a)]), e("div", {
|
|
255
255
|
class: "card-img-cover"
|
|
256
256
|
}, null), e("div", {
|
|
257
|
-
class: "card"
|
|
258
|
-
}, [e("div", {
|
|
259
|
-
class: ["card-column-item", "flex-1"],
|
|
257
|
+
class: "card",
|
|
260
258
|
style: {
|
|
261
|
-
|
|
259
|
+
flexDirection: o.value ? "row" : "row-reverse"
|
|
262
260
|
}
|
|
263
|
-
}, [e(
|
|
261
|
+
}, [e("div", {
|
|
262
|
+
class: ["card-column-item", "flex-1"]
|
|
263
|
+
}, [e(g, h(n, {
|
|
264
264
|
shadow: !1,
|
|
265
265
|
radius: !1,
|
|
266
266
|
onFinish: (U) => t("finish", U)
|
|
@@ -269,8 +269,7 @@ const q = /* @__PURE__ */ L({
|
|
|
269
269
|
})]), e("div", {
|
|
270
270
|
class: ["card-column-muted", "flex-1"],
|
|
271
271
|
style: {
|
|
272
|
-
width: "350px"
|
|
273
|
-
"flex-direction": n.value ? "column-reverse" : "column"
|
|
272
|
+
width: "350px"
|
|
274
273
|
}
|
|
275
274
|
}, [u && e("img", {
|
|
276
275
|
src: u,
|
|
@@ -286,7 +285,7 @@ const q = /* @__PURE__ */ L({
|
|
|
286
285
|
}
|
|
287
286
|
}, [e("div", {
|
|
288
287
|
class: ["flex-col", "space-y-4"]
|
|
289
|
-
}, [(b = a.logo) == null ? void 0 : b.call(a), e(g, h(
|
|
288
|
+
}, [(b = a.logo) == null ? void 0 : b.call(a), e(g, h(n, {
|
|
290
289
|
onFinish: (d) => t("finish", d)
|
|
291
290
|
}), I(i = a.default()) ? i : {
|
|
292
291
|
default: () => [i]
|
|
@@ -298,15 +297,15 @@ const q = /* @__PURE__ */ L({
|
|
|
298
297
|
}]
|
|
299
298
|
}, [e("div", {
|
|
300
299
|
class: "column-item"
|
|
301
|
-
}, [
|
|
300
|
+
}, [o.value && e("div", {
|
|
302
301
|
class: "logo"
|
|
303
|
-
}, [(p = a.logo) == null ? void 0 : p.call(a)]), e(g, h(
|
|
302
|
+
}, [(p = a.logo) == null ? void 0 : p.call(a)]), e(g, h(n, {
|
|
304
303
|
shadow: !1,
|
|
305
304
|
radius: !1,
|
|
306
305
|
onFinish: (i) => t("finish", i)
|
|
307
306
|
}), null)]), e("div", {
|
|
308
307
|
class: "column-muted"
|
|
309
|
-
}, [!
|
|
308
|
+
}, [!o.value && e("div", {
|
|
310
309
|
class: "logo"
|
|
311
310
|
}, [(F = a.logo) == null ? void 0 : F.call(a)]), l.bgImageUrl && e("img", {
|
|
312
311
|
src: l.bgImageUrl,
|
|
@@ -320,7 +319,7 @@ const q = /* @__PURE__ */ L({
|
|
|
320
319
|
class: "card"
|
|
321
320
|
}, [e("div", {
|
|
322
321
|
class: ["card-column-item", "flex-1"]
|
|
323
|
-
}, [e(g, h(
|
|
322
|
+
}, [e(g, h(n, {
|
|
324
323
|
shadow: !1,
|
|
325
324
|
radius: !1,
|
|
326
325
|
onFinish: (i) => t("finish", i)
|
|
@@ -341,7 +340,7 @@ const q = /* @__PURE__ */ L({
|
|
|
341
340
|
}
|
|
342
341
|
}, [e("div", {
|
|
343
342
|
class: ["flex-col", "space-y-4"]
|
|
344
|
-
}, [(r = a.logo) == null ? void 0 : r.call(a), e(g,
|
|
343
|
+
}, [(r = a.logo) == null ? void 0 : r.call(a), e(g, n, null)])]);
|
|
345
344
|
};
|
|
346
345
|
}
|
|
347
346
|
});
|