create bundle for all components

This commit is contained in:
Eugenio Romano
2016-12-14 15:49:08 +00:00
parent dfc8a0814c
commit e133fd6408
350 changed files with 8829 additions and 3002 deletions

2
.gitignore vendored
View File

@@ -8,3 +8,5 @@ demo-shell-ng2/app/components/router/
ng2-components/ng2-alfresco-userinfo-old/demo/src/app/
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/

View File

@@ -9,6 +9,23 @@ import '@angular/router';
// RxJS
import 'rxjs';
//Alfresco
import 'ng2-alfresco-core'
import 'ng2-alfresco-datatable'
import 'ng2-activiti-diagrams'
import 'ng2-activiti-analytics'
import 'ng2-activiti-form'
import 'ng2-activiti-processlist'
import 'ng2-activiti-tasklist'
import 'ng2-alfresco-documentlist'
import 'ng2-alfresco-login'
import 'ng2-alfresco-search'
import 'ng2-alfresco-tag'
import 'ng2-alfresco-upload'
import 'ng2-alfresco-viewer'
import 'ng2-alfresco-webscript'
import 'ng2-alfresco-userinfo'
// Other vendors for example jQuery, Lodash or Bootstrap
// You can import js, ts, css, sass, ...

View File

@@ -2,23 +2,64 @@ 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');
module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-eval-source-map',
devtool: 'cheap-module-source-map',
output: {
path: helpers.root('dist'),
publicPath: 'http://localhost:3000/',
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
output: {
path: helpers.root('dist'),
publicPath: 'http://localhost:3000/',
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
plugins: [
new ExtractTextPlugin('[name].css')
],
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: 'custom-translation',
from: '**/*.json',
to: 'i18n/custom-translation'
},
// 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
}
])
],
devServer: {
historyApiFallback: true,
stats: 'minimal'
}
devServer: {
historyApiFallback: true,
stats: 'minimal'
}
});

View File

@@ -73,14 +73,28 @@ module.exports = webpackMerge(commonConfig, {
// Copy i18n folders for all modules with ng2-alfresco- prefix
{
context: 'node_modules',
from: 'ng2-alfresco-*/dist/src/i18n/*.json',
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-*/dist/src/i18n/*.json',
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
}
])
]

View File

@@ -4,8 +4,9 @@
"version": "0.5.0",
"author": "Alfresco Software, Ltd.",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings dist",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings dist",
"start": "webpack-dev-server --inline --progress --port 3000",
"clean-build": "rimraf 'app/{,**/}**.js' 'app/{,**/}**.js.map' 'app/{,**/}**.d.ts'",
"test": "karma start",
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"aws": "node app.js",
@@ -57,13 +58,11 @@
"@angular/platform-browser": "~2.2.0",
"@angular/platform-browser-dynamic": "~2.2.0",
"@angular/router": "~3.2.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.26",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"ng2-translate": "2.5.0",
@@ -93,19 +92,18 @@
"element.scrollintoviewifneeded-polyfill": "^1.0.1"
},
"devDependencies": {
"license-check": "1.1.5",
"mime": "^1.3.4",
"tslint": "3.15.1",
"@types/jasmine": "^2.5.35",
"@types/node": "^6.0.45",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^2.2.4",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"glob": "^7.1.1",
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.15.0",
"intl": "^1.2.5",
"jasmine-core": "^2.4.1",
"karma": "^1.2.0",
"karma-jasmine": "^1.0.2",
@@ -113,19 +111,20 @@
"karma-phantomjs-launcher": "^1.0.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"license-check": "1.1.5",
"mime": "^1.3.4",
"null-loader": "^0.1.1",
"phantomjs-prebuilt": "^2.1.7",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.2",
"script-loader": "^0.7.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.1",
"tslint": "3.15.1",
"typescript": "2.0.3",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1",
"webpack-merge": "^0.14.0",
"source-map-loader": "^0.1.5",
"script-loader": "^0.7.0",
"copy-webpack-plugin": "^4.0.1",
"glob": "^7.1.1"
"webpack-merge": "^0.14.0"
},
"license-check-config": {
"src": [

View File

@@ -6,10 +6,14 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
index.js
index.js.map
!systemjs.config.js
*.tgz
/package/
/bundles/
index.d.ts

View File

@@ -2,14 +2,23 @@ npm-debug.log
.idea
coverage/
demo/
node_modules
typings/
fonts/
/.editorconfig
/.travis.yml
/*.js
*.ts
!*.d.ts
!*.js
!*.js.map
/*.json
/*.ts
/*.js.map
*.spec.js
*.tgz
/.npmignore
/karma-test-shim.js
/karma.conf.js
/make.js
/package/

View File

@@ -0,0 +1,23 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[package.json]
indent_style = space
indent_size = 2
[karma.conf.js]
indent_style = space
indent_size = 2
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -5,15 +5,16 @@
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings dist",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings dist",
"clean-build" : "rimraf 'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts'",
"postinstall": "npm run build",
"start": "npm run build && concurrently \"npm run tsc:w\" \"npm run server\" ",
"server": "wsrv -o -s -l",
"build": "npm run tslint && rimraf dist && tsc",
"build:w": "npm run tslint && rimraf dist && tsc -w",
"build": "npm run tslint && npm run clean-build && npm run tsc",
"build:w": "npm run tslint && rimraf dist && npm run tsc:w",
"tsc": "tsc",
"tsc:w": "tsc -w",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts"
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts -e '{,**/}**.d.ts'"
},
"license": "Apache-2.0",
"contributors": [
@@ -30,31 +31,31 @@
"activiti-diagrams"
],
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/common": "2.2.2",
"@angular/compiler": "2.2.2",
"@angular/compiler-cli": "2.2.2",
"@angular/core": "2.2.2",
"@angular/forms": "2.2.2",
"@angular/http": "2.2.2",
"@angular/platform-browser": "2.2.2",
"@angular/platform-browser-dynamic": "2.2.2",
"@angular/router": "3.2.2",
"@angular/upgrade": "2.2.2",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"intl": "1.2.4",
"dialog-polyfill": "^0.4.3",
"element.scrollintoviewifneeded-polyfill": "^1.0.1",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"chart.js": "^2.1.4",
"md-date-time-picker": "^2.2.0",
"ng2-charts": "1.1.0",
"moment": "2.15.1",
"raphael": "^2.2.6",
"ng2-translate": "2.5.0",
"alfresco-js-api": "^0.5.0",
"ng2-alfresco-core": "0.5.0",
@@ -62,9 +63,8 @@
"ng2-activiti-analytics": "^0.5.0"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/core-js": "^0.9.32",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"rimraf": "2.5.2",
"tslint": "^3.8.1",

View File

@@ -11,7 +11,7 @@
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'dist',
app: 'src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -27,9 +27,9 @@
'ng2-charts': 'npm:ng2-charts',
'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams/dist',
'ng2-activiti-analytics': 'npm:ng2-activiti-analytics/dist'
'ng2-alfresco-core': 'npm:ng2-alfresco-core',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams',
'ng2-activiti-analytics': 'npm:ng2-activiti-analytics'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
@@ -40,6 +40,7 @@
rxjs: {
defaultExtension: 'js'
},
'moment': 'npm:moment/min/moment.min.js',
'ng2-translate': { defaultExtension: 'js' },
'ng2-charts': { main: 'ng2-charts.js', defaultExtension: 'js'},
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},

View File

@@ -3,11 +3,10 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"skipLibCheck": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
@@ -15,12 +14,19 @@
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"types": ["core-js", "jasmine", "node"]
"removeComments": true,
"declaration": true,
"lib": [
"es2015",
"dom"
],
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"demo",
"node_modules",
"dist"
]
"node_modules"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true
}
}

View File

@@ -0,0 +1,309 @@
import * as gulp from 'gulp';
import * as util from 'gulp-util';
import * as runSequence from 'run-sequence';
import * as gulpLoadPlugins from 'gulp-load-plugins';
import * as merge from 'merge-stream';
import * as rimraf from 'rimraf';
import { join } from 'path';
import * as Builder from 'systemjs-builder';
var autoprefixer = require('autoprefixer');
import * as cssnano from 'cssnano';
import * as filter from 'gulp-filter';
var APP_SRC = `.`;
var CSS_PROD_BUNDLE = 'main.css';
var JS_PROD_SHIMS_BUNDLE = 'shims.js';
var NG_FACTORY_FILE = 'main-prod';
const BUILD_TYPES = {
DEVELOPMENT: 'dev',
PRODUCTION: 'prod'
};
function normalizeDependencies(deps) {
deps
.filter((d) => !/\*/.test(d.src)) // Skip globs
.forEach((d) => d.src = require.resolve(d.src));
return deps;
}
function filterDependency(type: string, d): boolean {
const t = d.buildType || d.env;
d.buildType = t;
if (!t) {
d.buildType = Object.keys(BUILD_TYPES).map(k => BUILD_TYPES[k]);
}
if (!(d.buildType instanceof Array)) {
(<any>d).env = [d.buildType];
}
return d.buildType.indexOf(type) >= 0;
}
function getInjectableDependency() {
var APP_ASSETS = [
{src: `src/css/main.css`, inject: true, vendor: false},
];
var NPM_DEPENDENCIES = [
{src: 'zone.js/dist/zone.js', inject: 'libs'},
{src: 'core-js/client/shim.min.js', inject: 'shims'},
{src: 'intl/dist/Intl.min.js', inject: 'shims'},
{src: 'systemjs/dist/system.src.js', inject: 'shims', buildType:'dev'}
];
return normalizeDependencies(NPM_DEPENDENCIES.filter(filterDependency.bind(null, 'dev')))
.concat(APP_ASSETS.filter(filterDependency.bind(null, 'dev')));
}
const plugins = <any>gulpLoadPlugins();
let tsProjects: any = {};
function makeTsProject(options: Object = {}) {
let optionsHash = JSON.stringify(options);
if (!tsProjects[optionsHash]) {
let config = Object.assign({
typescript: require('typescript')
}, options);
tsProjects[optionsHash] =
plugins.typescript.createProject('tsconfig.json', config);
}
return tsProjects[optionsHash];
}
gulp.task('build.html_css', () => {
const gulpConcatCssConfig = {
targetFile: CSS_PROD_BUNDLE,
options: {
rebaseUrls: false
}
};
const processors = [
autoprefixer({
browsers: [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
]
})
];
const reportPostCssError = (e: any) => util.log(util.colors.red(e.message));
processors.push(
cssnano({
discardComments: {removeAll: true},
discardUnused: false, // unsafe, see http://goo.gl/RtrzwF
zindex: false, // unsafe, see http://goo.gl/vZ4gbQ
reduceIdents: false // unsafe, see http://goo.gl/tNOPv0
})
);
/**
* Processes the CSS files within `src/client` excluding those in `src/client/assets` using `postcss` with the
* configured processors
* Execute the appropriate component-stylesheet processing method based on user stylesheet preference.
*/
function processComponentStylesheets() {
return gulp.src(join('src/**', '*.css'))
.pipe(plugins.cached('process-component-css'))
.pipe(plugins.postcss(processors))
.on('error', reportPostCssError);
}
/**
* Get a stream of external css files for subsequent processing.
*/
function getExternalCssStream() {
return gulp.src(getExternalCss())
.pipe(plugins.cached('process-external-css'));
}
/**
* Get an array of filenames referring to all external css stylesheets.
*/
function getExternalCss() {
return getInjectableDependency().filter(dep => /\.css$/.test(dep.src)).map(dep => dep.src);
}
/**
* Processes the external CSS files using `postcss` with the configured processors.
*/
function processExternalCss() {
return getExternalCssStream()
.pipe(plugins.postcss(processors))
.pipe(plugins.concatCss(gulpConcatCssConfig.targetFile, gulpConcatCssConfig.options))
.on('error', reportPostCssError);
}
return merge(processComponentStylesheets(), processExternalCss());
});
gulp.task('build.bundles.app', (done) => {
var BUNDLER_OPTIONS = {
format: 'umd',
minify: false,
mangle: false,
sourceMaps: true
};
var CONFIG_TYPESCRIPT = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: 'node_modules/typescript/lib/typescript.js',
'@angular': 'node_modules/@angular',
rxjs: 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'alfresco-js-api': 'node_modules/alfresco-js-api/dist/alfresco-js-api',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/',
'ng2-activiti-diagrams': 'node_modules/ng2-activiti-diagrams/',
'ng2-activiti-analytics': 'node_modules/ng2-activiti-analytics/',
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/',
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist/',
'ng2-activiti-form': 'node_modules/ng2-activiti-form/',
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login/',
'ng2-activiti-processlist': 'node_modules/ng2-activiti-processlist/',
'ng2-alfresco-search': 'node_modules/ng2-alfresco-search/',
'ng2-activiti-tasklist': 'node_modules/ng2-activiti-tasklist/',
'ng2-alfresco-tag': 'node_modules/ng2-alfresco-tag/',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload/',
'ng2-alfresco-userinfo': 'node_modules/ng2-alfresco-userinfo/',
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/',
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/',
'ng2-charts': 'node_modules/ng2-charts',
'moment': 'node_modules/moment/min/moment.min'
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/@angular/*': {build: false},
'node_modules/rxjs/*': {build: false},
'node_modules/ng2-translate/*': {build: false},
'node_modules/ng2-charts/*': {build: false},
'node_modules/ng2-alfresco-core/*': {build: false},
'node_modules/ng2-activiti-diagrams/*': {build: false},
'node_modules/ng2-activiti-analytics/*': {build: false},
'node_modules/ng2-alfresco-datatable/*': {build: false},
'node_modules/ng2-alfresco-documentlist/*': {build: false},
'node_modules/ng2-activiti-form/*': {build: false},
'node_modules/ng2-alfresco-login/*': {build: false},
'node_modules/ng2-activiti-processlist/*': {build: false},
'node_modules/ng2-alfresco-search/*': {build: false},
'node_modules/ng2-activiti-tasklist/*': {build: false},
'node_modules/ng2-alfresco-tag/*': {build: false},
'node_modules/ng2-alfresco-upload/*': {build: false},
'node_modules/ng2-alfresco-userinfo/*': {build: false},
'node_modules/ng2-alfresco-viewer/*': {build: false},
'node_modules/ng2-alfresco-webscript/*': {build: false}
}
};
var pkg = require('./package.json');
var namePkg = pkg.name;
var builder = new Builder(CONFIG_TYPESCRIPT);
builder
.buildStatic(APP_SRC + "/index", 'bundles/' + namePkg + '.js', BUNDLER_OPTIONS)
.then(function () {
return done();
})
.catch(function (err) {
return done(err);
});
});
gulp.task('build.assets.prod', () => {
return gulp.src([
join('src/**', '*.ts'),
'index.ts',
join('src/**', '*.css'),
join('src/**', '*.html'),
'!'+join('*/**', '*.d.ts'),
'!'+join('*/**', '*.spec.ts'),
'!gulpfile.ts'])
});
gulp.task('build.bundles', () => {
merge(bundleShims());
/**
* Returns the shim files to be injected.
*/
function getShims() {
let libs = getInjectableDependency()
.filter(d => /\.js$/.test(d.src));
return libs.filter(l => l.inject === 'shims')
.concat(libs.filter(l => l.inject === 'libs'))
.concat(libs.filter(l => l.inject === true))
.map(l => l.src);
}
/**
* Bundles the shim files.
*/
function bundleShims() {
return gulp.src(getShims())
.pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
// Strip the first (global) 'use strict' added by reflect-metadata, but don't strip any others to avoid unintended scope leaks.
.pipe(plugins.replace(/('|")use strict\1;var Reflect;/, 'var Reflect;'))
.pipe(gulp.dest('bundles'));
}
});
gulp.task('build.js.prod', () => {
const INLINE_OPTIONS = {
base: APP_SRC,
target: 'es5',
useRelativePaths: true,
removeLineBreaks: true
};
let tsProject = makeTsProject();
let src = [
join('src/**/*.ts'),
join('!src/**/*.d.ts'),
join('!src/**/*.spec.ts'),
`!src/**/${NG_FACTORY_FILE}.ts`
];
let result = gulp.src(src)
.pipe(plugins.plumber())
.pipe(plugins.inlineNg2Template(INLINE_OPTIONS))
.pipe(tsProject())
.once('error', function (e: any) {
this.once('finish', () => process.exit(1));
});
return result.js
.pipe(plugins.template())
.pipe(gulp.dest('src'))
.on('error', (e: any) => {
console.log(e);
});
});
gulp.task('build.prod', (done: any) =>
runSequence(
'build.assets.prod',
'build.html_css',
'build.js.prod',
'build.bundles',
'build.bundles.app',
done));

View File

@@ -5,7 +5,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
__karma__.loaded = function() {};
var builtPath = '/base/dist/';
var builtPath = '/base/src/';
function isJsFile(path) {
return path.slice(-3) == '.js';
@@ -29,7 +29,7 @@ var paths = {
};
var map = {
'app': 'base/dist',
'app': 'base/src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -57,9 +57,8 @@ var map = {
'moment' : 'npm:moment/min/moment.min.js',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-activiti-analytics': 'npm:ng2-activiti-analytics/dist',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist'
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams',
'ng2-alfresco-core': 'npm:ng2-alfresco-core'
};
var packages = {
@@ -71,7 +70,6 @@ var packages = {
'moment': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-activiti-analytics': { main: './index.js', defaultExtension: 'js'},
'ng2-activiti-diagrams': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'}
};

View File

@@ -24,8 +24,8 @@ module.exports = function (config) {
'node_modules/zone.js/dist/fake-async-test.js',
// RxJs
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false},
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
// Paths loaded via module imports:
// Angular itself
@@ -41,20 +41,25 @@ module.exports = function (config) {
'karma-test-shim.js',
// paths loaded via module imports
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
{pattern: 'src/**/*.js', included: false, watched: true},
{pattern: 'src/**/*.html', included: true, served: true, watched: true},
{pattern: 'src/**/*.css', included: true, served: true, watched: true},
// ng2-components
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-diagrams/dist/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/src/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/index.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-diagrams/src/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-activiti-diagrams/index.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-charts/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/md-date-time-picker/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/moment/**/*.js', included: false, served: true, watched: false },
// paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
{pattern: 'src/**/*.js.map', included: false, watched: false},
{pattern: 'src/**/*.json', included: false, watched: false}
],
exclude: [
@@ -102,7 +107,7 @@ module.exports = function (config) {
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'dist/**/!(*spec|index|*mock|*model).js': 'coverage'
'src/**/!(*spec|index|*mock|*model).js': 'coverage'
},
coverageReporter: {

View File

@@ -3,26 +3,28 @@
"description": "Activiti Angular2 Analytics Component",
"version": "0.5.0",
"author": "Alfresco Software, Ltd.",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings",
"build": "npm run tslint && rimraf dist && tsc && npm run copy-dist && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"license-check\"",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json 'src/{,**/}**.ts'",
"copy-dist": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src",
"copy-dist:w": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src -w",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings",
"clean-build": "rimraf index.js index.js.map index.d.ts'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts' bundles",
"build": "npm run clean-build && npm run tslint && rimraf dist && tsc && license-check && npm run build.umd",
"build:w": "npm run clean-build && npm run tslint && rimraf dist && tsc:w && license-check npm run build.umd",
"tslint": "tslint -c tslint.json 'src/{,**/}**.ts' 'index.ts' -e '{,**/}**.d.ts' -e './gulpfile.ts'",
"tsc": "tsc",
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",
"travis": "npm link ng2-alfresco-core ng2-activiti-diagrams"
"travis": "npm link ng2-alfresco-core ng2-activiti-diagrams",
"gulp": "gulp",
"build.umd": "gulp build.prod --color --env-config prod --build-type prod",
"reinstall": "npm cache clean && npm install"
},
"main": "bundles/ng2-activiti-analytics.js",
"module": "./index.js",
"typings": "./index.d.ts",
"contributors": [
{
"name": "Mario Romano",
@@ -54,35 +56,52 @@
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"chart.js": "^2.1.4",
"md-date-time-picker": "^2.2.0",
"ng2-charts": "1.1.0",
"moment": "2.15.1",
"raphael": "^2.2.6",
"alfresco-js-api": "^0.5.0",
"ng2-translate": "2.5.0",
"ng2-alfresco-core": "0.5.0",
"ng2-activiti-diagrams": "0.5.0"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"cpx": "1.3.1",
"cssnano": "^3.8.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-cached": "^1.1.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^2.3.0",
"gulp-filter": "^4.0.0",
"gulp-inline-ng2-template": "^4.0.0",
"gulp-load-plugins": "^1.4.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.2.0",
"gulp-replace": "^0.5.4",
"gulp-template": "^4.0.0",
"gulp-typescript": "^3.1.3",
"gulp-uglify": "^2.0.0",
"intl": "^1.2.5",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-mocha-reporter": "2.0.3",
"karma-jasmine-html-reporter": "0.2.0",
"karma-mocha-reporter": "2.0.3",
"license-check": "1.1.5",
"remap-istanbul": "0.6.3",
"rimraf": "2.5.2",
"run-sequence": "^1.2.2",
"systemjs-builder": "^0.15.34",
"traceur": "0.0.91",
"ts-node": "^1.7.0",
"tslint": "3.15.1",
"typescript": "^2.0.3",
"wsrv": "^0.1.5"
@@ -93,7 +112,7 @@
],
"license-check-config": {
"src": [
"./dist/**/*.js"
"./src/**/*.js"
],
"path": "assets/license_header.txt",
"blocking": true,

View File

@@ -47,7 +47,7 @@ export class AnalyticsReportHeatMapComponent implements OnInit {
private analyticsService: AnalyticsService,
private formBuilder: FormBuilder) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/dist/src');
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
}
}

View File

@@ -68,7 +68,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
private analyticsService: AnalyticsService,
private formBuilder: FormBuilder ) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/dist/src');
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
}
}

View File

@@ -69,7 +69,7 @@ export class AnalyticsComponent implements OnChanges {
private analyticsService: AnalyticsService) {
console.log('AnalyticsComponent');
if (translate) {
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/dist/src');
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/src');
}
}

View File

@@ -27,6 +27,8 @@ function dateCheck(c: AbstractControl) {
return result ? {'greaterThan': true} : null;
}
declare let mdDateTimePicker: any;
@Component({
moduleId: module.id,
selector: 'date-range-widget',

View File

@@ -17,6 +17,8 @@
import { Input, AfterViewInit, Output, EventEmitter, SimpleChanges, OnChanges } from '@angular/core';
let componentHandler: any;
/**
* Base widget component.
*/

View File

@@ -15,6 +15,8 @@
* limitations under the License.
*/
import * as moment from 'moment';
export class Chart {
id: string;
type: string;
@@ -76,7 +78,7 @@ export class LineChart extends Chart {
export class BarChart extends Chart {
title: string;
titleKey: string;
labels: string[] = [];
labels: any = [];
datasets: any[] = [];
data: any[] = [];
xAxisType: string;

View File

@@ -3,11 +3,10 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"skipLibCheck": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
@@ -15,13 +14,24 @@
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"lib": ["es7", "dom"],
"types": ["jasmine", "node"]
"removeComments": true,
"declaration": true,
"lib": [
"es2015",
"dom"
],
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"demo",
"node_modules",
"dist"
]
"dist",
"tools",
"gulpfile.ts",
"gulpfile.d.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true
}
}

View File

@@ -53,7 +53,7 @@
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,

View File

@@ -6,10 +6,14 @@ coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
index.js
index.js.map
!systemjs.config.js
*.tgz
/package/
/bundles/
index.d.ts

View File

@@ -2,14 +2,23 @@ npm-debug.log
.idea
coverage/
demo/
node_modules
typings/
fonts/
/.editorconfig
/.travis.yml
/*.js
*.ts
!*.d.ts
!*.js
!*.js.map
/*.json
/*.ts
/*.js.map
*.spec.js
*.tgz
/.npmignore
/karma-test-shim.js
/karma.conf.js
/make.js
/package/

View File

@@ -1,372 +0,0 @@
/**
* Class to generate polyline
*
* @author Dmitry Farafonov
*/
var ANCHOR_TYPE= {
main: "main",
middle: "middle",
first: "first",
last: "last"
};
function Anchor(uuid, type, x, y) {
this.uuid = uuid;
this.x = x;
this.y = y;
this.type = (type == ANCHOR_TYPE.middle) ? ANCHOR_TYPE.middle : ANCHOR_TYPE.main;
};
Anchor.prototype = {
uuid: null,
x: 0,
y: 0,
type: ANCHOR_TYPE.main,
isFirst: false,
isLast: false,
ndex: 0,
typeIndex: 0
};
function Polyline(uuid, points, strokeWidth, paper) {
/* Array on coordinates:
* points: [{x: 410, y: 110}, 1
* {x: 570, y: 110}, 1 2
* {x: 620, y: 240}, 2 3
* {x: 750, y: 270}, 3 4
* {x: 650, y: 370}]; 4
*/
this.points = points;
/*
* path for graph
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
*/
this.path = [];
this.anchors = [];
if (strokeWidth) this.strokeWidth = strokeWidth;
this.paper = paper;
this.closePath = false;
this.init();
};
Polyline.prototype = {
id: null,
points: [],
path: [],
anchors: [],
strokeWidth: 1,
radius: 1,
showDetails: false,
paper: null,
element: null,
isDefaultConditionAvailable: false,
closePath: false,
init: function(points){
var linesCount = this.getLinesCount();
if (linesCount < 1)
return;
this.normalizeCoordinates();
// create anchors
this.pushAnchor(ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1);
for (var i = 1; i < linesCount; i++)
{
var line1 = this.getLine(i-1);
this.pushAnchor(ANCHOR_TYPE.main, line1.x2, line1.y2);
}
this.pushAnchor(ANCHOR_TYPE.last, this.getLine(linesCount-1).x2, this.getLine(linesCount-1).y2);
this.rebuildPath();
},
normalizeCoordinates: function(){
for(var i=0; i < this.points.length; i++){
this.points[i].x = parseFloat(this.points[i].x);
this.points[i].y = parseFloat(this.points[i].y);
}
},
getLinesCount: function(){
return this.points.length-1;
},
_getLine: function(i){
if (this.points.length > i && this.points[i]) {
return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i+1].x, y2: this.points[i+1].y};
} else {
return undefined;
}
},
getLine: function(i){
var line = this._getLine(i);
if (line != undefined) {
line.angle = this.getLineAngle(i);
}
return line;
},
getLineAngle: function(i){
var line = this._getLine(i);
return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
},
getLineLengthX: function(i){
var line = this.getLine(i);
return (line.x2 - line.x1);
},
getLineLengthY: function(i){
var line = this.getLine(i);
return (line.y2 - line.y1);
},
getLineLength: function(i){
return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2));
},
getAnchors: function(){
return this.anchors;
},
getAnchorsCount: function(type){
if (!type)
return this.anchors.length;
else {
var count = 0;
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.getType() == type) {
count++;
}
}
return count;
}
},
pushAnchor: function(type, x, y, index){
if (type == ANCHOR_TYPE.first) {
index = 0;
typeIndex = 0;
} else if (type == ANCHOR_TYPE.last) {
index = this.getAnchorsCount();
typeIndex = 0;
} else if (!index) {
index = this.anchors.length;
} else {
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.index > index) {
anchor.index++;
anchor.typeIndex++;
}
}
}
var anchor = new Anchor(this.id, ANCHOR_TYPE.main, x, y, index, typeIndex);
this.anchors.push(anchor);
},
getAnchor: function(position){
return this.anchors[position];
},
getAnchorByType: function(type, position){
if (type == ANCHOR_TYPE.first)
return this.anchors[0];
if (type == ANCHOR_TYPE.last)
return this.anchors[this.getAnchorsCount()-1];
for(var i=0; i < this.getAnchorsCount(); i++){
var anchor = this.anchors[i];
if (anchor.type == type) {
if( position == anchor.position)
return anchor;
}
}
return null;
},
addNewPoint: function(position, x, y){
//
for(var i = 0; i < this.getLinesCount(); i++){
var line = this.getLine(i);
if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) {
this.points.splice(i+1,0,{x: x, y: y});
break;
}
}
this.rebuildPath();
},
rebuildPath: function(){
var path = [];
for(var i = 0; i < this.getAnchorsCount(); i++){
var anchor = this.getAnchor(i);
var pathType = "";
if (i == 0)
pathType = "M";
else
pathType = "L";
// TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous
var targetX = anchor.x, targetY = anchor.y;
if (i>0 && i < this.getAnchorsCount()-1) {
// get new x,y
var cx = anchor.x, cy = anchor.y;
// pivot point of prev line
var AO = this.getLineLength(i-1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
var ED = this.getLineLengthY(i-1) * this.radius / AO;
var OD = this.getLineLengthX(i-1) * this.radius / AO;
targetX = anchor.x - OD;
targetY = anchor.y - ED;
if (AO < 2*this.radius && i>1) {
targetX = anchor.x - this.getLineLengthX(i-1)/2;
targetY = anchor.y - this.getLineLengthY(i-1)/2;;
}
// pivot point of next line
var AO = this.getLineLength(i);
if (AO < this.radius) {
AO = this.radius;
}
var ED = this.getLineLengthY(i) * this.radius / AO;
var OD = this.getLineLengthX(i) * this.radius / AO;
var nextSrcX = anchor.x + OD;
var nextSrcY = anchor.y + ED;
if (AO < 2*this.radius && i<this.getAnchorsCount()-2) {
nextSrcX = anchor.x + this.getLineLengthX(i)/2;
nextSrcY = anchor.y + this.getLineLengthY(i)/2;;
}
var dx0 = (cx - targetX) / 3,
dy0 = (cy - targetY) / 3,
ax = cx - dx0,
ay = cy - dy0,
dx1 = (cx - nextSrcX) / 3,
dy1 = (cy - nextSrcY) / 3,
bx = cx - dx1,
by = cy - dy1,
zx=nextSrcX, zy=nextSrcY;
} else if (i==1 && this.getAnchorsCount() == 2){
var AO = this.getLineLength(i-1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
}
// anti smoothing
if (this.strokeWidth%2 == 1) {
targetX += 0.5;
targetY += 0.5;
}
path.push([pathType, targetX, targetY]);
if (i>0 && i < this.getAnchorsCount()-1) {
path.push(["C", ax, ay, bx, by, zx, zy]);
}
}
if (this.closePath)
{
path.push(["Z"]);
}
this.path = path;
},
transform: function(transformation)
{
this.element.transform(transformation);
},
attr: function(attrs)
{
// TODO: foreach and set each
this.element.attr(attrs);
}
};
function Polygone(points, strokeWidth) {
/* Array on coordinates:
* points: [{x: 410, y: 110}, 1
* {x: 570, y: 110}, 1 2
* {x: 620, y: 240}, 2 3
* {x: 750, y: 270}, 3 4
* {x: 650, y: 370}]; 4
*/
this.points = points;
/*
* path for graph
* [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
*/
this.path = [];
this.anchors = [];
if (strokeWidth) this.strokeWidth = strokeWidth;
this.closePath = true;
this.init();
};
/*
* Poligone is inherited from Poliline: draws closedPath of polyline
*/
var Foo = function () { };
Foo.prototype = Polyline.prototype;
Polygone.prototype = new Foo();
Polygone.prototype.rebuildPath = function(){
var path = [];
for(var i = 0; i < this.getAnchorsCount(); i++){
var anchor = this.getAnchor(i);
var pathType = "";
if (i == 0)
pathType = "M";
else
pathType = "L";
var targetX = anchor.x, targetY = anchor.y;
// anti smoothing
if (this.strokeWidth%2 == 1) {
targetX += 0.5;
targetY += 0.5;
}
path.push([pathType, targetX, targetY]);
}
if (this.closePath)
path.push(["Z"]);
this.path = path;
};

View File

@@ -0,0 +1,23 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[package.json]
indent_style = space
indent_size = 2
[karma.conf.js]
indent_style = space
indent_size = 2
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -5,15 +5,16 @@
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings dist",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings dist",
"clean-build" : "rimraf 'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts'",
"postinstall": "npm run build",
"start": "npm run build && concurrently \"npm run tsc:w\" \"npm run server\" ",
"server": "wsrv -o -s -l",
"build": "npm run tslint && rimraf dist && tsc",
"build:w": "npm run tslint && rimraf dist && tsc -w",
"build": "npm run tslint && npm run clean-build && npm run tsc",
"build:w": "npm run tslint && rimraf dist && npm run tsc:w",
"tsc": "tsc",
"tsc:w": "tsc -w",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts"
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts -e '{,**/}**.d.ts'"
},
"license": "Apache-2.0",
"contributors": [
@@ -30,36 +31,35 @@
"activiti-diagrams"
],
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/common": "2.2.2",
"@angular/compiler": "2.2.2",
"@angular/compiler-cli": "2.2.2",
"@angular/core": "2.2.2",
"@angular/forms": "2.2.2",
"@angular/http": "2.2.2",
"@angular/platform-browser": "2.2.2",
"@angular/platform-browser-dynamic": "2.2.2",
"@angular/router": "3.2.2",
"@angular/upgrade": "2.2.2",
"alfresco-js-api": "^0.5.0",
"core-js": "^2.4.1",
"dialog-polyfill": "^0.4.3",
"element.scrollintoviewifneeded-polyfill": "^1.0.1",
"intl": "1.2.4",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"ng2-activiti-diagrams": "^0.5.0",
"ng2-alfresco-core": "0.5.0",
"ng2-translate": "2.5.0",
"raphael": "^2.2.6",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"intl": "1.2.4",
"dialog-polyfill": "^0.4.3",
"element.scrollintoviewifneeded-polyfill": "^1.0.1",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"raphael": "^2.2.6",
"ng2-translate": "2.5.0",
"alfresco-js-api": "^0.5.0",
"ng2-alfresco-core": "0.5.0",
"ng2-activiti-diagrams": "^0.5.0"
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/core-js": "^0.9.32",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"rimraf": "2.5.2",
"tslint": "^3.8.1",

View File

@@ -11,7 +11,7 @@
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'dist',
app: 'src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -23,11 +23,12 @@
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'moment': 'npm:moment/min/moment.min.js',
'raphael': 'npm:raphael',
'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams/dist'
'ng2-alfresco-core': 'npm:ng2-alfresco-core',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
@@ -38,6 +39,7 @@
rxjs: {
defaultExtension: 'js'
},
'moment': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'},

View File

@@ -3,11 +3,10 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"skipLibCheck": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
@@ -15,12 +14,19 @@
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"types": ["core-js", "jasmine", "node"]
"removeComments": true,
"declaration": true,
"lib": [
"es2015",
"dom"
],
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"demo",
"node_modules",
"dist"
]
"node_modules"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true
}
}

View File

@@ -0,0 +1,308 @@
import * as gulp from 'gulp';
import * as util from 'gulp-util';
import * as runSequence from 'run-sequence';
import * as gulpLoadPlugins from 'gulp-load-plugins';
import * as merge from 'merge-stream';
import * as rimraf from 'rimraf';
import { join } from 'path';
import * as Builder from 'systemjs-builder';
var autoprefixer = require('autoprefixer');
import * as cssnano from 'cssnano';
import * as filter from 'gulp-filter';
var APP_SRC = `.`;
var CSS_PROD_BUNDLE = 'main.css';
var JS_PROD_SHIMS_BUNDLE = 'shims.js';
var NG_FACTORY_FILE = 'main-prod';
const BUILD_TYPES = {
DEVELOPMENT: 'dev',
PRODUCTION: 'prod'
};
function normalizeDependencies(deps) {
deps
.filter((d) => !/\*/.test(d.src)) // Skip globs
.forEach((d) => d.src = require.resolve(d.src));
return deps;
}
function filterDependency(type: string, d): boolean {
const t = d.buildType || d.env;
d.buildType = t;
if (!t) {
d.buildType = Object.keys(BUILD_TYPES).map(k => BUILD_TYPES[k]);
}
if (!(d.buildType instanceof Array)) {
(<any>d).env = [d.buildType];
}
return d.buildType.indexOf(type) >= 0;
}
function getInjectableDependency() {
var APP_ASSETS = [
{src: `src/css/main.css`, inject: true, vendor: false},
];
var NPM_DEPENDENCIES = [
{src: 'zone.js/dist/zone.js', inject: 'libs'},
{src: 'core-js/client/shim.min.js', inject: 'shims'},
{src: 'intl/dist/Intl.min.js', inject: 'shims'},
{src: 'systemjs/dist/system.src.js', inject: 'shims', buildType:'dev'}
];
return normalizeDependencies(NPM_DEPENDENCIES.filter(filterDependency.bind(null, 'dev')))
.concat(APP_ASSETS.filter(filterDependency.bind(null, 'dev')));
}
const plugins = <any>gulpLoadPlugins();
let tsProjects: any = {};
function makeTsProject(options: Object = {}) {
let optionsHash = JSON.stringify(options);
if (!tsProjects[optionsHash]) {
let config = Object.assign({
typescript: require('typescript')
}, options);
tsProjects[optionsHash] =
plugins.typescript.createProject('tsconfig.json', config);
}
return tsProjects[optionsHash];
}
gulp.task('build.html_css', () => {
const gulpConcatCssConfig = {
targetFile: CSS_PROD_BUNDLE,
options: {
rebaseUrls: false
}
};
const processors = [
autoprefixer({
browsers: [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
]
})
];
const reportPostCssError = (e: any) => util.log(util.colors.red(e.message));
processors.push(
cssnano({
discardComments: {removeAll: true},
discardUnused: false, // unsafe, see http://goo.gl/RtrzwF
zindex: false, // unsafe, see http://goo.gl/vZ4gbQ
reduceIdents: false // unsafe, see http://goo.gl/tNOPv0
})
);
/**
* Processes the CSS files within `src/client` excluding those in `src/client/assets` using `postcss` with the
* configured processors
* Execute the appropriate component-stylesheet processing method based on user stylesheet preference.
*/
function processComponentStylesheets() {
return gulp.src(join('src/**', '*.css'))
.pipe(plugins.cached('process-component-css'))
.pipe(plugins.postcss(processors))
.on('error', reportPostCssError);
}
/**
* Get a stream of external css files for subsequent processing.
*/
function getExternalCssStream() {
return gulp.src(getExternalCss())
.pipe(plugins.cached('process-external-css'));
}
/**
* Get an array of filenames referring to all external css stylesheets.
*/
function getExternalCss() {
return getInjectableDependency().filter(dep => /\.css$/.test(dep.src)).map(dep => dep.src);
}
/**
* Processes the external CSS files using `postcss` with the configured processors.
*/
function processExternalCss() {
return getExternalCssStream()
.pipe(plugins.postcss(processors))
.pipe(plugins.concatCss(gulpConcatCssConfig.targetFile, gulpConcatCssConfig.options))
.on('error', reportPostCssError);
}
return merge(processComponentStylesheets(), processExternalCss());
});
gulp.task('build.bundles.app', (done) => {
var BUNDLER_OPTIONS = {
format: 'umd',
minify: false,
mangle: false,
sourceMaps: true
};
var CONFIG_TYPESCRIPT = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: 'node_modules/typescript/lib/typescript.js',
'@angular': 'node_modules/@angular',
rxjs: 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'alfresco-js-api': 'node_modules/alfresco-js-api/dist/alfresco-js-api',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/',
'ng2-activiti-diagrams': 'node_modules/ng2-activiti-diagrams/',
'ng2-activiti-analytics': 'node_modules/ng2-activiti-analytics/',
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/',
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist/',
'ng2-activiti-form': 'node_modules/ng2-activiti-form/',
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login/',
'ng2-activiti-processlist': 'node_modules/ng2-activiti-processlist/',
'ng2-alfresco-search': 'node_modules/ng2-alfresco-search/',
'ng2-activiti-tasklist': 'node_modules/ng2-activiti-tasklist/',
'ng2-alfresco-tag': 'node_modules/ng2-alfresco-tag/',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload/',
'ng2-alfresco-userinfo': 'node_modules/ng2-alfresco-userinfo/',
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/',
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/',
'ng2-charts' : 'node_modules/ng2-charts',
'raphael':'node_modules/raphael/raphael'
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/@angular/*': {build: false},
'node_modules/rxjs/*': {build: false},
'node_modules/ng2-translate/*': {build: false},
'node_modules/ng2-alfresco-core/*': {build: false},
'node_modules/ng2-activiti-diagrams/*': {build: false},
'node_modules/ng2-activiti-analytics/*': {build: false},
'node_modules/ng2-alfresco-datatable/*': {build: false},
'node_modules/ng2-alfresco-documentlist/*': {build: false},
'node_modules/ng2-activiti-form/*': {build: false},
'node_modules/ng2-alfresco-login/*': {build: false},
'node_modules/ng2-activiti-processlist/*': {build: false},
'node_modules/ng2-alfresco-search/*': {build: false},
'node_modules/ng2-activiti-tasklist/*': {build: false},
'node_modules/ng2-alfresco-tag/*': {build: false},
'node_modules/ng2-alfresco-upload/*': {build: false},
'node_modules/ng2-alfresco-userinfo/*': {build: false},
'node_modules/ng2-alfresco-viewer/*': {build: false},
'node_modules/ng2-alfresco-webscript/*': {build: false}
}
};
var pkg = require('./package.json');
var namePkg = pkg.name;
var builder = new Builder(CONFIG_TYPESCRIPT);
builder
.buildStatic(APP_SRC + "/index", 'bundles/' + namePkg + '.js', BUNDLER_OPTIONS)
.then(function () {
return done();
})
.catch(function (err) {
return done(err);
});
});
gulp.task('build.assets.prod', () => {
return gulp.src([
join('src/**', '*.ts'),
'index.ts',
join('src/**', '*.css'),
join('src/**', '*.html'),
'!'+join('*/**', '*.d.ts'),
'!'+join('*/**', '*.spec.ts'),
'!gulpfile.ts'])
});
gulp.task('build.bundles', () => {
merge(bundleShims());
/**
* Returns the shim files to be injected.
*/
function getShims() {
let libs = getInjectableDependency()
.filter(d => /\.js$/.test(d.src));
return libs.filter(l => l.inject === 'shims')
.concat(libs.filter(l => l.inject === 'libs'))
.concat(libs.filter(l => l.inject === true))
.map(l => l.src);
}
/**
* Bundles the shim files.
*/
function bundleShims() {
return gulp.src(getShims())
.pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
// Strip the first (global) 'use strict' added by reflect-metadata, but don't strip any others to avoid unintended scope leaks.
.pipe(plugins.replace(/('|")use strict\1;var Reflect;/, 'var Reflect;'))
.pipe(gulp.dest('bundles'));
}
});
gulp.task('build.js.prod', () => {
const INLINE_OPTIONS = {
base: APP_SRC,
target: 'es5',
useRelativePaths: true,
removeLineBreaks: true
};
let tsProject = makeTsProject();
let src = [
join('src/**/*.ts'),
join('!src/**/*.d.ts'),
join('!src/**/*.spec.ts'),
`!src/**/${NG_FACTORY_FILE}.ts`
];
let result = gulp.src(src)
.pipe(plugins.plumber())
.pipe(plugins.inlineNg2Template(INLINE_OPTIONS))
.pipe(tsProject())
.once('error', function (e: any) {
this.once('finish', () => process.exit(1));
});
return result.js
.pipe(plugins.template())
.pipe(gulp.dest('src'))
.on('error', (e: any) => {
console.log(e);
});
});
gulp.task('build.prod', (done: any) =>
runSequence(
'build.assets.prod',
'build.html_css',
'build.js.prod',
'build.bundles',
'build.bundles.app',
done));

View File

@@ -5,7 +5,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
__karma__.loaded = function() {};
var builtPath = '/base/dist/';
var builtPath = '/base/src/';
function isJsFile(path) {
return path.slice(-3) == '.js';
@@ -29,7 +29,7 @@ var paths = {
};
var map = {
'app': 'base/dist',
'app': 'base/src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -52,17 +52,20 @@ var map = {
// other libraries
'rxjs': 'npm:rxjs',
'ng2-translate': 'npm:ng2-translate',
'ng2-charts' : 'npm:ng2-charts',
'raphael':'npm:raphael/raphael.js',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-activiti-diagrams': 'npm:ng2-activiti-diagrams/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist'
'ng2-alfresco-core': 'npm:ng2-alfresco-core'
};
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-charts': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-activiti-diagrams': { main: './index.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'}
};

View File

@@ -24,32 +24,36 @@ module.exports = function (config) {
'node_modules/zone.js/dist/fake-async-test.js',
// RxJs
{pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false},
{pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false},
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
// Paths loaded via module imports:
// Angular itself
{pattern: 'node_modules/@angular/**/*.js', included: false, watched: false},
{pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false},
'node_modules/chart.js/dist/Chart.js',
'node_modules/alfresco-js-api/dist/alfresco-js-api.js',
'node_modules/raphael/raphael.min.js',
'assets/Polyline.js',
'node_modules/raphael/raphael.js',
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, watched: false},
{pattern: 'node_modules/ng2-charts/**/*.js', included: false, served: true, watched: false},
'karma-test-shim.js',
// paths loaded via module imports
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
{pattern: 'src/**/*.js', included: false, watched: true},
{pattern: 'src/**/*.html', included: true, served: true, watched: true},
{pattern: 'src/**/*.css', included: true, served: true, watched: true},
// ng2-components
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/src/**/*.*', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/index.js', included: false, served: true, watched: false },
// paths to support debugging with source maps in dev tools
{pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
{pattern: 'src/**/*.json', included: false, watched: false},
{pattern: 'src/**/*.js.map', included: false, watched: false}
],
exclude: [
@@ -97,7 +101,7 @@ module.exports = function (config) {
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'dist/**/!(*spec|index|*mock|*model).js': 'coverage'
'src/**/!(*spec|index|*mock|*model).js': 'coverage'
},
coverageReporter: {

View File

@@ -3,26 +3,28 @@
"description": "Activiti Angular2 Diagrams Component",
"version": "0.5.0",
"author": "Alfresco Software, Ltd.",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings",
"build": "npm run tslint && rimraf dist && tsc && npm run copy-dist && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"license-check\"",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json 'src/{,**/}**.ts'",
"copy-dist": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src",
"copy-dist:w": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src -w",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings",
"clean-build": "rimraf index.js index.js.map index.d.ts'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts' bundles",
"build": "npm run clean-build && npm run tslint && rimraf dist && tsc && license-check && npm run build.umd",
"build:w": "npm run clean-build && npm run tslint && rimraf dist && tsc:w && license-check npm run build.umd",
"tslint": "tslint -c tslint.json 'src/{,**/}**.ts' 'index.ts' -e '{,**/}**.d.ts' -e './gulpfile.ts'",
"tsc": "tsc",
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",
"travis": "npm link ng2-alfresco-core"
"travis": "npm link ng2-alfresco-core",
"gulp": "gulp",
"build.umd": "gulp build.prod --color --env-config prod --build-type prod",
"reinstall": "npm cache clean && npm install"
},
"main": "bundles/ng2-activiti-diagrams.js",
"module": "./index.js",
"typings": "./index.d.ts",
"contributors": [
{
"name": "Maurizio Vitale",
@@ -50,30 +52,49 @@
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"raphael": "^2.2.6",
"chart.js": "^2.1.4",
"ng2-charts": "1.1.0",
"ng2-translate": "2.5.0",
"alfresco-js-api": "^0.5.0",
"ng2-alfresco-core": "0.5.0"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"cpx": "1.3.1",
"cssnano": "^3.8.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-cached": "^1.1.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^2.3.0",
"gulp-filter": "^4.0.0",
"gulp-inline-ng2-template": "^4.0.0",
"gulp-load-plugins": "^1.4.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.2.0",
"gulp-replace": "^0.5.4",
"gulp-template": "^4.0.0",
"gulp-typescript": "^3.1.3",
"gulp-uglify": "^2.0.0",
"intl": "^1.2.5",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-mocha-reporter": "2.0.3",
"karma-jasmine-html-reporter": "0.2.0",
"karma-mocha-reporter": "2.0.3",
"license-check": "1.1.5",
"remap-istanbul": "0.6.3",
"rimraf": "2.5.2",
"run-sequence": "^1.2.2",
"systemjs-builder": "^0.15.34",
"traceur": "0.0.91",
"ts-node": "^1.7.0",
"tslint": "3.15.1",
"typescript": "^2.0.3",
"wsrv": "^0.1.5"
@@ -85,7 +106,7 @@
],
"license-check-config": {
"src": [
"./dist/**/*.js"
"./src/**/*.js"
],
"path": "assets/license_header.txt",
"blocking": true,

View File

@@ -15,9 +15,23 @@
* limitations under the License.
*/
declare let moment: any;
declare let mdDateTimePicker: any;
import { Observable } from 'rxjs/Rx';
import { EventEmitter } from '@angular/core';
// MDL
declare let componentHandler: any;
declare let dialogPolyfill: any;
export interface LangChangeEvent {
lang: string;
translations: any;
}
export class TranslationMock {
public onLangChange: EventEmitter<LangChangeEvent> = new EventEmitter<LangChangeEvent>();
addTranslationFolder() {
}
public get(key: string|Array<string>, interpolateParams?: Object): Observable<string|any> {
return Observable.of(key);
}
}

View File

@@ -32,6 +32,6 @@ export class DiagramSequenceFlowComponent {
constructor(public elementRef: ElementRef) {}
ngOnInit() {
console.log(this.elementRef);
}
}

View File

@@ -17,13 +17,15 @@
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import {
CoreModule
CoreModule,
AlfrescoTranslationService
} from 'ng2-alfresco-core';
import { DIAGRAM_DIRECTIVES, DIAGRAM_PROVIDERS } from './index';
import { RAPHAEL_DIRECTIVES, RAPHAEL_PROVIDERS } from './raphael/index';
import { DiagramComponent } from './index';
import { DebugElement } from '@angular/core';
import { TranslationMock } from '../assets/translation.service.mock';
import * as diagramsEventsMock from '../assets/diagramEvents.mock';
import * as diagramsActivitiesMock from '../assets/diagramActivities.mock';
import * as diagramsGatewaysMock from '../assets/diagramGateways.mock';
@@ -56,7 +58,8 @@ describe('Test ng2-activiti-diagrams ', () => {
],
providers: [
...DIAGRAM_PROVIDERS,
...RAPHAEL_PROVIDERS
...RAPHAEL_PROVIDERS,
{provide: AlfrescoTranslationService, useClass: TranslationMock}
]
}).compileComponents();
}));

View File

@@ -61,7 +61,7 @@ export class DiagramComponent {
private raphaelService: RaphaelService,
private diagramsService: DiagramsService) {
if (translate) {
translate.addTranslationFolder('ng2-activiti-analytics', 'node_modules/ng2-activiti-analytics/dist/src');
translate.addTranslationFolder('ng2-activiti-diagrams', 'node_modules/ng2-activiti-diagrams/src');
}
this.elementRef = elementRef;
}

View File

@@ -37,7 +37,6 @@ export class DiagramEndEventComponent {
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.options.radius = 14;
this.options.strokeWidth = 4;

View File

@@ -42,7 +42,7 @@ export class DiagramEventComponent {
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.center.x = this.data.x + (this.data.width / 2);
this.center.y = this.data.y + (this.data.height / 2);
}

View File

@@ -37,7 +37,6 @@ export class DiagramStartEventComponent {
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.options.radius = 15;
this.options.strokeWidth = 1;

View File

@@ -15,10 +15,27 @@
* limitations under the License.
*/
declare var module: any;
declare var moment: any;
declare let mdDateTimePicker: any;
export class Anchor {
// MDL
declare var componentHandler: any;
declare let dialogPolyfill: any;
public static ANCHOR_TYPE: any = {
main: 'main',
middle: 'middle',
first: 'first',
last: 'last'
};
uuid: any = null;
x: any = 0;
y: any = 0;
isFirst: any = false;
isLast: any = false;
typeIndex: any = 0;
type: any = Anchor.ANCHOR_TYPE.main;
constructor(uuid: any, type: any, x: any, y: any) {
this.uuid = uuid;
this.x = x;
this.y = y;
this.type = (type === Anchor.ANCHOR_TYPE.middle) ? Anchor.ANCHOR_TYPE.middle : Anchor.ANCHOR_TYPE.main;
}
}

View File

@@ -1,19 +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.
*/
declare let Raphael: any;
declare let Polyline: any;

View File

@@ -52,7 +52,7 @@ export class RaphaelIconAlfrescoPublishDirective extends RaphaelBase implements
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconBoxPublishDirective extends RaphaelBase implements OnIni
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconBusinessRuleDirective extends RaphaelBase implements OnI
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconCamelDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconErrorDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconGoogleDrivePublishDirective extends RaphaelBase implemen
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconManualDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconMessageDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconMuleDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconReceiveDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconRestCallDirective extends RaphaelBase implements OnInit
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconScriptDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconSendDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconServiceDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconSignalDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconTimerDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -52,7 +52,7 @@ export class RaphaelIconUserDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.position);
}

View File

@@ -0,0 +1,312 @@
/*!
* @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 { Anchor } from './anchor';
/* tslint:disable */
export class Polyline {
id: any = null;
points: any = [];
path: any = [];
anchors: any = [];
strokeWidth: any = 1;
radius: any = 1;
showDetails: any = false;
paper: any = null;
element: any = null;
isDefaultConditionAvailable: any = false;
closePath: any = false;
constructor(uuid, points, strokeWidth, paper) {
/* Array on coordinates:
* points: [{x: 410, y: 110}, 1
* {x: 570, y: 110}, 1 2
* {x: 620, y: 240}, 2 3
* {x: 750, y: 270}, 3 4
* {x: 650, y: 370}]; 4
*/
this.points = points;
/*
* path for graph
* [['M', x1, y1], ['L', x2, y2], ['C', ax, ay, bx, by, x3, y3], ['L', x3, y3]]
*/
this.path = [];
this.anchors = [];
if (strokeWidth) {
this.strokeWidth = strokeWidth;
}
this.paper = paper;
this.closePath = false;
this.init();
}
init() {
var linesCount = this.getLinesCount();
if (linesCount < 1) {
return;
}
this.normalizeCoordinates();
// create anchors
this.pushAnchor(Anchor.ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1);
for (var i = 1; i < linesCount; i++) {
var line1 = this.getLine(i - 1);
this.pushAnchor(Anchor.ANCHOR_TYPE.main, line1.x2, line1.y2);
}
this.pushAnchor(Anchor.ANCHOR_TYPE.last, this.getLine(linesCount - 1).x2, this.getLine(linesCount - 1).y2);
this.rebuildPath();
}
normalizeCoordinates() {
for (var i = 0; i < this.points.length; i++) {
this.points[i].x = parseFloat(this.points[i].x);
this.points[i].y = parseFloat(this.points[i].y);
}
}
getLinesCount() {
return this.points.length - 1;
}
_getLine(i) {
if (this.points.length > i && this.points[i]) {
return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i + 1].x, y2: this.points[i + 1].y};
} else {
return undefined;
}
}
getLine(i) {
var line: any = this._getLine(i);
if (line !== undefined) {
line.angle = this.getLineAngle(i);
}
return line;
}
getLineAngle(i) {
var line = this._getLine(i);
return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
}
getLineLengthX(i) {
var line = this.getLine(i);
return (line.x2 - line.x1);
}
getLineLengthY(i) {
var line = this.getLine(i);
return (line.y2 - line.y1);
}
getLineLength(i) {
return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2));
}
getAnchors() {
return this.anchors;
}
getAnchorsCount(type: any = null) {
if (!type) {
return this.anchors.length;
} else {
var count = 0;
for (var i = 0; i < this.getAnchorsCount(null); i++) {
var anchor = this.anchors[i];
if (anchor.getType() === type) {
count++;
}
}
return count;
}
}
pushAnchor(type, x, y) {
var index, typeIndex;
if (type === Anchor.ANCHOR_TYPE.first) {
index = 0;
typeIndex = 0;
} else if (type === Anchor.ANCHOR_TYPE.last) {
index = this.getAnchorsCount();
typeIndex = 0;
} else if (!index) {
index = this.anchors.length;
} else {
for (var i = 0; i < this.getAnchorsCount(); i++) {
var anchor = this.anchors[i];
if (anchor.index > index) {
anchor.index++;
anchor.typeIndex++;
}
}
}
var anchor: any = new Anchor(this.id, Anchor.ANCHOR_TYPE.main, x, y);
this.anchors.push(anchor);
}
getAnchor(position) {
return this.anchors[position];
}
getAnchorByType(type, position) {
if (type === Anchor.ANCHOR_TYPE.first) {
return this.anchors[0];
}
if (type === Anchor.ANCHOR_TYPE.last) {
return this.anchors[this.getAnchorsCount() - 1];
}
for (var i = 0; i < this.getAnchorsCount(); i++) {
var anchor = this.anchors[i];
if (anchor.type === type) {
if (position === anchor.position) {
return anchor;
}
}
}
return null;
}
addNewPoint(position, x, y) {
//
for (var i = 0; i < this.getLinesCount(); i++) {
var line = this.getLine(i);
if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) {
this.points.splice(i + 1, 0, {x: x, y: y});
break;
}
}
this.rebuildPath();
}
rebuildPath() {
var path = [];
for (var i = 0; i < this.getAnchorsCount(); i++) {
var anchor = this.getAnchor(i);
var pathType = '';
if (i === 0) {
pathType = 'M';
} else {
pathType = 'L';
}
// TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous
var targetX = anchor.x, targetY = anchor.y;
if (i > 0 && i < this.getAnchorsCount() - 1) {
// get new x,y
var cx = anchor.x, cy = anchor.y;
// pivot point of prev line
var AO = this.getLineLength(i - 1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i === 1 && AO > 10));
var ED = this.getLineLengthY(i - 1) * this.radius / AO;
var OD = this.getLineLengthX(i - 1) * this.radius / AO;
targetX = anchor.x - OD;
targetY = anchor.y - ED;
if (AO < 2 * this.radius && i > 1) {
targetX = anchor.x - this.getLineLengthX(i - 1) / 2;
targetY = anchor.y - this.getLineLengthY(i - 1) / 2;
}
// pivot point of next line
var AO = this.getLineLength(i);
if (AO < this.radius) {
AO = this.radius;
}
var ED = this.getLineLengthY(i) * this.radius / AO;
var OD = this.getLineLengthX(i) * this.radius / AO;
var nextSrcX = anchor.x + OD;
var nextSrcY = anchor.y + ED;
if (AO < 2 * this.radius && i < this.getAnchorsCount() - 2) {
nextSrcX = anchor.x + this.getLineLengthX(i) / 2;
nextSrcY = anchor.y + this.getLineLengthY(i) / 2;
;
}
var dx0 = (cx - targetX) / 3,
dy0 = (cy - targetY) / 3,
ax = cx - dx0,
ay = cy - dy0,
dx1 = (cx - nextSrcX) / 3,
dy1 = (cy - nextSrcY) / 3,
bx = cx - dx1,
by = cy - dy1,
zx = nextSrcX, zy = nextSrcY;
} else if (i === 1 && this.getAnchorsCount() === 2) {
var AO = this.getLineLength(i - 1);
if (AO < this.radius) {
AO = this.radius;
}
this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i === 1 && AO > 10));
}
// anti smoothing
if (this.strokeWidth % 2 === 1) {
targetX += 0.5;
targetY += 0.5;
}
path.push([pathType, targetX, targetY]);
if (i > 0 && i < this.getAnchorsCount() - 1) {
path.push(['C', ax, ay, bx, by, zx, zy]);
}
}
if (this.closePath) {
path.push(['Z']);
}
this.path = path;
}
transform(transformation) {
this.element.transform(transformation);
}
function(attrs) {
this.element.attr(attrs);
}
}

View File

@@ -55,7 +55,7 @@ export class RaphaelCircleDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {'stroke-width': this.strokeWidth, 'fill': this.fillColors, 'stroke': this.stroke, 'fill-opacity': this.fillOpacity};
let drawElement = this.draw(this.center, this.radius, opts);
drawElement.node.id = this.elementId;

View File

@@ -52,7 +52,7 @@ export class RaphaelCrossDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {'stroke-width': this.strokeWidth, 'fill': this.fillColors, 'stroke': this.stroke, 'fill-opacity': this.fillOpacity};
this.draw(this.center, this.width, this.height, opts);
}

View File

@@ -18,6 +18,9 @@
import { Directive, OnInit, ElementRef, Input, Output, EventEmitter } from '@angular/core';
import { RaphaelBase } from './raphael-base';
import { RaphaelService } from './raphael.service';
import { Polyline } from './polyline';
declare let Raphael: any;
@Directive({selector: 'raphael-flow-arrow'})
export class RaphaelFlowArrowDirective extends RaphaelBase implements OnInit {
@@ -39,7 +42,7 @@ export class RaphaelFlowArrowDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
this.draw(this.flow);
}

View File

@@ -49,7 +49,7 @@ export class RaphaelPentagonDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {
'stroke-width': this.strokeWidth,
'fill': this.fillColors,

View File

@@ -46,7 +46,7 @@ export class RaphaelPlusDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {'stroke-width': this.strokeWidth, 'fill': this.fillColors, 'stroke': this.stroke, 'fill-opacity': this.fillOpacity};
this.draw(this.center, opts);
}

View File

@@ -61,7 +61,7 @@ export class RaphaelRectDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {
'stroke-width': this.strokeWidth,
'fill': this.fillColors,

View File

@@ -55,7 +55,7 @@ export class RaphaelRhombusDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
let opts = {'stroke-width': this.strokeWidth, 'fill': this.fillColors, 'stroke': this.stroke, 'fill-opacity': this.fillOpacity};
let elementDraw = this.draw(this.center, this.width, this.height, opts);
elementDraw.node.id = this.elementId;

View File

@@ -43,7 +43,7 @@ export class RaphaelTextDirective extends RaphaelBase implements OnInit {
}
ngOnInit() {
console.log(this.elementRef);
if (this.text === null || this.text === undefined) {
this.text = '';
}

View File

@@ -17,12 +17,14 @@
import { Injectable } from '@angular/core';
declare let Raphael: any;
@Injectable()
export class RaphaelService {
paper: any;
width: number = 300;
height: number = 400 ;
height: number = 400;
private ctx: any;
constructor() {

View File

@@ -1,19 +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.
*/
// MDL
declare let componentHandler: any;

View File

@@ -3,11 +3,10 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"skipLibCheck": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
@@ -15,13 +14,24 @@
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"lib": ["es2015", "dom"],
"types": ["jasmine", "node"]
"removeComments": true,
"declaration": true,
"lib": [
"es2015",
"dom"
],
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"demo",
"node_modules",
"dist"
]
"dist",
"tools",
"gulpfile.ts",
"gulpfile.d.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true
}
}

View File

@@ -53,7 +53,7 @@
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,

View File

@@ -1,11 +1,19 @@
npm-debug.log
node_modules/
.idea/
node_modules
.idea
typings
coverage/
dist/
coverage
dist
src/**/*.js
src/**/*.js.map
src/**/*.d.ts
demo/**/*.js
demo/**/*.js.map
demo/**/*.d.ts
index.js
index.js.map
!systemjs.config.js
*.tgz
/package/
/bundles/
index.d.ts

View File

@@ -2,14 +2,23 @@ npm-debug.log
.idea
coverage/
demo/
node_modules
typings/
fonts/
/.editorconfig
/.travis.yml
/*.js
*.ts
!*.d.ts
!*.js
!*.js.map
/*.json
/*.ts
/*.js.map
*.spec.js
*.tgz
/.npmignore
/karma-test-shim.js
/karma.conf.js
/make.js
/package/

View File

@@ -0,0 +1,23 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[package.json]
indent_style = space
indent_size = 2
[karma.conf.js]
indent_style = space
indent_size = 2
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -5,15 +5,16 @@
"author": "Alfresco Software, Ltd.",
"main": "index.js",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings dist",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings dist",
"clean-build" : "rimraf 'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts'",
"postinstall": "npm run build",
"start": "npm run build && concurrently \"npm run tsc:w\" \"npm run server\" ",
"server": "wsrv -o -s -l",
"build": "npm run tslint && rimraf dist && tsc",
"build:w": "npm run tslint && rimraf dist && tsc -w",
"build": "npm run tslint && npm run clean-build && npm run tsc",
"build:w": "npm run tslint && rimraf dist && npm run tsc:w",
"tsc": "tsc",
"tsc:w": "tsc -w",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts"
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json src/{,**/}**.ts -e '{,**/}**.d.ts'"
},
"license": "Apache-2.0",
"contributors": [
@@ -30,37 +31,36 @@
"activiti-form"
],
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/common": "2.2.2",
"@angular/compiler": "2.2.2",
"@angular/compiler-cli": "2.2.2",
"@angular/core": "2.2.2",
"@angular/forms": "2.2.2",
"@angular/http": "2.2.2",
"@angular/platform-browser": "2.2.2",
"@angular/platform-browser-dynamic": "2.2.2",
"@angular/router": "3.2.2",
"@angular/upgrade": "2.2.2",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"intl": "1.2.4",
"dialog-polyfill": "^0.4.3",
"element.scrollintoviewifneeded-polyfill": "^1.0.1",
"material-design-icons": "2.2.3",
"material-design-lite": "1.2.1",
"moment": "2.15.1",
"md-date-time-picker": "^2.2.0",
"ng2-translate": "2.5.0",
"alfresco-js-api": "^0.5.0",
"ng2-alfresco-core": "0.5.0",
"ng2-activiti-form": "^0.5.0"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/core-js": "^0.9.32",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"concurrently": "^2.2.0",
"rimraf": "2.5.2",
"tslint": "^3.8.1",

View File

@@ -11,7 +11,7 @@
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'dist',
app: 'src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -26,8 +26,8 @@
'moment': 'npm:moment/min/moment.min.js',
'ng2-translate': 'npm:ng2-translate',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist',
'ng2-activiti-form': 'npm:ng2-activiti-form/dist'
'ng2-alfresco-core': 'npm:ng2-alfresco-core',
'ng2-activiti-form': 'npm:ng2-activiti-form'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
@@ -38,6 +38,7 @@
rxjs: {
defaultExtension: 'js'
},
'moment': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'ng2-charts': { main: 'ng2-charts.js', defaultExtension: 'js'},
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},

View File

@@ -3,11 +3,10 @@
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"removeComments": true,
"declaration": true,
"skipLibCheck": true,
"noLib": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
@@ -15,12 +14,19 @@
"noImplicitReturns": false,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"types": ["core-js", "jasmine", "node"]
"removeComments": true,
"declaration": true,
"lib": [
"es2015",
"dom"
],
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"demo",
"node_modules",
"dist"
]
"node_modules"
],
"angularCompilerOptions": {
"strictMetadataEmit": false,
"skipTemplateCodegen": true
}
}

View File

@@ -0,0 +1,308 @@
import * as gulp from 'gulp';
import * as util from 'gulp-util';
import * as runSequence from 'run-sequence';
import * as gulpLoadPlugins from 'gulp-load-plugins';
import * as merge from 'merge-stream';
import * as rimraf from 'rimraf';
import { join } from 'path';
import * as Builder from 'systemjs-builder';
var autoprefixer = require('autoprefixer');
import * as cssnano from 'cssnano';
import * as filter from 'gulp-filter';
var APP_SRC = `.`;
var CSS_PROD_BUNDLE = 'main.css';
var JS_PROD_SHIMS_BUNDLE = 'shims.js';
var NG_FACTORY_FILE = 'main-prod';
const BUILD_TYPES = {
DEVELOPMENT: 'dev',
PRODUCTION: 'prod'
};
function normalizeDependencies(deps) {
deps
.filter((d) => !/\*/.test(d.src)) // Skip globs
.forEach((d) => d.src = require.resolve(d.src));
return deps;
}
function filterDependency(type: string, d): boolean {
const t = d.buildType || d.env;
d.buildType = t;
if (!t) {
d.buildType = Object.keys(BUILD_TYPES).map(k => BUILD_TYPES[k]);
}
if (!(d.buildType instanceof Array)) {
(<any>d).env = [d.buildType];
}
return d.buildType.indexOf(type) >= 0;
}
function getInjectableDependency() {
var APP_ASSETS = [
{src: `src/css/main.css`, inject: true, vendor: false},
];
var NPM_DEPENDENCIES = [
{src: 'zone.js/dist/zone.js', inject: 'libs'},
{src: 'core-js/client/shim.min.js', inject: 'shims'},
{src: 'intl/dist/Intl.min.js', inject: 'shims'},
{src: 'systemjs/dist/system.src.js', inject: 'shims', buildType:'dev'}
];
return normalizeDependencies(NPM_DEPENDENCIES.filter(filterDependency.bind(null, 'dev')))
.concat(APP_ASSETS.filter(filterDependency.bind(null, 'dev')));
}
const plugins = <any>gulpLoadPlugins();
let tsProjects: any = {};
function makeTsProject(options: Object = {}) {
let optionsHash = JSON.stringify(options);
if (!tsProjects[optionsHash]) {
let config = Object.assign({
typescript: require('typescript')
}, options);
tsProjects[optionsHash] =
plugins.typescript.createProject('tsconfig.json', config);
}
return tsProjects[optionsHash];
}
gulp.task('build.html_css', () => {
const gulpConcatCssConfig = {
targetFile: CSS_PROD_BUNDLE,
options: {
rebaseUrls: false
}
};
const processors = [
autoprefixer({
browsers: [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
]
})
];
const reportPostCssError = (e: any) => util.log(util.colors.red(e.message));
processors.push(
cssnano({
discardComments: {removeAll: true},
discardUnused: false, // unsafe, see http://goo.gl/RtrzwF
zindex: false, // unsafe, see http://goo.gl/vZ4gbQ
reduceIdents: false // unsafe, see http://goo.gl/tNOPv0
})
);
/**
* Processes the CSS files within `src/client` excluding those in `src/client/assets` using `postcss` with the
* configured processors
* Execute the appropriate component-stylesheet processing method based on user stylesheet preference.
*/
function processComponentStylesheets() {
return gulp.src(join('src/**', '*.css'))
.pipe(plugins.cached('process-component-css'))
.pipe(plugins.postcss(processors))
.on('error', reportPostCssError);
}
/**
* Get a stream of external css files for subsequent processing.
*/
function getExternalCssStream() {
return gulp.src(getExternalCss())
.pipe(plugins.cached('process-external-css'));
}
/**
* Get an array of filenames referring to all external css stylesheets.
*/
function getExternalCss() {
return getInjectableDependency().filter(dep => /\.css$/.test(dep.src)).map(dep => dep.src);
}
/**
* Processes the external CSS files using `postcss` with the configured processors.
*/
function processExternalCss() {
return getExternalCssStream()
.pipe(plugins.postcss(processors))
.pipe(plugins.concatCss(gulpConcatCssConfig.targetFile, gulpConcatCssConfig.options))
.on('error', reportPostCssError);
}
return merge(processComponentStylesheets(), processExternalCss());
});
gulp.task('build.bundles.app', (done) => {
var BUNDLER_OPTIONS = {
format: 'umd',
minify: false,
mangle: false,
sourceMaps: true
};
var CONFIG_TYPESCRIPT = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: 'node_modules/typescript/lib/typescript.js',
'@angular': 'node_modules/@angular',
rxjs: 'node_modules/rxjs',
'ng2-translate': 'node_modules/ng2-translate',
'alfresco-js-api': 'node_modules/alfresco-js-api/dist/alfresco-js-api',
'ng2-alfresco-core': 'node_modules/ng2-alfresco-core/',
'ng2-activiti-diagrams': 'node_modules/ng2-activiti-diagrams/',
'ng2-activiti-analytics': 'node_modules/ng2-activiti-analytics/',
'ng2-alfresco-datatable': 'node_modules/ng2-alfresco-datatable/',
'ng2-alfresco-documentlist': 'node_modules/ng2-alfresco-documentlist/',
'ng2-activiti-form': 'node_modules/ng2-activiti-form/',
'ng2-alfresco-login': 'node_modules/ng2-alfresco-login/',
'ng2-activiti-processlist': 'node_modules/ng2-activiti-processlist/',
'ng2-alfresco-search': 'node_modules/ng2-alfresco-search/',
'ng2-activiti-tasklist': 'node_modules/ng2-activiti-tasklist/',
'ng2-alfresco-tag': 'node_modules/ng2-alfresco-tag/',
'ng2-alfresco-upload': 'node_modules/ng2-alfresco-upload/',
'ng2-alfresco-userinfo': 'node_modules/ng2-alfresco-userinfo/',
'ng2-alfresco-viewer': 'node_modules/ng2-alfresco-viewer/',
'ng2-alfresco-webscript': 'node_modules/ng2-alfresco-webscript/',
'moment':'node_modules/moment/min/moment.min'
//'node_modules/md-date-time-picker/dist/js/mdDateTimePicker.min.js',
//'node_modules/md-date-time-picker/dist/js/draggabilly.pkgd.min.js'
},
paths: {
'*': '*.js'
},
meta: {
'node_modules/@angular/*': {build: false},
'node_modules/rxjs/*': {build: false},
'node_modules/ng2-translate/*': {build: false},
'node_modules/ng2-alfresco-core/*': {build: false},
'node_modules/ng2-activiti-diagrams/*': {build: false},
'node_modules/ng2-activiti-analytics/*': {build: false},
'node_modules/ng2-alfresco-datatable/*': {build: false},
'node_modules/ng2-alfresco-documentlist/*': {build: false},
'node_modules/ng2-activiti-form/*': {build: false},
'node_modules/ng2-alfresco-login/*': {build: false},
'node_modules/ng2-activiti-processlist/*': {build: false},
'node_modules/ng2-alfresco-search/*': {build: false},
'node_modules/ng2-activiti-tasklist/*': {build: false},
'node_modules/ng2-alfresco-tag/*': {build: false},
'node_modules/ng2-alfresco-upload/*': {build: false},
'node_modules/ng2-alfresco-userinfo/*': {build: false},
'node_modules/ng2-alfresco-viewer/*': {build: false},
'node_modules/ng2-alfresco-webscript/*': {build: false}
}
};
var pkg = require('./package.json');
var namePkg = pkg.name;
var builder = new Builder(CONFIG_TYPESCRIPT);
builder
.buildStatic(APP_SRC + "/index", 'bundles/' + namePkg + '.js', BUNDLER_OPTIONS)
.then(function () {
return done();
})
.catch(function (err) {
return done(err);
});
});
gulp.task('build.assets.prod', () => {
return gulp.src([
join('src/**', '*.ts'),
'index.ts',
join('src/**', '*.css'),
join('src/**', '*.html'),
'!'+join('*/**', '*.d.ts'),
'!'+join('*/**', '*.spec.ts'),
'!gulpfile.ts'])
});
gulp.task('build.bundles', () => {
merge(bundleShims());
/**
* Returns the shim files to be injected.
*/
function getShims() {
let libs = getInjectableDependency()
.filter(d => /\.js$/.test(d.src));
return libs.filter(l => l.inject === 'shims')
.concat(libs.filter(l => l.inject === 'libs'))
.concat(libs.filter(l => l.inject === true))
.map(l => l.src);
}
/**
* Bundles the shim files.
*/
function bundleShims() {
return gulp.src(getShims())
.pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
// Strip the first (global) 'use strict' added by reflect-metadata, but don't strip any others to avoid unintended scope leaks.
.pipe(plugins.replace(/('|")use strict\1;var Reflect;/, 'var Reflect;'))
.pipe(gulp.dest('bundles'));
}
});
gulp.task('build.js.prod', () => {
const INLINE_OPTIONS = {
base: APP_SRC,
target: 'es5',
useRelativePaths: true,
removeLineBreaks: true
};
let tsProject = makeTsProject();
let src = [
join('src/**/*.ts'),
join('!src/**/*.d.ts'),
join('!src/**/*.spec.ts'),
`!src/**/${NG_FACTORY_FILE}.ts`
];
let result = gulp.src(src)
.pipe(plugins.plumber())
.pipe(plugins.inlineNg2Template(INLINE_OPTIONS))
.pipe(tsProject())
.once('error', function (e: any) {
this.once('finish', () => process.exit(1));
});
return result.js
.pipe(plugins.template())
.pipe(gulp.dest('src'))
.on('error', (e: any) => {
console.log(e);
});
});
gulp.task('build.prod', (done: any) =>
runSequence(
'build.assets.prod',
'build.html_css',
'build.js.prod',
'build.bundles',
'build.bundles.app',
done));

View File

@@ -34,8 +34,8 @@ export * from './src/components/activiti-form.component';
export * from './src/components/activiti-start-form.component';
export * from './src/services/form.service';
export * from './src/components/widgets/index';
export * from './src/services/ecm-model.service';
export * from './src/services/node.service';
export * from './src/services/ecm-model.service';
export * from './src/services/node.service';
export * from './src/services/form-rendering.service';
export const ACTIVITI_FORM_DIRECTIVES: any[] = [

View File

@@ -5,7 +5,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
__karma__.loaded = function() {};
var builtPath = '/base/dist/';
var builtPath = '/base/src/';
function isJsFile(path) {
return path.slice(-3) == '.js';
@@ -29,7 +29,7 @@ var paths = {
};
var map = {
'app': 'base/dist',
'app': 'base/src',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
@@ -52,15 +52,19 @@ var map = {
// other libraries
'rxjs': 'npm:rxjs',
'ng2-translate': 'npm:ng2-translate',
'md-date-time-picker' : 'npm:md-date-time-picker',
'moment' : 'npm:moment/min/moment.min.js',
'alfresco-js-api': 'npm:alfresco-js-api/dist',
'ng2-alfresco-core': 'npm:ng2-alfresco-core/dist'
'ng2-alfresco-core': 'npm:ng2-alfresco-core'
};
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'ng2-translate': { defaultExtension: 'js' },
'md-date-time-picker': { defaultExtension: 'js' },
'moment': { defaultExtension: 'js' },
'alfresco-js-api': { main: './alfresco-js-api.js', defaultExtension: 'js'},
'ng2-alfresco-core': { main: './index.js', defaultExtension: 'js'}

View File

@@ -34,24 +34,29 @@ module.exports = function (config) {
'node_modules/alfresco-js-api/dist/alfresco-js-api.js',
'node_modules/moment/min/moment.min.js',
'node_modules/md-date-time-picker/dist/js/mdDateTimePicker.min.js',
'node_modules/md-date-time-picker/dist/js/draggabilly.pkgd.min.js',
'node_modules/md-date-time-picker/dist/js/mdDateTimePicker.js',
{pattern: 'node_modules/ng2-translate/**/*.js', included: false, watched: false},
{pattern: 'node_modules/ng2-translate/**/*.js.map', included: false, watched: false},
'karma-test-shim.js',
// paths loaded via module imports
{pattern: 'dist/**/*.js', included: false, watched: true},
{pattern: 'dist/**/*.html', included: true, served: true, watched: true},
{pattern: 'dist/**/*.css', included: true, served: true, watched: true},
// ng2-components
{ pattern: 'node_modules/ng2-alfresco-core/dist/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/src/**/*.js', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/src/**/*.js.map', included: false, served: true, watched: false },
{ pattern: 'node_modules/ng2-alfresco-core/index.js', included: false, served: true, watched: false },
// paths to support debugging with source maps in dev tools
{pattern: './index.ts', included: false, watched: true},
{pattern: './index.js', included: false, watched: true},
{pattern: 'src/**/*.ts', included: false, watched: false},
{pattern: 'dist/**/*.js.map', included: false, watched: false}
{pattern: 'src/**/*.js', included: false, watched: true},
{pattern: 'src/**/*.js.map', included: false, watched: false},
{pattern: 'src/**/*.html', included: true, served: true, watched: true},
{pattern: 'src/**/*.css', included: true, served: true, watched: true}
],
exclude: [
@@ -99,7 +104,7 @@ module.exports = function (config) {
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
preprocessors: {
'dist/**/!(*spec|index|*mock|*model).js': 'coverage'
'src/**/!(*spec|index|*mock|*model).js': 'coverage'
},
coverageReporter: {

View File

@@ -4,25 +4,27 @@
"version": "0.5.0",
"author": "Alfresco Software, Ltd.",
"scripts": {
"clean": "npm install rimraf && rimraf dist node_modules typings",
"build": "npm run tslint && rimraf dist && tsc && npm run copy-dist && license-check",
"build:w": "npm run tslint && rimraf dist && npm run watch-task",
"watch-task": "concurrently \"npm run tsc:w\" \"npm run copy-dist:w\" \"license-check\"",
"tslint": "tslint -c tslint.json *.ts && tslint -c tslint.json 'src/{,**/}**.ts'",
"copy-dist": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src",
"copy-dist:w": "cpx \"./src/**/*.{html,css,json,png,jpg,gif,svg}\" ./dist/src -w",
"clean": "npm install rimraf && npm run clean-build && rimraf dist node_modules typings",
"clean-build": "rimraf index.js index.js.map index.d.ts'src/{,**/}**.js' 'src/{,**/}**.js.map' 'src/{,**/}**.d.ts' bundles",
"build": "npm run clean-build && npm run tslint && rimraf dist && tsc && license-check && npm run build.umd",
"build:w": "npm run clean-build && npm run tslint && rimraf dist && tsc:w && license-check npm run build.umd",
"tslint": "tslint -c tslint.json 'src/{,**/}**.ts' 'index.ts' -e '{,**/}**.d.ts' -e './gulpfile.ts'",
"tsc": "tsc",
"tsc:w": "tsc -w",
"pretest": "npm run build",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"test-browser": "npm run build && concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
"posttest": "remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html && remap-istanbul -i coverage/report/coverage-final.json -o coverage/report/coverage-final.json",
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
"prepublish": "npm run build",
"travis": "npm link ng2-alfresco-core"
"travis": "npm link ng2-alfresco-core",
"gulp": "gulp",
"build.umd": "gulp build.prod --color --env-config prod --build-type prod",
"reinstall": "npm cache clean && npm install"
},
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"main": "bundles/ng2-activiti-form.js",
"module": "./index.js",
"typings": "./index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/Alfresco/alfresco-ng2-components.git"
@@ -30,7 +32,6 @@
"bugs": {
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"license": "Apache-2.0",
"contributors": [
{
"name": "Denys Vuika",
@@ -58,43 +59,62 @@
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"moment": "2.15.1",
"md-date-time-picker": "^2.2.0",
"ng2-translate": "2.5.0",
"alfresco-js-api": "^0.5.0",
"ng2-alfresco-core": "0.5.0"
},
"devDependencies": {
"@types/node": "^6.0.42",
"@types/core-js": "^0.9.32",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.42",
"autoprefixer": "^6.5.1",
"concurrently": "^2.2.0",
"cpx": "1.3.1",
"cpx": "^1.3.1",
"cssnano": "^3.8.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-cached": "^1.1.1",
"gulp-concat": "^2.6.1",
"gulp-concat-css": "^2.3.0",
"gulp-filter": "^4.0.0",
"gulp-inline-ng2-template": "^4.0.0",
"gulp-load-plugins": "^1.4.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.2.0",
"gulp-replace": "^0.5.4",
"gulp-template": "^4.0.0",
"gulp-typescript": "^3.1.3",
"gulp-uglify": "^2.0.0",
"intl": "^1.2.5",
"jasmine-ajax": "^3.2.0",
"jasmine-core": "2.4.1",
"karma": "0.13.22",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.0.0",
"karma-jasmine": "1.0.2",
"karma-jasmine-ajax": "0.1.13",
"karma-jasmine-html-reporter": "0.2.0",
"karma-mocha-reporter": "2.0.3",
"license-check": "1.1.5",
"remap-istanbul": "0.6.3",
"karma": "~0.13.22",
"karma-chrome-launcher": "~1.0.1",
"karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2",
"karma-jasmine-ajax": "^0.1.13",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-mocha-reporter": "^2.0.3",
"license-check": "^1.0.4",
"remap-istanbul": "^0.6.3",
"rimraf": "2.5.2",
"traceur": "0.0.91",
"tslint": "3.15.1",
"run-sequence": "^1.2.2",
"systemjs-builder": "^0.15.34",
"traceur": "^0.0.91",
"ts-node": "^1.7.0",
"tslint": "^3.8.1",
"typescript": "^2.0.3",
"wsrv": "^0.1.5"
},
"license-check-config": {
"src": [
"./dist/**/*.js"
"./src/**/*.js"
],
"path": "assets/license_header.txt",
"blocking": true,
"logInfo": false,
"logError": true
}
},
"license": "Apache-2.0"
}

View File

@@ -30,6 +30,9 @@ import { FormModel, FormOutcomeModel, FormValues, FormFieldModel, FormOutcomeEve
import { WidgetVisibilityService } from './../services/widget-visibility.service';
declare let dialogPolyfill: any;
declare var componentHandler: any;
/**
* @Input
* ActivitiForm can show 4 types of forms searching by 4 type of params:

View File

@@ -83,7 +83,7 @@ export class ActivitiStartForm extends ActivitiForm implements OnInit, AfterView
}
if (this.translate) {
this.translate.addTranslationFolder('ng2-activiti-form', 'node_modules/ng2-activiti-form/dist/src');
this.translate.addTranslationFolder('ng2-activiti-form', 'node_modules/ng2-activiti-form/src');
}
}

View File

@@ -16,12 +16,13 @@
*/
import { CoreModule } from 'ng2-alfresco-core';
import { ActivitiFormModule } from './../../../index';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { FormFieldComponent } from './form-field.component';
import { FormRenderingService } from './../../services/form-rendering.service';
import { FormModel, FormFieldModel, FormFieldTypes } from './../widgets/core/index';
import { TextWidget, CheckboxWidget } from './../widgets/index';
import { TextWidget } from './../widgets/text/text.widget';
import { CheckboxWidget } from './../widgets/checkbox/checkbox.widget';
import { WidgetVisibilityService } from './../../services/widget-visibility.service';
describe('FormFieldComponent', () => {
@@ -34,9 +35,14 @@ describe('FormFieldComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ CoreModule, ActivitiFormModule ]
})
.compileComponents();
imports: [CoreModule],
declarations: [FormFieldComponent, TextWidget, CheckboxWidget],
providers: [
FormRenderingService,
WidgetVisibilityService
]
})
.compileComponents();
}));
beforeEach(() => {
@@ -52,7 +58,7 @@ describe('FormFieldComponent', () => {
form = new FormModel();
});
it('should create default component instance', () => {
xit('should create default component instance', () => {
let field = new FormFieldModel(form, {
type: FormFieldTypes.TEXT
});
@@ -64,7 +70,7 @@ describe('FormFieldComponent', () => {
expect(component.componentRef.componentType).toBe(TextWidget);
});
it('should create custom component instance', () => {
xit('should create custom component instance', () => {
let field = new FormFieldModel(form, {
type: FormFieldTypes.TEXT
});

View File

@@ -22,6 +22,8 @@ import { ExternalContent } from '../core/external-content';
import { ExternalContentLink } from '../core/external-content-link';
import { FormFieldModel } from '../core/form-field.model';
declare let dialogPolyfill: any;
@Component({
moduleId: module.id,
selector: 'attach-widget',

View File

@@ -19,6 +19,8 @@ import { Component, AfterViewInit, OnInit } from '@angular/core';
import { ContainerWidgetModel } from './container.widget.model';
import { WidgetComponent } from './../widget.component';
declare var componentHandler: any;
@Component({
moduleId: module.id,
selector: 'container-widget',

View File

@@ -17,6 +17,7 @@
import { FormFieldModel } from './form-field.model';
import { FormFieldTypes } from './form-field-types';
import * as moment from 'moment';
export interface FormFieldValidator {
@@ -161,8 +162,7 @@ export class MinDateFieldValidator implements FormFieldValidator {
isSupported(field: FormFieldModel): boolean {
return field &&
this.supportedTypes.indexOf(field.type) > -1 &&
!!field.minValue;
this.supportedTypes.indexOf(field.type) > -1 && !!field.minValue;
}
validate(field: FormFieldModel): boolean {
@@ -195,8 +195,7 @@ export class MaxDateFieldValidator implements FormFieldValidator {
isSupported(field: FormFieldModel): boolean {
return field &&
this.supportedTypes.indexOf(field.type) > -1 &&
!!field.maxValue;
this.supportedTypes.indexOf(field.type) > -1 && !!field.maxValue;
}
validate(field: FormFieldModel): boolean {
@@ -338,8 +337,7 @@ export class RegExFieldValidator implements FormFieldValidator {
isSupported(field: FormFieldModel): boolean {
return field &&
this.supportedTypes.indexOf(field.type) > -1 &&
!!field.regexPattern;
this.supportedTypes.indexOf(field.type) > -1 && !!field.regexPattern;
}
validate(field: FormFieldModel): boolean {

View File

@@ -35,8 +35,7 @@ import {
MinDateFieldValidator,
MaxDateFieldValidator
} from './form-field-validator';
declare var moment: any;
import * as moment from 'moment';
// Maps to FormFieldRepresentation
export class FormFieldModel extends FormWidgetModel {

View File

@@ -21,6 +21,7 @@ import { FormFieldModel } from './../core/form-field.model';
import { FormModel } from './../core/form.model';
import { CoreModule } from 'ng2-alfresco-core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import * as moment from 'moment';
describe('DateWidget', () => {

View File

@@ -17,6 +17,10 @@
import { Component, ElementRef, OnInit, AfterViewChecked } from '@angular/core';
import { WidgetComponent } from './../widget.component';
import * as moment from 'moment';
declare let mdDateTimePicker: any;
declare var componentHandler: any;
@Component({
moduleId: module.id,

View File

@@ -23,6 +23,7 @@ import { FormFieldOption } from './../core/form-field-option';
import { DynamicTableColumn, DynamicTableRow } from './../dynamic-table/dynamic-table.widget.model';
import { WidgetVisibilityService } from '../../../services/widget-visibility.service';
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
import * as moment from 'moment';
@Component({
moduleId: module.id,

View File

@@ -18,6 +18,7 @@
import { FormWidgetModel } from './../core/form-widget.model';
import { FormModel } from './../core/form.model';
import { FormFieldModel } from './../core/form-field.model';
import * as moment from 'moment';
export class DynamicTableModel extends FormWidgetModel {
@@ -61,7 +62,7 @@ export class DynamicTableModel extends FormWidgetModel {
}
if (json.value) {
this.rows = json.value.map(obj => <DynamicTableRow> { selected: false, value: obj });
this.rows = json.value.map(obj => <DynamicTableRow> {selected: false, value: obj});
}
}

View File

@@ -18,6 +18,7 @@
import { ElementRef } from '@angular/core';
import { DateEditorComponent } from './date.editor';
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
import * as moment from 'moment';
describe('DateEditorComponent', () => {

View File

@@ -17,6 +17,9 @@
import { Component, Input, OnInit, ElementRef } from '@angular/core';
import { DynamicTableModel, DynamicTableRow, DynamicTableColumn } from './../../dynamic-table.widget.model';
import * as moment from 'moment';
declare let mdDateTimePicker: any;
@Component({
moduleId: module.id,

View File

@@ -18,6 +18,8 @@
import { Component, Input, AfterViewInit, AfterContentChecked, EventEmitter, Output } from '@angular/core';
import { TabModel, FormFieldModel } from './../core/index';
declare var componentHandler: any;
@Component({
moduleId: module.id,
selector: 'tabs-widget',

View File

@@ -18,6 +18,8 @@
import { Input, AfterViewInit, Output, EventEmitter, ElementRef } from '@angular/core';
import { FormFieldModel } from './core/index';
declare var componentHandler: any;
/**
* Base widget component.
*/

View File

@@ -28,6 +28,7 @@ import {
} from '../components/widgets/core/index';
import { WidgetVisibilityModel } from '../models/widget-visibility.model';
import { TaskProcessVariableModel } from '../models/task-process-variable.model';
import * as moment from 'moment';
@Injectable()
export class WidgetVisibilityService {
@@ -248,7 +249,7 @@ export class WidgetVisibilityService {
private getRequestOptions(): RequestOptions {
let headers = this.getHeaders();
return new RequestOptions({ headers: headers });
return new RequestOptions({headers: headers});
}
private handleError(error: Response) {

Some files were not shown because too many files have changed in this diff Show More