import{r as i,d as t,h as s,H as h}from"./p-9b6cc562.js";const e=class{constructor(s){i(this,s),this.fireenjinFetch=t(this,"fireenjinFetch",7),this.ionChange=t(this,"ionChange",7),this.disabled=!1,this.cancelText="Dismiss",this.okText="Okay",this.placeholder=void 0,this.name=void 0,this.selectedText=void 0,this.multiple=!1,this.interface="alert",this.interfaceOptions={},this.compareWith=void 0,this.value=void 0,this.icon=void 0,this.endpoint=void 0,this.header=void 0,this.subHeader=void 0,this.message=void 0,this.orderBy=void 0,this.dataPropsMap=void 0,this.optionEl=void 0,this.limit=15,this.params=void 0,this.query=void 0,this.label=void 0,this.pattern=void 0,this.options=[],this.required=!1,this.resultsKey=void 0,this.labelPosition=void 0,this.lines=void 0,this.results=[]}onChange(i){var t,s;(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.name)===this.name&&(this.value=(null===(s=i.target)||void 0===s?void 0:s.value)||null)}onSuccess(i){var t,s,h;"select"===(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.name)&&i.detail.endpoint===this.endpoint&&(this.results=(null===(h=null===(s=null==i?void 0:i.detail)||void 0===s?void 0:s.data)||void 0===h?void 0:h.results)?i.detail.data.results:[],setTimeout((()=>{this.value=this.value}),200))}fetchData(){this.endpoint&&this.fireenjinFetch.emit({name:"select",endpoint:this.endpoint,dataPropsMap:this.dataPropsMap?this.dataPropsMap:this.resultsKey?{[this.resultsKey]:"results"}:null,params:Object.assign({data:Object.assign(Object.assign(Object.assign({},this.query?{query:this.query}:{}),this.orderBy?{orderBy:this.orderBy}:{}),{limit:this.limit?this.limit:15})},this.params?this.params:{})})}componentWillLoad(){this.fetchData()}render(){return s(h,null,s("ion-item",{lines:this.lines},this.icon&&s("ion-icon",{slot:"start",name:this.icon}),this.label&&s("ion-label",{position:this.labelPosition},this.label),s("ion-select",{disabled:this.disabled,selectedText:this.selectedText,interface:this.interface,compareWith:this.compareWith,name:this.name,value:this.value,okText:this.okText,multiple:this.multiple,cancelText:this.cancelText,placeholder:this.placeholder,interfaceOptions:this.interfaceOptions?this.interfaceOptions:{header:this.header,subHeader:this.subHeader,message:this.message}},(this.options?this.options:[]).map((i=>this.optionEl?this.optionEl(i):s("ion-select-option",{value:i.value,disabled:i.disabled},i.label))),(this.results?this.results:[]).map((i=>this.optionEl?this.optionEl(i):s("ion-select-option",{value:i.id},i.name)))),s("input",{style:{opacity:"0",height:"0",width:"0",float:"left",margin:"0",padding:"0"},type:"text",pattern:this.pattern,value:this.value,required:this.required})))}};e.style="fireenjin-select ion-icon{margin-right:5px;color:var(--ion-text-color);opacity:0.33}fireenjin-select select{border:none;width:auto;padding:10px;min-width:30%;cursor:pointer;text-align:justify}";export{e as fireenjin_select}