getaddress-autocomplete
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "getaddress-autocomplete", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "GetAddress.io - Autocomplete plug-in", | ||
@@ -5,0 +5,0 @@ "main": "./dist/getaddress-autocomplete.mjs", |
@@ -11,3 +11,3 @@ Javascript - Autocomplete. | ||
``` | ||
<script src="https://cdn.getaddress.io/scripts/getaddress-autocomplete-1.1.1.min.js"></script> | ||
<script src="https://cdn.getaddress.io/scripts/getaddress-autocomplete-1.1.2.min.js"></script> | ||
``` | ||
@@ -66,2 +66,3 @@ | ||
thoroughfare:'thoroughfare', /* The id of the element bound to 'thoroughfare' */ | ||
town_or_city:'town_or_city',/* The id of the element bound to 'town_or_city' */ | ||
county:'county', /* The id of the element bound to 'county' */ | ||
@@ -102,3 +103,4 @@ country:'country', /* The id of the element bound to 'country' */ | ||
debug:false, /* if true, logs behavior */ | ||
enable_get:true /* if true, retreives address on select */ | ||
enable_get:true /* if true, retreives address on select */, | ||
set_default_output_field_names:true /* if true, defaults output field names to JSON field names*/ | ||
} | ||
@@ -105,0 +107,0 @@ ); |
@@ -38,3 +38,3 @@ import Autocomplete from "./Autocomplete"; | ||
const outputFields = new OutputFields(allOptions.output_fields); | ||
const outputFields = new OutputFields(allOptions.output_fields,allOptions.set_default_output_field_names); | ||
if(!outputFields.formatted_address_0){ | ||
@@ -41,0 +41,0 @@ outputFields.formatted_address_0 = id; |
@@ -38,2 +38,3 @@ import {AutocompleteFilter} from "getaddress-api"; | ||
enable_get=true; | ||
set_default_output_field_names=true; | ||
@@ -83,3 +84,4 @@ constructor(options:IOptions = {}) | ||
suggestion_show_all_class_names?:string[]; | ||
set_default_output_field_names?:boolean; | ||
} | ||
export class OutputFields{ | ||
formatted_address_0:string=""; | ||
formatted_address_1:string="formatted_address_1"; | ||
formatted_address_2:string="formatted_address_2"; | ||
formatted_address_3:string="formatted_address_3"; | ||
formatted_address_4:string="formatted_address_4"; | ||
line_1= "line_1"; | ||
line_2= "line_2"; | ||
line_3= "line_3"; | ||
line_4 = "line_4"; | ||
town_or_city= "town_or_city"; | ||
county= "county"; | ||
country= "country"; | ||
postcode= "postcode"; | ||
latitude= "latitude"; | ||
longitude= "longitude"; | ||
building_number= "building_number"; | ||
building_name= "building_name"; | ||
sub_building_number= "sub_building_number"; | ||
sub_building_name= "sub_building_name"; | ||
thoroughfare= 'thoroughfare'; | ||
locality = "locality"; | ||
district = "district"; | ||
residential = "residential" | ||
formatted_address_0:string; | ||
formatted_address_1:string; | ||
formatted_address_2:string; | ||
formatted_address_3:string; | ||
formatted_address_4:string; | ||
line_1:string; | ||
line_2:string; | ||
line_3:string; | ||
line_4:string; | ||
town_or_city:string; | ||
county:string; | ||
country:string; | ||
postcode:string; | ||
latitude:string; | ||
longitude:string; | ||
building_number:string; | ||
building_name:string; | ||
sub_building_number:string; | ||
sub_building_name:string; | ||
thoroughfare:string; | ||
locality:string; | ||
district:string; | ||
residential:string; | ||
constructor(outputFields:IOutputFields = {}) | ||
constructor(outputFields:IOutputFields = {}, setDefaults:boolean) | ||
{ | ||
if(setDefaults){ | ||
this.setDefaultValues(); | ||
} | ||
for (const prop in outputFields) { | ||
@@ -34,2 +38,29 @@ if (outputFields.hasOwnProperty(prop) && typeof outputFields[prop] !== 'undefined') { | ||
} | ||
private setDefaultValues() | ||
{ | ||
this.formatted_address_0=""; | ||
this.formatted_address_1="formatted_address_1"; | ||
this.formatted_address_2="formatted_address_2"; | ||
this.formatted_address_3="formatted_address_3"; | ||
this.formatted_address_4="formatted_address_4"; | ||
this.line_1= "line_1"; | ||
this.line_2= "line_2"; | ||
this.line_3= "line_3"; | ||
this.line_4 = "line_4"; | ||
this.town_or_city= "town_or_city"; | ||
this.county= "county"; | ||
this.country= "country"; | ||
this.postcode= "postcode"; | ||
this.latitude= "latitude"; | ||
this.longitude= "longitude"; | ||
this.building_number= "building_number"; | ||
this.building_name= "building_name"; | ||
this.sub_building_number= "sub_building_number"; | ||
this.sub_building_name= "sub_building_name"; | ||
this.thoroughfare= 'thoroughfare'; | ||
this.locality = "locality"; | ||
this.district = "district"; | ||
this.residential = "residential"; | ||
} | ||
} | ||
@@ -36,0 +67,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51049
1044
126