'use strict';

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

const index = require('./index-17105557.js');
const core = require('@sankhyalabs/core');

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

exports.snk_filter_text = SnkFilterText;
