generated from VLADIMIR/template_frontend
210 lines
32 KiB
JavaScript
210 lines
32 KiB
JavaScript
import{$ as e,A as t,D as n,G as r,P as i,X as a,Z as o,it as s,p as c,st as l,v as u,z as d}from"./vue-router-bPs2Bq2h.js";import{G as f,J as p,K as m,M as h,N as g,R as _,X as v,Y as y,Z as b,o as x,r as S}from"./light-BDe84dgP.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./Follower-GEKZrWCx.js";import{a as k,c as A,i as j,n as ee,o as te,r as M,t as ne,u as N}from"./utils-BubchhOC.js";import{D as re,M as ie,a as P,d as F,i as I,l as L,y as R}from"./Card-CfP6D37a.js";import{c as z}from"./resolve-slot-Cp3m6n7Y.js";import{a as B}from"./light-WRuBODwl.js";import{t as ae}from"./use-compitable-BcHeQzgm.js";import{o as oe}from"./Button-CxlnN3s4.js";import{t as V}from"./Popover-GghbY-DG.js";import{r as se}from"./keep-dbDSz9wI.js";import{t as H}from"./call-ChHlm4-m.js";import{t as U}from"./Tag-N44ccOld.js";import{E as W,Q as G,Y as ce,q as K,v as le}from"./index-CbH26Z0q.js";var q=`v-hidden`,ue=T(`[v-hidden]`,{display:`none!important`}),J=n({name:`Overflow`,props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(e,{slots:t}){let n=s(null),r=s(null);function i(i){let{value:a}=n,{getCounter:o,getTail:s}=e,c;if(c=o===void 0?r.value:o(),!a||!c)return;c.hasAttribute(q)&&c.removeAttribute(q);let{children:l}=a;if(i.showAllItemsBeforeCalculate)for(let e of l)e.hasAttribute(q)&&e.removeAttribute(q);let u=a.offsetWidth,d=[],f=t.tail?s?.():null,p=f?f.offsetWidth:0,m=!1,h=a.children.length-+!!t.tail;for(let t=0;t<h-1;++t){if(t<0)continue;let n=l[t];if(m){n.hasAttribute(q)||n.setAttribute(q,``);continue}else n.hasAttribute(q)&&n.removeAttribute(q);let r=n.offsetWidth;if(p+=r,d[t]=r,p>u){let{updateCounter:n}=e;for(let r=t;r>=0;--r){let i=h-1-r;n===void 0?c.textContent=`${i}`:n(i);let a=c.offsetWidth;if(p-=d[r],p+a<=u||r===0){m=!0,t=r-1,f&&(t===-1?(f.style.maxWidth=`${u-a}px`,f.style.boxSizing=`border-box`):f.style.maxWidth=``);let{onUpdateCount:n}=e;n&&n(i);break}}}}let{onUpdateOverflow:g}=e;m?g!==void 0&&g(!0):(g!==void 0&&g(!1),c.setAttribute(q,``))}let a=_();return ue.mount({id:`vueuc/overflow`,head:!0,anchorMetaName:D,ssr:a}),d(()=>i({showAllItemsBeforeCalculate:!1})),{selfRef:n,counterRef:r,sync:i}},render(){let{$slots:e}=this;return i(()=>this.sync({showAllItemsBeforeCalculate:!1})),t(`div`,{class:`v-overflow`,ref:`selfRef`},[r(e,`default`),e.counter?e.counter():t(`span`,{style:{display:`inline-block`},ref:`counterRef`}),e.tail?e.tail():null])}});function Y(e){switch(typeof e){case`string`:return e||void 0;case`number`:return String(e);default:return}}var de=f([m(`base-selection`,`
|
|
--n-padding-single: var(--n-padding-single-top) var(--n-padding-single-right) var(--n-padding-single-bottom) var(--n-padding-single-left);
|
|
--n-padding-multiple: var(--n-padding-multiple-top) var(--n-padding-multiple-right) var(--n-padding-multiple-bottom) var(--n-padding-multiple-left);
|
|
position: relative;
|
|
z-index: auto;
|
|
box-shadow: none;
|
|
width: 100%;
|
|
max-width: 100%;
|
|
display: inline-block;
|
|
vertical-align: bottom;
|
|
border-radius: var(--n-border-radius);
|
|
min-height: var(--n-height);
|
|
line-height: 1.5;
|
|
font-size: var(--n-font-size);
|
|
`,[m(`base-loading`,`
|
|
color: var(--n-loading-color);
|
|
`),m(`base-selection-tags`,`min-height: var(--n-height);`),p(`border, state-border`,`
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
pointer-events: none;
|
|
border: var(--n-border);
|
|
border-radius: inherit;
|
|
transition:
|
|
box-shadow .3s var(--n-bezier),
|
|
border-color .3s var(--n-bezier);
|
|
`),p(`state-border`,`
|
|
z-index: 1;
|
|
border-color: #0000;
|
|
`),m(`base-suffix`,`
|
|
cursor: pointer;
|
|
position: absolute;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
right: 10px;
|
|
`,[p(`arrow`,`
|
|
font-size: var(--n-arrow-size);
|
|
color: var(--n-arrow-color);
|
|
transition: color .3s var(--n-bezier);
|
|
`)]),m(`base-selection-overlay`,`
|
|
display: flex;
|
|
align-items: center;
|
|
white-space: nowrap;
|
|
pointer-events: none;
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
padding: var(--n-padding-single);
|
|
transition: color .3s var(--n-bezier);
|
|
`,[p(`wrapper`,`
|
|
flex-basis: 0;
|
|
flex-grow: 1;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
`)]),m(`base-selection-placeholder`,`
|
|
color: var(--n-placeholder-color);
|
|
`,[p(`inner`,`
|
|
max-width: 100%;
|
|
overflow: hidden;
|
|
`)]),m(`base-selection-tags`,`
|
|
cursor: pointer;
|
|
outline: none;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
z-index: auto;
|
|
display: flex;
|
|
padding: var(--n-padding-multiple);
|
|
flex-wrap: wrap;
|
|
align-items: center;
|
|
width: 100%;
|
|
vertical-align: bottom;
|
|
background-color: var(--n-color);
|
|
border-radius: inherit;
|
|
transition:
|
|
color .3s var(--n-bezier),
|
|
box-shadow .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier);
|
|
`),m(`base-selection-label`,`
|
|
height: var(--n-height);
|
|
display: inline-flex;
|
|
width: 100%;
|
|
vertical-align: bottom;
|
|
cursor: pointer;
|
|
outline: none;
|
|
z-index: auto;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
transition:
|
|
color .3s var(--n-bezier),
|
|
box-shadow .3s var(--n-bezier),
|
|
background-color .3s var(--n-bezier);
|
|
border-radius: inherit;
|
|
background-color: var(--n-color);
|
|
align-items: center;
|
|
`,[m(`base-selection-input`,`
|
|
font-size: inherit;
|
|
line-height: inherit;
|
|
outline: none;
|
|
cursor: pointer;
|
|
box-sizing: border-box;
|
|
border:none;
|
|
width: 100%;
|
|
padding: var(--n-padding-single);
|
|
background-color: #0000;
|
|
color: var(--n-text-color);
|
|
transition: color .3s var(--n-bezier);
|
|
caret-color: var(--n-caret-color);
|
|
`,[p(`content`,`
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
`)]),p(`render-label`,`
|
|
color: var(--n-text-color);
|
|
`)]),v(`disabled`,[f(`&:hover`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-hover);
|
|
border: var(--n-border-hover);
|
|
`)]),y(`focus`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-focus);
|
|
border: var(--n-border-focus);
|
|
`)]),y(`active`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-active);
|
|
border: var(--n-border-active);
|
|
`),m(`base-selection-label`,`background-color: var(--n-color-active);`),m(`base-selection-tags`,`background-color: var(--n-color-active);`)])]),y(`disabled`,`cursor: not-allowed;`,[p(`arrow`,`
|
|
color: var(--n-arrow-color-disabled);
|
|
`),m(`base-selection-label`,`
|
|
cursor: not-allowed;
|
|
background-color: var(--n-color-disabled);
|
|
`,[m(`base-selection-input`,`
|
|
cursor: not-allowed;
|
|
color: var(--n-text-color-disabled);
|
|
`),p(`render-label`,`
|
|
color: var(--n-text-color-disabled);
|
|
`)]),m(`base-selection-tags`,`
|
|
cursor: not-allowed;
|
|
background-color: var(--n-color-disabled);
|
|
`),m(`base-selection-placeholder`,`
|
|
cursor: not-allowed;
|
|
color: var(--n-placeholder-color-disabled);
|
|
`)]),m(`base-selection-input-tag`,`
|
|
height: calc(var(--n-height) - 6px);
|
|
line-height: calc(var(--n-height) - 6px);
|
|
outline: none;
|
|
display: none;
|
|
position: relative;
|
|
margin-bottom: 3px;
|
|
max-width: 100%;
|
|
vertical-align: bottom;
|
|
`,[p(`input`,`
|
|
font-size: inherit;
|
|
font-family: inherit;
|
|
min-width: 1px;
|
|
padding: 0;
|
|
background-color: #0000;
|
|
outline: none;
|
|
border: none;
|
|
max-width: 100%;
|
|
overflow: hidden;
|
|
width: 1em;
|
|
line-height: inherit;
|
|
cursor: pointer;
|
|
color: var(--n-text-color);
|
|
caret-color: var(--n-caret-color);
|
|
`),p(`mirror`,`
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
white-space: pre;
|
|
visibility: hidden;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
opacity: 0;
|
|
`)]),[`warning`,`error`].map(e=>y(`${e}-status`,[p(`state-border`,`border: var(--n-border-${e});`),v(`disabled`,[f(`&:hover`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-hover-${e});
|
|
border: var(--n-border-hover-${e});
|
|
`)]),y(`active`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-active-${e});
|
|
border: var(--n-border-active-${e});
|
|
`),m(`base-selection-label`,`background-color: var(--n-color-active-${e});`),m(`base-selection-tags`,`background-color: var(--n-color-active-${e});`)]),y(`focus`,[p(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-focus-${e});
|
|
border: var(--n-border-focus-${e});
|
|
`)])])]))]),m(`base-selection-popover`,`
|
|
margin-bottom: -3px;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
margin-right: -8px;
|
|
`),m(`base-selection-tag-wrapper`,`
|
|
max-width: 100%;
|
|
display: inline-flex;
|
|
padding: 0 7px 3px 0;
|
|
`,[f(`&:last-child`,`padding-right: 0;`),m(`tag`,`
|
|
font-size: 14px;
|
|
max-width: 100%;
|
|
`,[p(`content`,`
|
|
line-height: 1.25;
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
`)])])]),fe=n({name:`InternalSelection`,props:Object.assign(Object.assign({},S.props),{clsPrefix:{type:String,required:!0},bordered:{type:Boolean,default:void 0},active:Boolean,pattern:{type:String,default:``},placeholder:String,selectedOption:{type:Object,default:null},selectedOptions:{type:Array,default:null},labelField:{type:String,default:`label`},valueField:{type:String,default:`value`},multiple:Boolean,filterable:Boolean,clearable:Boolean,disabled:Boolean,size:{type:String,default:`medium`},loading:Boolean,autofocus:Boolean,showArrow:{type:Boolean,default:!0},inputProps:Object,focused:Boolean,renderTag:Function,onKeydown:Function,onClick:Function,onBlur:Function,onFocus:Function,onDeleteOption:Function,maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,onClear:Function,onPatternInput:Function,onPatternFocus:Function,onPatternBlur:Function,renderLabel:Function,status:String,inlineThemeDisabled:Boolean,ignoreComposition:{type:Boolean,default:!0},onResize:Function}),setup(e){let{mergedClsPrefixRef:t,mergedRtlRef:n}=g(e),r=x(`InternalSelection`,n,t),c=s(null),f=s(null),p=s(null),m=s(null),_=s(null),v=s(null),y=s(null),C=s(null),w=s(null),T=s(null),E=s(!1),D=s(!1),O=s(!1),k=S(`InternalSelection`,`-internal-selection`,de,W,e,l(e,`clsPrefix`)),j=u(()=>e.clearable&&!e.disabled&&(O.value||e.active)),ee=u(()=>e.selectedOption?e.renderTag?e.renderTag({option:e.selectedOption,handleClose:()=>{}}):e.renderLabel?e.renderLabel(e.selectedOption,!0):B(e.selectedOption[e.labelField],e.selectedOption,!0):e.placeholder),te=u(()=>{let t=e.selectedOption;if(t)return t[e.labelField]}),M=u(()=>e.multiple?!!(Array.isArray(e.selectedOptions)&&e.selectedOptions.length):e.selectedOption!==null);function ne(){var t;let{value:n}=c;if(n){let{value:r}=f;r&&(r.style.width=`${n.offsetWidth}px`,e.maxTagCount!==`responsive`&&((t=w.value)==null||t.sync({showAllItemsBeforeCalculate:!1})))}}function N(){let{value:e}=T;e&&(e.style.display=`none`)}function re(){let{value:e}=T;e&&(e.style.display=`inline-block`)}a(l(e,`active`),e=>{e||N()}),a(l(e,`pattern`),()=>{e.multiple&&i(ne)});function ie(t){let{onFocus:n}=e;n&&n(t)}function P(t){let{onBlur:n}=e;n&&n(t)}function F(t){let{onDeleteOption:n}=e;n&&n(t)}function I(t){let{onClear:n}=e;n&&n(t)}function L(t){let{onPatternInput:n}=e;n&&n(t)}function R(e){(!e.relatedTarget||!p.value?.contains(e.relatedTarget))&&ie(e)}function ae(e){p.value?.contains(e.relatedTarget)||P(e)}function oe(e){I(e)}function V(){O.value=!0}function se(){O.value=!1}function H(t){!e.active||!e.filterable||t.target!==f.value&&t.preventDefault()}function U(e){F(e)}let G=s(!1);function ce(t){if(t.key===`Backspace`&&!G.value&&!e.pattern.length){let{selectedOptions:t}=e;t?.length&&U(t[t.length-1])}}let K=null;function le(t){let{value:n}=c;n&&(n.textContent=t.target.value,ne()),e.ignoreComposition&&G.value?K=t:L(t)}function q(){G.value=!0}function ue(){G.value=!1,e.ignoreComposition&&L(K),K=null}function J(t){var n;D.value=!0,(n=e.onPatternFocus)==null||n.call(e,t)}function Y(t){var n;D.value=!1,(n=e.onPatternBlur)==null||n.call(e,t)}function fe(){var t,n;if(e.filterable)D.value=!1,(t=v.value)==null||t.blur(),(n=f.value)==null||n.blur();else if(e.multiple){let{value:e}=m;e?.blur()}else{let{value:e}=_;e?.blur()}}function pe(){var t,n,r;e.filterable?(D.value=!1,(t=v.value)==null||t.focus()):e.multiple?(n=m.value)==null||n.focus():(r=_.value)==null||r.focus()}function me(){let{value:e}=f;e&&(re(),e.focus())}function he(){let{value:e}=f;e&&e.blur()}function ge(e){let{value:t}=y;t&&t.setTextContent(`+${e}`)}function _e(){let{value:e}=C;return e}function X(){return f.value}let Z=null;function Q(){Z!==null&&window.clearTimeout(Z)}function $(){e.active||(Q(),Z=window.setTimeout(()=>{M.value&&(E.value=!0)},100))}function ve(){Q()}function ye(e){e||(Q(),E.value=!1)}a(M,e=>{e||(E.value=!1)}),d(()=>{o(()=>{let t=v.value;t&&(e.disabled?t.removeAttribute(`tabindex`):t.tabIndex=D.value?-1:0)})}),A(p,e.onResize);let{inlineThemeDisabled:be}=e,xe=u(()=>{let{size:t}=e,{common:{cubicBezierEaseInOut:n},self:{fontWeight:r,borderRadius:i,color:a,placeholderColor:o,textColor:s,paddingSingle:c,paddingMultiple:l,caretColor:u,colorDisabled:d,textColorDisabled:f,placeholderColorDisabled:p,colorActive:m,boxShadowFocus:h,boxShadowActive:g,boxShadowHover:_,border:v,borderFocus:y,borderHover:x,borderActive:S,arrowColor:C,arrowColorDisabled:w,loadingColor:T,colorActiveWarning:E,boxShadowFocusWarning:D,boxShadowActiveWarning:O,boxShadowHoverWarning:A,borderWarning:j,borderFocusWarning:ee,borderHoverWarning:te,borderActiveWarning:M,colorActiveError:ne,boxShadowFocusError:N,boxShadowActiveError:re,boxShadowHoverError:ie,borderError:P,borderFocusError:F,borderHoverError:I,borderActiveError:L,clearColor:R,clearColorHover:B,clearColorPressed:ae,clearSize:oe,arrowSize:V,[b(`height`,t)]:se,[b(`fontSize`,t)]:H}}=k.value,U=z(c),W=z(l);return{"--n-bezier":n,"--n-border":v,"--n-border-active":S,"--n-border-focus":y,"--n-border-hover":x,"--n-border-radius":i,"--n-box-shadow-active":g,"--n-box-shadow-focus":h,"--n-box-shadow-hover":_,"--n-caret-color":u,"--n-color":a,"--n-color-active":m,"--n-color-disabled":d,"--n-font-size":H,"--n-height":se,"--n-padding-single-top":U.top,"--n-padding-multiple-top":W.top,"--n-padding-single-right":U.right,"--n-padding-multiple-right":W.right,"--n-padding-single-left":U.left,"--n-padding-multiple-left":W.left,"--n-padding-single-bottom":U.bottom,"--n-padding-multiple-bottom":W.bottom,"--n-placeholder-color":o,"--n-placeholder-color-disabled":p,"--n-text-color":s,"--n-text-color-disabled":f,"--n-arrow-color":C,"--n-arrow-color-disabled":w,"--n-loading-color":T,"--n-color-active-warning":E,"--n-box-shadow-focus-warning":D,"--n-box-shadow-active-warning":O,"--n-box-shadow-hover-warning":A,"--n-border-warning":j,"--n-border-focus-warning":ee,"--n-border-hover-warning":te,"--n-border-active-warning":M,"--n-color-active-error":ne,"--n-box-shadow-focus-error":N,"--n-box-shadow-active-error":re,"--n-box-shadow-hover-error":ie,"--n-border-error":P,"--n-border-focus-error":F,"--n-border-hover-error":I,"--n-border-active-error":L,"--n-clear-size":oe,"--n-clear-color":R,"--n-clear-color-hover":B,"--n-clear-color-pressed":ae,"--n-arrow-size":V,"--n-font-weight":r}}),Se=be?h(`internal-selection`,u(()=>e.size[0]),xe,e):void 0;return{mergedTheme:k,mergedClearable:j,mergedClsPrefix:t,rtlEnabled:r,patternInputFocused:D,filterablePlaceholder:ee,label:te,selected:M,showTagsPanel:E,isComposing:G,counterRef:y,counterWrapperRef:C,patternInputMirrorRef:c,patternInputRef:f,selfRef:p,multipleElRef:m,singleElRef:_,patternInputWrapperRef:v,overflowRef:w,inputTagElRef:T,handleMouseDown:H,handleFocusin:R,handleClear:oe,handleMouseEnter:V,handleMouseLeave:se,handleDeleteOption:U,handlePatternKeyDown:ce,handlePatternInputInput:le,handlePatternInputBlur:Y,handlePatternInputFocus:J,handleMouseEnterCounter:$,handleMouseLeaveCounter:ve,handleFocusout:ae,handleCompositionEnd:ue,handleCompositionStart:q,onPopoverUpdateShow:ye,focus:pe,focusInput:me,blur:fe,blurInput:he,updateCounter:ge,getCounter:_e,getTail:X,renderLabel:e.renderLabel,cssVars:be?void 0:xe,themeClass:Se?.themeClass,onRender:Se?.onRender}},render(){let{status:e,multiple:n,size:r,disabled:i,filterable:a,maxTagCount:o,bordered:s,clsPrefix:l,ellipsisTagPopoverProps:u,onRender:d,renderTag:f,renderLabel:p}=this;d?.();let m=o===`responsive`,h=typeof o==`number`,g=m||h,_=t(F,null,{default:()=>t(I,{clsPrefix:l,loading:this.loading,showArrow:this.showArrow,showClear:this.mergedClearable&&this.selected,onClear:this.handleClear},{default:()=>{var e;return(e=this.$slots).arrow?.call(e)}})}),v;if(n){let{labelField:e}=this,n=n=>t(`div`,{class:`${l}-base-selection-tag-wrapper`,key:n.value},f?f({option:n,handleClose:()=>{this.handleDeleteOption(n)}}):t(U,{size:r,closable:!n.disabled,disabled:i,onClose:()=>{this.handleDeleteOption(n)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>p?p(n,!0):B(n[e],n,!0)})),s=()=>(h?this.selectedOptions.slice(0,o):this.selectedOptions).map(n),d=a?t(`div`,{class:`${l}-base-selection-input-tag`,ref:`inputTagElRef`,key:`__input-tag__`},t(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,tabindex:-1,disabled:i,value:this.pattern,autofocus:this.autofocus,class:`${l}-base-selection-input-tag__input`,onBlur:this.handlePatternInputBlur,onFocus:this.handlePatternInputFocus,onKeydown:this.handlePatternKeyDown,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),t(`span`,{ref:`patternInputMirrorRef`,class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,y=m?()=>t(`div`,{class:`${l}-base-selection-tag-wrapper`,ref:`counterWrapperRef`},t(U,{size:r,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:i})):void 0,b;if(h){let e=this.selectedOptions.length-o;e>0&&(b=t(`div`,{class:`${l}-base-selection-tag-wrapper`,key:`__counter__`},t(U,{size:r,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,disabled:i},{default:()=>`+${e}`})))}let x=m?a?t(J,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:s,counter:y,tail:()=>d}):t(J,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:s,counter:y}):h&&b?s().concat(b):s(),S=g?()=>t(`div`,{class:`${l}-base-selection-popover`},m?s():this.selectedOptions.map(n)):void 0,C=g?Object.assign({show:this.showTagsPanel,trigger:`hover`,overlap:!0,placement:`top`,width:`trigger`,onUpdateShow:this.onPopoverUpdateShow,theme:this.mergedTheme.peers.Popover,themeOverrides:this.mergedTheme.peerOverrides.Popover},u):null,w=!this.selected&&(!this.active||!this.pattern&&!this.isComposing)?t(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},t(`div`,{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,T=a?t(`div`,{ref:`patternInputWrapperRef`,class:`${l}-base-selection-tags`},x,m?null:d,_):t(`div`,{ref:`multipleElRef`,class:`${l}-base-selection-tags`,tabindex:i?void 0:0},x,_);v=t(c,null,g?t(V,Object.assign({},C,{scrollable:!0,style:`max-height: calc(var(--v-target-height) * 6.6);`}),{trigger:()=>T,default:S}):T,w)}else if(a){let e=this.pattern||this.isComposing,n=this.active?!e:!this.selected,r=this.active?!1:this.selected;v=t(`div`,{ref:`patternInputWrapperRef`,class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:Y(this.label)},t(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,class:`${l}-base-selection-input`,value:this.active?this.pattern:``,placeholder:``,readonly:i,disabled:i,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),r?t(`div`,{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:`input`},t(`div`,{class:`${l}-base-selection-overlay__wrapper`},f?f({option:this.selectedOption,handleClose:()=>{}}):p?p(this.selectedOption,!0):B(this.label,this.selectedOption,!0))):null,n?t(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:`placeholder`},t(`div`,{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,_)}else v=t(`div`,{ref:`singleElRef`,class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label===void 0?t(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:`placeholder`},t(`div`,{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):t(`div`,{class:`${l}-base-selection-input`,title:Y(this.label),key:`input`},t(`div`,{class:`${l}-base-selection-input__content`},f?f({option:this.selectedOption,handleClose:()=>{}}):p?p(this.selectedOption,!0):B(this.label,this.selectedOption,!0))),_);return t(`div`,{ref:`selfRef`,class:[`${l}-base-selection`,this.rtlEnabled&&`${l}-base-selection--rtl`,this.themeClass,e&&`${l}-base-selection--${e}-status`,{[`${l}-base-selection--active`]:this.active,[`${l}-base-selection--selected`]:this.selected||this.active&&this.pattern,[`${l}-base-selection--disabled`]:this.disabled,[`${l}-base-selection--multiple`]:this.multiple,[`${l}-base-selection--focus`]:this.focused}],style:this.cssVars,onClick:this.onClick,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onKeydown:this.onKeydown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onMousedown:this.handleMouseDown},v,s?t(`div`,{class:`${l}-base-selection__border`}):null,s?t(`div`,{class:`${l}-base-selection__state-border`}):null)}}),pe=f([m(`select`,`
|
|
z-index: auto;
|
|
outline: none;
|
|
width: 100%;
|
|
position: relative;
|
|
font-weight: var(--n-font-weight);
|
|
`),m(`select-menu`,`
|
|
margin: 4px 0;
|
|
box-shadow: var(--n-menu-box-shadow);
|
|
`,[P({originalTransition:`background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)`})])]),me=n({name:`Select`,props:Object.assign(Object.assign({},S.props),{to:E.propTo,bordered:{type:Boolean,default:void 0},clearable:Boolean,clearCreatedOptionsOnClear:{type:Boolean,default:!0},clearFilterAfterSelect:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},defaultValue:{type:[String,Number,Array],default:null},keyboard:{type:Boolean,default:!0},value:[String,Number,Array],placeholder:String,menuProps:Object,multiple:Boolean,size:String,menuSize:{type:String},filterable:Boolean,disabled:{type:Boolean,default:void 0},remote:Boolean,loading:Boolean,filter:Function,placement:{type:String,default:`bottom-start`},widthMode:{type:String,default:`trigger`},tag:Boolean,onCreate:Function,fallbackOption:{type:[Function,Boolean],default:void 0},show:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:!0},maxTagCount:[Number,String],ellipsisTagPopoverProps:Object,consistentMenuWidth:{type:Boolean,default:!0},virtualScroll:{type:Boolean,default:!0},labelField:{type:String,default:`label`},valueField:{type:String,default:`value`},childrenField:{type:String,default:`children`},renderLabel:Function,renderOption:Function,renderTag:Function,"onUpdate:value":[Function,Array],inputProps:Object,nodeProps:Function,ignoreComposition:{type:Boolean,default:!0},showOnFocus:Boolean,onUpdateValue:[Function,Array],onBlur:[Function,Array],onClear:[Function,Array],onFocus:[Function,Array],onScroll:[Function,Array],onSearch:[Function,Array],onUpdateShow:[Function,Array],"onUpdate:show":[Function,Array],displayDirective:{type:String,default:`show`},resetMenuOnOptionsChange:{type:Boolean,default:!0},status:String,showCheckmark:{type:Boolean,default:!0},scrollbarProps:Object,onChange:[Function,Array],items:Array}),slots:Object,setup(e){let{mergedClsPrefixRef:t,mergedBorderedRef:n,namespaceRef:r,inlineThemeDisabled:i,mergedComponentPropsRef:o}=g(e),c=S(`Select`,`-select`,pe,le,e,t),d=s(e.defaultValue),f=re(l(e,`value`),d),p=s(!1),m=s(``),_=ae(e,[`items`,`options`]),v=s([]),y=s([]),b=u(()=>y.value.concat(v.value).concat(_.value)),x=u(()=>{let{filter:t}=e;if(t)return t;let{labelField:n,valueField:r}=e;return(e,t)=>{if(!t)return!1;let i=t[n];if(typeof i==`string`)return j(e,i);let a=t[r];return typeof a==`string`?j(e,a):typeof a==`number`?j(e,String(a)):!1}}),C=u(()=>{if(e.remote)return _.value;{let{value:t}=b,{value:n}=m;return!n.length||!e.filterable?t:M(t,x.value,n,e.childrenField)}}),w=u(()=>{let{valueField:t,childrenField:n}=e,r=ne(t,n);return te(C.value,r)}),T=u(()=>ee(b.value,e.valueField,e.childrenField)),D=s(!1),O=re(l(e,`show`),D),k=s(null),A=s(null),P=s(null),{localeRef:F}=L(`Select`),I=u(()=>e.placeholder??F.value.placeholder),R=[],z=s(new Map),B=u(()=>{let{fallbackOption:t}=e;if(t===void 0){let{labelField:t,valueField:n}=e;return e=>({[t]:String(e),[n]:e})}return t===!1?!1:e=>Object.assign(t(e),{value:e})});function V(t){let n=e.remote,{value:r}=z,{value:i}=T,{value:a}=B,o=[];return t.forEach(e=>{if(i.has(e))o.push(i.get(e));else if(n&&r.has(e))o.push(r.get(e));else if(a){let t=a(e);t&&o.push(t)}}),o}let U=u(()=>{if(e.multiple){let{value:e}=f;return Array.isArray(e)?V(e):[]}return null}),W=u(()=>{let{value:t}=f;return!e.multiple&&!Array.isArray(t)?t===null?null:V([t])[0]||null:null}),G=oe(e,{mergedSize:t=>{let{size:n}=e;if(n)return n;let{mergedSize:r}=t||{};return r?.value?r.value:o?.value?.Select?.size||`medium`}}),{mergedSizeRef:ce,mergedDisabledRef:q,mergedStatusRef:ue}=G;function J(t,n){let{onChange:r,"onUpdate:value":i,onUpdateValue:a}=e,{nTriggerFormChange:o,nTriggerFormInput:s}=G;r&&H(r,t,n),a&&H(a,t,n),i&&H(i,t,n),d.value=t,o(),s()}function Y(t){let{onBlur:n}=e,{nTriggerFormBlur:r}=G;n&&H(n,t),r()}function de(){let{onClear:t}=e;t&&H(t)}function fe(t){let{onFocus:n,showOnFocus:r}=e,{nTriggerFormFocus:i}=G;n&&H(n,t),i(),r&&X()}function me(t){let{onSearch:n}=e;n&&H(n,t)}function he(t){let{onScroll:n}=e;n&&H(n,t)}function ge(){var t;let{remote:n,multiple:r}=e;if(n){let{value:n}=z;if(r){let{valueField:r}=e;(t=U.value)==null||t.forEach(e=>{n.set(e[r],e)})}else{let t=W.value;t&&n.set(t[e.valueField],t)}}}function _e(t){let{onUpdateShow:n,"onUpdate:show":r}=e;n&&H(n,t),r&&H(r,t),D.value=t}function X(){q.value||(_e(!0),D.value=!0,e.filterable&&Le())}function Z(){_e(!1)}function Q(){m.value=``,y.value=R}let $=s(!1);function ve(){e.filterable&&($.value=!0)}function ye(){e.filterable&&($.value=!1,O.value||Q())}function be(){q.value||(O.value?e.filterable?Le():Z():X())}function xe(e){(P.value?.selfRef)?.contains(e.relatedTarget)||(p.value=!1,Y(e),Z())}function Se(e){fe(e),p.value=!0}function Ce(){p.value=!0}function we(e){k.value?.$el.contains(e.relatedTarget)||(p.value=!1,Y(e),Z())}function Te(){var e;(e=k.value)==null||e.focus(),Z()}function Ee(e){O.value&&(k.value?.$el.contains(ie(e))||Z())}function De(t){if(!Array.isArray(t))return[];if(B.value)return Array.from(t);{let{remote:n}=e,{value:r}=T;if(n){let{value:e}=z;return t.filter(t=>r.has(t)||e.has(t))}else return t.filter(e=>r.has(e))}}function Oe(e){ke(e.rawNode)}function ke(t){if(q.value)return;let{tag:n,remote:r,clearFilterAfterSelect:i,valueField:a}=e;if(n&&!r){let{value:e}=y,t=e[0]||null;if(t){let e=v.value;e.length?e.push(t):v.value=[t],y.value=R}}if(r&&z.value.set(t[a],t),e.multiple){let e=De(f.value),o=e.findIndex(e=>e===t[a]);if(~o){if(e.splice(o,1),n&&!r){let e=Ae(t[a]);~e&&(v.value.splice(e,1),i&&(m.value=``))}}else e.push(t[a]),i&&(m.value=``);J(e,V(e))}else{if(n&&!r){let e=Ae(t[a]);~e?v.value=[v.value[e]]:v.value=R}Ie(),Z(),J(t[a],t)}}function Ae(t){return v.value.findIndex(n=>n[e.valueField]===t)}function je(t){O.value||X();let{value:n}=t.target;m.value=n;let{tag:r,remote:i}=e;if(me(n),r&&!i){if(!n){y.value=R;return}let{onCreate:t}=e,r=t?t(n):{[e.labelField]:n,[e.valueField]:n},{valueField:i,labelField:a}=e;_.value.some(e=>e[i]===r[i]||e[a]===r[a])||v.value.some(e=>e[i]===r[i]||e[a]===r[a])?y.value=R:y.value=[r]}}function Me(t){t.stopPropagation();let{multiple:n,tag:r,remote:i,clearCreatedOptionsOnClear:a}=e;!n&&e.filterable&&Z(),r&&!i&&a&&(v.value=R),de(),n?J([],[]):J(null,null)}function Ne(e){!N(e,`action`)&&!N(e,`empty`)&&!N(e,`header`)&&e.preventDefault()}function Pe(e){he(e)}function Fe(t){var n,r,i;if(!e.keyboard){t.preventDefault();return}switch(t.key){case` `:if(e.filterable)break;t.preventDefault();case`Enter`:if(!k.value?.isComposing){if(O.value){let t=P.value?.getPendingTmNode();t?Oe(t):e.filterable||(Z(),Ie())}else if(X(),e.tag&&$.value){let t=y.value[0];if(t){let n=t[e.valueField],{value:r}=f;e.multiple&&Array.isArray(r)&&r.includes(n)||ke(t)}}}t.preventDefault();break;case`ArrowUp`:if(t.preventDefault(),e.loading)return;O.value&&((n=P.value)==null||n.prev());break;case`ArrowDown`:if(t.preventDefault(),e.loading)return;O.value?(r=P.value)==null||r.next():X();break;case`Escape`:O.value&&(se(t),Z()),(i=k.value)==null||i.focus();break}}function Ie(){var e;(e=k.value)==null||e.focus()}function Le(){var e;(e=k.value)==null||e.focusInput()}function Re(){var e;O.value&&((e=A.value)==null||e.syncPosition())}ge(),a(l(e,`options`),ge);let ze={focus:()=>{var e;(e=k.value)==null||e.focus()},focusInput:()=>{var e;(e=k.value)==null||e.focusInput()},blur:()=>{var e;(e=k.value)==null||e.blur()},blurInput:()=>{var e;(e=k.value)==null||e.blurInput()}},Be=u(()=>{let{self:{menuBoxShadow:e}}=c.value;return{"--n-menu-box-shadow":e}}),Ve=i?h(`select`,void 0,Be,e):void 0;return Object.assign(Object.assign({},ze),{mergedStatus:ue,mergedClsPrefix:t,mergedBordered:n,namespace:r,treeMate:w,isMounted:K(),triggerRef:k,menuRef:P,pattern:m,uncontrolledShow:D,mergedShow:O,adjustedTo:E(e),uncontrolledValue:d,mergedValue:f,followerRef:A,localizedPlaceholder:I,selectedOption:W,selectedOptions:U,mergedSize:ce,mergedDisabled:q,focused:p,activeWithoutMenuOpen:$,inlineThemeDisabled:i,onTriggerInputFocus:ve,onTriggerInputBlur:ye,handleTriggerOrMenuResize:Re,handleMenuFocus:Ce,handleMenuBlur:we,handleMenuTabOut:Te,handleTriggerClick:be,handleToggle:Oe,handleDeleteOption:ke,handlePatternInput:je,handleClear:Me,handleTriggerBlur:xe,handleTriggerFocus:Se,handleKeydown:Fe,handleMenuAfterLeave:Q,handleMenuClickOutside:Ee,handleMenuScroll:Pe,handleMenuKeydown:Fe,handleMenuMousedown:Ne,mergedTheme:c,cssVars:i?void 0:Be,themeClass:Ve?.themeClass,onRender:Ve?.onRender})},render(){return t(`div`,{class:`${this.mergedClsPrefix}-select`},t(C,null,{default:()=>[t(w,null,{default:()=>t(fe,{ref:`triggerRef`,inlineThemeDisabled:this.inlineThemeDisabled,status:this.mergedStatus,inputProps:this.inputProps,clsPrefix:this.mergedClsPrefix,showArrow:this.showArrow,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,active:this.activeWithoutMenuOpen||this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,renderTag:this.renderTag,renderLabel:this.renderLabel,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,labelField:this.labelField,valueField:this.valueField,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,loading:this.loading,focused:this.focused,onClick:this.handleTriggerClick,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onClear:this.handleClear,onBlur:this.handleTriggerBlur,onFocus:this.handleTriggerFocus,onKeydown:this.handleKeydown,onPatternBlur:this.onTriggerInputBlur,onPatternFocus:this.onTriggerInputFocus,onResize:this.handleTriggerOrMenuResize,ignoreComposition:this.ignoreComposition},{arrow:()=>{var e;return[(e=this.$slots).arrow?.call(e)]}})}),t(O,{ref:`followerRef`,show:this.mergedShow,to:this.adjustedTo,teleportDisabled:this.adjustedTo===E.tdkey,containerClass:this.namespace,width:this.consistentMenuWidth?`target`:void 0,minWidth:`target`,placement:this.placement},{default:()=>t(ce,{name:`fade-in-scale-up-transition`,appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var n;return this.mergedShow||this.displayDirective===`show`?((n=this.onRender)==null||n.call(this),e(t(k,Object.assign({},this.menuProps,{ref:`menuRef`,onResize:this.handleTriggerOrMenuResize,inlineThemeDisabled:this.inlineThemeDisabled,virtualScroll:this.consistentMenuWidth&&this.virtualScroll,class:[`${this.mergedClsPrefix}-select-menu`,this.themeClass,this.menuProps?.class],clsPrefix:this.mergedClsPrefix,focusable:!0,labelField:this.labelField,valueField:this.valueField,autoPending:!0,nodeProps:this.nodeProps,theme:this.mergedTheme.peers.InternalSelectMenu,themeOverrides:this.mergedTheme.peerOverrides.InternalSelectMenu,treeMate:this.treeMate,multiple:this.multiple,size:this.menuSize,renderOption:this.renderOption,renderLabel:this.renderLabel,value:this.mergedValue,style:[this.menuProps?.style,this.cssVars],onToggle:this.handleToggle,onScroll:this.handleMenuScroll,onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onTabOut:this.handleMenuTabOut,onMousedown:this.handleMenuMousedown,show:this.mergedShow,showCheckmark:this.showCheckmark,resetMenuOnOptionsChange:this.resetMenuOnOptionsChange,scrollbarProps:this.scrollbarProps}),{empty:()=>{var e;return[(e=this.$slots).empty?.call(e)]},header:()=>{var e;return[(e=this.$slots).header?.call(e)]},action:()=>{var e;return[(e=this.$slots).action?.call(e)]}}),this.displayDirective===`show`?[[G,this.mergedShow],[R,this.handleMenuClickOutside,void 0,{capture:!0}]]:[[R,this.handleMenuClickOutside,void 0,{capture:!0}]])):null}})})]}))}});export{me as t}; |