Skip to content

Commit

Permalink
Merge pull request #41 from duffbuster/enhancement/angular-7-upgrade
Browse files Browse the repository at this point in the history
Enhancement/angular 7 upgrade
  • Loading branch information
nbfontana authored May 13, 2019
2 parents e43a3be + b65ff3b commit 48cccb4
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 79 deletions.
27 changes: 13 additions & 14 deletions demo/demo.component.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
import {Component} from '@angular/core';
import {FormBuilder, FormGroup} from "@angular/forms";
import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';

@Component({
selector: 'demo-app',
template: `
<form class="container" [formGroup]="form">
<div class="row">
<div class="col-md-3 col-sm-5 form-group">
<label>Example</label>
<input class="form-control"
maxlength="20"
currencyMask formControlName="value"
[(ngModel)]="value"
[placeholder]="'R$ 0,00'"
[options]="ngxCurrencyOptions"/>
<input
class="form-control"
maxlength="20"
currencyMask
formControlName="value"
[placeholder]="'R$ 0,00'"
[options]="ngxCurrencyOptions"
/>
</div>
</div>
<div class="row col-md-4 col-sm-6 form-group">
<pre style="width: 100%">{{ form.value | json }}</pre>
</div>
</form>`
</form>
`
})
export class DemoComponent {

public form: FormGroup;
public value: number;
public ngxCurrencyOptions = {
prefix: 'R$ ',
thousands: '.',
Expand Down
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./src/currency-mask.directive";
export * from "./src/currency-mask.module";
export * from './src/currency-mask.directive';
export * from './src/currency-mask.module';
export { CurrencyMaskConfig } from './src/currency-mask.config';
112 changes: 59 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "concurrently --raw \"webpack-dev-server --open\" \"npm run test:watch\"",
"demo": "npm start",
"build:demo": "webpack -p",
"build:umd": "webpack --config webpack.config.umd.ts",
"build:umd": "webpack --mode=production --config webpack.config.umd.ts",
"build:ngc": "ngc -p tsconfig-ngc.json",
"build:dist": "npm run build:umd && npm run build:ngc",
"build:clean": "del-cli dist",
Expand All @@ -24,7 +24,6 @@
"release:git": "git add package.json && git commit -m \"chore: bump version number\" && standard-version --first-release && git push --follow-tags origin master",
"release:npm": "npm run build:dist && npm run copyfiles && npm publish dist",
"postrelease": "npm run build:clean && npm run gh-pages",
"commitmsg": "validate-commit-msg",
"codecov": "cat coverage/lcov.info | codecov"
},
"repository": {
Expand All @@ -49,64 +48,71 @@
},
"homepage": "https://github.com/nbfontana/ngx-currency#readme",
"devDependencies": {
"@angular/common": "4.3.2",
"@angular/compiler": "4.3.2",
"@angular/compiler-cli": "4.3.2",
"@angular/core": "4.3.2",
"@angular/forms": "4.3.2",
"@angular/language-service": "4.3.2",
"@angular/platform-browser": "4.3.2",
"@angular/platform-browser-dynamic": "4.3.2",
"@angular/common": "7.2.15",
"@angular/compiler": "7.2.15",
"@angular/compiler-cli": "7.2.15",
"@angular/core": "7.2.15",
"@angular/forms": "7.2.15",
"@angular/language-service": "7.2.15",
"@angular/platform-browser": "7.2.15",
"@angular/platform-browser-dynamic": "7.2.15",
"@compodoc/compodoc": "1.0.0-beta.3",
"@types/chai": "4.0.0",
"@types/html-webpack-plugin": "2.11.2",
"@types/mocha": "2.2.41",
"@types/node": "^7.0.0",
"@types/sinon": "2.1.2",
"@types/sinon-chai": "2.7.26",
"@types/webpack": "2.2.8",
"chai": "^4.0.0",
"codecov": "2.1.0",
"codelyzer": "3.0.0",
"commitizen": "2.8.1",
"concurrently": "3.0.0",
"copyfiles": "1.2.0",
"core-js": "2.4.1",
"cz-conventional-changelog": "2.0.0",
"del-cli": "1.0.0",
"fork-ts-checker-webpack-plugin": "0.2.2",
"html-webpack-plugin": "2.28.0",
"husky": "0.13.0",
"istanbul-instrumenter-loader": "2.0.0",
"karma": "^1.4.1",
"karma-chrome-launcher": "2.1.1",
"karma-coverage": "^1.1.1",
"karma-coverage-istanbul-reporter": "1.0.0",
"@types/chai": "4.1.7",
"@types/html-webpack-plugin": "3.2.0",
"@types/mocha": "5.2.6",
"@types/node": "12.0.0",
"@types/sinon": "7.0.11",
"@types/sinon-chai": "3.2.2",
"@types/webpack": "4.4.31",
"chai": "4.2.0",
"codecov": "3.4.0",
"codelyzer": "4.5.0",
"commitizen": "3.1.1",
"concurrently": "4.1.0",
"copyfiles": "2.1.0",
"core-js": "2.5.4",
"cz-conventional-changelog": "2.1.0",
"del-cli": "1.1.0",
"fork-ts-checker-webpack-plugin": "1.3.1",
"html-webpack-plugin": "3.2.0",
"husky": "2.2.0",
"istanbul-instrumenter-loader": "3.0.1",
"karma": "4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-coverage-istanbul-reporter": "2.0.5",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.3",
"karma-mocha-reporter": "2.2.5",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.1",
"mocha": "3.3.0",
"nyc": "^11.0.3",
"rxjs": "5.0.1",
"sinon": "^6.2.0",
"sinon-chai": "2.8.0",
"standard-version": "4.0.0",
"ts-loader": "2.1.0",
"ts-node": "3.0.0",
"tslint": "5.1.0",
"tslint-loader": "3.5.3",
"typescript": "2.3.3",
"validate-commit-msg": "2.8.0",
"webpack": "2.2.0",
"webpack-angular-externals": "1.0.0",
"webpack-dev-server": "2.2.0",
"webpack-rxjs-externals": "1.0.0",
"zone.js": "0.8.4"
"karma-webpack": "^4.0.0-rc.6",
"mocha": "6.1.4",
"nyc": "14.1.0",
"rxjs": "6.5.1",
"rxjs-compat": "6.5.1",
"sinon": "7.3.2",
"sinon-chai": "3.3.0",
"standard-version": "6.0.1",
"ts-loader": "6.0.0",
"ts-node": "7.0.1",
"tslint": "5.12.1",
"tslint-loader": "3.5.4",
"typescript": "3.2.4",
"validate-commit-msg": "2.14.0",
"webpack": "4.31.0",
"webpack-angular-externals": "1.0.2",
"webpack-cli": "3.3.2",
"webpack-dev-server": "3.3.1",
"webpack-rxjs-externals": "2.0.0",
"zone.js": "0.8.29"
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"commit-msg": "validate-commit-msg"
}
}
}
2 changes: 1 addition & 1 deletion src/currency-mask.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CURRENCYMASKDIRECTIVE_VALUE_ACCESSOR: any = {
})
export class CurrencyMaskDirective implements AfterViewInit, ControlValueAccessor, DoCheck, OnInit {

@Input() options: any = {};
@Input() options: Partial<CurrencyMaskConfig> = {};

public inputHandler: InputHandler;
public keyValueDiffer: KeyValueDiffer<any, any>;
Expand Down
9 changes: 4 additions & 5 deletions test/currency-mask-config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { InputService } from './../src/input.service';
import { fakeAsync } from "@angular/core/testing";
import { expect } from "chai";

describe('Testing CurrencyMaskConfig', () => {
Expand All @@ -18,17 +17,17 @@ describe('Testing CurrencyMaskConfig', () => {
inputService = new InputService(null, options);
})

it('should return null because the nullable parameterization is true', fakeAsync(() => {
it('should return null because the nullable parameterization is true', () => {
var option: any = { nullable: true }
inputService.updateOptions(option);
inputService.value = null;
expect(null).to.equals(inputService.clearMask(""));
}));
});

it('should return zero because the nullable parameterization is false', fakeAsync(() => {
it('should return zero because the nullable parameterization is false', () => {
var option: any = { nullable: false }
inputService.updateOptions(option);
inputService.value = null;
expect(0).to.equals(inputService.clearMask(""));
}));
});
});
7 changes: 3 additions & 4 deletions webpack.config.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ export default {
resolve: {
extensions: ['.ts', '.js']
},
optimization: {
minimize: true
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
sourceMap: true
}),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
path.join(__dirname, 'src')
Expand Down

0 comments on commit 48cccb4

Please sign in to comment.