mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#46 upload component
This commit is contained in:
@@ -21,9 +21,9 @@ import {MDL} from 'ng2-alfresco-core/material';
|
|||||||
import {FilesComponent} from './components/files/files.component';
|
import {FilesComponent} from './components/files/files.component';
|
||||||
import {AlfrescoLoginComponent} from 'ng2-alfresco-login/ng2-alfresco-login';
|
import {AlfrescoLoginComponent} from 'ng2-alfresco-login/ng2-alfresco-login';
|
||||||
import {AuthRouterOutlet} from './components/router/AuthRouterOutlet';
|
import {AuthRouterOutlet} from './components/router/AuthRouterOutlet';
|
||||||
import {UploaderComponent} from './components/uploader/uploader.component';
|
|
||||||
import {AlfrescoSettingsService} from 'ng2-alfresco-core/services';
|
import {AlfrescoSettingsService} from 'ng2-alfresco-core/services';
|
||||||
import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate';
|
import {TranslateService, TranslatePipe} from 'ng2-translate/ng2-translate';
|
||||||
|
import {UploadComponent} from 'ng2-alfresco-upload/ng2-alfresco-upload';
|
||||||
|
|
||||||
declare var document: any;
|
declare var document: any;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ declare var document: any;
|
|||||||
@RouteConfig([
|
@RouteConfig([
|
||||||
{path: '/home', name: 'Home', component: FilesComponent},
|
{path: '/home', name: 'Home', component: FilesComponent},
|
||||||
{path: '/', name: 'Files', component: FilesComponent, useAsDefault: true},
|
{path: '/', name: 'Files', component: FilesComponent, useAsDefault: true},
|
||||||
{path: '/uploader', name: 'Uploader', component: UploaderComponent},
|
{path: '/uploader', name: 'Uploader', component: UploadComponent},
|
||||||
{path: '/login', name: 'Login', component: AlfrescoLoginComponent}
|
{path: '/login', name: 'Login', component: AlfrescoLoginComponent}
|
||||||
])
|
])
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
@@ -1,111 +0,0 @@
|
|||||||
/**
|
|
||||||
* @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, NgZone} from 'angular2/core';
|
|
||||||
import {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader';
|
|
||||||
import {AlfrescoSettingsService} from 'ng2-alfresco-core/services';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'alfresco-uploader',
|
|
||||||
styles: [
|
|
||||||
`
|
|
||||||
:host .dropzone {
|
|
||||||
width: 100%;
|
|
||||||
height: 100px;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
margin-top: 2px;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
],
|
|
||||||
template: `
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<h2>Upload File</h2>
|
|
||||||
<input type="file"
|
|
||||||
[ng-file-select]="options"
|
|
||||||
(onUpload)="handleUpload($event)">
|
|
||||||
<div>
|
|
||||||
Response: {{ uploadFile | json }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<h2>Drag and Drop file demo</h2>
|
|
||||||
<div class="col-md-4 col-md-offset-3">
|
|
||||||
<div [ng-file-drop]="options" (onUpload)="handleDropUpload($event)" class="dropzone">
|
|
||||||
Drop file here...
|
|
||||||
</div>
|
|
||||||
<div class="progress">
|
|
||||||
<div class="progress-bar" [style.width]="dropProgress + '%'"></div>
|
|
||||||
<span class="percent">{{ dropProgress }}%</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
directives: [UPLOAD_DIRECTIVES]
|
|
||||||
})
|
|
||||||
export class UploaderComponent {
|
|
||||||
uploadFile:any;
|
|
||||||
options:Object;
|
|
||||||
|
|
||||||
zone:NgZone;
|
|
||||||
dropProgress:number = 0;
|
|
||||||
dropResp:any[] = [];
|
|
||||||
|
|
||||||
constructor(settings:AlfrescoSettingsService) {
|
|
||||||
this.options = {
|
|
||||||
url: settings.host + '/alfresco/service/api/upload',
|
|
||||||
withCredentials: true,
|
|
||||||
authToken: btoa('admin:admin'),
|
|
||||||
authTokenPrefix: 'Basic',
|
|
||||||
fieldName: 'filedata',
|
|
||||||
formFields: {
|
|
||||||
siteid: 'swsdp',
|
|
||||||
containerid: 'documentLibrary'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.zone = new NgZone({enableLongStackTrace: false});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleUpload(data):void {
|
|
||||||
if (data && data.response) {
|
|
||||||
data = JSON.parse(data.response);
|
|
||||||
this.uploadFile = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleDropUpload(data):void {
|
|
||||||
let index = this.dropResp.findIndex(x => x.id === data.id);
|
|
||||||
if (index === -1) {
|
|
||||||
this.dropResp.push(data);
|
|
||||||
} else {
|
|
||||||
this.zone.run(() => {
|
|
||||||
this.dropResp[index] = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let total = 0, uploaded = 0;
|
|
||||||
this.dropResp.forEach(resp => {
|
|
||||||
total += resp.progress.total;
|
|
||||||
uploaded += resp.progress.loaded;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.dropProgress = Math.floor(uploaded / (total / 100));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
.p-10 {
|
.p-10 {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
0
demo-shell-ng2/app/fonts/material-icons.woff2
Normal file
0
demo-shell-ng2/app/fonts/material-icons.woff2
Normal file
@@ -13,4 +13,4 @@
|
|||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
@@ -38,6 +38,7 @@
|
|||||||
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core',
|
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core',
|
||||||
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist',
|
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist',
|
||||||
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login',
|
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login',
|
||||||
|
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload',
|
||||||
'ng2-translate': 'node_modules/ng2-translate',
|
'ng2-translate': 'node_modules/ng2-translate',
|
||||||
'rxjs': 'node_modules/rxjs'
|
'rxjs': 'node_modules/rxjs'
|
||||||
},
|
},
|
||||||
@@ -58,6 +59,9 @@
|
|||||||
'ng2-alfresco-login': {
|
'ng2-alfresco-login': {
|
||||||
defaultExtension: 'js'
|
defaultExtension: 'js'
|
||||||
},
|
},
|
||||||
|
'ng2-alfresco-upload': {
|
||||||
|
defaultExtension: 'js'
|
||||||
|
},
|
||||||
'ng2-translate': {
|
'ng2-translate': {
|
||||||
defaultExtension: 'js'
|
defaultExtension: 'js'
|
||||||
},
|
},
|
||||||
|
@@ -48,7 +48,6 @@
|
|||||||
"material-design-icons": "^2.2.3",
|
"material-design-icons": "^2.2.3",
|
||||||
"material-design-lite": "^1.1.3",
|
"material-design-lite": "^1.1.3",
|
||||||
"ng2-translate": "^1.11.2",
|
"ng2-translate": "^1.11.2",
|
||||||
"ng2-uploader": "denisvuyka/ng2-uploader",
|
|
||||||
"reflect-metadata": "0.1.2",
|
"reflect-metadata": "0.1.2",
|
||||||
"rxjs": "5.0.0-beta.2",
|
"rxjs": "5.0.0-beta.2",
|
||||||
"systemjs": "0.19.26",
|
"systemjs": "0.19.26",
|
||||||
|
@@ -1,19 +1,3 @@
|
|||||||
/**
|
|
||||||
* @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'], function(exports_1, context_1) {
|
System.register(['angular2/core'], function(exports_1, context_1) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var __moduleName = context_1 && context_1.id;
|
var __moduleName = context_1 && context_1.id;
|
||||||
@@ -48,10 +32,6 @@ System.register(['angular2/core'], function(exports_1, context_1) {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
AlfrescoSettingsService.prototype.getAuthToken = function () {
|
|
||||||
// todo: get proper token value
|
|
||||||
return 'Basic ' + btoa('admin:admin');
|
|
||||||
};
|
|
||||||
AlfrescoSettingsService = __decorate([
|
AlfrescoSettingsService = __decorate([
|
||||||
core_1.Injectable(),
|
core_1.Injectable(),
|
||||||
__metadata('design:paramtypes', [])
|
__metadata('design:paramtypes', [])
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"AlfrescoSettingsService.js","sourceRoot":"","sources":["AlfrescoSettingsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAKH;gBAAA;oBACY,UAAK,GAAW,uBAAuB,CAAC;gBAcpD,CAAC;gBAZG,sBAAW,yCAAI;yBAAf;wBACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,CAAC;yBAED,UAAgB,KAAY;wBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACvB,CAAC;;;mBAJA;gBAMD,8CAAY,GAAZ;oBACI,+BAA+B;oBAC/B,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC1C,CAAC;gBAfL;oBAAC,iBAAU,EAAE;;2CAAA;gBAgBb,8BAAC;YAAD,CAAC,AAfD,IAeC;YAfD,6DAeC,CAAA"}
|
{"version":3,"file":"AlfrescoSettingsService.js","sourceRoot":"","sources":["AlfrescoSettingsService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;YAmBA;gBAAA;oBACY,UAAK,GAAW,uBAAuB,CAAC;gBASpD,CAAC;gBAPG,sBAAW,yCAAI;yBAAf;wBACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACtB,CAAC;yBAED,UAAgB,KAAY;wBACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACvB,CAAC;;;mBAJA;gBANL;oBAAC,iBAAU,EAAE;;2CAAA;gBAWb,8BAAC;YAAD,CAAC,AAVD,IAUC;YAVD,6DAUC,CAAA"}
|
@@ -1,7 +1,7 @@
|
|||||||
System.register(['./src/components/document-list', './src/components/content-column', './src/components/content-column-list', './src/components/content-action', './src/components/content-action-list', './src/services/folder-actions.service', './src/services/document-actions.service', './src/services/alfresco.service'], function(exports_1, context_1) {
|
System.register(['./src/components/document-list', './src/components/document-action', './src/components/document-action-list', './src/components/quick-document-action', './src/components/quick-document-action-list', './src/components/folder-action', './src/components/folder-action-list', './src/components/quick-folder-action', './src/components/quick-folder-action-list', './src/services/folder-actions.service', './src/services/document-actions.service'], function(exports_1, context_1) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var __moduleName = context_1 && context_1.id;
|
var __moduleName = context_1 && context_1.id;
|
||||||
var document_list_1, content_column_1, content_column_list_1, content_action_1, content_action_list_1, folder_actions_service_1, document_actions_service_1, alfresco_service_1;
|
var document_list_1, document_action_1, document_action_list_1, quick_document_action_1, quick_document_action_list_1, folder_action_1, folder_action_list_1, quick_folder_action_1, quick_folder_action_list_1, folder_actions_service_1, document_actions_service_1;
|
||||||
var DOCUMENT_LIST_DIRECTIVES, DOCUMENT_LIST_PROVIDERS;
|
var DOCUMENT_LIST_DIRECTIVES, DOCUMENT_LIST_PROVIDERS;
|
||||||
var exportedNames_1 = {
|
var exportedNames_1 = {
|
||||||
'DOCUMENT_LIST_DIRECTIVES': true,
|
'DOCUMENT_LIST_DIRECTIVES': true,
|
||||||
@@ -20,21 +20,37 @@ System.register(['./src/components/document-list', './src/components/content-col
|
|||||||
document_list_1 = document_list_1_1;
|
document_list_1 = document_list_1_1;
|
||||||
exportStar_1(document_list_1_1);
|
exportStar_1(document_list_1_1);
|
||||||
},
|
},
|
||||||
function (content_column_1_1) {
|
function (document_action_1_1) {
|
||||||
content_column_1 = content_column_1_1;
|
document_action_1 = document_action_1_1;
|
||||||
exportStar_1(content_column_1_1);
|
exportStar_1(document_action_1_1);
|
||||||
},
|
},
|
||||||
function (content_column_list_1_1) {
|
function (document_action_list_1_1) {
|
||||||
content_column_list_1 = content_column_list_1_1;
|
document_action_list_1 = document_action_list_1_1;
|
||||||
exportStar_1(content_column_list_1_1);
|
exportStar_1(document_action_list_1_1);
|
||||||
},
|
},
|
||||||
function (content_action_1_1) {
|
function (quick_document_action_1_1) {
|
||||||
content_action_1 = content_action_1_1;
|
quick_document_action_1 = quick_document_action_1_1;
|
||||||
exportStar_1(content_action_1_1);
|
exportStar_1(quick_document_action_1_1);
|
||||||
},
|
},
|
||||||
function (content_action_list_1_1) {
|
function (quick_document_action_list_1_1) {
|
||||||
content_action_list_1 = content_action_list_1_1;
|
quick_document_action_list_1 = quick_document_action_list_1_1;
|
||||||
exportStar_1(content_action_list_1_1);
|
exportStar_1(quick_document_action_list_1_1);
|
||||||
|
},
|
||||||
|
function (folder_action_1_1) {
|
||||||
|
folder_action_1 = folder_action_1_1;
|
||||||
|
exportStar_1(folder_action_1_1);
|
||||||
|
},
|
||||||
|
function (folder_action_list_1_1) {
|
||||||
|
folder_action_list_1 = folder_action_list_1_1;
|
||||||
|
exportStar_1(folder_action_list_1_1);
|
||||||
|
},
|
||||||
|
function (quick_folder_action_1_1) {
|
||||||
|
quick_folder_action_1 = quick_folder_action_1_1;
|
||||||
|
exportStar_1(quick_folder_action_1_1);
|
||||||
|
},
|
||||||
|
function (quick_folder_action_list_1_1) {
|
||||||
|
quick_folder_action_list_1 = quick_folder_action_list_1_1;
|
||||||
|
exportStar_1(quick_folder_action_list_1_1);
|
||||||
},
|
},
|
||||||
function (folder_actions_service_1_1) {
|
function (folder_actions_service_1_1) {
|
||||||
folder_actions_service_1 = folder_actions_service_1_1;
|
folder_actions_service_1 = folder_actions_service_1_1;
|
||||||
@@ -43,35 +59,37 @@ System.register(['./src/components/document-list', './src/components/content-col
|
|||||||
function (document_actions_service_1_1) {
|
function (document_actions_service_1_1) {
|
||||||
document_actions_service_1 = document_actions_service_1_1;
|
document_actions_service_1 = document_actions_service_1_1;
|
||||||
exportStar_1(document_actions_service_1_1);
|
exportStar_1(document_actions_service_1_1);
|
||||||
},
|
|
||||||
function (alfresco_service_1_1) {
|
|
||||||
alfresco_service_1 = alfresco_service_1_1;
|
|
||||||
exportStar_1(alfresco_service_1_1);
|
|
||||||
}],
|
}],
|
||||||
execute: function() {
|
execute: function() {
|
||||||
exports_1("default",{
|
exports_1("default",{
|
||||||
directives: [
|
directives: [
|
||||||
document_list_1.DocumentList,
|
document_list_1.DocumentList,
|
||||||
content_column_1.ContentColumn,
|
document_action_1.DocumentAction,
|
||||||
content_column_list_1.ContentColumnList,
|
document_action_list_1.DocumentActionList,
|
||||||
content_action_1.ContentAction,
|
quick_document_action_1.QuickDocumentAction,
|
||||||
content_action_list_1.ContentActionList
|
quick_document_action_list_1.QuickDocumentActionList,
|
||||||
|
folder_action_1.FolderAction,
|
||||||
|
folder_action_list_1.FolderActionList,
|
||||||
|
quick_folder_action_1.QuickFolderAction,
|
||||||
|
quick_folder_action_list_1.QuickFolderActionList
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
alfresco_service_1.AlfrescoService,
|
|
||||||
folder_actions_service_1.FolderActionsService,
|
folder_actions_service_1.FolderActionsService,
|
||||||
document_actions_service_1.DocumentActionsService
|
document_actions_service_1.DocumentActionsService
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
exports_1("DOCUMENT_LIST_DIRECTIVES", DOCUMENT_LIST_DIRECTIVES = [
|
exports_1("DOCUMENT_LIST_DIRECTIVES", DOCUMENT_LIST_DIRECTIVES = [
|
||||||
document_list_1.DocumentList,
|
document_list_1.DocumentList,
|
||||||
content_column_1.ContentColumn,
|
document_action_1.DocumentAction,
|
||||||
content_column_list_1.ContentColumnList,
|
document_action_list_1.DocumentActionList,
|
||||||
content_action_1.ContentAction,
|
quick_document_action_1.QuickDocumentAction,
|
||||||
content_action_list_1.ContentActionList
|
quick_document_action_list_1.QuickDocumentActionList,
|
||||||
|
folder_action_1.FolderAction,
|
||||||
|
folder_action_list_1.FolderActionList,
|
||||||
|
quick_folder_action_1.QuickFolderAction,
|
||||||
|
quick_folder_action_list_1.QuickFolderActionList
|
||||||
]);
|
]);
|
||||||
exports_1("DOCUMENT_LIST_PROVIDERS", DOCUMENT_LIST_PROVIDERS = [
|
exports_1("DOCUMENT_LIST_PROVIDERS", DOCUMENT_LIST_PROVIDERS = [
|
||||||
alfresco_service_1.AlfrescoService,
|
|
||||||
folder_actions_service_1.FolderActionsService,
|
folder_actions_service_1.FolderActionsService,
|
||||||
document_actions_service_1.DocumentActionsService
|
document_actions_service_1.DocumentActionsService
|
||||||
]);
|
]);
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"ng2-alfresco-documentlist.js","sourceRoot":"","sources":["ng2-alfresco-documentlist.ts"],"names":[],"mappings":";;;;QAqCa,wBAAwB,EAQxB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAvBpC,oBAAe;gBACX,UAAU,EAAE;oBACR,4BAAY;oBACZ,8BAAa;oBACb,uCAAiB;oBACjB,8BAAa;oBACb,uCAAiB;iBACpB;gBACD,SAAS,EAAE;oBACP,kCAAe;oBACf,6CAAoB;oBACpB,iDAAsB;iBACzB;aACJ,EAAA;YAEY,sCAAA,wBAAwB,GAAU;gBAC3C,4BAAY;gBACZ,8BAAa;gBACb,uCAAiB;gBACjB,8BAAa;gBACb,uCAAiB;aACpB,CAAA,CAAC;YAEW,qCAAA,uBAAuB,GAAU;gBAC1C,kCAAe;gBACf,6CAAoB;gBACpB,iDAAsB;aACzB,CAAA,CAAC"}
|
{"version":3,"file":"ng2-alfresco-documentlist.js","sourceRoot":"","sources":["ng2-alfresco-documentlist.ts"],"names":[],"mappings":";;;;QA4Ca,wBAAwB,EAYxB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA9BpC,oBAAe;gBACX,UAAU,EAAE;oBACR,4BAAY;oBACZ,gCAAc;oBACd,yCAAkB;oBAClB,2CAAmB;oBACnB,oDAAuB;oBACvB,4BAAY;oBACZ,qCAAgB;oBAChB,uCAAiB;oBACjB,gDAAqB;iBACxB;gBACD,SAAS,EAAE;oBACP,6CAAoB;oBACpB,iDAAsB;iBACzB;aACJ,EAAA;YAEY,sCAAA,wBAAwB,GAAU;gBAC3C,4BAAY;gBACZ,gCAAc;gBACd,yCAAkB;gBAClB,2CAAmB;gBACnB,oDAAuB;gBACvB,4BAAY;gBACZ,qCAAgB;gBAChB,uCAAiB;gBACjB,gDAAqB;aACxB,CAAA,CAAC;YAEW,qCAAA,uBAAuB,GAAU;gBAC1C,6CAAoB;gBACpB,iDAAsB;aACzB,CAAA,CAAC"}
|
@@ -1,20 +1,4 @@
|
|||||||
/**
|
System.register(['angular2/core', './../services/alfresco.service'], function(exports_1, context_1) {
|
||||||
* @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', './../services/alfresco.service', './../models/content-column.model'], function(exports_1, context_1) {
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var __moduleName = context_1 && context_1.id;
|
var __moduleName = context_1 && context_1.id;
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
@@ -26,7 +10,7 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
};
|
};
|
||||||
var core_1, alfresco_service_1, content_column_model_1;
|
var core_1, alfresco_service_1;
|
||||||
var DocumentList;
|
var DocumentList;
|
||||||
return {
|
return {
|
||||||
setters:[
|
setters:[
|
||||||
@@ -35,9 +19,6 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
},
|
},
|
||||||
function (alfresco_service_1_1) {
|
function (alfresco_service_1_1) {
|
||||||
alfresco_service_1 = alfresco_service_1_1;
|
alfresco_service_1 = alfresco_service_1_1;
|
||||||
},
|
|
||||||
function (content_column_model_1_1) {
|
|
||||||
content_column_model_1 = content_column_model_1_1;
|
|
||||||
}],
|
}],
|
||||||
execute: function() {
|
execute: function() {
|
||||||
DocumentList = (function () {
|
DocumentList = (function () {
|
||||||
@@ -45,6 +26,8 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
this._alfrescoService = _alfrescoService;
|
this._alfrescoService = _alfrescoService;
|
||||||
this.navigate = true;
|
this.navigate = true;
|
||||||
this.breadcrumb = false;
|
this.breadcrumb = false;
|
||||||
|
this.thumbnails = true;
|
||||||
|
this.downloads = true;
|
||||||
this.itemClick = new core_1.EventEmitter();
|
this.itemClick = new core_1.EventEmitter();
|
||||||
this.rootFolder = {
|
this.rootFolder = {
|
||||||
name: 'Document Library',
|
name: 'Document Library',
|
||||||
@@ -52,8 +35,10 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
};
|
};
|
||||||
this.currentFolderPath = 'swsdp/documentLibrary';
|
this.currentFolderPath = 'swsdp/documentLibrary';
|
||||||
this.route = [];
|
this.route = [];
|
||||||
this.actions = [];
|
this.documentActions = [];
|
||||||
this.columns = [];
|
this.quickDocumentActions = [];
|
||||||
|
this.folderActions = [];
|
||||||
|
this.quickFolderActions = [];
|
||||||
}
|
}
|
||||||
DocumentList.prototype.canNavigateParent = function () {
|
DocumentList.prototype.canNavigateParent = function () {
|
||||||
return this.navigate &&
|
return this.navigate &&
|
||||||
@@ -64,28 +49,6 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
this.route.push(this.rootFolder);
|
this.route.push(this.rootFolder);
|
||||||
this.displayFolderContent(this.rootFolder.path);
|
this.displayFolderContent(this.rootFolder.path);
|
||||||
};
|
};
|
||||||
DocumentList.prototype.ngAfterContentInit = function () {
|
|
||||||
if (!this.columns || this.columns.length === 0) {
|
|
||||||
this.setupDefaultColumns();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DocumentList.prototype.ngAfterViewChecked = function () {
|
|
||||||
// workaround for MDL issues with dynamic components
|
|
||||||
if (componentHandler) {
|
|
||||||
componentHandler.upgradeAllRegistered();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DocumentList.prototype.getContentActions = function (target, type) {
|
|
||||||
if (target && type) {
|
|
||||||
var ltarget_1 = target.toLowerCase();
|
|
||||||
var ltype_1 = type.toLowerCase();
|
|
||||||
return this.actions.filter(function (entry) {
|
|
||||||
return entry.target.toLowerCase() === ltarget_1 &&
|
|
||||||
entry.type.toLowerCase() === ltype_1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
};
|
|
||||||
DocumentList.prototype.onNavigateParentClick = function ($event) {
|
DocumentList.prototype.onNavigateParentClick = function ($event) {
|
||||||
if ($event) {
|
if ($event) {
|
||||||
$event.preventDefault();
|
$event.preventDefault();
|
||||||
@@ -134,6 +97,11 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
DocumentList.prototype.getDocumentThumbnailUrl = function (document) {
|
DocumentList.prototype.getDocumentThumbnailUrl = function (document) {
|
||||||
return this._alfrescoService.getDocumentThumbnailUrl(document);
|
return this._alfrescoService.getDocumentThumbnailUrl(document);
|
||||||
};
|
};
|
||||||
|
DocumentList.prototype.registerDocumentAction = function (action) {
|
||||||
|
if (action) {
|
||||||
|
this.documentActions.push(action);
|
||||||
|
}
|
||||||
|
};
|
||||||
DocumentList.prototype.executeContentAction = function (document, action) {
|
DocumentList.prototype.executeContentAction = function (document, action) {
|
||||||
// todo: safety checks
|
// todo: safety checks
|
||||||
action.handler(document);
|
action.handler(document);
|
||||||
@@ -151,18 +119,6 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
.getFolder(path)
|
.getFolder(path)
|
||||||
.subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; });
|
.subscribe(function (folder) { return _this.folder = folder; }, function (error) { return _this.errorMessage = error; });
|
||||||
};
|
};
|
||||||
DocumentList.prototype.setupDefaultColumns = function () {
|
|
||||||
var thumbnailCol = new content_column_model_1.ContentColumnModel();
|
|
||||||
thumbnailCol.source = '$thumbnail';
|
|
||||||
var nameCol = new content_column_model_1.ContentColumnModel();
|
|
||||||
nameCol.title = 'Name';
|
|
||||||
nameCol.source = 'displayName';
|
|
||||||
nameCol.cssClass = 'full-width name-column';
|
|
||||||
this.columns = [
|
|
||||||
thumbnailCol,
|
|
||||||
nameCol
|
|
||||||
];
|
|
||||||
};
|
|
||||||
__decorate([
|
__decorate([
|
||||||
core_1.Input(),
|
core_1.Input(),
|
||||||
__metadata('design:type', Boolean)
|
__metadata('design:type', Boolean)
|
||||||
@@ -174,17 +130,26 @@ System.register(['angular2/core', './../services/alfresco.service', './../models
|
|||||||
__decorate([
|
__decorate([
|
||||||
core_1.Input('folder-icon'),
|
core_1.Input('folder-icon'),
|
||||||
__metadata('design:type', String)
|
__metadata('design:type', String)
|
||||||
], DocumentList.prototype, "folderIcon", void 0);
|
], DocumentList.prototype, "folderIconClass", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', Boolean)
|
||||||
|
], DocumentList.prototype, "thumbnails", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', Boolean)
|
||||||
|
], DocumentList.prototype, "downloads", void 0);
|
||||||
__decorate([
|
__decorate([
|
||||||
core_1.Output(),
|
core_1.Output(),
|
||||||
__metadata('design:type', core_1.EventEmitter)
|
__metadata('design:type', core_1.EventEmitter)
|
||||||
], DocumentList.prototype, "itemClick", void 0);
|
], DocumentList.prototype, "itemClick", void 0);
|
||||||
DocumentList = __decorate([
|
DocumentList = __decorate([
|
||||||
core_1.Component({
|
core_1.Component({
|
||||||
moduleId: __moduleName,
|
|
||||||
selector: 'alfresco-document-list',
|
selector: 'alfresco-document-list',
|
||||||
styleUrls: ['./document-list.css'],
|
styles: [
|
||||||
templateUrl: './document-list.html',
|
"\n :host .breadcrumb {\n margin-bottom: 4px;\n }\n\n :host .folder-icon {\n float: left;\n margin-right: 10px;\n font-size: 4em;\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 <ol *ngIf=\"breadcrumb\" class=\"breadcrumb\">\n <li *ngFor=\"#r of route; #last = last\" [class.active]=\"last\" [ngSwitch]=\"last\">\n <span *ngSwitchWhen=\"true\">{{r.name}}</span>\n <a *ngSwitchDefault href=\"#\" (click)=\"goToRoute(r, $event)\">{{r.name}}</a>\n </li>\n </ol>\n <div *ngIf=\"folder\" class=\"list-group\">\n <a href=\"#\" *ngIf=\"canNavigateParent()\" (click)=\"onNavigateParentClick($event)\" class=\"list-group-item\">\n <span class=\"glyphicon glyphicon-level-up\"></span> ...\n </a>\n <a href=\"#\" *ngFor=\"#document of folder.items\" class=\"list-group-item clearfix\">\n \n <!-- folder actions -->\n <div *ngIf=\"document.isFolder && folderActions.length > 0\" class=\"btn-group pull-right\">\n <button type=\"button\" class=\"btn btn-default\"\n *ngFor=\"#qfa of quickFolderActions\" (click)=\"executeContentAction(document, qfa)\">\n <span *ngIf=\"qfa.icon\" class=\"{{qfa.icon}}\"></span>\n <span *ngIf=\"qfa.title\">{{qfa.title}}</span>\n </button>\n <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" \n aria-haspopup=\"true\" aria-expanded=\"false\">\n Actions <span class=\"caret\"></span>\n </button>\n <ul class=\"dropdown-menu\">\n <li *ngFor=\"#folderAction of folderActions\">\n <a href=\"#\" (click)=\"executeContentAction(document, folderAction)\">{{folderAction.title}}</a>\n </li>\n </ul>\n </div>\n \n <!-- document actions -->\n <div *ngIf=\"!document.isFolder\" class=\"btn-group pull-right\">\n <button type=\"button\" class=\"btn btn-default\"\n *ngFor=\"#qda of quickDocumentActions\" (click)=\"executeContentAction(document, qda)\">\n <span *ngIf=\"qda.icon\" class=\"{{qda.icon}}\"></span>\n <span *ngIf=\"qda.title\">{{qda.title}}</span>\n </button>\n <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" \n aria-haspopup=\"true\" aria-expanded=\"false\">\n Actions <span class=\"caret\"></span>\n </button>\n <ul class=\"dropdown-menu\">\n <li>\n <a *ngIf=\"downloads && !document.isFolder\" \n href=\"{{getContentUrl(document)}}\" \n download target=\"_blank\">\n Download\n </a>\n </li>\n <li *ngIf=\"documentActions.length > 0\" role=\"separator\" class=\"divider\"></li>\n <li *ngFor=\"#documentAction of documentActions\">\n <a href=\"#\" (click)=\"executeContentAction(document, documentAction)\">{{documentAction.title}}</a>\n </li>\n </ul>\n </div>\n \n <i *ngIf=\"thumbnails && document.isFolder\" class=\"folder-icon {{folderIconClass || 'glyphicon glyphicon-folder-close'}}\"\n (click)=\"onItemClick(document, $event)\">\n </i>\n <img *ngIf=\"thumbnails && !document.isFolder\" class=\"file-icon\"\n alt=\"\"\n src=\"{{getDocumentThumbnailUrl(document)}}\"\n (click)=\"onItemClick(document, $event)\">\n <h1 class=\"list-group-item-heading document-header\" (click)=\"onItemClick(document, $event)\" >\n {{document.displayName}}\n </h1>\n <p class=\"list-group-item-text\">{{document.description}}</p>\n <small>\n Modified {{document.modifiedOn}} by {{document.modifiedBy}}\n </small>\n </a>\n </div>\n ",
|
||||||
providers: [alfresco_service_1.AlfrescoService]
|
providers: [alfresco_service_1.AlfrescoService]
|
||||||
}),
|
}),
|
||||||
__metadata('design:paramtypes', [alfresco_service_1.AlfrescoService])
|
__metadata('design:paramtypes', [alfresco_service_1.AlfrescoService])
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"document-list.js","sourceRoot":"","sources":["document-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BH;gBA2BI,sBACY,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBA1BpC,aAAQ,GAAY,IAAI,CAAC;oBACzB,eAAU,GAAY,KAAK,CAAC;oBAG3B,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;oBAElB,YAAO,GAAyB,EAAE,CAAC;oBACnC,YAAO,GAAyB,EAAE,CAAC;gBAUhC,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,yCAAkB,GAAlB;oBACI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;wBAC7C,IAAI,CAAC,mBAAmB,EAAE,CAAC;oBAC/B,CAAC;gBACL,CAAC;gBAED,yCAAkB,GAAlB;oBACI,oDAAoD;oBACpD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,EAAE,wBAAwB;wBAClC,MAAM,EAAE;4BACJ,wqBA0BC;yBACJ;wBACD,QAAQ,EAAE,0yIAyET;wBACD,SAAS,EAAE,CAAC,kCAAe,CAAC;qBAC/B,CAAC;;gCAAA;gBA6HF,mBAAC;YAAD,CAAC,AA5HD,IA4HC;YA5HD,uCA4HC,CAAA"}
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"content-action.model.js","sourceRoot":"","sources":["content-action.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;YAEH;gBAAA;gBAMA,CAAC;gBAAD,yBAAC;YAAD,CAAC,AAND,IAMC;YAND,mDAMC,CAAA"}
|
{"version":3,"file":"content-action.model.js","sourceRoot":"","sources":["content-action.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;YAEH;gBAAA;gBAIA,CAAC;gBAAD,yBAAC;YAAD,CAAC,AAJD,IAIC;YAJD,mDAIC,CAAA"}
|
@@ -67,7 +67,7 @@ System.register(['angular2/core', 'angular2/http', 'rxjs/Observable', '../../../
|
|||||||
AlfrescoService.prototype.getFolder = function (folder) {
|
AlfrescoService.prototype.getFolder = function (folder) {
|
||||||
var headers = new http_1.Headers({
|
var headers = new http_1.Headers({
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': this.settings.getAuthToken()
|
'Authorization': 'Basic ' + btoa('admin:admin')
|
||||||
});
|
});
|
||||||
var options = new http_1.RequestOptions({ headers: headers });
|
var options = new http_1.RequestOptions({ headers: headers });
|
||||||
return this.http
|
return this.http
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"alfresco.service.js","sourceRoot":"","sources":["alfresco.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YASH;gBACI,yBACY,IAAU,EACV,QAAiC;oBADjC,SAAI,GAAJ,IAAI,CAAM;oBACV,aA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
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
System.register(['angular2/core', './alfresco.service'], function(exports_1, context_1) {
|
System.register(['angular2/core'], function(exports_1, context_1) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var __moduleName = context_1 && context_1.id;
|
var __moduleName = context_1 && context_1.id;
|
||||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
@@ -26,61 +26,33 @@ System.register(['angular2/core', './alfresco.service'], function(exports_1, con
|
|||||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
};
|
};
|
||||||
var core_1, alfresco_service_1;
|
var core_1;
|
||||||
var DocumentActionsService;
|
var DocumentActionsService;
|
||||||
return {
|
return {
|
||||||
setters:[
|
setters:[
|
||||||
function (core_1_1) {
|
function (core_1_1) {
|
||||||
core_1 = core_1_1;
|
core_1 = core_1_1;
|
||||||
},
|
|
||||||
function (alfresco_service_1_1) {
|
|
||||||
alfresco_service_1 = alfresco_service_1_1;
|
|
||||||
}],
|
}],
|
||||||
execute: function() {
|
execute: function() {
|
||||||
DocumentActionsService = (function () {
|
DocumentActionsService = (function () {
|
||||||
function DocumentActionsService(_alfrescoService) {
|
function DocumentActionsService() {
|
||||||
this._alfrescoService = _alfrescoService;
|
|
||||||
this.handlers = {};
|
this.handlers = {};
|
||||||
this.setupActionHandlers();
|
// todo: just for dev/demo purposes, to be replaced with real actions
|
||||||
|
this.handlers['system1'] = this.handleStandardAction1;
|
||||||
|
this.handlers['system2'] = this.handleStandardAction2;
|
||||||
}
|
}
|
||||||
DocumentActionsService.prototype.getHandler = function (key) {
|
DocumentActionsService.prototype.getHandler = function (key) {
|
||||||
if (key) {
|
return this.handlers[key];
|
||||||
var lkey = key.toLowerCase();
|
|
||||||
return this.handlers[lkey];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
DocumentActionsService.prototype.setHandler = function (key, handler) {
|
DocumentActionsService.prototype.handleStandardAction1 = function (document) {
|
||||||
if (key) {
|
|
||||||
var lkey = key.toLowerCase();
|
|
||||||
this.handlers[lkey] = handler;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DocumentActionsService.prototype.setupActionHandlers = function () {
|
|
||||||
this.handlers['download'] = this.download.bind(this);
|
|
||||||
// todo: just for dev/demo purposes, to be replaced with real actions
|
|
||||||
this.handlers['system1'] = this.handleStandardAction1.bind(this);
|
|
||||||
this.handlers['system2'] = this.handleStandardAction2.bind(this);
|
|
||||||
};
|
|
||||||
DocumentActionsService.prototype.handleStandardAction1 = function (obj) {
|
|
||||||
window.alert('standard document action 1');
|
window.alert('standard document action 1');
|
||||||
};
|
};
|
||||||
DocumentActionsService.prototype.handleStandardAction2 = function (obj) {
|
DocumentActionsService.prototype.handleStandardAction2 = function (document) {
|
||||||
window.alert('standard document action 2');
|
window.alert('standard document action 2');
|
||||||
};
|
};
|
||||||
DocumentActionsService.prototype.download = function (obj) {
|
|
||||||
if (obj && !obj.isFolder) {
|
|
||||||
var link = document.createElement('a');
|
|
||||||
document.body.appendChild(link);
|
|
||||||
link.setAttribute('download', 'download');
|
|
||||||
link.href = this._alfrescoService.getContentUrl(obj);
|
|
||||||
link.click();
|
|
||||||
document.body.removeChild(link);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
DocumentActionsService = __decorate([
|
DocumentActionsService = __decorate([
|
||||||
core_1.Injectable(),
|
core_1.Injectable(),
|
||||||
__metadata('design:paramtypes', [alfresco_service_1.AlfrescoService])
|
__metadata('design:paramtypes', [])
|
||||||
], DocumentActionsService);
|
], DocumentActionsService);
|
||||||
return DocumentActionsService;
|
return DocumentActionsService;
|
||||||
}());
|
}());
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"document-actions.service.js","sourceRoot":"","sources":["document-actions.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAOH;gBAGI,gCAAoB,gBAAiC;oBAAjC,qBAAgB,GAAhB,gBAAgB,CAAiB;oBAF7C,aAAQ,GAA4C,EAAE,CAAC;oBAG3D,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAC/B,CAAC;gBAED,2CAAU,GAAV,UAAW,GAAW;oBAClB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;wBACN,IAAI,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;wBAC7B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC/B,CAAC;oBACD,MAAM,CAAC,IAAI,CAAC;gBAChB,CAAC;gBAED,2CAAU,GAAV,UAAW,GAAW,EAAE,OAA6B;oBACjD,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;wBACN,IAAI,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;wBAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;oBAClC,CAAC;gBACL,CAAC;gBAEO,oDAAmB,GAA3B;oBACI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAErD,qEAAqE;oBACrE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrE,CAAC;gBAEO,sDAAqB,GAA7B,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,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC;gBAEO,sDAAqB,GAA7B,UAA8B,QAAa;oBACvC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBAC/C,CAAC;gBAEO,sDAAqB,GAA7B,UAA8B,QAAa;oBACvC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;gBAC/C,CAAC;gBApBL;oBAAC,iBAAU,EAAE;;0CAAA;gBAqBb,6BAAC;YAAD,CAAC,AApBD,IAoBC;YApBD,2DAoBC,CAAA"}
|
@@ -38,21 +38,11 @@ System.register(['angular2/core'], function(exports_1, context_1) {
|
|||||||
function FolderActionsService() {
|
function FolderActionsService() {
|
||||||
this.handlers = {};
|
this.handlers = {};
|
||||||
// todo: just for dev/demo purposes, to be replaced with real actions
|
// todo: just for dev/demo purposes, to be replaced with real actions
|
||||||
this.handlers['system1'] = this.handleStandardAction1.bind(this);
|
this.handlers['system1'] = this.handleStandardAction1;
|
||||||
this.handlers['system2'] = this.handleStandardAction2.bind(this);
|
this.handlers['system2'] = this.handleStandardAction2;
|
||||||
}
|
}
|
||||||
FolderActionsService.prototype.getHandler = function (key) {
|
FolderActionsService.prototype.getHandler = function (key) {
|
||||||
if (key) {
|
return this.handlers[key];
|
||||||
var lkey = key.toLowerCase();
|
|
||||||
return this.handlers[lkey];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
FolderActionsService.prototype.setHandler = function (key, handler) {
|
|
||||||
if (key) {
|
|
||||||
var lkey = key.toLowerCase();
|
|
||||||
this.handlers[lkey] = handler;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
FolderActionsService.prototype.handleStandardAction1 = function (document) {
|
FolderActionsService.prototype.handleStandardAction1 = function (document) {
|
||||||
window.alert('standard folder action 1');
|
window.alert('standard folder action 1');
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"folder-actions.service.js","sourceRoot":"","sources":["folder-actions.service.ts"],"names":[],"mapp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;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAMH;gBAGI;oBAFQ,aAAQ,GAA4C,EAAE,CAAC;oBAG3D,qEAAqE;oBACrE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC;oBACtD,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,qBAAqB,CAAC;gBAC1D,CAAC;gBAED,yCAAU,GAAV,UAAW,GAAW;oBAClB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC;gBAEO,oDAAqB,GAA7B,UAA8B,QAAa;oBACvC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;gBAC7C,CAAC;gBAEO,oDAAqB,GAA7B,UAA8B,QAAa;oBACvC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;gBAC7C,CAAC;gBApBL;oBAAC,iBAAU,EAAE;;wCAAA;gBAqBb,2BAAC;YAAD,CAAC,AApBD,IAoBC;YApBD,uDAoBC,CAAA"}
|
@@ -1,7 +1,7 @@
|
|||||||
System.register(['./src/components/alfresco-login', './src/services/alfresco-authentication'], function(exports_1, context_1) {
|
System.register(['./src/alfresco-login.component', './src/alfresco-authentication.service'], function(exports_1, context_1) {
|
||||||
"use strict";
|
"use strict";
|
||||||
var __moduleName = context_1 && context_1.id;
|
var __moduleName = context_1 && context_1.id;
|
||||||
var alfresco_login_1, alfresco_authentication_1;
|
var alfresco_login_component_1, alfresco_authentication_service_1;
|
||||||
var ALFRESCO_LOGIN_DIRECTIVES, ALFRESCO_AUTHENTICATION;
|
var ALFRESCO_LOGIN_DIRECTIVES, ALFRESCO_AUTHENTICATION;
|
||||||
var exportedNames_1 = {
|
var exportedNames_1 = {
|
||||||
'ALFRESCO_LOGIN_DIRECTIVES': true,
|
'ALFRESCO_LOGIN_DIRECTIVES': true,
|
||||||
@@ -16,21 +16,21 @@ System.register(['./src/components/alfresco-login', './src/services/alfresco-aut
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
setters:[
|
setters:[
|
||||||
function (alfresco_login_1_1) {
|
function (alfresco_login_component_1_1) {
|
||||||
alfresco_login_1 = alfresco_login_1_1;
|
alfresco_login_component_1 = alfresco_login_component_1_1;
|
||||||
exportStar_1(alfresco_login_1_1);
|
exportStar_1(alfresco_login_component_1_1);
|
||||||
},
|
},
|
||||||
function (alfresco_authentication_1_1) {
|
function (alfresco_authentication_service_1_1) {
|
||||||
alfresco_authentication_1 = alfresco_authentication_1_1;
|
alfresco_authentication_service_1 = alfresco_authentication_service_1_1;
|
||||||
exportStar_1(alfresco_authentication_1_1);
|
exportStar_1(alfresco_authentication_service_1_1);
|
||||||
}],
|
}],
|
||||||
execute: function() {
|
execute: function() {
|
||||||
exports_1("default",{
|
exports_1("default",{
|
||||||
directives: [alfresco_login_1.AlfrescoLoginComponent],
|
directives: [alfresco_login_component_1.AlfrescoLoginComponent],
|
||||||
providers: [alfresco_authentication_1.AlfrescoAuthenticationService]
|
providers: [alfresco_authentication_service_1.AlfrescoAuthenticationService]
|
||||||
});
|
});
|
||||||
exports_1("ALFRESCO_LOGIN_DIRECTIVES", ALFRESCO_LOGIN_DIRECTIVES = [alfresco_login_1.AlfrescoLoginComponent]);
|
exports_1("ALFRESCO_LOGIN_DIRECTIVES", ALFRESCO_LOGIN_DIRECTIVES = [alfresco_login_component_1.AlfrescoLoginComponent]);
|
||||||
exports_1("ALFRESCO_AUTHENTICATION", ALFRESCO_AUTHENTICATION = [alfresco_authentication_1.AlfrescoAuthenticationService]);
|
exports_1("ALFRESCO_AUTHENTICATION", ALFRESCO_AUTHENTICATION = [alfresco_authentication_service_1.AlfrescoAuthenticationService]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"ng2-alfresco-login.js","sourceRoot":"","sources":["ng2-alfresco-login.ts"],"names":[],"mappings":";;;;QA2Ba,yBAAyB,EACzB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;YANpC,oBAAe;gBACX,UAAU,EAAE,CAAC,uCAAsB,CAAC;gBACpC,SAAS,EAAE,CAAC,uDAA6B,CAAC;aAC7C,EAAA;YAEY,uCAAA,yBAAyB,GAAU,CAAC,uCAAsB,CAAC,CAAA,CAAC;YAC5D,qCAAA,uBAAuB,GAAU,CAAC,uDAA6B,CAAC,CAAA,CAAC"}
|
{"version":3,"file":"ng2-alfresco-login.js","sourceRoot":"","sources":["ng2-alfresco-login.ts"],"names":[],"mappings":";;;;QA2Ba,yBAAyB,EACzB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;YANpC,oBAAe;gBACX,UAAU,EAAE,CAAC,iDAAsB,CAAC;gBACpC,SAAS,EAAE,CAAC,+DAA6B,CAAC;aAC7C,EAAA;YAEY,uCAAA,yBAAyB,GAAU,CAAC,iDAAsB,CAAC,CAAA,CAAC;YAC5D,qCAAA,uBAAuB,GAAU,CAAC,+DAA6B,CAAC,CAAA,CAAC"}
|
@@ -42,7 +42,9 @@
|
|||||||
"reflect-metadata": "0.1.2",
|
"reflect-metadata": "0.1.2",
|
||||||
"rxjs": "5.0.0-beta.2",
|
"rxjs": "5.0.0-beta.2",
|
||||||
"zone.js": "0.6.10",
|
"zone.js": "0.6.10",
|
||||||
"ng2-translate": "^1.11.2"
|
"ng2-translate": "^1.11.2",
|
||||||
|
"angular2": "2.0.0-beta.15",
|
||||||
|
"ng2-alfresco-core": "0.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"angular2": "2.0.0-beta.15",
|
"angular2": "2.0.0-beta.15",
|
||||||
|
@@ -10,10 +10,17 @@
|
|||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"declaration": true
|
"declaration": true
|
||||||
},
|
},
|
||||||
|
"files":[
|
||||||
|
"node_modules/angular2/typings/browser.d.ts",
|
||||||
|
"typings/browser/ambient/jasmine/index.d.ts",
|
||||||
|
"src/alfresco-login.component.ts",
|
||||||
|
"src/alfresco-login.component.spec.ts",
|
||||||
|
"src/alfresco-authentication.service.ts",
|
||||||
|
"src/alfresco-authentication.service.spec.ts"
|
||||||
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"**/node_modules",
|
||||||
"typings/main",
|
"**/typings/main",
|
||||||
"typings/main.d.ts",
|
"**/typings/main.d.ts"
|
||||||
"demo"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
6
ng2-components/ng2-alfresco-upload/.gitignore
vendored
Normal file
6
ng2-components/ng2-alfresco-upload/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
npm-debug.log
|
||||||
|
node_modules
|
||||||
|
jspm_packages
|
||||||
|
.idea
|
||||||
|
typings
|
||||||
|
coverage
|
6
ng2-components/ng2-alfresco-upload/.travis.yml
Executable file
6
ng2-components/ng2-alfresco-upload/.travis.yml
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- '5'
|
||||||
|
script: npm run coverage
|
||||||
|
# Send coverage data to Coveralls
|
||||||
|
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
|
177
ng2-components/ng2-alfresco-upload/LICENSE
Normal file
177
ng2-components/ng2-alfresco-upload/LICENSE
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
28
ng2-components/ng2-alfresco-upload/README.md
Normal file
28
ng2-components/ng2-alfresco-upload/README.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Alfresco Upload Component for Angular 2
|
||||||
|
|
||||||
|
Components included:
|
||||||
|
|
||||||
|
* Upload Component
|
||||||
|
|
||||||
|
### Custom Upload Component
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import {Component} from 'angular2/core';
|
||||||
|
import {Login} from 'ng2-alfresco-login/ng2-alfresco-login';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'my-login',
|
||||||
|
template: ' <alfresco-login method="{{methodName}}"></alfresco-login>',
|
||||||
|
directives: [Login]
|
||||||
|
})
|
||||||
|
export class MyLoginComponent {
|
||||||
|
methodName: string = 'POST';
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install
|
||||||
|
$ npm run build
|
||||||
|
```
|
16
ng2-components/ng2-alfresco-upload/assets/license_header.txt
Normal file
16
ng2-components/ng2-alfresco-upload/assets/license_header.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* @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.
|
||||||
|
*/
|
0
ng2-components/ng2-alfresco-upload/i18n/en.json
Normal file
0
ng2-components/ng2-alfresco-upload/i18n/en.json
Normal file
0
ng2-components/ng2-alfresco-upload/i18n/it.json
Normal file
0
ng2-components/ng2-alfresco-upload/i18n/it.json
Normal file
28
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.d.ts
vendored
Normal file
28
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* @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 { UploadComponent } from './src/components/upload.component';
|
||||||
|
import { UploadService } from './src/services/upload.service';
|
||||||
|
import { FileSelectDirective } from './src/directives/file-select.directive';
|
||||||
|
import { FileDraggableDirective } from './src/directives/file-draggable.directive';
|
||||||
|
export * from './src/components/upload.component';
|
||||||
|
export * from './src/services/upload.service';
|
||||||
|
declare var _default: {
|
||||||
|
component: typeof UploadComponent[];
|
||||||
|
directives: (typeof FileSelectDirective | typeof FileDraggableDirective)[];
|
||||||
|
providers: typeof UploadService[];
|
||||||
|
};
|
||||||
|
export default _default;
|
53
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.js
Normal file
53
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.js
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/**
|
||||||
|
* @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(['./src/components/upload.component', './src/services/upload.service', './src/directives/file-select.directive', './src/directives/file-draggable.directive'], function(exports_1, context_1) {
|
||||||
|
"use strict";
|
||||||
|
var __moduleName = context_1 && context_1.id;
|
||||||
|
var upload_component_1, upload_service_1, file_select_directive_1, file_draggable_directive_1;
|
||||||
|
function exportStar_1(m) {
|
||||||
|
var exports = {};
|
||||||
|
for(var n in m) {
|
||||||
|
if (n !== "default") exports[n] = m[n];
|
||||||
|
}
|
||||||
|
exports_1(exports);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (upload_component_1_1) {
|
||||||
|
upload_component_1 = upload_component_1_1;
|
||||||
|
exportStar_1(upload_component_1_1);
|
||||||
|
},
|
||||||
|
function (upload_service_1_1) {
|
||||||
|
upload_service_1 = upload_service_1_1;
|
||||||
|
exportStar_1(upload_service_1_1);
|
||||||
|
},
|
||||||
|
function (file_select_directive_1_1) {
|
||||||
|
file_select_directive_1 = file_select_directive_1_1;
|
||||||
|
},
|
||||||
|
function (file_draggable_directive_1_1) {
|
||||||
|
file_draggable_directive_1 = file_draggable_directive_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
exports_1("default",{
|
||||||
|
component: [upload_component_1.UploadComponent],
|
||||||
|
directives: [file_select_directive_1.FileSelectDirective, file_draggable_directive_1.FileDraggableDirective],
|
||||||
|
providers: [upload_service_1.UploadService]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=ng2-alfresco-upload.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"ng2-alfresco-upload.js","sourceRoot":"","sources":["ng2-alfresco-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAUH,oBAAe;gBACX,SAAS,EAAE,CAAC,kCAAe,CAAC;gBAC5B,UAAU,EAAE,CAAC,2CAAmB,EAAE,iDAAsB,CAAC;gBACzD,SAAS,EAAE,CAAC,8BAAa,CAAC;aAC7B,EAAA"}
|
30
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.ts
Normal file
30
ng2-components/ng2-alfresco-upload/ng2-alfresco-upload.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* @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 {UploadComponent} from './src/components/upload.component';
|
||||||
|
import {UploadService} from './src/services/upload.service';
|
||||||
|
import {FileSelectDirective} from './src/directives/file-select.directive';
|
||||||
|
import {FileDraggableDirective} from './src/directives/file-draggable.directive';
|
||||||
|
|
||||||
|
export * from './src/components/upload.component';
|
||||||
|
export * from './src/services/upload.service';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
component: [UploadComponent],
|
||||||
|
directives: [FileSelectDirective, FileDraggableDirective],
|
||||||
|
providers: [UploadService]
|
||||||
|
}
|
67
ng2-components/ng2-alfresco-upload/package.json
Normal file
67
ng2-components/ng2-alfresco-upload/package.json
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
{
|
||||||
|
"name": "ng2-alfresco-upload",
|
||||||
|
"description": "Alfresco Angular2 Upload Component",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"author": "Alfresco Software, Ltd.",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tslint -c tslint.json **/*.ts && typings install && tsc && license-check",
|
||||||
|
"licensecheck": "license-check",
|
||||||
|
"tsc": "tsc",
|
||||||
|
"tsc:w": "tsc -w",
|
||||||
|
"typings": "typings",
|
||||||
|
"test": "live-server --open=tests-runner.html"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Alfresco/dev-platform-webcomponents.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Alfresco/dev-platform-webcomponents/issues"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Mario Romano",
|
||||||
|
"email": "mario.romano83@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"ng2",
|
||||||
|
"angular",
|
||||||
|
"angular2",
|
||||||
|
"alfresco"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"angular2": "2.0.0-beta.15",
|
||||||
|
"systemjs": "0.19.26",
|
||||||
|
"es6-shim": "^0.35.0",
|
||||||
|
"reflect-metadata": "0.1.2",
|
||||||
|
"rxjs": "5.0.0-beta.2",
|
||||||
|
"zone.js": "0.6.10",
|
||||||
|
"ng2-translate": "^1.11.2"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"angular2": "2.0.0-beta.15",
|
||||||
|
"ng2-alfresco-core": "0.1.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"coveralls": "^2.11.9",
|
||||||
|
"jasmine-core": "2.4.1",
|
||||||
|
"license-check": "^1.0.4",
|
||||||
|
"live-server": "^0.9.2",
|
||||||
|
"tslint": "^3.8.1",
|
||||||
|
"typescript": "^1.8.10",
|
||||||
|
"typings": "^0.7.12"
|
||||||
|
},
|
||||||
|
"license-check-config": {
|
||||||
|
"src": [
|
||||||
|
"**/*.ts",
|
||||||
|
"!/node_modules/**/*",
|
||||||
|
"!/typings/**/*"
|
||||||
|
],
|
||||||
|
"path": "assets/license_header.txt",
|
||||||
|
"blocking": false,
|
||||||
|
"logInfo": false,
|
||||||
|
"logError": true
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,115 @@
|
|||||||
|
|
||||||
|
.file-dialog {
|
||||||
|
display: none;
|
||||||
|
-webkit-box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .2);
|
||||||
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, .2);
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
-webkit-transform: translate3d(0, 0, 0);
|
||||||
|
transform: translate3d(0, 0, 0);
|
||||||
|
-webkit-transition-delay: 0s;
|
||||||
|
transition-delay: 0s;
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transition: transform .15s cubic-bezier(0.4, 0.0, 1, 1), opacity .15s cubic-bezier(0.4, 0.0, 1, 1), visibility 0ms linear .15s;
|
||||||
|
transition: transform .15s cubic-bezier(0.4, 0.0, 1, 1), opacity .15s cubic-bezier(0.4, 0.0, 1, 1), visibility 0ms linear .15s;
|
||||||
|
bottom: 0px;
|
||||||
|
left: auto;
|
||||||
|
max-height: 350px;
|
||||||
|
overflow: visible;
|
||||||
|
right: 24px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header {
|
||||||
|
width: 900px;
|
||||||
|
background-color: #0c79bf;
|
||||||
|
border: 1px transparent solid;
|
||||||
|
-moz-border-radius-topleft: 2px;
|
||||||
|
-webkit-border-top-left-radius: 2px;
|
||||||
|
border-top-left-radius: 2px;
|
||||||
|
-moz-border-radius-topright: 2px;
|
||||||
|
-webkit-border-top-right-radius: 2px;
|
||||||
|
border-top-right-radius: 2px;
|
||||||
|
bottom: 0px;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 52px;
|
||||||
|
line-height: 52px;
|
||||||
|
padding: 0px 10px 0px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .title {
|
||||||
|
float: left;
|
||||||
|
min-width: 200px;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .buttons {
|
||||||
|
float: right;
|
||||||
|
padding: 10px 10px 10px 10px;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .close-button {
|
||||||
|
cursor: pointer;
|
||||||
|
float: left;
|
||||||
|
height: 35px;
|
||||||
|
width: 35px;
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .close-button:hover {
|
||||||
|
border: 1px solid white;
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .minimize-button {
|
||||||
|
cursor: pointer;
|
||||||
|
float: left;
|
||||||
|
height: 35px;
|
||||||
|
width: 35px;
|
||||||
|
margin-right: 10px;
|
||||||
|
-webkit-border-radius: 2px;
|
||||||
|
-moz-border-radius: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.up {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.down {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active .up {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active .down {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .header .minimize-button:hover {
|
||||||
|
border: 1px solid white;
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-dialog .body-dialog {
|
||||||
|
float: left;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: -4px;
|
||||||
|
border-bottom: 1px solid #C0C0C0;
|
||||||
|
border-right: 1px solid #C0C0C0;
|
||||||
|
border-left: 1px solid #C0C0C0;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
28
ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.d.ts
vendored
Normal file
28
ng2-components/ng2-alfresco-upload/src/components/file-uploading-dialog.component.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* @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 { ElementRef } from 'angular2/core';
|
||||||
|
import { FileModel } from '../models/file.model';
|
||||||
|
export declare class FileUploadingDialogComponent {
|
||||||
|
el: ElementRef;
|
||||||
|
filesUploadingList: FileModel[];
|
||||||
|
_isDialogActive: boolean;
|
||||||
|
_isDialogMinimized: boolean;
|
||||||
|
constructor(el: ElementRef);
|
||||||
|
toggleDialog($event: any): void;
|
||||||
|
showDialog(): void;
|
||||||
|
toggleDialogMinimize($event: any): void;
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
<div class="file-dialog" [ngClass]="{show: _isDialogActive}">
|
||||||
|
<div class="header">
|
||||||
|
<div class="title">
|
||||||
|
{{filesUploadingList.length}} uploads complete
|
||||||
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<div class="minimize-button" [ngClass]="{active: _isDialogMinimized}" (click)="toggleDialogMinimize($event)">
|
||||||
|
<i class="material-icons down">keyboard_arrow_down</i>
|
||||||
|
<i class="material-icons up">keyboard_arrow_up</i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="close-button" (click)="toggleDialog($event)">
|
||||||
|
<i class="material-icons">clear</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="body-dialog" [ngClass]="{hide: _isDialogMinimized}">
|
||||||
|
<alfresco-file-uploading-list [filesUploadingList]="filesUploadingList"></alfresco-file-uploading-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* @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', './file-uploading-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, file_uploading_list_component_1;
|
||||||
|
var FileUploadingDialogComponent;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (core_1_1) {
|
||||||
|
core_1 = core_1_1;
|
||||||
|
},
|
||||||
|
function (file_uploading_list_component_1_1) {
|
||||||
|
file_uploading_list_component_1 = file_uploading_list_component_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
FileUploadingDialogComponent = (function () {
|
||||||
|
function FileUploadingDialogComponent(el) {
|
||||||
|
this.el = el;
|
||||||
|
this._isDialogActive = false;
|
||||||
|
this._isDialogMinimized = false;
|
||||||
|
console.log('FileUploadingDialogComponent constructor', el);
|
||||||
|
}
|
||||||
|
FileUploadingDialogComponent.prototype.toggleDialog = function ($event) {
|
||||||
|
this._isDialogActive = !this._isDialogActive;
|
||||||
|
};
|
||||||
|
FileUploadingDialogComponent.prototype.showDialog = function () {
|
||||||
|
this._isDialogActive = true;
|
||||||
|
};
|
||||||
|
FileUploadingDialogComponent.prototype.toggleDialogMinimize = function ($event) {
|
||||||
|
this._isDialogMinimized = !this._isDialogMinimized;
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', Array)
|
||||||
|
], FileUploadingDialogComponent.prototype, "filesUploadingList", void 0);
|
||||||
|
FileUploadingDialogComponent = __decorate([
|
||||||
|
core_1.Component({
|
||||||
|
selector: 'file-uploading-dialog',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
directives: [file_uploading_list_component_1.FileUploadingListComponent],
|
||||||
|
templateUrl: './file-uploading-dialog.component.html',
|
||||||
|
styleUrls: ['./file-uploading-dialog.component.css'],
|
||||||
|
host: { '[class.dialog-show]': 'toggleDialog' }
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [core_1.ElementRef])
|
||||||
|
], FileUploadingDialogComponent);
|
||||||
|
return FileUploadingDialogComponent;
|
||||||
|
}());
|
||||||
|
exports_1("FileUploadingDialogComponent", FileUploadingDialogComponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=file-uploading-dialog.component.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-uploading-dialog.component.js","sourceRoot":"","sources":["file-uploading-dialog.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;YAiBH;gBASI,sCAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAJhC,oBAAe,GAAW,KAAK,CAAC;oBAEhC,uBAAkB,GAAW,KAAK,CAAC;oBAG/B,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;gBAED,mDAAY,GAAZ,UAAa,MAAM;oBACf,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC;gBACjD,CAAC;gBAED,iDAAU,GAAV;oBACI,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;gBAChC,CAAC;gBAED,2DAAoB,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,kBAAkB,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBACvD,CAAC;gBArBD;oBAAC,YAAK,EAAE;;wFAAA;gBAVZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,uBAAuB;wBACjC,QAAQ,EAAE,YAAY;wBACtB,UAAU,EAAE,CAAC,0DAA0B,CAAC;wBACxC,WAAW,EAAE,wCAAwC;wBACrD,SAAS,EAAE,CAAC,uCAAuC,CAAC;wBACpD,IAAI,EAAE,EAAC,qBAAqB,EAAE,cAAc,EAAC;qBAChD,CAAC;;gDAAA;gBAyBF,mCAAC;YAAD,CAAC,AAxBD,IAwBC;YAxBD,uEAwBC,CAAA"}
|
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* @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, ElementRef, Input} from 'angular2/core';
|
||||||
|
import {FileModel} from '../models/file.model';
|
||||||
|
import {FileUploadingListComponent} from './file-uploading-list.component';
|
||||||
|
|
||||||
|
declare let __moduleName:string;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'file-uploading-dialog',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
directives: [FileUploadingListComponent],
|
||||||
|
templateUrl: './file-uploading-dialog.component.html',
|
||||||
|
styleUrls: ['./file-uploading-dialog.component.css'],
|
||||||
|
host: {'[class.dialog-show]': 'toggleDialog'}
|
||||||
|
})
|
||||||
|
export class FileUploadingDialogComponent {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
filesUploadingList:FileModel [];
|
||||||
|
|
||||||
|
_isDialogActive:boolean = false;
|
||||||
|
|
||||||
|
_isDialogMinimized:boolean = false;
|
||||||
|
|
||||||
|
constructor(public el:ElementRef) {
|
||||||
|
console.log('FileUploadingDialogComponent constructor', el);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleDialog($event) {
|
||||||
|
this._isDialogActive = !this._isDialogActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
showDialog() {
|
||||||
|
this._isDialogActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleDialogMinimize($event) {
|
||||||
|
this._isDialogMinimized = !this._isDialogMinimized;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
.mdl-data-table {
|
||||||
|
width: 100%;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursor {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
24
ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.d.ts
vendored
Normal file
24
ng2-components/ng2-alfresco-upload/src/components/file-uploading-list.component.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* @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 { ElementRef } from 'angular2/core';
|
||||||
|
import { FileModel } from '../models/file.model';
|
||||||
|
export declare class FileUploadingListComponent {
|
||||||
|
el: ElementRef;
|
||||||
|
filesUploadingList: FileModel[];
|
||||||
|
constructor(el: ElementRef);
|
||||||
|
abort(id: any): void;
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="#file of filesUploadingList">
|
||||||
|
<td class="mdl-data-table__cell--non-numeric">{{file.name}}</td>
|
||||||
|
<td _ngcontent-hvq-3="">
|
||||||
|
<div _ngcontent-hvq-3="" class="mdl-progress mdl-js-progress is-upgraded" id="{{file.id}}"
|
||||||
|
data-upgraded=",MaterialProgress">
|
||||||
|
<div class="progressbar bar bar1" style="width: {{file.progress.percent}}%;"></div>
|
||||||
|
<div class="bufferbar bar bar2" style="width: 100%;"></div>
|
||||||
|
<div class="auxbar bar bar3" style="width: 0%;"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="mdl-data-table__cell--non-numeric">{{file.size}}</td>
|
||||||
|
<td>
|
||||||
|
<span *ngIf="file.done && !file.abort"><i class="material-icons">done</i></span>
|
||||||
|
<span *ngIf="file.uploading" (click)="abort(file.id)" class="cursor" ><i class="material-icons">play_arrow</i></span>
|
||||||
|
<span *ngIf="file.abort"><i class="material-icons">remove_circle</i></span>
|
||||||
|
<span *ngIf="!file.abort && !file.uploading && !file.done"><i class="material-icons">pause</i></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* @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'], 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;
|
||||||
|
var FileUploadingListComponent;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (core_1_1) {
|
||||||
|
core_1 = core_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
FileUploadingListComponent = (function () {
|
||||||
|
function FileUploadingListComponent(el) {
|
||||||
|
this.el = el;
|
||||||
|
console.log('filesUploadingList constructor', el);
|
||||||
|
setInterval(function () {
|
||||||
|
console.log('Check for async update from drag directive');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
FileUploadingListComponent.prototype.abort = function (id) {
|
||||||
|
var file = this.filesUploadingList.filter(function (uploadingFileModel) {
|
||||||
|
return uploadingFileModel.id == id;
|
||||||
|
});
|
||||||
|
file[0].setAbort();
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', Array)
|
||||||
|
], FileUploadingListComponent.prototype, "filesUploadingList", void 0);
|
||||||
|
FileUploadingListComponent = __decorate([
|
||||||
|
core_1.Component({
|
||||||
|
selector: 'alfresco-file-uploading-list',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
templateUrl: './file-uploading-list.component.html',
|
||||||
|
styleUrls: ['./file-uploading-list.component.css']
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [core_1.ElementRef])
|
||||||
|
], FileUploadingListComponent);
|
||||||
|
return FileUploadingListComponent;
|
||||||
|
}());
|
||||||
|
exports_1("FileUploadingListComponent", FileUploadingListComponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=file-uploading-list.component.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-uploading-list.component.js","sourceRoot":"","sources":["file-uploading-list.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAcH;gBAKI,oCAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAC5B,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;oBAElD,WAAW,CAAC;wBACR,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;oBAC9D,CAAC,EAAE,IAAI,CAAC,CAAC;gBACb,CAAC;gBAED,0CAAK,GAAL,UAAM,EAAE;oBACJ,IAAI,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,UAAC,kBAAkB;wBACzD,MAAM,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;oBACvC,CAAC,CAAC,CAAC;oBACH,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACvB,CAAC;gBAhBD;oBAAC,YAAK,EAAE;;sFAAA;gBARZ;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,8BAA8B;wBACxC,QAAQ,EAAE,YAAY;wBACtB,WAAW,EAAE,sCAAsC;wBACnD,SAAS,EAAE,CAAC,qCAAqC,CAAC;qBACrD,CAAC;;8CAAA;gBAoBF,iCAAC;YAAD,CAAC,AAnBD,IAmBC;YAnBD,mEAmBC,CAAA"}
|
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* @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, ElementRef, Input} from 'angular2/core';
|
||||||
|
import {FileModel} from '../models/file.model';
|
||||||
|
|
||||||
|
declare let __moduleName:string;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'alfresco-file-uploading-list',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
templateUrl: './file-uploading-list.component.html',
|
||||||
|
styleUrls: ['./file-uploading-list.component.css']
|
||||||
|
})
|
||||||
|
export class FileUploadingListComponent {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
filesUploadingList:FileModel [];
|
||||||
|
|
||||||
|
constructor(public el:ElementRef) {
|
||||||
|
console.log('filesUploadingList constructor', el);
|
||||||
|
|
||||||
|
setInterval(() => {
|
||||||
|
console.log('Check for async update from drag directive');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
abort(id):void {
|
||||||
|
let file = this.filesUploadingList.filter((uploadingFileModel) => {
|
||||||
|
return uploadingFileModel.id == id;
|
||||||
|
});
|
||||||
|
file[0].setAbort();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,35 @@
|
|||||||
|
.mdl-button--file input {
|
||||||
|
cursor: pointer;
|
||||||
|
height: 100%;
|
||||||
|
right: 0;
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 300px;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-textfield--file .mdl-textfield__input {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc(100% - 32px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdl-textfield--file .mdl-button--file {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-border {
|
||||||
|
vertical-align: middle;
|
||||||
|
color: #555;
|
||||||
|
padding: 20px;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
display: inline-block;
|
||||||
|
border: 3px dashed #555;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-focus {
|
||||||
|
color: #2196F3;
|
||||||
|
border: 3px dashed #2196F3;
|
||||||
|
}
|
31
ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts
vendored
Normal file
31
ng2-components/ng2-alfresco-upload/src/components/upload.component.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* @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 { ElementRef } from 'angular2/core';
|
||||||
|
import { FileModel } from '../models/file.model';
|
||||||
|
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
|
||||||
|
export declare class UploadComponent {
|
||||||
|
el: ElementRef;
|
||||||
|
private _uploaderService;
|
||||||
|
method: string;
|
||||||
|
undoNotificationBar: any;
|
||||||
|
fileUploadingDialogComponent: FileUploadingDialogComponent;
|
||||||
|
filesUploadingList: FileModel[];
|
||||||
|
constructor(el: ElementRef);
|
||||||
|
onFilesAdded(files: any): void;
|
||||||
|
showUndoNotificationBar(latestFilesAdded: any): void;
|
||||||
|
showDialog(): void;
|
||||||
|
}
|
@@ -0,0 +1,52 @@
|
|||||||
|
<br>
|
||||||
|
|
||||||
|
<!--upload buttons-->
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<div class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
|
||||||
|
<i class="material-icons">file_upload</i> Upload<input file-select type="file" name="uploadFiles" id="uploadFiles"
|
||||||
|
multiple="multiple"
|
||||||
|
accept=".jpg,.gif,.png,.svg,.mp4"
|
||||||
|
(onFilesAdded)="onFilesAdded($event)"
|
||||||
|
#uploadFiles>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<div class="mdl-button mdl-js-button mdl-button--raised mdl-button--file">
|
||||||
|
<i class="material-icons">file_upload</i> Upload Folder<input file-select type="file" name="uploadFiles" id="uploadFolder"
|
||||||
|
multiple="multiple"
|
||||||
|
accept=".jpg,.gif,.png,.svg"
|
||||||
|
(onFilesAdded)="onFilesAdded($event)"
|
||||||
|
webkitdirectory directory
|
||||||
|
multiple #uploadFiles>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<div file-draggable id='UploadBorder' class="upload-border" (onFilesAdded)="onFilesAdded($event)"
|
||||||
|
dropzone="" webkitdropzone="copy file:image/png file:image/gif file:image/jpeg" #droparea>
|
||||||
|
Drop Area
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!--show dialog-->
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<button type="button" (click)="showDialog($event)" class="mdl-button mdl-js-button mdl-button--raised show-modal">Show
|
||||||
|
Dialog
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<file-uploading-dialog [filesUploadingList]="filesUploadingList" #fileUploadingDialog></file-uploading-dialog>
|
||||||
|
|
||||||
|
<!--show snackbar-->
|
||||||
|
|
||||||
|
|
||||||
|
<div id="demo-snackbar-example" class="mdl-js-snackbar mdl-snackbar" #undoNotificationBar>
|
||||||
|
<div class="mdl-snackbar__text"></div>
|
||||||
|
<button class="mdl-snackbar__action" type="button"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
@@ -0,0 +1,122 @@
|
|||||||
|
/**
|
||||||
|
* @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', '../services/upload.service', './file-uploading-dialog.component', '../directives/file-select.directive', '../directives/file-draggable.directive'], 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, upload_service_1, file_uploading_dialog_component_1, file_select_directive_1, file_draggable_directive_1;
|
||||||
|
var UploadComponent;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (core_1_1) {
|
||||||
|
core_1 = core_1_1;
|
||||||
|
},
|
||||||
|
function (upload_service_1_1) {
|
||||||
|
upload_service_1 = upload_service_1_1;
|
||||||
|
},
|
||||||
|
function (file_uploading_dialog_component_1_1) {
|
||||||
|
file_uploading_dialog_component_1 = file_uploading_dialog_component_1_1;
|
||||||
|
},
|
||||||
|
function (file_select_directive_1_1) {
|
||||||
|
file_select_directive_1 = file_select_directive_1_1;
|
||||||
|
},
|
||||||
|
function (file_draggable_directive_1_1) {
|
||||||
|
file_draggable_directive_1 = file_draggable_directive_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
UploadComponent = (function () {
|
||||||
|
function UploadComponent(el) {
|
||||||
|
this.el = el;
|
||||||
|
this.method = 'GET';
|
||||||
|
this.filesUploadingList = [];
|
||||||
|
console.log('UploadComponent constructor', el);
|
||||||
|
this._uploaderService = new upload_service_1.UploadService({
|
||||||
|
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
|
||||||
|
withCredentials: true,
|
||||||
|
authToken: btoa('admin:admin'),
|
||||||
|
authTokenPrefix: 'Basic',
|
||||||
|
fieldName: 'filedata',
|
||||||
|
formFields: {
|
||||||
|
siteid: 'swsdp',
|
||||||
|
containerid: 'documentLibrary'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
UploadComponent.prototype.onFilesAdded = function (files) {
|
||||||
|
var latestFilesAdded = [];
|
||||||
|
if (componentHandler) {
|
||||||
|
componentHandler.upgradeAllRegistered();
|
||||||
|
}
|
||||||
|
if (files.length) {
|
||||||
|
latestFilesAdded = this._uploaderService.addToQueue(files);
|
||||||
|
this.filesUploadingList = this._uploaderService.getQueue();
|
||||||
|
this.showDialog();
|
||||||
|
this.showUndoNotificationBar(latestFilesAdded);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
UploadComponent.prototype.showUndoNotificationBar = function (latestFilesAdded) {
|
||||||
|
this.snackbarContainer.nativeElement.MaterialSnackbar.showSnackbar({
|
||||||
|
message: 'Upload in progress...',
|
||||||
|
timeout: 5000,
|
||||||
|
actionHandler: function () {
|
||||||
|
latestFilesAdded.forEach(function (uploadingFileModel) {
|
||||||
|
uploadingFileModel.setAbort();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionText: 'Undo'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
UploadComponent.prototype.showDialog = function () {
|
||||||
|
this.fileUploadingDialogComponent.showDialog();
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Input(),
|
||||||
|
__metadata('design:type', String)
|
||||||
|
], UploadComponent.prototype, "method", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.ViewChild('undoNotificationBar'),
|
||||||
|
__metadata('design:type', Object)
|
||||||
|
], UploadComponent.prototype, "undoNotificationBar", void 0);
|
||||||
|
__decorate([
|
||||||
|
core_1.ViewChild('fileUploadingDialog'),
|
||||||
|
__metadata('design:type', file_uploading_dialog_component_1.FileUploadingDialogComponent)
|
||||||
|
], UploadComponent.prototype, "fileUploadingDialogComponent", void 0);
|
||||||
|
UploadComponent = __decorate([
|
||||||
|
core_1.Component({
|
||||||
|
selector: 'alfresco-upload',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
directives: [file_select_directive_1.FileSelectDirective, file_draggable_directive_1.FileDraggableDirective, file_uploading_dialog_component_1.FileUploadingDialogComponent],
|
||||||
|
templateUrl: './upload.component.html',
|
||||||
|
styleUrls: ['./upload.component.css']
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [core_1.ElementRef])
|
||||||
|
], UploadComponent);
|
||||||
|
return UploadComponent;
|
||||||
|
}());
|
||||||
|
exports_1("UploadComponent", UploadComponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=upload.component.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"upload.component.js","sourceRoot":"","sources":["upload.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBH;gBAeI,yBAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAVhC,WAAM,GAAU,KAAK,CAAC;oBAQtB,uBAAkB,GAAgB,EAAE,CAAC;oBAGjC,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;oBAE/C,IAAI,CAAC,gBAAgB,GAAG,IAAI,8BAAa,CAAC;wBACtC,GAAG,EAAE,wDAAwD;wBAC7D,eAAe,EAAE,IAAI;wBACrB,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC;wBAC9B,eAAe,EAAE,OAAO;wBACxB,SAAS,EAAE,UAAU;wBACrB,UAAU,EAAE;4BACR,MAAM,EAAE,OAAO;4BACf,WAAW,EAAE,iBAAiB;yBACjC;qBACJ,CAAC,CAAC;gBACP,CAAC;gBAED,sCAAY,GAAZ,UAAa,KAAK;oBACd,IAAI,gBAAgB,GAAgB,EAAE,CAAC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AC,wBAAwB,CAAC;qBACxC,CAAC;;mCAAA;gBA8DF,sBAAC;YAAD,CAAC,AA7DD,IA6DC;YA7DD,6CA6DC,CAAA"}
|
@@ -0,0 +1,98 @@
|
|||||||
|
/**
|
||||||
|
* @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, Input, ViewChild, ElementRef} from 'angular2/core';
|
||||||
|
import {UploadService} from '../services/upload.service';
|
||||||
|
import {FileModel} from '../models/file.model';
|
||||||
|
import {FileUploadingDialogComponent} from './file-uploading-dialog.component';
|
||||||
|
import {FileSelectDirective} from '../directives/file-select.directive';
|
||||||
|
import {FileDraggableDirective} from '../directives/file-draggable.directive';
|
||||||
|
|
||||||
|
declare let componentHandler;
|
||||||
|
declare let dialogPolyfill;
|
||||||
|
declare let __moduleName:string;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'alfresco-upload',
|
||||||
|
moduleId: __moduleName,
|
||||||
|
directives: [FileSelectDirective, FileDraggableDirective, FileUploadingDialogComponent],
|
||||||
|
templateUrl: './upload.component.html',
|
||||||
|
styleUrls: ['./upload.component.css']
|
||||||
|
})
|
||||||
|
export class UploadComponent {
|
||||||
|
|
||||||
|
private _uploaderService:UploadService;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
method:string = 'GET';
|
||||||
|
|
||||||
|
@ViewChild('undoNotificationBar')
|
||||||
|
undoNotificationBar;
|
||||||
|
|
||||||
|
@ViewChild('fileUploadingDialog')
|
||||||
|
fileUploadingDialogComponent:FileUploadingDialogComponent;
|
||||||
|
|
||||||
|
filesUploadingList:FileModel [] = [];
|
||||||
|
|
||||||
|
constructor(public el:ElementRef) {
|
||||||
|
console.log('UploadComponent constructor', el);
|
||||||
|
|
||||||
|
this._uploaderService = new UploadService({
|
||||||
|
url: 'http://192.168.99.100:8080/alfresco/service/api/upload',
|
||||||
|
withCredentials: true,
|
||||||
|
authToken: btoa('admin:admin'),
|
||||||
|
authTokenPrefix: 'Basic',
|
||||||
|
fieldName: 'filedata',
|
||||||
|
formFields: {
|
||||||
|
siteid: 'swsdp',
|
||||||
|
containerid: 'documentLibrary'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onFilesAdded(files):void {
|
||||||
|
let latestFilesAdded:FileModel [] = [];
|
||||||
|
if (componentHandler) {
|
||||||
|
componentHandler.upgradeAllRegistered();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (files.length) {
|
||||||
|
latestFilesAdded = this._uploaderService.addToQueue(files);
|
||||||
|
this.filesUploadingList = this._uploaderService.getQueue();
|
||||||
|
this.showDialog();
|
||||||
|
this.showUndoNotificationBar(latestFilesAdded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showUndoNotificationBar(latestFilesAdded){
|
||||||
|
this.snackbarContainer.nativeElement.MaterialSnackbar.showSnackbar({
|
||||||
|
message: 'Upload in progress...',
|
||||||
|
timeout: 5000,
|
||||||
|
actionHandler: function () {
|
||||||
|
latestFilesAdded.forEach((uploadingFileModel) => {
|
||||||
|
uploadingFileModel.setAbort();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionText: 'Undo'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
showDialog():void {
|
||||||
|
this.fileUploadingDialogComponent.showDialog();
|
||||||
|
}
|
||||||
|
}
|
29
ng2-components/ng2-alfresco-upload/src/directives/file-draggable.directive.d.ts
vendored
Normal file
29
ng2-components/ng2-alfresco-upload/src/directives/file-draggable.directive.d.ts
vendored
Normal file
@@ -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 { ElementRef, EventEmitter } from 'angular2/core';
|
||||||
|
export declare class FileDraggableDirective {
|
||||||
|
el: ElementRef;
|
||||||
|
onFilesAdded: EventEmitter<any>;
|
||||||
|
files: File[];
|
||||||
|
private _inputFocusClass;
|
||||||
|
constructor(el: ElementRef);
|
||||||
|
private _onDropFiles($event);
|
||||||
|
private _traverseFileTree(item, x);
|
||||||
|
private _onDragEnter($event);
|
||||||
|
private _onDragLeave($event);
|
||||||
|
private _preventDefault($event);
|
||||||
|
}
|
@@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* @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'], 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;
|
||||||
|
var FileDraggableDirective;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (core_1_1) {
|
||||||
|
core_1 = core_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
FileDraggableDirective = (function () {
|
||||||
|
function FileDraggableDirective(el) {
|
||||||
|
this.el = el;
|
||||||
|
this.onFilesAdded = new core_1.EventEmitter();
|
||||||
|
this._inputFocusClass = false;
|
||||||
|
console.log('FileDraggableComponent constructor', el);
|
||||||
|
}
|
||||||
|
FileDraggableDirective.prototype._onDropFiles = function ($event) {
|
||||||
|
this._preventDefault($event);
|
||||||
|
var items = $event.dataTransfer.items;
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var item = items[i].webkitGetAsEntry();
|
||||||
|
if (item) {
|
||||||
|
this._traverseFileTree(item, -1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var dt = $event.dataTransfer;
|
||||||
|
var files = dt.files;
|
||||||
|
this.onFilesAdded.emit(files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.onFilesAdded.emit([]);
|
||||||
|
this._inputFocusClass = false;
|
||||||
|
};
|
||||||
|
FileDraggableDirective.prototype._traverseFileTree = function (item, x) {
|
||||||
|
if (item.isFile) {
|
||||||
|
var self_1 = this;
|
||||||
|
item.file(function (file) {
|
||||||
|
self_1.onFilesAdded.emit([file]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (item.isDirectory) {
|
||||||
|
var self_2 = this;
|
||||||
|
var dirReader = item.createReader();
|
||||||
|
dirReader.readEntries(function (entries) {
|
||||||
|
for (var i = 0; i < entries.length; i++) {
|
||||||
|
self_2._traverseFileTree(entries[i], i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileDraggableDirective.prototype._onDragEnter = function ($event) {
|
||||||
|
this._preventDefault($event);
|
||||||
|
this._inputFocusClass = true;
|
||||||
|
};
|
||||||
|
FileDraggableDirective.prototype._onDragLeave = function ($event) {
|
||||||
|
this._preventDefault($event);
|
||||||
|
this._inputFocusClass = false;
|
||||||
|
};
|
||||||
|
FileDraggableDirective.prototype._preventDefault = function ($event) {
|
||||||
|
$event.stopPropagation();
|
||||||
|
$event.preventDefault();
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Output(),
|
||||||
|
__metadata('design:type', core_1.EventEmitter)
|
||||||
|
], FileDraggableDirective.prototype, "onFilesAdded", void 0);
|
||||||
|
FileDraggableDirective = __decorate([
|
||||||
|
core_1.Directive({
|
||||||
|
selector: '[file-draggable]',
|
||||||
|
host: {
|
||||||
|
'(drop)': '_onDropFiles($event)',
|
||||||
|
'(dragenter)': '_onDragEnter($event)',
|
||||||
|
'(dragleave)': '_onDragLeave($event)',
|
||||||
|
'(dragover)': '_preventDefault($event)',
|
||||||
|
'[class.input-focus]': '_inputFocusClass'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [core_1.ElementRef])
|
||||||
|
], FileDraggableDirective);
|
||||||
|
return FileDraggableDirective;
|
||||||
|
}());
|
||||||
|
exports_1("FileDraggableDirective", FileDraggableDirective);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=file-draggable.directive.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-draggable.directive.js","sourceRoot":"","sources":["file-draggable.directive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAcH;gBAMI,gCAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAJhC,iBAAY,GAAqB,IAAI,mBAAY,EAAE,CAAC;oBAE5C,qBAAgB,GAAW,KAAK,CAAC;oBAGrC,OAAO,CAAC,GAAG,CAAC,oCAAoC,EAAE,EAAE,CAAC,CAAC;gBAC1D,CAAC;gBAEO,6CAAY,GAApB,UAAqB,MAAM;oBACvB,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;oBAE7B,IAAI,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;oBACtC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;wBACpC,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;wBACvC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;4BACP,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;wBACrC,CAAC;wBAAC,IAAI,CAAC,CAAC;4BACJ,IAAI,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC;4BAC7B,IAAI,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;4BACrB,IAAI,CAAC,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AAgB,GAAG,KAAK,CAAC;gBAClC,CAAC;gBAEO,gDAAe,GAAvB,UAAwB,MAAM;oBAC1B,MAAM,CAAC,eAAe,EAAE,CAAC;oBACzB,MAAM,CAAC,cAAc,EAAE,CAAC;gBAC5B,CAAC;gBA9DD;oBAAC,aAAM,EAAE;;4EAAA;gBAXb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,kBAAkB;wBAC5B,IAAI,EAAE;4BACF,QAAQ,EAAE,sBAAsB;4BAChC,aAAa,EAAE,sBAAsB;4BACrC,aAAa,EAAE,sBAAsB;4BACrC,YAAY,EAAE,yBAAyB;4BACvC,qBAAqB,EAAE,kBAAkB;yBAC5C;qBACJ,CAAC;;0CAAA;gBAiEF,6BAAC;YAAD,CAAC,AAhED,IAgEC;YAhED,2DAgEC,CAAA"}
|
@@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* @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 {Directive, ElementRef, EventEmitter, Output} from 'angular2/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[file-draggable]',
|
||||||
|
host: {
|
||||||
|
'(drop)': '_onDropFiles($event)',
|
||||||
|
'(dragenter)': '_onDragEnter($event)',
|
||||||
|
'(dragleave)': '_onDragLeave($event)',
|
||||||
|
'(dragover)': '_preventDefault($event)',
|
||||||
|
'[class.input-focus]': '_inputFocusClass'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
export class FileDraggableDirective {
|
||||||
|
@Output()
|
||||||
|
onFilesAdded:EventEmitter<any> = new EventEmitter();
|
||||||
|
files:File [];
|
||||||
|
private _inputFocusClass:boolean = false;
|
||||||
|
|
||||||
|
constructor(public el:ElementRef) {
|
||||||
|
console.log('FileDraggableComponent constructor', el);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _onDropFiles($event):void {
|
||||||
|
this._preventDefault($event);
|
||||||
|
|
||||||
|
var items = $event.dataTransfer.items;
|
||||||
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
var item = items[i].webkitGetAsEntry();
|
||||||
|
if (item) {
|
||||||
|
this._traverseFileTree(item, -1);
|
||||||
|
} else {
|
||||||
|
let dt = $event.dataTransfer;
|
||||||
|
let files = dt.files;
|
||||||
|
this.onFilesAdded.emit(files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.onFilesAdded.emit([]);
|
||||||
|
|
||||||
|
this._inputFocusClass = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _traverseFileTree(item, x):void {
|
||||||
|
if (item.isFile) {
|
||||||
|
let self = this;
|
||||||
|
item.file(function (file) {
|
||||||
|
self.onFilesAdded.emit([file]);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (item.isDirectory) {
|
||||||
|
let self = this;
|
||||||
|
let dirReader = item.createReader();
|
||||||
|
dirReader.readEntries(function (entries) {
|
||||||
|
for (var i = 0; i < entries.length; i++) {
|
||||||
|
self._traverseFileTree(entries[i], i);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _onDragEnter($event):void {
|
||||||
|
this._preventDefault($event);
|
||||||
|
|
||||||
|
this._inputFocusClass = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _onDragLeave($event):void {
|
||||||
|
this._preventDefault($event);
|
||||||
|
|
||||||
|
this._inputFocusClass = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _preventDefault($event):void {
|
||||||
|
$event.stopPropagation();
|
||||||
|
$event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
23
ng2-components/ng2-alfresco-upload/src/directives/file-select.directive.d.ts
vendored
Normal file
23
ng2-components/ng2-alfresco-upload/src/directives/file-select.directive.d.ts
vendored
Normal file
@@ -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.
|
||||||
|
*/
|
||||||
|
import { ElementRef, EventEmitter } from 'angular2/core';
|
||||||
|
export declare class FileSelectDirective {
|
||||||
|
el: ElementRef;
|
||||||
|
onFilesAdded: EventEmitter<any>;
|
||||||
|
constructor(el: ElementRef);
|
||||||
|
private _onAdd();
|
||||||
|
}
|
@@ -0,0 +1,64 @@
|
|||||||
|
/**
|
||||||
|
* @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'], 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;
|
||||||
|
var FileSelectDirective;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (core_1_1) {
|
||||||
|
core_1 = core_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
FileSelectDirective = (function () {
|
||||||
|
function FileSelectDirective(el) {
|
||||||
|
this.el = el;
|
||||||
|
this.onFilesAdded = new core_1.EventEmitter();
|
||||||
|
console.log('FileSelectComponent constructor', el);
|
||||||
|
}
|
||||||
|
FileSelectDirective.prototype._onAdd = function () {
|
||||||
|
var files = this.el.nativeElement.files;
|
||||||
|
this.onFilesAdded.emit(files);
|
||||||
|
};
|
||||||
|
__decorate([
|
||||||
|
core_1.Output(),
|
||||||
|
__metadata('design:type', core_1.EventEmitter)
|
||||||
|
], FileSelectDirective.prototype, "onFilesAdded", void 0);
|
||||||
|
FileSelectDirective = __decorate([
|
||||||
|
core_1.Directive({
|
||||||
|
selector: '[file-select]',
|
||||||
|
host: { '(change)': '_onAdd()' }
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [core_1.ElementRef])
|
||||||
|
], FileSelectDirective);
|
||||||
|
return FileSelectDirective;
|
||||||
|
}());
|
||||||
|
exports_1("FileSelectDirective", FileSelectDirective);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=file-select.directive.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-select.directive.js","sourceRoot":"","sources":["file-select.directive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YAQH;gBAKI,6BAAmB,EAAa;oBAAb,OAAE,GAAF,EAAE,CAAW;oBAFhC,iBAAY,GAAqB,IAAI,mBAAY,EAAE,CAAC;oBAGhD,OAAO,CAAC,GAAG,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAC;gBACvD,CAAC;gBAEO,oCAAM,GAAd;oBACI,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC;oBACxC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAClC,CAAC;gBAVD;oBAAC,aAAM,EAAE;;yEAAA;gBANb;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,eAAe;wBACzB,IAAI,EAAE,EAAC,UAAU,EAAE,UAAU,EAAC;qBACjC,CAAC;;uCAAA;gBAcF,0BAAC;YAAD,CAAC,AAbD,IAaC;YAbD,qDAaC,CAAA"}
|
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* @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 {Directive, ElementRef, EventEmitter, Output} from 'angular2/core';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[file-select]',
|
||||||
|
host: {'(change)': '_onAdd()'}
|
||||||
|
})
|
||||||
|
export class FileSelectDirective {
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
onFilesAdded:EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
constructor(public el:ElementRef) {
|
||||||
|
console.log('FileSelectComponent constructor', el);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _onAdd():void {
|
||||||
|
let files = this.el.nativeElement.files;
|
||||||
|
this.onFilesAdded.emit(files);
|
||||||
|
}
|
||||||
|
}
|
40
ng2-components/ng2-alfresco-upload/src/models/file.model.d.ts
vendored
Normal file
40
ng2-components/ng2-alfresco-upload/src/models/file.model.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* @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 FileModel {
|
||||||
|
id: string;
|
||||||
|
status: number;
|
||||||
|
statusText: string;
|
||||||
|
progress: Object;
|
||||||
|
name: string;
|
||||||
|
size: string;
|
||||||
|
response: string;
|
||||||
|
done: boolean;
|
||||||
|
error: boolean;
|
||||||
|
abort: boolean;
|
||||||
|
uploading: boolean;
|
||||||
|
file: any;
|
||||||
|
_xmlHttpRequest: XMLHttpRequest;
|
||||||
|
constructor(file: any);
|
||||||
|
setProgres(progress: any): void;
|
||||||
|
setError(): void;
|
||||||
|
setUploading(): void;
|
||||||
|
setXMLHttpRequest(xmlHttpRequest: XMLHttpRequest): void;
|
||||||
|
setAbort(): void;
|
||||||
|
onFinished(status: number, statusText: string, response: string): void;
|
||||||
|
private _getFileSize(sizeinbytes);
|
||||||
|
private _generateId();
|
||||||
|
}
|
88
ng2-components/ng2-alfresco-upload/src/models/file.model.js
Normal file
88
ng2-components/ng2-alfresco-upload/src/models/file.model.js
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
/**
|
||||||
|
* @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 FileModel;
|
||||||
|
return {
|
||||||
|
setters:[],
|
||||||
|
execute: function() {
|
||||||
|
FileModel = (function () {
|
||||||
|
function FileModel(file) {
|
||||||
|
this.done = false;
|
||||||
|
this.error = false;
|
||||||
|
this.abort = false;
|
||||||
|
this.uploading = false;
|
||||||
|
this.file = file;
|
||||||
|
this.id = this._generateId();
|
||||||
|
this.name = file.name;
|
||||||
|
this.size = this._getFileSize(file.size);
|
||||||
|
this.progress = {
|
||||||
|
loaded: 0,
|
||||||
|
total: 0,
|
||||||
|
percent: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
FileModel.prototype.setProgres = function (progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
};
|
||||||
|
FileModel.prototype.setError = function () {
|
||||||
|
this.error = true;
|
||||||
|
};
|
||||||
|
FileModel.prototype.setUploading = function () {
|
||||||
|
this.uploading = true;
|
||||||
|
};
|
||||||
|
FileModel.prototype.setXMLHttpRequest = function (xmlHttpRequest) {
|
||||||
|
this._xmlHttpRequest = xmlHttpRequest;
|
||||||
|
};
|
||||||
|
FileModel.prototype.setAbort = function () {
|
||||||
|
if (!this.done && !this.error) {
|
||||||
|
this.abort = true;
|
||||||
|
this.uploading = false;
|
||||||
|
this._xmlHttpRequest.abort();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
FileModel.prototype.onFinished = function (status, statusText, response) {
|
||||||
|
this.status = status;
|
||||||
|
this.statusText = statusText;
|
||||||
|
this.response = response;
|
||||||
|
this.done = true;
|
||||||
|
this.uploading = false;
|
||||||
|
};
|
||||||
|
FileModel.prototype._getFileSize = function (sizeinbytes) {
|
||||||
|
var fSExt = new Array('Bytes', 'KB', 'MB', 'GB');
|
||||||
|
var size = sizeinbytes;
|
||||||
|
var i = 0;
|
||||||
|
while (size > 900) {
|
||||||
|
size /= 1000;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return Math.round((Math.round(size * 100) / 100)) + ' ' + fSExt[i];
|
||||||
|
};
|
||||||
|
FileModel.prototype._generateId = function () {
|
||||||
|
return 'uploading-' + 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return FileModel;
|
||||||
|
}());
|
||||||
|
exports_1("FileModel", FileModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=file.model.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file.model.js","sourceRoot":"","sources":["file.model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;YAGH;gBAeI,mBAAY,IAAQ;oBAPpB,SAAI,GAAW,KAAK,CAAC;oBACrB,UAAK,GAAW,KAAK,CAAC;oBACtB,UAAK,GAAW,KAAK,CAAC;oBACtB,cAAS,GAAW,KAAK,CAAC;oBAKtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;oBACjB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;oBAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;oBACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACzC,IAAI,CAAC,QAAQ,GAAG;wBACZ,MAAM,EAAE,CAAC;wBACT,KAAK,EAAE,CAAC;wBACR,OAAO,EAAE,CAAC;qBACb,CAAC;gBACN,CAAC;gBAED,8BAAU,GAAV,UAAW,QAAY;oBACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC7B,CAAC;gBAED,4BAAQ,GAAR;oBACI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;gBACtB,CAAC;gBAED,gCAAY,GAAZ;oBACI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBAC1B,CAAC;gBAED,qCAAiB,GAAjB,UAAkB,cAA6B;oBAC3C,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;gBAC1C,CAAC;gBAED,4BAAQ,GAAR;oBACI,EAAE,CAAA,CAAC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AAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;wBACnE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAC1B,CAAC,CAAC,CAAC;gBACX,CAAC;gBACL,gBAAC;YAAD,CAAC,AA5ED,IA4EC;YA5ED,iCA4EC,CAAA"}
|
95
ng2-components/ng2-alfresco-upload/src/models/file.model.ts
Normal file
95
ng2-components/ng2-alfresco-upload/src/models/file.model.ts
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
/**
|
||||||
|
* @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 FileModel {
|
||||||
|
id:string;
|
||||||
|
status:number;
|
||||||
|
statusText:string;
|
||||||
|
progress:Object;
|
||||||
|
name:string;
|
||||||
|
size:string;
|
||||||
|
response:string;
|
||||||
|
done:boolean = false;
|
||||||
|
error:boolean = false;
|
||||||
|
abort:boolean = false;
|
||||||
|
uploading:boolean = false;
|
||||||
|
file:any;
|
||||||
|
_xmlHttpRequest:XMLHttpRequest;
|
||||||
|
|
||||||
|
constructor(file:any) {
|
||||||
|
this.file = file;
|
||||||
|
this.id = this._generateId();
|
||||||
|
this.name = file.name;
|
||||||
|
this.size = this._getFileSize(file.size);
|
||||||
|
this.progress = {
|
||||||
|
loaded: 0,
|
||||||
|
total: 0,
|
||||||
|
percent: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
setProgres(progress:any):void {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
setError():void {
|
||||||
|
this.error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setUploading(){
|
||||||
|
this.uploading = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setXMLHttpRequest(xmlHttpRequest:XMLHttpRequest){
|
||||||
|
this._xmlHttpRequest = xmlHttpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
setAbort():void {
|
||||||
|
if(!this.done && !this.error){
|
||||||
|
this.abort = true;
|
||||||
|
this.uploading = false;
|
||||||
|
this._xmlHttpRequest.abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onFinished(status:number, statusText:string, response:string):void {
|
||||||
|
this.status = status;
|
||||||
|
this.statusText = statusText;
|
||||||
|
this.response = response;
|
||||||
|
this.done = true;
|
||||||
|
this.uploading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getFileSize(sizeinbytes):string {
|
||||||
|
let fSExt = new Array('Bytes', 'KB', 'MB', 'GB');
|
||||||
|
let size = sizeinbytes;
|
||||||
|
let i = 0;
|
||||||
|
while (size > 900) {
|
||||||
|
size /= 1000;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return Math.round((Math.round(size * 100) / 100)) + ' ' + fSExt[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
private _generateId():string {
|
||||||
|
return 'uploading-' + 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
let r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||||
|
return v.toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
33
ng2-components/ng2-alfresco-upload/src/services/upload.service.d.ts
vendored
Normal file
33
ng2-components/ng2-alfresco-upload/src/services/upload.service.d.ts
vendored
Normal file
@@ -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.
|
||||||
|
*/
|
||||||
|
import { FileModel } from '../models/file.model';
|
||||||
|
export declare class UploadService {
|
||||||
|
private _url;
|
||||||
|
private _method;
|
||||||
|
private _authTokenPrefix;
|
||||||
|
private _authToken;
|
||||||
|
private _fieldName;
|
||||||
|
private _formFields;
|
||||||
|
private _withCredentials;
|
||||||
|
_queue: FileModel[];
|
||||||
|
constructor(options: any);
|
||||||
|
addToQueue(files: any[]): FileModel[];
|
||||||
|
private _uploadFilesInTheQueue();
|
||||||
|
uploadFile(uploadingFileModel: any): void;
|
||||||
|
getQueue(): FileModel[];
|
||||||
|
private _isFile(file);
|
||||||
|
}
|
@@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* @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(['../models/file.model'], function(exports_1, context_1) {
|
||||||
|
"use strict";
|
||||||
|
var __moduleName = context_1 && context_1.id;
|
||||||
|
var file_model_1;
|
||||||
|
var UploadService;
|
||||||
|
return {
|
||||||
|
setters:[
|
||||||
|
function (file_model_1_1) {
|
||||||
|
file_model_1 = file_model_1_1;
|
||||||
|
}],
|
||||||
|
execute: function() {
|
||||||
|
UploadService = (function () {
|
||||||
|
function UploadService(options) {
|
||||||
|
this._method = 'POST';
|
||||||
|
this._authTokenPrefix = 'Basic';
|
||||||
|
this._authToken = undefined;
|
||||||
|
this._fieldName = 'file';
|
||||||
|
this._formFields = {};
|
||||||
|
this._queue = [];
|
||||||
|
console.log('UploadService constructor');
|
||||||
|
this._withCredentials = options.withCredentials != null ? options.withCredentials : this._withCredentials;
|
||||||
|
this._url = options.url != null ? options.url : this._url;
|
||||||
|
this._authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this._authTokenPrefix;
|
||||||
|
this._authToken = options.authToken != null ? options.authToken : this._authToken;
|
||||||
|
this._fieldName = options.fieldName != null ? options.fieldName : this._fieldName;
|
||||||
|
this._formFields = options.formFields != null ? options.formFields : this._formFields;
|
||||||
|
}
|
||||||
|
UploadService.prototype.addToQueue = function (files) {
|
||||||
|
var latestFilesAdded = [];
|
||||||
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
||||||
|
var file = files_1[_i];
|
||||||
|
if (this._isFile(file)) {
|
||||||
|
var uploadingFileModel = new file_model_1.FileModel(file);
|
||||||
|
latestFilesAdded.push(uploadingFileModel);
|
||||||
|
this._queue.push(uploadingFileModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._uploadFilesInTheQueue();
|
||||||
|
return latestFilesAdded;
|
||||||
|
};
|
||||||
|
UploadService.prototype._uploadFilesInTheQueue = function () {
|
||||||
|
var _this = this;
|
||||||
|
var filesToUpload = this._queue.filter(function (uploadingFileModel) {
|
||||||
|
return !uploadingFileModel.uploading && !uploadingFileModel.done && !uploadingFileModel.abort && !uploadingFileModel.error;
|
||||||
|
});
|
||||||
|
filesToUpload.forEach(function (uploadingFileModel) {
|
||||||
|
uploadingFileModel.setUploading();
|
||||||
|
_this.uploadFile(uploadingFileModel);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
;
|
||||||
|
UploadService.prototype.uploadFile = function (uploadingFileModel) {
|
||||||
|
var _this = this;
|
||||||
|
var form = new FormData();
|
||||||
|
form.append(this._fieldName, uploadingFileModel.file, uploadingFileModel.name);
|
||||||
|
Object.keys(this._formFields).forEach(function (key) {
|
||||||
|
form.append(key, _this._formFields[key]);
|
||||||
|
});
|
||||||
|
var xmlHttpRequest = new XMLHttpRequest();
|
||||||
|
uploadingFileModel.setXMLHttpRequest(xmlHttpRequest);
|
||||||
|
xmlHttpRequest.upload.onprogress = function (e) {
|
||||||
|
if (e.lengthComputable) {
|
||||||
|
var percent = Math.round(e.loaded / e.total * 100);
|
||||||
|
uploadingFileModel.setProgres({
|
||||||
|
total: e.total,
|
||||||
|
loaded: e.loaded,
|
||||||
|
percent: percent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xmlHttpRequest.upload.onabort = function (e) {
|
||||||
|
uploadingFileModel.setAbort();
|
||||||
|
};
|
||||||
|
xmlHttpRequest.upload.onerror = function (e) {
|
||||||
|
uploadingFileModel.setError();
|
||||||
|
};
|
||||||
|
xmlHttpRequest.onreadystatechange = function () {
|
||||||
|
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||||
|
uploadingFileModel.onFinished(xmlHttpRequest.status, xmlHttpRequest.statusText, xmlHttpRequest.response);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xmlHttpRequest.open(this._method, this._url, true);
|
||||||
|
xmlHttpRequest.withCredentials = this._withCredentials;
|
||||||
|
if (this._authToken) {
|
||||||
|
xmlHttpRequest.setRequestHeader('Authorization', this._authTokenPrefix + " " + this._authToken);
|
||||||
|
}
|
||||||
|
xmlHttpRequest.send(form);
|
||||||
|
};
|
||||||
|
UploadService.prototype.getQueue = function () {
|
||||||
|
return this._queue;
|
||||||
|
};
|
||||||
|
UploadService.prototype._isFile = function (file) {
|
||||||
|
return file !== null && (file instanceof Blob || (file.name && file.size));
|
||||||
|
};
|
||||||
|
return UploadService;
|
||||||
|
}());
|
||||||
|
exports_1("UploadService", UploadService);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=upload.service.js.map
|
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"upload.service.js","sourceRoot":"","sources":["upload.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;YAKH;gBAWI,uBAAY,OAAW;oBATf,YAAO,GAAU,MAAM,CAAC;oBACxB,qBAAgB,GAAU,OAAO,CAAC;oBAClC,eAAU,GAAU,SAAS,CAAC;oBAC9B,eAAU,GAAU,MAAM,CAAC;oBAC3B,gBAAW,GAAU,EAAE,CAAC;oBAGhC,WAAM,GAAe,EAAE,CAAC;oBAGpB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;oBAEzC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBAC1G,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC;oBAC1D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBAC1G,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,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AAkB,GAAG;wBAChC,EAAE,CAAC,CAAC,cAAc,CAAC,UAAU,KAAK,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;4BACpD,kBAAkB,CAAC,UAAU,CACzB,cAAc,CAAC,MAAM,EACrB,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,QAAQ,CAC1B,CAAC;wBACN,CAAC;oBACL,CAAC,CAAC;oBAEF,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBACnD,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBAEvD,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;wBAClB,cAAc,CAAC,gBAAgB,CAAC,eAAe,EAAK,IAAI,CAAC,gBAAgB,SAAI,IAAI,CAAC,UAAY,CAAC,CAAC;oBACpG,CAAC;oBAED,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC;gBAED,gCAAQ,GAAR;oBACI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;gBACvB,CAAC;gBAEO,+BAAO,GAAf,UAAgB,IAAQ;oBACpB,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/E,CAAC;gBACL,oBAAC;YAAD,CAAC,AAvGD,IAuGC;YAvGD,yCAuGC,CAAA"}
|
@@ -0,0 +1,124 @@
|
|||||||
|
/**
|
||||||
|
* @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 {FileModel} from '../models/file.model';
|
||||||
|
|
||||||
|
export class UploadService {
|
||||||
|
private _url:string;
|
||||||
|
private _method:string = 'POST';
|
||||||
|
private _authTokenPrefix:string = 'Basic';
|
||||||
|
private _authToken:string = undefined;
|
||||||
|
private _fieldName:string = 'file';
|
||||||
|
private _formFields:Object = {};
|
||||||
|
private _withCredentials:boolean;
|
||||||
|
|
||||||
|
_queue:FileModel[] = [];
|
||||||
|
|
||||||
|
constructor(options:any) {
|
||||||
|
console.log('UploadService constructor');
|
||||||
|
|
||||||
|
this._withCredentials = options.withCredentials != null ? options.withCredentials : this._withCredentials;
|
||||||
|
this._url = options.url != null ? options.url : this._url;
|
||||||
|
this._authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this._authTokenPrefix;
|
||||||
|
this._authToken = options.authToken != null ? options.authToken : this._authToken;
|
||||||
|
this._fieldName = options.fieldName != null ? options.fieldName : this._fieldName;
|
||||||
|
this._formFields = options.formFields != null ? options.formFields : this._formFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
addToQueue(files:any[]):FileModel[] {
|
||||||
|
let latestFilesAdded:FileModel[] = [];
|
||||||
|
|
||||||
|
for (let file of files) {
|
||||||
|
if (this._isFile(file)) {
|
||||||
|
let uploadingFileModel = new FileModel(file)
|
||||||
|
latestFilesAdded.push(uploadingFileModel)
|
||||||
|
this._queue.push(uploadingFileModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._uploadFilesInTheQueue();
|
||||||
|
|
||||||
|
return latestFilesAdded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _uploadFilesInTheQueue():void {
|
||||||
|
let filesToUpload = this._queue.filter((uploadingFileModel) => {
|
||||||
|
return !uploadingFileModel.uploading && !uploadingFileModel.done && !uploadingFileModel.abort && !uploadingFileModel.error;
|
||||||
|
});
|
||||||
|
filesToUpload.forEach((uploadingFileModel) => {
|
||||||
|
uploadingFileModel.setUploading();
|
||||||
|
this.uploadFile(uploadingFileModel);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
uploadFile(uploadingFileModel:any):void {
|
||||||
|
let form = new FormData();
|
||||||
|
form.append(this._fieldName, uploadingFileModel.file, uploadingFileModel.name);
|
||||||
|
Object.keys(this._formFields).forEach((key) => {
|
||||||
|
form.append(key, this._formFields[key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
let xmlHttpRequest = new XMLHttpRequest();
|
||||||
|
uploadingFileModel.setXMLHttpRequest(xmlHttpRequest);
|
||||||
|
|
||||||
|
xmlHttpRequest.upload.onprogress = (e) => {
|
||||||
|
if (e.lengthComputable) {
|
||||||
|
let percent = Math.round(e.loaded / e.total * 100);
|
||||||
|
uploadingFileModel.setProgres({
|
||||||
|
total: e.total,
|
||||||
|
loaded: e.loaded,
|
||||||
|
percent: percent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xmlHttpRequest.upload.onabort = (e) => {
|
||||||
|
uploadingFileModel.setAbort();
|
||||||
|
};
|
||||||
|
|
||||||
|
xmlHttpRequest.upload.onerror = (e) => {
|
||||||
|
uploadingFileModel.setError();
|
||||||
|
};
|
||||||
|
|
||||||
|
xmlHttpRequest.onreadystatechange = () => {
|
||||||
|
if (xmlHttpRequest.readyState === XMLHttpRequest.DONE) {
|
||||||
|
uploadingFileModel.onFinished(
|
||||||
|
xmlHttpRequest.status,
|
||||||
|
xmlHttpRequest.statusText,
|
||||||
|
xmlHttpRequest.response
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
xmlHttpRequest.open(this._method, this._url, true);
|
||||||
|
xmlHttpRequest.withCredentials = this._withCredentials;
|
||||||
|
|
||||||
|
if (this._authToken) {
|
||||||
|
xmlHttpRequest.setRequestHeader('Authorization', `${this._authTokenPrefix} ${this._authToken}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlHttpRequest.send(form);
|
||||||
|
}
|
||||||
|
|
||||||
|
getQueue():FileModel[] {
|
||||||
|
return this._queue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _isFile(file:any):boolean {
|
||||||
|
return file !== null && (file instanceof Blob || (file.name && file.size));
|
||||||
|
}
|
||||||
|
}
|
53
ng2-components/ng2-alfresco-upload/tests-runner.html
Normal file
53
ng2-components/ng2-alfresco-upload/tests-runner.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
||||||
|
<title>Alfresco Login component Tests</title>
|
||||||
|
<link rel="stylesheet" href="node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
|
||||||
|
<script src="node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
|
||||||
|
<script src="node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
|
||||||
|
<script src="node_modules/jasmine-core/lib/jasmine-core/boot.js"></script>
|
||||||
|
|
||||||
|
<!-- #1. add the system.js library -->
|
||||||
|
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
|
||||||
|
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
|
||||||
|
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
|
||||||
|
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
|
||||||
|
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||||
|
<script src="node_modules/rxjs/bundles/Rx.js"></script>
|
||||||
|
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
|
||||||
|
|
||||||
|
<script src="node_modules/angular2/bundles/http.dev.js"></script>
|
||||||
|
<script src="node_modules/angular2/bundles/router.dev.js"></script>
|
||||||
|
<script src="node_modules/angular2/bundles/testing.dev.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// #2. Configure systemjs to use the .js extension
|
||||||
|
// for imports from the app folder
|
||||||
|
System.config({
|
||||||
|
packages: {
|
||||||
|
'src': {defaultExtension: 'js'}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// #3. Import the spec file explicitly
|
||||||
|
Promise.all([
|
||||||
|
System.import('src/authentication.service.spec'),
|
||||||
|
System.import('src/upload.component.spec')
|
||||||
|
])
|
||||||
|
// #4. wait for all imports to load ...
|
||||||
|
// then re-execute `window.onload` which
|
||||||
|
// triggers the Jasmine test-runner start
|
||||||
|
// or explain what went wrong.
|
||||||
|
.then(window.onload)
|
||||||
|
.catch(console.error.bind(console));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Unit Testing Chapter #1: Proof of life. -->
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
18
ng2-components/ng2-alfresco-upload/tsconfig.json
Normal file
18
ng2-components/ng2-alfresco-upload/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"module": "system",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"sourceMap": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"removeComments": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"typings/main",
|
||||||
|
"typings/main.d.ts"
|
||||||
|
]
|
||||||
|
}
|
122
ng2-components/ng2-alfresco-upload/tslint.json
Normal file
122
ng2-components/ng2-alfresco-upload/tslint.json
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"align": [
|
||||||
|
true,
|
||||||
|
"parameters",
|
||||||
|
"arguments",
|
||||||
|
"statements"
|
||||||
|
],
|
||||||
|
"ban": false,
|
||||||
|
"class-name": true,
|
||||||
|
"comment-format": [
|
||||||
|
true,
|
||||||
|
"check-space",
|
||||||
|
"check-lowercase"
|
||||||
|
],
|
||||||
|
"curly": true,
|
||||||
|
"eofline": true,
|
||||||
|
"forin": true,
|
||||||
|
"indent": [
|
||||||
|
true,
|
||||||
|
"spaces"
|
||||||
|
],
|
||||||
|
"interface-name": false,
|
||||||
|
"jsdoc-format": true,
|
||||||
|
"label-position": true,
|
||||||
|
"label-undefined": true,
|
||||||
|
"max-line-length": [
|
||||||
|
true,
|
||||||
|
140
|
||||||
|
],
|
||||||
|
"member-ordering": [
|
||||||
|
true,
|
||||||
|
"public-before-private",
|
||||||
|
"static-before-instance",
|
||||||
|
"variables-before-functions"
|
||||||
|
],
|
||||||
|
"no-any": false,
|
||||||
|
"no-arg": true,
|
||||||
|
"no-bitwise": true,
|
||||||
|
"no-conditional-assignment": true,
|
||||||
|
"no-consecutive-blank-lines": false,
|
||||||
|
"no-console": [
|
||||||
|
true,
|
||||||
|
"debug",
|
||||||
|
"info",
|
||||||
|
"time",
|
||||||
|
"timeEnd",
|
||||||
|
"trace"
|
||||||
|
],
|
||||||
|
"no-construct": true,
|
||||||
|
"no-constructor-vars": false,
|
||||||
|
"no-debugger": true,
|
||||||
|
"no-duplicate-key": true,
|
||||||
|
"no-duplicate-variable": true,
|
||||||
|
"no-empty": true,
|
||||||
|
"no-eval": true,
|
||||||
|
"no-inferrable-types": false,
|
||||||
|
"no-internal-module": true,
|
||||||
|
"no-require-imports": true,
|
||||||
|
"no-shadowed-variable": true,
|
||||||
|
"no-switch-case-fall-through": true,
|
||||||
|
"no-trailing-whitespace": true,
|
||||||
|
"no-unreachable": true,
|
||||||
|
"no-unused-expression": true,
|
||||||
|
"no-unused-variable": true,
|
||||||
|
"no-use-before-declare": true,
|
||||||
|
"no-var-keyword": true,
|
||||||
|
"no-var-requires": true,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"one-line": [
|
||||||
|
true,
|
||||||
|
"check-open-brace",
|
||||||
|
"check-catch",
|
||||||
|
"check-else",
|
||||||
|
"check-whitespace"
|
||||||
|
],
|
||||||
|
"quotemark": [
|
||||||
|
true,
|
||||||
|
"single",
|
||||||
|
"avoid-escape"
|
||||||
|
],
|
||||||
|
"radix": true,
|
||||||
|
"semicolon": true,
|
||||||
|
"switch-default": true,
|
||||||
|
"trailing-comma": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"multiline": "never",
|
||||||
|
"singleline": "never"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"triple-equals": [
|
||||||
|
true,
|
||||||
|
"allow-null-check"
|
||||||
|
],
|
||||||
|
"typedef": false,
|
||||||
|
"typedef-whitespace": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"call-signature": "nospace",
|
||||||
|
"index-signature": "nospace",
|
||||||
|
"parameter": "nospace",
|
||||||
|
"property-declaration": "nospace",
|
||||||
|
"variable-declaration": "nospace"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"use-strict": false,
|
||||||
|
"variable-name": [
|
||||||
|
true,
|
||||||
|
"check-format",
|
||||||
|
"allow-leading-underscore",
|
||||||
|
"ban-keywords"
|
||||||
|
],
|
||||||
|
"whitespace": [
|
||||||
|
true,
|
||||||
|
"check-branch",
|
||||||
|
"check-decl",
|
||||||
|
"check-operator",
|
||||||
|
"check-separator"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
6
ng2-components/ng2-alfresco-upload/typings.json
Normal file
6
ng2-components/ng2-alfresco-upload/typings.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"ambientDependencies": {
|
||||||
|
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
|
||||||
|
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b"
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user