UNPKG

@nepwork/dashboards

Version:

Dashboards for emergencies and monitoring

86 lines 2.88 kB
/** * @license * Copyright Akveo. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ import { __decorate } from "tslib"; import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import { share } from 'rxjs/operators'; /** * Search component service, connects your code to a page-level search component. */ var NbSearchService = /** @class */ (function () { function NbSearchService() { this.searchSubmittings$ = new Subject(); this.searchActivations$ = new Subject(); this.searchDeactivations$ = new Subject(); this.searchInput$ = new Subject(); } /*** * Activate (open) search component * @param {string} searchType * @param {string} tag */ NbSearchService.prototype.activateSearch = function (searchType, tag) { this.searchActivations$.next({ searchType: searchType, tag: tag }); }; /** * Deactibate (close) search component * @param {string} searchType * @param {string} tag */ NbSearchService.prototype.deactivateSearch = function (searchType, tag) { this.searchDeactivations$.next({ searchType: searchType, tag: tag }); }; /** * Trigger search submit * @param {string} term * @param {string} tag */ NbSearchService.prototype.submitSearch = function (term, tag) { this.searchSubmittings$.next({ term: term, tag: tag }); }; /** * Trigger search submit by input event * @param {string} term * @param {string} tag */ NbSearchService.prototype.searchInput = function (term, tag) { this.searchInput$.next({ term: term, tag: tag }); }; /** * Subscribe to 'activate' event * @returns Observable<{searchType: string; tag?: string}> */ NbSearchService.prototype.onSearchActivate = function () { return this.searchActivations$.pipe(share()); }; /** * Subscribe to 'deactivate' event * @returns Observable<{searchType: string; tag?: string}> */ NbSearchService.prototype.onSearchDeactivate = function () { return this.searchDeactivations$.pipe(share()); }; /** * Subscribe to 'submit' event (when submit button clicked) * @returns Observable<{term: string; tag?: string}> */ NbSearchService.prototype.onSearchSubmit = function () { return this.searchSubmittings$.pipe(share()); }; /** * Subscribe to input event * @returns Observable<{term: string; tag?: string}> */ NbSearchService.prototype.onSearchInput = function () { return this.searchInput$.pipe(share()); }; NbSearchService = __decorate([ Injectable() ], NbSearchService); return NbSearchService; }()); export { NbSearchService }; //# sourceMappingURL=search.service.js.map