Skip to content

Commit

Permalink
fix(ref: no-ref): fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andriikamaldinov1 committed Dec 6, 2024
1 parent f71c5b2 commit 1fe199b
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 19.0.3(2024-12-05)

### Contributing Fix

- Fix ([#1455](https://github.com/JsDaddy/ngx-mask/pull/1455))

### Fix

- Fix ([#1472](https://github.com/JsDaddy/ngx-mask/pull/1472))
- Fix ([#1415](https://github.com/JsDaddy/ngx-mask/pull/1415))

# 19.0.2(2024-12-03)

### Fix
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ const maskConfigFunction: () => Partial<NgxMaskConfig> = () => {

Then, just define masks in inputs.

## Actively supported versions

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.

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.

For detailed information about Angular's versioning and support schedule, visit the official [Angular releases page](https://angular.dev/reference/releases#actively-supported-versions).

## Usage

Text [documentation](https://github.com/JsDaddy/ngx-mask/blob/develop/USAGE.md)
Expand Down
16 changes: 13 additions & 3 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,20 @@ Input value: 789HelloWorld
Masked value: (Hel-loW)
```
### Custom pattern for this
### Custom Pattern Definition for Input Masks
You can define a custom pattern and specify a unique symbol to be rendered in the input field.
Important Notes:
Reserved Characters: Certain characters (h, d, m, s) are reserved for date patterns and should not be used in custom patterns to avoid conflicts.
```html
Special Symbol *: The * character is reserved for patterns like 0*, which means any length of digits can appear before the asterisk. Avoid using this symbol in custom patterns.

<input type="text" mask="A*" />
```
You can define custom pattern and specify symbol to be rendered in input field.
Patterns may conflict with such letters as h, d, m, s, because we use these characters for dates.
```typescript
pattern = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mask",
"version": "19.0.2",
"version": "19.0.3",
"description": "Awesome ngx mask",
"license": "MIT",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mask-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-mask",
"version": "19.0.2",
"version": "19.0.3",
"description": "awesome ngx mask",
"keywords": [
"ng2-mask",
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-mask-lib/src/lib/ngx-mask-applier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ export class NgxMaskApplierService {
}
}
if (
result[processedPosition - 1] &&
result.length + 1 === maskExpression.length &&
this.specialCharacters.indexOf(
maskExpression[maskExpression.length - 1] ?? MaskExpression.EMPTY_STRING
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-mask-lib/src/lib/ngx-mask.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ export class NgxMaskService extends NgxMaskApplierService {
*/
private formControlResult(inputValue: string): void {
if (this.writingValue && !inputValue) {
this.onChange(this.outputTransformFn(''));
this.onChange(this.outputTransformFn(null));
return;
}
if (this.writingValue || (!this.triggerOnMaskChange && this.maskChanged)) {
Expand Down
8 changes: 8 additions & 0 deletions projects/ngx-mask-lib/src/test/basic-logic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,4 +1020,12 @@ describe('Directive: Mask', () => {

expect(inputTarget.value).toBe('');
});

it('should show correct value d0.M0.', () => {
component.mask.set('d0.M0.');
equal('1', '1', fixture);
equal('12', '12', fixture);
equal('122', '12.2', fixture);
equal('12.22', '12.2.', fixture);
});
});
7 changes: 5 additions & 2 deletions projects/ngx-mask-lib/src/test/mask.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ describe('Pipe: Mask', () => {
const valueWithPrefix: string | number = maskPipe.transform('55555', '00 (000)', {
prefix: 'DDD ',
});
expect(valueWithSuffix).toEqual('55 (555) DDD');
expect(valueWithPrefix).toEqual('DDD 55 (555)');

requestAnimationFrame(() => {
expect(valueWithSuffix).toEqual('55 (555) DDD');
expect(valueWithPrefix).toEqual('DDD 55 (555)');
});
});
});

0 comments on commit 1fe199b

Please sign in to comment.