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 { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
||||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||||
import { AuthService, LogService } from 'ng2-alfresco-core';
|
import { AuthService, LogService } from 'ng2-alfresco-core';
|
||||||
import {
|
import { DocumentActionsService, DocumentListComponent, ContentActionHandler, DocumentActionModel, FolderActionModel } from 'ng2-alfresco-documentlist';
|
||||||
DocumentActionsService,
|
|
||||||
DocumentList,
|
|
||||||
ContentActionHandler,
|
|
||||||
DocumentActionModel,
|
|
||||||
FolderActionModel
|
|
||||||
} from 'ng2-alfresco-documentlist';
|
|
||||||
import { FormService } from 'ng2-activiti-form';
|
import { FormService } from 'ng2-activiti-form';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -45,8 +39,8 @@ export class FilesComponent implements OnInit {
|
|||||||
versioning: boolean = false;
|
versioning: boolean = false;
|
||||||
acceptedFilesType: string = '.jpg,.pdf,.js';
|
acceptedFilesType: string = '.jpg,.pdf,.js';
|
||||||
|
|
||||||
@ViewChild(DocumentList)
|
@ViewChild(DocumentListComponent)
|
||||||
documentList: DocumentList;
|
documentList: DocumentListComponent;
|
||||||
|
|
||||||
constructor(private documentActions: DocumentActionsService,
|
constructor(private documentActions: DocumentActionsService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
|
@ -131,7 +131,7 @@ import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfr
|
|||||||
class DocumentListDemo {
|
class DocumentListDemo {
|
||||||
|
|
||||||
@ViewChild(DocumentList)
|
@ViewChild(DocumentList)
|
||||||
documentList: DocumentList;
|
documentList: DocumentListComponent;
|
||||||
|
|
||||||
constructor(private authService: AlfrescoAuthenticationService,
|
constructor(private authService: AlfrescoAuthenticationService,
|
||||||
private settingsService: AlfrescoSettingsService) {
|
private settingsService: AlfrescoSettingsService) {
|
||||||
@ -210,7 +210,7 @@ DocumentList provides simple breadcrumb element to indicate the current position
|
|||||||
|
|
||||||
| Name | Type | Description |
|
| 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. |
|
| `folderNode` | MinimalNodeEntryEntity | Active node, builds UI based on `folderNode.path.elements` collection. |
|
||||||
|
|
||||||
### Creation Menu Action
|
### Creation Menu Action
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
import { NgModule, Component, OnInit, ViewChild } from '@angular/core';
|
import { NgModule, Component, OnInit, ViewChild } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
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';
|
import { CoreModule, StorageService, SettingsService, AuthService, AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -124,8 +124,8 @@ class DocumentListDemo implements OnInit {
|
|||||||
ecmHost: string = 'http://localhost:8080';
|
ecmHost: string = 'http://localhost:8080';
|
||||||
ticket: string;
|
ticket: string;
|
||||||
|
|
||||||
@ViewChild(DocumentList)
|
@ViewChild(DocumentListComponent)
|
||||||
documentList: DocumentList;
|
documentList: DocumentListComponent;
|
||||||
|
|
||||||
constructor(private authService: AuthService,
|
constructor(private authService: AuthService,
|
||||||
private settingsService: SettingsService,
|
private settingsService: SettingsService,
|
||||||
|
@ -19,26 +19,26 @@ import { NgModule, ModuleWithProviders } from '@angular/core';
|
|||||||
import { CoreModule } from 'ng2-alfresco-core';
|
import { CoreModule } from 'ng2-alfresco-core';
|
||||||
import { DataTableModule } from 'ng2-alfresco-datatable';
|
import { DataTableModule } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
import { DocumentList } from './src/components/document-list';
|
import { DocumentListComponent } from './src/components/document-list.component';
|
||||||
import { DocumentMenuAction } from './src/components/document-menu-action';
|
import { DocumentMenuActionComponent } from './src/components/document-menu-action.component';
|
||||||
import { ContentColumn } from './src/components/content-column';
|
import { ContentColumnComponent } from './src/components/content-column/content-column.component';
|
||||||
import { ContentColumnList } from './src/components/content-column-list';
|
import { ContentColumnListComponent } from './src/components/content-column/content-column-list.component';
|
||||||
import { ContentAction } from './src/components/content-action';
|
import { ContentActionComponent } from './src/components/content-action/content-action.component';
|
||||||
import { ContentActionList } from './src/components/content-action-list';
|
import { ContentActionListComponent } from './src/components/content-action/content-action-list.component';
|
||||||
import { EmptyFolderContent } from './src/components/empty-folder-content';
|
import { EmptyFolderContentComponent } from './src/components/empty-folder/empty-folder-content.component';
|
||||||
import { DocumentListBreadcrumb } from './src/components/breadcrumb/breadcrumb.component';
|
import { DocumentListBreadcrumbComponent } from './src/components/breadcrumb/breadcrumb.component';
|
||||||
|
|
||||||
import { FolderActionsService } from './src/services/folder-actions.service';
|
import { FolderActionsService } from './src/services/folder-actions.service';
|
||||||
import { DocumentActionsService } from './src/services/document-actions.service';
|
import { DocumentActionsService } from './src/services/document-actions.service';
|
||||||
import { DocumentListService } from './src/services/document-list.service';
|
import { DocumentListService } from './src/services/document-list.service';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
export * from './src/components/document-list';
|
export * from './src/components/document-list.component';
|
||||||
export * from './src/components/content-column';
|
export * from './src/components/content-column/content-column.component';
|
||||||
export * from './src/components/content-column-list';
|
export * from './src/components/content-column/content-column-list.component';
|
||||||
export * from './src/components/content-action';
|
export * from './src/components/content-action/content-action.component';
|
||||||
export * from './src/components/content-action-list';
|
export * from './src/components/content-action/content-action-list.component';
|
||||||
export * from './src/components/empty-folder-content';
|
export * from './src/components/empty-folder/empty-folder-content.component';
|
||||||
export * from './src/components/breadcrumb/breadcrumb.component';
|
export * from './src/components/breadcrumb/breadcrumb.component';
|
||||||
|
|
||||||
// data
|
// data
|
||||||
@ -54,14 +54,14 @@ export * from './src/models/content-action.model';
|
|||||||
export * from './src/models/document-library.model';
|
export * from './src/models/document-library.model';
|
||||||
|
|
||||||
export const DOCUMENT_LIST_DIRECTIVES: any[] = [
|
export const DOCUMENT_LIST_DIRECTIVES: any[] = [
|
||||||
DocumentList,
|
DocumentListComponent,
|
||||||
DocumentMenuAction,
|
DocumentMenuActionComponent,
|
||||||
ContentColumn,
|
ContentColumnComponent,
|
||||||
ContentColumnList,
|
ContentColumnListComponent,
|
||||||
ContentAction,
|
ContentActionComponent,
|
||||||
ContentActionList,
|
ContentActionListComponent,
|
||||||
EmptyFolderContent,
|
EmptyFolderContentComponent,
|
||||||
DocumentListBreadcrumb
|
DocumentListBreadcrumbComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
export const DOCUMENT_LIST_PROVIDERS: any[] = [
|
export const DOCUMENT_LIST_PROVIDERS: any[] = [
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { PathElementEntity } from 'alfresco-js-api';
|
import { PathElementEntity } from 'alfresco-js-api';
|
||||||
import { DocumentListBreadcrumb } from './breadcrumb.component';
|
import { DocumentListBreadcrumbComponent } from './breadcrumb.component';
|
||||||
import { DocumentList } from '../document-list';
|
import { DocumentListComponent } from '../document-list.component';
|
||||||
|
|
||||||
describe('DocumentListBreadcrumb', () => {
|
describe('DocumentListBreadcrumb', () => {
|
||||||
|
|
||||||
let component;
|
let component;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
component = new DocumentListBreadcrumb();
|
component = new DocumentListBreadcrumbComponent();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set current path', () => {
|
it('should set current path', () => {
|
||||||
@ -50,7 +50,7 @@ describe('DocumentListBreadcrumb', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should update document list on click', (done) => {
|
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();
|
spyOn(documentList, 'loadFolderByNodeId').and.stub();
|
||||||
|
|
||||||
let node = <PathElementEntity> { id: '-id-', name: 'name' };
|
let node = <PathElementEntity> { id: '-id-', name: 'name' };
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { MinimalNodeEntryEntity, PathElementEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntryEntity, PathElementEntity } from 'alfresco-js-api';
|
||||||
import { DocumentList } from '../document-list';
|
import { DocumentListComponent } from '../document-list.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
@ -25,13 +25,13 @@ import { DocumentList } from '../document-list';
|
|||||||
templateUrl: './breadcrumb.component.html',
|
templateUrl: './breadcrumb.component.html',
|
||||||
styleUrls: ['./breadcrumb.component.css']
|
styleUrls: ['./breadcrumb.component.css']
|
||||||
})
|
})
|
||||||
export class DocumentListBreadcrumb implements OnChanges {
|
export class DocumentListBreadcrumbComponent implements OnChanges {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
folderNode: MinimalNodeEntryEntity;
|
folderNode: MinimalNodeEntryEntity;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
target: DocumentList;
|
target: DocumentListComponent;
|
||||||
|
|
||||||
route: PathElementEntity[] = [];
|
route: PathElementEntity[] = [];
|
||||||
|
|
||||||
|
@ -15,20 +15,20 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DocumentList } from './document-list';
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
import { DocumentListServiceMock } from '../assets/document-list.service.mock';
|
import { DocumentListServiceMock } from './../../assets/document-list.service.mock';
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionModel } from './../../models/content-action.model';
|
||||||
import { ContentActionList } from './content-action-list';
|
import { ContentActionListComponent } from './content-action-list.component';
|
||||||
|
|
||||||
describe('ContentColumnList', () => {
|
describe('ContentColumnList', () => {
|
||||||
|
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
let actionList: ContentActionList;
|
let actionList: ContentActionListComponent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let documentListService = new DocumentListServiceMock();
|
let documentListService = new DocumentListServiceMock();
|
||||||
documentList = new DocumentList(documentListService, null, null);
|
documentList = new DocumentListComponent(documentListService, null, null);
|
||||||
actionList = new ContentActionList(documentList);
|
actionList = new ContentActionListComponent(documentList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should register action', () => {
|
it('should register action', () => {
|
||||||
@ -42,7 +42,7 @@ describe('ContentColumnList', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should require document list instance to register action', () => {
|
it('should require document list instance to register action', () => {
|
||||||
actionList = new ContentActionList(null);
|
actionList = new ContentActionListComponent(null);
|
||||||
let action = new ContentActionModel();
|
let action = new ContentActionModel();
|
||||||
expect(actionList.registerAction(action)).toBeFalsy();
|
expect(actionList.registerAction(action)).toBeFalsy();
|
||||||
});
|
});
|
@ -15,18 +15,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {Component} from '@angular/core';
|
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({
|
@Component({
|
||||||
selector: 'content-actions',
|
selector: 'content-actions',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class ContentActionList {
|
export class ContentActionListComponent {
|
||||||
|
|
||||||
constructor(
|
constructor(private documentList: DocumentListComponent) {
|
||||||
private documentList: DocumentList) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -17,19 +17,19 @@
|
|||||||
|
|
||||||
import { EventEmitter } from '@angular/core';
|
import { EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
import { DocumentList } from './document-list';
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
import { DocumentListServiceMock } from '../assets/document-list.service.mock';
|
import { DocumentListServiceMock } from './../../assets/document-list.service.mock';
|
||||||
import { ContentActionList } from './content-action-list';
|
import { ContentActionListComponent } from './content-action-list.component';
|
||||||
import { ContentAction } from './content-action';
|
import { ContentActionComponent } from './content-action.component';
|
||||||
import { DocumentActionsService } from '../services/document-actions.service';
|
import { DocumentActionsService } from './../../services/document-actions.service';
|
||||||
import { FolderActionsService } from '../services/folder-actions.service';
|
import { FolderActionsService } from './../../services/folder-actions.service';
|
||||||
import { ContentActionHandler } from '../models/content-action.model';
|
import { ContentActionHandler } from './../../models/content-action.model';
|
||||||
import { FileNode } from '../assets/document-library.model.mock';
|
import { FileNode } from './../../assets/document-library.model.mock';
|
||||||
|
|
||||||
describe('ContentAction', () => {
|
describe('ContentAction', () => {
|
||||||
|
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
let actionList: ContentActionList;
|
let actionList: ContentActionListComponent;
|
||||||
let documentActions: DocumentActionsService;
|
let documentActions: DocumentActionsService;
|
||||||
let folderActions: FolderActionsService;
|
let folderActions: FolderActionsService;
|
||||||
|
|
||||||
@ -38,21 +38,21 @@ describe('ContentAction', () => {
|
|||||||
documentActions = new DocumentActionsService(null, null);
|
documentActions = new DocumentActionsService(null, null);
|
||||||
folderActions = new FolderActionsService(null);
|
folderActions = new FolderActionsService(null);
|
||||||
|
|
||||||
documentList = new DocumentList(documentServiceMock, null, null);
|
documentList = new DocumentListComponent(documentServiceMock, null, null);
|
||||||
actionList = new ContentActionList(documentList);
|
actionList = new ContentActionListComponent(documentList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should register within parent actions list', () => {
|
it('should register within parent actions list', () => {
|
||||||
spyOn(actionList, 'registerAction').and.stub();
|
spyOn(actionList, 'registerAction').and.stub();
|
||||||
|
|
||||||
let action = new ContentAction(actionList, null, null);
|
let action = new ContentActionComponent(actionList, null, null);
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
|
|
||||||
expect(actionList.registerAction).toHaveBeenCalled();
|
expect(actionList.registerAction).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should setup and register model', () => {
|
it('should setup and register model', () => {
|
||||||
let action = new ContentAction(actionList, null, null);
|
let action = new ContentActionComponent(actionList, null, null);
|
||||||
action.target = 'document';
|
action.target = 'document';
|
||||||
action.title = '<title>';
|
action.title = '<title>';
|
||||||
action.icon = '<icon>';
|
action.icon = '<icon>';
|
||||||
@ -73,7 +73,7 @@ describe('ContentAction', () => {
|
|||||||
let handler = function() {};
|
let handler = function() {};
|
||||||
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
||||||
|
|
||||||
let action = new ContentAction(actionList, documentActions, null);
|
let action = new ContentActionComponent(actionList, documentActions, null);
|
||||||
action.target = 'document';
|
action.target = 'document';
|
||||||
action.handler = '<handler>';
|
action.handler = '<handler>';
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
@ -89,7 +89,7 @@ describe('ContentAction', () => {
|
|||||||
let handler = function() {};
|
let handler = function() {};
|
||||||
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
||||||
|
|
||||||
let action = new ContentAction(actionList, null, folderActions);
|
let action = new ContentActionComponent(actionList, null, folderActions);
|
||||||
action.target = 'folder';
|
action.target = 'folder';
|
||||||
action.handler = '<handler>';
|
action.handler = '<handler>';
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
@ -105,7 +105,7 @@ describe('ContentAction', () => {
|
|||||||
spyOn(folderActions, 'getHandler').and.stub();
|
spyOn(folderActions, 'getHandler').and.stub();
|
||||||
spyOn(documentActions, '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.handler = '<handler>';
|
||||||
|
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
@ -125,7 +125,7 @@ describe('ContentAction', () => {
|
|||||||
it('should be case insensitive for document target', () => {
|
it('should be case insensitive for document target', () => {
|
||||||
spyOn(documentActions, 'getHandler').and.stub();
|
spyOn(documentActions, 'getHandler').and.stub();
|
||||||
|
|
||||||
let action = new ContentAction(actionList, documentActions, null);
|
let action = new ContentActionComponent(actionList, documentActions, null);
|
||||||
action.target = 'DoCuMeNt';
|
action.target = 'DoCuMeNt';
|
||||||
action.handler = '<handler>';
|
action.handler = '<handler>';
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ describe('ContentAction', () => {
|
|||||||
it('should be case insensitive for folder target', () => {
|
it('should be case insensitive for folder target', () => {
|
||||||
spyOn(folderActions, 'getHandler').and.stub();
|
spyOn(folderActions, 'getHandler').and.stub();
|
||||||
|
|
||||||
let action = new ContentAction(actionList, null, folderActions);
|
let action = new ContentActionComponent(actionList, null, folderActions);
|
||||||
action.target = 'FoLdEr';
|
action.target = 'FoLdEr';
|
||||||
action.handler = '<handler>';
|
action.handler = '<handler>';
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ describe('ContentAction', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
let action = new ContentAction(actionList, null, null);
|
let action = new ContentActionComponent(actionList, null, null);
|
||||||
action.target = 'document';
|
action.target = 'document';
|
||||||
action.execute = emitter;
|
action.execute = emitter;
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ describe('ContentAction', () => {
|
|||||||
|
|
||||||
it('should sync localizable fields with model', () => {
|
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.title = 'title1';
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
|
|
||||||
@ -178,25 +178,25 @@ describe('ContentAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not find document action handler with missing service', () => {
|
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();
|
expect(action.getSystemHandler('document', 'name')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not find folder action handler with missing service', () => {
|
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();
|
expect(action.getSystemHandler('folder', 'name')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find document action handler via service', () => {
|
it('should find document action handler via service', () => {
|
||||||
let handler = <ContentActionHandler> function (obj: any, target?: any) {};
|
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);
|
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
||||||
expect(action.getSystemHandler('document', 'name')).toBe(handler);
|
expect(action.getSystemHandler('document', 'name')).toBe(handler);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should find folder action handler via service', () => {
|
it('should find folder action handler via service', () => {
|
||||||
let handler = <ContentActionHandler> function (obj: any, target?: any) {};
|
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);
|
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
||||||
expect(action.getSystemHandler('folder', 'name')).toBe(handler);
|
expect(action.getSystemHandler('folder', 'name')).toBe(handler);
|
||||||
});
|
});
|
||||||
@ -205,7 +205,7 @@ describe('ContentAction', () => {
|
|||||||
spyOn(folderActions, 'getHandler').and.stub();
|
spyOn(folderActions, 'getHandler').and.stub();
|
||||||
spyOn(documentActions, '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(action.getSystemHandler('unknown', 'name')).toBeNull();
|
||||||
expect(folderActions.getHandler).not.toHaveBeenCalled();
|
expect(folderActions.getHandler).not.toHaveBeenCalled();
|
||||||
@ -214,7 +214,7 @@ describe('ContentAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should wire model with custom event handler', (done) => {
|
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 file = new FileNode();
|
||||||
|
|
||||||
let handler = new EventEmitter();
|
let handler = new EventEmitter();
|
||||||
@ -230,7 +230,7 @@ describe('ContentAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should allow registering model without handler', () => {
|
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();
|
spyOn(actionList, 'registerAction').and.callThrough();
|
||||||
action.execute = null;
|
action.execute = null;
|
||||||
@ -241,7 +241,7 @@ describe('ContentAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should register on init', () => {
|
it('should register on init', () => {
|
||||||
let action = new ContentAction(actionList, null, null);
|
let action = new ContentActionComponent(actionList, null, null);
|
||||||
spyOn(action, 'register').and.callThrough();
|
spyOn(action, 'register').and.callThrough();
|
||||||
|
|
||||||
action.ngOnInit();
|
action.ngOnInit();
|
||||||
@ -249,10 +249,10 @@ describe('ContentAction', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should require action list to register action with', () => {
|
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();
|
expect(action.register()).toBeTruthy();
|
||||||
|
|
||||||
action = new ContentAction(null, null, null);
|
action = new ContentActionComponent(null, null, null);
|
||||||
expect(action.register()).toBeFalsy();
|
expect(action.register()).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -15,26 +15,19 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Component, OnInit, OnChanges, Input, Output, EventEmitter } from '@angular/core';
|
||||||
Component,
|
|
||||||
OnInit,
|
|
||||||
OnChanges,
|
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
EventEmitter
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionListComponent } from './content-action-list.component';
|
||||||
import { ContentActionList } from './content-action-list';
|
import { ContentActionModel } from './../../models/content-action.model';
|
||||||
import { DocumentActionsService } from '../services/document-actions.service';
|
import { DocumentActionsService } from '../../services/document-actions.service';
|
||||||
import { FolderActionsService } from '../services/folder-actions.service';
|
import { FolderActionsService } from '../../services/folder-actions.service';
|
||||||
import { ContentActionHandler } from '../models/content-action.model';
|
import { ContentActionHandler } from '../../models/content-action.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'content-action',
|
selector: 'content-action',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class ContentAction implements OnInit, OnChanges {
|
export class ContentActionComponent implements OnInit, OnChanges {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
title: string = 'Action';
|
title: string = 'Action';
|
||||||
@ -54,7 +47,7 @@ export class ContentAction implements OnInit, OnChanges {
|
|||||||
model: ContentActionModel;
|
model: ContentActionModel;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private list: ContentActionList,
|
private list: ContentActionListComponent,
|
||||||
private documentActions: DocumentActionsService,
|
private documentActions: DocumentActionsService,
|
||||||
private folderActions: FolderActionsService) {
|
private folderActions: FolderActionsService) {
|
||||||
this.model = new ContentActionModel();
|
this.model = new ContentActionModel();
|
@ -17,19 +17,19 @@
|
|||||||
|
|
||||||
import { DataColumn } from 'ng2-alfresco-datatable';
|
import { DataColumn } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
import { DocumentList } from './document-list';
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
import { DocumentListServiceMock } from '../assets/document-list.service.mock';
|
import { DocumentListServiceMock } from './../../assets/document-list.service.mock';
|
||||||
import { ContentColumnList } from './content-column-list';
|
import { ContentColumnListComponent } from './content-column-list.component';
|
||||||
|
|
||||||
describe('ContentColumnList', () => {
|
describe('ContentColumnList', () => {
|
||||||
|
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
let columnList: ContentColumnList;
|
let columnList: ContentColumnListComponent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let service = new DocumentListServiceMock();
|
let service = new DocumentListServiceMock();
|
||||||
documentList = new DocumentList(service, null, null);
|
documentList = new DocumentListComponent(service, null, null);
|
||||||
columnList = new ContentColumnList(documentList);
|
columnList = new ContentColumnListComponent(documentList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should register column within parent document list', () => {
|
it('should register column within parent document list', () => {
|
||||||
@ -45,7 +45,7 @@ describe('ContentColumnList', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should require document list instance to register action', () => {
|
it('should require document list instance to register action', () => {
|
||||||
columnList = new ContentColumnList(null);
|
columnList = new ContentColumnListComponent(null);
|
||||||
let col = <DataColumn> {};
|
let col = <DataColumn> {};
|
||||||
expect(columnList.registerColumn(col)).toBeFalsy();
|
expect(columnList.registerColumn(col)).toBeFalsy();
|
||||||
});
|
});
|
@ -16,17 +16,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { DocumentList } from './document-list';
|
|
||||||
import { DataColumn } from 'ng2-alfresco-datatable';
|
import { DataColumn } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'content-columns',
|
selector: 'content-columns',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class ContentColumnList {
|
export class ContentColumnListComponent {
|
||||||
|
|
||||||
constructor(
|
constructor(private documentList: DocumentListComponent) {
|
||||||
private documentList: DocumentList) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -15,26 +15,26 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DocumentList } from './document-list';
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
import { ContentColumn } from './content-column';
|
import { ContentColumnComponent } from './content-column.component';
|
||||||
import { DocumentListServiceMock } from '../assets/document-list.service.mock';
|
import { DocumentListServiceMock } from './../../assets/document-list.service.mock';
|
||||||
import { ContentColumnList } from './content-column-list';
|
import { ContentColumnListComponent } from './content-column-list.component';
|
||||||
|
|
||||||
describe('ContentColumn', () => {
|
describe('ContentColumn', () => {
|
||||||
|
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
let columnList: ContentColumnList;
|
let columnList: ContentColumnListComponent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let service = new DocumentListServiceMock();
|
let service = new DocumentListServiceMock();
|
||||||
documentList = new DocumentList(service, null, null);
|
documentList = new DocumentListComponent(service, null, null);
|
||||||
columnList = new ContentColumnList(documentList);
|
columnList = new ContentColumnListComponent(documentList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should register model within parent column list', () => {
|
it('should register model within parent column list', () => {
|
||||||
spyOn(columnList, 'registerColumn').and.callThrough();
|
spyOn(columnList, 'registerColumn').and.callThrough();
|
||||||
|
|
||||||
let column = new ContentColumn(columnList);
|
let column = new ContentColumnComponent(columnList);
|
||||||
column.ngOnInit();
|
column.ngOnInit();
|
||||||
|
|
||||||
expect(columnList.registerColumn).toHaveBeenCalled();
|
expect(columnList.registerColumn).toHaveBeenCalled();
|
||||||
@ -45,7 +45,7 @@ describe('ContentColumn', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should setup screen reader title for thumbnail column', () => {
|
it('should setup screen reader title for thumbnail column', () => {
|
||||||
let column = new ContentColumn(columnList);
|
let column = new ContentColumnComponent(columnList);
|
||||||
column.key = '$thumbnail';
|
column.key = '$thumbnail';
|
||||||
column.ngOnInit();
|
column.ngOnInit();
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ describe('ContentColumn', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should register on init', () => {
|
it('should register on init', () => {
|
||||||
let column = new ContentColumn(columnList);
|
let column = new ContentColumnComponent(columnList);
|
||||||
spyOn(column, 'register').and.callThrough();
|
spyOn(column, 'register').and.callThrough();
|
||||||
|
|
||||||
column.ngOnInit();
|
column.ngOnInit();
|
||||||
@ -61,10 +61,10 @@ describe('ContentColumn', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should require action list to register action with', () => {
|
it('should require action list to register action with', () => {
|
||||||
let column = new ContentColumn(columnList);
|
let column = new ContentColumnComponent(columnList);
|
||||||
expect(column.register()).toBeTruthy();
|
expect(column.register()).toBeTruthy();
|
||||||
|
|
||||||
column = new ContentColumn(null);
|
column = new ContentColumnComponent(null);
|
||||||
expect(column.register()).toBeFalsy();
|
expect(column.register()).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
@ -16,14 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { ContentColumnList } from './content-column-list';
|
|
||||||
import { DataColumn } from 'ng2-alfresco-datatable';
|
import { DataColumn } from 'ng2-alfresco-datatable';
|
||||||
|
|
||||||
|
import { ContentColumnListComponent } from './content-column-list.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'content-column',
|
selector: 'content-column',
|
||||||
template: ''
|
template: ''
|
||||||
})
|
})
|
||||||
export class ContentColumn implements OnInit, DataColumn {
|
export class ContentColumnComponent implements OnInit, DataColumn {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
key: string;
|
key: string;
|
||||||
@ -49,7 +50,7 @@ export class ContentColumn implements OnInit, DataColumn {
|
|||||||
@Input('class')
|
@Input('class')
|
||||||
cssClass: string;
|
cssClass: string;
|
||||||
|
|
||||||
constructor(private list: ContentColumnList) {}
|
constructor(private list: ContentColumnListComponent) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.srTitle && this.key === '$thumbnail') {
|
if (!this.srTitle && this.key === '$thumbnail') {
|
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
import { NgZone, SimpleChange, TemplateRef } from '@angular/core';
|
import { NgZone, SimpleChange, TemplateRef } from '@angular/core';
|
||||||
import { DataTableComponent, DataColumn, DataRowEvent } from 'ng2-alfresco-datatable';
|
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 { DocumentListServiceMock } from './../assets/document-list.service.mock';
|
||||||
import { ContentActionModel } from '../models/content-action.model';
|
import { ContentActionModel } from '../models/content-action.model';
|
||||||
import { FileNode, FolderNode } from '../assets/document-library.model.mock';
|
import { FileNode, FolderNode } from '../assets/document-library.model.mock';
|
||||||
@ -27,14 +28,14 @@ import { ShareDataRow, RowFilter, ImageResolver } from './../data/share-datatabl
|
|||||||
describe('DocumentList', () => {
|
describe('DocumentList', () => {
|
||||||
|
|
||||||
let documentListService: DocumentListServiceMock;
|
let documentListService: DocumentListServiceMock;
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
let eventMock: any;
|
let eventMock: any;
|
||||||
let componentHandler;
|
let componentHandler;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
documentListService = new DocumentListServiceMock();
|
documentListService = new DocumentListServiceMock();
|
||||||
let zone = new NgZone(false);
|
let zone = new NgZone(false);
|
||||||
documentList = new DocumentList(documentListService, zone, null);
|
documentList = new DocumentListComponent(documentListService, zone, null);
|
||||||
|
|
||||||
eventMock = {
|
eventMock = {
|
||||||
preventDefault: function () {
|
preventDefault: function () {
|
||||||
@ -154,7 +155,7 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve(true));
|
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve(true));
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeClick(node);
|
documentList.onNodeClick(node);
|
||||||
|
|
||||||
expect(documentList.loadFolder).toHaveBeenCalled();
|
expect(documentList.loadFolder).toHaveBeenCalled();
|
||||||
@ -227,7 +228,7 @@ describe('DocumentList', () => {
|
|||||||
expect(e.value).toBe(file);
|
expect(e.value).toBe(file);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeClick(file);
|
documentList.onNodeClick(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -237,7 +238,7 @@ describe('DocumentList', () => {
|
|||||||
expect(e.value).toBe(file);
|
expect(e.value).toBe(file);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(file);
|
documentList.onNodeDblClick(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -245,7 +246,7 @@ describe('DocumentList', () => {
|
|||||||
let folder = new FolderNode();
|
let folder = new FolderNode();
|
||||||
spyOn(documentList, 'performNavigation').and.stub();
|
spyOn(documentList, 'performNavigation').and.stub();
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeClick(folder);
|
documentList.onNodeClick(folder);
|
||||||
expect(documentList.performNavigation).toHaveBeenCalled();
|
expect(documentList.performNavigation).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@ -254,7 +255,7 @@ describe('DocumentList', () => {
|
|||||||
let folder = new FolderNode();
|
let folder = new FolderNode();
|
||||||
spyOn(documentList, 'performNavigation').and.stub();
|
spyOn(documentList, 'performNavigation').and.stub();
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(folder);
|
documentList.onNodeDblClick(folder);
|
||||||
expect(documentList.performNavigation).toHaveBeenCalled();
|
expect(documentList.performNavigation).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@ -263,7 +264,7 @@ describe('DocumentList', () => {
|
|||||||
let folder = new FolderNode();
|
let folder = new FolderNode();
|
||||||
spyOn(documentList, 'performNavigation').and.stub();
|
spyOn(documentList, 'performNavigation').and.stub();
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(folder);
|
documentList.onNodeDblClick(folder);
|
||||||
|
|
||||||
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
||||||
@ -274,7 +275,7 @@ describe('DocumentList', () => {
|
|||||||
spyOn(documentList, 'performNavigation').and.stub();
|
spyOn(documentList, 'performNavigation').and.stub();
|
||||||
|
|
||||||
documentList.navigate = false;
|
documentList.navigate = false;
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(folder);
|
documentList.onNodeDblClick(folder);
|
||||||
|
|
||||||
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
||||||
@ -300,13 +301,13 @@ describe('DocumentList', () => {
|
|||||||
file.entry = null;
|
file.entry = null;
|
||||||
let called = false;
|
let called = false;
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.preview.subscribe(val => called = true);
|
documentList.preview.subscribe(val => called = true);
|
||||||
|
|
||||||
documentList.onNodeClick(file);
|
documentList.onNodeClick(file);
|
||||||
expect(called).toBeFalsy();
|
expect(called).toBeFalsy();
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(file);
|
documentList.onNodeDblClick(file);
|
||||||
expect(called).toBeFalsy();
|
expect(called).toBeFalsy();
|
||||||
});
|
});
|
||||||
@ -316,10 +317,10 @@ describe('DocumentList', () => {
|
|||||||
folder.entry = null;
|
folder.entry = null;
|
||||||
spyOn(documentList, 'performNavigation').and.stub();
|
spyOn(documentList, 'performNavigation').and.stub();
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeClick(folder);
|
documentList.onNodeClick(folder);
|
||||||
|
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.onNodeDblClick(folder);
|
documentList.onNodeDblClick(folder);
|
||||||
|
|
||||||
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
expect(documentList.performNavigation).not.toHaveBeenCalled();
|
||||||
@ -391,10 +392,10 @@ describe('DocumentList', () => {
|
|||||||
|
|
||||||
it('should enforce single-click on mobile browser', () => {
|
it('should enforce single-click on mobile browser', () => {
|
||||||
spyOn(documentList, 'isMobile').and.returnValue(true);
|
spyOn(documentList, 'isMobile').and.returnValue(true);
|
||||||
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||||
documentList.ngOnInit();
|
documentList.ngOnInit();
|
||||||
expect(documentList.isMobile).toHaveBeenCalled();
|
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) => {
|
it('should emit error on wrong folder id', (done) => {
|
@ -29,10 +29,10 @@ declare var module: any;
|
|||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
selector: 'alfresco-document-list',
|
selector: 'alfresco-document-list',
|
||||||
styleUrls: ['./document-list.css'],
|
styleUrls: ['./document-list.component.css'],
|
||||||
templateUrl: './document-list.html'
|
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 SINGLE_CLICK_NAVIGATION: string = 'click';
|
||||||
static DOUBLE_CLICK_NAVIGATION: string = 'dblclick';
|
static DOUBLE_CLICK_NAVIGATION: string = 'dblclick';
|
||||||
@ -47,7 +47,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
|||||||
navigate: boolean = true;
|
navigate: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
navigationMode: string = DocumentList.DOUBLE_CLICK_NAVIGATION; // click|dblclick
|
navigationMode: string = DocumentListComponent.DOUBLE_CLICK_NAVIGATION; // click|dblclick
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
thumbnails: boolean = false;
|
thumbnails: boolean = false;
|
||||||
@ -65,7 +65,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
|||||||
creationMenuActions: boolean = true;
|
creationMenuActions: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
pageSize: number = DocumentList.DEFAULT_PAGE_SIZE;
|
pageSize: number = DocumentListComponent.DEFAULT_PAGE_SIZE;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set rowFilter(value: RowFilter) {
|
set rowFilter(value: RowFilter) {
|
||||||
@ -156,7 +156,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
|||||||
|
|
||||||
// Automatically enforce single-click navigation for mobile browsers
|
// Automatically enforce single-click navigation for mobile browsers
|
||||||
if (this.isMobile()) {
|
if (this.isMobile()) {
|
||||||
this.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
this.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadFolder();
|
this.loadFolder();
|
||||||
@ -309,7 +309,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
|||||||
value: node
|
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 && node.entry) {
|
||||||
if (node.entry.isFile) {
|
if (node.entry.isFile) {
|
||||||
this.onPreviewFile(node);
|
this.onPreviewFile(node);
|
||||||
@ -332,7 +332,7 @@ export class DocumentList implements OnInit, OnChanges, AfterContentInit {
|
|||||||
value: node
|
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 && node.entry) {
|
||||||
if (node.entry.isFile) {
|
if (node.entry.isFile) {
|
||||||
this.onPreviewFile(node);
|
this.onPreviewFile(node);
|
@ -18,6 +18,7 @@
|
|||||||
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
|
||||||
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
import { AlfrescoTranslateService, LogService } from 'ng2-alfresco-core';
|
||||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||||
|
|
||||||
import { DocumentListService } from './../services/document-list.service';
|
import { DocumentListService } from './../services/document-list.service';
|
||||||
import { ContentActionModel } from './../models/content-action.model';
|
import { ContentActionModel } from './../models/content-action.model';
|
||||||
|
|
||||||
@ -28,10 +29,10 @@ const ERROR_FOLDER_ALREADY_EXIST = 409;
|
|||||||
@Component({
|
@Component({
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
selector: 'alfresco-document-menu-action',
|
selector: 'alfresco-document-menu-action',
|
||||||
styleUrls: ['./document-menu-action.css'],
|
styleUrls: ['./document-menu-action.component.css'],
|
||||||
templateUrl: './document-menu-action.html'
|
templateUrl: './document-menu-action.component.html'
|
||||||
})
|
})
|
||||||
export class DocumentMenuAction {
|
export class DocumentMenuActionComponent {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
folderId: string;
|
folderId: string;
|
@ -15,21 +15,22 @@
|
|||||||
* limitations under the License.
|
* 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 { 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', () => {
|
describe('EmptyFolderContent', () => {
|
||||||
|
|
||||||
let emptyFolderContent: EmptyFolderContent;
|
let emptyFolderContent: EmptyFolderContentComponent;
|
||||||
let documentList: DocumentList;
|
let documentList: DocumentListComponent;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
let documentListService = new DocumentListServiceMock();
|
let documentListService = new DocumentListServiceMock();
|
||||||
documentList = new DocumentList(documentListService, null, null);
|
documentList = new DocumentListComponent(documentListService, null, null);
|
||||||
documentList.dataTable = new DataTableComponent();
|
documentList.dataTable = new DataTableComponent();
|
||||||
emptyFolderContent = new EmptyFolderContent(documentList);
|
emptyFolderContent = new EmptyFolderContentComponent(documentList);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('is defined', () => {
|
it('is defined', () => {
|
@ -15,23 +15,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import { Directive, ContentChild, TemplateRef, AfterContentInit } from '@angular/core';
|
||||||
Directive,
|
import { DocumentListComponent } from './../document-list.component';
|
||||||
ContentChild,
|
|
||||||
TemplateRef,
|
|
||||||
AfterContentInit
|
|
||||||
} from '@angular/core';
|
|
||||||
import { DocumentList } from './document-list';
|
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'empty-folder-content'
|
selector: 'empty-folder-content'
|
||||||
})
|
})
|
||||||
export class EmptyFolderContent implements AfterContentInit {
|
export class EmptyFolderContentComponent implements AfterContentInit {
|
||||||
|
|
||||||
@ContentChild(TemplateRef)
|
@ContentChild(TemplateRef)
|
||||||
template: any;
|
template: any;
|
||||||
|
|
||||||
constructor(private documentList: DocumentList) {
|
constructor(private documentList: DocumentListComponent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
Loading…
x
Reference in New Issue
Block a user