geonetwork-ui 2.11.0-dev.f5ee66b24 → 2.11.0-dev.fb48cfeee

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 (74) hide show
  1. package/fesm2022/geonetwork-ui.mjs +1570 -1196
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +153 -71
  4. package/index.d.ts.map +1 -1
  5. package/package.json +6 -5
  6. package/src/libs/api/metadata-converter/src/lib/dcat-ap/dcat-ap.converter.ts +2 -0
  7. package/src/libs/api/metadata-converter/src/lib/fixtures/mel.records.dataset+featurecatalog.ts +395 -0
  8. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +35 -8
  9. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +19 -0
  10. package/src/libs/api/metadata-converter/src/lib/iso19115-3/iso19115-3.converter.ts +17 -6
  11. package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +110 -0
  12. package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +131 -0
  13. package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +9 -0
  14. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +2 -1
  15. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +29 -3
  16. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +83 -35
  17. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
  18. package/src/libs/common/domain/src/lib/model/record/flags.model.ts +1 -0
  19. package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
  20. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +14 -18
  21. package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
  22. package/src/libs/common/domain/src/lib/model/search/filter.model.ts +4 -1
  23. package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -0
  24. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +20 -1
  25. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +42 -62
  26. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +32 -19
  27. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-constraints/form-field-constraints.component.ts +3 -5
  28. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.ts +2 -2
  29. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.css +0 -0
  30. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.html +18 -0
  31. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
  33. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
  34. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
  35. package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
  36. package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
  37. package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
  38. package/src/libs/feature/map/src/index.ts +0 -1
  39. package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
  40. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +3 -1
  41. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +1 -1
  42. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +7 -1
  43. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +26 -4
  44. package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +52 -8
  45. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +11 -1
  46. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +77 -3
  47. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +1 -0
  48. package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
  49. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +56 -4
  50. package/src/libs/feature/search/src/lib/utils/service/fields.ts +33 -9
  51. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
  52. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
  53. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
  54. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +2 -2
  55. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +3 -3
  56. package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
  57. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +8 -2
  58. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +34 -5
  59. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  60. package/src/libs/util/app-config/src/lib/app-config.ts +34 -0
  61. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  62. package/src/libs/util/app-config/src/lib/model.ts +24 -1
  63. package/src/libs/util/shared/src/lib/utils/geojson.ts +16 -0
  64. package/translations/de.json +12 -1
  65. package/translations/en.json +14 -3
  66. package/translations/es.json +12 -1
  67. package/translations/fr.json +19 -8
  68. package/translations/it.json +12 -1
  69. package/translations/nl.json +12 -1
  70. package/translations/pt.json +12 -1
  71. package/translations/sk.json +12 -1
  72. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  73. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  74. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
@@ -21,6 +21,7 @@ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
21
21
  marker('search.filters.summaryLabel.user')
22
22
  marker('search.filters.summaryLabel.changeDate')
23
23
  marker('search.filters.summaryLabel.resourceCreationRevisionDate')
24
+ marker('search.filters.summaryLabel.temporalExtent')
24
25
 
25
26
  const OPEN_BOUND = '…'
26
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,11 +11,11 @@ import {
11
11
  MultilingualSearchField,
12
12
  OrganizationSearchField,
13
13
  OwnerSearchField,
14
+ RecordKindField,
14
15
  ResourceCreationRevisionDateSearchField,
15
16
  ResourceTypeLegacyField,
16
17
  SimpleSearchField,
17
18
  TranslatedSearchField,
18
- RecordKindField,
19
19
  UserSearchField,
20
20
  } from './fields'
21
21
  import { forkJoin, Observable, of } from 'rxjs'
@@ -45,14 +45,29 @@ marker('search.filters.publisherOrg')
45
45
  marker('search.filters.user')
46
46
  marker('search.filters.changeDate')
47
47
  marker('search.filters.resourceCreationRevisionDate')
48
+ marker('search.filters.temporalExtent')
48
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
+ )
49
62
  @Injectable({
50
63
  providedIn: 'root',
51
64
  })
52
65
  export class FieldsService {
53
66
  protected injector = inject(Injector)
67
+ private customFields =
68
+ inject<CustomSearchField[]>(CUSTOM_FIELDS, { optional: true }) ?? []
54
69
 
55
- protected fields = {
70
+ private baseFields: Record<string, AbstractSearchField> = {
56
71
  organization: new OrganizationSearchField(this.injector),
57
72
  format: new SimpleSearchField('format', this.injector, 'asc'),
58
73
  resourceType: new ResourceTypeLegacyField(this.injector), // Deprecated, use `recordKind` instead
@@ -101,9 +116,46 @@ export class FieldsService {
101
116
  this.injector,
102
117
  'desc'
103
118
  ),
119
+ temporalExtent: new DateRangeSearchField(
120
+ 'resourceTemporalExtentDateRange',
121
+ this.injector,
122
+ 'desc'
123
+ ),
104
124
  availableServices: new AvailableServicesField(this.injector),
105
125
  spatialExtent: new BoundingBoxSearchField('spatialExtent', this.injector),
106
- } 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
+ if (!customField.name.includes(':')) {
143
+ console.warn(
144
+ `The custom field '${customField.name}' is not scoped with a prefix. Custom fields must have their names prefixed, for instance "myOrg:myKeywords". This field will be ignored.`
145
+ )
146
+ continue
147
+ }
148
+ const newField = baseField.clone()
149
+ newField.setFieldIdentifier(customField.name)
150
+ if (customField.includeValues) {
151
+ newField.includeValues = customField.includeValues
152
+ }
153
+ if (customField.excludeValues) {
154
+ newField.excludeValues = customField.excludeValues
155
+ }
156
+ this.fields[customField.name] = newField
157
+ }
158
+ }
107
159
 
108
160
  get supportedFields() {
109
161
  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 {
@@ -476,12 +500,12 @@ export class BoundingBoxSearchField extends SimpleSearchField {
476
500
 
477
501
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> {
478
502
  return of({
479
- [this.esFieldName]: values.map(Number) as BoundingBox,
503
+ [this.fieldIdentifier]: values.map(Number) as BoundingBox,
480
504
  })
481
505
  }
482
506
 
483
507
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
484
- const filter = filters[this.esFieldName]
508
+ const filter = filters[this.fieldIdentifier]
485
509
  return of(isBoundingBox(filter) ? filter : [])
486
510
  }
487
511
 
@@ -599,7 +623,7 @@ export class RecordKindField extends SimpleSearchField {
599
623
 
600
624
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters | string> {
601
625
  const filters: FieldFilters = {
602
- [this.esFieldName]: values.reduce((acc, value) => {
626
+ [this.fieldIdentifier]: values.reduce((acc, value) => {
603
627
  if (value === '') return { ...acc, [value]: true }
604
628
 
605
629
  const keysToAdd = this.TYPE_MAPPING[value] || [value]
@@ -626,7 +650,7 @@ export class RecordKindField extends SimpleSearchField {
626
650
  }
627
651
 
628
652
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
629
- const filter = filters[this.esFieldName]
653
+ const filter = filters[this.fieldIdentifier]
630
654
  if (!filter) return of([])
631
655
 
632
656
  const activeValues = Object.keys(filter).filter((v) => filter[v])
@@ -17,9 +17,9 @@
17
17
  <ng-template #titleTemplate>
18
18
  <div class="px-2">
19
19
  <div class="text-lg font-bold">{{ featureType.name }}</div>
20
- @if (featureType.definition) {
20
+ @if (featureType.description) {
21
21
  <div class="text-sm">
22
- {{ featureType.definition }}
22
+ {{ featureType.description }}
23
23
  </div>
24
24
  }
25
25
  </div>
@@ -87,7 +87,7 @@
87
87
  <ul class="list-disc list-inside mr-4">
88
88
  @for (v of row.values; track v) {
89
89
  <li>
90
- {{ v.label || v.code }}
90
+ {{ v.label || v.value }}
91
91
  </li>
92
92
  }
93
93
  </ul>
@@ -19,7 +19,7 @@ import { iconoirList } from '@ng-icons/iconoir'
19
19
  marker('feature.catalog.attribute.type')
20
20
  marker('feature.catalog.attribute.name')
21
21
  marker('feature.catalog.attribute.code')
22
- marker('feature.catalog.attribute.definition')
22
+ marker('feature.catalog.attribute.description')
23
23
  marker('feature.catalog.attribute.values')
24
24
 
25
25
  interface ColumnDefinition {
@@ -56,7 +56,7 @@ export class FeatureCatalogListComponent {
56
56
  readonly COLUMNS_DEFAULT: ColumnDefinition[] = [
57
57
  { key: 'type', width: '25%' },
58
58
  { key: 'name', width: '40%' },
59
- { key: 'definition', width: 'minmax(0px, 1fr)' },
59
+ { key: 'description', width: 'minmax(0px, 1fr)' },
60
60
  ]
61
61
 
62
62
  readonly COLUMN_VALUES: ColumnDefinition = {
@@ -16,10 +16,6 @@ gn-ui-button {
16
16
  --gn-ui-button-padding: 0;
17
17
  font-size: 1em;
18
18
  }
19
- ng-icon.search {
20
- margin-top: 0.6rem;
21
- margin-left: 0.6rem;
22
- }
23
19
  gn-ui-button:last-of-type {
24
20
  --gn-ui-button-rounded: 0 var(--gn-ui-text-input-rounded, 0.25em)
25
21
  var(--gn-ui-text-input-rounded, 0.25em) 0;
@@ -1,9 +1,9 @@
1
1
  <span class="w-full inline-block relative">
2
2
  @if (!allowSubmit) {
3
3
  <div
4
- class="absolute inset-y-[--icon-padding] left-[--icon-padding] w-[--icon-width] pointer-events-none"
4
+ class="absolute inset-y-[--icon-padding] left-[--icon-padding] w-[--icon-width] pointer-events-none flex items-center justify-center"
5
5
  >
6
- <ng-icon name="iconoirSearch" class="text-primary search"></ng-icon>
6
+ <ng-icon name="iconoirSearch" class="text-primary"></ng-icon>
7
7
  </div>
8
8
  }
9
9
  <div class="flex flex-row">
@@ -134,13 +134,13 @@ export class AutocompleteComponent
134
134
  getExtraClass(): string {
135
135
  if (this.allowSubmit) {
136
136
  if (this.enterButton) {
137
- return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+var(--icon-padding))] inset-y-[--icon-padding]'
137
+ return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+var(--icon-padding))] top-1/2 -translate-y-1/2'
138
138
  } else {
139
- return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+0.25*var(--icon-width))] inset-y-[calc(0.25*var(--icon-width))]'
139
+ return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+0.25*var(--icon-width))] top-1/2 -translate-y-1/2'
140
140
  }
141
141
  } else {
142
142
  if (!this.enterButton) {
143
- return 'border rounded-lg absolute w-8 h-8 right-2 inset-y-2'
143
+ return 'border rounded-lg absolute w-8 h-8 right-2 top-1/2 -translate-y-1/2'
144
144
  }
145
145
  }
146
146
  return 'border rounded-lg absolute w-8 h-8'
@@ -56,7 +56,8 @@ export class SearchFeatureCatalogComponent {
56
56
  const fuzzyFilter = createFuzzyFilter(searchTerm)
57
57
  return (
58
58
  fuzzyFilter(featureType.name) ||
59
- (featureType.definition && fuzzyFilter(featureType.definition))
59
+ (featureType.description &&
60
+ fuzzyFilter(featureType.description))
60
61
  )
61
62
  }
62
63
  )
@@ -58,7 +58,12 @@
58
58
  [class]="
59
59
  (hasSelection
60
60
  ? 'border-b-[1px] border-gray-400 pb-[20px]'
61
- : 'pb-[8px]') + ' text-black'
61
+ : 'pb-[12px]') + ' text-black flex flex-col gap-[8px]'
62
+ "
63
+ style="
64
+ --gn-ui-text-input-rounded: 8px;
65
+ --gn-ui-text-input-border-size: 1px;
66
+ --gn-ui-text-input-padding: 6px;
62
67
  "
63
68
  >
64
69
  <gn-ui-drag-and-drop-file-input
@@ -68,12 +73,13 @@
68
73
  [showFileName]="false"
69
74
  textClass="text-black truncate"
70
75
  dropzoneBackgroundColor="transparent"
71
- icon="iconoirImport"
76
+ icon="iconoirUpload"
72
77
  extraClass="gn-ui-gray-outline-input w-full !h-[32px] px-[8px] py-[4px] justify-between"
73
78
  (fileChange)="handleFileSelected($event)"
74
79
  (errorChange)="handleFileError($event)"
75
80
  data-cy="importGeojson"
76
81
  ></gn-ui-drag-and-drop-file-input>
82
+ <ng-content></ng-content>
77
83
  </div>
78
84
 
79
85
  @if (hasSelection) {
@@ -20,9 +20,9 @@ import { ButtonComponent } from '../button/button.component'
20
20
  import { NgIcon, provideIcons } from '@ng-icons/core'
21
21
  import {
22
22
  iconoirCheckCircle,
23
- iconoirImport,
24
23
  iconoirSquareDashed,
25
24
  iconoirTrash,
25
+ iconoirUpload,
26
26
  } from '@ng-icons/iconoir'
27
27
  import {
28
28
  matClose,
@@ -35,6 +35,7 @@ import {
35
35
  BoundingBox,
36
36
  getGeometryBoundingBox,
37
37
  getGeometryFromGeoJSON,
38
+ isBoundingBoxWithinWorldExtent,
38
39
  propagateToDocumentOnly,
39
40
  readFileAsText,
40
41
  } from '../../../../../../libs/util/shared/src'
@@ -46,11 +47,18 @@ import {
46
47
  marker('search.filters.spatialExtent.import')
47
48
  marker('search.filters.spatialExtent.helpText')
48
49
  marker('search.filters.spatialExtent.error.title')
50
+ marker('search.filters.spatialExtent.error.outOfBounds')
49
51
 
50
52
  const LABEL_FROM_FILE = marker('search.filters.spatialExtent.bboxFromFile')
51
53
  const LABEL_FROM_FILE_DELETE = marker(
52
54
  'search.filters.spatialExtent.bboxFromFileDelete'
53
55
  )
56
+ const LABEL_FROM_LOCATION = marker(
57
+ 'search.filters.spatialExtent.bboxFromLocation'
58
+ )
59
+ const LABEL_FROM_LOCATION_DELETE = marker(
60
+ 'search.filters.spatialExtent.bboxFromLocationDelete'
61
+ )
54
62
  const LABEL_INITIAL = marker('search.filters.spatialExtent.bboxInitial')
55
63
  const LABEL_INITIAL_DELETE = marker(
56
64
  'search.filters.spatialExtent.bboxInitialDelete'
@@ -74,9 +82,9 @@ export interface SpatialExtentDropdownError {
74
82
  providers: [
75
83
  provideIcons({
76
84
  iconoirCheckCircle,
77
- iconoirImport,
78
85
  iconoirSquareDashed,
79
86
  iconoirTrash,
87
+ iconoirUpload,
80
88
  matClose,
81
89
  matExpandLess,
82
90
  matExpandMore,
@@ -103,6 +111,7 @@ export class SpatialExtentDropdownComponent {
103
111
 
104
112
  bbox: BoundingBox | null = null
105
113
  fileName = ''
114
+ locationName = ''
106
115
 
107
116
  @ViewChild('overlayOrigin') overlayOrigin: CdkOverlayOrigin
108
117
  @ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay
@@ -136,15 +145,19 @@ export class SpatialExtentDropdownComponent {
136
145
  }
137
146
 
138
147
  get selectionLabelKey() {
139
- return this.fileName ? LABEL_FROM_FILE : LABEL_INITIAL
148
+ if (this.fileName) return LABEL_FROM_FILE
149
+ if (this.locationName) return LABEL_FROM_LOCATION
150
+ return LABEL_INITIAL
140
151
  }
141
152
 
142
153
  get selectionDeleteLabelKey() {
143
- return this.fileName ? LABEL_FROM_FILE_DELETE : LABEL_INITIAL_DELETE
154
+ if (this.fileName) return LABEL_FROM_FILE_DELETE
155
+ if (this.locationName) return LABEL_FROM_LOCATION_DELETE
156
+ return LABEL_INITIAL_DELETE
144
157
  }
145
158
 
146
159
  get selectionLabelParams() {
147
- return { fileName: this.fileName }
160
+ return { fileName: this.fileName, locationName: this.locationName }
148
161
  }
149
162
 
150
163
  openOverlay() {
@@ -178,8 +191,13 @@ export class SpatialExtentDropdownComponent {
178
191
  return
179
192
  }
180
193
  const bbox = getGeometryBoundingBox(geometry)
194
+ if (!isBoundingBoxWithinWorldExtent(bbox)) {
195
+ this.setError(marker('search.filters.spatialExtent.error.outOfBounds'))
196
+ return
197
+ }
181
198
  this.bbox = bbox
182
199
  this.fileName = file.name
200
+ this.locationName = ''
183
201
  this.bboxChange.emit(bbox)
184
202
  this.cd.markForCheck()
185
203
  } catch {
@@ -188,6 +206,16 @@ export class SpatialExtentDropdownComponent {
188
206
  }
189
207
  }
190
208
 
209
+ setLocationBbox(bbox: BoundingBox, name: string) {
210
+ this.errorKey = null
211
+ this.bbox = bbox
212
+ this.locationName = name
213
+ this.fileName = ''
214
+ this.fileInput?.clear()
215
+ this.bboxChange.emit(bbox)
216
+ this.cd.markForCheck()
217
+ }
218
+
191
219
  handleFileError(error: DragAndDropFileInputError) {
192
220
  if (error === 'file-too-large') {
193
221
  this.setError(marker('search.filters.spatialExtent.error.fileTooLarge'), {
@@ -207,6 +235,7 @@ export class SpatialExtentDropdownComponent {
207
235
  removeSelection(event: Event) {
208
236
  this.bbox = null
209
237
  this.fileName = ''
238
+ this.locationName = ''
210
239
  this.errorKey = null
211
240
  this.fileInput?.clear()
212
241
  this.bboxChange.emit(null)
@@ -3,6 +3,7 @@
3
3
  }
4
4
 
5
5
  :host {
6
+ display: block;
6
7
  position: relative;
7
8
  }
8
9
 
@@ -253,6 +253,9 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
253
253
  'advanced_filters',
254
254
  'limit',
255
255
  'spatial_extent_max_file_size',
256
+ 'geocoding_provider',
257
+ 'geocoding_provider_options',
258
+ 'geocoding_provider_labels',
256
259
  ],
257
260
  warnings,
258
261
  errors
@@ -265,6 +268,18 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
265
268
  warnings,
266
269
  errors
267
270
  )
271
+ const parsedCustomFilters = parseMultiConfigSection(
272
+ parsed,
273
+ 'custom_filter',
274
+ ['name', 'base_filter'],
275
+ ['exclude_values', 'include_values', 'label_key'],
276
+ warnings,
277
+ errors
278
+ )
279
+ const parsedGeocodingProviderLabels =
280
+ parsedSearchSection?.geocoding_provider_labels as
281
+ | Record<string, string>
282
+ | undefined
268
283
  searchConfig =
269
284
  parsedSearchSection === null
270
285
  ? null
@@ -281,9 +296,28 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
281
296
  filters: param.filters,
282
297
  })),
283
298
  ADVANCED_FILTERS: parsedSearchSection.advanced_filters,
299
+ CUSTOM_FILTERS: (parsedCustomFilters ?? []).map(
300
+ (customFilter) => ({
301
+ name: customFilter.name,
302
+ baseFilter: customFilter.base_filter,
303
+ excludeValues: customFilter.exclude_values,
304
+ includeValues: customFilter.include_values,
305
+ labelKey: customFilter.label_key,
306
+ })
307
+ ),
284
308
  LIMIT: parsedSearchSection.limit,
285
309
  SPATIAL_EXTENT_MAX_FILE_SIZE:
286
310
  parsedSearchSection.spatial_extent_max_file_size,
311
+ GEOCODING_PROVIDER: parsedSearchSection.geocoding_provider,
312
+ GEOCODING_PROVIDER_OPTIONS:
313
+ parsedSearchSection.geocoding_provider_options,
314
+ GEOCODING_PROVIDER_LABELS: parsedGeocodingProviderLabels
315
+ ? {
316
+ MAIN: parsedGeocodingProviderLabels.main,
317
+ SECONDARY: parsedGeocodingProviderLabels.secondary,
318
+ TERTIARY: parsedGeocodingProviderLabels.tertiary,
319
+ }
320
+ : undefined,
287
321
  } as SearchConfig)
288
322
 
289
323
  const parsedMetadataQualitySection = parseConfigSection(
@@ -41,7 +41,26 @@ fonts_stylesheet_url = "https://fonts.googleapis.com/css2?family=Open+Sans"
41
41
  record_kind_quick_filter = false
42
42
  filter_geometry_url = 'https://my.domain.org/geom.json'
43
43
  do_not_use_default_search_preset = false
44
- advanced_filters = ['publicationYear', 'documentStandard', 'inspireKeyword', 'topic', 'license']
44
+ geocoding_provider = "geoplateforme"
45
+ geocoding_provider_options.index = "poi"
46
+ geocoding_provider_options.category = "administratif"
47
+ geocoding_provider_options.limit = 5
48
+ geocoding_provider_labels.main = '/properties/name/0'
49
+ geocoding_provider_labels.secondary = '/properties/citycode/0'
50
+ geocoding_provider_labels.tertiary = '/properties/category/1'
51
+ advanced_filters = ['publicationYear', 'documentStandard', 'inspireKeyword', 'topic', 'license', 'myOrg:firstCustomFilter', 'myOrg:secondCustomFilter']
52
+
53
+ [[custom_filter]]
54
+ name = 'myOrg:firstCustomFilter'
55
+ base_filter = 'keyword'
56
+ exclude_values = ['my keyword 1', 'my keyword 2']
57
+ label_key = 'myOrg.firstCustomFilter'
58
+
59
+ [[custom_filter]]
60
+ name = 'myOrg:secondCustomFilter'
61
+ base_filter = 'keyword'
62
+ include_values = ['my keyword 3', 'my keyword 4']
63
+ label_key = 'myOrg.secondCustomFilter'
45
64
 
46
65
  [[search_preset]]
47
66
  sort = "-createDate"
@@ -81,6 +100,23 @@ main_color = "#212029" # All-purpose text color
81
100
  background_color = "#fdfbff"
82
101
  `
83
102
 
103
+ export const customFilterMissingMandatoryConfigFixture = () => `
104
+ [global]
105
+ geonetwork4_api_url = "/geonetwork/srv/api"
106
+
107
+ [theme]
108
+ primary_color = "#093564"
109
+ secondary_color = "#c2e9dc"
110
+ main_color = "#212029" # All-purpose text color
111
+ background_color = "#fdfbff"
112
+
113
+ [search]
114
+ advanced_filters = ['myOrg:firstCustomFilter']
115
+
116
+ [[custom_filter]]
117
+ name = 'myOrg:firstCustomFilter'
118
+ `
119
+
84
120
  export const mapConfigFixture = (): MapConfig => ({
85
121
  MAX_ZOOM: 10,
86
122
  MAX_EXTENT: [-418263.418776, 5251529.591305, 961272.067714, 6706890.609855],
@@ -55,15 +55,38 @@ export interface SearchPreset {
55
55
  filters: Record<string, string[] | string>
56
56
  }
57
57
 
58
+ export type GeocodingProviderName = 'geoadmin' | 'geonames' | 'geoplateforme'
59
+
60
+ export interface CustomSearchFieldConfig {
61
+ name: string
62
+ baseFilter: string
63
+ excludeValues?: string[]
64
+ includeValues?: string[]
65
+ labelKey?: string
66
+ }
67
+
68
+ export interface GeocodingProviderLabelsConfig {
69
+ MAIN?: string
70
+ SECONDARY?: string
71
+ TERTIARY?: string
72
+ }
73
+
58
74
  export interface SearchConfig {
59
75
  RECORD_KIND_QUICK_FILTER?: boolean
60
76
  FILTER_GEOMETRY_URL?: string
61
77
  FILTER_GEOMETRY_DATA?: string
62
78
  DO_NOT_USE_DEFAULT_SEARCH_PRESET?: boolean
63
79
  SEARCH_PRESET?: SearchPreset[]
64
- ADVANCED_FILTERS?: []
80
+ ADVANCED_FILTERS?: string[]
81
+ CUSTOM_FILTERS?: CustomSearchFieldConfig[]
65
82
  LIMIT?: number
66
83
  SPATIAL_EXTENT_MAX_FILE_SIZE?: number
84
+ GEOCODING_PROVIDER?: GeocodingProviderName
85
+ GEOCODING_PROVIDER_OPTIONS?: Record<
86
+ string,
87
+ string | number | boolean | string[]
88
+ >
89
+ GEOCODING_PROVIDER_LABELS?: GeocodingProviderLabelsConfig
67
90
  }
68
91
 
69
92
  export interface MetadataQualityConfig {
@@ -46,6 +46,22 @@ export function isBoundingBox(value: unknown): value is BoundingBox {
46
46
  )
47
47
  }
48
48
 
49
+ /**
50
+ * Checks that a bounding box's coordinates stay within the valid
51
+ * longitude (-180/180) and latitude (-90/90) ranges.
52
+ */
53
+ export function isBoundingBoxWithinWorldExtent(bbox: BoundingBox): boolean {
54
+ const [minX, minY, maxX, maxY] = bbox
55
+ return (
56
+ minX >= -180 &&
57
+ maxX <= 180 &&
58
+ minY >= -90 &&
59
+ maxY <= 90 &&
60
+ minX <= maxX &&
61
+ minY <= maxY
62
+ )
63
+ }
64
+
49
65
  export function getGeometryBoundingBox(geometry: Geometry): BoundingBox {
50
66
  // use the bounding box if specified in the GeoJSON object
51
67
  if (geometry.bbox) {