| 1 |
- System.register(["./index-legacy-6b8080dc-1763717014417.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,L,A,B,z,$,I,j,D,V,U,E,H,q,_,W,Q,Z,J,X,Y,G,ee,ne,le,te,oe,ae,re,ie,se,de,ue,ce;return{setters:[e=>{l=e.C,t=e.dN,o=e.d,a=e.dO,r=e.U,i=e.r,s=e.p,d=e.A,u=e.av,c=e.dP,h=e.B,v=e.dQ,f=e.dR,p=e.dS,m=e.dT,g=e.dU,b=e.R,y=e._,w=e.J,k=e.Z,x=e.n,C=e.dV,S=e.a2,R=e.a3,M=e.dW,P=e.a0,N=e.dX,T=e.dY,F=e.dZ,O=e.d_,K=e.V,L=e.d$,A=e.e0,B=e.e1,z=e.e2,$=e.e3,I=e.e4,j=e.e5,D=e.e6,V=e.F,U=e.e7,E=e.E,H=e.D,q=e.I,_=e.L,W=e.bm,Q=e.K,Z=e.dE,J=e.e8,X=e.cr,Y=e.a5,G=e.M,ee=e.e9,ne=e.ea,le=e.Q,te=e.eb,oe=e.ec,ae=e.ed,re=e.ee,ie=e.ef,se=e.aI,de=e.eg,ue=e.S,ce=e.ak}],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:function(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"}}}),fe=b("n-cascader"),pe=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(fe),O=w(()=>e.tmNode.key),K=w(()=>{const{value:e}=n,{value:t}=l;return!t&&"hover"===e}),L=w(()=>{if(K.value)return H}),A=w(()=>{if(K.value)return q}),B=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}),j=k(()=>!!l.value&&d.value.has(O.value)),D=w(()=>e.tmNode.isLeaf),V=w(()=>e.tmNode.disabled),U=w(()=>e.tmNode.rawNode[p.value]),E=w(()=>e.tmNode.shallowLoaded);function H(){if(!K.value||V.value)return;const{value:e}=O;x(e),C(e)}function q(){K.value&&H()}function _(){const{value:e}=t,{value:n}=O;e?z.value||B.value?T(n):N(n):(N(n),M(!0))}return{checkStrategy:c,multiple:t,cascade:u,checked:B,indeterminate:z,hoverPending:$,keyboardPending:I,isLoading:j,showCheckbox:m,isLeaf:D,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}=D,{value:s}=E;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}=D;e||_()},mergedHandleMouseEnter:L,mergedHandleMouseMove:A,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)}}),me=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(fe),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(pe,{key:e.key,tmNode:e})}):this.tmNodes.map(e=>d(pe,{key:e.key,tmNode:e}))}))}}),ge=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(fe),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(me,{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`},A(this.$slots.empty,()=>[d(B,{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})),[[L,this.handleClickOutside,void 0,{capture:!0}]]):null})}});function be(e){return e?e.map(e=>e.rawNode):null}function ye(e,n,l){const t=[];for(;e;)t.push(e.rawNode[l]),e=e.parent;return t.reverse().join(n)}const 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(fe),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:ye(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].toLowerCase().indexOf(e.toLowerCase()))}),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,j("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(D,{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:()=>A(t["not-found"],()=>[])}),[[L,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"}),E("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 ",[H("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 ",[H("show-prefix","\n padding-left: 0;\n "),E("label","\n flex: 1 0 0;\n overflow: hidden;\n text-overflow: ellipsis;\n "),E("prefix","\n min-width: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n "),E("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",[H("checkmark","\n color: var(--n-option-check-mark-color);\n ",[U({originalTransition:"background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)"})]),H("arrow","\n color: var(--n-option-arrow-color);\n ")])]),H("selected","\n color: var(--n-option-text-color-active);\n "),H("active","\n color: var(--n-option-text-color-active);\n background-color: var(--n-option-color-hover);\n "),H("pending","\n background-color: var(--n-option-color-hover);\n "),V("&:hover","\n background-color: var(--n-option-color-hover);\n "),H("disabled","\n color: var(--n-option-text-color-disabled);\n background-color: #0000;\n cursor: not-allowed;\n ",[l("cascader-option-icon",[H("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:J.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,slots:Object,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=Q(c,u),v=w(()=>e.leafOnly?"child":e.checkStrategy),f=i(""),p=Z(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=J(e),O=i(!1),K=e=>{R.value.add(e)},L=e=>{R.value.delete(e)},A=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]})}),B=w(()=>{const{cascade:n,multiple:l}=e;return l&&Array.isArray(h.value)?A.value.getCheckedKeys(h.value,{cascade:n,allowNotLoaded:e.allowCheckingNotLoaded}):{checkedKeys:[],indeterminateKeys:[]}}),z=w(()=>B.value.checkedKeys),$=w(()=>B.value.indeterminateKeys),j=w(()=>{const{treeNodePath:e,treeNode:n}=A.value.getPath(S.value);let l;return null===n?l=[A.value.treeNodes]:(l=e.map(e=>e.siblings),n.isLeaf||R.value.has(n.key)||!n.children||l.push(n.children)),l}),D=w(()=>{const{keyPath:e}=A.value.getPath(S.value);return e}),V=w(()=>s.value.self.optionHeight);X(e.options)&&Y(e.options,(e,n)=>{e!==n&&(S.value=null,C.value=null)});const U=i(!1);function E(n){const{onUpdateShow:l,"onUpdate:show":t}=e;l&&ue(l,n),t&&ue(t,n),U.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 te(e){C.value=e}function oe(e){S.value=e}function ae(e){const{value:{getNode:n}}=A;return e.map(e=>{var l;return(null===(l=n(e))||void 0===l?void 0:l.rawNode)||null})}function re(n){var l;const{cascade:t,multiple:o,filterable:a}=e,{value:{check:r,getNode:i,getPath:s}}=A;if(o)try{const{checkedKeys:l}=r(n,B.value.checkedKeys,{cascade:t,checkStrategy:v.value,allowNotLoaded:e.allowCheckingNotLoaded});H(l,ae(l),l.map(e=>{var n;return be(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,be(s(n).treeNodePath))}else{const e=i(n);H(n,(null==e?void 0:e.rawNode)||null,be(null===(l=s(n))||void 0===l?void 0:l.treeNodePath))}return!0}function he(n){const{cascade:l,multiple:t}=e;if(t){const{value:{uncheck:t,getNode:o,getPath:a}}=A,{checkedKeys:r}=t(n,B.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 be(null===(n=a(e))||void 0===n?void 0:n.treeNodePath)})),C.value=n,S.value=n}}const pe=w(()=>{if(e.multiple){const{showPath:n,separator:l,labelField:t,cascade:o}=e,{getCheckedKeys:a,getNode:r}=A.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?ye(o,l,t):o.rawNode[t],value:o.key}})}return[]}),me=w(()=>{const{multiple:n,showPath:l,separator:t,labelField:o}=e,{value:a}=h;if(n||Array.isArray(a))return null;{const{getNode:e}=A.value;if(null===a)return null;const n=e(a);return null===n?{label:String(a),value:a}:{label:l?ye(n,t,o):n.rawNode[o],value:n.key}}}),ge=r(e,"show"),we=Q(ge,U),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="",E(!0),e.filterable&&Me())}function Ne(e=!1){var n;e&&(null===(n=x.value)||void 0===n||n.focus()),E(!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}=A;switch(n){case"prev":if(null!==a){const e=r.getPrev(a,{loop:!0});null!==e&&(te(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&&(te(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&&(te(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&&(oe(a),te(e.key))}else{const{value:l}=R;if(!l.has(a)){K(a),oe(a);const{onLoad:l}=e;l&&l(n.rawNode).then(()=>{L(a)}).catch(()=>{L(a)})}}}break;case"parent":if(null!==a){const e=r.getParent(a);if(null!==e){te(e.key);const n=e.getParent();oe(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))he(l);else{const n=re(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 Le(){var e;null===(e=M.value)||void 0===e||e.syncPosition()}function Ae(){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=A.value.getNode(n);l&&(null===(e=y.value)||void 0===e||e.scroll(l.level,l.index,N(V.value)))}}))},{immediate:!0});const Be=w(()=>!(!e.multiple||!e.cascade)||"child"!==v.value);G(fe,{slots:n,mergedClsPrefixRef:t,mergedThemeRef:s,mergedValueRef:h,checkedKeysRef:z,indeterminateKeysRef:$,hoverKeyPathRef:D,mergedCheckStrategyRef:v,showCheckboxRef:Be,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:Ae,syncSelectMenuPosition:Le,updateKeyboardKey:te,updateHoverKey:oe,addLoadingKey:K,deleteLoadingKey:L,doCheck:re,doUncheck:he,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(Be.value){const e=z.value;return{keys:e,options:ae(e)}}return{keys:[],options:[]}},getIndeterminateData:()=>{if(Be.value){const e=$.value;return{keys:e,options:ae(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?Le():Ae())},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:A,mergedSize:m,mergedDisabled:g,localizedPlaceholder:xe,selectedOption:me,selectedOptions:pe,adjustedTo:F,menuModel:j,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?he(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===J.tdkey,to:this.adjustedTo},{default:()=>{var e;null===(e=this.onRender)||void 0===e||e.call(this);const{menuProps:n}=this;return d(ge,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===J.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]}))}})]}))}}))}}});
|