diff --git a/package-lock.json b/package-lock.json index a2dd17b6d..6bf147523 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ngx-mat-input-tel", - "version": "17.2.0", + "version": "17.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ngx-mat-input-tel", - "version": "17.2.0", + "version": "17.3.0", "dependencies": { "@angular/animations": "^17.1.2", "@angular/cdk": "^17.1.2", @@ -19,7 +19,7 @@ "@angular/platform-browser-dynamic": "^17.1.2", "@angular/router": "^17.1.2", "core-js": "^3.33.3", - "libphonenumber-js": "^1.10.55", + "libphonenumber-js": "^1.10.60", "rxjs": "~7.8.1", "tslib": "^2.6.2", "zone.js": "~0.14.3" @@ -17466,9 +17466,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.10.55", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.55.tgz", - "integrity": "sha512-MrTg2JFLscgmTY6/oT9vopYETlgUls/FU6OaeeamGwk4LFxjIgOUML/ZSZICgR0LPYXaonVJo40lzMvaaTJlQA==" + "version": "1.10.60", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.10.60.tgz", + "integrity": "sha512-Ctgq2lXUpEJo5j1762NOzl2xo7z7pqmVWYai0p07LvAkQ32tbPv3wb+tcUeHEiXhKU5buM4H9MXsXo6OlM6C2g==" }, "node_modules/license-webpack-plugin": { "version": "4.0.2", diff --git a/package.json b/package.json index a245dd8fd..7433a39e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-input-tel", - "version": "17.2.0", + "version": "17.3.0", "scripts": { "ng": "ng", "start": "ng serve", @@ -25,7 +25,7 @@ "@angular/platform-browser-dynamic": "^17.1.2", "@angular/router": "^17.1.2", "core-js": "^3.33.3", - "libphonenumber-js": "^1.10.55", + "libphonenumber-js": "^1.10.60", "rxjs": "~7.8.1", "tslib": "^2.6.2", "zone.js": "~0.14.3" diff --git a/projects/ngx-mat-input-tel/package.json b/projects/ngx-mat-input-tel/package.json index a2251cf51..11546f873 100644 --- a/projects/ngx-mat-input-tel/package.json +++ b/projects/ngx-mat-input-tel/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-input-tel", - "version": "17.2.0", + "version": "17.3.0", "author": { "name": "Raphaƫl Balet", "email": "raphael.balet@outlook.com" @@ -14,7 +14,7 @@ "@angular/forms": ">=15.x", "@angular/platform-browser": ">=15.x", "@angular/platform-browser-dynamic": ">=15.x", - "libphonenumber-js": "^1.10.55" + "libphonenumber-js": "^1.10.60" }, "repository": { "type": "git", diff --git a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.ts b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.ts index 05790f390..9b8319532 100644 --- a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.ts +++ b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.ts @@ -261,13 +261,17 @@ export class NgxMatInputTelComponent ngDoCheck(): void { if (this.ngControl) { - const isInvalide = this.errorStateMatcher.isErrorState( - this.ngControl.control, - this._parentForm, - ) + const oldState = this.errorState + const newState = this.errorStateMatcher.isErrorState(this.ngControl.control, this._parentForm) this.errorState = - (isInvalide && !this.ngControl.control?.value) || (!this.focused ? isInvalide : false) + (newState && (!this.ngControl.control?.value || this.ngControl.control?.touched)) || + (!this.focused ? newState : false) + + if (oldState !== newState) { + this.errorState = newState + this.stateChanges.next() + } } }