diff --git a/demo-shell-ng2/app/components/files/files.component.ts b/demo-shell-ng2/app/components/files/files.component.ts index 988de5ce54..a7755ebbe9 100644 --- a/demo-shell-ng2/app/components/files/files.component.ts +++ b/demo-shell-ng2/app/components/files/files.component.ts @@ -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', '') diff --git a/demo-shell-ng2/app/main.ts b/demo-shell-ng2/app/main.ts index e464bc731f..86f990cc07 100644 --- a/demo-shell-ng2/app/main.ts +++ b/demo-shell-ng2/app/main.ts @@ -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, diff --git a/ng2-components/ng2-alfresco-core/.gitignore b/ng2-components/ng2-alfresco-core/.gitignore index bdc6d2ca8c..0184de8cd0 100644 --- a/ng2-components/ng2-alfresco-core/.gitignore +++ b/ng2-components/ng2-alfresco-core/.gitignore @@ -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 diff --git a/ng2-components/ng2-alfresco-core/package.json b/ng2-components/ng2-alfresco-core/package.json index e6057676a1..f7c8743ec7 100644 --- a/ng2-components/ng2-alfresco-core/package.json +++ b/ng2-components/ng2-alfresco-core/package.json @@ -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", diff --git a/ng2-components/ng2-alfresco-datatable/package.json b/ng2-components/ng2-alfresco-datatable/package.json index e3ebe65b1b..1eb82c2212 100644 --- a/ng2-components/ng2-alfresco-datatable/package.json +++ b/ng2-components/ng2-alfresco-datatable/package.json @@ -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", diff --git a/ng2-components/ng2-alfresco-documentlist/.gitignore b/ng2-components/ng2-alfresco-documentlist/.gitignore index b514403e57..dfcb7458fd 100644 --- a/ng2-components/ng2-alfresco-documentlist/.gitignore +++ b/ng2-components/ng2-alfresco-documentlist/.gitignore @@ -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 diff --git a/ng2-components/ng2-alfresco-documentlist/package.json b/ng2-components/ng2-alfresco-documentlist/package.json index b37b159635..28891547e4 100644 --- a/ng2-components/ng2-alfresco-documentlist/package.json +++ b/ng2-components/ng2-alfresco-documentlist/package.json @@ -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", diff --git a/ng2-components/ng2-alfresco-login/.gitignore b/ng2-components/ng2-alfresco-login/.gitignore index 86fbe6050f..026d1fc882 100644 --- a/ng2-components/ng2-alfresco-login/.gitignore +++ b/ng2-components/ng2-alfresco-login/.gitignore @@ -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 diff --git a/ng2-components/ng2-alfresco-login/demo/.gitignore b/ng2-components/ng2-alfresco-login/demo/.gitignore new file mode 100644 index 0000000000..d728305c75 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/demo/.gitignore @@ -0,0 +1,5 @@ +node_modules +.idea +coverage +dist +typings \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/.npmignore b/ng2-components/ng2-alfresco-login/demo/.npmignore new file mode 100644 index 0000000000..ed72ec0779 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/demo/.npmignore @@ -0,0 +1,6 @@ +node_modules +.idea +coverage +src +typings +typings.json \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/LICENSE b/ng2-components/ng2-alfresco-login/demo/LICENSE new file mode 100644 index 0000000000..059fc6c668 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/demo/LICENSE @@ -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. diff --git a/ng2-components/ng2-alfresco-login/demo/README.md b/ng2-components/ng2-alfresco-login/demo/README.md new file mode 100644 index 0000000000..9f87666579 --- /dev/null +++ b/ng2-components/ng2-alfresco-login/demo/README.md @@ -0,0 +1,13 @@ +# angular2-testing + +Install: + +``` +npm install +``` + +Run the project: + +``` +npm start +``` \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/app.component.d.ts b/ng2-components/ng2-alfresco-login/demo/app/app.component.d.ts deleted file mode 100644 index 8ad6471df1..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/app.component.d.ts +++ /dev/null @@ -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; -} diff --git a/ng2-components/ng2-alfresco-login/demo/app/app.component.js b/ng2-components/ng2-alfresco-login/demo/app/app.component.js deleted file mode 100644 index a42d4dbff2..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/app.component.js +++ /dev/null @@ -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: '', - 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 \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/app.component.js.map b/ng2-components/ng2-alfresco-login/demo/app/app.component.js.map deleted file mode 100644 index e5f6ac0790..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/app.component.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/home.component.d.ts b/ng2-components/ng2-alfresco-login/demo/app/home.component.d.ts deleted file mode 100644 index c6ada9c512..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/home.component.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare class HomeComponent { -} diff --git a/ng2-components/ng2-alfresco-login/demo/app/home.component.js b/ng2-components/ng2-alfresco-login/demo/app/home.component.js deleted file mode 100644 index 9119676a26..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/home.component.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/home.component.js.map b/ng2-components/ng2-alfresco-login/demo/app/home.component.js.map deleted file mode 100644 index 2154b4150c..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/home.component.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/js/xml2json.js b/ng2-components/ng2-alfresco-login/demo/app/js/xml2json.js deleted file mode 100644 index 09193e6fcd..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/js/xml2json.js +++ /dev/null @@ -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 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 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"; - } - else - s += "/>"; - } - else if (n.nodeType == 3) - s += n.nodeValue; - else if (n.nodeType == 4) - s += ""; - 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}"; -} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/main.d.ts b/ng2-components/ng2-alfresco-login/demo/app/main.d.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ng2-components/ng2-alfresco-login/demo/app/main.js b/ng2-components/ng2-alfresco-login/demo/app/main.js deleted file mode 100644 index a0327a1a04..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/main.js +++ /dev/null @@ -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 \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/app/main.js.map b/ng2-components/ng2-alfresco-login/demo/app/main.js.map deleted file mode 100644 index 9d22f1889b..0000000000 --- a/ng2-components/ng2-alfresco-login/demo/app/main.js.map +++ /dev/null @@ -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"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-login/demo/index.html b/ng2-components/ng2-alfresco-login/demo/index.html index 95689fedfd..225bfa70dc 100644 --- a/ng2-components/ng2-alfresco-login/demo/index.html +++ b/ng2-components/ng2-alfresco-login/demo/index.html @@ -1,7 +1,8 @@ - + + - Alfresco Login Component Demo - + + Angular 2 Testing @@ -16,23 +17,19 @@ - - - - - - - - - + System.import('dist/src/my-app').catch(console.log.bind(console)); + + + -Loading... + + + diff --git a/ng2-components/ng2-alfresco-login/demo/package.json b/ng2-components/ng2-alfresco-login/demo/package.json index 938ae77f40..f23dee9952 100644 --- a/ng2-components/ng2-alfresco-login/demo/package.json +++ b/ng2-components/ng2-alfresco-login/demo/package.json @@ -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" - } -} \ No newline at end of file + "http-server": "0.8.5", + "systemjs": "0.19.17", + "typescript": "1.7.5", + "typings": "0.6.8" + }, + "keywords": [ + "angular2", + "typescript" + ] +} diff --git a/ng2-components/ng2-alfresco-login/demo/app/app.component.ts b/ng2-components/ng2-alfresco-login/demo/src/components/my-login.component.ts similarity index 58% rename from ng2-components/ng2-alfresco-login/demo/app/app.component.ts rename to ng2-components/ng2-alfresco-login/demo/src/components/my-login.component.ts index 76194a1279..03fd96fec7 100644 --- a/ng2-components/ng2-alfresco-login/demo/app/app.component.ts +++ b/ng2-components/ng2-alfresco-login/demo/src/components/my-login.component.ts @@ -1,3 +1,5 @@ +/// + /** * @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: '', 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); } -} \ No newline at end of file +} diff --git a/ng2-components/ng2-alfresco-login/demo/app/main.ts b/ng2-components/ng2-alfresco-login/demo/src/my-app.ts similarity index 87% rename from ng2-components/ng2-alfresco-login/demo/app/main.ts rename to ng2-components/ng2-alfresco-login/demo/src/my-app.ts index b90f93814c..058bdcb66f 100644 --- a/ng2-components/ng2-alfresco-login/demo/app/main.ts +++ b/ng2-components/ng2-alfresco-login/demo/src/my-app.ts @@ -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, { diff --git a/ng2-components/ng2-alfresco-login/demo/tsconfig.json b/ng2-components/ng2-alfresco-login/demo/tsconfig.json index 2f3531e7b9..d0f08ba4ce 100644 --- a/ng2-components/ng2-alfresco-login/demo/tsconfig.json +++ b/ng2-components/ng2-alfresco-login/demo/tsconfig.json @@ -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" ] } diff --git a/ng2-components/ng2-alfresco-login/demo/typings.json b/ng2-components/ng2-alfresco-login/demo/typings.json index 8d5672dbcf..39a2ebcc56 100644 --- a/ng2-components/ng2-alfresco-login/demo/typings.json +++ b/ng2-components/ng2-alfresco-login/demo/typings.json @@ -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" + } } diff --git a/ng2-components/ng2-alfresco-login/karma.conf.js b/ng2-components/ng2-alfresco-login/karma.conf.js index f717fb9d8d..d5ba842eb5 100644 --- a/ng2-components/ng2-alfresco-login/karma.conf.js +++ b/ng2-components/ng2-alfresco-login/karma.conf.js @@ -75,6 +75,6 @@ module.exports = function (config) { ] }, - singleRun: false + singleRun: true }) }; diff --git a/ng2-components/ng2-alfresco-login/package.json b/ng2-components/ng2-alfresco-login/package.json index c0b4a86e12..c96f4118c6 100644 --- a/ng2-components/ng2-alfresco-login/package.json +++ b/ng2-components/ng2-alfresco-login/package.json @@ -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", diff --git a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts index 14eff08af3..71def92e00 100644 --- a/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts +++ b/ng2-components/ng2-alfresco-login/src/components/alfresco-login.component.ts @@ -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); + } } diff --git a/ng2-components/ng2-alfresco-upload/.gitignore b/ng2-components/ng2-alfresco-upload/.gitignore index 17e27059f5..06a7f7934f 100644 --- a/ng2-components/ng2-alfresco-upload/.gitignore +++ b/ng2-components/ng2-alfresco-upload/.gitignore @@ -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 diff --git a/ng2-components/ng2-alfresco-upload/demo/.gitignore b/ng2-components/ng2-alfresco-upload/demo/.gitignore new file mode 100644 index 0000000000..d728305c75 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/.gitignore @@ -0,0 +1,5 @@ +node_modules +.idea +coverage +dist +typings \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/demo/LICENSE b/ng2-components/ng2-alfresco-upload/demo/LICENSE new file mode 100644 index 0000000000..059fc6c668 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/LICENSE @@ -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. diff --git a/ng2-components/ng2-alfresco-upload/demo/README.md b/ng2-components/ng2-alfresco-upload/demo/README.md new file mode 100644 index 0000000000..9f87666579 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/README.md @@ -0,0 +1,13 @@ +# angular2-testing + +Install: + +``` +npm install +``` + +Run the project: + +``` +npm start +``` \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/demo/demo.html b/ng2-components/ng2-alfresco-upload/demo/demo.html deleted file mode 100644 index 7b1ddc3455..0000000000 --- a/ng2-components/ng2-alfresco-upload/demo/demo.html +++ /dev/null @@ -1,54 +0,0 @@ -
- - - - - -
-
- file_upload Upload -
- -

- -
- file_upload Upload Folder -
- -

- -
- -
- -
- - -
- - - - - - - - -
-
- -
- -
-
diff --git a/ng2-components/ng2-alfresco-upload/demo/index.html b/ng2-components/ng2-alfresco-upload/demo/index.html new file mode 100644 index 0000000000..cbb462b986 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/index.html @@ -0,0 +1,67 @@ + + + + + Angular 2 Upload + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-upload/demo/package.json b/ng2-components/ng2-alfresco-upload/demo/package.json new file mode 100644 index 0000000000..0b20919e95 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/package.json @@ -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" + ] +} diff --git a/ng2-components/ng2-alfresco-login/demo/app/home.component.ts b/ng2-components/ng2-alfresco-upload/demo/src/components/my-demo.component.ts similarity index 51% rename from ng2-components/ng2-alfresco-login/demo/app/home.component.ts rename to ng2-components/ng2-alfresco-upload/demo/src/components/my-demo.component.ts index 0f0f9c94c2..da206ea2a0 100644 --- a/ng2-components/ng2-alfresco-login/demo/app/home.component.ts +++ b/ng2-components/ng2-alfresco-upload/demo/src/components/my-demo.component.ts @@ -1,3 +1,5 @@ +/// + /** * @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: ` + `, + directives: [ALFRESCO_ULPOAD_COMPONENT] }) +export class MyDemoComponent { -export class HomeComponent { - -} \ No newline at end of file +} diff --git a/ng2-components/ng2-alfresco-upload/demo/src/my-app.ts b/ng2-components/ng2-alfresco-upload/demo/src/my-app.ts new file mode 100644 index 0000000000..e5cdfbba1a --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/src/my-app.ts @@ -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: '', + directives: [MyDemoComponent] +}) +class VgDemo { + constructor() { + + } +} + +bootstrap(VgDemo, [ + HTTP_PROVIDERS, + provide(TranslateLoader, {useClass: AlfrescoTranslationLoader}), + TranslateService +]); diff --git a/ng2-components/ng2-alfresco-upload/demo/tsconfig.json b/ng2-components/ng2-alfresco-upload/demo/tsconfig.json new file mode 100644 index 0000000000..d0f08ba4ce --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/tsconfig.json @@ -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" + ] +} diff --git a/ng2-components/ng2-alfresco-upload/demo/typings.json b/ng2-components/ng2-alfresco-upload/demo/typings.json new file mode 100644 index 0000000000..39a2ebcc56 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/demo/typings.json @@ -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" + } +} diff --git a/ng2-components/ng2-alfresco-upload/package.json b/ng2-components/ng2-alfresco-upload/package.json index b4bb37f32c..9b2fabb1c5 100644 --- a/ng2-components/ng2-alfresco-upload/package.json +++ b/ng2-components/ng2-alfresco-upload/package.json @@ -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", diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts index 4ab392801e..b375d65c0a 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/upload-button.component.ts @@ -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); + } } /** diff --git a/ng2-components/ng2-alfresco-viewer/.gitignore b/ng2-components/ng2-alfresco-viewer/.gitignore index f902001d8e..b8553684da 100644 --- a/ng2-components/ng2-alfresco-viewer/.gitignore +++ b/ng2-components/ng2-alfresco-viewer/.gitignore @@ -7,3 +7,7 @@ coverage dist src/**/*.js src/**/*.js.map +src/**/*.d.ts +demo/**/*.js +demo/**/*.js.map +demo/**/*.d.ts diff --git a/ng2-components/ng2-alfresco-viewer/package.json b/ng2-components/ng2-alfresco-viewer/package.json index 6c9b62472c..79c1f2f00e 100644 --- a/ng2-components/ng2-alfresco-viewer/package.json +++ b/ng2-components/ng2-alfresco-viewer/package.json @@ -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",