1import{_ as C,A as F,x as S,bD as y}from"./index.b39fe1b1.js";import k from"./TmlInput.c5c24787.js";import x from"./TmlSegmentedSelect.6efd6645.js";import{N as m,D as o,E as r,f as a,U as p,S as f,H as h,V,G as _,Q as u,R as O,F as I,a2 as b,a1 as N,a0 as T,O as P,a5 as j}from"./vue.00f7c436.js";import"./sentry.09480738.js";import"./faCheck.dd6ba410.js";import"./faTimes.9e2515d7.js";import"./faPlus.b7ccafa3.js";import"./faMinus.5dd9ea58.js";import"./faArrowRight.97fd3c4b.js";import"./faUndo.a98f3c90.js";const A={name:"TmlAutocomplete",components:{TmlForm:F,TmlInput:k,TmlSegmentedSelect:x},props:{options:{type:Array,required:!0},placeholder:{type:String,default:""},label:{type:String,default:""},height:{type:String,default:"300px"},displayField:{type:String,default:"text"},value:{type:String},formNamePrefix:{type:String,default:""},fieldNamePrefix:{type:String,default:""}},data(){return{internalInputValue:null,selectObject:[],isOpen:!1,isFocused:!1,uid:S()}},computed:{dynamicPlaceholder(){return this.placeholder?this.label?this.internalInputValue?this.label:this.placeholder:this.placeholder:""}},watch:{internalInputValue:{immediate:!0,handler(e,t){e!==t&&this.$emit("input",e)}},value:{immediate:!0,handler(e,t){e!==t&&(this.internalInputValue=e)}}},methods:{has:y,handleInput(e){this.internalInputValue=e,this.internalInputValue&&this.isFocused&&this.open()},handleFocus(){this.internalInputValue&&this.isFocused&&this.open()},handleClick(){this.isOpen||(this.isFocused=!0)},watchForClose(e){e[`forceClose_${this.uid}`]&&this.close();const t=e.target;t&&t.id===this.uid||(t.parentNode?this.watchForClose({target:t.parentNode}):this.close())},open(){this.isOpen||(this.isOpen=!0,window.addEventListener("click",this.watchForClose),this.$emit("open"))},onSelect(e,t){t(e),this.$emit("selected",this.selectObject),(!y(e,"preventClose")||!e.preventClose)&&this.$nextTick(()=>{this.close()})},close(){window.removeEventListener("click",this.watchForClose),this.isOpen&&(this.focused=!1,this.isOpen=!1,this.$emit("blur"))}}},E=["id"],z={autocomplete:"off",onsubmit:"return false;"},B={class:"w-full relative"},D={key:0,class:"flex justify-start items-center w-full"},L=["onClick"],U={key:1,class:"flex justify-start items-center w-full"};function q(e,t,i,G,s,l){const v=m("tml-input"),g=m("tml-form"),w=m("tml-segmented-select");return o(),r("div",{id:s.uid,class:"tml-autocomplete",onClick:t[1]||(t[1]=(...n)=>l.handleClick&&l.handleClick(...n))},[a(g,{"form-name":`${i.formNamePrefix}autocomplete`},{default:p(()=>[f("form",z,[a(v,{ref:"autocompleteInput","field-name":`${i.fieldNamePrefix}autocomplete`,type:"text",placeholder:l.dynamicPlaceholder,"auto-complete":!1,class:h({"select-open":s.isOpen}),value:s.internalInputValue,onInput:l.handleInput,onFocus:l.handleFocus},null,8,["field-name","placeholder","class","value","onInput","onFocus"])])]),_:1},8,["form-name"]),a(w,{modelValue:s.selectObject,"onUpdate:modelValue":t[0]||(t[0]=n=>s.selectObject=n),items:i.options,identifier:"value"},{default:p(({select:n,allItems:c})=>[f("div",B,[a(V,{name:"open-down"},{default:p(()=>[s.isOpen?(o(),r("div",{key:0,ref:"option-container",class:h(["option-container flex flex-col absolute",{"select-open":s.isOpen}])},[e.$slots["prepend-custom"]?(o(),r("div",D,[_(e.$slots,"prepend-custom",{},void 0,!0)])):u("",!0),f("div",{class:h(["option-list",{overflow:i.height}]),style:O({"max-height":`${i.height} !important`})},[c.length?_(e.$slots,"options-custom",P(j({key:0},{onSelect:l.onSelect,allItems:c,select:n})),()=>[(o(!0),r(I,null,b(c,d=>(o(),r("div",{key:d.uid,class:"option input-padding flex justify-start items-center w-full cursor-pointer",onClick:N(H=>l.onSelect(d,n),["stop"])},T(d[i.displayField]),9,L))),128))],!0):u("",!0)],6),e.$slots["append-custom"]?(o(),r("div",U,[_(e.$slots,"append-custom",{},void 0,!0)])):u("",!0)],2)):u("",!0)]),_:2},1024)])]),_:3},8,["modelValue","items"])],8,E)}const te=C(A,[["render",q],["__scopeId","data-v-e5c5c37a"]]);export{te as default}; 2//# sourceMappingURL=TmlAutocomplete.92b84ed7.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.