-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsrc_app_custom-elements_resource_resource-list_module_ts.b6932405de802000.js.map
1 lines (1 loc) · 9.63 KB
/
src_app_custom-elements_resource_resource-list_module_ts.b6932405de802000.js.map
1
{"version":3,"file":"src_app_custom-elements_resource_resource-list_module_ts.b6932405de802000.js","mappings":"oQASA,MAAMA,EAAgBC,KAAqB,iBAAiB,IAG/CC,EAAe,MAD5B,MACaA,EAGXC,YAAoBC,GAAAC,KAAAD,OAClBC,KAAKC,WAAaD,KAAKE,eACzB,CAEQA,gBACN,MAAMC,EAAgBH,KAAKD,KAAKK,IAAST,GAAeU,QAAKC,KAAKC,GAWtE,SAASC,EAAaC,GACpB,OAAOC,OAAOC,KAAKF,GAAcH,IAAIM,IACjC,MAAMC,EAAMJ,EAAaG,GACzB,MAAO,CACLE,GAAIC,EAAOH,GACXI,MAAOJ,EACPK,MAAOJ,EAAII,MACbC,cAAeC,EAAgBN,EAAIK,cAAeN,MAGnDQ,KAAKC,EACV,CAtB+Eb,CAAaD,KAClFN,KAAaqB,KAAYnB,EAAe,CAC5CoB,UAAWA,IAAM,IAAIC,IACrBC,mBAAmB,IAErBxB,SAAWyB,UACJzB,CACT,CAAC0B,SAAA3B,KAAA,mBAAA4B,iBAfU/B,GAAegC,MAAAC,MAAA,EAAAH,SAAA3B,KAAA,WAAA+B,EAAAC,IAAA,OAAfnC,EAAeoC,QAAfpC,EAAeqC,mBAAfrC,CAAe,KAiC5B,SAASsB,EAAgBgB,EAAsBvB,GAC7C,OAAOF,OAAOC,KAAKwB,GAAiB7B,IAAI8B,IACpC,MAAMC,EAAMF,EAAgBC,GAC5B,MAAO,CACLtB,GAAIC,EAAOqB,GACXpB,MAAOoB,EACPnB,MAAOoB,EAAIpB,MACXqB,UAAWC,EAAYF,EAAIC,UAAWF,EAAQxB,MAGjDQ,KAAKC,EACV,CAGA,SAASkB,EAAYC,EAAmBJ,EAAgBxB,GACtD,OAAOF,OAAOC,KAAK6B,GA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AAmE,iBACV,CAEAC,WACE,MAAMzB,EAAY3C,KAAKmE,gBAAgBE,SAAS1B,UAAY,GAG5D3C,KAAKkE,gBAAgBjE,WAAWqE,UAAUC,IACxCvE,KAAKC,WAAasE,EAClBvE,KAAKuD,eAAeZ,EAAQ,EAEhC,CAEAY,eAAezC,GACbA,EAAKA,EAAGmC,cACRjD,KAAKyD,iBACHzD,KAAKC,WAAWuE,KAAK7B,GAAYA,EAAS7B,GAAGmC,gBAAkBnC,IAAOd,KAAKC,WAAW,GACxFD,KAAKmE,gBAAgBM,UAAU,GAAI,CAAC9B,SAAU3C,KAAKyD,iBAAiB3C,IACtE,CAACa,SAAA3B,KAAA,mBAAA4B,iBAzBUqC,GAAqBpC,MAAAC,GAAAD,MAAA6C,KAAA,EAAA/C,SAAA3B,KAAA,UAAA+B,EAAA4C,IAAA,MAArBV,EAAqBW,UAAA,wBAAAC,MAAA,EAAAC,KAAA,EAAAC,OAAA,4YAAAC,SAAA,SAAAC,EAAAC,GAAA,EAAAD,IDVlCpD,MAAA,UAAAA,CAA2B,WAEvBA,MAAA,EAAAsD,EAAA,gBAIFtD,QACAA,MAAA,WACEA,MAAA,EAAAuD,EAAA,aAWFvD,iBAjB+BA,MAAA,GAAAA,MAAA,UAAAqD,EAAAjF,YAMA4B,MAAA,GAAAA,MAAA,gBAAAqD,EAAAzB,iBAAA,KAAAyB,EAAAzB,iBAAAvC,8DCEpB+C,CAAqB,KCCrBoB,EAAkB,MAL/B,MAKaA,EALbvF,cAMEE,KAAAsF,uBAAoCrB,EACrCtC,SAAA3B,KAAA,mBAAA4B,iBAFYyD,EAAkB,EAAA1D,SAAA3B,KAAA,UAAA+B,EAAAwD,IAAA,MAAlBF,IAAkB1D,SAAA3B,KAAA,UAAA+B,EAAAyD,IAAA,WAFlB,CAAE3F,GAAiB4F,QAAA,CAFnBC,eAIAL,CAAkB","names":["resourcesPath","CONTENT_URL_PREFIX","ResourceService","constructor","http","this","categories","getCategories","categoriesSrc","get","pipe","map","data","mkCategories","categoryJson","Object","keys","catKey","cat","id","makeId","title","order","subCategories","mkSubCategories","sort","compareCats","connectable","connector","AsyncSubject","resetOnDisconnect","connect","static","t","i0","i1","core","wxM","factory","ɵfac","subCategoryJson","subKey","sub","resources","mkResources","resourceJson","resKey","res","category","subCategory","compareTitles","l","r","toUpperCase","toLowerCase","replace","category_r2","_r4","$implicit","ctx_r3","selectCategory","ctx_r0","selectedCategory","resource_r7","url","titleCn","descCn","desc","ResourceListComponent_div_4_div_3_Template","subCategory_r5","ResourceListComponent","resourceService","locationService","ngOnInit","search","subscribe","cats","find","setSearch","i2","In1","selectors","decls","vars","consts","template","rf","ctx","ResourceListComponent_button_2_Template","ResourceListComponent_div_4_Template","ResourceListModule","customElementComponent","a4G","s3X","imports","CommonModule"],"sourceRoot":"webpack:///","sources":["./src/app/custom-elements/resource/resource.service.ts","./src/app/custom-elements/resource/resource-list.component.html","./src/app/custom-elements/resource/resource-list.component.ts","./src/app/custom-elements/resource/resource-list.module.ts"],"sourcesContent":["import {Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\n\nimport {AsyncSubject, connectable, Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nimport {Category, Resource, SubCategory} from './resource.model';\nimport {CONTENT_URL_PREFIX} from 'app/documents/document.service';\n\nconst resourcesPath = CONTENT_URL_PREFIX + 'resources.json';\n\n@Injectable()\nexport class ResourceService {\n categories: Observable<Category[]>;\n\n constructor(private http: HttpClient) {\n this.categories = this.getCategories();\n }\n\n private getCategories(): Observable<Category[]> {\n const categoriesSrc = this.http.get<any>(resourcesPath).pipe(map((data) => mkCategories(data)));\n const categories = connectable(categoriesSrc, {\n connector: () => new AsyncSubject(),\n resetOnDisconnect: false,\n });\n categories.connect();\n return categories;\n }\n}\n\n// Extract sorted Category[] from resource JSON data\nfunction mkCategories(categoryJson: any): Category[] {\n return Object.keys(categoryJson).map(catKey => {\n const cat = categoryJson[catKey];\n return {\n id: makeId(catKey),\n title: catKey,\n order: cat.order,\n subCategories: mkSubCategories(cat.subCategories, catKey)\n } as Category;\n })\n .sort(compareCats);\n}\n\n// Extract sorted SubCategory[] from JSON category data\nfunction mkSubCategories(subCategoryJson: any, catKey: string): SubCategory[] {\n return Object.keys(subCategoryJson).map(subKey => {\n const sub = subCategoryJson[subKey];\n return {\n id: makeId(subKey),\n title: subKey,\n order: sub.order,\n resources: mkResources(sub.resources, subKey, catKey)\n } as SubCategory;\n })\n .sort(compareCats);\n}\n\n// Extract sorted Resource[] from JSON subcategory data\nfunction mkResources(resourceJson: any, subKey: string, catKey: string): Resource[] {\n return Object.keys(resourceJson).map(resKey => {\n const res = resourceJson[resKey];\n res.category = catKey;\n res.subCategory = subKey;\n res.id = makeId(resKey);\n return res as Resource;\n })\n .sort(compareTitles);\n}\n\nfunction compareCats(l: Category | SubCategory, r: Category | SubCategory) {\n return l.order === r.order ? compareTitles(l, r) : l.order > r.order ? 1 : -1;\n}\n\nfunction compareTitles(l: {title: string}, r: {title: string}) {\n return l.title.toUpperCase() > r.title.toUpperCase() ? 1 : -1;\n}\n\nfunction makeId(title: string) {\n return title.toLowerCase().replace(/\\s+/g, '-');\n}\n","<div class=\"center-layout\">\n <div class=\"flex-center group-buttons\">\n <button *ngFor=\"let category of categories\"\n class=\"button mat-button filter-button\"\n [class.selected]=\"category.id == selectedCategory.id\"\n (click)=\"selectCategory(category.id)\">{{category.title}}</button>\n </div>\n <div class=\"showcase\">\n <div *ngFor=\"let subCategory of selectedCategory?.subCategories\">\n <h2 class=\"subcategory-title\" id=\"{{subCategory.id}}\">{{subCategory.title}}</h2>\n <div *ngFor=\"let resource of subCategory.resources\">\n <div class=\"resource-item\">\n <a class=\"resource-row-link\" rel=\"noopener\" target=\"_blank\" [href]=\"resource.url\">\n <h3 class=\"resource-name\">{{ resource.titleCn || resource.title }}</h3>\n <p class=\"resource-description\">{{ resource.descCn || resource.desc || '无描述' }}</p>\n </a>\n </div>\n </div>\n </div>\n </div>\n</div>\n","import { Component, OnInit } from '@angular/core';\n\nimport { Category } from './resource.model';\nimport { ResourceService } from './resource.service';\nimport { LocationService } from 'app/shared/location.service';\n\n@Component({\n selector: 'aio-resource-list',\n templateUrl: 'resource-list.component.html'\n})\nexport class ResourceListComponent implements OnInit {\n\n categories: Category[];\n selectedCategory: Category;\n\n constructor(\n private resourceService: ResourceService,\n private locationService: LocationService) {\n }\n\n ngOnInit() {\n const category = this.locationService.search().category || '';\n // Not using async pipe because cats appear twice in template\n // No need to unsubscribe because categories observable completes.\n this.resourceService.categories.subscribe(cats => {\n this.categories = cats;\n this.selectCategory(category);\n });\n }\n\n selectCategory(id: string) {\n id = id.toLowerCase();\n this.selectedCategory =\n this.categories.find(category => category.id.toLowerCase() === id) || this.categories[0];\n this.locationService.setSearch('', {category: this.selectedCategory.id});\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ResourceListComponent } from './resource-list.component';\nimport { ResourceService } from './resource.service';\nimport { WithCustomElementComponent } from '../element-registry';\n\n@NgModule({\n imports: [ CommonModule ],\n declarations: [ ResourceListComponent ],\n providers: [ ResourceService ]\n})\nexport class ResourceListModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = ResourceListComponent;\n}\n"],"x_google_ignoreList":[]}