You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
7.0 MiB

  1. (self.webpackChunknextcloud_ui_legacy=self.webpackChunknextcloud_ui_legacy||[]).push([[4208],{8:(e,t,n)=>{"use strict";n.d(t,{N:()=>g});var a=n(39841),r=n(418),i=n(3168),o=n(83194),s=n(28881),l=n(19051),d=n(63814),u=n(51431);function c(e){let t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(let n=0;n<e.attributes.length;n++){const a=e.attributes.item(n);t["@attributes"][a.nodeName]=a.nodeValue}}}else 3===e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(let n=0;n<e.childNodes.length;n++){const a=e.childNodes.item(n),r=a.nodeName;if(void 0===t[r])t[r]=c(a);else{if(void 0===t[r].push){const e=t[r];t[r]=[],t[r].push(e)}t[r].push(c(a))}}return t}function h(e){const t=c(function(e){let t=null;try{t=(new DOMParser).parseFromString(e,"text/xml")}catch(e){i.l.error("Failed to parse xml document",e)}return t}(e)),n=t["d:multistatus"]["d:response"],a=[];for(const e in n){const t=n[e]["d:propstat"];"HTTP/1.1 200 OK"===t["d:status"]["#text"]&&a.push({id:parseInt(t["d:prop"]["oc:id"]["#text"]),displayName:t["d:prop"]["oc:display-name"]["#text"],canAssign:"true"===t["d:prop"]["oc:can-assign"]["#text"],userAssignable:"true"===t["d:prop"]["oc:user-assignable"]["#text"],userVisible:"true"===t["d:prop"]["oc:user-visible"]["#text"]})}return a}(0,r.r)(r.k);const p={name:"NcSelectTags",components:{NcEllipsisedOption:o.A,NcSelect:s.N},model:{prop:"modelValue",event:"update:modelValue"},props:{...s.N.props,fetchTags:{type:Boolean,default:!0},getOptionLabel:{type:Function,default:e=>{const{displayName:t,userVisible:n,userAssignable:a}=e;return!1===n?(0,r.a)("{tag} (invisible)",{tag:t}):!1===a?(0,r.a)("{tag} (restricted)",{tag:t}):t}},limit:{type:Number,default:5},multiple:{type:Boolean,default:!0},optionsFilter:{type:Function,default:null},passthru:{type:Boolean,default:!1},placeholder:{type:String,default:(0,r.a)("Select a tag")},value:{type:[Number,Array,Object],default:void 0},modelValue:{type:[Number,Array,Object],default:null}," ":{}},emits:["input","update:modelValue","update:model-value"," "],setup:()=>({model:(0,a.u)("value","input"),noop:()=>{}}),data:()=>({search:"",availableTags:[]}),computed:{availableOptions(){return this.optionsFilter?this.tags.filter(this.optionsFilter):this.tags},localValue(){return 0===this.tags.length?[]:this.multiple?this.model.filter(e=>""!==e).map(e=>this.tags.find(t=>t.id===e)):this.tags.find(e=>e.id===this.model)},propsToForward(){const{fetchTags:e,optionsFilter:t,passthru:n,...a}=this.$props;return a},tags(){return this.fetchTags?this.availableTags:this.options}},async created(){if(this.fetchTags)try{const e=await async function(){return window.NextcloudVueDocs?Promise.resolve(h(window.NextcloudVueDocs.tags)):h((await(0,l.Ay)({method:"PROPFIND",url:(0,d.dC)("dav")+"/systemtags/",data:'<?xml version="1.0"?>\n\t\t\t\t\t<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t\t\t\t\t <d:prop>\n\t\t\t\t\t\t<oc:id />\n\t\t\t\t\t\t<oc:display-name />\n\t\t\t\t\t\t<oc:user-visible />\n\t\t\t\t\t\t<oc:user-assignable />\n\t\t\t\t\t\t<oc:can-assign />\n\t\t\t\t\t </d:prop>\n\t\t\t\t\t</d:propfind>'})).data)}();this.availableTags=e}catch(e){i.l.error("Loading systemtags failed",e)}},methods:{handleInput(e){this.multiple?this.model=e.map(e=>e.id):this.model=null===e?null:e.id}}};var m=function(){var e=this,t=e._self._c;return t("NcSelect",e._g(e._b({attrs:{options:e.availableOptions,"close-on-select":!e.multiple,value:e.passthru?e.model:e.localValue},on:{search:t=>e.search=t},scopedSlots:e._u([{key:"option",fn:function(n){return[t("NcEllipsisedOption",{attrs:{name:e.getOptionLabel(n),search:e.search}})]}},{key:"selected-option",fn:function(n){return[t("NcEllipsisedOption",{attrs:{name:e.getOptionLabel(n),search:e.search}})]}},e._l(e.$scopedSlots,function(t,n){return{key:n,fn:function(t){return[e._t(n,null,null,t)]}}})],null,!0)},"NcSelect",e.propsToForward,!1),{...e.$listeners,input:e.passthru?e.$listeners.input:e.noop,"update:modelValue":e.passthru?e.$listeners["update:modelValue"]:e.handleInput,"update:model-value":e.passthru?e.$listeners["update:model-value"]:e.noop}))},f
  2. //# sourceMappingURL=core-common.js.map?v=8a297fd70174219d4e3a