import{r as i,d as t,h as s,H as e}from"./p-03169580.js";const h="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}";let n=class{constructor(s){i(this,s);this.fireenjinFetch=t(this,"fireenjinFetch",7);this.ionChange=t(this,"ionChange",7);this.disabled=false;this.cancelText="Dismiss";this.okText="Okay";this.multiple=false;this.interface="alert";this.interfaceOptions={};this.limit=15;this.options=[];this.required=false;this.results=[]}onSuccess(i){var t,s,e;if(((t=i===null||i===void 0?void 0:i.detail)===null||t===void 0?void 0:t.name)!=="select"||i.detail.endpoint!==this.endpoint)return;this.results=((e=(s=i===null||i===void 0?void 0:i.detail)===null||s===void 0?void 0:s.data)===null||e===void 0?void 0:e.results)?i.detail.data.results:[];setTimeout((()=>{this.value=this.value}),200)}fetchData(){if(!this.endpoint)return;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))))))}};n.style=h;export{n as fireenjin_select};
//# sourceMappingURL=p-442a6dbb.entry.js.map