Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added popup container & popup placement selector functionality #391

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ Or this:
[inputId]="my-input-id"
name="phone"
formControlName="phone"
searchCountryPopupContainer="ngx-intl-tel-input"
searchCountryPopupPlacement="bottom left"
></ngx-intl-tel-input>
</form>
```
Expand All @@ -118,7 +120,10 @@ Or this:
| inputId | `string` | `phone` | Unique ID for `<input>` element. |
| selectedCountryISO | `<CountryISO>` | `None` | Set specific country on load. |
| separateDialCode | `boolean` | `false` | Visually separate dialcode into the drop down element. |
| countryChange | `<Country>` | `None` | Emits country value when the user selects a country from the dropdown. |
| countryChange | `<Country>` | `None` | Emits country value when the user selects a country from the dropdown. |
| searchCountryPopupContainer | `string` | `undefined` | A selector specifying the element the popover should be appended to.
| searchCountryPopupPlacement | `string` | `'bottom left'` | Placement of a popover. Accepts: `top`, `bottom`, `left`, `right`
|

## Supported Formats

Expand Down
135 changes: 68 additions & 67 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,70 @@
{
"name": "ngx-intl-tel-input-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build_stats": "ng build --stats-json",
"analyze": "webpack-bundle-analyzer dist/ngx-intl-tel-input-app/stats.json",
"build_lib": "ng build ngx-intl-tel-input",
"copy-license": "cp ./LICENSE ./dist/ngx-intl-tel-input",
"copy-readme": "cp ./README.md ./dist/ngx-intl-tel-input",
"copy-files": "npm run copy-license && npm run copy-readme",
"npm_pack": "npm run copy-files && cd dist/ngx-intl-tel-input && npm pack",
"package": "npm run build_lib && npm run npm_pack",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.2.1",
"@angular/common": "~11.2.1",
"@angular/compiler": "~11.2.1",
"@angular/core": "~11.2.1",
"@angular/forms": "~11.2.1",
"@angular/platform-browser": "~11.2.1",
"@angular/platform-browser-dynamic": "~11.2.1",
"@angular/router": "~11.2.1",
"bootstrap": "^4.5.2",
"core-js": "^3.6.5",
"google-libphonenumber": "^3.2.3",
"intl-tel-input": "^17.0.3",
"jquery": "^3.5.0",
"ngx-bootstrap": "^6.0.0",
"popper.js": "^1.16.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1102.1",
"@angular/cli": "~11.2.1",
"@angular/compiler-cli": "~11.2.1",
"@angular/language-service": "~11.2.1",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"ajv": "^6.10.2",
"eslint": "^7.2.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "~11.2.3",
"prettier": "^2.0.5",
"protractor": "^7.0.0",
"rollup": "^2.22.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "~4.1.5",
"webpack-bundle-analyzer": "^3.9.0"
}
"name": "ngx-intl-tel-input-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build_stats": "ng build --stats-json",
"analyze": "webpack-bundle-analyzer dist/ngx-intl-tel-input-app/stats.json",
"build_lib": "ng build ngx-intl-tel-input",
"copy-license": "COPY .\\LICENSE .\\dist\\ngx-intl-tel-input",
"copy-readme": "COPY .\\README.md .\\dist\\ngx-intl-tel-input",
"copy-files": "npm run copy-license && npm run copy-readme",
"npm_pack": "npm run copy-files && cd dist/ngx-intl-tel-input && npm pack",
"package": "npm run build_lib && npm run npm_pack",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.1.4",
"@angular/common": "~12.1.4",
"@angular/compiler": "~12.1.4",
"@angular/core": "~12.1.4",
"@angular/forms": "~12.1.4",
"@angular/platform-browser": "~12.1.4",
"@angular/platform-browser-dynamic": "~12.1.4",
"@angular/router": "~12.1.4",
"bootstrap": "^5.0.2",
"core-js": "^3.16.0",
"google-libphonenumber": "^3.2.22",
"intl-tel-input": "^17.0.13",
"jquery": "^3.6.0",
"ngx-bootstrap": "^7.0.0",
"popper.js": "^1.16.1",
"@popperjs/core": "^2.9.2",
"rxjs": "~6.5.3",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.1.4",
"@angular/cli": "~12.1.4",
"@angular/compiler-cli": "~12.1.4",
"@angular/language-service": "~12.1.4",
"@types/jasmine": "~3.8.2",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^16.4.10",
"ajv": "^6.9.1",
"eslint": "^7.32.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"ng-packagr": "~12.1.2",
"prettier": "^2.3.2",
"protractor": "^7.0.0",
"rollup": "^2.55.1",
"ts-node": "~10.1.0",
"tslint": "~6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "~4.3.5",
"webpack-bundle-analyzer": "^4.4.2"
}
}
14 changes: 7 additions & 7 deletions projects/ngx-intl-tel-input/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ngx-intl-tel-input",
"version": "3.1.1",
"version": "3.1.3",
"peerDependencies": {
"@angular/common": "8.x - 11.x",
"@angular/core": "8.x - 11.x",
"@angular/forms": "8.x - 11.x",
"google-libphonenumber": "^3.2.3",
"intl-tel-input": "^17.0.3",
"ngx-bootstrap": "^6.0.0"
"@angular/common": "^12.1.4",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i assume there are way too many version changes here, more than are required to get this change to work?

"@angular/core": "^12.1.4",
"@angular/forms": "^12.1.4",
"google-libphonenumber": "^3.2.22",
"intl-tel-input": "^17.0.13",
"ngx-bootstrap": "^7.0.0"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
li.iti__country:hover {
background-color: rgba(0, 0, 0, 0.05);
cursor: pointer;
}
.iti__selected-flag.dropdown-toggle:after {
content: none;
Expand All @@ -15,6 +16,7 @@ li.iti__country:hover {
width: fit-content;
padding: 1px;
border-collapse: collapse;
margin-top: 0;
}
.search-container {
position: relative;
Expand All @@ -36,7 +38,7 @@ li.iti__country:hover {
border: none;
}

.iti input#country-search-box {
.iti__country-dropdown input#country-search-box {
padding-left: 6px;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,75 @@
<div class="iti iti--allow-dropdown"
[ngClass]="separateDialCodeClass">
<div class="iti__flag-container"
<div class="iti iti--allow-dropdown" [ngClass]="separateDialCodeClass">
<div
class="iti__flag-container"
dropdown
[ngClass]="{'disabled': disabled}"
[isDisabled]="disabled">
<div class="iti__selected-flag dropdown-toggle"
dropdownToggle>
<div class="iti__flag"
[ngClass]="selectedCountry?.flagClass"></div>
<div *ngIf="separateDialCode"
class="selected-dial-code">+{{selectedCountry.dialCode}}</div>
[container]="
searchCountryPopupContainer != null
? searchCountryPopupContainer
: '.iti__selected-flag.dropdown-toggle'
"
[placement]="searchCountryPopupPlacement"
[ngClass]="{ disabled: disabled }"
[isDisabled]="disabled"
>
<div class="iti__selected-flag dropdown-toggle" dropdownToggle>
<div class="iti__flag" [ngClass]="selectedCountry?.flagClass"></div>
<div *ngIf="separateDialCode" class="selected-dial-code">
+{{ selectedCountry.dialCode }}
</div>
<div class="iti__arrow"></div>
</div>
<div *dropdownMenu
class="dropdown-menu country-dropdown">
<div class="search-container"
*ngIf="searchCountryFlag && searchCountryField">
<input id="country-search-box"
<div *dropdownMenu class="iti dropdown-menu country-dropdown">
<div
class="search-container"
*ngIf="searchCountryFlag && searchCountryField"
>
<input
id="country-search-box"
[(ngModel)]="countrySearchText"
(keyup)="searchCountry()"
(click)="$event.stopPropagation()"
[placeholder]="searchCountryPlaceholder"
autofocus>
autocomplete="off"
autocorrect="off"
autocapitalize="none"
spellcheck="false"
autofocus
/>
</div>
<ul class="iti__country-list"
#countryList>
<li class="iti__country iti__preferred"
<ul class="iti__country-list" #countryList>
<li
class="iti__country iti__preferred"
*ngFor="let country of preferredCountriesInDropDown"
(click)="onCountrySelect(country, focusable)"
[id]="country.htmlId+'-preferred'">
[id]="country.htmlId + '-preferred'"
>
<div class="iti__flag-box">
<div class="iti__flag"
[ngClass]="country.flagClass"></div>
<div class="iti__flag" [ngClass]="country.flagClass"></div>
</div>
<span class="iti__country-name">{{country.name}}</span>
<span class="iti__dial-code">+{{country.dialCode}}</span>
<span class="iti__country-name">{{ country.name }}</span>
<span class="iti__dial-code">+{{ country.dialCode }}</span>
</li>
<li class="iti__divider"
*ngIf="preferredCountriesInDropDown?.length"></li>
<li class="iti__country iti__standard"
<li
class="iti__divider"
*ngIf="preferredCountriesInDropDown?.length"
></li>
<li
class="iti__country iti__standard"
*ngFor="let country of allCountries"
(click)="onCountrySelect(country, focusable)"
[id]="country.htmlId">
[id]="country.htmlId"
>
<div class="iti__flag-box">
<div class="iti__flag"
[ngClass]="country.flagClass"></div>
<div class="iti__flag" [ngClass]="country.flagClass"></div>
</div>
<span class="iti__country-name">{{country.name}}</span>
<span class="iti__dial-code">+{{country.dialCode}}</span>
<span class="iti__country-name">{{ country.name }}</span>
<span class="iti__dial-code">+{{ country.dialCode }}</span>
</li>
</ul>
</div>
</div>
<input type="tel"
<input
type="tel"
[id]="inputId"
autocomplete="off"
[ngClass]="cssClass"
Expand All @@ -64,5 +81,6 @@
[placeholder]="resolvePlaceholder()"
[attr.maxLength]="maxLength"
[attr.validation]="phoneValidation"
#focusable>
#focusable
/>
</div>
Loading