UNPKG

@rero/rero-ils-ui

Version:

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

2 lines (1 loc) 2.11 kB
import{a as l}from"./chunk-CGU6MK6Q.js";import{U as c,j as n}from"./chunk-4GRLSOJZ.js";import{fc as i}from"./chunk-MTJX6JRK.js";import{r,v as s}from"./chunk-3WD6XLXL.js";var y=()=>new o().getTypes(),f=[{path:"",component:i,title:"Entities"}],o=class extends l{constructor(){super(...arguments),this.name="entities",this.recordType="local_entities",this._options=[{label:"Relevance",value:"bestmatch",defaultQuery:!0},{label:"Date (newest)",value:"-created"},{label:"Date (oldest)",value:"created"},{label:"Name",value:"fr_name"}]}getTypes(){return[{key:"entities",index:"entities",label:"Entities",component:c,canAdd:()=>r({can:this.routeToolService.appStore.canAccess(n.LOCENT_CREATE),routerLink:["/records",this.recordType,"new"]}),canUpdate:e=>this._buildUpdatePermission(e),canDelete:e=>this._buildDeletePermission(e),aggregationsName:{resource_type:"Source",type:"Type",source_catalog:"Source catalog"},showFacetsIfNoResults:!1,allowEmptySearch:!0,aggregationsOrder:["resource_type","type","source_catalog"],aggregationsExpand:["resource_type","type","source_catalog"],aggregationsBucketSize:10,itemHeaders:{Accept:"application/rero+json, application/json"},listHeaders:{Accept:"application/rero+json, application/json"},sortOptions:this._sortOptions()}]}_buildUpdatePermission(e){return e.metadata.resource_type!=="local"?r({can:!1,message:""}):this.routeToolService.permissions(e,this.recordType).pipe(s(t=>({can:t?.canUpdate?.can||!1,message:t?.canUpdate?.message||"",routerLink:["/records",this.recordType,"edit",e.metadata.pid]})))}_buildDeletePermission(e){return e.metadata.resource_type!=="local"?r({can:!1,message:""}):this.routeToolService.permissions(e,this.recordType).pipe(s(t=>({can:t?.canDelete?.can||!1,message:t?.canDelete?.message||"",type:this.recordType})))}_sortOptions(){let e=this._options;return this.routeToolService.translateService.onLangChange.subscribe(t=>{let a=e.findIndex(p=>p.label==="Name");switch(t.lang){case"de":e[a].value="de_name";break;case"en":e[a].value="en_name";break;case"it":e[a].value="it_name";break;default:e[a].value="fr_name"}}),e}};export{y as a,f as b};