angular-docs-cn/aio/dist/api-api-list-module-es5.40a...

2 lines
7.0 KiB
JavaScript

!function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function i(t,i,s){return i&&e(t.prototype,i),s&&e(t,s),t}(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{dth9:function(e,s,n){"use strict";n.r(s),n.d(s,"ApiListModule",function(){return I});var a,r=n("ofXK"),c=n("tk/3"),u=n("PCNd"),o=n("jtHE"),l=n("itXk"),h=n("lJxs"),p=n("fXoL"),f=n("XNiG"),b=n("1G5W"),y=n("vkgz"),v=n("jn67"),S=n("vHPH"),d=((a=function(){function e(i,s){t(this,e),this.http=i,this.logger=s,this.apiBase=v.b+"api/",this.apiListJsonDefault="api-list.json",this.firstTime=!0,this.onDestroy=new f.a,this.sectionsSubject=new o.a(1),this._sections=this.sectionsSubject.pipe(Object(b.a)(this.onDestroy))}return i(e,[{key:"ngOnDestroy",value:function(){this.onDestroy.next()}},{key:"fetchSections",value:function(t){var e=this,i=this.apiBase+(t||this.apiListJsonDefault);this.http.get(i).pipe(Object(b.a)(this.onDestroy),Object(y.a)(function(){return e.logger.log("Got API sections from "+i)})).subscribe(function(t){return e.sectionsSubject.next(t)},function(t){throw e.logger.error(t),t})}},{key:"sections",get:function(){var t=this;return this.firstTime&&(this.firstTime=!1,this.fetchSections(),this._sections.subscribe(function(e){return t.logger.log("ApiService got API ".concat(e.length," section(s)"))})),this._sections.pipe(Object(y.a)(function(t){t.forEach(function(t){t.deprecated=!!t.items&&t.items.every(function(t){return"deprecated"===t.stability})})}))}}]),e}()).\u0275fac=function(t){return new(t||a)(p.Xb(c.a),p.Xb(S.a))},a.\u0275prov=p.Kb({token:a,factory:a.\u0275fac}),a),g=n("/lUL"),m=n("x4lQ"),j=["filter"];function C(t,e){if(1&t&&(p.Tb(0,"h2"),p.Tb(1,"a",11),p.Ac(2),p.Sb(),p.Sb()),2&t){var i=p.ec().$implicit;p.Cb(1),p.Gb("deprecated-api-item",i.deprecated),p.jc("href",i.path,p.uc),p.Cb(1),p.Bc(i.title)}}function k(t,e){if(1&t&&(p.Rb(0),p.Tb(1,"li",13),p.Tb(2,"a",11),p.Pb(3,"span"),p.Ac(4),p.Sb(),p.Sb(),p.Qb()),2&t){var i=e.$implicit;p.Cb(2),p.Gb("deprecated-api-item","deprecated"===i.stability),p.jc("href",i.path,p.uc),p.Cb(1),p.Fb("symbol ",i.docType,""),p.Cb(1),p.Cc(" ",i.title," ")}}function w(t,e){if(1&t&&(p.Tb(0,"ul",12),p.zc(1,k,5,7,"ng-container",8),p.Sb()),2&t){var i=p.ec().$implicit;p.Cb(1),p.jc("ngForOf",i.items)}}function T(t,e){if(1&t&&(p.Tb(0,"div"),p.zc(1,C,3,4,"h2",9),p.zc(2,w,2,1,"ul",10),p.Sb()),2&t){var i=e.$implicit;p.Cb(1),p.jc("ngIf",i.items),p.Cb(1),p.jc("ngIf",i.items&&i.items.length)}}var O,M,A=function e(){t(this,e),this.query="",this.status="all",this.type="all"},D=((M=function(){function e(i,s){t(this,e),this.apiService=i,this.locationService=s,this.showStatusMenu=!1,this.showTypeMenu=!1,this.criteriaSubject=new o.a(1),this.searchCriteria=new A,this.types=[{value:"all",title:"All"},{value:"class",title:"Class"},{value:"const",title:"Const"},{value:"decorator",title:"Decorator"},{value:"directive",title:"Directive"},{value:"enum",title:"Enum"},{value:"function",title:"Function"},{value:"interface",title:"Interface"},{value:"pipe",title:"Pipe"},{value:"ngmodule",title:"NgModule"},{value:"type-alias",title:"Type alias"},{value:"package",title:"Package"}],this.statuses=[{value:"all",title:"All"},{value:"stable",title:"Stable"},{value:"deprecated",title:"Deprecated"},{value:"security-risk",title:"Security Risk"}]}return i(e,[{key:"ngOnInit",value:function(){var t=this;this.filteredSections=Object(l.a)([this.apiService.sections,this.criteriaSubject]).pipe(Object(h.a)(function(t){return{sections:t[0],criteria:t[1]}}),Object(h.a)(function(e){return e.sections.map(function(i){return Object.assign(Object.assign({},i),{items:t.filterSection(i,e.criteria)})})})),this.initializeSearchCriteria()}},{key:"setQuery",value:function(t){this.setSearchCriteria({query:(t||"").toLowerCase().trim()})}},{key:"setStatus",value:function(t){this.toggleStatusMenu(),this.status=t,this.setSearchCriteria({status:t.value})}},{key:"setType",value:function(t){this.toggleTypeMenu(),this.type=t,this.setSearchCriteria({type:t.value})}},{key:"toggleStatusMenu",value:function(){this.showStatusMenu=!this.showStatusMenu}},{key:"toggleTypeMenu",value:function(){this.showTypeMenu=!this.showTypeMenu}},{key:"filterSection",value:function(t,e){var i=e.query,s=e.status,n=e.type,a=!i||-1!==t.name.indexOf(i),r=(t.items||[]).filter(function(t){return function(t){return"all"===n||n===t.docType}(t)&&function(t){return"all"===s||s===t.stability||"security-risk"===s&&t.securityRisk}(t)&&function(t){return a||-1!==t.name.indexOf(i)}(t)});return r.length?r:a&&"package"===n?[]:null}},{key:"initializeSearchCriteria",value:function(){var t=this.locationService.search(),e=t.query,i=t.status,s=t.type,n=(e||"").toLowerCase();this.queryEl.nativeElement.value=n,this.status=this.statuses.find(function(t){return t.value===i})||this.statuses[0],this.type=this.types.find(function(t){return t.value===s})||this.types[0],this.searchCriteria={query:n,status:this.status.value,type:this.type.value},this.criteriaSubject.next(this.searchCriteria)}},{key:"setLocationSearch",value:function(){var t=this.searchCriteria,e=t.query,i=t.status,s=t.type;this.locationService.setSearch("API Search",{query:e||void 0,status:"all"!==i?i:void 0,type:"all"!==s?s:void 0})}},{key:"setSearchCriteria",value:function(t){this.criteriaSubject.next(Object.assign(this.searchCriteria,t)),this.setLocationSearch()}}]),e}()).\u0275fac=function(t){return new(t||M)(p.Ob(d),p.Ob(g.a))},M.\u0275cmp=p.Ib({type:M,selectors:[["aio-api-list"]],viewQuery:function(t,e){var i;1&t&&p.Ec(j,3),2&t&&p.oc(i=p.bc())&&(e.queryEl=i.first)},decls:11,vars:9,consts:[[1,"l-flex-wrap","api-filter"],["label","Type:",3,"options","selected","showSymbol","change"],["label","Status:",3,"options","selected","disabled","change"],[1,"form-search"],["placeholder","Filter","aria-label","Filter Search",3,"input"],["filter",""],[1,"material-icons"],[1,"api-list-container"],[4,"ngFor","ngForOf"],[4,"ngIf"],["class","api-list",4,"ngIf"],[3,"href"],[1,"api-list"],[1,"api-item"]],template:function(t,e){1&t&&(p.Tb(0,"div",0),p.Tb(1,"aio-select",1),p.ac("change",function(t){return e.setType(t.option)}),p.Sb(),p.Tb(2,"aio-select",2),p.ac("change",function(t){return e.setStatus(t.option)}),p.Sb(),p.Tb(3,"div",3),p.Tb(4,"input",4,5),p.ac("input",function(t){return e.setQuery(t.target.value)}),p.Sb(),p.Tb(6,"i",6),p.Ac(7,"search"),p.Sb(),p.Sb(),p.Sb(),p.Tb(8,"article",7),p.zc(9,T,3,2,"div",8),p.fc(10,"async"),p.Sb()),2&t&&(p.Cb(1),p.jc("options",e.types)("selected",e.type)("showSymbol",!0),p.Cb(1),p.jc("options",e.statuses)("selected",e.status)("disabled","package"===e.type.value),p.Cb(7),p.jc("ngForOf",p.gc(10,7,e.filteredSections)))},directives:[m.a,r.j,r.k],pipes:[r.b],encapsulation:2}),M),I=((O=function e(){t(this,e),this.customElementComponent=D}).\u0275mod=p.Mb({type:O}),O.\u0275inj=p.Lb({factory:function(t){return new(t||O)},providers:[d],imports:[[r.c,u.a,c.b]]}),O)}}])}();
//# sourceMappingURL=api-api-list-module-es5.40a43cd22f50f64d63bb.js.map