adb-shared 22.0.0-beta.2 → 22.0.0-beta.4
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/adb-shared-map.mjs +236 -183
- package/fesm2022/adb-shared-map.mjs.map +1 -1
- package/fesm2022/adb-shared.mjs +92 -22
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +5 -4
- package/redlist-colors.css +7 -0
- package/types/adb-shared-map.d.ts +72 -37
- package/types/adb-shared.d.ts +30 -9
|
@@ -2,7 +2,7 @@ import * as i1$2 from "@angular/common";
|
|
|
2
2
|
import { CommonModule } from "@angular/common";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Injectable, InjectionToken, Input, NgModule, afterRenderEffect, computed, effect, forwardRef, inject, input, output, signal } from "@angular/core";
|
|
5
|
-
import * as
|
|
5
|
+
import * as i4 from "@angular/forms";
|
|
6
6
|
import { FormArray, FormControl, FormGroup, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from "@angular/forms";
|
|
7
7
|
import GeoJSON from "ol/format/GeoJSON.js";
|
|
8
8
|
import Draw from "ol/interaction/Draw.js";
|
|
@@ -14,6 +14,7 @@ import { fromLonLat, toLonLat, transformExtent } from "ol/proj.js";
|
|
|
14
14
|
import { getDistance } from "ol/sphere.js";
|
|
15
15
|
import Map from "ol/Map.js";
|
|
16
16
|
import View from "ol/View.js";
|
|
17
|
+
import { extend, getCenter, getForViewAndSize, isEmpty } from "ol/extent.js";
|
|
17
18
|
import TileLayer from "ol/layer/Tile.js";
|
|
18
19
|
import TileWMS from "ol/source/TileWMS.js";
|
|
19
20
|
import XYZ from "ol/source/XYZ.js";
|
|
@@ -27,16 +28,15 @@ import { TranslatePipe } from "@ngx-translate/core";
|
|
|
27
28
|
import * as i1 from "@angular/router";
|
|
28
29
|
import { NavigationEnd, RouterModule } from "@angular/router";
|
|
29
30
|
import Feature from "ol/Feature.js";
|
|
30
|
-
import { extend, getCenter, getForViewAndSize, isEmpty } from "ol/extent.js";
|
|
31
31
|
import { finalize } from "rxjs/operators";
|
|
32
32
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
33
33
|
import * as i2 from "@angular/common/http";
|
|
34
34
|
import { HttpClient } from "@angular/common/http";
|
|
35
35
|
import { Subscription, combineLatest, debounceTime, map } from "rxjs";
|
|
36
|
+
import * as i1$1 from "adb-shared";
|
|
37
|
+
import { AdbButtonsModule, AdbDatePickerModule, AdbDirectivesModule, AdbDropdownModule, AdbFilterSectionModule, AdbPickerModule, AdbPipesModule } from "adb-shared";
|
|
36
38
|
import LineString from "ol/geom/LineString.js";
|
|
37
39
|
import MultiPolygon from "ol/geom/MultiPolygon.js";
|
|
38
|
-
import * as i1$1 from "adb-shared";
|
|
39
|
-
import { AdbButtonsModule, AdbDatePickerModule, AdbDirectivesModule, AdbFilterSectionModule, AdbPickerModule, AdbPipesModule } from "adb-shared";
|
|
40
40
|
import { addYears, endOfDay, endOfYear, parseISO, startOfDay, startOfYear } from "date-fns";
|
|
41
41
|
const DateTypes = {
|
|
42
42
|
THIS_YEAR: "1",
|
|
@@ -48,6 +48,12 @@ const DateTypes = {
|
|
|
48
48
|
};
|
|
49
49
|
const MapConstants = {
|
|
50
50
|
INITIAL_METERS_PER_PIXEL: 200,
|
|
51
|
+
FIT_PADDING: [
|
|
52
|
+
20,
|
|
53
|
+
20,
|
|
54
|
+
20,
|
|
55
|
+
20
|
|
56
|
+
],
|
|
51
57
|
LOCATION_MARKER_BACKGROUND_COLOR: "#f3db60",
|
|
52
58
|
LOCATION_MARKER_BORDER_COLOR: "#665500",
|
|
53
59
|
OBSERVATION_MARKER_BACKGROUND_COLOR: "#007c91",
|
|
@@ -67,9 +73,88 @@ const MapConstants = {
|
|
|
67
73
|
HOVER_RADIUS: 10
|
|
68
74
|
};
|
|
69
75
|
var AdbMapUtils = class AdbMapUtils {
|
|
76
|
+
static INITIAL_METERS_PER_PIXEL = 500;
|
|
77
|
+
static INITIAL_CENTER_LAT = 62;
|
|
78
|
+
static INITIAL_CENTER_LNG = 17;
|
|
79
|
+
static OverlayMaps = {
|
|
80
|
+
"Altitude": AdbMapUtils.wms("https://maps.sgu.se/lmv/hojdmodell/v1.1?SERVICE=WMS", {
|
|
81
|
+
layers: "terrangskuggning",
|
|
82
|
+
format: "image/png",
|
|
83
|
+
transparent: true,
|
|
84
|
+
opacity: .3,
|
|
85
|
+
maxZoom: 16,
|
|
86
|
+
version: "1.3.0"
|
|
87
|
+
}),
|
|
88
|
+
"Fjällkarta": AdbMapUtils.wms("api/maps/mountain", {
|
|
89
|
+
minZoom: 6,
|
|
90
|
+
maxZoom: 18,
|
|
91
|
+
maxNativeZoom: 14,
|
|
92
|
+
attribution: "© <a href=\"https://www.lantmateriet.se/\">Fjällkart</a>",
|
|
93
|
+
wms: true
|
|
94
|
+
}),
|
|
95
|
+
"Kommuner": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
96
|
+
layers: "GeoRegion:Municipality",
|
|
97
|
+
version: "1.1.0",
|
|
98
|
+
transparent: true,
|
|
99
|
+
format: "image/png"
|
|
100
|
+
}),
|
|
101
|
+
"Län": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
102
|
+
layers: "GeoRegion:County",
|
|
103
|
+
version: "1.1.0",
|
|
104
|
+
transparent: true,
|
|
105
|
+
format: "image/png"
|
|
106
|
+
}),
|
|
107
|
+
"Ortnamn": AdbMapUtils.wms("https://maps.sgu.se/lmv/topowebb-skikt/v1.1?SERVICE=WMS", {
|
|
108
|
+
layers: "text",
|
|
109
|
+
format: "image/png",
|
|
110
|
+
transparent: true,
|
|
111
|
+
version: "1.3.0"
|
|
112
|
+
}),
|
|
113
|
+
"Ekonomisk zon": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms?", {
|
|
114
|
+
layers: "it.geosolutions:Ekonomiska_zonens_yttre_avgränsningslinjer_linje",
|
|
115
|
+
format: "image/png",
|
|
116
|
+
transparent: true,
|
|
117
|
+
version: "1.1.0"
|
|
118
|
+
})
|
|
119
|
+
};
|
|
120
|
+
static Providers = [{
|
|
121
|
+
name: "Open Streetmap",
|
|
122
|
+
id: 3,
|
|
123
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
124
|
+
minZoom: 0,
|
|
125
|
+
maxZoom: 18,
|
|
126
|
+
params: {
|
|
127
|
+
maxNativeZoom: 18,
|
|
128
|
+
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
|
|
129
|
+
},
|
|
130
|
+
wms: false
|
|
131
|
+
}, {
|
|
132
|
+
name: "Sveriges gränser",
|
|
133
|
+
id: 7,
|
|
134
|
+
url: "https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms",
|
|
135
|
+
minZoom: 6,
|
|
136
|
+
maxZoom: 18,
|
|
137
|
+
params: {
|
|
138
|
+
maxNativeZoom: 14,
|
|
139
|
+
attribution: "© <a href=\"https://www.lantmateriet.se/\">Sveriges gränser</a>",
|
|
140
|
+
layers: "it.geosolutions:Sverige_epsg5845",
|
|
141
|
+
styles: "municipality_name_yellow",
|
|
142
|
+
epsg: 5845
|
|
143
|
+
},
|
|
144
|
+
wms: true
|
|
145
|
+
}];
|
|
146
|
+
static fitExtentIfReady(map, extent, options) {
|
|
147
|
+
const size = map.getSize();
|
|
148
|
+
if (!size?.[0] || !size[1] || !extent || isEmpty(extent)) return false;
|
|
149
|
+
map.getView().fit(extent, options);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
static isCluster(properties) {
|
|
153
|
+
return properties["groupingType"] === "pixelCluster" || !!properties["isCluster"];
|
|
154
|
+
}
|
|
70
155
|
static locationSymbol(feature, selected = false, hovered = false) {
|
|
71
156
|
const props = feature.getProperties();
|
|
72
|
-
const cluster = props
|
|
157
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
73
158
|
const point = ["Point", "MultiPoint"].includes(feature.getGeometry()?.getType());
|
|
74
159
|
const text = point && !cluster && props["observationCount"] === 1 && (props["locations"]?.count === 1 || !!props["location"]) ? new Text({
|
|
75
160
|
text: "1",
|
|
@@ -152,7 +237,7 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
152
237
|
const color = before ? MapConstants.BEFORE_CUTOFF_YEAR_COLOR : MapConstants.AFTER_CUTOFF_YEAR_COLOR;
|
|
153
238
|
const image = style.getImage();
|
|
154
239
|
if (image instanceof Circle) {
|
|
155
|
-
image.setFill(before ?
|
|
240
|
+
image.setFill(new Fill({ color: before ? "transparent" : color }));
|
|
156
241
|
image.setStroke(new Stroke({
|
|
157
242
|
color: before ? color : "#000",
|
|
158
243
|
width: before ? 2 : image.getStroke().getWidth()
|
|
@@ -167,9 +252,16 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
167
252
|
const latitude = toLonLat(center)[1];
|
|
168
253
|
return new CircleGeometry(center, radius / Math.cos(latitude * Math.PI / 180));
|
|
169
254
|
}
|
|
170
|
-
static
|
|
171
|
-
|
|
172
|
-
|
|
255
|
+
static gridSymbol(observationCount, levels) {
|
|
256
|
+
const color = levels.find((level) => observationCount <= level.max)?.color ?? "#2FB3BB";
|
|
257
|
+
return new Style({
|
|
258
|
+
stroke: new Stroke({
|
|
259
|
+
color: "#212529",
|
|
260
|
+
width: 1
|
|
261
|
+
}),
|
|
262
|
+
fill: new Fill({ color })
|
|
263
|
+
});
|
|
264
|
+
}
|
|
173
265
|
static gridLevels(result) {
|
|
174
266
|
const counts = (result?.features ?? []).map((feature) => feature.properties?.ObservationsCount).filter((count) => typeof count === "number");
|
|
175
267
|
if (!counts.length) return [];
|
|
@@ -202,73 +294,6 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
202
294
|
}
|
|
203
295
|
return AdbMapUtils.INITIAL_METERS_PER_PIXEL;
|
|
204
296
|
}
|
|
205
|
-
static OverlayMaps = {
|
|
206
|
-
"Altitude": AdbMapUtils.wms("https://maps.sgu.se/lmv/hojdmodell/v1.1?SERVICE=WMS", {
|
|
207
|
-
layers: "terrangskuggning",
|
|
208
|
-
format: "image/png",
|
|
209
|
-
transparent: true,
|
|
210
|
-
opacity: .3,
|
|
211
|
-
maxZoom: 16,
|
|
212
|
-
version: "1.3.0"
|
|
213
|
-
}),
|
|
214
|
-
"Fjällkarta": AdbMapUtils.wms("api/maps/mountain", {
|
|
215
|
-
minZoom: 6,
|
|
216
|
-
maxZoom: 18,
|
|
217
|
-
maxNativeZoom: 14,
|
|
218
|
-
attribution: "© <a href=\"https://www.lantmateriet.se/\">Fjällkart</a>",
|
|
219
|
-
wms: true
|
|
220
|
-
}),
|
|
221
|
-
"Kommuner": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
222
|
-
layers: "GeoRegion:Municipality",
|
|
223
|
-
version: "1.1.0",
|
|
224
|
-
transparent: true,
|
|
225
|
-
format: "image/png"
|
|
226
|
-
}),
|
|
227
|
-
"Län": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
228
|
-
layers: "GeoRegion:County",
|
|
229
|
-
version: "1.1.0",
|
|
230
|
-
transparent: true,
|
|
231
|
-
format: "image/png"
|
|
232
|
-
}),
|
|
233
|
-
"Ortnamn": AdbMapUtils.wms("https://maps.sgu.se/lmv/topowebb-skikt/v1.1?SERVICE=WMS", {
|
|
234
|
-
layers: "text",
|
|
235
|
-
format: "image/png",
|
|
236
|
-
transparent: true,
|
|
237
|
-
version: "1.3.0"
|
|
238
|
-
}),
|
|
239
|
-
"Ekonomisk zon": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms?", {
|
|
240
|
-
layers: "it.geosolutions:Ekonomiska_zonens_yttre_avgränsningslinjer_linje",
|
|
241
|
-
format: "image/png",
|
|
242
|
-
transparent: true,
|
|
243
|
-
version: "1.1.0"
|
|
244
|
-
})
|
|
245
|
-
};
|
|
246
|
-
static Providers = [{
|
|
247
|
-
name: "Open Streetmap",
|
|
248
|
-
id: 3,
|
|
249
|
-
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
250
|
-
minZoom: 0,
|
|
251
|
-
maxZoom: 18,
|
|
252
|
-
params: {
|
|
253
|
-
maxNativeZoom: 18,
|
|
254
|
-
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
|
|
255
|
-
},
|
|
256
|
-
wms: false
|
|
257
|
-
}, {
|
|
258
|
-
name: "Sveriges gränser",
|
|
259
|
-
id: 7,
|
|
260
|
-
url: "https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms",
|
|
261
|
-
minZoom: 6,
|
|
262
|
-
maxZoom: 18,
|
|
263
|
-
params: {
|
|
264
|
-
maxNativeZoom: 14,
|
|
265
|
-
attribution: "© <a href=\"https://www.lantmateriet.se/\">Sveriges gränser</a>",
|
|
266
|
-
layers: "it.geosolutions:Sverige_epsg5845",
|
|
267
|
-
styles: "municipality_name_yellow",
|
|
268
|
-
epsg: 5845
|
|
269
|
-
},
|
|
270
|
-
wms: true
|
|
271
|
-
}];
|
|
272
297
|
static wms(url, options) {
|
|
273
298
|
const { opacity = 1, attribution, minZoom, maxZoom, maxNativeZoom, epsg, wms, ...parameters } = options;
|
|
274
299
|
const params = Object.fromEntries(Object.entries(parameters).map(([key, value]) => [key.toUpperCase(), value]));
|
|
@@ -301,12 +326,7 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
301
326
|
if (options.providers !== false) this.addProviders(map);
|
|
302
327
|
return map;
|
|
303
328
|
}
|
|
304
|
-
static
|
|
305
|
-
const element = document.createElement("details");
|
|
306
|
-
element.className = "ol-control adb-map-layers";
|
|
307
|
-
const summary = document.createElement("summary");
|
|
308
|
-
summary.textContent = "Kartlager";
|
|
309
|
-
element.append(summary);
|
|
329
|
+
static addProviderLayers(map) {
|
|
310
330
|
const backgrounds = this.Providers.map((provider) => {
|
|
311
331
|
const layer = provider.wms ? this.wms(provider.url, provider.params) : new TileLayer({ source: new XYZ({
|
|
312
332
|
url: provider.url.replace("{s}", "{a-c}"),
|
|
@@ -331,10 +351,28 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
331
351
|
maxZoom: original.getMaxZoom()
|
|
332
352
|
})
|
|
333
353
|
}));
|
|
334
|
-
for (const [index, entry] of
|
|
335
|
-
const background = index < backgrounds.length;
|
|
354
|
+
for (const [index, entry] of backgrounds.entries()) {
|
|
336
355
|
entry.layer.setVisible(index === 0);
|
|
337
356
|
map.addLayer(entry.layer);
|
|
357
|
+
}
|
|
358
|
+
for (const entry of overlays) {
|
|
359
|
+
entry.layer.setVisible(false);
|
|
360
|
+
map.addLayer(entry.layer);
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
backgrounds,
|
|
364
|
+
overlays
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
static addProviders(map) {
|
|
368
|
+
const element = document.createElement("details");
|
|
369
|
+
element.className = "ol-control adb-map-layers";
|
|
370
|
+
const summary = document.createElement("summary");
|
|
371
|
+
summary.textContent = "Kartlager";
|
|
372
|
+
element.append(summary);
|
|
373
|
+
const { backgrounds, overlays } = this.addProviderLayers(map);
|
|
374
|
+
for (const [index, entry] of [...backgrounds, ...overlays].entries()) {
|
|
375
|
+
const background = index < backgrounds.length;
|
|
338
376
|
const label = document.createElement("label");
|
|
339
377
|
const input = document.createElement("input");
|
|
340
378
|
input.type = background ? "radio" : "checkbox";
|
|
@@ -364,9 +402,9 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
364
402
|
var PolygonDrawerInput = class PolygonDrawerInput {
|
|
365
403
|
mapId = "draw-" + Math.floor(Math.random() * Date.now());
|
|
366
404
|
map;
|
|
367
|
-
polygonDraw = false;
|
|
405
|
+
polygonDraw = signal(false, ...ngDevMode ? [{ debugName: "polygonDraw" }] : /* istanbul ignore next */ []);
|
|
368
406
|
disabled = false;
|
|
369
|
-
shapeLayer = false;
|
|
407
|
+
shapeLayer = signal(false, ...ngDevMode ? [{ debugName: "shapeLayer" }] : /* istanbul ignore next */ []);
|
|
370
408
|
source = new VectorSource();
|
|
371
409
|
format = new GeoJSON();
|
|
372
410
|
draw;
|
|
@@ -398,7 +436,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
398
436
|
startDraw(type) {
|
|
399
437
|
if (this.disabled) return;
|
|
400
438
|
this.stopDraw();
|
|
401
|
-
this.polygonDraw
|
|
439
|
+
this.polygonDraw.set(true);
|
|
402
440
|
this.draw = new Draw({
|
|
403
441
|
source: this.source,
|
|
404
442
|
type
|
|
@@ -420,7 +458,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
420
458
|
};
|
|
421
459
|
} else geo = this.format.writeFeatureObject(event.feature, options);
|
|
422
460
|
this.geoJson = geo;
|
|
423
|
-
this.shapeLayer
|
|
461
|
+
this.shapeLayer.set(true);
|
|
424
462
|
this.onChange(geo);
|
|
425
463
|
this.onTouched();
|
|
426
464
|
this.stopDraw();
|
|
@@ -429,7 +467,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
429
467
|
stopDraw() {
|
|
430
468
|
if (this.draw) this.map.removeInteraction(this.draw);
|
|
431
469
|
this.draw = void 0;
|
|
432
|
-
this.polygonDraw
|
|
470
|
+
this.polygonDraw.set(false);
|
|
433
471
|
}
|
|
434
472
|
onUndoStep() {
|
|
435
473
|
this.draw?.removeLastPoint();
|
|
@@ -439,7 +477,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
439
477
|
this.stopDraw();
|
|
440
478
|
this.source.clear();
|
|
441
479
|
this.pendingFit = false;
|
|
442
|
-
this.shapeLayer
|
|
480
|
+
this.shapeLayer.set(false);
|
|
443
481
|
this.geoJson = null;
|
|
444
482
|
this.onChange(null);
|
|
445
483
|
this.onTouched();
|
|
@@ -450,7 +488,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
450
488
|
if (!this.map) return;
|
|
451
489
|
this.source.clear();
|
|
452
490
|
this.pendingFit = false;
|
|
453
|
-
this.shapeLayer
|
|
491
|
+
this.shapeLayer.set(false);
|
|
454
492
|
if (this.geoJson?.type !== "Feature") return;
|
|
455
493
|
const feature = this.format.readFeatures(this.geoJson, { featureProjection: this.map.getView().getProjection() })[0];
|
|
456
494
|
if (this.geoJson.geometry.type === "Point" && this.geoJson.properties?.radius) {
|
|
@@ -458,22 +496,16 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
458
496
|
feature.setGeometry(new CircleGeometry(fromLonLat(this.geoJson.geometry.coordinates), this.geoJson.properties.radius / Math.cos(latitude * Math.PI / 180)));
|
|
459
497
|
}
|
|
460
498
|
this.source.addFeature(feature);
|
|
461
|
-
this.shapeLayer
|
|
499
|
+
this.shapeLayer.set(true);
|
|
462
500
|
this.pendingFit = true;
|
|
463
501
|
this.fitShape();
|
|
464
502
|
}
|
|
465
503
|
fitShape() {
|
|
466
|
-
|
|
467
|
-
if (!this.
|
|
468
|
-
|
|
469
|
-
padding: [
|
|
470
|
-
20,
|
|
471
|
-
20,
|
|
472
|
-
20,
|
|
473
|
-
20
|
|
474
|
-
],
|
|
504
|
+
if (!this.pendingFit) return;
|
|
505
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.source.getExtent(), {
|
|
506
|
+
padding: MapConstants.FIT_PADDING,
|
|
475
507
|
maxZoom: 18
|
|
476
|
-
});
|
|
508
|
+
})) return;
|
|
477
509
|
this.pendingFit = false;
|
|
478
510
|
}
|
|
479
511
|
writeValue(value) {
|
|
@@ -514,13 +546,12 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
514
546
|
multi: true
|
|
515
547
|
}],
|
|
516
548
|
ngImport: i0,
|
|
517
|
-
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>",
|
|
549
|
+
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>",
|
|
518
550
|
dependencies: [{
|
|
519
551
|
kind: "pipe",
|
|
520
552
|
type: i1$3.TranslatePipe,
|
|
521
553
|
name: "translate"
|
|
522
|
-
}]
|
|
523
|
-
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
554
|
+
}]
|
|
524
555
|
});
|
|
525
556
|
};
|
|
526
557
|
i0.ɵɵngDeclareClassMetadata({
|
|
@@ -533,13 +564,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
533
564
|
args: [{
|
|
534
565
|
selector: "adb-polygon-drawer",
|
|
535
566
|
standalone: false,
|
|
536
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
537
567
|
providers: [{
|
|
538
568
|
provide: NG_VALUE_ACCESSOR,
|
|
539
569
|
useExisting: forwardRef(() => PolygonDrawerInput),
|
|
540
570
|
multi: true
|
|
541
571
|
}],
|
|
542
|
-
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>"
|
|
572
|
+
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>"
|
|
543
573
|
}]
|
|
544
574
|
}]
|
|
545
575
|
});
|
|
@@ -712,7 +742,12 @@ var AdbBffMapDataSource = class AdbBffMapDataSource {
|
|
|
712
742
|
for (const key of Object.keys(params)) if (params[key] == null) delete params[key];
|
|
713
743
|
return this.http.get(request.url, { params }).pipe(map((response) => {
|
|
714
744
|
const geoJson = response?.geoJson;
|
|
715
|
-
if (
|
|
745
|
+
if (geoJson == null) return {
|
|
746
|
+
type: "FeatureCollection",
|
|
747
|
+
features: [],
|
|
748
|
+
properties: { count: 0 }
|
|
749
|
+
};
|
|
750
|
+
if (geoJson.type !== "FeatureCollection") throw new Error("Invalid BFF GeoJSON response");
|
|
716
751
|
return {
|
|
717
752
|
...geoJson,
|
|
718
753
|
properties: {
|
|
@@ -771,7 +806,7 @@ var MapFeaturePickerComponent = class MapFeaturePickerComponent {
|
|
|
771
806
|
const choices = [];
|
|
772
807
|
const ids = /* @__PURE__ */ new Set();
|
|
773
808
|
for (const feature of this.features()) {
|
|
774
|
-
if (
|
|
809
|
+
if (AdbMapUtils.isCluster(feature.getProperties())) continue;
|
|
775
810
|
for (const item of feature.get("locations")?.items ?? []) {
|
|
776
811
|
if (ids.has(item.locationId)) continue;
|
|
777
812
|
ids.add(item.locationId);
|
|
@@ -873,8 +908,7 @@ var MapFeaturePickerComponent = class MapFeaturePickerComponent {
|
|
|
873
908
|
kind: "pipe",
|
|
874
909
|
type: i1$3.TranslatePipe,
|
|
875
910
|
name: "translate"
|
|
876
|
-
}]
|
|
877
|
-
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
911
|
+
}]
|
|
878
912
|
});
|
|
879
913
|
};
|
|
880
914
|
i0.ɵɵngDeclareClassMetadata({
|
|
@@ -887,7 +921,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
887
921
|
args: [{
|
|
888
922
|
selector: "adb-map-feature-picker",
|
|
889
923
|
host: { class: "adb-map-feature-picker" },
|
|
890
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
891
924
|
standalone: false,
|
|
892
925
|
template: "@if (choices().length > 1) {\n<section class=\"adb-plate-primary shadow adb-map-feature-picker-panel\" [style.left.px]=\"position().left\" [style.top.px]=\"position().top\" [attr.aria-label]=\"'MAP.FEATURE_PICKER.TITLE' | translate\"\n (adbClickOutside)=\"dismissed.emit(false)\"\n (keydown.escape)=\"$event.stopPropagation(); dismissed.emit(true)\">\n <div class=\"d-flex align-items-center justify-content-between gap-3 mb-2\">\n <h2 class=\"h6 mb-0\">{{'MAP.FEATURE_PICKER.TITLE' | translate}}</h2>\n <button type=\"button\" class=\"btn-close\" [attr.aria-label]=\"'MAP.FEATURE_PICKER.CLOSE' | translate\" (click)=\"dismissed.emit(true)\"></button>\n </div>\n <ul class=\"list-group list-group-flush\">\n @for (choice of choices(); track choice.item.locationId) {\n <li class=\"list-group-item p-0\">\n <button type=\"button\" class=\"list-group-item list-group-item-action border-0 text-break\" (click)=\"choose(choice)\">\n @if (choice.item.locality) {\n {{choice.item.locality}}\n @if (choice.item.municipality) {, {{choice.item.municipality}}}\n } @else if (choice.item.municipality) {\n {{choice.item.municipality}}\n }\n ({{choice.item.locationId}})\n </button>\n </li>\n }\n </ul>\n</section>\n}\n"
|
|
893
926
|
}]
|
|
@@ -1046,8 +1079,17 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1046
1079
|
activatedRoute;
|
|
1047
1080
|
config;
|
|
1048
1081
|
router;
|
|
1082
|
+
dataSource;
|
|
1049
1083
|
showLegend = input(true, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
|
|
1050
|
-
|
|
1084
|
+
headerButtons = input([
|
|
1085
|
+
"layers",
|
|
1086
|
+
"export",
|
|
1087
|
+
"settings"
|
|
1088
|
+
], ...ngDevMode ? [{ debugName: "headerButtons" }] : /* istanbul ignore next */ []);
|
|
1089
|
+
showLayersButton = computed(() => this.headerButtons().includes("layers"), ...ngDevMode ? [{ debugName: "showLayersButton" }] : /* istanbul ignore next */ []);
|
|
1090
|
+
showExportButton = computed(() => this.headerButtons().includes("export"), ...ngDevMode ? [{ debugName: "showExportButton" }] : /* istanbul ignore next */ []);
|
|
1091
|
+
showSettingsButton = computed(() => this.headerButtons().includes("settings"), ...ngDevMode ? [{ debugName: "showSettingsButton" }] : /* istanbul ignore next */ []);
|
|
1092
|
+
providerLayers = signal(null, ...ngDevMode ? [{ debugName: "providerLayers" }] : /* istanbul ignore next */ []);
|
|
1051
1093
|
allowPresentationMode = input(false, ...ngDevMode ? [{ debugName: "allowPresentationMode" }] : /* istanbul ignore next */ []);
|
|
1052
1094
|
presentationMode = input("locations", ...ngDevMode ? [{ debugName: "presentationMode" }] : /* istanbul ignore next */ []);
|
|
1053
1095
|
route = signal(null, ...ngDevMode ? [{ debugName: "route" }] : /* istanbul ignore next */ []);
|
|
@@ -1056,7 +1098,6 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1056
1098
|
if (this.allowPresentationMode() && (mode === "locations" || mode === "observations")) return mode;
|
|
1057
1099
|
return this.presentationMode();
|
|
1058
1100
|
}, ...ngDevMode ? [{ debugName: "activePresentationMode" }] : /* istanbul ignore next */ []);
|
|
1059
|
-
dataSource = inject(ADB_MAP_DATA_SOURCE);
|
|
1060
1101
|
requestedParams = "";
|
|
1061
1102
|
settingsOpen = signal(false, ...ngDevMode ? [{ debugName: "settingsOpen" }] : /* istanbul ignore next */ []);
|
|
1062
1103
|
savingSettings = signal(false, ...ngDevMode ? [{ debugName: "savingSettings" }] : /* istanbul ignore next */ []);
|
|
@@ -1087,15 +1128,16 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1087
1128
|
pendingExtent;
|
|
1088
1129
|
mapResult = signal(null, ...ngDevMode ? [{ debugName: "mapResult" }] : /* istanbul ignore next */ []);
|
|
1089
1130
|
cutoffYear = computed(() => this.activePresentationMode() === "observations" ? this.route()?.queryParams["cutoff"] ?? null : null, ...ngDevMode ? [{ debugName: "cutoffYear" }] : /* istanbul ignore next */ []);
|
|
1090
|
-
gridLevels =
|
|
1131
|
+
gridLevels = [];
|
|
1091
1132
|
mapId = "" + Math.floor(Math.random() * Date.now());
|
|
1092
1133
|
map;
|
|
1093
1134
|
mapReady = signal(false, ...ngDevMode ? [{ debugName: "mapReady" }] : /* istanbul ignore next */ []);
|
|
1094
1135
|
queryParams = {};
|
|
1095
|
-
constructor(activatedRoute, config, router) {
|
|
1136
|
+
constructor(activatedRoute, config, router, dataSource) {
|
|
1096
1137
|
this.activatedRoute = activatedRoute;
|
|
1097
1138
|
this.config = config;
|
|
1098
1139
|
this.router = router;
|
|
1140
|
+
this.dataSource = dataSource;
|
|
1099
1141
|
this.route.set(this.activatedRoute.snapshot);
|
|
1100
1142
|
this.settingsForm.controls.presentationMode.valueChanges.pipe(takeUntilDestroyed()).subscribe((mode) => {
|
|
1101
1143
|
const cutoff = this.settingsForm.controls.cutoff;
|
|
@@ -1127,8 +1169,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1127
1169
|
this.map = AdbMapUtils.createMap(this.mapId, {
|
|
1128
1170
|
zoom: true,
|
|
1129
1171
|
scrollZoom: false,
|
|
1130
|
-
providers:
|
|
1172
|
+
providers: false
|
|
1131
1173
|
});
|
|
1174
|
+
this.providerLayers.set(AdbMapUtils.addProviderLayers(this.map));
|
|
1132
1175
|
this.map.addLayer(new VectorLayer({
|
|
1133
1176
|
source: this.uncertaintySource,
|
|
1134
1177
|
style: new Style({ stroke: new Stroke({
|
|
@@ -1150,6 +1193,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1150
1193
|
if (size?.[0] && size[1]) this.mapReady.set(true);
|
|
1151
1194
|
this.attachUserListeners();
|
|
1152
1195
|
}
|
|
1196
|
+
selectBackground(index) {
|
|
1197
|
+
this.providerLayers().backgrounds.forEach((entry, layerIndex) => entry.layer.setVisible(layerIndex === index));
|
|
1198
|
+
}
|
|
1153
1199
|
openSettings() {
|
|
1154
1200
|
this.settingsForm.reset({
|
|
1155
1201
|
presentationMode: this.activePresentationMode(),
|
|
@@ -1238,7 +1284,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1238
1284
|
onFeatureChosen(selection) {
|
|
1239
1285
|
this.closeLocationPicker(selection.restoreFocus);
|
|
1240
1286
|
const { feature, properties: props } = selection;
|
|
1241
|
-
const cluster = props
|
|
1287
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
1242
1288
|
const location = !cluster && !!(props["location"] || props["observationCount"]);
|
|
1243
1289
|
if ((cluster || location) && this.config.enableClusterSelection && selection.selectMode) {
|
|
1244
1290
|
this.selectedFeature = feature;
|
|
@@ -1255,12 +1301,12 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1255
1301
|
let extent = feature.getGeometry().getExtent();
|
|
1256
1302
|
if (cluster) {
|
|
1257
1303
|
const projectedCenter = getCenter(extent);
|
|
1258
|
-
const center = toLonLat(projectedCenter);
|
|
1259
1304
|
const radius = props["cluster"].radiusMeters;
|
|
1260
|
-
extent =
|
|
1305
|
+
extent = AdbMapUtils.createUncertaintyCircle(projectedCenter, radius).getExtent();
|
|
1261
1306
|
const view = this.map.getView();
|
|
1262
1307
|
const size = this.map.getSize();
|
|
1263
|
-
const
|
|
1308
|
+
const [top, right, bottom, left] = MapConstants.FIT_PADDING;
|
|
1309
|
+
const fitSize = [size[0] - left - right, size[1] - top - bottom];
|
|
1264
1310
|
if (view.getResolutionForExtent(extent, fitSize) >= view.getResolution()) extent = getForViewAndSize(projectedCenter, view.getResolution() / 2, 0, fitSize);
|
|
1265
1311
|
}
|
|
1266
1312
|
const bbox = transformExtent(extent, this.map.getView().getProjection(), "EPSG:4326").join(",");
|
|
@@ -1302,6 +1348,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1302
1348
|
return qParams.bbox ? AdbMapUtils.getMetersPerPixel(qParams.bbox, this.map.getSize()?.[0]) : MapConstants.INITIAL_METERS_PER_PIXEL;
|
|
1303
1349
|
}
|
|
1304
1350
|
buildMap(geojson, fitView) {
|
|
1351
|
+
this.gridLevels = AdbMapUtils.gridLevels(geojson);
|
|
1305
1352
|
this.mapResult.set(geojson);
|
|
1306
1353
|
const features = this.format.readFeatures(geojson, { featureProjection: this.map.getView().getProjection() });
|
|
1307
1354
|
this.closeLocationPicker(false);
|
|
@@ -1332,17 +1379,10 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1332
1379
|
return [...this.map.getView().getCenter(), this.map.getView().getResolution()].join(",");
|
|
1333
1380
|
}
|
|
1334
1381
|
fitPendingExtent() {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
this.map.getView().fit(this.pendingExtent, {
|
|
1338
|
-
padding: [
|
|
1339
|
-
20,
|
|
1340
|
-
20,
|
|
1341
|
-
20,
|
|
1342
|
-
20
|
|
1343
|
-
],
|
|
1382
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1383
|
+
padding: MapConstants.FIT_PADDING,
|
|
1344
1384
|
maxZoom: 18
|
|
1345
|
-
});
|
|
1385
|
+
})) return;
|
|
1346
1386
|
this.fittedView = this.viewKey();
|
|
1347
1387
|
this.pendingExtent = void 0;
|
|
1348
1388
|
}
|
|
@@ -1355,7 +1395,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1355
1395
|
}),
|
|
1356
1396
|
fill: new Fill({ color: "transparent" })
|
|
1357
1397
|
});
|
|
1358
|
-
const cluster = props
|
|
1398
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
1359
1399
|
const location = props["locations"] || props["location"];
|
|
1360
1400
|
const point = ["Point", "MultiPoint"].includes(feature.getGeometry()?.getType());
|
|
1361
1401
|
if (cluster || location || point) return this.activePresentationMode() === "observations" ? this.aggregatedSymbol(feature) : this.locationSymbol(feature);
|
|
@@ -1366,14 +1406,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1366
1406
|
}),
|
|
1367
1407
|
fill: new Fill({ color: "rgba(0,118,129,0.1)" })
|
|
1368
1408
|
});
|
|
1369
|
-
|
|
1370
|
-
return new Style({
|
|
1371
|
-
stroke: new Stroke({
|
|
1372
|
-
color: "#212529",
|
|
1373
|
-
width: 1
|
|
1374
|
-
}),
|
|
1375
|
-
fill: new Fill({ color })
|
|
1376
|
-
});
|
|
1409
|
+
return AdbMapUtils.gridSymbol(props["ObservationsCount"], this.gridLevels);
|
|
1377
1410
|
}
|
|
1378
1411
|
locationSymbol(feature) {
|
|
1379
1412
|
return AdbMapUtils.locationSymbol(feature, feature === this.selectedFeature, feature === this.hoveredFeature);
|
|
@@ -1394,7 +1427,8 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1394
1427
|
deps: [
|
|
1395
1428
|
{ token: i1.ActivatedRoute },
|
|
1396
1429
|
{ token: AdbMapConfigService },
|
|
1397
|
-
{ token: i1.Router }
|
|
1430
|
+
{ token: i1.Router },
|
|
1431
|
+
{ token: ADB_MAP_DATA_SOURCE }
|
|
1398
1432
|
],
|
|
1399
1433
|
target: i0.ɵɵFactoryTarget.Component
|
|
1400
1434
|
});
|
|
@@ -1412,9 +1446,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1412
1446
|
isRequired: false,
|
|
1413
1447
|
transformFunction: null
|
|
1414
1448
|
},
|
|
1415
|
-
|
|
1416
|
-
classPropertyName: "
|
|
1417
|
-
publicName: "
|
|
1449
|
+
headerButtons: {
|
|
1450
|
+
classPropertyName: "headerButtons",
|
|
1451
|
+
publicName: "headerButtons",
|
|
1418
1452
|
isSignal: true,
|
|
1419
1453
|
isRequired: false,
|
|
1420
1454
|
transformFunction: null
|
|
@@ -1439,54 +1473,62 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1439
1473
|
clusterSelected: "clusterSelected"
|
|
1440
1474
|
},
|
|
1441
1475
|
ngImport: i0,
|
|
1442
|
-
template: "@if(error){\n<div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'ERROR.SERVER_ERROR'|translate}}</span>\n</div>\n}\n<div [class.loading]=\"mapLoading()\">\n <div class=\"d-flex align-items-center justify-content-end flex-wrap gap-1
|
|
1476
|
+
template: "@if(error){\n<div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'ERROR.SERVER_ERROR'|translate}}</span>\n</div>\n}\n<div [class.loading]=\"mapLoading()\">\n <div class=\"bg-light d-flex align-items-center justify-content-end border-bottom flex-wrap gap-1 p-1\" [class.d-none]=\"!headerButtons().length && mapResult()?.properties?.count == null\">\n @if (!mapLoading() && mapResult()?.properties?.count != null) {\n <span class=\"me-auto\">{{mapResult().properties.count | adbSpacing}} {{'MAP.OBSERVATIONS' | translate}}</span>\n }\n @if (showLayersButton() && !settingsOpen()) {\n @if (providerLayers(); as layers) {\n <div class=\"dropdown\" (keydown.escape)=\"layerPicker.close(); layerButton.focus(); $event.stopPropagation()\">\n <button #layerButton #layerPicker=\"adbDropdown\" adbDropdown [insideClick]=\"true\"\n type=\"button\" class=\"btn btn-sm btn-secondary dropdown-toggle no-caret\"\n [attr.aria-label]=\"'MAP.LAYERS' | translate\" [title]=\"'MAP.LAYERS' | translate\">\n <span class=\"bi bi-layers\" aria-hidden=\"true\"></span>\n </button>\n <div class=\"dropdown-menu z-3 bg-light shadow p-3 text-nowrap\">\n <fieldset>\n <legend class=\"visually-hidden\">{{'MAP.LAYERS' | translate}}</legend>\n @for (entry of layers.backgrounds; track entry.name; let index = $index) {\n <label class=\"d-block\">\n <input type=\"radio\" [name]=\"mapId + '-background'\" [checked]=\"entry.layer.getVisible()\"\n (change)=\"selectBackground(index)\">\n {{entry.name}}\n </label>\n }\n </fieldset>\n @if (layers.overlays.length) {\n <hr class=\"my-2\">\n @for (entry of layers.overlays; track entry.name) {\n <label class=\"d-block\">\n <input #overlay type=\"checkbox\" [checked]=\"entry.layer.getVisible()\"\n (change)=\"entry.layer.setVisible(overlay.checked)\">\n {{entry.name}}\n </label>\n }\n }\n </div>\n </div>\n }\n }\n @if (showExportButton()) {\n <button type=\"button\" class=\"btn btn-sm btn-secondary\" [attr.aria-label]=\"'MAP.EXPORT' | translate\" [title]=\"'MAP.EXPORT' | translate\" [disabled]=\"settingsOpen()\" (click)=\"onExport()\">\n <span class=\"bi bi-download\" aria-hidden=\"true\"></span>\n </button>\n }\n <button #settingsButton [hidden]=\"!showSettingsButton() && !settingsOpen()\" type=\"button\" class=\"btn btn-sm btn-secondary\" [attr.aria-label]=\"'MAP.SETTINGS.TITLE' | translate\"\n [title]=\"'MAP.SETTINGS.TITLE' | translate\" [attr.aria-expanded]=\"settingsOpen()\" [attr.aria-controls]=\"mapId + '-settings'\"\n (click)=\"settingsOpen() ? cancelSettings(settingsButton) : openSettings()\">\n <span class=\"bi bi-gear\" aria-hidden=\"true\"></span>\n </button>\n </div>\n <div class=\"position-relative\">\n <div [id]=\"mapId\" tabindex=\"0\" class=\"adb-map\" [class.invisible]=\"settingsOpen()\" [attr.inert]=\"settingsOpen() ? '' : null\"></div>\n @if (locationOptions(); as options) {\n <adb-map-feature-picker [locationOptions]=\"options\" (featureChosen)=\"onFeatureChosen($event)\" (dismissed)=\"closeLocationPicker($event)\" />\n }\n @if (settingsOpen()) {\n <form [id]=\"mapId + '-settings'\" [formGroup]=\"settingsForm\" (ngSubmit)=\"saveSettings(settingsButton)\"\n class=\"p-3 position-absolute top-0 start-0 w-100 h-100 overflow-auto m-0\"\n [class.loading]=\"savingSettings()\" [attr.aria-labelledby]=\"mapId + '-settings-title'\" [attr.aria-busy]=\"savingSettings()\"\n (keydown.escape)=\"cancelSettings(settingsButton); $event.stopPropagation()\">\n <h2 [id]=\"mapId + '-settings-title'\" class=\"h5\">{{'MAP.SETTINGS.TITLE' | translate}}</h2>\n <div class=\"form-check mb-3\">\n <input [id]=\"mapId + '-uncertain'\" type=\"checkbox\" formControlName=\"uncertain\" class=\"form-check-input\">\n <label [for]=\"mapId + '-uncertain'\" class=\"form-check-label\">{{'MAP.SETTINGS.UNCERTAINTY' | translate}}</label>\n </div>\n @if (allowPresentationMode()) {\n <div class=\"mb-3\">\n <label [for]=\"mapId + '-presentation-mode'\">{{'MAP.SETTINGS.PRESENTATION_MODE' | translate}}</label>\n <select [id]=\"mapId + '-presentation-mode'\" formControlName=\"presentationMode\" class=\"form-select\">\n <option value=\"locations\">{{'MAP.SETTINGS.LOCATIONS_MODE' | translate}}</option>\n <option value=\"observations\">{{'MAP.SETTINGS.OBSERVATIONS_MODE' | translate}}</option>\n </select>\n </div>\n @if (settingsForm.controls.presentationMode.value === 'observations') {\n <div class=\"mb-3\">\n <label [for]=\"mapId + '-cutoff'\">{{'MAP.SETTINGS.CUTOFF' | translate}}</label>\n <input [id]=\"mapId + '-cutoff'\" type=\"text\" inputmode=\"numeric\" formControlName=\"cutoff\" class=\"form-control\"\n [attr.aria-invalid]=\"settingsForm.controls.cutoff.invalid\" [attr.aria-describedby]=\"mapId + '-cutoff-error'\">\n @if (settingsForm.controls.cutoff.invalid) {\n <div [id]=\"mapId + '-cutoff-error'\" class=\"invalid-feedback\">{{'MAP.SETTINGS.INVALID_CUTOFF' | translate}}</div>\n }\n </div>\n }\n }\n @if (settingsError()) {\n <div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'MAP.SETTINGS.SAVE_ERROR' | translate}}</span>\n </div>\n }\n <div class=\"d-flex justify-content-end gap-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancelSettings(settingsButton)\">{{'MAP.SETTINGS.CANCEL' | translate}}</button>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"settingsForm.invalid || settingsForm.pristine\">{{'MAP.SETTINGS.SAVE' | translate}}</button>\n </div>\n </form>\n }\n </div>\n</div>\n@if (showLegend() && !settingsOpen()) {\n <adb-map-legend [result]=\"mapResult()\" [cutoffYear]=\"cutoffYear()\" [loading]=\"mapLoading()\"\n [showObservationStatus]=\"activePresentationMode() === 'observations'\" />\n}\n",
|
|
1443
1477
|
dependencies: [
|
|
1444
1478
|
{
|
|
1445
1479
|
kind: "directive",
|
|
1446
|
-
type:
|
|
1480
|
+
type: i1$1.AdbDropdownDirective,
|
|
1481
|
+
selector: "[adbDropdown]",
|
|
1482
|
+
inputs: ["insideClick"],
|
|
1483
|
+
outputs: ["adbDropdown", "dropdownClose"],
|
|
1484
|
+
exportAs: ["adbDropdown"]
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
kind: "directive",
|
|
1488
|
+
type: i4.ɵNgNoValidate,
|
|
1447
1489
|
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
1448
1490
|
},
|
|
1449
1491
|
{
|
|
1450
1492
|
kind: "directive",
|
|
1451
|
-
type:
|
|
1493
|
+
type: i4.NgSelectOption,
|
|
1452
1494
|
selector: "option",
|
|
1453
1495
|
inputs: ["ngValue", "value"]
|
|
1454
1496
|
},
|
|
1455
1497
|
{
|
|
1456
1498
|
kind: "directive",
|
|
1457
|
-
type:
|
|
1499
|
+
type: i4.ɵNgSelectMultipleOption,
|
|
1458
1500
|
selector: "option",
|
|
1459
1501
|
inputs: ["ngValue", "value"]
|
|
1460
1502
|
},
|
|
1461
1503
|
{
|
|
1462
1504
|
kind: "directive",
|
|
1463
|
-
type:
|
|
1505
|
+
type: i4.DefaultValueAccessor,
|
|
1464
1506
|
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
1465
1507
|
},
|
|
1466
1508
|
{
|
|
1467
1509
|
kind: "directive",
|
|
1468
|
-
type:
|
|
1510
|
+
type: i4.CheckboxControlValueAccessor,
|
|
1469
1511
|
selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]"
|
|
1470
1512
|
},
|
|
1471
1513
|
{
|
|
1472
1514
|
kind: "directive",
|
|
1473
|
-
type:
|
|
1515
|
+
type: i4.SelectControlValueAccessor,
|
|
1474
1516
|
selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]",
|
|
1475
1517
|
inputs: ["compareWith"]
|
|
1476
1518
|
},
|
|
1477
1519
|
{
|
|
1478
1520
|
kind: "directive",
|
|
1479
|
-
type:
|
|
1521
|
+
type: i4.NgControlStatus,
|
|
1480
1522
|
selector: "[formControlName],[ngModel],[formControl]"
|
|
1481
1523
|
},
|
|
1482
1524
|
{
|
|
1483
1525
|
kind: "directive",
|
|
1484
|
-
type:
|
|
1526
|
+
type: i4.NgControlStatusGroup,
|
|
1485
1527
|
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
1486
1528
|
},
|
|
1487
1529
|
{
|
|
1488
1530
|
kind: "directive",
|
|
1489
|
-
type:
|
|
1531
|
+
type: i4.FormGroupDirective,
|
|
1490
1532
|
selector: "[formGroup]",
|
|
1491
1533
|
inputs: ["formGroup"],
|
|
1492
1534
|
outputs: ["ngSubmit"],
|
|
@@ -1494,7 +1536,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1494
1536
|
},
|
|
1495
1537
|
{
|
|
1496
1538
|
kind: "directive",
|
|
1497
|
-
type:
|
|
1539
|
+
type: i4.FormControlName,
|
|
1498
1540
|
selector: "[formControlName]",
|
|
1499
1541
|
inputs: [
|
|
1500
1542
|
"formControlName",
|
|
@@ -1546,13 +1588,20 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1546
1588
|
selector: "adb-map",
|
|
1547
1589
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
1548
1590
|
standalone: false,
|
|
1549
|
-
template: "@if(error){\n<div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'ERROR.SERVER_ERROR'|translate}}</span>\n</div>\n}\n<div [class.loading]=\"mapLoading()\">\n <div class=\"d-flex align-items-center justify-content-end flex-wrap gap-1
|
|
1591
|
+
template: "@if(error){\n<div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'ERROR.SERVER_ERROR'|translate}}</span>\n</div>\n}\n<div [class.loading]=\"mapLoading()\">\n <div class=\"bg-light d-flex align-items-center justify-content-end border-bottom flex-wrap gap-1 p-1\" [class.d-none]=\"!headerButtons().length && mapResult()?.properties?.count == null\">\n @if (!mapLoading() && mapResult()?.properties?.count != null) {\n <span class=\"me-auto\">{{mapResult().properties.count | adbSpacing}} {{'MAP.OBSERVATIONS' | translate}}</span>\n }\n @if (showLayersButton() && !settingsOpen()) {\n @if (providerLayers(); as layers) {\n <div class=\"dropdown\" (keydown.escape)=\"layerPicker.close(); layerButton.focus(); $event.stopPropagation()\">\n <button #layerButton #layerPicker=\"adbDropdown\" adbDropdown [insideClick]=\"true\"\n type=\"button\" class=\"btn btn-sm btn-secondary dropdown-toggle no-caret\"\n [attr.aria-label]=\"'MAP.LAYERS' | translate\" [title]=\"'MAP.LAYERS' | translate\">\n <span class=\"bi bi-layers\" aria-hidden=\"true\"></span>\n </button>\n <div class=\"dropdown-menu z-3 bg-light shadow p-3 text-nowrap\">\n <fieldset>\n <legend class=\"visually-hidden\">{{'MAP.LAYERS' | translate}}</legend>\n @for (entry of layers.backgrounds; track entry.name; let index = $index) {\n <label class=\"d-block\">\n <input type=\"radio\" [name]=\"mapId + '-background'\" [checked]=\"entry.layer.getVisible()\"\n (change)=\"selectBackground(index)\">\n {{entry.name}}\n </label>\n }\n </fieldset>\n @if (layers.overlays.length) {\n <hr class=\"my-2\">\n @for (entry of layers.overlays; track entry.name) {\n <label class=\"d-block\">\n <input #overlay type=\"checkbox\" [checked]=\"entry.layer.getVisible()\"\n (change)=\"entry.layer.setVisible(overlay.checked)\">\n {{entry.name}}\n </label>\n }\n }\n </div>\n </div>\n }\n }\n @if (showExportButton()) {\n <button type=\"button\" class=\"btn btn-sm btn-secondary\" [attr.aria-label]=\"'MAP.EXPORT' | translate\" [title]=\"'MAP.EXPORT' | translate\" [disabled]=\"settingsOpen()\" (click)=\"onExport()\">\n <span class=\"bi bi-download\" aria-hidden=\"true\"></span>\n </button>\n }\n <button #settingsButton [hidden]=\"!showSettingsButton() && !settingsOpen()\" type=\"button\" class=\"btn btn-sm btn-secondary\" [attr.aria-label]=\"'MAP.SETTINGS.TITLE' | translate\"\n [title]=\"'MAP.SETTINGS.TITLE' | translate\" [attr.aria-expanded]=\"settingsOpen()\" [attr.aria-controls]=\"mapId + '-settings'\"\n (click)=\"settingsOpen() ? cancelSettings(settingsButton) : openSettings()\">\n <span class=\"bi bi-gear\" aria-hidden=\"true\"></span>\n </button>\n </div>\n <div class=\"position-relative\">\n <div [id]=\"mapId\" tabindex=\"0\" class=\"adb-map\" [class.invisible]=\"settingsOpen()\" [attr.inert]=\"settingsOpen() ? '' : null\"></div>\n @if (locationOptions(); as options) {\n <adb-map-feature-picker [locationOptions]=\"options\" (featureChosen)=\"onFeatureChosen($event)\" (dismissed)=\"closeLocationPicker($event)\" />\n }\n @if (settingsOpen()) {\n <form [id]=\"mapId + '-settings'\" [formGroup]=\"settingsForm\" (ngSubmit)=\"saveSettings(settingsButton)\"\n class=\"p-3 position-absolute top-0 start-0 w-100 h-100 overflow-auto m-0\"\n [class.loading]=\"savingSettings()\" [attr.aria-labelledby]=\"mapId + '-settings-title'\" [attr.aria-busy]=\"savingSettings()\"\n (keydown.escape)=\"cancelSettings(settingsButton); $event.stopPropagation()\">\n <h2 [id]=\"mapId + '-settings-title'\" class=\"h5\">{{'MAP.SETTINGS.TITLE' | translate}}</h2>\n <div class=\"form-check mb-3\">\n <input [id]=\"mapId + '-uncertain'\" type=\"checkbox\" formControlName=\"uncertain\" class=\"form-check-input\">\n <label [for]=\"mapId + '-uncertain'\" class=\"form-check-label\">{{'MAP.SETTINGS.UNCERTAINTY' | translate}}</label>\n </div>\n @if (allowPresentationMode()) {\n <div class=\"mb-3\">\n <label [for]=\"mapId + '-presentation-mode'\">{{'MAP.SETTINGS.PRESENTATION_MODE' | translate}}</label>\n <select [id]=\"mapId + '-presentation-mode'\" formControlName=\"presentationMode\" class=\"form-select\">\n <option value=\"locations\">{{'MAP.SETTINGS.LOCATIONS_MODE' | translate}}</option>\n <option value=\"observations\">{{'MAP.SETTINGS.OBSERVATIONS_MODE' | translate}}</option>\n </select>\n </div>\n @if (settingsForm.controls.presentationMode.value === 'observations') {\n <div class=\"mb-3\">\n <label [for]=\"mapId + '-cutoff'\">{{'MAP.SETTINGS.CUTOFF' | translate}}</label>\n <input [id]=\"mapId + '-cutoff'\" type=\"text\" inputmode=\"numeric\" formControlName=\"cutoff\" class=\"form-control\"\n [attr.aria-invalid]=\"settingsForm.controls.cutoff.invalid\" [attr.aria-describedby]=\"mapId + '-cutoff-error'\">\n @if (settingsForm.controls.cutoff.invalid) {\n <div [id]=\"mapId + '-cutoff-error'\" class=\"invalid-feedback\">{{'MAP.SETTINGS.INVALID_CUTOFF' | translate}}</div>\n }\n </div>\n }\n }\n @if (settingsError()) {\n <div class=\"d-flex align-items-baseline gap-2 p-2 mb-3\" role=\"alert\">\n <span class=\"bi bi-circle-fill text-danger\" aria-hidden=\"true\"></span>\n <span>{{'MAP.SETTINGS.SAVE_ERROR' | translate}}</span>\n </div>\n }\n <div class=\"d-flex justify-content-end gap-2\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancelSettings(settingsButton)\">{{'MAP.SETTINGS.CANCEL' | translate}}</button>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"settingsForm.invalid || settingsForm.pristine\">{{'MAP.SETTINGS.SAVE' | translate}}</button>\n </div>\n </form>\n }\n </div>\n</div>\n@if (showLegend() && !settingsOpen()) {\n <adb-map-legend [result]=\"mapResult()\" [cutoffYear]=\"cutoffYear()\" [loading]=\"mapLoading()\"\n [showObservationStatus]=\"activePresentationMode() === 'observations'\" />\n}\n"
|
|
1550
1592
|
}]
|
|
1551
1593
|
}],
|
|
1552
1594
|
ctorParameters: () => [
|
|
1553
1595
|
{ type: i1.ActivatedRoute },
|
|
1554
1596
|
{ type: AdbMapConfigService },
|
|
1555
|
-
{ type: i1.Router }
|
|
1597
|
+
{ type: i1.Router },
|
|
1598
|
+
{
|
|
1599
|
+
type: void 0,
|
|
1600
|
+
decorators: [{
|
|
1601
|
+
type: Inject,
|
|
1602
|
+
args: [ADB_MAP_DATA_SOURCE]
|
|
1603
|
+
}]
|
|
1604
|
+
}
|
|
1556
1605
|
],
|
|
1557
1606
|
propDecorators: {
|
|
1558
1607
|
showLegend: [{
|
|
@@ -1563,11 +1612,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1563
1612
|
required: false
|
|
1564
1613
|
}]
|
|
1565
1614
|
}],
|
|
1566
|
-
|
|
1615
|
+
headerButtons: [{
|
|
1567
1616
|
type: i0.Input,
|
|
1568
1617
|
args: [{
|
|
1569
1618
|
isSignal: true,
|
|
1570
|
-
alias: "
|
|
1619
|
+
alias: "headerButtons",
|
|
1571
1620
|
required: false
|
|
1572
1621
|
}]
|
|
1573
1622
|
}],
|
|
@@ -1668,17 +1717,10 @@ var AdbLocationMapComponent = class AdbLocationMapComponent {
|
|
|
1668
1717
|
}
|
|
1669
1718
|
}
|
|
1670
1719
|
fitPendingExtent() {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
this.map.getView().fit(this.pendingExtent, {
|
|
1674
|
-
padding: [
|
|
1675
|
-
20,
|
|
1676
|
-
20,
|
|
1677
|
-
20,
|
|
1678
|
-
20
|
|
1679
|
-
],
|
|
1720
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1721
|
+
padding: MapConstants.FIT_PADDING,
|
|
1680
1722
|
maxZoom: 18
|
|
1681
|
-
});
|
|
1723
|
+
})) return;
|
|
1682
1724
|
this.pendingExtent = null;
|
|
1683
1725
|
}
|
|
1684
1726
|
ngOnDestroy() {
|
|
@@ -1761,6 +1803,8 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1761
1803
|
];
|
|
1762
1804
|
subscriptions = new Subscription();
|
|
1763
1805
|
form;
|
|
1806
|
+
canFilter = signal(false, ...ngDevMode ? [{ debugName: "canFilter" }] : /* istanbul ignore next */ []);
|
|
1807
|
+
formEvents;
|
|
1764
1808
|
thisYear = /* @__PURE__ */ new Date();
|
|
1765
1809
|
lastYear = addYears(/* @__PURE__ */ new Date(), -1);
|
|
1766
1810
|
queryParamsMap;
|
|
@@ -1801,7 +1845,12 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1801
1845
|
lists: results[2]
|
|
1802
1846
|
})), debounceTime(0));
|
|
1803
1847
|
this.subscriptions.add(combined$.subscribe((result) => {
|
|
1848
|
+
this.formEvents?.unsubscribe();
|
|
1804
1849
|
this.form = this.createForm(result.params, result.qParams, result.lists);
|
|
1850
|
+
this.canFilter.set(false);
|
|
1851
|
+
this.formEvents = this.form.events.subscribe(() => {
|
|
1852
|
+
this.canFilter.set(!this.form.invalid && this.form.dirty);
|
|
1853
|
+
});
|
|
1805
1854
|
this.cdr.markForCheck();
|
|
1806
1855
|
}));
|
|
1807
1856
|
}
|
|
@@ -1924,6 +1973,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1924
1973
|
}
|
|
1925
1974
|
}
|
|
1926
1975
|
ngOnDestroy() {
|
|
1976
|
+
this.formEvents?.unsubscribe();
|
|
1927
1977
|
this.subscriptions.unsubscribe();
|
|
1928
1978
|
}
|
|
1929
1979
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -1963,49 +2013,49 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1963
2013
|
}
|
|
1964
2014
|
},
|
|
1965
2015
|
ngImport: i0,
|
|
1966
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"
|
|
2016
|
+
template: "@if(form){\n<form [formGroup]=\"form\" class=\"mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"area-select\">\n {{'CHOOSE'|translate}}\n </button>\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"hasOwnArea\" (click)=\"hasOwnArea=true\" role=\"tab\" id=\"tab-draw\" aria-selected=\"{{hasOwnArea}}\" aria-controls=\"area-draw\">\n {{'OWN_AREA'|translate}}\n </button>\n </div>\n }\n <div class=\"mb-2\">\n @if(hasOwnArea&&visibleFilters().ownArea){\n <div class=\"pt-1\" role=\"tabpanel\" id=\"area-draw\" aria-labelledby=\"tab-draw\">\n <div>\n <adb-polygon-drawer formControlName=\"geo\"></adb-polygon-drawer>\n </div>\n </div>\n }@else{\n <div role=\"tabpanel\" id=\"area-select\" aria-labelledby=\"tab-select\">\n <div formArrayName=\"areas\">\n <div class=\"d-flex align-items-end mb-1\">\n <label>{{'AREAS'|translate}}</label>\n <button class=\"ms-auto text-dark btn btn-sm btn-secondary\" attr.aria-label=\"{{'OBSERVATION.ADD_AREA'|translate}}\" title=\"{{'OBSERVATION.ADD_AREA'|translate}}\" type=\"button\" (click)=\"addArea()\">\n <span class=\"bi bi-plus\"></span>\n </button>\n </div>\n @for (ctrl of areasArray.controls; track ctrl; let i = $index; let last = $last) {\n <div class=\"d-flex mb-2\">\n <adb-area-picker id=\"area-{{i}}\" [formControlName]=\"i\"></adb-area-picker>\n @if(areasArray.length>1){\n <button class=\"btn btn-secondary ms-1\" attr.aria-label=\"{{'DELETE'|translate}}\" title=\"{{'DELETE'|translate}}\" type=\"button\" (click)=\"removeArea(i)\">\n <span class=\"bi bi-trash\"></span>\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n </ng-template>\n </adb-filter-section>\n }\n @if(form.get('taxonId')){\n @if(visibleFilters().taxaLists){\n <adb-filter-section [count]=\"taxonListCount\" titleResource=\"LISTS.NATURE_CONSERVATION_LISTS\">\n <div class=\"mb-3\">\n <app-treeview formControlName=\"list\" [nodes]=\"taxaLists\"></app-treeview>\n </div>\n {{'LISTS.READ_MORE'|translate}}\n <a [href]=\"artfakta\">{{'LISTS.LIST_CONTENT'|translate}}</a>\n </adb-filter-section>\n }\n @if(visibleFilters().datasources){\n <adb-filter-section [count]=\"dataSetCount\" titleResource=\"DATASET.DATASETS\">\n @if (form.get('ds')) {\n <div formArrayName=\"ds\">\n @for (item of dsControls; track item; let i = $index) {\n <div [formGroupName]=\"i\" class=\"form-check\">\n <input type=\"checkbox\" formControlName=\"selected\" [id]=\"'ds-' + item.value.id\" class=\"form-check-input\">\n <label [for]=\"'ds-' + item.value.id\" class=\"form-check-label\">{{ 'PROVIDERS.'+item.value.id |translate }}</label>\n </div>\n }\n </div>\n }\n </adb-filter-section>\n }\n }\n </div>\n <div class=\"d-flex justify-content-end gap-2\">\n @if (inline) {\n <a class=\"btn btn-secondary\" [routerLink]=\"[]\">\n {{'CANCEL'|translate}}\n </a>\n }\n <a [routerLink]=\"[]\" class=\"btn btn-secondary\" [queryParams]=\"null\">\n {{'CLEAR'|translate}}\n </a>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"!canFilter()\">{{'FILTER'|translate}}</button>\n </div>\n</form>\n}\n",
|
|
1967
2017
|
dependencies: [
|
|
1968
2018
|
{
|
|
1969
2019
|
kind: "directive",
|
|
1970
|
-
type:
|
|
2020
|
+
type: i4.ɵNgNoValidate,
|
|
1971
2021
|
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
1972
2022
|
},
|
|
1973
2023
|
{
|
|
1974
2024
|
kind: "directive",
|
|
1975
|
-
type:
|
|
2025
|
+
type: i4.NgSelectOption,
|
|
1976
2026
|
selector: "option",
|
|
1977
2027
|
inputs: ["ngValue", "value"]
|
|
1978
2028
|
},
|
|
1979
2029
|
{
|
|
1980
2030
|
kind: "directive",
|
|
1981
|
-
type:
|
|
2031
|
+
type: i4.ɵNgSelectMultipleOption,
|
|
1982
2032
|
selector: "option",
|
|
1983
2033
|
inputs: ["ngValue", "value"]
|
|
1984
2034
|
},
|
|
1985
2035
|
{
|
|
1986
2036
|
kind: "directive",
|
|
1987
|
-
type:
|
|
2037
|
+
type: i4.DefaultValueAccessor,
|
|
1988
2038
|
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
1989
2039
|
},
|
|
1990
2040
|
{
|
|
1991
2041
|
kind: "directive",
|
|
1992
|
-
type:
|
|
2042
|
+
type: i4.CheckboxControlValueAccessor,
|
|
1993
2043
|
selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]"
|
|
1994
2044
|
},
|
|
1995
2045
|
{
|
|
1996
2046
|
kind: "directive",
|
|
1997
|
-
type:
|
|
2047
|
+
type: i4.SelectControlValueAccessor,
|
|
1998
2048
|
selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]",
|
|
1999
2049
|
inputs: ["compareWith"]
|
|
2000
2050
|
},
|
|
2001
2051
|
{
|
|
2002
2052
|
kind: "directive",
|
|
2003
|
-
type:
|
|
2053
|
+
type: i4.NgControlStatus,
|
|
2004
2054
|
selector: "[formControlName],[ngModel],[formControl]"
|
|
2005
2055
|
},
|
|
2006
2056
|
{
|
|
2007
2057
|
kind: "directive",
|
|
2008
|
-
type:
|
|
2058
|
+
type: i4.NgControlStatusGroup,
|
|
2009
2059
|
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
2010
2060
|
},
|
|
2011
2061
|
{
|
|
@@ -2029,7 +2079,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2029
2079
|
},
|
|
2030
2080
|
{
|
|
2031
2081
|
kind: "directive",
|
|
2032
|
-
type:
|
|
2082
|
+
type: i4.FormGroupDirective,
|
|
2033
2083
|
selector: "[formGroup]",
|
|
2034
2084
|
inputs: ["formGroup"],
|
|
2035
2085
|
outputs: ["ngSubmit"],
|
|
@@ -2037,7 +2087,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2037
2087
|
},
|
|
2038
2088
|
{
|
|
2039
2089
|
kind: "directive",
|
|
2040
|
-
type:
|
|
2090
|
+
type: i4.FormControlName,
|
|
2041
2091
|
selector: "[formControlName]",
|
|
2042
2092
|
inputs: [
|
|
2043
2093
|
"formControlName",
|
|
@@ -2048,13 +2098,13 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2048
2098
|
},
|
|
2049
2099
|
{
|
|
2050
2100
|
kind: "directive",
|
|
2051
|
-
type:
|
|
2101
|
+
type: i4.FormGroupName,
|
|
2052
2102
|
selector: "[formGroupName]",
|
|
2053
2103
|
inputs: ["formGroupName"]
|
|
2054
2104
|
},
|
|
2055
2105
|
{
|
|
2056
2106
|
kind: "directive",
|
|
2057
|
-
type:
|
|
2107
|
+
type: i4.FormArrayName,
|
|
2058
2108
|
selector: "[formArrayName]",
|
|
2059
2109
|
inputs: ["formArrayName"]
|
|
2060
2110
|
},
|
|
@@ -2138,7 +2188,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2138
2188
|
selector: "adb-map-filters",
|
|
2139
2189
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
2140
2190
|
standalone: false,
|
|
2141
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"
|
|
2191
|
+
template: "@if(form){\n<form [formGroup]=\"form\" class=\"mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"area-select\">\n {{'CHOOSE'|translate}}\n </button>\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"hasOwnArea\" (click)=\"hasOwnArea=true\" role=\"tab\" id=\"tab-draw\" aria-selected=\"{{hasOwnArea}}\" aria-controls=\"area-draw\">\n {{'OWN_AREA'|translate}}\n </button>\n </div>\n }\n <div class=\"mb-2\">\n @if(hasOwnArea&&visibleFilters().ownArea){\n <div class=\"pt-1\" role=\"tabpanel\" id=\"area-draw\" aria-labelledby=\"tab-draw\">\n <div>\n <adb-polygon-drawer formControlName=\"geo\"></adb-polygon-drawer>\n </div>\n </div>\n }@else{\n <div role=\"tabpanel\" id=\"area-select\" aria-labelledby=\"tab-select\">\n <div formArrayName=\"areas\">\n <div class=\"d-flex align-items-end mb-1\">\n <label>{{'AREAS'|translate}}</label>\n <button class=\"ms-auto text-dark btn btn-sm btn-secondary\" attr.aria-label=\"{{'OBSERVATION.ADD_AREA'|translate}}\" title=\"{{'OBSERVATION.ADD_AREA'|translate}}\" type=\"button\" (click)=\"addArea()\">\n <span class=\"bi bi-plus\"></span>\n </button>\n </div>\n @for (ctrl of areasArray.controls; track ctrl; let i = $index; let last = $last) {\n <div class=\"d-flex mb-2\">\n <adb-area-picker id=\"area-{{i}}\" [formControlName]=\"i\"></adb-area-picker>\n @if(areasArray.length>1){\n <button class=\"btn btn-secondary ms-1\" attr.aria-label=\"{{'DELETE'|translate}}\" title=\"{{'DELETE'|translate}}\" type=\"button\" (click)=\"removeArea(i)\">\n <span class=\"bi bi-trash\"></span>\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n </ng-template>\n </adb-filter-section>\n }\n @if(form.get('taxonId')){\n @if(visibleFilters().taxaLists){\n <adb-filter-section [count]=\"taxonListCount\" titleResource=\"LISTS.NATURE_CONSERVATION_LISTS\">\n <div class=\"mb-3\">\n <app-treeview formControlName=\"list\" [nodes]=\"taxaLists\"></app-treeview>\n </div>\n {{'LISTS.READ_MORE'|translate}}\n <a [href]=\"artfakta\">{{'LISTS.LIST_CONTENT'|translate}}</a>\n </adb-filter-section>\n }\n @if(visibleFilters().datasources){\n <adb-filter-section [count]=\"dataSetCount\" titleResource=\"DATASET.DATASETS\">\n @if (form.get('ds')) {\n <div formArrayName=\"ds\">\n @for (item of dsControls; track item; let i = $index) {\n <div [formGroupName]=\"i\" class=\"form-check\">\n <input type=\"checkbox\" formControlName=\"selected\" [id]=\"'ds-' + item.value.id\" class=\"form-check-input\">\n <label [for]=\"'ds-' + item.value.id\" class=\"form-check-label\">{{ 'PROVIDERS.'+item.value.id |translate }}</label>\n </div>\n }\n </div>\n }\n </adb-filter-section>\n }\n }\n </div>\n <div class=\"d-flex justify-content-end gap-2\">\n @if (inline) {\n <a class=\"btn btn-secondary\" [routerLink]=\"[]\">\n {{'CANCEL'|translate}}\n </a>\n }\n <a [routerLink]=\"[]\" class=\"btn btn-secondary\" [queryParams]=\"null\">\n {{'CLEAR'|translate}}\n </a>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"!canFilter()\">{{'FILTER'|translate}}</button>\n </div>\n</form>\n}\n"
|
|
2142
2192
|
}]
|
|
2143
2193
|
}],
|
|
2144
2194
|
ctorParameters: () => [
|
|
@@ -2196,6 +2246,7 @@ var AdbMapModule = class AdbMapModule {
|
|
|
2196
2246
|
CommonModule,
|
|
2197
2247
|
AdbButtonsModule,
|
|
2198
2248
|
AdbDirectivesModule,
|
|
2249
|
+
AdbDropdownModule,
|
|
2199
2250
|
FormsModule,
|
|
2200
2251
|
RouterModule,
|
|
2201
2252
|
ReactiveFormsModule,
|
|
@@ -2222,6 +2273,7 @@ var AdbMapModule = class AdbMapModule {
|
|
|
2222
2273
|
CommonModule,
|
|
2223
2274
|
AdbButtonsModule,
|
|
2224
2275
|
AdbDirectivesModule,
|
|
2276
|
+
AdbDropdownModule,
|
|
2225
2277
|
FormsModule,
|
|
2226
2278
|
RouterModule,
|
|
2227
2279
|
ReactiveFormsModule,
|
|
@@ -2244,6 +2296,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2244
2296
|
CommonModule,
|
|
2245
2297
|
AdbButtonsModule,
|
|
2246
2298
|
AdbDirectivesModule,
|
|
2299
|
+
AdbDropdownModule,
|
|
2247
2300
|
FormsModule,
|
|
2248
2301
|
RouterModule,
|
|
2249
2302
|
ReactiveFormsModule,
|