UNPKG

coveo-search-ui-extensions

Version:

Small generic components to extend the functionality of Coveo's Search UI framework.

70 lines (69 loc) 2.13 kB
import { Component, IComponentBindings } from 'coveo-search-ui'; import './Strings'; /** * Initialization options of the **QueryList** class. */ export interface IQueryListOptions { /** * Number of User Queries shown. * * Default: `3` * Minimum: `1` */ numberOfItems: number; /** * Label of the list of User Queries. * * Default: `Most Recent Queries` */ listLabel: string; /** * Function that tranform a query of the list into a HTMLElement representation. * * Default: Create a span element such as `<span class="coveo-content">My Query</span>`. * * @param query The query to transform. */ transform(query: string): Promise<HTMLElement>; /** * Identifier of the user from which Clicked Documents are shown. * * **Require** */ userId: string; } /** * Display the list of the most recent queries of a user. */ export declare class QueryList extends Component { element: HTMLElement; options: IQueryListOptions; bindings: IComponentBindings; /** * Identifier of the Search-UI component. */ static readonly ID = "QueryList"; /** * Default initialization options of the **QueryList** class. */ static readonly options: IQueryListOptions; private userProfileModel; private sortedQueryList; /** * Create an instance of **QueryList**. Initialize is needed the **UserProfileModel** and fetch user actions related to the **UserId**. * * @param element Element on which to bind the component. * @param options Initialization options of the component. * @param bindings Bindings of the Search-UI environment. */ constructor(element: HTMLElement, options: IQueryListOptions, bindings: IComponentBindings); private filterDuplicateQueries; private render; /** * Make a list item element generate a query when click if an omnibox is present. * @param query The query to generate. * @param listItem The list item element. */ private makeClickable; private addTooltipElement; }