generated from VLADIMIR/template_frontend
210 lines
33 KiB
JavaScript
210 lines
33 KiB
JavaScript
import{$ as e,A as t,H as n,J as r,L as i,N as a,et as o,g as s,nt as c,st as l,ut as u,x as d}from"./auth-Dlv0TZH7.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-CW1_EUxw.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./Follower-Dxa1u-Fk.js";import{a as k,c as ee,i as A,n as te,o as ne,r as j,t as M,u as N}from"./utils-C8k7gGrr.js";import{D as P,M as re,a as F,d as ie,i as I,l as L,y as R}from"./Card-CfZWA1ay.js";import{c as z}from"./resolve-slot-DN9_xhmA.js";import{a as B}from"./light-B-plK5Ph.js";import{t as ae}from"./use-compitable-s8dIAO0Z.js";import{o as oe}from"./Button-D7SvPTTG.js";import{t as V}from"./Popover-XrVR6ktU.js";import{r as se}from"./keep-i-TI_pod.js";import{t as H}from"./call-ChHlm4-m.js";import{t as U}from"./Tag-DWY4EXx8.js";import{E as W,Q as G,Y as ce,q as K,v as le}from"./index-DRS1zBKt.js";var q=`v-hidden`,ue=T(`[v-hidden]`,{display:`none!important`}),J=t({name:`Overflow`,props:{getCounter:Function,getTail:Function,updateCounter:Function,onUpdateCount:Function,onUpdateOverflow:Function},setup(e,{slots:t}){let r=l(null),i=l(null);function a(n){let{value:a}=r,{getCounter:o,getTail:s}=e,c;if(c=o===void 0?i.value:o(),!a||!c)return;c.hasAttribute(q)&&c.removeAttribute(q);let{children:l}=a;if(n.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 o=_();return ue.mount({id:`vueuc/overflow`,head:!0,anchorMetaName:D,ssr:o}),n(()=>a({showAllItemsBeforeCalculate:!1})),{selfRef:r,counterRef:i,sync:a}},render(){let{$slots:e}=this;return i(()=>this.sync({showAllItemsBeforeCalculate:!1})),a(`div`,{class:`v-overflow`,ref:`selfRef`},[r(e,`default`),e.counter?e.counter():a(`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=t({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(t){let{mergedClsPrefixRef:r,mergedRtlRef:a}=g(t),s=x(`InternalSelection`,a,r),c=l(null),f=l(null),p=l(null),m=l(null),_=l(null),v=l(null),y=l(null),C=l(null),w=l(null),T=l(null),E=l(!1),D=l(!1),O=l(!1),k=S(`InternalSelection`,`-internal-selection`,de,W,t,u(t,`clsPrefix`)),A=d(()=>t.clearable&&!t.disabled&&(O.value||t.active)),te=d(()=>t.selectedOption?t.renderTag?t.renderTag({option:t.selectedOption,handleClose:()=>{}}):t.renderLabel?t.renderLabel(t.selectedOption,!0):B(t.selectedOption[t.labelField],t.selectedOption,!0):t.placeholder),ne=d(()=>{let e=t.selectedOption;if(e)return e[t.labelField]}),j=d(()=>t.multiple?!!(Array.isArray(t.selectedOptions)&&t.selectedOptions.length):t.selectedOption!==null);function M(){var e;let{value:n}=c;if(n){let{value:r}=f;r&&(r.style.width=`${n.offsetWidth}px`,t.maxTagCount!==`responsive`&&((e=w.value)==null||e.sync({showAllItemsBeforeCalculate:!1})))}}function N(){let{value:e}=T;e&&(e.style.display=`none`)}function P(){let{value:e}=T;e&&(e.style.display=`inline-block`)}e(u(t,`active`),e=>{e||N()}),e(u(t,`pattern`),()=>{t.multiple&&i(M)});function re(e){let{onFocus:n}=t;n&&n(e)}function F(e){let{onBlur:n}=t;n&&n(e)}function ie(e){let{onDeleteOption:n}=t;n&&n(e)}function I(e){let{onClear:n}=t;n&&n(e)}function L(e){let{onPatternInput:n}=t;n&&n(e)}function R(e){(!e.relatedTarget||!p.value?.contains(e.relatedTarget))&&re(e)}function ae(e){p.value?.contains(e.relatedTarget)||F(e)}function oe(e){I(e)}function V(){O.value=!0}function se(){O.value=!1}function H(e){!t.active||!t.filterable||e.target!==f.value&&e.preventDefault()}function U(e){ie(e)}let G=l(!1);function ce(e){if(e.key===`Backspace`&&!G.value&&!t.pattern.length){let{selectedOptions:e}=t;e?.length&&U(e[e.length-1])}}let K=null;function le(e){let{value:n}=c;n&&(n.textContent=e.target.value,M()),t.ignoreComposition&&G.value?K=e:L(e)}function q(){G.value=!0}function ue(){G.value=!1,t.ignoreComposition&&L(K),K=null}function J(e){var n;D.value=!0,(n=t.onPatternFocus)==null||n.call(t,e)}function Y(e){var n;D.value=!1,(n=t.onPatternBlur)==null||n.call(t,e)}function fe(){var e,n;if(t.filterable)D.value=!1,(e=v.value)==null||e.blur(),(n=f.value)==null||n.blur();else if(t.multiple){let{value:e}=m;e?.blur()}else{let{value:e}=_;e?.blur()}}function pe(){var e,n,r;t.filterable?(D.value=!1,(e=v.value)==null||e.focus()):t.multiple?(n=m.value)==null||n.focus():(r=_.value)==null||r.focus()}function me(){let{value:e}=f;e&&(P(),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 $(){t.active||(Q(),Z=window.setTimeout(()=>{j.value&&(E.value=!0)},100))}function ve(){Q()}function ye(e){e||(Q(),E.value=!1)}e(j,e=>{e||(E.value=!1)}),n(()=>{o(()=>{let e=v.value;e&&(t.disabled?e.removeAttribute(`tabindex`):e.tabIndex=D.value?-1:0)})}),ee(p,t.onResize);let{inlineThemeDisabled:be}=t,xe=d(()=>{let{size:e}=t,{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:ee,borderWarning:A,borderFocusWarning:te,borderHoverWarning:ne,borderActiveWarning:j,colorActiveError:M,boxShadowFocusError:N,boxShadowActiveError:P,boxShadowHoverError:re,borderError:F,borderFocusError:ie,borderHoverError:I,borderActiveError:L,clearColor:R,clearColorHover:B,clearColorPressed:ae,clearSize:oe,arrowSize:V,[b(`height`,e)]:se,[b(`fontSize`,e)]: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":ee,"--n-border-warning":A,"--n-border-focus-warning":te,"--n-border-hover-warning":ne,"--n-border-active-warning":j,"--n-color-active-error":M,"--n-box-shadow-focus-error":N,"--n-box-shadow-active-error":P,"--n-box-shadow-hover-error":re,"--n-border-error":F,"--n-border-focus-error":ie,"--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`,d(()=>t.size[0]),xe,t):void 0;return{mergedTheme:k,mergedClearable:A,mergedClsPrefix:r,rtlEnabled:s,patternInputFocused:D,filterablePlaceholder:te,label:ne,selected:j,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:t.renderLabel,cssVars:be?void 0:xe,themeClass:Se?.themeClass,onRender:Se?.onRender}},render(){let{status:e,multiple:t,size:n,disabled:r,filterable:i,maxTagCount:o,bordered:c,clsPrefix:l,ellipsisTagPopoverProps:u,onRender:d,renderTag:f,renderLabel:p}=this;d?.();let m=o===`responsive`,h=typeof o==`number`,g=m||h,_=a(ie,null,{default:()=>a(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(t){let{labelField:e}=this,t=t=>a(`div`,{class:`${l}-base-selection-tag-wrapper`,key:t.value},f?f({option:t,handleClose:()=>{this.handleDeleteOption(t)}}):a(U,{size:n,closable:!t.disabled,disabled:r,onClose:()=>{this.handleDeleteOption(t)},internalCloseIsButtonTag:!1,internalCloseFocusable:!1},{default:()=>p?p(t,!0):B(t[e],t,!0)})),c=()=>(h?this.selectedOptions.slice(0,o):this.selectedOptions).map(t),d=i?a(`div`,{class:`${l}-base-selection-input-tag`,ref:`inputTagElRef`,key:`__input-tag__`},a(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,tabindex:-1,disabled:r,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})),a(`span`,{ref:`patternInputMirrorRef`,class:`${l}-base-selection-input-tag__mirror`},this.pattern)):null,y=m?()=>a(`div`,{class:`${l}-base-selection-tag-wrapper`,ref:`counterWrapperRef`},a(U,{size:n,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,onMouseleave:this.handleMouseLeaveCounter,disabled:r})):void 0,b;if(h){let e=this.selectedOptions.length-o;e>0&&(b=a(`div`,{class:`${l}-base-selection-tag-wrapper`,key:`__counter__`},a(U,{size:n,ref:`counterRef`,onMouseenter:this.handleMouseEnterCounter,disabled:r},{default:()=>`+${e}`})))}let x=m?i?a(J,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,getTail:this.getTail,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:c,counter:y,tail:()=>d}):a(J,{ref:`overflowRef`,updateCounter:this.updateCounter,getCounter:this.getCounter,style:{width:`100%`,display:`flex`,overflow:`hidden`}},{default:c,counter:y}):h&&b?c().concat(b):c(),S=g?()=>a(`div`,{class:`${l}-base-selection-popover`},m?c():this.selectedOptions.map(t)):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)?a(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`},a(`div`,{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):null,T=i?a(`div`,{ref:`patternInputWrapperRef`,class:`${l}-base-selection-tags`},x,m?null:d,_):a(`div`,{ref:`multipleElRef`,class:`${l}-base-selection-tags`,tabindex:r?void 0:0},x,_);v=a(s,null,g?a(V,Object.assign({},C,{scrollable:!0,style:`max-height: calc(var(--v-target-height) * 6.6);`}),{trigger:()=>T,default:S}):T,w)}else if(i){let e=this.pattern||this.isComposing,t=this.active?!e:!this.selected,n=this.active?!1:this.selected;v=a(`div`,{ref:`patternInputWrapperRef`,class:`${l}-base-selection-label`,title:this.patternInputFocused?void 0:Y(this.label)},a(`input`,Object.assign({},this.inputProps,{ref:`patternInputRef`,class:`${l}-base-selection-input`,value:this.active?this.pattern:``,placeholder:``,readonly:r,disabled:r,tabindex:-1,autofocus:this.autofocus,onFocus:this.handlePatternInputFocus,onBlur:this.handlePatternInputBlur,onInput:this.handlePatternInputInput,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd})),n?a(`div`,{class:`${l}-base-selection-label__render-label ${l}-base-selection-overlay`,key:`input`},a(`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,t?a(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:`placeholder`},a(`div`,{class:`${l}-base-selection-overlay__wrapper`},this.filterablePlaceholder)):null,_)}else v=a(`div`,{ref:`singleElRef`,class:`${l}-base-selection-label`,tabindex:this.disabled?void 0:0},this.label===void 0?a(`div`,{class:`${l}-base-selection-placeholder ${l}-base-selection-overlay`,key:`placeholder`},a(`div`,{class:`${l}-base-selection-placeholder__inner`},this.placeholder)):a(`div`,{class:`${l}-base-selection-input`,title:Y(this.label),key:`input`},a(`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 a(`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,c?a(`div`,{class:`${l}-base-selection__border`}):null,c?a(`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);
|
|
`,[F({originalTransition:`background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)`})])]),me=t({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(t){let{mergedClsPrefixRef:n,mergedBorderedRef:r,namespaceRef:i,inlineThemeDisabled:a,mergedComponentPropsRef:o}=g(t),s=S(`Select`,`-select`,pe,le,t,n),c=l(t.defaultValue),f=P(u(t,`value`),c),p=l(!1),m=l(``),_=ae(t,[`items`,`options`]),v=l([]),y=l([]),b=d(()=>y.value.concat(v.value).concat(_.value)),x=d(()=>{let{filter:e}=t;if(e)return e;let{labelField:n,valueField:r}=t;return(e,t)=>{if(!t)return!1;let i=t[n];if(typeof i==`string`)return A(e,i);let a=t[r];return typeof a==`string`?A(e,a):typeof a==`number`?A(e,String(a)):!1}}),C=d(()=>{if(t.remote)return _.value;{let{value:e}=b,{value:n}=m;return!n.length||!t.filterable?e:j(e,x.value,n,t.childrenField)}}),w=d(()=>{let{valueField:e,childrenField:n}=t,r=M(e,n);return ne(C.value,r)}),T=d(()=>te(b.value,t.valueField,t.childrenField)),D=l(!1),O=P(u(t,`show`),D),k=l(null),ee=l(null),F=l(null),{localeRef:ie}=L(`Select`),I=d(()=>t.placeholder??ie.value.placeholder),R=[],z=l(new Map),B=d(()=>{let{fallbackOption:e}=t;if(e===void 0){let{labelField:e,valueField:n}=t;return t=>({[e]:String(t),[n]:t})}return e===!1?!1:t=>Object.assign(e(t),{value:t})});function V(e){let n=t.remote,{value:r}=z,{value:i}=T,{value:a}=B,o=[];return e.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=d(()=>{if(t.multiple){let{value:e}=f;return Array.isArray(e)?V(e):[]}return null}),W=d(()=>{let{value:e}=f;return!t.multiple&&!Array.isArray(e)?e===null?null:V([e])[0]||null:null}),G=oe(t,{mergedSize:e=>{let{size:n}=t;if(n)return n;let{mergedSize:r}=e||{};return r?.value?r.value:o?.value?.Select?.size||`medium`}}),{mergedSizeRef:ce,mergedDisabledRef:q,mergedStatusRef:ue}=G;function J(e,n){let{onChange:r,"onUpdate:value":i,onUpdateValue:a}=t,{nTriggerFormChange:o,nTriggerFormInput:s}=G;r&&H(r,e,n),a&&H(a,e,n),i&&H(i,e,n),c.value=e,o(),s()}function Y(e){let{onBlur:n}=t,{nTriggerFormBlur:r}=G;n&&H(n,e),r()}function de(){let{onClear:e}=t;e&&H(e)}function fe(e){let{onFocus:n,showOnFocus:r}=t,{nTriggerFormFocus:i}=G;n&&H(n,e),i(),r&&X()}function me(e){let{onSearch:n}=t;n&&H(n,e)}function he(e){let{onScroll:n}=t;n&&H(n,e)}function ge(){var e;let{remote:n,multiple:r}=t;if(n){let{value:n}=z;if(r){let{valueField:r}=t;(e=U.value)==null||e.forEach(e=>{n.set(e[r],e)})}else{let e=W.value;e&&n.set(e[t.valueField],e)}}}function _e(e){let{onUpdateShow:n,"onUpdate:show":r}=t;n&&H(n,e),r&&H(r,e),D.value=e}function X(){q.value||(_e(!0),D.value=!0,t.filterable&&Le())}function Z(){_e(!1)}function Q(){m.value=``,y.value=R}let $=l(!1);function ve(){t.filterable&&($.value=!0)}function ye(){t.filterable&&($.value=!1,O.value||Q())}function be(){q.value||(O.value?t.filterable?Le():Z():X())}function xe(e){(F.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(re(e))||Z())}function De(e){if(!Array.isArray(e))return[];if(B.value)return Array.from(e);{let{remote:n}=t,{value:r}=T;if(n){let{value:t}=z;return e.filter(e=>r.has(e)||t.has(e))}else return e.filter(e=>r.has(e))}}function Oe(e){ke(e.rawNode)}function ke(e){if(q.value)return;let{tag:n,remote:r,clearFilterAfterSelect:i,valueField:a}=t;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(e[a],e),t.multiple){let t=De(f.value),o=t.findIndex(t=>t===e[a]);if(~o){if(t.splice(o,1),n&&!r){let t=Ae(e[a]);~t&&(v.value.splice(t,1),i&&(m.value=``))}}else t.push(e[a]),i&&(m.value=``);J(t,V(t))}else{if(n&&!r){let t=Ae(e[a]);~t?v.value=[v.value[t]]:v.value=R}Ie(),Z(),J(e[a],e)}}function Ae(e){return v.value.findIndex(n=>n[t.valueField]===e)}function je(e){O.value||X();let{value:n}=e.target;m.value=n;let{tag:r,remote:i}=t;if(me(n),r&&!i){if(!n){y.value=R;return}let{onCreate:e}=t,r=e?e(n):{[t.labelField]:n,[t.valueField]:n},{valueField:i,labelField:a}=t;_.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(e){e.stopPropagation();let{multiple:n,tag:r,remote:i,clearCreatedOptionsOnClear:a}=t;!n&&t.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(e){var n,r,i;if(!t.keyboard){e.preventDefault();return}switch(e.key){case` `:if(t.filterable)break;e.preventDefault();case`Enter`:if(!k.value?.isComposing){if(O.value){let e=F.value?.getPendingTmNode();e?Oe(e):t.filterable||(Z(),Ie())}else if(X(),t.tag&&$.value){let e=y.value[0];if(e){let n=e[t.valueField],{value:r}=f;t.multiple&&Array.isArray(r)&&r.includes(n)||ke(e)}}}e.preventDefault();break;case`ArrowUp`:if(e.preventDefault(),t.loading)return;O.value&&((n=F.value)==null||n.prev());break;case`ArrowDown`:if(e.preventDefault(),t.loading)return;O.value?(r=F.value)==null||r.next():X();break;case`Escape`:O.value&&(se(e),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=ee.value)==null||e.syncPosition())}ge(),e(u(t,`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=d(()=>{let{self:{menuBoxShadow:e}}=s.value;return{"--n-menu-box-shadow":e}}),Ve=a?h(`select`,void 0,Be,t):void 0;return Object.assign(Object.assign({},ze),{mergedStatus:ue,mergedClsPrefix:n,mergedBordered:r,namespace:i,treeMate:w,isMounted:K(),triggerRef:k,menuRef:F,pattern:m,uncontrolledShow:D,mergedShow:O,adjustedTo:E(t),uncontrolledValue:c,mergedValue:f,followerRef:ee,localizedPlaceholder:I,selectedOption:W,selectedOptions:U,mergedSize:ce,mergedDisabled:q,focused:p,activeWithoutMenuOpen:$,inlineThemeDisabled:a,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:s,cssVars:a?void 0:Be,themeClass:Ve?.themeClass,onRender:Ve?.onRender})},render(){return a(`div`,{class:`${this.mergedClsPrefix}-select`},a(C,null,{default:()=>[a(w,null,{default:()=>a(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)]}})}),a(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:()=>a(ce,{name:`fade-in-scale-up-transition`,appear:this.isMounted,onAfterLeave:this.handleMenuAfterLeave},{default:()=>{var e;return this.mergedShow||this.displayDirective===`show`?((e=this.onRender)==null||e.call(this),c(a(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}})})]}))}});function he(e){let[t,n=``]=e.split(`T`),[r,i,a]=t.split(`-`).map(Number),[o,s,c]=(n.split(`.`)[0]||`00:00:00`).split(`:`).map(Number);return new Date(Date.UTC(r,i-1,a,o,s,c||0))}function ge(e){if(!e)return``;let t=he(e);return Number.isNaN(t.getTime())?``:t.toLocaleString(`ru-RU`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`})}export{he as n,me as r,ge as t}; |