geonetwork-ui 2.10.3-dev.4154db07d → 2.11.0-dev.0559cfd9d

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 (128) hide show
  1. package/fesm2022/geonetwork-ui.mjs +2983 -2095
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +408 -180
  4. package/index.d.ts.map +1 -1
  5. package/package.json +10 -8
  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/generic.records.ts +5 -5
  8. package/src/libs/api/metadata-converter/src/lib/fixtures/mel.records.dataset+featurecatalog.ts +395 -0
  9. package/src/libs/api/metadata-converter/src/lib/fixtures/metawal.records.ts +5 -5
  10. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +78 -21
  11. package/src/libs/api/metadata-converter/src/lib/gn4/types/elasticsearch.model.ts +13 -1
  12. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +19 -0
  13. package/src/libs/api/metadata-converter/src/lib/iso19115-3/iso19115-3.converter.ts +17 -6
  14. package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +110 -0
  15. package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +133 -2
  16. package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +9 -0
  17. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +11 -6
  18. package/src/libs/api/metadata-converter/src/lib/iso19139/utils/association-type.mapper.ts +12 -0
  19. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +2 -2
  20. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +157 -38
  21. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +45 -50
  22. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +54 -20
  23. package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
  24. package/src/libs/common/domain/src/lib/model/search/filter.model.ts +24 -2
  25. package/src/libs/common/domain/src/lib/model/search/sort-by.model.ts +1 -5
  26. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +3 -3
  27. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +42 -62
  28. package/src/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts +3 -2
  29. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +2 -1
  30. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +54 -41
  31. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-associated-records/form-field-associated-records.component.html +33 -0
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-associated-records/form-field-associated-records.component.ts +94 -0
  33. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.html +16 -12
  34. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +6 -0
  35. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +6 -0
  36. package/src/libs/feature/editor/src/lib/fields.config.ts +5 -0
  37. package/src/libs/feature/map/src/index.ts +0 -2
  38. package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +1 -0
  39. package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
  40. package/src/libs/feature/notifications/src/lib/notifications.service.ts +6 -4
  41. package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
  42. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +4 -8
  43. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +10 -17
  44. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +2 -4
  45. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +4 -9
  46. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +2 -7
  47. package/src/libs/feature/router/src/lib/default/router.service.ts +1 -1
  48. package/src/libs/feature/router/src/lib/default/state/query-params.utils.ts +1 -1
  49. package/src/libs/feature/search/src/index.ts +2 -0
  50. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +18 -4
  51. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +80 -19
  52. package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +105 -0
  53. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +18 -0
  54. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +114 -0
  55. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +19 -8
  56. package/src/libs/feature/search/src/lib/sort-by/sort-by.component.ts +1 -1
  57. package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
  58. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +64 -4
  59. package/src/libs/feature/search/src/lib/utils/service/fields.ts +92 -9
  60. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.html +6 -7
  61. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.ts +31 -19
  62. package/src/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.ts +2 -2
  63. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
  64. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
  65. package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
  66. package/src/libs/ui/inputs/src/index.ts +2 -0
  67. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
  68. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +12 -3
  69. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +11 -3
  70. package/src/libs/ui/inputs/src/lib/date-adapter.providers.ts +30 -0
  71. package/src/libs/ui/inputs/src/lib/date-picker/date-picker.component.ts +3 -24
  72. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.css +37 -3
  73. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.html +135 -16
  74. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.ts +166 -29
  75. package/src/libs/ui/inputs/src/lib/date-range-picker/date-range-picker.component.ts +3 -7
  76. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.css +1 -0
  77. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.html +20 -7
  78. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.ts +46 -5
  79. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
  80. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
  81. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
  82. package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
  83. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.css +0 -0
  84. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +117 -0
  85. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +244 -0
  86. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  87. package/src/libs/util/app-config/src/lib/app-config.ts +37 -0
  88. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  89. package/src/libs/util/app-config/src/lib/model.ts +25 -1
  90. package/src/libs/util/data-fetcher/src/lib/data-fetcher.ts +19 -22
  91. package/src/libs/util/data-fetcher/src/lib/engine/duckdb.ts +185 -0
  92. package/src/libs/util/data-fetcher/src/lib/engine/results.ts +63 -0
  93. package/src/libs/util/data-fetcher/src/lib/{sql-utils.ts → engine/sql-utils.ts} +28 -13
  94. package/src/libs/util/data-fetcher/src/lib/model.ts +2 -1
  95. package/src/libs/util/data-fetcher/src/lib/readers/base-file.ts +53 -38
  96. package/src/libs/util/data-fetcher/src/lib/readers/base.ts +11 -0
  97. package/src/libs/util/data-fetcher/src/lib/readers/csv.ts +9 -47
  98. package/src/libs/util/data-fetcher/src/lib/readers/excel.ts +27 -27
  99. package/src/libs/util/data-fetcher/src/lib/readers/geojson.ts +5 -24
  100. package/src/libs/util/data-fetcher/src/lib/readers/gml.ts +5 -49
  101. package/src/libs/util/data-fetcher/src/lib/readers/json.ts +5 -23
  102. package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +184 -128
  103. package/src/libs/util/data-fetcher/src/lib/utils.ts +0 -143
  104. package/src/libs/util/shared/src/index.ts +1 -0
  105. package/src/libs/util/shared/src/lib/autofocus.directive.ts +26 -0
  106. package/src/libs/util/shared/src/lib/gn-ui-version.ts +1 -1
  107. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  108. package/src/libs/util/shared/src/lib/services/date.service.ts +3 -3
  109. package/src/libs/util/shared/src/lib/utils/file.ts +15 -0
  110. package/src/libs/util/shared/src/lib/utils/geojson.ts +24 -0
  111. package/src/libs/util/shared/src/lib/utils/index.ts +1 -0
  112. package/tailwind.base.css +5 -0
  113. package/translations/de.json +38 -5
  114. package/translations/en.json +37 -4
  115. package/translations/es.json +35 -2
  116. package/translations/fr.json +42 -9
  117. package/translations/it.json +36 -3
  118. package/translations/nl.json +35 -2
  119. package/translations/pt.json +35 -2
  120. package/translations/sk.json +36 -3
  121. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  122. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  123. package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
  124. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  125. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  126. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
  127. package/src/libs/util/data-fetcher/src/lib/readers/base-cache.ts +0 -14
  128. /package/src/libs/feature/{map/src/lib/geocoding/geocoding.component.css → editor/src/lib/components/record-form/form-field/form-field-associated-records/form-field-associated-records.component.css} +0 -0
@@ -24,7 +24,7 @@ import {
24
24
  propagateToDocumentOnly,
25
25
  } from '../../../../../../libs/util/shared/src'
26
26
  import { ButtonComponent } from '../button/button.component'
27
- import { NgIcon, provideIcons } from '@ng-icons/core'
27
+ import { NgIcon, provideIcons, provideNgIconsConfig } from '@ng-icons/core'
28
28
  import { FormsModule } from '@angular/forms'
29
29
  import { TranslatePipe } from '@ngx-translate/core'
30
30
 
@@ -46,19 +46,22 @@ import {
46
46
  matExpandMore,
47
47
  matExpandLess,
48
48
  }),
49
+ provideNgIconsConfig({
50
+ size: '1.5rem',
51
+ }),
49
52
  ],
50
53
  standalone: true,
51
54
  })
52
- export class DropdownMultiselectComponent {
55
+ export class DropdownMultiselectComponent<T = unknown> {
53
56
  private scrollStrategies = inject(ScrollStrategyOptions)
54
57
 
55
58
  @Input() title: string
56
- @Input() choices: Choice[]
57
- @Input() selected: unknown[] = []
59
+ @Input() choices: Choice<T>[]
60
+ @Input() selected: T[] = []
58
61
  @Input() allowSearch = true
59
62
  @Input() maxRows: number
60
63
  @Input() searchInputValue = ''
61
- @Output() selectValues = new EventEmitter<unknown[]>()
64
+ @Output() selectValues = new EventEmitter<T[]>()
62
65
  @ViewChild('overlayOrigin') overlayOrigin: CdkOverlayOrigin
63
66
  @ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay
64
67
  @ViewChild('overlayContainer', { read: ElementRef })
@@ -115,7 +118,7 @@ export class DropdownMultiselectComponent {
115
118
 
116
119
  private setFocus() {
117
120
  setTimeout(() => {
118
- this.searchFieldInput.nativeElement.focus()
121
+ this.searchFieldInput?.nativeElement.focus()
119
122
  }, 0)
120
123
  }
121
124
 
@@ -194,18 +197,18 @@ export class DropdownMultiselectComponent {
194
197
  this.checkboxes.get(newIndex).nativeElement.focus()
195
198
  }
196
199
 
197
- isSelected(choice: Choice) {
200
+ isSelected(choice: Choice<T>) {
198
201
  return this.selected.indexOf(choice.value) > -1
199
202
  }
200
203
 
201
- select(choice: Choice, selected: boolean) {
204
+ select(choice: Choice<T>, selected: boolean) {
202
205
  this.selected = selected
203
206
  ? [...this.selected.filter((v) => v !== choice.value), choice.value]
204
207
  : this.selected.filter((v) => v !== choice.value)
205
208
  this.selectValues.emit(this.selected)
206
209
  }
207
210
 
208
- toggle(choice: Choice) {
211
+ toggle(choice: Choice<T>) {
209
212
  this.select(choice, !this.isSelected(choice))
210
213
  }
211
214
 
@@ -1,4 +1,4 @@
1
- export interface Choice {
2
- value: unknown
1
+ export interface Choice<T = unknown> {
2
+ value: T
3
3
  label: string
4
4
  }
@@ -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
  )
@@ -0,0 +1,117 @@
1
+ <gn-ui-button
2
+ type="outline"
3
+ extraClass="bg-background w-full !p-[8px] !pl-[16px]"
4
+ [title]="title"
5
+ (buttonClick)="toggleOverlay()"
6
+ cdkOverlayOrigin
7
+ #overlayOrigin="cdkOverlayOrigin"
8
+ >
9
+ <div class="grow flex items-center mr-2 gap-2 overflow-hidden">
10
+ <div class="text-left font-medium truncate py-1">
11
+ {{ title }}
12
+ </div>
13
+ @if (hasSelection) {
14
+ <div
15
+ class="bg-primary-lighter text-white shrink-0 rounded-full font-bold text-[12px] w-[22px] h-[22px] flex items-center justify-center"
16
+ >
17
+ 1
18
+ </div>
19
+ }
20
+ </div>
21
+ <button class="h-6 w-6 flex items-center" data-cy="clearSelection">
22
+ @if (hasSelection && !overlayOpen) {
23
+ <ng-icon
24
+ class="shrink-0 opacity-40 mr-1.5 hover:opacity-80 transition-colors clear-btn"
25
+ (click)="removeSelection($event)"
26
+ name="matClose"
27
+ ></ng-icon>
28
+ }
29
+ </button>
30
+ <ng-icon
31
+ [name]="overlayOpen ? 'matExpandLess' : 'matExpandMore'"
32
+ class="shrink-0 opacity-40"
33
+ >
34
+ </ng-icon>
35
+ </gn-ui-button>
36
+
37
+ <ng-template
38
+ cdkConnectedOverlay
39
+ cdkConnectedOverlayHasBackdrop
40
+ cdkConnectedOverlayBackdropClass="cdk-overlay-transparent-backdrop"
41
+ [cdkConnectedOverlayOrigin]="overlayOrigin"
42
+ [cdkConnectedOverlayOpen]="overlayOpen"
43
+ [cdkConnectedOverlayPositions]="overlayPositions"
44
+ [cdkConnectedOverlayScrollStrategy]="scrollStrategy"
45
+ [cdkConnectedOverlayFlexibleDimensions]="true"
46
+ (overlayOutsideClick)="closeOverlay()"
47
+ (detach)="closeOverlay()"
48
+ >
49
+ <div
50
+ class="bg-white border border-gray-400 rounded shadow-lg pt-[12px] px-[16px] overlay-container w-[280px] flex flex-col gap-2"
51
+ [style.min-width]="overlayMinWidth"
52
+ >
53
+ <div class="text-xs text-black">
54
+ {{ 'search.filters.spatialExtent.helpText' | translate }}
55
+ </div>
56
+
57
+ <div
58
+ [class]="
59
+ (hasSelection
60
+ ? 'border-b-[1px] border-gray-400 pb-[20px]'
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;
67
+ "
68
+ >
69
+ <gn-ui-drag-and-drop-file-input
70
+ accept=".json,.geojson"
71
+ [placeholder]="'search.filters.spatialExtent.import' | translate"
72
+ [maxFileSizeMb]="maxFileSizeMb"
73
+ [showFileName]="false"
74
+ textClass="text-black truncate"
75
+ dropzoneBackgroundColor="transparent"
76
+ icon="iconoirUpload"
77
+ extraClass="gn-ui-gray-outline-input w-full !h-[32px] px-[8px] py-[4px] justify-between"
78
+ (fileChange)="handleFileSelected($event)"
79
+ (errorChange)="handleFileError($event)"
80
+ data-cy="importGeojson"
81
+ ></gn-ui-drag-and-drop-file-input>
82
+ <ng-content></ng-content>
83
+ </div>
84
+
85
+ @if (hasSelection) {
86
+ <gn-ui-button
87
+ [type]="'primary-light'"
88
+ [title]="selectionDeleteLabelKey | translate: selectionLabelParams"
89
+ (buttonClick)="removeSelection($event)"
90
+ extraClass="group gap-x-2 w-full h-[28px] px-[8px] py-[4px] mb-[12px] bg-primary-lighter text-white"
91
+ data-test="spatial-extent-selected-item"
92
+ >
93
+ <ng-icon
94
+ name="iconoirSquareDashed"
95
+ class="shrink-0"
96
+ size="15px"
97
+ ></ng-icon>
98
+ <span class="group-hover:hidden truncate text-sm m-auto">
99
+ {{ selectionLabelKey | translate: selectionLabelParams }}
100
+ </span>
101
+ <span class="hidden group-hover:block truncate text-sm m-auto">
102
+ {{ selectionDeleteLabelKey | translate: selectionLabelParams }}
103
+ </span>
104
+ <ng-icon
105
+ name="iconoirCheckCircle"
106
+ class="group-hover:hidden shrink-0"
107
+ size="14px"
108
+ ></ng-icon>
109
+ <ng-icon
110
+ name="iconoirTrash"
111
+ class="!hidden group-hover:!block shrink-0"
112
+ size="15px"
113
+ ></ng-icon>
114
+ </gn-ui-button>
115
+ }
116
+ </div>
117
+ </ng-template>
@@ -0,0 +1,244 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ ChangeDetectorRef,
4
+ Component,
5
+ EventEmitter,
6
+ Input,
7
+ Output,
8
+ ViewChild,
9
+ inject,
10
+ } from '@angular/core'
11
+ import {
12
+ CdkConnectedOverlay,
13
+ CdkOverlayOrigin,
14
+ ConnectedPosition,
15
+ OverlayModule,
16
+ ScrollStrategyOptions,
17
+ } from '@angular/cdk/overlay'
18
+
19
+ import { ButtonComponent } from '../button/button.component'
20
+ import { NgIcon, provideIcons } from '@ng-icons/core'
21
+ import {
22
+ iconoirCheckCircle,
23
+ iconoirSquareDashed,
24
+ iconoirTrash,
25
+ iconoirUpload,
26
+ } from '@ng-icons/iconoir'
27
+ import {
28
+ matClose,
29
+ matExpandLess,
30
+ matExpandMore,
31
+ } from '@ng-icons/material-icons/baseline'
32
+ import { TranslatePipe } from '@ngx-translate/core'
33
+ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
34
+ import {
35
+ BoundingBox,
36
+ getGeometryBoundingBox,
37
+ getGeometryFromGeoJSON,
38
+ isBoundingBoxWithinWorldExtent,
39
+ propagateToDocumentOnly,
40
+ readFileAsText,
41
+ } from '../../../../../../libs/util/shared/src'
42
+ import {
43
+ DragAndDropFileInputComponent,
44
+ DragAndDropFileInputError,
45
+ } from '../drag-and-drop-file-input/drag-and-drop-file-input.component'
46
+
47
+ marker('search.filters.spatialExtent.import')
48
+ marker('search.filters.spatialExtent.helpText')
49
+ marker('search.filters.spatialExtent.error.title')
50
+ marker('search.filters.spatialExtent.error.outOfBounds')
51
+
52
+ const LABEL_FROM_FILE = marker('search.filters.spatialExtent.bboxFromFile')
53
+ const LABEL_FROM_FILE_DELETE = marker(
54
+ 'search.filters.spatialExtent.bboxFromFileDelete'
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
+ )
62
+ const LABEL_INITIAL = marker('search.filters.spatialExtent.bboxInitial')
63
+ const LABEL_INITIAL_DELETE = marker(
64
+ 'search.filters.spatialExtent.bboxInitialDelete'
65
+ )
66
+
67
+ export interface SpatialExtentDropdownError {
68
+ key: string
69
+ params?: Record<string, string | number>
70
+ }
71
+
72
+ @Component({
73
+ selector: 'gn-ui-spatial-extent-dropdown',
74
+ standalone: true,
75
+ imports: [
76
+ ButtonComponent,
77
+ NgIcon,
78
+ OverlayModule,
79
+ TranslatePipe,
80
+ DragAndDropFileInputComponent,
81
+ ],
82
+ providers: [
83
+ provideIcons({
84
+ iconoirCheckCircle,
85
+ iconoirSquareDashed,
86
+ iconoirTrash,
87
+ iconoirUpload,
88
+ matClose,
89
+ matExpandLess,
90
+ matExpandMore,
91
+ }),
92
+ ],
93
+ templateUrl: './spatial-extent-dropdown.component.html',
94
+ styleUrls: ['./spatial-extent-dropdown.component.css'],
95
+ changeDetection: ChangeDetectionStrategy.OnPush,
96
+ })
97
+ export class SpatialExtentDropdownComponent {
98
+ private cd = inject(ChangeDetectorRef)
99
+ private scrollStrategies = inject(ScrollStrategyOptions)
100
+
101
+ @Input() title: string
102
+ @Input() maxFileSizeMb: number | null = null
103
+ @Input() set initialBbox(value: BoundingBox | null) {
104
+ if (!this.bbox && value) {
105
+ this.bbox = value
106
+ }
107
+ }
108
+
109
+ @Output() bboxChange = new EventEmitter<BoundingBox | null>()
110
+ @Output() errorChange = new EventEmitter<SpatialExtentDropdownError>()
111
+
112
+ bbox: BoundingBox | null = null
113
+ fileName = ''
114
+ locationName = ''
115
+
116
+ @ViewChild('overlayOrigin') overlayOrigin: CdkOverlayOrigin
117
+ @ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay
118
+ @ViewChild(DragAndDropFileInputComponent)
119
+ fileInput: DragAndDropFileInputComponent
120
+
121
+ overlayPositions: ConnectedPosition[] = [
122
+ {
123
+ originX: 'start',
124
+ originY: 'bottom',
125
+ overlayX: 'start',
126
+ overlayY: 'top',
127
+ offsetY: 8,
128
+ },
129
+ {
130
+ originX: 'start',
131
+ originY: 'top',
132
+ overlayX: 'start',
133
+ overlayY: 'bottom',
134
+ offsetY: -8,
135
+ },
136
+ ]
137
+ scrollStrategy = this.scrollStrategies.reposition()
138
+ overlayOpen = false
139
+ overlayMinWidth = 'none'
140
+
141
+ errorKey: string | null = null
142
+
143
+ get hasSelection() {
144
+ return !!this.bbox
145
+ }
146
+
147
+ get selectionLabelKey() {
148
+ if (this.fileName) return LABEL_FROM_FILE
149
+ if (this.locationName) return LABEL_FROM_LOCATION
150
+ return LABEL_INITIAL
151
+ }
152
+
153
+ get selectionDeleteLabelKey() {
154
+ if (this.fileName) return LABEL_FROM_FILE_DELETE
155
+ if (this.locationName) return LABEL_FROM_LOCATION_DELETE
156
+ return LABEL_INITIAL_DELETE
157
+ }
158
+
159
+ get selectionLabelParams() {
160
+ return { fileName: this.fileName, locationName: this.locationName }
161
+ }
162
+
163
+ openOverlay() {
164
+ this.overlayMinWidth =
165
+ this.overlayOrigin.elementRef.nativeElement.getBoundingClientRect()
166
+ .width + 'px'
167
+ this.overlayOpen = true
168
+ }
169
+
170
+ closeOverlay() {
171
+ this.overlayOpen = false
172
+ }
173
+
174
+ toggleOverlay() {
175
+ if (this.overlayOpen) {
176
+ this.closeOverlay()
177
+ } else {
178
+ this.openOverlay()
179
+ }
180
+ }
181
+
182
+ async handleFileSelected(file: File) {
183
+ this.errorKey = null
184
+ let content: string
185
+ try {
186
+ content = await readFileAsText(file)
187
+ const parsed = JSON.parse(content)
188
+ const geometry = getGeometryFromGeoJSON(parsed)
189
+ if (!geometry) {
190
+ this.setError(marker('search.filters.spatialExtent.error.noGeometry'))
191
+ return
192
+ }
193
+ const bbox = getGeometryBoundingBox(geometry)
194
+ if (!isBoundingBoxWithinWorldExtent(bbox)) {
195
+ this.setError(marker('search.filters.spatialExtent.error.outOfBounds'))
196
+ return
197
+ }
198
+ this.bbox = bbox
199
+ this.fileName = file.name
200
+ this.locationName = ''
201
+ this.bboxChange.emit(bbox)
202
+ this.cd.markForCheck()
203
+ } catch {
204
+ this.setError(marker('search.filters.spatialExtent.error.invalidFormat'))
205
+ return
206
+ }
207
+ }
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
+
219
+ handleFileError(error: DragAndDropFileInputError) {
220
+ if (error === 'file-too-large') {
221
+ this.setError(marker('search.filters.spatialExtent.error.fileTooLarge'), {
222
+ maxSize: this.maxFileSizeMb,
223
+ })
224
+ } else {
225
+ this.setError(marker('search.filters.spatialExtent.error.invalidFormat'))
226
+ }
227
+ }
228
+
229
+ private setError(errorKey: string, params?: Record<string, string | number>) {
230
+ this.errorKey = errorKey
231
+ this.errorChange.emit({ key: errorKey, params })
232
+ this.cd.markForCheck()
233
+ }
234
+
235
+ removeSelection(event: Event) {
236
+ this.bbox = null
237
+ this.fileName = ''
238
+ this.locationName = ''
239
+ this.errorKey = null
240
+ this.fileInput?.clear()
241
+ this.bboxChange.emit(null)
242
+ propagateToDocumentOnly(event)
243
+ }
244
+ }
@@ -3,6 +3,7 @@
3
3
  }
4
4
 
5
5
  :host {
6
+ display: block;
6
7
  position: relative;
7
8
  }
8
9
 
@@ -252,6 +252,10 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
252
252
  'search_preset',
253
253
  'advanced_filters',
254
254
  'limit',
255
+ 'spatial_extent_max_file_size',
256
+ 'geocoding_provider',
257
+ 'geocoding_provider_options',
258
+ 'geocoding_provider_labels',
255
259
  ],
256
260
  warnings,
257
261
  errors
@@ -264,6 +268,18 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
264
268
  warnings,
265
269
  errors
266
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
267
283
  searchConfig =
268
284
  parsedSearchSection === null
269
285
  ? null
@@ -280,7 +296,28 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
280
296
  filters: param.filters,
281
297
  })),
282
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
+ ),
283
308
  LIMIT: parsedSearchSection.limit,
309
+ SPATIAL_EXTENT_MAX_FILE_SIZE:
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,
284
321
  } as SearchConfig)
285
322
 
286
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,14 +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
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
66
90
  }
67
91
 
68
92
  export interface MetadataQualityConfig {
@@ -7,20 +7,19 @@ import { DataItem, DatasetHeaders, FetchError, SupportedType } from './model'
7
7
  import { inferDatasetType } from './utils'
8
8
  import { BaseReader } from './readers/base'
9
9
  import { GmlReader } from './readers/gml'
10
- import { WfsVersion } from '@camptocamp/ogc-client'
11
10
  import { WfsReader } from './readers/wfs'
12
11
 
12
+ interface OpenDatasetOptions {
13
+ typeHint?: SupportedType
14
+ wfsFeatureType?: string
15
+ enableCache?: boolean // by default cache will be used if this is not set to false
16
+ }
17
+
13
18
  export async function openDataset(
14
19
  url: string,
15
- typeHint?: SupportedType,
16
- options?: {
17
- namespace?: string
18
- wfsVersion?: WfsVersion
19
- wfsFeatureType?: string
20
- },
21
- cacheActive?: boolean
20
+ options?: OpenDatasetOptions
22
21
  ): Promise<BaseReader> {
23
- const fileType = await inferDatasetType(url, typeHint)
22
+ const fileType = await inferDatasetType(url, options?.typeHint)
24
23
  let reader:
25
24
  | CsvReader
26
25
  | JsonReader
@@ -43,19 +42,19 @@ export async function openDataset(
43
42
  reader = new ExcelReader(url)
44
43
  break
45
44
  case 'gml':
46
- reader = new GmlReader(url, options.namespace, options.wfsVersion)
45
+ reader = new GmlReader(url)
47
46
  break
48
47
  case 'wfs':
49
- reader = await WfsReader.createReader(url, options.wfsFeatureType)
48
+ reader = new WfsReader(url, options?.wfsFeatureType)
50
49
  break
51
50
  }
52
- reader.setCacheActive(cacheActive)
51
+ reader.enableCache(options?.enableCache ?? true)
53
52
  reader.load()
54
53
  return reader
55
- } catch (e: any) {
56
- //WfsReader may already raise a FetchError
54
+ } catch (e: unknown) {
55
+ // WfsReader may already raise a FetchError
57
56
  if (e instanceof FetchError) throw e
58
- else throw FetchError.parsingFailed(e.message)
57
+ else throw FetchError.parsingFailed((e as Error).message)
59
58
  }
60
59
  }
61
60
 
@@ -63,22 +62,20 @@ export async function openDataset(
63
62
  * This fetches the full dataset at the given URL and parses it according to its mime type.
64
63
  * All items in the dataset are converted to GeoJSON features, even if they do not bear any spatial geometry.
65
64
  * File type can be either inferred (from the HTTP headers or the URL), or hinted using the 2nd argument
66
- * File type is determined liked so:
65
+ * File type is determined like so:
67
66
  * 1. if a type hint is given, use it
68
67
  * 2. otherwise, look for a Content-Type header in the response with a supported mime type
69
68
  * 3. if no valid mime type was found, look for an explicit file extension in the url (.csv, .geojson etc.)
70
69
  */
71
70
  export async function readDataset(
72
71
  url: string,
73
- typeHint?: SupportedType,
74
- options?: any,
75
- cacheActive = true
72
+ options?: OpenDatasetOptions
76
73
  ): Promise<DataItem[]> {
77
- const reader = await openDataset(url, typeHint, options, cacheActive)
74
+ const reader = await openDataset(url, options)
78
75
  try {
79
76
  return await reader.read()
80
- } catch (e: any) {
81
- throw FetchError.parsingFailed(e.message)
77
+ } catch (e: unknown) {
78
+ throw FetchError.parsingFailed((e as Error).message)
82
79
  }
83
80
  }
84
81