import{r as t,e as i,h as s,g as e}from"./p-15c07fa9.js";import{ElementIDUtils as l}from"@sankhyalabs/core";import{F as o}from"./p-ff1990ad.js";const h=class{constructor(s){t(this,s),this.valueChanged=i(this,"valueChanged",7),this.config=void 0,this.errorMessage=void 0,this.optionsList=[]}async setFocus(){var t,i;null===(i=null===(t=this._element)||void 0===t?void 0:t.querySelector("ez-check"))||void 0===i||i.setFocus()}async clearValue(){var t;this.config=Object.assign(Object.assign({},this.config),{value:this.config.value}),this.valueChanged.emit(null===(t=this.config)||void 0===t?void 0:t.value)}componentDidLoad(){this._element&&l.addIDInfo(this._element,"filterContentEditor")}handleToggleCheck(t,i){var s,e;this.errorMessage=void 0;let l=null!==(s=this.config.value)&&void 0!==s?s:{};l[t.name]=i,this.config=Object.assign(Object.assign({},this.config),{value:l}),this.valueChanged.emit(null===(e=this.config)||void 0===e?void 0:e.value)}renderOptions(){return this.optionsList.map((t=>s("ez-check",{label:t.label,onEzChange:i=>this.handleToggleCheck(t,i.detail),value:!!this.isChecked(t.name),enabled:this.config.enabled})))}isChecked(t){var i;return null===(i=this.config.value)||void 0===i?void 0:i[t]}buidOptions(){var t,i,s;const e=null!==(s=null===(i=null===(t=this.config)||void 0===t?void 0:t.props)||void 0===i?void 0:i.options)&&void 0!==s?s:[];this.optionsList=[...e]}componentWillRender(){this.buidOptions()}render(){if(this.config&&this.config.type===o.CHECK_BOX_LIST)return s("ez-tooltip",{active:!1===this.config.enabled,message:this.config.disabledMessage,type:"warning"},s("div",{class:"ez-flex ez-flex--column"},this.renderOptions(),this.errorMessage&&s("span",{class:"ez-text ez-text--small ez-text--error ez-margin--small"},this.errorMessage)))}get _element(){return e(this)}};export{h as snk_filter_checkbox_list}