geonetwork-ui 2.11.0-dev.5c2e5295e → 2.11.0-dev.62b98576f

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 (130) hide show
  1. package/fesm2022/geonetwork-ui.mjs +2654 -1669
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +465 -187
  4. package/index.d.ts.map +1 -1
  5. package/package.json +13 -11
  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 +78 -21
  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 +160 -54
  16. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +119 -51
  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 +26 -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 +22 -3
  25. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +42 -62
  26. package/src/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts +3 -2
  27. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +2 -1
  28. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +54 -41
  29. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-constraints/form-field-constraints.component.ts +3 -5
  30. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.ts +2 -2
  31. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.html +18 -0
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
  33. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
  34. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
  35. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
  36. package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
  37. package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
  38. package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
  39. package/src/libs/feature/map/src/index.ts +0 -2
  40. package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +1 -0
  41. package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
  42. package/src/libs/feature/notifications/src/lib/notifications.service.ts +6 -4
  43. package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
  44. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +4 -8
  45. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +10 -17
  46. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +2 -4
  47. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +4 -9
  48. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +2 -7
  49. package/src/libs/feature/router/src/lib/default/state/query-params.utils.ts +1 -1
  50. package/src/libs/feature/search/src/index.ts +2 -0
  51. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +18 -4
  52. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +80 -19
  53. package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +105 -0
  54. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +18 -0
  55. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +114 -0
  56. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +19 -8
  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 +94 -10
  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/ui/map/src/lib/components/map-container/map-container.component.ts +6 -5
  88. package/src/libs/util/app-config/src/index.ts +1 -0
  89. package/src/libs/util/app-config/src/lib/app-config.ts +338 -247
  90. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  91. package/src/libs/util/app-config/src/lib/model.ts +42 -1
  92. package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
  93. package/src/libs/util/data-fetcher/src/lib/data-fetcher.ts +19 -22
  94. package/src/libs/util/data-fetcher/src/lib/engine/duckdb.ts +185 -0
  95. package/src/libs/util/data-fetcher/src/lib/engine/results.ts +63 -0
  96. package/src/libs/util/data-fetcher/src/lib/{sql-utils.ts → engine/sql-utils.ts} +28 -13
  97. package/src/libs/util/data-fetcher/src/lib/model.ts +2 -1
  98. package/src/libs/util/data-fetcher/src/lib/readers/base-file.ts +53 -38
  99. package/src/libs/util/data-fetcher/src/lib/readers/base.ts +11 -0
  100. package/src/libs/util/data-fetcher/src/lib/readers/csv.ts +9 -47
  101. package/src/libs/util/data-fetcher/src/lib/readers/excel.ts +27 -27
  102. package/src/libs/util/data-fetcher/src/lib/readers/geojson.ts +5 -24
  103. package/src/libs/util/data-fetcher/src/lib/readers/gml.ts +5 -49
  104. package/src/libs/util/data-fetcher/src/lib/readers/json.ts +5 -23
  105. package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +184 -128
  106. package/src/libs/util/data-fetcher/src/lib/utils.ts +0 -143
  107. package/src/libs/util/shared/src/index.ts +1 -0
  108. package/src/libs/util/shared/src/lib/autofocus.directive.ts +26 -0
  109. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  110. package/src/libs/util/shared/src/lib/services/date.service.ts +3 -3
  111. package/src/libs/util/shared/src/lib/utils/file.ts +15 -0
  112. package/src/libs/util/shared/src/lib/utils/geojson.ts +45 -10
  113. package/src/libs/util/shared/src/lib/utils/index.ts +1 -0
  114. package/tailwind.base.css +5 -0
  115. package/translations/de.json +30 -5
  116. package/translations/en.json +29 -4
  117. package/translations/es.json +27 -2
  118. package/translations/fr.json +34 -9
  119. package/translations/it.json +28 -3
  120. package/translations/nl.json +27 -2
  121. package/translations/pt.json +27 -2
  122. package/translations/sk.json +28 -3
  123. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  124. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  125. package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
  126. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  127. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  128. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
  129. package/src/libs/util/data-fetcher/src/lib/readers/base-cache.ts +0 -14
  130. /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
@@ -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
 
@@ -29,11 +29,11 @@ import {
29
29
  MapExtentChangeEvent,
30
30
  MapExtentChangeEventType,
31
31
  MapContext,
32
- MapContextLayerXyz,
33
32
  MapContextView,
34
33
  MapEventsByType,
35
34
  SourceLoadErrorEvent,
36
35
  SourceLoadErrorType,
36
+ MapContextLayerMapLibreStyle,
37
37
  } from '@geospatial-sdk/core'
38
38
  import {
39
39
  applyContextDiffToMap,
@@ -55,10 +55,11 @@ import {
55
55
  import { matSwipeOutline } from '@ng-icons/material-icons/outline'
56
56
  import { transformExtent } from 'ol/proj.js'
57
57
 
58
- const DEFAULT_BASEMAP_LAYER: MapContextLayerXyz = {
59
- type: 'xyz',
60
- url: `https://{a-c}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png`,
61
- attributions: `<span>© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/">Carto</a></span>`,
58
+ export const DEFAULT_BASEMAP_LAYER: MapContextLayerMapLibreStyle = {
59
+ type: 'maplibre-style',
60
+ styleUrl: `https://basemaps.cartocdn.com/gl/positron-gl-style/style.json`,
61
+ clickable: false,
62
+ hoverable: false,
62
63
  }
63
64
 
64
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'