UNPKG

@spartacus/storefront

Version:

Spartacus Storefront is a package that you can include in your application, which allows you to add default storefront features.

85 lines (84 loc) 2.78 kB
import { OnChanges, SimpleChanges } from '@angular/core'; import { Params, Router } from '@angular/router'; import { GenericLinkComponentService } from './generic-link-component.service'; import * as i0 from "@angular/core"; /** * This component navigates using [routerLink] attribute when input 'url' is a relative url. Otherwise (when it's absolute), [href] is used. */ export declare class GenericLinkComponent implements OnChanges { protected router: Router; protected service?: GenericLinkComponentService; /** * Pattern matching string starting with `http://` or `https://`. */ private readonly PROTOCOL_REGEX; /** * Pattern matching string starting with `mailto:`. */ protected MAILTO_PROTOCOL_REGEX: RegExp; /** * Pattern matching string starting with `tel:`. */ protected TEL_PROTOCOL_REGEX: RegExp; /** * @deprecated since version 5.0 * Use the following constructor instead: * ``` * constructor( * protected router: Router, * protected service?: GenericLinkComponentService * ) * ``` */ constructor(router: Router); /** * Used to split url into 2 parts: * 1. the path * 2. query params + hash fragment */ private readonly URL_SPLIT; /** * Parsed parts of the @Input `url`, when it's a local URL. * It should not be used when the `url` is external. * @see `url` */ private routeParts; url: string | any[]; target: string | null; id: string; class: string; style: string; title: string; isExternalUrl(): boolean; get rel(): string; ngOnChanges(changes: SimpleChanges): void; /** * The part with the path of the local url. */ get routerUrl(): any[]; /** * The part with the query params of the local url. */ get queryParams(): Params; /** * The part with the hash fragment of the local url. */ get fragment(): string; /** * Parses the given url and sets the property `urlParts` accordingly. */ private setUrlParts; /** * Parses the given string into 3 parts: * - string path (wrapped in an array to be compatible with Angular syntax for the `routerLink`) * - query params (as an object) * - hash fragment (string) */ private splitUrl; /** * Prepends a leading slash to the given URL string, in case it doesn't have it. */ private getAbsoluteUrl; static ɵfac: i0.ɵɵFactoryDeclaration<GenericLinkComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<GenericLinkComponent, "cx-generic-link", never, { "url": "url"; "target": "target"; "id": "id"; "class": "class"; "style": "style"; "title": "title"; }, {}, never, ["*"]>; }