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.4 KiB
2 lines
1.4 KiB
import{r as v,aC as m,f as d,u as o,cj as T,P as x,J as C,au as y}from"./index-f4658ae7.js";function b(){const s=v(!1),{getMiniWidthNumber:a}=m(),l=d(()=>o(s)?0:o(a));function i(f){s.value=f}return{getCollapsedWidth:l,onBreakpointChange:i}}function N(s){const{getTrigger:a,getSplit:l}=m(),i=d(()=>{const c=o(a);return c!==T.NONE&&!o(s)&&(c===T.FOOTER||o(l))});return{getTriggerAttr:d(()=>o(i)?{}:{trigger:null}),getShowTrigger:i}}function k(s,a,l=!1){const{getMiniWidthNumber:i,getCollapsed:f,setMenuSetting:c}=m();x(()=>{C(()=>{y(M,80)()})});function g(t){var e;const r=o(t);return r?Reflect.has(r,"$el")?(e=o(t))==null?void 0:e.$el:o(t):null}function w(t,r,e){document.onmousemove=function(u){let n=t.left+(u.clientX-e);u=u||window.event;const p=800,h=o(i);return n<0&&(n=0),n>p&&(n=p),n<h&&(n=h),t.style.left=r.style.width=n+"px",!1}}function W(t){const r=g(s);document.onmouseup=function(){var u;document.onmousemove=null,document.onmouseup=null,r.style.transition="width 0.2s";const e=parseInt(r.style.width);if(l)c({menuWidth:e});else{const n=o(i);o(f)?e>n&&c({collapsed:!1,menuWidth:e}):e>n+20?c({menuWidth:e}):c({collapsed:!0})}(u=t.releaseCapture)==null||u.call(t)}}function M(){const t=g(a);if(!t)return;const r=g(s);r&&(t.onmousedown=e=>{var n;r.style.transition="unset";const u=e==null?void 0:e.clientX;return t.left=t.offsetLeft,w(t,r,u),W(t),(n=t.setCapture)==null||n.call(t),!1})}return{}}export{k as useDragLine,b as useSiderEvent,N as useTrigger};
|