Files
machartaa_admin_dist/dist/assets/index-432f8768.js
T
2026-09-16 14:07:27 +03:30

2 lines
3.9 KiB
JavaScript

import{ax as q,ao as W,d as $,i as E,h as J,j as L,y as U,x as K,ai as Q,R as X,a9 as Y,as as Z,af as k,e as P,ak as B,az as I,a4 as ee}from"./index-f44a958f.js";import{R as te}from"./index-120ad211.js";import{w as R}from"./_plugin-vue_export-helper-9644f77d.js";import{A as ne,s as ae}from"./isSymbol-9ca68d9f.js";import{o as ie}from"./omit-555d0220.js";function _(n){var e,t=function(l){return function(){e=null,n.apply(void 0,q(l))}},a=function(){if(e==null){for(var l=arguments.length,d=new Array(l),c=0;c<l;c++)d[c]=arguments[c];e=R(t(d))}};return a.cancel=function(){return R.cancel(e)},a}function T(n){return n!==window?n.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function F(n,e,t){if(t!==void 0&&e.top>n.top-t)return"".concat(t+e.top,"px")}function H(n,e,t){if(t!==void 0&&e.bottom<n.bottom+t){var a=window.innerHeight-e.bottom;return"".concat(t+a,"px")}}var D=["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],y=[];function j(n,e){if(n){var t=y.find(function(a){return a.target===n});t?t.affixList.push(e):(t={target:n,affixList:[e],eventHandlers:{}},y.push(t),D.forEach(function(a){t.eventHandlers[a]=ne(n,a,function(){t.affixList.forEach(function(s){var l=s.exposed.lazyUpdatePosition;l()},(a==="touchstart"||a==="touchmove")&&ae?{passive:!0}:!1)})}))}}function M(n){var e=y.find(function(t){var a=t.affixList.some(function(s){return s===n});return a&&(t.affixList=t.affixList.filter(function(s){return s!==n})),a});e&&e.affixList.length===0&&(y=y.filter(function(t){return t!==e}),D.forEach(function(t){var a=e.eventHandlers[t];a&&a.remove&&a.remove()}))}function re(){return typeof window<"u"?window:null}var m;(function(n){n[n.None=0]="None",n[n.Prepare=1]="Prepare"})(m||(m={}));var oe=function(){return{offsetTop:Number,offsetBottom:Number,target:{type:Function,default:re},prefixCls:String,onChange:Function,onTestUpdatePosition:Function}},fe=$({compatConfig:{MODE:3},name:"AAffix",props:oe(),setup:function(e,t){var a=t.slots,s=t.emit,l=t.expose,d=E(),c=E(),f=J({affixStyle:void 0,placeholderStyle:void 0,status:m.None,lastAffix:!1,prevTarget:null,timeout:null}),g=ee(),S=L(function(){return e.offsetBottom===void 0&&e.offsetTop===void 0?0:e.offsetTop}),b=L(function(){return e.offsetBottom}),G=function(){var r=f.status,x=f.lastAffix,v=e.target;if(!(r!==m.Prepare||!c.value||!d.value||!v)){var p=v();if(p){var o={status:m.None},w=T(p),u=T(d.value),N=F(u,w,S.value),z=H(u,w,b.value);N!==void 0?(o.affixStyle={position:"fixed",top:N,width:u.width+"px",height:u.height+"px"},o.placeholderStyle={width:u.width+"px",height:u.height+"px"}):z!==void 0&&(o.affixStyle={position:"fixed",bottom:z,width:u.width+"px",height:u.height+"px"},o.placeholderStyle={width:u.width+"px",height:u.height+"px"}),o.lastAffix=!!o.affixStyle,x!==o.lastAffix&&s("change",o.lastAffix),I(f,o)}}},C=function(){I(f,{status:m.Prepare,affixStyle:void 0,placeholderStyle:void 0}),g.update()},h=_(function(){C()}),A=_(function(){var i=e.target,r=f.affixStyle;if(i&&r){var x=i();if(x&&d.value){var v=T(x),p=T(d.value),o=F(p,v,S.value),w=H(p,v,b.value);if(o!==void 0&&r.top===o||w!==void 0&&r.bottom===w)return}}C()});l({updatePosition:h,lazyUpdatePosition:A}),U(function(){return e.target},function(i){var r=(i==null?void 0:i())||null;f.prevTarget!==r&&(M(g),r&&(j(r,g),h()),f.prevTarget=r)}),U(function(){return[e.offsetTop,e.offsetBottom]},h),K(function(){var i=e.target;i&&(f.timeout=setTimeout(function(){j(i(),g),h()}))}),Q(function(){G()}),X(function(){clearTimeout(f.timeout),M(g),h.cancel(),A.cancel()});var O=Y("affix",e),V=O.prefixCls;return function(){var i,r=f.affixStyle,x=f.placeholderStyle,v=Z(k({},V.value,r)),p=ie(e,["prefixCls","offsetTop","offsetBottom","target","onChange","onTestUpdatePosition"]);return P(te,{onResize:h},{default:function(){return[P("div",B(B({},p),{},{style:x,ref:d}),[P("div",{class:v,ref:c,style:r},[(i=a.default)===null||i===void 0?void 0:i.call(a)])])]}})}}});const ve=W(fe);export{ve as _,_ as t};