Files
machartaa_admin_dist/dist/assets/index-9e9f857b.js
T

2 lines
3.9 KiB
JavaScript

import{ay as q,ap as W,d as $,i as E,h as J,j as L,z as U,x as K,aj as Q,S as X,a9 as Y,at as Z,ag as k,e as S,al as B,aA as I,ab as ee}from"./index-185c08ed.js";import{R as te}from"./index-a2809ce1.js";import{w as _}from"./_plugin-vue_export-helper-e26fbd9a.js";import{A as ne,s as ae}from"./isSymbol-18d6b370.js";import{o as ie}from"./omit-d93eaa18.js";function F(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=_(t(d))}};return a.cancel=function(){return _.cancel(e)},a}function T(n){return n!==window?n.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function R(n,e,t){if(t!==void 0&&e.top>n.top-t)return"".concat(t+e.top,"px")}function j(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 H(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 x;(function(n){n[n.None=0]="None",n[n.Prepare=1]="Prepare"})(x||(x={}));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:x.None,lastAffix:!1,prevTarget:null,timeout:null}),g=ee(),P=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,m=f.lastAffix,v=e.target;if(!(r!==x.Prepare||!c.value||!d.value||!v)){var p=v();if(p){var o={status:x.None},w=T(p),u=T(d.value),N=R(u,w,P.value),z=j(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,m!==o.lastAffix&&s("change",o.lastAffix),I(f,o)}}},A=function(){I(f,{status:x.Prepare,affixStyle:void 0,placeholderStyle:void 0}),g.update()},h=F(function(){A()}),C=F(function(){var i=e.target,r=f.affixStyle;if(i&&r){var m=i();if(m&&d.value){var v=T(m),p=T(d.value),o=R(p,v,P.value),w=j(p,v,b.value);if(o!==void 0&&r.top===o||w!==void 0&&r.bottom===w)return}}A()});l({updatePosition:h,lazyUpdatePosition:C}),U(function(){return e.target},function(i){var r=(i==null?void 0:i())||null;f.prevTarget!==r&&(M(g),r&&(H(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(){H(i(),g),h()}))}),Q(function(){G()}),X(function(){clearTimeout(f.timeout),M(g),h.cancel(),C.cancel()});var O=Y("affix",e),V=O.prefixCls;return function(){var i,r=f.affixStyle,m=f.placeholderStyle,v=Z(k({},V.value,r)),p=ie(e,["prefixCls","offsetTop","offsetBottom","target","onChange","onTestUpdatePosition"]);return S(te,{onResize:h},{default:function(){return[S("div",B(B({},p),{},{style:m,ref:d}),[S("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 _,F as t};