import{a as P,C as E,k as V,b as u,m as i,g as a,p as l,q as r,f as L,L as A,D as n,u as t,K as h,F as I,H as W,I as S}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import{c as M,u as N,n as R,d as z,a as H,o as K}from"./widget-BUAABBRb.js";import{_ as $}from"./RequiredHint.vue_vue_type_style_index_0_lang-R4Bqx90z.js";import{u as j}from"./translationsStore-DBJu9sBR.js";import{_ as G}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";const J={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"},se={key:1,class:"ccb-dropdown__label"},te={class:"ccb-dropdown__list"},ae=["onClick"],oe={class:"ccb-dropdown--option-label"},ie={key:0,class:"ccb-dropdown--option-converted"},le={key:1,class:"ccb-field__descriptions ccb-after"},ne={key:0,class:"ccb-field__description"},ce=P({__name:"Dropdown",props:{field:{}},setup(C){const F=C,{field:e}=E(F),p=M(),x=K(),k=N(),B=R(),f=j(),T=z(),d=V(!1),_=V(null),q=u(()=>{var o;return((o=H().getWarningTexts)==null?void 0:o.requiredMsg)||""}),g=()=>{d.value?document.removeEventListener("click",b):document.addEventListener("click",b),d.value=!d.value},b=s=>{_.value&&"contains"in _.value&&!_.value.contains(s.target)&&(d.value=!1,document.removeEventListener("click",b))},w=(s,o=!0)=>{var c;if((s==null?void 0:s.optionValue)!==((c=m.value)==null?void 0:c.optionValue)){let v=0;s!=null&&s.optionValue&&e.value.summaryView!=="show_label_not_calculable"&&(v=+(s==null?void 0:s.optionValue).split("_")[0]||0),e.value.selectedOption=s,e.value.value=v,e.value.displayValue=x.getMultipleOptionsFieldDisplayView(e.value),p.updateField(e.value.alias,e.value),B.applyConditionForField(e.value.alias),p.getPageBreakEnabled&&p.getActivePage.action==="not_skip"&&T.checkPageFieldsConditions()}o&&g()},m=u(()=>e.value.selectedOption),D=u(()=>{var s;return(s=e.value.options)==null?void 0:s.map(o=>({...o}))}),y=u(()=>p.checkFieldRequired(e.value)),O=u(()=>{var s;return((s=e.value)==null?void 0:s.additionalStyles)||""});return(s,o)=>(a(),i("div",{class:S(["ccb-field ccb-dropdown-field",{active:d.value,required:y.value,"ccb-field-disabled":t(e).disabled,[O.value]:!0}])},[l("div",J,[y.value?(a(),L($,{key:0,text:q.value},null,8,["text"])):r("",!0),l("div",Q,[A(n(t(e).label),1),t(e).required?(a(),i("span",U,"*")):r("",!0)])]),t(k).getAppearanceDescriptionPosition==="before"?(a(),i("div",X,[t(e).description?(a(),i("div",Y,n(t(e).description),1)):r("",!0)])):r("",!0),l("div",{class:"ccb-field__input-wrapper",ref_key:"dropdownWrapper",ref:_},[l("div",Z,[l("div",{class:"ccb-dropdown__input",onClick:g},[m.value?(a(),i("span",se,n(m.value.optionText),1)):(a(),i("span",ee,n(t(f).getTranslations.selectValue),1)),o[1]||(o[1]=l("span",{class:"ccb-dropdown__icon"},[l("i",{class:"ccb-icon-Path-3485"})],-1))]),l("div",te,[l("ul",null,[l("li",{onClick:o[0]||(o[0]=h(()=>w(void 0,!0),["prevent"]))},n(t(f).getTranslations.selectValue),1),(a(!0),i(I,null,W(D.value,(c,v)=>(a(),i("li",{key:c.optionValue,onClick:h(()=>w(c),["prevent"]),class:S(["ccb-dropdown--option",{"ccb-option-disabled":t(e).disableOptions.includes(v)}])},[l("span",oe,n(c.optionText),1),t(e).showValueInOption?(a(),i("span",ie,n(t(f).getTranslations.price)+": "+n(c.optionConverted),1)):r("",!0)],10,ae))),128))])])])],512),t(k).getAppearanceDescriptionPosition==="after"?(a(),i("div",le,[t(e).description?(a(),i("div",ne,n(t(e).description),1)):r("",!0)])):r("",!0)],2))}}),me=G(ce,[["__scopeId","data-v-817b562c"]]);export{me as default};
//# sourceMappingURL=index-BKcu7Hoi.js.map
