import { ApplicationContext, HTMLBuilder } from '@sankhyalabs/core';
export const buildSearchPlus = ({ name, required, readOnly, dataUnit }) => {
  const ezSearch = HTMLBuilder.parseElement(`<ez-search-plus
          class="ez-grid grid_editor"
          mode="slim"
          suppress-empty-option=${required}
          enabled=${!readOnly}
          hide-description-input=${true}
    />`);
  const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__PLUS__OPTION__LOADER__");
  ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
  ezSearch.autoFocus = true;
  ezSearch.valueGetter = () => ezSearch.getValueAsync();
  return ezSearch;
};
