diff --git a/demo-shell-ng2/app/components/files/files.component.ts b/demo-shell-ng2/app/components/files/files.component.ts index b707909b56..9990785764 100644 --- a/demo-shell-ng2/app/components/files/files.component.ts +++ b/demo-shell-ng2/app/components/files/files.component.ts @@ -64,6 +64,10 @@ import {MDL} from 'ng2-alfresco-core/material'; [navigate]="navigation" [downloads]="downloads" (itemClick)="onItemClick($event)"> + + + + @@ -92,6 +96,10 @@ export class FilesComponent { } myCustomAction1(event) { - alert('Custom action for ' + event.value.displayName); + alert('Custom document action for ' + event.value.displayName); + } + + myFolderAction1(event) { + alert('Custom folder action for ' + event.value.displayName); } } diff --git a/ng2-components/ng2-alfresco-documentlist/README.md b/ng2-components/ng2-alfresco-documentlist/README.md index 8d489aa048..4672f3fbd7 100644 --- a/ng2-components/ng2-alfresco-documentlist/README.md +++ b/ng2-components/ng2-alfresco-documentlist/README.md @@ -1,6 +1,4 @@ -# Alfresco Components for Angular 2 - -TODO: basic overview +# Document List Component for Angular 2 ## Build @@ -11,6 +9,17 @@ npm run build ## Basic usage +```html + + +``` + ```ts export class MyView { thumbnails: boolean = true; @@ -30,18 +39,13 @@ export class MyView { } ``` -```html - - -``` +### Actions -### Document actions +Document List supports declarative actions for Documents and Folders. +Each action can be bound to either default out-of-box handler or a custom behavior. +You can define both folder and document actions at the same time. + +#### Document actions ```html @@ -52,4 +56,33 @@ export class MyView { ``` -TODO: more details on declaring and using actions +```ts +export class MyView { + // ... + + myCustomAction1(event) { + alert('Custom document action for ' + event.value.displayName); + } +} +``` + +#### Folder actions + +```html + + + + + + +``` + +```ts +export class MyView { + // ... + + myFolderAction1(event) { + alert('Custom folder action for ' + event.value.displayName); + } +} +``` diff --git a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.d.ts b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.d.ts index ec988036d4..7f991b8e18 100644 --- a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.d.ts +++ b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.d.ts @@ -1,11 +1,15 @@ import { DocumentList } from './src/document-list.component'; -import { DocumentListActions } from './src/document-list-actions.component'; import { DocumentAction } from './src/document-action.component'; +import { DocumentActionList } from './src/document-action-list.component'; +import { FolderAction } from './src/folder-action.component'; +import { FolderActionList } from './src/folder-action-list.component'; export * from './src/document-list.component'; -export * from './src/document-list-actions.component'; export * from './src/document-action.component'; +export * from './src/document-action-list.component'; +export * from './src/folder-action-list.component'; +export * from './src/folder-action-list.component'; declare var _default: { - directives: (typeof DocumentList | typeof DocumentListActions | typeof DocumentAction)[]; + directives: (typeof DocumentList | typeof DocumentAction | typeof DocumentActionList | typeof FolderAction | typeof FolderActionList)[]; providers: undefined[]; }; export default _default; diff --git a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js index c8b9a0965a..c94b76b8a0 100644 --- a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js +++ b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js @@ -1,7 +1,7 @@ -System.register(['./src/document-list.component', './src/document-list-actions.component', './src/document-action.component'], function(exports_1, context_1) { +System.register(['./src/document-list.component', './src/document-action.component', './src/document-action-list.component', './src/folder-action.component', './src/folder-action-list.component'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; - var document_list_component_1, document_list_actions_component_1, document_action_component_1; + var document_list_component_1, document_action_component_1, document_action_list_component_1, folder_action_component_1, folder_action_list_component_1; var DOCUMENT_LIST_DIRECTIVES; var exportedNames_1 = { 'DOCUMENT_LIST_DIRECTIVES': true @@ -19,23 +19,33 @@ System.register(['./src/document-list.component', './src/document-list-actions.c document_list_component_1 = document_list_component_1_1; exportStar_1(document_list_component_1_1); }, - function (document_list_actions_component_1_1) { - document_list_actions_component_1 = document_list_actions_component_1_1; - exportStar_1(document_list_actions_component_1_1); - }, function (document_action_component_1_1) { document_action_component_1 = document_action_component_1_1; exportStar_1(document_action_component_1_1); + }, + function (document_action_list_component_1_1) { + document_action_list_component_1 = document_action_list_component_1_1; + exportStar_1(document_action_list_component_1_1); + }, + function (folder_action_component_1_1) { + folder_action_component_1 = folder_action_component_1_1; + }, + function (folder_action_list_component_1_1) { + folder_action_list_component_1 = folder_action_list_component_1_1; + exportStar_1(folder_action_list_component_1_1); + exportStar_1(folder_action_list_component_1_1); }], execute: function() { exports_1("default",{ - directives: [document_list_component_1.DocumentList, document_list_actions_component_1.DocumentListActions, document_action_component_1.DocumentAction], + directives: [document_list_component_1.DocumentList, document_action_component_1.DocumentAction, document_action_list_component_1.DocumentActionList, folder_action_component_1.FolderAction, folder_action_list_component_1.FolderActionList], providers: [] }); exports_1("DOCUMENT_LIST_DIRECTIVES", DOCUMENT_LIST_DIRECTIVES = [ document_list_component_1.DocumentList, - document_list_actions_component_1.DocumentListActions, - document_action_component_1.DocumentAction + document_action_component_1.DocumentAction, + document_action_list_component_1.DocumentActionList, + folder_action_component_1.FolderAction, + folder_action_list_component_1.FolderActionList ]); } } diff --git a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js.map b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js.map index 45169dfe3d..8a7285ce09 100644 --- a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js.map +++ b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.js.map @@ -1 +1 @@ -{"version":3,"file":"ng2-alfresco-documentlist.js","sourceRoot":"","sources":["ng2-alfresco-documentlist.ts"],"names":[],"mappings":";;;;QAaa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;YALrC,oBAAe;gBACX,UAAU,EAAE,CAAC,sCAAY,EAAE,qDAAmB,EAAE,0CAAc,CAAC;gBAC/D,SAAS,EAAE,EAAE;aAChB,EAAA;YAEY,sCAAA,wBAAwB,GAAU;gBAC3C,sCAAY;gBACZ,qDAAmB;gBACnB,0CAAc;aACjB,CAAA,CAAC"} \ No newline at end of file +{"version":3,"file":"ng2-alfresco-documentlist.js","sourceRoot":"","sources":["ng2-alfresco-documentlist.ts"],"names":[],"mappings":";;;;QAiBa,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YALrC,oBAAe;gBACX,UAAU,EAAE,CAAC,sCAAY,EAAE,0CAAc,EAAE,mDAAkB,EAAE,sCAAY,EAAE,+CAAgB,CAAC;gBAC9F,SAAS,EAAE,EAAE;aAChB,EAAA;YAEY,sCAAA,wBAAwB,GAAU;gBAC3C,sCAAY;gBACZ,0CAAc;gBACd,mDAAkB;gBAClB,sCAAY;gBACZ,+CAAgB;aACnB,CAAA,CAAC"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.ts b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.ts index 608b9d41cd..6ccbbc38db 100644 --- a/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.ts +++ b/ng2-components/ng2-alfresco-documentlist/ng2-alfresco-documentlist.ts @@ -1,18 +1,24 @@ import {DocumentList} from './src/document-list.component'; -import {DocumentListActions} from './src/document-list-actions.component'; import {DocumentAction} from './src/document-action.component'; +import {DocumentActionList} from './src/document-action-list.component'; +import {FolderAction} from './src/folder-action.component'; +import {FolderActionList} from './src/folder-action-list.component'; export * from './src/document-list.component'; -export * from './src/document-list-actions.component'; export * from './src/document-action.component'; +export * from './src/document-action-list.component'; +export * from './src/folder-action-list.component'; +export * from './src/folder-action-list.component'; export default { - directives: [DocumentList, DocumentListActions, DocumentAction], + directives: [DocumentList, DocumentAction, DocumentActionList, FolderAction, FolderActionList], providers: [] } export const DOCUMENT_LIST_DIRECTIVES: [any] = [ DocumentList, - DocumentListActions, - DocumentAction + DocumentAction, + DocumentActionList, + FolderAction, + FolderActionList ]; diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.d.ts b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.d.ts similarity index 84% rename from ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.d.ts rename to ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.d.ts index c3cd9f31b1..5e83032a22 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.d.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.d.ts @@ -1,6 +1,6 @@ import { DocumentList } from './document-list.component'; import { DocumentActionModel } from './models/document-action.model'; -export declare class DocumentListActions { +export declare class DocumentActionList { private list; constructor(list: DocumentList); registerAction(action: DocumentActionModel): void; diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js similarity index 83% rename from ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js rename to ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js index 33e20b3dcf..e5b160e749 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js @@ -27,7 +27,7 @@ System.register(['angular2/core', './document-list.component'], function(exports if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var core_1, document_list_component_1; - var DocumentListActions; + var DocumentActionList; return { setters:[ function (core_1_1) { @@ -37,26 +37,26 @@ System.register(['angular2/core', './document-list.component'], function(exports document_list_component_1 = document_list_component_1_1; }], execute: function() { - DocumentListActions = (function () { - function DocumentListActions(list) { + DocumentActionList = (function () { + function DocumentActionList(list) { this.list = list; // saves reference to parent container // so that content children can access it } - DocumentListActions.prototype.registerAction = function (action) { + DocumentActionList.prototype.registerAction = function (action) { this.list.registerDocumentAction(action); }; - DocumentListActions = __decorate([ + DocumentActionList = __decorate([ core_1.Component({ selector: 'document-actions', template: '' }), __metadata('design:paramtypes', [document_list_component_1.DocumentList]) - ], DocumentListActions); - return DocumentListActions; + ], DocumentActionList); + return DocumentActionList; }()); - exports_1("DocumentListActions", DocumentListActions); + exports_1("DocumentActionList", DocumentActionList); } } }); -//# sourceMappingURL=document-list-actions.component.js.map \ No newline at end of file +//# sourceMappingURL=document-action-list.component.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js.map new file mode 100644 index 0000000000..4feaaefab7 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"document-action-list.component.js","sourceRoot":"","sources":["document-action-list.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBACI,4BAAoB,IAAkB;oBAAlB,SAAI,GAAJ,IAAI,CAAc;oBAClC,sCAAsC;oBACtC,yCAAyC;gBAC7C,CAAC;gBAED,2CAAc,GAAd,UAAe,MAA2B;oBACtC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;gBAC7C,CAAC;gBAZL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,kBAAkB;wBAC5B,QAAQ,EAAE,EAAE;qBACf,CAAC;;sCAAA;gBAUF,yBAAC;YAAD,CAAC,AATD,IASC;YATD,mDASC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.ts b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.ts similarity index 96% rename from ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.ts rename to ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.ts index 42d9f63b84..2e2bc3df0b 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action-list.component.ts @@ -23,7 +23,7 @@ import {DocumentActionModel} from './models/document-action.model'; selector: 'document-actions', template: '' }) -export class DocumentListActions { +export class DocumentActionList { constructor(private list: DocumentList) { // saves reference to parent container // so that content children can access it diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.d.ts b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.d.ts index ccb0d33144..7910abf0b3 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.d.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.d.ts @@ -15,14 +15,14 @@ * limitations under the License. */ import { OnInit, EventEmitter } from 'angular2/core'; -import { DocumentListActions } from './document-list-actions.component'; +import { DocumentActionList } from './document-action-list.component'; export declare class DocumentAction implements OnInit { private list; title: string; handler: string; execute: EventEmitter<{}>; private defaultHandlers; - constructor(list: DocumentListActions); + constructor(list: DocumentActionList); ngOnInit(): void; handleStandardAction1(document: any): void; handleStandardAction2(document: any): void; diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js index a6e88c1a1e..d797d8fd52 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -System.register(['angular2/core', './models/document-action.model', './document-list-actions.component'], function(exports_1, context_1) { +System.register(['angular2/core', './models/document-action.model', './document-action-list.component'], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { @@ -26,7 +26,7 @@ System.register(['angular2/core', './models/document-action.model', './document- var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; - var core_1, document_action_model_1, document_list_actions_component_1; + var core_1, document_action_model_1, document_action_list_component_1; var DocumentAction; return { setters:[ @@ -36,8 +36,8 @@ System.register(['angular2/core', './models/document-action.model', './document- function (document_action_model_1_1) { document_action_model_1 = document_action_model_1_1; }, - function (document_list_actions_component_1_1) { - document_list_actions_component_1 = document_list_actions_component_1_1; + function (document_action_list_component_1_1) { + document_action_list_component_1 = document_action_list_component_1_1; }], execute: function() { DocumentAction = (function () { @@ -92,7 +92,7 @@ System.register(['angular2/core', './models/document-action.model', './document- selector: 'document-action', template: '' }), - __metadata('design:paramtypes', [document_list_actions_component_1.DocumentListActions]) + __metadata('design:paramtypes', [document_action_list_component_1.DocumentActionList]) ], DocumentAction); return DocumentAction; }()); diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js.map index e9834e2683..2361ac76c7 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js.map +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.js.map @@ -1 +1 @@ -{"version":3,"file":"document-action.component.js","sourceRoot":"","sources":["document-action.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBAOI,wBAAoB,IAAyB;oBAAzB,SAAI,GAAJ,IAAI,CAAqB;oBANpC,UAAK,GAAW,QAAQ,CAAC;oBAExB,YAAO,GAAG,IAAI,mBAAY,EAAE,CAAC;oBAE/B,oBAAe,GAA6C,EAAE,CAAC;oBAGnE,qEAAqE;oBACrE,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC;oBAC7D,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC;gBACjE,CAAC;gBAED,iCAAQ,GAAR;oBAAA,iBAkBC;oBAjBG,IAAI,KAAK,GAAG,IAAI,2CAAmB,EAAE,CAAC;oBACtC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;oBAEzB,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;wBACf,IAAI,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;wBACxD,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;4BACjB,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC;wBACnC,CAAC;oBACL,CAAC;oBAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;wBACtB,KAAK,CAAC,OAAO,GAAG,UAAC,QAAa;4BAC1B,KAAI,CAAC,OAAO,CAAC,IAAI,CAAC;gCACd,KAAK,EAAE,QAAQ;6BAClB,CAAC,CAAC;wBACP,CAAC,CAAC;oBACN,CAAC;oBAED,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBACpC,CAAC;gBAED,8CAAqB,GAArB,UAAsB,QAAa;oBAC/B,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACtC,CAAC;gBAED,8CAAqB,GAArB,UAAsB,QAAa;oBAC/B,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;gBACtC,CAAC;gBAtCD;oBAAC,YAAK,EAAE;;6DAAA;gBACR;oBAAC,YAAK,EAAE;;+DAAA;gBACR;oBAAC,aAAM,EAAE;;+DAAA;gBAPb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,iBAAiB;wBAC3B,QAAQ,EAAE,EAAE;qBACf,CAAC;;kCAAA;gBAyCF,qBAAC;YAAD,CAAC,AAxCD,IAwCC;YAxCD,2CAwCC,CAAA"} \ No newline at end of file +{"version":3,"file":"document-action.component.js","sourceRoot":"","sources":["document-action.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBAOI,wBAAoB,IAAwB;oBAAxB,SAAI,GAAJ,IAAI,CAAoB;oBANnC,UAAK,GAAW,QAAQ,CAAC;oBAExB,YAAO,GAAG,IAAI,mBAAY,EAAE,CAAC;oBAE/B,oBAAe,GAA6C,EAAE,CAAC;oBAGnE,qEAAqE;oBACrE,IAAI,CAAC,eAAe,CAAC,SAA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ACf,CAAC;;kCAAA;gBAyCF,qBAAC;YAAD,CAAC,AAxCD,IAwCC;YAxCD,2CAwCC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.ts b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.ts index 07a1e06a47..becb84f17a 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-action.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-action.component.ts @@ -17,7 +17,7 @@ import {Component, OnInit, Input, Output, EventEmitter} from 'angular2/core'; import {DocumentActionModel, DocumentActionHandler} from './models/document-action.model'; -import {DocumentListActions} from './document-list-actions.component'; +import {DocumentActionList} from './document-action-list.component'; @Component({ selector: 'document-action', @@ -30,7 +30,7 @@ export class DocumentAction implements OnInit { private defaultHandlers: { [id: string]: DocumentActionHandler; } = {}; - constructor(private list: DocumentListActions) { + constructor(private list: DocumentActionList) { // todo: just for dev/demo purposes, to be replaced with real actions this.defaultHandlers['system1'] = this.handleStandardAction1; this.defaultHandlers['system2'] = this.handleStandardAction2; diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js.map deleted file mode 100644 index 9383fe73d6..0000000000 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list-actions.component.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"document-list-actions.component.js","sourceRoot":"","sources":["document-list-actions.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBACI,6BAAoB,IAAkB;oBAAlB,SAAI,GAAJ,IAAI,CAAc;oBAClC,sCAAsC;oBACtC,yCAAyC;gBAC7C,CAAC;gBAED,4CAAc,GAAd,UAAe,MAA2B;oBACtC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;gBAC7C,CAAC;gBAZL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,kBAAkB;wBAC5B,QAAQ,EAAE,EAAE;qBACf,CAAC;;uCAAA;gBAUF,0BAAC;YAAD,CAAC,AATD,IASC;YATD,qDASC,CAAA"} \ No newline at end of file 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 8efcb7234f..c9f912bfbd 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 @@ -19,6 +19,7 @@ import { AlfrescoService } from './alfresco.service'; import { FolderEntity } from './core/entities/folder.entity'; import { DocumentEntity } from './core/entities/document.entity'; import { DocumentActionModel } from './models/document-action.model'; +import { FolderActionModel } from './models/folder-action.model'; export declare class DocumentList implements OnInit { private _alfrescoService; navigate: boolean; @@ -36,6 +37,7 @@ export declare class DocumentList implements OnInit { errorMessage: any; route: any[]; documentActions: DocumentActionModel[]; + folderActions: FolderActionModel[]; canNavigateParent(): boolean; constructor(_alfrescoService: AlfrescoService); ngOnInit(): void; @@ -45,7 +47,9 @@ export declare class DocumentList implements OnInit { getContentUrl(document: DocumentEntity): string; getDocumentThumbnailUrl(document: DocumentEntity): string; registerDocumentAction(action: DocumentActionModel): void; + registerFolderAction(action: FolderActionModel): void; executeDocumentAction(document: DocumentEntity, action: DocumentActionModel): void; + executeFolderAction(document: DocumentEntity, action: FolderActionModel): void; 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 c09f80d624..f695336c84 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.js @@ -37,6 +37,7 @@ System.register(['angular2/core', './alfresco.service'], function(exports_1, con this.currentFolderPath = 'swsdp/documentLibrary'; this.route = []; this.documentActions = []; + this.folderActions = []; } DocumentList.prototype.canNavigateParent = function () { return this.navigate && @@ -96,12 +97,21 @@ System.register(['angular2/core', './alfresco.service'], function(exports_1, con return this._alfrescoService.getDocumentThumbnailUrl(document); }; DocumentList.prototype.registerDocumentAction = function (action) { + // do additional registration actions here this.documentActions.push(action); }; + DocumentList.prototype.registerFolderAction = function (action) { + // do additional registration actions here + this.folderActions.push(action); + }; DocumentList.prototype.executeDocumentAction = function (document, action) { // todo: safety checks action.handler(document); }; + DocumentList.prototype.executeFolderAction = function (document, action) { + // todo: safety checks + action.handler(document); + }; DocumentList.prototype.getItemPath = function (item) { var container = item.location.container; var path = item.location.path !== '/' ? (item.location.path + '/') : '/'; @@ -145,7 +155,7 @@ System.register(['angular2/core', './alfresco.service'], function(exports_1, con 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 {\n font-size: 24px;\n line-height: 32px;\n }\n \n :host .document-header:hover {\n text-decoration: underline;\n }\n " ], - template: "\n \n \n {{r.name}}\n {{r.name}}\n \n \n \n \n ...\n \n \n \n \n \n Actions \n \n \n \n \n Download\n \n \n \n \n {{documentAction.title}}\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 \n {{r.name}}\n {{r.name}}\n \n \n \n \n ...\n \n \n \n \n \n \n Actions \n \n \n \n {{folderAction.title}}\n \n \n \n \n \n \n \n Actions \n \n \n \n \n Download\n \n \n \n \n {{documentAction.title}}\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 22a13987ac..280a301bac 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":";;;;;;;;;;;;;;;;;;;;;;;YAwGA;gBA2BI,sBACY,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBA1BpC,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;oBAIpD,UAAK,GAAU,EAAE,CAAC;oBAClB,oBAAe,GAA0B,EAAE,CAAC;gBAUzC,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;gBAED,4CAAqB,GAArB,UAAsB,MAAM;oBACxB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;wBACT,MAAM,CAAC,cAAc,EAAE,CAAC;oBAC5B,CAAC;oBAED,EAAE,CAA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GAAG,GAAG,YAAY,CAAC;gBACnD,CAAC;gBAEO,2CAAoB,GAA5B,UAA6B,IAAI;oBAAjC,iBAQC;oBAPG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;oBAC9B,IAAI,CAAC,gBAAgB;yBAChB,SAAS,CAAC,IAAI,CAAC;yBACf,SAAS,CACN,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,EAC9B,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,YAAY,GAAQ,KAAK,EAA9B,CAA8B,CAC1C,CAAC;gBACV,CAAC;gBAnHD;oBAAC,YAAK,EAAE;;8DAAA;gBACR;oBAAC,YAAK,EAAE;;gEAAA;gBACR;oBAAC,YAAK,CAAC,mBAAmB,CAAC;;qEAAA;gBAC3B;oBAAC,YAAK,EAAE;;gEAAA;gBACR;oBAAC,YAAK,EAAE;;+DAAA;gBAER;oBAAC,aAAM,EAAE;;+DAAA;gBA1Fb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,wBAAwB;wBAClC,MAAM,EAAE;4BACJ,uoBAyBC;yBACJ;wBACD,QAAQ,EAAE,2qFAiDT;wBACD,SAAS,EAAE,CAAC,kCAAe,CAAC;qBAC/B,CAAC;;gCAAA;gBAuHF,mBAAC;YAAD,CAAC,AAtHD,IAsHC;YAtHD,uCAsHC,CAAA"} \ No newline at end of file +{"version":3,"file":"document-list.component.js","sourceRoot":"","sources":["document-list.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;YAuHA;gBA4BI,sBACY,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBA3BpC,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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,CACN,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,EAC9B,UAAA,KAAK,IAAI,OAAA,KAAI,CAAC,YAAY,GAAQ,KAAK,EAA9B,CAA8B,CAC1C,CAAC;gBACV,CAAC;gBA/HD;oBAAC,YAAK,EAAE;;8DAAA;gBACR;oBAAC,YAAK,EAAE;;gEAAA;gBACR;oBAAC,YAAK,CAAC,mBAAmB,CAAC;;qEAAA;gBAC3B;oBAAC,YAAK,EAAE;;gEAAA;gBACR;oBAAC,YAAK,EAAE;;+DAAA;gBAER;oBAAC,aAAM,EAAE;;+DAAA;gBAxGb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,wBAAwB;wBAClC,MAAM,EAAE;4BACJ,uoBAyBC;yBACJ;wBACD,QAAQ,EAAE,u8GA+DT;wBACD,SAAS,EAAE,CAAC,kCAAe,CAAC;qBAC/B,CAAC;;gCAAA;gBAmIF,mBAAC;YAAD,CAAC,AAlID,IAkIC;YAlID,uCAkIC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts index 4d7c0f48a6..5b092798f6 100644 --- a/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts +++ b/ng2-components/ng2-alfresco-documentlist/src/document-list.component.ts @@ -19,6 +19,7 @@ import {AlfrescoService} from './alfresco.service'; import {FolderEntity} from './core/entities/folder.entity'; import {DocumentEntity} from './core/entities/document.entity'; import {DocumentActionModel} from './models/document-action.model'; +import {FolderActionModel} from './models/folder-action.model'; @Component({ selector: 'alfresco-document-list', @@ -63,6 +64,20 @@ import {DocumentActionModel} from './models/document-action.model'; + + + + Actions + + + + {{folderAction.title}} + + + + + @@ -122,6 +137,7 @@ export class DocumentList implements OnInit { route: any[] = []; documentActions: DocumentActionModel[] = []; + folderActions: FolderActionModel[] = []; canNavigateParent(): boolean { return this.navigate && @@ -196,14 +212,25 @@ export class DocumentList implements OnInit { } registerDocumentAction(action: DocumentActionModel) { + // do additional registration actions here this.documentActions.push(action); } + registerFolderAction(action: FolderActionModel) { + // do additional registration actions here + this.folderActions.push(action); + } + executeDocumentAction(document:DocumentEntity, action: DocumentActionModel) { // todo: safety checks action.handler(document); } + executeFolderAction(document:DocumentEntity, action: FolderActionModel) { + // todo: safety checks + action.handler(document); + } + private getItemPath(item: DocumentEntity):string { let container = item.location.container; let path = item.location.path !== '/' ? (item.location.path + '/' ) : '/'; diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.d.ts b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.d.ts new file mode 100644 index 0000000000..36859eac57 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.d.ts @@ -0,0 +1,7 @@ +import { DocumentList } from './document-list.component'; +import { FolderActionModel } from './models/folder-action.model'; +export declare class FolderActionList { + private list; + constructor(list: DocumentList); + registerAction(action: FolderActionModel): void; +} diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js new file mode 100644 index 0000000000..12c0991e92 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js @@ -0,0 +1,62 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +System.register(['angular2/core', './document-list.component'], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); + }; + var core_1, document_list_component_1; + var FolderActionList; + return { + setters:[ + function (core_1_1) { + core_1 = core_1_1; + }, + function (document_list_component_1_1) { + document_list_component_1 = document_list_component_1_1; + }], + execute: function() { + FolderActionList = (function () { + function FolderActionList(list) { + this.list = list; + // saves reference to parent container + // so that content children can access it + } + FolderActionList.prototype.registerAction = function (action) { + this.list.registerFolderAction(action); + }; + FolderActionList = __decorate([ + core_1.Component({ + selector: 'folder-actions', + template: '' + }), + __metadata('design:paramtypes', [document_list_component_1.DocumentList]) + ], FolderActionList); + return FolderActionList; + }()); + exports_1("FolderActionList", FolderActionList); + } + } +}); +//# sourceMappingURL=folder-action-list.component.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js.map new file mode 100644 index 0000000000..1b33245295 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"folder-action-list.component.js","sourceRoot":"","sources":["folder-action-list.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAUH;gBACI,0BAAoB,IAAkB;oBAAlB,SAAI,GAAJ,IAAI,CAAc;oBAClC,sCAAsC;oBACtC,yCAAyC;gBAC7C,CAAC;gBAED,yCAAc,GAAd,UAAe,MAAyB;oBACpC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;gBAC3C,CAAC;gBAZL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,gBAAgB;wBAC1B,QAAQ,EAAE,EAAE;qBACf,CAAC;;oCAAA;gBAUF,uBAAC;YAAD,CAAC,AATD,IASC;YATD,+CASC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.ts b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.ts new file mode 100644 index 0000000000..d783a59f46 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action-list.component.ts @@ -0,0 +1,35 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Component} from 'angular2/core'; +import {DocumentList} from './document-list.component'; +import {FolderActionModel} from './models/folder-action.model'; + +@Component({ + selector: 'folder-actions', + template: '' +}) +export class FolderActionList { + constructor(private list: DocumentList) { + // saves reference to parent container + // so that content children can access it + } + + registerAction(action: FolderActionModel) { + this.list.registerFolderAction(action); + } +} diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.d.ts b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.d.ts new file mode 100644 index 0000000000..891374223a --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.d.ts @@ -0,0 +1,29 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { OnInit, EventEmitter } from 'angular2/core'; +import { FolderActionList } from './folder-action-list.component'; +export declare class FolderAction implements OnInit { + private list; + title: string; + handler: string; + execute: EventEmitter<{}>; + private defaultHandlers; + constructor(list: FolderActionList); + ngOnInit(): void; + handleStandardAction1(document: any): void; + handleStandardAction2(document: any): void; +} diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js new file mode 100644 index 0000000000..b2500a7851 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js @@ -0,0 +1,103 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +System.register(['angular2/core', './models/folder-action.model', './folder-action-list.component'], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); + }; + var core_1, folder_action_model_1, folder_action_list_component_1; + var FolderAction; + return { + setters:[ + function (core_1_1) { + core_1 = core_1_1; + }, + function (folder_action_model_1_1) { + folder_action_model_1 = folder_action_model_1_1; + }, + function (folder_action_list_component_1_1) { + folder_action_list_component_1 = folder_action_list_component_1_1; + }], + execute: function() { + FolderAction = (function () { + function FolderAction(list) { + this.list = list; + this.title = 'Action'; + this.execute = new core_1.EventEmitter(); + this.defaultHandlers = {}; + // todo: just for dev/demo purposes, to be replaced with real actions + this.defaultHandlers['system1'] = this.handleStandardAction1; + this.defaultHandlers['system2'] = this.handleStandardAction2; + } + FolderAction.prototype.ngOnInit = function () { + var _this = this; + var model = new folder_action_model_1.FolderActionModel(); + model.title = this.title; + if (this.handler) { + var defaultHandler = this.defaultHandlers[this.handler]; + if (defaultHandler) { + model.handler = defaultHandler; + } + } + else if (this.execute) { + model.handler = function (document) { + _this.execute.emit({ + value: document + }); + }; + } + this.list.registerAction(model); + }; + FolderAction.prototype.handleStandardAction1 = function (document) { + window.alert('dummy folder action 1'); + }; + FolderAction.prototype.handleStandardAction2 = function (document) { + window.alert('dummy folder action 2'); + }; + __decorate([ + core_1.Input(), + __metadata('design:type', String) + ], FolderAction.prototype, "title", void 0); + __decorate([ + core_1.Input(), + __metadata('design:type', String) + ], FolderAction.prototype, "handler", void 0); + __decorate([ + core_1.Output(), + __metadata('design:type', Object) + ], FolderAction.prototype, "execute", void 0); + FolderAction = __decorate([ + core_1.Component({ + selector: 'folder-action', + template: '' + }), + __metadata('design:paramtypes', [folder_action_list_component_1.FolderActionList]) + ], FolderAction); + return FolderAction; + }()); + exports_1("FolderAction", FolderAction); + } + } +}); +//# sourceMappingURL=folder-action.component.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js.map b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js.map new file mode 100644 index 0000000000..638efc960c --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.js.map @@ -0,0 +1 @@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BAC/B,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBAC1C,CAAC;gBAED,4CAAqB,GAArB,UAAsB,QAAa;oBAC/B,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;gBAC1C,CAAC;gBAtCD;oBAAC,YAAK,EAAE;;2DAAA;gBACR;oBAAC,YAAK,EAAE;;6DAAA;gBACR;oBAAC,aAAM,EAAE;;6DAAA;gBAPb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,eAAe;wBACzB,QAAQ,EAAE,EAAE;qBACf,CAAC;;gCAAA;gBAyCF,mBAAC;YAAD,CAAC,AAxCD,IAwCC;YAxCD,uCAwCC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.ts b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.ts new file mode 100644 index 0000000000..26ebadce33 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/folder-action.component.ts @@ -0,0 +1,66 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Component, OnInit, Input, Output, EventEmitter} from 'angular2/core'; +import {FolderActionModel, FolderActionHandler} from './models/folder-action.model'; +import {FolderActionList} from './folder-action-list.component'; + +@Component({ + selector: 'folder-action', + template: '' +}) +export class FolderAction implements OnInit { + @Input() title: string = 'Action'; + @Input() handler: string; + @Output() execute = new EventEmitter(); + + private defaultHandlers: { [id: string]: FolderActionHandler; } = {}; + + constructor(private list: FolderActionList) { + // todo: just for dev/demo purposes, to be replaced with real actions + this.defaultHandlers['system1'] = this.handleStandardAction1; + this.defaultHandlers['system2'] = this.handleStandardAction2; + } + + ngOnInit() { + let model = new FolderActionModel(); + model.title = this.title; + + if (this.handler) { + let defaultHandler = this.defaultHandlers[this.handler]; + if (defaultHandler) { + model.handler = defaultHandler; + } + } else if (this.execute) { + model.handler = (document: any): void => { + this.execute.emit({ + value: document + }); + }; + } + + this.list.registerAction(model); + } + + handleStandardAction1(document: any) { + window.alert('dummy folder action 1'); + } + + handleStandardAction2(document: any) { + window.alert('dummy folder action 2'); + } +} diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.d.ts b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.d.ts new file mode 100644 index 0000000000..088f73c6d3 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.d.ts @@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export declare class FolderActionModel { + title: string; + handler: FolderActionHandler; +} +export interface FolderActionHandler { + (document: any): any; +} diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js new file mode 100644 index 0000000000..8f76624704 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js @@ -0,0 +1,33 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +System.register([], function(exports_1, context_1) { + "use strict"; + var __moduleName = context_1 && context_1.id; + var FolderActionModel; + return { + setters:[], + execute: function() { + FolderActionModel = (function () { + function FolderActionModel() { + } + return FolderActionModel; + }()); + exports_1("FolderActionModel", FolderActionModel); + } + } +}); +//# sourceMappingURL=folder-action.model.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js.map b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js.map new file mode 100644 index 0000000000..3472419694 --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"folder-action.model.js","sourceRoot":"","sources":["folder-action.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;YAEH;gBAAA;gBAGA,CAAC;gBAAD,wBAAC;YAAD,CAAC,AAHD,IAGC;YAHD,iDAGC,CAAA"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.ts b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.ts new file mode 100644 index 0000000000..8c8597d5bf --- /dev/null +++ b/ng2-components/ng2-alfresco-documentlist/src/models/folder-action.model.ts @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class FolderActionModel { + title: string; + handler: FolderActionHandler; +} + +export interface FolderActionHandler { + (document: any): any; +}
{{document.description}}