diff --git a/.gitignore b/.gitignore index 3185b6b26f3..e427910ca08 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules workspace.xml .idea/ dist/ +ng2-components/coverage/ !systemjs.config.js demo-shell-ng2/app/components/router/ ng2-components/ng2-alfresco-userinfo-old/demo/src/app/ @@ -10,3 +11,6 @@ ng2-components/ng2-alfresco-userinfo-old/src/services/bpm-user.service.spec.ts ng2-components/ng2-alfresco-userinfo-old/src/services/ecm-user.service.spec.ts src/environments/ /ng2-components/ng2-example-webpack/ +/ng2-components/config/coverage/ +*.npmrc +/demo-shell-ng2/ng2-components/ diff --git a/.travis.yml b/.travis.yml index d1a00422a28..c293925d1b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js dist: trusty sudo: false node_js: - - "5" + - "6" before_install: - "export DISPLAY=:99.0" @@ -10,48 +10,34 @@ before_install: env: matrix: - - MODULE=ng2-alfresco-core - - MODULE=ng2-alfresco-datatable - - MODULE=ng2-alfresco-documentlist - - MODULE=ng2-alfresco-login - - MODULE=ng2-alfresco-search - - MODULE=ng2-alfresco-upload - - MODULE=ng2-alfresco-viewer - - MODULE=ng2-alfresco-webscript - - MODULE=ng2-alfresco-tag - - MODULE=ng2-activiti-form - - MODULE=ng2-activiti-tasklist - - MODULE=ng2-activiti-processlist - - MODULE=ng2-activiti-diagrams - - MODULE=ng2-activiti-analytics - - MODULE=ng2-alfresco-userinfo - - MODULE=ng2-alfresco-social + - MODULE=ng2-components-alfresco + - MODULE=ng2-components-activiti + - MODULE=ng2-demo-shell + +install: + - if ([ "$MODULE" == "ng2-components-alfresco" -o "$MODULE" == "ng2-components-activiti" ]); then + if ([ "$TRAVIS_BRANCH" = "master" ]); then + (./scripts/npm-build-all.sh || exit 1;); + else + (./scripts/npm-build-all.sh -gitjsapi development || exit 1;); + fi + fi + +script: + - if ([ "$MODULE" == "ng2-components-activiti" ]); then + (./scripts/npm-build-all.sh -si -sb -t "ng2-activiti*" || exit 1;); + fi + - if ([ "$MODULE" == "ng2-components-alfresco" ]); then + (./scripts/npm-build-all.sh -si -sb -t "ng2-alfresco*" || exit 1;); + fi + - if ([ "$MODULE" == "ng2-demo-shell" ]); then + if ([ "$TRAVIS_BRANCH" = "master" ]); then + (./scripts/start.sh -t -ss || exit 1;); + else + (./scripts/start.sh -dev -t -ss -gitjsapi development || exit 1;); + fi + fi -before_script: - - if ([ "$MODULE" != "ng2-alfresco-core" ]); then - (cd ng2-components/ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - if ([ "$MODULE" == "ng2-alfresco-documentlist" ] || [ "$MODULE" == "ng2-alfresco-webscript" ] || [ "$MODULE" == "ng2-activiti-processlist" ] || [ "$MODULE" == "ng2-activiti-tasklist" ]); then - (cd ng2-components/ng2-alfresco-datatable; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - if ([ "$MODULE" == "ng2-activiti-tasklist" ] || [ "$MODULE" == "ng2-activiti-processlist" ]); then - (cd ng2-components/ng2-alfresco-datatable; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - (cd ng2-components/ng2-activiti-form; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - if ([ "$MODULE" == "ng2-activiti-processlist" ]); then - (cd ng2-components/ng2-alfresco-datatable; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - (cd ng2-components/ng2-activiti-form; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - (cd ng2-components/ng2-activiti-tasklist; npm link ng2-alfresco-core; npm link ng2-alfresco-datatable; npm link ng2-activiti-form; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - if ([ "$MODULE" == "ng2-activiti-analytics" ]); then - (cd ng2-components/ng2-activiti-diagrams; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - if ([ "$MODULE" == "ng2-alfresco-search" ]); then - (cd ng2-components/ng2-alfresco-datatable; npm link ng2-alfresco-core; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - (cd ng2-components/ng2-alfresco-documentlist; npm link ng2-alfresco-core; npm link ng2-alfresco-datatable; if [ ! -d "bundles" ]; then npm install && npm run build && npm link; fi); - fi - - cd ng2-components/$MODULE; -script: npm install && npm run travis && npm run test # Send coverage data to Coveralls after_success: bash <(curl -s https://codecov.io/bash) -X gcov @@ -61,18 +47,4 @@ cache: - ./node_modules/material-design-lite - ./node_modules/material-design-icons - demo-shell-ng2/node_modules - - ng2-components/ng2-activiti-form/node_modules - - ng2-components/ng2-activiti-processlist/node_modules - - ng2-components/ng2-activiti-tasklist/node_modules - - ng2-components/ng2-alfresco-core/node_modules - - ng2-components/ng2-alfresco-datatable/node_modules - - ng2-components/ng2-alfresco-documentlist/node_modules - - ng2-components/ng2-alfresco-login/node_modules - - ng2-components/ng2-alfresco-search/node_modules - - ng2-components/ng2-alfresco-upload/node_modules - - ng2-components/ng2-alfresco-viewer/node_modules - - ng2-components/ng2-alfresco-webscript/node_modules - - ng2-components/ng2-alfresco-tag/node_modules - - ng2-components/ng2-activiti-analytics/node_modules - - ng2-components/ng2-alfresco-userinfo/node_modules - - ng2-components/ng2-activiti-diagrams/node_modules + - ng2-components/node_modules diff --git a/.vscode/settings.json b/.vscode/settings.json index 277ffe4f6d1..bc3c11c1fb3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,9 +6,10 @@ "**/.hg": true, "**/.DS_Store": true, "**/*.js": { "when": "$(basename).ts"}, - "**/*.js.map": { "when": "$(basename)"}, + "**/*.js.map": { "when": "$(basename).ts"}, "**/*.d.ts": { "when": "$(basename).ts"}, "**/coverage": true }, - "editor.renderIndentGuides": true + "editor.renderIndentGuides": true, + "tslint.configFile": "ng2-components/config/assets/tslint.json" } diff --git a/appveyor.yml b/appveyor.yml index 2e00efed227..0b341ddcebb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,53 +6,36 @@ branches: - dev-build-test environment: - nodejs_version: "5" + nodejs_version: "6" matrix: - - COMPONENT_NAME: ng2-alfresco-core - - COMPONENT_NAME: ng2-alfresco-datatable - - COMPONENT_NAME: ng2-alfresco-documentlist - - COMPONENT_NAME: ng2-alfresco-login - - COMPONENT_NAME: ng2-alfresco-search - - COMPONENT_NAME: ng2-alfresco-upload - - COMPONENT_NAME: ng2-alfresco-viewer - - COMPONENT_NAME: ng2-alfresco-tag - - COMPONENT_NAME: ng2-alfresco-webscript - - COMPONENT_NAME: ng2-activiti-form - - COMPONENT_NAME: ng2-activiti-tasklist - - COMPONENT_NAME: ng2-activiti-processlist - - COMPONENT_NAME: ng2-activiti-diagrams - - COMPONENT_NAME: ng2-activiti-analytics - - COMPONENT_NAME: ng2-alfresco-userinfo - - COMPONENT_NAME: ng2-alfresco-social + - COMPONENT_NAME: ng2-components-activiti + - COMPONENT_NAME: ng2-components-alfresco + - COMPONENT_NAME: ng2-demo-shell # Install scripts. (runs after repo cloning) install: # Get the latest stable version of Node.js or io.js - ps: Install-Product node $env:nodejs_version # install module - - IF %COMPONENT_NAME% NEQ ng2-alfresco-core (cd ng2-components/ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-alfresco-documentlist (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-alfresco-search (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-alfresco-search (cd ng2-components/ng2-alfresco-documentlist && npm link ng2-alfresco-core && npm link ng2-alfresco-datatable && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-processlist (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-processlist (cd ng2-components/ng2-activiti-form && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-processlist (cd ng2-components/ng2-activiti-tasklist && npm link ng2-alfresco-core && npm link ng2-alfresco-datatable && npm link ng2-activiti-form && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-tasklist (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-tasklist (cd ng2-components/ng2-activiti-form && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-alfresco-webscript (cd ng2-components/ng2-alfresco-datatable && npm link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - IF %COMPONENT_NAME% EQU ng2-activiti-analytics (cd ng2-components/ng2-activiti-diagrams && npm link link ng2-alfresco-core && npm link && npm install && npm run build && cd ../../) - - cd ng2-components/%COMPONENT_NAME% - - npm run travis - -# Post-install test scripts. -test_script: - - npm install - # Output useful info for debugging. - - node --version - - npm --version - # run tests - - npm test + - if %COMPONENT_NAME% EQU ng2-components-activiti ( + if %APPVEYOR_REPO_BRANCH EQU master + (cd scripts && sh npm-build-all.sh -t "ng2-activiti*" || exit 1) + else + (cd scripts && sh npm-build-all.sh -t "ng2-activiti*" -gitjsapi development|| exit 1) + ) + - if %COMPONENT_NAME% EQU ng2-components-alfresco ( + if %APPVEYOR_REPO_BRANCH EQU master + (cd scripts && sh npm-build-all.sh -t "ng2-alfresco*" || exit 1) + else + (cd scripts && sh npm-build-all.sh -t "ng2-alfresco*" -gitjsapi development|| exit 1) + ) + - if %COMPONENT_NAME% EQU ng2-demo-shell ( + if %APPVEYOR_REPO_BRANCH EQU master + (cd scripts && sh start.sh -t -ss || exit 1) + else + (cd scripts && sh start.sh -dev -t -ss -gitjsapi development|| exit 1) + ) # Don't actually build. build: off diff --git a/demo-shell-ng2/.gitignore b/demo-shell-ng2/.gitignore index 5cb7530c4a5..67093b31a54 100644 --- a/demo-shell-ng2/.gitignore +++ b/demo-shell-ng2/.gitignore @@ -1,8 +1,11 @@ typings/ node_modules/ bower_components/ +ng2-components/ app/**/*.js app/**/*.js.map +app/**/*.d.ts + !app/js/Polyline.js .idea versions.json diff --git a/demo-shell-ng2/app/components/about/about.component.ts b/demo-shell-ng2/app/components/about/about.component.ts index a1766c5f303..f7706caff04 100644 --- a/demo-shell-ng2/app/components/about/about.component.ts +++ b/demo-shell-ng2/app/components/about/about.component.ts @@ -35,7 +35,7 @@ export class AboutComponent implements OnInit { ngOnInit() { this.http.get('/versions.json').subscribe(response => { - let regexp = new RegExp('^(ng2-activiti|ng2-alfresco|alfresco-)', 'g'); + let regexp = new RegExp('^(ng2-activiti|ng2-alfresco|alfresco-)'); let alfrescoPackages = Object.keys(response.json().dependencies).filter((val) => { this.logService.log(val); diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html index 9599799d100..943a2cacdcd 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -70,6 +70,12 @@ (taskCreated)="onTaskCreated($event)" (taskDeleted)="onTaskDeleted($event)"> +
+
Attachments
+ + @@ -149,6 +155,7 @@
diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts index e74a6390d28..982905e7e38 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -79,6 +79,7 @@ export class ActivitiDemoComponent implements AfterViewInit { appId: number = null; fileShowed: boolean = false; + selectFirstReport: boolean = false; content: Blob; contentName: string; @@ -213,14 +214,8 @@ export class ActivitiDemoComponent implements AfterViewInit { } onReportDeleted() { + this.selectFirstReport = true; this.analyticsreportlist.reload(); - this.selectFirstElementInReportList(); - } - - selectFirstElementInReportList() { - if (!this.analyticsreportlist.isReportsEmpty()) { - this.analyticsreportlist.selectReport(this.analyticsreportlist.reports[0]); - } } navigateStartProcess() { @@ -259,6 +254,12 @@ export class ActivitiDemoComponent implements AfterViewInit { this.contentName = content.name; } + onAttachmentClick(content: any) { + this.fileShowed = true; + this.content = content.contentBlob; + this.contentName = content.name; + } + onTaskCreated(data: any) { this.currentTaskId = data.parentTaskId; this.taskList.reload(); diff --git a/demo-shell-ng2/app/components/files/files.component.css b/demo-shell-ng2/app/components/files/files.component.css index cb4cb685aa0..73ec99ca5d9 100644 --- a/demo-shell-ng2/app/components/files/files.component.css +++ b/demo-shell-ng2/app/components/files/files.component.css @@ -15,3 +15,7 @@ .error-message--text { color: #d50000; } + +.adf-not-overlay-viewer { + height:900px; +} diff --git a/demo-shell-ng2/app/components/files/files.component.html b/demo-shell-ng2/app/components/files/files.component.html index bf828122ff6..7dfc7864763 100644 --- a/demo-shell-ng2/app/components/files/files.component.html +++ b/demo-shell-ng2/app/components/files/files.component.html @@ -18,6 +18,7 @@ [contextMenuActions]="true" [contentActions]="true" [allowDropFiles]="true" + [sorting]="['name', 'desc']" (error)="onNavigationError($event)" (success)="resetError()" (preview)="showFile($event)" @@ -44,6 +45,8 @@ --> + +
- Disable when user has no permissions + Disable upload button when user has no permissions
Upload
@@ -195,5 +199,15 @@
Upload
+ + + + + + + + + + diff --git a/demo-shell-ng2/app/components/setting/setting.component.css b/demo-shell-ng2/app/components/setting/setting.component.css index 91992ec4aa0..abbadd44969 100644 --- a/demo-shell-ng2/app/components/setting/setting.component.css +++ b/demo-shell-ng2/app/components/setting/setting.component.css @@ -1,6 +1,6 @@ .setting-card.mdl-card { - width: 320px; - height: 320px; + width: 100%; + height: 100%; } .setting-card > .mdl-card__title { @@ -30,6 +30,6 @@ display: table-row; } -.adf-setting-input-padding{ +.adf-setting-input-padding { padding-top: 0px !important; } diff --git a/demo-shell-ng2/app/polyfills.ts b/demo-shell-ng2/app/polyfills.ts index d5be0fad928..541adc72dc1 100644 --- a/demo-shell-ng2/app/polyfills.ts +++ b/demo-shell-ng2/app/polyfills.ts @@ -1,16 +1,17 @@ import 'core-js/es6'; import 'core-js/es7/reflect'; +import 'intl'; -// IE 8-11 -require('zone.js/dist/zone'); +require('zone.js/dist/zone'); // IE 8-11 +require('element.scrollintoviewifneeded-polyfill'); // IE/FF if (process.env.ENV === 'production') { - // Production + // Production } else { - // Development + // Development - Error['stackTraceLimit'] = Infinity; + Error['stackTraceLimit'] = Infinity; - require('zone.js/dist/long-stack-trace-zone'); + require('zone.js/dist/long-stack-trace-zone'); } diff --git a/demo-shell-ng2/app/vendor.ts b/demo-shell-ng2/app/vendor.ts index 91d7764380b..9883f4891e2 100644 --- a/demo-shell-ng2/app/vendor.ts +++ b/demo-shell-ng2/app/vendor.ts @@ -32,39 +32,44 @@ import 'ng2-alfresco-webscript'; import 'ng2-alfresco-userinfo'; // Polyfill(s) for dialogs -require('script!dialog-polyfill/dialog-polyfill'); +require('script-loader!dialog-polyfill/dialog-polyfill'); import 'dialog-polyfill/dialog-polyfill.css'; // Flags import 'flag-icon-css/css/flag-icon.min.css'; -import '../public/css/app.css'; -import '../public/css/muli-font.css'; - // Load the Angular Material 2 stylesheet import '../public/css/angular-material.css'; +// Google Material Design Lite +import 'material-design-lite/material.js'; +import 'material-design-lite/dist/material.orange-blue.min.css'; +import 'material-design-icons/iconfont/material-icons.css'; + +import '../public/css/app.css'; +import '../public/css/muli-font.css'; + import 'ng2-activiti-form/stencils/runtime.ng1'; import 'ng2-activiti-form/stencils/runtime.adf'; import 'ng2-charts'; import 'chart.js'; -require('script!raphael/raphael.min.js'); +require('script-loader!raphael/raphael.min.js'); -require('script!moment/min/moment.min.js'); +require('script-loader!moment/min/moment.min.js'); import 'md-date-time-picker/dist/css/mdDateTimePicker.css'; -require('script!md-date-time-picker/dist/js/mdDateTimePicker.min.js'); -require('script!md-date-time-picker/dist/js/draggabilly.pkgd.min.js'); +require('script-loader!md-date-time-picker/dist/js/mdDateTimePicker.min.js'); +require('script-loader!md-date-time-picker/dist/js/draggabilly.pkgd.min.js'); require('pdfjs-dist/web/compatibility.js'); // Setting worker path to worker bundle. let pdfjsLib = require('pdfjs-dist'); if (process.env.ENV === 'production') { - pdfjsLib.PDFJS.workerSrc = './pdf.worker.js'; + pdfjsLib.PDFJS.workerSrc = './pdf.worker.js'; } else { - pdfjsLib.PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js'; + pdfjsLib.PDFJS.workerSrc = '../../node_modules/pdfjs-dist/build/pdf.worker.js'; } require('pdfjs-dist/web/pdf_viewer.js'); diff --git a/demo-shell-ng2/config/helpers.js b/demo-shell-ng2/config/helpers.js index 15dc4a5a468..a11fa771d6c 100644 --- a/demo-shell-ng2/config/helpers.js +++ b/demo-shell-ng2/config/helpers.js @@ -1,7 +1,10 @@ var path = require('path'); + var _root = path.resolve(__dirname, '..'); + function root(args) { args = Array.prototype.slice.call(arguments, 0); return path.join.apply(path, [_root].concat(args)); } + exports.root = root; diff --git a/demo-shell-ng2/config/karma.conf.js b/demo-shell-ng2/config/karma.conf.js index c3b4a58f9e4..c7bf96fe26f 100644 --- a/demo-shell-ng2/config/karma.conf.js +++ b/demo-shell-ng2/config/karma.conf.js @@ -1,37 +1,73 @@ var webpackConfig = require('./webpack.test'); module.exports = function (config) { - var _config = { - basePath: '', + var _config = { + basePath: '', - frameworks: ['jasmine'], + frameworks: ['jasmine'], - files: [ - { pattern: './config/karma-test-shim.js', watched: false } - ], + files: [ + './node_modules/hammerjs/hammer.js', - preprocessors: { - './config/karma-test-shim.js': ['webpack', 'sourcemap'] - }, + { pattern: './config/karma-test-shim.js', watched: false } + ], - webpack: webpackConfig, + preprocessors: { + './config/karma-test-shim.js': ['webpack', 'sourcemap'] + }, - webpackMiddleware: { - stats: 'errors-only' - }, + webpack: webpackConfig, - webpackServer: { - noInfo: true - }, + webpackMiddleware: { + stats: 'errors-only' + }, - reporters: ['mocha'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: false, - browsers: ['Chrome'], - singleRun: true - }; + port: 9876, - config.set(_config); + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + colors: true, + + autoWatch: true, + + captureTimeout: 180000, + browserDisconnectTimeout: 180000, + browserDisconnectTolerance: 3, + browserNoActivityTimeout: 300000, + + browsers: ['Chrome'], + + customLaunchers: { + Chrome_travis_ci: { + base: 'Chrome', + flags: ['--no-sandbox'] + } + }, + + // Karma plugins loaded + plugins: [ + require('../node_modules/karma-jasmine'), + require('../node_modules/karma-coverage'), + require('../node_modules/karma-sourcemap-loader'), + require('../node_modules/karma-chrome-launcher'), + require('../node_modules/karma-mocha-reporter'), + require('../node_modules/karma-webpack'), + require('../node_modules/karma-jasmine-html-reporter') + ], + + webpackServer: { + noInfo: true + }, + + reporters: ['mocha'] + + }; + + if (process.env.TRAVIS) { + config.browsers = ['Chrome_travis_ci']; + } + + config.set(_config); }; diff --git a/demo-shell-ng2/config/loaders/license-check.js b/demo-shell-ng2/config/loaders/license-check.js new file mode 100644 index 00000000000..6a15ac03e2a --- /dev/null +++ b/demo-shell-ng2/config/loaders/license-check.js @@ -0,0 +1,67 @@ +var path = require('path'); +var loaderUtils = require('loader-utils'); +var fs = require('fs'); + +var licenseFileUtf8Store = undefined; + +function readLicenseHeaderFile(licenseFilePath) { + if (licenseFileUtf8Store) { + return licenseFileUtf8Store; + } + + if (fs.existsSync(licenseFilePath)) { + licenseFileUtf8Store = fs.readFileSync(licenseFilePath, 'utf8').split(/\r?\n/); + return licenseFileUtf8Store; + } + + throw new Error('The license header file path is wrong ' + licenseFilePath); +} + +function isFileEmpty(fileContents) { + return fileContents.toString('utf8').trim() === ''; +} + +function readCurrentFile(fileContent) { + return fileContent.toString('utf8').split(/\r?\n/); +} + +function isLicenseHeaderPresent(currentFileContent, licenseFilePath) { + if (!isFileEmpty(currentFileContent)) { + var currentFileUtf8 = readCurrentFile(currentFileContent), + licenseFileUtf8 = readLicenseHeaderFile(licenseFilePath); + skipStrict = 0; + + if(currentFileUtf8[0] === '"use strict";' ) { + skipStrict = 1; + } + + for (var i = skipStrict; i < licenseFileUtf8.length; i++) { + if (currentFileUtf8[i + skipStrict] !== licenseFileUtf8[i]) { + return false; + } + } + } + return true; +} + +function report(hasHeader, emitter, filename) { + if (hasHeader) return; + emitter('Missing license header file : ' + filename); +} + +function licenseCheck(webpackInstance, input, options) { + var isLicensePresent = isLicenseHeaderPresent(input, options.licenseFile); + + var emitter = options.emitErrors ? webpackInstance.emitError : webpackInstance.emitWarning; + + report(isLicensePresent, emitter, webpackInstance.resourcePath); +} + +module.exports = function(input, map) { + this.cacheable && this.cacheable(); + var callback = this.async(); + + var options = loaderUtils.getOptions(this); + licenseCheck(this, input, options); + callback(null, input, map); +}; diff --git a/demo-shell-ng2/config/webpack.common.js b/demo-shell-ng2/config/webpack.common.js index 6f4c13f5d55..ee7a199828e 100644 --- a/demo-shell-ng2/config/webpack.common.js +++ b/demo-shell-ng2/config/webpack.common.js @@ -1,22 +1,27 @@ -var webpack = require('webpack'); -var HtmlWebpackPlugin = require('html-webpack-plugin'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var helpers = require('./helpers'); -var path = require('path'); -var fs = require('fs'); -var glob = require('glob'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); +const webpack = require('webpack'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const helpers = require('./helpers'); +const path = require('path'); -const rootPath = helpers.root('node_modules'); - -var pattern = '+(alfresco-js-api|ng2-alfresco|ng2-activiti)*'; -var options = { - cwd: rootPath, - realpath: true -}; - -var alfrescoLibs = glob.sync(pattern, options); -// console.dir(alfrescoLibs); +const alfrescoLibs = [ + 'ng2-activiti-analytics', + 'ng2-activiti-diagrams', + 'ng2-activiti-form', + 'ng2-activiti-processlist', + 'ng2-activiti-tasklist', + 'ng2-alfresco-core', + 'ng2-alfresco-datatable', + 'ng2-alfresco-documentlist', + 'ng2-alfresco-login', + 'ng2-alfresco-search', + 'ng2-alfresco-tag', + 'ng2-alfresco-upload', + 'ng2-alfresco-userinfo', + 'ng2-alfresco-viewer', + 'ng2-alfresco-webscript' +]; module.exports = { entry: { @@ -25,162 +30,146 @@ module.exports = { 'app': './app/main.ts' }, - resolve: { - extensions: ['', '.ts', '.js'], - modules: [ - helpers.root('app'), - helpers.root('node_modules') - ], - root: rootPath, - fallback: rootPath - }, - resolveLoader: { alias: { - 'systemjs-loader': helpers.root('config', 'loaders', 'system.js'), - 'debug-loader': helpers.root('config', 'loaders', 'debug.js') - }, - fallback: rootPath + "license-check": path.resolve(__dirname, "./loaders/license-check") + } }, + module: { - preLoaders: [ + rules: [ { + enforce: 'pre', test: /\.js$/, - include: [ - ...alfrescoLibs - ], - loader: 'source-map-loader' - } - ], - loaders: [ + include: [helpers.root('app'), helpers.root('../ng2-components')], + loader: 'source-map-loader', + exclude: [ /node_modules/, /public/, /resources/, /dist/] + }, { + enforce: 'pre', test: /\.ts$/, - loaders: ['awesome-typescript-loader', 'angular2-template-loader', 'systemjs-loader'], - exclude: ['node_modules','public'] + loader: 'tslint-loader', + include: [helpers.root('app')], + options: { + emitErrors: true + }, + exclude: [ /node_modules/, /public/, /resources/, /dist/] }, { - test: /\.js$/, - include: [ - ...alfrescoLibs - ], - loaders: ['angular2-template-loader', 'source-map-loader', 'systemjs-loader'] + enforce: 'pre', + test: /\.ts$/, + use: 'source-map-loader', + exclude: [ /public/, /resources/, /dist/] }, { - test: /\.html$/, - exclude: alfrescoLibs, - loader: 'html' + test: /\.ts$/, + include: [helpers.root('app'), helpers.root('../ng2-components')], + loader: [ + 'ts-loader', + 'angular2-template-loader' + ], + exclude: [ /node_modules/, /public/, /resources/, /dist/] }, { test: /\.html$/, - include: alfrescoLibs, - loader: 'html', - query: { - interpolate: true - } + loader: 'html-loader', + exclude: [ /node_modules/, /public/, /resources/, /dist/] }, { - test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, - loader: 'file?name=assets/[name].[hash].[ext]' + test: /\.css$/, + exclude: [helpers.root('app'), helpers.root('../ng2-components')], + loader: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: 'css-loader?sourceMap' + }) }, { test: /\.css$/, - exclude: [ - helpers.root('app'), - ...alfrescoLibs - ], - loader: ExtractTextPlugin.extract('style', 'css?sourceMap') + include: [helpers.root('app'), helpers.root('../ng2-components')], + loader: 'raw-loader' }, { - test: /\.css$/, - include: [ - helpers.root('app'), - ...alfrescoLibs - ], - loader: 'raw' + test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, + loader: 'file-loader?name=assets/[name].[hash].[ext]' + }, + { + enforce: 'pre', + test: /\.ts$/, + loader: 'license-check', + include: helpers.root('app'), + options: { + emitErrors: true, + licenseFile: path.resolve(__dirname, '../assets/license_header.txt') + }, + exclude: [/node_modules/, /bundles/, /dist/, /demo/], } ] }, plugins: [ - - new webpack.WatchIgnorePlugin([ new RegExp('^((?!(ng2-activiti|ng2-alfresco|demo-shell-ng2)).)((?!(src|app)).)*$')]), + // Workaround for angular/angular#11580 + new webpack.ContextReplacementPlugin( + // The (\\|\/) piece accounts for path separators in *nix and Windows + /angular(\\|\/)core(\\|\/)@angular/, + helpers.root('./app'), // location of your src + {} // a map of your routes + ), + new HtmlWebpackPlugin({ + template: './index.html' + }), new CopyWebpackPlugin([ + ... alfrescoLibs.map(lib => { + return { + context: `../ng2-components/${lib}/bundles/assets/` , + from: '**/*', + to: `assets/` + } + }), + { + context: 'resources/i18n', + from: '**/*.json', + to: 'resources/i18n' + }, + ... alfrescoLibs.map(lib => { + return { + context: 'node_modules', + from: `${lib}/src/i18n/*.json`, + to: 'node_modules' + } + }), + { + from: 'favicon-96x96.png' + }, + { + from: 'node_modules/pdfjs-dist/build/pdf.worker.js', + to: 'pdf.worker.js' + }, { - from: 'versions.json' - },{ - context: 'node_modules', - from: 'element.scrollintoviewifneeded-polyfill/index.js', - to: 'js/element.scrollintoviewifneeded-polyfill.js', - flatten: true - },{ - context: 'node_modules', - from: 'classlist-polyfill/src/index.js', - to: 'js/classlist-polyfill.js', - flatten: true - }, { - context: 'node_modules', - from: 'intl/dist/Intl.min.js', - to: 'js/Intl.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'web-animations-js/web-animations.min.js', - to: 'js/web-animations.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'core-js/client/shim.min.js', - to: 'js/shim.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'es6-shim/es6-shim.min.js', - to: 'js/es6-shim.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'es5-shim/es5-shim.min.js', - to: 'js/es5-shim.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'systemjs/dist/system-polyfills.js', - to: 'js/system-polyfills.js', - flatten: true - }, { - context: 'node_modules', - from: 'material-design-lite/material.min.js', - to: 'js/material.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'material-design-lite/material.min.js', - to: 'js/material.min.js', - flatten: true - }, { - context: 'node_modules', - from: 'material-design-icons/iconfont/', - to: 'css/iconfont/', - flatten: true - }, { context: 'public', from: '', to: '' + }, + { + from: 'versions.json' } ]), new webpack.optimize.CommonsChunkPlugin({ name: ['app', 'vendor', 'polyfills'] - }), - - new HtmlWebpackPlugin({ - template: 'index.html' }) ], + devServer: { + contentBase: helpers.root('dist'), + compress: true, + port: 3000, + historyApiFallback: true, + host: '0.0.0.0', + inline: true + }, + node: { - fs: 'empty', - module: false + fs: 'empty' } }; diff --git a/demo-shell-ng2/config/webpack.dev.js b/demo-shell-ng2/config/webpack.dev.js index 2816a0faeb4..9b3824a5aff 100644 --- a/demo-shell-ng2/config/webpack.dev.js +++ b/demo-shell-ng2/config/webpack.dev.js @@ -1,8 +1,9 @@ -var webpackMerge = require('webpack-merge'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var commonConfig = require('./webpack.common.js'); -var helpers = require('./helpers'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); +const webpack = require('webpack'); +const webpackMerge = require('webpack-merge'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const commonConfig = require('./webpack.common.js'); +const helpers = require('./helpers'); +const path = require('path'); module.exports = webpackMerge(commonConfig, { @@ -14,55 +15,38 @@ module.exports = webpackMerge(commonConfig, { chunkFilename: '[id].chunk.js' }, + resolve: { + alias: { + "ng2-alfresco-core$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-core/index.ts'), + "ng2-alfresco-datatable$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-datatable/index.ts'), + "ng2-activiti-form/stencils/runtime.ng1$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-form/stencils/runtime.ng1'), + "ng2-activiti-form/stencils/runtime.adf$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-form/stencils/runtime.adf'), + "ng2-activiti-diagrams$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-diagrams/index.ts'), + "ng2-activiti-analytics$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-analytics/index.ts'), + "ng2-activiti-form$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-form/index.ts'), + "ng2-activiti-tasklist$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-tasklist/index.ts'), + "ng2-activiti-processlist$": path.resolve(__dirname, '../../ng2-components/ng2-activiti-processlist/index.ts'), + "ng2-alfresco-documentlist$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-documentlist/index.ts'), + "ng2-alfresco-login$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-login/index.ts'), + "ng2-alfresco-search$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-search/index.ts'), + "ng2-alfresco-social$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-social/index.ts'), + "ng2-alfresco-tag$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-tag/index.ts'), + "ng2-alfresco-upload$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-upload/index.ts'), + "ng2-alfresco-viewer$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-viewer/index.ts'), + "ng2-alfresco-webscript$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-webscript/index.ts'), + "ng2-alfresco-userinfo$": path.resolve(__dirname, '../../ng2-components/ng2-alfresco-userinfo/index.ts') + }, + extensions: ['.ts', '.js'], + modules: [path.resolve(__dirname, '../node_modules')] + }, + plugins: [ - new ExtractTextPlugin('[name].css'), - new CopyWebpackPlugin([ - { - from: 'favicon-96x96.png' - }, - { - from: 'node_modules/pdfjs-dist/build/pdf.worker.js', - to: 'pdf.worker.js' - }, - { - context: 'resources/i18n', - from: '**/*.json', - to: 'resources/i18n' - }, - // Copy i18n folders for all modules with ng2-alfresco- prefix - { - context: 'node_modules', - from: 'ng2-alfresco-*/src/i18n/*.json', - to: 'node_modules' - }, - // Copy i18n folders for all modules with ng2-activiti- prefix - { - context: 'node_modules', - from: 'ng2-activiti-*/src/i18n/*.json', - to: 'node_modules' - }, - // Copy asstes folders for all modules with ng2-activiti- prefix - { - context: 'node_modules', - from: 'ng2-activiti-*/src/assets/images/*.*', - to: 'assets/images', - flatten: true - }, - // Copy asstes folders for all modules with ng2-alfresco- prefix - { - context: 'node_modules', - from: 'ng2-alfresco-*/src/assets/images/*.*', - to: 'assets/images', - flatten: true + new webpack.NoEmitOnErrorsPlugin(), + new ExtractTextPlugin('[name].[hash].css'), + new webpack.LoaderOptionsPlugin({ + htmlLoader: { + minimize: false // workaround for ng2 } - ]) - ], - - devServer: { - host: '0.0.0.0', - port: 3000, - inline: true, - historyApiFallback: true, - stats: 'minimal' - } + }) + ] }); diff --git a/demo-shell-ng2/config/webpack.prod.js b/demo-shell-ng2/config/webpack.prod.js index 1b73b19959c..8ed049c3cb7 100644 --- a/demo-shell-ng2/config/webpack.prod.js +++ b/demo-shell-ng2/config/webpack.prod.js @@ -1,104 +1,79 @@ -var webpack = require('webpack'); -var webpackMerge = require('webpack-merge'); -var ExtractTextPlugin = require('extract-text-webpack-plugin'); -var CopyWebpackPlugin = require('copy-webpack-plugin'); -var commonConfig = require('./webpack.common.js'); -var helpers = require('./helpers'); +const webpack = require('webpack'); +const webpackMerge = require('webpack-merge'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const commonConfig = require('./webpack.common.js'); +const helpers = require('./helpers'); +const CopyWebpackPlugin = require('copy-webpack-plugin'); const ENV = process.env.NODE_ENV = process.env.ENV = 'production'; -module.exports = webpackMerge(commonConfig, { - devtool: 'source-map', - - output: { - path: helpers.root('dist'), - publicPath: '/', - filename: '[name].[hash].js', - chunkFilename: '[id].[hash].chunk.js' - }, - - htmlLoader: { - minimize: false // workaround for ng2 - }, +const alfrescoLibs = [ + 'ng2-activiti-analytics', + 'ng2-activiti-diagrams', + 'ng2-activiti-form', + 'ng2-activiti-processlist', + 'ng2-activiti-tasklist', + 'ng2-alfresco-core', + 'ng2-alfresco-datatable', + 'ng2-alfresco-documentlist', + 'ng2-alfresco-login', + 'ng2-alfresco-search', + 'ng2-alfresco-tag', + 'ng2-alfresco-upload', + 'ng2-alfresco-userinfo', + 'ng2-alfresco-viewer', + 'ng2-alfresco-webscript' +]; - plugins: [ - // Define env variables to help with builds - // Reference: https://webpack.github.io/docs/list-of-plugins.html#defineplugin - new webpack.DefinePlugin({ - 'process.env': { - 'ENV': JSON.stringify(ENV) - } - }), - - // Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin - // Only emit files when there are no errors - new webpack.NoErrorsPlugin(), +module.exports = webpackMerge(commonConfig, { - // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin - // Dedupe modules in the output - new webpack.optimize.DedupePlugin(), + devtool: 'source-map', - // Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin - // Minify all javascript, switch loaders to minimizing mode - new webpack.optimize.UglifyJsPlugin({ - output:{ - comments: false - }, - mangle: { - keep_fnames: true - }, - compressor: { - screw_ie8: true, - warnings: false - } - }), + output: { + path: helpers.root('dist'), + publicPath: '/', + filename: '[name].[hash].js', + chunkFilename: '[id].[hash].chunk.js' + }, - // Extract css files - // Reference: https://github.com/webpack/extract-text-webpack-plugin - // Disabled when in test mode or not in build mode - new ExtractTextPlugin('[name].[hash].css'), + resolve: { + extensions: ['.ts', '.js'], + modules: [helpers.root('node_modules')] + }, - // Copy assets from the public folder - // Reference: https://github.com/kevlened/copy-webpack-plugin - new CopyWebpackPlugin([ - { - from: 'favicon-96x96.png' - }, - { - from: 'node_modules/pdfjs-dist/build/pdf.worker.js', - to: 'pdf.worker.js' - }, - { - context: 'resources/i18n', - from: '**/*.json', - to: 'resources/i18n' - }, - // Copy i18n folders for all modules with ng2-alfresco- prefix - { - context: 'node_modules', - from: 'ng2-alfresco-*/src/i18n/*.json', - to: 'node_modules' - }, - // Copy i18n folders for all modules with ng2-activiti- prefix - { - context: 'node_modules', - from: 'ng2-activiti-*/src/i18n/*.json', - to: 'node_modules' - }, - // Copy asstes folders for all modules with ng2-activiti- prefix - { - context: 'node_modules', - from: 'ng2-activiti-*/src/assets/images/*.*', - to: 'assets/images', - flatten : true - }, - // Copy asstes folders for all modules with ng2-alfresco- prefix - { - context: 'node_modules', - from: 'ng2-alfresco-*/src/assets/images/*.*', - to: 'assets/images', - flatten : true - } - ]) - ] + plugins: [ + new CopyWebpackPlugin([ + ... alfrescoLibs.map(lib => { + return { + context: `node_modules/${lib}/bundles/assets/` , + from: '**/*', + to: `assets/` + } + }) + ]), + new webpack.NoEmitOnErrorsPlugin(), + new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618 + mangle: { + keep_fnames: true + }, + compress: { + warnings: false + }, + output: { + comments: false + }, + sourceMap: true + }), + new ExtractTextPlugin('[name].[hash].css'), + new webpack.DefinePlugin({ + 'process.env': { + 'ENV': JSON.stringify(ENV) + } + }), + new webpack.LoaderOptionsPlugin({ + htmlLoader: { + minimize: false // workaround for ng2 + } + }) + ] }); diff --git a/demo-shell-ng2/config/webpack.test.js b/demo-shell-ng2/config/webpack.test.js index c9bcd38d21d..c03156628c8 100644 --- a/demo-shell-ng2/config/webpack.test.js +++ b/demo-shell-ng2/config/webpack.test.js @@ -1,78 +1,46 @@ -var helpers = require('./helpers'); -var fs = require('fs'); -var glob = require('glob'); - -const rootPath = helpers.root('node_modules'); - -var pattern = '+(alfresco-js-api|ng2-alfresco|ng2-activiti)*'; -var options = { - cwd: rootPath, - realpath: true -}; - -var alfrescoLibs = glob.sync(pattern, options); +const webpack = require('webpack'); +const helpers = require('./helpers'); module.exports = { - devtool: 'inline-source-map', - - resolve: { - extensions: ['', '.ts', '.js'], - modules: [ - helpers.root('app'), - helpers.root('node_modules') - ], - root: rootPath, - fallback: rootPath - }, - resolveLoader: { - alias: { - 'systemjs-loader': helpers.root('config', 'loaders', 'system.js') - }, - fallback: rootPath - }, - - module: { - preLoaders: [ - { - test: /\.js$/, - include: [ - ...alfrescoLibs - ], - loader: 'source-map-loader' - } - ], - loaders: [ - { - test: /\.ts$/, - loaders: ['awesome-typescript-loader', 'angular2-template-loader', 'systemjs-loader'], - exclude: ['node_modules','public'] - }, - { - test: /\.js$/, - include: [ - ...alfrescoLibs - ], - loaders: ['angular2-template-loader', 'source-map-loader', 'systemjs-loader'] - }, - { - test: /\.html$/, - loader: 'html' - - }, - { - test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, - loader: 'null' - }, - { - test: /\.css$/, - loader: 'raw' - } + devtool: 'inline-source-map', + + resolve: { + extensions: ['.ts', '.js'], + modules: [helpers.root('../ng2-components'), helpers.root('node_modules')] + }, + + module: { + rules: [ + { + test: /\.ts$/, + loaders: ['ts-loader', 'angular2-template-loader'], + exclude: [ /public/, /resources/, /dist/] + }, + { + test: /\.html$/, + loader: 'html-loader', + exclude: [ /public/, /resources/, /dist/] + + }, + { + test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/, + loader: 'null-loader' + }, + { + test: /\.css$/, + loader: ['to-string-loader', 'css-loader'], + exclude: [ /public/, /resources/, /dist/] + } + ] + }, + + plugins: [ + new webpack.ContextReplacementPlugin( + // The (\\|\/) piece accounts for path separators in *nix and Windows + /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, + helpers.root('./src'), // location of your src + {} // a map of your routes + ) ] - }, - - node: { - fs: 'empty', - module: false - } } diff --git a/demo-shell-ng2/index.html b/demo-shell-ng2/index.html index 0e8d01209c3..7e93895ca92 100644 --- a/demo-shell-ng2/index.html +++ b/demo-shell-ng2/index.html @@ -7,13 +7,6 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_audio.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_audio.svg new file mode 100755 index 00000000000..f3836172dd5 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_audio.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_database.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_database.svg new file mode 100755 index 00000000000..6f7cbdb5ddf --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_database.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_document.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_document.svg new file mode 100755 index 00000000000..62e011d124d --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_document.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ebook.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ebook.svg new file mode 100755 index 00000000000..c26452389f4 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ebook.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder.svg new file mode 100755 index 00000000000..aff7d2871d0 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder_empty.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder_empty.svg new file mode 100755 index 00000000000..54d0b9003ac --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_folder_empty.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_form.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_form.svg new file mode 100755 index 00000000000..d46e889326b --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_form.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_docs.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_docs.svg new file mode 100755 index 00000000000..1d9a03515bb --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_docs.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_drawings.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_drawings.svg new file mode 100755 index 00000000000..a1eae45e657 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_drawings.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_forms.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_forms.svg new file mode 100755 index 00000000000..d8946f40f90 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_forms.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_sheets.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_sheets.svg new file mode 100755 index 00000000000..d6a96c144a1 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_sheets.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_slides.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_slides.svg new file mode 100755 index 00000000000..61fab21ab7b --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_google_slides.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_miscellaneous.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_miscellaneous.svg new file mode 100755 index 00000000000..a6bd024609d --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_miscellaneous.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_excel.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_excel.svg new file mode 100755 index 00000000000..b98380dd765 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_excel.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_powerpoint.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_powerpoint.svg new file mode 100755 index 00000000000..a6166744c73 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_powerpoint.svg @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_word.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_word.svg new file mode 100755 index 00000000000..046efc4f834 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_ms_word.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_pdf.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_pdf.svg new file mode 100755 index 00000000000..4d6d4b388dc --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_pdf.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_presentation.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_presentation.svg new file mode 100755 index 00000000000..7dce6d633c6 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_presentation.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_raster_image.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_raster_image.svg new file mode 100755 index 00000000000..d48242ce6d9 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_raster_image.svg @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_spreadsheet.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_spreadsheet.svg new file mode 100755 index 00000000000..9de23268807 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_spreadsheet.svg @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_vector_image.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_vector_image.svg new file mode 100755 index 00000000000..cfa5dbe4bd3 --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_vector_image.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_video.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_video.svg new file mode 100755 index 00000000000..b93d993619c --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_video.svg @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_website.svg b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_website.svg new file mode 100755 index 00000000000..220bab2a91b --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/assets/images/ft_ic_website.svg @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts new file mode 100644 index 00000000000..d03020274cb --- /dev/null +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable-cell.component.ts @@ -0,0 +1,48 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, Input, ChangeDetectionStrategy } from '@angular/core'; +import { DataTableAdapter, DataColumn, DataRow } from '../../data/index'; + +@Component({ + selector: 'alfresco-datatable-cell', + changeDetection: ChangeDetectionStrategy.OnPush, + template: '{{value}}' +}) +export class DataTableCellComponent { + + @Input() + data: DataTableAdapter; + + @Input() + column: DataColumn; + + @Input() + row: DataRow; + + @Input() + value: any; + + constructor() { } + + ngOnInit() { + if (this.column && this.column.key && this.row && this.data) { + this.value = this.data.getValue(this.row, this.column); + } + } + +} diff --git a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html index db3f470479c..1343f025bc5 100644 --- a/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html +++ b/ng2-components/ng2-alfresco-datatable/src/components/datatable/datatable.component.html @@ -65,15 +65,21 @@ {{asIconValue(row, col)}} {{iconAltTextKey(data.getValue(row, col))|translate}} + +
+ {{ iconAltTextKey(data.getValue(row, col)) | translate }}
- {{data.getValue(row, col)}} +
- {{data.getValue(row, col)}} +
@@ -95,7 +101,7 @@