@rero/rero-ils-ui
Version:
User interface for RERO integrated library system (RERO ILS).
2 lines (1 loc) • 3.89 kB
JavaScript
import{a as B,c as k}from"./chunk-DWADVSH7.js";import{b as P}from"./chunk-LRFB5ZDQ.js";import{a as V}from"./chunk-BR2J44KJ.js";import{a as H}from"./chunk-CGU6MK6Q.js";import{j as m,k as O}from"./chunk-4GRLSOJZ.js";import{J as w,Tb as A,ec as j,fc as b}from"./chunk-MTJX6JRK.js";import{a as T}from"./chunk-GQ5FIRIY.js";import{e as M,l as N,x as E}from"./chunk-L5BLWZD6.js";import{i as z}from"./chunk-4MYHQLZQ.js";import{Aa as f,Ca as g,Db as R,J as u,Vc as D,a as p,ac as v,bc as y,cc as x,da as h,gb as S,ia as n,r as i,rc as I,v as a,yb as C,yd as _}from"./chunk-3WD6XLXL.js";var c=class{constructor(e){this.label="",this.weight=100,Object.assign(this,e)}getImportEndpoint(){return this.endpoint!=null?this.endpoint:`import_${this.key}`}};var F=(()=>{class o{constructor(){this.httpClient=n(z)}getSources(){return this.httpClient.get("/api/imports/config/").pipe(a(t=>t.map(r=>new c(r))),u(()=>[]))}static{this.\u0275fac=function(r){return new(r||o)}}static{this.\u0275prov=h({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();var $=(()=>{class o extends b{constructor(){super(),this.defaultOptions={name:"10",size:10},this.optionsValues=[{name:"10",size:10},{name:"20",size:20},{name:"50",size:50}],this.options=f(this.optionsValues),this.maxRecordsSelected=_(this.defaultOptions),g(()=>{if(this.maxRecordsSelected().size!==this.store.size()){this.store.updateSize(this.maxRecordsSelected().size);let t=this.optionsValues.find(r=>r.size===this.store.size());if(!t){t={name:String(this.store.size()),size:this.store.size()};let r=[t,...this.optionsValues].sort((s,d)=>s.size-d.size);this.options.set(r)}this.maxRecordsSelected.set(t)}})}static{this.\u0275fac=function(r){return new(r||o)}}static{this.\u0275cmp=C({type:o,selectors:[["admin-import-record-search"]],inputs:{maxRecordsSelected:[1,"maxRecordsSelected"]},outputs:{maxRecordsSelected:"maxRecordsSelectedChange"},features:[D([A]),R],decls:2,vars:2,consts:[[1,"core:my-1"],["afterInputSearch","","optionLabel","name",3,"ngModelChange","options","ngModel"]],template:function(r,s){r&1&&(y(0,"ng-core-record-search",0)(1,"p-select",1),I("ngModelChange",function(G){return s.maxRecordsSelected.set(G)}),x()()),r&2&&(S(),v("options",s.options())("ngModel",s.maxRecordsSelected()))},dependencies:[j,w,E,M,N],encapsulation:2,changeDetection:0})}}return o})();var Re=()=>new l().getTypeConfigs(),ve=[{path:"",component:$,title:"Import from the web",canActivate:[V],data:{permissions:[m.DOC_ACCESS,m.DOC_SEARCH],operator:O.AND}},{path:"detail/:pid",component:k,title:"Import"}],l=class extends H{constructor(){super(...arguments),this.translateService=n(T),this.importSourceApiService=n(F),this._baseTypeConfig={component:P,detailComponent:B,canAdd:()=>i(!1),canUpdate:()=>i(!1),canDelete:()=>i(!1),processBucketName:e=>this.processName(e),processFilterName:e=>this.processName(e),resultsText:e=>this.getResultsText(e),aggregationsBucketSize:10,aggregationsOrder:["document_type","author","language","year"],aggregationsExpand:["document_type","author","language","year"],itemHeaders:{Accept:"application/rero+json, application/json"},listHeaders:{Accept:"application/rero+json, application/json"},allowEmptySearch:!1,showFacetsIfNoResults:!0}}getTypeConfigs(){return this.importSourceApiService.getSources().pipe(a(e=>e.map(t=>this._loadConfigSource(t))))}getResultsText(e){let t=this.routeToolService.recordService.totalHits(e.total)||0;return t===0?this.translateService.instant("no result"):this.translateService.instant("{{ total }} results of {{ remoteTotal }}",{total:t,remoteTotal:e.remote_total})}_loadConfigSource(e){let t={key:e.getImportEndpoint(),label:e.label};return p(p({},this._baseTypeConfig),t)}processName(e){return e.name?i(e.name):e.aggregationKey==="language"?i(this.routeToolService.translateService.instant(`lang_${e.key}`)):this.routeToolService.translateService.stream(e.key)}};export{Re as a,ve as b};