import{d as D,ar as g,A as i,r as L,bn as m,bo as h,bp as f,h as v,a9 as t,br as A}from"../../../../common/preload-helper.BAt0wiQU.js";import{p as B}from"../../index.CwVZreOu.js";/* empty css                                                                                      */import"../../../../common/DnDDataTableControl.vue_vue_type_style_index_0_scoped_0b913e4f_lang.CI1SyTf2.js";/* empty css                                                                                                 */import{_ as H}from"../../../../common/LabelControl.vue_vue_type_script_setup_true_lang.8NM1WLzi.js";/* empty css                                                                                        */import{A as N}from"../../../../common/index.CIPBl7_V.js";import"../../../../common/index.Bkgl5HZD.js";import"../../../../common/motion.DDNFslEg.js";import"../../../../common/KeyCode.D63Tfrq7.js";import"../../../../common/index.2Llx5d_f.js";import"../../../../common/useState.9-uUdCQD.js";import"../../../../common/FormItemContext.B-agHi0o.js";import"../../../../common/createContext.DKLY0CB7.js";const j={class:"wwp-row-handle"},q={class:"wwp-left-content"},x={class:"wwp-right-content"},E=["innerHTML"],W=D({__name:"SwitchControl",props:{params:{type:Object,required:!0},conditionalValues:{type:Object,required:!1,default:()=>({})}},emits:["conditionalData","fieldData"],setup(k,{emit:_}){const w=k,c=_,{params:b,conditionalValues:d}=g(w),e=b.value,a=i(d.value[e.id]?d.value[e.id]:e.default),s=L({check:a.value==="yes"}),y=i(e.options.yes),V=i(e.options.no),o=i([]);a.value&&(o.value[e.id]=a.value,c("fieldData",o.value));const C=r=>{a.value=r?"yes":"no",o.value[e.id]=a.value,s.check=r,c("conditionalData",o.value),c("fieldData",o.value)};return(r,n)=>{var p,u;return m(),h("div",j,[f("div",q,[v(t(H),{params:t(e)},null,8,["params"])]),f("div",x,[v(t(N),{checked:s.check,"onUpdate:checked":n[0]||(n[0]=l=>s.check=l),"checked-children":y.value,"un-checked-children":V.value,onChange:n[1]||(n[1]=l=>C(l))},null,8,["checked","checked-children","un-checked-children"]),t(e).description!=="undefined"?(m(),h("p",{key:0,innerHTML:t(B)((u=(p=t(e))==null?void 0:p.description)!=null?u:"")},null,8,E)):A("",!0)])])}}});export{W as default};
