From 0800c406cd0dda22dfb030c33c0b6c0871117fd9 Mon Sep 17 00:00:00 2001 From: Vito Date: Wed, 3 Apr 2019 17:56:37 +0100 Subject: [PATCH] [ADF-4328] added expandedSideNav as new user preference value (#4545) * [ADF-4328] added expandedSideNav as new user preference value * [ADF-4328] update demo shell with the new User preference value * [ADF-4328] added documentation update --- .../src/app/components/app-layout/app-layout.component.ts | 4 ++-- docs/core/services/user-preferences.service.md | 2 +- lib/core/services/user-preferences.service.ts | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.ts b/demo-shell/src/app/components/app-layout/app-layout.component.ts index 5a732acda3..f1075cfbc9 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.ts +++ b/demo-shell/src/app/components/app-layout/app-layout.component.ts @@ -16,7 +16,7 @@ */ import { Component, ViewEncapsulation, OnInit } from '@angular/core'; -import { UserPreferencesService, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core'; +import { UserPreferencesService, AppConfigService, AlfrescoApiService, UserPreferenceValues } from '@alfresco/adf-core'; import { HeaderDataService } from '../header-data/header-data.service'; @Component({ @@ -123,7 +123,7 @@ export class AppLayoutComponent implements OnInit { setState(state) { if (this.config.get('sideNav.preserveState')) { - this.userPreferences.set('expandedSidenav', state); + this.userPreferences.set(UserPreferenceValues.ExpandedSideNavStatus, state); } } } diff --git a/docs/core/services/user-preferences.service.md b/docs/core/services/user-preferences.service.md index b3f7853569..78e5deac19 100644 --- a/docs/core/services/user-preferences.service.md +++ b/docs/core/services/user-preferences.service.md @@ -108,7 +108,7 @@ whole set of user properties. This is useful when a component needs to react to ``` You can also use the `select` method to get notification when a particular property is changed. -A set of basic properties is added into the enumeration [`UserPreferenceValues`](../../../lib/core/services/user-preferences.service.ts) which gives you the key value to access the standard user preference service properties : **PaginationSize**, **DisableCSRF**, **Locale** and **SupportedPageSizes**. +A set of basic properties is added into the enumeration [`UserPreferenceValues`](../../../lib/core/services/user-preferences.service.ts) which gives you the key value to access the standard user preference service properties : **PaginationSize**, **DisableCSRF**, **Locale**, **SupportedPageSizes** and **ExpandedSideNavStatus**. ```ts userPreferences.disableCSRF = true; diff --git a/lib/core/services/user-preferences.service.ts b/lib/core/services/user-preferences.service.ts index a3f178aa39..5cd8a9c29c 100644 --- a/lib/core/services/user-preferences.service.ts +++ b/lib/core/services/user-preferences.service.ts @@ -25,7 +25,8 @@ import { distinctUntilChanged, map } from 'rxjs/operators'; export enum UserPreferenceValues { PaginationSize = 'paginationSize', Locale = 'locale', - SupportedPageSizes = 'supportedPageSizes' + SupportedPageSizes = 'supportedPageSizes', + ExpandedSideNavStatus = 'expandedSidenav' } @Injectable({ @@ -36,7 +37,8 @@ export class UserPreferencesService { defaults = { paginationSize: 25, supportedPageSizes: [5, 10, 15, 20], - locale: 'en' + locale: 'en', + expandedSidenav: true }; private userPreferenceStatus: any = this.defaults;