import { ElementIDUtils, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME, StringUtils, ApplicationContext, KeyboardManager, } from '@sankhyalabs/core';
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
import { Host, h } from '@stencil/core';
import { ApplicationUtils, buildFieldSearch } from '../../utils';
import AgGridController from './controller/ag-grid/AgGridController';
import { SelectionCounter } from './subcomponents/selection-counter';
import InMemoryFilterColumnDataSource from './utils/InMemoryFilterColumnDataSource';
import { focusOnFieldSerch, SEARCH_FIELD_FULL_WIDTH, SHORTCUT_SEARCH_FIELD } from '../../utils/searchColumn/search-column';
import initI18n from '../../utils/i18n';
const windowInstace = window;
const matches = (text, filter) => {
  const normalizedText = StringUtils.replaceAccentuatedCharsLower(text === null || text === void 0 ? void 0 : text.toLocaleLowerCase());
  const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(filter.toLocaleLowerCase());
  return normalizedText === null || normalizedText === void 0 ? void 0 : normalizedText.includes(normalizedFilter);
};
export class EzGrid {
  constructor() {
    this._gridController = new AgGridController(false);
    this._customEditor = new Map();
    this._customRenders = new Map();
    this._paginationInfo = undefined;
    this._paginationChangedByKeyboard = true;
    this._showSelectionCounter = false;
    this._isAllSelection = false;
    this._currentPageSelected = undefined;
    this._selectionCount = undefined;
    this._hasLeftButtons = false;
    this._customFormatters = new Map();
    this.enableLockManagerLoadingComp = false;
    this.enableLockManagerTaskbarClick = true;
    this.multipleSelection = undefined;
    this.config = undefined;
    this.selectionToastConfig = undefined;
    this.serverUrl = undefined;
    this.dataUnit = undefined;
    this.statusResolver = undefined;
    this.columnfilterDataSource = undefined;
    this.useEnterLikeTab = false;
    this.recordsValidator = undefined;
    this.canEdit = true;
    this.autoFocus = true;
    this.paginationCounterMode = 'auto';
    this.enableGridInsert = false;
    this.enableContinuousInsert = true;
    this.suppressCheckboxColumn = false;
    this.suppressFilterColumn = false;
    this.outlineMode = false;
    this.enableRowTableStriped = true;
    this.compact = false;
    this.useSearchColumn = true;
    this.suppressHorizontalScroll = false;
    this.mode = "complete";
  }
  /**
   * Aplica a definição de colunas.
   */
  async setColumnsDef(cols) {
    this._gridController.setColumnsDef(cols);
  }
  /**
   * Retorna os filtros aplicados.
   */
  async getAppliedColumnFilters() {
    var _a;
    return (_a = this._gridController.getFilter()) !== null && _a !== void 0 ? _a : [];
  }
  async refreshColumnFilterDataSource() {
    var _a, _b;
    if (this.columnfilterDataSource) {
      (_b = (_a = this.columnfilterDataSource)['refresh']) === null || _b === void 0 ? void 0 : _b.call(_a);
    }
  }
  /**
   * Adiciona item de menu nas colunas.
   */
  async addColumnMenuItem(label, name, action, icon) {
    this._gridController.addColumnMenuItem({ label, name, action, icon });
  }
  /**
   * Aplica o estado das colunas.
   */
  async setColumnsState(state) {
    this._gridController.setColumnsState(state);
  }
  /**
   * Insere os registros no ez-grid.
   */
  async setData(data) {
    this._gridController.setData(data);
  }
  /**
   * Obtém as linhas selecionadas.
   */
  async getSelection() {
    return Promise.resolve(this._gridController.getSelection());
  }
  /**
   * Obtém o estado atual das colunas.
   */
  async getColumnsState() {
    return Promise.resolve(this._gridController.getColumnsState());
  }
  /**
   * Obtém a lista de definição de colunas.
   */
  async getColumns() {
    return Promise.resolve(this._gridController.getColumnsDef());
  }
  /**
   * Aplica um filtro rápido.
   */
  async quickFilter(term) {
    this._gridController.quickFilter(term);
  }
  /**
   * Localiza determinada coluna tornando-a visível.
   */
  async locateColumn(columnName) {
    this._gridController.locateColumn(columnName, this._element);
  }
  /**
   * Usa um argumento para filtrar as colunas po label
   */
  async filterColumns(search) {
    return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
  }
  /**
   * Registra um editor customizado para campos da grade e formulário.
   */
  async addCustomEditor(fieldName, customEditor, detailContext) {
    const newCustomEditor = new Map(this._customEditor);
    newCustomEditor.set(fieldName, {
      customEditor,
      detailContext,
    });
    this._customEditor = newCustomEditor;
    this._gridController.setCellEditors(newCustomEditor);
  }
  /**
   * Registra um render customizado para colunas da grid.
   */
  async addGridCustomRender(fieldName, customRender, detailContext) {
    const newCustomRenders = new Map(this._customRenders);
    newCustomRenders.set(fieldName, { customRender, detailContext });
    this._customRenders = newCustomRenders;
    this._gridController.setCellRenders(newCustomRenders);
  }
  /**
   * Registra um formatador de valores para uma coluna da grid.
   */
  async addCustomValueFormatter(columnName, customFormatter) {
    if (!columnName || !customFormatter) {
      return;
    }
    const newCustomFormatters = new Map(this._customFormatters);
    newCustomFormatters.set(columnName, customFormatter);
    this._customFormatters = newCustomFormatters;
    this._gridController.setCustomFormatters(newCustomFormatters);
  }
  /**
   * Remove o formatador de valores de uma coluna da grid.
   */
  async removeCustomValueFormatter(columnName) {
    if (!columnName) {
      return;
    }
    const newCustomFormatters = new Map(this._customFormatters);
    newCustomFormatters.delete(columnName);
    this._customFormatters = newCustomFormatters;
    this._gridController.setCustomFormatters(newCustomFormatters);
  }
  /**
   * Atualiza linhas da grade.
   */
  async refreshSelectedRows() {
    this._gridController.refreshSelectedRows();
  }
  /**
   * Retorna o formatador customizado da coluna caso exista.
   */
  async getCustomValueFormatter(columnName) {
    return this._customFormatters.get(columnName);
  }
  /**
   * Atribui o foco para a grade.
   */
  async setFocus() {
    this._gridController.setFocus();
  }
  /**
   * Para a edição da grade.
   */
  async stopEdit() {
    this._gridController.stopEdit();
  }
  async checkStopEditOutsideClick(event) {
    var _a;
    if ((_a = this._container) === null || _a === void 0 ? void 0 : _a.contains(event.target))
      return;
    this._gridController.stopEdit();
  }
  observeConfig(config) {
    this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
  }
  updatePaginationTooltip() {
    this.handleShowCancelPagination();
    if (!this._refPaginationLabelTooltip)
      return;
    const alreadyDefined = this._refPaginationLabelTooltip.getAttribute('data-tooltip');
    if (alreadyDefined) {
      this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
    }
  }
  observePaginationCounterMode(newValue) {
    if (newValue === 'hidden') {
      this._hidePaginationDescription();
    }
    if (newValue === 'show') {
      this._showPaginationDescription();
    }
  }
  async observeModeChange(newMode = this.mode) {
    if (newMode === "simple") {
      this.canEdit = false;
      this.multipleSelection = false;
      this.suppressCheckboxColumn = true;
      this.compact = true;
    }
  }
  async handleApplyFilterColumn() {
    const filters = this._gridController.getFilter();
    this.ezColumnFilterChanged.emit(filters !== null && filters !== void 0 ? filters : []);
  }
  onSelectionChange(evt) {
    this._currentPageSelected = evt.detail.selectionHeaderStatus === true;
    if (this.dataUnit) {
      this.setSelection(this.dataUnit.getSelectionInfo());
    }
  }
  async handleClick(event) {
    this.checkStopEditOutsideClick(event);
  }
  setSelection(selectionInfo) {
    var _a;
    this._selectionCount = (_a = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.length) !== null && _a !== void 0 ? _a : 0;
    this._isAllSelection = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords();
    this._showSelectionCounter = this._selectionCount > 1 || this._isAllSelection;
  }
  onSelectAllRecords() {
    var _a;
    (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.setSelection(SelectionMode.ALL_RECORDS).then(selection => this.setSelection(selection));
  }
  onSelectPageRecords() {
    var _a;
    (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.setSelection(this.dataUnit.records.map(record => record.__record__id__)).then(selection => this.setSelection(selection));
  }
  onClearSelectedRecords() {
    var _a;
    (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
    this._gridController.clearRangeSelection();
    this.setSelection(undefined);
  }
  createConfigFromState(state) {
    let newConfig = { columns: [] };
    state.forEach(columnState => {
      if (!columnState.hidden) {
        let newConfigColumn = { name: columnState.name };
        if (columnState.width) {
          newConfigColumn['width'] = columnState.width;
        }
        if (columnState.sort) {
          newConfigColumn['ascending'] = columnState.sort.toUpperCase() === 'ASC';
          newConfigColumn['orderIndex'] = columnState.sortIndex;
        }
        else {
          newConfigColumn['orderIndex'] = 0;
        }
        if (newConfigColumn) {
          newConfig.columns.push(newConfigColumn);
        }
      }
    });
    return newConfig;
  }
  positionSelectionCounter() {
    var _a, _b;
    if (!this._gridSelectionCounter)
      return;
    if (!this._showSelectionCounter) {
      this._gridSelectionCounter.style.bottom = '';
      return;
    }
    const containerRect = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
    const selectionRect = (_b = this._gridSelectionCounter) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
    if (!containerRect || !selectionRect)
      return;
    const positionBottom = containerRect.bottom - 30;
    this._gridSelectionCounter.style.bottom = document.body.clientHeight - positionBottom + 'px';
    this._gridSelectionCounter.style.left = this.calculatePositionLeft(containerRect, selectionRect);
  }
  calculatePositionLeft(containerRect, selectionRect) {
    let selectionStart = containerRect.left + (containerRect.width / 2);
    const containerRightEdge = containerRect.left + this._container.clientWidth;
    const selectionEnd = (selectionStart - (selectionRect.width / 2)) + selectionRect.width;
    if (selectionEnd > containerRightEdge) {
      selectionStart = containerRightEdge - (selectionRect.width / 2);
    }
    return `${selectionStart}px`;
  }
  setEvents() {
    window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
    window.addEventListener('scroll', this.positionSelectionCounter.bind(this));
  }
  resizeSelectionCounter() {
    if (this._gridSelectionCounter == undefined) {
      return;
    }
    this._gridSelectionCounter.style.width = '';
    if (this._gridSelectionCounter.clientHeight > 42) {
      this._gridSelectionCounter.style.width = 'min-content';
    }
    this.positionSelectionCounter();
  }
  configSelectionCounter() {
    if (this._element == undefined) {
      return;
    }
    if (this._resizeObserver != undefined) {
      this._resizeObserver.unobserve(this._element);
    }
    this._resizeObserver = new ResizeObserver(JSUtils.debounce(this.resizeSelectionCounter.bind(this), 200));
    this._resizeObserver.observe(this._element);
    this.resizeSelectionCounter();
  }
  onColumnStateChange(type, state, info) {
    var _a;
    this.ezColumnStateChange.emit({ type, state, isUserChange: info.isUserChange });
    if (info.isUserChange) {
      if (type === 'columnMovedEnd' && !info.isElementResize) {
        let newConfig;
        if (this.config) {
          newConfig = { columns: [] };
          state.forEach(columnState => {
            let newConfigColumn = this.config.columns.find(column => column.name === columnState.name);
            if (newConfigColumn) {
              newConfigColumn.width = columnState.width;
              newConfig.columns.push(newConfigColumn);
            }
          });
        }
        else {
          newConfig = this.createConfigFromState(state);
        }
        if (newConfig.columns.length > 0) {
          this.configChange.emit(newConfig);
        }
      }
      else if (type === 'columnResize') {
        if ((_a = info.column) === null || _a === void 0 ? void 0 : _a.colId) {
          let newConfig;
          if (this.config) {
            newConfig = Object.assign({}, this.config);
          }
          else {
            newConfig = this.createConfigFromState(state);
          }
          let newColumn = newConfig.columns.find(column => column.name === info.column.colId);
          if (newColumn) {
            newColumn.customWidth = info.column.actualWidth;
            this.configChange.emit(newConfig);
          }
        }
      }
    }
  }
  buildDataElementId() {
    const dataInfo = { dataUnit: this.dataUnit };
    ElementIDUtils.addIDInfo(this._element, null, dataInfo);
    const dtInfo = { id: 'ezGrid' };
    if (this._refPaginationControl) {
      ElementIDUtils.addIDInfo(this._refPaginationControl, 'pagination', dtInfo);
    }
  }
  handlePageChange() {
    this.resetPaginationState();
    this._gridController.setFocusFirstRow();
    this.ezPageChangedChanged.emit();
  }
  previousPage() {
    if (this.dataUnit) {
      this.dataUnit.previousPage()
        .then(() => this.handlePageChange());
    }
  }
  nextPage() {
    if (this.dataUnit) {
      this.dataUnit.nextPage()
        .then(() => this.handlePageChange());
    }
  }
  nextRecord() {
    if (this.dataUnit) {
      if (this.dataUnit.getSelectionInfo().records.length === 0) {
        this.dataUnit.selectFirst();
        return;
      }
      this.dataUnit.nextRecord();
    }
  }
  previousRecord() {
    if (this.dataUnit) {
      this.dataUnit.previousRecord();
    }
  }
  resetPaginationState() {
    var _a;
    this._paginationChangedByKeyboard = false;
    (_a = this._gridController) === null || _a === void 0 ? void 0 : _a.resetPaginationState();
  }
  resolvePaginationClassMode() {
    if (this.shouldPresentPaginationLabel())
      return "pagination-expanded";
    return "pagination-contracted";
  }
  async handleCancelPagination() {
    var _a;
    this.dataUnit.cancelPagination = true;
    await ((_a = this._cancelPaginationPopoverElement) === null || _a === void 0 ? void 0 : _a.hide());
  }
  renderCancelPagination() {
    return (h("ez-popover", { ref: (element) => (this._cancelPaginationPopoverElement = element), "overlay-type": 'none', autoClose: false }, h("div", { class: 'cancel-pagination' }, h("ez-icon", { iconName: "sync", size: "x-large", class: "spin" }), h("span", { onClick: () => this.handleCancelPagination(), class: 'cancel-pagination-btn' }, this.i18n("ez-grid.cancelPagination")))));
  }
  handleShowCancelPagination() {
    var _a, _b, _c;
    if (!this._hasToShowCancelPagination()) {
      (_a = this._cancelPaginationPopoverElement) === null || _a === void 0 ? void 0 : _a.hide();
      return;
    }
    if ((_b = this._cancelPaginationPopoverElement) === null || _b === void 0 ? void 0 : _b.opened)
      return;
    (_c = this._cancelPaginationPopoverElement) === null || _c === void 0 ? void 0 : _c.show("15px");
  }
  getPaginationControl() {
    if (!this._paginationInfo)
      return null;
    const { currentPage, hasMore } = this._paginationInfo;
    return (h("div", { class: `grid-header__container grid-header__pagination ${this.resolvePaginationClassMode()}`, ref: ref => (this._refPaginationControl = ref) }, this.renderCancelPagination(), h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium", ref: (element) => (this._refPaginationLabel = element) }, h("span", { class: "grid-header__pagination-label" }, this.shouldPresentPaginationLabel() && h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, this._getActualPageLabel()), this.shouldPresentPaginationLabel() && this._getRemainingPageLabel())), h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium", title: `${this._getActualPageLabel()} ${this._getRemainingPageLabel()}` }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: this.i18n("ez-grid.previousPage") }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: this.i18n("ez-grid.nextPage") }))));
  }
  shouldPresentPaginationLabel() {
    return this.paginationCounterMode === 'show' || this.paginationCounterMode === 'auto';
  }
  componentDidLoad() {
    const _application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
    this.enableLockManagerLoadingComp = (!_application || (_application === null || _application === void 0 ? void 0 : _application.enableLockManagerLoadingApp)) ? this.enableLockManagerLoadingComp : false;
    this._gridController.initDatagrid(this._container, {
      onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
      onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
      onPaginationChange: (paginationInfo, selectFirstRecord) => {
        this.handlePaginationChange(selectFirstRecord, paginationInfo);
      },
      onPaginationUpdate: (paginationInfo) => {
        this._paginationInfo = paginationInfo;
      },
      onDoubleClick: (row) => {
        this.ezDoubleClick.emit(row);
      },
      allowMultipleSelection: this.multipleSelection,
      serverURL: this.serverUrl,
      dataUnit: this.dataUnit,
      statusResolver: this.statusResolver,
      useEnterLikeTab: this.useEnterLikeTab,
      recordsValidator: this.recordsValidator,
      editionIsDisabled: () => !this.canEdit,
      customFormatters: this._customFormatters,
      autoFocus: this.autoFocus,
      enableGridInsert: this.enableGridInsert,
      enableContinuousInsert: this.enableContinuousInsert,
      suppressFilterColumn: this.suppressFilterColumn,
      suppressCheckBoxCol: this.suppressCheckboxColumn,
      onRefresh: () => {
        if (this.dataUnit) {
          this.setSelection(this.dataUnit.getSelectionInfo());
        }
      },
      enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick,
      enableLockManagerLoadingComp: this.enableLockManagerLoadingComp,
      enableRowTableStriped: this.enableRowTableStriped,
      suppressHorizontalScroll: this.suppressHorizontalScroll,
      i18n: this.i18n
    });
    if (this.config) {
      this.observeConfig(this.config);
    }
    if (this.dataUnit != undefined) {
      this._paginationInfo = this.dataUnit.getPaginationInfo();
    }
    this.buildDataElementId();
    this.setEvents();
    this.componentReady.emit();
    this._gridController.configFilterColumn(this._filterColumn);
    this.initKeyboardManager();
  }
  handlePaginationChange(selectFirstRecord, paginationInfo) {
    var _a;
    if (selectFirstRecord !== false && this.autoFocus) {
      if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
        this._gridController.setFocusLastRow();
      }
      else {
        this._gridController.setFocusFirstRow();
        this._paginationChangedByKeyboard = true;
      }
    }
    this._paginationInfo = paginationInfo;
  }
  _getActualPageLabel() {
    const { firstRecord, lastRecord } = this._paginationInfo;
    return `${firstRecord}-${lastRecord}`;
  }
  _getRemainingPageLabel() {
    const { total, count } = this._paginationInfo;
    return `${total == undefined ? this.i18n("ez-grid.remainingPageLabel", { count: count + 1 }) : this.i18n("ez-grid.remainingTotalLabel", { total })}`;
  }
  _hasToShowCancelPagination() {
    var _a;
    const { total, count } = (_a = this._paginationInfo) !== null && _a !== void 0 ? _a : {};
    const hasMore = (total === undefined);
    return !this.dataUnit.cancelPagination && hasMore && count > this.dataUnit.pageSize;
  }
  _getPaginationTooltip() {
    return this._getActualPageLabel() + this._getRemainingPageLabel();
  }
  _initHeaderOverflowWatcher() {
    var _a;
    (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
    if (this._refPaginationControl)
      this._headerOverflowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
  }
  buildOverFlowWatcherParams() {
    return {
      element: this._refPaginationControl,
      callback: this.handleOverFlow.bind(this),
      notOverFlow: ["grid-pagination-tooltip"]
    };
  }
  handleOverFlow() {
    if (!this._refPaginationLabel || !this._refPaginationControl)
      return;
    const controlWidth = this._refPaginationControl.clientWidth;
    const labelWidth = this._refPaginationLabel.scrollWidth;
    const buttonsElement = this._refPaginationControl.querySelector('#grid-pagination-tooltip');
    const buttonsWidth = (buttonsElement === null || buttonsElement === void 0 ? void 0 : buttonsElement.clientWidth) || 0;
    const totalMargins = this._getElementMargins(this._refPaginationLabel) + (buttonsElement ? this._getElementMargins(buttonsElement) : 0);
    const paginationWidthWithoutDescription = labelWidth + buttonsWidth + totalMargins;
    const paginationWidthWithDescription = paginationWidthWithoutDescription + this._getPaginationDescriptionWidth();
    if (controlWidth > paginationWidthWithDescription) {
      this._showPaginationDescription();
    }
    else if (controlWidth <= paginationWidthWithoutDescription) {
      this._hidePaginationDescription();
    }
  }
  _getPaginationDescriptionWidth() {
    var _a;
    return ((_a = this._refPaginationLabelTooltip) === null || _a === void 0 ? void 0 : _a.scrollWidth) || 0;
  }
  _getElementMargins(element) {
    const style = getComputedStyle(element);
    return parseFloat(style.marginLeft) + parseFloat(style.marginRight);
  }
  _hidePaginationDescription() {
    this._refPaginationLabel.classList.add(OVERFLOWED_CLASS_NAME);
    this._refPaginationLabelTooltip.setAttribute('data-flow', 'bottom');
    this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
  }
  ;
  _showPaginationDescription() {
    this._refPaginationLabel.classList.remove(OVERFLOWED_CLASS_NAME);
    this._refPaginationLabelTooltip.removeAttribute('data-flow');
    this._refPaginationLabelTooltip.removeAttribute('data-tooltip');
  }
  disconnectedCallback() {
    var _a, _b;
    (_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
    (_b = this._gridController) === null || _b === void 0 ? void 0 : _b.destroy();
    this.removeShortcuts();
  }
  connectedCallback() {
    var _a;
    this.observeModeChange();
    (_a = this._gridController) === null || _a === void 0 ? void 0 : _a.registryListeners();
  }
  componentWillRender() {
    this.configSelectionCounter();
  }
  componentDidRender() {
    windowInstace.addEventListener('onSubmitFilter', () => {
      ApplicationUtils.info(this.i18n("ez-grid.filterAppliedSuccess"));
    });
  }
  async componentWillLoad() {
    this.i18n = await initI18n();
    this._hasLeftButtons = !!this._element.querySelector('[slot="leftButtons"]');
    if (!this.dataUnit.name.includes("InMemoryDataUnit"))
      return;
  }
  componentDidUpdate() {
    this._gridController.setAutoFocus(this.autoFocus);
    this._gridController.setEnableGridInsert(this.enableGridInsert);
    this._gridController.setEnableContinuousInsert(this.enableContinuousInsert);
    if (this.dataUnit && this._showSelectionCounter) {
      this.setSelection(this.dataUnit.getSelectionInfo());
    }
    if (this.paginationCounterMode === 'auto')
      this._initHeaderOverflowWatcher();
  }
  getDataSource() {
    if (!this.columnfilterDataSource) {
      this.columnfilterDataSource = new InMemoryFilterColumnDataSource(this.dataUnit);
    }
    return this.columnfilterDataSource;
  }
  hideHeader() {
    if (this.mode === "simple") {
      return true;
    }
    return !this._hasLeftButtons && !this._paginationInfo;
  }
  resolveLeftHeaderClass() {
    if (this.paginationCounterMode == 'show')
      return "left__header-expanded";
    return "left__header-contracted";
  }
  async initKeyboardManager() {
    this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
    this._keyboardManager
      .bind("ctrl + .", () => {
      if (!this._paginationInfo)
        return;
      this.nextRecord();
    }, { description: this.i18n("ez-grid.nextRecord"), element: this._element })
      .bind("ctrl + ,", () => {
      if (!this._paginationInfo)
        return;
      this.previousRecord();
    }, { description: this.i18n("ez-grid.previousRecord"), element: this._element })
      .bind("ctrl + alt + ArrowLeft", () => {
      if (!this._paginationInfo)
        return;
      const { currentPage } = this._paginationInfo;
      if (currentPage > 0) {
        this.previousPage();
      }
    }, { description: this.i18n("ez-grid.previousPage"), element: this._element })
      .bind("ctrl + alt + ArrowRight", () => {
      if (!this._paginationInfo)
        return;
      const { hasMore } = this._paginationInfo;
      if (hasMore) {
        this.nextPage();
      }
    }, { description: this.i18n("ez-grid.nextPage"), element: this._element });
    if (this.useSearchColumn) {
      this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
        if (!this._container || !this._ezPopoverSearchColumn)
          return;
        const container = this._container.getBoundingClientRect();
        await focusOnFieldSerch(this._columnSearch);
        this._ezPopoverSearchColumn.showUnder(this._container, { horizontalGap: container.width - (SEARCH_FIELD_FULL_WIDTH), verticalGap: container.height * -1 });
      }, { description: this.i18n("ez-grid.searchColumn"), element: this._element });
    }
  }
  async removeShortcuts() {
    var _a;
    (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
  }
  renderFieldSearchColumn() {
    this._columnSearch = buildFieldSearch({
      value: StringUtils.generateUUID(),
      label: this.i18n("ez-grid.labelSearchColumn"),
    }, ({ argument }) => new Promise(accept => {
      this.filterColumns(argument).then((columns) => {
        accept(columns
          .filter(column => !column.hidden)
          .map(column => ({ label: column.label, value: column.name })));
      });
    }), async (option) => {
      if (option != undefined && option.value != undefined) {
        await this.locateColumn(option.value);
        if (this._ezPopoverSearchColumn) {
          this._ezPopoverSearchColumn.hide();
        }
        if (this._container) {
          requestAnimationFrame(() => this._container.focus());
        }
      }
    });
    return this._columnSearch;
  }
  render() {
    var _a;
    return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: {
        'grid__container ez-grid': true,
        'outline-mode': this.outlineMode,
        'shadow-mode': !this.outlineMode,
        'no-padding': this.compact,
        'header-overlay': !this.hideHeader(),
        'no-scroll': this.suppressHorizontalScroll
      }, ref: elem => (this._container = elem), tabindex: "0" }), h("div", { class: {
        'ez-box ez-padding--small grid-header': true,
        'outline-mode': this.outlineMode,
        'shadow-mode': !this.outlineMode && !this.hideHeader(),
      }, tabindex: "0" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: `grid-header__container grid-header__left-container ${this.resolveLeftHeaderClass()}` }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("ez-popover", { ref: elem => (this._ezPopoverSearchColumn = elem), overlayType: "none" }, this.renderFieldSearchColumn()), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter  ez-elevation--4
          ${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
        ` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, i18n: this.i18n, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
  }
  static get is() { return "ez-grid"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() {
    return {
      "$": ["ez-grid.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["ez-grid.css"]
    };
  }
  static get assetsDirs() { return ["../assets"]; }
  static get properties() {
    return {
      "enableLockManagerLoadingComp": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Define se o componente deve usar o LockManager para controle de carregamento da aplica\u00E7\u00E3o"
        },
        "attribute": "enable-lock-manager-loading-comp",
        "reflect": false,
        "defaultValue": "false"
      },
      "enableLockManagerTaskbarClick": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Ativa inser\u00E7\u00E3o de registros no modo grade pela Taskbar."
        },
        "attribute": "enable-lock-manager-taskbar-click",
        "reflect": false,
        "defaultValue": "true"
      },
      "multipleSelection": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Habilita a sele\u00E7\u00E3o de v\u00E1rias linhas."
        },
        "attribute": "multiple-selection",
        "reflect": false
      },
      "config": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "IGridConfig",
          "resolved": "IGridConfig",
          "references": {
            "IGridConfig": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Configura\u00E7\u00E3o de exibi\u00E7\u00E3o da grade."
        }
      },
      "selectionToastConfig": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "ISelectionToastConfig",
          "resolved": "ISelectionToastConfig",
          "references": {
            "ISelectionToastConfig": {
              "location": "import",
              "path": "./interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Configura\u00E7\u00E3o da sele\u00E7\u00E3o de grade no toast."
        }
      },
      "serverUrl": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Endere\u00E7o do servidor para obten\u00E7\u00E3o dos dados."
        },
        "attribute": "server-url",
        "reflect": false
      },
      "dataUnit": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "DataUnit",
          "resolved": "DataUnit",
          "references": {
            "DataUnit": {
              "location": "import",
              "path": "@sankhyalabs/core"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Unidade de dados. Respons\u00E1vel pelo controle de edi\u00E7\u00E3o de registros e\ninforma\u00E7\u00F5es pertinentes aos campos."
        }
      },
      "statusResolver": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "IStatusResolver | StatusResolverFunction",
          "resolved": "((data: object) => string) | IStatusResolver",
          "references": {
            "IStatusResolver": {
              "location": "import",
              "path": "./controller/EzGridController"
            },
            "StatusResolverFunction": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define um `IStatusResolver` respons\u00E1vel pelo estado da coluna de status."
        }
      },
      "columnfilterDataSource": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "IMultiSelectionListDataSource",
          "resolved": "IMultiSelectionListDataSource",
          "references": {
            "IMultiSelectionListDataSource": {
              "location": "import",
              "path": "../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define um `IMultiSelectionListDataSource` respons\u00E1vel por alimentar o filtro de colunas."
        }
      },
      "useEnterLikeTab": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Quando verdadeiro, o ENTER far\u00E1 a navega\u00E7\u00E3o como se fosse a tecla TAB na grade."
        },
        "attribute": "use-enter-like-tab",
        "reflect": false,
        "defaultValue": "false"
      },
      "recordsValidator": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "IRecordValidator",
          "resolved": "IRecordValidator",
          "references": {
            "IRecordValidator": {
              "location": "import",
              "path": "../../utils/form/interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define um validador respons\u00E1vel pela integridade dos registros."
        }
      },
      "canEdit": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se a edi\u00E7\u00E3o est\u00E1 habilitada na grid."
        },
        "attribute": "can-edit",
        "reflect": false,
        "defaultValue": "true"
      },
      "autoFocus": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Define se a grid ser\u00E1 focada ao ser carregada."
        },
        "attribute": "auto-focus",
        "reflect": false,
        "defaultValue": "true"
      },
      "paginationCounterMode": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "'show' | 'hidden' | 'auto'",
          "resolved": "\"auto\" | \"hidden\" | \"show\"",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Define se a grid ser\u00E1 focada ao ser carregada."
        },
        "attribute": "pagination-counter-mode",
        "reflect": false,
        "defaultValue": "'auto'"
      },
      "enableGridInsert": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
        },
        "attribute": "enable-grid-insert",
        "reflect": false,
        "defaultValue": "false"
      },
      "enableContinuousInsert": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Ativa/desativa a inser\u00E7\u00E3o continua na grade\nS\u00F3 funciona quando a prop enableGridInsert est\u00E1 ativa"
        },
        "attribute": "enable-continuous-insert",
        "reflect": false,
        "defaultValue": "true"
      },
      "suppressCheckboxColumn": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Informa se a coluna de chechbox deve ser suprimida"
        },
        "attribute": "suppress-checkbox-column",
        "reflect": false,
        "defaultValue": "false"
      },
      "suppressFilterColumn": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Informa se a grade deve suprimir o filtro de coluna."
        },
        "attribute": "suppress-filter-column",
        "reflect": false,
        "defaultValue": "false"
      },
      "outlineMode": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Altera visualmente as sombras e bordas do componente\nQuando false, aplica o padr\u00E3o de sombras ao componente (Utilizar quando for o elemento principal do layout)\nQuando true, aplica o padr\u00E3o de outline ao componente (Utilizar quando estiver contido em outro elemento como um painel ou pop-up)"
        },
        "attribute": "outline-mode",
        "reflect": false,
        "defaultValue": "false"
      },
      "enableRowTableStriped": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Ativa modo de linhas com cores alternadas."
        },
        "attribute": "enable-row-table-striped",
        "reflect": false,
        "defaultValue": "true"
      },
      "compact": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Define se a grade deve ser exibida em modo compacto"
        },
        "attribute": "compact",
        "reflect": false,
        "defaultValue": "false"
      },
      "useSearchColumn": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se a grade deve exibir um buscador de coluna com uso do Ctrl+F"
        },
        "attribute": "use-search-column",
        "reflect": false,
        "defaultValue": "true"
      },
      "suppressHorizontalScroll": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define se a grade deve suprimir o scroll horizontal."
        },
        "attribute": "suppress-horizontal-scroll",
        "reflect": false,
        "defaultValue": "false"
      },
      "mode": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "IGridMode",
          "resolved": "\"complete\" | \"simple\"",
          "references": {
            "IGridMode": {
              "location": "import",
              "path": "./interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Define o modo de uso da grade"
        },
        "attribute": "mode",
        "reflect": true,
        "defaultValue": "\"complete\""
      }
    };
  }
  static get states() {
    return {
      "_paginationInfo": {},
      "_paginationChangedByKeyboard": {},
      "_showSelectionCounter": {},
      "_isAllSelection": {},
      "_currentPageSelected": {},
      "_selectionCount": {},
      "_hasLeftButtons": {},
      "_customFormatters": {}
    };
  }
  static get events() {
    return [{
        "method": "ezColumnStateChange",
        "name": "ezColumnStateChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando acontece a altera\u00E7\u00E3o de estado das colunas do grid: Ordena\u00E7\u00E3o, largura, etc."
        },
        "complexType": {
          "original": "EzGridColumStateEvent",
          "resolved": "EzGridColumStateEvent",
          "references": {
            "EzGridColumStateEvent": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          }
        }
      }, {
        "method": "ezPageChangedChanged",
        "name": "ezPageChangedChanged",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido a p\u00E1gina atual \u00E9 alterada."
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }, {
        "method": "ezColumnFilterChanged",
        "name": "ezColumnFilterChanged",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando acontece a altera\u00E7\u00E3o de filtro de colunas."
        },
        "complexType": {
          "original": "Array<Filter>",
          "resolved": "Filter[]",
          "references": {
            "Array": {
              "location": "global"
            },
            "Filter": {
              "location": "import",
              "path": "@sankhyalabs/core"
            }
          }
        }
      }, {
        "method": "ezSelectionChange",
        "name": "ezSelectionChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando acontece a altera\u00E7\u00E3o de sele\u00E7\u00E3o de linhas."
        },
        "complexType": {
          "original": "ISelection",
          "resolved": "ISelection",
          "references": {
            "ISelection": {
              "location": "import",
              "path": "./interfaces"
            }
          }
        }
      }, {
        "method": "ezDoubleClick",
        "name": "ezDoubleClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido com o duplo clique de uma linha"
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }, {
        "method": "configChange",
        "name": "configChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando acontece a altera\u00E7\u00E3o de configura\u00E7\u00E3o do grade."
        },
        "complexType": {
          "original": "IGridConfig",
          "resolved": "IGridConfig",
          "references": {
            "IGridConfig": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          }
        }
      }, {
        "method": "componentReady",
        "name": "componentReady",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitido quando o componente estiver completamente carregado."
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }];
  }
  static get methods() {
    return {
      "setColumnsDef": {
        "complexType": {
          "signature": "(cols: Array<EzGridColumn>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            },
            "EzGridColumn": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Aplica a defini\u00E7\u00E3o de colunas.",
          "tags": []
        }
      },
      "getAppliedColumnFilters": {
        "complexType": {
          "signature": "() => Promise<Array<Filter>>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Filter": {
              "location": "import",
              "path": "@sankhyalabs/core"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<Filter[]>"
        },
        "docs": {
          "text": "Retorna os filtros aplicados.",
          "tags": []
        }
      },
      "refreshColumnFilterDataSource": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      },
      "addColumnMenuItem": {
        "complexType": {
          "signature": "(label: string, name: string, action: Function, icon: HTMLElement | string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Function": {
              "location": "global"
            },
            "HTMLElement": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Adiciona item de menu nas colunas.",
          "tags": []
        }
      },
      "setColumnsState": {
        "complexType": {
          "signature": "(state: Array<EzGridColumnConfig>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            },
            "EzGridColumnConfig": {
              "location": "import",
              "path": "./controller/EzGridController"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Aplica o estado das colunas.",
          "tags": []
        }
      },
      "setData": {
        "complexType": {
          "signature": "(data: Array<any>) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Insere os registros no ez-grid.",
          "tags": []
        }
      },
      "getSelection": {
        "complexType": {
          "signature": "() => Promise<Array<any>>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<any[]>"
        },
        "docs": {
          "text": "Obt\u00E9m as linhas selecionadas.",
          "tags": []
        }
      },
      "getColumnsState": {
        "complexType": {
          "signature": "() => Promise<Array<EzGridColumn>>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "EzGridColumn": {
              "location": "import",
              "path": "./controller/EzGridController"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<EzGridColumn[]>"
        },
        "docs": {
          "text": "Obt\u00E9m o estado atual das colunas.",
          "tags": []
        }
      },
      "getColumns": {
        "complexType": {
          "signature": "() => Promise<Array<EzGridColumn>>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            },
            "EzGridColumn": {
              "location": "import",
              "path": "./controller/EzGridController"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<EzGridColumn[]>"
        },
        "docs": {
          "text": "Obt\u00E9m a lista de defini\u00E7\u00E3o de colunas.",
          "tags": []
        }
      },
      "quickFilter": {
        "complexType": {
          "signature": "(term: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Aplica um filtro r\u00E1pido.",
          "tags": []
        }
      },
      "locateColumn": {
        "complexType": {
          "signature": "(columnName: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Localiza determinada coluna tornando-a vis\u00EDvel.",
          "tags": []
        }
      },
      "filterColumns": {
        "complexType": {
          "signature": "(search: string) => Promise<Array<EzGridColumn>>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "EzGridColumn": {
              "location": "import",
              "path": "./controller/EzGridController"
            },
            "Array": {
              "location": "global"
            }
          },
          "return": "Promise<EzGridColumn[]>"
        },
        "docs": {
          "text": "Usa um argumento para filtrar as colunas po label",
          "tags": []
        }
      },
      "addCustomEditor": {
        "complexType": {
          "signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ICustomEditor": {
              "location": "import",
              "path": "../../utils/customEditor/interfaces/ICustomEditor"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
          "tags": []
        }
      },
      "addGridCustomRender": {
        "complexType": {
          "signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ICustomRender": {
              "location": "import",
              "path": "../../utils/customRender/interfaces/ICustomRender"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Registra um render customizado para colunas da grid.",
          "tags": []
        }
      },
      "addCustomValueFormatter": {
        "complexType": {
          "signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }, {
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ICustomFormatter": {
              "location": "import",
              "path": "./interfaces"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Registra um formatador de valores para uma coluna da grid.",
          "tags": []
        }
      },
      "removeCustomValueFormatter": {
        "complexType": {
          "signature": "(columnName: string) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Remove o formatador de valores de uma coluna da grid.",
          "tags": []
        }
      },
      "refreshSelectedRows": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Atualiza linhas da grade.",
          "tags": []
        }
      },
      "getCustomValueFormatter": {
        "complexType": {
          "signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "ICustomFormatter": {
              "location": "import",
              "path": "./interfaces"
            }
          },
          "return": "Promise<ICustomFormatter>"
        },
        "docs": {
          "text": "Retorna o formatador customizado da coluna caso exista.",
          "tags": []
        }
      },
      "setFocus": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Atribui o foco para a grade.",
          "tags": []
        }
      },
      "stopEdit": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Para a edi\u00E7\u00E3o da grade.",
          "tags": []
        }
      },
      "checkStopEditOutsideClick": {
        "complexType": {
          "signature": "(event: MouseEvent) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            },
            "MouseEvent": {
              "location": "global"
            },
            "Node": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "",
          "tags": []
        }
      }
    };
  }
  static get elementRef() { return "_element"; }
  static get watchers() {
    return [{
        "propName": "config",
        "methodName": "observeConfig"
      }, {
        "propName": "_paginationInfo",
        "methodName": "updatePaginationTooltip"
      }, {
        "propName": "paginationCounterMode",
        "methodName": "observePaginationCounterMode"
      }, {
        "propName": "mode",
        "methodName": "observeModeChange"
      }];
  }
  static get listeners() {
    return [{
        "name": "applyFilterColumnOptions",
        "method": "handleApplyFilterColumn",
        "target": undefined,
        "capture": false,
        "passive": false
      }, {
        "name": "ezSelectionChange",
        "method": "onSelectionChange",
        "target": undefined,
        "capture": false,
        "passive": false
      }, {
        "name": "click",
        "method": "handleClick",
        "target": undefined,
        "capture": true,
        "passive": false
      }];
  }
}
