st-comp 0.0.150 → 0.0.152

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.
@@ -0,0 +1 @@
1
+ "use strict";require("./base-0ca7c43a.cjs");const e=require("vue"),f=require("./index-afc88a4b.cjs"),h=require("./_plugin-vue_export-helper-f246444f.cjs");const g={key:0,class:"rule-box"},x={key:0,class:"level-box"},V={class:"level-color"},C={class:"level-text"},w={__name:"index",props:{value:{type:String,default:""},isFocus:{type:Boolean,default:!1},textColor:{type:[String,null],default:null}},setup(c,{expose:m}){const v=c,u=[{text:"不能包含空格",validator:t=>!/\s/.test(t)},{text:"长度为8-18个字符",validator:t=>t.length>=8&&t.length<=18},{text:"必须包含字母、数字、符号中至少2种",validator:t=>{const l=/[a-zA-Z]/.test(t),a=/\d/.test(t),r=/[^a-zA-Z0-9]/.test(t);return[l,a,r].filter(Boolean).length>=2}},{text:"请勿输入连续、重复6位以上字母或数字, 0123456, 1111111",validator:t=>{if(/([a-zA-Z0-9])\1{6,}/.test(t)||/(?:0123456|1234567|2345678|3456789|9876543|8765432|7654321|6543210)/.test(t))return!1;const r=t.toLowerCase(),d=s=>{if(!/^[a-z]+$/.test(s))return!1;for(let n=1;n<s.length;n++)if(s.charCodeAt(n)!==s.charCodeAt(n-1)+1)return!1;return!0};for(let s=0;s<=r.length-7;s++){const n=r.substr(s,7);if(d(n))return!1}return!0}}],p=e.computed(()=>!u.map(l=>l.validator(v.value)).includes(!1)),o=e.computed(()=>{const t=v.value;if(!t)return 0;let l=0;return t.length>=8&&l++,t.length>=12&&l++,/\d/.test(t)&&l++,/[a-z]/.test(t)&&l++,/[A-Z]/.test(t)&&l++,/[^a-zA-Z0-9]/.test(t)&&l++,l<=2?1:l<=4?2:3}),i=e.computed(()=>{switch(o.value){case 1:return"lv1";case 2:return"lv2";case 3:return"lv3";default:return""}}),_=e.computed(()=>{switch(o.value){case 1:return"弱";case 2:return"中";case 3:return"强";default:return""}});return m({pwdValidators:u,levelValue:o,ruleFormPassword:[{required:!0,trigger:"blur",message:"密码不能为空"},...u.map(t=>({trigger:"blur",validator:(l,a,r)=>{t.validator(a)?r():r(t.text)}}))]}),(t,l)=>{const a=f.ElIcon;return e.openBlock(),e.createElementBlock("div",{class:"password-prompt",style:e.normalizeStyle({color:c.textColor??"var(--el-color-info)"})},[e.createVNode(e.Transition,{name:"slide-down"},{default:e.withCtx(()=>[c.isFocus?(e.openBlock(),e.createElementBlock("div",g,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(u,(r,d)=>e.createElementVNode("div",{class:"rule-item",key:d},[e.withDirectives(e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(e.unref(f.circle_check_default))]),_:2},1536),[[e.vShow,r.validator(c.value)]]),e.createElementVNode("span",null,e.toDisplayString(r.text),1)])),64))])):e.createCommentVNode("",!0)]),_:1}),!c.isFocus&&p.value?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",V,[e.createElementVNode("div",{class:e.normalizeClass(["levelValue-block",[o.value>=1?i.value:""]])},null,2),e.createElementVNode("div",{class:e.normalizeClass(["levelValue-block",[o.value>=2?i.value:""]])},null,2),e.createElementVNode("div",{class:e.normalizeClass(["levelValue-block",[o.value>=3?i.value:""]])},null,2)]),e.createElementVNode("div",C,"密码强度: "+e.toDisplayString(_.value),1)])):e.createCommentVNode("",!0)],4)}}},N=h._export_sfc(w,[["__scopeId","data-v-ff60a416"]]);exports.PasswordPrompt=N;
@@ -1,5 +1,5 @@
1
1
  import "./base-19787dfb.js";
2
- import { computed as i, openBlock as d, createElementBlock as v, normalizeStyle as V, createVNode as _, Transition as k, withCtx as g, Fragment as z, renderList as A, createElementVNode as s, withDirectives as S, unref as N, vShow as F, toDisplayString as x, createCommentVNode as b, normalizeClass as h } from "vue";
2
+ import { computed as i, openBlock as d, createElementBlock as v, normalizeStyle as V, createVNode as _, Transition as k, withCtx as g, Fragment as z, renderList as A, createElementVNode as s, withDirectives as S, unref as N, vShow as F, toDisplayString as x, createCommentVNode as w, normalizeClass as h } from "vue";
3
3
  import { g as Z, E as B } from "./index-72151b24.js";
4
4
  import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  const L = {
@@ -27,8 +27,8 @@ const L = {
27
27
  default: null
28
28
  }
29
29
  },
30
- setup(n, { expose: w }) {
31
- const p = n, c = [
30
+ setup(u, { expose: y }) {
31
+ const p = u, c = [
32
32
  {
33
33
  text: "不能包含空格",
34
34
  validator: (e) => !/\s/.test(e)
@@ -40,8 +40,8 @@ const L = {
40
40
  {
41
41
  text: "必须包含字母、数字、符号中至少2种",
42
42
  validator: (e) => {
43
- const t = /[a-zA-Z]/.test(e), a = /\d/.test(e), l = /[^a-zA-Z0-9]/.test(e);
44
- return [t, a, l].filter(Boolean).length >= 2;
43
+ const t = /[a-zA-Z]/.test(e), o = /\d/.test(e), l = /[^a-zA-Z0-9]/.test(e);
44
+ return [t, o, l].filter(Boolean).length >= 2;
45
45
  }
46
46
  },
47
47
  {
@@ -52,27 +52,27 @@ const L = {
52
52
  const l = e.toLowerCase(), m = (r) => {
53
53
  if (!/^[a-z]+$/.test(r))
54
54
  return !1;
55
- for (let o = 1; o < r.length; o++)
56
- if (r.charCodeAt(o) !== r.charCodeAt(o - 1) + 1)
55
+ for (let n = 1; n < r.length; n++)
56
+ if (r.charCodeAt(n) !== r.charCodeAt(n - 1) + 1)
57
57
  return !1;
58
58
  return !0;
59
59
  };
60
60
  for (let r = 0; r <= l.length - 7; r++) {
61
- const o = l.substr(r, 7);
62
- if (m(o))
61
+ const n = l.substr(r, 7);
62
+ if (m(n))
63
63
  return !1;
64
64
  }
65
65
  return !0;
66
66
  }
67
67
  }
68
- ], y = i(() => !c.map((t) => t.validator(p.value)).includes(!1)), u = i(() => {
68
+ ], C = i(() => !c.map((t) => t.validator(p.value)).includes(!1)), a = i(() => {
69
69
  const e = p.value;
70
70
  if (!e)
71
71
  return 0;
72
72
  let t = 0;
73
73
  return e.length >= 8 && t++, e.length >= 12 && t++, /\d/.test(e) && t++, /[a-z]/.test(e) && t++, /[A-Z]/.test(e) && t++, /[^a-zA-Z0-9]/.test(e) && t++, t <= 2 ? 1 : t <= 4 ? 2 : 3;
74
74
  }), f = i(() => {
75
- switch (u.value) {
75
+ switch (a.value) {
76
76
  case 1:
77
77
  return "lv1";
78
78
  case 2:
@@ -82,8 +82,8 @@ const L = {
82
82
  default:
83
83
  return "";
84
84
  }
85
- }), C = i(() => {
86
- switch (u.value) {
85
+ }), b = i(() => {
86
+ switch (a.value) {
87
87
  case 1:
88
88
  return "弱";
89
89
  case 2:
@@ -94,63 +94,64 @@ const L = {
94
94
  return "";
95
95
  }
96
96
  });
97
- return w({
97
+ return y({
98
98
  pwdValidators: c,
99
+ levelValue: a,
99
100
  // 提供给表单校验使用
100
101
  ruleFormPassword: [
101
102
  { required: !0, trigger: "blur", message: "密码不能为空" },
102
103
  ...c.map((e) => ({
103
104
  trigger: "blur",
104
- validator: (t, a, l) => {
105
- e.validator(a) ? l() : l(e.text);
105
+ validator: (t, o, l) => {
106
+ e.validator(o) ? l() : l(e.text);
106
107
  }
107
108
  }))
108
109
  ]
109
110
  }), (e, t) => {
110
- const a = B;
111
+ const o = B;
111
112
  return d(), v("div", {
112
113
  class: "password-prompt",
113
- style: V({ color: n.textColor ?? "var(--el-color-info)" })
114
+ style: V({ color: u.textColor ?? "var(--el-color-info)" })
114
115
  }, [
115
116
  _(k, { name: "slide-down" }, {
116
117
  default: g(() => [
117
- n.isFocus ? (d(), v("div", L, [
118
+ u.isFocus ? (d(), v("div", L, [
118
119
  (d(), v(z, null, A(c, (l, m) => s("div", {
119
120
  class: "rule-item",
120
121
  key: m
121
122
  }, [
122
- S(_(a, null, {
123
+ S(_(o, null, {
123
124
  default: g(() => [
124
125
  _(N(Z))
125
126
  ]),
126
127
  _: 2
127
128
  }, 1536), [
128
- [F, l.validator(n.value)]
129
+ [F, l.validator(u.value)]
129
130
  ]),
130
131
  s("span", null, x(l.text), 1)
131
132
  ])), 64))
132
- ])) : b("", !0)
133
+ ])) : w("", !0)
133
134
  ]),
134
135
  _: 1
135
136
  }),
136
- !n.isFocus && y.value ? (d(), v("div", P, [
137
+ !u.isFocus && C.value ? (d(), v("div", P, [
137
138
  s("div", D, [
138
139
  s("div", {
139
- class: h(["levelValue-block", [u.value >= 1 ? f.value : ""]])
140
+ class: h(["levelValue-block", [a.value >= 1 ? f.value : ""]])
140
141
  }, null, 2),
141
142
  s("div", {
142
- class: h(["levelValue-block", [u.value >= 2 ? f.value : ""]])
143
+ class: h(["levelValue-block", [a.value >= 2 ? f.value : ""]])
143
144
  }, null, 2),
144
145
  s("div", {
145
- class: h(["levelValue-block", [u.value >= 3 ? f.value : ""]])
146
+ class: h(["levelValue-block", [a.value >= 3 ? f.value : ""]])
146
147
  }, null, 2)
147
148
  ]),
148
- s("div", I, "密码强度: " + x(C.value), 1)
149
- ])) : b("", !0)
149
+ s("div", I, "密码强度: " + x(b.value), 1)
150
+ ])) : w("", !0)
150
151
  ], 4);
151
152
  };
152
153
  }
153
- }, H = /* @__PURE__ */ E(T, [["__scopeId", "data-v-b9fee9dd"]]);
154
+ }, H = /* @__PURE__ */ E(T, [["__scopeId", "data-v-ff60a416"]]);
154
155
  export {
155
156
  H as P
156
157
  };