ngx-mask 19.0.6 → 20.0.0

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/README.md CHANGED
@@ -1,206 +1,255 @@
1
- <a href="http://jsdaddy.io/img/logo.png">
2
- <h1 align="center">NGX MASK</h1>
3
- </a>
1
+ <h1 align="center">NGX-MASK</h1>
4
2
 
5
3
  <p align="center">
6
- NGX MASK is the best directive to solve masking input with needed pattern
4
+ A powerful Angular directive for input masking with customizable patterns
7
5
  </p>
8
6
 
9
- [![CI](https://github.com/JsDaddy/ngx-mask/actions/workflows/quality-check.yml/badge.svg?branch=develop)](https://github.com/JsDaddy/ngx-mask/actions/workflows/main.yml)
10
- [![npm](https://img.shields.io/npm/v/ngx-mask.svg)](https://www.npmjs.com/package/ngx-mask)
11
- [![npm downloads](https://img.shields.io/npm/dt/ngx-mask.svg)](https://npmjs.org/ngx-mask)
7
+ <p align="center">
8
+ Created with ❤️ by
9
+ </p>
12
10
 
13
- [![npm](https://img.shields.io/npm/dm/ngx-mask.svg)](https://www.npmjs.com/package/ngx-mask)
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>
14
16
 
15
- [![GitHub contributors](https://img.shields.io/github/contributors/JSDaddy/ngx-mask.svg?style=flat)](https://github.com/JSDaddy/ngx-mask)
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">
20
+ </a>
21
+ <a href="https://www.npmjs.com/package/ngx-mask">
22
+ <img src="https://img.shields.io/npm/v/ngx-mask.svg" alt="npm version">
23
+ </a>
24
+ <a href="https://npmjs.org/ngx-mask">
25
+ <img src="https://img.shields.io/npm/dt/ngx-mask.svg" alt="npm downloads">
26
+ </a>
27
+ <a href="https://www.npmjs.com/package/ngx-mask">
28
+ <img src="https://img.shields.io/npm/dm/ngx-mask.svg" alt="npm monthly downloads">
29
+ </a>
30
+ <a href="https://github.com/JSDaddy/ngx-mask">
31
+ <img src="https://img.shields.io/github/contributors/JSDaddy/ngx-mask.svg?style=flat" alt="GitHub contributors">
32
+ </a>
33
+ <a href="https://github.com/JSDaddy/ngx-mask">
34
+ <img src="https://img.shields.io/github/stars/JSDaddy/ngx-mask.svg?label=GitHub%20Stars&style=flat" alt="GitHub Stars">
35
+ </a>
36
+ </p>
16
37
 
17
- [![GitHub stars](https://img.shields.io/github/stars/JSDaddy/ngx-mask.svg?label=GitHub%20Stars&style=flat)](https://github.com/JSDaddy/ngx-mask)
38
+ ## Table of Contents
18
39
 
19
- You can also try our NGX LOADER INDICATOR [check](https://www.npmjs.com/package/ngx-loader-indicator).
20
- You can also try our NGX COPYPASTE [check](https://www.npmjs.com/package/ngx-copypaste).
40
+ - [Features](#features)
41
+ - [Demo](#demo)
42
+ - [Installation](#installation)
43
+ - [Version Compatibility](#version-compatibility)
44
+ - [Quick Start](#quick-start)
45
+ - [For Angular 15+ (Standalone)](#for-angular-15-standalone)
46
+ - [For Angular Modules](#for-angular-modules)
47
+ - [Related Projects](#related-projects)
48
+ - [Contributing](#contributing)
21
49
 
22
- ### You can try live [documentation](https://jsdaddy.github.io/ngx-mask/) with examples
50
+ ## Features
23
51
 
24
- ## Installing
52
+ NGX-MASK is a feature-rich input mask directive for Angular applications that provides:
25
53
 
26
- Angular version 17.x.x
54
+ <table>
55
+ <tr>
56
+ <td width="33%" valign="top">
27
57
 
28
- ```bash
29
- $ npm install --save ngx-mask
30
- ```
58
+ ### 🎯 Masking Patterns
31
59
 
32
- Angular version 16.x.x
60
+ • Custom patterns & expressions
33
61
 
34
- ```bash
35
- $ npm install --save ngx-mask@16.4.2
36
- ```
62
+ • Multiple mask patterns (|)
37
63
 
38
- Angular version 15.x.x
64
+ • Built-in common patterns
39
65
 
40
- ```bash
41
- $ npm install --save ngx-mask@15.2.3
42
- ```
66
+ • Prefix & suffix support
43
67
 
44
- Angular version 14.x.x
68
+ </td>
69
+ <td width="33%" valign="top">
45
70
 
46
- ```bash
47
- $ npm install --save ngx-mask@14.3.3
48
- ```
71
+ ### 🔢 Number Formatting
72
+
73
+ • Thousand separators
74
+
75
+ • Decimal markers
76
+
77
+ • Negative numbers
78
+
79
+ • Leading zeros
80
+
81
+ </td>
82
+ <td width="33%" valign="top">
83
+
84
+ ### ⚡ Input Control
85
+
86
+ • Real-time validation
87
+
88
+ • Clear on non-match
89
+
90
+ • Show/hide mask typing
91
+
92
+ • Keep character positions
93
+
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td width="33%" valign="top">
98
+
99
+ ### 📅 Date & Time
100
+
101
+ • Leading zero handling
102
+
103
+ • AM/PM support
104
+
105
+ • Custom separators
106
+
107
+ • Multiple formats
108
+
109
+ </td>
110
+ <td width="33%" valign="top">
111
+
112
+ ### 🛠️ Customization
113
+
114
+ • Custom placeholders
115
+
116
+ • Special characters
49
117
 
50
- Angular version 13.x.x or 12.x.x
118
+ • Transform functions
119
+
120
+ • Custom validation
121
+
122
+ </td>
123
+ <td width="33%" valign="top">
124
+
125
+ ### 📋 Form Integration
126
+
127
+ • Reactive Forms
128
+
129
+ • ControlValueAccessor
130
+
131
+ • Built-in validation
132
+
133
+ • Standalone support
134
+
135
+ </td>
136
+ </tr>
137
+ </table>
138
+
139
+ ## Demo
140
+
141
+ Check out our [live documentation and examples](https://jsdaddy.github.io/ngx-mask/)
142
+
143
+ ## Installation
51
144
 
52
145
  ```bash
53
- $ npm install --save ngx-mask@13.2.2
146
+ # For Angular 17 and above
147
+ $ npm install ngx-mask # Using npm
148
+ $ bun add ngx-mask # Using bun
149
+
150
+ # For specific Angular versions:
151
+ # Angular 16.x.x
152
+ $ npm install ngx-mask@16.4.2 # Using npm
153
+ $ bun add ngx-mask@16.4.2 # Using bun
154
+
155
+ # Angular 15.x.x
156
+ $ npm install ngx-mask@15.2.3 # Using npm
157
+ $ bun add ngx-mask@15.2.3 # Using bun
158
+
159
+ # Angular 14.x.x
160
+ $ npm install ngx-mask@14.3.3 # Using npm
161
+ $ bun add ngx-mask@14.3.3 # Using bun
162
+
163
+ # Angular 13.x.x or 12.x.x
164
+ $ npm install ngx-mask@13.2.2 # Using npm
165
+ $ bun add ngx-mask@13.2.2 # Using bun
54
166
  ```
55
167
 
56
- ## Quickstart if ngx-mask version >= 15.0.0
168
+ > **Package Manager Note**: You can use either npm or bun based on your preference. Both package managers will work equally well with ngx-mask.
57
169
 
58
- Import **ngx-mask** directive, pipe and provide NgxMask providers with `provideNgxMask` function.
170
+ ## Version Compatibility
59
171
 
60
- ### With default config options application level
172
+ NGX-MASK follows Angular's official support policy, supporting Active and LTS versions. Currently supported:
61
173
 
62
- ```typescript
63
- bootstrapApplication(AppComponent, {
64
- providers: [
65
- (...)
66
- provideEnvironmentNgxMask(),
67
- (...)
68
- ],
69
- }).catch((err) => console.error(err));
70
- ```
174
+ - Angular 17 and newer (latest features and updates)
175
+ - For older Angular versions, use the corresponding NGX-MASK version as specified above
71
176
 
72
- ### Passing your own mask config options
177
+ > **Note**: Versions for Angular older than v17 will not receive new features or updates.
178
+
179
+ ## Quick Start
180
+
181
+ ### For Angular 15+ (Standalone)
182
+
183
+ #### Application-wide Setup with Default Config
73
184
 
74
185
  ```typescript
75
- import { NgxMaskConfig } from 'ngx-mask'
76
-
77
- const maskConfig: Partial<NgxMaskConfig> = {
78
- validation: false,
79
- };
80
-
81
- bootstrapApplication(AppComponent, {
82
- providers: [
83
- (...)
84
- provideEnvironmentNgxMask(maskConfig),
85
- (...)
86
- ],
87
- }).catch((err) => console.error(err));
186
+ bootstrapApplication(AppComponent, { providers: [provideEnvironmentNgxMask()] }).catch((err) =>
187
+ console.error(err)
188
+ );
88
189
  ```
89
190
 
90
- ### Using a function to configure:
191
+ #### With Custom Configuration
91
192
 
92
193
  ```typescript
93
- const maskConfigFunction: () => Partial<NgxMaskConfig> = () => {
94
- return {
95
- validation: false,
96
- };
97
- };
98
-
99
- bootstrapApplication(AppComponent, {
100
- providers: [
101
- (...)
102
- provideEnvironmentNgxMask(maskConfigFunction),
103
- (...)
104
- ],
105
- }).catch((err) => console.error(err));
194
+ import { NgxMaskConfig } from 'ngx-mask';
195
+
196
+ const maskConfig: Partial<NgxMaskConfig> = { validation: false };
197
+
198
+ bootstrapApplication(AppComponent, { providers: [provideEnvironmentNgxMask(maskConfig)] }).catch(
199
+ (err) => console.error(err)
200
+ );
106
201
  ```
107
202
 
108
- ### With config options feature level
203
+ #### Feature-level Configuration
109
204
 
110
205
  ```typescript
111
206
  @Component({
112
207
  selector: 'my-feature',
113
- templateUrl: './my-feature.component.html',
114
- styleUrls: ['./my-feature.component.css'],
115
208
  standalone: true,
116
- imports: [NgxMaskDirective, (...)],
117
- providers: [
118
- (...)
119
- provideNgxMask(),
120
- (...)
121
- ],
209
+ imports: [NgxMaskDirective],
210
+ providers: [provideNgxMask()],
122
211
  })
123
212
  export class MyFeatureComponent {}
124
213
  ```
125
214
 
126
- Then, import directive, pipe to needed standalone component and just define masks in inputs.
215
+ ### For Angular < 15 (NgModule)
127
216
 
128
- ### With Angular modules
217
+ #### Application-wide Setup with Default Config
129
218
 
130
219
  ```typescript
131
- @NgModule({
132
- imports: [
133
- NgxMaskDirective, NgxMaskPipe
134
- ],
135
- providers: [provideNgxMask()]
136
- })
137
- ```
138
-
139
- ## Quickstart if ngx-mask version < 15.0.0
140
-
141
- For version ngx-mask < 15.0.0
142
- Import **ngx-mask** module in Angular app.
143
-
144
- ### With default mask config options
145
-
146
- ```typescript
147
- import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask'
148
-
149
- export const options: Partial<null | NgxMaskConfig> | (() => Partial<NgxMaskConfig>) = null;
220
+ import { NgxMaskModule } from 'ngx-mask';
150
221
 
151
- @NgModule({
152
- imports: [
153
- NgxMaskModule.forRoot(),
154
- ],
155
- })
222
+ @NgModule({ imports: [NgxMaskModule.forRoot()] })
223
+ export class AppModule {}
156
224
  ```
157
225
 
158
- ### Passing in your own mask config options
226
+ #### With Custom Configuration
159
227
 
160
228
  ```typescript
161
- import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask'
229
+ import { NgxMaskModule, NgxMaskConfig } from 'ngx-mask';
162
230
 
163
- const maskConfig: Partial<NgxMaskConfig> = {
164
- validation: false,
165
- };
231
+ const maskConfig: Partial<NgxMaskConfig> = { validation: false };
166
232
 
167
- @NgModule({
168
- imports: [
169
- NgxMaskModule.forRoot(maskConfig),
170
- ],
171
- })
233
+ @NgModule({ imports: [NgxMaskModule.forRoot(maskConfig)] })
234
+ export class AppModule {}
172
235
  ```
173
236
 
174
- Or using a function to get the config:
237
+ #### Feature-level Configuration
175
238
 
176
239
  ```typescript
177
- const maskConfigFunction: () => Partial<NgxMaskConfig> = () => {
178
- return {
179
- validation: false,
180
- };
181
- };
182
-
183
- @NgModule({
184
- imports: [
185
- NgxMaskModule.forRoot(maskConfigFunction),
186
- ],
187
- })
188
- ```
240
+ import { NgxMaskModule } from 'ngx-mask';
189
241
 
190
- Then, just define masks in inputs.
191
-
192
- ## Actively supported versions
193
-
194
- ngx-mask follows the official Angular support policy, supporting the Active and LTS (Long-Term Support) versions of Angular. As of the latest release, Angular v17 and newer are supported.
195
-
196
- Projects using Angular versions outside the supported range (e.g., older than v17) should use the last compatible version of ngx-mask. However, these versions will no longer receive updates, bug fixes, or new features.
242
+ @NgModule({ imports: [NgxMaskModule.forChild()] })
243
+ export class FeatureModule {}
244
+ ```
197
245
 
198
- For detailed information about Angular's versioning and support schedule, visit the official [Angular releases page](https://angular.dev/reference/releases#actively-supported-versions).
246
+ ## Related Projects
199
247
 
200
- ## Usage
248
+ Check out other projects by JSDaddy:
201
249
 
202
- Text [documentation](https://github.com/JsDaddy/ngx-mask/blob/develop/USAGE.md)
250
+ - [ngx-copypaste](https://github.com/JsDaddy/ngx-copypaste)
251
+ - [ngx-loader-indicator](https://github.com/JsDaddy/ngx-loader-indicator)
203
252
 
204
253
  ## Contributing
205
254
 
206
- We would love some contributions! Check out this [document](https://github.com/JsDaddy/ngx-mask/blob/develop/CONTRIBUTING.md) to get started.
255
+ We welcome contributions! Please read our [contributing guidelines](CONTRIBUTING.md) to learn about our development process and how you can propose bugfixes and improvements.