geonetwork-ui 2.11.0-dev.5f9922c2e → 2.11.0-dev.6804f3b43
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.
- package/fesm2022/geonetwork-ui.mjs +1293 -1283
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +116 -80
- package/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +90 -31
- package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
- package/src/libs/common/domain/src/lib/model/search/filter.model.ts +12 -2
- package/src/libs/feature/map/src/index.ts +0 -2
- package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
- package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
- package/src/libs/feature/search/src/index.ts +2 -0
- package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +3 -0
- package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +21 -4
- package/src/libs/feature/{map/src/lib → search/src/lib/geocoding}/geocoding.service.ts +16 -7
- package/src/libs/feature/search/src/lib/location-search/location-search.component.html +8 -0
- package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +40 -0
- package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +2 -0
- package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
- package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +56 -4
- package/src/libs/feature/search/src/lib/utils/service/fields.ts +67 -9
- package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
- package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +10 -1
- package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +8 -0
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
- package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +5 -11
- package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +34 -4
- package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
- package/src/libs/ui/map/src/lib/components/map-container/map-container.component.ts +2 -0
- package/src/libs/util/app-config/src/lib/app-config.ts +22 -0
- package/src/libs/util/app-config/src/lib/fixtures.ts +33 -1
- package/src/libs/util/app-config/src/lib/model.ts +14 -1
- package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
- package/src/libs/util/shared/src/lib/utils/geojson.ts +16 -0
- package/translations/de.json +10 -3
- package/translations/en.json +11 -4
- package/translations/es.json +10 -3
- package/translations/fr.json +15 -8
- package/translations/it.json +10 -3
- package/translations/nl.json +10 -3
- package/translations/pt.json +10 -3
- package/translations/sk.json +10 -3
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.css +0 -0
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
- package/src/libs/feature/map/src/lib/style/index.ts +0 -2
- package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
- package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
137
|
+
const filter = filters[this.fieldIdentifier]
|
|
118
138
|
if (!filter) return of([])
|
|
119
139
|
// filter by expression
|
|
120
140
|
if (typeof filter === 'string') {
|
|
@@ -132,6 +152,10 @@ export class SimpleSearchField implements AbstractSearchField {
|
|
|
132
152
|
getType(): FieldType {
|
|
133
153
|
return 'values'
|
|
134
154
|
}
|
|
155
|
+
|
|
156
|
+
clone(): typeof this {
|
|
157
|
+
return Object.create(this)
|
|
158
|
+
}
|
|
135
159
|
}
|
|
136
160
|
|
|
137
161
|
export class TranslatedSearchField extends SimpleSearchField {
|
|
@@ -435,6 +459,40 @@ export class DateRangeSearchField extends SimpleSearchField {
|
|
|
435
459
|
}
|
|
436
460
|
}
|
|
437
461
|
|
|
462
|
+
// treats a resource's creation/revision dates as an interval (its min and max), so a record matches
|
|
463
|
+
// when that interval intersects the filter range, not just when a single date falls inside it
|
|
464
|
+
export class ResourceCreationRevisionDateSearchField extends DateRangeSearchField {
|
|
465
|
+
constructor(injector: Injector, order: 'asc' | 'desc' = 'desc') {
|
|
466
|
+
super('resourceCreationRevisionDate', injector, order)
|
|
467
|
+
const dateSourceFields = [
|
|
468
|
+
'creationDateForResource',
|
|
469
|
+
'revisionDateForResource',
|
|
470
|
+
]
|
|
471
|
+
const collectSortedDates = dateSourceFields
|
|
472
|
+
.map(
|
|
473
|
+
(field) => `if (doc.containsKey('${field}')) {
|
|
474
|
+
for (def date : doc['${field}']) { dates.add(date.millis); }
|
|
475
|
+
}`
|
|
476
|
+
)
|
|
477
|
+
.join('\n')
|
|
478
|
+
|
|
479
|
+
this.esService.registerRuntimeField(
|
|
480
|
+
'resourceCreationRevisionDateMin',
|
|
481
|
+
`def dates = [];
|
|
482
|
+
${collectSortedDates}
|
|
483
|
+
if (dates.length > 0) { dates.sort(null); emit(dates[0]); }`,
|
|
484
|
+
'date'
|
|
485
|
+
)
|
|
486
|
+
this.esService.registerRuntimeField(
|
|
487
|
+
'resourceCreationRevisionDateMax',
|
|
488
|
+
`def dates = [];
|
|
489
|
+
${collectSortedDates}
|
|
490
|
+
if (dates.length > 0) { dates.sort(null); emit(dates[dates.length - 1]); }`,
|
|
491
|
+
'date'
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
438
496
|
export class BoundingBoxSearchField extends SimpleSearchField {
|
|
439
497
|
getAvailableValues(): Observable<FieldAvailableValue[]> {
|
|
440
498
|
return of([])
|
|
@@ -442,12 +500,12 @@ export class BoundingBoxSearchField extends SimpleSearchField {
|
|
|
442
500
|
|
|
443
501
|
getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> {
|
|
444
502
|
return of({
|
|
445
|
-
[this.
|
|
503
|
+
[this.fieldIdentifier]: values.map(Number) as BoundingBox,
|
|
446
504
|
})
|
|
447
505
|
}
|
|
448
506
|
|
|
449
507
|
getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
|
|
450
|
-
const filter = filters[this.
|
|
508
|
+
const filter = filters[this.fieldIdentifier]
|
|
451
509
|
return of(isBoundingBox(filter) ? filter : [])
|
|
452
510
|
}
|
|
453
511
|
|
|
@@ -565,7 +623,7 @@ export class RecordKindField extends SimpleSearchField {
|
|
|
565
623
|
|
|
566
624
|
getFiltersForValues(values: FieldValue[]): Observable<FieldFilters | string> {
|
|
567
625
|
const filters: FieldFilters = {
|
|
568
|
-
[this.
|
|
626
|
+
[this.fieldIdentifier]: values.reduce((acc, value) => {
|
|
569
627
|
if (value === '') return { ...acc, [value]: true }
|
|
570
628
|
|
|
571
629
|
const keysToAdd = this.TYPE_MAPPING[value] || [value]
|
|
@@ -592,7 +650,7 @@ export class RecordKindField extends SimpleSearchField {
|
|
|
592
650
|
}
|
|
593
651
|
|
|
594
652
|
getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
|
|
595
|
-
const filter = filters[this.
|
|
653
|
+
const filter = filters[this.fieldIdentifier]
|
|
596
654
|
if (!filter) return of([])
|
|
597
655
|
|
|
598
656
|
const activeValues = Object.keys(filter).filter((v) => filter[v])
|
|
@@ -128,7 +128,8 @@ export class ServiceCapabilitiesComponent implements OnInit {
|
|
|
128
128
|
this.loading = true
|
|
129
129
|
this.availableLayers = await getLayers(
|
|
130
130
|
this.apiLinks[0].url.href,
|
|
131
|
-
this.apiLinks[0].accessServiceProtocol
|
|
131
|
+
this.apiLinks[0].accessServiceProtocol,
|
|
132
|
+
true
|
|
132
133
|
)
|
|
133
134
|
this.loading = false
|
|
134
135
|
this.cdr.detectChanges()
|
|
@@ -83,7 +83,16 @@
|
|
|
83
83
|
>
|
|
84
84
|
@for (suggestion of suggestions$ | async; track suggestion) {
|
|
85
85
|
<mat-option [value]="suggestion" class="p-2 suggestion text-start">
|
|
86
|
-
|
|
86
|
+
@if (displayWithTemplate) {
|
|
87
|
+
<ng-container
|
|
88
|
+
*ngTemplateOutlet="
|
|
89
|
+
displayWithTemplate;
|
|
90
|
+
context: { $implicit: suggestion }
|
|
91
|
+
"
|
|
92
|
+
></ng-container>
|
|
93
|
+
} @else {
|
|
94
|
+
{{ displayWithFnInternal(suggestion) }}
|
|
95
|
+
}
|
|
87
96
|
</mat-option>
|
|
88
97
|
}
|
|
89
98
|
</mat-autocomplete>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
OnInit,
|
|
12
12
|
Output,
|
|
13
13
|
SimpleChanges,
|
|
14
|
+
TemplateRef,
|
|
14
15
|
ViewChild,
|
|
15
16
|
inject,
|
|
16
17
|
} from '@angular/core'
|
|
@@ -97,6 +98,13 @@ export class AutocompleteComponent
|
|
|
97
98
|
@ViewChild(MatAutocompleteTrigger) triggerRef: MatAutocompleteTrigger
|
|
98
99
|
@ViewChild(MatAutocomplete) autocomplete: MatAutocomplete
|
|
99
100
|
@ViewChild('searchInput') inputRef: ElementRef<HTMLInputElement>
|
|
101
|
+
/**
|
|
102
|
+
* Custom template to render each suggestion. Takes precedence over
|
|
103
|
+
* `displayWithFn` when set.
|
|
104
|
+
*/
|
|
105
|
+
@Input() displayWithTemplate?: TemplateRef<{
|
|
106
|
+
$implicit: AutocompleteItem
|
|
107
|
+
}>
|
|
100
108
|
|
|
101
109
|
searching: boolean
|
|
102
110
|
control = new UntypedFormControl()
|
|
@@ -20,10 +20,13 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
}
|
|
22
22
|
</div>
|
|
23
|
-
<button
|
|
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
|
|
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-
|
|
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
|
|
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:
|
|
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<
|
|
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
|
|
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
|
|
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
|
|
package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
[class]="
|
|
59
59
|
(hasSelection
|
|
60
60
|
? 'border-b-[1px] border-gray-400 pb-[20px]'
|
|
61
|
-
: 'pb-[
|
|
61
|
+
: 'pb-[12px]') + ' text-black'
|
|
62
62
|
"
|
|
63
63
|
>
|
|
64
64
|
<gn-ui-drag-and-drop-file-input
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
[showFileName]="false"
|
|
69
69
|
textClass="text-black truncate"
|
|
70
70
|
dropzoneBackgroundColor="transparent"
|
|
71
|
-
icon="
|
|
71
|
+
icon="iconoirUpload"
|
|
72
72
|
extraClass="gn-ui-gray-outline-input w-full !h-[32px] px-[8px] py-[4px] justify-between"
|
|
73
73
|
(fileChange)="handleFileSelected($event)"
|
|
74
74
|
(errorChange)="handleFileError($event)"
|
|
@@ -79,11 +79,7 @@
|
|
|
79
79
|
@if (hasSelection) {
|
|
80
80
|
<gn-ui-button
|
|
81
81
|
[type]="'primary-light'"
|
|
82
|
-
[title]="
|
|
83
|
-
('search.filters.spatialExtent.bboxDelete' | translate) +
|
|
84
|
-
' ' +
|
|
85
|
-
fileName
|
|
86
|
-
"
|
|
82
|
+
[title]="selectionDeleteLabelKey | translate: selectionLabelParams"
|
|
87
83
|
(buttonClick)="removeSelection($event)"
|
|
88
84
|
extraClass="group gap-x-2 w-full h-[28px] px-[8px] py-[4px] mb-[12px] bg-primary-lighter text-white"
|
|
89
85
|
data-test="spatial-extent-selected-item"
|
|
@@ -94,12 +90,10 @@
|
|
|
94
90
|
size="15px"
|
|
95
91
|
></ng-icon>
|
|
96
92
|
<span class="group-hover:hidden truncate text-sm m-auto">
|
|
97
|
-
{{
|
|
98
|
-
{{ fileName }}
|
|
93
|
+
{{ selectionLabelKey | translate: selectionLabelParams }}
|
|
99
94
|
</span>
|
|
100
95
|
<span class="hidden group-hover:block truncate text-sm m-auto">
|
|
101
|
-
{{
|
|
102
|
-
{{ fileName }}
|
|
96
|
+
{{ selectionDeleteLabelKey | translate: selectionLabelParams }}
|
|
103
97
|
</span>
|
|
104
98
|
<ng-icon
|
|
105
99
|
name="iconoirCheckCircle"
|
package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts
CHANGED
|
@@ -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,21 @@ 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.
|
|
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_INITIAL = marker('search.filters.spatialExtent.bboxInitial')
|
|
57
|
+
const LABEL_INITIAL_DELETE = marker(
|
|
58
|
+
'search.filters.spatialExtent.bboxInitialDelete'
|
|
59
|
+
)
|
|
50
60
|
|
|
51
61
|
export interface SpatialExtentDropdownError {
|
|
52
62
|
key: string
|
|
53
63
|
params?: Record<string, string | number>
|
|
54
64
|
}
|
|
55
|
-
marker('search.filters.spatialExtent.bboxDelete')
|
|
56
65
|
|
|
57
66
|
@Component({
|
|
58
67
|
selector: 'gn-ui-spatial-extent-dropdown',
|
|
@@ -67,9 +76,9 @@ marker('search.filters.spatialExtent.bboxDelete')
|
|
|
67
76
|
providers: [
|
|
68
77
|
provideIcons({
|
|
69
78
|
iconoirCheckCircle,
|
|
70
|
-
iconoirImport,
|
|
71
79
|
iconoirSquareDashed,
|
|
72
80
|
iconoirTrash,
|
|
81
|
+
iconoirUpload,
|
|
73
82
|
matClose,
|
|
74
83
|
matExpandLess,
|
|
75
84
|
matExpandMore,
|
|
@@ -85,6 +94,11 @@ export class SpatialExtentDropdownComponent {
|
|
|
85
94
|
|
|
86
95
|
@Input() title: string
|
|
87
96
|
@Input() maxFileSizeMb: number | null = null
|
|
97
|
+
@Input() set initialBbox(value: BoundingBox | null) {
|
|
98
|
+
if (!this.bbox && value) {
|
|
99
|
+
this.bbox = value
|
|
100
|
+
}
|
|
101
|
+
}
|
|
88
102
|
|
|
89
103
|
@Output() bboxChange = new EventEmitter<BoundingBox | null>()
|
|
90
104
|
@Output() errorChange = new EventEmitter<SpatialExtentDropdownError>()
|
|
@@ -123,6 +137,18 @@ export class SpatialExtentDropdownComponent {
|
|
|
123
137
|
return !!this.bbox
|
|
124
138
|
}
|
|
125
139
|
|
|
140
|
+
get selectionLabelKey() {
|
|
141
|
+
return this.fileName ? LABEL_FROM_FILE : LABEL_INITIAL
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
get selectionDeleteLabelKey() {
|
|
145
|
+
return this.fileName ? LABEL_FROM_FILE_DELETE : LABEL_INITIAL_DELETE
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
get selectionLabelParams() {
|
|
149
|
+
return { fileName: this.fileName }
|
|
150
|
+
}
|
|
151
|
+
|
|
126
152
|
openOverlay() {
|
|
127
153
|
this.overlayMinWidth =
|
|
128
154
|
this.overlayOrigin.elementRef.nativeElement.getBoundingClientRect()
|
|
@@ -154,6 +180,10 @@ export class SpatialExtentDropdownComponent {
|
|
|
154
180
|
return
|
|
155
181
|
}
|
|
156
182
|
const bbox = getGeometryBoundingBox(geometry)
|
|
183
|
+
if (!isBoundingBoxWithinWorldExtent(bbox)) {
|
|
184
|
+
this.setError(marker('search.filters.spatialExtent.error.outOfBounds'))
|
|
185
|
+
return
|
|
186
|
+
}
|
|
157
187
|
this.bbox = bbox
|
|
158
188
|
this.fileName = file.name
|
|
159
189
|
this.bboxChange.emit(bbox)
|
|
@@ -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 = {
|
|
@@ -253,6 +253,8 @@ 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',
|
|
256
258
|
],
|
|
257
259
|
warnings,
|
|
258
260
|
errors
|
|
@@ -265,6 +267,14 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
265
267
|
warnings,
|
|
266
268
|
errors
|
|
267
269
|
)
|
|
270
|
+
const parsedCustomFilters = parseMultiConfigSection(
|
|
271
|
+
parsed,
|
|
272
|
+
'custom_filter',
|
|
273
|
+
['name', 'base_filter'],
|
|
274
|
+
['exclude_values', 'include_values', 'label_key'],
|
|
275
|
+
warnings,
|
|
276
|
+
errors
|
|
277
|
+
)
|
|
268
278
|
searchConfig =
|
|
269
279
|
parsedSearchSection === null
|
|
270
280
|
? null
|
|
@@ -281,9 +291,21 @@ export function loadAppConfig(configUrl = 'assets/configuration/default.toml') {
|
|
|
281
291
|
filters: param.filters,
|
|
282
292
|
})),
|
|
283
293
|
ADVANCED_FILTERS: parsedSearchSection.advanced_filters,
|
|
294
|
+
CUSTOM_FILTERS: (parsedCustomFilters ?? []).map(
|
|
295
|
+
(customFilter) => ({
|
|
296
|
+
name: customFilter.name,
|
|
297
|
+
baseFilter: customFilter.base_filter,
|
|
298
|
+
excludeValues: customFilter.exclude_values,
|
|
299
|
+
includeValues: customFilter.include_values,
|
|
300
|
+
labelKey: customFilter.label_key,
|
|
301
|
+
})
|
|
302
|
+
),
|
|
284
303
|
LIMIT: parsedSearchSection.limit,
|
|
285
304
|
SPATIAL_EXTENT_MAX_FILE_SIZE:
|
|
286
305
|
parsedSearchSection.spatial_extent_max_file_size,
|
|
306
|
+
GEOCODING_PROVIDER: parsedSearchSection.geocoding_provider,
|
|
307
|
+
GEOCODING_PROVIDER_OPTIONS:
|
|
308
|
+
parsedSearchSection.geocoding_provider_options,
|
|
287
309
|
} as SearchConfig)
|
|
288
310
|
|
|
289
311
|
const parsedMetadataQualitySection = parseConfigSection(
|
|
@@ -41,7 +41,22 @@ 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
|
-
|
|
44
|
+
geocoding_provider = "geoplateforme"
|
|
45
|
+
geocoding_provider_options.category = "administratif"
|
|
46
|
+
geocoding_provider_options.limit = 5
|
|
47
|
+
advanced_filters = ['publicationYear', 'documentStandard', 'inspireKeyword', 'topic', 'license', 'myOrg:firstCustomFilter', 'myOrg:secondCustomFilter']
|
|
48
|
+
|
|
49
|
+
[[custom_filter]]
|
|
50
|
+
name = 'myOrg:firstCustomFilter'
|
|
51
|
+
base_filter = 'keyword'
|
|
52
|
+
exclude_values = ['my keyword 1', 'my keyword 2']
|
|
53
|
+
label_key = 'myOrg.firstCustomFilter'
|
|
54
|
+
|
|
55
|
+
[[custom_filter]]
|
|
56
|
+
name = 'myOrg:secondCustomFilter'
|
|
57
|
+
base_filter = 'keyword'
|
|
58
|
+
include_values = ['my keyword 3', 'my keyword 4']
|
|
59
|
+
label_key = 'myOrg.secondCustomFilter'
|
|
45
60
|
|
|
46
61
|
[[search_preset]]
|
|
47
62
|
sort = "-createDate"
|
|
@@ -81,6 +96,23 @@ main_color = "#212029" # All-purpose text color
|
|
|
81
96
|
background_color = "#fdfbff"
|
|
82
97
|
`
|
|
83
98
|
|
|
99
|
+
export const customFilterMissingMandatoryConfigFixture = () => `
|
|
100
|
+
[global]
|
|
101
|
+
geonetwork4_api_url = "/geonetwork/srv/api"
|
|
102
|
+
|
|
103
|
+
[theme]
|
|
104
|
+
primary_color = "#093564"
|
|
105
|
+
secondary_color = "#c2e9dc"
|
|
106
|
+
main_color = "#212029" # All-purpose text color
|
|
107
|
+
background_color = "#fdfbff"
|
|
108
|
+
|
|
109
|
+
[search]
|
|
110
|
+
advanced_filters = ['myOrg:firstCustomFilter']
|
|
111
|
+
|
|
112
|
+
[[custom_filter]]
|
|
113
|
+
name = 'myOrg:firstCustomFilter'
|
|
114
|
+
`
|
|
115
|
+
|
|
84
116
|
export const mapConfigFixture = (): MapConfig => ({
|
|
85
117
|
MAX_ZOOM: 10,
|
|
86
118
|
MAX_EXTENT: [-418263.418776, 5251529.591305, 961272.067714, 6706890.609855],
|
|
@@ -55,15 +55,28 @@ 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
|
+
|
|
58
68
|
export interface SearchConfig {
|
|
59
69
|
RECORD_KIND_QUICK_FILTER?: boolean
|
|
60
70
|
FILTER_GEOMETRY_URL?: string
|
|
61
71
|
FILTER_GEOMETRY_DATA?: string
|
|
62
72
|
DO_NOT_USE_DEFAULT_SEARCH_PRESET?: boolean
|
|
63
73
|
SEARCH_PRESET?: SearchPreset[]
|
|
64
|
-
ADVANCED_FILTERS?: []
|
|
74
|
+
ADVANCED_FILTERS?: string[]
|
|
75
|
+
CUSTOM_FILTERS?: CustomSearchFieldConfig[]
|
|
65
76
|
LIMIT?: number
|
|
66
77
|
SPATIAL_EXTENT_MAX_FILE_SIZE?: number
|
|
78
|
+
GEOCODING_PROVIDER?: GeocodingProviderName
|
|
79
|
+
GEOCODING_PROVIDER_OPTIONS?: Record<string, string | number>
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
export interface MetadataQualityConfig {
|
|
@@ -344,7 +344,11 @@ export function getLinkLabel(
|
|
|
344
344
|
return format ? `${label} (${format})` : label
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
export async function getLayers(
|
|
347
|
+
export async function getLayers(
|
|
348
|
+
url: string,
|
|
349
|
+
serviceProtocol: ServiceProtocol,
|
|
350
|
+
deep = false
|
|
351
|
+
) {
|
|
348
352
|
switch (serviceProtocol) {
|
|
349
353
|
case 'ogcFeatures': {
|
|
350
354
|
const layers = await new OgcApiEndpoint(url).allCollections
|
|
@@ -352,7 +356,10 @@ export async function getLayers(url: string, serviceProtocol: ServiceProtocol) {
|
|
|
352
356
|
}
|
|
353
357
|
case 'wfs': {
|
|
354
358
|
const endpointWfs = await new WfsEndpoint(url).isReady()
|
|
355
|
-
const featureTypes =
|
|
359
|
+
const featureTypes = endpointWfs.getFeatureTypes()
|
|
360
|
+
if (!deep) {
|
|
361
|
+
return featureTypes
|
|
362
|
+
}
|
|
356
363
|
const layers = (
|
|
357
364
|
await Promise.allSettled(
|
|
358
365
|
featureTypes.map((collection) => {
|
|
@@ -366,14 +373,16 @@ export async function getLayers(url: string, serviceProtocol: ServiceProtocol) {
|
|
|
366
373
|
}
|
|
367
374
|
case 'wms': {
|
|
368
375
|
const endpointWms = await new WmsEndpoint(url).isReady()
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
const layersSummary = endpointWms
|
|
377
|
+
.getLayers()
|
|
378
|
+
.flatMap(wmsLayerFlatten)
|
|
379
|
+
.filter((l) => l.name)
|
|
380
|
+
if (!deep) {
|
|
381
|
+
return layersSummary
|
|
382
|
+
}
|
|
383
|
+
const layers = layersSummary.map((collection) =>
|
|
384
|
+
endpointWms.getLayerByName(collection.name)
|
|
385
|
+
)
|
|
377
386
|
return layers
|
|
378
387
|
}
|
|
379
388
|
case 'wmts': {
|
|
@@ -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) {
|