geonetwork-ui 2.11.0-dev.aed5b2e5b → 2.11.0-dev.b42374ab5

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 (87) hide show
  1. package/fesm2022/geonetwork-ui.mjs +1511 -1027
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +276 -117
  4. package/index.d.ts.map +1 -1
  5. package/package.json +7 -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 +159 -54
  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 +24 -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 +64 -6
  51. package/src/libs/feature/search/src/lib/utils/service/fields.ts +82 -13
  52. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
  53. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
  54. package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
  55. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
  56. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +12 -3
  57. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +11 -3
  58. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
  59. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
  60. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
  61. package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
  62. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +11 -11
  63. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +57 -4
  64. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  65. package/src/libs/ui/map/src/lib/components/map-container/map-container.component.ts +2 -0
  66. package/src/libs/util/app-config/src/index.ts +1 -0
  67. package/src/libs/util/app-config/src/lib/app-config.ts +338 -250
  68. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  69. package/src/libs/util/app-config/src/lib/model.ts +41 -1
  70. package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
  71. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  72. package/src/libs/util/shared/src/lib/utils/geojson.ts +45 -10
  73. package/translations/de.json +18 -4
  74. package/translations/en.json +19 -5
  75. package/translations/es.json +18 -4
  76. package/translations/fr.json +24 -10
  77. package/translations/it.json +18 -4
  78. package/translations/nl.json +18 -4
  79. package/translations/pt.json +18 -4
  80. package/translations/sk.json +18 -4
  81. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  82. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  83. package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
  84. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  85. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  86. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
  87. /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
@@ -20,7 +20,11 @@ import {
20
20
  isDateRange,
21
21
  METADATA_LANGUAGE,
22
22
  } from '../../../../../../../libs/api/repository/src'
23
- import { formatUserInfo } from '../../../../../../../libs/util/shared/src'
23
+ import {
24
+ BoundingBox,
25
+ formatUserInfo,
26
+ isBoundingBox,
27
+ } from '../../../../../../../libs/util/shared/src'
24
28
  import { PossibleResourceTypes } from '../../../../../../../libs/api/metadata-converter/src'
25
29
 
26
30
  export type FieldType = 'values' | 'dateRange' | 'spatialExtent'
@@ -49,6 +53,15 @@ export class SimpleSearchField implements AbstractSearchField {
49
53
  // FIXME: this is required to register runtime fields; abstract this as well
50
54
  protected esService = this.injector.get(ElasticsearchService)
51
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
+
52
65
  constructor(
53
66
  protected esFieldName: string,
54
67
  protected injector: Injector,
@@ -56,13 +69,24 @@ export class SimpleSearchField implements AbstractSearchField {
56
69
  protected orderType: 'key' | 'count' = 'key'
57
70
  ) {}
58
71
 
72
+ public setFieldIdentifier(fieldIdentifier: string) {
73
+ this.customIdentifier = fieldIdentifier
74
+ this.esService.registerFieldAlias(fieldIdentifier, this.esFieldName)
75
+ }
76
+
59
77
  protected getAggregations(): AggregationsParams {
60
78
  return {
61
- [this.esFieldName]: {
79
+ [this.fieldIdentifier]: {
62
80
  type: 'terms',
63
81
  field: this.esFieldName,
64
82
  limit: 1000,
65
83
  sort: [this.order, this.orderType],
84
+ ...(this.includeValues?.length && {
85
+ includeValues: this.includeValues,
86
+ }),
87
+ ...(this.excludeValues?.length && {
88
+ excludeValues: this.excludeValues,
89
+ }),
66
90
  },
67
91
  }
68
92
  }
@@ -75,7 +99,7 @@ export class SimpleSearchField implements AbstractSearchField {
75
99
  return this.repository.aggregate(this.getAggregations()).pipe(
76
100
  map(
77
101
  (response) =>
78
- (response[this.esFieldName] as AggregationBuckets).buckets || []
102
+ (response[this.fieldIdentifier] as AggregationBuckets).buckets || []
79
103
  ),
80
104
  switchMap((buckets: TermBucket[]) => {
81
105
  const bucketPromises = buckets.map(async (bucket) => ({
@@ -93,7 +117,7 @@ export class SimpleSearchField implements AbstractSearchField {
93
117
  // FieldValue[]
94
118
  if (this.getType() === 'values') {
95
119
  return of({
96
- [this.esFieldName]: (values as FieldValue[]).reduce((acc, val) => {
120
+ [this.fieldIdentifier]: (values as FieldValue[]).reduce((acc, val) => {
97
121
  const value = val.toString()
98
122
  if (value !== '') {
99
123
  return { ...acc, [value]: true }
@@ -104,13 +128,13 @@ export class SimpleSearchField implements AbstractSearchField {
104
128
  }
105
129
  // DateRange
106
130
  return of({
107
- [this.esFieldName]: values[0] !== '' ? values[0] : {},
131
+ [this.fieldIdentifier]: values[0] !== '' ? values[0] : {},
108
132
  })
109
133
  }
110
134
  getValuesForFilter(
111
135
  filters: FieldFilters
112
136
  ): Observable<FieldValue[] | FieldValue | DateRange> {
113
- const filter = filters[this.esFieldName]
137
+ const filter = filters[this.fieldIdentifier]
114
138
  if (!filter) return of([])
115
139
  // filter by expression
116
140
  if (typeof filter === 'string') {
@@ -128,6 +152,10 @@ export class SimpleSearchField implements AbstractSearchField {
128
152
  getType(): FieldType {
129
153
  return 'values'
130
154
  }
155
+
156
+ clone(): typeof this {
157
+ return Object.create(this)
158
+ }
131
159
  }
132
160
 
133
161
  export class TranslatedSearchField extends SimpleSearchField {
@@ -171,7 +199,8 @@ export class TranslatedSearchField extends SimpleSearchField {
171
199
  export class MultilingualSearchField extends SimpleSearchField {
172
200
  // we're using a getter in case the token value changes over time
173
201
  private get searchLanguage() {
174
- return this.injector.get(METADATA_LANGUAGE, null)
202
+ const language = this.injector.get(METADATA_LANGUAGE, null)
203
+ return typeof language === 'function' ? language() : language
175
204
  }
176
205
 
177
206
  constructor(
@@ -431,16 +460,56 @@ export class DateRangeSearchField extends SimpleSearchField {
431
460
  }
432
461
  }
433
462
 
434
- export class SpatialExtentSearchField extends SimpleSearchField {
435
- constructor(injector: Injector) {
436
- super('spatialExtent', injector, 'asc')
463
+ // treats a resource's creation/revision dates as an interval (its min and max), so a record matches
464
+ // when that interval intersects the filter range, not just when a single date falls inside it
465
+ export class ResourceCreationRevisionDateSearchField extends DateRangeSearchField {
466
+ constructor(injector: Injector, order: 'asc' | 'desc' = 'desc') {
467
+ super('resourceCreationRevisionDate', injector, order)
468
+ const dateSourceFields = [
469
+ 'creationDateForResource',
470
+ 'revisionDateForResource',
471
+ ]
472
+ const collectSortedDates = dateSourceFields
473
+ .map(
474
+ (field) => `if (doc.containsKey('${field}')) {
475
+ for (def date : doc['${field}']) { dates.add(date.millis); }
476
+ }`
477
+ )
478
+ .join('\n')
479
+
480
+ this.esService.registerRuntimeField(
481
+ 'resourceCreationRevisionDateMin',
482
+ `def dates = [];
483
+ ${collectSortedDates}
484
+ if (dates.length > 0) { dates.sort(null); emit(dates[0]); }`,
485
+ 'date'
486
+ )
487
+ this.esService.registerRuntimeField(
488
+ 'resourceCreationRevisionDateMax',
489
+ `def dates = [];
490
+ ${collectSortedDates}
491
+ if (dates.length > 0) { dates.sort(null); emit(dates[dates.length - 1]); }`,
492
+ 'date'
493
+ )
437
494
  }
495
+ }
438
496
 
497
+ export class BoundingBoxSearchField extends SimpleSearchField {
439
498
  getAvailableValues(): Observable<FieldAvailableValue[]> {
440
- // TODO: return an array of spatial extents to show which ones are available in the dropdown
441
499
  return of([])
442
500
  }
443
501
 
502
+ getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> {
503
+ return of({
504
+ [this.fieldIdentifier]: values.map(Number) as BoundingBox,
505
+ })
506
+ }
507
+
508
+ getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
509
+ const filter = filters[this.fieldIdentifier]
510
+ return of(isBoundingBox(filter) ? filter : [])
511
+ }
512
+
444
513
  getType(): FieldType {
445
514
  return 'spatialExtent'
446
515
  }
@@ -555,7 +624,7 @@ export class RecordKindField extends SimpleSearchField {
555
624
 
556
625
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters | string> {
557
626
  const filters: FieldFilters = {
558
- [this.esFieldName]: values.reduce((acc, value) => {
627
+ [this.fieldIdentifier]: values.reduce((acc, value) => {
559
628
  if (value === '') return { ...acc, [value]: true }
560
629
 
561
630
  const keysToAdd = this.TYPE_MAPPING[value] || [value]
@@ -582,7 +651,7 @@ export class RecordKindField extends SimpleSearchField {
582
651
  }
583
652
 
584
653
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
585
- const filter = filters[this.esFieldName]
654
+ const filter = filters[this.fieldIdentifier]
586
655
  if (!filter) return of([])
587
656
 
588
657
  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 = {
@@ -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()
@@ -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
  }
@@ -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
 
@@ -58,6 +58,8 @@ import { transformExtent } from 'ol/proj.js'
58
58
  export const DEFAULT_BASEMAP_LAYER: MapContextLayerMapLibreStyle = {
59
59
  type: 'maplibre-style',
60
60
  styleUrl: `https://basemaps.cartocdn.com/gl/positron-gl-style/style.json`,
61
+ clickable: false,
62
+ hoverable: false,
61
63
  }
62
64
 
63
65
  const DEFAULT_VIEW: MapContextView = {
@@ -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'