5 lines
20 KiB
Java
5 lines
20 KiB
Java
|
|
import{a as k,cm as Fe,cn as Ce,hC as ye,hX as Ne,aI as J,h as Z,j as _e,hF as je,hG as Oe,hJ as We,c8 as be,hK as He,P as Se,fT as Be,l as ze,h8 as Xe,fm as Ue,a5 as Ge,c6 as qe,dr as Je,f as Ye,hg as Qe,ct as Ze,hL as et,gE as tt,fV as nt,bT as lt,hM as at,gI as Pe,hN as ot,hh as st,hj as it,k as ct}from"./index-X7Y8jykP.js";import{a as rt,u as ut,d as me}from"./useMaxLevel-DE205ncc.js";import{c as y,w as ve,r as G,s as Ae,S as dt,a2 as vt,h as $e,f as E,e as xe,o as ht,ag as de,a7 as pt}from"./vue-vendor-DNhG1Cve.js";import{g as ft}from"./index-BuONesFs.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";const we="__RC_CASCADER_SPLIT__",Te="SHOW_PARENT",Ee="SHOW_CHILD";function ee(e){return e.join(we)}function oe(e){return e.map(ee)}function gt(e){return e.split(we)}function mt(e){const{label:l,value:t,children:a}=e||{},n=t||"value";return{label:l||"label",value:n,key:n,children:a||"children"}}function ie(e,l){var t,a;return(t=e.isLeaf)!==null&&t!==void 0?t:!(!((a=e[l.children])===null||a===void 0)&&a.length)}function Ct(e){const l=e.parentElement;if(!l)return;const t=e.offsetTop-l.offsetTop;t-l.scrollTop<0?l.scrollTo({top:t}):t+e.offsetHeight-l.scrollTop>l.offsetHeight&&l.scrollTo({top:t+e.offsetHeight-l.offsetHeight})}const St=((e,l)=>y(()=>rt(e.value,{fieldNames:l.value,initWrapper:a=>k(k({},a),{pathKeyEntities:{}}),processEntity:(a,n)=>{const i=a.nodes.map(r=>r[l.value.value]).join(we);n.pathKeyEntities[i]=a,a.key=i}}).pathKeyEntities));function yt(e){const l=Ae(!1),t=G({});return ve(()=>{if(!e.value){l.value=!1,t.value={};return}let a={matchInputWidth:!0,limit:50};e.value&&typeof e.value=="object"&&(a=k(k({},a),e.value)),a.limit<=0&&delete a.limit,l.value=!0,t.value=a}),{showSearch:l,searchConfig:t}}const ce="__rc_cascader_search_mark__",bt=(e,l,t)=>{let{label:a}=t;return l.some(n=>String(n[a]).toLowerCase().includes(e.toLowerCase()))},xt=e=>{let{path:l,fieldNames:t}=e;return l.map(a=>a[t.label]).join(" / ")},wt=((e,l,t,a,n,i)=>y(()=>{const{filter:r=bt,render:d=xt,limit:v=50,sort:c}=n.value,o=[];if(!e.value)return[];function C(O,b){O.forEach(T=>{if(!c&&v>0&&o.length>=v)return;const g=[...b,T],x=T[t.value.children];(!x||x.length===0||i.value)&&r(e.value,g,{label:t.value.label})&&o.push(k(k({},T),{[t.value.label]:d({inputValue:e.value,path:g,prefixCls:a.value,fieldNames:t.value}),[ce]:g})),x&&C(T[t.value.children],g)})}return C(l.value,[]),c&&o.sort((O,b)=>c(O[ce],b[ce],e.value,t.value)),v>0?o.slice(0,v):o}));function Ve(e,l,t){const a=new Set(e);return e.filter(n=>{const i=l[n],r=i?i.parent:null,d=i?i.children:null;return t===Ee?!(d&&d.some(v=>v.key&&a.has(v.key))):!(r&&!r.node.disabled&&a.has(r.key))})}function re(e,l,t){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;var n;let i=l;const r=[];for(let d=0;d<e.length;d+=1){const v=e[d],c=i==null?void 0:i.findIndex(C=>{const O=C[t.value];return a?String(O)===String(v):O===v}),o=c!==-1?i==null?void 0:i[c]:null;r.push({value:(n=o==null?void 0:o[t.value])!==null&&n!==void 0?n:v,index:c,option:o}),i=o==null?void 0:o[t.children]}return r}const It=((e,l,t)=>y(()=>{const a=[],n=[];return t.value.forEach(i=>{re(i,e.value,l.value).every(d=>d.option)?n.push(i):a.push(i)}),[n,a]})),Ot=((e,l,t,a,n)=>y(()=>{const i=n.value||(r=>{let{labels:d}=r;const v=a.value?d.slice(-1):d,c=" / ";return v.every(o=>["string","number"].includes(typeof o))?v.join(c):v.reduce((o,C,O)=>{const b=Fe(C)?Ce(C,{key:O}):C;return O===0?[b]:[...o,c,b]},[])});return e.value.map(r=>{const d=re(r,l.value,t.value),v=i({labels:d.map(o=>{let{option:C,value:O}=o;var b;return(b=C==null?void 0:C[t.value.label])!==null&&b!==void 0?b:O}),selectedOptions:d.map(o=>{let{option:C}=o;return C})}),c=ee(r);return{label:v,value:c,key:c,valueCells:r}})})),De=Symbol("CascaderContextKey"),Pt=e=>{vt(De,e)},he=()=>dt(De),Vt=(()=>{const e=ye(),{values:l}=he(),[t,a]=Ne([]);return $e(()=>e.open,()=>{if(e.open&&!e.multiple){const n=l.value[0];a(n||[])}},{immediate:!0}),[t,a]}),kt=((e,l,t,a,n,i)=>{const r=ye(),d=y(()=>r.direction==="rtl"),[v,c,o]=[G([]),G(),G([])];ve(()=>{let g=-1,x=l.value;const h=[],w=[],$=a.value.length;
|
||
|
|
&${n}-expand ${n}-expand-icon,
|
||
|
|
${n}-loading-icon
|
||
|
|
`,r=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return[{[t]:{width:e.controlWidth}},{[`${t}-dropdown`]:[ft(`${l}-checkbox`,e),{[`&${a}-select-dropdown`]:{padding:0}},{[t]:{"&-checkbox":{top:0,marginInlineEnd:e.paddingXS},"&-menus":{display:"flex",flexWrap:"nowrap",alignItems:"flex-start",[`&${t}-menu-empty`]:{[`${t}-menu`]:{width:"100%",height:"auto",[n]:{color:e.colorTextDisabled}}}},"&-menu":{flexGrow:1,minWidth:e.controlItemWidth,height:e.dropdownHeight,margin:0,padding:e.paddingXXS,overflow:"auto",verticalAlign:"top",listStyle:"none","-ms-overflow-style":"-ms-autohiding-scrollbar","&:not(:last-child)":{borderInlineEnd:`${e.lineWidth}px ${e.lineType} ${e.colorSplit}`},"&-item":k(k({},Ue),{display:"flex",flexWrap:"nowrap",alignItems:"center",padding:`${r}px ${e.paddingSM}px`,lineHeight:e.lineHeight,cursor:"pointer",transition:`all ${e.motionDurationMid}`,borderRadius:e.borderRadiusSM,"&:hover":{background:e.controlItemBgHover},"&-disabled":{color:e.colorTextDisabled,cursor:"not-allowed","&:hover":{background:"transparent"},[i]:{color:e.colorTextDisabled}},[`&-active:not(${n}-disabled)`]:{"&, &:hover":{fontWeight:e.fontWeightStrong,backgroundColor:e.controlItemBgActive}},"&-content":{flex:"auto"},[i]:{marginInlineStart:e.paddingXXS,color:e.colorTextDescription,fontSize:e.fontSizeIcon},"&-keyword":{color:e.colorHighlight}})}}}]},{[`${t}-dropdown-rtl`]:{direction:"rtl"}},Xe(e)]},Dt=ze("Cascader",e=>[Et(e)],{controlWidth:184,controlItemWidth:111,dropdownHeight:180});var Rt=function(e,l){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&l.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)l.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(t[a[n]]=e[a[n]]);return t};function Lt(e,l,t){const a=e.toLowerCase().split(l).reduce((r,d,v)=>v===0?[d]:[...r,l,d],[]),n=[];let i=0;return a.forEach((r,d)=>{const v=i+r.length;let c=e.slice(i,v);i=v,d%2===1&&(c=E("span",{class:`${t}-menu-item-keyword`,key:"seperator"},[c])),n.push(c)}),n}const Kt=e=>{let{inputValue:l,path:t,prefixCls:a,fieldNames:n}=e;const i=[],r=l.toLowerCase();return t.forEach((d,v)=>{v!==0&&i.push(" / ");let c=d[n.label];const o=typeof c;(o==="string"||o==="number")&&(c=Lt(String(c),r,a)),i.push(c)}),i};function Mt(){return k(k({},be(Le(),["customSlots","checkable","options"])),{multiple:{type:Boolean,default:void 0},size:String,bordered:{type:Boolean,default:void 0},placement:{type:String},suffixIcon:Se.any,status:String,options:Array,popupClassName:String,dropdownClassName:String,"onUpdate:value":Function})}const Ft=xe({compatConfig:{MODE:3},name:"ACascader",inheritAttrs:!1,props:_e(Mt(),{bordered:!0,choiceTransitionName:"",allowClear:!0}),setup(e,l){let{attrs:t,expose:a,slots:n,emit:i}=l;const r=qe(),d=Je.useInject(),v=y(()=>it(d.status,e.status)),{prefixCls:c,rootPrefixCls:o,getPrefixCls:C,direction:O,getPopupContainer:b,renderEmpty:T,size:g,disabled:x}=Ye("cascader",e),h=y(()=>C("select",e.prefixCls)),{compactSize:w,compactItemClassnames:$}=Qe(h,O),P=y(()=>w.value||g.value),_=Ze(),R=y(()=>{var s;return(s=x.value)!==null&&s!==void 0?s:_.value}),[D,X]=et(h),[Y]=Dt(c),U=y(()=>O.value==="rtl"),F=y(()=>{if(!e.showSearch)return e.showSearch;let s={render:Kt};return typeof e.showSearch=="object"&&(s=k(k({},s),e.showSearch)),s}),N=y(()=>ct(e.popupClassName||e.dropdownClassName,`${c.value}-dropdown`,{[`${c.value}-dropdown-rtl`]:U.value},X.value)),j=G();a({focus(){var s;(s=j.value)===null||s===void 0||s.focus()},blur(){var s;(s=j.value)===null||s===void 0||s.blur()}});const te=function(){for(var s=arguments.length,S=new Array(s),m=0;m<s;m++)S[m]=arguments[m];i("update:value",S[0]),i("change",...S),r.onFieldChange()},L=function(){for(var s=arguments.length,S=new Array(s),m=0;m<s;m++)S[m]=arguments[m];i("blur",...S),r.onFieldBlur()},p=y(()=>e.showArrow!==void 0?e.showArrow:e.loading||!e.multiple),I=y(()=>e.placement!==void 0?e.placement:O.value==="rtl"?"bottomRight":"bottomLeft");return()=>{var s,S;const{notFoundContent:m=(s=n.n
|