From 53045c0f855a4d95d6f92d1005b42d28c331d511 Mon Sep 17 00:00:00 2001 From: cbourget Date: Mon, 26 Aug 2019 12:37:18 -0400 Subject: [PATCH 01/88] feat(search): add a way to trigger a search (and update the searchbar) manually --- .../search-bar/search-bar.component.html | 21 ++- .../search-bar/search-bar.component.scss | 2 +- .../search/search-bar/search-bar.component.ts | 155 +++++++++++------- .../search-selector.component.html | 2 +- .../search-selector.component.ts | 49 ++++-- .../search-settings.component.ts | 10 +- .../search/shared/search-source.service.ts | 1 + .../src/lib/search/shared/sources/icherche.ts | 7 + packages/geo/src/public_api.ts | 1 + packages/integration/src/lib/search/index.ts | 1 - .../search-bar-binding.directive.ts | 61 +++++++ .../search/search-bar/search-bar.module.ts | 17 ++ .../lib/search/search-results-tool/index.ts | 1 - .../search-results-tool.module.ts | 34 ++++ .../src/lib/search/search.module.ts | 32 +--- .../src/lib/search/search.state.ts | 27 ++- packages/integration/src/public_api.ts | 11 +- 17 files changed, 315 insertions(+), 117 deletions(-) create mode 100644 packages/integration/src/lib/search/search-bar/search-bar-binding.directive.ts create mode 100644 packages/integration/src/lib/search/search-bar/search-bar.module.ts delete mode 100644 packages/integration/src/lib/search/search-results-tool/index.ts create mode 100644 packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts diff --git a/packages/geo/src/lib/search/search-bar/search-bar.component.html b/packages/geo/src/lib/search/search-bar/search-bar.component.html index c48cf3d2fe..5438efa0c0 100644 --- a/packages/geo/src/lib/search/search-bar/search-bar.component.html +++ b/packages/geo/src/lib/search/search-bar/search-bar.component.html @@ -1,13 +1,13 @@ -
+
@@ -21,24 +21,23 @@ + [searchType]="searchType$ | async" + (searchTypeChange)="onSearchTypeChange($event)"> + (searchSourceChange)="onSearchSettingsChange()"> +
- -
diff --git a/packages/geo/src/lib/search/search-bar/search-bar.component.scss b/packages/geo/src/lib/search/search-bar/search-bar.component.scss index 653f6fb120..e0a9d5b41b 100644 --- a/packages/geo/src/lib/search/search-bar/search-bar.component.scss +++ b/packages/geo/src/lib/search/search-bar/search-bar.component.scss @@ -33,7 +33,7 @@ width: calc(100% - (2 * #{$igo-icon-size})); } -:host.empty .igo-search-bar-container > mat-form-field { +.igo-search-bar-container.empty > mat-form-field { width: calc(100% - #{$igo-icon-size}); } diff --git a/packages/geo/src/lib/search/search-bar/search-bar.component.ts b/packages/geo/src/lib/search/search-bar/search-bar.component.ts index 8f01702f9d..593c3ba41a 100644 --- a/packages/geo/src/lib/search/search-bar/search-bar.component.ts +++ b/packages/geo/src/lib/search/search-bar/search-bar.component.ts @@ -12,9 +12,10 @@ import { } from '@angular/core'; import { FloatLabelType } from '@angular/material'; -import { Subject, Subscription, EMPTY, timer } from 'rxjs'; +import { BehaviorSubject, Subject, Subscription, EMPTY, timer } from 'rxjs'; import { debounce, distinctUntilChanged } from 'rxjs/operators'; +import { LanguageService } from '@igo2/core'; import { EntityStore } from '@igo2/common'; import { SEARCH_TYPES } from '../shared/search.enums'; @@ -33,35 +34,69 @@ import { SearchService } from '../shared/search.service'; changeDetection: ChangeDetectionStrategy.OnPush }) export class SearchBarComponent implements OnInit, OnDestroy { + /** * Invalid keys */ - private readonly invalidKeys = ['Control', 'Shift', 'Alt']; + static invalidKeys = ['Control', 'Shift', 'Alt']; + + readonly placeholder$: BehaviorSubject = new BehaviorSubject('search.placeholder'); + + readonly empty$: BehaviorSubject = new BehaviorSubject(true); + + /** + * Subscription to the ssearch bar term + */ + private term$$: Subscription; /** * Search term stream */ - private stream$ = new Subject(); + private stream$: BehaviorSubject = new BehaviorSubject(''); /** * Subscription to the search term stream */ private stream$$: Subscription; + /** + * Subscription to the search type + */ + private searchType$$: Subscription; + + /** + * List of available search types + */ + @Input() searchTypes: string[] = SEARCH_TYPES; + /** * Search term */ - @Input() term = ''; + @Input() + set searchType(value: string) { this.setSearchType(value); } + get searchType(): string { return this.searchType$.value; } + readonly searchType$: BehaviorSubject = new BehaviorSubject(undefined); /** - * Whether a float label should be displayed + * Search term */ - @Input() floatLabel: FloatLabelType = 'never'; + @Input() + set term(value: string) { this.setTerm(value); } + get term(): string { return this.term$.value; } + readonly term$: BehaviorSubject = new BehaviorSubject(''); /** * Whether this component is disabled */ - @Input() disabled = false; + @Input() + set disabled(value: boolean) { this.disabled$.next(value); } + get disabled(): boolean { return this.disabled$.value; } + readonly disabled$: BehaviorSubject = new BehaviorSubject(false); + + /** + * Whether a float label should be displayed + */ + @Input() floatLabel: FloatLabelType = 'never'; /** * Icons color (search and clear) @@ -71,7 +106,7 @@ export class SearchBarComponent implements OnInit, OnDestroy { /** * Debounce time between each keystroke */ - @Input() debounce = 300; + @Input() debounce = 200; /** * Minimum term length required to trigger a research @@ -98,15 +133,10 @@ export class SearchBarComponent implements OnInit, OnDestroy { */ @Input() store: EntityStore; - /** - * List of available search types - */ - @Input() searchTypes: string[] = SEARCH_TYPES; - /** * Event emitted when the search term changes */ - @Output() change = new EventEmitter(); + @Output() searchTermChange = new EventEmitter(); /** * Event emitted when a research is completed @@ -132,15 +162,6 @@ export class SearchBarComponent implements OnInit, OnDestroy { */ @ViewChild('input') input: ElementRef; - /** - * Host's empty class - * @internal - */ - @HostBinding('class.empty') - get emptyClass() { - return this.empty; - } - /** * Whether the search bar is empty * @internal @@ -149,33 +170,29 @@ export class SearchBarComponent implements OnInit, OnDestroy { return this.term.length === 0; } - /** - * Search bar palceholder - * @internal - */ - set placeholder(value: string) { - this._placeholder = value; - } - get placeholder(): string { - return this.empty ? this._placeholder : ''; - } - private _placeholder = 'search.placeholder'; - - constructor(private searchService: SearchService) {} + constructor( + private languageService: LanguageService, + private searchService: SearchService + ) {} /** * Subscribe to the search term stream and trigger researches * @internal */ ngOnInit(): void { + this.term$$ = this.term$.subscribe((term: string) => { + this.empty$.next(term === undefined || term.length === 0); + }); + this.stream$$ = this.stream$ .pipe( - debounce((term: string) => { - return term === '' ? EMPTY : timer(200); - }), - distinctUntilChanged() + debounce((term: string) => term === '' ? EMPTY : timer(this.debounce)) ) - .subscribe((term: string) => this.onTermChange(term)); + .subscribe((term: string) => this.onSetTerm(term)); + + this.searchType$$ = this.searchType$ + .pipe(distinctUntilChanged()) + .subscribe((searchType: string) => this.onSetSearchType(searchType)); } /** @@ -183,7 +200,9 @@ export class SearchBarComponent implements OnInit, OnDestroy { * @internal */ ngOnDestroy() { + this.term$$.unsubscribe(); this.stream$$.unsubscribe(); + this.searchType$$.unsubscribe(); } /** @@ -209,6 +228,15 @@ export class SearchBarComponent implements OnInit, OnDestroy { this.clearFeature.emit(); } + /** + * Update search type + * @param searchType Enabled search type + * @internal + */ + onSearchTypeChange(searchType: string) { + this.setSearchType(searchType); + } + /** * Update the placeholder with the enabled search type. The placeholder * for all availables search typers needs to be defined in the locale @@ -216,10 +244,8 @@ export class SearchBarComponent implements OnInit, OnDestroy { * @param searchType Enabled search type * @internal */ - onSearchTypeChange(searchType: string) { - this.searchTypeChange.emit(searchType); - this.placeholder = `search.${searchType.toLowerCase()}.placeholder`; - this.doSearch(this.term); + setSearchType(searchType: string) { + this.searchType$.next(searchType); } onSearchSettingsChange() { @@ -235,11 +261,14 @@ export class SearchBarComponent implements OnInit, OnDestroy { return; } - this.term = term; - if ( - term.replace(/(#[^\s]*)/g, '').trim().length >= this.minLength || - term.replace(/(#[^\s]*)/g, '').trim().length === 0 - ) { + term = term || ''; + + if (term !== this.term) { + this.term$.next(term); + } + + const slug = term.replace(/(#[^\s]*)/g, '').trim(); + if (slug.length >= this.minLength || slug.length === 0) { this.stream$.next(term); } } @@ -248,8 +277,8 @@ export class SearchBarComponent implements OnInit, OnDestroy { * Clear the stream and the input */ private clear() { - this.term = ''; - this.stream$.next(this.term); + this.term$.next(''); + this.stream$.next(''); this.input.nativeElement.focus(); } @@ -257,7 +286,7 @@ export class SearchBarComponent implements OnInit, OnDestroy { * Validate if a given key stroke is a valid input */ private keyIsValid(key: string) { - return this.invalidKeys.indexOf(key) === -1; + return SearchBarComponent.invalidKeys.indexOf(key) === -1; } /** @@ -265,17 +294,31 @@ export class SearchBarComponent implements OnInit, OnDestroy { * research in every enabled search sources. * @param term Search term */ - private onTermChange(term: string | undefined) { - this.change.emit(term); + private onSetTerm(term: string | undefined) { + this.searchTermChange.emit(term); this.doSearch(term); } + private onSetSearchType(searchType: string) { + if (searchType === undefined || searchType === null) { + return; + } + + this.searchTypeChange.emit(searchType); + + const placeholder = `search.${searchType.toLowerCase()}.placeholder`; + this.placeholder$.next(placeholder); + + this.setTerm(this.term); + } + /** * Execute the search * @param term Search term */ private doSearch(term: string | undefined) { - if (term === undefined || term.replace(/(#[^\s]*)/g, '').trim() === '') { + const slug = term ? term.replace(/(#[^\s]*)/g, '').trim() : ''; + if (slug === '') { if (this.store !== undefined) { this.store.clear(); } diff --git a/packages/geo/src/lib/search/search-selector/search-selector.component.html b/packages/geo/src/lib/search/search-selector/search-selector.component.html index fad9b790c7..8264bf9211 100644 --- a/packages/geo/src/lib/search/search-selector/search-selector.component.html +++ b/packages/geo/src/lib/search/search-selector/search-selector.component.html @@ -17,7 +17,7 @@ yPosition="above"> {{getSearchTypeTitle(searchType) | translate}} diff --git a/packages/geo/src/lib/search/search-selector/search-selector.component.ts b/packages/geo/src/lib/search/search-selector/search-selector.component.ts index 4ccaaf8c62..3f4ced2b9b 100644 --- a/packages/geo/src/lib/search/search-selector/search-selector.component.ts +++ b/packages/geo/src/lib/search/search-selector/search-selector.component.ts @@ -3,10 +3,14 @@ import { Input, Output, EventEmitter, + ChangeDetectionStrategy, OnInit, - ChangeDetectionStrategy + OnDestroy } from '@angular/core'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { distinctUntilChanged } from 'rxjs/operators'; + import { SEARCH_TYPES } from '../shared/search.enums'; import { SearchSourceService } from '../shared/search-source.service'; @@ -24,7 +28,14 @@ import { SearchSourceService } from '../shared/search-source.service'; styleUrls: ['./search-selector.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class SearchSelectorComponent implements OnInit { +export class SearchSelectorComponent implements OnInit, OnDestroy { + + readonly searchType$: BehaviorSubject = new BehaviorSubject(undefined); + + /** + * Subscription to the search type + */ + private searchType$$: Subscription; /** * List of available search types @@ -34,22 +45,25 @@ export class SearchSelectorComponent implements OnInit { /** * The search type enabled */ - @Input() enabled: string; + @Input() + set searchType(value: string) { this.setSearchType(value); } + get searchType(): string { return this.searchType$.value; } /** * Event emitted when the enabled search type changes */ - @Output() change = new EventEmitter(); + @Output() searchTypeChange = new EventEmitter(); constructor(private searchSourceService: SearchSourceService) {} - /** - * Enable the first search type if the enabled input is not defined - * @internal - */ ngOnInit() { - const initial = this.enabled || this.searchTypes[0]; - this.enableSearchType(initial); + this.searchType$$ = this.searchType$ + .pipe(distinctUntilChanged()) + .subscribe((searchType: string) => this.onSetSearchType(searchType)); + } + + ngOnDestroy() { + this.searchType$$.unsubscribe(); } /** @@ -58,7 +72,7 @@ export class SearchSelectorComponent implements OnInit { * @internal */ onSearchTypeChange(searchType: string) { - this.enableSearchType(searchType); + this.setSearchType(searchType); } /** @@ -76,10 +90,17 @@ export class SearchSelectorComponent implements OnInit { * Emit an event and enable the search sources of the given type. * @param searchType Search type */ - private enableSearchType(searchType: string) { - this.enabled = searchType; + private setSearchType(searchType: string | undefined) { + this.searchType$.next(searchType); + } + + private onSetSearchType(searchType: string) { + if (searchType === undefined || searchType === null) { + return; + } + this.searchSourceService.enableSourcesByType(searchType); - this.change.emit(searchType); + this.searchTypeChange.emit(searchType); } } diff --git a/packages/geo/src/lib/search/search-settings/search-settings.component.ts b/packages/geo/src/lib/search/search-settings/search-settings.component.ts index 348cc04077..24d5119d60 100644 --- a/packages/geo/src/lib/search/search-settings/search-settings.component.ts +++ b/packages/geo/src/lib/search/search-settings/search-settings.component.ts @@ -29,9 +29,9 @@ import { SearchSourceSettings, SettingOptions } from '../shared/sources/source.i export class SearchSettingsComponent { /** - * Event emitted when the enabled search type changes + * Event emitted when the enabled search source changes */ - @Output() change = new EventEmitter(); + @Output() searchSourceChange = new EventEmitter(); constructor(private searchSourceService: SearchSourceService) {} @@ -55,7 +55,7 @@ export class SearchSettingsComponent { ) { settingValue.enabled = event.checked; source.setParamFromSetting(setting); - this.change.emit(source); + this.searchSourceChange.emit(source); } /** @@ -76,12 +76,12 @@ export class SearchSettingsComponent { } }); source.setParamFromSetting(setting); - this.change.emit(source); + this.searchSourceChange.emit(source); } onCheckSearchSource(event: MatCheckboxChange, source: SearchSource) { source.enabled = event.checked; - this.change.emit(source); + this.searchSourceChange.emit(source); } } diff --git a/packages/geo/src/lib/search/shared/search-source.service.ts b/packages/geo/src/lib/search/shared/search-source.service.ts index 88ef009cd4..0839e688d8 100644 --- a/packages/geo/src/lib/search/shared/search-source.service.ts +++ b/packages/geo/src/lib/search/shared/search-source.service.ts @@ -5,6 +5,7 @@ import { SearchSourceSettings } from './sources/source.interfaces'; * Service where all available search sources are registered. */ export class SearchSourceService { + constructor(private sources: SearchSource[]) {} /** diff --git a/packages/geo/src/lib/search/shared/sources/icherche.ts b/packages/geo/src/lib/search/shared/sources/icherche.ts index af1af459b7..d8defa5e39 100644 --- a/packages/geo/src/lib/search/shared/sources/icherche.ts +++ b/packages/geo/src/lib/search/shared/sources/icherche.ts @@ -284,6 +284,13 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { IChercheSearchSource.propertiesBlacklist ); + if (data.geometry === undefined) { + return Object.assign( + { type: data.index }, + properties + ); + } + const googleLinksProperties: { GoogleMaps: string; GoogleStreetView?: string; diff --git a/packages/geo/src/public_api.ts b/packages/geo/src/public_api.ts index f0a73f4b90..8198103429 100644 --- a/packages/geo/src/public_api.ts +++ b/packages/geo/src/public_api.ts @@ -29,6 +29,7 @@ export * from './lib/query/query.module'; export * from './lib/routing/routing.module'; export * from './lib/search/search.module'; export * from './lib/search/search-bar/search-bar.module'; +export * from './lib/search/search-bar/search-bar.component'; export * from './lib/search/search-results/search-results.module'; export * from './lib/toast/toast.module'; export * from './lib/wkt/wkt.module'; diff --git a/packages/integration/src/lib/search/index.ts b/packages/integration/src/lib/search/index.ts index dd920cae39..2b37d0aed8 100644 --- a/packages/integration/src/lib/search/index.ts +++ b/packages/integration/src/lib/search/index.ts @@ -1,4 +1,3 @@ export * from './query.state'; export * from './search.state'; -export * from './search-results-tool'; export * from './search.module'; diff --git a/packages/integration/src/lib/search/search-bar/search-bar-binding.directive.ts b/packages/integration/src/lib/search/search-bar/search-bar-binding.directive.ts new file mode 100644 index 0000000000..2b689d3409 --- /dev/null +++ b/packages/integration/src/lib/search/search-bar/search-bar-binding.directive.ts @@ -0,0 +1,61 @@ +import { Directive, Self, OnInit, OnDestroy, HostListener } from '@angular/core'; +import { Subscription } from 'rxjs'; + +import { SearchBarComponent } from '@igo2/geo'; +import { SearchState } from '../search.state'; + +@Directive({ + selector: '[igoSearchBarBinding]' +}) +export class SearchBarBindingDirective implements OnInit, OnDestroy { + + get searchTerm(): string { return this.searchState.searchTerm$.value; } + get searchType(): string { return this.searchState.searchType$.value; } + + private searchTerm$$: Subscription; + private searchType$$: Subscription; + private searchDisabled$$: Subscription; + + constructor( + @Self() private component: SearchBarComponent, + private searchState: SearchState + ) {} + + ngOnInit() { + this.searchTerm$$ = this.searchState.searchTerm$.subscribe((searchTerm: string) => { + if (searchTerm !== undefined && searchTerm !== null) { + this.component.setTerm(searchTerm); + } + }); + + this.searchType$$ = this.searchState.searchType$.subscribe((searchType: string) => { + if (searchType !== undefined && searchType !== null) { + this.component.setSearchType(searchType); + } + }); + + this.searchDisabled$$ = this.searchState.searchDisabled$.subscribe((searchDisabled: boolean) => { + this.component.disabled = searchDisabled; + }); + } + + ngOnDestroy() { + this.searchTerm$$.unsubscribe(); + this.searchType$$.unsubscribe(); + this.searchDisabled$$.unsubscribe(); + } + + @HostListener('searchTermChange', ['$event']) + onSearchTermChange(searchTerm?: string) { + if (searchTerm !== this.searchTerm) { + this.searchState.setSearchTerm(searchTerm); + } + } + + @HostListener('searchTypeChange', ['$event']) + onSearchTypeChange(searchType?: string) { + if (searchType !== this.searchType) { + this.searchState.setSearchType(searchType); + } + } +} diff --git a/packages/integration/src/lib/search/search-bar/search-bar.module.ts b/packages/integration/src/lib/search/search-bar/search-bar.module.ts new file mode 100644 index 0000000000..e82fd2c619 --- /dev/null +++ b/packages/integration/src/lib/search/search-bar/search-bar.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; + +import { IgoSearchModule } from '@igo2/geo'; + +import { SearchBarBindingDirective } from './search-bar-binding.directive'; + +/** + * @ignore + */ +@NgModule({ + imports: [ + IgoSearchModule + ], + declarations: [SearchBarBindingDirective], + exports: [SearchBarBindingDirective] +}) +export class IgoAppSearchBarModule {} diff --git a/packages/integration/src/lib/search/search-results-tool/index.ts b/packages/integration/src/lib/search/search-results-tool/index.ts deleted file mode 100644 index 0fa9b064ee..0000000000 --- a/packages/integration/src/lib/search/search-results-tool/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './search-results-tool.component'; diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts b/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts new file mode 100644 index 0000000000..4f4095d07c --- /dev/null +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts @@ -0,0 +1,34 @@ +import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { MatIconModule, MatButtonModule } from '@angular/material'; + +import { IgoFlexibleModule, IgoPanelModule } from '@igo2/common'; +import { + IgoFeatureModule, + IgoSearchModule, + IgoFeatureDetailsModule +} from '@igo2/geo'; + +import { SearchResultsToolComponent } from './search-results-tool.component'; + +/** + * @ignore + */ +@NgModule({ + imports: [ + CommonModule, + MatIconModule, + MatButtonModule, + IgoFeatureModule, + IgoSearchModule, + IgoFlexibleModule, + IgoPanelModule, + IgoFeatureDetailsModule + ], + declarations: [SearchResultsToolComponent], + exports: [SearchResultsToolComponent], + entryComponents: [SearchResultsToolComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) +export class IgoAppSearchResultsToolModule {} diff --git a/packages/integration/src/lib/search/search.module.ts b/packages/integration/src/lib/search/search.module.ts index fad02f774b..9cf2e96e54 100644 --- a/packages/integration/src/lib/search/search.module.ts +++ b/packages/integration/src/lib/search/search.module.ts @@ -1,30 +1,14 @@ -import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; -import { MatIconModule, MatButtonModule } from '@angular/material'; - -import { IgoFlexibleModule, IgoPanelModule } from '@igo2/common'; -import { - IgoFeatureModule, - IgoSearchModule, - IgoFeatureDetailsModule -} from '@igo2/geo'; -import { SearchResultsToolComponent } from './search-results-tool/search-results-tool.component'; +import { IgoAppSearchBarModule } from './search-bar/search-bar.module'; +import { IgoAppSearchResultsToolModule } from './search-results-tool/search-results-tool.module'; @NgModule({ - imports: [ - CommonModule, - MatIconModule, - MatButtonModule, - IgoFeatureModule, - IgoSearchModule, - IgoFlexibleModule, - IgoPanelModule, - IgoFeatureDetailsModule + imports: [], + declarations: [], + exports: [ + IgoAppSearchBarModule, + IgoAppSearchResultsToolModule ], - declarations: [SearchResultsToolComponent], - exports: [SearchResultsToolComponent], - entryComponents: [SearchResultsToolComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA] }) export class IgoAppSearchModule {} diff --git a/packages/integration/src/lib/search/search.state.ts b/packages/integration/src/lib/search/search.state.ts index 3831e8d061..06d2c60f35 100644 --- a/packages/integration/src/lib/search/search.state.ts +++ b/packages/integration/src/lib/search/search.state.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { EntityStore } from '@igo2/common'; import { SearchResult, SearchSourceService, SearchSource } from '@igo2/geo'; +import { BehaviorSubject } from 'rxjs'; /** * Service that holds the state of the search module @@ -10,10 +11,17 @@ import { SearchResult, SearchSourceService, SearchSource } from '@igo2/geo'; providedIn: 'root' }) export class SearchState { + + readonly searchTerm$: BehaviorSubject = new BehaviorSubject(undefined); + + readonly searchType$: BehaviorSubject = new BehaviorSubject(undefined); + + readonly searchDisabled$: BehaviorSubject = new BehaviorSubject(false); + /** * Store that holds the search results */ - public store: EntityStore = new EntityStore([]); + readonly store: EntityStore = new EntityStore([]); /** * Search types currently enabled in the search source service @@ -25,4 +33,21 @@ export class SearchState { } constructor(private searchSourceService: SearchSourceService) {} + + enableSearch() { + this.searchDisabled$.next(false); + } + + disableSearch() { + this.searchDisabled$.next(true); + } + + setSearchTerm(searchTerm: string) { + this.searchTerm$.next(searchTerm); + } + + setSearchType(searchType: string) { + this.searchSourceService.enableSourcesByType(searchType); + this.searchType$.next(searchType); + } } diff --git a/packages/integration/src/public_api.ts b/packages/integration/src/public_api.ts index c8837b9ffb..7dc44dd73b 100644 --- a/packages/integration/src/public_api.ts +++ b/packages/integration/src/public_api.ts @@ -6,8 +6,7 @@ export * from './lib/integration.module'; export * from './lib/about/about.module'; export * from './lib/context/context.module'; export * from './lib/catalog/catalog.module'; -export * from './lib/catalog/catalog-browser-tool/catalog-browser-tool.module'; -export * from './lib/catalog/catalog-library-tool/catalog-library-tool.module'; + export * from './lib/directions/directions.module'; export * from './lib/workspace/workspace.module'; export * from './lib/filter/filter.module'; @@ -20,7 +19,11 @@ export * from './lib/tool/tool.module'; export * from './lib/about'; export * from './lib/context'; + +export * from './lib/catalog/catalog-browser-tool/catalog-browser-tool.component'; +export * from './lib/catalog/catalog-library-tool/catalog-library-tool.component'; export * from './lib/catalog'; + export * from './lib/directions'; export * from './lib/workspace'; export * from './lib/filter'; @@ -28,5 +31,9 @@ export * from './lib/import-export'; export * from './lib/map'; export * from './lib/measure'; export * from './lib/print'; + +export * from './lib/search/search-bar/search-bar-binding.directive'; +export * from './lib/search/search-results-tool/search-results-tool.component'; export * from './lib/search'; + export * from './lib/tool'; From 730df39913fd9d53ef6c0967198a5dcbb9866803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Barbeau?= Date: Thu, 29 Aug 2019 14:46:08 -0400 Subject: [PATCH 02/88] fix(*): minors bugs, locale --- demo/src/app/geo/layer/layer.component.html | 1 - .../time-filter/time-filter.component.html | 6 +- package-lock.json | 70 ++++---- package.json | 3 +- .../context-item/context-item.component.html | 2 +- .../context-list/context-list.component.html | 2 +- .../core/src/style/themes/blue.theme.scss | 2 +- packages/geo/package.json | 3 +- .../catalog-browser-group.component.html | 1 - .../catalog-browser.component.html | 1 - .../shared/datasources/wms-datasource.ts | 63 +++++-- packages/geo/src/lib/filter/filter.module.ts | 12 +- .../time-filter-form.component.html | 4 +- .../layer-item/layer-item.component.html | 4 +- .../layer-item/layer-item.component.scss | 14 +- .../layer-list/layer-list.component.html | 2 +- .../layer/layer-list/layer-list.component.ts | 161 +++++++++++++----- .../geo/src/lib/print/shared/print.service.ts | 81 +++++---- .../search/search-bar/search-bar.component.ts | 7 +- .../search-settings.component.html | 2 +- .../shared/sources/coordinates.providers.ts | 10 +- .../lib/search/shared/sources/coordinates.ts | 18 +- .../src/lib/search/shared/sources/icherche.ts | 9 +- packages/geo/src/locale/en.geo.json | 8 +- packages/geo/src/locale/fr.geo.json | 16 +- .../src/lib/context/context.state.ts | 1 + .../search-results-tool.component.html | 6 + .../search-results-tool.component.ts | 11 +- .../search-results-tool.module.ts | 2 + .../{en.tools.json => en.integration.json} | 4 + .../{fr.tools.json => fr.integration.json} | 4 + 31 files changed, 345 insertions(+), 185 deletions(-) rename packages/integration/src/locale/{en.tools.json => en.integration.json} (78%) rename packages/integration/src/locale/{fr.tools.json => fr.integration.json} (79%) diff --git a/demo/src/app/geo/layer/layer.component.html b/demo/src/app/geo/layer/layer.component.html index 3ebadfa624..5a66e26cac 100644 --- a/demo/src/app/geo/layer/layer.component.html +++ b/demo/src/app/geo/layer/layer.component.html @@ -17,7 +17,6 @@ diff --git a/demo/src/app/geo/time-filter/time-filter.component.html b/demo/src/app/geo/time-filter/time-filter.component.html index 689f8842a2..1792751626 100644 --- a/demo/src/app/geo/time-filter/time-filter.component.html +++ b/demo/src/app/geo/time-filter/time-filter.component.html @@ -3,7 +3,7 @@ Time filter
  • npm install --save moment@2.22.2
  • -
  • npm install --save @mat-datetimepicker/core@2.0.1
  • +
  • npm install --save @mat-datetimepicker/core@3.0.0-beta.0
  • Dependencies: LanguageService

  • @@ -16,9 +16,7 @@ - - - + diff --git a/package-lock.json b/package-lock.json index a19bfdcf87..1924ae1f20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1028,6 +1028,14 @@ } } }, + "@mat-datetimepicker/core": { + "version": "3.0.0-beta.0", + "resolved": "https://registry.npmjs.org/@mat-datetimepicker/core/-/core-3.0.0-beta.0.tgz", + "integrity": "sha512-bsEziG0qmzVmg5PoBYqdaoUm58M1m6Qf0JIS0xHMFkvuRtLKJsA4G1LJ9Up5ZruKMW1rmtE3wuBeZmyln4vsQQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "@mdi/angular-material": { "version": "3.9.97", "resolved": "https://registry.npmjs.org/@mdi/angular-material/-/angular-material-3.9.97.tgz", @@ -1552,7 +1560,7 @@ }, "acorn-globals": { "version": "1.0.9", - "resolved": "http://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-1.0.9.tgz", "integrity": "sha1-VbtemGkVB7dFedBRNBMhfDgMVM8=", "requires": { "acorn": "^2.1.0" @@ -1721,7 +1729,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -1865,7 +1873,7 @@ "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha1-aALmJk79GMeQobDVF/DyYnvyyUo=", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true }, "archy": { @@ -1917,7 +1925,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, "arr-map": { @@ -1949,7 +1957,7 @@ }, "array-equal": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" }, "array-filter": { @@ -2453,7 +2461,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -2654,7 +2662,7 @@ "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha1-LN4J617jQfSEdGuwMJsyU7GxRC8=", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", "dev": true }, "body-parser": { @@ -3001,7 +3009,7 @@ "buffer-indexof": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha1-Uvq8xqYG0aADAoAmSO9o9jnaJow=", + "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", "dev": true }, "buffer-xor": { @@ -3058,7 +3066,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -3263,7 +3271,7 @@ "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -3687,7 +3695,7 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, "conventional-changelog": { @@ -4436,7 +4444,7 @@ "copy-concurrently": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha1-kilzmMrjSTf8r9bsgTnBgFHwteA=", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", "dev": true, "requires": { "aproba": "^1.1.1", @@ -5662,7 +5670,7 @@ "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha1-f8vbGY3HGVlDLv4ThCaE4FJaywI=", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", "dev": true, "requires": { "md5.js": "^1.3.4", @@ -6952,7 +6960,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, "gauge": { @@ -7533,7 +7541,7 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true }, "globby": { @@ -8808,7 +8816,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -9317,7 +9325,7 @@ }, "jsdom": { "version": "8.5.0", - "resolved": "http://registry.npmjs.org/jsdom/-/jsdom-8.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-8.5.0.tgz", "integrity": "sha1-1Nj12/J2hjW2KmKCO5R89wcevJg=", "requires": { "abab": "^1.0.0", @@ -10478,7 +10486,7 @@ "miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha1-8IA1HIZbDcViqEYpZtqlNUPHik0=", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dev": true, "requires": { "bn.js": "^4.0.0", @@ -10542,7 +10550,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -10672,9 +10680,9 @@ "dev": true }, "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" }, "morgan": { "version": "1.9.1", @@ -11296,7 +11304,7 @@ "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha1-CKfyqL9zRgR3mp76StXMcXq7lUs=", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -11686,7 +11694,7 @@ "p-map": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha1-5OlPMR6rvIYzoeeZCBZfyiYkG2s=", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", "dev": true }, "p-try": { @@ -12036,7 +12044,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -12046,7 +12054,7 @@ "pbf": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz", - "integrity": "sha1-9wAEutyygXYeq7HnbJLxefCBiek=", + "integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==", "requires": { "ieee754": "^1.1.6", "resolve-protobuf-schema": "^2.0.0" @@ -12514,7 +12522,7 @@ "promise": { "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "dev": true, "optional": true, "requires": { @@ -13272,7 +13280,7 @@ "replacestream": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", - "integrity": "sha1-PuV5gJK+Nksc2xSEMISSyz3/LzY=", + "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", "dev": true, "requires": { "escape-string-regexp": "^1.0.3", @@ -14216,7 +14224,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -14267,7 +14275,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -16237,7 +16245,7 @@ "vlq": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", - "integrity": "sha1-jz5DKM9jsVQMDWfhsneDhviXWyY=", + "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", "dev": true }, "vm-browserify": { diff --git a/package.json b/package.json index b82377e285..18bb70b025 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "@angular/platform-browser": "^7.2.6", "@angular/platform-browser-dynamic": "^7.2.6", "@angular/router": "^7.2.6", + "@mat-datetimepicker/core": "^3.0.0-beta.0", "@mdi/angular-material": "^3.6.95", "@ngx-translate/core": "^10.0.1", "@turf/helpers": "^6.1.4", @@ -91,7 +92,7 @@ "jspdf": "^1.5.3", "jszip": "^3.1.5", "jwt-decode": "^2.2.0", - "moment": "^2.24.0", + "moment": "^2.22.2", "ngx-cacheable": "^1.0.9", "ol": "^5.3.0", "proj4": "^2.5.0", diff --git a/packages/context/src/lib/context-manager/context-item/context-item.component.html b/packages/context/src/lib/context-manager/context-item/context-item.component.html index 54e8516829..b4c968f601 100644 --- a/packages/context/src/lib/context-manager/context-item/context-item.component.html +++ b/packages/context/src/lib/context-manager/context-item/context-item.component.html @@ -2,7 +2,7 @@ = new BehaviorSubject(''); + + get title(): string { + return this.title$.getValue(); + } + + constructor( + @Inject('options') options: SearchSourceOptions, + private languageService: LanguageService + ) { super(options); + this.languageService.translate + .get(this.options.title) + .subscribe(title => this.title$.next(title)); } getId(): string { @@ -38,7 +50,7 @@ export class CoordinatesReverseSearchSource extends SearchSource protected getDefaultOptions(): SearchSourceOptions { return { - title: 'Coordinates', + title: 'igo.geo.search.coordinates.name', order: 1 }; } diff --git a/packages/geo/src/lib/search/shared/sources/icherche.ts b/packages/geo/src/lib/search/shared/sources/icherche.ts index d8defa5e39..64e23a7294 100644 --- a/packages/geo/src/lib/search/shared/sources/icherche.ts +++ b/packages/geo/src/lib/search/shared/sources/icherche.ts @@ -101,7 +101,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { // enabled: true // }, { - title: 'mrc', + title: 'MRC', value: 'mrc', enabled: true }, @@ -165,7 +165,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { }, { type: 'radiobutton', - title: 'trust level', + title: 'ecmax', name: 'ecmax', values: [ { @@ -285,10 +285,7 @@ export class IChercheSearchSource extends SearchSource implements TextSearch { ); if (data.geometry === undefined) { - return Object.assign( - { type: data.index }, - properties - ); + return Object.assign({ type: data.index }, properties); } const googleLinksProperties: { diff --git a/packages/geo/src/locale/en.geo.json b/packages/geo/src/locale/en.geo.json index 9707d01a6a..c8785315ef 100644 --- a/packages/geo/src/locale/en.geo.json +++ b/packages/geo/src/locale/en.geo.json @@ -90,6 +90,7 @@ "hideLayer": "Hide Layer", "lowerLayer": "Bring layer backward", "loadingLegendText": "Loading legend", + "filterPlaceholder": "Filter", "noLegendText": "No legend available for this layer", "opacity": "Opacity", "raiseLayer": "Bring layer forward", @@ -210,6 +211,9 @@ "metadataUrl": "Metadata" } }, + "coordinates": { + "name": "Coordinates" + }, "menu.tooltip": "Search Options", "settings": { "title": "Settings" @@ -217,8 +221,8 @@ "searchSources": { "settings": { "results type": "Results type", - "trust level": "Trust level", - "results limit": "Limit", + "ecmax": "Maximum deviation", + "results limit": "Number of results", "multiple object": "Multiple object", "country limitation": "Limitation (country)" } diff --git a/packages/geo/src/locale/fr.geo.json b/packages/geo/src/locale/fr.geo.json index ed9cbfe06f..b063ebea72 100644 --- a/packages/geo/src/locale/fr.geo.json +++ b/packages/geo/src/locale/fr.geo.json @@ -89,6 +89,7 @@ "hideLayer": "Masquer la couche", "lowerLayer": "Mettre en arrière", "loadingLegendText": "Chargement de la légende", + "filterPlaceholder": "Filtre", "noLegendText": "Aucune légende disponible pour cette couche", "opacity": "Opacité", "raiseLayer": "Mettre en avant", @@ -98,10 +99,10 @@ "subsetLayersListKeyword": "Limiter l'affichage de la liste selon le titre ou par type (wms, wfs,...)", "deleteKeyword": "Supprimer le mot-clé", "subsetLayersListKeywordPlaceholder": "Filtre", - "subsetLayersListOnlyVisible": "Conserver que les couches qui sont visible", - "subsetLayersListOnlyInRange": "Conserver que les couches qui sont dans la plage de résolution active", - "sortAlphabetically": "Trier la liste des couches alphabétiquement.", - "sortMapOrder": "Replacer les couches selon l'ordre cartographique.", + "subsetLayersListOnlyVisible": "Conserver les couches visibles", + "subsetLayersListOnlyInRange": "Conserver les couches qui sont dans la plage de résolution active", + "sortAlphabetically": "Trier la liste des couches alphabétiquement", + "sortMapOrder": "Replacer les couches selon l'ordre cartographique", "resetLayersList": "Supprimer le filtre appliqué à la liste" }, "download": { @@ -209,6 +210,9 @@ "metadataUrl": "Métadonnées" } }, + "coordinates": { + "name": "Coordonnées" + }, "menu.tooltip": "Options de recherche", "settings": { "title": "Paramètres" @@ -216,8 +220,8 @@ "searchSources": { "settings": { "results type": "Type de résultat", - "trust level": "Niveau de confiance", - "results limit": "Limite", + "ecmax": "Écart maximal", + "results limit": "Nombre de résultats", "multiple object": "Objet multiple", "country limitation": "Limitation (pays)" } diff --git a/packages/integration/src/lib/context/context.state.ts b/packages/integration/src/lib/context/context.state.ts index 789d713570..8c975b859b 100644 --- a/packages/integration/src/lib/context/context.state.ts +++ b/packages/integration/src/lib/context/context.state.ts @@ -77,6 +77,7 @@ export class ContextState { * @param context Detailed context */ private onContextChange(context: DetailedContext) { + console.log(context); if (context === undefined) { return; } diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html index 2907b499bf..5c93eda2d8 100644 --- a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html @@ -1,4 +1,10 @@ +
    +

    {{ 'igo.integration.searchResultsTool.noResults' | translate }}

    +

    {{ 'igo.integration.searchResultsTool.doSearch' | translate }}

    +
    + { this.feature = element ? (element.entity.data as Feature) : undefined; - if (!this.feature) { + if (!this.feature && this.store.stateView.empty) { this.topPanelState = 'initial'; } return this.feature; @@ -96,7 +96,8 @@ export class SearchResultsToolComponent { private mapState: MapState, private layerService: LayerService, private searchState: SearchState - ) {} + ) { + } /** * Try to add a feature to the map when it's being focused @@ -104,10 +105,10 @@ export class SearchResultsToolComponent { * @param result A search result that could be a feature */ onResultFocus(result: SearchResult) { + this.tryAddFeatureToMap(result); if (this.topPanelState === 'initial') { this.toggleTopPanel(); } - this.tryAddFeatureToMap(result); } /** @@ -116,11 +117,11 @@ export class SearchResultsToolComponent { * @param result A search result that could be a feature or some layer options */ onResultSelect(result: SearchResult) { + this.tryAddFeatureToMap(result); + this.tryAddLayerToMap(result); if (this.topPanelState === 'initial') { this.toggleTopPanel(); } - this.tryAddFeatureToMap(result); - this.tryAddLayerToMap(result); } toggleTopPanel() { diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts b/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts index 4f4095d07c..642bec6a4d 100644 --- a/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.module.ts @@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common'; import { MatIconModule, MatButtonModule } from '@angular/material'; +import { IgoLanguageModule } from '@igo2/core'; import { IgoFlexibleModule, IgoPanelModule } from '@igo2/common'; import { IgoFeatureModule, @@ -20,6 +21,7 @@ import { SearchResultsToolComponent } from './search-results-tool.component'; CommonModule, MatIconModule, MatButtonModule, + IgoLanguageModule, IgoFeatureModule, IgoSearchModule, IgoFlexibleModule, diff --git a/packages/integration/src/locale/en.tools.json b/packages/integration/src/locale/en.integration.json similarity index 78% rename from packages/integration/src/locale/en.tools.json rename to packages/integration/src/locale/en.integration.json index 0c21057e53..e22812b2a8 100644 --- a/packages/integration/src/locale/en.tools.json +++ b/packages/integration/src/locale/en.integration.json @@ -14,6 +14,10 @@ "shareMap": "Share", "timeAnalysis": "Time Analysis", "about": "About" + }, + "searchResultsTool": { + "noResults": "No results", + "doSearch": "Do a search in the search bar" } } } diff --git a/packages/integration/src/locale/fr.tools.json b/packages/integration/src/locale/fr.integration.json similarity index 79% rename from packages/integration/src/locale/fr.tools.json rename to packages/integration/src/locale/fr.integration.json index 74a4ca9d16..79cf121557 100644 --- a/packages/integration/src/locale/fr.tools.json +++ b/packages/integration/src/locale/fr.integration.json @@ -14,6 +14,10 @@ "shareMap": "Partager", "timeAnalysis": "Analyse Temporelle", "about": "À propos" + }, + "searchResultsTool": { + "noResults": "Aucun résultat", + "doSearch": "Veuillez effectuer une recherche" } } } From 1656ce2471013d0c81ac9ba1e82b41d7ff422643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Barbeau?= Date: Thu, 29 Aug 2019 14:54:30 -0400 Subject: [PATCH 03/88] lint(*): fix lint --- demo/src/app/core/request/request.component.ts | 1 - .../src/lib/context-manager/shared/context.service.ts | 8 ++++---- packages/geo/src/lib/datasource/utils/id-generator.ts | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/demo/src/app/core/request/request.component.ts b/demo/src/app/core/request/request.component.ts index 38e6bf492f..1ebef7e481 100644 --- a/demo/src/app/core/request/request.component.ts +++ b/demo/src/app/core/request/request.component.ts @@ -3,7 +3,6 @@ import { HttpClient } from '@angular/common/http'; import { LanguageService } from '@igo2/core'; - @Component({ selector: 'app-request', templateUrl: './request.component.html', diff --git a/packages/context/src/lib/context-manager/shared/context.service.ts b/packages/context/src/lib/context-manager/shared/context.service.ts index 77eddde781..e934af2771 100644 --- a/packages/context/src/lib/context-manager/shared/context.service.ts +++ b/packages/context/src/lib/context-manager/shared/context.service.ts @@ -236,13 +236,13 @@ export class ContextService { .filter((t, index, self) => self.findIndex((t2) => t2.name === t.name) === index); return resMerge; }), - catchError(res => { - return this.handleError(res, uri); + catchError(err => { + return this.handleError(err, uri); }) ); }), - catchError(res => { - return this.handleError(res, uri); + catchError(err2 => { + return this.handleError(err2, uri); }) ); } diff --git a/packages/geo/src/lib/datasource/utils/id-generator.ts b/packages/geo/src/lib/datasource/utils/id-generator.ts index 45e70ad70e..d9061d7a12 100644 --- a/packages/geo/src/lib/datasource/utils/id-generator.ts +++ b/packages/geo/src/lib/datasource/utils/id-generator.ts @@ -31,7 +31,7 @@ export function generateIdFromSourceOptions(options: DataSourceOptions): string */ export function generateWMSIdFromSourceOptions(options: WMSDataSourceOptions) { const layers = options.params.layers; - const url = options.url.charAt(0) === '/'? window.location.origin + options.url : options.url + const url = options.url.charAt(0) === '/' ? window.location.origin + options.url : options.url; const chain = 'wms' + url + layers; return Md5.hashStr(chain) as string; } From 37220dc023d67e62809ca0a4f405a675addbc332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Thu, 29 Aug 2019 15:42:47 -0400 Subject: [PATCH 04/88] feat(layer-list): Show/hide legend on click (title) (#390) * feat(layer-list) show/hide legend on click (title) * typo * refactor(layer-list) Line spacing beetween layers --- .../lib/layer/layer-item/layer-item.component.html | 13 ++----------- .../lib/layer/layer-item/layer-item.component.scss | 9 ++++++++- .../lib/layer/layer-item/layer-item.component.ts | 4 ++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/geo/src/lib/layer/layer-item/layer-item.component.html b/packages/geo/src/lib/layer/layer-item/layer-item.component.html index 7edfd06f8b..cbb6a3b442 100644 --- a/packages/geo/src/lib/layer/layer-item/layer-item.component.html +++ b/packages/geo/src/lib/layer/layer-item/layer-item.component.html @@ -1,14 +1,5 @@ - - - -

    {{layer.title}}

    + +

    {{layer.title}}