@alfresco/adf-core
Version:
113 lines (112 loc) • 3.44 kB
TypeScript
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { AppConfigService } from '../../app-config/app-config.service';
import { StorageService } from './storage.service';
import * as i0 from "@angular/core";
export declare enum UserPreferenceValues {
PaginationSize = "paginationSize",
Locale = "locale",
SupportedPageSizes = "supportedPageSizes",
ExpandedSideNavStatus = "expandedSidenav"
}
export declare class UserPreferencesService {
translate: TranslateService;
private appConfig;
private storage;
private document;
private rendererFactory;
private directionality;
defaults: {
paginationSize: number;
supportedPageSizes: number[];
locale: string;
expandedSidenav: boolean;
};
private userPreferenceStatus;
private onChangeSubject;
onChange: Observable<any>;
constructor(translate: TranslateService, appConfig: AppConfigService, storage: StorageService);
private initUserPreferenceStatus;
private initUserLanguage;
/**
* Sets up a callback to notify when a property has changed.
*
* @param property The property to watch
* @returns Notification callback
*/
select<T = any>(property: string): Observable<T>;
/**
* Gets a preference property.
*
* @param property Name of the property
* @param defaultValue Default to return if the property is not found
* @returns Preference property
*/
get(property: string, defaultValue?: string): string;
/**
* Sets a preference property.
*
* @param property Name of the property
* @param value New value for the property
*/
set(property: string, value: any): void;
/**
* Sets a preference property.
*
* @param property Name of the property
* @param value New value for the property
*/
setWithoutStore(property: string, value: any): void;
/**
* Check if an item is present in the storage
*
* @param property Name of the property
* @returns True if the item is present, false otherwise
*/
hasItem(property: string): boolean;
/**
* Gets the active storage prefix for preferences.
*
* @returns Storage prefix
*/
getStoragePrefix(): string;
/**
* Sets the active storage prefix for preferences.
*
* @param value Name of the prefix
*/
setStoragePrefix(value: string | null): void;
/**
* Gets the full property key with prefix.
*
* @param property The property name
* @returns Property key
*/
getPropertyKey(property: string): string;
/**
* Gets an array containing the available page sizes.
*
* @returns Array of page size values
*/
get supportedPageSizes(): number[];
set supportedPageSizes(value: number[]);
/** Pagination size. */
set paginationSize(value: number);
get paginationSize(): number;
/**
* Current locale setting.
*
* @returns locale name
*/
get locale(): string;
set locale(value: string);
/**
* Gets the default locale.
*
* @returns Default locale language code
*/
getDefaultLocale(): string;
private getLanguageByKey;
static ɵfac: i0.ɵɵFactoryDeclaration<UserPreferencesService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<UserPreferencesService>;
}