angular-docs-cn/aio/dist/toc-toc-module-es5.d1fa63cb...

2 lines
8.0 KiB
JavaScript

!function(){function e(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,o=!1,r=void 0;try{for(var c,a=e[Symbol.iterator]();!(i=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(l){o=!0,r=l}finally{try{i||null==a.return||a.return()}finally{if(o)throw r}}return n}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return t(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,i=l(e);if(t){var o=l(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return a(this,n)}}function a(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{"+1zh":function(t,i,a){"use strict";a.r(i),a.d(i,"TocModule",function(){return M});var l=a("ofXK"),s=a("NFeN"),u=a("XNiG"),d=a("itXk"),f=a("7Hc7"),b=a("1G5W"),p=a("HDdC"),h=a("Y7HM"),y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(i,e);var t=c(i);function i(e){var o,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f.a;return n(this,i),(o=t.call(this)).source=e,o.delayTime=r,o.scheduler=c,(!Object(h.a)(r)||r<0)&&(o.delayTime=0),c&&"function"==typeof c.schedule||(o.scheduler=f.a),o}return o(i,[{key:"_subscribe",value:function(e){return this.scheduler.schedule(i.dispatch,this.delayTime,{source:this.source,subscriber:e})}}],[{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:f.a;return new i(e,t,n)}},{key:"dispatch",value:function(e){var t=e.source,n=e.subscriber;return this.add(t.subscribe(n))}}]),i}(p.a);function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(n){return n.lift(new m(e,t))}}var m=function(){function e(t,i){n(this,e),this.scheduler=t,this.delay=i}return o(e,[{key:"call",value:function(e,t){return new y(t,this.delay,this.scheduler).subscribe(e)}}]),e}(),g=a("JX91"),E=a("fXoL"),w=a("Faly"),O=a("TNhP"),j=["tocItem"];function x(e,t){1&e&&(E.Tb(0,"div",7),E.Ac(1," Contents "),E.Sb())}function C(e,t){if(1&e){var n=E.Ub();E.Tb(0,"button",8),E.ac("click",function(){return E.sc(n),E.ec(2).toggle(!1)}),E.Ac(1," Contents "),E.Pb(2,"mat-icon",9),E.Sb()}if(2&e){var i=E.ec(2);E.Db("aria-pressed",!i.isCollapsed),E.Cb(2),E.Gb("collapsed",i.isCollapsed)}}function I(e,t){if(1&e&&(E.Tb(0,"li",11,12),E.Pb(2,"a",13),E.Sb()),2&e){var n=E.ec(),i=n.$implicit,o=n.index,r=E.ec(2);E.Eb(i.level),E.Gb("secondary","EmbeddedExpandable"===r.type&&o>=r.primaryMax)("active",o===r.activeIndex),E.kc("title",i.title),E.Cb(2),E.jc("href",i.href,E.uc)("innerHTML",i.content,E.tc)}}function k(e,t){if(1&e&&(E.Rb(0),E.zc(1,I,3,10,"li",10),E.Qb()),2&e){var n=t.$implicit,i=E.ec(2);E.Cb(1),E.jc("ngIf","Floating"===i.type||"h1"!==n.level)}}function T(e,t){if(1&e){var n=E.Ub();E.Tb(0,"button",14),E.ac("click",function(){return E.sc(n),E.ec(2).toggle()}),E.Sb()}if(2&e){var i=E.ec(2);E.Gb("collapsed",i.isCollapsed),E.Db("aria-pressed",!i.isCollapsed)}}function S(e,t){if(1&e&&(E.Tb(0,"div",1),E.zc(1,x,2,0,"div",2),E.zc(2,C,3,3,"button",3),E.Tb(3,"ul",4),E.zc(4,k,2,1,"ng-container",5),E.Sb(),E.zc(5,T,1,3,"button",6),E.Sb()),2&e){var n=E.ec();E.Gb("collapsed",n.isCollapsed),E.Cb(1),E.jc("ngIf","EmbeddedSimple"===n.type),E.Cb(1),E.jc("ngIf","EmbeddedExpandable"===n.type),E.Cb(1),E.Gb("embedded","Floating"!==n.type),E.Cb(1),E.jc("ngForOf",n.tocList),E.Cb(1),E.jc("ngIf","EmbeddedExpandable"===n.type)}}var _,A,P=((A=function(){function t(e,i,o){n(this,t),this.scrollService=e,this.tocService=o,this.activeIndex=null,this.type="None",this.isCollapsed=!0,this.isEmbedded=!1,this.onDestroy=new u.a,this.primaryMax=4,this.isEmbedded=-1!==i.nativeElement.className.indexOf("embedded")}return o(t,[{key:"ngOnInit",value:function(){var e=this;this.tocService.tocList.pipe(Object(b.a)(this.onDestroy)).subscribe(function(t){e.tocList=t;var n,i=(n=function(e){return"h1"!==e.level},e.tocList.reduce(function(e,t){return n(t)?e+1:e},0));e.type=i>0?e.isEmbedded?i>e.primaryMax?"EmbeddedExpandable":"EmbeddedSimple":"Floating":"None"})}},{key:"ngAfterViewInit",value:function(){var t=this;this.isEmbedded||Object(d.a)([this.tocService.activeItemIndex.pipe(v(f.a)),this.items.changes.pipe(Object(g.a)(this.items))]).pipe(Object(b.a)(this.onDestroy)).subscribe(function(n){var i=e(n,2),o=i[0],r=i[1];if(t.activeIndex=o,!(null===o||o>=r.length)){var c=r.toArray()[o].nativeElement,a=c.offsetParent,l=c.getBoundingClientRect(),s=a.getBoundingClientRect();l.top>=s.top&&l.bottom<=s.bottom||(a.scrollTop+=l.top-s.top-a.clientHeight/2)}})}},{key:"ngOnDestroy",value:function(){this.onDestroy.next()}},{key:"toggle",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isCollapsed=!this.isCollapsed,e&&this.isCollapsed&&this.toTop()}},{key:"toTop",value:function(){this.scrollService.scrollToTop()}}]),t}()).\u0275fac=function(e){return new(e||A)(E.Ob(w.a),E.Ob(E.l),E.Ob(O.a))},A.\u0275cmp=E.Ib({type:A,selectors:[["aio-toc"]],viewQuery:function(e,t){var n;1&e&&E.Ec(j,1),2&e&&E.oc(n=E.bc())&&(t.items=n)},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,t){1&e&&E.zc(0,S,6,8,"div",0),2&e&&E.jc("ngIf","None"!==t.type)},directives:[l.k,l.j,s.a],encapsulation:2}),A),M=((_=function e(){n(this,e),this.customElementComponent=P}).\u0275mod=E.Mb({type:_}),_.\u0275inj=E.Lb({factory:function(e){return new(e||_)},imports:[[l.c,s.b]]}),_)}}])}();
//# sourceMappingURL=toc-toc-module-es5.d1fa63cbc4f8ec0088ea.js.map