diff --git a/demo-shell-ng2/index.html b/demo-shell-ng2/index.html index 380361401f..439f1d9c2f 100644 --- a/demo-shell-ng2/index.html +++ b/demo-shell-ng2/index.html @@ -1,4 +1,4 @@ - + File Share - Angular 2 @@ -26,7 +26,8 @@ - + + diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.d.ts b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.d.ts index 14434416d1..3da98e87f6 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.d.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.d.ts @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { OnInit, EventEmitter } from "angular2/core"; -import { AlfrescoService } from "./alfresco.service"; -import { FolderEntity } from "./core/entities/folder.entity"; -import { DocumentEntity } from "./core/entities/document.entity"; +import { OnInit, EventEmitter } from 'angular2/core'; +import { AlfrescoService } from './alfresco.service'; +import { FolderEntity } from './core/entities/folder.entity'; +import { DocumentEntity } from './core/entities/document.entity'; export declare class DocumentList implements OnInit { private _alfrescoService; navigate: boolean; @@ -37,12 +37,11 @@ export declare class DocumentList implements OnInit { canNavigateParent(): boolean; constructor(_alfrescoService: AlfrescoService); ngOnInit(): void; - private displayFolderContent(path); onNavigateParentClick($event: any): void; - onDownloadClick(event: any): void; onItemClick(item: DocumentEntity, $event: any): void; goToRoute(r: any, $event: any): void; - private getItemPath(item); getContentUrl(document: DocumentEntity): string; getDocumentThumbnailUrl(document: DocumentEntity): string; + private getItemPath(item); + private displayFolderContent(path); } diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js index 64babec3fe..1622b635bc 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js @@ -1,4 +1,4 @@ -System.register(["angular2/core", "./alfresco.service"], function(exports_1, context_1) { +System.register(['angular2/core', './alfresco.service'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -24,15 +24,10 @@ System.register(["angular2/core", "./alfresco.service"], function(exports_1, con DocumentList = (function () { function DocumentList(_alfrescoService) { this._alfrescoService = _alfrescoService; - // example: this.navigate = true; - // example: this.breadcrumb = false; - // example: this.folderIconClass = 'fa fa-folder-o fa-4x'; - // example: this.thumbnails = true; - // example: this.downloads = true; this.itemClick = new core_1.EventEmitter(); this.rootFolder = { @@ -51,28 +46,18 @@ System.register(["angular2/core", "./alfresco.service"], function(exports_1, con this.route.push(this.rootFolder); this.displayFolderContent(this.rootFolder.path); }; - DocumentList.prototype.displayFolderContent = function (path) { - var _this = this; - this.currentFolderPath = path; - this._alfrescoService - .getFolder(path) - .subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; }); - }; DocumentList.prototype.onNavigateParentClick = function ($event) { if ($event) { $event.preventDefault(); } if (this.navigate) { this.route.pop(); - var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; - if (parent) { - this.displayFolderContent(parent.path); + var parent_1 = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; + if (parent_1) { + this.displayFolderContent(parent_1.path); } } }; - DocumentList.prototype.onDownloadClick = function (event) { - event.stopPropagation(); - }; DocumentList.prototype.onItemClick = function (item, $event) { if ($event) { $event.preventDefault(); @@ -103,17 +88,24 @@ System.register(["angular2/core", "./alfresco.service"], function(exports_1, con } } }; + DocumentList.prototype.getContentUrl = function (document) { + return this._alfrescoService.getContentUrl(document); + }; + DocumentList.prototype.getDocumentThumbnailUrl = function (document) { + return this._alfrescoService.getDocumentThumbnailUrl(document); + }; DocumentList.prototype.getItemPath = function (item) { var container = item.location.container; var path = item.location.path !== '/' ? (item.location.path + '/') : '/'; var relativePath = container + path + item.fileName; return item.location.site + '/' + relativePath; }; - DocumentList.prototype.getContentUrl = function (document) { - return this._alfrescoService.getContentUrl(document); - }; - DocumentList.prototype.getDocumentThumbnailUrl = function (document) { - return this._alfrescoService.getDocumentThumbnailUrl(document); + DocumentList.prototype.displayFolderContent = function (path) { + var _this = this; + this.currentFolderPath = path; + this._alfrescoService + .getFolder(path) + .subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; }); }; __decorate([ core_1.Input(), @@ -143,9 +135,9 @@ System.register(["angular2/core", "./alfresco.service"], function(exports_1, con core_1.Component({ selector: 'alfresco-document-list', styles: [ - "\n :host .breadcrumb {\n margin-bottom: 4px;\n }\n\n :host .folder-icon {\n float: left;\n margin-right: 10px;\n }\n\n :host .file-icon {\n width: 52px;\n height: 52px;\n float: left;\n margin-right: 10px;\n }\n\n :host .document-header:hover {\n text-decoration: underline;\n }\n\n :host .download-button {\n color: #777;\n text-decoration: none;\n }\n\n :host .download-button:hover {\n color: #555;\n }\n " + "\n :host .breadcrumb {\n margin-bottom: 4px;\n }\n\n :host .folder-icon {\n float: left;\n margin-right: 10px;\n }\n\n :host .file-icon {\n width: 52px;\n height: 52px;\n float: left;\n margin-right: 10px;\n }\n \n :host .document-header {\n font-size: 24px;\n line-height: 32px;\n }\n \n :host .document-header:hover {\n text-decoration: underline;\n }\n " ], - template: "\n
    \n
  1. \n {{r.name}}\n {{r.name}}\n
  2. \n
\n
\n \n ...\n \n \n \n \n \n \n \n

\n {{document.displayName}}\n

\n

{{document.description}}

\n \n Modified {{document.modifiedOn}} by {{document.modifiedBy}}\n \n \n
\n ", + template: "\n
    \n
  1. \n {{r.name}}\n {{r.name}}\n
  2. \n
\n
\n \n ...\n \n \n \n
\n \n \n
\n \n \n \n \"\"\n\n

\n {{document.displayName}}\n

\n

{{document.description}}

\n \n Modified {{document.modifiedOn}} by {{document.modifiedBy}}\n \n \n
\n ", providers: [alfresco_service_1.AlfrescoService] }), __metadata('design:paramtypes', [alfresco_service_1.AlfrescoService]) diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js.map index bf8853052f..71dd785409 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js.map +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js.map @@ -1 +1 @@ -{"version":3,"file":"document-list.component.js","sourceRoot":"","sources":["document-list.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAoFA;gBA+BI,sBACY,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBA9B7C,gFAAgF;oBACvE,aAAQ,GAAY,IAAI,CAAC;oBAClC,iFAAiF;oBACxE,eAAU,GAAY,KAAK,CAAC;oBACrC,oGAAoG;oBACxE,oBAAe,GAAW,sBAAsB,CAAC;oBAC7E,wFAAwF;oBAC/E,eAAU,GAAY,IAAI,CAAC;oBACpC,uFAAuF;oBAC9E,cAAS,GAAY,IAAI,CAAC;oBAEzB,cAAS,GAAsB,IAAI,mBAAY,EAAE,CAAC;oBAE5D,eAAU,GAAG;wBACT,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,uBAAuB;qBAChC,CAAC;oBACF,sBAAiB,GAAW,uBAAuB,CAAC;oBAIpD,UAAK,GAAU,EAAE,CAAC;gBAUf,CAAC;gBARJ,wCAAiB,GAAjB;oBACI,MAAM,CAAC,IAAI,CAAC,QAAQ;wBAChB,CAAC,IAAI,CAAC,UAAU;wBAChB,IAAI,CAAC,iBAAiB,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACxD,CAAC;gBAMD,+BAAQ,GAAR;oBACI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACjC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACpD,CAAC;gBAEO,2CAAoB,GAA5B,UAA6B,IAAI;oBAAjC,iBAQC;oBAPG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;oBAC9B,IAAI,CAAC,gB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;gBAED,oCAAa,GAAb,UAAc,QAAwB;oBAClC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACzD,CAAC;gBAED,8CAAuB,GAAvB,UAAwB,QAAyB;oBAC7C,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;gBACnE,CAAC;gBAjHD;oBAAC,YAAK,EAAE;;8DAAA;gBAER;oBAAC,YAAK,EAAE;;gEAAA;gBAER;oBAAC,YAAK,CAAC,mBAAmB,CAAC;;qEAAA;gBAE3B;oBAAC,YAAK,EAAE;;gEAAA;gBAER;oBAAC,YAAK,EAAE;;+DAAA;gBAER;oBAAC,aAAM,EAAE;;+DAAA;gBA5Eb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,wBAAwB;wBAClC,MAAM,EAAE;4BACJ,0sBA6BC;yBACJ;wBACD,QAAQ,EAAE,4nDA0BT;wBACD,SAAS,EAAE,CAAC,kCAAe,CAAC;qBAC/B,CAAC;;gCAAA;gBAsHF,mBAAC;YAAD,CAAC,AArHD,IAqHC;YArHD,uCAqHC,CAAA"} \ No newline at end of file +{"version":3,"file":"document-list.component.js","sourceRoot":"","sources":["document-list.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAyGA;gBA0BI,sBACY,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBAzBpC,aAAQ,GAAY,IAAI,CAAC;oBACzB,eAAU,GAAY,KAAK,CAAC;oBACT,oBAAe,GAAW,sBAAsB,CAAC;oBACpE,eAAU,GAAY,IAAI,CAAC;oBAC3B,cAAS,GAAY,IAAI,CAAC;oBAEzB,cAAS,GAAsB,IAAI,mBAAY,EAAE,CAAC;oBAE5D,eAAU,GAAG;wBACT,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,uBAAuB;qBAChC,CAAC;oBACF,sBAAiB,GAAW,uBAAuB,CAAC;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/ng2-alfresco-documentlist/src/document-list.component.ts index 5db086b9fd..6d192da563 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import {Component, OnInit, Input, Output, EventEmitter} from "angular2/core"; -import {AlfrescoService} from "./alfresco.service"; -import {FolderEntity} from "./core/entities/folder.entity"; -import {DocumentEntity} from "./core/entities/document.entity"; +import {Component, OnInit, Input, Output, EventEmitter} from 'angular2/core'; +import {AlfrescoService} from './alfresco.service'; +import {FolderEntity} from './core/entities/folder.entity'; +import {DocumentEntity} from './core/entities/document.entity'; @Component({ selector: 'alfresco-document-list', @@ -38,19 +38,15 @@ import {DocumentEntity} from "./core/entities/document.entity"; float: left; margin-right: 10px; } - + + :host .document-header { + font-size: 24px; + line-height: 32px; + } + :host .document-header:hover { text-decoration: underline; } - - :host .download-button { - color: #777; - text-decoration: none; - } - - :host .download-button:hover { - color: #555; - } ` ], template: ` @@ -64,15 +60,40 @@ import {DocumentEntity} from "./core/entities/document.entity"; ... - - - - - - -

+ + +
+ + +
+ + + + +

{{document.displayName}} -

+

{{document.description}}

Modified {{document.modifiedOn}} by {{document.modifiedBy}} @@ -84,15 +105,10 @@ import {DocumentEntity} from "./core/entities/document.entity"; }) export class DocumentList implements OnInit { - // example: @Input() navigate: boolean = true; - // example: @Input() breadcrumb: boolean = false; - // example: @Input('folder-icon-class') folderIconClass: string = 'fa fa-folder-o fa-4x'; - // example: @Input() thumbnails: boolean = true; - // example: @Input() downloads: boolean = true; @Output() itemClick: EventEmitter = new EventEmitter(); @@ -122,16 +138,6 @@ export class DocumentList implements OnInit { this.displayFolderContent(this.rootFolder.path); } - private displayFolderContent(path) { - this.currentFolderPath = path; - this._alfrescoService - .getFolder(path) - .subscribe( - folder => this.folder = folder, - error => this.errorMessage = error - ); - } - onNavigateParentClick($event) { if ($event) { $event.preventDefault(); @@ -139,17 +145,13 @@ export class DocumentList implements OnInit { if (this.navigate) { this.route.pop(); - var parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; + let parent = this.route.length > 0 ? this.route[this.route.length - 1] : this.rootFolder; if (parent) { this.displayFolderContent(parent.path); } } } - onDownloadClick(event) { - event.stopPropagation(); - } - onItemClick(item: DocumentEntity, $event) { if ($event) { $event.preventDefault(); @@ -161,7 +163,7 @@ export class DocumentList implements OnInit { if (this.navigate && item) { if (item.isFolder) { - var path = this.getItemPath(item); + let path = this.getItemPath(item); this.route.push({ name: item.displayName, path: path @@ -177,7 +179,7 @@ export class DocumentList implements OnInit { } if (this.navigate) { - var idx = this.route.indexOf(r); + let idx = this.route.indexOf(r); if (idx > -1) { this.route.splice(idx + 1); this.displayFolderContent(r.path); @@ -185,13 +187,6 @@ export class DocumentList implements OnInit { } } - private getItemPath(item: DocumentEntity):string { - var container = item.location.container; - var path = item.location.path !== '/' ? (item.location.path + '/' ) : '/'; - var relativePath = container + path + item.fileName; - return item.location.site + '/' + relativePath; - } - getContentUrl(document: DocumentEntity) { return this._alfrescoService.getContentUrl(document); } @@ -199,4 +194,21 @@ export class DocumentList implements OnInit { getDocumentThumbnailUrl(document: DocumentEntity) { return this._alfrescoService.getDocumentThumbnailUrl(document); } + + private getItemPath(item: DocumentEntity):string { + let container = item.location.container; + let path = item.location.path !== '/' ? (item.location.path + '/' ) : '/'; + let relativePath = container + path + item.fileName; + return item.location.site + '/' + relativePath; + } + + private displayFolderContent(path) { + this.currentFolderPath = path; + this._alfrescoService + .getFolder(path) + .subscribe( + folder => this.folder = folder, + error => this.errorMessage = error + ); + } }