-
Notifications
You must be signed in to change notification settings - Fork 0
/
8-es2015.1812e0d1104b63625882.js
1 lines (1 loc) · 11.7 KB
/
8-es2015.1812e0d1104b63625882.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{vrIs:function(t,e,n){"use strict";n.r(e),n.d(e,"SearchResultModule",(function(){return F}));var i=n("ofXK"),c=n("tyNb"),s=n("fXoL"),a=n("kH+g");const o=["dropdownButtonSortBy"];function r(t,e){if(1&t){const t=s.Xb();s.Wb(0,"div",6),s.ec("click",(function(){s.qc(t);const n=e.$implicit;return s.gc(2).selectFilterType(n)})),s.Wb(1,"a",7),s.xc(2),s.Vb(),s.Sb(3,"hr",8),s.Vb()}if(2&t){const t=e.$implicit,n=s.gc(2);s.Hb(1),s.Jb("is-active",t===n.selectedFilterType),s.Hb(1),s.zc(" ",t," ")}}function l(t,e){if(1&t&&(s.Wb(0,"div",4),s.wc(1,r,4,3,"div",5),s.Vb()),2&t){const t=s.gc();s.Hb(1),s.mc("ngForOf",t.sortType)}}let b=(()=>{class t{constructor(t){this.renderer=t,this.dropDownSortBy=!1,this.selectedFilterType="Best match",this.filterTypeChanged=new s.q,this.sortType=["Best match","Most stars","Fewest stars","Fewest fork","Most fork","Recently updated","Least recently updated"],this.renderer.listen("window","click",t=>{t.target!==this.dropdownButtonSortBy.nativeElement&&(this.dropDownSortBy=!1)})}ngOnInit(){}selectFilterType(t){this.selectedFilterType=t,this.filterTypeChanged.emit(t)}}return t.\u0275fac=function(e){return new(e||t)(s.Rb(s.K))},t.\u0275cmp=s.Lb({type:t,selectors:[["app-search-filter"]],viewQuery:function(t,e){var n;1&t&&s.uc(o,!0),2&t&&s.oc(n=s.fc())&&(e.dropdownButtonSortBy=n.first)},outputs:{filterTypeChanged:"filterTypeChanged"},decls:5,vars:2,consts:[[1,"navbar-item","has-dropdown","is-active"],[1,"navbar-link",3,"click"],["dropdownButtonSortBy",""],["class","navbar-dropdown is-right",4,"ngIf"],[1,"navbar-dropdown","is-right"],[3,"click",4,"ngFor","ngForOf"],[3,"click"],[1,"navbar-item"],[1,"navbar-divider"]],template:function(t,e){1&t&&(s.Wb(0,"div",0),s.Wb(1,"a",1,2),s.ec("click",(function(){return e.dropDownSortBy=!e.dropDownSortBy})),s.xc(3),s.Vb(),s.wc(4,l,2,1,"div",3),s.Vb()),2&t&&(s.Hb(3),s.zc(" Sort: ",e.selectedFilterType," "),s.Hb(1),s.mc("ngIf",e.dropDownSortBy))},directives:[i.k,i.j],styles:["[_nghost-%COMP%]{display:inline-flex}.navbar-dropdown[_ngcontent-%COMP%], .navbar-link[_ngcontent-%COMP%]{border-radius:5px}"]}),t})();var u=n("wHSu"),g=n("6NWb");function p(t,e){if(1&t&&(s.Wb(0,"a",13),s.Wb(1,"span",14),s.Sb(2,"fa-icon",6),s.Vb(),s.Wb(3,"p"),s.xc(4),s.Vb(),s.Vb()),2&t){const t=s.gc();s.Hb(2),s.mc("icon",t.faCircle)("size","xs"),s.Hb(2),s.yc(null==t.item?null:t.item.language)}}function d(t,e){if(1&t&&(s.Wb(0,"a",13),s.Wb(1,"span",14),s.Sb(2,"fa-icon",6),s.Vb(),s.Wb(3,"p"),s.xc(4),s.Vb(),s.Vb()),2&t){const t=s.gc();s.Hb(2),s.mc("icon",t.faStar)("size","xs"),s.Hb(2),s.yc(null==t.item?null:t.item.stargazers_count)}}function f(t,e){if(1&t&&(s.Wb(0,"a",13),s.Wb(1,"span",14),s.Sb(2,"fa-icon",6),s.Vb(),s.Wb(3,"p"),s.xc(4),s.Vb(),s.Vb()),2&t){const t=s.gc();s.Hb(2),s.mc("icon",t.faNetworkWired)("size","xs"),s.Hb(2),s.yc(null==t.item?null:t.item.forks_count)}}function h(t,e){if(1&t&&(s.Wb(0,"a",13),s.Wb(1,"span",14),s.Sb(2,"fa-icon",6),s.Vb(),s.Wb(3,"p"),s.xc(4),s.Vb(),s.Vb()),2&t){const t=s.gc();s.Hb(2),s.mc("icon",t.faEye)("size","xs"),s.Hb(2),s.yc(null==t.item?null:t.item.watchers_count)}}function m(t,e){if(1&t&&(s.Wb(0,"a",13),s.Wb(1,"p"),s.xc(2),s.hc(3,"date"),s.Vb(),s.Vb()),2&t){const t=s.gc();s.Hb(2),s.zc("Updated on ",s.ic(3,1,null==t.item?null:t.item.updated_at),"")}}let v=(()=>{class t{constructor(t){this.router=t,this.faDatabase=u.c,this.faNetworkWired=u.f,this.faCircle=u.a,this.faStar=u.g,this.faEye=u.e}ngOnChanges(){}navigateToDescription(t){this.router.navigate(["detail"],{queryParams:{repo:null==t?void 0:t.full_name}})}}return t.\u0275fac=function(e){return new(e||t)(s.Rb(c.b))},t.\u0275cmp=s.Lb({type:t,selectors:[["app-item-summary-box"]],inputs:{item:"item"},features:[s.Fb],decls:19,vars:9,consts:[[1,"box",3,"click"],[1,"media"],[1,"media-content"],[1,"content"],[1,"content-tob-bar"],[1,"title-container"],[3,"icon","size"],[1,"box-title"],[1,"repo-description"],[1,"description"],[1,"level","is-mobile"],[1,"level-left"],["class","level-item",4,"ngIf"],[1,"level-item"],[1,"icon","is-small"]],template:function(t,e){1&t&&(s.Wb(0,"div",0),s.ec("click",(function(){return e.navigateToDescription(e.item)})),s.Wb(1,"article",1),s.Wb(2,"div",2),s.Wb(3,"div",3),s.Wb(4,"div",4),s.Wb(5,"div",5),s.Sb(6,"fa-icon",6),s.Wb(7,"h5",7),s.xc(8),s.Vb(),s.Vb(),s.Wb(9,"div",8),s.Wb(10,"p",9),s.xc(11),s.Vb(),s.Vb(),s.Vb(),s.Vb(),s.Wb(12,"nav",10),s.Wb(13,"div",11),s.wc(14,p,5,3,"a",12),s.wc(15,d,5,3,"a",12),s.wc(16,f,5,3,"a",12),s.wc(17,h,5,3,"a",12),s.wc(18,m,4,3,"a",12),s.Vb(),s.Vb(),s.Vb(),s.Vb(),s.Vb()),2&t&&(s.Hb(6),s.mc("icon",e.faDatabase)("size","xs"),s.Hb(2),s.yc(null==e.item?null:e.item.full_name),s.Hb(3),s.yc(null==e.item?null:e.item.description),s.Hb(3),s.mc("ngIf",null==e.item?null:e.item.language),s.Hb(1),s.mc("ngIf",null==e.item?null:e.item.score),s.Hb(1),s.mc("ngIf",null==e.item?null:e.item.forks_count),s.Hb(1),s.mc("ngIf",null==e.item?null:e.item.watchers_count),s.Hb(1),s.mc("ngIf",null==e.item?null:e.item.updated_at))},directives:[g.a,i.k],pipes:[i.d],styles:["[_nghost-%COMP%]{display:block}.media-content[_ngcontent-%COMP%]{width:100%}.content-tob-bar[_ngcontent-%COMP%]{margin:0}.content-tob-bar[_ngcontent-%COMP%] fa-icon[_ngcontent-%COMP%]{margin-top:2px}.content-tob-bar[_ngcontent-%COMP%] .title-container[_ngcontent-%COMP%]{display:flex}.content-tob-bar[_ngcontent-%COMP%] .repo-description[_ngcontent-%COMP%]{min-height:35px}"]}),t})();var y=n("Frqi"),w=n("oOf3");function x(t,e){1&t&&s.Sb(0,"app-item-summary-box",9),2&t&&s.mc("item",e.$implicit)}function P(t,e){if(1&t&&(s.Wb(0,"div",7),s.wc(1,x,1,1,"app-item-summary-box",8),s.hc(2,"paginate"),s.Vb()),2&t){const t=s.gc();s.Hb(1),s.mc("ngForOf",s.jc(2,1,null==t.searchResult?null:t.searchResult.items,t.config))}}function k(t,e){1&t&&s.Sb(0,"app-loading")}function W(t,e){if(1&t){const t=s.Xb();s.Wb(0,"a",17),s.ec("click",(function(){return s.qc(t),s.gc(),s.pc(1).previous()})),s.xc(1,"Previous"),s.Vb()}if(2&t){s.gc();const t=s.pc(1);s.Jb("disabled",t.isFirstPage())}}function C(t,e){if(1&t){const t=s.Xb();s.Wb(0,"a",18),s.ec("click",(function(){return s.qc(t),s.gc(),s.pc(1).next()})),s.xc(1,"Next page"),s.Vb()}if(2&t){s.gc();const t=s.pc(1);s.Jb("disabled",t.isLastPage())}}function V(t,e){if(1&t){const t=s.Xb();s.Wb(0,"a",21),s.ec("click",(function(){s.qc(t);const e=s.gc().$implicit;return s.gc(),s.pc(1).setCurrent(e.value)})),s.xc(1),s.Vb()}if(2&t){const t=s.gc().$implicit;s.gc();const e=s.pc(1);s.Jb("is-current",e.getCurrent()===t.value),s.Hb(1),s.yc(t.label)}}function H(t,e){if(1&t&&(s.Wb(0,"a",22),s.Wb(1,"span"),s.xc(2),s.Vb(),s.Vb()),2&t){const t=s.gc().$implicit;s.Hb(2),s.yc(t.label)}}function O(t,e){if(1&t&&(s.Wb(0,"li"),s.wc(1,V,2,3,"a",19),s.wc(2,H,3,1,"a",20),s.Vb()),2&t){const t=e.$implicit;s.gc();const n=s.pc(1);s.Hb(1),s.mc("ngIf",n.getCurrent()!==t.value),s.Hb(1),s.mc("ngIf",n.getCurrent()===t.value)}}function _(t,e){if(1&t){const t=s.Xb();s.Wb(0,"pagination-template",10,11),s.ec("pageChange",(function(e){return s.qc(t),s.gc().onPageChange(e)})),s.Wb(2,"nav",12),s.wc(3,W,2,2,"a",13),s.wc(4,C,2,2,"a",14),s.Wb(5,"ul",15),s.wc(6,O,3,2,"li",16),s.Vb(),s.Vb(),s.Vb()}if(2&t){const t=s.pc(1),e=s.gc();s.mc("id",e.config.id)("maxSize",10),s.Hb(3),s.mc("ngIf",!t.isFirstPage()),s.Hb(1),s.mc("ngIf",!t.isLastPage()),s.Hb(2),s.mc("ngForOf",t.pages)}}function S(t,e){1&t&&(s.Wb(0,"h1",23),s.xc(1,"Sorry, Content you are looking for doesn't exist!!"),s.Vb())}const I=[{path:"",component:(()=>{class t{constructor(t,e){this.route=t,this.getDatService=e,this.perPage=36,this.sort="match",this.order="desc",this.config={id:"advanced",currentPage:1,itemsPerPage:this.perPage}}ngOnInit(){this.subscribeToQueryParamsChange()}subscribeToQueryParamsChange(){this.sub=this.route.queryParams.subscribe(t=>{this.searchKey=t.searchKey,this.getSearchResult(!0)})}getSearchResult(t){this.loading=!0,t&&this.resetPagination(),this.searchResult=null;const e=this.getQueryParameter(this.searchKey,this.sort,this.order,this.perPage,this.config.currentPage);this.getDatService.getPublicRepositories(e).subscribe(t=>{var e;this.searchResult=t,this.config.totalItems=(null==t?void 0:t.total_count)>1e3?1e3:null==t?void 0:t.total_count,this.config.itemsPerPage=null===(e=null==t?void 0:t.items)||void 0===e?void 0:e.length,this.loading=!1})}getQueryParameter(t,e,n,i,c){return"q="+t+"&sort="+e+"&order="+n+"&per_page="+i+"&page="+c}onPageChange(t){this.config.currentPage=t,this.getSearchResult(!1)}changeFilterProps(t){switch(t){case"Best match":this.sort="",this.order="";break;case"Most stars":this.sort="stars",this.order="desc";break;case"Fewest stars":this.sort="stars",this.order="asc";break;case"Fewest fork":this.sort="fork",this.order="asc";break;case"Most fork":this.sort="fork",this.order="desc";break;case"Recently updated":this.sort="updated",this.order="desc";break;case"Least recently updated":this.sort="updated",this.order="asc"}this.getSearchResult(!0)}resetPagination(){this.config.currentPage=1}ngOnDestroy(){this.sub.unsubscribe()}}return t.\u0275fac=function(e){return new(e||t)(s.Rb(c.a),s.Rb(a.a))},t.\u0275cmp=s.Lb({type:t,selectors:[["app-search-result"]],decls:9,vars:9,consts:[[1,"container","is-fluid"],[1,"top-bar"],[3,"filterTypeChanged"],["class","flex-container",4,"ngIf"],[4,"ngIf"],[3,"id","maxSize","pageChange",4,"ngIf"],["class","content-not-found-text",4,"ngIf"],[1,"flex-container"],[3,"item",4,"ngFor","ngForOf"],[3,"item"],[3,"id","maxSize","pageChange"],["p","paginationApi"],["role","navigation","aria-label","pagination",1,"pagination","is-small"],["class","pagination-previous",3,"disabled","click",4,"ngIf"],["class","pagination-next",3,"disabled","click",4,"ngIf"],[1,"pagination-list"],[4,"ngFor","ngForOf"],[1,"pagination-previous",3,"click"],[1,"pagination-next",3,"click"],["class","pagination-link",3,"is-current","click",4,"ngIf"],["class","pagination-link is-current",4,"ngIf"],[1,"pagination-link",3,"click"],[1,"pagination-link","is-current"],[1,"content-not-found-text"]],template:function(t,e){1&t&&(s.Wb(0,"div",0),s.Wb(1,"div",1),s.Wb(2,"p"),s.xc(3),s.Vb(),s.Wb(4,"app-search-filter",2),s.ec("filterTypeChanged",(function(t){return e.changeFilterProps(t)})),s.Vb(),s.Vb(),s.wc(5,P,3,4,"div",3),s.wc(6,k,1,0,"app-loading",4),s.wc(7,_,7,5,"pagination-template",5),s.wc(8,S,2,0,"h1",6),s.Vb()),2&t&&(s.Hb(1),s.vc("visibility",e.loading?"hidden":"unset"),s.Hb(2),s.zc("showing ",null==e.searchResult?null:e.searchResult.total_count," available repository results"),s.Hb(1),s.vc("visibility",(null==e.searchResult||null==e.searchResult.items?null:e.searchResult.items.length)>0?"unset":"hidden"),s.Hb(1),s.mc("ngIf",!e.loading),s.Hb(1),s.mc("ngIf",e.loading),s.Hb(1),s.mc("ngIf",(null==e.searchResult||null==e.searchResult.items?null:e.searchResult.items.length)>0),s.Hb(1),s.mc("ngIf",0===(null==e.searchResult||null==e.searchResult.items?null:e.searchResult.items.length)))},directives:[b,i.k,i.j,v,y.a,w.c],pipes:[w.b],styles:["[_nghost-%COMP%]{display:block}.top-bar[_ngcontent-%COMP%]{display:flex;border-bottom:1px dotted #ccc;margin:15px 15px 5px}.flex-container[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;height:100%;justify-content:center}.flex-container[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-size:51px;margin:auto}pagination-template[_ngcontent-%COMP%]{display:block}pagination-template[_ngcontent-%COMP%] nav[_ngcontent-%COMP%]{max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;margin:10px 10px 10px auto}app-search-filter[_ngcontent-%COMP%]{margin-left:auto;margin-top:-15px}.content-not-found-text[_ngcontent-%COMP%]{font-size:35px;padding-left:31%;padding-top:8%}"]}),t})()}];let M=(()=>{class t{}return t.\u0275mod=s.Pb({type:t}),t.\u0275inj=s.Ob({factory:function(e){return new(e||t)},imports:[[c.d.forChild(I)],c.d]}),t})();var R=n("PCNd");let F=(()=>{class t{}return t.\u0275mod=s.Pb({type:t}),t.\u0275inj=s.Ob({factory:function(e){return new(e||t)},imports:[[i.b,R.a,M,w.a]]}),t})()}}]);