angular-docs-cn/aio/dist/resource-resource-list-modu...

2 lines
3.5 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[13],{"6U+v":function(e,t,r){"use strict";r.r(t),r.d(t,"ResourceListModule",function(){return S});var c=r("ofXK"),o=r("fXoL"),i=r("lJxs"),s=r("qZ0a"),n=r("jn67"),u=r("tk/3");const a=n.a+"resources.json";let b=(()=>{class e{constructor(e){this.http=e,this.categories=this.getCategories()}getCategories(){const e=this.http.get(a).pipe(Object(i.a)(e=>{return t=e,Object.keys(t).map(e=>{const r=t[e];return{id:f(e),title:e,order:r.order,subCategories:l(r.subCategories,e)}}).sort(g);var t}),Object(s.a)());return e.connect(),e}}return e.\u0275fac=function(t){return new(t||e)(o.Xb(u.a))},e.\u0275prov=o.Kb({token:e,factory:e.\u0275fac}),e})();function l(e,t){return Object.keys(e).map(r=>{const c=e[r];return{id:f(r),title:r,order:c.order,resources:d(c.resources,r,t)}}).sort(g)}function d(e,t,r){return Object.keys(e).map(c=>{const o=e[c];return o.category=r,o.subCategory=t,o.id=f(c),o}).sort(p)}function g(e,t){return e.order===t.order?p(e,t):e.order>t.order?1:-1}function p(e,t){return e.title.toUpperCase()>t.title.toUpperCase()?1:-1}function f(e){return e.toLowerCase().replace(/\s+/g,"-")}var C=r("/lUL");function h(e,t){if(1&e){const e=o.Ub();o.Tb(0,"a",5),o.ac("click",function(){o.sc(e);const r=t.$implicit;return o.ec().selectCategory(r.id)})("keyup.enter",function(){o.sc(e);const r=t.$implicit;return o.ec().selectCategory(r.id)}),o.Ac(1),o.Sb()}if(2&e){const e=t.$implicit,r=o.ec();o.Gb("selected",e.id==r.selectedCategory.id),o.Cb(1),o.Bc(e.title)}}function y(e,t){if(1&e&&(o.Tb(0,"div"),o.Tb(1,"div",8),o.Tb(2,"a",9),o.Tb(3,"h4"),o.Ac(4),o.Sb(),o.Tb(5,"p",10),o.Ac(6),o.Sb(),o.Sb(),o.Sb(),o.Sb()),2&e){const e=t.$implicit;o.Cb(2),o.jc("href",e.url,o.uc),o.Cb(2),o.Bc(e.title),o.Cb(2),o.Bc(e.desc||"No Description")}}function v(e,t){if(1&e&&(o.Tb(0,"div"),o.Pb(1,"a",6),o.Tb(2,"h3",7),o.Ac(3),o.Sb(),o.zc(4,y,7,3,"div",4),o.Sb()),2&e){const e=t.$implicit;o.Cb(1),o.kc("id",e.id),o.Cb(2),o.Bc(e.title),o.Cb(1),o.jc("ngForOf",e.resources)}}let m=(()=>{class e{constructor(e,t){this.resourceService=e,this.locationService=t}ngOnInit(){const e=this.locationService.search().category||"";this.resourceService.categories.subscribe(t=>{this.categories=t,this.selectCategory(e)})}selectCategory(e){e=e.toLowerCase(),this.selectedCategory=this.categories.find(t=>t.id.toLowerCase()===e)||this.categories[0],this.locationService.setSearch("",{category:this.selectedCategory.id})}}return e.\u0275fac=function(t){return new(t||e)(o.Ob(b),o.Ob(C.a))},e.\u0275cmp=o.Ib({type:e,selectors:[["aio-resource-list"]],decls:5,vars:2,consts:[[1,"center-layout"],[1,"flex-center","group-buttons"],["class","button mat-button filter-button",3,"selected","click","keyup.enter",4,"ngFor","ngForOf"],[1,"showcase"],[4,"ngFor","ngForOf"],[1,"button","mat-button","filter-button",3,"click","keyup.enter"],[3,"id"],[1,"subcategory-title"],[1,"resource-item"],["rel","noopener","target","_blank",1,"resource-row-link",3,"href"],[1,"resource-description"]],template:function(e,t){1&e&&(o.Tb(0,"div",0),o.Tb(1,"div",1),o.zc(2,h,2,3,"a",2),o.Sb(),o.Tb(3,"div",3),o.zc(4,v,5,3,"div",4),o.Sb(),o.Sb()),2&e&&(o.Cb(2),o.jc("ngForOf",t.categories),o.Cb(2),o.jc("ngForOf",null==t.selectedCategory?null:t.selectedCategory.subCategories))},directives:[c.j],encapsulation:2}),e})(),S=(()=>{class e{constructor(){this.customElementComponent=m}}return e.\u0275mod=o.Mb({type:e}),e.\u0275inj=o.Lb({factory:function(t){return new(t||e)},providers:[b],imports:[[c.c]]}),e})()}}]);
//# sourceMappingURL=resource-resource-list-module-es2015.c10f93cd4e05eaabbcfd.js.map