From 1064521fe97c59edeace1ec7dfcc67f78be39b02 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 25 May 2018 09:58:49 +0100 Subject: [PATCH] [ADF-3088] move sorting picker to a separate module (#3396) * move sorting picker to a separate module * update translation mock --- lib/core/core.module.ts | 16 ++++---- lib/core/index.ts | 4 +- lib/core/mock/translation.service.mock.ts | 6 ++- lib/core/sorting-picker/index.ts | 18 +++++++++ lib/core/sorting-picker/public-api.ts | 19 ++++++++++ .../sorting-picker.component.html | 0 .../sorting-picker.component.spec.ts | 0 .../sorting-picker.component.ts | 0 .../sorting-picker/sorting-picker.module.ts | 37 +++++++++++++++++++ 9 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 lib/core/sorting-picker/index.ts create mode 100644 lib/core/sorting-picker/public-api.ts rename lib/core/{components => }/sorting-picker/sorting-picker.component.html (100%) rename lib/core/{components => }/sorting-picker/sorting-picker.component.spec.ts (100%) rename lib/core/{components => }/sorting-picker/sorting-picker.component.ts (100%) create mode 100644 lib/core/sorting-picker/sorting-picker.module.ts diff --git a/lib/core/core.module.ts b/lib/core/core.module.ts index 99b73364ce..d91aac0514 100644 --- a/lib/core/core.module.ts +++ b/lib/core/core.module.ts @@ -81,7 +81,7 @@ import { UploadService } from './services/upload.service'; import { UserPreferencesService } from './services/user-preferences.service'; import { SearchConfigurationService } from './services/search-configuration.service'; import { startupServiceFactory } from './services/startup-service-factory'; -import { SortingPickerComponent } from './components/sorting-picker/sorting-picker.component'; +import { SortingPickerModule } from './sorting-picker/sorting-picker.module'; export function createTranslateLoader(http: HttpClient, logService: LogService) { return new TranslateLoaderService(http, logService); @@ -162,7 +162,8 @@ export function providers() { useFactory: (createTranslateLoader), deps: [HttpClient, LogService] } - }) + }), + SortingPickerModule ], exports: [ AboutModule, @@ -192,7 +193,8 @@ export function providers() { DataTableModule, TranslateModule, ButtonsMenuModule, - TemplatetModule + TemplatetModule, + SortingPickerModule ] }) export class CoreModuleLazy { @@ -233,10 +235,8 @@ export class CoreModuleLazy { useFactory: (createTranslateLoader), deps: [HttpClient, LogService] } - }) - ], - declarations: [ - SortingPickerComponent + }), + SortingPickerModule ], exports: [ AboutModule, @@ -267,7 +267,7 @@ export class CoreModuleLazy { TranslateModule, ButtonsMenuModule, TemplatetModule, - SortingPickerComponent + SortingPickerModule ], providers: [ ...providers(), diff --git a/lib/core/index.ts b/lib/core/index.ts index 8c6179a0b5..a7c994c411 100644 --- a/lib/core/index.ts +++ b/lib/core/index.ts @@ -34,9 +34,7 @@ export * from './form/index'; export * from './sidenav-layout/index'; export * from './comments/index'; export * from './buttons-menu/index'; - -export * from './components/sorting-picker/sorting-picker.component'; - +export * from './sorting-picker/index'; export * from './templates/index'; export * from './pipes/index'; export * from './services/index'; diff --git a/lib/core/mock/translation.service.mock.ts b/lib/core/mock/translation.service.mock.ts index e983b41709..f55d3313ca 100644 --- a/lib/core/mock/translation.service.mock.ts +++ b/lib/core/mock/translation.service.mock.ts @@ -17,18 +17,20 @@ import { EventEmitter } from '@angular/core'; import { Observable } from 'rxjs/Observable'; +import { TranslationService } from '../services/translation.service'; export interface LangChangeEvent { lang: string; translations: any; } -export class TranslationMock { +export class TranslationMock implements TranslationService { defaultLang: string = 'en'; userLang: string; customLoader: any; - translate = { + + translate: any = { onLangChange: new EventEmitter() }; diff --git a/lib/core/sorting-picker/index.ts b/lib/core/sorting-picker/index.ts new file mode 100644 index 0000000000..4c6ac1d58f --- /dev/null +++ b/lib/core/sorting-picker/index.ts @@ -0,0 +1,18 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './public-api'; diff --git a/lib/core/sorting-picker/public-api.ts b/lib/core/sorting-picker/public-api.ts new file mode 100644 index 0000000000..97d05dba4d --- /dev/null +++ b/lib/core/sorting-picker/public-api.ts @@ -0,0 +1,19 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * 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. + */ + +export * from './sorting-picker.component'; +export * from './sorting-picker.module'; diff --git a/lib/core/components/sorting-picker/sorting-picker.component.html b/lib/core/sorting-picker/sorting-picker.component.html similarity index 100% rename from lib/core/components/sorting-picker/sorting-picker.component.html rename to lib/core/sorting-picker/sorting-picker.component.html diff --git a/lib/core/components/sorting-picker/sorting-picker.component.spec.ts b/lib/core/sorting-picker/sorting-picker.component.spec.ts similarity index 100% rename from lib/core/components/sorting-picker/sorting-picker.component.spec.ts rename to lib/core/sorting-picker/sorting-picker.component.spec.ts diff --git a/lib/core/components/sorting-picker/sorting-picker.component.ts b/lib/core/sorting-picker/sorting-picker.component.ts similarity index 100% rename from lib/core/components/sorting-picker/sorting-picker.component.ts rename to lib/core/sorting-picker/sorting-picker.component.ts diff --git a/lib/core/sorting-picker/sorting-picker.module.ts b/lib/core/sorting-picker/sorting-picker.module.ts new file mode 100644 index 0000000000..138d079317 --- /dev/null +++ b/lib/core/sorting-picker/sorting-picker.module.ts @@ -0,0 +1,37 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * 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 { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { TranslateModule } from '@ngx-translate/core'; +import { MaterialModule } from '../material.module'; +import { SortingPickerComponent } from './sorting-picker.component'; + +@NgModule({ + imports: [ + CommonModule, + MaterialModule, + TranslateModule + ], + declarations: [ + SortingPickerComponent + ], + exports: [ + SortingPickerComponent + ] +}) +export class SortingPickerModule {}