geonetwork-ui 2.11.0-dev.4c200c0a1 → 2.11.0-dev.57f4be358

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.
Files changed (49) hide show
  1. package/fesm2022/geonetwork-ui.mjs +1290 -1283
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +116 -80
  4. package/index.d.ts.map +1 -1
  5. package/package.json +1 -1
  6. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +90 -31
  7. package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
  8. package/src/libs/common/domain/src/lib/model/search/filter.model.ts +12 -2
  9. package/src/libs/feature/map/src/index.ts +0 -2
  10. package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
  11. package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
  12. package/src/libs/feature/search/src/index.ts +2 -0
  13. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +3 -0
  14. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +21 -4
  15. package/src/libs/feature/{map/src/lib → search/src/lib/geocoding}/geocoding.service.ts +16 -7
  16. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +8 -0
  17. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +40 -0
  18. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +2 -0
  19. package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
  20. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +56 -4
  21. package/src/libs/feature/search/src/lib/utils/service/fields.ts +67 -9
  22. package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
  23. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +10 -1
  24. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +8 -0
  25. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
  26. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
  27. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
  28. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +5 -11
  29. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +34 -4
  30. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  31. package/src/libs/util/app-config/src/lib/app-config.ts +22 -0
  32. package/src/libs/util/app-config/src/lib/fixtures.ts +33 -1
  33. package/src/libs/util/app-config/src/lib/model.ts +14 -1
  34. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  35. package/src/libs/util/shared/src/lib/utils/geojson.ts +16 -0
  36. package/translations/de.json +10 -3
  37. package/translations/en.json +11 -4
  38. package/translations/es.json +10 -3
  39. package/translations/fr.json +15 -8
  40. package/translations/it.json +10 -3
  41. package/translations/nl.json +10 -3
  42. package/translations/pt.json +10 -3
  43. package/translations/sk.json +10 -3
  44. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.css +0 -0
  45. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  46. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  47. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  48. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  49. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
@@ -7,6 +7,8 @@ export interface TermsAggregationParams {
7
7
  limit: number
8
8
  sort: AggregationSort
9
9
  filter?: string
10
+ includeValues?: string[]
11
+ excludeValues?: string[]
10
12
  }
11
13
  export interface HistogramAggregationParams {
12
14
  type: 'histogram'
@@ -21,7 +21,10 @@ export type QueryString = {
21
21
  query_string: string
22
22
  }
23
23
  export type QueryRange = {
24
- range: Record<string, { format: string; gte: string; lte: string }>
24
+ range: Record<
25
+ string,
26
+ { format: string; gte?: string; lte?: string; relation?: string }
27
+ >
25
28
  }
26
29
  export type QueryGeoShape = {
27
30
  geo_shape: {
@@ -31,4 +34,11 @@ export type QueryGeoShape = {
31
34
  }
32
35
  }
33
36
  }
34
- export type FilterQuery = Array<QueryString | QueryRange | QueryGeoShape>
37
+ export type QueryBool = {
38
+ bool: {
39
+ filter: QueryRange[]
40
+ }
41
+ }
42
+ export type FilterQuery = Array<
43
+ QueryString | QueryRange | QueryGeoShape | QueryBool
44
+ >
@@ -6,8 +6,6 @@ export * from './lib/feature-map.module'
6
6
  export * from './lib/map-state-container/map-state-container.component'
7
7
  export * from './lib/constant'
8
8
  export * from './lib/utils'
9
- export * from './lib/style'
10
9
  export * from './lib/layers-panel/layers-panel.component'
11
10
  export * from './lib/add-layer-from-catalog/add-layer-from-catalog.component'
12
11
  export * from './lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component'
13
- export * from './lib/geocoding/geocoding.component'
@@ -2,18 +2,11 @@ import { NgModule } from '@angular/core'
2
2
  import { StoreModule } from '@ngrx/store'
3
3
  import * as fromMap from './+state/map.reducer'
4
4
  import { MapFacade } from './+state/map.facade'
5
- import { GEOCODING_PROVIDER, GeocodingProvider } from './geocoding.service'
6
5
 
7
6
  @NgModule({
8
7
  imports: [
9
8
  StoreModule.forFeature(fromMap.MAP_FEATURE_KEY, fromMap.mapReducer),
10
9
  ],
11
- providers: [
12
- MapFacade,
13
- {
14
- provide: GEOCODING_PROVIDER,
15
- useValue: ['geonames', { maxRows: 5 }] as GeocodingProvider,
16
- },
17
- ],
10
+ providers: [MapFacade],
18
11
  })
19
12
  export class FeatureMapModule {}
@@ -33,7 +33,6 @@ import { RecordsRepositoryInterface } from '../../../../../../libs/common/domain
33
33
  import { NOT_KNOWN_CONSTRAINT } from '../../../../../../libs/feature/editor/src'
34
34
  import { NotificationsService } from '../../../../../../libs/feature/notifications/src'
35
35
  import { ButtonComponent, TextInputComponent } from '../../../../../../libs/ui/inputs/src'
36
- import { getOptionalEditorConfig } from '../../../../../../libs/util/app-config/src'
37
36
  import { NgIcon, provideIcons, provideNgIconsConfig } from '@ng-icons/core'
38
37
  import { iconoirAppWindow, iconoirPlusCircle } from '@ng-icons/iconoir'
39
38
  import { matCloseOutline } from '@ng-icons/material-icons/outline'
@@ -48,6 +47,10 @@ marker('notify.reuse.form.error.title')
48
47
  marker('notify.reuse.form.error.body')
49
48
 
50
49
  export const REUSE_FORM_URL = new InjectionToken<string>('reuseFormUrl')
50
+ // language assigned to the created reuse record; falls back to the current UI language
51
+ export const NEW_RECORD_DEFAULT_LANGUAGE = new InjectionToken<string>(
52
+ 'newRecordDefaultLanguage'
53
+ )
51
54
 
52
55
  @Component({
53
56
  selector: 'gn-ui-notify-reuse-form',
@@ -86,6 +89,9 @@ export class NotifyReuseFormComponent implements OnDestroy {
86
89
  private readonly notificationsService = inject(NotificationsService)
87
90
  private readonly platformServiceInterface = inject(PlatformServiceInterface)
88
91
  reuseFormUrl = inject(REUSE_FORM_URL, { optional: true })
92
+ private newRecordDefaultLanguage = inject(NEW_RECORD_DEFAULT_LANGUAGE, {
93
+ optional: true,
94
+ })
89
95
  private locationStrategy = inject(LocationStrategy)
90
96
 
91
97
  me = toSignal(this.platformServiceInterface.getMe())
@@ -158,8 +164,7 @@ export class NotifyReuseFormComponent implements OnDestroy {
158
164
  submit() {
159
165
  if (!this.isFormValid()) return
160
166
  const defaultLang =
161
- getOptionalEditorConfig()?.NEW_RECORD_DEFAULT_LANGUAGE ??
162
- this.translate.currentLang
167
+ this.newRecordDefaultLanguage ?? this.translate.currentLang
163
168
  const onlineResource: OnlineLinkResource = {
164
169
  type: 'link',
165
170
  url: new URL(this.url()),
@@ -1,4 +1,6 @@
1
1
  export * from './lib/feature-search.module'
2
+ export * from './lib/geocoding/geocoding.service'
3
+ export * from './lib/location-search/location-search.component'
2
4
  export * from './lib/filter-geometry.token'
3
5
  export * from './lib/record-url.token'
4
6
  export * from './lib/state/actions'
@@ -3,13 +3,16 @@
3
3
  [title]="title"
4
4
  [dateRange]="(selectedDateRange$ | async) ?? {}"
5
5
  (dateRangeChange)="onDateRangeChange($event)"
6
+ [attr.data-cy-field]="fieldName"
6
7
  ></gn-ui-date-range-dropdown>
7
8
  } @else if (fieldType === 'spatialExtent') {
8
9
  <gn-ui-spatial-extent-dropdown
9
10
  [title]="title"
11
+ [initialBbox]="(selectedBoundingBox$ | async) ?? null"
10
12
  [maxFileSizeMb]="spatialExtentMaxFileSize"
11
13
  (bboxChange)="onBboxChange($event)"
12
14
  (errorChange)="onSpatialExtentError($event)"
15
+ [attr.data-cy-field]="fieldName"
13
16
  ></gn-ui-spatial-extent-dropdown>
14
17
  } @else {
15
18
  <gn-ui-dropdown-multiselect
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ChangeDetectionStrategy,
3
3
  Component,
4
+ InjectionToken,
4
5
  Input,
5
6
  OnInit,
6
7
  inject,
@@ -27,7 +28,12 @@ import { CommonModule } from '@angular/common'
27
28
  import { BoundingBox } from '../../../../../../libs/util/shared/src'
28
29
  import { NotificationsService } from '../../../../../../libs/feature/notifications/src'
29
30
  import { TranslateService } from '@ngx-translate/core'
30
- import { getOptionalSearchConfig } from '../../../../../../libs/util/app-config/src'
31
+
32
+ // in MB, null means no limit
33
+ export const SPATIAL_EXTENT_MAX_FILE_SIZE = new InjectionToken<number | null>(
34
+ 'spatialExtentMaxFileSize',
35
+ { factory: () => null }
36
+ )
31
37
 
32
38
  @Component({
33
39
  selector: 'gn-ui-filter-dropdown',
@@ -52,8 +58,7 @@ export class FilterDropdownComponent implements OnInit {
52
58
  @Input() fieldName: string
53
59
  @Input() title: string
54
60
 
55
- spatialExtentMaxFileSize =
56
- getOptionalSearchConfig()?.SPATIAL_EXTENT_MAX_FILE_SIZE
61
+ spatialExtentMaxFileSize = inject(SPATIAL_EXTENT_MAX_FILE_SIZE)
57
62
 
58
63
  fieldType: FieldType
59
64
  choices$: Observable<Choice[]>
@@ -71,6 +76,14 @@ export class FilterDropdownComponent implements OnInit {
71
76
  map((selected) => (Array.isArray(selected) ? {} : (selected as DateRange)))
72
77
  ) as Observable<DateRange>
73
78
 
79
+ selectedBoundingBox$ = this.selected$.pipe(
80
+ map((selected) =>
81
+ Array.isArray(selected) && selected.length > 0
82
+ ? (selected as BoundingBox)
83
+ : null
84
+ )
85
+ ) as Observable<BoundingBox | null>
86
+
74
87
  onSelectedValues(values: unknown[]) {
75
88
  this.fieldsService
76
89
  .buildFiltersFromFieldValues({ [this.fieldName]: values as FieldValue[] })
@@ -80,7 +93,11 @@ export class FilterDropdownComponent implements OnInit {
80
93
  private spatialExtentErrorNotificationId: number | null = null
81
94
 
82
95
  onBboxChange(bbox: BoundingBox | null) {
83
- console.log(bbox)
96
+ this.fieldsService
97
+ .buildFiltersFromFieldValues({
98
+ [this.fieldName]: bbox,
99
+ })
100
+ .subscribe((filters) => this.searchService.updateFilters(filters))
84
101
  this.clearSpatialExtentErrorNotification()
85
102
  }
86
103
 
@@ -5,22 +5,31 @@ import {
5
5
  GeocodingResult,
6
6
  queryGeonames,
7
7
  GeonamesOptions,
8
- DataGouvFrOptions,
9
- queryDataGouvFr,
8
+ GeoplateformeOptions,
9
+ queryGeoplateforme,
10
10
  } from '@geospatial-sdk/geocoding'
11
11
  import { from, Observable, throwError } from 'rxjs'
12
12
  import { catchError } from 'rxjs/operators'
13
13
 
14
14
  type GeoadminGeocodingProvider = ['geoadmin', GeoadminOptions]
15
15
  type GeonamesGeocodingProvider = ['geonames', GeonamesOptions]
16
- type DataGouvFrGeocodingProvider = ['data-gouv-fr', DataGouvFrOptions]
16
+ type GeoplateformeGeocodingProvider = ['geoplateforme', GeoplateformeOptions]
17
17
  export type GeocodingProvider =
18
18
  | GeoadminGeocodingProvider
19
19
  | GeonamesGeocodingProvider
20
- | DataGouvFrGeocodingProvider
20
+ | GeoplateformeGeocodingProvider
21
+
22
+ export const DEFAULT_GEOCODING_PROVIDER = [
23
+ 'geonames',
24
+ { maxRows: 5 },
25
+ ] as GeocodingProvider
21
26
 
22
27
  export const GEOCODING_PROVIDER = new InjectionToken<GeocodingProvider>(
23
- 'geocoding-provider'
28
+ 'geocoding-provider',
29
+ {
30
+ providedIn: 'root',
31
+ factory: (): GeocodingProvider => DEFAULT_GEOCODING_PROVIDER,
32
+ }
24
33
  )
25
34
 
26
35
  @Injectable({
@@ -42,9 +51,9 @@ export class GeocodingService {
42
51
  queryGeonames(text, this.provider[1] as GeonamesOptions)
43
52
  )
44
53
  break
45
- case 'data-gouv-fr':
54
+ case 'geoplateforme':
46
55
  queryObservable = from(
47
- queryDataGouvFr(text, this.provider[1] as DataGouvFrOptions)
56
+ queryGeoplateforme(text, this.provider[1] as GeoplateformeOptions)
48
57
  )
49
58
  break
50
59
  default:
@@ -0,0 +1,8 @@
1
+ <gn-ui-autocomplete
2
+ [action]="searchAction"
3
+ [displayWithFn]="displayWithFn"
4
+ [placeholder]="placeholder"
5
+ [displayWithTemplate]="displayWithTemplate"
6
+ (itemSelected)="handleItemSelected($event)"
7
+ >
8
+ </gn-ui-autocomplete>
@@ -0,0 +1,40 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ EventEmitter,
5
+ inject,
6
+ Input,
7
+ Output,
8
+ TemplateRef,
9
+ } from '@angular/core'
10
+ import { Observable } from 'rxjs'
11
+ import { GeocodingResult } from '@geospatial-sdk/geocoding'
12
+ import {
13
+ AutocompleteComponent,
14
+ AutocompleteItem,
15
+ } from '../../../../../../libs/ui/inputs/src'
16
+ import { GeocodingService } from '../geocoding/geocoding.service'
17
+
18
+ @Component({
19
+ selector: 'gn-ui-location-search',
20
+ templateUrl: './location-search.component.html',
21
+ changeDetection: ChangeDetectionStrategy.OnPush,
22
+ standalone: true,
23
+ imports: [AutocompleteComponent],
24
+ })
25
+ export class LocationSearchComponent {
26
+ private geocodingService = inject(GeocodingService)
27
+
28
+ @Input() placeholder = ''
29
+ @Input() displayWithTemplate?: TemplateRef<{ $implicit: GeocodingResult }>
30
+ @Output() resultSelected = new EventEmitter<GeocodingResult>()
31
+
32
+ displayWithFn = (item: AutocompleteItem) => (item as GeocodingResult).label
33
+
34
+ searchAction = (text: string): Observable<AutocompleteItem[]> =>
35
+ this.geocodingService.query(text)
36
+
37
+ handleItemSelected(item: AutocompleteItem) {
38
+ this.resultSelected.emit(item as GeocodingResult)
39
+ }
40
+ }
@@ -20,6 +20,8 @@ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
20
20
 
21
21
  marker('search.filters.summaryLabel.user')
22
22
  marker('search.filters.summaryLabel.changeDate')
23
+ marker('search.filters.summaryLabel.resourceCreationRevisionDate')
24
+ marker('search.filters.summaryLabel.temporalExtent')
23
25
 
24
26
  const OPEN_BOUND = '…'
25
27
 
@@ -8,7 +8,6 @@ import {
8
8
  SortByField,
9
9
  } from '../../../../../../libs/common/domain/src/lib/model/search'
10
10
  import { DEFAULT_PAGE_SIZE, FIELDS_SUMMARY } from '../constants'
11
- import { getOptionalSearchConfig } from '../../../../../../libs/util/app-config/src'
12
11
  import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
13
12
 
14
13
  export const SEARCH_FEATURE_KEY = 'searchState'
@@ -56,9 +55,7 @@ export const initSearch = (): SearchStateSearch => {
56
55
  },
57
56
  params: {
58
57
  filters: {},
59
- pageSize: getOptionalSearchConfig()?.LIMIT
60
- ? getOptionalSearchConfig().LIMIT
61
- : DEFAULT_PAGE_SIZE,
58
+ pageSize: DEFAULT_PAGE_SIZE,
62
59
  currentPage: 0,
63
60
  favoritesOnly: false,
64
61
  useSpatialFilter: true,
@@ -1,4 +1,4 @@
1
- import { Injectable, Injector, inject } from '@angular/core'
1
+ import { inject, Injectable, InjectionToken, Injector } from '@angular/core'
2
2
  import {
3
3
  AbstractSearchField,
4
4
  AvailableServicesField,
@@ -11,10 +11,11 @@ import {
11
11
  MultilingualSearchField,
12
12
  OrganizationSearchField,
13
13
  OwnerSearchField,
14
+ RecordKindField,
15
+ ResourceCreationRevisionDateSearchField,
14
16
  ResourceTypeLegacyField,
15
17
  SimpleSearchField,
16
18
  TranslatedSearchField,
17
- RecordKindField,
18
19
  UserSearchField,
19
20
  } from './fields'
20
21
  import { forkJoin, Observable, of } from 'rxjs'
@@ -43,14 +44,30 @@ marker('search.filters.producerOrg')
43
44
  marker('search.filters.publisherOrg')
44
45
  marker('search.filters.user')
45
46
  marker('search.filters.changeDate')
47
+ marker('search.filters.resourceCreationRevisionDate')
48
+ marker('search.filters.temporalExtent')
46
49
  marker('search.filters.spatialExtent')
50
+ marker('search.filters.documentStandard')
51
+
52
+ export interface CustomSearchField {
53
+ name: string
54
+ baseFilter: string
55
+ excludeValues?: string[]
56
+ includeValues?: string[]
57
+ }
58
+
59
+ export const CUSTOM_FIELDS = new InjectionToken<CustomSearchField[]>(
60
+ 'custom-fields'
61
+ )
47
62
  @Injectable({
48
63
  providedIn: 'root',
49
64
  })
50
65
  export class FieldsService {
51
66
  protected injector = inject(Injector)
67
+ private customFields =
68
+ inject<CustomSearchField[]>(CUSTOM_FIELDS, { optional: true }) ?? []
52
69
 
53
- protected fields = {
70
+ private baseFields: Record<string, AbstractSearchField> = {
54
71
  organization: new OrganizationSearchField(this.injector),
55
72
  format: new SimpleSearchField('format', this.injector, 'asc'),
56
73
  resourceType: new ResourceTypeLegacyField(this.injector), // Deprecated, use `recordKind` instead
@@ -95,9 +112,44 @@ export class FieldsService {
95
112
  ),
96
113
  user: new UserSearchField(this.injector),
97
114
  changeDate: new DateRangeSearchField('changeDate', this.injector, 'desc'),
115
+ resourceCreationRevisionDate: new ResourceCreationRevisionDateSearchField(
116
+ this.injector,
117
+ 'desc'
118
+ ),
119
+ temporalExtent: new DateRangeSearchField(
120
+ 'resourceTemporalExtentDateRange',
121
+ this.injector,
122
+ 'desc'
123
+ ),
98
124
  availableServices: new AvailableServicesField(this.injector),
99
125
  spatialExtent: new BoundingBoxSearchField('spatialExtent', this.injector),
100
- } as Record<string, AbstractSearchField>
126
+ }
127
+
128
+ protected fields: Record<string, AbstractSearchField>
129
+
130
+ constructor() {
131
+ this.fields = { ...this.baseFields }
132
+ for (const customField of this.customFields) {
133
+ const baseField = this.baseFields[customField.baseFilter]
134
+ if (!(baseField instanceof SimpleSearchField)) {
135
+ console.warn(
136
+ `The custom field '${customField.name}' relies on a base field '${
137
+ customField.baseFilter
138
+ }' that is not supported. This field will be ignored.`
139
+ )
140
+ continue
141
+ }
142
+ const newField = baseField.clone()
143
+ newField.setFieldIdentifier(customField.name)
144
+ if (customField.includeValues) {
145
+ newField.includeValues = customField.includeValues
146
+ }
147
+ if (customField.excludeValues) {
148
+ newField.excludeValues = customField.excludeValues
149
+ }
150
+ this.fields[customField.name] = newField
151
+ }
152
+ }
101
153
 
102
154
  get supportedFields() {
103
155
  return Object.keys(this.fields)
@@ -53,6 +53,15 @@ export class SimpleSearchField implements AbstractSearchField {
53
53
  // FIXME: this is required to register runtime fields; abstract this as well
54
54
  protected esService = this.injector.get(ElasticsearchService)
55
55
 
56
+ private customIdentifier?: string
57
+
58
+ protected get fieldIdentifier(): string {
59
+ return this.customIdentifier ?? this.esFieldName
60
+ }
61
+
62
+ public includeValues: string[] = []
63
+ public excludeValues: string[] = []
64
+
56
65
  constructor(
57
66
  protected esFieldName: string,
58
67
  protected injector: Injector,
@@ -60,13 +69,24 @@ export class SimpleSearchField implements AbstractSearchField {
60
69
  protected orderType: 'key' | 'count' = 'key'
61
70
  ) {}
62
71
 
72
+ public setFieldIdentifier(fieldIdentifier: string) {
73
+ this.customIdentifier = fieldIdentifier
74
+ this.esService.registerFieldAlias(fieldIdentifier, this.esFieldName)
75
+ }
76
+
63
77
  protected getAggregations(): AggregationsParams {
64
78
  return {
65
- [this.esFieldName]: {
79
+ [this.fieldIdentifier]: {
66
80
  type: 'terms',
67
81
  field: this.esFieldName,
68
82
  limit: 1000,
69
83
  sort: [this.order, this.orderType],
84
+ ...(this.includeValues?.length && {
85
+ includeValues: this.includeValues,
86
+ }),
87
+ ...(this.excludeValues?.length && {
88
+ excludeValues: this.excludeValues,
89
+ }),
70
90
  },
71
91
  }
72
92
  }
@@ -79,7 +99,7 @@ export class SimpleSearchField implements AbstractSearchField {
79
99
  return this.repository.aggregate(this.getAggregations()).pipe(
80
100
  map(
81
101
  (response) =>
82
- (response[this.esFieldName] as AggregationBuckets).buckets || []
102
+ (response[this.fieldIdentifier] as AggregationBuckets).buckets || []
83
103
  ),
84
104
  switchMap((buckets: TermBucket[]) => {
85
105
  const bucketPromises = buckets.map(async (bucket) => ({
@@ -97,7 +117,7 @@ export class SimpleSearchField implements AbstractSearchField {
97
117
  // FieldValue[]
98
118
  if (this.getType() === 'values') {
99
119
  return of({
100
- [this.esFieldName]: (values as FieldValue[]).reduce((acc, val) => {
120
+ [this.fieldIdentifier]: (values as FieldValue[]).reduce((acc, val) => {
101
121
  const value = val.toString()
102
122
  if (value !== '') {
103
123
  return { ...acc, [value]: true }
@@ -108,13 +128,13 @@ export class SimpleSearchField implements AbstractSearchField {
108
128
  }
109
129
  // DateRange
110
130
  return of({
111
- [this.esFieldName]: values[0] !== '' ? values[0] : {},
131
+ [this.fieldIdentifier]: values[0] !== '' ? values[0] : {},
112
132
  })
113
133
  }
114
134
  getValuesForFilter(
115
135
  filters: FieldFilters
116
136
  ): Observable<FieldValue[] | FieldValue | DateRange> {
117
- const filter = filters[this.esFieldName]
137
+ const filter = filters[this.fieldIdentifier]
118
138
  if (!filter) return of([])
119
139
  // filter by expression
120
140
  if (typeof filter === 'string') {
@@ -132,6 +152,10 @@ export class SimpleSearchField implements AbstractSearchField {
132
152
  getType(): FieldType {
133
153
  return 'values'
134
154
  }
155
+
156
+ clone(): typeof this {
157
+ return Object.create(this)
158
+ }
135
159
  }
136
160
 
137
161
  export class TranslatedSearchField extends SimpleSearchField {
@@ -435,6 +459,40 @@ export class DateRangeSearchField extends SimpleSearchField {
435
459
  }
436
460
  }
437
461
 
462
+ // treats a resource's creation/revision dates as an interval (its min and max), so a record matches
463
+ // when that interval intersects the filter range, not just when a single date falls inside it
464
+ export class ResourceCreationRevisionDateSearchField extends DateRangeSearchField {
465
+ constructor(injector: Injector, order: 'asc' | 'desc' = 'desc') {
466
+ super('resourceCreationRevisionDate', injector, order)
467
+ const dateSourceFields = [
468
+ 'creationDateForResource',
469
+ 'revisionDateForResource',
470
+ ]
471
+ const collectSortedDates = dateSourceFields
472
+ .map(
473
+ (field) => `if (doc.containsKey('${field}')) {
474
+ for (def date : doc['${field}']) { dates.add(date.millis); }
475
+ }`
476
+ )
477
+ .join('\n')
478
+
479
+ this.esService.registerRuntimeField(
480
+ 'resourceCreationRevisionDateMin',
481
+ `def dates = [];
482
+ ${collectSortedDates}
483
+ if (dates.length > 0) { dates.sort(null); emit(dates[0]); }`,
484
+ 'date'
485
+ )
486
+ this.esService.registerRuntimeField(
487
+ 'resourceCreationRevisionDateMax',
488
+ `def dates = [];
489
+ ${collectSortedDates}
490
+ if (dates.length > 0) { dates.sort(null); emit(dates[dates.length - 1]); }`,
491
+ 'date'
492
+ )
493
+ }
494
+ }
495
+
438
496
  export class BoundingBoxSearchField extends SimpleSearchField {
439
497
  getAvailableValues(): Observable<FieldAvailableValue[]> {
440
498
  return of([])
@@ -442,12 +500,12 @@ export class BoundingBoxSearchField extends SimpleSearchField {
442
500
 
443
501
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> {
444
502
  return of({
445
- [this.esFieldName]: values.map(Number) as BoundingBox,
503
+ [this.fieldIdentifier]: values.map(Number) as BoundingBox,
446
504
  })
447
505
  }
448
506
 
449
507
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
450
- const filter = filters[this.esFieldName]
508
+ const filter = filters[this.fieldIdentifier]
451
509
  return of(isBoundingBox(filter) ? filter : [])
452
510
  }
453
511
 
@@ -565,7 +623,7 @@ export class RecordKindField extends SimpleSearchField {
565
623
 
566
624
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters | string> {
567
625
  const filters: FieldFilters = {
568
- [this.esFieldName]: values.reduce((acc, value) => {
626
+ [this.fieldIdentifier]: values.reduce((acc, value) => {
569
627
  if (value === '') return { ...acc, [value]: true }
570
628
 
571
629
  const keysToAdd = this.TYPE_MAPPING[value] || [value]
@@ -592,7 +650,7 @@ export class RecordKindField extends SimpleSearchField {
592
650
  }
593
651
 
594
652
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
595
- const filter = filters[this.esFieldName]
653
+ const filter = filters[this.fieldIdentifier]
596
654
  if (!filter) return of([])
597
655
 
598
656
  const activeValues = Object.keys(filter).filter((v) => filter[v])
@@ -128,7 +128,8 @@ export class ServiceCapabilitiesComponent implements OnInit {
128
128
  this.loading = true
129
129
  this.availableLayers = await getLayers(
130
130
  this.apiLinks[0].url.href,
131
- this.apiLinks[0].accessServiceProtocol
131
+ this.apiLinks[0].accessServiceProtocol,
132
+ true
132
133
  )
133
134
  this.loading = false
134
135
  this.cdr.detectChanges()
@@ -83,7 +83,16 @@
83
83
  >
84
84
  @for (suggestion of suggestions$ | async; track suggestion) {
85
85
  <mat-option [value]="suggestion" class="p-2 suggestion text-start">
86
- {{ displayWithFnInternal(suggestion) }}
86
+ @if (displayWithTemplate) {
87
+ <ng-container
88
+ *ngTemplateOutlet="
89
+ displayWithTemplate;
90
+ context: { $implicit: suggestion }
91
+ "
92
+ ></ng-container>
93
+ } @else {
94
+ {{ displayWithFnInternal(suggestion) }}
95
+ }
87
96
  </mat-option>
88
97
  }
89
98
  </mat-autocomplete>
@@ -11,6 +11,7 @@ import {
11
11
  OnInit,
12
12
  Output,
13
13
  SimpleChanges,
14
+ TemplateRef,
14
15
  ViewChild,
15
16
  inject,
16
17
  } from '@angular/core'
@@ -97,6 +98,13 @@ export class AutocompleteComponent
97
98
  @ViewChild(MatAutocompleteTrigger) triggerRef: MatAutocompleteTrigger
98
99
  @ViewChild(MatAutocomplete) autocomplete: MatAutocomplete
99
100
  @ViewChild('searchInput') inputRef: ElementRef<HTMLInputElement>
101
+ /**
102
+ * Custom template to render each suggestion. Takes precedence over
103
+ * `displayWithFn` when set.
104
+ */
105
+ @Input() displayWithTemplate?: TemplateRef<{
106
+ $implicit: AutocompleteItem
107
+ }>
100
108
 
101
109
  searching: boolean
102
110
  control = new UntypedFormControl()
@@ -20,10 +20,13 @@
20
20
  </div>
21
21
  }
22
22
  </div>
23
- <button class="h-6 w-6" data-test="dropdown-clear">
23
+ <button
24
+ class="h-6 w-6 flex items-center justify-center"
25
+ data-test="dropdown-clear"
26
+ >
24
27
  @if (hasSelectedChoices && !overlayOpen) {
25
28
  <ng-icon
26
- class="shrink-0 opacity-40 mr-1.5 hover:opacity-80 transition-colors clear-btn"
29
+ class="shrink-0 opacity-40 hover:opacity-80 transition-colors clear-btn"
27
30
  (click)="clearSelection($event)"
28
31
  name="matClose"
29
32
  ></ng-icon>
@@ -61,13 +64,13 @@
61
64
  #overlayContainer
62
65
  >
63
66
  <div
64
- class="border border-gray-300 rounded mb-2 mx-2 min-h-[44px] flex flex-row gap-[2px] flex-wrap p-2 focus-within:rounded focus-within:border-2 focus-within:border-primary"
67
+ class="border border-gray-300 rounded mb-2 mx-2 min-h-[44px] flex flex-row gap-1 flex-wrap p-2 focus-within:rounded focus-within:border-2 focus-within:border-primary"
65
68
  >
66
69
  @for (selected of selectedChoices; track selected) {
67
70
  <button
68
71
  type="button"
69
72
  [title]="selected.label"
70
- class="max-w-full bg-main text-white rounded pr-[7px] flex gap-1 items-center opacity-70 hover:opacity-100 focus:opacity-100 transition-opacity mb-1"
73
+ class="max-w-full bg-main text-white rounded pr-[7px] flex gap-1 items-center opacity-70 hover:opacity-100 focus:opacity-100 transition-opacity"
71
74
  (click)="select(selected, false)"
72
75
  >
73
76
  <div class="text-sm truncate leading-[26px] px-2">