@nova-ui/bits
Version:
SolarWinds Nova Framework
38 lines (37 loc) • 1.46 kB
TypeScript
import { PipeTransform } from "@angular/core";
import { SafeHtml } from "@angular/platform-browser";
import * as i0 from "@angular/core";
/**
* <example-url>./../examples/index.html#/pipes/highlight</example-url>
*
* The nuiHighlight pipe is used to mark a portion of text. It will search the provided text for the specified string and highlight it. Returns HTML.
* Can only be used with `innerHTML` directive. Escapes all the characters by default and highlights every match in the string.
*
* __Parameters :__
*
* text - The source text.
*
* search - The search term to be highlighted.
*
* __Usage :__
* "text" | nuiHighlight : "search"
*
* __Examples :__
*
* <code>{{ "hello world" | nuiHighlight:"world" }}</code>
*
* formats to: <code>hello <span class="nui-highlighted">world</span></code>
*
*
* <code>{{ "hello <span class="x">FOO</span> bar" | nuiHighlight:"bar" }}</code>
*
* formats to: <code>hello <span class="x">FOO</span><span class="nui-highlighted">bar</span>;</code>
*/
export declare class HighlightPipe implements PipeTransform {
private readonly deduplicateStarsRegex;
transform(text: string, search: string): SafeHtml;
escapeItem(item: string): string;
private getHighlightRegex;
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<HighlightPipe, "nuiHighlight", false>;
}