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

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

@@ -1,24 +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 var module: any;
declare var moment: any;
declare let mdDateTimePicker: any;
// MDL
declare var componentHandler: any;
declare let dialogPolyfill: any;

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) {

View File

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

View File

@@ -1,121 +1,121 @@
{
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [
true,
180
],
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": false,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-constructor-vars": false,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-strict": false,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"interface-name": false,
"jsdoc-format": true,
"label-position": true,
"label-undefined": true,
"max-line-length": [
true,
180
],
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-any": false,
"no-arg": true,
"no-bitwise": false,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-constructor-vars": false,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": false,
"no-internal-module": true,
"no-require-imports": false,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unreachable": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"no-var-requires": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single",
"avoid-escape"
],
"radix": true,
"semicolon": true,
"switch-default": true,
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef": false,
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-strict": false,
"variable-name": [
true,
"check-format",
"allow-leading-underscore",
"ban-keywords"
],
"whitespace": [
true,
"check-branch",
"check-operator",
"check-separator",
"check-type",
"check-module",
"check-decl"
]
}
}