-
Notifications
You must be signed in to change notification settings - Fork 1
/
src_app_custom-elements_api_api-list_module_ts.348fbe8534d1ffbc.js
2 lines (2 loc) · 6.33 KB
/
src_app_custom-elements_api_api-list_module_ts.348fbe8534d1ffbc.js
1
2
"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([["src_app_custom-elements_api_api-list_module_ts"],{4858:(I,u,n)=>{n.r(u),n.d(u,{ApiListModule:()=>N});var p=n(6362),h=n(8784),S=n(4466),m=n(6067),A=n(6562),f=n(635),t=n(3184),T=n(253),v=n(8951),g=n(9337),C=n(5733),L=n(4541);let d=(()=>{class s{constructor(e,i){this.http=e,this.logger=i,this.apiBase=C.Yp+"api/",this.apiListJsonDefault="api-list.json",this.firstTime=!0,this.onDestroy=new T.x,this.sectionsSubject=new m.t(1),this._sections=this.sectionsSubject.pipe((0,v.R)(this.onDestroy))}get sections(){return this.firstTime&&(this.firstTime=!1,this.fetchSections(),this._sections.subscribe(e=>this.logger.log(`ApiService got API ${e.length} section(s)`))),this._sections.pipe((0,g.b)(e=>{e.forEach(i=>{i.deprecated=!!i.items&&i.items.every(a=>"deprecated"===a.stability)})}))}ngOnDestroy(){this.onDestroy.next()}fetchSections(e){const i=this.apiBase+(e||this.apiListJsonDefault);this.http.get(i).pipe((0,v.R)(this.onDestroy),(0,g.b)(()=>this.logger.log(`Got API sections from ${i}`))).subscribe(a=>this.sectionsSubject.next(a),a=>{throw this.logger.error(a),a})}}return s.\u0275fac=function(e){return new(e||s)(t.LFG(h.eN),t.LFG(L.Y))},s.\u0275prov=t.Yz7({token:s,factory:s.\u0275fac}),s})();var Z=n(5370),b=n(587);const j=["filter"];function M(s,l){if(1&s&&(t.TgZ(0,"h2"),t.TgZ(1,"a",11),t._uU(2),t.qZA(),t.qZA()),2&s){const e=t.oxw().$implicit;t.xp6(1),t.ekj("deprecated-api-item",e.deprecated),t.Q6J("href",e.path,t.LSH),t.xp6(1),t.Oqu(e.title)}}function F(s,l){if(1&s&&(t.ynx(0),t.TgZ(1,"li",13),t.TgZ(2,"a",11),t._UZ(3,"span"),t._uU(4),t.qZA(),t.qZA(),t.BQk()),2&s){const e=l.$implicit;t.xp6(2),t.ekj("deprecated-api-item","deprecated"===e.stability),t.Q6J("href",e.path,t.LSH),t.xp6(1),t.Gre("symbol ",e.docType,""),t.xp6(1),t.hij(" ",e.title," ")}}function x(s,l){if(1&s&&(t.TgZ(0,"ul",12),t.YNc(1,F,5,7,"ng-container",8),t.qZA()),2&s){const e=t.oxw().$implicit;t.xp6(1),t.Q6J("ngForOf",e.items)}}function J(s,l){if(1&s&&(t.TgZ(0,"div"),t.YNc(1,M,3,4,"h2",9),t.YNc(2,x,2,1,"ul",10),t.qZA()),2&s){const e=l.$implicit;t.xp6(1),t.Q6J("ngIf",e.items),t.xp6(1),t.Q6J("ngIf",e.items&&e.items.length)}}class Q{constructor(){this.query="",this.status="all",this.type="all"}}let O=(()=>{class s{constructor(e,i){this.apiService=e,this.locationService=i,this.showStatusMenu=!1,this.showTypeMenu=!1,this.criteriaSubject=new m.t(1),this.searchCriteria=new Q,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:"element",title:"Element"},{value:"enum",title:"\u679a\u4e3e"},{value:"function",title:"\u51fd\u6570"},{value:"interface",title:"\u63a5\u53e3"},{value:"package",title:"Package"},{value:"pipe",title:"\u7ba1\u9053"},{value:"ngmodule",title:"NgModule"},{value:"type-alias",title:"\u7c7b\u578b\u522b\u540d"}],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,A.a)([this.apiService.sections,this.criteriaSubject]).pipe((0,f.U)(e=>({sections:e[0],criteria:e[1]})),(0,f.U)(e=>e.sections.map(i=>Object.assign(Object.assign({},i),{items:this.filterSection(i,e.criteria)})))),this.initializeSearchCriteria()}setQuery(e){this.setSearchCriteria({query:(e||"").toLowerCase().trim()})}setStatus(e){this.toggleStatusMenu(),this.status=e,this.setSearchCriteria({status:e.value})}setType(e){this.toggleTypeMenu(),this.type=e,this.setSearchCriteria({type:e.value})}toggleStatusMenu(){this.showStatusMenu=!this.showStatusMenu}toggleTypeMenu(){this.showTypeMenu=!this.showTypeMenu}filterSection(e,{query:i,status:a,type:o}){const r=!i||-1!==e.name.indexOf(i),y=(e.items||[]).filter(c=>(c=>"all"===o||o===c.docType)(c)&&(c=>"all"===a||a===c.stability||"security-risk"===a&&c.securityRisk)(c)&&(c=>r||-1!==c.name.indexOf(i))(c));return y.length?y:r&&"package"===o?[]:null}initializeSearchCriteria(){const{query:e,status:i,type:a}=this.locationService.search(),o=(e||"").toLowerCase();this.queryEl.nativeElement.value=o,this.status=this.statuses.find(r=>r.value===i)||this.statuses[0],this.type=this.types.find(r=>r.value===a)||this.types[0],this.searchCriteria={query:o,status:this.status.value,type:this.type.value},this.criteriaSubject.next(this.searchCriteria)}setLocationSearch(){const{query:e,status:i,type:a}=this.searchCriteria;this.locationService.setSearch("API \u641c\u7d22",{query:e||void 0,status:"all"!==i?i:void 0,type:"all"!==a?a:void 0})}setSearchCriteria(e){this.criteriaSubject.next(Object.assign(this.searchCriteria,e)),this.setLocationSearch()}}return s.\u0275fac=function(e){return new(e||s)(t.Y36(d),t.Y36(Z.a))},s.\u0275cmp=t.Xpm({type:s,selectors:[["aio-api-list"]],viewQuery:function(e,i){if(1&e&&t.Gf(j,7),2&e){let a;t.iGM(a=t.CRH())&&(i.queryEl=a.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(e,i){1&e&&(t.TgZ(0,"div",0),t.TgZ(1,"aio-select",1),t.NdJ("change",function(o){return i.setType(o.option)}),t.qZA(),t.TgZ(2,"aio-select",2),t.NdJ("change",function(o){return i.setStatus(o.option)}),t.qZA(),t.TgZ(3,"div",3),t.TgZ(4,"input",4,5),t.NdJ("input",function(o){return i.setQuery(o.target.value)}),t.qZA(),t.TgZ(6,"i",6),t._uU(7,"search"),t.qZA(),t.qZA(),t.qZA(),t.TgZ(8,"article",7),t.YNc(9,J,3,2,"div",8),t.ALo(10,"async"),t.qZA()),2&e&&(t.xp6(1),t.Q6J("options",i.types)("selected",i.type)("showSymbol",!0),t.xp6(1),t.Q6J("options",i.statuses)("selected",i.status)("disabled","package"===i.type.value),t.xp6(7),t.Q6J("ngForOf",t.lcZ(10,7,i.filteredSections)))},directives:[b.H,p.sg,p.O5],pipes:[p.Ov],encapsulation:2}),s})(),N=(()=>{class s{constructor(){this.customElementComponent=O}}return s.\u0275fac=function(e){return new(e||s)},s.\u0275mod=t.oAB({type:s}),s.\u0275inj=t.cJS({providers:[d],imports:[[p.ez,S.m,h.JF]]}),s})()}}]);
//# sourceMappingURL=src_app_custom-elements_api_api-list_module_ts.348fbe8534d1ffbc.js.map