From 431144818978d4937cbec8e1b79aa9be69d2093b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 9 Jan 2017 14:34:36 +0000 Subject: [PATCH] #1400 component naming convention fixes --- .../app/components/files/files.component.ts | 12 +--- .../ng2-alfresco-documentlist/README.md | 4 +- .../demo/src/main.ts | 6 +- .../ng2-alfresco-documentlist/index.ts | 44 ++++++------- .../breadcrumb/breadcrumb.component.spec.ts | 8 +-- .../breadcrumb/breadcrumb.component.ts | 6 +- .../content-action-list.component.spec.ts} | 18 +++--- .../content-action-list.component.ts} | 12 ++-- .../content-action.component.spec.ts} | 62 +++++++++---------- .../content-action.component.ts} | 25 +++----- .../content-column-list.component.spec.ts} | 16 ++--- .../content-column-list.component.ts} | 8 +-- .../content-column.component.spec.ts} | 26 ++++---- .../content-column.component.ts} | 7 ++- ...t-list.css => document-list.component.css} | 0 ...list.html => document-list.component.html} | 0 ...pec.ts => document-list.component.spec.ts} | 33 +++++----- ...ent-list.ts => document-list.component.ts} | 16 ++--- ...css => document-menu-action.component.css} | 0 ...ml => document-menu-action.component.html} | 0 ...n.ts => document-menu-action.component.ts} | 7 ++- .../empty-folder-content.component.spec.ts} | 15 ++--- .../empty-folder-content.component.ts} | 13 ++-- 23 files changed, 162 insertions(+), 176 deletions(-) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-action-list.spec.ts => content-action/content-action-list.component.spec.ts} (72%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-action-list.ts => content-action/content-action-list.component.ts} (78%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-action.spec.ts => content-action/content-action.component.spec.ts} (75%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-action.ts => content-action/content-action.component.ts} (80%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-column-list.spec.ts => content-column/content-column-list.component.spec.ts} (76%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-column-list.ts => content-column/content-column-list.component.ts} (87%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-column.spec.ts => content-column/content-column.component.spec.ts} (66%) rename ng2-components/ng2-alfresco-documentlist/src/components/{content-column.ts => content-column/content-column.component.ts} (87%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-list.css => document-list.component.css} (100%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-list.html => document-list.component.html} (100%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-list.spec.ts => document-list.component.spec.ts} (92%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-list.ts => document-list.component.ts} (95%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-menu-action.css => document-menu-action.component.css} (100%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-menu-action.html => document-menu-action.component.html} (100%) rename ng2-components/ng2-alfresco-documentlist/src/components/{document-menu-action.ts => document-menu-action.component.ts} (96%) rename ng2-components/ng2-alfresco-documentlist/src/components/{empty-folder-content.spec.ts => empty-folder/empty-folder-content.component.spec.ts} (72%) rename ng2-components/ng2-alfresco-documentlist/src/components/{empty-folder-content.ts => empty-folder/empty-folder-content.component.ts} (77%) diff --git a/demo-shell-ng2/app/components/files/files.component.ts b/demo-shell-ng2/app/components/files/files.component.ts index c4cda092de8..65053fcf2e1 100644 --- a/demo-shell-ng2/app/components/files/files.component.ts +++ b/demo-shell-ng2/app/components/files/files.component.ts @@ -18,13 +18,7 @@ import { Component, OnInit, Optional, ViewChild } from '@angular/core'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { AuthService, LogService } from 'ng2-alfresco-core'; -import { - DocumentActionsService, - DocumentList, - ContentActionHandler, - DocumentActionModel, - FolderActionModel -} from 'ng2-alfresco-documentlist'; +import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist'; import { FormService } from 'ng2-activiti-form'; @Component({ @@ -45,8 +39,8 @@ export class FilesComponent implements OnInit { versioning: boolean = false; acceptedFilesType: string = '.jpg,.pdf,.js'; - @ViewChild(DocumentList) - documentList: DocumentList; + @ViewChild(DocumentListComponent) + documentList: DocumentListComponent; constructor(private documentActions: DocumentActionsService, private authService: AuthService, diff --git a/ng2-components/ng2-alfresco-documentlist/README.md b/ng2-components/ng2-alfresco-documentlist/README.md index 7ccfae68b1f..2225a8b07f9 100644 --- a/ng2-components/ng2-alfresco-documentlist/README.md +++ b/ng2-components/ng2-alfresco-documentlist/README.md @@ -131,7 +131,7 @@ import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfr class DocumentListDemo { @ViewChild(DocumentList) - documentList: DocumentList; + documentList: DocumentListComponent; constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) { @@ -210,7 +210,7 @@ DocumentList provides simple breadcrumb element to indicate the current position | Name | Type | Description | | --- | --- | --- | -| `target` | DocumentList | DocumentList component to operate with. Upon clicks will instruct the given component to update. | +| `target` | DocumentListComponent | DocumentList component to operate with. Upon clicks will instruct the given component to update. | | `folderNode` | MinimalNodeEntryEntity | Active node, builds UI based on `folderNode.path.elements` collection. | ### Creation Menu Action diff --git a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts index d6e12095717..c8b5fd69b82 100644 --- a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts +++ b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts @@ -18,7 +18,7 @@ import { NgModule, Component, OnInit, ViewChild } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { DocumentListModule, DocumentList, DocumentActionsService } from 'ng2-alfresco-documentlist'; +import { DocumentListModule, DocumentListComponent, DocumentActionsService } from 'ng2-alfresco-documentlist'; import { CoreModule, StorageService, SettingsService, AuthService, AlfrescoTranslateService, LogService } from 'ng2-alfresco-core'; @Component({ @@ -124,8 +124,8 @@ class DocumentListDemo implements OnInit { ecmHost: string = 'http://localhost:8080'; ticket: string; - @ViewChild(DocumentList) - documentList: DocumentList; + @ViewChild(DocumentListComponent) + documentList: DocumentListComponent; constructor(private authService: AuthService, private settingsService: SettingsService, diff --git a/ng2-components/ng2-alfresco-documentlist/index.ts b/ng2-components/ng2-alfresco-documentlist/index.ts index 44698426545..81be2a67c88 100644 --- a/ng2-components/ng2-alfresco-documentlist/index.ts +++ b/ng2-components/ng2-alfresco-documentlist/index.ts @@ -19,26 +19,26 @@ import { NgModule, ModuleWithProviders } from '@angular/core'; import { CoreModule } from 'ng2-alfresco-core'; import { DataTableModule } from 'ng2-alfresco-datatable'; -import { DocumentList } from './src/components/document-list'; -import { DocumentMenuAction } from './src/components/document-menu-action'; -import { ContentColumn } from './src/components/content-column'; -import { ContentColumnList } from './src/components/content-column-list'; -import { ContentAction } from './src/components/content-action'; -import { ContentActionList } from './src/components/content-action-list'; -import { EmptyFolderContent } from './src/components/empty-folder-content'; -import { DocumentListBreadcrumb } from './src/components/breadcrumb/breadcrumb.component'; +import { DocumentListComponent } from './src/components/document-list.component'; +import { DocumentMenuActionComponent } from './src/components/document-menu-action.component'; +import { ContentColumnComponent } from './src/components/content-column/content-column.component'; +import { ContentColumnListComponent } from './src/components/content-column/content-column-list.component'; +import { ContentActionComponent } from './src/components/content-action/content-action.component'; +import { ContentActionListComponent } from './src/components/content-action/content-action-list.component'; +import { EmptyFolderContentComponent } from './src/components/empty-folder/empty-folder-content.component'; +import { DocumentListBreadcrumbComponent } from './src/components/breadcrumb/breadcrumb.component'; import { FolderActionsService } from './src/services/folder-actions.service'; import { DocumentActionsService } from './src/services/document-actions.service'; import { DocumentListService } from './src/services/document-list.service'; // components -export * from './src/components/document-list'; -export * from './src/components/content-column'; -export * from './src/components/content-column-list'; -export * from './src/components/content-action'; -export * from './src/components/content-action-list'; -export * from './src/components/empty-folder-content'; +export * from './src/components/document-list.component'; +export * from './src/components/content-column/content-column.component'; +export * from './src/components/content-column/content-column-list.component'; +export * from './src/components/content-action/content-action.component'; +export * from './src/components/content-action/content-action-list.component'; +export * from './src/components/empty-folder/empty-folder-content.component'; export * from './src/components/breadcrumb/breadcrumb.component'; // data @@ -54,14 +54,14 @@ export * from './src/models/content-action.model'; export * from './src/models/document-library.model'; export const DOCUMENT_LIST_DIRECTIVES: any[] = [ - DocumentList, - DocumentMenuAction, - ContentColumn, - ContentColumnList, - ContentAction, - ContentActionList, - EmptyFolderContent, - DocumentListBreadcrumb + DocumentListComponent, + DocumentMenuActionComponent, + ContentColumnComponent, + ContentColumnListComponent, + ContentActionComponent, + ContentActionListComponent, + EmptyFolderContentComponent, + DocumentListBreadcrumbComponent ]; export const DOCUMENT_LIST_PROVIDERS: any[] = [ diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts index d2354ff1e0b..56744a769f7 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.spec.ts @@ -16,15 +16,15 @@ */ import { PathElementEntity } from 'alfresco-js-api'; -import { DocumentListBreadcrumb } from './breadcrumb.component'; -import { DocumentList } from '../document-list'; +import { DocumentListBreadcrumbComponent } from './breadcrumb.component'; +import { DocumentListComponent } from '../document-list.component'; describe('DocumentListBreadcrumb', () => { let component; beforeEach(() => { - component = new DocumentListBreadcrumb(); + component = new DocumentListBreadcrumbComponent(); }); it('should set current path', () => { @@ -50,7 +50,7 @@ describe('DocumentListBreadcrumb', () => { }); it('should update document list on click', (done) => { - let documentList = new DocumentList(null, null, null); + let documentList = new DocumentListComponent(null, null, null); spyOn(documentList, 'loadFolderByNodeId').and.stub(); let node = { id: '-id-', name: 'name' }; diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts index a9249108540..c462817deee 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/breadcrumb/breadcrumb.component.ts @@ -17,7 +17,7 @@ import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; import { MinimalNodeEntryEntity, PathElementEntity } from 'alfresco-js-api'; -import { DocumentList } from '../document-list'; +import { DocumentListComponent } from '../document-list.component'; @Component({ moduleId: module.id, @@ -25,13 +25,13 @@ import { DocumentList } from '../document-list'; templateUrl: './breadcrumb.component.html', styleUrls: ['./breadcrumb.component.css'] }) -export class DocumentListBreadcrumb implements OnChanges { +export class DocumentListBreadcrumbComponent implements OnChanges { @Input() folderNode: MinimalNodeEntryEntity; @Input() - target: DocumentList; + target: DocumentListComponent; route: PathElementEntity[] = []; diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.spec.ts similarity index 72% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.spec.ts index 00a54484177..ffcaaa044e4 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.spec.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import { DocumentList } from './document-list'; -import { DocumentListServiceMock } from '../assets/document-list.service.mock'; -import { ContentActionModel } from './../models/content-action.model'; -import { ContentActionList } from './content-action-list'; +import { DocumentListComponent } from './../document-list.component'; +import { DocumentListServiceMock } from './../../assets/document-list.service.mock'; +import { ContentActionModel } from './../../models/content-action.model'; +import { ContentActionListComponent } from './content-action-list.component'; describe('ContentColumnList', () => { - let documentList: DocumentList; - let actionList: ContentActionList; + let documentList: DocumentListComponent; + let actionList: ContentActionListComponent; beforeEach(() => { let documentListService = new DocumentListServiceMock(); - documentList = new DocumentList(documentListService, null, null); - actionList = new ContentActionList(documentList); + documentList = new DocumentListComponent(documentListService, null, null); + actionList = new ContentActionListComponent(documentList); }); it('should register action', () => { @@ -42,7 +42,7 @@ describe('ContentColumnList', () => { }); it('should require document list instance to register action', () => { - actionList = new ContentActionList(null); + actionList = new ContentActionListComponent(null); let action = new ContentActionModel(); expect(actionList.registerAction(action)).toBeFalsy(); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.ts similarity index 78% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.ts index 2dd1f15ff4f..00f9e789736 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action-list.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action-list.component.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import {Component} from '@angular/core'; -import {DocumentList} from './document-list'; -import {ContentActionModel} from './../models/content-action.model'; +import { Component } from '@angular/core'; + +import { DocumentListComponent } from './../document-list.component'; +import { ContentActionModel } from './../../models/content-action.model'; @Component({ selector: 'content-actions', template: '' }) -export class ContentActionList { +export class ContentActionListComponent { - constructor( - private documentList: DocumentList) { + constructor(private documentList: DocumentListComponent) { } /** diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.spec.ts similarity index 75% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.spec.ts index 7ebd29d8774..bd8b614b26a 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.spec.ts @@ -17,19 +17,19 @@ import { EventEmitter } from '@angular/core'; -import { DocumentList } from './document-list'; -import { DocumentListServiceMock } from '../assets/document-list.service.mock'; -import { ContentActionList } from './content-action-list'; -import { ContentAction } from './content-action'; -import { DocumentActionsService } from '../services/document-actions.service'; -import { FolderActionsService } from '../services/folder-actions.service'; -import { ContentActionHandler } from '../models/content-action.model'; -import { FileNode } from '../assets/document-library.model.mock'; +import { DocumentListComponent } from './../document-list.component'; +import { DocumentListServiceMock } from './../../assets/document-list.service.mock'; +import { ContentActionListComponent } from './content-action-list.component'; +import { ContentActionComponent } from './content-action.component'; +import { DocumentActionsService } from './../../services/document-actions.service'; +import { FolderActionsService } from './../../services/folder-actions.service'; +import { ContentActionHandler } from './../../models/content-action.model'; +import { FileNode } from './../../assets/document-library.model.mock'; describe('ContentAction', () => { - let documentList: DocumentList; - let actionList: ContentActionList; + let documentList: DocumentListComponent; + let actionList: ContentActionListComponent; let documentActions: DocumentActionsService; let folderActions: FolderActionsService; @@ -38,21 +38,21 @@ describe('ContentAction', () => { documentActions = new DocumentActionsService(null, null); folderActions = new FolderActionsService(null); - documentList = new DocumentList(documentServiceMock, null, null); - actionList = new ContentActionList(documentList); + documentList = new DocumentListComponent(documentServiceMock, null, null); + actionList = new ContentActionListComponent(documentList); }); it('should register within parent actions list', () => { spyOn(actionList, 'registerAction').and.stub(); - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); action.ngOnInit(); expect(actionList.registerAction).toHaveBeenCalled(); }); it('should setup and register model', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); action.target = 'document'; action.title = ''; action.icon = '<icon>'; @@ -73,7 +73,7 @@ describe('ContentAction', () => { let handler = function() {}; spyOn(documentActions, 'getHandler').and.returnValue(handler); - let action = new ContentAction(actionList, documentActions, null); + let action = new ContentActionComponent(actionList, documentActions, null); action.target = 'document'; action.handler = '<handler>'; action.ngOnInit(); @@ -89,7 +89,7 @@ describe('ContentAction', () => { let handler = function() {}; spyOn(folderActions, 'getHandler').and.returnValue(handler); - let action = new ContentAction(actionList, null, folderActions); + let action = new ContentActionComponent(actionList, null, folderActions); action.target = 'folder'; action.handler = '<handler>'; action.ngOnInit(); @@ -105,7 +105,7 @@ describe('ContentAction', () => { spyOn(folderActions, 'getHandler').and.stub(); spyOn(documentActions, 'getHandler').and.stub(); - let action = new ContentAction(actionList, documentActions, folderActions); + let action = new ContentActionComponent(actionList, documentActions, folderActions); action.handler = '<handler>'; action.ngOnInit(); @@ -125,7 +125,7 @@ describe('ContentAction', () => { it('should be case insensitive for document target', () => { spyOn(documentActions, 'getHandler').and.stub(); - let action = new ContentAction(actionList, documentActions, null); + let action = new ContentActionComponent(actionList, documentActions, null); action.target = 'DoCuMeNt'; action.handler = '<handler>'; @@ -136,7 +136,7 @@ describe('ContentAction', () => { it('should be case insensitive for folder target', () => { spyOn(folderActions, 'getHandler').and.stub(); - let action = new ContentAction(actionList, null, folderActions); + let action = new ContentActionComponent(actionList, null, folderActions); action.target = 'FoLdEr'; action.handler = '<handler>'; @@ -152,7 +152,7 @@ describe('ContentAction', () => { done(); }); - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); action.target = 'document'; action.execute = emitter; @@ -165,7 +165,7 @@ describe('ContentAction', () => { it('should sync localizable fields with model', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); action.title = 'title1'; action.ngOnInit(); @@ -178,25 +178,25 @@ describe('ContentAction', () => { }); it('should not find document action handler with missing service', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); expect(action.getSystemHandler('document', 'name')).toBeNull(); }); it('should not find folder action handler with missing service', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); expect(action.getSystemHandler('folder', 'name')).toBeNull(); }); it('should find document action handler via service', () => { let handler = <ContentActionHandler> function (obj: any, target?: any) {}; - let action = new ContentAction(actionList, documentActions, null); + let action = new ContentActionComponent(actionList, documentActions, null); spyOn(documentActions, 'getHandler').and.returnValue(handler); expect(action.getSystemHandler('document', 'name')).toBe(handler); }); it('should find folder action handler via service', () => { let handler = <ContentActionHandler> function (obj: any, target?: any) {}; - let action = new ContentAction(actionList, null, folderActions); + let action = new ContentActionComponent(actionList, null, folderActions); spyOn(folderActions, 'getHandler').and.returnValue(handler); expect(action.getSystemHandler('folder', 'name')).toBe(handler); }); @@ -205,7 +205,7 @@ describe('ContentAction', () => { spyOn(folderActions, 'getHandler').and.stub(); spyOn(documentActions, 'getHandler').and.stub(); - let action = new ContentAction(actionList, documentActions, folderActions); + let action = new ContentActionComponent(actionList, documentActions, folderActions); expect(action.getSystemHandler('unknown', 'name')).toBeNull(); expect(folderActions.getHandler).not.toHaveBeenCalled(); @@ -214,7 +214,7 @@ describe('ContentAction', () => { }); it('should wire model with custom event handler', (done) => { - let action = new ContentAction(actionList, documentActions, folderActions); + let action = new ContentActionComponent(actionList, documentActions, folderActions); let file = new FileNode(); let handler = new EventEmitter(); @@ -230,7 +230,7 @@ describe('ContentAction', () => { }); it('should allow registering model without handler', () => { - let action = new ContentAction(actionList, documentActions, folderActions); + let action = new ContentActionComponent(actionList, documentActions, folderActions); spyOn(actionList, 'registerAction').and.callThrough(); action.execute = null; @@ -241,7 +241,7 @@ describe('ContentAction', () => { }); it('should register on init', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); spyOn(action, 'register').and.callThrough(); action.ngOnInit(); @@ -249,10 +249,10 @@ describe('ContentAction', () => { }); it('should require action list to register action with', () => { - let action = new ContentAction(actionList, null, null); + let action = new ContentActionComponent(actionList, null, null); expect(action.register()).toBeTruthy(); - action = new ContentAction(null, null, null); + action = new ContentActionComponent(null, null, null); expect(action.register()).toBeFalsy(); }); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.ts similarity index 80% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-action.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.ts index 03ad0740c6c..3adbb64985f 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-action.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-action/content-action.component.ts @@ -15,26 +15,19 @@ * limitations under the License. */ -import { - Component, - OnInit, - OnChanges, - Input, - Output, - EventEmitter -} from '@angular/core'; - -import { ContentActionModel } from './../models/content-action.model'; -import { ContentActionList } from './content-action-list'; -import { DocumentActionsService } from '../services/document-actions.service'; -import { FolderActionsService } from '../services/folder-actions.service'; -import { ContentActionHandler } from '../models/content-action.model'; +import { Component, OnInit, OnChanges, Input, Output, EventEmitter } from '@angular/core'; + +import { ContentActionListComponent } from './content-action-list.component'; +import { ContentActionModel } from './../../models/content-action.model'; +import { DocumentActionsService } from '../../services/document-actions.service'; +import { FolderActionsService } from '../../services/folder-actions.service'; +import { ContentActionHandler } from '../../models/content-action.model'; @Component({ selector: 'content-action', template: '' }) -export class ContentAction implements OnInit, OnChanges { +export class ContentActionComponent implements OnInit, OnChanges { @Input() title: string = 'Action'; @@ -54,7 +47,7 @@ export class ContentAction implements OnInit, OnChanges { model: ContentActionModel; constructor( - private list: ContentActionList, + private list: ContentActionListComponent, private documentActions: DocumentActionsService, private folderActions: FolderActionsService) { this.model = new ContentActionModel(); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.spec.ts similarity index 76% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.spec.ts index c21621f33fb..8fd4daad64f 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.spec.ts @@ -17,19 +17,19 @@ import { DataColumn } from 'ng2-alfresco-datatable'; -import { DocumentList } from './document-list'; -import { DocumentListServiceMock } from '../assets/document-list.service.mock'; -import { ContentColumnList } from './content-column-list'; +import { DocumentListComponent } from './../document-list.component'; +import { DocumentListServiceMock } from './../../assets/document-list.service.mock'; +import { ContentColumnListComponent } from './content-column-list.component'; describe('ContentColumnList', () => { - let documentList: DocumentList; - let columnList: ContentColumnList; + let documentList: DocumentListComponent; + let columnList: ContentColumnListComponent; beforeEach(() => { let service = new DocumentListServiceMock(); - documentList = new DocumentList(service, null, null); - columnList = new ContentColumnList(documentList); + documentList = new DocumentListComponent(service, null, null); + columnList = new ContentColumnListComponent(documentList); }); it('should register column within parent document list', () => { @@ -45,7 +45,7 @@ describe('ContentColumnList', () => { }); it('should require document list instance to register action', () => { - columnList = new ContentColumnList(null); + columnList = new ContentColumnListComponent(null); let col = <DataColumn> {}; expect(columnList.registerColumn(col)).toBeFalsy(); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.ts similarity index 87% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.ts index f84c158e8ed..ac1580efa2d 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column-list.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column-list.component.ts @@ -16,17 +16,17 @@ */ import { Component } from '@angular/core'; -import { DocumentList } from './document-list'; import { DataColumn } from 'ng2-alfresco-datatable'; +import { DocumentListComponent } from './../document-list.component'; + @Component({ selector: 'content-columns', template: '' }) -export class ContentColumnList { +export class ContentColumnListComponent { - constructor( - private documentList: DocumentList) { + constructor(private documentList: DocumentListComponent) { } /** diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.spec.ts similarity index 66% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.spec.ts index 0b64a9892a4..1400641d353 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.spec.ts @@ -15,26 +15,26 @@ * limitations under the License. */ -import { DocumentList } from './document-list'; -import { ContentColumn } from './content-column'; -import { DocumentListServiceMock } from '../assets/document-list.service.mock'; -import { ContentColumnList } from './content-column-list'; +import { DocumentListComponent } from './../document-list.component'; +import { ContentColumnComponent } from './content-column.component'; +import { DocumentListServiceMock } from './../../assets/document-list.service.mock'; +import { ContentColumnListComponent } from './content-column-list.component'; describe('ContentColumn', () => { - let documentList: DocumentList; - let columnList: ContentColumnList; + let documentList: DocumentListComponent; + let columnList: ContentColumnListComponent; beforeEach(() => { let service = new DocumentListServiceMock(); - documentList = new DocumentList(service, null, null); - columnList = new ContentColumnList(documentList); + documentList = new DocumentListComponent(service, null, null); + columnList = new ContentColumnListComponent(documentList); }); it('should register model within parent column list', () => { spyOn(columnList, 'registerColumn').and.callThrough(); - let column = new ContentColumn(columnList); + let column = new ContentColumnComponent(columnList); column.ngOnInit(); expect(columnList.registerColumn).toHaveBeenCalled(); @@ -45,7 +45,7 @@ describe('ContentColumn', () => { }); it('should setup screen reader title for thumbnail column', () => { - let column = new ContentColumn(columnList); + let column = new ContentColumnComponent(columnList); column.key = '$thumbnail'; column.ngOnInit(); @@ -53,7 +53,7 @@ describe('ContentColumn', () => { }); it('should register on init', () => { - let column = new ContentColumn(columnList); + let column = new ContentColumnComponent(columnList); spyOn(column, 'register').and.callThrough(); column.ngOnInit(); @@ -61,10 +61,10 @@ describe('ContentColumn', () => { }); it('should require action list to register action with', () => { - let column = new ContentColumn(columnList); + let column = new ContentColumnComponent(columnList); expect(column.register()).toBeTruthy(); - column = new ContentColumn(null); + column = new ContentColumnComponent(null); expect(column.register()).toBeFalsy(); }); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.ts b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.ts similarity index 87% rename from ng2-components/ng2-alfresco-documentlist/src/components/content-column.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.ts index 3f5f715f6d0..5adcb351a83 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/content-column.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/content-column/content-column.component.ts @@ -16,14 +16,15 @@ */ import { Component, OnInit, Input } from '@angular/core'; -import { ContentColumnList } from './content-column-list'; import { DataColumn } from 'ng2-alfresco-datatable'; +import { ContentColumnListComponent } from './content-column-list.component'; + @Component({ selector: 'content-column', template: '' }) -export class ContentColumn implements OnInit, DataColumn { +export class ContentColumnComponent implements OnInit, DataColumn { @Input() key: string; @@ -49,7 +50,7 @@ export class ContentColumn implements OnInit, DataColumn { @Input('class') cssClass: string; - constructor(private list: ContentColumnList) {} + constructor(private list: ContentColumnListComponent) {} ngOnInit() { if (!this.srTitle && this.key === '$thumbnail') { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.css b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.css similarity index 100% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-list.css rename to ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.css diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.html b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html similarity index 100% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-list.html rename to ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.html diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts similarity index 92% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts index e877c82550e..c2cc0459cb8 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.spec.ts @@ -17,7 +17,8 @@ import { NgZone, SimpleChange, TemplateRef } from '@angular/core'; import { DataTableComponent, DataColumn, DataRowEvent } from 'ng2-alfresco-datatable'; -import { DocumentList } from './document-list'; + +import { DocumentListComponent } from './document-list.component'; import { DocumentListServiceMock } from './../assets/document-list.service.mock'; import { ContentActionModel } from '../models/content-action.model'; import { FileNode, FolderNode } from '../assets/document-library.model.mock'; @@ -27,14 +28,14 @@ import { ShareDataRow, RowFilter, ImageResolver } from './../data/share-datatabl describe('DocumentList', () => { let documentListService: DocumentListServiceMock; - let documentList: DocumentList; + let documentList: DocumentListComponent; let eventMock: any; let componentHandler; beforeEach(() => { documentListService = new DocumentListServiceMock(); let zone = new NgZone(false); - documentList = new DocumentList(documentListService, zone, null); + documentList = new DocumentListComponent(documentListService, zone, null); eventMock = { preventDefault: function () { @@ -154,7 +155,7 @@ describe('DocumentList', () => { spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve(true)); - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.onNodeClick(node); expect(documentList.loadFolder).toHaveBeenCalled(); @@ -227,7 +228,7 @@ describe('DocumentList', () => { expect(e.value).toBe(file); done(); }); - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.onNodeClick(file); }); @@ -237,7 +238,7 @@ describe('DocumentList', () => { expect(e.value).toBe(file); done(); }); - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.onNodeDblClick(file); }); @@ -245,7 +246,7 @@ describe('DocumentList', () => { let folder = new FolderNode(); spyOn(documentList, 'performNavigation').and.stub(); - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.onNodeClick(folder); expect(documentList.performNavigation).toHaveBeenCalled(); }); @@ -254,7 +255,7 @@ describe('DocumentList', () => { let folder = new FolderNode(); spyOn(documentList, 'performNavigation').and.stub(); - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.onNodeDblClick(folder); expect(documentList.performNavigation).toHaveBeenCalled(); }); @@ -263,7 +264,7 @@ describe('DocumentList', () => { let folder = new FolderNode(); spyOn(documentList, 'performNavigation').and.stub(); - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.onNodeDblClick(folder); expect(documentList.performNavigation).not.toHaveBeenCalled(); @@ -274,7 +275,7 @@ describe('DocumentList', () => { spyOn(documentList, 'performNavigation').and.stub(); documentList.navigate = false; - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.onNodeDblClick(folder); expect(documentList.performNavigation).not.toHaveBeenCalled(); @@ -300,13 +301,13 @@ describe('DocumentList', () => { file.entry = null; let called = false; - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.preview.subscribe(val => called = true); documentList.onNodeClick(file); expect(called).toBeFalsy(); - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.onNodeDblClick(file); expect(called).toBeFalsy(); }); @@ -316,10 +317,10 @@ describe('DocumentList', () => { folder.entry = null; spyOn(documentList, 'performNavigation').and.stub(); - documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; documentList.onNodeClick(folder); - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.onNodeDblClick(folder); expect(documentList.performNavigation).not.toHaveBeenCalled(); @@ -391,10 +392,10 @@ describe('DocumentList', () => { it('should enforce single-click on mobile browser', () => { spyOn(documentList, 'isMobile').and.returnValue(true); - documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION; + documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; documentList.ngOnInit(); expect(documentList.isMobile).toHaveBeenCalled(); - expect(documentList.navigationMode).toBe(DocumentList.SINGLE_CLICK_NAVIGATION); + expect(documentList.navigationMode).toBe(DocumentListComponent.SINGLE_CLICK_NAVIGATION); }); it('should emit error on wrong folder id', (done) => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts similarity index 95% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts index 55c73ae85bf..1fc0d76a952 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.component.ts @@ -29,10 +29,10 @@ declare var module: any; @Component({ moduleId: module.id, selector: 'alfresco-document-list', - styleUrls: ['./document-list.css'], - templateUrl: './document-list.html' + styleUrls: ['./document-list.component.css'], + templateUrl: './document-list.component.html' }) -export class DocumentList implements OnInit, OnChanges, AfterContentInit { +export class DocumentListComponent implements OnInit, OnChanges, AfterContentInit { static SINGLE_CLICK_NAVIGATION: string = 'click'; static DOUBLE_CLICK_NAVIGATION: string = 'dblclick'; @@ -47,7 +47,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit { navigate: boolean = true; @Input() - navigationMode: string = DocumentList.DOUBLE_CLICK_NAVIGATION; // click|dblclick + navigationMode: string = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; // click|dblclick @Input() thumbnails: boolean = false; @@ -65,7 +65,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit { creationMenuActions: boolean = true; @Input() - pageSize: number = DocumentList.DEFAULT_PAGE_SIZE; + pageSize: number = DocumentListComponent.DEFAULT_PAGE_SIZE; @Input() set rowFilter(value: RowFilter) { @@ -156,7 +156,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit { // Automatically enforce single-click navigation for mobile browsers if (this.isMobile()) { - this.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION; + this.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION; } this.loadFolder(); @@ -309,7 +309,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit { value: node }); - if (this.navigate && this.navigationMode === DocumentList.SINGLE_CLICK_NAVIGATION) { + if (this.navigate && this.navigationMode === DocumentListComponent.SINGLE_CLICK_NAVIGATION) { if (node && node.entry) { if (node.entry.isFile) { this.onPreviewFile(node); @@ -332,7 +332,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit { value: node }); - if (this.navigate && this.navigationMode === DocumentList.DOUBLE_CLICK_NAVIGATION) { + if (this.navigate && this.navigationMode === DocumentListComponent.DOUBLE_CLICK_NAVIGATION) { if (node && node.entry) { if (node.entry.isFile) { this.onPreviewFile(node); diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.css b/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.css similarity index 100% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.css rename to ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.css diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.html b/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.html similarity index 100% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.html rename to ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.html diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.ts similarity index 96% rename from ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.ts index 43a5d9fc6e0..e9e7172189b 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-menu-action.component.ts @@ -18,6 +18,7 @@ import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core'; import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core'; import { MinimalNodeEntity } from 'alfresco-js-api'; + import { DocumentListService } from './../services/document-list.service'; import { ContentActionModel } from './../models/content-action.model'; @@ -28,10 +29,10 @@ const ERROR_FOLDER_ALREADY_EXIST = 409; @Component({ moduleId: module.id, selector: 'alfresco-document-menu-action', - styleUrls: ['./document-menu-action.css'], - templateUrl: './document-menu-action.html' + styleUrls: ['./document-menu-action.component.css'], + templateUrl: './document-menu-action.component.html' }) -export class DocumentMenuAction { +export class DocumentMenuActionComponent { @Input() folderId: string; diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.spec.ts similarity index 72% rename from ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.spec.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.spec.ts index 03ac5afbbd8..766522cb4d1 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.spec.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.spec.ts @@ -15,21 +15,22 @@ * limitations under the License. */ -import { EmptyFolderContent } from './empty-folder-content'; -import { DocumentList } from './document-list'; -import { DocumentListServiceMock } from './../assets/document-list.service.mock'; import { DataTableComponent } from 'ng2-alfresco-datatable'; +import { EmptyFolderContentComponent } from './empty-folder-content.component'; +import { DocumentListComponent } from './../document-list.component'; +import { DocumentListServiceMock } from './../../assets/document-list.service.mock'; + describe('EmptyFolderContent', () => { - let emptyFolderContent: EmptyFolderContent; - let documentList: DocumentList; + let emptyFolderContent: EmptyFolderContentComponent; + let documentList: DocumentListComponent; beforeEach(() => { let documentListService = new DocumentListServiceMock(); - documentList = new DocumentList(documentListService, null, null); + documentList = new DocumentListComponent(documentListService, null, null); documentList.dataTable = new DataTableComponent(); - emptyFolderContent = new EmptyFolderContent(documentList); + emptyFolderContent = new EmptyFolderContentComponent(documentList); }); it('is defined', () => { diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.ts b/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.ts similarity index 77% rename from ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.ts rename to ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.ts index cb55c97fec3..2ff4ee759da 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder-content.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/components/empty-folder/empty-folder-content.component.ts @@ -15,23 +15,18 @@ * limitations under the License. */ -import { - Directive, - ContentChild, - TemplateRef, - AfterContentInit -} from '@angular/core'; -import { DocumentList } from './document-list'; +import { Directive, ContentChild, TemplateRef, AfterContentInit } from '@angular/core'; +import { DocumentListComponent } from './../document-list.component'; @Directive({ selector: 'empty-folder-content' }) -export class EmptyFolderContent implements AfterContentInit { +export class EmptyFolderContentComponent implements AfterContentInit { @ContentChild(TemplateRef) template: any; - constructor(private documentList: DocumentList) { + constructor(private documentList: DocumentListComponent) { } ngAfterContentInit() {