@versatiledatakit/shared
Version:
Versatile Data Kit Shared library enables reusability of shared features like: NgRx Redux, Error Handlers, Utils, Generic Components, etc.
110 lines (109 loc) • 2.81 kB
TypeScript
import { Location } from '@angular/common';
export interface StateManagerParamValue {
key: string;
value: string;
position: number;
}
/**
* ** State Manager for Browser URL.
*
* - Provides methods for easy appending/retrieving/removing of params and query params to the URL state.
* - Provides ability to serialize current state as URL href.
*/
export declare class URLStateManager {
baseURL: string;
urlLocation: Location;
/**
* ** Store value if URL Params State mutated since previous navigation.
*/
isParamsStateMutated: boolean;
/**
* ** Store value if URL QueryParams State mutated since previous navigation.
*/
isQueryParamsStateMutated: boolean;
private readonly params;
private readonly queryParams;
private readonly locationHref;
/**
* ** Constructor.
*/
constructor(baseURL: string, urlLocation: Location);
/**
* ** Returns current Browser URL href.
*/
get URL(): string;
/**
* ** Replace current URL state to Browser URL.
*/
replaceToUrl(): void;
/**
* ** Apply current URL state to Browser URL.
*/
locationToURL(): void;
/**
* ** Navigate through Angular Router with set URL state.
*/
navigateToUrl(): Promise<boolean>;
/**
* ** Set query param to URL state.
*/
setQueryParam(key: string, value: string, position?: number): void;
/**
* ** Returns query param value for given key.
*/
getQueryParam(key: string): string;
/**
* ** Removes query param from URL state.
*/
removeQueryParam(key: string): void;
/**
* ** Clear stored queryParams.
*/
clearQueryParams(): void;
/**
* ** Set param to URL state.
*/
setParam(key: string, value: string, position?: number): void;
/**
* ** Returns param value for given key.
*/
getParam(key: string): string;
/**
* ** Removes query param from URL state.
*/
removeParam(key: string): void;
/**
* ** Clear stored params.
*/
clearParams(): void;
/**
* ** Returns serialized params in string.
*/
getParamsToString(): string;
/**
* ** Returns serialized queryParams in string.
*/
getQueryParamsToString(): string;
/**
* ** Returns query params in Map format.
*/
getQueryParamsAsMap(): {
[key: string]: string;
};
/**
* ** Returns params in Map format.
*/
getParamsAsMap(): {
[key: string]: string;
};
/**
* ** Build url from base and provided params.
*/
buildUrlWithParams(): string;
/**
* ** Change Base url.
*/
changeBaseUrl(baseUrl: string): void;
private getSortedByPosition;
private _notifyForLocationChange;
}