Files
nextcloud-server-mirror/dist/ProfilesCustomPicker-CfrGVWpg.chunk.mjs
nextcloud-command 230b14978e chore(assets): Recompile assets
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-06-22 18:44:49 +00:00

3 lines
4.3 KiB
JavaScript

import{c as d}from"./index-D-iKxf2E.chunk.mjs";import{b as h,c as m,d as C}from"./index-C6ey-Mhx.chunk.mjs";import{N as _}from"./logger-D3RVzcfQ-B261d025.chunk.mjs";import{N as I}from"./NcEmptyContent-CGAPqk4S-q4HLj68a.chunk.mjs";import{N as S}from"./index-C13i_MTM.chunk.mjs";import{A as U,l as g}from"./logger-CjkGH-x3.chunk.mjs";import{A as R}from"./ArrowRight-BgQTbtKu.chunk.mjs";import{_ as A}from"./public-C1mLBHT3.chunk.mjs";import{r as s,o as b,f as O,g as a,t as f,k as c,w as u,j as y,c as x,h as T}from"./Web-ByHSuvRG.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";import"./TrashCanOutline-CW4_EEhq.chunk.mjs";const $={name:"ProfilesCustomPicker",components:{NcSelect:S,NcButton:_,NcEmptyContent:I,AccountOutline:U,ArrowRightIcon:R},props:{providerId:{type:String,required:!0},accessible:{type:Boolean,default:!1}},emits:["submit"],data(){return{searchQuery:"",loading:!1,resultUrl:null,reference:null,profiles:[],selectedProfile:null,abortController:null}},computed:{options(){return this.searchQuery!==""?this.profiles:[]},noResultText(){return this.loading?t("profile","Searching …"):t("profile","Not found")}},mounted(){this.focusOnInput()},methods:{focusOnInput(){this.$nextTick(()=>{this.$refs["profiles-search-input"].$el.getElementsByTagName("input")[0]?.focus()})},async searchForProfile(e){e.trim()===""||e.trim().length<3||(this.searchQuery=e.trim(),this.loading=!0,await this.debounceFindProfiles(e))},debounceFindProfiles:C(function(...e){this.findProfiles(...e)},300),async findProfiles(e){const r=m("core/autocomplete/get?search={searchQuery}&itemType=%20&itemId=%20&shareTypes[]=0&limit=20",{searchQuery:e});try{const n=await d.get(r);this.profiles=n.data.ocs.data.map(i=>({user:i.id,displayName:i.label,icon:i.icon,subtitle:i.subline,isNoUser:i.source.startsWith("users")}))}catch(n){g.error("profile_picker: error while searching for users",{error:n})}finally{this.loading=!1}},submit(){this.resultUrl=window.location.origin+h(`/u/${this.selectedProfile.user.trim().toLowerCase()}`,null,{noRewrite:!0}),this.$emit("submit",this.resultUrl),this.$el.dispatchEvent(new CustomEvent("submit",{detail:this.resultUrl,bubbles:!0}))},async resolveResult(e){this.loading=!0,this.abortController=new AbortController,this.selectedProfile=e,this.resultUrl=window.location.origin+h(`/u/${this.selectedProfile.user.trim().toLowerCase()}`,null,{noRewrite:!0});try{const r=await d.get(m("references/resolve",2)+"?reference="+encodeURIComponent(this.resultUrl),{signal:this.abortController.signal});this.reference=r.data.ocs.data.references[this.resultUrl]}catch(r){g.error("profile_picker: error resolving the user profile link",{error:r})}finally{this.loading=!1}},clearSelection(){this.selectedProfile=null,this.resultUrl=null,this.reference=null}}},B={class:"profile-picker"},E={class:"profile-picker__heading"},Q={class:"input-wrapper"},F={class:"profile-picker__footer"};function V(e,r,n,i,o,l){const w=s("NcSelect"),P=s("AccountOutline"),k=s("NcEmptyContent"),N=s("ArrowRightIcon"),v=s("NcButton");return b(),O("div",B,[a("div",E,[a("h2",null,f(e.t("profile","Profile picker")),1),a("div",Q,[c(w,{ref:"profiles-search-input",modelValue:o.selectedProfile,"onUpdate:modelValue":r[0]||(r[0]=p=>o.selectedProfile=p),inputId:"profiles-search",loading:o.loading,filterable:!1,placeholder:e.t("profile","Search for a user profile"),clearSearchOnBlur:()=>!1,multiple:!1,options:l.options,label:"displayName",onSearch:l.searchForProfile,"onOption:selecting":l.resolveResult},{"no-options":u(({search:p})=>[y(f(p?l.noResultText:e.t("profile","Search for a user profile. Start typing")),1)]),_:1},8,["modelValue","loading","placeholder","options","onSearch","onOption:selecting"])]),c(k,{class:"empty-content"},{icon:u(()=>[c(P,{size:20})]),_:1})]),a("div",F,[o.selectedProfile!==null?(b(),x(v,{key:0,variant:"primary","aria-label":e.t("profile","Insert selected user profile link"),disabled:o.loading||o.selectedProfile===null,onClick:l.submit},{icon:u(()=>[c(N)]),default:u(()=>[y(f(e.t("profile","Insert"))+" ",1)]),_:1},8,["aria-label","disabled","onClick"])):T("",!0)])])}const ee=A($,[["render",V],["__scopeId","data-v-5dbe4c82"]]);export{ee as default};
//# sourceMappingURL=ProfilesCustomPicker-CfrGVWpg.chunk.mjs.map