-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchunk-MJZCWHKY.js
More file actions
1 lines (1 loc) · 6.79 KB
/
Copy pathchunk-MJZCWHKY.js
File metadata and controls
1 lines (1 loc) · 6.79 KB
1
import{a as h,c as Q}from"./chunk-Y54HNU3H.js";import{a as O}from"./chunk-FFGJMO62.js";import"./chunk-XRBZUWDJ.js";import{o as R,q as I,r as P,t as j}from"./chunk-LJRBPGSW.js";import"./chunk-JYBRZQRP.js";import{Da as n,Ea as o,Fa as d,I as a,Ma as b,Na as w,Qa as E,Qb as v,Ra as g,Sa as C,Ta as T,U as y,Ua as l,W as B,ca as r,da as N,h as D,la as m,ma as p,r as F,va as f,xa as M,za as S}from"./chunk-UJIEDWPF.js";var k=["fixedEle"],W=["*"],x=(()=>{class t{constructor(i){this.elementRef=i,this.nelOffset=0,this.nelPosition="top",this.nelZIndex=100,this.nelOnChange=new y,this.nelOnScroll=new y,this.fixed=!1,this.width=0,this.height=0,this.reachBottom$=new D}ngOnDestroy(){this.subscribeScoll&&this.subscribeScoll.unsubscribe()}ngAfterViewInit(){this.width=this.elementRef.nativeElement.offsetWidth,this.height=this.elementRef.nativeElement.offsetHeight,this.container=O(this.elementRef.nativeElement,!0),this.initScroll(),this.handleScroll(!0)}initScroll(){this.subscribeScoll=F(this.container,"scroll").subscribe(()=>{this.handleScroll()})}handleScroll(i=!1){let e=!1;if(this.nelPosition==="top"){if(this.elementRef.nativeElement.getBoundingClientRect().top<=this.nelOffset&&(e=!0),e&&this.nelTarget){let s=this.nelTarget.getBoundingClientRect().bottom-this.nelOffset-this.height;s<0?(this.fixedEle.nativeElement.style.transform=`translateY(${s}px)`,this.fixedEle.nativeElement.style.zIndex=""):(this.fixedEle.nativeElement.style.transform="",this.fixedEle.nativeElement.style.zIndex=this.nelZIndex),this.nelTarget.getBoundingClientRect().bottom<0?e=!1:e=!0}}else document.documentElement.clientHeight-this.elementRef.nativeElement.getBoundingClientRect().bottom<=this.nelOffset&&(e=!0);this.fixed!==e&&this.changeFixed(e),i||this.nelOnScroll.emit({scrollTop:this.container.scrollTop,affix:e})}changeFixed(i){setTimeout(()=>{this.fixed=i,i?(this.elementRef.nativeElement.style.width=this.width+"px",this.elementRef.nativeElement.style.height=this.height+"px",this.fixedEle.nativeElement.style.width=this.width+"px",this.fixedEle.nativeElement.style.height=this.height+"px",this.nelPosition==="top"?this.fixedEle.nativeElement.style.top=this.nelOffset+"px":this.fixedEle.nativeElement.style.bottom=this.nelOffset+"px"):(this.fixedEle.nativeElement.style.width="",this.fixedEle.nativeElement.style.height="",this.fixedEle.nativeElement.style.top="",this.elementRef.nativeElement.style.width="",this.elementRef.nativeElement.style.height=""),this.nelOnChange.emit(i)},0)}static{this.\u0275fac=function(e){return new(e||t)(N(B))}}static{this.\u0275cmp=m({type:t,selectors:[["nel-affix"]],viewQuery:function(e,s){if(e&1&&E(k,5),e&2){let c;g(c=C())&&(s.fixedEle=c.first)}},hostVars:2,hostBindings:function(e,s){e&2&&S("el-affix")},inputs:{nelOffset:"nelOffset",nelTarget:"nelTarget",nelPosition:"nelPosition",nelZIndex:"nelZIndex"},outputs:{nelOnChange:"nelOnChange",nelOnScroll:"nelOnScroll"},standalone:!1,ngContentSelectors:W,decls:3,vars:2,consts:[["fixedEle",""],[2,"z-index","1000"]],template:function(e,s){e&1&&(b(),n(0,"div",1,0),w(2),o()),e&2&&M("el-affix--fixed",s.fixed)},encapsulation:2})}}return t})();var U=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275mod=p({type:t})}static{this.\u0275inj=a({})}}return t})();var V=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=m({type:t,selectors:[["nel-demo-affix-basic"]],standalone:!1,decls:3,vars:2,consts:[[3,"nelOffset"],["nel-button","",3,"nelType"]],template:function(e,s){e&1&&(n(0,"nel-affix",0)(1,"button",1),l(2,"\u8DDD\u79BB\u9876\u90E8 120px"),o()()),e&2&&(f("nelOffset",120),r(),f("nelType","primary"))},dependencies:[x,h],encapsulation:2})}}return t})();var G=["containerEle"],Z=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=m({type:t,selectors:[["nel-demo-affix-target"]],viewQuery:function(e,s){if(e&1&&E(G,5),e&2){let c;g(c=C())&&(s.containerEle=c.first)}},standalone:!1,decls:5,vars:3,consts:[["containerEle",""],[1,"affix-container"],[3,"nelTarget","nelOffset"],["nel-button","",3,"nelType"]],template:function(e,s){if(e&1&&(n(0,"div",1,0)(2,"nel-affix",2)(3,"button",3),l(4,"\u6307\u5B9A\u5BB9\u5668"),o()()()),e&2){let c=T(1);r(2),f("nelTarget",c)("nelOffset",80),r(),f("nelType","primary")}},dependencies:[x,h],styles:[".affix-container[_ngcontent-%COMP%]{text-align:center;height:400px;border-radius:4px;background:#ecf5ff}"]})}}return t})();var z=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=m({type:t,selectors:[["nel-demo-affix-position"]],standalone:!1,decls:3,vars:3,consts:[[3,"nelPosition","nelOffset"],["nel-button","",3,"nelType"]],template:function(e,s){e&1&&(n(0,"nel-affix",0)(1,"button",1),l(2,"\u8DDD\u79BB\u5E95\u90E8 20px"),o()()),e&2&&(f("nelPosition","bottom")("nelOffset",20),r(),f("nelType","primary"))},dependencies:[x,h],encapsulation:2})}}return t})();var H=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275mod=p({type:t})}static{this.\u0275inj=a({imports:[U,Q]})}}return t})();var q=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=m({type:t,selectors:[["app-affix"]],standalone:!1,decls:24,vars:4,consts:[["code","import { NelAffixModule } from 'ng-element-ui/affix';"],[3,"codeUrl"],["demo",""],[3,"docUrl"]],template:function(e,s){e&1&&(n(0,"h2"),l(1,"Affix \u56FA\u9489"),o(),n(2,"p"),l(3,"\u5C06\u9875\u9762\u5143\u7D20\u56FA\u5B9A\u5728\u7279\u5B9A\u53EF\u89C6\u533A\u57DF\u3002"),o(),d(4,"app-code",0),n(5,"h3"),l(6,"\u57FA\u672C\u7528\u6CD5"),o(),n(7,"p"),l(8,"\u56FA\u9489\u9ED8\u8BA4\u56FA\u5B9A\u5728\u9875\u9762\u9876\u90E8\u3002"),o(),n(9,"app-demo",1),d(10,"nel-demo-affix-basic",2),o(),n(11,"h3"),l(12,"\u6307\u5B9A\u5BB9\u5668"),o(),n(13,"p"),l(14,"\u901A\u8FC7\u8BBE\u7F6E nelTarget \u5C5E\u6027\uFF0C\u8BA9\u56FA\u9489\u59CB\u7EC8\u4FDD\u6301\u5728\u5BB9\u5668\u5185\uFF0C\u8D85\u8FC7\u8303\u56F4\u5219\u9690\u85CF\u3002"),o(),n(15,"app-demo",1),d(16,"nel-demo-affix-target",2),o(),n(17,"h3"),l(18,"\u56FA\u5B9A\u4F4D\u7F6E"),o(),n(19,"p"),l(20,"Affix \u7EC4\u4EF6\u63D0\u4F9B\u4E86\u4E24\u4E2A\u56FA\u5B9A\u4F4D\u7F6E\uFF1Atop \u548C bottom\u3002"),o(),n(21,"app-demo",1),d(22,"nel-demo-affix-position",2),o(),d(23,"app-doc",3)),e&2&&(r(9),f("codeUrl","components-affix-demo-basic.component"),r(6),f("codeUrl","components-affix-demo-target.component"),r(6),f("codeUrl","components-affix-demo-position.component"),r(2),f("docUrl","components-affix"))},dependencies:[V,Z,z,R,I,P],encapsulation:2})}}return t})();var L=[{path:"",component:q}],$=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275mod=p({type:t})}static{this.\u0275inj=a({imports:[v.forChild(L),v]})}}return t})();var Pe=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275mod=p({type:t})}static{this.\u0275inj=a({imports:[H,j,$]})}}return t})();export{Pe as AffixModule};