UNPKG

coveo-search-ui-extensions

Version:

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

60 lines (59 loc) 2.05 kB
import { Component, IQueryResult, IResultsComponentBindings } from 'coveo-search-ui'; /** * The possible options for _ResultAction_. */ export interface IResultActionOptions { /** * The icon that the ResultAction will display. * If text is provided, the button will contain that text. * If the HTML of an SVG image is provided, that image will be displayed in the button. */ icon?: string; /** * The tooltip that displays on hovering the ResultAction. */ tooltip?: string; } /** * The base class for all ResultAction components. * Its main responsibility is handling the visual elements of the Result Action. */ export declare abstract class ResultAction extends Component { element: HTMLElement; options: IResultActionOptions; bindings?: IResultsComponentBindings; queryResult?: IQueryResult; static ID: string; private isInitialized; /** * The possible options for _ResultAction_. * @componentOptions */ static options: IResultActionOptions; /** * Construct a ResultAction component. * @param element The HTML element bound to this component. * @param options The options that can be provided to this component. * @param bindings The bindings, or environment within which this component exists. * @param queryResult The result of the query in which this resultAction exists. */ constructor(element: HTMLElement, options: IResultActionOptions, bindings?: IResultsComponentBindings, queryResult?: IQueryResult); /** * The action that will be performed when the ResultAction is clicked. * @abstract */ protected abstract doAction(): void; /** * Initializes the component if it is not already initialized. */ protected init(): void; /** * Deactivate the component if it is initialized. * @param e The reason for the deactivation. */ protected deactivate(e: string): void; /** * Make the result action button visible. */ private show; }