0.6.0The main entry point for all other API elements
Extends WithLang, WithDumpRestore, Base
(Object)
configuration object
| Name | Description |
|---|---|
options.projectId String
|
unique id of the project |
options.dao Object
|
optional Data Access Object providing all DAOs for managed classes (IconSet, DataSets, Dictionaries, MediaSets); if this parameter defined then it is used to build instead of default ClientDao |
options.uri String
|
URI of the GraphQL endpoint; this parameter is used
only if the
options.dao
parameter is not defined
|
options.credentials (Object | String)
|
client credentials; used only if
the
options.dao
is not defined
|
options.hoverTimeout Integer
|
timeout used to cancel hovered elements |
options.enableHoverSelected Boolean
|
enables hovering effects for
already selected features; by default
false
|
DataSetGroup instance associated with this object.
Index of all created Dictionary instances.
Type: Object
Data Access Object containing references to all other DAOs (for DataSets, IconSets, MediaSets, Dictionaries)
Type: Object
Asynchronous method destroying this class.
Creates and returns a new DataSet object. Returns a promise resolving the DataSet. See also: #getDataSet, #deleteDataSet
(Object)
parameters used to create the DataSet
| Name | Description |
|---|---|
options.dataSetId String
|
mandatory unique identifier of the DataSet to create |
options.fields Object
|
mapping of fields between original properties and properties returned by VectorTiles |
options.load Boolean
|
[true]
if this flag is
true
then the DataSet
automatically loads its values
|
Promise<DataSet>:
with the resolved DataSet object
Returns a DataSet corresponding to the specified identifier. See also: #newDataSet, #deleteDataSet.
(String)
unique identifier of the DataSet
DataSet:
the data set corresponding to the given ID or null if
no such DataSet was found
Deletes a DataSet corresponding to the specified identifier. See also: #newDataSet, #getDataSet. This method rises an exception if there is no such a DataSet for the given identifier.
(String)
unique identifier of the DataSet to destroy
Creates and returns a new IconSet object. Returns a promise resolving the IconSet. See also: #getIconSet, #deleteIconSet
Promise<IconSet>:
with the resolved IconSet object
Returns a IconSet corresponding to the specified identifier. See also: #newIconSet, #deleteIconSet.
(String)
unique identifier of the IconSet
IconSet:
the data set corresponding to the given ID or null if
no such IconSet was found
Deletes a IconSet corresponding to the specified identifier. See also: #newIconSet, #getIconSet. This method rises an exception if there is no such a IconSet for the given identifier.
(String)
unique identifier of the IconSet to destroy
Creates and returns a new MediaSet object. Returns a promise resolving the MediaSet. See also: #getMediaSet, #deleteMediaSet
Promise<MediaSet>:
with the resolved MediaSet object
Returns a MediaSet corresponding to the specified identifier. See also: #newMediaSet, #deleteMediaSet.
(String)
unique identifier of the MediaSet
MediaSet:
the data set corresponding to the given ID or null if
no such MediaSet was found
Deletes a MediaSet corresponding to the specified identifier. See also: #newMediaSet, #getMediaSet. This method rises an exception if there is no such a MediaSet for the given identifier.
(String)
unique identifier of the MediaSet to destroy
Creates and returns a new Dictionary object. Returns a promise resolving the Dictionary. See also: #getDictionary, #deleteDictionary
Promise<Dictionary>:
with the resolved Dictionary object
Returns a Dictionary corresponding to the specified identifier. See also: #newDictionary, #deleteDictionary.
(String)
unique identifier of the Dictionary
Dictionary:
the data set corresponding to the given ID or null if
no such Dictionary was found
Deletes a Dictionary corresponding to the specified identifier. See also: #newDictionary, #getDictionary. This method rises an exception if there is no such a Dictionary for the given identifier.
(String)
unique identifier of the Dictionary to destroy
Utility method resolving local paths.
(any
= '')
The global namespace for this package.
Classes defining main functionality of DataSets (like search, results loading, query building, autocompletion, statistics loading etc)
Classes defining main functionality of DataSets (like search, results loading, query building, autocompletion, statistics loading etc)
This class is main entry point to work with Data Sets. It manages search queries, statistics for search results, loaded search results and currently selected items.
Extends WithFields, WithReload, WithDao, Base
// Create a new DataSet instance. Note that the Data Access Object (the "dao"
// field) provides all required methods to call the server.
const dataSet = new DataSet({
dao : new DataSetDao({ ... }),
daoProps : { projectId: 'myproject' },
lang : 'fr',
fields : { guid : 'guid', name : 'properties.name', city : 'properties....'}
})
// Launch the search request
const data = await dataSet.request
// Set the language to "fr"
.setLang('fr')
// We want to search by the "3d" keyword in the "q" index.
// Currently applyed language is "fr", so the query will be bulid for the
// "q__fr" index.
.addFulltext('q', '3d');
// Add also filtering by enumerated fields: we want to search only in
// companies.
.addFilter('type', 'company');
// Suggest full-text terms for the text mask "eng"
// (like "engine", "engineer"...).
.addMask('q', 'eng');
// Now we can explore the results of the search operation:
console.log('Results: ', data);
// The same values are available using individual DataSet fields:
```
* dataSet.stats (SearchResultsStats) - contains information about
all results matching to the applied search criteria
* dataSet.results (SearchResults) - contains paginated search results
visible in the currently applied geographical bounding box.
It has the following useful fields: items, pageIdx, pageNumber, etc
* dataSet.selected (SelectedItem) - contains information about the currently
selected item:
- guid: ID of the selected item
- item: the selected object itself; this field is null if the selected
item do not match the applied search criteria
- position: absolute position of the selected item in the results list (
it takes into account the currently applied orders)
* dataSet.suggestions (Suggestions) - contains suggestions for
text tokens; it is used to get correct tokens for full-text searches.
The returned suggestions are contained in items matching to the currently
applied search criteria
* dataSet.filters (FilterStats) - contains statistics about filter terms
with the corresponding number of matching results
```
Statistics about search results.
Type: SearchResultStats
Currently loaded items matching to search query.
Type: SearchResults
Instsance managing currently selected item.
Type: SelectedItem
Search suggestions
Type: Suggestions
Statistics about applied filters.
Type: FilterStats
Promise allowing to wait the end of all opertions changing the state of this DataSet.
Type: Promise
Returns JSON representation of loaded data associated with this instance
Object:
JSON representation of data loaded by this DataSet
Request instance used to update search criteria. The EV_APPLY_REQUEST intent is used to re-launch the loading operations.
Type: DataSetRequest
Sets a new request and reloads everything (results, stats, selected item etc) corresponding to the specified request. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied query is equals to the given one.
Emits the EV_LOAD intent.
(Object)
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
the search query |
options.bbox Bbox
|
geographical bounding box |
options.masks SuggestionMasks
|
optional suggestions masks |
options.orderBy Array<String>
|
list of fields to order results |
options.lang String
|
the language to apply |
options.fields Object
|
new fields mapping |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
Intent:
true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
This class manages paginated search results. It loads subset of items matching to the currently applied search criteria using the specified page index, page size and orderBy parameter.
Extends WithOrderBy, SearchResultsStats
(Object)
configuration object
| Name | Description |
|---|---|
options.dao Object
|
mandatory Data Access Object providing required methods to load data |
options.dao.loadResultsStats Function
|
mandatory function loading stats about results matching to the query and bounding box |
options.dao.loadResults Function
|
mandatory function loading the specified sub-set of items corresponding to the query within the specified bounding box |
options.pageSize Number
|
size of the result pages (number of items loaded at once) |
Mandatory DAO methods
The initial offset of the result page. This offset is defined by the currently selected page and the page size.
Type: Integer
The number of items to load in the current page. It can be less or equals to the size of the page.
Type: Integer
Total number of pages in search results. This is a calculated field.
Type: Integer
Index of the current result page.
Type: Integer
Sets a new page index. This method returns an intent allowing to wait the results loading. This method calls the SearchResults.load method.
(Integer)
index of the page to load
Intent:
an intent (Promise) returning control when this method
finishes results loading
Size of result pages - maximal number of elements loaded at once from the server.
Type: Integer
Sets a new size of the result page. Returns an intent. This method calls the SearchResults.load method.
(Integer)
new page size
Intent:
notifies that the size of the page is changing
Select a page correponding to the specified position in the result list. This method calls the SearchResults.load method.
(Integer)
absolute position in the result list
(any
= false)
Loads search results corresponding to the specified query, geographical bounding box and to the givent order parameter. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied query and bbox not change.
Emits the EV_LOAD intent.
(Object
= {})
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
the search query |
options.bbox Bbox
|
the geographical bounding box filtering search results |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
options.orderBy Array<String>
|
an array of fields used to order results; by default it is an empty array |
options.position Integer
|
optional absolute position in the result list; if this parameter is defined then the results are loaded for the page corresponding to this position; otherwise results are loaded from the page corresponding to the #pageIdx |
options.pageIdx Integer
|
optional page to load; this parameter is taken into account only if the "position" parameter is not defined |
Intent:
defining the end of the loading process; this intent
returns true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
This class manages statistics for DataSet search results
Extends WithSearchQueryAndBbox, WithDao, WithReload, Base
Mandatory DAO methods
Returns an object with all common properties used by the DAO to call methods
Type: Object
Sets a new query and loads statistics about results corresponding to the specified query. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied query is equals to the given one.
Emits the EV_LOAD intent.
(Object)
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
the search query |
options.bbox Bbox
|
geographical bounding box associated with this search |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
Intent:
true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
Returns the total number of results corresponding to the currently applied query.
Type: Int
This class manages selected items and their loading
Extends WithSearchQueryAndBbox, WithOrderBy, WithDao, WithReload, Base
Data Access Object mandatory methods
Sets a new GUID and reloads selected item. If the selected item does not match the currently applied search criteria then the "item" field returns "null". This method updates the GUID of the selected item and tries to load it using the currently applied search criteria and order parameters.
(String)
unique identifier of the selected feature
(any)
optional information associated with this selection
defining who initializes this selection
Intent:
allows to wait till the end of the loading operation
Additional information associated with this selection. It can be used to identify who initiates this selection.
Type: any
The currently selected item. If the element with the sepecified GUID does not matches to the currently applied search criteria then this field is "null".
Type: Object
Position of the selected item in the search result list.
Type: Int
Sets a new query and geographical bounding box then loads the selected item. If the selected item does not match the currently applied search criteria then the "item" field returns "null". Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied query is equals to the given one.
Emits the EV_LOAD intent.
(Object
= {})
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
object containing the search query |
options.bbox Bbox
|
geographical bounding box to check if the selected item fits within |
options.guid String
|
GUID of the selected item; if this parameter is not defined then already applied GUID is used |
options.origin any
|
additional information associated with this selection; it can be used to identify who initiates this selection |
options.force Boolean
|
force results reloading even if the search query nor guid were not changed; by default this flag is "false" |
options.orderBy Array<String>
|
an array of fields used to order results; by default it is an empty array |
Intent:
defining the end of the loading process; this intent
returns true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
Reloads selected item using the currently applied search parameters, selected GUID and fields to order results.
Emits the EV_LOAD_SELECTED_ITEM intent.
Intent:
This class manages information related to Vector Tiles for a specific DataSet (like tilesUrls).
Extends WithSearchQuery, WithFields, WithDao, WithReload, Base
(Object)
configuration object
| Name | Description |
|---|---|
options.cluster Boolean
|
optional flag defining if points should be clustered in the returned vector tiles |
options.lang String
|
mandatory language; used to define vector tile properties |
options.fields Object
|
mandatory fields mapping; used to define vector tile properties |
options.dao Object
|
mandatory Data Access Object providing required methods to load data |
options.dao.loadTilesUrl Function
|
mandatory function loading MapTiles |
options.dao.loadClusterInfo Function
|
mandatory function loading information about the currently selected clusters |
Sets a new search query and calls the #load method. Internally it calls the MapTiles#load method.
(SearchQuery)
search criteria to update
(Boolean)
if this flag is true then new MapTiles will
be loaded even if the given query is the same as the previous one
Intent:
allowing to wait the end of the loading process
Flag showing if VectoTiles should contain clustered results or individual points. This flag makes sense only for Point geometry.
Type: Boolean
Sets the cluster flag. Internally it calls the MapTiles#load method.
(Boolean)
this flag defines if points in vector tiles should
clustered or not
Intent:
allowing to wait the end of the loading process
Transforms a full GeoJSON feature to the format acceptable by the MapBoxGL map. The resulting GeoJSON contains simplified properties in the form of key/value pairs. To perform this transformation the WithFields.selectFields method is used.
(Object)
the original GeoJSON feature
Object:
resulting GeoJSON feature with simplified properties (simple
key/value pairs)
Sets a new search query and loads MapTiles. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied queries are equals to the new ones.
Emits the EV_LOAD intent.
(Object)
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
search query |
options.lang String
|
applied language; vector tiles will contain properties corresponding to this language |
options.fields Object
|
fields mapping; vector tiles will contain properties defined by this mapping |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
(Boolean)
the flag defining if Points returned by vector
tiles are clustered or not
(Object)
the selected cluster object
Intent:
defining the end of the loading process; this intent
returns true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
Identifier of the selected cluster
Type: Integer
List of child GeoJson features for the currently selected cluster. Note
that features from this list contains "mapped" properties as defined
by the selectFields methods in the WithFields mixin.
If no cluster selected and loaded then this field contains an empty array.
This class manages full-text token suggestions matching to the specified queries and suggestion masks
Extends WithSuggestionMasks, WithSearchQuery, WithReload, WithDao, Base
Mandatory DAO methods
Sets a new suggestion mask and calls the #load method.
(SuggestionMasks)
contains masks used to load suggestions
(Boolean)
if this flag is true then new suggestions will
be loaded even if the given search query and masks are the same as the
previous ones
Intent:
allowing to wait the end of the loading process
Sets a new search query and masks and calls the #load method.
(SearchQuery)
search query
(Boolean)
if this flag is true then new suggestions will
be loaded even if the given query and masks are the same as the previous ones
(SuggestionMasks)
for these text masks new suggestions
should be loaded
Intent:
allowing to wait the end of the loading process
Sets a new search query and masks and loads suggestions. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied queries are equals to the new ones.
Emits the EV_LOAD intent.
(Object
= {})
parameters for this method
| Name | Description |
|---|---|
options.masks SuggestionMasks
|
object containing suggestion masks |
options.query SearchQuery
|
object defining the applied search criteria |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
Intent:
defining the end of the loading process; this intent
returns true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
SuggestionMasks is an object containing field names with the corresponding text masks.
Type: Object
SearchQuery is defined as an array of operations.
Type: Array
Bounding box is an array of [south, west, north, east] geographical coordinates.
Type: Array
This class synchronizes interactions between DataSets. It allows to have just one hovered / selected feature between DataSets from the same group. To set a feature hovered on the map the DataSetGroup#setHovered method should be used. Hovered features from lists should be defined using the DataSetGroup#setFullHovered method - this method selects only some property fields and transforms the initial object to the same format as data coming from map vector tiles. To manage selected features the DataSetGroup#setSelected method should be used.
Extends Base
(Object)
configuration object
| Name | Description |
|---|---|
options.keyPrefix String
|
prefix used to generate unique feature keys |
options.enableHoverSelected Boolean
|
enables hovering effects for
already selected features; by default
false
|
options.hoverTimeout Integer
|
timeout defining how long hover effects (like popup or style changes) should last when the mouse moved out of a layer feature |
Timeout defining how long hover effects (like popup or style changes) should last when the mouse moved out of a layer feature.
Type: Integer
This flag is used to enable hovering effects for selected items.
Type: Boolean
Returns information about a hovered feature with the following fields:
dataSetId: identifier of the DataSetdataSet: the DataSet instance managing the hovered featurefeature: the hovered featurefeatureKey: the unique key of the hovered featureisCluster : boolean flag showing if the hovered feature is a cluster
If there is no hovered features then this method returns an empty object.Object:
the information about the hovered features
Information about the currently selected feature. If there is no selected features then this field is an empty object. If there are selected features then this object has the following fields:
dataSetId: identifier of the DataSetdataSet: the DataSet instance managing the selected featurefeature: the selected featurefeatureKey: the unique key of the selected featureisCluster : the flag showing if the selected feature is a clusterObject:
the information about the selected feature
Removes currently applied selection.
Returns a unique key for the given feature. For features representing
map clusters the returned key contains the cluster_id property.
For other features the key contains the guid property.
Otherwise this method returns null.
(Object)
the GeoJSON feature
String:
the unique key of the feature
This class manages statistics for DataSet filters. The results represents filter keys with the corresponding number of features matching to these fiters.
Extends WithSearchQuery, WithDao, WithReload, Base
(Object)
configuration object
| Name | Description |
|---|---|
options.dao Object
|
mandatory Data Access Object providing required methods to load data |
options.dao.loadIndexes Function
|
mandatory function loading list of all indexes |
options.dao.loadFitersStats Function
|
mandatory function loading stats about filters (about terms used in simple indexes) |
Mandatory DAO methods
Returns an object with all common properties used by the DAO to call methods
Type: Object
Returns a list of filter terms with the corresponding number of results matching to this term. Each object in the returned list has the following fields:
value: string filter valuecount: number of results matching to this term(String)
name of the filter
Array<Object>:
Sets a new query and loads filters statistics. Forces re-loading if the specified "force" flag is true; otherwise do nothing if the already applied query is equals to the given one.
Emits the EV_LOAD intent.
(Object)
parameters for this method
| Name | Description |
|---|---|
options.query SearchQuery
|
the search query |
options.force Boolean
|
force results reloading even if the search query was not changed; by default this flag is "false" |
Intent:
true if the results were reloaded; false if the search
query was not changed and nothing was reloaded
Mixins are functions extending the provided type and returning a new class with additional methods and fields.
Type: Function
Base:
a new class extending the specified type with additional
methods and fields
// Mixin definition:
function HelloMixin(Type = class{}) {
return class extends Type {
sayHello(name) {
console.log(`Hello '${name}'!`);
}
}
}
// Mixin usage
// Define the first type using this mixin: simple use case without explicit parents.
class FirstTypeWithHello extends HelloMixin() {
...
}
class ParentBase { ... }
// Second type using this mixin. This class extends the `ParentBase` and
// inject additional methods provided by the `HelloMixin`.
class SecondTypeWithHello extends HelloMixin(ParentBase) {
...
}
// Here both types, the `FirstTypeWithHello` and `SecondTypeWithHello`
// have their own `sayHello(name)` methods:
const a = new FirstTypeWithHello();
const b = new SecondTypeWithHello();
a.sayHello('A'); // prints "Hello 'A'!"
b.sayHello('B'); // prints "Hello 'B'!"
This mixin adds usage of Data Access Object (DAO) to the underlying types.
Type: Mixin
This mixin provides access to object fields taking into account the currently applied language. It gives a simplified "view" of objects.
Type: Mixin
Extends WithLang
```
const FieldsSelector = WithFields(class {})
const selector = new FieldsSelector({
lang : "fr",
fields : {
"name" : "properties.name", // the "properties.name" is mapped to "name"
"city" : "properties.address.city"
}
});
const object = {
'guid': "...",
'properties' : {
...
'address' : {
'city::fr' : 'Londres',
'city::en' : 'London'
}
'name::fr' : 'Foo Bar (French Name)',
'name' : 'Foo Bar (Default Name)',
}
};
let result = selector.selectFields(object);
```
For the currently applied language ("fr") the resulting object would be:
`{ 'city' : 'Londres', 'name' : 'Foo Bar (French Name)' }`
To get the english version of the simplified object:
```
selector._setLang('en');
result = selector.selectFields(object);
```
The resulting object is:
```{ 'city' : 'London', 'name' : 'Foo Bar (Default Name)' }```
Note that the 'name' field contains the default name because there is no
english-specic version of this field in the original object.
This mixin defines language-specific fields for the main class.
Type: Mixin
```
const MyType = WithLang(class {})
const obj = new MyType({ lang : "fr" });
assert(obj.lang, 'fr');
assert(obj.defaultLang, 'fr');
```
Select translated fields from the given object and returns a simplified
version of the object. The fields parameter defines mapping between
original properties and the corresponding field names in the resulting
object.
(Object
= {})
the original object from which the translated fields
should be selected.
(Object)
optional fields mapping containing paths to the
original properties as keys and the corresponding field names as values;
if this parameter is not defined then the
WithFields.fields
is
used instead.
Object:
a new simplified version of the object where property
names are defined by the
fields
mapping and the corresponding
values contain translated version of properties from the original object.
class MyType extends Base.withMixins(WithLang) {}
const m = new MyType({ lang : 'fr' });
const obj = {
guid : 'foobar',
properties : {
'title' : 'Hello', // Default title used for all languages
'title::fr' : 'Bonjour', // French title
'description::en' : 'Short description', // English description
'description::fr' : 'Description courte', // French description
// No default descriptions
}
}
// Fields mapping.
const fields = {
'guid' : 'guid',
'properties.title' : 'title',
'properties.description' : 'descr'
};
// Select fields for the currently applied language - French in this case
let result = m.selectFields(obj, fields);
console.log(result);
// The result is :
// { guid:'foobar', title:'Bonjour', descr:'Description courte' };
// Change the language to English
m._setLang('en');
result = m.selectFields(obj, fields);
console.log(result);
// The result is :
// { guid:'foobar', title:'Hello', descr:'Short description' };
// Change the language to Ukranian
m._setLang('ua');
result = m.selectFields(obj, fields);
console.log(result);
// The result is :
// { guid:'foobar', title:'Hello', descr:undefined };
// Note that the default title is used in this case
// but there is no descriptions.
Selects one translated field from the specified object.
any:
the translated field of the object
class MyType extends Base.withMixins(WithLang) {}
const m = new MyType({ lang : 'fr' });
const obj = {
guid : 'foobar',
properties : {
'title' : 'Hello', // Default title used for all languages
'title::fr' : 'Bonjour', // French title
'description::en' : 'Short description', // English description
'description::fr' : 'Description courte', // French description
// No default descriptions
}
}
// Select fields for the currently applied language - French in this case
console.log(m.selectField(obj, 'properties.title'));
// The result is: 'Bonjour'
console.log(m.selectField(obj, 'properties.description'));
// The result is: 'Description courte'
// Change the language to English
m._setLang('en');
console.log(m.selectField(obj, 'properties.title'));
// The result is: 'Hello'
console.log(m.selectField(obj, 'properties.description'));
// The result is: 'Short description'
// Change the language to Ukranian
m._setLang('ua');
console.log(m.selectField(obj, 'properties.title'));
// The result is: 'Hello'; it is the default property value
console.log(m.selectField(obj, 'properties.description'));
// The result is: undefined
// For this language there is no descriptions.
// There is no default description neither.
This mixin defines fields used to order search results
Type: Mixin
This mixin manages geographical bounding boxes.
Type: Mixin
Extends WithSearchQuery
This mixin provides access to search queries fields.
Type: Mixin
A SearchQuery object applied to get suggestions
Type: SearchQuery
Sets a new search query and returns true if the new query is different
from the previous one.
(SearchQuery)
new query to set
This mixin provides access to suggestion masks.
Type: Mixin
SuggestionMasks object applied to get suggestions
Type: SuggestionMasks
Sets new suggestion masks and returns true if new masks are different
from the previous ones.
(SuggestionMasks)
an object containing suggestion masks
for various indexes (keys are index names, values are lists of masks);
Contains keys of events used by DataSet-related classes.
Request fields were changed See DataSetRequest class.
Request changes were applied See DataSetRequest class.
Notifies about the loading process. See SelectedItem, SearchResults, SearchResultsStats, MapTiles and Suggestions classes.
Loading search results statistics See SearchResultsStats class.
Loading of a selected item. See SelectedItem class.
New suggestions loading. See Suggestions class.
DataSet loading cluster info - all children of a specific cluster. See MapTiles class.
Load search results from the currently specified page See SearchResults class.
A new DataSet is removed from the group. See DataSetGroup class.
A new item from a group is hovered. See DataSetGroup class.
A new feature from a group was selected. See DataSetGroup class.
This is an utility class containing methods for building various search criteria such as query, geographical bounding boxes used to filter search results and for fulltext suggestion masks.
fulltext: fulltext index names with the currently applied query tokens;filters: basic index names with applied valueslang: currently applied language; this language is used to build
names of full-text indexes in queries and for suggestion masksmasks: contains names of logical fulltext indexes with the corresponding
tokens used to return suggestionsThe fulltext and filters fields are used to build the query in the
resulting request.
Full-text search requests are produced for language-specific indexes.
To deduce the full name of a full-text index the basic index name is combined
with the currently applied language. For example for the index q and the
language fr the real complete index name is q__fr. So if we have the
full text search criteria { q : ['dev'] } and the current language is fr
then the build search query is ['match', 'q__fr', 'dev'].
Extends WithDumpRestore, Base
(Object)
configuration object
| Name | Description |
|---|---|
options.fulltext Object
|
names of full text indexes with associated search tokens |
options.filters Object
|
names filter indexes with associated values used to search results |
options.masks Object
|
currently applied suggestions masks; keys correspond to index names and values are lists of tokens; these tokens are used to return suggestions |
options.bbox Bbox
|
currently geographical bounding box; this value is used to get features only from this geographical area |
options.lang String
|
currently applied language; this value is used to re-define exact name of indexes |
options.pageSize String
|
size of result pages |
options.pageIdx String
|
current result page |
options.orderBy Array<String>
|
ordering fields |
options.selectedGuid String
|
GUID of the item to select |
```
options = {
textIndexes : ['q', 'tags'], // Name of full-text indexes used in the DataSet
fulltext : { q : ['artificial', 'intelligence'] },
filters : { type : ['laboratory'] },
masks : { q : ['dev'] }, // Used to produce suggestions for these tokens
lang : 'fr',
orderBy: ['properties.title'],
pageSize : 10,
pageIdx : 1,
}
```
will generate the following request object:
```
{
query : ['all',
['match', 'q__fr', 'artificial', 'intelligence'],
['match', 'type', 'laboratory'],
],
masks : {
'q__fr' : ['dev']
},
lang : 'fr'
}
```
Applies the underlying request changes. Basically this method allows to notify all registered listeners that the process of the request creation is finished and the resulting request can be used to perform searches. Fires the EV_APPLY_REQUEST event.
Intent:
Sets a new ordering fields.
(any)
DataSetRequest:
this instance
Currently applied results page
Type: Integer
Sets a new results page.
Type: Integer
(any)
DataSetRequest:
this instance
Currently applied result page size
Type: Integer
Sets a new results page size.
Type: Integer
(any)
DataSetRequest:
this instance
Sets a new language.
Type: String
(any)
DataSetRequest:
this instance
Sets a new bounding box and returns reference to this instance.
(Bbox)
a new bbox to set
DataSetRequest:
this instance
Sets a new GUID for a selected item
(String)
a new GUID to set
DataSetRequest:
this instance
Removes the selection from this request
DataSetRequest:
this instance
The JSON representation of this request. It contains search query, language, geographical bounding box, suggestion masks, page idexes and size, GUID of the selected item etc
Type: Object
Filters object containing index keys with the corresponding values to search in these indexes.
Type: Object
Toggle filter values for the specified index - if a search value exists in the list of searched tokens then it is removed; it is added if such a value is not defined for the index.
Replaces existing suggestion masks by the new one. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Adds the specified suggestion mask to the existing ones. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Toggles the specified suggestion mask in the request. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Object containing index names with the corresponding full text queries
Type: Object
Replaces existing full text search the new one. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Adds the specified fulltext mask to the existing ones. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Toggles the specified fulltext query in the request. Checks that the specified index key exists in the global list of indexes (see the #textIndexes field).
Creates a new copy of this instance.
DataSetRequest:
Icons management
Icons management
Icons, glyphs and css class management.
Extends Base
URL path giving access to the CSS stylesheet defining classes provided by this iconset.
Type: String
Name of the MapBox glyph font corresponding to this icon set. It should be used to reference icon glyphs in MapBox GL styles.
See also:
Type: String
Contains keys of events used by IconSet-related classes.
Media management
Media management
Manages various media items and associated metadata
Extends Base
Returns a list of media objects corresponding to the specified key and type. If there is no type defined then all medias for the specified key are returned. The resulting media objects contains URIs.
(any)
(any)
Contains keys of events used by MediaSet-related classes.
Management of enumerted values (dictionaries)
Management of enumerted values (dictionaries)
Dictionaries management.
Extends Base
Contains keys of events used by Dictionary-related classes.
Notifies that a Dictionary instance is destoroyed.
Notifies that a Dictionary instance is loaded
Commonly used classes
Commonly used classes
Common super-class for all API types.
Extends WithEvents()
(Object
= {})
contains parameters for this class.
Returns a new static extension of this type with the given mixins.
(...Function)
list of mixin functions extending this type
// Mixin definition
function MyMixin(Type) {
return class extends Type {
sayHello(name) {
console.log(`Hello ${name}!`);
}
}
}
// Base to extend
class MyBase extends Base.withMixins(MyMixin) {
...
}
// Usage of mixed-in methods:
const obj = new MyBase();
obj.sayHello('John');
// > Hello John!
Unregisters all handlers added to this class using the #register method.
Asynchronous method initializing this class.
Asynchronous method destroying this class. By default calls all registration functions registred with the #initialize method.
Returns option value corresponding to the specified key. If this value is a function then executes it and returns the execution result.
(String)
options key
(Object
= {})
parameters to call function defined in options
with the specified name
any:
the options value for the given key or the execution result
if this value is a function
Delegates all errors notifications from children to this class.
(...any)
Intents are Promises used as events. It allows to notify about begin and ends of asynchronous processes.
Type: deferred
This object contains a set of methods to use as Mixins for other classes working with intents.
Creates and returns a new intent with the specified options. An intent is a defererred object - a newly created Promise instance with exposed "resolve", "reject", "end" and "done" methods. It also has the "handled" flag showing if the intent was already resolved or not.
(String)
key of the intent
(Object
= {})
an object containing parameters to add
to the newly created intent
Intent:
an intent with the specified key and parameters
Creates a new intent, delivers it to all listeners and executes the given action after that. Note that the action is executed after the intent was delivered to all listeners.
(any)
(Object)
optional intent parameters
| Name | Description |
|---|---|
options.key String
|
of the key of the intent to create |
(Function)
optional action to execute; if this action
is not defined then the returned intent will be not resolved
Intent:
corresponding to the specified parameters
Creates and returns a "deferred" object - a newly created Promise instance with exposed "resolve", "reject", "end" and "done" methods. It also has the "handled" flag showing if the intent was already resolved or not. After promise resolving its results are available in the "result" and "error" fields.
(Function
= ()=>{})
method to invoke if the registered handlers rises errors
Deferred objects are newly created Promise instances with exposed "resolve", "reject" methods. The deferred object created and returned by the newDeferred method.
// A basic deferred object can be created in the following way:
let yes, no, deferred = new Promise((y, n) => (yes=y,no=n));
defered.resolve = yes; deferred.reject = no;
...
Error returned by this deferred object. By default it is undefined.
Type: any
Result returned by this deferred object. By default it is undefined.
Type: any
This method resolves this promise with the specified value.
(any)
the resulting value for this promise
This method resolves this promise with the specified error.
(any)
the error which used to resolve this promise
Finalizes the promise with the specified error or the resulting value.
(any)
the error used to resolve the promise; if it is not defined
(or null) then this promise will be resolved with the resulting value.
(any)
the resulting value used to resolve the promise; it is
taken into account only if the error is not defined.
Mixin function adding events handling to the specified type.
(any)
to this type all event-specific functionalities will be added
Contains keys of events used by the Client
Sets the specified feature as a hovered feature. This method accepts full GeoJSON features and transforms them to reduced (hovered) format with properties mapped to key/value pairs as it is defined by MapBox VectoTiles. Information about the currently hovered feature can be retrieved using the DataSetGroup.hovered field.
Sets the specified map feature as a hovered feature. This method don't transforms the given feature and use it "as is" to defined as hovered. To select "full" GeoJSON features (for example - coming from search results) the DataSetGroup.setHovered method should be used instead. Information about the currently hovered feature can be retrieved using the DataSetGroup.hovered field.
Selects the specified feature. To remove the selected feature the null
could be used.
Information about the currently selected feature can be retrieved using the
DataSetGroup.selected field.
Intent:
This mixin defines common methods used to dump and restore the internal state of the current object.
Type: Mixin
(Object)
configuration object
This mixin defines common methods used to reloadable classes.
Type: Mixin
(Object)
configuration object