import{r as i,d as t,h as s,H as e}from"./p-f8363b1b.js";const h=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.multiple=!1,this.interface="alert",this.interfaceOptions={},this.limit=15,this.options=[],this.required=!1,this.results=[]}onSuccess(i){var t,s,e;"select"===(null===(t=null==i?void 0:i.detail)||void 0===t?void 0:t.name)&&i.detail.endpoint===this.endpoint&&(this.results=(null===(e=null===(s=null==i?void 0:i.detail)||void 0===s?void 0:s.data)||void 0===e?void 0:e.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(e,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))))))}};h.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{h as fireenjin_select}