@ng-prime-extensions/px-searchable-accordion
Version:
PrimeNG searchable accordion extension
83 lines (79 loc) • 3.4 kB
TypeScript
import * as i0 from '@angular/core';
import { OnChanges, AfterViewInit, OnDestroy, TemplateRef, ChangeDetectorRef, SimpleChanges } from '@angular/core';
import { Observable, Subject, BehaviorSubject } from 'rxjs';
import { Router, ActivatedRoute } from '@angular/router';
interface PxSearchableAccordionEntry {
/**
* If set, it will be used to create url fragments
*/
id?: string;
header: string;
content: string;
/**
* Optional data that can be used by the developer, usually when dealing with custom header/content templates.
*/
data?: any;
}
declare class PxSearchableAccordionComponent implements OnChanges, AfterViewInit, OnDestroy {
private router;
private activatedRoute;
private changeDetector;
private document;
/**
* Accordion entries to be rendered.
*/
entries: PxSearchableAccordionEntry[];
/**
* A search string or an observable that emits the search string.
*/
searchString: string | Observable<string> | Subject<string> | BehaviorSubject<string>;
/**
* Template to render the header with.
*/
headerTemplate?: TemplateRef<any>;
/**
* Template to render the content with.
*/
contentTemplate?: TemplateRef<any>;
/**
* Template to render the no results message.
*/
noResultsTemplate?: TemplateRef<any>;
/**
* Search delay time in milliseconds.
*/
searchDebounceTime: number;
/**
* Weather searched words will be highlighted.
*/
highlightWords: boolean;
/**
* The css class applied to the highlighted words.
*/
highlightClass: string;
/**
* If true, url fragments will be generated based on the set entry id.
*/
allowUrlFragments: boolean;
protected filteredEntries: BehaviorSubject<PxSearchableAccordionEntry[]>;
protected activeEntryIndex: number;
private searchSub?;
private routeFragmentsSub?;
private lastSearchString;
private searchQueryRegex;
constructor(router: Router, activatedRoute: ActivatedRoute, changeDetector: ChangeDetectorRef, document: Document);
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewInit(): void;
/**
* Searches the available entries for the given search string
* @param searchStr
*/
search(searchStr: string): Promise<void>;
protected activeIndexChanged(): void;
private highlightString;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<PxSearchableAccordionComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<PxSearchableAccordionComponent, "px-searchable-accordion", never, { "entries": { "alias": "entries"; "required": true; }; "searchString": { "alias": "searchString"; "required": true; }; "headerTemplate": { "alias": "headerTemplate"; "required": false; }; "contentTemplate": { "alias": "contentTemplate"; "required": false; }; "noResultsTemplate": { "alias": "noResultsTemplate"; "required": false; }; "searchDebounceTime": { "alias": "searchDebounceTime"; "required": false; }; "highlightWords": { "alias": "highlightWords"; "required": false; }; "highlightClass": { "alias": "highlightClass"; "required": false; }; "allowUrlFragments": { "alias": "allowUrlFragments"; "required": false; }; }, {}, never, never, true, never>;
}
export { PxSearchableAccordionComponent };
export type { PxSearchableAccordionEntry };