ngx-mask 21.1.0 → 22.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +51 -46
- package/fesm2022/ngx-mask.mjs +1024 -615
- package/package.json +16 -10
- package/types/ngx-mask.d.ts +77 -16
- package/fesm2022/ngx-mask.mjs.map +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
<h1 align="center">
|
|
1
|
+
<h1 align="center">ngx-mask</h1>
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
A powerful Angular directive for input masking with customizable patterns
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<p align="center">
|
|
12
|
-
<a href="https://jsdaddy.io">
|
|
13
|
-
<img src="http://jsdaddy.io/assets/images/shared/logo.svg" alt="JSDaddy" width="75">
|
|
14
|
-
</a>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
|
-
<p align="center">
|
|
18
|
-
<a href="https://github.com/JsDaddy/ngx-mask/actions/workflows/quality-check.yml">
|
|
19
|
-
<img src="https://github.com/JsDaddy/ngx-mask/actions/workflows/quality-check.yml/badge.svg?branch=develop" alt="CI">
|
|
8
|
+
<a href="https://github.com/NepipenkoIgor/ngx-mask/actions/workflows/quality-check.yml">
|
|
9
|
+
<img src="https://github.com/NepipenkoIgor/ngx-mask/actions/workflows/quality-check.yml/badge.svg?branch=develop" alt="CI">
|
|
20
10
|
</a>
|
|
21
11
|
<a href="https://www.npmjs.com/package/ngx-mask">
|
|
22
12
|
<img src="https://img.shields.io/npm/v/ngx-mask.svg" alt="npm version">
|
|
@@ -27,14 +17,25 @@ A powerful Angular directive for input masking with customizable patterns
|
|
|
27
17
|
<a href="https://www.npmjs.com/package/ngx-mask">
|
|
28
18
|
<img src="https://img.shields.io/npm/dm/ngx-mask.svg" alt="npm monthly downloads">
|
|
29
19
|
</a>
|
|
30
|
-
<a href="https://
|
|
31
|
-
<img src="https://img.shields.io/
|
|
20
|
+
<a href="https://bundlephobia.com/package/ngx-mask">
|
|
21
|
+
<img src="https://img.shields.io/bundlephobia/minzip/ngx-mask.svg" alt="Bundle size">
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://www.npmjs.com/package/ngx-mask">
|
|
24
|
+
<img src="https://img.shields.io/npm/types/ngx-mask.svg" alt="TypeScript support">
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://github.com/NepipenkoIgor/ngx-mask/blob/develop/LICENSE">
|
|
27
|
+
<img src="https://img.shields.io/npm/l/ngx-mask.svg" alt="License">
|
|
28
|
+
</a>
|
|
29
|
+
<a href="https://github.com/NepipenkoIgor/ngx-mask">
|
|
30
|
+
<img src="https://img.shields.io/github/contributors/NepipenkoIgor/ngx-mask.svg?style=flat" alt="GitHub contributors">
|
|
32
31
|
</a>
|
|
33
|
-
<a href="https://github.com/
|
|
34
|
-
<img src="https://img.shields.io/github/stars/
|
|
32
|
+
<a href="https://github.com/NepipenkoIgor/ngx-mask">
|
|
33
|
+
<img src="https://img.shields.io/github/stars/NepipenkoIgor/ngx-mask.svg?label=GitHub%20Stars&style=flat" alt="GitHub Stars">
|
|
35
34
|
</a>
|
|
36
35
|
</p>
|
|
37
36
|
|
|
37
|
+
`ngx-mask` is the input-masking library built for modern Angular. One standalone directive (`NgxMaskDirective`) and pipe (`NgxMaskPipe`) cover all three form models — **Reactive Forms, template-driven, and the new Signal Forms** — through a first-class `ControlValueAccessor`, and run cleanly in **zoneless** and SSR applications. You get production-ready masks out of the box: dates and times with validity checking, numbers with thousand separators and decimal precision, IP, CPF/CNPJ, secure/hidden input, plus fully custom patterns with prefixes, suffixes and multi-mask expressions. No runtime dependencies beyond Angular, ~15 KB gzipped — provide it once, bind `mask`, done.
|
|
38
|
+
|
|
38
39
|
## Table of Contents
|
|
39
40
|
|
|
40
41
|
- [Features](#features)
|
|
@@ -42,9 +43,8 @@ A powerful Angular directive for input masking with customizable patterns
|
|
|
42
43
|
- [Installation](#installation)
|
|
43
44
|
- [Version Compatibility](#version-compatibility)
|
|
44
45
|
- [Quick Start](#quick-start)
|
|
45
|
-
- [
|
|
46
|
-
- [
|
|
47
|
-
- [Related Projects](#related-projects)
|
|
46
|
+
- [Standalone Applications](#standalone-applications)
|
|
47
|
+
- [NgModule-based Applications](#ngmodule-based-applications)
|
|
48
48
|
- [Contributing](#contributing)
|
|
49
49
|
|
|
50
50
|
## Features
|
|
@@ -138,7 +138,7 @@ NGX-MASK is a feature-rich input mask directive for Angular applications that pr
|
|
|
138
138
|
|
|
139
139
|
## Demo
|
|
140
140
|
|
|
141
|
-
Check out our [live documentation and examples](https://
|
|
141
|
+
Check out our [live documentation and examples](https://nepipenkoigor.github.io/ngx-mask/)
|
|
142
142
|
|
|
143
143
|
## Installation
|
|
144
144
|
|
|
@@ -178,7 +178,14 @@ NGX-MASK follows Angular's official support policy, supporting Active and LTS ve
|
|
|
178
178
|
|
|
179
179
|
## Quick Start
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
`ngx-mask` ships as a standalone directive (`NgxMaskDirective`) and pipe (`NgxMaskPipe`) — there is no `NgxMaskModule` in current versions. Configuration is registered through one of two provider functions:
|
|
182
|
+
|
|
183
|
+
- **`provideEnvironmentNgxMask(config?)`** — application-wide config. Use it once in `bootstrapApplication` / `app.config.ts` (or a root `NgModule`'s `providers`).
|
|
184
|
+
- **`provideNgxMask(config?)`** — injector-level config. Use it in a component's or feature's `providers` to configure/override the options for that subtree only.
|
|
185
|
+
|
|
186
|
+
Directive inputs (e.g. `[thousandSeparator]`) always override any provider config. See [USAGE.md](USAGE.md#configuration) for the full decision guide, examples, and common pitfalls.
|
|
187
|
+
|
|
188
|
+
### Standalone Applications
|
|
182
189
|
|
|
183
190
|
#### Application-wide Setup with Default Config
|
|
184
191
|
|
|
@@ -212,44 +219,42 @@ bootstrapApplication(AppComponent, { providers: [provideEnvironmentNgxMask(maskC
|
|
|
212
219
|
export class MyFeatureComponent {}
|
|
213
220
|
```
|
|
214
221
|
|
|
215
|
-
###
|
|
222
|
+
### NgModule-based Applications
|
|
216
223
|
|
|
217
|
-
|
|
224
|
+
Module-based apps import the standalone directive/pipe into `imports` and register the provider function:
|
|
218
225
|
|
|
219
226
|
```typescript
|
|
220
|
-
import {
|
|
227
|
+
import { NgxMaskDirective, NgxMaskPipe, provideEnvironmentNgxMask } from 'ngx-mask';
|
|
221
228
|
|
|
222
|
-
@NgModule({
|
|
229
|
+
@NgModule({
|
|
230
|
+
imports: [NgxMaskDirective, NgxMaskPipe],
|
|
231
|
+
exports: [NgxMaskDirective, NgxMaskPipe],
|
|
232
|
+
providers: [provideEnvironmentNgxMask()],
|
|
233
|
+
})
|
|
223
234
|
export class AppModule {}
|
|
224
235
|
```
|
|
225
236
|
|
|
226
|
-
####
|
|
237
|
+
#### Migrating from ngx-mask ≤ 14 (`NgxMaskModule`)
|
|
227
238
|
|
|
228
|
-
|
|
229
|
-
import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask';
|
|
230
|
-
|
|
231
|
-
const maskConfig: Partial<NgxMaskConfig> = { validation: false };
|
|
239
|
+
`NgxMaskModule.forRoot()` / `forChild()` only exist in ngx-mask 14.x and older (Angular < 15):
|
|
232
240
|
|
|
241
|
+
```typescript
|
|
242
|
+
// Before (ngx-mask <= 14)
|
|
233
243
|
@NgModule({ imports: [NgxMaskModule.forRoot(maskConfig)] })
|
|
234
244
|
export class AppModule {}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
#### Feature-level Configuration
|
|
238
|
-
|
|
239
|
-
```typescript
|
|
240
|
-
import { NgxMaskModule } from 'ngx-mask';
|
|
241
245
|
|
|
242
|
-
|
|
243
|
-
|
|
246
|
+
// After (current ngx-mask)
|
|
247
|
+
@NgModule({
|
|
248
|
+
imports: [NgxMaskDirective],
|
|
249
|
+
providers: [provideEnvironmentNgxMask(maskConfig)],
|
|
250
|
+
})
|
|
251
|
+
export class AppModule {}
|
|
244
252
|
```
|
|
245
253
|
|
|
246
|
-
## Related Projects
|
|
247
|
-
|
|
248
|
-
Check out other projects by JSDaddy:
|
|
249
|
-
|
|
250
|
-
- [ngx-copypaste](https://github.com/JsDaddy/ngx-copypaste)
|
|
251
|
-
- [ngx-loader-indicator](https://github.com/JsDaddy/ngx-loader-indicator)
|
|
252
|
-
|
|
253
254
|
## Contributing
|
|
254
255
|
|
|
255
256
|
We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) to learn about our development process and how you can propose bugfixes and improvements.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
<p align="center">Maintained by <a href="https://software.novines.eu">Igor Nepipenko</a></p>
|