@syntify/office 0.1.2-beta.2 → 0.1.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8909,7 +8909,7 @@ const H_ = { class: "synt-office-relation-wrapper" }, Z_ = { class: "synt-office
|
|
|
8909
8909
|
j.value += 10, await Jg(), Dt.scrollTop = en;
|
|
8910
8910
|
}
|
|
8911
8911
|
}, Fe = async () => {
|
|
8912
|
-
|
|
8912
|
+
await $();
|
|
8913
8913
|
}, At = async (te) => {
|
|
8914
8914
|
Array.isArray(T.value) && (T.value.includes(te) ? T.value = T.value.filter((Dt) => Dt !== te) : T.value.push(te)), await $();
|
|
8915
8915
|
}, Ee = xr(() => {
|
|
@@ -58,4 +58,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
58
58
|
* @license MIT licensed
|
|
59
59
|
*
|
|
60
60
|
* Copyright (C) 2018 Varun A P
|
|
61
|
-
*/var o0=El.exports,bg;function u0(){return bg||(bg=1,function(g){(function(w,l){g.exports?g.exports=l():w.Toastify=l()})(o0,function(w){var l=function(b){return new l.lib.init(b)},z="1.12.0";l.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,ariaLive:"polite",style:{background:""}},l.lib=l.prototype={toastify:z,constructor:l,init:function(b){return b||(b={}),this.options={},this.toastElement=null,this.options.text=b.text||l.defaults.text,this.options.node=b.node||l.defaults.node,this.options.duration=b.duration===0?0:b.duration||l.defaults.duration,this.options.selector=b.selector||l.defaults.selector,this.options.callback=b.callback||l.defaults.callback,this.options.destination=b.destination||l.defaults.destination,this.options.newWindow=b.newWindow||l.defaults.newWindow,this.options.close=b.close||l.defaults.close,this.options.gravity=b.gravity==="bottom"?"toastify-bottom":l.defaults.gravity,this.options.positionLeft=b.positionLeft||l.defaults.positionLeft,this.options.position=b.position||l.defaults.position,this.options.backgroundColor=b.backgroundColor||l.defaults.backgroundColor,this.options.avatar=b.avatar||l.defaults.avatar,this.options.className=b.className||l.defaults.className,this.options.stopOnFocus=b.stopOnFocus===void 0?l.defaults.stopOnFocus:b.stopOnFocus,this.options.onClick=b.onClick||l.defaults.onClick,this.options.offset=b.offset||l.defaults.offset,this.options.escapeMarkup=b.escapeMarkup!==void 0?b.escapeMarkup:l.defaults.escapeMarkup,this.options.ariaLive=b.ariaLive||l.defaults.ariaLive,this.options.style=b.style||l.defaults.style,b.backgroundColor&&(this.options.style.background=b.backgroundColor),this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var b=document.createElement("div");b.className="toastify on "+this.options.className,this.options.position?b.className+=" toastify-"+this.options.position:this.options.positionLeft===!0?(b.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):b.className+=" toastify-right",b.className+=" "+this.options.gravity,this.options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');for(var k in this.options.style)b.style[k]=this.options.style[k];if(this.options.ariaLive&&b.setAttribute("aria-live",this.options.ariaLive),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)b.appendChild(this.options.node);else if(this.options.escapeMarkup?b.innerText=this.options.text:b.innerHTML=this.options.text,this.options.avatar!==""){var W=document.createElement("img");W.src=this.options.avatar,W.className="toastify-avatar",this.options.position=="left"||this.options.positionLeft===!0?b.appendChild(W):b.insertAdjacentElement("afterbegin",W)}if(this.options.close===!0){var Q=document.createElement("button");Q.type="button",Q.setAttribute("aria-label","Close"),Q.className="toast-close",Q.innerHTML="✖",Q.addEventListener("click",(function(q){q.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}).bind(this));var ce=window.innerWidth>0?window.innerWidth:screen.width;(this.options.position=="left"||this.options.positionLeft===!0)&&ce>360?b.insertAdjacentElement("afterbegin",Q):b.appendChild(Q)}if(this.options.stopOnFocus&&this.options.duration>0){var le=this;b.addEventListener("mouseover",function(q){window.clearTimeout(b.timeOutValue)}),b.addEventListener("mouseleave",function(){b.timeOutValue=window.setTimeout(function(){le.removeElement(b)},le.options.duration)})}if(typeof this.options.destination<"u"&&b.addEventListener("click",(function(q){q.stopPropagation(),this.options.newWindow===!0?window.open(this.options.destination,"_blank"):window.location=this.options.destination}).bind(this)),typeof this.options.onClick=="function"&&typeof this.options.destination>"u"&&b.addEventListener("click",(function(q){q.stopPropagation(),this.options.onClick()}).bind(this)),typeof this.options.offset=="object"){var j=L("x",this.options),$=L("y",this.options),Z=this.options.position=="left"?j:"-"+j,ze=this.options.gravity=="toastify-top"?$:"-"+$;b.style.transform="translate("+Z+","+ze+")"}return b},showToast:function(){this.toastElement=this.buildToast();var b;if(typeof this.options.selector=="string"?b=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||typeof ShadowRoot<"u"&&this.options.selector instanceof ShadowRoot?b=this.options.selector:b=document.body,!b)throw"Root element is not defined";var k=l.defaults.oldestFirst?b.firstChild:b.lastChild;return b.insertBefore(this.toastElement,k),l.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout((function(){this.removeElement(this.toastElement)}).bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(b){b.className=b.className.replace(" on",""),window.setTimeout((function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),b.parentNode&&b.parentNode.removeChild(b),this.options.callback.call(b),l.reposition()}).bind(this),400)}},l.reposition=function(){for(var b={top:15,bottom:15},k={top:15,bottom:15},W={top:15,bottom:15},Q=document.getElementsByClassName("toastify"),ce,le=0;le<Q.length;le++){P(Q[le],"toastify-top")===!0?ce="toastify-top":ce="toastify-bottom";var j=Q[le].offsetHeight;ce=ce.substr(9,ce.length-1);var $=15,Z=window.innerWidth>0?window.innerWidth:screen.width;Z<=360?(Q[le].style[ce]=W[ce]+"px",W[ce]+=j+$):P(Q[le],"toastify-left")===!0?(Q[le].style[ce]=b[ce]+"px",b[ce]+=j+$):(Q[le].style[ce]=k[ce]+"px",k[ce]+=j+$)}return this};function L(b,k){return k.offset[b]?isNaN(k.offset[b])?k.offset[b]:k.offset[b]+"px":"0px"}function P(b,k){return!b||typeof k!="string"?!1:!!(b.className&&b.className.trim().split(/\s+/gi).indexOf(k)>-1)}return l.lib.init.prototype=l.lib,l})}(El)),El.exports}u0();function l0(g){const[w,l,z]=g.relation.definition.split(":"),L=g.relation.api[l],P=s.ref(!1),b=s.ref([]),k=s.ref({limit:99999,page:1});return{options:b,isLoading:P,finalQuery:k,fetchData:async()=>{P.value=!0;try{const W=s.computed(()=>({limit:k.value.limit,page:k.value.page,filter:JSON.stringify(g.query)}));await L.get(`/api/${z}`,{params:W.value}).then(Q=>Q.data).then(Q=>{Q.code==200&&(b.value=Q==null?void 0:Q.data)})}catch(W){console.error("Error fetching data:",W)}finally{P.value=!1}}}}const a0={class:"synt-office-relation-wrapper"},s0={class:"synt-office-relation-label"},f0={class:"synt-office-relation-note"},c0={class:"synt-office-relation-group-input-wrapper"},h0={class:"synt-office-relation-input-wrapper"},p0={class:"synt-office-relation-skeleton-wrapper"},d0={key:0,class:"synt-office-relation-modal-overlay"},g0={class:"synt-office-relation-modal-wrapper"},_0={class:"synt-office-relation-modal-header-end"},v0={class:"synt-office-relation-modal-option"},m0={class:"synt-office-relation-modal-table-wrapper"},y0={id:"table-relation-collection"},w0=["checked"],b0={class:"synt-office-relation-modal-table-label"},x0=["checked","onChange"],E0={class:"synt-badge-tabel"},C0={class:"synt-office-relation-modal-table-footer"},A0={class:"synt-office-relation-modal-table-footer-end"},S0={class:"synt-office-relation-font-bold"},O0={class:"synt-office-relation-font-bold"},L0=s.defineComponent({__name:"OfficeRelation",props:s.mergeModels({fields:{},isDisabled:{},isError:{},query:{}},{modelValue:{},modelModifiers:{}}),emits:s.mergeModels(["update:selected"],["update:modelValue"]),setup(g,{emit:w}){const l=g,z=w,L=s.useModel(g,"modelValue"),{options:P,isLoading:b,fetchData:k}=l0({relation:l.fields.relation,query:l.query}),W=s.ref(""),Q=s.ref(500),ce=s.ref(null),le=s.ref(null),j=s.ref(!1),$=s.computed(()=>{var ee,re;return(re=(ee=l.fields)==null?void 0:ee.options)==null?void 0:re.isMultiple}),Z=s.computed(()=>{var ee;return(ee=P.value)==null?void 0:ee.filter(re=>{var Lt,Zt,wn,Yt;return(Yt=(wn=re==null?void 0:re[(Zt=(Lt=l.fields)==null?void 0:Lt.relation)==null?void 0:Zt.display])==null?void 0:wn.toLowerCase())==null?void 0:Yt.includes(W.value)})}),ze=s.computed(()=>Z.value.slice(0,Q.value)),q=s.computed(()=>ze.value.length<Z.value.length),ae=s.computed(()=>{var ee;return((ee=P.value)==null?void 0:ee.find(re=>re.id===L.value))||null});s.watch(ae,ee=>{z("update:selected",ee)});const Tt=async([{isIntersecting:ee,target:re}])=>{if(ee){const Lt=re.offsetParent,Zt=Lt.scrollTop;Q.value+=10,await s.nextTick(),Lt.scrollTop=Zt}},$e=async()=>{P.value.length||await k()},vt=async ee=>{Array.isArray(L.value)&&(L.value.includes(ee)?L.value=L.value.filter(Lt=>Lt!==ee):L.value.push(ee)),await k()},Oe=s.computed(()=>{if(Array.isArray(L.value))return Z.value.length>0&&Z.value.every(ee=>Array.isArray(L.value)&&L.value.includes(ee.id))});function mt(){if(Array.isArray(L.value))if(Oe.value)L.value=L.value.filter(ee=>!Z.value.map(re=>re.id).includes(ee));else{const ee=Z.value.map(re=>re.id);L.value=Array.from(new Set([...L.value,...ee]))}}const qe=async()=>{await k(),j.value=!0},Nt=async()=>{W.value="",j.value=!1};return s.watch(()=>L.value,async()=>{P.value.length||(b.value=!0,L.value&&await k(),b.value=!1)}),s.onMounted(async()=>{ce.value=new IntersectionObserver(Tt)}),(ee,re)=>{var Lt,Zt,wn,Yt,$i;return s.openBlock(),s.createElementBlock("div",null,[s.createElementVNode("div",a0,[s.createElementVNode("label",s0,s.toDisplayString((Lt=ee.fields)==null?void 0:Lt.name),1),s.createElementVNode("span",f0,s.toDisplayString((wn=(Zt=ee.fields)==null?void 0:Zt.options)==null?void 0:wn.note),1),s.createElementVNode("div",c0,[s.createElementVNode("div",h0,[s.withDirectives(s.createElementVNode("div",p0,re[3]||(re[3]=[s.createElementVNode("div",{class:"synt-office-relation-skeleton"},[s.createElementVNode("div",{class:"synt-office-relation-content"})],-1)]),512),[[s.vShow,s.unref(b)]]),s.createVNode(s.unref(n0),{modelValue:L.value,"onUpdate:modelValue":re[0]||(re[0]=Ht=>L.value=Ht),class:s.normalizeClass(["synt-relation-control",{"synt-office-relation-error":ee.isError,"synt-office-relation-disabled":ee.isDisabled,"synt-office-relation-normal":!ee.isError&&!ee.isDisabled}]),options:ze.value,reduce:Ht=>Ht.id,label:($i=(Yt=ee.fields)==null?void 0:Yt.relation)==null?void 0:$i.display,placeholder:"Please enter at least 3 letters...",disabled:ee.isDisabled,multiple:$.value,onOpen:$e},{option:s.withCtx(Ht=>{var Ge,Je;return[s.createElementVNode("span",null,s.toDisplayString(Ht[(Je=(Ge=ee.fields)==null?void 0:Ge.relation)==null?void 0:Je.display]),1)]}),"list-footer":s.withCtx(()=>[s.withDirectives(s.createElementVNode("li",{ref_key:"load",ref:le,class:"synt-office-relation-loading"},re[4]||(re[4]=[s.createElementVNode("i",{class:"synt-office-relation-loading-spin fa-solid fa-spinner"},null,-1)]),512),[[s.vShow,q.value]])]),_:1},8,["modelValue","class","options","reduce","label","disabled","multiple"])]),$.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"synt-office-relation-btn-expands",onClick:s.withModifiers(qe,["prevent"])},re[5]||(re[5]=[s.createElementVNode("i",{class:"synt-office-relation-btn-expands-icon fa-solid fa-up-right-and-down-left-from-center"},null,-1)]))):s.createCommentVNode("",!0)])]),s.createVNode(s.Transition,{name:"fade"},{default:s.withCtx(()=>{var Ht;return[j.value?(s.openBlock(),s.createElementBlock("div",d0,[s.createElementVNode("div",g0,[s.createVNode(s.unref(wl),{label:ee.fields.name,icon:"fa-solid fa-table"},{end:s.withCtx(()=>[s.createElementVNode("div",_0,[s.createElementVNode("button",{type:"button",class:"synt-office-relation-modal-btn-close",onClick:s.withModifiers(Nt,["prevent"])},re[6]||(re[6]=[s.createElementVNode("i",{class:"fa-solid fa-xmark"},null,-1)]))])]),_:1},8,["label"]),s.createElementVNode("div",v0,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":re[1]||(re[1]=Ge=>W.value=Ge),type:"search",placeholder:"Cari...",class:"synt-office-relation-modal-search"},null,512),[[s.vModelText,W.value]]),s.createElementVNode("button",{type:"button",class:"synt-office-relation-modal-btn-refresh",onClick:re[2]||(re[2]=s.withModifiers((...Ge)=>s.unref(k)&&s.unref(k)(...Ge),["prevent"]))},re[7]||(re[7]=[s.createElementVNode("i",{class:"synt-office-relation-modal-btn-icon fa-solid fa-sync"},null,-1)]))]),s.createElementVNode("div",m0,[s.createElementVNode("table",y0,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,[W.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("input",{key:0,type:"checkbox",class:"synt-office-relation-modal-table-checkbox",checked:Oe.value,onChange:mt},null,40,w0))]),s.createElementVNode("th",b0,s.toDisplayString((Ht=ee.fields)==null?void 0:Ht.name),1)])]),s.createElementVNode("tbody",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Z.value,Ge=>{var Je,Di;return s.openBlock(),s.createElementBlock("tr",{key:Ge.id},[s.createElementVNode("td",null,[s.createElementVNode("input",{type:"checkbox",class:"synt-office-relation-modal-table-checkbox",checked:Array.isArray(L.value)&&L.value.includes(Ge.id),onChange:yn=>vt(Ge.id)},null,40,x0)]),s.createElementVNode("td",null,[s.createElementVNode("div",E0,s.toDisplayString(Ge[(Di=(Je=ee.fields)==null?void 0:Je.relation)==null?void 0:Di.display]),1)])])}),128))])])]),s.createElementVNode("div",C0,[s.createElementVNode("div",A0,[re[8]||(re[8]=s.createElementVNode("span",{class:"synt-office-relation-font-bold"},s.toDisplayString(1),-1)),re[9]||(re[9]=s.createTextVNode(" - ")),s.createElementVNode("span",S0,s.toDisplayString(Z.value.length),1),re[10]||(re[10]=s.createTextVNode(" dari ")),s.createElementVNode("span",O0,s.toDisplayString(Z.value.length),1)])])])])):s.createCommentVNode("",!0)]}),_:1})])}}});lt.OfficeCollection=Ig,lt.OfficeCollectionTable=Xg,lt.OfficeHeader=wl,lt.OfficeLayout=bl,lt.OfficeLayoutWrapper=dg,lt.OfficeLink=Eg,lt.OfficeRelation=L0,lt.OfficeSingle=v_,lt.OfficeTab=a_,lt.OfficeTabs=u_,Object.defineProperty(lt,Symbol.toStringTag,{value:"Module"})});
|
|
61
|
+
*/var o0=El.exports,bg;function u0(){return bg||(bg=1,function(g){(function(w,l){g.exports?g.exports=l():w.Toastify=l()})(o0,function(w){var l=function(b){return new l.lib.init(b)},z="1.12.0";l.defaults={oldestFirst:!0,text:"Toastify is awesome!",node:void 0,duration:3e3,selector:void 0,callback:function(){},destination:void 0,newWindow:!1,close:!1,gravity:"toastify-top",positionLeft:!1,position:"",backgroundColor:"",avatar:"",className:"",stopOnFocus:!0,onClick:function(){},offset:{x:0,y:0},escapeMarkup:!0,ariaLive:"polite",style:{background:""}},l.lib=l.prototype={toastify:z,constructor:l,init:function(b){return b||(b={}),this.options={},this.toastElement=null,this.options.text=b.text||l.defaults.text,this.options.node=b.node||l.defaults.node,this.options.duration=b.duration===0?0:b.duration||l.defaults.duration,this.options.selector=b.selector||l.defaults.selector,this.options.callback=b.callback||l.defaults.callback,this.options.destination=b.destination||l.defaults.destination,this.options.newWindow=b.newWindow||l.defaults.newWindow,this.options.close=b.close||l.defaults.close,this.options.gravity=b.gravity==="bottom"?"toastify-bottom":l.defaults.gravity,this.options.positionLeft=b.positionLeft||l.defaults.positionLeft,this.options.position=b.position||l.defaults.position,this.options.backgroundColor=b.backgroundColor||l.defaults.backgroundColor,this.options.avatar=b.avatar||l.defaults.avatar,this.options.className=b.className||l.defaults.className,this.options.stopOnFocus=b.stopOnFocus===void 0?l.defaults.stopOnFocus:b.stopOnFocus,this.options.onClick=b.onClick||l.defaults.onClick,this.options.offset=b.offset||l.defaults.offset,this.options.escapeMarkup=b.escapeMarkup!==void 0?b.escapeMarkup:l.defaults.escapeMarkup,this.options.ariaLive=b.ariaLive||l.defaults.ariaLive,this.options.style=b.style||l.defaults.style,b.backgroundColor&&(this.options.style.background=b.backgroundColor),this},buildToast:function(){if(!this.options)throw"Toastify is not initialized";var b=document.createElement("div");b.className="toastify on "+this.options.className,this.options.position?b.className+=" toastify-"+this.options.position:this.options.positionLeft===!0?(b.className+=" toastify-left",console.warn("Property `positionLeft` will be depreciated in further versions. Please use `position` instead.")):b.className+=" toastify-right",b.className+=" "+this.options.gravity,this.options.backgroundColor&&console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');for(var k in this.options.style)b.style[k]=this.options.style[k];if(this.options.ariaLive&&b.setAttribute("aria-live",this.options.ariaLive),this.options.node&&this.options.node.nodeType===Node.ELEMENT_NODE)b.appendChild(this.options.node);else if(this.options.escapeMarkup?b.innerText=this.options.text:b.innerHTML=this.options.text,this.options.avatar!==""){var W=document.createElement("img");W.src=this.options.avatar,W.className="toastify-avatar",this.options.position=="left"||this.options.positionLeft===!0?b.appendChild(W):b.insertAdjacentElement("afterbegin",W)}if(this.options.close===!0){var Q=document.createElement("button");Q.type="button",Q.setAttribute("aria-label","Close"),Q.className="toast-close",Q.innerHTML="✖",Q.addEventListener("click",(function(q){q.stopPropagation(),this.removeElement(this.toastElement),window.clearTimeout(this.toastElement.timeOutValue)}).bind(this));var ce=window.innerWidth>0?window.innerWidth:screen.width;(this.options.position=="left"||this.options.positionLeft===!0)&&ce>360?b.insertAdjacentElement("afterbegin",Q):b.appendChild(Q)}if(this.options.stopOnFocus&&this.options.duration>0){var le=this;b.addEventListener("mouseover",function(q){window.clearTimeout(b.timeOutValue)}),b.addEventListener("mouseleave",function(){b.timeOutValue=window.setTimeout(function(){le.removeElement(b)},le.options.duration)})}if(typeof this.options.destination<"u"&&b.addEventListener("click",(function(q){q.stopPropagation(),this.options.newWindow===!0?window.open(this.options.destination,"_blank"):window.location=this.options.destination}).bind(this)),typeof this.options.onClick=="function"&&typeof this.options.destination>"u"&&b.addEventListener("click",(function(q){q.stopPropagation(),this.options.onClick()}).bind(this)),typeof this.options.offset=="object"){var j=L("x",this.options),$=L("y",this.options),Z=this.options.position=="left"?j:"-"+j,ze=this.options.gravity=="toastify-top"?$:"-"+$;b.style.transform="translate("+Z+","+ze+")"}return b},showToast:function(){this.toastElement=this.buildToast();var b;if(typeof this.options.selector=="string"?b=document.getElementById(this.options.selector):this.options.selector instanceof HTMLElement||typeof ShadowRoot<"u"&&this.options.selector instanceof ShadowRoot?b=this.options.selector:b=document.body,!b)throw"Root element is not defined";var k=l.defaults.oldestFirst?b.firstChild:b.lastChild;return b.insertBefore(this.toastElement,k),l.reposition(),this.options.duration>0&&(this.toastElement.timeOutValue=window.setTimeout((function(){this.removeElement(this.toastElement)}).bind(this),this.options.duration)),this},hideToast:function(){this.toastElement.timeOutValue&&clearTimeout(this.toastElement.timeOutValue),this.removeElement(this.toastElement)},removeElement:function(b){b.className=b.className.replace(" on",""),window.setTimeout((function(){this.options.node&&this.options.node.parentNode&&this.options.node.parentNode.removeChild(this.options.node),b.parentNode&&b.parentNode.removeChild(b),this.options.callback.call(b),l.reposition()}).bind(this),400)}},l.reposition=function(){for(var b={top:15,bottom:15},k={top:15,bottom:15},W={top:15,bottom:15},Q=document.getElementsByClassName("toastify"),ce,le=0;le<Q.length;le++){P(Q[le],"toastify-top")===!0?ce="toastify-top":ce="toastify-bottom";var j=Q[le].offsetHeight;ce=ce.substr(9,ce.length-1);var $=15,Z=window.innerWidth>0?window.innerWidth:screen.width;Z<=360?(Q[le].style[ce]=W[ce]+"px",W[ce]+=j+$):P(Q[le],"toastify-left")===!0?(Q[le].style[ce]=b[ce]+"px",b[ce]+=j+$):(Q[le].style[ce]=k[ce]+"px",k[ce]+=j+$)}return this};function L(b,k){return k.offset[b]?isNaN(k.offset[b])?k.offset[b]:k.offset[b]+"px":"0px"}function P(b,k){return!b||typeof k!="string"?!1:!!(b.className&&b.className.trim().split(/\s+/gi).indexOf(k)>-1)}return l.lib.init.prototype=l.lib,l})}(El)),El.exports}u0();function l0(g){const[w,l,z]=g.relation.definition.split(":"),L=g.relation.api[l],P=s.ref(!1),b=s.ref([]),k=s.ref({limit:99999,page:1});return{options:b,isLoading:P,finalQuery:k,fetchData:async()=>{P.value=!0;try{const W=s.computed(()=>({limit:k.value.limit,page:k.value.page,filter:JSON.stringify(g.query)}));await L.get(`/api/${z}`,{params:W.value}).then(Q=>Q.data).then(Q=>{Q.code==200&&(b.value=Q==null?void 0:Q.data)})}catch(W){console.error("Error fetching data:",W)}finally{P.value=!1}}}}const a0={class:"synt-office-relation-wrapper"},s0={class:"synt-office-relation-label"},f0={class:"synt-office-relation-note"},c0={class:"synt-office-relation-group-input-wrapper"},h0={class:"synt-office-relation-input-wrapper"},p0={class:"synt-office-relation-skeleton-wrapper"},d0={key:0,class:"synt-office-relation-modal-overlay"},g0={class:"synt-office-relation-modal-wrapper"},_0={class:"synt-office-relation-modal-header-end"},v0={class:"synt-office-relation-modal-option"},m0={class:"synt-office-relation-modal-table-wrapper"},y0={id:"table-relation-collection"},w0=["checked"],b0={class:"synt-office-relation-modal-table-label"},x0=["checked","onChange"],E0={class:"synt-badge-tabel"},C0={class:"synt-office-relation-modal-table-footer"},A0={class:"synt-office-relation-modal-table-footer-end"},S0={class:"synt-office-relation-font-bold"},O0={class:"synt-office-relation-font-bold"},L0=s.defineComponent({__name:"OfficeRelation",props:s.mergeModels({fields:{},isDisabled:{},isError:{},query:{}},{modelValue:{},modelModifiers:{}}),emits:s.mergeModels(["update:selected"],["update:modelValue"]),setup(g,{emit:w}){const l=g,z=w,L=s.useModel(g,"modelValue"),{options:P,isLoading:b,fetchData:k}=l0({relation:l.fields.relation,query:l.query}),W=s.ref(""),Q=s.ref(500),ce=s.ref(null),le=s.ref(null),j=s.ref(!1),$=s.computed(()=>{var ee,re;return(re=(ee=l.fields)==null?void 0:ee.options)==null?void 0:re.isMultiple}),Z=s.computed(()=>{var ee;return(ee=P.value)==null?void 0:ee.filter(re=>{var Lt,Zt,wn,Yt;return(Yt=(wn=re==null?void 0:re[(Zt=(Lt=l.fields)==null?void 0:Lt.relation)==null?void 0:Zt.display])==null?void 0:wn.toLowerCase())==null?void 0:Yt.includes(W.value)})}),ze=s.computed(()=>Z.value.slice(0,Q.value)),q=s.computed(()=>ze.value.length<Z.value.length),ae=s.computed(()=>{var ee;return((ee=P.value)==null?void 0:ee.find(re=>re.id===L.value))||null});s.watch(ae,ee=>{z("update:selected",ee)});const Tt=async([{isIntersecting:ee,target:re}])=>{if(ee){const Lt=re.offsetParent,Zt=Lt.scrollTop;Q.value+=10,await s.nextTick(),Lt.scrollTop=Zt}},$e=async()=>{await k()},vt=async ee=>{Array.isArray(L.value)&&(L.value.includes(ee)?L.value=L.value.filter(Lt=>Lt!==ee):L.value.push(ee)),await k()},Oe=s.computed(()=>{if(Array.isArray(L.value))return Z.value.length>0&&Z.value.every(ee=>Array.isArray(L.value)&&L.value.includes(ee.id))});function mt(){if(Array.isArray(L.value))if(Oe.value)L.value=L.value.filter(ee=>!Z.value.map(re=>re.id).includes(ee));else{const ee=Z.value.map(re=>re.id);L.value=Array.from(new Set([...L.value,...ee]))}}const qe=async()=>{await k(),j.value=!0},Nt=async()=>{W.value="",j.value=!1};return s.watch(()=>L.value,async()=>{P.value.length||(b.value=!0,L.value&&await k(),b.value=!1)}),s.onMounted(async()=>{ce.value=new IntersectionObserver(Tt)}),(ee,re)=>{var Lt,Zt,wn,Yt,$i;return s.openBlock(),s.createElementBlock("div",null,[s.createElementVNode("div",a0,[s.createElementVNode("label",s0,s.toDisplayString((Lt=ee.fields)==null?void 0:Lt.name),1),s.createElementVNode("span",f0,s.toDisplayString((wn=(Zt=ee.fields)==null?void 0:Zt.options)==null?void 0:wn.note),1),s.createElementVNode("div",c0,[s.createElementVNode("div",h0,[s.withDirectives(s.createElementVNode("div",p0,re[3]||(re[3]=[s.createElementVNode("div",{class:"synt-office-relation-skeleton"},[s.createElementVNode("div",{class:"synt-office-relation-content"})],-1)]),512),[[s.vShow,s.unref(b)]]),s.createVNode(s.unref(n0),{modelValue:L.value,"onUpdate:modelValue":re[0]||(re[0]=Ht=>L.value=Ht),class:s.normalizeClass(["synt-relation-control",{"synt-office-relation-error":ee.isError,"synt-office-relation-disabled":ee.isDisabled,"synt-office-relation-normal":!ee.isError&&!ee.isDisabled}]),options:ze.value,reduce:Ht=>Ht.id,label:($i=(Yt=ee.fields)==null?void 0:Yt.relation)==null?void 0:$i.display,placeholder:"Please enter at least 3 letters...",disabled:ee.isDisabled,multiple:$.value,onOpen:$e},{option:s.withCtx(Ht=>{var Ge,Je;return[s.createElementVNode("span",null,s.toDisplayString(Ht[(Je=(Ge=ee.fields)==null?void 0:Ge.relation)==null?void 0:Je.display]),1)]}),"list-footer":s.withCtx(()=>[s.withDirectives(s.createElementVNode("li",{ref_key:"load",ref:le,class:"synt-office-relation-loading"},re[4]||(re[4]=[s.createElementVNode("i",{class:"synt-office-relation-loading-spin fa-solid fa-spinner"},null,-1)]),512),[[s.vShow,q.value]])]),_:1},8,["modelValue","class","options","reduce","label","disabled","multiple"])]),$.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"synt-office-relation-btn-expands",onClick:s.withModifiers(qe,["prevent"])},re[5]||(re[5]=[s.createElementVNode("i",{class:"synt-office-relation-btn-expands-icon fa-solid fa-up-right-and-down-left-from-center"},null,-1)]))):s.createCommentVNode("",!0)])]),s.createVNode(s.Transition,{name:"fade"},{default:s.withCtx(()=>{var Ht;return[j.value?(s.openBlock(),s.createElementBlock("div",d0,[s.createElementVNode("div",g0,[s.createVNode(s.unref(wl),{label:ee.fields.name,icon:"fa-solid fa-table"},{end:s.withCtx(()=>[s.createElementVNode("div",_0,[s.createElementVNode("button",{type:"button",class:"synt-office-relation-modal-btn-close",onClick:s.withModifiers(Nt,["prevent"])},re[6]||(re[6]=[s.createElementVNode("i",{class:"fa-solid fa-xmark"},null,-1)]))])]),_:1},8,["label"]),s.createElementVNode("div",v0,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":re[1]||(re[1]=Ge=>W.value=Ge),type:"search",placeholder:"Cari...",class:"synt-office-relation-modal-search"},null,512),[[s.vModelText,W.value]]),s.createElementVNode("button",{type:"button",class:"synt-office-relation-modal-btn-refresh",onClick:re[2]||(re[2]=s.withModifiers((...Ge)=>s.unref(k)&&s.unref(k)(...Ge),["prevent"]))},re[7]||(re[7]=[s.createElementVNode("i",{class:"synt-office-relation-modal-btn-icon fa-solid fa-sync"},null,-1)]))]),s.createElementVNode("div",m0,[s.createElementVNode("table",y0,[s.createElementVNode("thead",null,[s.createElementVNode("tr",null,[s.createElementVNode("th",null,[W.value?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("input",{key:0,type:"checkbox",class:"synt-office-relation-modal-table-checkbox",checked:Oe.value,onChange:mt},null,40,w0))]),s.createElementVNode("th",b0,s.toDisplayString((Ht=ee.fields)==null?void 0:Ht.name),1)])]),s.createElementVNode("tbody",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(Z.value,Ge=>{var Je,Di;return s.openBlock(),s.createElementBlock("tr",{key:Ge.id},[s.createElementVNode("td",null,[s.createElementVNode("input",{type:"checkbox",class:"synt-office-relation-modal-table-checkbox",checked:Array.isArray(L.value)&&L.value.includes(Ge.id),onChange:yn=>vt(Ge.id)},null,40,x0)]),s.createElementVNode("td",null,[s.createElementVNode("div",E0,s.toDisplayString(Ge[(Di=(Je=ee.fields)==null?void 0:Je.relation)==null?void 0:Di.display]),1)])])}),128))])])]),s.createElementVNode("div",C0,[s.createElementVNode("div",A0,[re[8]||(re[8]=s.createElementVNode("span",{class:"synt-office-relation-font-bold"},s.toDisplayString(1),-1)),re[9]||(re[9]=s.createTextVNode(" - ")),s.createElementVNode("span",S0,s.toDisplayString(Z.value.length),1),re[10]||(re[10]=s.createTextVNode(" dari ")),s.createElementVNode("span",O0,s.toDisplayString(Z.value.length),1)])])])])):s.createCommentVNode("",!0)]}),_:1})])}}});lt.OfficeCollection=Ig,lt.OfficeCollectionTable=Xg,lt.OfficeHeader=wl,lt.OfficeLayout=bl,lt.OfficeLayoutWrapper=dg,lt.OfficeLink=Eg,lt.OfficeRelation=L0,lt.OfficeSingle=v_,lt.OfficeTab=a_,lt.OfficeTabs=u_,Object.defineProperty(lt,Symbol.toStringTag,{value:"Module"})});
|