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
/
Copy pathsrc_app_custom-elements_api_api-list_module_ts-es2015.d9c36aa3d5321c3f76ac.js.map
1 lines (1 loc) · 14.9 KB
/
src_app_custom-elements_api_api-list_module_ts-es2015.d9c36aa3d5321c3f76ac.js.map
1
{"version":3,"sources":["webpack:///src/app/custom-elements/api/api.service.ts","webpack:///src/app/custom-elements/api/api-list.component.html","webpack:///src/app/custom-elements/api/api-list.component.ts","webpack:///src/app/custom-elements/api/api-list.module.ts"],"names":["ApiService","http","logger","apiBase","apiListJsonDefault","firstTime","onDestroy","Subject","sectionsSubject","ReplaySubject","_sections","this","pipe","takeUntil","fetchSections","subscribe","sections","log","length","tap","forEach","section","deprecated","items","every","item","stability","next","src","url","get","err","error","SearchCriteria","query","status","type","ApiListComponent","apiService","locationService","showStatusMenu","showTypeMenu","criteriaSubject","searchCriteria","types","value","title","statuses","filteredSections","combineLatest","map","results","criteria","filterSection","initializeSearchCriteria","setSearchCriteria","toLowerCase","trim","toggleStatusMenu","toggleTypeMenu","sectionNameMatches","name","indexOf","filter","docType","securityRisk","search","q","queryEl","nativeElement","find","x","setSearch","undefined","Object","assign","setLocationSearch","setType","setStatus","setQuery","ApiListModule","customElementComponent"],"mappings":"yUA2BO,Y,MAAMA,EA+BX,YAAoBC,EAA0BC,GAA1B,KAAAD,OAA0B,KAAAC,SA7BtC,KAAAC,QAAU,KAAyB,OACnC,KAAAC,mBAAqB,gBACrB,KAAAC,WAAY,EACZ,KAAAC,UAAY,IAAIC,EAAA,GAChB,KAAAC,gBAAkB,IAAIC,EAAA,EAA4B,GAClD,KAAAC,UAAYC,KAAKH,gBAAgBI,MAAK,EAAAC,EAAA,GAAUF,KAAKL,YAM7D,eAUE,OARIK,KAAKN,YACPM,KAAKN,WAAY,EACjBM,KAAKG,gBAGLH,KAAKD,UAAUK,UAAUC,GAAYL,KAAKT,OAAOe,IAAI,sBAAsBD,EAASE,u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,iCAAS,EAAAC,SAAA,kBAAzC,QACA,eAA0B,kBAAM,QAClC,QACF,QAEA,qBACE,uB,kBAaF,S,MAjCc,kCAAiB,kBAAjB,CAAiB,iBAOjB,qCAAoB,oBAApB,CAAoB,qCAaP,2D,6DCKpB,GCdA,Q,MAAMC,EANb,cAOE,KAAAC,uBAAoC5C,G,6CADzB2C,I,wBAAAA,I,6BAFA,CAAEhF,GAAY,SAHhB,CAAE,KAAc,IAAc,S,GAKlC","file":"x","sourcesContent":["import { Injectable, OnDestroy } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\n\nimport { ReplaySubject, Subject } from 'rxjs';\nimport { takeUntil, tap } from 'rxjs/operators';\n\nimport { Logger } from 'app/shared/logger.service';\nimport { DOC_CONTENT_URL_PREFIX } from 'app/documents/document.service';\n\nexport interface ApiItem {\n name: string;\n title: string;\n path: string;\n docType: string;\n stability: string;\n securityRisk: boolean;\n}\n\nexport interface ApiSection {\n path: string;\n name: string;\n title: string;\n deprecated: boolean;\n items: ApiItem[]|null;\n}\n\n@Injectable()\nexport class ApiService implements OnDestroy {\n\n private apiBase = DOC_CONTENT_URL_PREFIX + 'api/';\n private apiListJsonDefault = 'api-list.json';\n private firstTime = true;\n private onDestroy = new Subject();\n private sectionsSubject = new ReplaySubject<ApiSection[]>(1);\n private _sections = this.sectionsSubject.pipe(takeUntil(this.onDestroy));\n\n /**\n * Return a cached observable of API sections from a JSON file.\n * API sections is an array of Angular top modules and metadata about their API documents (items).\n */\n get sections() {\n\n if (this.firstTime) {\n this.firstTime = false;\n this.fetchSections(); // TODO: get URL for fetchSections by configuration?\n\n // makes sectionsSubject hot; subscribe ensures stays alive (always refCount > 0);\n this._sections.subscribe(sections => this.logger.log(`ApiService got API ${sections.length} section(s)`));\n }\n\n return this._sections.pipe(tap(sections => {\n sections.forEach(section => {\n section.deprecated = !!section.items &&\n section.items.every(item => item.stability === 'deprecated');\n });\n }));\n }\n\n constructor(private http: HttpClient, private logger: Logger) { }\n\n ngOnDestroy() {\n this.onDestroy.next();\n }\n\n /**\n * Fetch API sections from a JSON file.\n * API sections is an array of Angular top modules and metadata about their API documents (items).\n * Updates `sections` observable\n *\n * @param [src] - Name of the api list JSON file\n */\n fetchSections(src?: string) {\n // TODO: get URL by configuration?\n const url = this.apiBase + (src || this.apiListJsonDefault);\n this.http.get<ApiSection[]>(url)\n .pipe(\n takeUntil(this.onDestroy),\n tap(() => this.logger.log(`Got API sections from ${url}`)),\n )\n .subscribe(\n sections => this.sectionsSubject.next(sections),\n (err: HttpErrorResponse) => {\n // TODO: handle error\n this.logger.error(err);\n throw err; // rethrow for now.\n }\n );\n }\n}\n","<div class=\"l-flex-wrap api-filter\">\n\n <aio-select (change)=\"setType($event.option)\"\n [options]=\"types\"\n [selected]=\"type\"\n [showSymbol]=\"true\"\n label=\"类型:\">\n </aio-select>\n\n <aio-select (change)=\"setStatus($event.option)\"\n [options]=\"statuses\"\n [selected]=\"status\"\n [disabled]=\"type.value === 'package'\"\n label=\"状态:\">\n </aio-select>\n\n <div class=\"form-search\">\n <input #filter placeholder=\"过滤\" (input)=\"setQuery($any($event.target).value)\" aria-label=\"Filter Search\">\n <i class=\"material-icons\">search</i>\n </div>\n</div>\n\n<article class=\"api-list-container\">\n <div *ngFor=\"let section of filteredSections | async\" >\n <h2 *ngIf=\"section.items\"><a [href]=\"section.path\" [class.deprecated-api-item]=\"section.deprecated\">{{section.title}}</a></h2>\n <ul class=\"api-list\" *ngIf=\"section.items && section.items.length\">\n <ng-container *ngFor=\"let item of section.items\">\n <li class=\"api-item\">\n <a [href]=\"item.path\" [class.deprecated-api-item]=\"item.stability === 'deprecated'\">\n <span class=\"symbol {{item.docType}}\"></span>\n {{item.title}}\n </a>\n </li>\n </ng-container>\n </ul>\n </div>\n</article>\n","/*\n* API List & Filter Component\n*\n* A page that displays a formatted list of the public Angular API entities.\n* Clicking on a list item triggers navigation to the corresponding API entity document.\n* Can add/remove API entity links based on filter settings.\n*/\n\nimport { Component, ElementRef, OnInit, ViewChild } from '@angular/core';\n\nimport { combineLatest, Observable, ReplaySubject } from 'rxjs';\n\nimport { LocationService } from 'app/shared/location.service';\nimport { ApiItem, ApiSection, ApiService } from './api.service';\n\nimport { Option } from 'app/shared/select/select.component';\nimport { map } from 'rxjs/operators';\n\nclass SearchCriteria {\n query = '';\n status = 'all';\n type = 'all';\n}\n\n@Component({\n selector: 'aio-api-list',\n templateUrl: './api-list.component.html',\n})\nexport class ApiListComponent implements OnInit {\n\n filteredSections: Observable<ApiSection[]>;\n\n showStatusMenu = false;\n showTypeMenu = false;\n\n private criteriaSubject = new ReplaySubject<SearchCriteria>(1);\n private searchCriteria = new SearchCriteria();\n\n status: Option;\n type: Option;\n\n // API types\n types: Option[] = [\n { value: 'all', title: '全部' },\n { value: 'class', title: '类' },\n { value: 'const', title: '常量'},\n { value: 'decorator', title: '装饰器' },\n { value: 'directive', title: '指令' },\n { value: 'enum', title: '枚举' },\n { value: 'function', title: '函数' },\n { value: 'interface', title: '接口' },\n { value: 'pipe', title: '管道'},\n { value: 'ngmodule', title: 'NgModule'},\n { value: 'type-alias', title: '类型别名' },\n { value: 'package', title: '包'}\n ];\n\n statuses: Option[] = [\n { value: 'all', title: '全部' },\n { value: 'stable', title: '稳定'},\n { value: 'deprecated', title: '弃用' },\n { value: 'security-risk', title: '安全风险' }\n ];\n\n @ViewChild('filter', { static: true }) queryEl: ElementRef;\n\n constructor(\n private apiService: ApiService,\n private locationService: LocationService) { }\n\n ngOnInit() {\n this.filteredSections =\n combineLatest([\n this.apiService.sections,\n this.criteriaSubject,\n ]).pipe(\n map( results => ({ sections: results[0], criteria: results[1]})),\n map( results => (\n results.sections\n .map(section => ({ ...section, items: this.filterSection(section, results.criteria) }))\n ))\n );\n\n this.initializeSearchCriteria();\n }\n\n // TODO: may need to debounce as the original did\n // although there shouldn't be any perf consequences if we don't\n setQuery(query: string) {\n this.setSearchCriteria({query: (query || '').toLowerCase().trim() });\n }\n\n setStatus(status: Option) {\n this.toggleStatusMenu();\n this.status = status;\n this.setSearchCriteria({status: status.value});\n }\n\n setType(type: Option) {\n this.toggleTypeMenu();\n this.type = type;\n this.setSearchCriteria({type: type.value});\n }\n\n toggleStatusMenu() {\n this.showStatusMenu = !this.showStatusMenu;\n }\n\n toggleTypeMenu() {\n this.showTypeMenu = !this.showTypeMenu;\n }\n\n //////// Private //////////\n\n private filterSection(section: ApiSection, { query, status, type }: SearchCriteria) {\n const sectionNameMatches = !query || section.name.indexOf(query) !== -1;\n\n const matchesQuery = (item: ApiItem) =>\n sectionNameMatches || item.name.indexOf(query) !== -1;\n const matchesStatus = (item: ApiItem) =>\n status === 'all' || status === item.stability || (status === 'security-risk' && item.securityRisk);\n const matchesType = (item: ApiItem) =>\n type === 'all' || type === item.docType;\n\n const items: ApiItem[] = (section.items || []).filter(item =>\n matchesType(item) && matchesStatus(item) && matchesQuery(item));\n\n // If there are no items we still return an empty array if the section name matches and the type is 'package'\n return items.length ? items : (sectionNameMatches && type === 'package') ? [] : null;\n }\n\n // Get initial search criteria from URL search params\n private initializeSearchCriteria() {\n const {query, status, type} = this.locationService.search();\n\n const q = (query || '').toLowerCase();\n // Hack: can't bind to query because input cursor always forced to end-of-line.\n this.queryEl.nativeElement.value = q;\n\n this.status = this.statuses.find(x => x.value === status) || this.statuses[0];\n this.type = this.types.find(x => x.value === type) || this.types[0];\n\n this.searchCriteria = {\n query: q,\n status: this.status.value,\n type: this.type.value\n };\n\n this.criteriaSubject.next(this.searchCriteria);\n }\n\n private setLocationSearch() {\n const {query, status, type} = this.searchCriteria;\n const params = {\n query: query ? query : undefined,\n status: status !== 'all' ? status : undefined,\n type: type !== 'all' ? type : undefined\n };\n\n this.locationService.setSearch('API 搜索', params);\n }\n\n private setSearchCriteria(criteria: Partial<SearchCriteria>) {\n this.criteriaSubject.next(Object.assign(this.searchCriteria, criteria));\n this.setLocationSearch();\n }\n}\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpClientModule } from '@angular/common/http';\nimport { SharedModule } from '../../shared/shared.module';\nimport { ApiListComponent } from './api-list.component';\nimport { ApiService } from './api.service';\nimport { WithCustomElementComponent } from '../element-registry';\n\n@NgModule({\n imports: [ CommonModule, SharedModule, HttpClientModule ],\n declarations: [ ApiListComponent ],\n entryComponents: [ ApiListComponent ],\n providers: [ ApiService ]\n})\nexport class ApiListModule implements WithCustomElementComponent {\n customElementComponent: Type<any> = ApiListComponent;\n}\n"]}