feat(package): upgrade to ng v2.3+ (#574)
This commit was merged in pull request #574.
This commit is contained in:
committed by
GitHub
parent
f5b5dc3bd2
commit
3cc6a9946f
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
/*eslint no-console: 0, no-sync: 0*/
|
||||
|
||||
// System.js bundler
|
||||
// simple and yet reusable system.js bundler
|
||||
// bundles, minifies and gzips
|
||||
|
||||
const fs = require('fs');
|
||||
const del = require('del');
|
||||
const path = require('path');
|
||||
const zlib = require('zlib');
|
||||
const async = require('async');
|
||||
const Builder = require('systemjs-builder');
|
||||
|
||||
const pkg = require('../package.json');
|
||||
const name = pkg.name;
|
||||
const targetFolder = path.resolve('./bundles');
|
||||
|
||||
async.waterfall([
|
||||
cleanBundlesFolder,
|
||||
getSystemJsBundleConfig,
|
||||
buildSystemJs({minify: false, sourceMaps: true, mangle: false}),
|
||||
getSystemJsBundleConfig,
|
||||
buildSystemJs({minify: true, sourceMaps: true, mangle: false}),
|
||||
gzipSystemJsBundle
|
||||
], err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
function getSystemJsBundleConfig(cb) {
|
||||
const config = {
|
||||
baseURL: '..',
|
||||
transpiler: 'typescript',
|
||||
typescriptOptions: {
|
||||
module: 'cjs'
|
||||
},
|
||||
map: {
|
||||
typescript: path.resolve('node_modules/typescript/lib/typescript.js'),
|
||||
'@angular/core': path.resolve('node_modules/@angular/core/index.js'),
|
||||
'@angular/common': path.resolve('node_modules/@angular/common/index.js'),
|
||||
'@angular/compiler': path.resolve('node_modules/@angular/compiler/index.js'),
|
||||
'@angular/platform-browser': path.resolve('node_modules/@angular/platform-browser/index.js'),
|
||||
'@angular/platform-browser-dynamic': path.resolve('node_modules/@angular/platform-browser-dynamic/'),
|
||||
rxjs: path.resolve('node_modules/rxjs')
|
||||
},
|
||||
paths: {
|
||||
'*': '*.js'
|
||||
}
|
||||
};
|
||||
|
||||
config.meta = ['@angular/common','@angular/compiler','@angular/core',
|
||||
'@angular/platform-browser','@angular/platform-browser-dynamic', 'rxjs'].reduce((memo, currentValue) => {
|
||||
memo[path.resolve(`node_modules/${currentValue}/*`)] = {build: false};
|
||||
return memo;
|
||||
}, {});
|
||||
config.meta.moment = {build: false};
|
||||
return cb(null, config);
|
||||
}
|
||||
|
||||
function cleanBundlesFolder(cb) {
|
||||
return del(targetFolder)
|
||||
.then(paths => {
|
||||
console.log('Deleted files and folders:\n', paths.join('\n'));
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
function buildSystemJs(options) {
|
||||
return (config, cb) => {
|
||||
const minPostFix = options && options.minify ? '.min' : '';
|
||||
const fileName = `${name}${minPostFix}.js`;
|
||||
const dest = path.resolve(__dirname, targetFolder, fileName);
|
||||
const builder = new Builder();
|
||||
|
||||
console.log('Bundling system.js file:', fileName, options);
|
||||
builder.config(config);
|
||||
return builder
|
||||
.bundle([name, name].join('/'), dest, options)
|
||||
.then(() => cb())
|
||||
.catch(cb);
|
||||
};
|
||||
}
|
||||
|
||||
function gzipSystemJsBundle(cb) {
|
||||
const files = fs
|
||||
.readdirSync(path.resolve(targetFolder))
|
||||
.map(file => path.resolve(targetFolder, file))
|
||||
.filter(file => fs.statSync(file).isFile())
|
||||
.filter(file => path.extname(file) !== 'gz');
|
||||
|
||||
return async.eachSeries(files, (file, gzipcb) => {
|
||||
process.nextTick(() => {
|
||||
console.log('Gzipping ', file);
|
||||
const gzip = zlib.createGzip({level: 9});
|
||||
const inp = fs.createReadStream(file);
|
||||
const out = fs.createWriteStream(`${file}.gz`);
|
||||
|
||||
inp.on('end', () => gzipcb());
|
||||
inp.on('error', err => gzipcb(err));
|
||||
return inp.pipe(gzip).pipe(out);
|
||||
});
|
||||
}, cb);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "./node_modules/eslint-config-valorsoft/.eslintrc.json",
|
||||
"env": {
|
||||
"node": true
|
||||
}
|
||||
}
|
||||
56
.gitignore
vendored
56
.gitignore
vendored
@@ -1,38 +1,38 @@
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
/node_modules
|
||||
/bower_components
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
/.vscode
|
||||
.project
|
||||
.classpath
|
||||
*.launch
|
||||
.settings/
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
|
||||
# type script artifacts
|
||||
/typings
|
||||
|
||||
# WebStorm
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# ignore build and dist for now
|
||||
/bundles
|
||||
/demo-build
|
||||
/dist
|
||||
/coverage
|
||||
/ts
|
||||
|
||||
# ignore incline compiling
|
||||
/demo/**/*.js
|
||||
/demo/**/*.d.ts
|
||||
!/demo/custom-typings.d.ts
|
||||
/demo/**/*.js.map
|
||||
/components/**/*.js
|
||||
/components/**/*.d.ts
|
||||
/components/**/*.js.map
|
||||
ng2-file-upload.js
|
||||
ng2-file-upload.d.ts
|
||||
ng2-file-upload.js.map
|
||||
/temp
|
||||
/demo/dist
|
||||
/demo/temp
|
||||
/logs
|
||||
|
||||
!/demo/components/file-upload/file-catcher.js
|
||||
#System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# AoT generated files
|
||||
factories
|
||||
/**/*.metadata.json
|
||||
/**/*.ngfactory.ts
|
||||
|
||||
/demo/e2e/*.js
|
||||
/demo/e2e/*.map
|
||||
src/**/*.js
|
||||
src/**/*.map
|
||||
scripts/**/*.js
|
||||
scripts/**/*.map
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
'use strict';
|
||||
var pkg = require('./package.json');
|
||||
|
||||
module.exports = {
|
||||
// metadata
|
||||
title: pkg.description,
|
||||
baseUrl: '/',
|
||||
// root folder name
|
||||
src: 'demo',
|
||||
dist: 'demo-build',
|
||||
htmlIndexes: ['index.html'],
|
||||
// karma bundle src
|
||||
spec: './spec-bundle.js',
|
||||
// webpack entry
|
||||
entry: {
|
||||
polyfills: './demo/polyfills.ts',
|
||||
vendor: './demo/vendor.ts',
|
||||
main: './demo/index.ts'
|
||||
},
|
||||
commonChunks: {
|
||||
name: ['polyfills', 'vendor'].reverse()
|
||||
},
|
||||
// webpack alias
|
||||
alias: {},
|
||||
copy: [
|
||||
{from: 'demo/favicon.ico', to: 'favicon.ico'},
|
||||
{from: 'demo/assets', to: 'assets'}
|
||||
]
|
||||
};
|
||||
27
.npmignore
27
.npmignore
@@ -1,27 +0,0 @@
|
||||
.idea
|
||||
gulp-tasks
|
||||
logs
|
||||
|
||||
# typings
|
||||
typings
|
||||
|
||||
# testing
|
||||
karma.conf.js
|
||||
test.bundle.js
|
||||
coverage
|
||||
|
||||
# demo build
|
||||
demo
|
||||
demo-build
|
||||
webpack.config.js
|
||||
|
||||
#typescript sources
|
||||
*.ts
|
||||
*.js.map
|
||||
!*.d.ts
|
||||
/components/**/*.ts
|
||||
!/components/**/*.d.ts
|
||||
|
||||
# AoT generated files
|
||||
factories
|
||||
/**/*.ngfactory.ts
|
||||
14
.travis.yml
14
.travis.yml
@@ -2,16 +2,20 @@ language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
|
||||
before_install:
|
||||
- export CHROME_BIN=chromium-browser
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
|
||||
script:
|
||||
- npm test
|
||||
- npm run pretest
|
||||
- npm run test-coverage
|
||||
|
||||
after_success:
|
||||
- ./node_modules/.bin/codecov -f coverage/coverage-final.json
|
||||
- ./node_modules/.bin/codecov
|
||||
|
||||
addons:
|
||||
# sauce labs tunel connector (read more https://docs.travis-ci.com/user/sauce-connect/ )
|
||||
sauce_connect: true
|
||||
firefox: "42.0"
|
||||
firefox: "latest"
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
4
LICENSE
4
LICENSE
@@ -1,7 +1,7 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Dmitriy Shekhovtsov <valorkin@gmail.com>
|
||||
Copyright (c) 2015 Valor Software
|
||||
Copyright (c) 2015-2017 Dmitriy Shekhovtsov <valorkin@gmail.com>
|
||||
Copyright (c) 2015-1017 Valor Software
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
57
angular-cli.json
Normal file
57
angular-cli.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"project": {
|
||||
"name": "ng2-file-upload"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"root": "demo/src",
|
||||
"outDir": "demo/dist",
|
||||
"assets": [
|
||||
"assets"
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"test": "../../scripts/test.ts",
|
||||
"tsconfig": "tsconfig.json",
|
||||
"prefix": "",
|
||||
"mobile": false,
|
||||
"styles": [
|
||||
],
|
||||
"scripts": [
|
||||
],
|
||||
"environments": {
|
||||
"source": "environments/environment.ts",
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"addons": [],
|
||||
"packages": [],
|
||||
"e2e": {
|
||||
"protractor": {
|
||||
"config": "protractor.conf.js"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "css",
|
||||
"prefixInterfaces": false,
|
||||
"inline": {
|
||||
"style": false,
|
||||
"template": false
|
||||
},
|
||||
"spec": {
|
||||
"class": false,
|
||||
"component": true,
|
||||
"directive": true,
|
||||
"module": false,
|
||||
"pipe": true,
|
||||
"service": true
|
||||
}
|
||||
}
|
||||
}
|
||||
2
demo/.gitignore
vendored
Normal file
2
demo/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
src/api-doc.json
|
||||
@@ -1,119 +0,0 @@
|
||||
/**
|
||||
* okaidia theme for JavaScript, CSS and HTML
|
||||
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
|
||||
* @author ocodia
|
||||
*/
|
||||
|
||||
code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
color: #f8f8f2;
|
||||
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
line-height: 1.5;
|
||||
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
}
|
||||
|
||||
/* Code blocks */
|
||||
pre[class*="language-"] {
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
|
||||
:not(pre) > code[class*="language-"],
|
||||
pre[class*="language-"] {
|
||||
background: #272822;
|
||||
}
|
||||
|
||||
/* Inline code */
|
||||
:not(pre) > code[class*="language-"] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.prolog,
|
||||
.token.doctype,
|
||||
.token.cdata {
|
||||
color: slategray;
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #f8f8f2;
|
||||
}
|
||||
|
||||
.namespace {
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
.token.property,
|
||||
.token.tag,
|
||||
.token.constant,
|
||||
.token.symbol,
|
||||
.token.deleted {
|
||||
color: #f92672;
|
||||
}
|
||||
|
||||
.token.boolean,
|
||||
.token.number {
|
||||
color: #ae81ff;
|
||||
}
|
||||
|
||||
.token.selector,
|
||||
.token.attr-name,
|
||||
.token.string,
|
||||
.token.char,
|
||||
.token.builtin,
|
||||
.token.inserted {
|
||||
color: #a6e22e;
|
||||
}
|
||||
|
||||
.token.operator,
|
||||
.token.entity,
|
||||
.token.url,
|
||||
.language-css .token.string,
|
||||
.style .token.string,
|
||||
.token.variable {
|
||||
color: #f8f8f2;
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.attr-value,
|
||||
.token.function {
|
||||
color: #e6db74;
|
||||
}
|
||||
|
||||
.token.keyword {
|
||||
color: #66d9ef;
|
||||
}
|
||||
|
||||
.token.regex,
|
||||
.token.important {
|
||||
color: #fd971f;
|
||||
}
|
||||
|
||||
.token.important,
|
||||
.token.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.token.italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help;
|
||||
}
|
||||
4
demo/bs-config.json
Normal file
4
demo/bs-config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"port": 4200,
|
||||
"server": { "baseDir": "./demo/dist" }
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
let doc = require('../../components/file-upload/readme.md');
|
||||
|
||||
let tabDesc:Array<any> = [
|
||||
{
|
||||
heading: 'Simple',
|
||||
ts: require('!!prismjs?lang=typescript!./file-upload/simple-demo.ts'),
|
||||
html: require('!!prismjs?lang=markup!./file-upload/simple-demo.html'),
|
||||
js: require('!!prismjs?lang=javascript!./file-upload/file-catcher.js')
|
||||
}
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'file-upload-section',
|
||||
template: `
|
||||
<section [id]="name.toLowerCase()">
|
||||
<div class="row">
|
||||
<tabset>
|
||||
<tab *ngFor="let desc of tabs" heading="{{desc.heading}}" (select)="select($event)">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
|
||||
<simple-demo></simple-demo>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="row" style="margin: 0px;">
|
||||
<tabset>
|
||||
<tab heading="Markup">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="language-html"><code class="language-html" ng-non-bindable [innerHTML]="desc.html"></code></pre>
|
||||
</div>
|
||||
</tab>
|
||||
<tab heading="TypeScript">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="language-typescript"><code class="language-typescript" ng-non-bindable [innerHTML]="desc.ts"></code></pre>
|
||||
</div>
|
||||
</tab>
|
||||
<tab heading="Backend Demo">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="language-javascript"><code class="language-javascript" ng-non-bindable [innerHTML]="desc.js"></code></pre>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
</div>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<h2>API</h2>
|
||||
<div class="card card-block panel panel-default panel-body" [innerHTML]="doc"></div>
|
||||
</div>
|
||||
</section>
|
||||
`
|
||||
})
|
||||
export class FileUploadSectionComponent {
|
||||
public name:string = 'File Upload';
|
||||
public currentHeading:string = 'Simple';
|
||||
public doc:string = doc;
|
||||
public tabs:any = tabDesc;
|
||||
|
||||
public select(e:any):void {
|
||||
if (e.heading) {
|
||||
this.currentHeading = e.heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<label class="btn btn-primary">Select File
|
||||
<input type="file" (change)="onChange($event)" [multiple]="multiple" style="display: none;"/>
|
||||
</label>
|
||||
@@ -1,122 +0,0 @@
|
||||
import { Component, ElementRef, Renderer, Input, HostListener, HostBinding, OnInit } from '@angular/core';
|
||||
import { FileUploader, FileUploaderOptions } from '../../../../ng2-file-upload';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-file-upload',
|
||||
providers: [FileUploader],
|
||||
template: require('./demo.html'),
|
||||
styles: [':host {border:1px solid black; padding:59px;display: block;}' +
|
||||
'.hover {border: 3px solid green; backgroud: black;}']
|
||||
})
|
||||
export class DemoFileUploadComponent implements OnInit {
|
||||
|
||||
@Input() public url:string;
|
||||
@Input() public queueLimit:number;
|
||||
@Input() public maxFileSize:number;
|
||||
@Input() public autoUpload:boolean;
|
||||
@Input() public allowedMimeType:Array<string>;
|
||||
@Input() public allowedFileType:Array<string>;
|
||||
@Input() public headers:Array<any>;
|
||||
|
||||
@HostBinding('class.hover') private isHover:boolean = false;
|
||||
|
||||
private inputs:string[] = ['allowedMimeType',
|
||||
'allowedFileType',
|
||||
'autoUpload',
|
||||
'isHTML5',
|
||||
'headers',
|
||||
'maxFileSize',
|
||||
'queueLimit',
|
||||
'removeAfterUpload',
|
||||
'url'
|
||||
];
|
||||
|
||||
private uploaderOptions:FileUploaderOptions = {};
|
||||
|
||||
private multiple:boolean = true;
|
||||
|
||||
private element:ElementRef;
|
||||
private fileUploadService:FileUploader;
|
||||
private renderer:Renderer;
|
||||
|
||||
public constructor(element:ElementRef, fileUploadService:FileUploader, renderer:Renderer) {
|
||||
this.element = element;
|
||||
this.fileUploadService = fileUploadService;
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public ngOnInit():any {
|
||||
for (let input of this.inputs) {
|
||||
if (this[input]) {
|
||||
this.uploaderOptions[input] = this[input];
|
||||
}
|
||||
}
|
||||
this.fileUploadService.setOptions(this.uploaderOptions);
|
||||
|
||||
this.multiple = (!this.queueLimit || this.queueLimit > 1);
|
||||
}
|
||||
|
||||
@HostListener('drop', ['$event'])
|
||||
public onDrop(event:any):void {
|
||||
this._preventAndStop(event);
|
||||
this.isHover = false;
|
||||
|
||||
let transfer = this._getTransfer(event);
|
||||
if (!transfer) {
|
||||
return;
|
||||
}
|
||||
this.fileUploadService.addToQueue(transfer.files);
|
||||
}
|
||||
|
||||
@HostListener('dragover', ['$event'])
|
||||
public onDragOver(event:any):void {
|
||||
this._preventAndStop(event);
|
||||
|
||||
if (this.isHover) {
|
||||
return;
|
||||
}
|
||||
|
||||
let transfer = this._getTransfer(event);
|
||||
if (!this._haveFiles(transfer.types)) {
|
||||
return;
|
||||
}
|
||||
this.isHover = true;
|
||||
}
|
||||
|
||||
@HostListener('dragleave', ['$event'])
|
||||
public onDragLeave(event:any):void {
|
||||
this._preventAndStop(event);
|
||||
if (event.currentTarget === (this as any).element[0]) {
|
||||
return;
|
||||
}
|
||||
this.isHover = false;
|
||||
}
|
||||
|
||||
public onChange($event:any):void {
|
||||
this.fileUploadService.addToQueue($event.srcElement.files);
|
||||
}
|
||||
|
||||
private _getTransfer(event:any):any {
|
||||
return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer;
|
||||
}
|
||||
|
||||
private _preventAndStop(event:any):any {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
private _haveFiles(types:any):any {
|
||||
if (!types) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (types.indexOf) {
|
||||
return types.indexOf('Files') !== -1;
|
||||
} else if (types.contains) {
|
||||
return types.contains('Files');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
1
demo/custom-typings.d.ts
vendored
1
demo/custom-typings.d.ts
vendored
@@ -1 +0,0 @@
|
||||
declare const ENV:string;
|
||||
@@ -1,4 +0,0 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { NgFileUploadDemo } from './ng2-file-upload-demo.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(NgFileUploadDemo);
|
||||
@@ -1,18 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { Ng2BootstrapModule } from 'ng2-bootstrap/ng2-bootstrap';
|
||||
import { FileUploadModule } from '../components/file-upload/file-upload.module';
|
||||
import { DemoComponent } from './app.component.ts';
|
||||
import { FileUploadSectionComponent } from './components/file-upload-section';
|
||||
import { SimpleDemoComponent } from './components/file-upload/simple-demo';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserModule, CommonModule, FileUploadModule, Ng2BootstrapModule, FormsModule],
|
||||
declarations: [DemoComponent, FileUploadSectionComponent, SimpleDemoComponent],
|
||||
bootstrap: [DemoComponent]
|
||||
})
|
||||
export class NgFileUploadDemo {
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Polyfills
|
||||
// (these modules are what are in 'angular2/bundles/angular2-polyfills' so don't use that here)
|
||||
|
||||
// import 'ie-shim'; // Internet Explorer
|
||||
// import 'es6-shim';
|
||||
// import 'es6-promise';
|
||||
// import 'es7-reflect-metadata';
|
||||
|
||||
// Prefer CoreJS over the polyfills above
|
||||
import 'core-js/es6';
|
||||
import 'core-js/es7/reflect';
|
||||
require('zone.js/dist/zone');
|
||||
require('reflect-metadata');
|
||||
|
||||
// Typescript emit helpers polyfill
|
||||
import 'ts-helpers';
|
||||
|
||||
if ('production' === ENV) {
|
||||
// Production
|
||||
|
||||
} else {
|
||||
// Development
|
||||
|
||||
(Error as any).stackTraceLimit = Infinity;
|
||||
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
let gettingStarted = require('./getting-started.md');
|
||||
let gettingStarted = require('html-loader!markdown-loader!../getting-started.md');
|
||||
|
||||
@Component({
|
||||
selector: 'app',
|
||||
@@ -18,7 +18,7 @@ let gettingStarted = require('./getting-started.md');
|
||||
</main>
|
||||
|
||||
<div class="container">
|
||||
<section id="getting-started">${gettingStarted}</section>
|
||||
<section id="getting-started" [innerHtml]="gettingStarted"></section>
|
||||
|
||||
<file-upload-section class="col-md-12"></file-upload-section>
|
||||
</div>
|
||||
@@ -30,5 +30,14 @@ let gettingStarted = require('./getting-started.md');
|
||||
</footer>
|
||||
`
|
||||
})
|
||||
export class DemoComponent {
|
||||
export class AppComponent {
|
||||
public gettingStarted:string = gettingStarted;
|
||||
public ngAfterContentInit(): any {
|
||||
setTimeout(()=>{
|
||||
if (typeof PR !== 'undefined') {
|
||||
// google code-prettify
|
||||
PR.prettyPrint();
|
||||
}
|
||||
}, 150);
|
||||
}
|
||||
}
|
||||
19
demo/src/app/app.module.ts
Normal file
19
demo/src/app/app.module.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { TabsModule } from 'ng2-bootstrap';
|
||||
import { FileUploadModule } from 'ng2-file-upload';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { FileUploadSectionComponent } from './components/file-upload-section';
|
||||
import { SimpleDemoComponent } from './components/file-upload/simple-demo';
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserModule, CommonModule, FileUploadModule, TabsModule.forRoot(), FormsModule],
|
||||
declarations: [AppComponent, FileUploadSectionComponent, SimpleDemoComponent],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
40
demo/src/app/components/file-upload-section.html
Normal file
40
demo/src/app/components/file-upload-section.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<section [attr.id]="name.toLowerCase()">
|
||||
<div class="row">
|
||||
<tabset>
|
||||
<tab *ngFor="let desc of tabs" heading="{{desc.heading}}" (select)="select($event)">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
|
||||
<simple-demo></simple-demo>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="row" style="margin: 0px;">
|
||||
<tabset>
|
||||
<tab heading="Markup">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="prettyprint linenums lang-html">{{desc.html}}</pre>
|
||||
</div>
|
||||
</tab>
|
||||
<tab heading="TypeScript">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="prettyprint linenums lang-js">{{desc.ts}}</pre>
|
||||
<pre class="language-typescript"><code class="language-typescript" ng-non-bindable [innerHTML]="desc.ts"></code></pre>
|
||||
</div>
|
||||
</tab>
|
||||
<tab heading="Backend Demo">
|
||||
<div class="card card-block panel panel-default panel-body">
|
||||
<pre class="prettyprint linenums lang-js">{{desc.js}}</pre>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
</div>
|
||||
</div>
|
||||
</tab>
|
||||
</tabset>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<h2>API</h2>
|
||||
<div class="card card-block panel panel-default panel-body" [innerHTML]="doc"></div>
|
||||
</div>
|
||||
</section>
|
||||
29
demo/src/app/components/file-upload-section.ts
Normal file
29
demo/src/app/components/file-upload-section.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
let doc = require('html-loader!markdown-loader!../../doc.md');
|
||||
|
||||
let tabDesc:Array<any> = [
|
||||
{
|
||||
heading: 'Simple',
|
||||
ts: require('!!raw-loader?lang=typescript!./file-upload/simple-demo.ts'),
|
||||
html: require('!!raw-loader?lang=markup!./file-upload/simple-demo.html'),
|
||||
js: require('!!raw-loader?lang=javascript!./file-upload/file-catcher.js')
|
||||
}
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'file-upload-section',
|
||||
templateUrl: './file-upload-section.html'
|
||||
})
|
||||
export class FileUploadSectionComponent {
|
||||
public name:string = 'File Upload';
|
||||
public currentHeading:string = 'Simple';
|
||||
public doc:string = doc;
|
||||
public tabs:any = tabDesc;
|
||||
|
||||
public select(e:any):void {
|
||||
if (e.heading) {
|
||||
this.currentHeading = e.heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
demo/src/app/components/file-upload/file-catcher.js
Normal file
50
demo/src/app/components/file-upload/file-catcher.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/*eslint-disable*/
|
||||
var express = require('express');
|
||||
var multer = require('multer');
|
||||
var fs = require('fs');
|
||||
var app = express();
|
||||
|
||||
var DIR = './uploads/';
|
||||
|
||||
var upload = multer({dest: DIR});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
res.setHeader('Access-Control-Allow-Origin', 'http://valor-software.github.io');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'POST');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
|
||||
res.setHeader('Access-Control-Allow-Credentials', true);
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(multer({
|
||||
dest: DIR,
|
||||
rename: function (fieldname, filename) {
|
||||
return filename + Date.now();
|
||||
},
|
||||
onFileUploadStart: function (file) {
|
||||
console.log(file.originalname + ' is starting ...');
|
||||
},
|
||||
onFileUploadComplete: function (file) {
|
||||
console.log(file.fieldname + ' uploaded to ' + file.path);
|
||||
}
|
||||
}));
|
||||
|
||||
app.get('/api', function (req, res) {
|
||||
res.end('file catcher example');
|
||||
});
|
||||
|
||||
app.post('/api', function (req, res) {
|
||||
upload(req, res, function (err) {
|
||||
if (err) {
|
||||
return res.end(err.toString());
|
||||
}
|
||||
|
||||
res.end('File is uploaded');
|
||||
});
|
||||
});
|
||||
|
||||
var PORT = process.env.PORT || 3000;
|
||||
|
||||
app.listen(PORT, function () {
|
||||
console.log('Working on port ' + PORT);
|
||||
});
|
||||
@@ -1,15 +1,12 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { FileUploader } from '../../../ng2-file-upload';
|
||||
|
||||
// webpack html imports
|
||||
let template = require('./simple-demo.html');
|
||||
import { FileUploader } from 'ng2-file-upload';
|
||||
|
||||
// const URL = '/api/';
|
||||
const URL = 'https://evening-anchorage-3159.herokuapp.com/api/';
|
||||
|
||||
@Component({
|
||||
selector: 'simple-demo',
|
||||
template: template
|
||||
templateUrl: './simple-demo.html'
|
||||
})
|
||||
export class SimpleDemoComponent {
|
||||
public uploader:FileUploader = new FileUploader({url: URL});
|
||||
2
demo/src/app/index.ts
Normal file
2
demo/src/app/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './app.component';
|
||||
export * from './app.module';
|
||||
217
demo/src/assets/css/prettify-angulario.css
Normal file
217
demo/src/assets/css/prettify-angulario.css
Normal file
@@ -0,0 +1,217 @@
|
||||
.prettyprint {
|
||||
white-space: pre-wrap;
|
||||
background: #F5F6F7;
|
||||
font-family: Monaco,"Lucida Console",monospace;
|
||||
color: #5C707A;
|
||||
width: auto;
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
font-size: 13px;
|
||||
line-height: 24px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
padding: 16px 32px
|
||||
}
|
||||
|
||||
.prettyprint.linenums,.prettyprint[class^="linenums:"],.prettyprint[class*=" linenums:"] {
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.prettyprint.is-showcase {
|
||||
border: 4px solid #0273D4
|
||||
}
|
||||
|
||||
.prettyprint code {
|
||||
background: none;
|
||||
font-size: 13px;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.prettyprint ol {
|
||||
background: #F5F6F7;
|
||||
padding: 16px 32px 16px 56px;
|
||||
margin: 0;
|
||||
overflow: auto;
|
||||
font-size: 13px
|
||||
}
|
||||
|
||||
.prettyprint ol li,.prettyprint .tag {
|
||||
color: #7a8b94;
|
||||
background: none;
|
||||
margin-bottom: 5px;
|
||||
line-height: normal;
|
||||
list-style-type: decimal;
|
||||
font-size: 12px
|
||||
}
|
||||
|
||||
.prettyprint ol li:last-child {
|
||||
margin-bottom: 0
|
||||
}
|
||||
|
||||
.prettyprint ol li code {
|
||||
background: none;
|
||||
font-size: 13px
|
||||
}
|
||||
|
||||
.prettyprint .pnk,.prettyprint .blk {
|
||||
border-radius: 4px;
|
||||
padding: 2px 4px
|
||||
}
|
||||
|
||||
.prettyprint .pnk {
|
||||
background: #CFD8DC;
|
||||
color: #5C707A
|
||||
}
|
||||
|
||||
.prettyprint .blk {
|
||||
background: #E0E0E0
|
||||
}
|
||||
|
||||
.prettyprint .otl {
|
||||
outline: 1px solid rgba(169,169,169,0.56)
|
||||
}
|
||||
|
||||
.prettyprint .kwd {
|
||||
color: #D43669
|
||||
}
|
||||
|
||||
.prettyprint .typ,.prettyprint .tag {
|
||||
color: #D43669
|
||||
}
|
||||
|
||||
.prettyprint .str,.prettyprint .atv {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .atn {
|
||||
/*color: #647f11*/
|
||||
color: #31708f
|
||||
}
|
||||
|
||||
.prettyprint .com {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .lit {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .pun {
|
||||
color: #7a8b94
|
||||
}
|
||||
|
||||
.prettyprint .pln {
|
||||
color: #5C707A
|
||||
/*color: #8a6d3b*/
|
||||
}
|
||||
|
||||
.prettyprint .dec {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
@media print {
|
||||
.prettyprint {
|
||||
background: #F5F6F7;
|
||||
border: none;
|
||||
box-shadow: none
|
||||
}
|
||||
|
||||
.prettyprint ol {
|
||||
background: #F5F6F7
|
||||
}
|
||||
|
||||
.prettyprint .kwd {
|
||||
color: #D43669
|
||||
}
|
||||
|
||||
.prettyprint .typ,.prettyprint .tag {
|
||||
color: #D43669
|
||||
}
|
||||
|
||||
.prettyprint .str,.prettyprint .atv {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .atn {
|
||||
/*color: #647f11*/
|
||||
color: #31708f
|
||||
}
|
||||
|
||||
.prettyprint .com {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .lit {
|
||||
color: #647f11
|
||||
}
|
||||
|
||||
.prettyprint .pun {
|
||||
color: #7a8b94
|
||||
}
|
||||
|
||||
.prettyprint .pln {
|
||||
color: #5C707A
|
||||
}
|
||||
|
||||
.prettyprint .dec {
|
||||
color: #647f11
|
||||
}
|
||||
}
|
||||
|
||||
h1 .prettyprint,h2 .prettyprint,h3 .prettyprint,h4 .prettyprint {
|
||||
background: none;
|
||||
font-family: Monaco,"Lucida Console",monospace;
|
||||
color: #253238;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
margin: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
h1 .prettyprint code,h2 .prettyprint code,h3 .prettyprint code,h4 .prettyprint code {
|
||||
background: none;
|
||||
font-size: 15px;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
h1 .prettyprint .kwd,h2 .prettyprint .kwd,h3 .prettyprint .kwd,h4 .prettyprint .kwd {
|
||||
color: #253238
|
||||
}
|
||||
|
||||
h1 .prettyprint .typ,h1 .prettyprint .tag,h2 .prettyprint .typ,h2 .prettyprint .tag,h3 .prettyprint .typ,h3 .prettyprint .tag,h4 .prettyprint .typ,h4 .prettyprint .tag {
|
||||
color: #B52E31
|
||||
}
|
||||
|
||||
h1 .prettyprint .str,h1 .prettyprint .atv,h2 .prettyprint .str,h2 .prettyprint .atv,h3 .prettyprint .str,h3 .prettyprint .atv,h4 .prettyprint .str,h4 .prettyprint .atv {
|
||||
color: #9d8d00
|
||||
}
|
||||
|
||||
h1 .prettyprint .atn,h2 .prettyprint .atn,h3 .prettyprint .atn,h4 .prettyprint .atn {
|
||||
color: #71a436
|
||||
}
|
||||
|
||||
h1 .prettyprint .com,h2 .prettyprint .com,h3 .prettyprint .com,h4 .prettyprint .com {
|
||||
color: #AFBEC5
|
||||
}
|
||||
|
||||
h1 .prettyprint .lit,h2 .prettyprint .lit,h3 .prettyprint .lit,h4 .prettyprint .lit {
|
||||
color: #9d8d00
|
||||
}
|
||||
|
||||
h1 .prettyprint .pun,h2 .prettyprint .pun,h3 .prettyprint .pun,h4 .prettyprint .pun {
|
||||
color: #000
|
||||
}
|
||||
|
||||
h1 .prettyprint .pln,h2 .prettyprint .pln,h3 .prettyprint .pln,h4 .prettyprint .pln {
|
||||
color: #000
|
||||
}
|
||||
|
||||
h1 .prettyprint .dec,h2 .prettyprint .dec,h3 .prettyprint .dec,h4 .prettyprint .dec {
|
||||
color: #8762c6
|
||||
}
|
||||
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
36
demo/src/assets/js/prettify.min.js
vendored
Normal file
36
demo/src/assets/js/prettify.min.js
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
!function () { var q = null; window.PR_SHOULD_USE_CONTINUATION = !0;
|
||||
(function () { function S(a) { function d(e) { var b = e.charCodeAt(0); if (b !== 92) return b; var a = e.charAt(1); return (b = r[a]) ? b : '0' <= a && a <= '7' ? parseInt(e.substring(1), 8) : a === 'u' || a === 'x' ? parseInt(e.substring(2), 16) : e.charCodeAt(1); } function g(e) { if (e < 32) return (e < 16 ? '\\x0' : '\\x') + e.toString(16); e = String.fromCharCode(e); return e === '\\' || e === '-' || e === ']' || e === '^' ? '\\' + e : e; } function b(e) { var b = e.substring(1, e.length - 1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g), e = [], a =
|
||||
b[0] === '^', c = ['[']; a && c.push('^'); for (var a = a ? 1 : 0, f = b.length; a < f; ++a) { var h = b[a]; if (/\\[bdsw]/i.test(h))c.push(h); else { var h = d(h), l; a + 2 < f && '-' === b[a + 1] ? (l = d(b[a + 2]), a += 2) : l = h; e.push([h, l]); l < 65 || h > 122 || (l < 65 || h > 90 || e.push([Math.max(65, h) | 32, Math.min(l, 90) | 32]), l < 97 || h > 122 || e.push([Math.max(97, h) & -33, Math.min(l, 122) & -33])); } }e.sort(function (e, a) { return e[0] - a[0] || a[1] - e[1]; }); b = []; f = []; for (a = 0; a < e.length; ++a)h = e[a], h[0] <= f[1] + 1 ? f[1] = Math.max(f[1], h[1]) : b.push(f = h); for (a = 0; a < b.length; ++a)h = b[a], c.push(g(h[0])),
|
||||
h[1] > h[0] && (h[1] + 1 > h[0] && c.push('-'), c.push(g(h[1]))); c.push(']'); return c.join(''); } function s(e) { for (var a = e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g), c = a.length, d = [], f = 0, h = 0; f < c; ++f) { var l = a[f]; l === '(' ? ++h : '\\' === l.charAt(0) && (l = +l.substring(1)) && (l <= h ? d[l] = -1 : a[f] = g(l)); } for (f = 1; f < d.length; ++f)-1 === d[f] && (d[f] = ++x); for (h = f = 0; f < c; ++f)l = a[f], l === '(' ? (++h, d[h] || (a[f] = '(?:')) : '\\' === l.charAt(0) && (l = +l.substring(1)) && l <= h &&
|
||||
(a[f] = '\\' + d[l]); for (f = 0; f < c; ++f)'^' === a[f] && '^' !== a[f + 1] && (a[f] = ''); if (e.ignoreCase && m) for (f = 0; f < c; ++f)l = a[f], e = l.charAt(0), l.length >= 2 && e === '[' ? a[f] = b(l) : e !== '\\' && (a[f] = l.replace(/[A-Za-z]/g, function (a) { a = a.charCodeAt(0); return '[' + String.fromCharCode(a & -33, a | 32) + ']'; })); return a.join(''); } for (var x = 0, m = !1, j = !1, k = 0, c = a.length; k < c; ++k) { var i = a[k]; if (i.ignoreCase)j = !0; else if (/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi, ''))) { m = !0; j = !1; break; } } for (var r = {
|
||||
b: 8, t: 9, n: 10, v: 11,
|
||||
f: 12, r: 13
|
||||
}, n = [], k = 0, c = a.length; k < c; ++k) { i = a[k]; if (i.global || i.multiline) throw Error('' + i); n.push('(?:' + s(i) + ')'); } return RegExp(n.join('|'), j ? 'gi' : 'g'); } function T(a, d) { function g(a) { var c = a.nodeType; if (c == 1) { if (!b.test(a.className)) { for (c = a.firstChild; c; c = c.nextSibling)g(c); c = a.nodeName.toLowerCase(); if ('br' === c || 'li' === c)s[j] = '\n', m[j << 1] = x++, m[j++ << 1 | 1] = a; } } else if (c == 3 || c == 4)c = a.nodeValue, c.length && (c = d ? c.replace(/\r\n?/g, '\n') : c.replace(/[\t\n\r ]+/g, ' '), s[j] = c, m[j << 1] = x, x += c.length, m[j++ << 1 | 1] =
|
||||
a); } var b = /(?:^|\s)nocode(?:\s|$)/, s = [], x = 0, m = [], j = 0; g(a); return {a: s.join('').replace(/\n$/, ''), d: m}; } function H(a, d, g, b) { d && (a = {a: d, e: a}, g(a), b.push.apply(b, a.g)); } function U(a) { for (var d = void 0, g = a.firstChild; g; g = g.nextSibling) var b = g.nodeType, d = b === 1 ? d ? a : g : b === 3 ? V.test(g.nodeValue) ? a : d : d; return d === a ? void 0 : d; } function C(a, d) { function g(a) { for (var j = a.e, k = [j, 'pln'], c = 0, i = a.a.match(s) || [], r = {}, n = 0, e = i.length; n < e; ++n) { var z = i[n], w = r[z], t = void 0, f; if (typeof w === 'string')f = !1; else { var h = b[z.charAt(0)];
|
||||
if (h)t = z.match(h[1]), w = h[0]; else { for (f = 0; f < x; ++f) if (h = d[f], t = z.match(h[1])) { w = h[0]; break; }t || (w = 'pln'); } if ((f = w.length >= 5 && 'lang-' === w.substring(0, 5)) && !(t && typeof t[1] === 'string'))f = !1, w = 'src'; f || (r[z] = w); }h = c; c += z.length; if (f) { f = t[1]; var l = z.indexOf(f), B = l + f.length; t[2] && (B = z.length - t[2].length, l = B - f.length); w = w.substring(5); H(j + h, z.substring(0, l), g, k); H(j + h + l, f, I(w, f), k); H(j + h + B, z.substring(B), g, k); } else k.push(j + h, w); }a.g = k; } var b = {}, s; (function () { for (var g = a.concat(d), j = [], k = {}, c = 0, i = g.length; c < i; ++c) { var r =
|
||||
g[c], n = r[3]; if (n) for (var e = n.length; --e >= 0;)b[n.charAt(e)] = r; r = r[1]; n = '' + r; k.hasOwnProperty(n) || (j.push(r), k[n] = q); }j.push(/[\S\s]/); s = S(j); })(); var x = d.length; return g; } function v(a) { var d = [], g = []; a.tripleQuotedStrings ? d.push(['str', /^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/, q, '\'"']) : a.multiLineStrings ? d.push(['str', /^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q, '\'"`']) : d.push(['str', /^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/, q, '"\'']); a.verbatimStrings && g.push(['str', /^@"(?:[^"]|"")*(?:"|$)/, q]); var b = a.hashComments; b && (a.cStyleComments ? (b > 1 ? d.push(['com', /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, q, '#']) : d.push(['com', /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/, q, '#']), g.push(['str', /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/, q])) : d.push(['com',
|
||||
/^#[^\n\r]*/, q, '#'])); a.cStyleComments && (g.push(['com', /^\/\/[^\n\r]*/, q]), g.push(['com', /^\/\*[\S\s]*?(?:\*\/|$)/, q])); if (b = a.regexLiterals) { var s = (b = b > 1 ? '' : '\n\r') ? '.' : '[\\S\\s]'; g.push(['lang-regex', RegExp('^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(' + ('/(?=[^/*' + b + '])(?:[^/\\x5B\\x5C' + b + ']|\\x5C' + s + '|\\x5B(?:[^\\x5C\\x5D' + b + ']|\\x5C' +
|
||||
s + ')*(?:\\x5D|$))+/') + ')')]); }(b = a.types) && g.push(['typ', b]); b = ('' + a.keywords).replace(/^ | $/g, ''); b.length && g.push(['kwd', RegExp('^(?:' + b.replace(/[\s,]+/g, '|') + ')\\b'), q]); d.push(['pln', /^\s+/, q, ' \r\n\t\u00a0']); b = '^.[^\\s\\w.$@\'"`/\\\\]*'; a.regexLiterals && (b += '(?!s*/)'); g.push(['lit', /^@[$_a-z][\w$@]*/i, q], ['typ', /^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/, q], ['pln', /^[$_a-z][\w$@]*/i, q], ['lit', /^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i, q, '0123456789'], ['pln', /^\\[\S\s]?/,
|
||||
q], ['pun', RegExp(b), q]); return C(d, g); } function J(a, d, g) { function b(a) { var c = a.nodeType; if (c == 1 && !x.test(a.className)) if ('br' === a.nodeName)s(a), a.parentNode && a.parentNode.removeChild(a); else for (a = a.firstChild; a; a = a.nextSibling)b(a); else if ((c == 3 || c == 4) && g) { var d = a.nodeValue, i = d.match(m); if (i)c = d.substring(0, i.index), a.nodeValue = c, (d = d.substring(i.index + i[0].length)) && a.parentNode.insertBefore(j.createTextNode(d), a.nextSibling), s(a), c || a.parentNode.removeChild(a); } } function s(a) { function b(a, c) { var d =
|
||||
c ? a.cloneNode(!1) : a, e = a.parentNode; if (e) { var e = b(e, 1), g = a.nextSibling; e.appendChild(d); for (var i = g; i; i = g)g = i.nextSibling, e.appendChild(i); } return d; } for (;!a.nextSibling;) if (a = a.parentNode, !a) return; for (var a = b(a.nextSibling, 0), d; (d = a.parentNode) && d.nodeType === 1;)a = d; c.push(a); } for (var x = /(?:^|\s)nocode(?:\s|$)/, m = /\r\n?|\n/, j = a.ownerDocument, k = j.createElement('li'); a.firstChild;)k.appendChild(a.firstChild); for (var c = [k], i = 0; i < c.length; ++i)b(c[i]); d === (d | 0) && c[0].setAttribute('value', d); var r = j.createElement('ol');
|
||||
r.className = 'linenums'; for (var d = Math.max(0, d - 1 | 0) || 0, i = 0, n = c.length; i < n; ++i)k = c[i], k.className = 'L' + (i + d) % 10, k.firstChild || k.appendChild(j.createTextNode('\u00a0')), r.appendChild(k); a.appendChild(r); } function p(a, d) { for (var g = d.length; --g >= 0;) { var b = d[g]; F.hasOwnProperty(b) ? D.console && console.warn('cannot override language handler %s', b) : F[b] = a; } } function I(a, d) { if (!a || !F.hasOwnProperty(a))a = /^\s*</.test(d) ? 'default-markup' : 'default-code'; return F[a]; } function K(a) { var d = a.h; try { var g = T(a.c, a.i), b = g.a;
|
||||
a.a = b; a.d = g.d; a.e = 0; I(d, b)(a); var s = /\bMSIE\s(\d+)/.exec(navigator.userAgent), s = s && +s[1] <= 8, d = /\n/g, x = a.a, m = x.length, g = 0, j = a.d, k = j.length, b = 0, c = a.g, i = c.length, r = 0; c[i] = m; var n, e; for (e = n = 0; e < i;)c[e] !== c[e + 2] ? (c[n++] = c[e++], c[n++] = c[e++]) : e += 2; i = n; for (e = n = 0; e < i;) { for (var p = c[e], w = c[e + 1], t = e + 2; t + 2 <= i && c[t + 1] === w;)t += 2; c[n++] = p; c[n++] = w; e = t; }c.length = n; var f = a.c, h; if (f)h = f.style.display, f.style.display = 'none'; try { for (;b < k;) { var l = j[b + 2] || m, B = c[r + 2] || m, t = Math.min(l, B), A = j[b + 1], G; if (A.nodeType !== 1 && (G = x.substring(g,
|
||||
t))) { s && (G = G.replace(d, '\r')); A.nodeValue = G; var L = A.ownerDocument, o = L.createElement('span'); o.className = c[r + 1]; var v = A.parentNode; v.replaceChild(o, A); o.appendChild(A); g < l && (j[b + 1] = A = L.createTextNode(x.substring(t, l)), v.insertBefore(A, o.nextSibling)); }g = t; g >= l && (b += 2); g >= B && (r += 2); } } finally { if (f)f.style.display = h; } } catch (u) { D.console && console.log(u && u.stack || u); } } var D = window, y = ['break,continue,do,else,for,if,return,while'], E = [[y, 'auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile'],
|
||||
'catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof'], M = [E, 'alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where'], N = [E, 'abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient'],
|
||||
O = [N, 'as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where'], E = [E, 'debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN'], P = [y, 'and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None'],
|
||||
Q = [y, 'alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END'], W = [y, 'as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use'], y = [y, 'case,done,elif,esac,eval,fi,function,in,local,set,then,until'], R = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V = /\S/, X = v({keywords: [M, O, E, 'caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END', P, Q, y], hashComments: !0, cStyleComments: !0, multiLineStrings: !0, regexLiterals: !0}), F = {}; p(X, ['default-code']); p(C([], [['pln', /^[^<?]+/], ['dec', /^<!\w[^>]*(?:>|$)/], ['com', /^<\!--[\S\s]*?(?:--\>|$)/], ['lang-', /^<\?([\S\s]+?)(?:\?>|$)/], ['lang-', /^<%([\S\s]+?)(?:%>|$)/], ['pun', /^(?:<[%?]|[%?]>)/], ['lang-',
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i], ['lang-js', /^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i], ['lang-css', /^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i], ['lang-in.tag', /^(<\/?[a-z][^<>]*>)/i]]), ['default-markup', 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl']); p(C([['pln', /^\s+/, q, ' \t\r\n'], ['atv', /^(?:"[^"]*"?|'[^']*'?)/, q, '"\'']], [['tag', /^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i], ['atn', /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], ['lang-uq.val', /^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/], ['pun', /^[/<->]+/],
|
||||
['lang-js', /^on\w+\s*=\s*"([^"]+)"/i], ['lang-js', /^on\w+\s*=\s*'([^']+)'/i], ['lang-js', /^on\w+\s*=\s*([^\s"'>]+)/i], ['lang-css', /^style\s*=\s*"([^"]+)"/i], ['lang-css', /^style\s*=\s*'([^']+)'/i], ['lang-css', /^style\s*=\s*([^\s"'>]+)/i]]), ['in.tag']); p(C([], [['atv', /^[\S\s]+/]]), ['uq.val']); p(v({keywords: M, hashComments: !0, cStyleComments: !0, types: R}), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']); p(v({keywords: 'null,true,false'}), ['json']); p(v({keywords: O, hashComments: !0, cStyleComments: !0, verbatimStrings: !0, types: R}),
|
||||
['cs']); p(v({keywords: N, cStyleComments: !0}), ['java']); p(v({keywords: y, hashComments: !0, multiLineStrings: !0}), ['bash', 'bsh', 'csh', 'sh']); p(v({keywords: P, hashComments: !0, multiLineStrings: !0, tripleQuotedStrings: !0}), ['cv', 'py', 'python']); p(v({keywords: 'caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END', hashComments: !0, multiLineStrings: !0, regexLiterals: 2}), ['perl', 'pl', 'pm']); p(v({
|
||||
keywords: Q,
|
||||
hashComments: !0, multiLineStrings: !0, regexLiterals: !0
|
||||
}), ['rb', 'ruby']); p(v({keywords: E, cStyleComments: !0, regexLiterals: !0}), ['javascript', 'js']); p(v({keywords: 'all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes', hashComments: 3, cStyleComments: !0, multilineStrings: !0, tripleQuotedStrings: !0, regexLiterals: !0}), ['coffee']); p(v({keywords: W, cStyleComments: !0, multilineStrings: !0}), ['rc', 'rs', 'rust']);
|
||||
p(C([], [['str', /^[\S\s]+/]]), ['regex']); var Y = D.PR = {
|
||||
createSimpleLexer: C, registerLangHandler: p, sourceDecorator: v, PR_ATTRIB_NAME: 'atn', PR_ATTRIB_VALUE: 'atv', PR_COMMENT: 'com', PR_DECLARATION: 'dec', PR_KEYWORD: 'kwd', PR_LITERAL: 'lit', PR_NOCODE: 'nocode', PR_PLAIN: 'pln', PR_PUNCTUATION: 'pun', PR_SOURCE: 'src', PR_STRING: 'str', PR_TAG: 'tag', PR_TYPE: 'typ', prettyPrintOne: D.prettyPrintOne = function (a, d, g) { var b = document.createElement('div'); b.innerHTML = '<pre>' + a + '</pre>'; b = b.firstChild; g && J(b, g, !0); K({h: d, j: g, c: b, i: 1});
|
||||
return b.innerHTML; }, prettyPrint: D.prettyPrint = function (a, d) { function g() { for (var b = D.PR_SHOULD_USE_CONTINUATION ? c.now() + 250 : Infinity; i < p.length && c.now() < b; i++) { for (var d = p[i], j = h, k = d; k = k.previousSibling;) { var m = k.nodeType, o = (m === 7 || m === 8) && k.nodeValue; if (o ? !/^\??prettify\b/.test(o) : m !== 3 || /\S/.test(k.nodeValue)) break; if (o) { j = {}; o.replace(/\b(\w+)=([\w%+\-.:]+)/g, function (a, b, c) { j[b] = c; }); break; } }k = d.className; if ((j !== h || e.test(k)) && !v.test(k)) { m = !1; for (o = d.parentNode; o; o = o.parentNode) if (f.test(o.tagName) &&
|
||||
o.className && e.test(o.className)) { m = !0; break; } if (!m) { d.className += ' prettyprinted'; m = j.lang; if (!m) { var m = k.match(n), y; if (!m && (y = U(d)) && t.test(y.tagName))m = y.className.match(n); m && (m = m[1]); } if (w.test(d.tagName))o = 1; else var o = d.currentStyle, u = s.defaultView, o = (o = o ? o.whiteSpace : u && u.getComputedStyle ? u.getComputedStyle(d, q).getPropertyValue('white-space') : 0) && 'pre' === o.substring(0, 3); u = j.linenums; if (!(u = u === 'true' || +u))u = (u = k.match(/\blinenums\b(?::(\d+))?/)) ? u[1] && u[1].length ? +u[1] : !0 : !1; u && J(d, u, o); r =
|
||||
{h: m, c: d, j: u, i: o}; K(r); } } }i < p.length ? setTimeout(g, 250) : 'function' === typeof a && a(); } for (var b = d || document.body, s = b.ownerDocument || document, b = [b.getElementsByTagName('pre'), b.getElementsByTagName('code'), b.getElementsByTagName('xmp')], p = [], m = 0; m < b.length; ++m) for (var j = 0, k = b[m].length; j < k; ++j)p.push(b[m][j]); var b = q, c = Date; c.now || (c = {now() { return +new Date; }}); var i = 0, r, n = /\blang(?:uage)?-([\w.]+)(?!\S)/, e = /\bprettyprint\b/, v = /\bprettyprinted\b/, w = /pre|xmp/i, t = /^code$/i, f = /^(?:pre|code|xmp)$/i,
|
||||
h = {}; g(); }
|
||||
}; typeof define === 'function' && define.amd && define('google-code-prettify', [], function () { return Y; }); })(); }();
|
||||
3
demo/src/environments/environment.prod.ts
Normal file
3
demo/src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
8
demo/src/environments/environment.ts
Normal file
8
demo/src/environments/environment.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
BIN
demo/src/favicon.ico
Normal file
BIN
demo/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Angular2 File Upload</title>
|
||||
<title>Angular File Upload</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
@@ -12,10 +12,9 @@
|
||||
<link rel="author" href="https://github.com/valor-software/ng2-file-upload/graphs/contributors">
|
||||
|
||||
<!--link to bootstrap.css-->
|
||||
<link rel="stylesheet" href="assets/css/prism-okaidia.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
|
||||
<link rel="stylesheet" href="assets/css/prettify-angulario.css">
|
||||
<style media="screen">
|
||||
.header {
|
||||
background-color: #0143A3;
|
||||
@@ -33,6 +32,7 @@
|
||||
<app>
|
||||
Loading...
|
||||
</app>
|
||||
|
||||
<script src="assets/js/prettify.min.js"></script>
|
||||
<!-- script files will be inserted by html-webpack-plugin -->
|
||||
</body>
|
||||
</html>
|
||||
12
demo/src/main.ts
Normal file
12
demo/src/main.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import './polyfills.ts';
|
||||
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { environment } from './environments/environment';
|
||||
import { AppModule } from './app/';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
21
demo/src/polyfills.ts
Normal file
21
demo/src/polyfills.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// This file includes polyfills needed by Angular 2 and is loaded before
|
||||
// the app. You can add your own extra polyfills to this file.
|
||||
import 'ts-helpers';
|
||||
import 'core-js/es6/symbol';
|
||||
import 'core-js/es6/object';
|
||||
import 'core-js/es6/function';
|
||||
import 'core-js/es6/parse-int';
|
||||
import 'core-js/es6/parse-float';
|
||||
import 'core-js/es6/number';
|
||||
import 'core-js/es6/math';
|
||||
import 'core-js/es6/string';
|
||||
import 'core-js/es6/date';
|
||||
import 'core-js/es6/array';
|
||||
import 'core-js/es6/regexp';
|
||||
import 'core-js/es6/map';
|
||||
import 'core-js/es6/set';
|
||||
import 'core-js/es6/reflect';
|
||||
|
||||
import 'core-js/es7/reflect';
|
||||
import 'zone.js/dist/zone';
|
||||
import 'classlist-polyfill';
|
||||
22
demo/src/tsconfig.json
Normal file
22
demo/src/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"noEmitHelpers" :true,
|
||||
"lib": ["es6", "dom"],
|
||||
"types": [
|
||||
"jasmine",
|
||||
"webpack"
|
||||
],
|
||||
"mapRoot": "./",
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../temp/out-tsc",
|
||||
"sourceMap": true,
|
||||
"target": "es5",
|
||||
"typeRoots": [
|
||||
"../node_modules/@types"
|
||||
]
|
||||
}
|
||||
}
|
||||
16
demo/src/typings.d.ts
vendored
Normal file
16
demo/src/typings.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Typings reference file, you can add your own global typings here
|
||||
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
|
||||
// tslint:disable
|
||||
declare const System: any;
|
||||
declare const ENV:string;
|
||||
// google code-prettify
|
||||
declare const PR:any;
|
||||
|
||||
declare const require:any;
|
||||
declare const global:any;
|
||||
|
||||
declare module jasmine {
|
||||
interface Matchers {
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// For vendors for example jQuery, Lodash, angular2-jwt just import them here unless you plan on
|
||||
// chunking vendors files for async loading. You would need to import the async loaded vendors
|
||||
// at the entry point of the async loaded file. Also see custom-typings.d.ts as you also need to
|
||||
// run `typings install x` where `x` is your module
|
||||
|
||||
// Angular 2
|
||||
import '@angular/common';
|
||||
import '@angular/core';
|
||||
import '@angular/forms';
|
||||
import '@angular/platform-browser';
|
||||
import '@angular/platform-browser-dynamic';
|
||||
|
||||
// RxJS
|
||||
import 'rxjs/add/operator/map';
|
||||
import 'rxjs/add/operator/mergeMap';
|
||||
|
||||
if ('production' === ENV) {
|
||||
// Production
|
||||
|
||||
} else {
|
||||
// Development
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const tslint = require('gulp-tslint');
|
||||
const gitignore = require('gitignore-to-glob')();
|
||||
|
||||
gitignore.push('**/*.ts');
|
||||
|
||||
gulp.task('tslint', () =>
|
||||
gulp
|
||||
.src(gitignore)
|
||||
.pipe(tslint({
|
||||
formatter: 'verbose',
|
||||
emitError: true,
|
||||
summarizeFailureOutput: true,
|
||||
reportLimit: 50
|
||||
}))
|
||||
.pipe(tslint.report())
|
||||
);
|
||||
|
||||
gulp.task('lint', ['tslint']);
|
||||
@@ -1,9 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
|
||||
require('require-dir')('./gulp-tasks');
|
||||
|
||||
gulp.task('default', () => {
|
||||
gulp.start('lint');
|
||||
});
|
||||
@@ -1,5 +1,85 @@
|
||||
'use strict';
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/0.13/config/configuration-file.html
|
||||
|
||||
const config = require('./.ng2-config');
|
||||
const customLaunchers = require('./scripts/sauce-browsers').customLaunchers;
|
||||
|
||||
module.exports = require('ng2-webpack-config').karma(config);
|
||||
module.exports = function (config) {
|
||||
const configuration = {
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', 'angular-cli'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-remap-istanbul'),
|
||||
require('angular-cli/plugins/karma')
|
||||
],
|
||||
files: [
|
||||
{pattern: './scripts/test.ts', watched: false}
|
||||
],
|
||||
preprocessors: {
|
||||
'./scripts/test.ts': ['angular-cli']
|
||||
},
|
||||
remapIstanbulReporter: {
|
||||
reports: {
|
||||
html: 'coverage',
|
||||
lcovonly: './coverage/coverage.lcov'
|
||||
}
|
||||
},
|
||||
angularCli: {
|
||||
config: './angular-cli.json',
|
||||
environment: 'dev'
|
||||
},
|
||||
reporters: config.angularCli && config.angularCli.codeCoverage
|
||||
? ['dots', 'karma-remap-istanbul']
|
||||
: ['dots'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
customLaunchers: {
|
||||
Chrome_travis_ci: {
|
||||
base: 'Chrome',
|
||||
flags: ['--no-sandbox']
|
||||
}
|
||||
},
|
||||
mime: { 'text/x-typescript': ['ts','tsx'] },
|
||||
client: { captureConsole: true }
|
||||
};
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
configuration.browsers = ['Chrome_travis_ci'];
|
||||
}
|
||||
|
||||
if (process.env.SAUCE) {
|
||||
if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
|
||||
console.log('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
configuration.plugins.push(require('karma-sauce-launcher'));
|
||||
configuration.reporters.push('saucelabs');
|
||||
configuration.sauceLabs = {
|
||||
verbose: true,
|
||||
testName: 'ng2-bootstrap unit tests',
|
||||
recordScreenshots: false,
|
||||
username: process.env.SAUCE_USERNAME,
|
||||
accessKey: process.env.SAUCE_ACCESS_KEY,
|
||||
connectOptions: {
|
||||
port: 5757,
|
||||
logfile: 'sauce_connect.log'
|
||||
},
|
||||
public: 'public'
|
||||
};
|
||||
configuration.captureTimeout = 0;
|
||||
configuration.customLaunchers = customLaunchers();
|
||||
configuration.browsers = Object.keys(configuration.customLaunchers);
|
||||
configuration.concurrency = 3;
|
||||
configuration.browserDisconnectTolerance = 2;
|
||||
configuration.browserNoActivityTimeout = 20000;
|
||||
configuration.browserDisconnectTimeout = 5000;
|
||||
}
|
||||
|
||||
config.set(configuration);
|
||||
};
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export * from './components/file-upload/file-select.directive';
|
||||
export * from './components/file-upload/file-drop.directive';
|
||||
export * from './components/file-upload/file-uploader.class';
|
||||
export * from './components/file-upload/file-item.class';
|
||||
|
||||
export { FileUploadModule } from './components/file-upload/file-upload.module';
|
||||
147
package.json
147
package.json
@@ -1,35 +1,30 @@
|
||||
{
|
||||
"name": "ng2-file-upload",
|
||||
"name": "ng2-file-upload-base",
|
||||
"version": "1.1.3-0",
|
||||
"description": "angular2 file upload directives",
|
||||
"private": true,
|
||||
"description": "Angular file upload directives",
|
||||
"scripts": {
|
||||
"flow.compile": "npm run flow.compile:common && npm run flow.compile:system",
|
||||
"flow.compile:common": "./node_modules/.bin/ngc -p tsconfig.publish.json",
|
||||
"flow.compile:system": "./.config/bundle-system.js",
|
||||
"flow.copy:src": "./node_modules/.bin/cpy ng2-file-upload.ts \"components/*.ts\" ts --parents",
|
||||
"flow.clean": "./node_modules/.bin/del bundles coverage demo-build \"components/**/*.+(js|d.ts|js.map)\" dist \"ng2-file-upload.+(js|d.ts|js.map)\"",
|
||||
"flow.deploy:gh-pages": "npm run flow.build:prod && ./node_modules/.bin/gh-pages -d demo-build",
|
||||
"flow.eslint": "./node_modules/.bin/eslint --ignore-path .gitignore --ext js --fix . .config",
|
||||
"flow.tslint": "./node_modules/.bin/gulp lint",
|
||||
"flow.lint": "npm run flow.eslint && npm run flow.tslint",
|
||||
"flow.changelog": "./node_modules/.bin/conventional-changelog -i CHANGELOG.md -s -p angular -v",
|
||||
"flow.github-release": "./node_modules/.bin/conventional-github-releaser -p angular",
|
||||
"flow.build:prod": "NODE_ENV=production ./node_modules/.bin/webpack --progress --color --display-error-details --display-cached",
|
||||
"flow.build:dev": "./node_modules/.bin/webpack --progress --color",
|
||||
"flow.serve:dev": "./node_modules/.bin/webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
|
||||
"flow.serve:prod": "NODE_ENV=production ./node_modules/.bin/webpack-dev-server --hot --inline --colors --display-error-details --display-cached",
|
||||
"prepublish": "npm run flow.clean && npm run flow.compile",
|
||||
"postpublish": "npm run flow.deploy:gh-pages",
|
||||
"start": "npm run flow.serve:dev",
|
||||
"pretest": "npm run flow.lint",
|
||||
"test": "NODE_ENV=test ./node_modules/.bin/karma start",
|
||||
"test:watch": "NODE_ENV=test ./node_modules/.bin/karma start --auto-watch --no-single-run",
|
||||
"preversion": "npm test",
|
||||
"version": "npm run flow.changelog && git add -A",
|
||||
"postversion": "git push origin development && git push --tags"
|
||||
"lite-server": "lite-server -c demo/bs-config.json",
|
||||
"demo.serve": "run-s build link demo.build lite-server",
|
||||
"demo.gh-pages": "run-s build demo.build demo.deploy",
|
||||
"demo.build": "ng build -prod --aot",
|
||||
"demo.deploy": "gh-pages -d demo/dist",
|
||||
"link": "ngm link -p src --here",
|
||||
"lint": "exit 0",
|
||||
"disable-lint": "tslint \"**/*.ts\" -c tslint.json --fix --type-check -t prose -e \"node_modules/**\" -e \"dist/**\" -e \"temp/**\" -e \"scripts/docs/**\"",
|
||||
"flow.changelog": "conventional-changelog -i CHANGELOG.md -s -p angular",
|
||||
"flow.github-release": "conventional-github-releaser -p angular",
|
||||
"build": "ngm build -p src --clean",
|
||||
"build.watch": "ngm build -p src --watch --skip-bundles",
|
||||
"start": "ng serve --aot",
|
||||
"pretest": "run-s lint build link",
|
||||
"test": "ng test -sr",
|
||||
"test-coverage": "ng test -sr -cc",
|
||||
"version": "npm run flow.changelog && git add -A"
|
||||
},
|
||||
"main": "ng2-file-upload.js",
|
||||
"typings": "ng2-file-upload.d.ts",
|
||||
"main": "bundles/ng2-file-upload.umd.js",
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"keywords": [
|
||||
"angular2",
|
||||
"bootstrap",
|
||||
@@ -50,53 +45,75 @@
|
||||
"homepage": "https://github.com/valor-software/ng2-file-upload#readme",
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^2.0.0",
|
||||
"@angular/compiler": "^2.0.0",
|
||||
"@angular/core": "^2.0.0",
|
||||
"@angular/forms": "^2.0.0"
|
||||
"@angular/common": "^2.3.0",
|
||||
"@angular/core": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/common": "2.1.0",
|
||||
"@angular/compiler": "^2.1.0",
|
||||
"@angular/compiler-cli": "2.1.0",
|
||||
"@angular/core": "2.1.0",
|
||||
"@angular/forms": "2.1.0",
|
||||
"@angular/platform-browser": "2.1.0",
|
||||
"@angular/platform-browser-dynamic": "2.1.0",
|
||||
"@angular/platform-server": "2.1.0",
|
||||
"@types/jasmine": "2.5.35",
|
||||
"@types/node": "6.0.45",
|
||||
"@types/webpack": "1.12.35",
|
||||
"async": "2.1.2",
|
||||
"@angular/common": "2.4.3",
|
||||
"@angular/compiler": "2.4.3",
|
||||
"@angular/compiler-cli": "2.4.3",
|
||||
"@angular/core": "2.4.3",
|
||||
"@angular/forms": "2.4.3",
|
||||
"@angular/http": "2.4.3",
|
||||
"@angular/language-service": "2.4.3",
|
||||
"@angular/platform-browser": "2.4.3",
|
||||
"@angular/platform-browser-dynamic": "2.4.3",
|
||||
"@angular/router": "3.4.3",
|
||||
"@angular/tsc-wrapped": "0.5.1",
|
||||
"@ngtools/webpack": "1.2.3",
|
||||
"@types/jasmine": "2.5.40",
|
||||
"@types/marked": "0.0.28",
|
||||
"@types/node": "7.0.0",
|
||||
"@types/webpack": "^2.2.1",
|
||||
"angular-cli": "1.0.0-beta.25.5",
|
||||
"bootstrap": "3.3.7",
|
||||
"chokidar-cli": "1.2.0",
|
||||
"classlist-polyfill": "1.0.3",
|
||||
"codecov": "1.0.1",
|
||||
"codelyzer": "~2.0.0-beta.4",
|
||||
"conventional-changelog-cli": "1.2.0",
|
||||
"conventional-github-releaser": "1.1.3",
|
||||
"core-js": "^2.4.1",
|
||||
"cpy": "5.0.0",
|
||||
"cpy-cli": "1.0.1",
|
||||
"del-cli": "0.2.0",
|
||||
"es6-promise": "4.0.5",
|
||||
"es6-shim": "0.35.1",
|
||||
"es7-reflect-metadata": "1.6.0",
|
||||
"eslint-config-valorsoft": "0.1.0",
|
||||
"gh-pages": "0.11.0",
|
||||
"gitignore-to-glob": "0.2.1",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-size": "2.1.0",
|
||||
"gulp-tslint": "6.1.2",
|
||||
"del-cli": "0.2.1",
|
||||
"gh-pages": "0.12.0",
|
||||
"gitignore-to-glob": "0.3.0",
|
||||
"google-code-prettify": "1.0.5",
|
||||
"html-loader": "0.4.4",
|
||||
"jasmine": "2.5.3",
|
||||
"jasmine-core": "2.5.2",
|
||||
"jasmine-data-provider": "2.2.0",
|
||||
"jasmine-spec-reporter": "3.2.0",
|
||||
"karma": "1.4.0",
|
||||
"karma-chrome-launcher": "^2.0.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-remap-istanbul": "0.4.0",
|
||||
"karma-sauce-launcher": "1.1.0",
|
||||
"lite-server": "2.2.2",
|
||||
"lodash": "4.17.4",
|
||||
"markdown-loader": "^0.1.7",
|
||||
"marked": "0.3.6",
|
||||
"ng2-bootstrap": "1.1.14",
|
||||
"ng2-webpack-config": "0.0.5",
|
||||
"pre-commit": "1.1.3",
|
||||
"prismjs": "1.5.1",
|
||||
"prismjs-loader": "0.0.4",
|
||||
"reflect-metadata": "0.1.8",
|
||||
"ng2-bootstrap": "1.2.2",
|
||||
"ng2-page-scroll": "4.0.0-beta.2",
|
||||
"ngm-cli": "0.4.0",
|
||||
"npm-run-all": "^4.0.1",
|
||||
"pre-commit": "1.2.2",
|
||||
"protractor": "5.0.0",
|
||||
"reflect-metadata": "0.1.9",
|
||||
"require-dir": "0.3.1",
|
||||
"rxjs": "5.0.0-beta.12",
|
||||
"systemjs-builder": "0.15.32",
|
||||
"tslint-config-valorsoft": "1.1.1",
|
||||
"typescript": "2.0.3",
|
||||
"zone.js": "0.6.26"
|
||||
"rxjs": "5.0.3",
|
||||
"systemjs-builder": "0.15.34",
|
||||
"ts-helpers": "^1.1.1",
|
||||
"ts-node": "2.0.0",
|
||||
"tslint": "4.3.1",
|
||||
"tslint-config-valorsoft": "1.2.0",
|
||||
"typedoc": "0.5.5",
|
||||
"typescript": "2.1.5",
|
||||
"wallaby-webpack": "0.0.30",
|
||||
"webdriver-manager": "11.1.1",
|
||||
"zone.js": "0.7.5"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const config = require('./.ng2-config');
|
||||
|
||||
module.exports.config = require('ng2-webpack-config').protractor(config);
|
||||
1
scripts/.gitignore
vendored
Normal file
1
scripts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!**/*.js
|
||||
21
scripts/matchers.ts
Normal file
21
scripts/matchers.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// tslint:disable
|
||||
/**
|
||||
* @copyright Angular ng-bootstrap team
|
||||
*/
|
||||
beforeEach(() => {
|
||||
jasmine.addMatchers({
|
||||
toHaveCssClass(/*util, customEqualityTests*/) {
|
||||
return {compare: buildError(false), negativeCompare: buildError(true)};
|
||||
|
||||
function buildError(isNot) {
|
||||
return function (actual, className) {
|
||||
const orNot = isNot ? 'not ' : '';
|
||||
return {
|
||||
pass: actual.classList.contains(className) === !isNot,
|
||||
message: `Expected ${actual.outerHTML} ${orNot} to contain the CSS class "${className}"`
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
18
scripts/sauce-browsers.js
Normal file
18
scripts/sauce-browsers.js
Normal file
@@ -0,0 +1,18 @@
|
||||
module.exports.customLaunchers = function customLaunchers() {
|
||||
return {
|
||||
sl_chrome: {base: 'SauceLabs', browserName: 'chrome'},
|
||||
sl_chrome_1: {base: 'SauceLabs', browserName: 'chrome', version: 'latest-1'},
|
||||
sl_firefox: {base: 'SauceLabs', browserName: 'firefox'},
|
||||
sl_firefox_1: {base: 'SauceLabs', browserName: 'firefox', version: 'latest-1'},
|
||||
sl_ie9: {base: 'SauceLabs', browserName: 'internet explorer', platform: 'Windows 2008', version: '9'},
|
||||
'SL_IE10': {base: 'SauceLabs', browserName: 'internet explorer', platform: 'Windows 2012', version: '10'},
|
||||
'SL_IE11': {base: 'SauceLabs', browserName: 'internet explorer', platform: 'Windows 8.1', version: '11'},
|
||||
'SL_EDGE': {base: 'SauceLabs', browserName: 'MicrosoftEdge', platform: 'Windows 10', version: '13.10586'},
|
||||
'SL_IOS9': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '9.3'},
|
||||
'SL_IOS10': {base: 'SauceLabs', browserName: 'iphone', platform: 'OS X 10.10', version: '10.0'},
|
||||
'SL_ANDROID4.4': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '4.4'},
|
||||
'SL_ANDROID5': {base: 'SauceLabs', browserName: 'android', platform: 'Linux', version: '5.1'},
|
||||
'SL_SAFARI9': {base: 'SauceLabs', browserName: 'safari', platform: 'OS X 10.11', version: '9.0'}
|
||||
};
|
||||
};
|
||||
|
||||
37
scripts/test.ts
Normal file
37
scripts/test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import '../demo/src/polyfills.ts';
|
||||
|
||||
import 'zone.js/dist/long-stack-trace-zone';
|
||||
import 'zone.js/dist/proxy.js';
|
||||
import 'zone.js/dist/sync-test';
|
||||
import 'zone.js/dist/jasmine-patch';
|
||||
import 'zone.js/dist/async-test';
|
||||
import 'zone.js/dist/fake-async-test';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
import './matchers';
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
declare var __karma__: any;
|
||||
declare var require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
__karma__.loaded = Function.prototype;
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
let context = require.context('../demo/src', true, /\.spec\.ts/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
|
||||
let context2 = require.context('../src/spec', true, /\.spec\.ts/);
|
||||
context2.keys().map(context2);
|
||||
// Finally, start Karma to run the tests.
|
||||
__karma__.start();
|
||||
17
scripts/typings.d.ts
vendored
Normal file
17
scripts/typings.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Typings reference file, you can add your own global typings here
|
||||
// https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html
|
||||
|
||||
// tslint:disable
|
||||
|
||||
declare const System: any;
|
||||
declare const ENV:string;
|
||||
// google code-prettify
|
||||
declare const PR:any;
|
||||
|
||||
declare const global:any;
|
||||
|
||||
declare module jasmine {
|
||||
interface Matchers {
|
||||
toHaveCssClass(expected: any): boolean;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/* eslint no-var: 0, vars-on-top: 0 */
|
||||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
|
||||
/*
|
||||
* When testing with webpack and ES6, we have to do some extra
|
||||
* things to get testing to work right. Because we are gonna write tests
|
||||
* in ES6 too, we have to compile those as well. That's handled in
|
||||
* karma.conf.js with the karma-webpack plugin. This is the entry
|
||||
* file for webpack test. Just like webpack will create a bundle.js
|
||||
* file for our client, when we run test, it will compile and bundle them
|
||||
* all here! Crazy huh. So we need to do some setup
|
||||
*/
|
||||
'use strict';
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
require('core-js');
|
||||
|
||||
// Typescript emit helpers polyfill
|
||||
require('ts-helpers');
|
||||
|
||||
require('zone.js/dist/zone');
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
require('zone.js/dist/async-test');
|
||||
require('zone.js/dist/fake-async-test');
|
||||
require('zone.js/dist/sync-test');
|
||||
require('zone.js/dist/proxy');
|
||||
require('zone.js/dist/jasmine-patch');
|
||||
|
||||
// RxJS
|
||||
require('rxjs/Rx');
|
||||
|
||||
var testing = require('@angular/core/testing');
|
||||
var browser = require('@angular/platform-browser-dynamic/testing');
|
||||
|
||||
testing.TestBed.initTestEnvironment(
|
||||
browser.BrowserDynamicTestingModule,
|
||||
browser.platformBrowserDynamicTesting()
|
||||
);
|
||||
|
||||
Object.assign(global, testing);
|
||||
|
||||
/*
|
||||
* Ok, this is kinda crazy. We can use the the context method on
|
||||
* require that webpack created in order to tell webpack
|
||||
* what files we actually want to require or import.
|
||||
* Below, context will be an function/object with file names as keys.
|
||||
* using that regex we are saying look in ./src/app and ./test then find
|
||||
* any file that ends with spec.js and get its path. By passing in true
|
||||
* we say do this recursively
|
||||
*/
|
||||
var testContext = require.context('./components', true, /\.spec\.ts/);
|
||||
|
||||
/*
|
||||
* get all the files, for each file, call the context function
|
||||
* that will require the file and load it up here. Context will
|
||||
* loop and require those spec files here
|
||||
*/
|
||||
function requireAll(requireContext) {
|
||||
return requireContext.keys().map(requireContext);
|
||||
}
|
||||
|
||||
// requires and returns all modules that match
|
||||
requireAll(testContext);
|
||||
6
src/index.ts
Normal file
6
src/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './file-upload/file-select.directive';
|
||||
export * from './file-upload/file-drop.directive';
|
||||
export * from './file-upload/file-uploader.class';
|
||||
export * from './file-upload/file-item.class';
|
||||
|
||||
export { FileUploadModule } from './file-upload/file-upload.module';
|
||||
1
src/ng2-file-upload.ts
Normal file
1
src/ng2-file-upload.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './index';
|
||||
8
src/package.json
Normal file
8
src/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "ng2-file-upload",
|
||||
"version": "1.1.0",
|
||||
"peerDependencies": {
|
||||
"@angular/common": "*",
|
||||
"@angular/core": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { inject, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FileUploader } from './file-uploader.class';
|
||||
import { FileUploadModule } from './file-upload.module';
|
||||
import { FileUploader } from '../file-upload/file-uploader.class';
|
||||
import { FileUploadModule } from '../file-upload/file-upload.module';
|
||||
|
||||
@Component({
|
||||
selector: 'container',
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "../dist",
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
@@ -11,23 +12,26 @@
|
||||
"declaration": true,
|
||||
"skipLibCheck": true,
|
||||
"stripInternal": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"lib": ["dom", "es6"],
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node",
|
||||
"webpack"
|
||||
],
|
||||
"typeRoots": [
|
||||
"../node_modules/@types"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"bundles",
|
||||
"dist"
|
||||
"node_modules"
|
||||
],
|
||||
"files": [
|
||||
"./demo/custom-typings.d.ts",
|
||||
"./ng2-file-upload.ts"
|
||||
]
|
||||
"../scripts/typings.d.ts",
|
||||
"./ng2-file-upload.ts",
|
||||
"./index.ts"
|
||||
],
|
||||
"angularCompilerOptions": {
|
||||
"genDir": "../temp/factories"
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"sourceMap": false,
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"listFiles": false,
|
||||
"noLib": false,
|
||||
"noImplicitAny": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"skipLibCheck": true,
|
||||
"stripInternal": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node",
|
||||
"webpack"
|
||||
]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"bundles",
|
||||
"dist"
|
||||
],
|
||||
"files": [
|
||||
"./ng2-file-upload.ts",
|
||||
"./demo/custom-typings.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -2,7 +2,11 @@
|
||||
"extends": "tslint-config-valorsoft",
|
||||
"rulesDirectory": "./node_modules/codelyzer",
|
||||
"rules": {
|
||||
"component-selector-name": [false, ""],
|
||||
"only-arrow-functions": false
|
||||
"no-forward-ref": false,
|
||||
"no-null-keyword": false,
|
||||
"only-arrow-functions": false,
|
||||
"no-access-missing-member": false,
|
||||
"directive-selector": false,
|
||||
"component-selector": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* eslint no-process-env: 0, global-require:0 */
|
||||
/**
|
||||
* @author: @AngularClass
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const reqPrism = require('prismjs');
|
||||
const marked = require('marked');
|
||||
|
||||
marked.Renderer.prototype.code = function renderCode(code, lang) {
|
||||
const out = this.options.highlight(code, lang);
|
||||
const classMap = this.options.langPrefix + lang;
|
||||
|
||||
if (!lang) {
|
||||
return `<pre><code>${out}\n</code></pre>`;
|
||||
}
|
||||
return `<pre class="${classMap}"><code class="${classMap}">${out}\n</code></pre>\n`;
|
||||
};
|
||||
|
||||
// Look in ./config folder for webpack.dev.js
|
||||
const conf = getWebpackConfig(process.env.NODE_ENV, require('./.ng2-config'));
|
||||
|
||||
conf.markdownLoader = {
|
||||
langPrefix: 'language-',
|
||||
highlight(code, lang) {
|
||||
const language = !lang || lang === 'html' ? 'markup' : lang;
|
||||
const Prism = global.Prism || reqPrism;
|
||||
|
||||
if (!Prism.languages[language]) {
|
||||
require(`prismjs/components/prism-${language}.js`);
|
||||
}
|
||||
return Prism.highlight(code, Prism.languages[language]);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = conf;
|
||||
|
||||
function getWebpackConfig(env, config) {
|
||||
switch (env) {
|
||||
case 'prod':
|
||||
case 'production':
|
||||
return require('ng2-webpack-config').webpack.prod(config);
|
||||
case 'test':
|
||||
case 'testing':
|
||||
return require('ng2-webpack-config').webpack.test(config);
|
||||
case 'dev':
|
||||
case 'development':
|
||||
default:
|
||||
return require('ng2-webpack-config').webpack.dev(config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user