import { r as registerInstance, e as createEvent, h, g as getElement } from './index-e9c7ceaa.js';
import { ElementIDUtils } from '@sankhyalabs/core';

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

export { SnkFilterText as snk_filter_text };
