'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-17105557.js');
const core = require('@sankhyalabs/core');
const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');

const SnkFilterMultiSelect = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.valueChanged = index.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) {
      core.ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
    }
  }
  render() {
    if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.MULTI_SELECT) {
      return undefined;
    }
    return (index.h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, index.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 index.getElement(this); }
};

exports.snk_filter_multi_select = SnkFilterMultiSelect;
