import{p as e,H as t,c as s,h as i,t as l}from"./p-Bpcl2TqF.js";import{d as r}from"./p-DRrF7tWE.js";import{d as a}from"./p-KvSIaMXJ.js";import{d as f}from"./p-D1Y2dGg4.js";import{d as c}from"./p-B4dxNvkn.js";import{d as o}from"./p-Do8YsFMA.js";import{d as n}from"./p-CHaOELW0.js";import{d as h}from"./p-uZq-wRGz.js";const m=()=>``;const p=e(class e extends t{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.ifxFilterSelect=s(this,"ifxFilterSelect",7)}filterName;filterLabel;placeholder;type="text";options;filterValues=[];ifxFilterSelect;handleTextInputChange(e){const t=e.target;const s=t.value;this.ifxFilterSelect.emit({filterName:this.filterName,filterValues:[s],type:this.type})}handleSingleSelectChange(e){const t=e.detail.value;this.ifxFilterSelect.emit({filterName:this.filterName,filterValues:[t],type:this.type})}handleMultiselectOptionChange(e){this.filterValues=e.detail.map((e=>({label:e.value,value:e.value})));this.ifxFilterSelect.emit({filterName:this.filterName,filterValues:this.filterValues,type:this.type})}render(){let e=[];if(typeof this.options==="string"){try{e=JSON.parse(this.options)}catch(t){console.error("Failed to parse options:",t);e=[]}}else if(Array.isArray(this.options)){e=this.options}switch(this.type){case"text":return i("ifx-text-field",{error:false,disabled:false,placeholder:this.placeholder,onIfxInput:e=>this.handleTextInputChange(e)},this.filterLabel);case"single-select":return i("ifx-select",{placeholder:"true","search-enabled":"true","search-placeholder-value":"Search...",onIfxSelect:e=>this.handleSingleSelectChange(e),"ifx-placeholder-value":this.placeholder,"ifx-label":this.filterLabel,"ifx-options":this.options});case"multi-select":return i("ifx-multiselect",{label:this.filterLabel,placeholder:this.placeholder,onIfxSelect:e=>this.handleMultiselectOptionChange(e)},e.map((e=>i("ifx-multiselect-option",{value:e.value||e},e.label||e))));default:return null}}static get style(){return m()}},[513,"ifx-set-filter",{filterName:[1,"filter-name"],filterLabel:[1,"filter-label"],placeholder:[1],type:[1],options:[1],filterValues:[32]}]);function u(){if(typeof customElements==="undefined"){return}const e=["ifx-set-filter","ifx-checkbox","ifx-icon","ifx-multiselect","ifx-multiselect-option","ifx-search-field","ifx-select","ifx-text-field"];e.forEach((e=>{switch(e){case"ifx-set-filter":if(!customElements.get(l(e))){customElements.define(l(e),p)}break;case"ifx-checkbox":if(!customElements.get(l(e))){r()}break;case"ifx-icon":if(!customElements.get(l(e))){a()}break;case"ifx-multiselect":if(!customElements.get(l(e))){f()}break;case"ifx-multiselect-option":if(!customElements.get(l(e))){c()}break;case"ifx-search-field":if(!customElements.get(l(e))){o()}break;case"ifx-select":if(!customElements.get(l(e))){n()}break;case"ifx-text-field":if(!customElements.get(l(e))){h()}break}}))}const x=p;const d=u;export{x as IfxSetFilter,d as defineCustomElement};
//# sourceMappingURL=ifx-set-filter.js.map