@provoly/dashboard 0.20.0 → 0.20.2
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/esm2022/lib/core/components/about/about.component.mjs +8 -5
- package/esm2022/lib/core/store/search/search.actions.mjs +2 -2
- package/esm2022/lib/core/store/search/search.service.mjs +2 -2
- package/esm2022/lib/dashboard/action-bus/service/bus.service.mjs +2 -2
- package/esm2022/lib/dashboard/components/dashboard.component.mjs +4 -1
- package/esm2022/lib/dashboard/components/widgets/header/widget-header.component.mjs +2 -5
- package/esm2022/lib/dashboard/store/dashboard.actions.mjs +2 -2
- package/esm2022/lib/dashboard/store/proxy.utils.mjs +4 -24
- package/esm2022/presentation/components/presentation.component.mjs +4 -5
- package/esm2022/restitution/components/restitution/restitution.component.mjs +5 -5
- package/esm2022/restitution/components/restitution-catalog/restitution-catalog.component.mjs +3 -3
- package/esm2022/restitution/i18n/en.translations.mjs +2 -2
- package/esm2022/restitution/i18n/fr.translations.mjs +2 -2
- package/esm2022/widgets/widget-aggregated-chart/component/widget-aggregated-chart.component.mjs +10 -3
- package/esm2022/widgets/widget-map/component/widget-map.component.mjs +40 -28
- package/esm2022/widgets/widget-map/utils/widget-map.utils.mjs +8 -25
- package/fesm2022/provoly-dashboard-presentation.mjs +3 -4
- package/fesm2022/provoly-dashboard-presentation.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-restitution.mjs +8 -8
- package/fesm2022/provoly-dashboard-restitution.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs +9 -2
- package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs.map +1 -1
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +46 -51
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
- package/fesm2022/provoly-dashboard.mjs +17 -34
- package/fesm2022/provoly-dashboard.mjs.map +1 -1
- package/lib/core/components/about/about.component.d.ts +2 -1
- package/lib/core/store/search/search.actions.d.ts +2 -2
- package/lib/dashboard/store/dashboard.actions.d.ts +2 -2
- package/lib/dashboard/store/dashboard.effects.d.ts +3 -3
- package/lib/dashboard/store/proxy.utils.d.ts +1 -1
- package/package.json +12 -12
- package/styles/components/_o-about.scss +44 -6
- package/styles/components/_o-widget.scss +1 -0
- package/widgets/widget-aggregated-chart/component/widget-aggregated-chart.component.d.ts +1 -0
- package/widgets/widget-map/component/widget-map.component.d.ts +4 -2
- package/widgets/widget-map/utils/widget-map.utils.d.ts +2 -2
|
@@ -17,7 +17,7 @@ import { toLonLat, get, transform, fromLonLat } from 'ol/proj';
|
|
|
17
17
|
import { register } from 'ol/proj/proj4';
|
|
18
18
|
import { Vector, TileWMS, WMTS, XYZ, Cluster, DataTile } from 'ol/source';
|
|
19
19
|
import proj4 from 'proj4';
|
|
20
|
-
import { BehaviorSubject, map, combineLatest, filter, distinctUntilChanged, startWith, debounceTime, delay, mergeMap, of, from, switchMap } from 'rxjs';
|
|
20
|
+
import { BehaviorSubject, map, combineLatest, filter, distinctUntilChanged, startWith, debounceTime, delay, mergeMap, of, from, switchMap, catchError } from 'rxjs';
|
|
21
21
|
import { ScaleLine, Attribution, defaults } from 'ol/control';
|
|
22
22
|
import { Polygon, Circle as Circle$1, LineString } from 'ol/geom';
|
|
23
23
|
import PointerInteraction from 'ol/interaction/Pointer';
|
|
@@ -1044,6 +1044,10 @@ class WidgetMapUtils {
|
|
|
1044
1044
|
if (value.type === 'MULTI') {
|
|
1045
1045
|
value = value.values[0];
|
|
1046
1046
|
}
|
|
1047
|
+
if (!value.visible) {
|
|
1048
|
+
console.warn(`Geometry not visible for item ${item.id}`);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1047
1051
|
let geometry;
|
|
1048
1052
|
try {
|
|
1049
1053
|
geometry = new GeoJSON().readGeometry(value.value, {
|
|
@@ -1055,29 +1059,6 @@ class WidgetMapUtils {
|
|
|
1055
1059
|
}
|
|
1056
1060
|
return geometry;
|
|
1057
1061
|
}
|
|
1058
|
-
static extractGeometries(value, points, type) {
|
|
1059
|
-
const valueSimple = value.value;
|
|
1060
|
-
if (typeof valueSimple !== 'string' && typeof valueSimple !== 'number') {
|
|
1061
|
-
if (type === 'point' && valueSimple.type === FieldType.POINT) {
|
|
1062
|
-
points.push(valueSimple.coordinates);
|
|
1063
|
-
}
|
|
1064
|
-
if (type === 'point' && valueSimple.type === FieldType.MULTIPOINT) {
|
|
1065
|
-
points.push(...valueSimple.coordinates);
|
|
1066
|
-
}
|
|
1067
|
-
if (type === 'line' && valueSimple.type === FieldType.LINE) {
|
|
1068
|
-
points.push(valueSimple.coordinates);
|
|
1069
|
-
}
|
|
1070
|
-
if (type === 'line' && valueSimple.type === FieldType.MULTILINE) {
|
|
1071
|
-
points.push(...valueSimple.coordinates);
|
|
1072
|
-
}
|
|
1073
|
-
if (type === 'polygon' && valueSimple.type === FieldType.POLYGON) {
|
|
1074
|
-
points.push(valueSimple.coordinates);
|
|
1075
|
-
}
|
|
1076
|
-
if (type === 'polygon' && valueSimple.type === FieldType.MULTIPOLYGON) {
|
|
1077
|
-
points.push(...valueSimple.coordinates);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
1062
|
static projectExtentAggregationResponse(field, extentResponse, layer, wmsCapabilities, map) {
|
|
1082
1063
|
const projBox = get(field.crs ?? DEFAULT_PROJECTION);
|
|
1083
1064
|
const response = extentResponse.values;
|
|
@@ -1092,6 +1073,7 @@ class WidgetMapUtils {
|
|
|
1092
1073
|
response[0].value.bottom_right.lon !== undefined) {
|
|
1093
1074
|
return {
|
|
1094
1075
|
datasource: layer.datasourceId,
|
|
1076
|
+
error: false,
|
|
1095
1077
|
extent: [
|
|
1096
1078
|
transform([
|
|
1097
1079
|
parseFloat(extentResponse.values[0].value.top_left.lon),
|
|
@@ -1106,7 +1088,8 @@ class WidgetMapUtils {
|
|
|
1106
1088
|
}
|
|
1107
1089
|
return {
|
|
1108
1090
|
datasource: layer.datasourceId,
|
|
1109
|
-
extent: XMLUtils.getLayerExtent(layer.paramLayer, map, wmsCapabilities[layer.url]?.doc) ?? []
|
|
1091
|
+
extent: XMLUtils.getLayerExtent(layer.paramLayer, map, wmsCapabilities[layer.url]?.doc) ?? [],
|
|
1092
|
+
error: false
|
|
1110
1093
|
};
|
|
1111
1094
|
}
|
|
1112
1095
|
static { this.DEFAULT_HEATMAP_RADIUS = 25; }
|
|
@@ -1580,7 +1563,10 @@ class WidgetMapComponent extends DataWidgetComponent {
|
|
|
1580
1563
|
new MapboxVectorLayer({
|
|
1581
1564
|
properties: { title: 'background' },
|
|
1582
1565
|
styleUrl
|
|
1583
|
-
})
|
|
1566
|
+
}) /* ,
|
|
1567
|
+
new TileLayer({
|
|
1568
|
+
source: new TileDebug()
|
|
1569
|
+
}) */
|
|
1584
1570
|
];
|
|
1585
1571
|
}));
|
|
1586
1572
|
this.options$
|
|
@@ -1717,17 +1703,19 @@ class WidgetMapComponent extends DataWidgetComponent {
|
|
|
1717
1703
|
.aggregate([layer.datasourceId], {
|
|
1718
1704
|
ordinate: { operation: Operation.EXTENT, attribute: attr.id, label: attr.name, keep0: false }
|
|
1719
1705
|
})
|
|
1720
|
-
.pipe(map((extentResponse) => {
|
|
1721
|
-
return WidgetMapUtils.projectExtentAggregationResponse(field, extentResponse, layer, wmsCapabilities, this.map);
|
|
1722
|
-
})))
|
|
1706
|
+
.pipe(map((extentResponse) => WidgetMapUtils.projectExtentAggregationResponse(field, extentResponse, layer, wmsCapabilities, this.map)), catchError(() => of({ datasource: layer.datasourceId, extent: [], error: true }))))
|
|
1723
1707
|
.flat())
|
|
1724
1708
|
.flat(),
|
|
1725
1709
|
...(options.layers?.filter((layer) => layer.type === 'wms') ?? [])
|
|
1726
1710
|
.filter((layer) => layer.fit)
|
|
1727
|
-
.map((layer) =>
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1711
|
+
.map((layer) => {
|
|
1712
|
+
const extent = XMLUtils.getLayerExtent(layer.paramLayer, this.map, wmsCapabilities[layer.url]?.doc);
|
|
1713
|
+
return of({
|
|
1714
|
+
datasource: `wms-${layer.paramLayer}`,
|
|
1715
|
+
extent: extent ?? [],
|
|
1716
|
+
error: !extent
|
|
1717
|
+
});
|
|
1718
|
+
})
|
|
1731
1719
|
])
|
|
1732
1720
|
: of([])), startWith([]));
|
|
1733
1721
|
this.legendLayers$ = this.options$.pipe(map((options) => (options.layers ?? []).filter((layer) => ['geoserver', 'wms'].includes(layer.type))), delay(10));
|
|
@@ -1744,26 +1732,33 @@ class WidgetMapComponent extends DataWidgetComponent {
|
|
|
1744
1732
|
this.fitExtents$,
|
|
1745
1733
|
this.datasourceFilters$
|
|
1746
1734
|
]).subscribe(([mapStyleLayer, layers, selectedIds, extents, filters]) => {
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
.getAllLayers()
|
|
1751
|
-
.filter((layer) => !(layer instanceof Tile))
|
|
1752
|
-
.forEach((layer) => {
|
|
1753
|
-
const getFeatures = layer.getSource()?.getFeatures;
|
|
1754
|
-
if (typeof getFeatures === 'function') {
|
|
1755
|
-
layer.getSource()?.getFeatures().forEach((feature) => {
|
|
1756
|
-
const type = feature.get('type');
|
|
1757
|
-
if (['bubble', 'marker', 'point', 'line', 'polygon', 'multi-line', 'multi-polygon'].includes(type)) {
|
|
1758
|
-
feature.setStyle(feature.get(selectedIds.includes(feature.get('id')) ? 'selectedStyle' : 'classicStyle'));
|
|
1759
|
-
}
|
|
1760
|
-
});
|
|
1761
|
-
}
|
|
1762
|
-
});
|
|
1763
|
-
setTimeout(() => {
|
|
1735
|
+
const neededCalculatedExtents = layers.filter((layer) => ['geoserver', 'wms'].includes(layer.get('type')) && layer.get('fit')).length;
|
|
1736
|
+
const nbCalculatedExtents = extents.filter((extent) => !extent.error).length;
|
|
1737
|
+
if (nbCalculatedExtents >= neededCalculatedExtents) {
|
|
1764
1738
|
this.fitMapForObjects(selectedIds, extents, filters);
|
|
1765
1739
|
this.map.updateSize();
|
|
1766
|
-
|
|
1740
|
+
setTimeout(() => {
|
|
1741
|
+
const toApplyLayers = [...layers, ...mapStyleLayer];
|
|
1742
|
+
this.map.setLayers(toApplyLayers);
|
|
1743
|
+
this.map
|
|
1744
|
+
.getAllLayers()
|
|
1745
|
+
.filter((layer) => !(layer instanceof Tile))
|
|
1746
|
+
.forEach((layer) => {
|
|
1747
|
+
const getFeatures = layer.getSource()?.getFeatures;
|
|
1748
|
+
if (typeof getFeatures === 'function') {
|
|
1749
|
+
layer.getSource()?.getFeatures().forEach((feature) => {
|
|
1750
|
+
const type = feature.get('type');
|
|
1751
|
+
if (['bubble', 'marker', 'point', 'line', 'polygon', 'multi-line', 'multi-polygon'].includes(type)) {
|
|
1752
|
+
feature.setStyle(feature.get(selectedIds.includes(feature.get('id')) ? 'selectedStyle' : 'classicStyle'));
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
}, 100);
|
|
1758
|
+
}
|
|
1759
|
+
else {
|
|
1760
|
+
this.map.setLayers([...mapStyleLayer]);
|
|
1761
|
+
}
|
|
1767
1762
|
}));
|
|
1768
1763
|
this.subscriptions.add(combineLatest([this.wmsFeatures$, this.classicFeatures$, this.widgetSize$, this.displayHeader$]).subscribe(([wmsFeatures, classicFeatures, size, header]) => {
|
|
1769
1764
|
if (this.map) {
|