System.register(["../../../../common/preload-helper-legacy.CIXZiioE.js","../../../../common/settings-store-legacy.BzmgUa8U.js","../../../../common/DnDDataTableControl.vue_vue_type_style_index_0_scoped_0b913e4f_lang-legacy.D1tDIuyM.js","../../index-legacy.Bb8z3cGQ.js","../../../../common/EditOutlined-legacy.DDjyzCfn.js","../../../../common/DeleteOutlined-legacy.Bc-rhxYC.js","../../../../common/index-legacy.Ccwy_0FI.js","../../../../common/_plugin-vue_export-helper-legacy.BVIICed7.js","../../../../common/index-legacy.CO4MsCT9.js","../../../../common/motion-legacy.C4TziduP.js","../../../../common/index-legacy.BpZDMFyf.js","../../../../common/index-legacy.M32zB8dq.js","../../../../common/useState-legacy.C_VuFIfe.js","../../../../common/warning-legacy.BXrMpzCz.js","../../../../common/compact-item-legacy.EWjDRkhe.js","../../../../common/createContext-legacy.DxkS4L9s.js","../../../../common/useMergedState-legacy.CSXWBAdW.js","../../../../common/KeyCode-legacy.Cey0FNFJ.js","../../../../common/ActionButton-legacy.D-ux39fB.js"],function(e,a){"use strict";var l,t,o,n,d,c,s,r,i,u,m,y,p,g,b,f,_,j,v,k,D,h,w,x,C;return{setters:[e=>{l=e.d,t=e.ar,o=e.bm,n=e.r,d=e.A,c=e.bn,s=e.bo,r=e.bp,i=e.aa,u=e.by,m=e.bs,y=e.a9,p=e.h,g=e.bu,b=e.bw,f=e.br,_=e.a4,j=e.bq},e=>{v=e.u},e=>{k=e.d},e=>{D=e.s},e=>{h=e.E},e=>{w=e.D},e=>{x=e.A},e=>{C=e._},null,null,null,null,null,null,null,null,null,null,null],execute:function(){const a={class:"wwp-full-width-table"},O={class:"thead-dark"},S={key:0,class:"editable-row-operations"},q={key:0,class:"editable-cell"},A=["onClick"];e("default",C(l({__name:"DnDDataTableControl",props:{params:{type:Object,required:!0},data:{type:Object,required:!0},editFields:{type:Object,required:!1,default:()=>({})},editedFields:{type:Number,required:!1,default:0}},emits:["fieldUpdatedData","fieldDeletedData","updateDataSource"],setup(e,{emit:l}){const C=e,{params:E,data:F,editedFields:U}=t(C),V=v(),{inlineMappingEdit:B}=o(V),I=E.value,K=I.fields,M=n({data:window.lodash.sortBy(F.value,e=>void 0!==e.field_order&&null!==e.field_order?e.field_order:0)}),T=I.editable,z=I.can_delete,G=I.delete_action,N=I.sort_action,H=d(I.show_in_table),J=d(!1),L=n([]),P=U,Q=l,R=d([]),W=async e=>{const a=[{key:"action",value:N}],l=M.data;a.push({key:"list",value:l});try{const e=await D(a,!1,!0);null!=e&&Q("updateDataSource",e)}catch(t){console.error(t)}};return(e,l)=>(c(),s("table",a,[r("thead",O,[r("tr",null,[(c(!0),s(i,null,u(y(K),(e,a)=>(c(),s("th",{key:a,scope:"col"},m(e.title),1))),128))])]),p(y(k),{modelValue:M.data,"onUpdate:modelValue":l[0]||(l[0]=e=>M.data=e),tag:"tbody","item-key":"name",onEnd:W},{item:g(({element:e})=>[r("tr",{class:b({"not-draggable":!(null!=e&&e.draggable)})},[(c(!0),s(i,null,u(H.value,(a,t)=>{return c(),s("td",{key:t,scope:"row"},["operation"===a?(c(),s("div",S,[null===y(P)?(c(),s("div",q,[y(T)?(c(),s("a",{key:0,onClick:a=>{return l=e.key,L[l]=window.lodash.cloneDeep(M.data.filter(e=>l===e.key)[0]),R.value=L[l],B.value=!1,void Q("fieldUpdatedData",R.value);var l}},[p(y(h))],8,A)):f("",!0),l[1]||(l[1]=_("   ",-1)),y(z)&&"no"!==(null==e?void 0:e.deletetable)?(c(),s(i,{key:1},[M.data.length?(c(),j(y(x),{key:0,title:"Sure to delete?",onConfirm:a=>(async e=>{const a=M.data.filter(a=>e===a.key)[0],l=[{key:"action",value:G}];for(const[o,n]of Object.entries(a))l.push({key:o,value:n});try{"success"===await D(l)&&(Q("fieldDeletedData",e),M.data=M.data.filter(a=>a.key!==e))}catch(t){console.error(t)}finally{J.value=!1}})(e.key)},{default:g(()=>[r("a",null,[p(y(w))])]),_:1},8,["onConfirm"])):f("",!0)],64)):f("",!0)])):f("",!0)])):(c(),s(i,{key:1},[_(m((o=e[a],Array.isArray(o)?o.join(", "):o)),1)],64))]);var o}),128))],2)]),_:1},8,["modelValue"])]))}}),[["__scopeId","data-v-0b913e4f"]]))}}});
