import{w as y}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{u as O,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 z,e as u,f as i,i as t,x as a,t as c,k as R,z as $,F as j,r as G}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as H,r as h,u as o}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as n,a as J}from"./vendor-vue-shared-DrzsEcag.js";import{_ as K}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 Q={class:"ccb-field__label"},U={class:"ccb-field__title"},X={key:0,class:"ccb-field-required-mark"},Y={key:1,class:"ccb-field__hidden"},Z={key:0,class:"ccb-field__descriptions ccb-before"},ee={key:0,class:"ccb-field__description"},se={class:"ccb-dropdown"},te={class:"ccb-dropdown__input"},oe={key:0,class:"ccb-dropdown__label"},ie={key:1,class:"ccb-dropdown__label"},ae={class:"ccb-dropdown__list"},re=["onClick"],ne={class:"ccb-dropdown--option-label"},ce={key:0,class:"ccb-dropdown--option-converted"},le={key:1,class:"ccb-field__descriptions ccb-after"},de={key:0,class:"ccb-field__description"},ue=z({__name:"Dropdown",props:{field:{}},setup(V){const S=V,{field:e}=H(S),C=e.value.options,_=O(),x=A(),m=L(),F=E(),b=I(),B=M(),d=h(!1),p=h(null),T=u(()=>{var r;return((r=N().getWarningTexts)==null?void 0:r.requiredMsg)||""}),P=()=>{d.value?document.removeEventListener("click",v):document.addEventListener("click",v),d.value=!d.value},v=s=>{p.value&&"contains"in p.value&&!p.value.contains(s.target)&&(d.value=!1,document.removeEventListener("click",v))},k=(s,r=!0)=>{var l;if((s==null?void 0:s.optionValue)!==((l=f.value)==null?void 0:l.optionValue)){let w=0;s!=null&&s.optionValue&&e.value.summaryView!=="show_label_not_calculable"&&(w=+(s==null?void 0:s.optionValue).split("_")[0]||0),e.value.selectedOption=s,e.value.value=w,e.value.displayValue=x.getMultipleOptionsFieldDisplayView(e.value),_.updateField(e.value.alias,e.value),F.applyConditionForField(e.value.alias),_.getPageBreakEnabled&&_.getActivePage.action==="not_skip"&&B.checkPageFieldsConditions()}r&&P()},f=u(()=>e.value.selectedOption),q=u(()=>C.map(s=>({...s}))),g=u(()=>!1),D=u(()=>"");return(s,r)=>(t(),i("div",{class:J(["ccb-field ccb-dropdown-field",{active:d.value,required:g.value,"ccb-field-disabled":o(e).disabled,[D.value]:!0}])},[a("div",Q,[g.value?(t(),R(W,{key:0,text:T.value},null,8,["text"])):c("",!0),a("div",U,[$(n(o(e).label),1),o(e).required?(t(),i("span",X,"*")):c("",!0)]),o(e).hidden?(t(),i("div",Y,r[1]||(r[1]=[a("i",{class:"ccb-icon-ic_eye_crossed"},null,-1)]))):c("",!0)]),o(m).getAppearanceDescriptionPosition==="before"?(t(),i("div",Z,[o(e).description?(t(),i("div",ee,n(o(e).description),1)):c("",!0)])):c("",!0),a("div",{class:"ccb-field__input-wrapper",ref_key:"dropdownWrapper",ref:p},[a("div",se,[a("div",te,[f.value?(t(),i("span",ie,n(f.value.optionText),1)):(t(),i("span",oe,n("Select value"))),r[2]||(r[2]=a("span",{class:"ccb-dropdown__icon"},[a("i",{class:"ccb-icon-Path-3485"})],-1))]),a("div",ae,[a("ul",null,[a("li",{onClick:r[0]||(r[0]=y(()=>k(void 0,!0),["prevent"]))},n(o(b).getTranslations.selectValue),1),(t(!0),i(j,null,G(q.value,l=>(t(),i("li",{key:l.optionValue,onClick:y(()=>k(l),["prevent"]),class:"ccb-dropdown--option"},[a("span",ne,n(l.optionText),1),o(e).showValueInOption?(t(),i("span",ce,n(o(b).getTranslations.price)+": "+n(l.optionConverted),1)):c("",!0)],8,re))),128))])])])],512),o(m).getAppearanceDescriptionPosition==="after"?(t(),i("div",le,[o(e).description?(t(),i("div",de,n(o(e).description),1)):c("",!0)])):c("",!0)],2))}}),Ee=K(ue,[["__scopeId","data-v-aace4635"]]);export{Ee as default};
//# sourceMappingURL=Dropdown-DaO-hTK-.js.map
