Skip to content

Commit

Permalink
release v1.6.0; add the mask directive
Browse files Browse the repository at this point in the history
  • Loading branch information
changhuixu committed Apr 21, 2020
1 parent 0d8623e commit 1e8a569
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Angular DigitOnly Directive
# Angular DigitOnly Directive and Mask Directive

## `digitOnly` directive

An Angular directive only allows [0-9] in the input box when typing, pasting or drag/dropping. This directive handles both Windows keyboard and Mac keyboard.

Expand All @@ -8,6 +10,14 @@ Since **v1.3.0**, this directive accepts an attribute for the separator for deci

Since **v1.5.0**, this directive will check the input `pattern` attribute if set. See an example below about an input only allows decimal numbers with precision of 2.

## `mask` directive

Since **v1.6.0**, the `mask` directive is added to this library. This directive checks the input `pattern` attribute if set.

- See an example below about an input allows `##-####`.

---

[![Build Status](https://img.shields.io/travis/changhuixu/ngx-digit-only/master.svg?label=Travis%20CI&style=flat-square)](https://travis-ci.org/changhuixu/ngx-digit-only)
[![npm](https://img.shields.io/npm/v/@uiowa/digit-only.svg?style=flat-square)](https://www.npmjs.com/package/@uiowa/digit-only)

Expand All @@ -18,7 +28,7 @@ Since **v1.5.0**, this directive will check the input `pattern` attribute if set
## Installation

```shell
npm i -S @uiowa/digit-only
npm i @uiowa/digit-only
```

## Usage
Expand Down Expand Up @@ -95,3 +105,19 @@ export class YourModule { }
decimal="true"
/>
```

### `mask` directive usage

```html
// input masked with pattern attribute: <code>##-####</code>
<input
id="org-dept"
type="text"
pattern="^(\d{0,2}|\d{2}-\d{0,4})$"
name="org-dept"
title="org-dept"
placeholder="00-0000"
mask
/>
`
```
30 changes: 28 additions & 2 deletions projects/uiowa/digit-only/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Angular DigitOnly Directive
# Angular DigitOnly Directive and Mask Directive

## `digitOnly` directive

An Angular directive only allows [0-9] in the input box when typing, pasting or drag/dropping. This directive handles both Windows keyboard and Mac keyboard.

Expand All @@ -8,6 +10,14 @@ Since **v1.3.0**, this directive accepts an attribute for the separator for deci

Since **v1.5.0**, this directive will check the input `pattern` attribute if set. See an example below about an input only allows decimal numbers with precision of 2.

## `mask` directive

Since **v1.6.0**, the `mask` directive is added to this library. This directive checks the input `pattern` attribute if set.

- See an example below about an input allows `##-####`.

---

[![Build Status](https://img.shields.io/travis/changhuixu/ngx-digit-only/master.svg?label=Travis%20CI&style=flat-square)](https://travis-ci.org/changhuixu/ngx-digit-only)
[![npm](https://img.shields.io/npm/v/@uiowa/digit-only.svg?style=flat-square)](https://www.npmjs.com/package/@uiowa/digit-only)

Expand All @@ -18,7 +28,7 @@ Since **v1.5.0**, this directive will check the input `pattern` attribute if set
## Installation

```shell
npm i -S @uiowa/digit-only
npm i @uiowa/digit-only
```

## Usage
Expand Down Expand Up @@ -95,3 +105,19 @@ export class YourModule { }
decimal="true"
/>
```

### `mask` directive usage

```html
// input masked with pattern attribute: <code>##-####</code>
<input
id="org-dept"
type="text"
pattern="^(\d{0,2}|\d{2}-\d{0,4})$"
name="org-dept"
title="org-dept"
placeholder="00-0000"
mask
/>
`
```
8 changes: 5 additions & 3 deletions projects/uiowa/digit-only/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@uiowa/digit-only",
"version": "1.5.0",
"version": "1.6.0",
"author": "Changhui Xu <[email protected]>",
"description": "An Angular directive only allows [0-9] in the input box when typing, pasting or drag/dropping. This directive handles both Windows keyboard and Mac keyboard.",
"description": "This package includes two Angular directives. The digitOnly directive only allows numbers in the input box when typing, pasting or drag/dropping. The mask directive checks the input pattern attribute.",
"keywords": [
"Angular",
"directive",
"number only",
"digit only",
"input",
"paste",
"drag drop"
"drag drop",
"mask",
"pattern"
],
"repository": {
"type": "git",
Expand Down

0 comments on commit 1e8a569

Please sign in to comment.