import { FSuggest, FSuggestSuggestionsCategory, FSuggestTemplate } from "./f-suggest"; import { html } from "lit"; export function displayOptions(this: FSuggest, suggestions: string[]) { return html`${suggestions.map((sg, index) => { return html` ${this.isSearchComponent ? html` ` : ""} ${sg} `; })}`; } export function displayCustomTemplate(this: FSuggest, suggestions: FSuggestTemplate[]) { return html`${suggestions.map((sg, index) => { return html` this.handleSelect(sg)} clickable .selected=${index === this.currentIndex ? "background" : "none"} > ${sg.template(this.value)} `; })}`; } export function displayCategories(this: FSuggest, suggestions: FSuggestSuggestionsCategory) { return Object.entries(suggestions).map(([objName, objValue], categoryIndex) => { return html`${objName} ${objValue.map((item, index) => { return html` ${this.isSearchComponent ? html` ` : ""} ${item} `; })} `; }); }