-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathsrc_app_custom-elements_toc_toc_module_ts.7841ae05fbf9bcf9.js
2 lines (2 loc) · 4.51 KB
/
src_app_custom-elements_toc_toc_module_ts.7841ae05fbf9bcf9.js
1
2
"use strict";(self.webpackChunkangular_cn=self.webpackChunkangular_cn||[]).push([["src_app_custom-elements_toc_toc_module_ts"],{2786:(S,r,s)=>{s.r(r),s.d(r,{TocModule:()=>J});var a=s(4364),m=s(7280),f=s(8187),g=s(7850),x=s(9311),u=s(4094),h=s(9530),v=s(7993),t=s(2316),b=s(9026),T=s(6308);const y=["tocItem"];function C(o,c){1&o&&(t.TgZ(0,"div",7),t._uU(1," \u76ee\u5f55 "),t.qZA())}function E(o,c){if(1&o){const e=t.EpF();t.TgZ(0,"button",8),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).toggle(!1)}),t._uU(1," \u76ee\u5f55 "),t._UZ(2,"mat-icon",9),t.qZA()}if(2&o){const e=t.oxw(2);t.uIk("aria-pressed",!e.isCollapsed),t.xp6(2),t.ekj("collapsed",e.isCollapsed)}}function _(o,c){if(1&o&&(t.TgZ(0,"li",11,12),t._UZ(2,"a",13),t.qZA()),2&o){const e=t.oxw(),n=e.$implicit,i=e.index,l=t.oxw(2);t.Tol(n.level),t.ekj("secondary","EmbeddedExpandable"===l.type&&i>=l.primaryMax)("active",i===l.activeIndex),t.s9C("title",n.title),t.xp6(2),t.Q6J("href",n.href,t.LSH)("innerHTML",n.content,t.oJD)}}function I(o,c){if(1&o&&(t.ynx(0),t.YNc(1,_,3,10,"li",10),t.BQk()),2&o){const e=c.$implicit,n=t.oxw(2);t.xp6(1),t.Q6J("ngIf","Floating"===n.type||"h1"!==e.level)}}function Z(o,c){if(1&o){const e=t.EpF();t.TgZ(0,"button",14),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).toggle()}),t.qZA()}if(2&o){const e=t.oxw(2);t.ekj("collapsed",e.isCollapsed),t.uIk("aria-pressed",!e.isCollapsed)}}function F(o,c){if(1&o&&(t.TgZ(0,"div",1),t.YNc(1,C,2,0,"div",2),t.YNc(2,E,3,3,"button",3),t.TgZ(3,"ul",4),t.YNc(4,I,2,1,"ng-container",5),t.qZA(),t.YNc(5,Z,1,3,"button",6),t.qZA()),2&o){const e=t.oxw();t.ekj("collapsed",e.isCollapsed),t.xp6(1),t.Q6J("ngIf","EmbeddedSimple"===e.type),t.xp6(1),t.Q6J("ngIf","EmbeddedExpandable"===e.type),t.xp6(1),t.ekj("embedded","Floating"!==e.type),t.xp6(1),t.Q6J("ngForOf",e.tocList),t.xp6(1),t.Q6J("ngIf","EmbeddedExpandable"===e.type)}}let M=(()=>{class o{constructor(e,n,i){this.scrollService=e,this.tocService=i,this.activeIndex=null,this.type="None",this.isCollapsed=!0,this.isEmbedded=!1,this.onDestroy=new f.x,this.primaryMax=4,this.isEmbedded=-1!==n.nativeElement.className.indexOf("embedded")}ngOnInit(){this.tocService.tocList.pipe((0,u.R)(this.onDestroy)).subscribe(e=>{this.tocList=e;const n=function(o,c){return o.reduce((e,n)=>"h1"!==n.level?e+1:e,0)}(this.tocList);this.type=n>0?this.isEmbedded?n>this.primaryMax?"EmbeddedExpandable":"EmbeddedSimple":"Floating":"None"})}ngAfterViewInit(){this.isEmbedded||(0,g.a)([this.tocService.activeItemIndex.pipe((0,h.R)(x.E)),this.items.changes.pipe((0,v.O)(this.items))]).pipe((0,u.R)(this.onDestroy)).subscribe(([e,n])=>{if(this.activeIndex=e,null===e||e>=n.length)return;const i=n.toArray()[e].nativeElement,l=i.offsetParent,d=i.getBoundingClientRect(),p=l.getBoundingClientRect();d.top>=p.top&&d.bottom<=p.bottom||(l.scrollTop+=d.top-p.top-l.clientHeight/2)})}ngOnDestroy(){this.onDestroy.next()}toggle(e=!0){this.isCollapsed=!this.isCollapsed,e&&this.isCollapsed&&this.toTop()}toTop(){this.scrollService.scrollToTop()}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(b.a),t.Y36(t.SBq),t.Y36(T.I))},o.\u0275cmp=t.Xpm({type:o,selectors:[["aio-toc"]],viewQuery:function(e,n){if(1&e&&t.Gf(y,5),2&e){let i;t.iGM(i=t.CRH())&&(n.items=i)}},decls:1,vars:1,consts:[["class","toc-inner no-print",3,"collapsed",4,"ngIf"],[1,"toc-inner","no-print"],["class","toc-heading embedded",4,"ngIf"],["type","button","class","toc-heading embedded secondary","title","Expand/collapse contents","aria-label","Expand/collapse contents",3,"click",4,"ngIf"],[1,"toc-list"],[4,"ngFor","ngForOf"],["type","button","class","toc-more-items embedded material-icons","title","Expand/collapse contents","aria-label","Expand/collapse contents",3,"collapsed","click",4,"ngIf"],[1,"toc-heading","embedded"],["type","button","title","Expand/collapse contents","aria-label","Expand/collapse contents",1,"toc-heading","embedded","secondary",3,"click"],["svgIcon","keyboard_arrow_right",1,"rotating-icon"],[3,"title","class","secondary","active",4,"ngIf"],[3,"title"],["tocItem",""],[3,"href","innerHTML"],["type","button","title","Expand/collapse contents","aria-label","Expand/collapse contents",1,"toc-more-items","embedded","material-icons",3,"click"]],template:function(e,n){1&e&&t.YNc(0,F,6,8,"div",0),2&e&&t.Q6J("ngIf","None"!==n.type)},directives:[a.O5,a.sg,m.Hw],encapsulation:2}),o})(),J=(()=>{class o{constructor(){this.customElementComponent=M}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o}),o.\u0275inj=t.cJS({imports:[[a.ez,m.Ps]]}),o})()}}]);
//# sourceMappingURL=src_app_custom-elements_toc_toc_module_ts.7841ae05fbf9bcf9.js.map