This commit is contained in:
Mario Romano
2016-05-19 02:09:40 +01:00
parent dde61f2302
commit 337f00999d
46 changed files with 526 additions and 667 deletions

View File

@@ -15,17 +15,17 @@
* limitations under the License.
*/
import {Component} from 'angular2/core';
import { Component } from 'angular2/core';
import {
DOCUMENT_LIST_DIRECTIVES,
DOCUMENT_LIST_PROVIDERS,
DocumentActionsService
} from 'ng2-alfresco-documentlist/ng2-alfresco-documentlist';
import {MDL} from 'ng2-alfresco-core/material';
import {ALFRESCO_ULPOAD_COMPONENT} from 'ng2-alfresco-upload/ng2-alfresco-upload';
import {TranslatePipe} from 'ng2-translate/ng2-translate';
import { MDL } from 'ng2-alfresco-core/material';
import { ALFRESCO_ULPOAD_COMPONENT } from 'ng2-alfresco-upload/ng2-alfresco-upload';
import { TranslatePipe } from 'ng2-translate/ng2-translate';
declare let __moduleName:string;
declare let __moduleName: string;
@Component({
moduleId: __moduleName,
@@ -68,7 +68,7 @@ export class FilesComponent {
}
getRelativeDirectory(currentFolderPath: string): string {
if(currentFolderPath.indexOf('/Sites/swsdp/documentLibrary/') !=-1) {
if (currentFolderPath.indexOf('/Sites/swsdp/documentLibrary/') != -1) {
return currentFolderPath.replace('/Sites/swsdp/documentLibrary/', '')
} else {
return currentFolderPath.replace('/Sites/swsdp/documentLibrary', '')

View File

@@ -15,15 +15,15 @@
* limitations under the License.
*/
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http';
import {TranslateLoader, TranslateService} from 'ng2-translate/ng2-translate';
import {ALFRESCO_AUTHENTICATION} from 'ng2-alfresco-login/ng2-alfresco-login';
import {ALFRESCO_CORE_PROVIDERS} from 'ng2-alfresco-core/services';
import {AlfrescoTranslationLoader} from 'ng2-alfresco-core/services';
import {provide} from 'angular2/core';
import { bootstrap } from 'angular2/platform/browser';
import { AppComponent } from './app.component';
import { ROUTER_PROVIDERS } from 'angular2/router';
import { HTTP_PROVIDERS } from 'angular2/http';
import { TranslateLoader, TranslateService } from 'ng2-translate/ng2-translate';
import { ALFRESCO_AUTHENTICATION } from 'ng2-alfresco-login/ng2-alfresco-login';
import { ALFRESCO_CORE_PROVIDERS } from 'ng2-alfresco-core/services';
import { AlfrescoTranslationLoader } from 'ng2-alfresco-core/services';
import { provide } from 'angular2/core';
bootstrap(AppComponent, [
ROUTER_PROVIDERS,

View File

@@ -7,6 +7,7 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
material.js
material.js.map
@@ -17,3 +18,7 @@ services.js
services.js.map
services/**/*.js
services/**/*.js.map
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts

View File

@@ -12,9 +12,10 @@
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",

View File

@@ -12,9 +12,10 @@
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",

View File

@@ -7,5 +7,9 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
ng2-alfresco-documentlist.js
ng2-alfresco-documentlist.js.map

View File

@@ -12,9 +12,10 @@
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",

View File

@@ -7,5 +7,9 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
ng2-alfresco-login.js
ng2-alfresco-login.js.map

View File

@@ -0,0 +1,5 @@
node_modules
.idea
coverage
dist
typings

View File

@@ -0,0 +1,6 @@
node_modules
.idea
coverage
src
typings
typings.json

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Raúl Jiménez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,13 @@
# angular2-testing
Install:
```
npm install
```
Run the project:
```
npm start
```

View File

@@ -1,10 +0,0 @@
import { Router } from 'angular2/router';
import { AlfrescoSettingsService } from 'ng2-alfresco-core/services';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-login/ng2-alfresco-login';
export declare class AppComponent {
auth: AlfrescoAuthenticationService;
router: Router;
constructor(auth: AlfrescoAuthenticationService, router: Router, alfrescoSettingsService: AlfrescoSettingsService);
mySuccessMethod($event: any): void;
myErrorMethod($event: any): void;
}

View File

@@ -1,77 +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.
*/
System.register(['angular2/core', 'ng2-alfresco-login/ng2-alfresco-login', 'angular2/router', 'ng2-alfresco-core/services'], 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, ng2_alfresco_login_1, router_1, services_1, ng2_alfresco_login_2;
var AppComponent;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
},
function (ng2_alfresco_login_1_1) {
ng2_alfresco_login_1 = ng2_alfresco_login_1_1;
ng2_alfresco_login_2 = ng2_alfresco_login_1_1;
},
function (router_1_1) {
router_1 = router_1_1;
},
function (services_1_1) {
services_1 = services_1_1;
}],
execute: function() {
AppComponent = (function () {
function AppComponent(auth, router, alfrescoSettingsService) {
this.auth = auth;
this.router = router;
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
}
AppComponent.prototype.mySuccessMethod = function ($event) {
console.log('Success Login EventEmitt called with: ' + $event.value);
};
AppComponent.prototype.myErrorMethod = function ($event) {
console.log('Error Login EventEmitt called with: ' + $event.value);
};
AppComponent = __decorate([
core_1.Component({
selector: 'my-app',
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
directives: [router_1.ROUTER_DIRECTIVES, ng2_alfresco_login_1.AlfrescoLoginComponent]
}),
router_1.RouteConfig([
{ path: '/', name: 'Login', component: ng2_alfresco_login_1.AlfrescoLoginComponent, useAsDefault: true }
]),
__metadata('design:paramtypes', [(typeof (_a = typeof ng2_alfresco_login_2.AlfrescoAuthenticationService !== 'undefined' && ng2_alfresco_login_2.AlfrescoAuthenticationService) === 'function' && _a) || Object, router_1.Router, (typeof (_b = typeof services_1.AlfrescoSettingsService !== 'undefined' && services_1.AlfrescoSettingsService) === 'function' && _b) || Object])
], AppComponent);
return AppComponent;
var _a, _b;
}());
exports_1("AppComponent", AppComponent);
}
}
});
//# sourceMappingURL=app.component.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkBH;gBAEI,sBAAmB,IAAkC,EAClC,MAAa,EACpB,uBAA+C;oBAFxC,SAAI,GAAJ,IAAI,CAA8B;oBAClC,WAAM,GAAN,MAAM,CAAO;oBAE5B,uBAAuB,CAAC,IAAI,GAAG,4BAA4B,CAAC;gBAEhE,CAAC;gBAED,sCAAe,GAAf,UAAgB,MAAM;oBAClB,OAAO,CAAC,GAAG,CAAC,wCAAwC,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACvE,CAAC;gBAED,oCAAa,GAAb,UAAc,MAAM;oBAChB,OAAO,CAAC,GAAG,CAAC,sCAAsC,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACrE,CAAC;gBAxBL;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,QAAQ;wBAClB,QAAQ,EAAE,yHAAyH;wBACnI,UAAU,EAAE,CAAC,0BAAiB,EAAE,2CAAsB,CAAC;qBAC1D,CAAC;oBAED,oBAAW,CAAC;wBACT,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,2CAAsB,EAAE,YAAY,EAAE,IAAI,EAAC;qBACpF,CAAC;;gCAAA;gBAkBF,mBAAC;;YAAD,CAAC,AAjBD,IAiBC;YAjBD,uCAiBC,CAAA"}

View File

@@ -1,2 +0,0 @@
export declare class HomeComponent {
}

View File

@@ -1,53 +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.
*/
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 HomeComponent;
return {
setters:[
function (core_1_1) {
core_1 = core_1_1;
}],
execute: function() {
HomeComponent = (function () {
function HomeComponent() {
}
HomeComponent = __decorate([
core_1.Component({
selector: 'home',
template: 'Welcome'
}),
__metadata('design:paramtypes', [])
], HomeComponent);
return HomeComponent;
}());
exports_1("HomeComponent", HomeComponent);
}
}
});
//# sourceMappingURL=home.component.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"home.component.js","sourceRoot":"","sources":["home.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;YASH;gBAAA;gBAEA,CAAC;gBAPD;oBAAC,gBAAS,CAAC;wBACP,QAAQ,EAAE,MAAM;wBAChB,QAAQ,EAAE,SAAS;qBACtB,CAAC;;iCAAA;gBAIF,oBAAC;YAAD,CAAC,AAFD,IAEC;YAFD,yCAEC,CAAA"}

View File

@@ -1,178 +0,0 @@
/* This work is licensed under Creative Commons GNU LGPL License.
License: http://creativecommons.org/licenses/LGPL/2.1/
Version: 0.9
Author: Stefan Goessner/2006
Web: http://goessner.net/
*/
var parseXml;
if (typeof window.DOMParser != "undefined") {
parseXml = function(xmlStr) {
return ( new window.DOMParser() ).parseFromString(xmlStr, "text/xml");
};
} else if (typeof window.ActiveXObject != "undefined" &&
new window.ActiveXObject("Microsoft.XMLDOM")) {
parseXml = function(xmlStr) {
var xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlStr);
return xmlDoc;
};
} else {
throw new Error("No XML parser found");
}
function xml2json(xml, tab) {
var X = {
toObj: function(xml) {
var o = {};
if (xml.nodeType==1) { // element node ..
if (xml.attributes.length) // element with attributes ..
for (var i=0; i<xml.attributes.length; i++)
o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString();
if (xml.firstChild) { // element has child nodes ..
var textChild=0, cdataChild=0, hasElementChild=false;
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType==1) hasElementChild = true;
else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; // non-whitespace text
else if (n.nodeType==4) cdataChild++; // cdata section node
}
if (hasElementChild) {
if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
X.removeWhite(xml);
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType == 3) // text node
o["#text"] = X.escape(n.nodeValue);
else if (n.nodeType == 4) // cdata node
o["#cdata"] = X.escape(n.nodeValue);
else if (o[n.nodeName]) { // multiple occurence of element ..
if (o[n.nodeName] instanceof Array)
o[n.nodeName][o[n.nodeName].length] = X.toObj(n);
else
o[n.nodeName] = [o[n.nodeName], X.toObj(n)];
}
else // first occurence of element..
o[n.nodeName] = X.toObj(n);
}
}
else { // mixed content
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
}
else if (textChild) { // pure text
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
else if (cdataChild) { // cdata
if (cdataChild > 1)
o = X.escape(X.innerXml(xml));
else
for (var n=xml.firstChild; n; n=n.nextSibling)
o["#cdata"] = X.escape(n.nodeValue);
}
}
if (!xml.attributes.length && !xml.firstChild) o = null;
}
else if (xml.nodeType==9) { // document.node
o = X.toObj(xml.documentElement);
}
else
alert("unhandled node type: " + xml.nodeType);
return o;
},
toJson: function(o, name, ind) {
var json = name ? ("\""+name+"\"") : "";
if (o instanceof Array) {
for (var i=0,n=o.length; i<n; i++)
o[i] = X.toJson(o[i], "", ind+"\t");
json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]";
}
else if (o == null)
json += (name&&":") + "null";
else if (typeof(o) == "object") {
var arr = [];
for (var m in o)
arr[arr.length] = X.toJson(o[m], m, ind+"\t");
json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}";
}
else if (typeof(o) == "string")
json += (name&&":") + "\"" + o.toString() + "\"";
else
json += (name&&":") + o.toString();
return json;
},
innerXml: function(node) {
var s = ""
if ("innerHTML" in node)
s = node.innerHTML;
else {
var asXml = function(n) {
var s = "";
if (n.nodeType == 1) {
s += "<" + n.nodeName;
for (var i=0; i<n.attributes.length;i++)
s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\"";
if (n.firstChild) {
s += ">";
for (var c=n.firstChild; c; c=c.nextSibling)
s += asXml(c);
s += "</"+n.nodeName+">";
}
else
s += "/>";
}
else if (n.nodeType == 3)
s += n.nodeValue;
else if (n.nodeType == 4)
s += "<![CDATA[" + n.nodeValue + "]]>";
return s;
};
for (var c=node.firstChild; c; c=c.nextSibling)
s += asXml(c);
}
return s;
},
escape: function(txt) {
return txt.replace(/[\\]/g, "\\\\")
.replace(/[\"]/g, '\\"')
.replace(/[\n]/g, '\\n')
.replace(/[\r]/g, '\\r');
},
removeWhite: function(e) {
e.normalize();
for (var n = e.firstChild; n; ) {
if (n.nodeType == 3) { // text node
if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
var nxt = n.nextSibling;
e.removeChild(n);
n = nxt;
}
else
n = n.nextSibling;
}
else if (n.nodeType == 1) { // element node
X.removeWhite(n);
n = n.nextSibling;
}
else // any other node
n = n.nextSibling;
}
return e;
}
};
xml = parseXml(xml);
if (xml.nodeType == 9) // document node
xml = xml.documentElement;
var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, "\t");
return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}";
}

View File

@@ -1,64 +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.
*/
System.register(['angular2/platform/browser', './app.component', 'ng2-alfresco-login/ng2-alfresco-login', 'angular2/router', 'angular2/core', 'angular2/http', 'ng2-translate/ng2-translate', 'ng2-alfresco-core/services'], function(exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var browser_1, app_component_1, ng2_alfresco_login_1, router_1, core_1, http_1, http_2, ng2_translate_1, services_1;
return {
setters:[
function (browser_1_1) {
browser_1 = browser_1_1;
},
function (app_component_1_1) {
app_component_1 = app_component_1_1;
},
function (ng2_alfresco_login_1_1) {
ng2_alfresco_login_1 = ng2_alfresco_login_1_1;
},
function (router_1_1) {
router_1 = router_1_1;
},
function (core_1_1) {
core_1 = core_1_1;
},
function (http_1_1) {
http_1 = http_1_1;
http_2 = http_1_1;
},
function (ng2_translate_1_1) {
ng2_translate_1 = ng2_translate_1_1;
},
function (services_1_1) {
services_1 = services_1_1;
}],
execute: function() {
browser_1.bootstrap(app_component_1.AppComponent, [
router_1.ROUTER_PROVIDERS,
http_2.HTTP_PROVIDERS,
core_1.provide(ng2_translate_1.TranslateLoader, {
useFactory: function (http) { return new ng2_translate_1.TranslateStaticLoader(http, 'node_modules/ng2-alfresco-login/i18n', '.json'); },
deps: [http_1.Http]
}),
// use TranslateService here, and not TRANSLATE_PROVIDERS (which will define a default TranslateStaticLoader)
ng2_translate_1.TranslateService,
ng2_alfresco_login_1.ALFRESCO_AUTHENTICATION,
services_1.ALFRESCO_CORE_PROVIDERS
]);
}
}
});
//# sourceMappingURL=main.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAYH,mBAAS,CAAC,4BAAY,EAAE;gBACpB,yBAAgB;gBAChB,qBAAc;gBACd,cAAO,CAAC,+BAAe,EAAE;oBACrB,UAAU,EAAE,UAAC,IAAU,IAAK,OAAA,IAAI,qCAAqB,CAAC,IAAI,EAAE,sCAAsC,EAAE,OAAO,CAAC,EAAhF,CAAgF;oBAC5G,IAAI,EAAE,CAAC,WAAI,CAAC;iBACf,CAAC;gBACF,6GAA6G;gBAC7G,gCAAgB;gBAChB,4CAAuB;gBACvB,kCAAuB;aAC1B,CAAC,CAAC"}

View File

@@ -1,7 +1,8 @@
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Alfresco Login Component Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<title>Angular 2 Testing</title>
<base href="/">
<!-- 1. Load libraries -->
@@ -16,23 +17,19 @@
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script src="/app/js/xml2json.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
defaultJSExtensions: true,
map: {
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core',
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login',
'ng2-translate': 'node_modules/ng2-translate',
'rxjs': 'node_modules/rxjs'
'rxjs': 'node_modules/rxjs',
'angular2' : 'node_modules/angular2',
'app': 'dist/src'
},
packages: {
app: {
'app': {
defaultExtension: 'js'
},
'ng2-alfresco-core': {
@@ -46,16 +43,20 @@
},
'rxjs': {
defaultExtension: 'js'
},
'angular2': {
defaultExtension: 'js'
}
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
System.import('dist/src/my-app').catch(console.log.bind(console));
</script>
</head>
<body>
<my-app>Loading...</my-app>
<my-login></my-login>
</body>
</html>

View File

@@ -1,29 +1,34 @@
{
"name": "angular2-quickstart",
"version": "1.0.0",
"name": "ng2-alfresco-login-demo",
"description": "Alfresco Angular2 Login Component - Demo",
"version": "0.1.0",
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
"postinstall": "npm run typings && npm link ng2-alfresco-login",
"typings": "typings install",
"start": "npm run test && http-server -c-1 -o -p 8875 .",
"build": "rm -rf dist && tsc",
"pretest": "npm install && npm run build"
},
"license": "ISC",
"license": "MIT",
"dependencies": {
"angular2": "2.0.0-beta.16",
"systemjs": "0.19.26",
"es6-shim": "^0.35.0",
"angular2": "2.0.0-beta.13",
"es6-promise": "3.0.2",
"es6-shim": "0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.12",
"ng2-translate": "^1.11.2",
"material-design-lite": "^1.1.3"
"zone.js": "0.6.6",
"ng2-translate": "^1.11.2"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^0.8.1"
}
}
"http-server": "0.8.5",
"systemjs": "0.19.17",
"typescript": "1.7.5",
"typings": "0.6.8"
},
"keywords": [
"angular2",
"typescript"
]
}

View File

@@ -1,3 +1,5 @@
///<reference path="../../node_modules/angular2/typings/browser.d.ts"/>
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
@@ -15,15 +17,15 @@
* limitations under the License.
*/
import {Component} from 'angular2/core';
import {AlfrescoLoginComponent} from 'ng2-alfresco-login/ng2-alfresco-login';
import {Router, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {AlfrescoSettingsService} from 'ng2-alfresco-core/services';
import {AlfrescoAuthenticationService} from 'ng2-alfresco-login/ng2-alfresco-login';
import { Component } from 'angular2/core';
import { AlfrescoLoginComponent } from 'ng2-alfresco-login/ng2-alfresco-login';
import { Router, RouteConfig, ROUTER_DIRECTIVES } from 'angular2/router';
import { AlfrescoSettingsService } from 'ng2-alfresco-core/services';
import { AlfrescoAuthenticationService } from 'ng2-alfresco-login/ng2-alfresco-login';
@Component({
selector: 'my-app',
selector: 'my-login',
template: '<alfresco-login method="POST" (onSuccess)="mySuccessMethod($event)" (onError)="myErrorMethod($event)"></alfresco-login>',
directives: [ROUTER_DIRECTIVES, AlfrescoLoginComponent]
})
@@ -31,21 +33,21 @@ import {AlfrescoAuthenticationService} from 'ng2-alfresco-login/ng2-alfresco-log
@RouteConfig([
{path: '/', name: 'Login', component: AlfrescoLoginComponent, useAsDefault: true}
])
export class AppComponent {
export class MyLoginComponent {
constructor(public auth:AlfrescoAuthenticationService,
public router:Router,
alfrescoSettingsService:AlfrescoSettingsService) {
constructor(public auth: AlfrescoAuthenticationService,
public router: Router,
alfrescoSettingsService: AlfrescoSettingsService) {
alfrescoSettingsService.host = 'http://192.168.99.100:8080';
}
mySuccessMethod($event) {
console.log('Success Login EventEmitt called with: '+$event.value);
console.log('Success Login EventEmitt called with: ' + $event.value);
}
myErrorMethod($event) {
console.log('Error Login EventEmitt called with: '+$event.value);
console.log('Error Login EventEmitt called with: ' + $event.value);
}
}
}

View File

@@ -16,16 +16,16 @@
*/
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
import {MyLoginComponent} from './components/my-login.component';
import {ALFRESCO_AUTHENTICATION} from 'ng2-alfresco-login/ng2-alfresco-login';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {provide} from 'angular2/core';
import {Http} from 'angular2/http';
import {HTTP_PROVIDERS} from 'angular2/http';
import {TRANSLATE_PROVIDERS, TranslateService, TranslateLoader, TranslateStaticLoader} from 'ng2-translate/ng2-translate';
import {TranslateService, TranslateLoader, TranslateStaticLoader} from 'ng2-translate/ng2-translate';
import {ALFRESCO_CORE_PROVIDERS} from 'ng2-alfresco-core/services';
bootstrap(AppComponent, [
bootstrap(MyLoginComponent, [
ROUTER_PROVIDERS,
HTTP_PROVIDERS,
provide(TranslateLoader, {

View File

@@ -1,18 +1,17 @@
{
"compilerOptions": {
"target": "es5",
"module": "system",
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"declaration": true
"sourceMap": true,
"removeComments": true,
"declaration": true,
"outDir": "dist"
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
"typings"
]
}

View File

@@ -1,6 +1,9 @@
{
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b"
}
"name": "angular2-testing",
"dependencies": {},
"devDependencies": {},
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#dd638012d63e069f2c99d06ef4dcc9616a943ee4"
}
}

View File

@@ -75,6 +75,6 @@ module.exports = function (config) {
]
},
singleRun: false
singleRun: true
})
};

View File

@@ -8,13 +8,15 @@
"typings": "typings install",
"start": "npm run test && http-server -c-1 -o -p 8875 .",
"build": "npm run tslint && typings install && rm -rf dist && tsc && npm run copytemplates && license-check",
"tslint": "npm run tslint-test && npm run tslint-src && npm run tslint-root",
"tslint": "npm run tslint-test && npm run tslint-src && npm run tslint-root && npm run tslint-demo",
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-demo": "tslint -c tslint.json demo/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",

View File

@@ -20,154 +20,154 @@ import { Router, ROUTER_DIRECTIVES } from 'angular2/router';
import { FORM_DIRECTIVES, ControlGroup, FormBuilder, Validators } from 'angular2/common';
import { AlfrescoAuthenticationService } from './../services/alfresco-authentication.service';
import { TranslateService, TranslatePipe } from 'ng2-translate/ng2-translate';
declare let componentHandler;
declare let componentHandler: any;
declare let __moduleName: string;
@Component({
selector: 'alfresco-login',
moduleId: __moduleName,
directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],
templateUrl: './alfresco-login.component.html',
styleUrls: ['./alfresco-login.component.css'],
pipes: [TranslatePipe]
selector: 'alfresco-login',
moduleId: __moduleName,
directives: [ROUTER_DIRECTIVES, FORM_DIRECTIVES],
templateUrl: './alfresco-login.component.html',
styleUrls: ['./alfresco-login.component.css'],
pipes: [TranslatePipe]
})
export class AlfrescoLoginComponent {
@Output()
onSuccess = new EventEmitter();
@Output()
onError = new EventEmitter();
translate: TranslateService;
@Output()
onSuccess = new EventEmitter();
@Output()
onError = new EventEmitter();
translate: TranslateService;
form: ControlGroup;
error: boolean = false;
success: boolean = false;
form: ControlGroup;
error: boolean = false;
success: boolean = false;
formError: { [id: string]: string };
formError: { [id: string]: string };
private _message: { [id: string]: { [id: string]: string }
};
/**
* Constructor
* @param _fb
* @param auth
* @param router
*/
constructor(private _fb: FormBuilder,
public auth: AlfrescoAuthenticationService,
public router: Router,
translate: TranslateService) {
this.formError = {
'username': '',
'password': ''
private _message: { [id: string]: { [id: string]: string }
};
this.form = this._fb.group({
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
password: ['', Validators.required]
});
/**
* Constructor
* @param _fb
* @param auth
* @param router
*/
constructor(private _fb: FormBuilder,
public auth: AlfrescoAuthenticationService,
public router: Router,
translate: TranslateService) {
this._message = {
'username': {
'required': 'LOGIN.MESSAGES.USERNAME-REQUIRED',
'minlength': 'LOGIN.MESSAGES.USERNAME-MIN'
},
'password': {
'required': 'LOGIN.MESSAGES.PASSWORD-REQUIRED'
}
};
this.translationInit(translate);
this.formError = {
'username': '',
'password': ''
};
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
this.form = this._fb.group({
username: ['', Validators.compose([Validators.required, Validators.minLength(4)])],
password: ['', Validators.required]
});
this.onValueChanged(null);
}
/**
* Method called on submit form
* @param value
* @param event
*/
onSubmit(value: any, event) {
this.error = false;
if (event) {
event.preventDefault();
}
this.auth.login(value.username, value.password)
.subscribe(
(token: any) => {
try {
this.success = true;
this.onSuccess.emit({
value: 'Login OK'
});
this.router.navigate(['Home']);
} catch (error) {
console.error(error.message);
}
},
(err: any) => {
this.error = true;
this.onError.emit({
value: 'Login KO'
});
console.log(err);
this.success = false;
},
() => console.log('Login done')
);
}
/**
* The method check the error in the form and push the error in the formError object
* @param data
*/
onValueChanged(data: any) {
for (let field in this.formError) {
if (field) {
this.formError[field] = '';
let hasError = this.form.controls[field].errors || (this.form.controls[field].dirty && !this.form.controls[field].valid);
if (hasError) {
for (let key in this.form.controls[field].errors) {
if (key) {
this.formError[field] += this._message[field][key] + '';
this._message = {
'username': {
'required': 'LOGIN.MESSAGES.USERNAME-REQUIRED',
'minlength': 'LOGIN.MESSAGES.USERNAME-MIN'
},
'password': {
'required': 'LOGIN.MESSAGES.PASSWORD-REQUIRED'
}
}
};
this.translationInit(translate);
this.form.valueChanges.subscribe(data => this.onValueChanged(data));
this.onValueChanged(null);
}
/**
* Method called on submit form
* @param value
* @param event
*/
onSubmit(value: any, event) {
this.error = false;
if (event) {
event.preventDefault();
}
}
this.auth.login(value.username, value.password)
.subscribe(
(token: any) => {
try {
this.success = true;
this.onSuccess.emit({
value: 'Login OK'
});
this.router.navigate(['Home']);
} catch (error) {
console.error(error.message);
}
},
(err: any) => {
this.error = true;
this.onError.emit({
value: 'Login KO'
});
console.log(err);
this.success = false;
},
() => console.log('Login done')
);
}
}
/**
* The method return if a field is valid or not
* @param field
* @returns {boolean}
*/
isErrorStyle(field: ControlGroup) {
if (componentHandler) {
componentHandler.upgradeAllRegistered();
/**
* The method check the error in the form and push the error in the formError object
* @param data
*/
onValueChanged(data: any) {
for (let field in this.formError) {
if (field) {
this.formError[field] = '';
let hasError = this.form.controls[field].errors || (this.form.controls[field].dirty && !this.form.controls[field].valid);
if (hasError) {
for (let key in this.form.controls[field].errors) {
if (key) {
this.formError[field] += this._message[field][key] + '';
}
}
}
}
}
}
if (field.valid) {
return false;
} else {
return true;
/**
* The method return if a field is valid or not
* @param field
* @returns {boolean}
*/
isErrorStyle(field: ControlGroup) {
if (typeof componentHandler !== 'undefined') {
componentHandler.upgradeAllRegistered();
}
if (field.valid) {
return false;
} else {
return true;
}
}
}
/**
* Initial configuration for Multi language
* @param translate
*/
translationInit(translate: TranslateService) {
this.translate = translate;
let userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
/**
* Initial configuration for Multi language
* @param translate
*/
translationInit(translate: TranslateService) {
this.translate = translate;
let userLang = navigator.language.split('-')[0]; // use navigator lang if available
userLang = /(fr|en)/gi.test(userLang) ? userLang : 'en';
this.translate.setDefaultLang(userLang);
this.translate.setDefaultLang(userLang);
this.translate.use(userLang);
}
this.translate.use(userLang);
}
}

View File

@@ -7,5 +7,9 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
ng2-alfresco-upload.js
ng2-alfresco-upload.js.map

View File

@@ -0,0 +1,5 @@
node_modules
.idea
coverage
dist
typings

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Raúl Jiménez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,13 @@
# angular2-testing
Install:
```
npm install
```
Run the project:
```
npm start
```

View File

@@ -1,54 +0,0 @@
<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)="onFilesDragged($event)"
dropzone="" webkitdropzone="copy file:image/png file:image/gif file:image/jpeg" #droparea>
<ng-content></ng-content>
</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>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular 2 Upload</title>
<base href="/">
<!-- Google Material Design Lite -->
<link rel="stylesheet" href="node_modules/material-design-lite/material.min.css">
<script src="node_modules/material-design-lite/material.min.js"></script>
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<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/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script>
System.config({
defaultJSExtensions: true,
map: {
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload',
'ng2-translate': 'node_modules/ng2-translate',
'rxjs': 'node_modules/rxjs',
'angular2' : 'node_modules/angular2',
'app': 'dist/src'
},
packages: {
'app': {
defaultExtension: 'js'
},
'ng2-alfresco-core': {
defaultExtension: 'js'
},
'ng2-alfresco-upload': {
defaultExtension: 'js'
},
'ng2-translate': {
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
},
'angular2': {
defaultExtension: 'js'
}
}
});
System.import('dist/src/my-app').catch(console.log.bind(console));
</script>
</head>
<body>
<my-app></my-app>
</body>
</html>

View File

@@ -0,0 +1,35 @@
{
"name": "ng2-alfresco-upload-demo",
"description": "Alfresco Angular2 Upload Component - Demo",
"version": "0.1.0",
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"postinstall": "npm run build && npm run typings && npm link ng2-alfresco-upload && npm link ng2-alfresco-core",
"typings": "typings install",
"start": "rm -rf dist && npm install && http-server -c-1 -o -p 8875 .",
"build": "rm -rf dist && tsc"
},
"license": "MIT",
"dependencies": {
"angular2": "2.0.0-beta.13",
"es6-promise": "3.0.2",
"es6-shim": "0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"zone.js": "0.6.6",
"ng2-translate": "^1.11.2",
"material-design-icons": "^2.2.3",
"material-design-lite": "^1.1.3"
},
"devDependencies": {
"http-server": "0.8.5",
"systemjs": "0.19.17",
"typescript": "1.7.5",
"typings": "0.6.8"
},
"keywords": [
"angular2",
"typescript"
]
}

View File

@@ -1,3 +1,5 @@
///<reference path="../../node_modules/angular2/typings/browser.d.ts"/>
/**
* @license
* Copyright 2016 Alfresco Software, Ltd.
@@ -15,13 +17,18 @@
* limitations under the License.
*/
import {Component} from 'angular2/core';
import { Component } from 'angular2/core';
import { ALFRESCO_ULPOAD_COMPONENT } from 'ng2-alfresco-upload/dist/ng2-alfresco-upload';
@Component({
selector: 'home',
template: 'Welcome'
selector: 'my-demo',
template: `<alfresco-upload-button [showDialogUpload]="true"
[showUdoNotificationBar]="true"
[uploadFolders]="false"
[multipleFiles]="false">
</alfresco-upload-button>`,
directives: [ALFRESCO_ULPOAD_COMPONENT]
})
export class MyDemoComponent {
export class HomeComponent {
}
}

View 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.
*/
import { Component, provide } from 'angular2/core';
import { bootstrap } from 'angular2/platform/browser';
import { HTTP_PROVIDERS } from 'angular2/http';
import { MyDemoComponent } from "./components/my-demo.component";
import { TranslateLoader, TranslateService } from 'ng2-translate/ng2-translate';
import { AlfrescoTranslationLoader } from 'ng2-alfresco-core/services';
@Component({
selector: 'my-app',
template: '<my-demo></my-demo>',
directives: [MyDemoComponent]
})
class VgDemo {
constructor() {
}
}
bootstrap(VgDemo, [
HTTP_PROVIDERS,
provide(TranslateLoader, {useClass: AlfrescoTranslationLoader}),
TranslateService
]);

View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"outDir": "dist"
},
"exclude": [
"node_modules",
"typings"
]
}

View File

@@ -0,0 +1,9 @@
{
"name": "angular2-testing",
"dependencies": {},
"devDependencies": {},
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#dd638012d63e069f2c99d06ef4dcc9616a943ee4"
}
}

View File

@@ -12,9 +12,10 @@
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",

View File

@@ -16,11 +16,12 @@
*/
import { Component, ViewChild, ElementRef, Input, Output, EventEmitter } from 'angular2/core';
import { Component, ViewChild, ElementRef, Input, Output, EventEmitter, Optional } from 'angular2/core';
import { UploadService } from '../services/upload.service';
import { FileModel } from '../models/file.model';
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
import { TranslateService, TranslatePipe } from 'ng2-translate/ng2-translate';
import 'rxjs/Rx';
declare let componentHandler: any;
declare let __moduleName: string;
@@ -88,7 +89,7 @@ export class UploadButtonComponent {
private _uploaderService: UploadService;
constructor(public el: ElementRef,
translate: TranslateService) {
@Optional() translate: TranslateService) {
console.log('UploadComponent constructor', el);
this._uploaderService = new UploadService({
@@ -103,7 +104,9 @@ export class UploadButtonComponent {
}
});
this.translationInit(translate);
if (translate) {
this.translationInit(translate);
}
}
/**

View File

@@ -7,3 +7,7 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts

View File

@@ -17,9 +17,10 @@
"tslint-test": "tslint -c tslint.json test/**/*.ts",
"tslint-src": "tslint -c tslint.json src/**/*.ts",
"tslint-root": "tslint -c tslint.json *.ts",
"copytemplates": "npm run copy-html && npm run copy-css",
"copytemplates": "npm run copy-html && npm run copy-css && npm run copy-i18n",
"copy-html": "copyfiles './src/**/*.html' dist",
"copy-css": "copyfiles './src/**/*.css' dist",
"copy-i18n": "copyfiles './i18n/**/*.json' dist",
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",