2 lines
21 KiB
Java
2 lines
21 KiB
Java
|
|
import{hC as at,hD as nt,hE as ot,aI as ie,h as U,a as p,fb as rt,fc as st,j as Qe,hF as ct,hG as Ue,hH as it,hI as ze,c8 as Ce,hJ as ut,hK as dt,P as ue,l as vt,m as Ze,gg as ft,c7 as _e,c6 as ht,dr as pt,f as mt,hg as gt,ct as yt,hL as Ct,hM as bt,k as Ge,hh as St,cd as wt,dn as Ae,c4 as Oe,fT as xt,fU as It,c5 as Vt,hj as kt,hN as Tt}from"./index-X7Y8jykP.js";import{T as Nt,g as Lt,r as Et}from"./index-Cl-8Hzo4.js";import{S as Dt,a2 as Pt,e as Re,h as ge,s as j,c as y,r as ye,f as z,n as Kt,t as te,w as $e,ag as ne,a7 as _t}from"./vue-vendor-DNhG1Cve.js";import{a as At,d as He,u as Ot}from"./useMaxLevel-DE205ncc.js";import{g as Ft}from"./index-BuONesFs.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./eagerComputed-BTlOruLW.js";function Ht(e){return Array.isArray(e)?e:e!==void 0?[e]:[]}function Mt(e){const{label:c,value:a,children:t}=e||{},l=a||"value";return{_title:c?[c]:["title","label"],value:l,key:l,children:t||"children"}}function Me(e){return e.disabled||e.disableCheckbox||e.checkable===!1}function jt(e,c){const a=[];function t(l){l.forEach(n=>{a.push(n[c.value]);const o=n[c.children];o&&t(o)})}return t(e),a}function Xe(e){return e==null}const et=Symbol("TreeSelectContextPropsKey");function Rt(e){return Pt(et,e)}function $t(){return Dt(et,{})}const Bt={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},Wt=Re({compatConfig:{MODE:3},name:"OptionList",inheritAttrs:!1,setup(e,c){let{slots:a,expose:t}=c;const l=at(),n=nt(),o=$t(),i=ye(),v=ot(()=>o.treeData,[()=>l.open,()=>o.treeData],d=>d[0]),r=y(()=>{const{checkable:d,halfCheckedKeys:C,checkedKeys:E}=n;return d?{checked:E,halfChecked:C}:null});ge(()=>l.open,()=>{Kt(()=>{var d;l.open&&!l.multiple&&n.checkedKeys.length&&((d=i.value)===null||d===void 0||d.scrollTo({key:n.checkedKeys[0]}))})},{immediate:!0,flush:"post"});const u=y(()=>String(l.searchValue).toLowerCase()),g=d=>u.value?String(d[n.treeNodeFilterProp]).toLowerCase().includes(u.value):!1,V=j(n.treeDefaultExpandedKeys),S=j(null);ge(()=>l.searchValue,()=>{l.searchValue&&(S.value=jt(te(o.treeData),te(o.fieldNames)))},{immediate:!0});const I=y(()=>n.treeExpandedKeys?n.treeExpandedKeys.slice():l.searchValue?S.value:V.value),w=d=>{var C;V.value=d,S.value=d,(C=n.onTreeExpand)===null||C===void 0||C.call(n,d)},k=d=>{d.preventDefault()},O=(d,C)=>{let{node:E}=C;var K,N;const{checkable:W,checkedKeys:G}=n;W&&Me(E)||((K=o.onSelect)===null||K===void 0||K.call(o,E.key,{selected:!G.includes(E.key)}),l.multiple||(N=l.toggleOpen)===null||N===void 0||N.call(l,!1))},_=ye(null),A=y(()=>n.keyEntities[_.value]),F=d=>{_.value=d};return t({scrollTo:function(){for(var d,C,E=arguments.length,K=new Array(E),N=0;N<E;N++)K[N]=arguments[N];return(C=(d=i.value)===null||d===void 0?void 0:d.scrollTo)===null||C===void 0?void 0:C.call(d,...K)},onKeydown:d=>{var C;const{which:E}=d;switch(E){case ie.UP:case ie.DOWN:case ie.LEFT:case ie.RIGHT:(C=i.value)===null||C===void 0||C.onKeydown(d);break;case ie.ENTER:{if(A.value){const{selectable:K,value:N}=A.value.node||{};K!==!1&&O(null,{node:{key:_.value},selected:!n.checkedKeys.includes(N)})}break}case ie.ESC:l.toggleOpen(!1)}},onKeyup:()=>{}}),()=>{var d;const{prefixCls:C,multiple:E,searchValue:K,open:N,notFoundContent:W=(d=a.notFoundContent)===null||d===void 0?void 0:d.call(a)}=l,{listHeight:G,listItemHeight:R,virtual:le,dropdownMatchSelectWidth:X,treeExpandAction:oe}=o,{checkable:re,treeDefaultExpandAll:se,treeIcon:ae,showTreeIcon:J,switcherIcon:ve,treeLine:fe,loadData:he,treeLoadedKeys:ce,treeMotion:m,onTreeLoad:D,checkedKeys:H}=n;if(v.value.length===0)return z("div",{role:"listbox",class:`${C}-empty`,onMousedown:k},[W]);const Y={fieldNames:o.fieldNames};return ce&&(Y.loadedKeys=ce),I.value&&(Y.expandedKeys=I.value),z("div",{onMousedown:k},[A.value&&N&&z("span",{style:Bt,"aria-live":"assertive"},[A.value.node.value]),z(Nt,U(U({ref:i,focusable:!1,prefixCls:`${C}-tree`,treeData:v.value,height:G,itemHeight:R,virtual:le!==!1&&X!==!1,multiple:E,icon:ae,showIcon:J,switcherIcon:ve,showLine:fe,loadData:K?null:he,motion:m,activeKey:_.value,checkable:re,checkStrict
|