import{createElementBlock as s,openBlock as c,createElementVNode as a,renderSlot as p,Fragment as w,renderList as k,createTextVNode as _,normalizeClass as v,toDisplayString as b,inject as g,onMounted as x,ref as y}from"/vue.js";import{z as A,n as h}from"./nc-main.DEgIQeOo.js";import"./service-worker.DGZzV4eE.js";const C={name:"NcLink",props:{model:{type:Array,default:void 0,required:!0},callback:{type:Function,default:void 0,required:!0}},setup(o){const t=g("state");if(!o.model){console.error("link component, model does not exist",this);return}if(!h.isFunction(o.callback)){console.warn("link component, callback does not exist or is not a function",this);return}const r=[];return r.length===0?void 0:(x(function(){for(let i=0,u=o.model.length;i<u;i++){const e=o.model[i],n={};n.value=e,e.icon&&(n.icon=e.icon);let l=t.hdr[e.field]||"wrong field name: "+e.field,f=e.field.search("_");if(f>=0){let m=t.hdr[e.field.substr(0,f)];m&&(l=m+", "+l.toLowerCase())}h.isNil(e.show)?n.show=l+": "+e.value:e.show!==""?n.show=l+": "+e.show:n.show=l,r.push(n)}}),{dropdownArr:y(r)})}},L={class:"ui dropdown"},N={class:"menu"},$=["onClick"];function F(o,t,r,d,i,u){return c(),s("div",L,[t[0]||(t[0]=a("i",{class:"nc-no-print nc-link-icon far fa-arrow-alt-circle-right"},null,-1)),a("div",N,[(c(!0),s(w,null,k(d.dropdownArr,e=>(c(),s("div",{key:e.value,class:"item",onClick:n=>r.callback(e.value)},[a("i",{class:v(e.icon)},null,2),_(" "+b(e.show),1)],8,$))),128))]),p(o.$slots,"default")])}const E=A(C,[["render",F]]);export{E as default};
