Updated: angular2 0.42.0 integration

This commit is contained in:
buchslava
2015-10-15 19:25:47 +03:00
parent d993060c62
commit a2f774a0be
9 changed files with 61 additions and 84 deletions

View File

@@ -1,6 +1,5 @@
import {FileLikeObject} from './file-like-object'; import {FileLikeObject} from './file-like-object';
import {FileUploader} from './file-uploader'; import {FileUploader} from './file-uploader';
import Form = ng.Form;
export class FileItem { export class FileItem {
public file:FileLikeObject; public file:FileLikeObject;

View File

@@ -1,5 +1,3 @@
/// <reference path="../../tsd.d.ts" />
import { import {
Component, View, OnInit, OnDestroy, OnChanges, Component, View, OnInit, OnDestroy, OnChanges,
Directive, EventEmitter, ElementRef, Renderer, Directive, EventEmitter, ElementRef, Renderer,

View File

@@ -1,5 +0,0 @@
/// <reference path="../tsd.d.ts" />
declare module 'ng2-file-upload' {
export = require('index');
}

View File

@@ -11,6 +11,9 @@ import {FileUploader} from '../../../components/file-upload/file-uploader';
// webpack html imports // webpack html imports
let template = require('./simple-demo.html'); let template = require('./simple-demo.html');
// const URL = '/api/';
const URL = 'https://evening-anchorage-3159.herokuapp.com/api/';
@Component({ @Component({
selector: 'simple-demo' selector: 'simple-demo'
}) })
@@ -19,7 +22,7 @@ let template = require('./simple-demo.html');
directives: [FileSelect, FileDrop, NgClass, NgStyle, CORE_DIRECTIVES, FORM_DIRECTIVES] directives: [FileSelect, FileDrop, NgClass, NgStyle, CORE_DIRECTIVES, FORM_DIRECTIVES]
}) })
export class SimpleDemo { export class SimpleDemo {
private uploader:FileUploader = new FileUploader({url: '/api/'}); private uploader:FileUploader = new FileUploader({url: URL});
private hasBaseDropZoneOver:boolean = false; private hasBaseDropZoneOver:boolean = false;
private hasAnotherDropZoneOver:boolean = false; private hasAnotherDropZoneOver:boolean = false;

26
es6-object.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
interface ObjectConstructor {
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
*/
assign(target: any, ...sources: any[]): any;
/**
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
*/
is(value1: any, value2: any): boolean;
/**
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* @param o The object to change its prototype.
* @param proto The value of the new prototype or null.
* @remarks Requires `__proto__` support.
*/
setPrototypeOf(o: any, proto: any): any;
}
declare function require(path:string): any;

View File

@@ -17,41 +17,12 @@ gulp.paths = {
require('require-dir')('./gulp-tasks'); require('require-dir')('./gulp-tasks');
var typescript = require('gulp-tsc');
var options = require('./tsconfig.json').compilerOptions;
options.emitError = false;
var o = {
target: 'es5',
module: 'commonjs',
outDir: 'dist',
sourceRoot: 'dist',
mapRoot: 'dist',
keepTree: true,
declaration: true,
noEmitOnError: true,
emitError: false,
sourceMap: true,
removeComments: true,
noResolve: false,
suppressImplicitAnyIndexErrors: true,
safe: false,
emitDecoratorMetadata: true,
experimentalDecorators: true
};
var clean = require('gulp-clean'); var clean = require('gulp-clean');
gulp.task('clean', function () { gulp.task('clean', function () {
return gulp.src('dist', {read: false}) return gulp.src('dist', {read: false})
.pipe(clean()); .pipe(clean());
}); });
gulp.task('compile', ['clean'], function () {
gulp.src(['components/**/*.ts'])
.pipe(typescript(o))
.pipe(gulp.dest(options.outDir));
});
gulp.task('default', function () { gulp.task('default', function () {
gulp.start('lint'); gulp.start('lint');
}); });

View File

@@ -1,27 +1,20 @@
{ {
"name": "ng2-file-upload", "name": "ng2-file-upload",
"version": "0.40.0", "version": "0.42.0",
"description": "angular2 file upload directives", "description": "angular2 file upload directives",
"scripts": { "scripts": {
"deploy": "NODE_ENV=production webpack -p --progress --color --optimize-minimize --optimize-dedupe --optimize-occurence-order", "deploy": "NODE_ENV=production webpack -p --progress --color --optimize-minimize --optimize-dedupe --optimize-occurence-order",
"prepublish": "gulp compile", "prepublish": "gulp clean && tsc",
"prestart": "npm install", "prestart": "npm install",
"server": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached", "server": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
"start": "npm run server", "start": "npm run server",
"test": "gulp lint" "test": "gulp lint"
}, },
"main": "dist/index.js", "main": "dist/index.js",
"typescript": { "typings": "dist/index.d.ts",
"definition": [
"dist/module.d.ts",
"typings/es6-object.d.ts"
]
},
"files": [ "files": [
"dist", "dist",
"components", "components"
"typings",
"tsd.d.ts"
], ],
"keywords": [ "keywords": [
"angular2", "angular2",
@@ -40,36 +33,36 @@
}, },
"homepage": "https://github.com/valor-software/ng2-file-upload#readme", "homepage": "https://github.com/valor-software/ng2-file-upload#readme",
"dependencies": { "dependencies": {
"angular2": "^2.0.0-alpha.40", "angular2": "^2.0.0-alpha.42",
"ng2-bootstrap": "^0.40.0", "ng2-bootstrap": "^0.40.0",
"reflect-metadata": "0.1.2", "reflect-metadata": "0.1.2",
"ts-loader": "0.5.6", "ts-loader": "0.5.6",
"zone.js": "0.5.8" "zone.js": "0.5.8"
}, },
"devDependencies": { "devDependencies": {
"bootstrap": "^3.3.5", "bootstrap": "3.3.5",
"clean-webpack-plugin": "^0.1.3", "clean-webpack-plugin": "0.1.3",
"compression-webpack-plugin": "^0.2.0", "compression-webpack-plugin": "0.2.0",
"eslint": "^1.1.0", "eslint": "1.6.0",
"exports-loader": "^0.6.2", "exports-loader": "0.6.2",
"file-loader": "^0.8.4", "file-loader": "0.8.4",
"gulp": "^3.9.0", "gulp": "3.9.0",
"gulp-clean": "^0.3.1", "gulp-clean": "0.3.1",
"gulp-eslint": "^1.0.0", "gulp-eslint": "1.0.0",
"gulp-size": "^2.0.0", "gulp-size": "2.0.0",
"gulp-tsc": "^1.1.1", "gulp-tsc": "1.1.1",
"gulp-tslint": "^3.1.2", "gulp-tslint": "3.3.1",
"html-loader": "^0.3.0", "html-loader": "0.3.0",
"markdown-loader": "^0.1.7", "markdown-loader": "0.1.7",
"marked": "^0.3.5", "marked": "0.3.5",
"moment": "^2.10.6", "moment": "2.10.6",
"pre-commit": "^1.1.1", "pre-commit": "1.1.1",
"prismjs": "valorkin/prism", "prismjs": "valorkin/prism",
"prismjs-loader": "0.0.2", "prismjs-loader": "0.0.2",
"raw-loader": "^0.5.1", "raw-loader": "0.5.1",
"require-dir": "^0.3.0", "require-dir": "0.3.0",
"typescript": "^1.6.2", "typescript": "1.6.2",
"webpack": "^1.12.2", "webpack": "1.12.2",
"webpack-dev-server": "^1.12.0" "webpack-dev-server": "1.12.0"
} }
} }

View File

@@ -14,17 +14,10 @@
"noEmitOnError": false, "noEmitOnError": false,
"noImplicitAny": false "noImplicitAny": false
}, },
"filesGlob": [ "exclude": [
"!./node_modules/**/*.ts" "node_modules"
], ],
"files": [ "files": [
"./tsd.d.ts", "./components/index.ts"
"./components/file-upload/file-select.ts",
"./components/file-upload/file-item.ts",
"./components/file-upload/file-like-object.ts",
"./components/file-upload/file-drop.ts",
"./components/file-upload/file-uploader.ts",
"./components/index.ts",
"./components/module.ts"
] ]
} }

3
tsd.d.ts vendored
View File

@@ -1,2 +1 @@
/// <reference path="typings/tsd.d.ts"/> /// <reference path="es6-object.d.ts"/>
/// <reference path="node_modules/angular2/bundles/typings/angular2/angular2.d.ts" />