jmapcloud-ng-core-types 1.0.1 → 1.0.1001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +23 -0
- package/package.json +1 -1
- package/public/core.d.ts +148 -0
- package/public/jmap/simple-search.d.ts +41 -0
package/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface JCoreService extends JCoreMainService {
|
|
|
25
25
|
Projection: JProjectionService
|
|
26
26
|
MapContext: JMapContextService
|
|
27
27
|
UI: JUIService
|
|
28
|
+
SimpleSearch: JSimpleSearchService
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export interface JUIService {
|
|
@@ -35,6 +36,11 @@ export interface JUIService {
|
|
|
35
36
|
getContainerHeight(): number
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
export interface JSimpleSearchService {
|
|
40
|
+
setQueryString(queryString: string): void
|
|
41
|
+
getMinimumQueryStringLength(): number
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
export interface JLibraryService {
|
|
39
45
|
maplibregl(): any
|
|
40
46
|
html2canvas(): any
|
|
@@ -196,6 +202,7 @@ export interface JEventService {
|
|
|
196
202
|
Language: JLanguageEventModule
|
|
197
203
|
Map: JMapEventModule
|
|
198
204
|
Geocoding: JGeocodingEventModule
|
|
205
|
+
SimpleSearch: JSimpleSearchEventModule
|
|
199
206
|
Photo: JPhotoEventModule
|
|
200
207
|
Project: JProjectEventModule
|
|
201
208
|
User: JUserEventModule
|
|
@@ -296,6 +303,13 @@ export interface JGeocodingEventModule extends JEventModule {
|
|
|
296
303
|
}
|
|
297
304
|
}
|
|
298
305
|
|
|
306
|
+
export interface JSimpleSearchEventModule extends JEventModule {
|
|
307
|
+
on: {
|
|
308
|
+
success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
|
|
309
|
+
error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
299
313
|
export interface JLayerEventModule extends JEventModule {
|
|
300
314
|
on: {
|
|
301
315
|
layersChange(listenerId: string, fn: (params: JLayerEventChangeParams) => void): void
|
|
@@ -396,6 +410,7 @@ export interface JCoreState {
|
|
|
396
410
|
photo: JPhotoState
|
|
397
411
|
query: JQueryState
|
|
398
412
|
geocoding: JGeocodingState
|
|
413
|
+
simpleSearch: JSimpleSearchState
|
|
399
414
|
geolocation: JGeolocationState
|
|
400
415
|
form: JFormState
|
|
401
416
|
server: JServerState
|
|
@@ -448,6 +463,14 @@ export interface JGeocodingState {
|
|
|
448
463
|
results: JGeocodingResult[]
|
|
449
464
|
}
|
|
450
465
|
|
|
466
|
+
export interface JSimpleSearchState {
|
|
467
|
+
isLoadPending: boolean
|
|
468
|
+
isLoading: boolean
|
|
469
|
+
hasLoadingError: boolean
|
|
470
|
+
queryString: string
|
|
471
|
+
results: JSimpleSearchResult
|
|
472
|
+
}
|
|
473
|
+
|
|
451
474
|
export interface JGeolocationState {
|
|
452
475
|
isLocationDisplayed: boolean
|
|
453
476
|
isEnabled: boolean
|
package/package.json
CHANGED
package/public/core.d.ts
CHANGED
|
@@ -6789,6 +6789,48 @@ declare namespace JMap {
|
|
|
6789
6789
|
function getDateFnsDateFormat(): string
|
|
6790
6790
|
}
|
|
6791
6791
|
|
|
6792
|
+
/**
|
|
6793
|
+
* **JMap.SimpleSearch**
|
|
6794
|
+
*
|
|
6795
|
+
* A search mecanism that let the user find features on any layer that has been indexed.
|
|
6796
|
+
*
|
|
6797
|
+
* The JMap Cloud administrator is responsible to specify which attributes of which spatial data sources are indexed. Once set, a global search can be made over a whole project to find features based on those indexed attributes.
|
|
6798
|
+
*
|
|
6799
|
+
* JMap Cloud implements the OpenSearch standard. For more details, see {@link https://opensearch.org/docs/latest/ the official documentation}
|
|
6800
|
+
*
|
|
6801
|
+
*/
|
|
6802
|
+
|
|
6803
|
+
namespace SimpleSearch {
|
|
6804
|
+
/**
|
|
6805
|
+
* ***JMap.SimpleSearch.setQueryString***
|
|
6806
|
+
*
|
|
6807
|
+
* execute a "query string" search on all layers of the current project using the passed string as the query. See {@link https://opensearch.org/docs/latest/query-dsl/full-text/query-string/#query-string-syntax here} for details
|
|
6808
|
+
*
|
|
6809
|
+
* This method will fetch a result object indicating all matches found.
|
|
6810
|
+
*
|
|
6811
|
+
* @throws if no project is loaded
|
|
6812
|
+
* @param queryString the search string to be used
|
|
6813
|
+
* @example ```ts
|
|
6814
|
+
*
|
|
6815
|
+
* ```
|
|
6816
|
+
*/
|
|
6817
|
+
function setQueryString(queryString: string): void
|
|
6818
|
+
|
|
6819
|
+
/**
|
|
6820
|
+
* **JMap.SimpleSearch.getMinimumQueryStringLength**
|
|
6821
|
+
*
|
|
6822
|
+
* Returns the query string length required to trigger a simple search
|
|
6823
|
+
*
|
|
6824
|
+
* @example ```ts
|
|
6825
|
+
*
|
|
6826
|
+
* // returns the minimum search string length
|
|
6827
|
+
* JMap.SimpleSearch.getMinimumQueryStringLength()
|
|
6828
|
+
* // 3
|
|
6829
|
+
* ```
|
|
6830
|
+
*/
|
|
6831
|
+
function getMinimumQueryStringLength(): number
|
|
6832
|
+
}
|
|
6833
|
+
|
|
6792
6834
|
/**
|
|
6793
6835
|
* **JMap.Query**
|
|
6794
6836
|
*
|
|
@@ -7348,6 +7390,112 @@ declare namespace JMap {
|
|
|
7348
7390
|
function remove(listenerId: string): void
|
|
7349
7391
|
}
|
|
7350
7392
|
|
|
7393
|
+
/**
|
|
7394
|
+
* ***JMap.Event.SimpleSearch***
|
|
7395
|
+
*
|
|
7396
|
+
* Here you can manage all simple search event listeners.
|
|
7397
|
+
*
|
|
7398
|
+
* Click to see all events available: ***{@link JMap.Event.SimpleSearch.on}***.
|
|
7399
|
+
*/
|
|
7400
|
+
namespace SimpleSearch {
|
|
7401
|
+
/**
|
|
7402
|
+
* ***JMap.Event.SimpleSearch.on***
|
|
7403
|
+
*
|
|
7404
|
+
* Here you have all JMap Cloud NG Core simple search events on which you can attach a listener.
|
|
7405
|
+
*/
|
|
7406
|
+
namespace on {
|
|
7407
|
+
/**
|
|
7408
|
+
* ***JMap.Event.SimpleSearch.on.success***
|
|
7409
|
+
*
|
|
7410
|
+
* This event is triggered when a simple search has been completed.
|
|
7411
|
+
*
|
|
7412
|
+
* @param listenerId Your listener id (must be unique)
|
|
7413
|
+
* @param fn Your listener function
|
|
7414
|
+
* @example ```ts
|
|
7415
|
+
*
|
|
7416
|
+
* // log a message in the console once the simple search has been completed
|
|
7417
|
+
* JMap.Event.SimpleSearch.on.success(
|
|
7418
|
+
* "custom-simple-search-success",
|
|
7419
|
+
* params => console.log("A simple search has been completed", params.results)
|
|
7420
|
+
* )
|
|
7421
|
+
* ```
|
|
7422
|
+
*/
|
|
7423
|
+
function success(listenerId: string, fn: (params: JSimpleSearchSuccessEventParams) => void): void
|
|
7424
|
+
|
|
7425
|
+
/**
|
|
7426
|
+
* ***JMap.Event.SimpleSearch.on.error***
|
|
7427
|
+
*
|
|
7428
|
+
* This event is triggered when a simple search has been processed, but an error occured.
|
|
7429
|
+
*
|
|
7430
|
+
* @param listenerId Your listener id (must be unique)
|
|
7431
|
+
* @param fn Your listener function
|
|
7432
|
+
* @example ```ts
|
|
7433
|
+
*
|
|
7434
|
+
* // log a message in the console if a simple search error occured
|
|
7435
|
+
* JMap.Event.SimpleSearch.on.error(
|
|
7436
|
+
* "custom-simple-search-error",
|
|
7437
|
+
* params => console.log("A simple search has failed", params)
|
|
7438
|
+
* )
|
|
7439
|
+
* ```
|
|
7440
|
+
*/
|
|
7441
|
+
function error(listenerId: string, fn: (params: JSimpleSearchErrorEventParams) => void): void
|
|
7442
|
+
}
|
|
7443
|
+
|
|
7444
|
+
/**
|
|
7445
|
+
* ***JMap.Event.SimpleSearch.activate***
|
|
7446
|
+
*
|
|
7447
|
+
* Activate the listener.
|
|
7448
|
+
*
|
|
7449
|
+
* If the listener is already active, do nothing.
|
|
7450
|
+
*
|
|
7451
|
+
* If the listener is inactive, it will be reactivated and will be called again ...
|
|
7452
|
+
*
|
|
7453
|
+
* @param listenerId The listener id
|
|
7454
|
+
* @example ```ts
|
|
7455
|
+
*
|
|
7456
|
+
* // activate the listener "my-simple-search-listener"
|
|
7457
|
+
* JMap.Event.SimpleSearch.activate("my-simple-search-listener")
|
|
7458
|
+
* ```
|
|
7459
|
+
*/
|
|
7460
|
+
function activate(listenerId: string): void
|
|
7461
|
+
|
|
7462
|
+
/**
|
|
7463
|
+
* ***JMap.Event.SimpleSearch.deactivate***
|
|
7464
|
+
*
|
|
7465
|
+
* Deactivate the listener.
|
|
7466
|
+
*
|
|
7467
|
+
* If the listener id doesn't exists or if the listener is already inactive, do nothing.
|
|
7468
|
+
*
|
|
7469
|
+
* If the listener is active, it will be deactivated and will be ignored ...
|
|
7470
|
+
*
|
|
7471
|
+
* @param listenerId The listener id
|
|
7472
|
+
* @example ```ts
|
|
7473
|
+
*
|
|
7474
|
+
* // deactivate the listener "my-simple-search-listener"
|
|
7475
|
+
* JMap.Event.SimpleSearch.deactivate("my-simple-search-listener")
|
|
7476
|
+
* ```
|
|
7477
|
+
*/
|
|
7478
|
+
function deactivate(listenerId: string): void
|
|
7479
|
+
|
|
7480
|
+
/**
|
|
7481
|
+
* ***JMap.Event.SimpleSearch.remove***
|
|
7482
|
+
*
|
|
7483
|
+
* Remove the listener.
|
|
7484
|
+
*
|
|
7485
|
+
* If the listener doesn't exist, do nothing.
|
|
7486
|
+
*
|
|
7487
|
+
* Remove the listener from JMap Cloud NG Core library. The listener is deleted and never called again after that.
|
|
7488
|
+
*
|
|
7489
|
+
* @param listenerId The listener id
|
|
7490
|
+
* @example ```ts
|
|
7491
|
+
*
|
|
7492
|
+
* // remove the listener "my-simple-search-listener"
|
|
7493
|
+
* JMap.Event.SimpleSearch.remove("my-simple-search-listener")
|
|
7494
|
+
* ```
|
|
7495
|
+
*/
|
|
7496
|
+
function remove(listenerId: string): void
|
|
7497
|
+
}
|
|
7498
|
+
|
|
7351
7499
|
namespace Server {
|
|
7352
7500
|
/**
|
|
7353
7501
|
* ***JMap.Event.Server.on***
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare interface JSimpleSearchQueryString {
|
|
2
|
+
query: {
|
|
3
|
+
multi_match: {
|
|
4
|
+
query: string
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface JSimpleSearchResult {
|
|
10
|
+
took: number
|
|
11
|
+
timedOut: boolean
|
|
12
|
+
shards: {
|
|
13
|
+
total: number
|
|
14
|
+
successful: number
|
|
15
|
+
skipped: number
|
|
16
|
+
failed: number
|
|
17
|
+
}
|
|
18
|
+
hits: {
|
|
19
|
+
total: {
|
|
20
|
+
value: number
|
|
21
|
+
relation: string
|
|
22
|
+
}
|
|
23
|
+
maxScore: number
|
|
24
|
+
hits: JSimpleSearchResultHit[]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare interface JSimpleSearchResultHit {
|
|
29
|
+
_index: string
|
|
30
|
+
_source: { spatialDataSourceId: string } & { [attributeName: string]: any }
|
|
31
|
+
_id: JId
|
|
32
|
+
_score: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare interface JSimpleSearchSuccessEventParams {
|
|
36
|
+
result: JSimpleSearchResult
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface JSimpleSearchErrorEventParams {
|
|
40
|
+
error: any
|
|
41
|
+
}
|