/*! * @license * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Signal } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; export declare const UserPreferenceValues: { readonly PaginationSize: "paginationSize"; readonly Locale: "locale"; readonly SupportedPageSizes: "supportedPageSizes"; readonly ExpandedSideNavStatus: "expandedSidenav"; }; export type UserPreferenceValues = (typeof UserPreferenceValues)[keyof typeof UserPreferenceValues]; export declare class UserPreferencesService { translate: TranslateService; private readonly appConfig; private readonly storage; private readonly document; private readonly rendererFactory; private readonly directionality; defaults: { paginationSize: number; supportedPageSizes: number[]; locale: string; expandedSidenav: boolean; }; private userPreferenceStatus; private readonly onChangeSubject; onChange: Observable; /** * Observable that emits the current locale whenever it changes. * This is a convenience property that simplifies subscribing to locale changes. * * @example Observable usage (requires manual unsubscription): * ```typescript * constructor(private userPreferencesService: UserPreferencesService) { * this.userPreferencesService.locale$ * .pipe(takeUntilDestroyed()) * .subscribe(locale => { * this.currentLocale = locale; * }); * } * ``` * * @example Signal usage (automatic cleanup, recommended): * ```typescript * export class MyComponent { * private userPreferencesService = inject(UserPreferencesService); * currentLocale = this.userPreferencesService.localeSignal; // Signal - no subscription needed! * } * ``` */ readonly locale$: Observable; /** * Signal that provides the current locale value. * Automatically handles cleanup - no need for takeUntilDestroyed or manual unsubscription. * This is the recommended way to access locale in components. */ readonly localeSignal: Signal; /** * Observable that emits the current pagination size whenever it changes. */ readonly paginationSize$: Observable; /** * Signal that provides the current pagination size value. */ readonly paginationSizeSignal: Signal; /** * Observable that emits the supported page sizes whenever they change. */ readonly supportedPageSizes$: Observable; /** * Signal that provides the supported page sizes array. */ readonly supportedPageSizesSignal: Signal; constructor(); private initUserPreferenceStatus; private initPaginationPreferences; private initUserLanguage; /** * Sets up a callback to notify when a property has changed. * * @param property The property to watch * @returns Notification callback */ select(property: string): Observable; /** * 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; static ɵprov: i0.ɵɵInjectableDeclaration; }