adb-shared 22.0.0-beta.3 → 22.0.0-beta.5
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 +137 -85
- package/fesm2022/adb-shared-map.mjs.map +1 -1
- package/fesm2022/adb-shared.mjs +168 -8
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/types/adb-shared-map.d.ts +56 -26
- package/types/adb-shared.d.ts +46 -1
|
@@ -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";
|
|
@@ -33,10 +33,10 @@ 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",
|
|
@@ -143,9 +149,12 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
143
149
|
map.getView().fit(extent, options);
|
|
144
150
|
return true;
|
|
145
151
|
}
|
|
152
|
+
static isCluster(properties) {
|
|
153
|
+
return properties["groupingType"] === "pixelCluster" || !!properties["isCluster"];
|
|
154
|
+
}
|
|
146
155
|
static locationSymbol(feature, selected = false, hovered = false) {
|
|
147
156
|
const props = feature.getProperties();
|
|
148
|
-
const cluster = props
|
|
157
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
149
158
|
const point = ["Point", "MultiPoint"].includes(feature.getGeometry()?.getType());
|
|
150
159
|
const text = point && !cluster && props["observationCount"] === 1 && (props["locations"]?.count === 1 || !!props["location"]) ? new Text({
|
|
151
160
|
text: "1",
|
|
@@ -228,7 +237,7 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
228
237
|
const color = before ? MapConstants.BEFORE_CUTOFF_YEAR_COLOR : MapConstants.AFTER_CUTOFF_YEAR_COLOR;
|
|
229
238
|
const image = style.getImage();
|
|
230
239
|
if (image instanceof Circle) {
|
|
231
|
-
image.setFill(before ?
|
|
240
|
+
image.setFill(new Fill({ color: before ? "transparent" : color }));
|
|
232
241
|
image.setStroke(new Stroke({
|
|
233
242
|
color: before ? color : "#000",
|
|
234
243
|
width: before ? 2 : image.getStroke().getWidth()
|
|
@@ -317,12 +326,7 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
317
326
|
if (options.providers !== false) this.addProviders(map);
|
|
318
327
|
return map;
|
|
319
328
|
}
|
|
320
|
-
static
|
|
321
|
-
const element = document.createElement("details");
|
|
322
|
-
element.className = "ol-control adb-map-layers";
|
|
323
|
-
const summary = document.createElement("summary");
|
|
324
|
-
summary.textContent = "Kartlager";
|
|
325
|
-
element.append(summary);
|
|
329
|
+
static addProviderLayers(map) {
|
|
326
330
|
const backgrounds = this.Providers.map((provider) => {
|
|
327
331
|
const layer = provider.wms ? this.wms(provider.url, provider.params) : new TileLayer({ source: new XYZ({
|
|
328
332
|
url: provider.url.replace("{s}", "{a-c}"),
|
|
@@ -347,10 +351,28 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
347
351
|
maxZoom: original.getMaxZoom()
|
|
348
352
|
})
|
|
349
353
|
}));
|
|
350
|
-
for (const [index, entry] of
|
|
351
|
-
const background = index < backgrounds.length;
|
|
354
|
+
for (const [index, entry] of backgrounds.entries()) {
|
|
352
355
|
entry.layer.setVisible(index === 0);
|
|
353
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;
|
|
354
376
|
const label = document.createElement("label");
|
|
355
377
|
const input = document.createElement("input");
|
|
356
378
|
input.type = background ? "radio" : "checkbox";
|
|
@@ -481,12 +503,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
481
503
|
fitShape() {
|
|
482
504
|
if (!this.pendingFit) return;
|
|
483
505
|
if (!AdbMapUtils.fitExtentIfReady(this.map, this.source.getExtent(), {
|
|
484
|
-
padding:
|
|
485
|
-
20,
|
|
486
|
-
20,
|
|
487
|
-
20,
|
|
488
|
-
20
|
|
489
|
-
],
|
|
506
|
+
padding: MapConstants.FIT_PADDING,
|
|
490
507
|
maxZoom: 18
|
|
491
508
|
})) return;
|
|
492
509
|
this.pendingFit = false;
|
|
@@ -534,8 +551,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
534
551
|
kind: "pipe",
|
|
535
552
|
type: i1$3.TranslatePipe,
|
|
536
553
|
name: "translate"
|
|
537
|
-
}]
|
|
538
|
-
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
554
|
+
}]
|
|
539
555
|
});
|
|
540
556
|
};
|
|
541
557
|
i0.ɵɵngDeclareClassMetadata({
|
|
@@ -548,7 +564,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
548
564
|
args: [{
|
|
549
565
|
selector: "adb-polygon-drawer",
|
|
550
566
|
standalone: false,
|
|
551
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
552
567
|
providers: [{
|
|
553
568
|
provide: NG_VALUE_ACCESSOR,
|
|
554
569
|
useExisting: forwardRef(() => PolygonDrawerInput),
|
|
@@ -727,7 +742,12 @@ var AdbBffMapDataSource = class AdbBffMapDataSource {
|
|
|
727
742
|
for (const key of Object.keys(params)) if (params[key] == null) delete params[key];
|
|
728
743
|
return this.http.get(request.url, { params }).pipe(map((response) => {
|
|
729
744
|
const geoJson = response?.geoJson;
|
|
730
|
-
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");
|
|
731
751
|
return {
|
|
732
752
|
...geoJson,
|
|
733
753
|
properties: {
|
|
@@ -786,7 +806,7 @@ var MapFeaturePickerComponent = class MapFeaturePickerComponent {
|
|
|
786
806
|
const choices = [];
|
|
787
807
|
const ids = /* @__PURE__ */ new Set();
|
|
788
808
|
for (const feature of this.features()) {
|
|
789
|
-
if (
|
|
809
|
+
if (AdbMapUtils.isCluster(feature.getProperties())) continue;
|
|
790
810
|
for (const item of feature.get("locations")?.items ?? []) {
|
|
791
811
|
if (ids.has(item.locationId)) continue;
|
|
792
812
|
ids.add(item.locationId);
|
|
@@ -888,8 +908,7 @@ var MapFeaturePickerComponent = class MapFeaturePickerComponent {
|
|
|
888
908
|
kind: "pipe",
|
|
889
909
|
type: i1$3.TranslatePipe,
|
|
890
910
|
name: "translate"
|
|
891
|
-
}]
|
|
892
|
-
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
911
|
+
}]
|
|
893
912
|
});
|
|
894
913
|
};
|
|
895
914
|
i0.ɵɵngDeclareClassMetadata({
|
|
@@ -902,7 +921,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
902
921
|
args: [{
|
|
903
922
|
selector: "adb-map-feature-picker",
|
|
904
923
|
host: { class: "adb-map-feature-picker" },
|
|
905
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
906
924
|
standalone: false,
|
|
907
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"
|
|
908
926
|
}]
|
|
@@ -1061,8 +1079,17 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1061
1079
|
activatedRoute;
|
|
1062
1080
|
config;
|
|
1063
1081
|
router;
|
|
1082
|
+
dataSource;
|
|
1064
1083
|
showLegend = input(true, ...ngDevMode ? [{ debugName: "showLegend" }] : /* istanbul ignore next */ []);
|
|
1065
|
-
|
|
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 */ []);
|
|
1066
1093
|
allowPresentationMode = input(false, ...ngDevMode ? [{ debugName: "allowPresentationMode" }] : /* istanbul ignore next */ []);
|
|
1067
1094
|
presentationMode = input("locations", ...ngDevMode ? [{ debugName: "presentationMode" }] : /* istanbul ignore next */ []);
|
|
1068
1095
|
route = signal(null, ...ngDevMode ? [{ debugName: "route" }] : /* istanbul ignore next */ []);
|
|
@@ -1071,7 +1098,6 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1071
1098
|
if (this.allowPresentationMode() && (mode === "locations" || mode === "observations")) return mode;
|
|
1072
1099
|
return this.presentationMode();
|
|
1073
1100
|
}, ...ngDevMode ? [{ debugName: "activePresentationMode" }] : /* istanbul ignore next */ []);
|
|
1074
|
-
dataSource = inject(ADB_MAP_DATA_SOURCE);
|
|
1075
1101
|
requestedParams = "";
|
|
1076
1102
|
settingsOpen = signal(false, ...ngDevMode ? [{ debugName: "settingsOpen" }] : /* istanbul ignore next */ []);
|
|
1077
1103
|
savingSettings = signal(false, ...ngDevMode ? [{ debugName: "savingSettings" }] : /* istanbul ignore next */ []);
|
|
@@ -1102,15 +1128,16 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1102
1128
|
pendingExtent;
|
|
1103
1129
|
mapResult = signal(null, ...ngDevMode ? [{ debugName: "mapResult" }] : /* istanbul ignore next */ []);
|
|
1104
1130
|
cutoffYear = computed(() => this.activePresentationMode() === "observations" ? this.route()?.queryParams["cutoff"] ?? null : null, ...ngDevMode ? [{ debugName: "cutoffYear" }] : /* istanbul ignore next */ []);
|
|
1105
|
-
gridLevels =
|
|
1131
|
+
gridLevels = [];
|
|
1106
1132
|
mapId = "" + Math.floor(Math.random() * Date.now());
|
|
1107
1133
|
map;
|
|
1108
1134
|
mapReady = signal(false, ...ngDevMode ? [{ debugName: "mapReady" }] : /* istanbul ignore next */ []);
|
|
1109
1135
|
queryParams = {};
|
|
1110
|
-
constructor(activatedRoute, config, router) {
|
|
1136
|
+
constructor(activatedRoute, config, router, dataSource) {
|
|
1111
1137
|
this.activatedRoute = activatedRoute;
|
|
1112
1138
|
this.config = config;
|
|
1113
1139
|
this.router = router;
|
|
1140
|
+
this.dataSource = dataSource;
|
|
1114
1141
|
this.route.set(this.activatedRoute.snapshot);
|
|
1115
1142
|
this.settingsForm.controls.presentationMode.valueChanges.pipe(takeUntilDestroyed()).subscribe((mode) => {
|
|
1116
1143
|
const cutoff = this.settingsForm.controls.cutoff;
|
|
@@ -1142,8 +1169,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1142
1169
|
this.map = AdbMapUtils.createMap(this.mapId, {
|
|
1143
1170
|
zoom: true,
|
|
1144
1171
|
scrollZoom: false,
|
|
1145
|
-
providers:
|
|
1172
|
+
providers: false
|
|
1146
1173
|
});
|
|
1174
|
+
this.providerLayers.set(AdbMapUtils.addProviderLayers(this.map));
|
|
1147
1175
|
this.map.addLayer(new VectorLayer({
|
|
1148
1176
|
source: this.uncertaintySource,
|
|
1149
1177
|
style: new Style({ stroke: new Stroke({
|
|
@@ -1165,6 +1193,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1165
1193
|
if (size?.[0] && size[1]) this.mapReady.set(true);
|
|
1166
1194
|
this.attachUserListeners();
|
|
1167
1195
|
}
|
|
1196
|
+
selectBackground(index) {
|
|
1197
|
+
this.providerLayers().backgrounds.forEach((entry, layerIndex) => entry.layer.setVisible(layerIndex === index));
|
|
1198
|
+
}
|
|
1168
1199
|
openSettings() {
|
|
1169
1200
|
this.settingsForm.reset({
|
|
1170
1201
|
presentationMode: this.activePresentationMode(),
|
|
@@ -1253,7 +1284,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1253
1284
|
onFeatureChosen(selection) {
|
|
1254
1285
|
this.closeLocationPicker(selection.restoreFocus);
|
|
1255
1286
|
const { feature, properties: props } = selection;
|
|
1256
|
-
const cluster = props
|
|
1287
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
1257
1288
|
const location = !cluster && !!(props["location"] || props["observationCount"]);
|
|
1258
1289
|
if ((cluster || location) && this.config.enableClusterSelection && selection.selectMode) {
|
|
1259
1290
|
this.selectedFeature = feature;
|
|
@@ -1270,12 +1301,12 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1270
1301
|
let extent = feature.getGeometry().getExtent();
|
|
1271
1302
|
if (cluster) {
|
|
1272
1303
|
const projectedCenter = getCenter(extent);
|
|
1273
|
-
const center = toLonLat(projectedCenter);
|
|
1274
1304
|
const radius = props["cluster"].radiusMeters;
|
|
1275
|
-
extent =
|
|
1305
|
+
extent = AdbMapUtils.createUncertaintyCircle(projectedCenter, radius).getExtent();
|
|
1276
1306
|
const view = this.map.getView();
|
|
1277
1307
|
const size = this.map.getSize();
|
|
1278
|
-
const
|
|
1308
|
+
const [top, right, bottom, left] = MapConstants.FIT_PADDING;
|
|
1309
|
+
const fitSize = [size[0] - left - right, size[1] - top - bottom];
|
|
1279
1310
|
if (view.getResolutionForExtent(extent, fitSize) >= view.getResolution()) extent = getForViewAndSize(projectedCenter, view.getResolution() / 2, 0, fitSize);
|
|
1280
1311
|
}
|
|
1281
1312
|
const bbox = transformExtent(extent, this.map.getView().getProjection(), "EPSG:4326").join(",");
|
|
@@ -1317,6 +1348,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1317
1348
|
return qParams.bbox ? AdbMapUtils.getMetersPerPixel(qParams.bbox, this.map.getSize()?.[0]) : MapConstants.INITIAL_METERS_PER_PIXEL;
|
|
1318
1349
|
}
|
|
1319
1350
|
buildMap(geojson, fitView) {
|
|
1351
|
+
this.gridLevels = AdbMapUtils.gridLevels(geojson);
|
|
1320
1352
|
this.mapResult.set(geojson);
|
|
1321
1353
|
const features = this.format.readFeatures(geojson, { featureProjection: this.map.getView().getProjection() });
|
|
1322
1354
|
this.closeLocationPicker(false);
|
|
@@ -1348,12 +1380,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1348
1380
|
}
|
|
1349
1381
|
fitPendingExtent() {
|
|
1350
1382
|
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1351
|
-
padding:
|
|
1352
|
-
20,
|
|
1353
|
-
20,
|
|
1354
|
-
20,
|
|
1355
|
-
20
|
|
1356
|
-
],
|
|
1383
|
+
padding: MapConstants.FIT_PADDING,
|
|
1357
1384
|
maxZoom: 18
|
|
1358
1385
|
})) return;
|
|
1359
1386
|
this.fittedView = this.viewKey();
|
|
@@ -1368,7 +1395,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1368
1395
|
}),
|
|
1369
1396
|
fill: new Fill({ color: "transparent" })
|
|
1370
1397
|
});
|
|
1371
|
-
const cluster = props
|
|
1398
|
+
const cluster = AdbMapUtils.isCluster(props);
|
|
1372
1399
|
const location = props["locations"] || props["location"];
|
|
1373
1400
|
const point = ["Point", "MultiPoint"].includes(feature.getGeometry()?.getType());
|
|
1374
1401
|
if (cluster || location || point) return this.activePresentationMode() === "observations" ? this.aggregatedSymbol(feature) : this.locationSymbol(feature);
|
|
@@ -1379,7 +1406,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1379
1406
|
}),
|
|
1380
1407
|
fill: new Fill({ color: "rgba(0,118,129,0.1)" })
|
|
1381
1408
|
});
|
|
1382
|
-
return AdbMapUtils.gridSymbol(props["ObservationsCount"], this.gridLevels
|
|
1409
|
+
return AdbMapUtils.gridSymbol(props["ObservationsCount"], this.gridLevels);
|
|
1383
1410
|
}
|
|
1384
1411
|
locationSymbol(feature) {
|
|
1385
1412
|
return AdbMapUtils.locationSymbol(feature, feature === this.selectedFeature, feature === this.hoveredFeature);
|
|
@@ -1400,7 +1427,8 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1400
1427
|
deps: [
|
|
1401
1428
|
{ token: i1.ActivatedRoute },
|
|
1402
1429
|
{ token: AdbMapConfigService },
|
|
1403
|
-
{ token: i1.Router }
|
|
1430
|
+
{ token: i1.Router },
|
|
1431
|
+
{ token: ADB_MAP_DATA_SOURCE }
|
|
1404
1432
|
],
|
|
1405
1433
|
target: i0.ɵɵFactoryTarget.Component
|
|
1406
1434
|
});
|
|
@@ -1418,9 +1446,9 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1418
1446
|
isRequired: false,
|
|
1419
1447
|
transformFunction: null
|
|
1420
1448
|
},
|
|
1421
|
-
|
|
1422
|
-
classPropertyName: "
|
|
1423
|
-
publicName: "
|
|
1449
|
+
headerButtons: {
|
|
1450
|
+
classPropertyName: "headerButtons",
|
|
1451
|
+
publicName: "headerButtons",
|
|
1424
1452
|
isSignal: true,
|
|
1425
1453
|
isRequired: false,
|
|
1426
1454
|
transformFunction: null
|
|
@@ -1445,54 +1473,62 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1445
1473
|
clusterSelected: "clusterSelected"
|
|
1446
1474
|
},
|
|
1447
1475
|
ngImport: i0,
|
|
1448
|
-
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 no-caret\" (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\"\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",
|
|
1449
1477
|
dependencies: [
|
|
1450
1478
|
{
|
|
1451
1479
|
kind: "directive",
|
|
1452
|
-
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,
|
|
1453
1489
|
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
1454
1490
|
},
|
|
1455
1491
|
{
|
|
1456
1492
|
kind: "directive",
|
|
1457
|
-
type:
|
|
1493
|
+
type: i4.NgSelectOption,
|
|
1458
1494
|
selector: "option",
|
|
1459
1495
|
inputs: ["ngValue", "value"]
|
|
1460
1496
|
},
|
|
1461
1497
|
{
|
|
1462
1498
|
kind: "directive",
|
|
1463
|
-
type:
|
|
1499
|
+
type: i4.ɵNgSelectMultipleOption,
|
|
1464
1500
|
selector: "option",
|
|
1465
1501
|
inputs: ["ngValue", "value"]
|
|
1466
1502
|
},
|
|
1467
1503
|
{
|
|
1468
1504
|
kind: "directive",
|
|
1469
|
-
type:
|
|
1505
|
+
type: i4.DefaultValueAccessor,
|
|
1470
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]"
|
|
1471
1507
|
},
|
|
1472
1508
|
{
|
|
1473
1509
|
kind: "directive",
|
|
1474
|
-
type:
|
|
1510
|
+
type: i4.CheckboxControlValueAccessor,
|
|
1475
1511
|
selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]"
|
|
1476
1512
|
},
|
|
1477
1513
|
{
|
|
1478
1514
|
kind: "directive",
|
|
1479
|
-
type:
|
|
1515
|
+
type: i4.SelectControlValueAccessor,
|
|
1480
1516
|
selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]",
|
|
1481
1517
|
inputs: ["compareWith"]
|
|
1482
1518
|
},
|
|
1483
1519
|
{
|
|
1484
1520
|
kind: "directive",
|
|
1485
|
-
type:
|
|
1521
|
+
type: i4.NgControlStatus,
|
|
1486
1522
|
selector: "[formControlName],[ngModel],[formControl]"
|
|
1487
1523
|
},
|
|
1488
1524
|
{
|
|
1489
1525
|
kind: "directive",
|
|
1490
|
-
type:
|
|
1526
|
+
type: i4.NgControlStatusGroup,
|
|
1491
1527
|
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
1492
1528
|
},
|
|
1493
1529
|
{
|
|
1494
1530
|
kind: "directive",
|
|
1495
|
-
type:
|
|
1531
|
+
type: i4.FormGroupDirective,
|
|
1496
1532
|
selector: "[formGroup]",
|
|
1497
1533
|
inputs: ["formGroup"],
|
|
1498
1534
|
outputs: ["ngSubmit"],
|
|
@@ -1500,7 +1536,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1500
1536
|
},
|
|
1501
1537
|
{
|
|
1502
1538
|
kind: "directive",
|
|
1503
|
-
type:
|
|
1539
|
+
type: i4.FormControlName,
|
|
1504
1540
|
selector: "[formControlName]",
|
|
1505
1541
|
inputs: [
|
|
1506
1542
|
"formControlName",
|
|
@@ -1552,13 +1588,20 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1552
1588
|
selector: "adb-map",
|
|
1553
1589
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
1554
1590
|
standalone: false,
|
|
1555
|
-
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 no-caret\" (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\"\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"
|
|
1556
1592
|
}]
|
|
1557
1593
|
}],
|
|
1558
1594
|
ctorParameters: () => [
|
|
1559
1595
|
{ type: i1.ActivatedRoute },
|
|
1560
1596
|
{ type: AdbMapConfigService },
|
|
1561
|
-
{ 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
|
+
}
|
|
1562
1605
|
],
|
|
1563
1606
|
propDecorators: {
|
|
1564
1607
|
showLegend: [{
|
|
@@ -1569,11 +1612,11 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1569
1612
|
required: false
|
|
1570
1613
|
}]
|
|
1571
1614
|
}],
|
|
1572
|
-
|
|
1615
|
+
headerButtons: [{
|
|
1573
1616
|
type: i0.Input,
|
|
1574
1617
|
args: [{
|
|
1575
1618
|
isSignal: true,
|
|
1576
|
-
alias: "
|
|
1619
|
+
alias: "headerButtons",
|
|
1577
1620
|
required: false
|
|
1578
1621
|
}]
|
|
1579
1622
|
}],
|
|
@@ -1675,12 +1718,7 @@ var AdbLocationMapComponent = class AdbLocationMapComponent {
|
|
|
1675
1718
|
}
|
|
1676
1719
|
fitPendingExtent() {
|
|
1677
1720
|
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1678
|
-
padding:
|
|
1679
|
-
20,
|
|
1680
|
-
20,
|
|
1681
|
-
20,
|
|
1682
|
-
20
|
|
1683
|
-
],
|
|
1721
|
+
padding: MapConstants.FIT_PADDING,
|
|
1684
1722
|
maxZoom: 18
|
|
1685
1723
|
})) return;
|
|
1686
1724
|
this.pendingExtent = null;
|
|
@@ -1745,12 +1783,15 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1745
1783
|
http;
|
|
1746
1784
|
router;
|
|
1747
1785
|
activatedRoute;
|
|
1786
|
+
static nextLocationInputId = 0;
|
|
1787
|
+
locationInputId = `map-filter-location-${AdbMapFilters.nextLocationInputId++}`;
|
|
1748
1788
|
inline = false;
|
|
1749
1789
|
hiddenFilters = input([], ...ngDevMode ? [{ debugName: "hiddenFilters" }] : /* istanbul ignore next */ []);
|
|
1750
1790
|
visibleFilters = computed(() => ({
|
|
1751
1791
|
taxon: !this.hiddenFilters().includes("taxon"),
|
|
1752
1792
|
time: !this.hiddenFilters().includes("time"),
|
|
1753
1793
|
area: !this.hiddenFilters().includes("area"),
|
|
1794
|
+
location: !this.hiddenFilters().includes("location"),
|
|
1754
1795
|
ownArea: !this.hiddenFilters().includes("ownArea"),
|
|
1755
1796
|
taxaLists: !this.hiddenFilters().includes("taxonLists"),
|
|
1756
1797
|
datasources: !this.hiddenFilters().includes("datasources")
|
|
@@ -1860,7 +1901,8 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1860
1901
|
params.ds = selected.length ? selected : null;
|
|
1861
1902
|
}
|
|
1862
1903
|
const locationIds = this.activatedRoute.snapshot.queryParamMap.getAll("locationId");
|
|
1863
|
-
if (
|
|
1904
|
+
if (this.visibleFilters().location && this.form.get("locationId").dirty) params.locationId = data.locationId;
|
|
1905
|
+
else if (locationIds.length) params.locationId = locationIds;
|
|
1864
1906
|
this.router.navigate([], {
|
|
1865
1907
|
queryParams: params,
|
|
1866
1908
|
relativeTo: this.activatedRoute
|
|
@@ -1872,6 +1914,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1872
1914
|
const areas = qMap.getAll("area").filter((a) => a != null && a.trim() !== "" && a.includes("-"));
|
|
1873
1915
|
const form = new FormGroup({
|
|
1874
1916
|
period: new FormControl(qMap.has("p") ? qMap.get("p") : "3"),
|
|
1917
|
+
locationId: new FormControl(qMap.get("locationId")),
|
|
1875
1918
|
areas: new FormArray((Array.isArray(areas) && areas.length ? areas : [null]).map((a) => new FormControl(a))),
|
|
1876
1919
|
geo: new FormControl(qMap.has("geo") ? {
|
|
1877
1920
|
type: "Feature",
|
|
@@ -1883,7 +1926,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1883
1926
|
});
|
|
1884
1927
|
this.areasArray = form.get("areas");
|
|
1885
1928
|
this.periodCount = qMap.has("p") && qMap.get("p") !== "3" ? 1 : 0;
|
|
1886
|
-
this.areaCount = areas.length + (this.hasOwnArea ? 1 : 0);
|
|
1929
|
+
this.areaCount = areas.length + (this.hasOwnArea ? 1 : 0) + (this.visibleFilters().location ? qMap.getAll("locationId").length : 0);
|
|
1887
1930
|
if (!this.hasTaxonInUrlParameter) {
|
|
1888
1931
|
form.addControl("taxonId", new FormControl(qMap.get("taxonId") ?? null));
|
|
1889
1932
|
const selectedTaxonList = qMap.has("list") ? qMap.getAll("list").map((val) => Number(val)).filter((val) => !isNaN(val)) : null;
|
|
@@ -1975,49 +2018,49 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1975
2018
|
}
|
|
1976
2019
|
},
|
|
1977
2020
|
ngImport: i0,
|
|
1978
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"
|
|
2021
|
+
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 || visibleFilters().location){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().area){\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 }\n @if(visibleFilters().location){\n <div class=\"mb-2\">\n <label [for]=\"locationInputId\">{{'MAP.LEGEND.LOCATION'|translate}}</label>\n <adb-location-picker [inputId]=\"locationInputId\" formControlName=\"locationId\" />\n </div>\n }\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",
|
|
1979
2022
|
dependencies: [
|
|
1980
2023
|
{
|
|
1981
2024
|
kind: "directive",
|
|
1982
|
-
type:
|
|
2025
|
+
type: i4.ɵNgNoValidate,
|
|
1983
2026
|
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
1984
2027
|
},
|
|
1985
2028
|
{
|
|
1986
2029
|
kind: "directive",
|
|
1987
|
-
type:
|
|
2030
|
+
type: i4.NgSelectOption,
|
|
1988
2031
|
selector: "option",
|
|
1989
2032
|
inputs: ["ngValue", "value"]
|
|
1990
2033
|
},
|
|
1991
2034
|
{
|
|
1992
2035
|
kind: "directive",
|
|
1993
|
-
type:
|
|
2036
|
+
type: i4.ɵNgSelectMultipleOption,
|
|
1994
2037
|
selector: "option",
|
|
1995
2038
|
inputs: ["ngValue", "value"]
|
|
1996
2039
|
},
|
|
1997
2040
|
{
|
|
1998
2041
|
kind: "directive",
|
|
1999
|
-
type:
|
|
2042
|
+
type: i4.DefaultValueAccessor,
|
|
2000
2043
|
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]"
|
|
2001
2044
|
},
|
|
2002
2045
|
{
|
|
2003
2046
|
kind: "directive",
|
|
2004
|
-
type:
|
|
2047
|
+
type: i4.CheckboxControlValueAccessor,
|
|
2005
2048
|
selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]"
|
|
2006
2049
|
},
|
|
2007
2050
|
{
|
|
2008
2051
|
kind: "directive",
|
|
2009
|
-
type:
|
|
2052
|
+
type: i4.SelectControlValueAccessor,
|
|
2010
2053
|
selector: "select:not([multiple]):not([ngNoCva])[formControlName],select:not([multiple]):not([ngNoCva])[formControl],select:not([multiple]):not([ngNoCva])[ngModel]",
|
|
2011
2054
|
inputs: ["compareWith"]
|
|
2012
2055
|
},
|
|
2013
2056
|
{
|
|
2014
2057
|
kind: "directive",
|
|
2015
|
-
type:
|
|
2058
|
+
type: i4.NgControlStatus,
|
|
2016
2059
|
selector: "[formControlName],[ngModel],[formControl]"
|
|
2017
2060
|
},
|
|
2018
2061
|
{
|
|
2019
2062
|
kind: "directive",
|
|
2020
|
-
type:
|
|
2063
|
+
type: i4.NgControlStatusGroup,
|
|
2021
2064
|
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
2022
2065
|
},
|
|
2023
2066
|
{
|
|
@@ -2041,7 +2084,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2041
2084
|
},
|
|
2042
2085
|
{
|
|
2043
2086
|
kind: "directive",
|
|
2044
|
-
type:
|
|
2087
|
+
type: i4.FormGroupDirective,
|
|
2045
2088
|
selector: "[formGroup]",
|
|
2046
2089
|
inputs: ["formGroup"],
|
|
2047
2090
|
outputs: ["ngSubmit"],
|
|
@@ -2049,7 +2092,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2049
2092
|
},
|
|
2050
2093
|
{
|
|
2051
2094
|
kind: "directive",
|
|
2052
|
-
type:
|
|
2095
|
+
type: i4.FormControlName,
|
|
2053
2096
|
selector: "[formControlName]",
|
|
2054
2097
|
inputs: [
|
|
2055
2098
|
"formControlName",
|
|
@@ -2060,13 +2103,13 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2060
2103
|
},
|
|
2061
2104
|
{
|
|
2062
2105
|
kind: "directive",
|
|
2063
|
-
type:
|
|
2106
|
+
type: i4.FormGroupName,
|
|
2064
2107
|
selector: "[formGroupName]",
|
|
2065
2108
|
inputs: ["formGroupName"]
|
|
2066
2109
|
},
|
|
2067
2110
|
{
|
|
2068
2111
|
kind: "directive",
|
|
2069
|
-
type:
|
|
2112
|
+
type: i4.FormArrayName,
|
|
2070
2113
|
selector: "[formArrayName]",
|
|
2071
2114
|
inputs: ["formArrayName"]
|
|
2072
2115
|
},
|
|
@@ -2104,6 +2147,12 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
2104
2147
|
"prefill"
|
|
2105
2148
|
]
|
|
2106
2149
|
},
|
|
2150
|
+
{
|
|
2151
|
+
kind: "component",
|
|
2152
|
+
type: i1$1.AdbLocationPickerComponent,
|
|
2153
|
+
selector: "adb-location-picker",
|
|
2154
|
+
inputs: ["placeholder", "inputId"]
|
|
2155
|
+
},
|
|
2107
2156
|
{
|
|
2108
2157
|
kind: "component",
|
|
2109
2158
|
type: i1$1.AdbTaxonPickerComponent,
|
|
@@ -2150,7 +2199,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2150
2199
|
selector: "adb-map-filters",
|
|
2151
2200
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
2152
2201
|
standalone: false,
|
|
2153
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"
|
|
2202
|
+
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 || visibleFilters().location){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().area){\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 }\n @if(visibleFilters().location){\n <div class=\"mb-2\">\n <label [for]=\"locationInputId\">{{'MAP.LEGEND.LOCATION'|translate}}</label>\n <adb-location-picker [inputId]=\"locationInputId\" formControlName=\"locationId\" />\n </div>\n }\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"
|
|
2154
2203
|
}]
|
|
2155
2204
|
}],
|
|
2156
2205
|
ctorParameters: () => [
|
|
@@ -2208,6 +2257,7 @@ var AdbMapModule = class AdbMapModule {
|
|
|
2208
2257
|
CommonModule,
|
|
2209
2258
|
AdbButtonsModule,
|
|
2210
2259
|
AdbDirectivesModule,
|
|
2260
|
+
AdbDropdownModule,
|
|
2211
2261
|
FormsModule,
|
|
2212
2262
|
RouterModule,
|
|
2213
2263
|
ReactiveFormsModule,
|
|
@@ -2234,6 +2284,7 @@ var AdbMapModule = class AdbMapModule {
|
|
|
2234
2284
|
CommonModule,
|
|
2235
2285
|
AdbButtonsModule,
|
|
2236
2286
|
AdbDirectivesModule,
|
|
2287
|
+
AdbDropdownModule,
|
|
2237
2288
|
FormsModule,
|
|
2238
2289
|
RouterModule,
|
|
2239
2290
|
ReactiveFormsModule,
|
|
@@ -2256,6 +2307,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2256
2307
|
CommonModule,
|
|
2257
2308
|
AdbButtonsModule,
|
|
2258
2309
|
AdbDirectivesModule,
|
|
2310
|
+
AdbDropdownModule,
|
|
2259
2311
|
FormsModule,
|
|
2260
2312
|
RouterModule,
|
|
2261
2313
|
ReactiveFormsModule,
|