import { r as registerInstance, e as createEvent, h, g as getElement } from './index-e9c7ceaa.js';
import { ElementIDUtils } from '@sankhyalabs/core';
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';

const SnkFilterMultiSelect = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.valueChanged = createEvent(this, "valueChanged", 7);
    this.value = undefined;
    this.config = undefined;
    this.errorMessage = undefined;
  }
  /**
   * Emitido quando acontece a alteração de valor do componente snk-filter-multi-select
   */
  ezChangeListener(evt) {
    var _a;
    this.errorMessage = undefined;
    this.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value;
    this.valueChanged.emit(this.value);
  }
  /**
   * Define o foco no componente snk-filter-multi-select.
   */
  async setFocus() {
    this._comboElement.setFocus();
  }
  /**
   * Limpa o valor do componente restaurando o valor original da configuração.
   */
  async clearValue() {
    this.value = this.config.value;
    if (this._comboElement) {
      this._comboElement.value = this.config.value;
    }
  }
  componentDidLoad() {
    if (this._element) {
      ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
    }
  }
  render() {
    if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
      return undefined;
    }
    return (h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-combo-box", { id: this.config.id, ref: ref => this._comboElement = ref, label: this.config.label, value: this.config.value, options: this.config.props.options, enabled: this.config.enabled, errorMessage: this.errorMessage, onEzVisibilityChange: (event) => {
        event.stopPropagation();
      } })));
  }
  get _element() { return getElement(this); }
};

export { SnkFilterMultiSelect as snk_filter_multi_select };
