import{inject as P,watch as V,resolveComponent as u,createBlock as s,openBlock as i,withCtx as t,createElementBlock as E,createCommentVNode as m,createElementVNode as g,withDirectives as $,toDisplayString as h,unref as r,createVNode as n,createTextVNode as d,renderSlot as j,vShow as A}from"/vue.js";import"./nc-main.DEgIQeOo.js";import"./service-worker.DGZzV4eE.js";const G={key:0,class:"nc-modal ui dimmer modals page visible transition active nc-center-screen",style:{display:"flex !important",width:"100%"}},F={class:"ui modal visible active front transition",style:{width:"auto"}},H={key:0,class:"header"},L={class:"content"},M={class:"actions"},J=Object.assign({name:"nc-modal"},{__name:"nc-modal",props:{show:{type:Boolean,default:!1},closeOnClick:{type:Boolean,default:!1},header:{type:String,default:void 0},content:{type:String,default:void 0},cancelText:{type:String,default:void 0},okText:{type:String,default:void 0}},emits:["modal-cancel","modal-ok"],setup(c,{emit:S}){const y=P("state"),a=y.rec;y.hdr;const w=S,_=c;function T(o){o.preventDefault(),o.stopPropagation(),v()}V(()=>_.show,o=>{o===!0&&(_.closeOnClick===!0?document.documentElement.addEventListener("click",T,{once:!0}):document.documentElement.style.setProperty("--pointer-events","none"))});let f=null;function b(o,e,p,l){l?f=y.grid?.[o]?.data?.[e-1]:f=null}function B(o,e,p){b(o,e,p,!0),v()}function D(){document.documentElement.style.setProperty("--pointer-events","auto"),w("modal-cancel",f)}function v(){document.documentElement.style.setProperty("--pointer-events","auto"),w("modal-ok",f)}return(o,e)=>{const p=u("nc-label"),l=u("nc-row"),k=u("nc-radio"),N=u("nc-label-dropdown"),C=u("nc-label-input"),O=u("nc-grid"),x=u("nc-button");return i(),s(l,{height:"0px"},{default:t(()=>[c.show===!0?(i(),E("div",G,[g("div",F,[c.header?(i(),E("div",H,h(c.header),1)):m("",!0),g("div",L,[r(a).apply?(i(),s(l,{key:0},{default:t(()=>[n(l,null,{default:t(()=>[n(p,{hdr:"hdr.apply.action"},{default:t(()=>[...e[2]||(e[2]=[d("Action",-1)])]),_:1})]),_:1}),n(l,{class:"nc-margin-top nc-space-between",width:"40em"},{default:t(()=>[n(k,{model:"rec.apply.action",value:"add",hdr:"hdr.apply.add"},{default:t(()=>[...e[3]||(e[3]=[d("Add",-1)])]),_:1}),n(k,{model:"rec.apply.action",value:"remove",hdr:"hdr.apply.remove"},{default:t(()=>[...e[4]||(e[4]=[d("Remove",-1)])]),_:1}),n(k,{model:"rec.apply.action",value:"modify",hdr:"hdr.apply.modify"},{default:t(()=>[...e[5]||(e[5]=[d("Modify",-1)])]),_:1})]),_:1}),n(l,{class:"nc-margin-top"},{default:t(()=>[n(N,{model:"rec.apply.field",hdr:"hdr.apply.field"},{default:t(()=>[...e[6]||(e[6]=[d("Field",-1)])]),_:1})]),_:1}),r(a).apply.action==="modify"?(i(),s(l,{key:0,class:"nc-margin-top"},{default:t(()=>[n(C,{model:"rec.apply.old_value",hdr:"hdr.apply.old_value"},{default:t(()=>[...e[7]||(e[7]=[d("Old value",-1)])]),_:1})]),_:1})):m("",!0),n(l,{class:"nc-margin-top"},{default:t(()=>[n(C,{model:"rec.apply.new_value",hdr:"hdr.apply.new_value"},{default:t(()=>[...e[8]||(e[8]=[d("New value",-1)])]),_:1})]),_:1})]),_:1})):m("",!0),r(a).link_grid?(i(),s(l,{key:1},{default:t(()=>[n(l,null,{default:t(()=>[n(p,{hdr:"hdr.link_grid.header"},{default:t(()=>[...e[9]||(e[9]=[d("Header",-1)])]),_:1})]),_:1}),n(l,null,{default:t(()=>[n(O,{id:"link_grid",model:"grid.link_grid",height:"60vh",onGridRowClicked:b,onGridRowDoubleClicked:B})]),_:1})]),_:1})):(i(),s(l,{key:2},{default:t(()=>[j(o.$slots,"default")]),_:3}))]),$(g("div",M,[c.cancelText?(i(),s(x,{key:0,class:"deny nc-modal-button",onClick:e[0]||(e[0]=R=>D())},{default:t(()=>[d(h(c.cancelText),1)]),_:1})):m("",!0),n(x,{class:"approve nc-modal-button",disabled:r(a).apply&&r(a).apply.new_value===""||r(a).apply&&r(a).apply.action==="modify"&&r(a).apply.old_value==="",onClick:e[1]||(e[1]=R=>v())},{default:t(()=>[d(h(c.okText),1)]),_:1},8,["disabled"])],512),[[A,_.closeOnClick!==!0]])])])):m("",!0)]),_:3})}}});export{J as default};
