mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
26 KiB
148 lines
26 KiB
2 years ago
|
import{aU as je,d as O,bQ as De,bR as Ae,a2 as se,c6 as Ke,b6 as We,y as T,r as $,v as Z,c7 as re,br as K,h as d,b7 as ye,bt as de,bT as ne,bu as qe,c8 as ce,bq as xe,c as L,f as V,b as j,u as we,x as W,c9 as Ge,J as Ue,q as X,ca as Ye,z as D,A as Se,N as Re,cb as ae,bV as ze,b0 as Ze,e as A,a as Xe,aV as Je,t as H,aT as Qe,cc as et,S as ue,V as tt,cd as oe,p as fe,B as nt,ce as ot,cf as it,L as lt,b_ as ve,cg as rt,b8 as st,k as at,ab as dt}from"./index-c17d3913.js";import{l as ct}from"./List-28c5febd.js";function ie(e){const t=e.filter(o=>o!==void 0);if(t.length!==0)return t.length===1?t[0]:o=>{e.forEach(s=>{s&&s(o)})}}let he=!1;function ut(){if(je&&window.CSS&&!he&&(he=!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{}}function me(e){return e&-e}class ft{constructor(t,o){this.l=t,this.min=o;const s=new Array(t+1);for(let r=0;r<t+1;++r)s[r]=0;this.ft=s}add(t,o){if(o===0)return;const{l:s,ft:r}=this;for(t+=1;t<=s;)r[t]+=o,t+=me(t)}get(t){return this.sum(t+1)-this.sum(t)}sum(t){if(t===void 0&&(t=this.l),t<=0)return 0;const{ft:o,min:s,l:r}=this;if(t>r)throw new Error("[FinweckTree.sum]: `i` is larger than length.");let a=t*s;for(;t>0;)a+=o[t],t-=me(t);return a}getBound(t){let o=0,s=this.l;for(;s>o;){const r=Math.floor((o+s)/2),a=this.sum(r);if(a>t){s=r;continue}else if(a<t){if(o===r)return this.sum(o+1)<=t?o+1:r;o=r}else return r}return o}}let Y;function vt(){return Y===void 0&&("matchMedia"in window?Y=window.matchMedia("(pointer:coarse)").matches:Y=!1),Y}let le;function ge(){return le===void 0&&(le="chrome"in window?window.devicePixelRatio:1),le}const ht=ne(".v-vl",{maxHeight:"inherit",height:"100%",overflow:"auto",minWidth:"1px"},[ne("&:not(.v-vl--show-scrollbar)",{scrollbarWidth:"none"},[ne("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",{width:0,height:0,display:"none"})])]),mt=O({name:"VirtualList",inheritAttrs:!1,props:{showScrollbar:{type:Boolean,default:!0},items:{type:Array,default:()=>[]},itemSize:{type:Number,required:!0},itemResizable:Boolean,itemsStyle:[String,Object],visibleItemsTag:{type:[String,Object],default:"div"},visibleItemsProps:Object,ignoreItemResize:Boolean,onScroll:Function,onWheel:Function,onResize:Function,defaultScrollKey:[Number,String],defaultScrollIndex:Number,keyField:{type:String,default:"key"},paddingTop:{type:[Number,String],default:0},paddingBottom:{type:[Number,String],default:0}},setup(e){const t=De();ht.mount({id:"vueuc/virtual-list",head:!0,anchorMetaName:Ae,ssr:t}),se(()=>{const{defaultScrollIndex:i,defaultScrollKey:c}=e;i!=null?h({index:i}):c!=null&&h({key:c})});let o=!1,s=!1;Ke(()=>{if(o=!1,!s){s=!0;return}h({top:m.value,left:f})}),We(()=>{o=!0,s||(s=!0)});const r=T(()=>{const i=new Map,{keyField:c}=e;return e.items.forEach((g,k)=>{i.set(g[c],k)}),i}),a=$(null),u=$(void 0),v=new Map,z=T(()=>{const{items:i,itemSize:c,keyField:g}=e,k=new ft(i.length,c);return i.forEach((C,_)=>{const p=C[g],P=v.get(p);P!==void 0&&k.add(_,P)}),k}),b=$(0);let f=0;const m=$(0),R=Z(()=>Math.max(z.value.getBound(m.value-re(e.paddingTop))-1,0)),F=T(()=>{const{value:i}=u;if(i===void 0)return[];const{items:c,itemSize:g}=e,k=R.value,C=Math.min(k+Math.ceil(i/g+1),c.length-1),_=[];for(let p=k;p<=C;++p)_.push(c[p]);return _}),h=(i,c)=>{if(typeof i=="number"){x(i,c,"auto");return}const{left:g,top:k,index:C,key:_,position:p,behavior:P,debounce:n=!0}=i;if(g!==void 0||k!==void 0)x(g,k,P);else if(C!==void 0)S(C,P,n);else if(_!==void 0){const l=r.value.get(_);l!==void 0&&S(l,P,n)}else p==="bottom"?x(0,Number.MAX_SAFE_INTEGER,P):p==="top"&&x(0,0,P)};let y,M=null;function S(i,c,g){const{value:k}=z,C=k.sum(i)+re(e.paddingTop);if(!g)a.value.scrollTo({left:0,top:C,behavior:c});else{y=i,M!==null&&window.clearTimeout(M),M=window.setTimeout(()=>{y=void 0,M=null},16);const{scrollTop:_,offsetHeight:p}=a.value;if(C>_){const P=k.get(i);C+P<=_+p||a.value.scrollTo({left:0,top:C+P-p,behav
|
||
2 years ago
|
display: flex;
|
||
|
flex-direction: column;
|
||
|
align-items: center;
|
||
|
font-size: var(--n-font-size);
|
||
|
`,[V("icon",`
|
||
|
width: var(--n-icon-size);
|
||
|
height: var(--n-icon-size);
|
||
|
font-size: var(--n-icon-size);
|
||
|
line-height: var(--n-icon-size);
|
||
|
color: var(--n-icon-color);
|
||
|
transition:
|
||
|
color .3s var(--n-bezier);
|
||
|
`,[j("+",[V("description",`
|
||
|
margin-top: 8px;
|
||
|
`)])]),V("description",`
|
||
|
transition: color .3s var(--n-bezier);
|
||
|
color: var(--n-text-color);
|
||
|
`),V("extra",`
|
||
|
text-align: center;
|
||
|
transition: color .3s var(--n-bezier);
|
||
|
margin-top: 12px;
|
||
|
color: var(--n-extra-text-color);
|
||
|
`)]),wt=Object.assign(Object.assign({},W.props),{description:String,showDescription:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},size:{type:String,default:"medium"},renderIcon:Function}),St=O({name:"Empty",props:wt,setup(e){const{mergedClsPrefixRef:t,inlineThemeDisabled:o}=we(e),s=W("Empty","-empty",xt,Ge,e,t),{localeRef:r}=Ue("Empty"),a=X(Ye,null),u=T(()=>{var f,m,R;return(f=e.description)!==null&&f!==void 0?f:(R=(m=a==null?void 0:a.mergedComponentPropsRef.value)===null||m===void 0?void 0:m.Empty)===null||R===void 0?void 0:R.description}),v=T(()=>{var f,m;return((m=(f=a==null?void 0:a.mergedComponentPropsRef.value)===null||f===void 0?void 0:f.Empty)===null||m===void 0?void 0:m.renderIcon)||(()=>d(bt,null))}),z=T(()=>{const{size:f}=e,{common:{cubicBezierEaseInOut:m},self:{[D("iconSize",f)]:R,[D("fontSize",f)]:F,textColor:h,iconColor:y,extraTextColor:M}}=s.value;return{"--n-icon-size":R,"--n-font-size":F,"--n-bezier":m,"--n-text-color":h,"--n-icon-color":y,"--n-extra-text-color":M}}),b=o?Se("empty",T(()=>{let f="";const{size:m}=e;return f+=m[0],f}),z,e):void 0;return{mergedClsPrefix:t,mergedRenderIcon:v,localizedDescription:T(()=>u.value||r.value.description),cssVars:o?void 0:z,themeClass:b==null?void 0:b.themeClass,onRender:b==null?void 0:b.onRender}},render(){const{$slots:e,mergedClsPrefix:t,onRender:o}=this;return o==null||o(),d("div",{class:[`${t}-empty`,this.themeClass],style:this.cssVars},this.showIcon?d("div",{class:`${t}-empty__icon`},e.icon?e.icon():d(Re,{clsPrefix:t},{default:this.mergedRenderIcon})):null,this.showDescription?d("div",{class:`${t}-empty__description`},e.default?e.default():this.localizedDescription):null,e.extra?d("div",{class:`${t}-empty__extra`},e.extra()):null)}});function Rt(e,t){return d(Ze,{name:"fade-in-scale-up-transition"},{default:()=>e?d(Re,{clsPrefix:t,class:`${t}-base-select-option__check`},{default:()=>d(pt)}):null})}const pe=O({name:"NBaseSelectOption",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(e){const{valueRef:t,pendingTmNodeRef:o,multipleRef:s,valueSetRef:r,renderLabelRef:a,renderOptionRef:u,labelFieldRef:v,valueFieldRef:z,showCheckmarkRef:b,nodePropsRef:f,handleOptionClick:m,handleOptionMouseEnter:R}=X(ae),F=Z(()=>{const{value:S}=o;return S?e.tmNode.key===S.key:!1});function h(S){const{tmNode:x}=e;x.disabled||m(S,x)}function y(S){const{tmNode:x}=e;x.disabled||R(S,x)}function M(S){const{tmNode:x}=e,{value:I}=F;x.disabled||I||R(S,x)}return{multiple:s,isGrouped:Z(()=>{const{tmNode:S}=e,{parent:x}=S;return x&&x.rawNode.type==="group"}),showCheckmark:b,nodeProps:f,isPending:F,isSelected:Z(()=>{const{value:S}=t,{value:x}=s;if(S===null)return!1;const I=e.tmNode.rawNode[z.value];if(x){const{value:B}=r;return B.has(I)}else return S===I}),labelField:v,renderLabel:a,renderOption:u,handleMouseMove:M,handleMouseEnter:y,handleClick:h}},render(){const{clsPrefix:e,tmNode:{rawNode:t},isSelected:o,isPending:s,isGrouped:r,showCheckmark:a,nodeProps:u,renderOption:v,renderLabel:z,handleClick:b,handleMouseEnter:f,handleMouseMove:m}=this,R=Rt(o,e),F=z?[z(t,o),a&&R]:[ze(t[this.labelField],t,o),a&&R],h=u==null?void 0:u(t),y=d("div",Object.assign({},h,{class:[`${e}-base-select-option`,t.class,h==null?void 0:h.class,{[`${e}-base-select-option--disabled`]:t.disabled,[`${e}-base-select-option--selected`]:o,[`${e}-base-select-option--grouped`]:r,[`${e}-base-select-option--pending`]:s,[`${e}-base-select-option--show-checkmark`]:a}],style:[(h==null?void 0:h.style)||"",t.style||""],onClick:ie([b,h==null?void 0:h.onClick]),onMouseenter:ie([f,h==null?void 0:h.onMouseenter]),onMousemove:ie([m,h==null?void 0:h.onMousemove])}),d("div",{class:`${e}-base-select-option__content`},F));return t.render?t.render({node:y,option:t,selected:o}):v?v({node:y,option:t,selected:o}):y}}),be=O({name:"NBaseSelectGroupHeader",props:{clsPrefix:{type:String,required:!0},tmNode:{type:Object,required:!0}},setup(){const{renderLabelRef:e,renderOptionRef:t,labelFieldRef:o,nodePropsRef:s}=X(ae);return{labelField:o,nodeProps:s,renderLabel:e,renderOption:t}},render(){const{clsPrefix:e,
|
||
|
line-height: 1.5;
|
||
|
outline: none;
|
||
|
z-index: 0;
|
||
|
position: relative;
|
||
|
border-radius: var(--n-border-radius);
|
||
|
transition:
|
||
|
background-color .3s var(--n-bezier),
|
||
|
box-shadow .3s var(--n-bezier);
|
||
|
background-color: var(--n-color);
|
||
|
`,[L("scrollbar",`
|
||
|
max-height: var(--n-height);
|
||
|
`),L("virtual-list",`
|
||
|
max-height: var(--n-height);
|
||
|
`),L("base-select-option",`
|
||
|
min-height: var(--n-option-height);
|
||
|
font-size: var(--n-option-font-size);
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
`,[V("content",`
|
||
|
z-index: 1;
|
||
|
white-space: nowrap;
|
||
|
text-overflow: ellipsis;
|
||
|
overflow: hidden;
|
||
|
`)]),L("base-select-group-header",`
|
||
|
min-height: var(--n-option-height);
|
||
|
font-size: .93em;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
`),L("base-select-menu-option-wrapper",`
|
||
|
position: relative;
|
||
|
width: 100%;
|
||
|
`),V("loading, empty",`
|
||
|
display: flex;
|
||
|
padding: 12px 32px;
|
||
|
flex: 1;
|
||
|
justify-content: center;
|
||
|
`),V("loading",`
|
||
|
color: var(--n-loading-color);
|
||
|
font-size: var(--n-loading-size);
|
||
|
`),V("action",`
|
||
|
padding: 8px var(--n-option-padding-left);
|
||
|
font-size: var(--n-option-font-size);
|
||
|
transition:
|
||
|
color .3s var(--n-bezier),
|
||
|
border-color .3s var(--n-bezier);
|
||
|
border-top: 1px solid var(--n-action-divider-color);
|
||
|
color: var(--n-action-text-color);
|
||
|
`),L("base-select-group-header",`
|
||
|
position: relative;
|
||
|
cursor: default;
|
||
|
padding: var(--n-option-padding);
|
||
|
color: var(--n-group-header-text-color);
|
||
|
`),L("base-select-option",`
|
||
|
cursor: pointer;
|
||
|
position: relative;
|
||
|
padding: var(--n-option-padding);
|
||
|
transition:
|
||
|
color .3s var(--n-bezier),
|
||
|
opacity .3s var(--n-bezier);
|
||
|
box-sizing: border-box;
|
||
|
color: var(--n-option-text-color);
|
||
|
opacity: 1;
|
||
|
`,[A("show-checkmark",`
|
||
|
padding-right: calc(var(--n-option-padding-right) + 20px);
|
||
|
`),j("&::before",`
|
||
|
content: "";
|
||
|
position: absolute;
|
||
|
left: 4px;
|
||
|
right: 4px;
|
||
|
top: 0;
|
||
|
bottom: 0;
|
||
|
border-radius: var(--n-border-radius);
|
||
|
transition: background-color .3s var(--n-bezier);
|
||
|
`),j("&:active",`
|
||
|
color: var(--n-option-text-color-pressed);
|
||
|
`),A("grouped",`
|
||
|
padding-left: calc(var(--n-option-padding-left) * 1.5);
|
||
|
`),A("pending",[j("&::before",`
|
||
|
background-color: var(--n-option-color-pending);
|
||
|
`)]),A("selected",`
|
||
|
color: var(--n-option-text-color-active);
|
||
|
`,[j("&::before",`
|
||
|
background-color: var(--n-option-color-active);
|
||
|
`),A("pending",[j("&::before",`
|
||
|
background-color: var(--n-option-color-active-pending);
|
||
|
`)])]),A("disabled",`
|
||
|
cursor: not-allowed;
|
||
|
`,[Xe("selected",`
|
||
|
color: var(--n-option-text-color-disabled);
|
||
|
`),A("selected",`
|
||
|
opacity: var(--n-option-opacity-disabled);
|
||
|
`)]),V("check",`
|
||
|
font-size: 16px;
|
||
|
position: absolute;
|
||
|
right: calc(var(--n-option-padding-right) - 4px);
|
||
|
top: calc(50% - 7px);
|
||
|
color: var(--n-option-check-color);
|
||
|
transition: color .3s var(--n-bezier);
|
||
|
`,[Je({enterScale:"0.5"})])])]),Nt=O({name:"InternalSelectMenu",props:Object.assign(Object.assign({},W.props),{clsPrefix:{type:String,required:!0},scrollable:{type:Boolean,default:!0},treeMate:{type:Object,required:!0},multiple:Boolean,size:{type:String,default:"medium"},value:{type:[String,Number,Array],default:null},autoPending:Boolean,virtualScroll:{type:Boolean,default:!0},show:{type:Boolean,default:!0},labelField:{type:String,default:"label"},valueField:{type:String,default:"value"},loading:Boolean,focusable:Boolean,renderLabel:Function,renderOption:Function,nodeProps:Function,showCheckmark:{type:Boolean,default:!0},onMousedown:Function,onScroll:Function,onFocus:Function,onBlur:Function,onKeyup:Function,onKeydown:Function,onTabOut:Function,onMouseenter:Function,onMouseleave:Function,onResize:Function,resetMenuOnOptionsChange:{type:Boolean,default:!0},inlineThemeDisabled:Boolean,onToggle:Function}),setup(e){const t=W("InternalSelectMenu","-internal-select-menu",zt,Qe,e,H(e,"clsPrefix")),o=$(null),s=$(null),r=$(null),a=T(()=>e.treeMate.getFlattenedNodes()),u=T(()=>et(a.value)),v=$(null);function z(){const{treeMate:n}=e;let l=null;const{value:w}=e;w===null?l=n.getFirstAvailableNode():(e.multiple?l=n.getNode((w||[])[(w||[]).length-1]):l=n.getNode(w),(!l||l.disabled)&&(l=n.getFirstAvailableNode())),i(l||null)}function b(){const{value:n}=v;n&&!e.treeMate.getNode(n.key)&&(v.value=null)}let f;ue(()=>e.show,n=>{n?f=ue(()=>e.treeMate,()=>{e.resetMenuOnOptionsChange?(e.autoPending?z():b(),tt(c)):b()},{immediate:!0}):f==null||f()},{immediate:!0}),xe(()=>{f==null||f()});const m=T(()=>re(t.value.self[D("optionHeight",e.size)])),R=T(()=>oe(t.value.self[D("padding",e.size)])),F=T(()=>e.multiple&&Array.isArray(e.value)?new Set(e.value):new Set),h=T(()=>{const n=a.value;return n&&n.length===0});function y(n){const{onToggle:l}=e;l&&l(n)}function M(n){const{onScroll:l}=e;l&&l(n)}function S(n){var l;(l=r.value)===null||l===void 0||l.sync(),M(n)}function x(){var n;(n=r.value)===null||n===void 0||n.sync()}function I(){const{value:n}=v;return n||null}function B(n,l){l.disabled||i(l,!1)}function E(n,l){l.disabled||y(l)}function J(n){var l;ve(n,"action")||(l=e.onKeyup)===null||l===void 0||l.call(e,n)}function Q(n){var l;ve(n,"action")||(l=e.onKeydown)===null||l===void 0||l.call(e,n)}function ee(n){var l;(l=e.onMousedown)===null||l===void 0||l.call(e,n),!e.focusable&&n.preventDefault()}function q(){const{value:n}=v;n&&i(n.getNext({loop:!0}),!0)}function U(){const{value:n}=v;n&&i(n.getPrev({loop:!0}),!0)}function i(n,l=!1){v.value=n,l&&c()}function c(){var n,l;const w=v.value;if(!w)return;const N=u.value(w.key);N!==null&&(e.virtualScroll?(n=s.value)===null||n===void 0||n.scrollTo({index:N}):(l=r.value)===null||l===void 0||l.scrollTo({index:N,elSize:m.value}))}function g(n){var l,w;!((l=o.value)===null||l===void 0)&&l.contains(n.target)&&((w=e.onFocus)===null||w===void 0||w.call(e,n))}function k(n){var l,w;!((l=o.value)===null||l===void 0)&&l.contains(n.relatedTarget)||(w=e.onBlur)===null||w===void 0||w.call(e,n)}fe(ae,{handleOptionMouseEnter:B,handleOptionClick:E,valueSetRef:F,pendingTmNodeRef:v,nodePropsRef:H(e,"nodeProps"),showCheckmarkRef:H(e,"showCheckmark"),multipleRef:H(e,"multiple"),valueRef:H(e,"value"),renderLabelRef:H(e,"renderLabel"),renderOptionRef:H(e,"renderOption"),labelFieldRef:H(e,"labelField"),valueFieldRef:H(e,"valueField")}),fe(rt,o),se(()=>{const{value:n}=r;n&&n.sync()});const C=T(()=>{const{size:n}=e,{common:{cubicBezierEaseInOut:l},self:{height:w,borderRadius:N,color:G,groupHeaderTextColor:ke,actionDividerColor:Ce,optionTextColorPressed:Te,optionTextColor:_e,optionTextColorDisabled:Pe,optionTextColorActive:Me,optionOpacityDisabled:Ne,optionCheckColor:Fe,actionTextColor:Ie,optionColorPending:Be,optionColorActive:Le,loadingColor:Oe,loadingSize:Ee,optionColorActivePending:He,[D("optionFontSize",n)]:$e,[D("optionHeight",n)]:Ve,[D("optionPadding",n)]:te}}=t.value;return{"--n-height":w,"--n-action-divider-color":Ce,"--n-action-text-color":Ie,"--n-bezier":l,"--n-border-radius":N,"--n-color":G,"--n-option-font-size":$e,"--n-gr
|
||
|
height: 1em;
|
||
|
width: 100%;
|
||
|
transition: background-color .3s var(--n-bezier);
|
||
|
transition:
|
||
|
--n-color-start .3s var(--n-bezier),
|
||
|
--n-color-end .3s var(--n-bezier),
|
||
|
background-color .3s var(--n-bezier);
|
||
|
animation: 2s skeleton-loading infinite cubic-bezier(0.36, 0, 0.64, 1);
|
||
|
background-color: var(--n-color-start);
|
||
|
`),j("@keyframes skeleton-loading",`
|
||
|
0% {
|
||
|
background: var(--n-color-start);
|
||
|
}
|
||
|
40% {
|
||
|
background: var(--n-color-end);
|
||
|
}
|
||
|
80% {
|
||
|
background: var(--n-color-start);
|
||
|
}
|
||
|
100% {
|
||
|
background: var(--n-color-start);
|
||
|
}
|
||
|
`)]),_t=Object.assign(Object.assign({},W.props),{text:Boolean,round:Boolean,circle:Boolean,height:[String,Number],width:[String,Number],size:String,repeat:{type:Number,default:1},animated:{type:Boolean,default:!0},sharp:{type:Boolean,default:!0}}),It=O({name:"Skeleton",inheritAttrs:!1,props:_t,setup(e){ut();const{mergedClsPrefixRef:t}=we(e),o=W("Skeleton","-skeleton",Tt,Ct,e,t);return{mergedClsPrefix:t,style:T(()=>{var s,r;const a=o.value,{common:{cubicBezierEaseInOut:u}}=a,v=a.self,{color:z,colorEnd:b,borderRadius:f}=v;let m;const{circle:R,sharp:F,round:h,width:y,height:M,size:S,text:x,animated:I}=e;S!==void 0&&(m=v[D("height",S)]);const B=R?(s=y??M)!==null&&s!==void 0?s:m:y,E=(r=R?y??M:M)!==null&&r!==void 0?r:m;return{display:x?"inline-block":"",verticalAlign:x?"-0.125em":"",borderRadius:R?"50%":h?"4096px":F?"":f,width:typeof B=="number"?K(B):B,height:typeof E=="number"?K(E):E,animation:I?"":"none","--n-bezier":u,"--n-color-start":z,"--n-color-end":b}})}},render(){const{repeat:e,style:t,mergedClsPrefix:o,$attrs:s}=this,r=d("div",ye({class:`${o}-skeleton`,style:t},s));return e>1?d(dt,null,Array.apply(null,{length:e}).map(a=>[r,`
|
||
|
`])):r}});export{Nt as N,Ft as _,St as a,It as b,gt as c,ie as m,ut as u};
|