ngx-mask 14.2.4 → 15.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/README.md +91 -9
- package/esm2020/index.mjs +7 -7
- package/esm2020/lib/ngx-mask-applier.service.mjs +527 -0
- package/esm2020/lib/ngx-mask.config.mjs +81 -0
- package/esm2020/lib/ngx-mask.directive.mjs +612 -0
- package/esm2020/lib/ngx-mask.pipe.mjs +32 -0
- package/esm2020/lib/ngx-mask.providers.mjs +34 -0
- package/esm2020/lib/ngx-mask.service.mjs +416 -0
- package/fesm2015/ngx-mask.mjs +90 -124
- package/fesm2015/ngx-mask.mjs.map +1 -1
- package/fesm2020/ngx-mask.mjs +91 -119
- package/fesm2020/ngx-mask.mjs.map +1 -1
- package/index.d.ts +6 -6
- package/lib/{mask-applier.service.d.ts → ngx-mask-applier.service.d.ts} +9 -10
- package/lib/{config.d.ts → ngx-mask.config.d.ts} +1 -1
- package/lib/{mask.directive.d.ts → ngx-mask.directive.d.ts} +8 -9
- package/lib/ngx-mask.pipe.d.ts +11 -0
- package/lib/ngx-mask.providers.d.ts +4 -0
- package/lib/{mask.service.d.ts → ngx-mask.service.d.ts} +9 -11
- package/package.json +4 -4
- package/esm2020/lib/config.mjs +0 -81
- package/esm2020/lib/mask-applier.service.mjs +0 -530
- package/esm2020/lib/mask.directive.mjs +0 -618
- package/esm2020/lib/mask.pipe.mjs +0 -30
- package/esm2020/lib/mask.service.mjs +0 -422
- package/esm2020/lib/ngx-mask.module.mjs +0 -53
- package/lib/mask.pipe.d.ts +0 -11
- package/lib/ngx-mask.module.d.ts +0 -16
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
<a href="
|
|
2
|
-
<h1 align="center">
|
|
1
|
+
<a href="http://jsdaddy.io/img/logo.png">
|
|
2
|
+
<h1 align="center">NGX MASK</h1>
|
|
3
3
|
</a>
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
NGX MASK is the best directive to solve masking input with needed pattern
|
|
7
|
+
</p>
|
|
8
|
+
|
|
5
9
|
[](https://github.com/JsDaddy/ngx-mask/actions/workflows/main.yml)
|
|
6
10
|
[](https://www.npmjs.com/package/ngx-mask)
|
|
7
11
|
[](https://npmjs.org/ngx-mask)
|
|
@@ -23,8 +27,90 @@ You can also try our [NGX COPYPASTE](https://www.npmjs.com/package/ngx-copypaste
|
|
|
23
27
|
$ npm install --save ngx-mask
|
|
24
28
|
```
|
|
25
29
|
|
|
26
|
-
## Quickstart
|
|
30
|
+
## Quickstart if ngx-mask version >= 15.0.0
|
|
31
|
+
|
|
32
|
+
Import **ngx-mask** directive, pipe and provide NgxMask providers with `provideNgxMask` function.
|
|
33
|
+
|
|
34
|
+
### With default config options application level
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
bootstrapApplication(AppComponent, {
|
|
38
|
+
providers: [
|
|
39
|
+
(...)
|
|
40
|
+
provideEnvironmentNgxMask(),
|
|
41
|
+
(...)
|
|
42
|
+
],
|
|
43
|
+
}).catch((err) => console.error(err));
|
|
44
|
+
````
|
|
45
|
+
|
|
46
|
+
### Passing your own mask config options
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { IConfig } from 'ngx-mask'
|
|
50
|
+
|
|
51
|
+
const maskConfig: Partial<IConfig> = {
|
|
52
|
+
validation: false,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
bootstrapApplication(AppComponent, {
|
|
56
|
+
providers: [
|
|
57
|
+
(...)
|
|
58
|
+
provideEnvironmentNgxMask(maskConfig),
|
|
59
|
+
(...)
|
|
60
|
+
],
|
|
61
|
+
}).catch((err) => console.error(err));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Using a function to configure:
|
|
27
65
|
|
|
66
|
+
```typescript
|
|
67
|
+
const maskConfigFunction: () => Partial<IConfig> = () => {
|
|
68
|
+
return {
|
|
69
|
+
validation: false,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
bootstrapApplication(AppComponent, {
|
|
74
|
+
providers: [
|
|
75
|
+
(...)
|
|
76
|
+
provideEnvironmentNgxMask(maskConfigFunction),
|
|
77
|
+
(...)
|
|
78
|
+
],
|
|
79
|
+
}).catch((err) => console.error(err));
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### With config options feature level
|
|
83
|
+
```typescript
|
|
84
|
+
@Component({
|
|
85
|
+
selector: 'my-feature',
|
|
86
|
+
templateUrl: './my-feature.component.html',
|
|
87
|
+
styleUrls: ['./my-feature.component.css'],
|
|
88
|
+
standalone: true,
|
|
89
|
+
imports: [NgxMaskDirective, (...)],
|
|
90
|
+
providers: [
|
|
91
|
+
(...)
|
|
92
|
+
provideNgxMask(),
|
|
93
|
+
(...)
|
|
94
|
+
],
|
|
95
|
+
})
|
|
96
|
+
export class MyFeatureComponent {}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Then, import directive, pipe to needed standalone component and just define masks in inputs.
|
|
100
|
+
### With Angular modules
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
@NgModule({
|
|
104
|
+
imports: [
|
|
105
|
+
NgxMaskDirective, NgxMaskPipe
|
|
106
|
+
],
|
|
107
|
+
providers: [provideNgxMask()]
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Quickstart if ngx-mask version < 15.0.0
|
|
112
|
+
|
|
113
|
+
For version ngx-mask < 15.0.0
|
|
28
114
|
Import **ngx-mask** module in Angular app.
|
|
29
115
|
|
|
30
116
|
### With default mask config options
|
|
@@ -75,7 +161,7 @@ const maskConfigFunction: () => Partial<IConfig> = () => {
|
|
|
75
161
|
|
|
76
162
|
Then, just define masks in inputs.
|
|
77
163
|
|
|
78
|
-
|
|
164
|
+
## Usage
|
|
79
165
|
|
|
80
166
|
```html
|
|
81
167
|
<input type="text" mask="<here goes your mask>" />
|
|
@@ -89,21 +175,17 @@ or
|
|
|
89
175
|
|
|
90
176
|
Also, you can use mask pipe.
|
|
91
177
|
|
|
92
|
-
### Usage
|
|
93
|
-
|
|
94
178
|
```html
|
|
95
179
|
<span>{{phone | mask: '(000) 000-0000'}}</span>
|
|
96
180
|
```
|
|
97
181
|
|
|
98
182
|
For separator you can add thousandSeparator
|
|
99
183
|
|
|
100
|
-
### Usage
|
|
101
|
-
|
|
102
184
|
```html
|
|
103
185
|
<span>{{value | mask: 'separator':','}}</span>
|
|
104
186
|
```
|
|
105
187
|
|
|
106
|
-
|
|
188
|
+
### Examples
|
|
107
189
|
|
|
108
190
|
| mask | example |
|
|
109
191
|
| -------------- | -------------- |
|
package/esm2020/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './lib/ngx-mask.
|
|
2
|
-
export * from './lib/mask.directive';
|
|
3
|
-
export * from './lib/mask.pipe';
|
|
4
|
-
export * from './lib/mask.service';
|
|
5
|
-
export * from './lib/mask-applier.service';
|
|
6
|
-
export * from './lib/config';
|
|
1
|
+
export * from './lib/ngx-mask.providers';
|
|
2
|
+
export * from './lib/ngx-mask.directive';
|
|
3
|
+
export * from './lib/ngx-mask.pipe';
|
|
4
|
+
export * from './lib/ngx-mask.service';
|
|
5
|
+
export * from './lib/ngx-mask-applier.service';
|
|
6
|
+
export * from './lib/ngx-mask.config';
|
|
7
7
|
export * from './lib/custom-keyboard-event';
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9uZ3gtbWFzay1saWIvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLHFCQUFxQixDQUFDO0FBQ3BDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYyxnQ0FBZ0MsQ0FBQztBQUMvQyxjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsNkJBQTZCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtbWFzay5wcm92aWRlcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LW1hc2suZGlyZWN0aXZlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1tYXNrLnBpcGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LW1hc2suc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtbWFzay1hcHBsaWVyLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LW1hc2suY29uZmlnJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2N1c3RvbS1rZXlib2FyZC1ldmVudCc7XG4iXX0=
|