You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.1 KiB
2 lines
1.1 KiB
var d=(e,y,p)=>new Promise((K,c)=>{var f=n=>{try{i(p.next(n))}catch(r){c(r)}},t=n=>{try{i(p.throw(n))}catch(r){c(r)}},i=n=>n.done?K(n.value):Promise.resolve(n.value).then(f,t);i((p=p.apply(e,y)).next())});import{aC as h,f as M,u as o,aE as u,ap as x,K as v,cn as A,co as g}from"./index-f4658ae7.js";function R(e,y,p,K){const{getCollapsed:c,getIsMixSidebar:f}=h();function t(l){return d(this,null,function*(){if(p.value===u.HORIZONTAL)return;const a=o(f);x(()=>{const s=v(y.value);if((s==null?void 0:s.length)===0){e.openKeys=[];return}o(K)?e.openKeys=g(s,l):e.openKeys=A([...e.openKeys,...g(s,l)])},16,!a)})}const i=M(()=>(o(f)?!1:o(c))?e.collapsedOpenKeys:e.openKeys);function n(){e.selectedKeys=[],e.openKeys=[]}function r(l){if(o(p)===u.HORIZONTAL||!o(K)||o(f))e.openKeys=l;else{const a=[];for(const{children:s,path:O}of o(y))s&&s.length>0&&a.push(O);if(o(c))e.collapsedOpenKeys=l;else{const s=l.find(O=>e.openKeys.indexOf(O)===-1);a.indexOf(s)===-1?e.openKeys=l:e.openKeys=s?[s]:[]}}}return{setOpenKeys:t,resetKeys:n,getOpenKeys:i,handleOpenChange:r}}export{R as useOpenKeys};
|