import { buildEditorMetadata } from "./IEditorMetadata";
export default class EzCellRender {
  init(params) {
    const span = document.createElement('span');
    this._currentParams = params;
    span.textContent = params.value;
    const fieldName = params.column.getColId();
    const dataUnit = params.context.dataUnit;
    this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
    this._gui = span;
  }
  refresh() {
    try {
      this._currentParams.refreshCell();
      return true;
    }
    catch (_a) {
      return false;
    }
  }
  getGui() {
    return this._gui;
  }
  afterGuiAttached() {
    this.focusIn();
  }
  focusIn() {
    this._gui.focus();
    this._gui.setFocus({ selectText: true });
  }
  getValue() {
    return this._currentParams.getValue();
  }
  isPopup() {
    return this._gui.isPopUp;
  }
  getFieldMetadata() {
    return this._fieldMetadata;
  }
}
