From a9ccb628f0a9e97321840fb7d67c3ca830987304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Balet?= Date: Thu, 26 Sep 2024 16:09:40 +0200 Subject: [PATCH 1/3] perf: use template string --- .prettierrc | 10 ++- package-lock.json | 12 ++-- package.json | 4 +- projects/ngx-mat-input-tel/package.json | 4 +- .../src/lib/ngx-mat-input-tel.component.html | 71 +++++++++++-------- .../src/lib/ngx-mat-input-tel.component.ts | 4 +- 6 files changed, 60 insertions(+), 45 deletions(-) diff --git a/.prettierrc b/.prettierrc index b49476321..562e95cbf 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,5 +3,13 @@ "singleQuote": true, "trailingComma": "all", "semi": false, - "arrowParens": "always" + "arrowParens": "always", + "overrides": [ + { + "files": "*.html", + "options": { + "parser": "angular" + } + } + ] } diff --git a/package-lock.json b/package-lock.json index 7cb547821..aa251cb9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ngx-mat-input-tel", - "version": "18.2.0", + "version": "18.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ngx-mat-input-tel", - "version": "18.2.0", + "version": "18.3.1", "dependencies": { "@angular/animations": "^18.2.5", "@angular/cdk": "^18.2.5", @@ -19,7 +19,7 @@ "@angular/platform-browser-dynamic": "^18.2.5", "@angular/router": "^18.2.5", "core-js": "^3.38.1", - "libphonenumber-js": "^1.11.8", + "libphonenumber-js": "^1.11.9", "rxjs": "~7.8.1", "tslib": "^2.7.0", "zone.js": "~0.14.10" @@ -17333,9 +17333,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.11.8", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.8.tgz", - "integrity": "sha512-0fv/YKpJBAgXKy0kaS3fnqoUVN8901vUYAKIGD/MWZaDfhJt1nZjPL3ZzdZBt/G8G8Hw2J1xOIrXWdNHFHPAvg==", + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.9.tgz", + "integrity": "sha512-Zs5wf5HaWzW2/inlupe2tstl0I/Tbqo7lH20ZLr6Is58u7Dz2n+gRFGNlj9/gWxFvNfp9+YyDsiegjNhdixB9A==", "license": "MIT" }, "node_modules/license-webpack-plugin": { diff --git a/package.json b/package.json index 92647e69a..42f37f553 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-input-tel", - "version": "18.2.0", + "version": "18.3.1", "scripts": { "ng": "ng", "start": "ng serve", @@ -25,7 +25,7 @@ "@angular/platform-browser-dynamic": "^18.2.5", "@angular/router": "^18.2.5", "core-js": "^3.38.1", - "libphonenumber-js": "^1.11.8", + "libphonenumber-js": "^1.11.9", "rxjs": "~7.8.1", "tslib": "^2.7.0", "zone.js": "~0.14.10" diff --git a/projects/ngx-mat-input-tel/package.json b/projects/ngx-mat-input-tel/package.json index 48f07a2b3..d6aacf53d 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": "18.2.0", + "version": "18.3.1", "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.11.8" + "libphonenumber-js": "^1.11.9" }, "repository": { "type": "git", diff --git a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html index be1b38102..5a9699c87 100644 --- a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html +++ b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html @@ -8,9 +8,10 @@ (menuOpened)="menuSearchInput?.nativeElement?.focus()" > - +{{ selectedCountry.dialCode }} + + @if(selectedCountry.dialCode) { + +{{ selectedCountry.dialCode }} + } + @if(enableSearch) { + + } @for(country of preferredCountriesInDropDown; track $index ) { + } @if(preferredCountriesInDropDown.length) { + + } @for(country of allCountries | search : searchCriteria; track $index ) { + - + @if(country.areaCodes) { + {{ country.areaCodes.join(', ') }} + } + + } + + + } Date: Fri, 27 Sep 2024 09:52:15 +0200 Subject: [PATCH 2/3] refactor(templateString): prettier --- package-lock.json | 17 +++ package.json | 1 + .../src/lib/ngx-mat-input-tel.component.html | 142 +++++++++--------- 3 files changed, 90 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index aa251cb9f..e92753ce4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,6 +57,7 @@ "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "^2.1.0", "ng-packagr": "^18.2.1", + "prettier": "^3.3.3", "protractor": "~7.0.0", "semantic-release": "^24.1.1", "ts-node": "^10.9.2", @@ -25215,6 +25216,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-ms": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.1.0.tgz", diff --git a/package.json b/package.json index 42f37f553..0bb83d29b 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "^2.1.0", "ng-packagr": "^18.2.1", + "prettier": "^3.3.3", "protractor": "~7.0.0", "semantic-release": "^24.1.1", "ts-node": "^10.9.2", diff --git a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html index 5a9699c87..cbc776f62 100644 --- a/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html +++ b/projects/ngx-mat-input-tel/src/lib/ngx-mat-input-tel.component.html @@ -9,8 +9,8 @@ > - @if(selectedCountry.dialCode) { - +{{ selectedCountry.dialCode }} + @if (selectedCountry.dialCode) { + +{{ selectedCountry.dialCode }} } @@ -19,80 +19,82 @@ class="ngx-mat-input-tel-overlay-pane" [backdropClass]="'ngx-mat-input-tel-overlay-backdrop'" > - @if(enableSearch) { - - - } @for(country of preferredCountriesInDropDown; track $index ) { - - } @if(preferredCountriesInDropDown.length) { - - } @for(country of allCountries | search : searchCriteria; track $index ) { - + } + @if (preferredCountriesInDropDown.length) { + + } + @for (country of allCountries | search: searchCriteria; track $index) { + + + } From 252497ff105b011b1f89c200f50891ca68fc9a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Balet?= Date: Thu, 10 Oct 2024 14:13:02 +0200 Subject: [PATCH 3/3] feat: update phone on parent change --- package-lock.json | 12 ++++++------ package.json | 4 ++-- projects/ngx-mat-input-tel/package.json | 4 ++-- .../src/lib/ngx-mat-input-tel.component.ts | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index e92753ce4..df794b931 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ngx-mat-input-tel", - "version": "18.3.1", + "version": "18.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ngx-mat-input-tel", - "version": "18.3.1", + "version": "18.4.0", "dependencies": { "@angular/animations": "^18.2.5", "@angular/cdk": "^18.2.5", @@ -19,7 +19,7 @@ "@angular/platform-browser-dynamic": "^18.2.5", "@angular/router": "^18.2.5", "core-js": "^3.38.1", - "libphonenumber-js": "^1.11.9", + "libphonenumber-js": "^1.11.11", "rxjs": "~7.8.1", "tslib": "^2.7.0", "zone.js": "~0.14.10" @@ -17334,9 +17334,9 @@ } }, "node_modules/libphonenumber-js": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.9.tgz", - "integrity": "sha512-Zs5wf5HaWzW2/inlupe2tstl0I/Tbqo7lH20ZLr6Is58u7Dz2n+gRFGNlj9/gWxFvNfp9+YyDsiegjNhdixB9A==", + "version": "1.11.11", + "resolved": "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.11.11.tgz", + "integrity": "sha512-mF3KaORjJQR6JBNcOkluDcJKhtoQT4VTLRMrX1v/wlBayL4M8ybwEDeryyPcrSEJmD0rVwHUbBarpZwN5NfPFQ==", "license": "MIT" }, "node_modules/license-webpack-plugin": { diff --git a/package.json b/package.json index 0bb83d29b..fcdf516c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-input-tel", - "version": "18.3.1", + "version": "18.4.0", "scripts": { "ng": "ng", "start": "ng serve", @@ -25,7 +25,7 @@ "@angular/platform-browser-dynamic": "^18.2.5", "@angular/router": "^18.2.5", "core-js": "^3.38.1", - "libphonenumber-js": "^1.11.9", + "libphonenumber-js": "^1.11.11", "rxjs": "~7.8.1", "tslib": "^2.7.0", "zone.js": "~0.14.10" diff --git a/projects/ngx-mat-input-tel/package.json b/projects/ngx-mat-input-tel/package.json index d6aacf53d..3c152a73e 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": "18.3.1", + "version": "18.4.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.11.9" + "libphonenumber-js": "^1.11.11" }, "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 c398e1d90..0bb32e464 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 @@ -193,7 +193,7 @@ export class NgxMatInputTelComponent ) { super(_defaultErrorStateMatcher, _parentForm, _parentFormGroup, _ngControl) - _focusMonitor.monitor(_elementRef, true).subscribe((origin) => { + _focusMonitor.monitor(_elementRef, true).subscribe((origin: any) => { if (this.focused && !origin) { this.onTouched() } @@ -404,6 +404,7 @@ export class NgxMatInputTelComponent // } // Value is set from outside using setValue() + this.onPhoneNumberChange() this._changeDetectorRef.markForCheck() }