mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-05-12 05:49:12 +08:00
374 lines
60 KiB
JavaScript
374 lines
60 KiB
JavaScript
import{g as en,w as we,o as tn,i as ue,a as nn,d as ne,r as q,u as rn,c as an,h as w,b as et,e as on,f as Ae,j as sn,k as y,l as _,m as L,n as Je,p as Oe,q as de,s as Ee,t as Pt,v as tt,x as T,y as _e,z as $t,A as ln,B as J,C as Q,D as nt,E as dn,F as fn,G as Ze,T as cn,H as De,I,J as rt,K as un,L as ye,M as bn,N as gn,O as mn,P as hn,Q as pn,R as vn,S as yn,U as xn,V as at,W as We,X as wn,Y as Rn,Z as Sn,_ as it,$ as Pn,a0 as ze,a1 as Ie,a2 as $n,a3 as kn,a4 as Cn,a5 as zn,a6 as kt,a7 as W,a8 as ot,a9 as Fn,aa as _n,ab as Tn,ac as An,ad as En,ae as On,af as Ln,ag as qn,ah as jn,ai as st,aj as Wn,ak as In,al as Mn,am as Bn,an as Nn}from"./index.ef367bc1.js";import{N as Vn}from"./Result.5bbf6e74.js";import{R as Dn}from"./index.8800836f.js";import{A as Hn}from"./Add.519158d4.js";function Un(t,e,n){var r;const a=ue(t,null);if(a===null)return;const o=(r=en())===null||r===void 0?void 0:r.proxy;we(n,i),i(n.value),tn(()=>{i(void 0,n.value)});function i(d,f){const c=a[e];f!==void 0&&s(c,f),d!==void 0&&l(c,d)}function s(d,f){d[f]||(d[f]=[]),d[f].splice(d[f].findIndex(c=>c===o),1)}function l(d,f){d[f]||(d[f]=[]),~d[f].findIndex(c=>c===o)||d[f].push(o)}}let lt=!1;function Yn(){if(!!nn&&!!window.CSS&&!lt&&(lt=!0,"registerProperty"in(window==null?void 0:window.CSS)))try{CSS.registerProperty({name:"--n-color-start",syntax:"<color>",inherits:!1,initialValue:"#0000"}),CSS.registerProperty({name:"--n-color-end",syntax:"<color>",inherits:!1,initialValue:"#0000"})}catch{}}const Gn=et(".v-x-scroll",{overflow:"auto",scrollbarWidth:"none"},[et("&::-webkit-scrollbar",{width:0,height:0})]),Xn=ne({name:"XScroll",props:{disabled:Boolean,onScroll:Function},setup(){const t=q(null);function e(a){!(a.currentTarget.offsetWidth<a.currentTarget.scrollWidth)||a.deltaY===0||(a.currentTarget.scrollLeft+=a.deltaY+a.deltaX,a.preventDefault())}const n=rn();return Gn.mount({id:"vueuc/x-scroll",head:!0,anchorMetaName:an,ssr:n}),Object.assign({selfRef:t,handleWheel:e},{scrollTo(...a){var o;(o=t.value)===null||o===void 0||o.scrollTo(...a)}})},render(){return w("div",{ref:"selfRef",onScroll:this.onScroll,onWheel:this.disabled?void 0:this.handleWheel,class:"v-x-scroll"},this.$slots)}});var Kn=/\s/;function Jn(t){for(var e=t.length;e--&&Kn.test(t.charAt(e)););return e}var Zn=/^\s+/;function Qn(t){return t&&t.slice(0,Jn(t)+1).replace(Zn,"")}var dt=0/0,er=/^[-+]0x[0-9a-f]+$/i,tr=/^0b[01]+$/i,nr=/^0o[0-7]+$/i,rr=parseInt;function ft(t){if(typeof t=="number")return t;if(on(t))return dt;if(Ae(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Ae(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Qn(t);var n=tr.test(t);return n||nr.test(t)?rr(t.slice(2),n?2:8):er.test(t)?dt:+t}var ar=function(){return sn.Date.now()};const Me=ar;var ir="Expected a function",or=Math.max,sr=Math.min;function lr(t,e,n){var r,a,o,i,s,l,d=0,f=!1,c=!1,h=!0;if(typeof t!="function")throw new TypeError(ir);e=ft(e)||0,Ae(n)&&(f=!!n.leading,c="maxWait"in n,o=c?or(ft(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function b(S){var A=r,j=a;return r=a=void 0,d=S,i=t.apply(j,A),i}function x(S){return d=S,s=setTimeout(m,e),f?b(S):i}function p(S){var A=S-l,j=S-d,B=e-A;return c?sr(B,o-j):B}function P(S){var A=S-l,j=S-d;return l===void 0||A>=e||A<0||c&&j>=o}function m(){var S=Me();if(P(S))return $(S);s=setTimeout(m,p(S))}function $(S){return s=void 0,h&&r?b(S):(r=a=void 0,i)}function v(){s!==void 0&&clearTimeout(s),d=0,r=l=a=s=void 0}function F(){return s===void 0?i:$(Me())}function O(){var S=Me(),A=P(S);if(r=arguments,a=this,l=S,A){if(s===void 0)return x(l);if(c)return clearTimeout(s),s=setTimeout(m,e),b(l)}return s===void 0&&(s=setTimeout(m,e)),i}return O.cancel=v,O.flush=F,O}var dr="Expected a function";function Be(t,e,n){var r=!0,a=!0;if(typeof t!="function")throw new TypeError(dr);return Ae(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),lr(t,e,{leading:r,maxWait:e,trailing:a})}const fr=y("form",[_("inline",`
|
|
width: 100%;
|
|
display: inline-flex;
|
|
align-items: flex-start;
|
|
align-content: space-around;
|
|
`,[y("form-item",{width:"auto",marginRight:"18px"},[L("&:last-child",{marginRight:0})])])]),Pe=Je("n-form"),Ct=Je("n-form-item-insts");var cr=globalThis&&globalThis.__awaiter||function(t,e,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(f){try{d(r.next(f))}catch(c){i(c)}}function l(f){try{d(r.throw(f))}catch(c){i(c)}}function d(f){f.done?o(f.value):a(f.value).then(s,l)}d((r=r.apply(t,e||[])).next())})};const ur=Object.assign(Object.assign({},de.props),{inline:Boolean,labelWidth:[Number,String],labelAlign:String,labelPlacement:{type:String,default:"top"},model:{type:Object,default:()=>{}},rules:Object,disabled:Boolean,size:String,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:!0},onSubmit:{type:Function,default:t=>t.preventDefault()},showLabel:{type:Boolean,default:void 0},validateMessages:Object}),br=ne({name:"Form",props:ur,setup(t){const{mergedClsPrefixRef:e}=Oe(t);de("Form","-form",fr,Pt,t,e);const n={},r=q(void 0),a=l=>{const d=r.value;(d===void 0||l>=d)&&(r.value=l)};function o(l,d=()=>!0){return cr(this,void 0,void 0,function*(){return yield new Promise((f,c)=>{const h=[];for(const b of tt(n)){const x=n[b];for(const p of x)p.path&&h.push(p.internalValidate(null,d))}Promise.all(h).then(b=>{if(b.some(x=>!x.valid)){const x=b.filter(p=>p.errors).map(p=>p.errors);l&&l(x),c(x)}else l&&l(),f()})})})}function i(){for(const l of tt(n)){const d=n[l];for(const f of d)f.restoreValidation()}}return Ee(Pe,{props:t,maxChildLabelWidthRef:r,deriveMaxChildLabelWidth:a}),Ee(Ct,{formItems:n}),Object.assign({validate:o,restoreValidation:i},{mergedClsPrefix:e})},render(){const{mergedClsPrefix:t}=this;return w("form",{class:[`${t}-form`,this.inline&&`${t}-form--inline`],onSubmit:this.onSubmit},this.$slots)}});function ce(){return ce=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ce.apply(this,arguments)}function gr(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Se(t,e)}function He(t){return He=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},He(t)}function Se(t,e){return Se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Se(t,e)}function mr(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Te(t,e,n){return mr()?Te=Reflect.construct.bind():Te=function(a,o,i){var s=[null];s.push.apply(s,o);var l=Function.bind.apply(a,s),d=new l;return i&&Se(d,i.prototype),d},Te.apply(null,arguments)}function hr(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Ue(t){var e=typeof Map=="function"?new Map:void 0;return Ue=function(r){if(r===null||!hr(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,a)}function a(){return Te(r,arguments,He(this).constructor)}return a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),Se(a,r)},Ue(t)}var pr=/%[sdj%]/g,vr=function(){};typeof process<"u"&&process.env;function Ye(t){if(!t||!t.length)return null;var e={};return t.forEach(function(n){var r=n.field;e[r]=e[r]||[],e[r].push(n)}),e}function X(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var a=0,o=n.length;if(typeof t=="function")return t.apply(null,n);if(typeof t=="string"){var i=t.replace(pr,function(s){if(s==="%%")return"%";if(a>=o)return s;switch(s){case"%s":return String(n[a++]);case"%d":return Number(n[a++]);case"%j":try{return JSON.stringify(n[a++])}catch{return"[Circular]"}break;default:return s}});return i}return t}function yr(t){return t==="string"||t==="url"||t==="hex"||t==="email"||t==="date"||t==="pattern"}function M(t,e){return!!(t==null||e==="array"&&Array.isArray(t)&&!t.length||yr(e)&&typeof t=="string"&&!t)}function xr(t,e,n){var r=[],a=0,o=t.length;function i(s){r.push.apply(r,s||[]),a++,a===o&&n(r)}t.forEach(function(s){e(s,i)})}function ct(t,e,n){var r=0,a=t.length;function o(i){if(i&&i.length){n(i);return}var s=r;r=r+1,s<a?e(t[s],o):n([])}o([])}function wr(t){var e=[];return Object.keys(t).forEach(function(n){e.push.apply(e,t[n]||[])}),e}var ut=function(t){gr(e,t);function e(n,r){var a;return a=t.call(this,"Async Validation Error")||this,a.errors=n,a.fields=r,a}return e}(Ue(Error));function Rr(t,e,n,r,a){if(e.first){var o=new Promise(function(h,b){var x=function(m){return r(m),m.length?b(new ut(m,Ye(m))):h(a)},p=wr(t);ct(p,n,x)});return o.catch(function(h){return h}),o}var i=e.firstFields===!0?Object.keys(t):e.firstFields||[],s=Object.keys(t),l=s.length,d=0,f=[],c=new Promise(function(h,b){var x=function(P){if(f.push.apply(f,P),d++,d===l)return r(f),f.length?b(new ut(f,Ye(f))):h(a)};s.length||(r(f),h(a)),s.forEach(function(p){var P=t[p];i.indexOf(p)!==-1?ct(P,n,x):xr(P,n,x)})});return c.catch(function(h){return h}),c}function Sr(t){return!!(t&&t.message!==void 0)}function Pr(t,e){for(var n=t,r=0;r<e.length;r++){if(n==null)return n;n=n[e[r]]}return n}function bt(t,e){return function(n){var r;return t.fullFields?r=Pr(e,t.fullFields):r=e[n.field||t.fullField],Sr(n)?(n.field=n.field||t.fullField,n.fieldValue=r,n):{message:typeof n=="function"?n():n,fieldValue:r,field:n.field||t.fullField}}}function gt(t,e){if(e){for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];typeof r=="object"&&typeof t[n]=="object"?t[n]=ce({},t[n],r):t[n]=r}}return t}var zt=function(e,n,r,a,o,i){e.required&&(!r.hasOwnProperty(e.field)||M(n,i||e.type))&&a.push(X(o.messages.required,e.fullField))},$r=function(e,n,r,a,o){(/^\s+$/.test(n)||n==="")&&a.push(X(o.messages.whitespace,e.fullField))},Fe,kr=function(){if(Fe)return Fe;var t="[a-fA-F\\d:]",e=function(F){return F&&F.includeBoundaries?"(?:(?<=\\s|^)(?="+t+")|(?<="+t+")(?=\\s|$))":""},n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",a=(`
|
|
(?:
|
|
(?:`+r+":){7}(?:"+r+`|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
(?:`+r+":){6}(?:"+n+"|:"+r+`|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
(?:`+r+":){5}(?::"+n+"|(?::"+r+`){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
(?:`+r+":){4}(?:(?::"+r+"){0,1}:"+n+"|(?::"+r+`){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
(?:`+r+":){3}(?:(?::"+r+"){0,2}:"+n+"|(?::"+r+`){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
(?:`+r+":){2}(?:(?::"+r+"){0,3}:"+n+"|(?::"+r+`){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
(?:`+r+":){1}(?:(?::"+r+"){0,4}:"+n+"|(?::"+r+`){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
(?::(?:(?::`+r+"){0,5}:"+n+"|(?::"+r+`){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
`).replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),o=new RegExp("(?:^"+n+"$)|(?:^"+a+"$)"),i=new RegExp("^"+n+"$"),s=new RegExp("^"+a+"$"),l=function(F){return F&&F.exact?o:new RegExp("(?:"+e(F)+n+e(F)+")|(?:"+e(F)+a+e(F)+")","g")};l.v4=function(v){return v&&v.exact?i:new RegExp(""+e(v)+n+e(v),"g")},l.v6=function(v){return v&&v.exact?s:new RegExp(""+e(v)+a+e(v),"g")};var d="(?:(?:[a-z]+:)?//)",f="(?:\\S+(?::\\S*)?@)?",c=l.v4().source,h=l.v6().source,b="(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)",x="(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*",p="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))",P="(?::\\d{2,5})?",m='(?:[/?#][^\\s"]*)?',$="(?:"+d+"|www\\.)"+f+"(?:localhost|"+c+"|"+h+"|"+b+x+p+")"+P+m;return Fe=new RegExp("(?:^"+$+"$)","i"),Fe},mt={email:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},xe={integer:function(e){return xe.number(e)&&parseInt(e,10)===e},float:function(e){return xe.number(e)&&!xe.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch{return!1}},date:function(e){return typeof e.getTime=="function"&&typeof e.getMonth=="function"&&typeof e.getYear=="function"&&!isNaN(e.getTime())},number:function(e){return isNaN(e)?!1:typeof e=="number"},object:function(e){return typeof e=="object"&&!xe.array(e)},method:function(e){return typeof e=="function"},email:function(e){return typeof e=="string"&&e.length<=320&&!!e.match(mt.email)},url:function(e){return typeof e=="string"&&e.length<=2048&&!!e.match(kr())},hex:function(e){return typeof e=="string"&&!!e.match(mt.hex)}},Cr=function(e,n,r,a,o){if(e.required&&n===void 0){zt(e,n,r,a,o);return}var i=["integer","float","array","regexp","object","method","email","number","date","url","hex"],s=e.type;i.indexOf(s)>-1?xe[s](n)||a.push(X(o.messages.types[s],e.fullField,e.type)):s&&typeof n!==e.type&&a.push(X(o.messages.types[s],e.fullField,e.type))},zr=function(e,n,r,a,o){var i=typeof e.len=="number",s=typeof e.min=="number",l=typeof e.max=="number",d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,f=n,c=null,h=typeof n=="number",b=typeof n=="string",x=Array.isArray(n);if(h?c="number":b?c="string":x&&(c="array"),!c)return!1;x&&(f=n.length),b&&(f=n.replace(d,"_").length),i?f!==e.len&&a.push(X(o.messages[c].len,e.fullField,e.len)):s&&!l&&f<e.min?a.push(X(o.messages[c].min,e.fullField,e.min)):l&&!s&&f>e.max?a.push(X(o.messages[c].max,e.fullField,e.max)):s&&l&&(f<e.min||f>e.max)&&a.push(X(o.messages[c].range,e.fullField,e.min,e.max))},he="enum",Fr=function(e,n,r,a,o){e[he]=Array.isArray(e[he])?e[he]:[],e[he].indexOf(n)===-1&&a.push(X(o.messages[he],e.fullField,e[he].join(", ")))},_r=function(e,n,r,a,o){if(e.pattern){if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(n)||a.push(X(o.messages.pattern.mismatch,e.fullField,n,e.pattern));else if(typeof e.pattern=="string"){var i=new RegExp(e.pattern);i.test(n)||a.push(X(o.messages.pattern.mismatch,e.fullField,n,e.pattern))}}},C={required:zt,whitespace:$r,type:Cr,range:zr,enum:Fr,pattern:_r},Tr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n,"string")&&!e.required)return r();C.required(e,n,a,i,o,"string"),M(n,"string")||(C.type(e,n,a,i,o),C.range(e,n,a,i,o),C.pattern(e,n,a,i,o),e.whitespace===!0&&C.whitespace(e,n,a,i,o))}r(i)},Ar=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&C.type(e,n,a,i,o)}r(i)},Er=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(n===""&&(n=void 0),M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&(C.type(e,n,a,i,o),C.range(e,n,a,i,o))}r(i)},Or=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&C.type(e,n,a,i,o)}r(i)},Lr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),M(n)||C.type(e,n,a,i,o)}r(i)},qr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&(C.type(e,n,a,i,o),C.range(e,n,a,i,o))}r(i)},jr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&(C.type(e,n,a,i,o),C.range(e,n,a,i,o))}r(i)},Wr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(n==null&&!e.required)return r();C.required(e,n,a,i,o,"array"),n!=null&&(C.type(e,n,a,i,o),C.range(e,n,a,i,o))}r(i)},Ir=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&C.type(e,n,a,i,o)}r(i)},Mr="enum",Br=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o),n!==void 0&&C[Mr](e,n,a,i,o)}r(i)},Nr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n,"string")&&!e.required)return r();C.required(e,n,a,i,o),M(n,"string")||C.pattern(e,n,a,i,o)}r(i)},Vr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n,"date")&&!e.required)return r();if(C.required(e,n,a,i,o),!M(n,"date")){var l;n instanceof Date?l=n:l=new Date(n),C.type(e,l,a,i,o),l&&C.range(e,l.getTime(),a,i,o)}}r(i)},Dr=function(e,n,r,a,o){var i=[],s=Array.isArray(n)?"array":typeof n;C.required(e,n,a,i,o,s),r(i)},Ne=function(e,n,r,a,o){var i=e.type,s=[],l=e.required||!e.required&&a.hasOwnProperty(e.field);if(l){if(M(n,i)&&!e.required)return r();C.required(e,n,a,s,o,i),M(n,i)||C.type(e,n,a,s,o)}r(s)},Hr=function(e,n,r,a,o){var i=[],s=e.required||!e.required&&a.hasOwnProperty(e.field);if(s){if(M(n)&&!e.required)return r();C.required(e,n,a,i,o)}r(i)},Re={string:Tr,method:Ar,number:Er,boolean:Or,regexp:Lr,integer:qr,float:jr,array:Wr,object:Ir,enum:Br,pattern:Nr,date:Vr,url:Ne,hex:Ne,email:Ne,required:Dr,any:Hr};function Ge(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var Xe=Ge(),$e=function(){function t(n){this.rules=null,this._messages=Xe,this.define(n)}var e=t.prototype;return e.define=function(r){var a=this;if(!r)throw new Error("Cannot configure a schema with no rules");if(typeof r!="object"||Array.isArray(r))throw new Error("Rules must be an object");this.rules={},Object.keys(r).forEach(function(o){var i=r[o];a.rules[o]=Array.isArray(i)?i:[i]})},e.messages=function(r){return r&&(this._messages=gt(Ge(),r)),this._messages},e.validate=function(r,a,o){var i=this;a===void 0&&(a={}),o===void 0&&(o=function(){});var s=r,l=a,d=o;if(typeof l=="function"&&(d=l,l={}),!this.rules||Object.keys(this.rules).length===0)return d&&d(null,s),Promise.resolve(s);function f(p){var P=[],m={};function $(F){if(Array.isArray(F)){var O;P=(O=P).concat.apply(O,F)}else P.push(F)}for(var v=0;v<p.length;v++)$(p[v]);P.length?(m=Ye(P),d(P,m)):d(null,s)}if(l.messages){var c=this.messages();c===Xe&&(c=Ge()),gt(c,l.messages),l.messages=c}else l.messages=this.messages();var h={},b=l.keys||Object.keys(this.rules);b.forEach(function(p){var P=i.rules[p],m=s[p];P.forEach(function($){var v=$;typeof v.transform=="function"&&(s===r&&(s=ce({},s)),m=s[p]=v.transform(m)),typeof v=="function"?v={validator:v}:v=ce({},v),v.validator=i.getValidationMethod(v),v.validator&&(v.field=p,v.fullField=v.fullField||p,v.type=i.getType(v),h[p]=h[p]||[],h[p].push({rule:v,value:m,source:s,field:p}))})});var x={};return Rr(h,l,function(p,P){var m=p.rule,$=(m.type==="object"||m.type==="array")&&(typeof m.fields=="object"||typeof m.defaultField=="object");$=$&&(m.required||!m.required&&p.value),m.field=p.field;function v(S,A){return ce({},A,{fullField:m.fullField+"."+S,fullFields:m.fullFields?[].concat(m.fullFields,[S]):[S]})}function F(S){S===void 0&&(S=[]);var A=Array.isArray(S)?S:[S];!l.suppressWarning&&A.length&&t.warning("async-validator:",A),A.length&&m.message!==void 0&&(A=[].concat(m.message));var j=A.map(bt(m,s));if(l.first&&j.length)return x[m.field]=1,P(j);if(!$)P(j);else{if(m.required&&!p.value)return m.message!==void 0?j=[].concat(m.message).map(bt(m,s)):l.error&&(j=[l.error(m,X(l.messages.required,m.field))]),P(j);var B={};m.defaultField&&Object.keys(p.value).map(function(D){B[D]=m.defaultField}),B=ce({},B,p.rule.fields);var ie={};Object.keys(B).forEach(function(D){var R=B[D],H=Array.isArray(R)?R:[R];ie[D]=H.map(v.bind(null,D))});var G=new t(ie);G.messages(l.messages),p.rule.options&&(p.rule.options.messages=l.messages,p.rule.options.error=l.error),G.validate(p.value,p.rule.options||l,function(D){var R=[];j&&j.length&&R.push.apply(R,j),D&&D.length&&R.push.apply(R,D),P(R.length?R:null)})}}var O;if(m.asyncValidator)O=m.asyncValidator(m,p.value,F,p.source,l);else if(m.validator){try{O=m.validator(m,p.value,F,p.source,l)}catch(S){console.error==null||console.error(S),l.suppressValidatorError||setTimeout(function(){throw S},0),F(S.message)}O===!0?F():O===!1?F(typeof m.message=="function"?m.message(m.fullField||m.field):m.message||(m.fullField||m.field)+" fails"):O instanceof Array?F(O):O instanceof Error&&F(O.message)}O&&O.then&&O.then(function(){return F()},function(S){return F(S)})},function(p){f(p)},s)},e.getType=function(r){if(r.type===void 0&&r.pattern instanceof RegExp&&(r.type="pattern"),typeof r.validator!="function"&&r.type&&!Re.hasOwnProperty(r.type))throw new Error(X("Unknown rule type %s",r.type));return r.type||"string"},e.getValidationMethod=function(r){if(typeof r.validator=="function")return r.validator;var a=Object.keys(r),o=a.indexOf("message");return o!==-1&&a.splice(o,1),a.length===1&&a[0]==="required"?Re.required:Re[this.getType(r)]||void 0},t}();$e.register=function(e,n){if(typeof n!="function")throw new Error("Cannot register a validator by type, validator is not a function");Re[e]=n};$e.warning=vr;$e.messages=Xe;$e.validators=Re;function Ur(t){const e=ue(Pe,null);return{mergedSize:T(()=>t.size!==void 0?t.size:(e==null?void 0:e.props.size)!==void 0?e.props.size:"medium")}}function Yr(t){const e=ue(Pe,null),n=T(()=>{const{labelPlacement:b}=t;return b!==void 0?b:e!=null&&e.props.labelPlacement?e.props.labelPlacement:"top"}),r=T(()=>n.value==="left"&&(t.labelWidth==="auto"||(e==null?void 0:e.props.labelWidth)==="auto")),a=T(()=>{if(n.value==="top")return;const{labelWidth:b}=t;if(b!==void 0&&b!=="auto")return _e(b);if(r.value){const x=e==null?void 0:e.maxChildLabelWidthRef.value;return x!==void 0?_e(x):void 0}if((e==null?void 0:e.props.labelWidth)!==void 0)return _e(e.props.labelWidth)}),o=T(()=>{const{labelAlign:b}=t;if(b)return b;if(e!=null&&e.props.labelAlign)return e.props.labelAlign}),i=T(()=>{var b;return[(b=t.labelProps)===null||b===void 0?void 0:b.style,t.labelStyle,{width:a.value}]}),s=T(()=>{const{showRequireMark:b}=t;return b!==void 0?b:e==null?void 0:e.props.showRequireMark}),l=T(()=>{const{requireMarkPlacement:b}=t;return b!==void 0?b:(e==null?void 0:e.props.requireMarkPlacement)||"right"}),d=q(!1),f=T(()=>{const{validationStatus:b}=t;if(b!==void 0)return b;if(d.value)return"error"}),c=T(()=>{const{showFeedback:b}=t;return b!==void 0?b:(e==null?void 0:e.props.showFeedback)!==void 0?e.props.showFeedback:!0}),h=T(()=>{const{showLabel:b}=t;return b!==void 0?b:(e==null?void 0:e.props.showLabel)!==void 0?e.props.showLabel:!0});return{validationErrored:d,mergedLabelStyle:i,mergedLabelPlacement:n,mergedLabelAlign:o,mergedShowRequireMark:s,mergedRequireMarkPlacement:l,mergedValidationStatus:f,mergedShowFeedback:c,mergedShowLabel:h,isAutoLabelWidth:r}}function Gr(t){const e=ue(Pe,null),n=T(()=>{const{rulePath:i}=t;if(i!==void 0)return i;const{path:s}=t;if(s!==void 0)return s}),r=T(()=>{const i=[],{rule:s}=t;if(s!==void 0&&(Array.isArray(s)?i.push(...s):i.push(s)),e){const{rules:l}=e.props,{value:d}=n;if(l!==void 0&&d!==void 0){const f=$t(l,d);f!==void 0&&(Array.isArray(f)?i.push(...f):i.push(f))}}return i}),a=T(()=>r.value.some(i=>i.required)),o=T(()=>a.value||t.required);return{mergedRules:r,mergedRequired:o}}const{cubicBezierEaseInOut:ht}=ln;function Xr({name:t="fade-down",fromOffset:e="-4px",enterDuration:n=".3s",leaveDuration:r=".3s",enterCubicBezier:a=ht,leaveCubicBezier:o=ht}={}){return[L(`&.${t}-transition-enter-from, &.${t}-transition-leave-to`,{opacity:0,transform:`translateY(${e})`}),L(`&.${t}-transition-enter-to, &.${t}-transition-leave-from`,{opacity:1,transform:"translateY(0)"}),L(`&.${t}-transition-leave-active`,{transition:`opacity ${r} ${o}, transform ${r} ${o}`}),L(`&.${t}-transition-enter-active`,{transition:`opacity ${n} ${a}, transform ${n} ${a}`})]}const Kr=y("form-item",`
|
|
display: grid;
|
|
line-height: var(--n-line-height);
|
|
`,[y("form-item-label",`
|
|
grid-area: label;
|
|
align-items: center;
|
|
line-height: 1.25;
|
|
text-align: var(--n-label-text-align);
|
|
font-size: var(--n-label-font-size);
|
|
min-height: var(--n-label-height);
|
|
padding: var(--n-label-padding);
|
|
color: var(--n-label-text-color);
|
|
transition: color .3s var(--n-bezier);
|
|
box-sizing: border-box;
|
|
font-weight: var(--n-label-font-weight);
|
|
`,[J("asterisk",`
|
|
white-space: nowrap;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
color: var(--n-asterisk-color);
|
|
transition: color .3s var(--n-bezier);
|
|
`),J("asterisk-placeholder",`
|
|
grid-area: mark;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
visibility: hidden;
|
|
`)]),y("form-item-blank",`
|
|
grid-area: blank;
|
|
min-height: var(--n-blank-height);
|
|
`),_("auto-label-width",[y("form-item-label","white-space: nowrap;")]),_("left-labelled",`
|
|
grid-template-areas:
|
|
"label blank"
|
|
"label feedback";
|
|
grid-template-columns: auto minmax(0, 1fr);
|
|
grid-template-rows: auto 1fr;
|
|
align-items: start;
|
|
`,[y("form-item-label",`
|
|
display: grid;
|
|
grid-template-columns: 1fr auto;
|
|
min-height: var(--n-blank-height);
|
|
height: auto;
|
|
box-sizing: border-box;
|
|
flex-shrink: 0;
|
|
flex-grow: 0;
|
|
`,[_("reverse-columns-space",`
|
|
grid-template-columns: auto 1fr;
|
|
`),_("left-mark",`
|
|
grid-template-areas:
|
|
"mark text"
|
|
". text";
|
|
`),_("right-mark",`
|
|
grid-template-areas:
|
|
"text mark"
|
|
"text .";
|
|
`),_("right-hanging-mark",`
|
|
grid-template-areas:
|
|
"text mark"
|
|
"text .";
|
|
`),J("text",`
|
|
grid-area: text;
|
|
`),J("asterisk",`
|
|
grid-area: mark;
|
|
align-self: end;
|
|
`)])]),_("top-labelled",`
|
|
grid-template-areas:
|
|
"label"
|
|
"blank"
|
|
"feedback";
|
|
grid-template-rows: minmax(var(--n-label-height), auto) 1fr;
|
|
grid-template-columns: minmax(0, 100%);
|
|
`,[_("no-label",`
|
|
grid-template-areas:
|
|
"blank"
|
|
"feedback";
|
|
grid-template-rows: 1fr;
|
|
`),y("form-item-label",`
|
|
display: flex;
|
|
align-items: flex-start;
|
|
justify-content: var(--n-label-text-align);
|
|
`)]),y("form-item-blank",`
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
align-items: center;
|
|
position: relative;
|
|
`),y("form-item-feedback-wrapper",`
|
|
grid-area: feedback;
|
|
box-sizing: border-box;
|
|
min-height: var(--n-feedback-height);
|
|
font-size: var(--n-feedback-font-size);
|
|
line-height: 1.25;
|
|
transform-origin: top left;
|
|
`,[L("&:not(:empty)",`
|
|
padding: var(--n-feedback-padding);
|
|
`),y("form-item-feedback",{transition:"color .3s var(--n-bezier)",color:"var(--n-feedback-text-color)"},[_("warning",{color:"var(--n-feedback-text-color-warning)"}),_("error",{color:"var(--n-feedback-text-color-error)"}),Xr({fromOffset:"-3px",enterDuration:".3s",leaveDuration:".2s"})])])]);var pt=globalThis&&globalThis.__awaiter||function(t,e,n,r){function a(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function s(f){try{d(r.next(f))}catch(c){i(c)}}function l(f){try{d(r.throw(f))}catch(c){i(c)}}function d(f){f.done?o(f.value):a(f.value).then(s,l)}d((r=r.apply(t,e||[])).next())})};const Jr=Object.assign(Object.assign({},de.props),{label:String,labelWidth:[Number,String],labelStyle:[String,Object],labelAlign:String,labelPlacement:String,path:String,first:Boolean,rulePath:String,required:Boolean,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:void 0},rule:[Object,Array],size:String,ignorePathChange:Boolean,validationStatus:String,feedback:String,showLabel:{type:Boolean,default:void 0},labelProps:Object});function vt(t,e){return(...n)=>{try{const r=t(...n);return!e&&(typeof r=="boolean"||r instanceof Error||Array.isArray(r))||(r==null?void 0:r.then)?r:(r===void 0||rt("form-item/validate",`You return a ${typeof r} typed value in the validator method, which is not recommended. Please use `+(e?"`Promise`":"`boolean`, `Error` or `Promise`")+" typed value instead."),!0)}catch(r){rt("form-item/validate","An error is catched in the validation, so the validation won't be done. Your callback in `validate` method of `n-form` or `n-form-item` won't be called in this validation."),console.error(r);return}}}const yt=ne({name:"FormItem",props:Jr,setup(t){Un(Ct,"formItems",Q(t,"path"));const{mergedClsPrefixRef:e,inlineThemeDisabled:n}=Oe(t),r=ue(Pe,null),a=Ur(t),o=Yr(t),{validationErrored:i}=o,{mergedRequired:s,mergedRules:l}=Gr(t),{mergedSize:d}=a,{mergedLabelPlacement:f,mergedLabelAlign:c,mergedRequireMarkPlacement:h}=o,b=q([]),x=q(nt()),p=r?Q(r.props,"disabled"):q(!1),P=de("Form","-form-item",Kr,Pt,t,e);we(Q(t,"path"),()=>{t.ignorePathChange||m()});function m(){b.value=[],i.value=!1,t.feedback&&(x.value=nt())}function $(){A("blur")}function v(){A("change")}function F(){A("focus")}function O(){A("input")}function S(R,H){return pt(this,void 0,void 0,function*(){let U,N,ee,re;return typeof R=="string"?(U=R,N=H):R!==null&&typeof R=="object"&&(U=R.trigger,N=R.callback,ee=R.shouldRuleBeApplied,re=R.options),yield new Promise((oe,se)=>{A(U,ee,re).then(({valid:le,errors:te})=>{le?(N&&N(),oe()):(N&&N(te),se(te))})})})}const A=(R=null,H=()=>!0,U={suppressWarning:!0})=>pt(this,void 0,void 0,function*(){const{path:N}=t;U?U.first||(U.first=t.first):U={};const{value:ee}=l,re=r?$t(r.props.model,N||""):void 0,oe={},se={},le=(R?ee.filter(K=>Array.isArray(K.trigger)?K.trigger.includes(R):K.trigger===R):ee).filter(H).map((K,Y)=>{const E=Object.assign({},K);if(E.validator&&(E.validator=vt(E.validator,!1)),E.asyncValidator&&(E.asyncValidator=vt(E.asyncValidator,!0)),E.renderMessage){const V=`__renderMessage__${Y}`;se[V]=E.message,E.message=V,oe[V]=E.renderMessage}return E});if(!le.length)return{valid:!0};const te=N!=null?N:"__n_no_path__",fe=new $e({[te]:le}),{validateMessages:be}=(r==null?void 0:r.props)||{};return be&&fe.messages(be),yield new Promise(K=>{fe.validate({[te]:re},U,Y=>{Y!=null&&Y.length?(b.value=Y.map(E=>{const V=(E==null?void 0:E.message)||"";return{key:V,render:()=>V.startsWith("__renderMessage__")?oe[V]():V}}),Y.forEach(E=>{var V;!((V=E.message)===null||V===void 0)&&V.startsWith("__renderMessage__")&&(E.message=se[E.message])}),i.value=!0,K({valid:!1,errors:Y})):(m(),K({valid:!0}))})})});Ee(dn,{path:Q(t,"path"),disabled:p,mergedSize:a.mergedSize,mergedValidationStatus:o.mergedValidationStatus,restoreValidation:m,handleContentBlur:$,handleContentChange:v,handleContentFocus:F,handleContentInput:O});const j={validate:S,restoreValidation:m,internalValidate:A},B=q(null);fn(()=>{if(!o.isAutoLabelWidth.value)return;const R=B.value;if(R!==null){const H=R.style.whiteSpace;R.style.whiteSpace="nowrap",R.style.width="",r==null||r.deriveMaxChildLabelWidth(Number(getComputedStyle(R).width.slice(0,-2))),R.style.whiteSpace=H}});const ie=T(()=>{var R;const{value:H}=d,{value:U}=f,N=U==="top"?"vertical":"horizontal",{common:{cubicBezierEaseInOut:ee},self:{labelTextColor:re,asteriskColor:oe,lineHeight:se,feedbackTextColor:le,feedbackTextColorWarning:te,feedbackTextColorError:fe,feedbackPadding:be,labelFontWeight:K,[I("labelHeight",H)]:Y,[I("blankHeight",H)]:E,[I("feedbackFontSize",H)]:V,[I("feedbackHeight",H)]:Le,[I("labelPadding",N)]:pe,[I("labelTextAlign",N)]:qe,[I(I("labelFontSize",U),H)]:ke}}=P.value;let ve=(R=c.value)!==null&&R!==void 0?R:qe;return U==="top"&&(ve=ve==="right"?"flex-end":"flex-start"),{"--n-bezier":ee,"--n-line-height":se,"--n-blank-height":E,"--n-label-font-size":ke,"--n-label-text-align":ve,"--n-label-height":Y,"--n-label-padding":pe,"--n-label-font-weight":K,"--n-asterisk-color":oe,"--n-label-text-color":re,"--n-feedback-padding":be,"--n-feedback-font-size":V,"--n-feedback-height":Le,"--n-feedback-text-color":le,"--n-feedback-text-color-warning":te,"--n-feedback-text-color-error":fe}}),G=n?Ze("form-item",T(()=>{var R;return`${d.value[0]}${f.value[0]}${((R=c.value)===null||R===void 0?void 0:R[0])||""}`}),ie,t):void 0,D=T(()=>f.value==="left"&&h.value==="left"&&c.value==="left");return Object.assign(Object.assign(Object.assign(Object.assign({labelElementRef:B,mergedClsPrefix:e,mergedRequired:s,feedbackId:x,renderExplains:b,reverseColSpace:D},o),a),j),{cssVars:n?void 0:ie,themeClass:G==null?void 0:G.themeClass,onRender:G==null?void 0:G.onRender})},render(){const{$slots:t,mergedClsPrefix:e,mergedShowLabel:n,mergedShowRequireMark:r,mergedRequireMarkPlacement:a,onRender:o}=this,i=r!==void 0?r:this.mergedRequired;o==null||o();const s=()=>{const l=this.$slots.label?this.$slots.label():this.label;if(!l)return null;const d=w("span",{class:`${e}-form-item-label__text`},l),f=i?w("span",{class:`${e}-form-item-label__asterisk`},a!=="left"?"\xA0*":"*\xA0"):a==="right-hanging"&&w("span",{class:`${e}-form-item-label__asterisk-placeholder`},"\xA0*"),{labelProps:c}=this;return w("label",Object.assign({},c,{class:[c==null?void 0:c.class,`${e}-form-item-label`,`${e}-form-item-label--${a}-mark`,this.reverseColSpace&&`${e}-form-item-label--reverse-columns-space`],style:this.mergedLabelStyle,ref:"labelElementRef"}),a==="left"?[f,d]:[d,f])};return w("div",{class:[`${e}-form-item`,this.themeClass,`${e}-form-item--${this.mergedSize}-size`,`${e}-form-item--${this.mergedLabelPlacement}-labelled`,this.isAutoLabelWidth&&`${e}-form-item--auto-label-width`,!n&&`${e}-form-item--no-label`],style:this.cssVars},n&&s(),w("div",{class:[`${e}-form-item-blank`,this.mergedValidationStatus&&`${e}-form-item-blank--${this.mergedValidationStatus}`]},t),this.mergedShowFeedback?w("div",{key:this.feedbackId,class:`${e}-form-item-feedback-wrapper`},w(cn,{name:"fade-down-transition",mode:"out-in"},{default:()=>{const{mergedValidationStatus:l}=this;return De(t.feedback,d=>{var f;const{feedback:c}=this,h=d||c?w("div",{key:"__feedback__",class:`${e}-form-item-feedback__line`},d||c):this.renderExplains.length?(f=this.renderExplains)===null||f===void 0?void 0:f.map(({key:b,render:x})=>w("div",{key:b,class:`${e}-form-item-feedback__line`},x())):null;return h?l==="warning"?w("div",{key:"controlled-warning",class:`${e}-form-item-feedback ${e}-form-item-feedback--warning`},h):l==="error"?w("div",{key:"controlled-error",class:`${e}-form-item-feedback ${e}-form-item-feedback--error`},h):l==="success"?w("div",{key:"controlled-success",class:`${e}-form-item-feedback ${e}-form-item-feedback--success`},h):w("div",{key:"controlled-default",class:`${e}-form-item-feedback`},h):null})}})):null)}}),Zr=t=>{const{primaryColor:e,successColor:n,warningColor:r,errorColor:a,infoColor:o,fontWeightStrong:i}=t;return{fontWeight:i,rotate:"252deg",colorStartPrimary:ye(e,{alpha:.6}),colorEndPrimary:e,colorStartInfo:ye(o,{alpha:.6}),colorEndInfo:o,colorStartWarning:ye(r,{alpha:.6}),colorEndWarning:r,colorStartError:ye(a,{alpha:.6}),colorEndError:a,colorStartSuccess:ye(n,{alpha:.6}),colorEndSuccess:n}},Qr={name:"GradientText",common:un,self:Zr},ea=Qr,ta=y("gradient-text",`
|
|
display: inline-block;
|
|
font-weight: var(--n-font-weight);
|
|
-webkit-background-clip: text;
|
|
background-clip: text;
|
|
color: #0000;
|
|
white-space: nowrap;
|
|
background-image: linear-gradient(var(--n-rotate), var(--n-color-start) 0%, var(--n-color-end) 100%);
|
|
transition:
|
|
--n-color-start .3s var(--n-bezier),
|
|
--n-color-end .3s var(--n-bezier);
|
|
`),na=Object.assign(Object.assign({},de.props),{size:[String,Number],fontSize:[String,Number],type:{type:String,default:"primary"},color:[Object,String],gradient:[Object,String]}),ra=ne({name:"GradientText",props:na,setup(t){Yn();const{mergedClsPrefixRef:e,inlineThemeDisabled:n}=Oe(t),r=T(()=>{const{type:d}=t;return d==="danger"?"error":d}),a=T(()=>{let d=t.size||t.fontSize;return d&&(d=_e(d)),d||void 0}),o=T(()=>{const d=t.color||t.gradient;if(typeof d=="string")return d;if(d){const f=d.deg||0,c=d.from,h=d.to;return`linear-gradient(${f}deg, ${c} 0%, ${h} 100%)`}}),i=de("GradientText","-gradient-text",ta,ea,t,e),s=T(()=>{const{value:d}=r,{common:{cubicBezierEaseInOut:f},self:{rotate:c,[I("colorStart",d)]:h,[I("colorEnd",d)]:b,fontWeight:x}}=i.value;return{"--n-bezier":f,"--n-rotate":c,"--n-color-start":h,"--n-color-end":b,"--n-font-weight":x}}),l=n?Ze("gradient-text",T(()=>r.value[0]),s,t):void 0;return{mergedClsPrefix:e,compatibleType:r,styleFontSize:a,styleBgImage:o,cssVars:n?void 0:s,themeClass:l==null?void 0:l.themeClass,onRender:l==null?void 0:l.onRender}},render(){const{mergedClsPrefix:t,onRender:e}=this;return e==null||e(),w("span",{class:[`${t}-gradient-text`,`${t}-gradient-text--${this.compatibleType}-type`,this.themeClass],style:[{fontSize:this.styleFontSize,backgroundImage:this.styleBgImage},this.cssVars]},this.$slots)}}),Qe=Je("n-tabs"),Ft={tab:[String,Number,Object,Function],name:{type:[String,Number],required:!0},disabled:Boolean,displayDirective:{type:String,default:"if"},closable:{type:Boolean,default:void 0},tabProps:Object,label:[String,Number,Object,Function]},xt=ne({__TAB_PANE__:!0,name:"TabPane",alias:["TabPanel"],props:Ft,setup(t){const e=ue(Qe,null);return e||bn("tab-pane","`n-tab-pane` must be placed inside `n-tabs`."),{style:e.paneStyleRef,class:e.paneClassRef,mergedClsPrefix:e.mergedClsPrefixRef}},render(){return w("div",{class:[`${this.mergedClsPrefix}-tab-pane`,this.class],style:this.style},this.$slots)}}),aa=Object.assign({internalLeftPadded:Boolean,internalAddable:Boolean,internalCreatedByPane:Boolean},yn(Ft,["displayDirective"])),Ke=ne({__TAB__:!0,inheritAttrs:!1,name:"Tab",props:aa,setup(t){const{mergedClsPrefixRef:e,valueRef:n,typeRef:r,closableRef:a,tabStyleRef:o,tabChangeIdRef:i,onBeforeLeaveRef:s,triggerRef:l,handleAdd:d,activateTab:f,handleClose:c}=ue(Qe);return{trigger:l,mergedClosable:T(()=>{if(t.internalAddable)return!1;const{closable:h}=t;return h===void 0?a.value:h}),style:o,clsPrefix:e,value:n,type:r,handleClose(h){h.stopPropagation(),!t.disabled&&c(t.name)},activateTab(){if(t.disabled)return;if(t.internalAddable){d();return}const{name:h}=t,b=++i.id;if(h!==n.value){const{value:x}=s;x?Promise.resolve(x(t.name,n.value)).then(p=>{p&&i.id===b&&f(h)}):f(h)}}}},render(){const{internalAddable:t,clsPrefix:e,name:n,disabled:r,label:a,tab:o,value:i,mergedClosable:s,style:l,trigger:d,$slots:{default:f}}=this,c=a!=null?a:o;return w("div",{class:`${e}-tabs-tab-wrapper`},this.internalLeftPadded?w("div",{class:`${e}-tabs-tab-pad`}):null,w("div",Object.assign({key:n,"data-name":n,"data-disabled":r?!0:void 0},gn({class:[`${e}-tabs-tab`,i===n&&`${e}-tabs-tab--active`,r&&`${e}-tabs-tab--disabled`,s&&`${e}-tabs-tab--closable`,t&&`${e}-tabs-tab--addable`],onClick:d==="click"?this.activateTab:void 0,onMouseenter:d==="hover"?this.activateTab:void 0,style:t?void 0:l},this.internalCreatedByPane?this.tabProps||{}:this.$attrs)),w("span",{class:`${e}-tabs-tab__label`},t?w(mn,null,w("div",{class:`${e}-tabs-tab__height-placeholder`},"\xA0"),w(hn,{clsPrefix:e},{default:()=>w(Hn,null)})):f?f():typeof c=="object"?c:pn(c!=null?c:n)),s&&this.type==="card"?w(vn,{clsPrefix:e,class:`${e}-tabs-tab__close`,onClick:this.handleClose,disabled:r}):null))}}),ia=y("tabs",`
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
transition:
|
|
background-color .3s var(--n-bezier),
|
|
border-color .3s var(--n-bezier);
|
|
`,[_("segment-type",[y("tabs-rail",[L("&.transition-disabled","color: red;",[y("tabs-tab",`
|
|
transition: none;
|
|
`)])])]),_("left, right",`
|
|
flex-direction: row;
|
|
`,[y("tabs-bar",`
|
|
width: 2px;
|
|
right: 0;
|
|
transition:
|
|
top .2s var(--n-bezier),
|
|
max-height .2s var(--n-bezier),
|
|
background-color .3s var(--n-bezier);
|
|
`),y("tabs-tab",`
|
|
padding: var(--n-tab-padding-vertical);
|
|
`)]),_("right",`
|
|
flex-direction: row-reverse;
|
|
`,[y("tabs-bar",`
|
|
left: 0;
|
|
`)]),_("bottom",`
|
|
flex-direction: column-reverse;
|
|
justify-content: flex-end;
|
|
`,[y("tabs-bar",`
|
|
top: 0;
|
|
`)]),y("tabs-rail",`
|
|
padding: 3px;
|
|
border-radius: var(--n-tab-border-radius);
|
|
width: 100%;
|
|
background-color: var(--n-color-segment);
|
|
transition: background-color .3s var(--n-bezier);
|
|
display: flex;
|
|
align-items: center;
|
|
`,[y("tabs-tab-wrapper",`
|
|
flex-basis: 0;
|
|
flex-grow: 1;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
`,[y("tabs-tab",`
|
|
overflow: hidden;
|
|
border-radius: var(--n-tab-border-radius);
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
`,[_("active",`
|
|
font-weight: var(--n-font-weight-strong);
|
|
color: var(--n-tab-text-color-active);
|
|
background-color: var(--n-tab-color-segment);
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .08);
|
|
`),L("&:hover",`
|
|
color: var(--n-tab-text-color-hover);
|
|
`)])])]),_("flex",[y("tabs-nav",{width:"100%"},[y("tabs-wrapper",{width:"100%"},[y("tabs-tab",{marginRight:0})])])]),y("tabs-nav",`
|
|
box-sizing: border-box;
|
|
line-height: 1.5;
|
|
display: flex;
|
|
transition: border-color .3s var(--n-bezier);
|
|
`,[J("prefix, suffix",`
|
|
display: flex;
|
|
align-items: center;
|
|
`),J("prefix","padding-right: 16px;"),J("suffix","padding-left: 16px;")]),y("tabs-nav-scroll-wrapper",`
|
|
flex: 1;
|
|
position: relative;
|
|
overflow: hidden;
|
|
`,[_("shadow-before",[L("&::before",`
|
|
box-shadow: inset 10px 0 8px -8px rgba(0, 0, 0, .12);
|
|
`)]),_("shadow-after",[L("&::after",`
|
|
box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, .12);
|
|
`)]),y("tabs-nav-y-scroll",`
|
|
height: 100%;
|
|
width: 100%;
|
|
overflow-y: auto;
|
|
scrollbar-width: none;
|
|
`,[L("&::-webkit-scrollbar",`
|
|
width: 0;
|
|
height: 0;
|
|
`)]),L("&::before, &::after",`
|
|
transition: box-shadow .3s var(--n-bezier);
|
|
pointer-events: none;
|
|
content: "";
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 20px;
|
|
z-index: 1;
|
|
`),L("&::before",`
|
|
left: 0;
|
|
`),L("&::after",`
|
|
right: 0;
|
|
`)]),y("tabs-nav-scroll-content",`
|
|
display: flex;
|
|
position: relative;
|
|
min-width: 100%;
|
|
width: fit-content;
|
|
`),y("tabs-wrapper",`
|
|
display: inline-flex;
|
|
flex-wrap: nowrap;
|
|
position: relative;
|
|
`),y("tabs-tab-wrapper",`
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
flex-shrink: 0;
|
|
flex-grow: 0;
|
|
`),y("tabs-tab",`
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
flex-wrap: nowrap;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
color: var(--n-tab-text-color);
|
|
font-size: var(--n-tab-font-size);
|
|
background-clip: padding-box;
|
|
padding: var(--n-tab-padding);
|
|
transition:
|
|
box-shadow .3s var(--n-bezier),
|
|
color .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier),
|
|
border-color .3s var(--n-bezier);
|
|
`,[_("disabled",{cursor:"not-allowed"}),J("close",`
|
|
margin-left: 6px;
|
|
transition:
|
|
background-color .3s var(--n-bezier),
|
|
color .3s var(--n-bezier);
|
|
`),J("label",`
|
|
display: flex;
|
|
align-items: center;
|
|
`)]),y("tabs-bar",`
|
|
position: absolute;
|
|
bottom: 0;
|
|
height: 2px;
|
|
border-radius: 1px;
|
|
background-color: var(--n-bar-color);
|
|
transition:
|
|
left .2s var(--n-bezier),
|
|
max-width .2s var(--n-bezier),
|
|
background-color .3s var(--n-bezier);
|
|
`,[L("&.transition-disabled",`
|
|
transition: none;
|
|
`),_("disabled",`
|
|
background-color: var(--n-tab-text-color-disabled)
|
|
`)]),y("tabs-pane-wrapper",`
|
|
position: relative;
|
|
overflow: hidden;
|
|
transition: max-height .2s var(--n-bezier);
|
|
`),y("tab-pane",`
|
|
color: var(--n-pane-text-color);
|
|
width: 100%;
|
|
padding: var(--n-pane-padding);
|
|
transition:
|
|
color .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier),
|
|
opacity .2s var(--n-bezier);
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
`,[L("&.next-transition-leave-active, &.prev-transition-leave-active, &.next-transition-enter-active, &.prev-transition-enter-active",`
|
|
transition:
|
|
color .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier),
|
|
transform .2s var(--n-bezier),
|
|
opacity .2s var(--n-bezier);
|
|
`),L("&.next-transition-leave-active, &.prev-transition-leave-active",`
|
|
position: absolute;
|
|
`),L("&.next-transition-enter-from, &.prev-transition-leave-to",`
|
|
transform: translateX(32px);
|
|
opacity: 0;
|
|
`),L("&.next-transition-leave-to, &.prev-transition-enter-from",`
|
|
transform: translateX(-32px);
|
|
opacity: 0;
|
|
`),L("&.next-transition-leave-from, &.next-transition-enter-to, &.prev-transition-leave-from, &.prev-transition-enter-to",`
|
|
transform: translateX(0);
|
|
opacity: 1;
|
|
`)]),y("tabs-tab-pad",`
|
|
width: var(--n-tab-gap);
|
|
flex-grow: 0;
|
|
flex-shrink: 0;
|
|
`),_("line-type, bar-type",[y("tabs-tab",`
|
|
font-weight: var(--n-tab-font-weight);
|
|
box-sizing: border-box;
|
|
vertical-align: bottom;
|
|
`,[L("&:hover",{color:"var(--n-tab-text-color-hover)"}),_("active",`
|
|
color: var(--n-tab-text-color-active);
|
|
font-weight: var(--n-tab-font-weight-active);
|
|
`),_("disabled",{color:"var(--n-tab-text-color-disabled)"})])]),y("tabs-nav",[_("line-type",[J("prefix, suffix",`
|
|
transition: border-color .3s var(--n-bezier);
|
|
border-bottom: 1px solid var(--n-tab-border-color);
|
|
`),y("tabs-nav-scroll-content",`
|
|
transition: border-color .3s var(--n-bezier);
|
|
border-bottom: 1px solid var(--n-tab-border-color);
|
|
`),y("tabs-bar",`
|
|
border-radius: 0;
|
|
bottom: -1px;
|
|
`)]),_("card-type",[J("prefix, suffix",`
|
|
transition: border-color .3s var(--n-bezier);
|
|
border-bottom: 1px solid var(--n-tab-border-color);
|
|
`),y("tabs-pad",`
|
|
flex-grow: 1;
|
|
transition: border-color .3s var(--n-bezier);
|
|
border-bottom: 1px solid var(--n-tab-border-color);
|
|
`),y("tabs-tab-pad",`
|
|
transition: border-color .3s var(--n-bezier);
|
|
border-bottom: 1px solid var(--n-tab-border-color);
|
|
`),y("tabs-tab",`
|
|
font-weight: var(--n-tab-font-weight);
|
|
border: 1px solid var(--n-tab-border-color);
|
|
border-top-left-radius: var(--n-tab-border-radius);
|
|
border-top-right-radius: var(--n-tab-border-radius);
|
|
background-color: var(--n-tab-color);
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
vertical-align: bottom;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
font-size: var(--n-tab-font-size);
|
|
color: var(--n-tab-text-color);
|
|
`,[_("addable",`
|
|
padding-left: 8px;
|
|
padding-right: 8px;
|
|
font-size: 16px;
|
|
`,[J("height-placeholder",`
|
|
width: 0;
|
|
font-size: var(--n-tab-font-size);
|
|
`),xn("disabled",[L("&:hover",`
|
|
color: var(--n-tab-text-color-hover);
|
|
`)])]),_("closable","padding-right: 6px;"),_("active",`
|
|
border-bottom: 1px solid #0000;
|
|
background-color: #0000;
|
|
font-weight: var(--n-tab-font-weight-active);
|
|
color: var(--n-tab-text-color-active);
|
|
`),_("disabled","color: var(--n-tab-text-color-disabled);")]),y("tabs-scroll-padding","border-bottom: 1px solid var(--n-tab-border-color);")]),_("left, right",[y("tabs-wrapper",`
|
|
flex-direction: column;
|
|
`,[y("tabs-tab-wrapper",`
|
|
flex-direction: column;
|
|
`,[y("tabs-tab-pad",`
|
|
height: var(--n-tab-gap);
|
|
width: 100%;
|
|
`)])]),y("tabs-nav-scroll-content",`
|
|
border-bottom: none;
|
|
`)]),_("left",[y("tabs-nav-scroll-content",`
|
|
box-sizing: border-box;
|
|
border-right: 1px solid var(--n-tab-border-color);
|
|
`)]),_("right",[y("tabs-nav-scroll-content",`
|
|
border-left: 1px solid var(--n-tab-border-color);
|
|
`)]),_("bottom",[y("tabs-nav-scroll-content",`
|
|
border-top: 1px solid var(--n-tab-border-color);
|
|
border-bottom: none;
|
|
`)])])]),oa=Object.assign(Object.assign({},de.props),{value:[String,Number],defaultValue:[String,Number],trigger:{type:String,default:"click"},type:{type:String,default:"bar"},closable:Boolean,justifyContent:String,size:{type:String,default:"medium"},placement:{type:String,default:"top"},tabStyle:[String,Object],barWidth:Number,paneClass:String,paneStyle:[String,Object],addable:[Boolean,Object],tabsPadding:{type:Number,default:0},animated:Boolean,onBeforeLeave:Function,onAdd:Function,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onClose:[Function,Array],labelSize:String,activeName:[String,Number],onActiveNameChange:[Function,Array]}),sa=ne({name:"Tabs",props:oa,setup(t,{slots:e}){var n,r,a,o;const{mergedClsPrefixRef:i,inlineThemeDisabled:s}=Oe(t),l=de("Tabs","-tabs",ia,Pn,t,i),d=q(null),f=q(null),c=q(null),h=q(null),b=q(null),x=q(!0),p=q(!0),P=at(t,["labelSize","size"]),m=at(t,["activeName","value"]),$=q((r=(n=m.value)!==null&&n!==void 0?n:t.defaultValue)!==null&&r!==void 0?r:e.default?(o=(a=We(e.default())[0])===null||a===void 0?void 0:a.props)===null||o===void 0?void 0:o.name:null),v=wn(m,$),F={id:0},O=T(()=>{if(!(!t.justifyContent||t.type==="card"))return{display:"flex",justifyContent:t.justifyContent}});we(v,()=>{F.id=0,B(),ie()});function S(){var u;const{value:g}=v;return g===null?null:(u=d.value)===null||u===void 0?void 0:u.querySelector(`[data-name="${g}"]`)}function A(u){if(t.type==="card")return;const{value:g}=f;if(!!g&&u){const k=`${i.value}-tabs-bar--disabled`,{barWidth:z,placement:ae}=t;if(u.dataset.disabled==="true"?g.classList.add(k):g.classList.remove(k),["top","bottom"].includes(ae)){if(j(["top","maxHeight","height"]),typeof z=="number"&&u.offsetWidth>=z){const Z=Math.floor((u.offsetWidth-z)/2)+u.offsetLeft;g.style.left=`${Z}px`,g.style.maxWidth=`${z}px`}else g.style.left=`${u.offsetLeft}px`,g.style.maxWidth=`${u.offsetWidth}px`;g.style.width="8192px",g.offsetWidth}else{if(j(["left","maxWidth","width"]),typeof z=="number"&&u.offsetHeight>=z){const Z=Math.floor((u.offsetHeight-z)/2)+u.offsetTop;g.style.top=`${Z}px`,g.style.maxHeight=`${z}px`}else g.style.top=`${u.offsetTop}px`,g.style.maxHeight=`${u.offsetHeight}px`;g.style.height="8192px",g.offsetHeight}}}function j(u){const{value:g}=f;if(!!g)for(const k of u)g.style[k]=""}function B(){if(t.type==="card")return;const u=S();u&&A(u)}function ie(u){var g;const k=(g=b.value)===null||g===void 0?void 0:g.$el;if(!k)return;const z=S();if(!z)return;const{scrollLeft:ae,offsetWidth:Z}=k,{offsetLeft:me,offsetWidth:Ce}=z;ae>me?k.scrollTo({top:0,left:me,behavior:"smooth"}):me+Ce>ae+Z&&k.scrollTo({top:0,left:me+Ce-Z,behavior:"smooth"})}const G=q(null);let D=0,R=null;function H(u){const g=G.value;if(g){D=u.getBoundingClientRect().height;const k=`${D}px`,z=()=>{g.style.height=k,g.style.maxHeight=k};R?(z(),R(),R=null):R=z}}function U(u){const g=G.value;if(g){const k=u.getBoundingClientRect().height,z=()=>{document.body.offsetHeight,g.style.maxHeight=`${k}px`,g.style.height=`${Math.max(D,k)}px`};R?(R(),R=null,z()):R=z}}function N(){const u=G.value;u&&(u.style.maxHeight="",u.style.height="")}const ee={value:[]},re=q("next");function oe(u){const g=v.value;let k="next";for(const z of ee.value){if(z===g)break;if(z===u){k="prev";break}}re.value=k,se(u)}function se(u){const{onActiveNameChange:g,onUpdateValue:k,"onUpdate:value":z}=t;g&&ze(g,u),k&&ze(k,u),z&&ze(z,u),$.value=u}function le(u){const{onClose:g}=t;g&&ze(g,u)}function te(){const{value:u}=f;if(!u)return;const g="transition-disabled";u.classList.add(g),B(),u.classList.remove(g)}let fe=0;function be(u){var g;if(u.contentRect.width===0&&u.contentRect.height===0||fe===u.contentRect.width)return;fe=u.contentRect.width;const{type:k}=t;(k==="line"||k==="bar")&&te(),k!=="segment"&&pe((g=b.value)===null||g===void 0?void 0:g.$el)}const K=Be(be,64);we([()=>t.justifyContent,()=>t.size],()=>{Ie(()=>{const{type:u}=t;(u==="line"||u==="bar")&&te()})});const Y=q(!1);function E(u){var g;const{target:k,contentRect:{width:z}}=u,ae=k.parentElement.offsetWidth;if(!Y.value)ae<z&&(Y.value=!0);else{const{value:Z}=h;if(!Z)return;ae-z>Z.$el.offsetWidth&&(Y.value=!1)}pe((g=b.value)===null||g===void 0?void 0:g.$el)}const V=Be(E,64);function Le(){const{onAdd:u}=t;u&&u(),Ie(()=>{const g=S(),{value:k}=b;!g||!k||k.scrollTo({left:g.offsetLeft,top:0,behavior:"smooth"})})}function pe(u){if(!u)return;const{scrollLeft:g,scrollWidth:k,offsetWidth:z}=u;x.value=g<=0,p.value=g+z>=k}const qe=Be(u=>{pe(u.target)},64);Ee(Qe,{triggerRef:Q(t,"trigger"),tabStyleRef:Q(t,"tabStyle"),paneClassRef:Q(t,"paneClass"),paneStyleRef:Q(t,"paneStyle"),mergedClsPrefixRef:i,typeRef:Q(t,"type"),closableRef:Q(t,"closable"),valueRef:v,tabChangeIdRef:F,onBeforeLeaveRef:Q(t,"onBeforeLeave"),activateTab:oe,handleClose:le,handleAdd:Le}),Rn(()=>{B(),ie()}),Sn(()=>{const{value:u}=c;if(!u||["left","right"].includes(t.placement))return;const{value:g}=i,k=`${g}-tabs-nav-scroll-wrapper--shadow-before`,z=`${g}-tabs-nav-scroll-wrapper--shadow-after`;x.value?u.classList.remove(k):u.classList.add(k),p.value?u.classList.remove(z):u.classList.add(z)});const ke=q(null);we(v,()=>{if(t.type==="segment"){const u=ke.value;u&&Ie(()=>{u.classList.add("transition-disabled"),u.offsetWidth,u.classList.remove("transition-disabled")})}});const ve={syncBarPosition:()=>{B()}},je=T(()=>{const{value:u}=P,{type:g}=t,k={card:"Card",bar:"Bar",line:"Line",segment:"Segment"}[g],z=`${u}${k}`,{self:{barColor:ae,closeIconColor:Z,closeIconColorHover:me,closeIconColorPressed:Ce,tabColor:_t,tabBorderColor:Tt,paneTextColor:At,tabFontWeight:Et,tabBorderRadius:Ot,tabFontWeightActive:Lt,colorSegment:qt,fontWeightStrong:jt,tabColorSegment:Wt,closeSize:It,closeIconSize:Mt,closeColorHover:Bt,closeColorPressed:Nt,closeBorderRadius:Vt,[I("panePadding",u)]:Dt,[I("tabPadding",z)]:Ht,[I("tabPaddingVertical",z)]:Ut,[I("tabGap",z)]:Yt,[I("tabTextColor",g)]:Gt,[I("tabTextColorActive",g)]:Xt,[I("tabTextColorHover",g)]:Kt,[I("tabTextColorDisabled",g)]:Jt,[I("tabFontSize",u)]:Zt},common:{cubicBezierEaseInOut:Qt}}=l.value;return{"--n-bezier":Qt,"--n-color-segment":qt,"--n-bar-color":ae,"--n-tab-font-size":Zt,"--n-tab-text-color":Gt,"--n-tab-text-color-active":Xt,"--n-tab-text-color-disabled":Jt,"--n-tab-text-color-hover":Kt,"--n-pane-text-color":At,"--n-tab-border-color":Tt,"--n-tab-border-radius":Ot,"--n-close-size":It,"--n-close-icon-size":Mt,"--n-close-color-hover":Bt,"--n-close-color-pressed":Nt,"--n-close-border-radius":Vt,"--n-close-icon-color":Z,"--n-close-icon-color-hover":me,"--n-close-icon-color-pressed":Ce,"--n-tab-color":_t,"--n-tab-font-weight":Et,"--n-tab-font-weight-active":Lt,"--n-tab-padding":Ht,"--n-tab-padding-vertical":Ut,"--n-tab-gap":Yt,"--n-pane-padding":Dt,"--n-font-weight-strong":jt,"--n-tab-color-segment":Wt}}),ge=s?Ze("tabs",T(()=>`${P.value[0]}${t.type[0]}`),je,t):void 0;return Object.assign({mergedClsPrefix:i,mergedValue:v,renderedNames:new Set,tabsRailElRef:ke,tabsPaneWrapperRef:G,tabsElRef:d,barElRef:f,addTabInstRef:h,xScrollInstRef:b,scrollWrapperElRef:c,addTabFixed:Y,tabWrapperStyle:O,handleNavResize:K,mergedSize:P,handleScroll:qe,handleTabsResize:V,cssVars:s?void 0:je,themeClass:ge==null?void 0:ge.themeClass,animationDirection:re,renderNameListRef:ee,onAnimationBeforeLeave:H,onAnimationEnter:U,onAnimationAfterEnter:N,onRender:ge==null?void 0:ge.onRender},ve)},render(){const{mergedClsPrefix:t,type:e,placement:n,addTabFixed:r,addable:a,mergedSize:o,renderNameListRef:i,onRender:s,$slots:{default:l,prefix:d,suffix:f}}=this;s==null||s();const c=l?We(l()).filter($=>$.type.__TAB_PANE__===!0):[],h=l?We(l()).filter($=>$.type.__TAB__===!0):[],b=!h.length,x=e==="card",p=e==="segment",P=!x&&!p&&this.justifyContent;i.value=[];const m=()=>{const $=w("div",{style:this.tabWrapperStyle,class:[`${t}-tabs-wrapper`]},P?null:w("div",{class:`${t}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}),b?c.map((v,F)=>(i.value.push(v.props.name),Ve(w(Ke,Object.assign({},v.props,{internalCreatedByPane:!0,internalLeftPadded:F!==0&&(!P||P==="center"||P==="start"||P==="end")}),v.children?{default:v.children.tab}:void 0)))):h.map((v,F)=>(i.value.push(v.props.name),Ve(F!==0&&!P?St(v):v))),!r&&a&&x?Rt(a,(b?c.length:h.length)!==0):null,P?null:w("div",{class:`${t}-tabs-scroll-padding`,style:{width:`${this.tabsPadding}px`}}));return w("div",{ref:"tabsElRef",class:`${t}-tabs-nav-scroll-content`},x&&a?w(it,{onResize:this.handleTabsResize},{default:()=>$}):$,x?w("div",{class:`${t}-tabs-pad`}):null,x?null:w("div",{ref:"barElRef",class:`${t}-tabs-bar`}))};return w("div",{class:[`${t}-tabs`,this.themeClass,`${t}-tabs--${e}-type`,`${t}-tabs--${o}-size`,P&&`${t}-tabs--flex`,`${t}-tabs--${n}`],style:this.cssVars},w("div",{class:[`${t}-tabs-nav--${e}-type`,`${t}-tabs-nav--${n}`,`${t}-tabs-nav`]},De(d,$=>$&&w("div",{class:`${t}-tabs-nav__prefix`},$)),p?w("div",{class:`${t}-tabs-rail`,ref:"tabsRailElRef"},b?c.map(($,v)=>(i.value.push($.props.name),w(Ke,Object.assign({},$.props,{internalCreatedByPane:!0,internalLeftPadded:v!==0}),$.children?{default:$.children.tab}:void 0))):h.map(($,v)=>(i.value.push($.props.name),v===0?$:St($)))):w(it,{onResize:this.handleNavResize},{default:()=>w("div",{class:`${t}-tabs-nav-scroll-wrapper`,ref:"scrollWrapperElRef"},["top","bottom"].includes(n)?w(Xn,{ref:"xScrollInstRef",onScroll:this.handleScroll},{default:m}):w("div",{class:`${t}-tabs-nav-y-scroll`},m()))}),r&&a&&x?Rt(a,!0):null,De(f,$=>$&&w("div",{class:`${t}-tabs-nav__suffix`},$))),b&&(this.animated?w("div",{ref:"tabsPaneWrapperRef",class:`${t}-tabs-pane-wrapper`},wt(c,this.mergedValue,this.renderedNames,this.onAnimationBeforeLeave,this.onAnimationEnter,this.onAnimationAfterEnter,this.animationDirection)):wt(c,this.mergedValue,this.renderedNames)))}});function wt(t,e,n,r,a,o,i){const s=[];return t.forEach(l=>{const{name:d,displayDirective:f,"display-directive":c}=l.props,h=x=>f===x||c===x,b=e===d;if(l.key!==void 0&&(l.key=d),b||h("show")||h("show:lazy")&&n.has(d)){n.has(d)||n.add(d);const x=!h("if");s.push(x?$n(l,[[zn,b]]):l)}}),i?w(kn,{name:`${i}-transition`,onBeforeLeave:r,onEnter:a,onAfterEnter:o},{default:()=>s}):s}function Rt(t,e){return w(Ke,{ref:"addTabInstRef",key:"__addable",name:"__addable",internalCreatedByPane:!0,internalAddable:!0,internalLeftPadded:e,disabled:typeof t=="object"&&t.disabled})}function St(t){const e=Cn(t);return e.props?e.props.internalLeftPadded=!0:e.props={internalLeftPadded:!0},e}function Ve(t){return Array.isArray(t.dynamicProps)?t.dynamicProps.includes("internalLeftPadded")||t.dynamicProps.push("internalLeftPadded"):t.dynamicProps=["internalLeftPadded"],t}function la(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!_n(t)}const da=ne({name:"Signin",setup(){const{t}=kt(),e=()=>({name:"admin",pwd:"123456"}),n=An(),r=q(e()),a=q(),o=q(!1),i={name:{required:!0,message:t("LoginModule.NamePlaceholder"),trigger:["blur","input"]},pwd:{required:!0,message:t("LoginModule.PasswordPlaceholder"),trigger:["blur","input"]}};return{signinForm:r,loginFormRef:a,handleLogin:()=>{var l;(l=a.value)==null||l.validate(d=>{d?window.$message.error("\u4E0D\u53EF\u4EE5\u8FD9\u6837\u54DF, \u4E0D\u53EF\u4EE5\u54DF"):(window.$message.info("\u767B\u9646\u4E2D..."),o.value=!0,setTimeout(()=>{n.push("/dashboard"),Tn("token","tokenValue")},2*1e3))})},rules:i,loading:o,t}},render(){let t;return W(br,{model:this.signinForm,ref:"loginFormRef",rules:this.rules},{default:()=>[W(yt,{label:this.t("LoginModule.Name"),path:"name"},{default:()=>[W(ot,{value:this.signinForm.name,"onUpdate:value":e=>this.signinForm.name=e,placeholder:this.t("LoginModule.NamePlaceholder")},null)]}),W(yt,{label:this.t("LoginModule.Password"),path:"pwd"},{default:()=>[W(ot,{value:this.signinForm.pwd,"onUpdate:value":e=>this.signinForm.pwd=e,type:"password",placeholder:this.t("LoginModule.PasswordPlaceholder")},null)]}),W(Fn,{style:["width: 100%","margin-to: 18px"],type:"primary",onClick:this.handleLogin.bind(this),loading:this.loading},la(t=this.t("LoginModule.Login"))?t:{default:()=>[t]})]})}}),fa=ne({name:"Register",render(){return W(Vn,{status:"info",title:"\u63D0\u793A",description:"\u6211\u5B9E\u5728\u662F\u4E0D\u60F3\u5199\u4E86..."},null)}}),ma=ne({name:"Login",setup(){const t=En({tabsValue:"signin"}),{t:e}=kt(),{height:n}=On(),r=Ln(),{updateLocale:a}=r;return{...qn(t),windowHeight:n,updateLocale:a,ray:e}},render(){return W("div",{class:["login"],style:[`height: ${this.windowHeight}px`]},[W(jn,null,{default:()=>[W(ra,{class:"login-title",type:"info"},{default:()=>[st("Ray Template")]}),W(Wn,{options:In(),onSelect:t=>this.updateLocale(t)},{default:()=>[W(Mn,{customClassName:"login-icon",name:"language",size:"18"},null)]})]}),W(Bn,null,{default:()=>[W(sa,{value:this.tabsValue,"onUpdate:value":t=>this.tabsValue=t},{default:()=>[W(xt,{tab:this.ray("LoginModule.Signin"),name:"signin"},{default:()=>[W(da,null,null)]}),W(xt,{tab:this.ray("LoginModule.Register"),name:"register"},{default:()=>[W(fa,null,null)]})]}),W(Nn,null,{default:()=>[st("\u53CB\u60C5\u94FE\u63A5")]}),W(Dn,null,null)]})])}});export{ma as default};
|