diff --git a/projects/hslayers/components/draw/draw.component.ts b/projects/hslayers/components/draw/draw.component.ts index 2fd9a1313f..b128356757 100644 --- a/projects/hslayers/components/draw/draw.component.ts +++ b/projects/hslayers/components/draw/draw.component.ts @@ -10,11 +10,11 @@ import { HsPanelHeaderComponent, HsPanelHelpersModule, } from 'hslayers-ng/common/panels'; -import {HsQueryModule} from 'hslayers-ng/components/query'; import {TranslateCustomPipe} from 'hslayers-ng/services/language'; import {HsDrawEditComponent} from './draw-edit/draw-edit.component'; import {HsDrawPanelComponent} from './draw-panel/draw-panel.component'; +import {HsQueryFeatureListComponent} from 'hslayers-ng/components/query'; @Component({ selector: 'hs-draw', @@ -27,7 +27,7 @@ import {HsDrawPanelComponent} from './draw-panel/draw-panel.component'; HsDrawEditComponent, HsDrawPanelComponent, HsPanelBaseComponent, - HsQueryModule, + HsQueryFeatureListComponent, HsPanelHeaderComponent, HsPanelHelpersModule, ], diff --git a/projects/hslayers/components/query/attribute-row/attribute-row.component.ts b/projects/hslayers/components/query/attribute-row/attribute-row.component.ts index d43c3e334b..a204e38c83 100644 --- a/projects/hslayers/components/query/attribute-row/attribute-row.component.ts +++ b/projects/hslayers/components/query/attribute-row/attribute-row.component.ts @@ -1,8 +1,11 @@ import {Component, Input, OnInit} from '@angular/core'; +import {FormsModule} from '@angular/forms'; @Component({ selector: 'hs-query-attribute-row', templateUrl: './attribute-row.component.html', + standalone: true, + imports: [FormsModule], }) export class HsQueryAttributeRowComponent implements OnInit { isObject = false; diff --git a/projects/hslayers/components/query/default-info-panel-body/default-info-panel-body.component.ts b/projects/hslayers/components/query/default-info-panel-body/default-info-panel-body.component.ts index 64ed75720c..24879f0307 100644 --- a/projects/hslayers/components/query/default-info-panel-body/default-info-panel-body.component.ts +++ b/projects/hslayers/components/query/default-info-panel-body/default-info-panel-body.component.ts @@ -1,10 +1,18 @@ import {Component, OnInit} from '@angular/core'; import {HsQueryBaseService} from 'hslayers-ng/services/query'; - +import {HsQueryFeatureListComponent} from '../feature-list/feature-list.component'; +import {NgbDropdownModule} from '@ng-bootstrap/ng-bootstrap'; +import {TranslateCustomPipe} from 'hslayers-ng/services/language'; @Component({ selector: 'hs-query-default-info-panel-body', templateUrl: './default-info-panel-body.component.html', + standalone: true, + imports: [ + HsQueryFeatureListComponent, + NgbDropdownModule, + TranslateCustomPipe, + ], }) export class HsQueryDefaultInfoPanelBodyComponent implements OnInit { featureInfoExpanded: boolean; diff --git a/projects/hslayers/components/query/feature-list/feature-list.component.ts b/projects/hslayers/components/query/feature-list/feature-list.component.ts index 4b15fe64f5..c213f74b41 100644 --- a/projects/hslayers/components/query/feature-list/feature-list.component.ts +++ b/projects/hslayers/components/query/feature-list/feature-list.component.ts @@ -3,17 +3,35 @@ import {Component} from '@angular/core'; import {Feature, getUid} from 'ol'; import {Geometry} from 'ol/geom'; +import {AsyncPipe, NgClass, NgStyle, SlicePipe} from '@angular/common'; +import {FormsModule} from '@angular/forms'; import {HsConfirmDialogComponent} from 'hslayers-ng/common/confirm'; import {HsDialogContainerService} from 'hslayers-ng/common/dialogs'; +import {HsDownloadModule} from 'hslayers-ng/common/download'; import {HsFeatureCommonService} from '../feature-common.service'; import {HsQueryBaseService} from 'hslayers-ng/services/query'; +import {HsQueryFeatureComponent} from '../feature/feature.component'; import {HsQueryVectorService} from 'hslayers-ng/services/query'; +import {NgbDropdownModule} from '@ng-bootstrap/ng-bootstrap'; +import {TranslateCustomPipe} from 'hslayers-ng/services/language'; import {exportFormats} from '../feature-common.service'; import {getTitle} from 'hslayers-ng/common/extensions'; @Component({ selector: 'hs-query-feature-list', templateUrl: './feature-list.component.html', + standalone: true, + imports: [ + TranslateCustomPipe, + AsyncPipe, + FormsModule, + NgbDropdownModule, + HsDownloadModule, + NgClass, + NgStyle, + HsQueryFeatureComponent, + SlicePipe, + ], }) export class HsQueryFeatureListComponent { exportMenuVisible; diff --git a/projects/hslayers/components/query/feature/feature.component.ts b/projects/hslayers/components/query/feature/feature.component.ts index 55a3f89512..88540ef9df 100644 --- a/projects/hslayers/components/query/feature/feature.component.ts +++ b/projects/hslayers/components/query/feature/feature.component.ts @@ -6,16 +6,32 @@ import {Feature} from 'ol'; import {Geometry} from 'ol/geom'; import {Layer} from 'ol/layer'; +import {AsyncPipe, NgClass} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {HsDownloadModule} from 'hslayers-ng/common/download'; import {HsFeatureCommonService} from '../feature-common.service'; import {HsLayerUtilsService} from 'hslayers-ng/services/utils'; import {HsMapService} from 'hslayers-ng/services/map'; +import {HsQueryAttributeRowComponent} from '../attribute-row/attribute-row.component'; import {HsQueryVectorService} from 'hslayers-ng/services/query'; +import {NgbDropdownModule} from '@ng-bootstrap/ng-bootstrap'; +import {TranslateCustomPipe} from 'hslayers-ng/services/language'; import {exportFormats} from '../feature-common.service'; import {getTitle} from 'hslayers-ng/common/extensions'; @Component({ selector: 'hs-query-feature', templateUrl: './feature.component.html', + standalone: true, + imports: [ + TranslateCustomPipe, + AsyncPipe, + FormsModule, + NgbDropdownModule, + HsDownloadModule, + NgClass, + HsQueryAttributeRowComponent, + ], }) export class HsQueryFeatureComponent implements OnInit { @Input() feature; diff --git a/projects/hslayers/components/query/public-api.ts b/projects/hslayers/components/query/public-api.ts index bcb810df2b..9c0d584773 100644 --- a/projects/hslayers/components/query/public-api.ts +++ b/projects/hslayers/components/query/public-api.ts @@ -6,4 +6,3 @@ export * from './feature/feature.component'; export * from './query-wms.service'; export * from './query-wmts.service'; export * from './query.component'; -export * from './query.module'; diff --git a/projects/hslayers/components/query/query.component.html b/projects/hslayers/components/query/query.component.html index 32aaed7124..e4b3f0c0dd 100644 --- a/projects/hslayers/components/query/query.component.html +++ b/projects/hslayers/components/query/query.component.html @@ -1,42 +1,39 @@ @if (isVisible$ | async) { -
- - @if (noFeatureSelected()) { -
-
- -

{{'QUERY.infoPanel.noFeaturesSelected' | translateHs }}

-

{{'QUERY.infoPanel.clickOnMap' | translateHs }}

-
-
- } - @if (hsLayoutService.mainpanel === 'query') { - - - } - - @if (hsQueryBaseService?.coordinates !== undefined && hsQueryBaseService?.coordinates.length > 0) { -
-
-
{{hsQueryBaseService?.coordinates[0].name}}
-
-
-
- @if (hsQueryBaseService?.coordinates.length>0) { - - } - -
-
+
+ + @if (noFeatureSelected()) { +
+
+ +

{{'QUERY.infoPanel.noFeaturesSelected' | translateHs }}

+

{{'QUERY.infoPanel.clickOnMap' | translateHs }}

+
+
+ } + @if (hsLayoutService.mainpanel === 'query') { + + + } + @if (hsQueryBaseService?.coordinates !== undefined && hsQueryBaseService?.coordinates.length > 0) { +
+
+
{{hsQueryBaseService?.coordinates[0].name}}
+
+
+
+ @if (hsQueryBaseService?.coordinates.length>0) { + + } +
- } +
+ } +
} \ No newline at end of file diff --git a/projects/hslayers/components/query/query.component.ts b/projects/hslayers/components/query/query.component.ts index 774dc2f3ce..7b31da1806 100644 --- a/projects/hslayers/components/query/query.component.ts +++ b/projects/hslayers/components/query/query.component.ts @@ -1,23 +1,45 @@ //TODO: Check if this import is still needed. Breaks production though //import 'ol-popup/src/ol-popup.css'; -import {Component, OnInit} from '@angular/core'; +import {Component, Inject, OnInit, Type} from '@angular/core'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import Popup from 'ol-popup'; import {Subject} from 'rxjs'; import {debounceTime, takeUntil} from 'rxjs/operators'; +import {AsyncPipe, NgClass} from '@angular/common'; +import {FormsModule} from '@angular/forms'; import {HsDrawService} from 'hslayers-ng/services/draw'; import {HsLogService} from 'hslayers-ng/services/log'; import {HsMapService} from 'hslayers-ng/services/map'; -import {HsPanelBaseComponent} from 'hslayers-ng/common/panels'; +import { + HsPanelBaseComponent, + HsPanelHeaderComponent, +} from 'hslayers-ng/common/panels'; import {HsQueryBaseService} from 'hslayers-ng/services/query'; +import {HsQueryDefaultInfoPanelBodyComponent} from './default-info-panel-body/default-info-panel-body.component'; import {HsQueryVectorService} from 'hslayers-ng/services/query'; import {HsQueryWmsService} from './query-wms.service'; +import {QUERY_INFO_PANEL} from './query.tokens'; +import {TranslateCustomPipe} from 'hslayers-ng/services/language'; @Component({ selector: 'hs-query', templateUrl: './query.component.html', + standalone: true, + imports: [ + TranslateCustomPipe, + HsPanelHeaderComponent, + AsyncPipe, + NgClass, + FormsModule, + ], + providers: [ + { + provide: QUERY_INFO_PANEL, + useValue: HsQueryDefaultInfoPanelBodyComponent, // Default value + }, + ], }) export class HsQueryComponent extends HsPanelBaseComponent implements OnInit { popup = new Popup(); @@ -33,6 +55,7 @@ export class HsQueryComponent extends HsPanelBaseComponent implements OnInit { private hsQueryVectorService: HsQueryVectorService, private hsDrawService: HsDrawService, private hsQueryWmsService: HsQueryWmsService, + @Inject(QUERY_INFO_PANEL) public infoPanelComponent: Type, ) { super(); } diff --git a/projects/hslayers/components/query/query.module.ts b/projects/hslayers/components/query/query.module.ts deleted file mode 100644 index 01b752c6f9..0000000000 --- a/projects/hslayers/components/query/query.module.ts +++ /dev/null @@ -1,41 +0,0 @@ -import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms'; - -import {NgbDropdownModule} from '@ng-bootstrap/ng-bootstrap'; - -import {HsDownloadModule} from 'hslayers-ng/common/download'; -import {HsPanelHeaderComponent} from 'hslayers-ng/common/panels'; -import {HsPanelHelpersModule} from 'hslayers-ng/common/panels'; -import {HsQueryAttributeRowComponent} from './attribute-row/attribute-row.component'; -import {HsQueryComponent} from './query.component'; -import {HsQueryDefaultInfoPanelBodyComponent} from './default-info-panel-body/default-info-panel-body.component'; -import {HsQueryFeatureComponent} from './feature/feature.component'; -import {HsQueryFeatureListComponent} from './feature-list/feature-list.component'; -import {TranslateCustomPipe} from 'hslayers-ng/services/language'; - -@NgModule({ - schemas: [CUSTOM_ELEMENTS_SCHEMA], - declarations: [ - HsQueryComponent, - HsQueryFeatureComponent, - HsQueryFeatureListComponent, - HsQueryDefaultInfoPanelBodyComponent, - HsQueryAttributeRowComponent, - ], - imports: [ - CommonModule, - HsPanelHelpersModule, - FormsModule, - TranslateCustomPipe, - HsDownloadModule, - NgbDropdownModule, - HsPanelHeaderComponent, - ], - exports: [ - HsQueryComponent, - HsQueryFeatureComponent, - HsQueryFeatureListComponent, - ], -}) -export class HsQueryModule {} diff --git a/projects/hslayers/components/query/query.tokens.ts b/projects/hslayers/components/query/query.tokens.ts new file mode 100644 index 0000000000..818591688c --- /dev/null +++ b/projects/hslayers/components/query/query.tokens.ts @@ -0,0 +1,5 @@ +import {InjectionToken, Type} from '@angular/core'; + +export const QUERY_INFO_PANEL = new InjectionToken>( + 'QUERY_INFO_PANEL', +);