import { ElementRef, OnInit, Renderer2 } from "@angular/core"; import { UntypedFormControl } from "@angular/forms"; import { TranslateService } from "@ngx-translate/core"; import { Observable } from "rxjs"; import { StarkLoggingService, StarkRoutingService } from "@nationalbankbelgium/stark-core"; import { AbstractStarkUiComponent } from "@nationalbankbelgium/stark-ui/src/internal-common"; import { StarkRouteSearchEntry } from "./route-search-entry.intf"; import { StarkMenuConfig, StarkMenuGroup } from "@nationalbankbelgium/stark-ui/src/modules/app-menu"; import * as i0 from "@angular/core"; /** * Direction in which the Route Search field can be displayed */ export type StarkRouteSearchDirection = "left" | "right"; /** * Component to search a particular route with autocompletion and to redirect to the route chosen by the user. * * **`IMPORTANT:`** by default, when no menu config is provided, the Route Search component will display only those routes already registered by the Router at the time the component is initialized. * In this case the lazy loaded routes that have not been loaded yet will not be displayed. * * ### Setting labels for routes * The component will construct the routes to display by recursively processing all the routes registered by the Router. * In this case, the label for each route will be taken from the route's `data.translationKey` property or from the route name if such property is not found. * * ### Customizing component labels * It is possible to override the following translations used in the different labels of this component: * * - **STARK.ROUTE_SEARCH.ABOUT:** label shown in the tooltip of the search button * - **STARK.ROUTE_SEARCH.PLACEHOLDER:** label shown in the placeholder of the search field */ export declare class StarkRouteSearchComponent extends AbstractStarkUiComponent implements OnInit { routingService: StarkRoutingService; logger: StarkLoggingService; translateService: TranslateService; /** * The {@link StarkMenuConfig} where the routes should be taken from. * Normally the same {@link StarkMenuConfig} is used for the {@link StarkAppMenuComponent}. * * **`IMPORTANT:`** when this is provided, the component will display all the routes from the config including the lazy loaded routes (if any). */ menuConfig?: StarkMenuConfig; /** * The direction in which the Route Search field will be displayed. * * Default: `"left"` */ direction: StarkRouteSearchDirection; /** * Desired icon of the search button. * * Default: `"magnify"` */ icon: "magnify" | string; /** * The source FormControl object of the search field */ searchField: UntypedFormControl; /** * The list of {@link StarkRouteSearchEntry}'s objects filtered by the auto-complete field */ filteredRouteEntries: Observable; /** * The list of routes to be displayed */ routesToDisplay: StarkRouteSearchEntry[]; /** * Whether the input field must be hidden or not */ hide: boolean; /** * Class constructor * @param routingService - The `StarkRoutingService` instance of the application. * @param logger - The `StarkLoggingService` instance of the application. * @param translateService - The `TranslateService` instance of the application. * @param renderer - Angular Renderer wrapper for DOM manipulations * @param elementRef - Reference to the DOM element where this component is attached to. */ constructor(routingService: StarkRoutingService, logger: StarkLoggingService, translateService: TranslateService, renderer: Renderer2, elementRef: ElementRef); /** * Filters the options according to what has been entered by the user in the input field * @param value - Filter value */ filterRouteEntries(value: string): StarkRouteSearchEntry[]; /** * Component lifecycle hook */ ngOnInit(): void; /** * Redirect the user to the chosen path * @param routeEntry - Route to navigate to */ redirect(routeEntry: StarkRouteSearchEntry): void; /** * Show/hide the input field */ show(): void; /** * @ignore */ trackPath(_index: number, routeEntry: StarkRouteSearchEntry): string; /** * Retrieve the list of routes from a {@link StarkMenuConfig} object which the user have passed to the component * @param menuConfig - `StarkMenuConfig` object */ constructRouteEntriesFromMenuConfig(menuConfig: StarkMenuConfig): StarkRouteSearchEntry[]; /** * Recursive method to extract routes from a StarkMenuGroup object. * @param group - The group which entries need to be extracted * @returns The extracted array of {@link StarkRouteSearchEntry} objects */ extractRoutesFromMenuGroup(group: StarkMenuGroup): StarkRouteSearchEntry[]; /** * Retrieve the list of routes from the Router if the user haven't passed a list to the component */ constructRouteEntriesFromRouterStates(): StarkRouteSearchEntry[]; /** * Translate the label of all elements in the {@link StarkRouteSearchEntry} object. * This is useful as the language can change during runtime. * @param routeEntries - Route entries to translate * @returns The translate route entries */ translateRoutesLabels(routeEntries: StarkRouteSearchEntry[]): StarkRouteSearchEntry[]; /** * Sort the array of {@link StarkRouteSearchEntry} objects by alphabetical order * @param routeEntries - The list of entries to sort * @returns The sorted array of {@link StarkRouteSearchEntry} objects */ sortRoutesLabels(routeEntries: StarkRouteSearchEntry[]): StarkRouteSearchEntry[]; /** * Determine the CSS class to use according to the direction chosen by the user */ getDirection(): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }