Skip to content

Commit

Permalink
feat(project): added readonly input to the search component
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Jan 3, 2020
1 parent 898c17a commit 46acaa1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ everything included in `matGoogleMapsAutocomplete` + the following
| streetNameLabel | `Input()` | string; | `Street` | input label
| streetNumberLabel | `Input()` | string; | `Nr.` | input label
| postalCodeLabel | `Input()` | string; | `PLZ` | input label
| vicinityLabel | `Input()` | string; | `Locality` | input label
| localityLabel | `Input()` | string; | `Locality` | input label
| showVicinity | `Input()` | boolean; | `false` | input label - whether to display the vecinity
| readonly | `Input()` | boolean; | `false` | readonly input
| country | `Input()` | string | string[]; | - | can be used to restrict results to specific groups. Currently, you can use componentRestrictions to filter by up to 5 countries. Countries must be passed as as a two-character, ISO 3166-1 Alpha-2 compatible country code. Multiple countries must be passed as a list of country codes.
| placeIdOnly | `Input()` | boolean | - | can be used to instruct the Autocomplete widget to retrieve only Place IDs. On calling getPlace() on the Autocomplete object, the PlaceResult made available will only have the place id, types and name properties set. You can use the returned place ID with calls to the Places, Geocoding, Directions or Distance Matrix services.
| strictBounds | `Input()` | boolean | - | is a boolean specifying whether the API must return only those places that are strictly within the region defined by the given bounds. The API does not return results outside this region even if they match the user input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@

<form [formGroup]="addressFormGroup" fxFlex fxLayoutGap="10px">
<div fxLayout="row" fxLayoutGap="10px">
<mat-form-field fxFlex="80" [appearance]="appearance" [@animate]="{ value: '*', params: { y: '100%' } }">
<mat-form-field fxFlex="80"
[appearance]="appearance"
[@animate]="{ value: '*', params: { y: '100%' } }">
<mat-label>{{streetNameLabel}}</mat-label>
<input
[readonly]="readonly"
formControlName="streetName"
matInput
required
Expand All @@ -34,6 +37,7 @@
<mat-form-field fxFlex="20" [appearance]="appearance" [@animate]="{ value: '*', params: { y: '100%' } }">
<mat-label>{{streetNumberLabel}}</mat-label>
<input
[readonly]="readonly"
formControlName="streetNumber"
matInput
required
Expand All @@ -46,17 +50,20 @@
<mat-form-field fxFlex="20" [appearance]="appearance" [@animate]="{ value: '*', params: { y: '100%' } }">
<mat-label>{{postalCodeLabel}}</mat-label>
<input
[readonly]="readonly"
formControlName="postalCode"
matInput
required
/>
<!-- <mat-icon color="primary" matSuffix>add_location</mat-icon>-->
<!-- <mat-error>{{ 'msa.contactData.currentAddress.error' | translate }}</mat-error>-->
</mat-form-field>
<mat-form-field *ngIf="showVicinity" fxFlex="auto" [appearance]="appearance"
<mat-form-field *ngIf="showVicinity" fxFlex="auto"
[appearance]="appearance"
[@animate]="{ value: '*', params: { y: '100%' } }">
<mat-label>{{vicinityLabel}}</mat-label>
<input
[readonly]="readonly"
matInput
formControlName="vicinity"
/>
Expand All @@ -65,6 +72,7 @@
<mat-form-field fxFlex="auto" [appearance]="appearance" [@animate]="{ value: '*', params: { y: '100%' } }">
<mat-label>{{localityLabel}}</mat-label>
<input
[readonly]="readonly"
formControlName="long"
matInput
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export class MatSearchGoogleMapsAutocompleteComponent implements OnInit {
@Input()
type?: string;

@Input()
readonly: boolean;

@Input()
disableSearch: boolean;

@Output()
onGermanAddressMapped: EventEmitter<GermanAddress> = new EventEmitter<GermanAddress>();

Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ <h2>Usage</h2>
<mat-search-google-maps-autocomplete appearance="outline"
country="de"
[showVicinity]="true"
[readonly]="true"
(onGermanAddressMapped)="onGermanAddressMapped($event)">
</mat-search-google-maps-autocomplete>
</mat-card-content>
Expand Down

0 comments on commit 46acaa1

Please sign in to comment.