diff --git a/demo/src/environments/environment.prod.ts b/demo/src/environments/environment.prod.ts index 8787b55d79..4980a5c956 100644 --- a/demo/src/environments/environment.prod.ts +++ b/demo/src/environments/environment.prod.ts @@ -76,7 +76,8 @@ export const environment: Environment = { enabled: true, params: { limit: '8' - } + }, + showAdvancedSettings: true }, coordinatesreverse: { showInPointerSummary: true diff --git a/demo/src/environments/environment.ts b/demo/src/environments/environment.ts index b2848c3ccf..6a154b3af4 100644 --- a/demo/src/environments/environment.ts +++ b/demo/src/environments/environment.ts @@ -299,8 +299,9 @@ export const environment: Environment = { order: 2, enabled: true, params: { - limit: '8' - } + limit: '8', + }, + showAdvancedSettings: true }, coordinatesreverse: { showInPointerSummary: true diff --git a/packages/geo/src/lib/search/shared/sources/icherche.ts b/packages/geo/src/lib/search/shared/sources/icherche.ts index 903c5152b8..fd74e391b6 100644 --- a/packages/geo/src/lib/search/shared/sources/icherche.ts +++ b/packages/geo/src/lib/search/shared/sources/icherche.ts @@ -18,7 +18,8 @@ import { SearchSource } from './source'; import { SearchSourceOptions, TextSearchOptions, - ReverseSearchOptions + ReverseSearchOptions, + SearchSourceSettings } from './source.interfaces'; import { IChercheData, @@ -132,6 +133,8 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { 'lieux' ]; + const showAdvancedParams = this.options.showAdvancedSettings ?? true; + return { title: 'igo.geo.search.icherche.name', searchUrl: 'https://geoegl.msp.gouv.qc.ca/apis/icherche', @@ -302,7 +305,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { } ] }, - { + showAdvancedParams && { type: 'radiobutton', title: 'ecmax', name: 'ecmax', @@ -351,7 +354,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { } ] } - ] + ].filter(Boolean) as SearchSourceSettings[] }; } diff --git a/packages/geo/src/lib/search/shared/sources/source.interfaces.ts b/packages/geo/src/lib/search/shared/sources/source.interfaces.ts index b421c961bb..1437b177f1 100644 --- a/packages/geo/src/lib/search/shared/sources/source.interfaces.ts +++ b/packages/geo/src/lib/search/shared/sources/source.interfaces.ts @@ -5,10 +5,12 @@ export interface SearchSourceOptions { enabled?: boolean; order?: number; distance?: number; - params?: { [key: string]: string }; + params?: ISearchSourceParams; settings?: SearchSourceSettings[]; showInPointerSummary?: boolean; showInSettings?: boolean; + /** Default value is true */ + showAdvancedSettings?: boolean; } export interface SearchSourceSettings { @@ -19,6 +21,14 @@ export interface SearchSourceSettings { allEnabled?: boolean; } +export interface ISearchSourceParams { + limit?: string; + datasets?: string; + ecmax?: string; + page?: string; + type?: string; +} + export interface SettingOptions { value: string | number; enabled: boolean; diff --git a/packages/geo/src/lib/search/shared/sources/source.ts b/packages/geo/src/lib/search/shared/sources/source.ts index 2246e5fc0c..fe60ccff0f 100644 --- a/packages/geo/src/lib/search/shared/sources/source.ts +++ b/packages/geo/src/lib/search/shared/sources/source.ts @@ -1,6 +1,7 @@ import { ObjectUtils } from '@igo2/utils'; import { StorageService } from '@igo2/core'; import { + ISearchSourceParams, SearchSourceOptions, SearchSourceSettings } from './source.interfaces'; @@ -96,8 +97,8 @@ export class SearchSource { /** * Search query params */ - get params(): { [key: string]: string } { - return this.options.params === undefined ? {} : this.options.params; + get params(): ISearchSourceParams | null { + return this.options.params; } /** diff --git a/packages/geo/src/locale/en.geo.json b/packages/geo/src/locale/en.geo.json index 2f57812a8f..8caa326bfa 100644 --- a/packages/geo/src/locale/en.geo.json +++ b/packages/geo/src/locale/en.geo.json @@ -513,7 +513,7 @@ }, "restrictExtent": { "map": "Map extent", - "quebec": "Whole Quebec" + "quebec": "Quebec" } }, "coordinates": { @@ -552,7 +552,7 @@ "radius": "Search radius", "results limit": "Number of results", "multiple object": "Multiple object", - "restrictExtent": "Restrict the extent", + "restrictExtent": "Search limit", "selectAll": "Select All", "unselectAll": "Unselect All", "true": "Yes", diff --git a/packages/geo/src/locale/fr.geo.json b/packages/geo/src/locale/fr.geo.json index c607172bb7..980066aa9e 100644 --- a/packages/geo/src/locale/fr.geo.json +++ b/packages/geo/src/locale/fr.geo.json @@ -511,8 +511,8 @@ "cultpatri":"Culture et patrimoine" }, "restrictExtent": { - "map": "À l'étendue de la carte", - "quebec": "Au Québec" + "map": "Étendue de la carte", + "quebec": "Québec" } }, "coordinates": { @@ -551,7 +551,7 @@ "radius": "Rayon de recherche", "results limit": "Nombre de résultats", "multiple object": "Objet multiple", - "restrictExtent": "Restreins l'étendue", + "restrictExtent": "Limite de recherche", "selectAll": "Tout sélectionner", "unselectAll": "Tout désélectionner", "true": "Oui",