geonetwork-ui 2.11.0-dev.9ba9c4d3d → 2.11.0-dev.9eb024f1f

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 (90) hide show
  1. package/fesm2022/geonetwork-ui.mjs +1473 -1030
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +258 -114
  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 +118 -53
  16. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +79 -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 +12 -2
  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.html +18 -0
  30. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
  31. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
  33. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
  34. package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
  35. package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
  36. package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
  37. package/src/libs/feature/map/src/index.ts +0 -2
  38. package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
  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/index.ts +2 -0
  43. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +10 -1
  44. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +39 -5
  45. package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +105 -0
  46. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +18 -0
  47. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +114 -0
  48. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +2 -0
  49. package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
  50. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +62 -4
  51. package/src/libs/feature/search/src/lib/utils/service/fields.ts +69 -10
  52. package/src/libs/ui/elements/src/lib/kind-badge/kind-badge.component.html +5 -1
  53. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
  54. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
  55. package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
  56. package/src/libs/ui/elements/src/lib/thumbnail/thumbnail.component.html +1 -1
  57. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
  58. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +12 -3
  59. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +11 -3
  60. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
  61. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
  62. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
  63. package/src/libs/ui/inputs/src/lib/inline-filter/inline-filter.component.html +6 -11
  64. package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
  65. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +11 -11
  66. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +57 -4
  67. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  68. package/src/libs/ui/search/src/lib/results-hits-number/results-hits-number.component.html +1 -0
  69. package/src/libs/util/app-config/src/index.ts +1 -0
  70. package/src/libs/util/app-config/src/lib/app-config.ts +338 -250
  71. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  72. package/src/libs/util/app-config/src/lib/model.ts +41 -1
  73. package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
  74. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  75. package/src/libs/util/shared/src/lib/utils/geojson.ts +37 -10
  76. package/translations/de.json +18 -4
  77. package/translations/en.json +19 -5
  78. package/translations/es.json +18 -4
  79. package/translations/fr.json +24 -10
  80. package/translations/it.json +18 -4
  81. package/translations/nl.json +18 -4
  82. package/translations/pt.json +18 -4
  83. package/translations/sk.json +18 -4
  84. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  85. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  86. package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
  87. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  88. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  89. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
  90. /package/src/libs/feature/{map/src/lib/geocoding/geocoding.component.css → editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.css} +0 -0
@@ -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 = {
@@ -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()
@@ -9,7 +9,7 @@
9
9
  class="relative w-full object-center"
10
10
  [ngClass]="imgFit === 'contain' ? 'h-4/5 w-4/5' : 'h-full'"
11
11
  [ngStyle]="{ objectFit: imgFit }"
12
- alt="thumbnail"
12
+ alt=""
13
13
  loading="lazy"
14
14
  (load)="setObjectFit()"
15
15
  [src]="imgUrl"
@@ -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">
@@ -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()
@@ -126,13 +134,13 @@ export class AutocompleteComponent
126
134
  getExtraClass(): string {
127
135
  if (this.allowSubmit) {
128
136
  if (this.enterButton) {
129
- 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'
130
138
  } else {
131
- 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'
132
140
  }
133
141
  } else {
134
142
  if (!this.enterButton) {
135
- 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'
136
144
  }
137
145
  }
138
146
  return 'border rounded-lg absolute w-8 h-8'
@@ -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">
@@ -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
  }
@@ -1,25 +1,20 @@
1
1
  <ul class="flex flex-wrap list-none gap-2">
2
2
  @for (choice of choices; track choice) {
3
3
  <li>
4
- <label
5
- class=""
4
+ <button
5
+ type="button"
6
6
  [ngClass]="{
7
7
  selected: isSelected(choice),
8
8
  }"
9
+ [attr.aria-pressed]="isSelected(choice)"
10
+ [attr.data-cy]="'inlineFilter-' + choice.value"
11
+ (click)="select(choice, !isSelected(choice))"
9
12
  >
10
- <input
11
- class="hidden"
12
- type="checkbox"
13
- #checkBox
14
- [checked]="isSelected(choice)"
15
- (change)="select(choice, checkBox.checked)"
16
- [attr.data-cy]="'inlineFilter-' + choice.value"
17
- />
18
13
  <ng-container
19
14
  *ngTemplateOutlet="itemTemplate; context: { $implicit: choice }"
20
15
  >
21
16
  </ng-container>
22
- </label>
17
+ </button>
23
18
  </li>
24
19
  }
25
20
  </ul>
@@ -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,22 +73,19 @@
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) {
80
86
  <gn-ui-button
81
87
  [type]="'primary-light'"
82
- [title]="
83
- ('search.filters.spatialExtent.bboxDelete' | translate) +
84
- ' ' +
85
- fileName
86
- "
88
+ [title]="selectionDeleteLabelKey | translate: selectionLabelParams"
87
89
  (buttonClick)="removeSelection($event)"
88
90
  extraClass="group gap-x-2 w-full h-[28px] px-[8px] py-[4px] mb-[12px] bg-primary-lighter text-white"
89
91
  data-test="spatial-extent-selected-item"
@@ -94,12 +96,10 @@
94
96
  size="15px"
95
97
  ></ng-icon>
96
98
  <span class="group-hover:hidden truncate text-sm m-auto">
97
- {{ 'search.filters.spatialExtent.bboxPrefix' | translate }}
98
- {{ fileName }}
99
+ {{ selectionLabelKey | translate: selectionLabelParams }}
99
100
  </span>
100
101
  <span class="hidden group-hover:block truncate text-sm m-auto">
101
- {{ 'search.filters.spatialExtent.bboxDelete' | translate }}
102
- {{ fileName }}
102
+ {{ selectionDeleteLabelKey | translate: selectionLabelParams }}
103
103
  </span>
104
104
  <ng-icon
105
105
  name="iconoirCheckCircle"
@@ -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,13 +47,27 @@ import {
46
47
  marker('search.filters.spatialExtent.import')
47
48
  marker('search.filters.spatialExtent.helpText')
48
49
  marker('search.filters.spatialExtent.error.title')
49
- marker('search.filters.spatialExtent.bboxPrefix')
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
+ )
50
66
 
51
67
  export interface SpatialExtentDropdownError {
52
68
  key: string
53
69
  params?: Record<string, string | number>
54
70
  }
55
- marker('search.filters.spatialExtent.bboxDelete')
56
71
 
57
72
  @Component({
58
73
  selector: 'gn-ui-spatial-extent-dropdown',
@@ -67,9 +82,9 @@ marker('search.filters.spatialExtent.bboxDelete')
67
82
  providers: [
68
83
  provideIcons({
69
84
  iconoirCheckCircle,
70
- iconoirImport,
71
85
  iconoirSquareDashed,
72
86
  iconoirTrash,
87
+ iconoirUpload,
73
88
  matClose,
74
89
  matExpandLess,
75
90
  matExpandMore,
@@ -85,12 +100,18 @@ export class SpatialExtentDropdownComponent {
85
100
 
86
101
  @Input() title: string
87
102
  @Input() maxFileSizeMb: number | null = null
103
+ @Input() set initialBbox(value: BoundingBox | null) {
104
+ if (!this.bbox && value) {
105
+ this.bbox = value
106
+ }
107
+ }
88
108
 
89
109
  @Output() bboxChange = new EventEmitter<BoundingBox | null>()
90
110
  @Output() errorChange = new EventEmitter<SpatialExtentDropdownError>()
91
111
 
92
112
  bbox: BoundingBox | null = null
93
113
  fileName = ''
114
+ locationName = ''
94
115
 
95
116
  @ViewChild('overlayOrigin') overlayOrigin: CdkOverlayOrigin
96
117
  @ViewChild(CdkConnectedOverlay) overlay: CdkConnectedOverlay
@@ -123,6 +144,22 @@ export class SpatialExtentDropdownComponent {
123
144
  return !!this.bbox
124
145
  }
125
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
+
126
163
  openOverlay() {
127
164
  this.overlayMinWidth =
128
165
  this.overlayOrigin.elementRef.nativeElement.getBoundingClientRect()
@@ -154,8 +191,13 @@ export class SpatialExtentDropdownComponent {
154
191
  return
155
192
  }
156
193
  const bbox = getGeometryBoundingBox(geometry)
194
+ if (!isBoundingBoxWithinWorldExtent(bbox)) {
195
+ this.setError(marker('search.filters.spatialExtent.error.outOfBounds'))
196
+ return
197
+ }
157
198
  this.bbox = bbox
158
199
  this.fileName = file.name
200
+ this.locationName = ''
159
201
  this.bboxChange.emit(bbox)
160
202
  this.cd.markForCheck()
161
203
  } catch {
@@ -164,6 +206,16 @@ export class SpatialExtentDropdownComponent {
164
206
  }
165
207
  }
166
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
+
167
219
  handleFileError(error: DragAndDropFileInputError) {
168
220
  if (error === 'file-too-large') {
169
221
  this.setError(marker('search.filters.spatialExtent.error.fileTooLarge'), {
@@ -183,6 +235,7 @@ export class SpatialExtentDropdownComponent {
183
235
  removeSelection(event: Event) {
184
236
  this.bbox = null
185
237
  this.fileName = ''
238
+ this.locationName = ''
186
239
  this.errorKey = null
187
240
  this.fileInput?.clear()
188
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
 
@@ -1,6 +1,7 @@
1
1
  @if (!loading) {
2
2
  <div class="w-full">
3
3
  <span
4
+ role="status"
4
5
  data-cy="resultsHitsFound"
5
6
  translate
6
7
  [translateParams]="{ hits: hits }"
@@ -2,3 +2,4 @@ export * from './lib/app-config'
2
2
  export * from './lib/fixtures'
3
3
  export * from './lib/model'
4
4
  export * from './lib/map-layers'
5
+ export * from './lib/parse-utils'