Cascader-legacy-154a1968-1720699367816.js 28 KB

1
  1. System.register(["./index-legacy-e0181e36-1720699367816.js"],(function(e,n){"use strict";var l,t,o,a,r,i,s,d,u,c,h,v,f,p,m,g,b,y,w,k,x,C,S,R,M,P,N,T,F,O,K,A,B,L,z,$,I,D,j,V,U,H,E,q,_,W,G,J,Q,X,Y,Z,ee,ne,le,te,oe,ae,re,ie,se,de,ue,ce;return{setters:[e=>{l=e.af,t=e.dl,o=e.d,a=e.dm,r=e.al,i=e.r,s=e.p,d=e.ad,u=e._,c=e.dn,h=e.a5,v=e.dp,f=e.dq,p=e.dr,m=e.ds,g=e.dt,b=e.aa,y=e.a8,w=e.U,k=e.du,x=e.n,C=e.dv,S=e.dw,R=e.dx,M=e.dy,P=e.dz,N=e.dA,T=e.dB,F=e.dC,O=e.dD,K=e.a0,A=e.dE,B=e.dF,L=e.dG,z=e.dH,$=e.dI,I=e.dJ,D=e.dK,j=e.dL,V=e.ah,U=e.dM,H=e.ag,E=e.ai,q=e.ab,_=e.ao,W=e.b2,G=e.ak,J=e.dN,Q=e.dO,X=e.c3,Y=e.A,Z=e.a7,ee=e.dP,ne=e.dQ,le=e.ap,te=e.dR,oe=e.dS,ae=e.dT,re=e.dU,ie=e.dV,se=e.av,de=e.dW,ue=e.dX,ce=e.S}],execute:function(){const n=l("base-menu-mask","\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: 14px;\n overflow: hidden;\n",[t()]),he=o({name:"BaseMenuMask",props:{clsPrefix:{type:String,required:!0}},setup(e){a("-base-menu-mask",n,r(e,"clsPrefix"));const l=i(null);let t=null;const o=i(!1);s((()=>{null!==t&&window.clearTimeout(t)}));const d={showOnce(e,n=1500){t&&window.clearTimeout(t),o.value=!0,l.value=e,t=window.setTimeout((()=>{o.value=!1,l.value=null}),n)}};return Object.assign({message:l,show:o},d)},render(){return d(u,{name:"fade-in-transition"},{default:()=>this.show?d("div",{class:`${this.clsPrefix}-base-menu-mask`},this.message):null})}}),ve=c({name:"Cascader",common:h,peers:{InternalSelectMenu:v,InternalSelection:f,Scrollbar:p,Checkbox:m,Empty:g},self:e=>{const{borderRadius:n,boxShadow2:l,popoverColor:t,textColor2:o,textColor3:a,primaryColor:r,textColorDisabled:i,dividerColor:s,hoverColor:d,fontSizeMedium:u,heightMedium:c}=e;return{menuBorderRadius:n,menuColor:t,menuBoxShadow:l,menuDividerColor:s,menuHeight:"calc(var(--n-option-height) * 6.6)",optionArrowColor:a,optionHeight:c,optionFontSize:u,optionColorHover:d,optionTextColor:o,optionTextColorActive:r,optionTextColorDisabled:i,optionCheckMarkColor:r,loadingColor:r,columnWidth:"180px"}}});function fe(e){return e?e.map((e=>e.rawNode)):null}function pe(e,n,l){const t=[];for(;e;)t.push(e.rawNode[l]),e=e.parent;return t.reverse().join(n)}const me=b("n-cascader"),ge=o({name:"NCascaderOption",props:{tmNode:{type:Object,required:!0}},setup(e){const{expandTriggerRef:n,remoteRef:l,multipleRef:t,mergedValueRef:o,checkedKeysRef:a,indeterminateKeysRef:r,hoverKeyPathRef:i,keyboardKeyRef:s,loadingKeySetRef:d,cascadeRef:u,mergedCheckStrategyRef:c,onLoadRef:h,mergedClsPrefixRef:v,mergedThemeRef:f,labelFieldRef:p,showCheckboxRef:m,renderPrefixRef:g,renderSuffixRef:b,updateHoverKey:x,updateKeyboardKey:C,addLoadingKey:S,deleteLoadingKey:R,closeMenu:M,doCheck:N,doUncheck:T,renderLabelRef:F}=y(me),O=w((()=>e.tmNode.key)),K=w((()=>{const{value:e}=n,{value:t}=l;return!t&&"hover"===e})),A=w((()=>{if(K.value)return E})),B=w((()=>{if(K.value)return q})),L=k((()=>{const{value:e}=t;return e?a.value.includes(O.value):o.value===O.value})),z=k((()=>!!t.value&&r.value.includes(O.value))),$=k((()=>i.value.includes(O.value))),I=k((()=>{const{value:e}=s;return null!==e&&e===O.value})),D=k((()=>!!l.value&&d.value.has(O.value))),j=w((()=>e.tmNode.isLeaf)),V=w((()=>e.tmNode.disabled)),U=w((()=>e.tmNode.rawNode[p.value])),H=w((()=>e.tmNode.shallowLoaded));function E(){if(!K.value||V.value)return;const{value:e}=O;x(e),C(e)}function q(){K.value&&E()}function _(){const{value:e}=t,{value:n}=O;e?z.value||L.value?T(n):N(n):(N(n),M(!0))}return{checkStrategy:c,multiple:t,cascade:u,checked:L,indeterminate:z,hoverPending:$,keyboardPending:I,isLoading:D,showCheckbox:m,isLeaf:j,disabled:V,label:U,mergedClsPrefix:v,mergedTheme:f,handleClick:function(n){if(V.value)return;const{value:t}=l,{value:o}=d,{value:a}=h,{value:r}=O,{value:i}=j,{value:s}=H;P(n,"checkbox")||(t&&!s&&!o.has(r)&&a&&(S(r),a(e.tmNode.rawNode).then((()=>{R(r)})).catch((()=>{R(r)}))),x(r),C(r)),i&&_()},handleCheckboxUpdateValue:function(){const{value:e}=j;e||_()},mergedHandleMouseEnter:A,mergedHandleMouseMove:B,renderLabel:F,renderPrefix:g,renderSuffix:b}},render(){const{mergedClsPrefix:e,showCheckbox:n,renderLabel:l,renderPrefix:t,renderSuffix:o}=this;let a=null;if(n||t){const n=this.showCheckbox?d(x,{focusable:!1,"data-checkbox":!0,disabled:this.disabled,checked:this.checked,indeterminate:this.indeterminate,theme:this.mergedTheme.peers.Checkbox,themeOverrides:this.mergedTheme.peerOverrides.Checkbox,onUpdateChecked:this.handleCheckboxUpdateValue}):null;a=d("div",{class:`${e}-cascader-option__prefix`},t?t({option:this.tmNode.rawNode,checked:this.checked,node:n}):n)}let r=null;const i=d("div",{class:`${e}-cascader-option-icon-placeholder`},this.isLeaf?"child"!==this.checkStrategy||this.multiple&&this.cascade?null:d(u,{name:"fade-in-scale-up-transition"},{default:()=>this.checked?d(S,{clsPrefix:e,class:`${e}-cascader-option-icon ${e}-cascader-option-icon--checkmark`},{default:()=>d(M,null)}):null}):d(C,{clsPrefix:e,scale:.85,strokeWidth:24,show:this.isLoading,class:`${e}-cascader-option-icon`},{default:()=>d(S,{clsPrefix:e,key:"arrow",class:`${e}-cascader-option-icon ${e}-cascader-option-icon--arrow`},{default:()=>d(R,null)})}));return r=d("div",{class:`${e}-cascader-option__suffix`},o?o({option:this.tmNode.rawNode,checked:this.checked,node:i}):i),d("div",{class:[`${e}-cascader-option`,this.keyboardPending||this.hoverPending&&`${e}-cascader-option--pending`,this.disabled&&`${e}-cascader-option--disabled`,this.showCheckbox&&`${e}-cascader-option--show-prefix`],onMouseenter:this.mergedHandleMouseEnter,onMousemove:this.mergedHandleMouseMove,onClick:this.handleClick},a,d("span",{class:`${e}-cascader-option__label`},l?l(this.tmNode.rawNode,this.checked):this.label),r)}}),be=o({name:"CascaderSubmenu",props:{depth:{type:Number,required:!0},tmNodes:{type:Array,required:!0}},setup(){const{virtualScrollRef:e,mergedClsPrefixRef:n,mergedThemeRef:l,optionHeightRef:t}=y(me),o=i(null),a=i(null),r={scroll(n,l){var t,r;e.value?null===(t=a.value)||void 0===t||t.scrollTo({index:n}):null===(r=o.value)||void 0===r||r.scrollTo({index:n,elSize:l})}};return Object.assign({mergedClsPrefix:n,mergedTheme:l,scrollbarInstRef:o,vlInstRef:a,virtualScroll:e,itemSize:w((()=>N(t.value))),handleVlScroll:()=>{var e;null===(e=o.value)||void 0===e||e.sync()},getVlContainer:()=>{var e;return null===(e=a.value)||void 0===e?void 0:e.listElRef},getVlContent:()=>{var e;return null===(e=a.value)||void 0===e?void 0:e.itemsElRef}},r)},render(){const{mergedClsPrefix:e,mergedTheme:n,virtualScroll:l}=this;return d("div",{class:[l&&`${e}-cascader-submenu--virtual`,`${e}-cascader-submenu`]},d(T,{ref:"scrollbarInstRef",theme:n.peers.Scrollbar,themeOverrides:n.peerOverrides.Scrollbar,container:l?this.getVlContainer:void 0,content:l?this.getVlContent:void 0},{default:()=>l?d(F,{items:this.tmNodes,itemSize:this.itemSize,onScroll:this.handleVlScroll,showScrollbar:!1,ref:"vlInstRef"},{default:({item:e})=>d(ge,{key:e.key,tmNode:e})}):this.tmNodes.map((e=>d(ge,{key:e.key,tmNode:e})))}))}}),ye=o({name:"NCascaderMenu",props:{value:[String,Number,Array],placement:{type:String,default:"bottom-start"},show:Boolean,menuModel:{type:Array,required:!0},loading:Boolean,onFocus:{type:Function,required:!0},onBlur:{type:Function,required:!0},onKeydown:{type:Function,required:!0},onMousedown:{type:Function,required:!0},onTabout:{type:Function,required:!0}},setup(e){const{localeRef:n,isMountedRef:l,mergedClsPrefixRef:t,syncCascaderMenuPosition:o,handleCascaderMenuClickOutside:a,mergedThemeRef:r,getColumnStyleRef:s}=y(me),d=[],u=i(null),c=i(null);O(c,(function(){o()}));const h={scroll(e,n,l){const t=d[e];t&&t.scroll(n,l)},showErrorMessage:function(e){var l;const{value:{loadingRequiredMessage:t}}=n;null===(l=u.value)||void 0===l||l.showOnce(t(e))}};return Object.assign({isMounted:l,mergedClsPrefix:t,selfElRef:c,submenuInstRefs:d,maskInstRef:u,mergedTheme:r,getColumnStyle:s,handleFocusin:function(n){const{value:l}=c;l&&(l.contains(n.relatedTarget)||e.onFocus(n))},handleFocusout:function(n){const{value:l}=c;l&&(l.contains(n.relatedTarget)||e.onBlur(n))},handleClickOutside:function(e){a(e)}},h)},render(){const{submenuInstRefs:e,mergedClsPrefix:n,mergedTheme:l}=this;return d(u,{name:"fade-in-scale-up-transition",appear:this.isMounted},{default:()=>this.show?K(d("div",{tabindex:"0",ref:"selfElRef",class:`${n}-cascader-menu`,onMousedown:this.onMousedown,onFocusin:this.handleFocusin,onFocusout:this.handleFocusout,onKeydown:this.onKeydown},this.menuModel[0].length?d("div",{class:`${n}-cascader-submenu-wrapper`},this.menuModel.map(((n,l)=>{var t;return d(be,{style:null===(t=this.getColumnStyle)||void 0===t?void 0:t.call(this,{level:l}),ref:n=>{n&&(e[l]=n)},key:l,tmNodes:n,depth:l+1})})),d(he,{clsPrefix:n,ref:"maskInstRef"})):d("div",{class:`${n}-cascader-menu__empty`},B(this.$slots.empty,(()=>[d(L,{theme:l.peers.Empty,themeOverrides:l.peerOverrides.Empty})]))),z(this.$slots.action,(e=>e&&d("div",{class:`${n}-cascader-menu-action`,"data-action":!0},e))),d($,{onFocus:this.onTabout})),[[A,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),we=o({name:"NCascaderSelectMenu",props:{value:{type:[String,Number,Array],default:null},show:Boolean,pattern:{type:String,default:""},multiple:Boolean,tmNodes:{type:Array,default:()=>[]},filter:Function,labelField:{type:String,required:!0},separator:{type:String,required:!0}},setup(e){const{isMountedRef:n,mergedValueRef:l,mergedClsPrefixRef:t,mergedThemeRef:o,mergedCheckStrategyRef:a,slots:r,syncSelectMenuPosition:s,closeMenu:d,handleSelectMenuClickOutside:u,doUncheck:c,doCheck:h,clearPattern:v}=y(me),f=i(null),p=w((()=>function(e,n,l,t){const o=[],a=[];return function e(r){for(const i of r){if(i.disabled)continue;const{rawNode:r}=i;a.push(r),!i.isLeaf&&n||o.push({label:pe(i,t,l),value:i.key,rawNode:i.rawNode,path:Array.from(a)}),!i.isLeaf&&i.children&&e(i.children),a.pop()}}(e),o}(e.tmNodes,"child"===a.value,e.labelField,e.separator))),m=w((()=>{const{filter:n}=e;if(n)return n;const{labelField:l}=e;return(e,n,t)=>t.some((n=>n[l]&&~n[l].indexOf(e)))})),g=w((()=>{const{pattern:n}=e,{value:l}=m;return(n?p.value.filter((e=>l(n,e.rawNode,e.path))):p.value).map((e=>({value:e.value,label:e.label})))})),b=w((()=>I(g.value,D("value","children"))));function k(n){if(e.multiple){const{value:e}=l;Array.isArray(e)?e.includes(n.key)?c(n.key):h(n.key):null===e&&h(n.key),v()}else h(n.key),d(!0)}const x={prev:function(){var e;null===(e=f.value)||void 0===e||e.prev()},next:function(){var e;null===(e=f.value)||void 0===e||e.next()},enter:function(){var e;if(f){const n=null===(e=f.value)||void 0===e?void 0:e.getPendingTmNode();return n&&k(n),!0}return!1}};return Object.assign({isMounted:n,mergedTheme:o,mergedClsPrefix:t,menuInstRef:f,selectTreeMate:b,handleResize:function(){s()},handleToggle:function(e){k(e)},handleClickOutside:function(e){u(e)},cascaderSlots:r},x)},render(){const{mergedClsPrefix:e,isMounted:n,mergedTheme:l,cascaderSlots:t}=this;return d(u,{name:"fade-in-scale-up-transition",appear:n},{default:()=>this.show?K(d(j,{ref:"menuInstRef",onResize:this.handleResize,clsPrefix:e,class:`${e}-cascader-menu`,autoPending:!0,themeOverrides:l.peerOverrides.InternalSelectMenu,theme:l.peers.InternalSelectMenu,treeMate:this.selectTreeMate,multiple:this.multiple,value:this.value,onToggle:this.handleToggle},{empty:()=>B(t["not-found"],(()=>[]))}),[[A,this.handleClickOutside,void 0,{capture:!0}]]):null})}}),ke=V([l("cascader-menu","\n outline: none;\n position: relative;\n margin: 4px 0;\n display: flex;\n flex-flow: column nowrap;\n border-radius: var(--n-menu-border-radius);\n overflow: hidden;\n box-shadow: var(--n-menu-box-shadow);\n color: var(--n-option-text-color);\n background-color: var(--n-menu-color);\n ",[U({transformOrigin:"inherit",duration:"0.2s"}),H("empty","\n display: flex;\n padding: 12px 32px;\n flex: 1;\n justify-content: center;\n "),l("scrollbar","\n width: 100%;\n "),l("base-menu-mask","\n background-color: var(--n-menu-mask-color);\n "),l("base-loading","\n color: var(--n-loading-color);\n "),l("cascader-submenu-wrapper","\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n "),l("cascader-submenu","\n height: var(--n-menu-height);\n min-width: var(--n-column-width);\n position: relative;\n ",[E("virtual","\n width: var(--n-column-width);\n "),l("scrollbar-content","\n position: relative;\n "),V("&:first-child","\n border-top-left-radius: var(--n-menu-border-radius);\n border-bottom-left-radius: var(--n-menu-border-radius);\n "),V("&:last-child","\n border-top-right-radius: var(--n-menu-border-radius);\n border-bottom-right-radius: var(--n-menu-border-radius);\n "),V("&:not(:first-child)","\n border-left: 1px solid var(--n-menu-divider-color);\n ")]),l("cascader-menu-action","\n box-sizing: border-box;\n padding: 8px;\n border-top: 1px solid var(--n-menu-divider-color);\n "),l("cascader-option","\n height: var(--n-option-height);\n line-height: var(--n-option-height);\n font-size: var(--n-option-font-size);\n padding: 0 0 0 18px;\n box-sizing: border-box;\n min-width: 182px;\n background-color: #0000;\n display: flex;\n align-items: center;\n white-space: nowrap;\n position: relative;\n cursor: pointer;\n transition:\n background-color .2s var(--n-bezier),\n color 0.2s var(--n-bezier);\n ",[E("show-prefix","\n padding-left: 0;\n "),H("label","\n flex: 1 0 0;\n overflow: hidden;\n text-overflow: ellipsis;\n "),H("prefix","\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n "),H("suffix","\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n "),l("cascader-option-icon-placeholder","\n line-height: 0;\n position: relative;\n width: 16px;\n height: 16px;\n font-size: 16px;\n ",[l("cascader-option-icon",[E("checkmark","\n color: var(--n-option-check-mark-color);\n ",[U({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})]),E("arrow","\n color: var(--n-option-arrow-color);\n ")])]),E("selected","\n color: var(--n-option-text-color-active);\n "),E("active","\n color: var(--n-option-text-color-active);\n background-color: var(--n-option-color-hover);\n "),E("pending","\n background-color: var(--n-option-color-hover);\n "),V("&:hover","\n background-color: var(--n-option-color-hover);\n "),E("disabled","\n color: var(--n-option-text-color-disabled);\n background-color: #0000;\n cursor: not-allowed;\n ",[l("cascader-option-icon",[E("arrow","\n color: var(--n-option-text-color-disabled);\n ")])])])]),l("cascader","\n z-index: auto;\n position: relative;\n width: 100%;\n ")]),xe=Object.assign(Object.assign({},_.props),{allowCheckingNotLoaded:Boolean,to:Q.propTo,bordered:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},value:[String,Number,Array],defaultValue:{type:[String,Number,Array],default:null},placeholder:String,multiple:Boolean,size:String,filterable:Boolean,disabled:{type:Boolean,default:void 0},disabledField:{type:String,default:"disabled"},expandTrigger:{type:String,default:"click"},clearable:Boolean,clearFilterAfterSelect:{type:Boolean,default:!0},remote:Boolean,onLoad:Function,separator:{type:String,default:" / "},filter:Function,placement:{type:String,default:"bottom-start"},cascade:{type:Boolean,default:!0},leafOnly:Boolean,showPath:{type:Boolean,default:!0},show:{type:Boolean,default:void 0},maxTagCount:[String,Number],ellipsisTagPopoverProps:Object,menuProps:Object,filterMenuProps:Object,virtualScroll:{type:Boolean,default:!0},checkStrategy:{type:String,default:"all"},valueField:{type:String,default:"value"},labelField:{type:String,default:"label"},childrenField:{type:String,default:"children"},renderLabel:Function,status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],"onUpdate:show":[Function,Array],onUpdateShow:[Function,Array],onBlur:Function,onFocus:Function,getColumnStyle:Function,renderPrefix:Function,renderSuffix:Function,onChange:[Function,Array]});e("N",o({name:"Cascader",props:xe,setup(e,{slots:n}){const{mergedBorderedRef:l,mergedClsPrefixRef:t,namespaceRef:o,inlineThemeDisabled:a}=q(e),s=_("Cascader","-cascader",ke,ve,e,t),{localeRef:d}=W("Cascader"),u=i(e.defaultValue),c=w((()=>e.value)),h=G(c,u),v=w((()=>e.leafOnly?"child":e.checkStrategy)),f=i(""),p=J(e),{mergedSizeRef:m,mergedDisabledRef:g,mergedStatusRef:b}=p,y=i(null),k=i(null),x=i(null),C=i(null),S=i(null),R=i(new Set),M=i(null),T=i(null),F=Q(e),O=i(!1),K=e=>{R.value.add(e)},A=e=>{R.value.delete(e)},B=w((()=>{const{valueField:n,childrenField:l,disabledField:t}=e;return I(e.options,{getDisabled:e=>e[t],getKey:e=>e[n],getChildren:e=>e[l]})})),L=w((()=>{const{cascade:n,multiple:l}=e;return l&&Array.isArray(h.value)?B.value.getCheckedKeys(h.value,{cascade:n,allowNotLoaded:e.allowCheckingNotLoaded}):{checkedKeys:[],indeterminateKeys:[]}})),z=w((()=>L.value.checkedKeys)),$=w((()=>L.value.indeterminateKeys)),D=w((()=>{const{treeNodePath:e,treeNode:n}=B.value.getPath(S.value);let l;return null===n?l=[B.value.treeNodes]:(l=e.map((e=>e.siblings)),n.isLeaf||R.value.has(n.key)||!n.children||l.push(n.children)),l})),j=w((()=>{const{keyPath:e}=B.value.getPath(S.value);return e})),V=w((()=>s.value.self.optionHeight));function U(n){const{onUpdateShow:l,"onUpdate:show":t}=e;l&&ue(l,n),t&&ue(t,n),be.value=n}function H(n,l,t){const{onUpdateValue:o,"onUpdate:value":a,onChange:r}=e,{nTriggerFormInput:i,nTriggerFormChange:s}=p;o&&ue(o,n,l,t),a&&ue(a,n,l,t),r&&ue(r,n,l,t),u.value=n,i(),s()}function E(e){C.value=e}function te(e){S.value=e}function oe(e){const{value:{getNode:n}}=B;return e.map((e=>{var l;return(null===(l=n(e))||void 0===l?void 0:l.rawNode)||null}))}function ae(n){var l;const{cascade:t,multiple:o,filterable:a}=e,{value:{check:r,getNode:i,getPath:s}}=B;if(o)try{const{checkedKeys:l}=r(n,L.value.checkedKeys,{cascade:t,checkStrategy:v.value,allowNotLoaded:e.allowCheckingNotLoaded});H(l,oe(l),l.map((e=>{var n;return fe(null===(n=s(e))||void 0===n?void 0:n.treeNodePath)}))),a&&Me(),C.value=n,S.value=n}catch(d){if(!(d instanceof ie))throw d;if(y.value){const l=i(n);null!==l&&y.value.showErrorMessage(l.rawNode[e.labelField])}}else if("child"===v.value){const e=i(n);if(!(null==e?void 0:e.isLeaf))return!1;H(n,e.rawNode,fe(s(n).treeNodePath))}else{const e=i(n);H(n,(null==e?void 0:e.rawNode)||null,fe(null===(l=s(n))||void 0===l?void 0:l.treeNodePath))}return!0}function re(n){const{cascade:l,multiple:t}=e;if(t){const{value:{uncheck:t,getNode:o,getPath:a}}=B,{checkedKeys:r}=t(n,L.value.checkedKeys,{cascade:l,checkStrategy:v.value,allowNotLoaded:e.allowCheckingNotLoaded});H(r,r.map((e=>{var n;return(null===(n=o(e))||void 0===n?void 0:n.rawNode)||null})),r.map((e=>{var n;return fe(null===(n=a(e))||void 0===n?void 0:n.treeNodePath)}))),C.value=n,S.value=n}}X(e.options)&&Y(e.options,((e,n)=>{e!==n&&(S.value=null,C.value=null)}));const he=w((()=>{if(e.multiple){const{showPath:n,separator:l,labelField:t,cascade:o}=e,{getCheckedKeys:a,getNode:r}=B.value;return a(z.value,{cascade:o,checkStrategy:v.value,allowNotLoaded:e.allowCheckingNotLoaded}).checkedKeys.map((e=>{const o=r(e);return null===o?{label:String(e),value:e}:{label:n?pe(o,l,t):o.rawNode[t],value:o.key}}))}return[]})),ge=w((()=>{const{multiple:n,showPath:l,separator:t,labelField:o}=e,{value:a}=h;if(n||Array.isArray(a))return null;{const{getNode:e}=B.value;if(null===a)return null;const n=e(a);return null===n?{label:String(a),value:a}:{label:l?pe(n,t,o):n.rawNode[o],value:n.key}}})),be=i(!1),ye=r(e,"show"),we=G(ye,be),xe=w((()=>{const{placeholder:n}=e;return void 0!==n?n:d.value.placeholder})),Ce=w((()=>!(!e.filterable||!f.value)));function Se(n){const{onBlur:l}=e,{nTriggerFormBlur:t}=p;l&&ue(l,n),t()}function Re(n){const{onFocus:l}=e,{nTriggerFormFocus:t}=p;l&&ue(l,n),t()}function Me(){var e;null===(e=x.value)||void 0===e||e.focusInput()}function Pe(){g.value||(f.value="",U(!0),e.filterable&&Me())}function Ne(e=!1){var n;e&&(null===(n=x.value)||void 0===n||n.focus()),U(!1),f.value=""}function Te(e){var n;Ce.value||we.value&&((null===(n=x.value)||void 0===n?void 0:n.$el.contains(se(e)))||Ne())}function Fe(){e.clearFilterAfterSelect&&(f.value="")}function Oe(n){var l,t,o;const{value:a}=C,{value:r}=B;switch(n){case"prev":if(null!==a){const e=r.getPrev(a,{loop:!0});null!==e&&(E(e.key),null===(l=y.value)||void 0===l||l.scroll(e.level,e.index,N(V.value)))}break;case"next":if(null===a){const e=r.getFirstAvailableNode();null!==e&&(E(e.key),null===(t=y.value)||void 0===t||t.scroll(e.level,e.index,N(V.value)))}else{const e=r.getNext(a,{loop:!0});null!==e&&(E(e.key),null===(o=y.value)||void 0===o||o.scroll(e.level,e.index,N(V.value)))}break;case"child":if(null!==a){const n=r.getNode(a);if(null!==n)if(n.shallowLoaded){const e=r.getChild(a);null!==e&&(te(a),E(e.key))}else{const{value:l}=R;if(!l.has(a)){K(a),te(a);const{onLoad:l}=e;l&&l(n.rawNode).then((()=>{A(a)})).catch((()=>{A(a)}))}}}break;case"parent":if(null!==a){const e=r.getParent(a);if(null!==e){E(e.key);const n=e.getParent();te(null===n?null:n.key)}}}}function Ke(n){var l,t;switch(n.key){case" ":case"ArrowDown":case"ArrowUp":if(e.filterable&&we.value)break;n.preventDefault()}if(!P(n,"action"))switch(n.key){case" ":if(e.filterable)return;case"Enter":if(we.value){const{value:n}=Ce,{value:l}=C;if(n)k.value&&k.value.enter()&&Fe();else if(null!==l)if(z.value.includes(l)||$.value.includes(l))re(l);else{const n=ae(l);!e.multiple&&n&&Ne(!0)}}else Pe();break;case"ArrowUp":n.preventDefault(),we.value&&(Ce.value?null===(l=k.value)||void 0===l||l.prev():Oe("prev"));break;case"ArrowDown":n.preventDefault(),we.value?Ce.value?null===(t=k.value)||void 0===t||t.next():Oe("next"):Pe();break;case"ArrowLeft":n.preventDefault(),we.value&&!Ce.value&&Oe("parent");break;case"ArrowRight":n.preventDefault(),we.value&&!Ce.value&&Oe("child");break;case"Escape":we.value&&(de(n),Ne(!0))}}function Ae(){var e;null===(e=M.value)||void 0===e||e.syncPosition()}function Be(){var e;null===(e=T.value)||void 0===e||e.syncPosition()}Y(we,(n=>{if(!n)return;if(e.multiple)return;const{value:l}=h;Array.isArray(l)||null===l?(C.value=null,S.value=null):(C.value=l,S.value=l,ce((()=>{var e;if(!we.value)return;const{value:n}=S;if(null!==h.value){const l=B.value.getNode(n);l&&(null===(e=y.value)||void 0===e||e.scroll(l.level,l.index,N(V.value)))}})))}),{immediate:!0});const Le=w((()=>!(!e.multiple||!e.cascade)||"child"!==v.value));Z(me,{slots:n,mergedClsPrefixRef:t,mergedThemeRef:s,mergedValueRef:h,checkedKeysRef:z,indeterminateKeysRef:$,hoverKeyPathRef:j,mergedCheckStrategyRef:v,showCheckboxRef:Le,cascadeRef:r(e,"cascade"),multipleRef:r(e,"multiple"),keyboardKeyRef:C,hoverKeyRef:S,remoteRef:r(e,"remote"),loadingKeySetRef:R,expandTriggerRef:r(e,"expandTrigger"),isMountedRef:ee(),onLoadRef:r(e,"onLoad"),virtualScrollRef:r(e,"virtualScroll"),optionHeightRef:V,localeRef:d,labelFieldRef:r(e,"labelField"),renderLabelRef:r(e,"renderLabel"),getColumnStyleRef:r(e,"getColumnStyle"),renderPrefixRef:r(e,"renderPrefix"),renderSuffixRef:r(e,"renderSuffix"),syncCascaderMenuPosition:Be,syncSelectMenuPosition:Ae,updateKeyboardKey:E,updateHoverKey:te,addLoadingKey:K,deleteLoadingKey:A,doCheck:ae,doUncheck:re,closeMenu:Ne,handleSelectMenuClickOutside:function(e){Ce.value&&Te(e)},handleCascaderMenuClickOutside:Te,clearPattern:Fe});const ze={focus:()=>{var e;null===(e=x.value)||void 0===e||e.focus()},blur:()=>{var e;null===(e=x.value)||void 0===e||e.blur()},getCheckedData:()=>{if(Le.value){const e=z.value;return{keys:e,options:oe(e)}}return{keys:[],options:[]}},getIndeterminateData:()=>{if(Le.value){const e=$.value;return{keys:e,options:oe(e)}}return{keys:[],options:[]}}},$e=w((()=>{const{self:{optionArrowColor:e,optionTextColor:n,optionTextColorActive:l,optionTextColorDisabled:t,optionCheckMarkColor:o,menuColor:a,menuBoxShadow:r,menuDividerColor:i,menuBorderRadius:d,menuHeight:u,optionColorHover:c,optionHeight:h,optionFontSize:v,loadingColor:f,columnWidth:p},common:{cubicBezierEaseInOut:m}}=s.value;return{"--n-bezier":m,"--n-menu-border-radius":d,"--n-menu-box-shadow":r,"--n-menu-height":u,"--n-column-width":p,"--n-menu-color":a,"--n-menu-divider-color":i,"--n-option-height":h,"--n-option-font-size":v,"--n-option-text-color":n,"--n-option-text-color-disabled":t,"--n-option-text-color-active":l,"--n-option-color-hover":c,"--n-option-check-mark-color":o,"--n-option-arrow-color":e,"--n-menu-mask-color":ne(a,{alpha:.75}),"--n-loading-color":f}})),Ie=a?le("cascader",void 0,$e,e):void 0;return Object.assign(Object.assign({},ze),{handleTriggerResize:function(){we.value&&(Ce.value?Ae():Be())},mergedStatus:b,selectMenuFollowerRef:M,cascaderMenuFollowerRef:T,triggerInstRef:x,selectMenuInstRef:k,cascaderMenuInstRef:y,mergedBordered:l,mergedClsPrefix:t,namespace:o,mergedValue:h,mergedShow:we,showSelectMenu:Ce,pattern:f,treeMate:B,mergedSize:m,mergedDisabled:g,localizedPlaceholder:xe,selectedOption:ge,selectedOptions:he,adjustedTo:F,menuModel:D,handleMenuTabout:function(){Ne(!0)},handleMenuFocus:function(e){var n;(null===(n=x.value)||void 0===n?void 0:n.$el.contains(e.relatedTarget))||(O.value=!0,Re(e))},handleMenuBlur:function(e){var n;(null===(n=x.value)||void 0===n?void 0:n.$el.contains(e.relatedTarget))||(O.value=!1,Se(e))},handleMenuKeydown:function(e){Ke(e)},handleMenuMousedown:function(n){P(n,"action")||e.multiple&&e.filter&&(n.preventDefault(),Me())},handleTriggerFocus:function(e){var n;(null===(n=y.value)||void 0===n?void 0:n.$el.contains(e.relatedTarget))||(O.value=!0,Re(e))},handleTriggerBlur:function(e){var n;(null===(n=y.value)||void 0===n?void 0:n.$el.contains(e.relatedTarget))||(O.value=!1,Se(e),Ne())},handleTriggerClick:function(){e.filterable?Pe():we.value?Ne(!0):Pe()},handleClear:function(n){n.stopPropagation(),e.multiple?H([],[],[]):H(null,null,null)},handleDeleteOption:function(n){const{multiple:l}=e,{value:t}=h;l&&Array.isArray(t)&&void 0!==n.value?re(n.value):H(null,null,null)},handlePatternInput:function(e){f.value=e.target.value},handleKeydown:Ke,focused:O,optionHeight:V,mergedTheme:s,cssVars:a?void 0:$e,themeClass:null==Ie?void 0:Ie.themeClass,onRender:null==Ie?void 0:Ie.onRender})},render(){const{mergedClsPrefix:e}=this;return d("div",{class:`${e}-cascader`},d(te,null,{default:()=>[d(oe,null,{default:()=>d(ae,{onResize:this.handleTriggerResize,ref:"triggerInstRef",status:this.mergedStatus,clsPrefix:e,maxTagCount:this.maxTagCount,ellipsisTagPopoverProps:this.ellipsisTagPopoverProps,bordered:this.mergedBordered,size:this.mergedSize,theme:this.mergedTheme.peers.InternalSelection,themeOverrides:this.mergedTheme.peerOverrides.InternalSelection,active:this.mergedShow,pattern:this.pattern,placeholder:this.localizedPlaceholder,selectedOption:this.selectedOption,selectedOptions:this.selectedOptions,multiple:this.multiple,filterable:this.filterable,clearable:this.clearable,disabled:this.mergedDisabled,focused:this.focused,onFocus:this.handleTriggerFocus,onBlur:this.handleTriggerBlur,onClick:this.handleTriggerClick,onClear:this.handleClear,onDeleteOption:this.handleDeleteOption,onPatternInput:this.handlePatternInput,onKeydown:this.handleKeydown},{arrow:()=>{var e,n;return null===(n=(e=this.$slots).arrow)||void 0===n?void 0:n.call(e)}})}),d(re,{key:"cascaderMenu",ref:"cascaderMenuFollowerRef",show:this.mergedShow&&!this.showSelectMenu,containerClass:this.namespace,placement:this.placement,width:this.options.length?void 0:"target",teleportDisabled:this.adjustedTo===Q.tdkey,to:this.adjustedTo},{default:()=>{var e;null===(e=this.onRender)||void 0===e||e.call(this);const{menuProps:n}=this;return d(ye,Object.assign({},n,{ref:"cascaderMenuInstRef",class:[this.themeClass,null==n?void 0:n.class],value:this.mergedValue,show:this.mergedShow&&!this.showSelectMenu,menuModel:this.menuModel,style:[this.cssVars,null==n?void 0:n.style],onFocus:this.handleMenuFocus,onBlur:this.handleMenuBlur,onKeydown:this.handleMenuKeydown,onMousedown:this.handleMenuMousedown,onTabout:this.handleMenuTabout}),{action:()=>{var e,n;return null===(n=(e=this.$slots).action)||void 0===n?void 0:n.call(e)},empty:()=>{var e,n;return null===(n=(e=this.$slots).empty)||void 0===n?void 0:n.call(e)}})}}),d(re,{key:"selectMenu",ref:"selectMenuFollowerRef",show:this.mergedShow&&this.showSelectMenu,containerClass:this.namespace,width:"target",placement:this.placement,to:this.adjustedTo,teleportDisabled:this.adjustedTo===Q.tdkey},{default:()=>{var e;null===(e=this.onRender)||void 0===e||e.call(this);const{filterMenuProps:n}=this;return d(we,Object.assign({},n,{ref:"selectMenuInstRef",class:[this.themeClass,null==n?void 0:n.class],value:this.mergedValue,show:this.mergedShow&&this.showSelectMenu,pattern:this.pattern,multiple:this.multiple,tmNodes:this.treeMate.treeNodes,filter:this.filter,labelField:this.labelField,separator:this.separator,style:[this.cssVars,null==n?void 0:n.style]}))}})]}))}}))}}}));