diff --git a/ng2-components/ng2-alfresco-documentlist/README.md b/ng2-components/ng2-alfresco-documentlist/README.md
index 738bd97733..2aaf3da951 100644
--- a/ng2-components/ng2-alfresco-documentlist/README.md
+++ b/ng2-components/ng2-alfresco-documentlist/README.md
@@ -114,7 +114,6 @@ import { NgModule, Component, ViewChild } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { CoreModule } from 'ng2-alfresco-core';
-import { DataTableModule } from 'ng2-alfresco-datatable';
import { DocumentListModule, DocumentList } from 'ng2-alfresco-documentlist';
import { AlfrescoSettingsService, AlfrescoAuthenticationService } from 'ng2-alfresco-core';
@@ -133,7 +132,8 @@ class DocumentListDemo {
@ViewChild(DocumentList)
documentList: DocumentList;
- constructor(private authService: AlfrescoAuthenticationService, private settingsService: AlfrescoSettingsService) {
+ constructor(private authService: AlfrescoAuthenticationService,
+ private settingsService: AlfrescoSettingsService) {
settingsService.ecmHost = 'http://localhost:8080';
this.authService.login('admin', 'admin').subscribe(
@@ -151,7 +151,6 @@ class DocumentListDemo {
imports: [
BrowserModule,
CoreModule.forRoot(),
- DataTableModule,
DocumentListModule.forRoot()
],
declarations: [DocumentListDemo],
@@ -169,6 +168,7 @@ platformBrowserDynamic().bootstrapModule(AppModule);
| Name | Type | Default | Description |
| --- | --- | --- | --- |
+| `rootPath` | string | -root- | Root node path, i.e. `-root-`, `-shared-`, `-my-`, etc. |
| `navigate` | boolean | true | Toggles navigation to folder content or file preview |
| `navigationMode` | string (click\|dblclick) | dblclick | User interaction for folder navigation or file preview |
| `thumbnails` | boolean | false | Show document thumbnails rather than icons |
@@ -282,7 +282,7 @@ HTML attributes:
| `sr-title` | string | | Screen reader title, used only when `title` is empty |
| `key` | string | | Column source key, example: `createdByUser.displayName` |
| `sortable` | boolean | false | Toggle sorting ability via column header clicks |
-| `class`| string | | CSS class list, example: `full-width ellipsis-cell` |
+| `class` | string | | CSS class list, example: `full-width ellipsis-cell` |
| `type` | string | text | Column type, text\|date\|number |
| `format` | string | | Value format pattern |
@@ -414,24 +414,12 @@ into context menu items like shown below:
Enabling context menu is very simple:
```ts
-import {
- CONTEXT_MENU_DIRECTIVES,
- CONTEXT_MENU_PROVIDERS
-} from 'ng2-alfresco-core';
-
-import {
- DOCUMENT_LIST_DIRECTIVES,
- DOCUMENT_LIST_PROVIDERS
-} from 'ng2-alfresco-documentlist';
-
@Component({
selector: 'my-view',
template: `
...
- `,
- directives: [DOCUMENT_LIST_DIRECTIVES, CONTEXT_MENU_DIRECTIVES],
- providers: [DOCUMENT_LIST_PROVIDERS, CONTEXT_MENU_PROVIDERS]
+ `
})
export class MyView {
}
@@ -464,10 +452,10 @@ DocumentList emits the following events:
| Name | Description |
| --- | --- |
-| nodeClick | emitted when user clicks a list node |
-| nodeDblClick | emitted when user double-clicks list node |
-| folderChange | emitted once current display folder has changed |
-| preview | emitted when user acts upon files with either single or double click (depends on `navigation-mode`), recommended for Viewer components integration |
+| `nodeClick` | emitted when user clicks a list node |
+| `nodeDblClick` | emitted when user double-clicks list node |
+| `folderChange` | emitted once current display folder has changed |
+| `preview` | emitted when user acts upon files with either single or double click (depends on `navigation-mode`), recommended for Viewer components integration |
## Advanced usage and customization
@@ -691,9 +679,7 @@ You register custom handler called `my-handler` that will be executing `myDocume
function each time upon being invoked.
```ts
-import {
- DocumentActionsService
-} from 'ng2-alfresco-documentlist';
+import { DocumentActionsService } from 'ng2-alfresco-documentlist';
export class MyView {
@@ -745,7 +731,7 @@ npm run build
### Build the files and keep watching for changes
```sh
-$ npm run build:w
+npm run build:w
```
## Running unit tests
diff --git a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts
index a094e8b144..0a28fab336 100644
--- a/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts
+++ b/ng2-components/ng2-alfresco-documentlist/demo/src/main.ts
@@ -19,7 +19,6 @@ import { NgModule, Component, OnInit, ViewChild } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { CoreModule } from 'ng2-alfresco-core';
-import { DataTableModule } from 'ng2-alfresco-datatable';
import { DocumentListModule, DocumentList } from 'ng2-alfresco-documentlist';
import {
@@ -217,7 +216,6 @@ class DocumentListDemo implements OnInit {
imports: [
BrowserModule,
CoreModule.forRoot(),
- DataTableModule,
DocumentListModule.forRoot()
],
declarations: [ DocumentListDemo ],
diff --git a/ng2-components/ng2-alfresco-documentlist/index.ts b/ng2-components/ng2-alfresco-documentlist/index.ts
index c8c9affce8..5178390abc 100644
--- a/ng2-components/ng2-alfresco-documentlist/index.ts
+++ b/ng2-components/ng2-alfresco-documentlist/index.ts
@@ -80,6 +80,7 @@ export const DOCUMENT_LIST_PROVIDERS: any[] = [
...DOCUMENT_LIST_PROVIDERS
],
exports: [
+ DataTableModule,
...DOCUMENT_LIST_DIRECTIVES
]
})
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
index 14078e6be7..81f042cf2c 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.spec.ts
@@ -47,6 +47,14 @@ describe('DocumentList', () => {
window['componentHandler'] = componentHandler;
});
+ it('should update root path', () => {
+ let adapter = documentList.data;
+ expect(adapter.rootPath).toBe(adapter.DEFAULT_ROOT_PATH);
+
+ documentList.rootPath = '-shared-';
+ expect(adapter.rootPath).toBe('-shared-');
+ });
+
it('should setup default columns', () => {
spyOn(documentList, 'setupDefaultColumns').and.callThrough();
diff --git a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
index fb239ad44a..58b744497d 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/components/document-list.ts
@@ -56,6 +56,18 @@ export class DocumentList implements OnInit, AfterContentInit {
baseComponentPath = module.id.replace('/components/document-list.js', '');
+ @Input()
+ set rootPath(value: string) {
+ this.data.rootPath = value || this.data.DEFAULT_ROOT_PATH;
+ }
+
+ get rootPath(): string {
+ if (this.data) {
+ return this.data.rootPath;
+ }
+ return null;
+ }
+
@Input()
fallbackThubnail: string = this.baseComponentPath + '/img/ft_ic_miscellaneous.svg';
diff --git a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts
index f2c7a2078d..4937ffcf60 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/data/share-datatable-adapter.ts
@@ -31,6 +31,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
ERR_ROW_NOT_FOUND: string = 'Row not found';
ERR_COL_NOT_FOUND: string = 'Column not found';
+ DEFAULT_ROOT_PATH: string = '-root-';
DEFAULT_DATE_FORMAT: string = 'medium';
DEFAULT_PAGE_SIZE: number = 20;
MIN_PAGE_SIZE: number = 5;
@@ -52,6 +53,7 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
thumbnails: boolean = false;
dataLoaded: DataLoadedEventEmitter;
+ rootPath: string = this.DEFAULT_ROOT_PATH;
constructor(private documentListService: DocumentListService,
private basePath: string,
@@ -207,7 +209,8 @@ export class ShareDataTableAdapter implements DataTableAdapter, PaginationProvid
this.documentListService
.getFolder(path, {
maxItems: this._maxItems,
- skipCount: this._skipCount
+ skipCount: this._skipCount,
+ rootPath: this.rootPath
})
.subscribe(val => {
this.loadPage(val);
diff --git a/ng2-components/ng2-alfresco-documentlist/src/services/document-list.service.ts b/ng2-components/ng2-alfresco-documentlist/src/services/document-list.service.ts
index a821c4e4fa..632f597a19 100644
--- a/ng2-components/ng2-alfresco-documentlist/src/services/document-list.service.ts
+++ b/ng2-components/ng2-alfresco-documentlist/src/services/document-list.service.ts
@@ -63,7 +63,12 @@ export class DocumentListService {
}
private getNodesPromise(folder: string, opts?: any): Promise {
- let nodeId = '-root-';
+ let rootPath = '-root-';
+
+ if (opts && opts.rootPath) {
+ rootPath = opts.rootPath;
+ }
+
let params: any = {
relativePath: folder,
include: ['path', 'properties']
@@ -78,7 +83,7 @@ export class DocumentListService {
}
}
- return this.apiService.getInstance().nodes.getNodeChildren(nodeId, params);
+ return this.apiService.getInstance().nodes.getNodeChildren(rootPath, params);
}
deleteNode(nodeId: string): Observable {