This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
src_app_custom-elements_api_api-list_module_ts-es2015.d9c36aa3d5321c3f76ac.js
2 lines (2 loc) · 6.35 KB
/
src_app_custom-elements_api_api-list_module_ts-es2015.d9c36aa3d5321c3f76ac.js
1
2
(self.webpackChunkangular_cn=self.webpackChunkangular_cn||[]).push([["src_app_custom-elements_api_api-list_module_ts"],{4705:function(t,e,i){"use strict";i.r(e),i.d(e,{ApiListModule:function(){return x}});var s=i(1116),a=i(2693),r=i(5425),n=i(6605),c=i(1305),l=i(9996),o=i(5366),u=i(5959),h=i(5416),p=i(4019),g=i(1374),f=i(9474);let y=(()=>{class t{constructor(t,e){this.http=t,this.logger=e,this.apiBase=g.Yp+"api/",this.apiListJsonDefault="api-list.json",this.firstTime=!0,this.onDestroy=new u.xQ,this.sectionsSubject=new n.t(1),this._sections=this.sectionsSubject.pipe((0,h.R)(this.onDestroy))}get sections(){return this.firstTime&&(this.firstTime=!1,this.fetchSections(),this._sections.subscribe(t=>this.logger.log(`ApiService got API ${t.length} section(s)`))),this._sections.pipe((0,p.b)(t=>{t.forEach(t=>{t.deprecated=!!t.items&&t.items.every(t=>"deprecated"===t.stability)})}))}ngOnDestroy(){this.onDestroy.next()}fetchSections(t){const e=this.apiBase+(t||this.apiListJsonDefault);this.http.get(e).pipe((0,h.R)(this.onDestroy),(0,p.b)(()=>this.logger.log(`Got API sections from ${e}`))).subscribe(t=>this.sectionsSubject.next(t),t=>{throw this.logger.error(t),t})}}return t.\u0275fac=function(e){return new(e||t)(o.LFG(a.eN),o.LFG(f.Y))},t.\u0275prov=o.Yz7({token:t,factory:t.\u0275fac}),t})();var d=i(2981),v=i(3732);const m=["filter"];function S(t,e){if(1&t&&(o.TgZ(0,"h2"),o.TgZ(1,"a",11),o._uU(2),o.qZA(),o.qZA()),2&t){const t=o.oxw().$implicit;o.xp6(1),o.ekj("deprecated-api-item",t.deprecated),o.Q6J("href",t.path,o.LSH),o.xp6(1),o.Oqu(t.title)}}function b(t,e){if(1&t&&(o.ynx(0),o.TgZ(1,"li",13),o.TgZ(2,"a",11),o._UZ(3,"span"),o._uU(4),o.qZA(),o.qZA(),o.BQk()),2&t){const t=e.$implicit;o.xp6(2),o.ekj("deprecated-api-item","deprecated"===t.stability),o.Q6J("href",t.path,o.LSH),o.xp6(1),o.Gre("symbol ",t.docType,""),o.xp6(1),o.hij(" ",t.title," ")}}function Z(t,e){if(1&t&&(o.TgZ(0,"ul",12),o.YNc(1,b,5,7,"ng-container",8),o.qZA()),2&t){const t=o.oxw().$implicit;o.xp6(1),o.Q6J("ngForOf",t.items)}}function T(t,e){if(1&t&&(o.TgZ(0,"div"),o.YNc(1,S,3,4,"h2",9),o.YNc(2,Z,2,1,"ul",10),o.qZA()),2&t){const t=e.$implicit;o.xp6(1),o.Q6J("ngIf",t.items),o.xp6(1),o.Q6J("ngIf",t.items&&t.items.length)}}class w{constructor(){this.query="",this.status="all",this.type="all"}}let q=(()=>{class t{constructor(t,e){this.apiService=t,this.locationService=e,this.showStatusMenu=!1,this.showTypeMenu=!1,this.criteriaSubject=new n.t(1),this.searchCriteria=new w,this.types=[{value:"all",title:"\u5168\u90e8"},{value:"class",title:"\u7c7b"},{value:"const",title:"\u5e38\u91cf"},{value:"decorator",title:"\u88c5\u9970\u5668"},{value:"directive",title:"\u6307\u4ee4"},{value:"enum",title:"\u679a\u4e3e"},{value:"function",title:"\u51fd\u6570"},{value:"interface",title:"\u63a5\u53e3"},{value:"pipe",title:"\u7ba1\u9053"},{value:"ngmodule",title:"NgModule"},{value:"type-alias",title:"\u7c7b\u578b\u522b\u540d"},{value:"package",title:"\u5305"}],this.statuses=[{value:"all",title:"\u5168\u90e8"},{value:"stable",title:"\u7a33\u5b9a"},{value:"deprecated",title:"\u5f03\u7528"},{value:"security-risk",title:"\u5b89\u5168\u98ce\u9669"}]}ngOnInit(){this.filteredSections=(0,c.aj)([this.apiService.sections,this.criteriaSubject]).pipe((0,l.U)(t=>({sections:t[0],criteria:t[1]})),(0,l.U)(t=>t.sections.map(e=>Object.assign(Object.assign({},e),{items:this.filterSection(e,t.criteria)})))),this.initializeSearchCriteria()}setQuery(t){this.setSearchCriteria({query:(t||"").toLowerCase().trim()})}setStatus(t){this.toggleStatusMenu(),this.status=t,this.setSearchCriteria({status:t.value})}setType(t){this.toggleTypeMenu(),this.type=t,this.setSearchCriteria({type:t.value})}toggleStatusMenu(){this.showStatusMenu=!this.showStatusMenu}toggleTypeMenu(){this.showTypeMenu=!this.showTypeMenu}filterSection(t,{query:e,status:i,type:s}){const a=!e||-1!==t.name.indexOf(e),r=(t.items||[]).filter(t=>(t=>"all"===s||s===t.docType)(t)&&(t=>"all"===i||i===t.stability||"security-risk"===i&&t.securityRisk)(t)&&(t=>a||-1!==t.name.indexOf(e))(t));return r.length?r:a&&"package"===s?[]:null}initializeSearchCriteria(){const{query:t,status:e,type:i}=this.locationService.search(),s=(t||"").toLowerCase();this.queryEl.nativeElement.value=s,this.status=this.statuses.find(t=>t.value===e)||this.statuses[0],this.type=this.types.find(t=>t.value===i)||this.types[0],this.searchCriteria={query:s,status:this.status.value,type:this.type.value},this.criteriaSubject.next(this.searchCriteria)}setLocationSearch(){const{query:t,status:e,type:i}=this.searchCriteria;this.locationService.setSearch("API \u641c\u7d22",{query:t||void 0,status:"all"!==e?e:void 0,type:"all"!==i?i:void 0})}setSearchCriteria(t){this.criteriaSubject.next(Object.assign(this.searchCriteria,t)),this.setLocationSearch()}}return t.\u0275fac=function(e){return new(e||t)(o.Y36(y),o.Y36(d.a))},t.\u0275cmp=o.Xpm({type:t,selectors:[["aio-api-list"]],viewQuery:function(t,e){if(1&t&&o.Gf(m,7),2&t){let t;o.iGM(t=o.CRH())&&(e.queryEl=t.first)}},decls:11,vars:9,consts:[[1,"l-flex-wrap","api-filter"],["label","\u7c7b\u578b\uff1a",3,"options","selected","showSymbol","change"],["label","\u72b6\u6001\uff1a",3,"options","selected","disabled","change"],[1,"form-search"],["placeholder","\u8fc7\u6ee4","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&&(o.TgZ(0,"div",0),o.TgZ(1,"aio-select",1),o.NdJ("change",function(t){return e.setType(t.option)}),o.qZA(),o.TgZ(2,"aio-select",2),o.NdJ("change",function(t){return e.setStatus(t.option)}),o.qZA(),o.TgZ(3,"div",3),o.TgZ(4,"input",4,5),o.NdJ("input",function(t){return e.setQuery(t.target.value)}),o.qZA(),o.TgZ(6,"i",6),o._uU(7,"search"),o.qZA(),o.qZA(),o.qZA(),o.TgZ(8,"article",7),o.YNc(9,T,3,2,"div",8),o.ALo(10,"async"),o.qZA()),2&t&&(o.xp6(1),o.Q6J("options",e.types)("selected",e.type)("showSymbol",!0),o.xp6(1),o.Q6J("options",e.statuses)("selected",e.status)("disabled","package"===e.type.value),o.xp6(7),o.Q6J("ngForOf",o.lcZ(10,7,e.filteredSections)))},directives:[v.H,s.sg,s.O5],pipes:[s.Ov],encapsulation:2}),t})(),x=(()=>{class t{constructor(){this.customElementComponent=q}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=o.oAB({type:t}),t.\u0275inj=o.cJS({providers:[y],imports:[[s.ez,r.m,a.JF]]}),t})()}}]);
//# sourceMappingURL=src_app_custom-elements_api_api-list_module_ts-es2015.d9c36aa3d5321c3f76ac.js.map