mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
parent
26fb2374d2
commit
dc28d5b679
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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[] = [
|
||||
|
@ -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 = <PathElementEntity> { id: '-id-', name: 'name' };
|
||||
|
@ -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[] = [];
|
||||
|
||||
|
@ -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();
|
||||
});
|
@ -16,17 +16,17 @@
|
||||
*/
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import {DocumentList} from './document-list';
|
||||
import {ContentActionModel} from './../models/content-action.model';
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
/**
|
@ -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 = '<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();
|
||||
});
|
||||
});
|
@ -15,26 +15,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
OnChanges,
|
||||
Input,
|
||||
Output,
|
||||
EventEmitter
|
||||
} from '@angular/core';
|
||||
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 { 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();
|
@ -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();
|
||||
});
|
@ -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) {
|
||||
}
|
||||
|
||||
/**
|
@ -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();
|
||||
});
|
||||
|
@ -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') {
|
@ -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) => {
|
@ -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);
|
@ -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;
|
@ -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', () => {
|
@ -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() {
|
Loading…
x
Reference in New Issue
Block a user