import{w as V}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{u as D,a as E,n as A}from"./fieldsStore-CQRN0FvQ.js";import{u as L}from"./appearanceStore-Cp-euDX2.js";import{_ as W}from"./RequiredHint.vue_vue_type_style_index_0_lang-DGTCbwUk.js";import{u as I}from"./translationsStore-D6vLzgNA.js";import{u as M}from"./pageBreakerStore-BevSHYnU.js";import{u as N}from"./settingsStore-8bwiLMEn.js";import{d as R,e as u,f as a,i as o,x as r,t as c,k as z,z as $,F as j,r as G}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as H,r as h,u as s}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as l,a as S}from"./vendor-vue-shared-DrzsEcag.js";import{_ as J}from"./vendor-vue3-html2pdf-KR020wX8.js";import"./vendor-pinia-BSPefQhS.js";import"./appStore-CFAkQG2b.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";import"./vendor-moment-Cv92BTSA.js";import"./vendor-bootstrap-CCU-90um.js";import"./vendor-jspdf-UFhKzYHA.js";import"./vendor-php-date-formatter-DSpPwBF8.js";import"./callbackStore-BhxBUA6V.js";import"./vendor-html2pdf.js-B-tok4Ns.js";import"./vendor-html2canvas-BfYXEYrK.js";const K={class:"ccb-field__label"},Q={class:"ccb-field__title"},U={key:0,class:"ccb-field-required-mark"},X={key:0,class:"ccb-field__descriptions ccb-before"},Y={key:0,class:"ccb-field__description"},Z={class:"ccb-dropdown"},ee={key:0,class:"ccb-dropdown__label"},te={key:1,class:"ccb-dropdown__label"},se={class:"ccb-dropdown__list"},oe=["onClick"],ie={class:"ccb-dropdown--option-label"},ae={key:0,class:"ccb-dropdown--option-converted"},re={key:1,class:"ccb-field__descriptions ccb-after"},le={key:0,class:"ccb-field__description"},ne=R({__name:"Dropdown",props:{field:{}},setup(C){const x=C,{field:e}=H(x),p=D(),F=A(),k=L(),B=E(),f=I(),T=M(),d=h(!1),_=h(null),q=u(()=>{var i;return((i=N().getWarningTexts)==null?void 0:i.requiredMsg)||""}),g=()=>{d.value?document.removeEventListener("click",m):document.addEventListener("click",m),d.value=!d.value},m=t=>{_.value&&"contains"in _.value&&!_.value.contains(t.target)&&(d.value=!1,document.removeEventListener("click",m))},w=(t,i=!0)=>{var n;if((t==null?void 0:t.optionValue)!==((n=b.value)==null?void 0:n.optionValue)){let v=0;t!=null&&t.optionValue&&e.value.summaryView!=="show_label_not_calculable"&&(v=+(t==null?void 0:t.optionValue).split("_")[0]||0),e.value.selectedOption=t,e.value.value=v,e.value.displayValue=F.getMultipleOptionsFieldDisplayView(e.value),p.updateField(e.value.alias,e.value),B.applyConditionForField(e.value.alias),p.getPageBreakEnabled&&p.getActivePage.action==="not_skip"&&T.checkPageFieldsConditions()}i&&g()},b=u(()=>e.value.selectedOption),O=u(()=>{var t;return(t=e.value.options)==null?void 0:t.map(i=>({...i}))}),y=u(()=>p.checkFieldRequired(e.value)),P=u(()=>{var t;return((t=e.value)==null?void 0:t.additionalStyles)||""});return(t,i)=>(o(),a("div",{class:S(["ccb-field ccb-dropdown-field",{active:d.value,required:y.value,"ccb-field-disabled":s(e).disabled,[P.value]:!0}])},[r("div",K,[y.value?(o(),z(W,{key:0,text:q.value},null,8,["text"])):c("",!0),r("div",Q,[$(l(s(e).label),1),s(e).required?(o(),a("span",U,"*")):c("",!0)])]),s(k).getAppearanceDescriptionPosition==="before"?(o(),a("div",X,[s(e).description?(o(),a("div",Y,l(s(e).description),1)):c("",!0)])):c("",!0),r("div",{class:"ccb-field__input-wrapper",ref_key:"dropdownWrapper",ref:_},[r("div",Z,[r("div",{class:"ccb-dropdown__input",onClick:g},[b.value?(o(),a("span",te,l(b.value.optionText),1)):(o(),a("span",ee,l(s(f).getTranslations.selectValue),1)),i[1]||(i[1]=r("span",{class:"ccb-dropdown__icon"},[r("i",{class:"ccb-icon-Path-3485"})],-1))]),r("div",se,[r("ul",null,[r("li",{onClick:i[0]||(i[0]=V(()=>w(void 0,!0),["prevent"]))},l(s(f).getTranslations.selectValue),1),(o(!0),a(j,null,G(O.value,(n,v)=>(o(),a("li",{key:n.optionValue,onClick:V(()=>w(n),["prevent"]),class:S(["ccb-dropdown--option",{"ccb-option-disabled":s(e).disableOptions.includes(v)}])},[r("span",ie,l(n.optionText),1),s(e).showValueInOption?(o(),a("span",ae,l(s(f).getTranslations.price)+": "+l(n.optionConverted),1)):c("",!0)],10,oe))),128))])])])],512),s(k).getAppearanceDescriptionPosition==="after"?(o(),a("div",re,[s(e).description?(o(),a("div",le,l(s(e).description),1)):c("",!0)])):c("",!0)],2))}}),Oe=J(ne,[["__scopeId","data-v-fcb15d1a"]]);export{Oe as default};
//# sourceMappingURL=index-BCpC-WF-.js.map
