UNPKG

@rero/rero-ils-ui

Version:

User interface for RERO integrated library system (RERO ILS).

2 lines (1 loc) 6.91 kB
import{$a as q,C as j,D as c,Ga as E,Ha as f,I as v,Ja as M,Na as O,Q as h,R as y,S as D,Sa as z,T as A,U as R,Ua as V,V as u,W as p,X as l,Y as d,ab as $,bb as G,cb as H,da as b,db as K,f as x,fa as S,fb as Q,g as m,ga as C,hb as J,ib as L,ja as F,jb as Z,ka as T,kb as g,oa as P,p as N,pa as _,t as a,va as k,z as U,za as I}from"./chunk-SU7KVPJ5.js";var X=(()=>{let e=class e extends ${constructor(){super(...arguments),this.httpClient=a(k),this.appConfigService=a(g)}getAvailability(r,n=null){let o=`${this.appConfigService.apiEndpointPrefix}/document/${r}/availability`;return n&&(o+=`?view_code=${n}`),this.httpClient.get(o)}};e.\u0275fac=(()=>{let r;return function(o){return(r||(r=U(e)))(o||e)}})(),e.\u0275prov=N({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function te(t,e){if(t&1&&(p(0,"li"),S(1),l()),t&2){let i=e.$implicit;c(),C(i.value)}}function ie(t,e){if(t&1&&(p(0,"ul",7),A(1,te,2,1,"li",null,D),l()),t&2){let i=b();c(),R(i.provisionActivityPublications)}}function re(t,e){if(t&1&&(p(0,"li"),S(1),l()),t&2){let i=e.$implicit;c(),C(i._text[0].value)}}function oe(t,e){if(t&1&&(p(0,"ul",7),A(1,re,2,1,"li",null,D),l()),t&2){let i=b();c(),R(i.record().metadata.editionStatement)}}function ne(t,e){if(t&1&&d(0,"shared-availability",9),t&2){let i=b();u("record",i.record())("apiService",i.documentApiService)("viewcode",i.viewcode())}}var Y=(()=>{let e=class e{constructor(){this.route=a(f),this.documentApiService=a(X),this.record=_.required(),this.type=_.required(),this.detailUrl=_(),this.viewcode=O(this.route.params.pipe(m(r=>r.viewcode))),this.recordDetailUrl=P(()=>this.detailUrl()?.link.replace(":viewcode",this.viewcode()))}get provisionActivityPublications(){let r=this.record()?.metadata;if(!r)return[];let{provisionActivity:n}=r,o=[];return n===void 0||n.map(s=>{s.type==="bf:Publication"&&"_text"in s&&s._text.map(w=>o.push(w))}),o}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=v({type:e,selectors:[["public-search-document-brief"]],inputs:{record:[1,"record"],type:[1,"type"],detailUrl:[1,"detailUrl"]},decls:14,vars:15,consts:[[1,"ui:flex","ui:gap-6"],[1,"ui:hidden","ui:md:block"],[3,"record"],[1,"ui:grow"],[1,"ui:mb-1"],["target","_self",3,"href"],[3,"contributions","view"],[1,"ui:list-none"],[3,"record","viewcode","isPublicView"],["recordType","document",3,"record","apiService","viewcode"]],template:function(n,o){if(n&1&&(p(0,"article",0)(1,"div",1),d(2,"shared-thumbnail",2),l(),p(3,"div",3)(4,"h4",4)(5,"a",5),F(6,"safeUrl"),S(7),F(8,"mainTitle"),l()(),d(9,"shared-contribution",6),h(10,ie,3,0,"ul",7),d(11,"shared-part-of",8),h(12,oe,3,0,"ul",7),h(13,ne,1,3,"shared-availability",9),l()()),n&2){let s;c(2),u("record",o.record()),c(3),u("href",T(6,11,o.recordDetailUrl()),j),c(2),C(T(8,13,o.record().metadata.title)),c(2),u("contributions",(s=o.record().metadata)==null?null:s.contribution)("view",o.viewcode()),c(),y(o.provisionActivityPublications.length>0?10:-1),c(),u("record",o.record())("viewcode",o.viewcode())("isPublicView",!0),c(),y(o.record().metadata.editionStatement?12:-1),c(),y(o.record().metadata.type!=="ebook"?13:-1)}},dependencies:[Z,G,L,J,H,K],encapsulation:2,changeDetection:0});let t=e;return t})();var ee=(()=>{let e=class e{constructor(){this.appConfigService=a(g),this.urlSerializer=a(E),this.route=a(f),this.router=a(M)}ngOnInit(){this.uriGlobalView=this._convertUrlForGlobalView()}_convertUrlForGlobalView(){let{queryParams:r}=this.route.snapshot,n=this.router.parseUrl(this.router.url).root.children.primary.segments.map(w=>w.path);n[0]=this.appConfigService.globalViewName;let o="/"+n.join("/"),s=this.router.createUrlTree([o],{queryParams:r});return this.urlSerializer.serialize(s)}};e.\u0275fac=function(n){return new(n||e)},e.\u0275cmp=v({type:e,selectors:[["public-search-document-record-search"]],decls:1,vars:0,template:function(n,o){n&1&&d(0,"ng-core-record-search-page")},dependencies:[q],encapsulation:2,changeDetection:0});let t=e;return t})();var ae=t=>{let e=t.params.type==="documents"?"Documents":"Authors/Subjects";return z(e)},Oe=t=>{let e=t.params.viewcode;return new B(a(g),a(f),a(I),a(V)).getTypes(e)},ze=[{path:"",title:ae,component:ee}],B=class{constructor(e,i,r,n){this.appConfigService=e,this.activatedRoute=i,this.translateService=r,this.recordService=n}getTypes(e){return[{key:"documents",component:Y,label:"Documents",aggregationsName:{online:"Online resources",not_online:"Physical resources",organisation:"Library",genreForm:"Genre, form",intendedAudience:"Intended audience",acquisition:"Acquisition date",year:"Publication year",subject:"Subject",fiction_statement:"Fiction statement"},showFacetsIfNoResults:!0,aggregationsOrder:this.aggregationsOrder(e),aggregationsExpand:()=>{let i=["document_type","fiction_statement"],{queryParams:r}=this.activatedRoute.snapshot;return this.appConfigService.globalViewName===e?(r.location||r.library)&&i.push("organisation"):r.location&&i.push("library"),i},aggregationsBucketSize:10,searchFilters:[{label:"Search in full text",filter:"fulltext",value:"true"},{label:"Show only:",filters:[{label:"Online resources",filter:"online",value:"true"},{label:"Physical resources",filter:"not_online",value:"true"}]}],processBucketName:i=>this.processBucketName(i),processFilterName:i=>this.processFilterName(i),preFilters:{view:e,simple:"1"},listHeaders:{Accept:"application/rero+json, application/json"},exportFormats:[{label:"JSON",format:"raw",endpoint:"",disableMaxRestResultsSize:!1},{label:"RIS (Zotero...)",format:"ris",endpoint:"",disableMaxRestResultsSize:!1}],sortOptions:[{label:"Relevance",value:"bestmatch",defaultQuery:!0},{label:"Date (newest)",value:"pub_date_new"},{label:"Date (oldest)",value:"pub_date_old"},{label:"Title",value:"title",defaultNoQuery:!0}]},{key:"entities",index:"entities",component:Q,label:"Authors/Subjects",aggregationsOrder:["type"],aggregationsExpand:["type"],listHeaders:{Accept:"application/rero+json, application/json"},preFilters:{view:e,simple:"1"}}]}processFilterName(e){if(e.name)return x(e.name);switch(e.aggregationKey){case"language":return this.translateService.stream(`lang_${e.key}`);case"library":return this.recordService.getRecord("libraries",e.key).pipe(m(i=>i.metadata.name));case"location":return this.recordService.getRecord("locations",e.key).pipe(m(i=>i.metadata.name));case"organisation":return this.recordService.getRecord("organisations",e.key).pipe(m(i=>i.metadata.name));default:return this.translateService.stream(e.key)}}processBucketName(e){return e.name?x(e.name):e.aggregationKey==="language"?this.translateService.stream(`lang_${e.key}`):this.translateService.stream(e.key)}aggregationsOrder(e){let i=["document_type","fiction_statement","language","year","author","subject","genreForm","intendedAudience","acquisition","status"],r=this.appConfigService.globalViewName===e?"organisation":"library";return[i[0],i[1],r,...i.slice(2)]}};export{ae as a,Oe as b,ze as c};