2 lines
80 KiB
JavaScript
2 lines
80 KiB
JavaScript
|
var e=Object.defineProperty,t=Object.defineProperties,n=Object.getOwnPropertyDescriptors,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=(t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i;import{aY as o,a6 as l,aZ as c,a_ as u,w as h,d as g,K as d,n as p,j as f,S as b,V as m,a$ as x,b0 as k,u as w,a9 as _,_ as v,b1 as y,c as E,Y as S,X as A,W as O,b2 as I,ac as T,a8 as R,U as $,b3 as C,b4 as N,b5 as M,ab as z,h as L,P as B,p as D,k as j,q as P,s as U,aw as Z,H,z as F,D as K,F as q,y as G,l as Q,A as W,B as X,x as J,v as V,t as Y,aQ as ee,aF as te,b6 as ne,b7 as ie,b8 as re,b9 as se}from"./index.c1bbda19.js";function ae(e){var t,n=function(n){return function(){t=null,e.apply(void 0,l(n))}},i=function(){if(null==t){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t=o(n(i))}};return i.cancel=function(){return o.cancel(t)},i}function oe(e){return e!==window?e.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function le(e,t,n){if(void 0!==n&&t.top>e.top-n)return"".concat(n+t.top,"px")}function ce(e,t,n){if(void 0!==n&&t.bottom<e.bottom+n){var i=window.innerHeight-t.bottom;return"".concat(n+i,"px")}}var ue,he,ge=["resize","scroll","touchstart","touchmove","touchend","pageshow","load"],de=[];function pe(e,t){if(e){var n=de.find((function(t){return t.target===e}));n?n.affixList.push(t):(n={target:e,affixList:[t],eventHandlers:{}},de.push(n),ge.forEach((function(t){n.eventHandlers[t]=c(e,t,(function(){n.affixList.forEach((function(e){(0,e.exposed.lazyUpdatePosition)()}),!("touchstart"!==t&&"touchmove"!==t||!u)&&{passive:!0})}))})))}}function fe(e){var t=de.find((function(t){var n=t.affixList.some((function(t){return t===e}));return n&&(t.affixList=t.affixList.filter((function(t){return t!==e}))),n}));t&&0===t.affixList.length&&(de=de.filter((function(e){return e!==t})),ge.forEach((function(e){var n=t.eventHandlers[e];n&&n.remove&&n.remove()})))}function be(){return"undefined"!=typeof window?window:null}(he=ue||(ue={}))[he.None=0]="None",he[he.Prepare=1]="Prepare";var me=h(g({name:"AAffix",props:{offsetTop:Number,offsetBottom:Number,target:{type:Function,default:be},prefixCls:String,onChange:Function,onTestUpdatePosition:Function},setup:function(e,t){var n=t.slots,i=t.emit,r=t.expose,s=d(),a=d(),o=p({affixStyle:void 0,placeholderStyle:void 0,status:ue.None,lastAffix:!1,prevTarget:null,timeout:null}),l=I(),c=f((function(){return void 0===e.offsetBottom&&void 0===e.offsetTop?0:e.offsetTop})),u=f((function(){return e.offsetBottom})),h=function(){O(o,{status:ue.Prepare,affixStyle:void 0,placeholderStyle:void 0}),l.update()},g=ae((function(){h()})),T=ae((function(){var t=e.target,n=o.affixStyle;if(t&&n){var i=t();if(i&&s.value){var r=oe(i),a=oe(s.value),l=le(a,r,c.value),g=ce(a,r,u.value);if(void 0!==l&&n.top===l||void 0!==g&&n.bottom===g)return}}h()}));r({updatePosition:g,lazyUpdatePosition:T}),b((function(){return e.target}),(function(e){var t=(null==e?void 0:e())||null;o.prevTarget!==t&&(fe(l),t&&(pe(t,l),g()),o.prevTarget=t)})),b((function(){return[e.offsetTop,e.offsetBottom]}),g),m((function(){var t=e.target;t&&(o.timeout=setTimeout((function(){pe(t(),l),g()})))})),x((function(){!function(){var t=o.status,n=o.lastAffix,r=e.target;if(t===ue.Prepare&&a.value&&s.value&&r){var l=r();if(l){var h={status:ue.None},g=oe(l),d=oe(s.value),p=le(d,g,c.value),f=ce(d,g,u.value);void 0!==p?(h.affixStyle={position:"fixed",top:p,width:d.width+"px",height:d.height+"px"},h.placeholderStyle={width:d.width+"px",height:d.height+"px"}):void 0!==f&&(h.affixStyle={position:"fixed",bottom:f,width:d.width+"px",height:d.height+"px"},h.placeholderStyle={width:d.width+"px",height:d.height+"px"}),h.lastAffix=!!h.affixStyle,n!==h.lastAffix&&i("change",h.lastAffix),O(o,h)}}}()})),k((function(){clearTimeout(o.timeout),fe(l),g.cancel(),T.cancel()}));var R=w("affix",e).prefixCls;return function(){var t,i=o.affixStyle,r=o.placeholderStyle,l=_(v({},R.value,i)),c=y(e,["prefixCls","offsetTop","offsetBottom","target","onChange","onTestUpdatePosition"
|