2.1.6 • Published 4 years ago

dealerlocator-base v2.1.6

Weekly downloads
4
License
Apache License 2....
Repository
github
Last release
4 years ago

Modules

Classes

utils

debounce ⇒

Taken from https://davidwalsh.name/function-debounce

Returns: void

ParamType
funcfunction
waitnumber
immediateboolean

htmlEscape ⇒ htmlString

ParamType
htmlhtmlString

htmlEncode ⇒ htmlString

ParamType
encodehtmlString

DealerLocator

Kind: global class

new DealerLocator()

controller-class, providing functionality used by the ui

DealerLocator.module.exports

Kind: static class of DealerLocator

new module.exports(config)

Creates an instance of DealerLocator. !! 'distance' and 'id' (items of key templateVars in mapOptions) are properties which cannot change their name/key !!

ParamType
configdefaultConfig

DealerLocator.defaultConfig ⇒ Object

returns default parameters for DealerLocator:constructor overwrite it with your settings in DealerLocator:constructor(config)

mapContainer: required resultEl: required resultsContainer: required apiKey: required computeDistanceBetweenPoints: required mapOptions: required urlGenerator: optional hasCluster: optional mapsDataSource: optional {MapsDataSource} mapsDataService: optional {MapsDataService} googleMap: optional {GoogleMap}

Kind: static property of DealerLocator
Access: public

DealerLocator.setData(data) ⇒

calls MapsDataSource to set data if no urlGenerator is passed

Kind: static method of DealerLocator
Returns: void
Access: public

ParamType
dataarray

DealerLocator.setRequestOptions(requestOptions) ⇒

set requestOptions used in MapsDataSource to fetch data requestOptions can contain following keys: method, acceptType, body, formData, transformer

Kind: static method of DealerLocator
Returns: void
Access: public

ParamType
requestOptionsObject

DealerLocator.initializeMap() ⇒ Promise.<undefined>

load mapsAPI and update views with data afterwards

Kind: static method of DealerLocator
Access: public

DealerLocator.showAll() ⇒ Promise.<undefined>

resets all filters, geolocation/radius + properties and displays all tupels cached or to be loaded

Kind: static method of DealerLocator
Access: public

DealerLocator.searchFor(address, resultRadius) ⇒ Promise.<undefined>

geolocating an address or plz, centers map to result and adds radius-filter as well as showing its results

Kind: static method of DealerLocator
Access: public

ParamType
addressstring
resultRadiusnumber

DealerLocator.mapIsLoaded() ⇒ boolean

mapsAPI loaded/ready or not

Kind: static method of DealerLocator
Access: public

DealerLocator.getCurrentLocation() ⇒ google.maps.Latlng

get current center of gmap

Kind: static method of DealerLocator
Access: public

DealerLocator.locateUser(resultRadius, zoom) ⇒ Promise.<(undefined|Object)>

locates client on gmap and sets class-prop this.clientLatLong for later calculations to show marker near client sets zoomlevel of gmap

Kind: static method of DealerLocator
Access: public

ParamType
resultRadiusnumber
zoomnumber

DealerLocator.setMapZoom(zoom) ⇒

set zoom-level of gmap

Kind: static method of DealerLocator
Returns: void
Access: public

ParamType
zoomnumber

DealerLocator.setMaxResults(max) ⇒

set a limit to the result-set

use it before using updateView() to apply the behaviour set it to undefined if no limit is needed

Kind: static method of DealerLocator
Returns: void
Access: public

ParamType
maxnumber

DealerLocator.updateView() ⇒ Promise.<undefined>

updates map and custom-results views, for example after a filter has been applied

Kind: static method of DealerLocator
Access: public

DealerLocator.closeInfoWindow() ⇒

closes currently opened infowindow on gmap

Kind: static method of DealerLocator
Returns: void
Access: public

DealerLocator.addFilterFor(key, value) ⇒ Promise.<undefined>

add filter for property-key and -value

Kind: static method of DealerLocator
Access: public

ParamType
keystring
valueany

DealerLocator.removeFilter(key, value) ⇒ Promise

remove previously added filter-option

Kind: static method of DealerLocator
Access: public

ParamType
keystring
valueany

DealerLocator.addRadiusFilterFor(radius) ⇒ Promise.<undefined>

removes old radius-filter and adds passed radius as new radius-filter

Kind: static method of DealerLocator
Access: public

ParamType
radiusnumber

DealerLocator.removeFilterType(type) ⇒ Promise.<undefined>

reset filter for specific type: radius or property

Kind: static method of DealerLocator
Access: public

ParamType
typestring

GoogleMap

Kind: global class

new GoogleMap()

exposing api's to interact with google.map instance

GoogleMap.module.exports

Kind: static class of GoogleMap

new module.exports(apiKey, mapContainer, hasCluster, hasCustomResults, mapsDataService, resultEl, resultsContainer, configOptions)

ParamType
apiKeystring
mapContainerstring
hasClusterboolean
hasCustomResultsboolean
mapsDataServiceMapsDataService
resultElstring
resultsContainerstring
configOptionsObject

GoogleMap.clientLatLong

Kind: static property of GoogleMap

ParamType
Object.<(lat|lng), number>

GoogleMap.clientLatLong ⇒ google.maps.LatLng

Kind: static property of GoogleMap

GoogleMap.isLoaded ⇒ boolean

Kind: static property of GoogleMap

GoogleMap.markers ⇒ array.<google.maps.Marker>

Kind: static property of GoogleMap

GoogleMap.load() ⇒

initialize gmap api load and callbacks

Kind: static method of GoogleMap
Returns: void
Access: public

GoogleMap.parseInfoWindow(marker, template) ⇒ Promise

parses data and template into google.maps.infowindow

Kind: static method of GoogleMap
Access: public

ParamType
markergoogle.maps.Marker
templatestring

GoogleMap.parseTemplate(templateContainer) ⇒ htmlString

template for popup when clicked on position on gmap !! distance and id are properties which cannot change their name/key !!

Kind: static method of GoogleMap
Access: public

ParamType
templateContainerstring
Object.<(properties.<Object>|id)>

GoogleMap.replaceTemplateVar(tmpl, templateVar, delimiters, properties) ⇒ htmlString

Replaces template vars in passed template. Escapes html to prevent xss and tries to replace html encoded templatevars as well

Kind: static method of GoogleMap
Returns: htmlString - tmpl
Access: public

ParamType
tmplhtmlString
templateVarstring
delimitersarray
propertiesobject

GoogleMap.closeInfoWindow() ⇒

closes currently opened infowindow on gmap

Kind: static method of GoogleMap
Returns: void
Access: public

GoogleMap.setZoom(zoom) ⇒

sets zoom-level of gmap

Kind: static method of GoogleMap
Returns: void
Access: public

ParamType
zoomnumber

GoogleMap.updateView() ⇒ Promise.<undefined>

Kind: static method of GoogleMap
Access: public

GoogleMap.getMarkers() ⇒ Promise.<array.<google.maps.marker>>

generates marker-objects from a dataSource

Kind: static method of GoogleMap
Access: public

GoogleMap.searchFor(address) ⇒ Promise.<any>

searches by address sets this.clientLatLong to result pos

Kind: static method of GoogleMap
Access: public

ParamType
addressstring

GoogleMap._geocode(parameters) ⇒ Promise.<Object>

in preparation of reverse geocoding where user gets located on page load, this location is a latLng and has to be transfered into a location/country

resources: https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse?hl=de https://developers.google.com/maps/documentation/geocoding/intro?hl=de#Viewports

{'address': address} | {'location': latlng}

Kind: static method of GoogleMap
Access: public

ParamType
parametersobject

MapsDataService

Kind: global class

new MapsDataService()

provides logic for MapsDataSource, primarily filtering data

MapsDataService.module.exports

Kind: static class of MapsDataService

new module.exports(mapsDataSource, computeDistanceBetweenPoints)

Creates an instance of MapsDataService.

ParamType
mapsDataSourceMapsDataSource
computeDistanceBetweenPointsfunction | undefined

MapsDataService.maxResults

Kind: static property of MapsDataService

ParamType
maxnumber

MapsDataService.getItems() ⇒ Promise.<undefined>

returns filtered data

Kind: static method of MapsDataService
Access: public

MapsDataService.setData(data) ⇒

prefills data of maps data source if no urlGenerator is passed

Kind: static method of MapsDataService
Returns: void
Access: public

ParamType
dataarray

MapsDataService.addFilterFor(propName, propValue) ⇒

add filter-option, does not apply them to data yet

Kind: static method of MapsDataService
Returns: void
Access: public

ParamType
propNamestring
propValueany

MapsDataService.removeFilterFor(propName, propValue) ⇒

remove a specific previously added filter-option, does not apply to data yet

Kind: static method of MapsDataService
Returns: void
Access: public

ParamType
propNamestring
propValueany

MapsDataService.addRadiusFilterFor(center, radius) ⇒

add filter for radius search

Kind: static method of MapsDataService
Returns: void
Access: public

ParamType
centernumber
radiusnumber

MapsDataService.removeFilterType(type) ⇒

remove filter of type "radius" or "property"

Kind: static method of MapsDataService
Returns: void
Access: public

ParamType
typestring

MapsDataService.resetFilters() ⇒

reset all previously applied filters

Kind: static method of MapsDataService
Returns: void
Access: public

MapsDataService.ensureDetailsFor(ids) ⇒ Promise.<array>

use to check if tuple/s has/have extended properties already loaded, if not it´ll be loaded

Kind: static method of MapsDataService
Access: public

ParamType
idsany

MapsDataService.hasActiveRadiusFilter() ⇒ boolean

checks if any of the active filters is a radius filter, return true or false

Kind: static method of MapsDataService
Access: public

MapsDataSource

Kind: global class

new MapsDataSource()

loads and caches data for maps

MapsDataSource.module.exports

Kind: static class of MapsDataSource

new module.exports(urlGenerator, requestOptions)

ParamType
urlGeneratorfunction
requestOptionsObject

MapsDataSource.data ⇒ null | array

Kind: static property of MapsDataSource
Access: public

MapsDataSource.requestOptions

requestOptions can contain following keys: method, acceptType, body, formData, transformer

Kind: static property of MapsDataSource
Access: public

ParamType
requestOptionsObject

MapsDataSource.mergeData(data) ⇒ null | array

Merges the given array into the current data

Kind: static method of MapsDataSource
Access: public

ParamType
dataarray

MapsDataSource.setData(data) ⇒

Kind: static method of MapsDataSource
Returns: void
Access: public

ParamType
dataarray

MapsDataSource.fetch() ⇒ Promise.<array>

Fetch all locations. Will use cached data on subsequent calls.

Kind: static method of MapsDataSource
Access: public

MapsDataSource.ensureDetailsFor(ids) ⇒ Promise.<array>

Ensures that all given id's contain all detail information. This may trigger a api request.

Kind: static method of MapsDataSource
Access: public

ParamType
idsarray
2.1.6

4 years ago

2.1.4

4 years ago

2.1.5

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.4

4 years ago