Skip to content

Commit

Permalink
Update examples and component READMEs (text-mask#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
msafi authored Aug 7, 2016
1 parent fcb0a00 commit b49a166
Show file tree
Hide file tree
Showing 15 changed files with 283 additions and 94 deletions.
10 changes: 3 additions & 7 deletions angular2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@ npm i angular2-text-mask --save
Then, require it and use it:

```typescript
import 'es6-shim';
import 'es6-promise';
import 'zone.js/dist/zone';
import 'reflect-metadata';

import {bootstrap} from '@angular/platform-browser-dynamic'
import {Component} from '@angular/core';
import MaskedInput from 'angular2-text-mask'

@Component({
selector: 'app',
templateUrl: `
<input [textMask]="{mask: '(111) 111 1111'}" [(ngModel)]="myModel" type="text"/>
<input [textMask]="{mask: mask}" [(ngModel)]="myModel" type="text"/>
`,
directives: [MaskedInput]
})
export class AppComponent {
private myModel = ''
public myModel = ''
public mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
}

bootstrap(AppComponent);
Expand Down
2 changes: 1 addition & 1 deletion angular2/example/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
id="1"
name="phone"
[(ngModel)]="myModel"
[textMask]="{mask: '(111) 111-1111'}"
[textMask]="{mask: mask}"
type="text"
class="form-control"
/>
Expand Down
6 changes: 3 additions & 3 deletions angular2/example/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'es6-shim'
import 'es6-promise'
import 'core-js/es7/reflect'
import 'zone.js/dist/zone'
import 'reflect-metadata'

import {Component} from '@angular/core'
import {disableDeprecatedForms, provideForms} from '@angular/forms'
Expand All @@ -15,8 +13,10 @@ import MaskedInput from '../src/angular2TextMask'
})
class AppComponent {
public myModel
public mask

constructor() {
this.mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
this.myModel = ''
}
}
Expand Down
4 changes: 3 additions & 1 deletion angular2/example/webpack.runAngular2Example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ var path = require('path')

module.exports = {
entry: relative('./app.ts'),

output: {
path: __dirname,
filename: 'bundle.js'
},

resolve: {
extensions: ['', '.js', '.ts']
},
Expand All @@ -14,7 +16,7 @@ module.exports = {
{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
query: {tsconfig: './angular2/tsconfig.json'}
query: {tsconfig: relative('../tsconfig.json')}
},

{test: /\.js/, loaders: ['babel-loader']}
Expand Down
6 changes: 3 additions & 3 deletions angular2/typings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446",
"node": "registry:dt/node#4.0.0+20160509154515"
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160621231320"
}
}
17 changes: 14 additions & 3 deletions angular2/typings/globals/core-js/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/core-js/core-js.d.ts
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/95e782233e8e203a0b9283c3a7031faee428a530/core-js/core-js.d.ts
declare type PropertyKey = string | number | symbol;

// #############################################################################################
Expand Down Expand Up @@ -772,8 +772,17 @@ interface PromiseConstructor {
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;

all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;

/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
Expand Down Expand Up @@ -1248,6 +1257,8 @@ interface String {
declare function delay(msec: number): Promise<void>;

declare namespace core {
var version: string;

namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
Expand Down
6 changes: 3 additions & 3 deletions angular2/typings/globals/core-js/typings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/core-js/core-js.d.ts",
"raw": "registry:dt/core-js#0.0.0+20160317120654",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/core-js/core-js.d.ts"
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/95e782233e8e203a0b9283c3a7031faee428a530/core-js/core-js.d.ts",
"raw": "registry:dt/core-js#0.0.0+20160602141332",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/95e782233e8e203a0b9283c3a7031faee428a530/core-js/core-js.d.ts"
}
}
5 changes: 3 additions & 2 deletions angular2/typings/globals/jasmine/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts
declare function describe(description: string, specDefinitions: () => void): void;
declare function fdescribe(description: string, specDefinitions: () => void): void;
declare function xdescribe(description: string, specDefinitions: () => void): void;
Expand Down Expand Up @@ -173,6 +173,7 @@ declare namespace jasmine {
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
addMatchers(matchers: CustomMatcherFactories): void;
specFilter(spec: Spec): boolean;
throwOnExpectationFailure(value: boolean): void;
}

interface FakeTimer {
Expand Down Expand Up @@ -295,7 +296,7 @@ declare namespace jasmine {
toContain(expected: any, expectationFailOutput?: any): boolean;
toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: number, precision?: any, expectationFailOutput?: any): boolean;
toThrow(expected?: any): boolean;
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
Expand Down
6 changes: 3 additions & 3 deletions angular2/typings/globals/jasmine/typings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts",
"raw": "registry:dt/jasmine#2.2.0+20160505161446",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/36a1be34dbe202c665b3ddafd50824f78c09eea3/jasmine/jasmine.d.ts"
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts",
"raw": "registry:dt/jasmine#2.2.0+20160621224255",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/c49913aa9ea419ea46c1c684e488cf2a10303b1a/jasmine/jasmine.d.ts"
}
}
Loading

0 comments on commit b49a166

Please sign in to comment.