Commit 359723b05cec15a0daac9b2e66507eeef851dc1b
Committed by
GitHub
Merge pull request #2765 from vvlladd28/bug/3.0/map/minor-fix
[3.0] Minor improvement for the map widgets
Showing
3 changed files
with
11 additions
and
11 deletions
@@ -20,12 +20,12 @@ import 'leaflet-providers'; | @@ -20,12 +20,12 @@ import 'leaflet-providers'; | ||
20 | import 'leaflet.markercluster/dist/leaflet.markercluster'; | 20 | import 'leaflet.markercluster/dist/leaflet.markercluster'; |
21 | 21 | ||
22 | import { | 22 | import { |
23 | - FormattedData, | ||
24 | - MapSettings, | ||
25 | - MarkerSettings, | ||
26 | - PolygonSettings, | ||
27 | - PolylineSettings, | ||
28 | - UnitedMapSettings | 23 | + FormattedData, |
24 | + MapSettings, | ||
25 | + MarkerSettings, | ||
26 | + PolygonSettings, | ||
27 | + PolylineSettings, | ||
28 | + UnitedMapSettings | ||
29 | } from './map-models'; | 29 | } from './map-models'; |
30 | import { Marker } from './markers'; | 30 | import { Marker } from './markers'; |
31 | import { BehaviorSubject, Observable } from 'rxjs'; | 31 | import { BehaviorSubject, Observable } from 'rxjs'; |
@@ -405,8 +405,8 @@ export default abstract class LeafletMap { | @@ -405,8 +405,8 @@ export default abstract class LeafletMap { | ||
405 | 405 | ||
406 | updatePolygon(polyData: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { | 406 | updatePolygon(polyData: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { |
407 | this.ready$.subscribe(() => { | 407 | this.ready$.subscribe(() => { |
408 | - const poly = this.polygons.get(polyData.datasource.entityName); | ||
409 | - poly.updatePolygon(polyData.data, dataSources, settings); | 408 | + const poly = this.polygons.get(polyData.$datasource.entityName); |
409 | + poly.updatePolygon(polyData, dataSources, settings); | ||
410 | }); | 410 | }); |
411 | } | 411 | } |
412 | } | 412 | } |
@@ -152,7 +152,7 @@ function parseTemplate(template: string, data: { $datasource?: Datasource, [key: | @@ -152,7 +152,7 @@ function parseTemplate(template: string, data: { $datasource?: Datasource, [key: | ||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | - const value = data[label]; | 155 | + const value = data[label] || ''; |
156 | let textValue: string; | 156 | let textValue: string; |
157 | if (isNumber(value)) { | 157 | if (isNumber(value)) { |
158 | textValue = padValue(value, valDec); | 158 | textValue = padValue(value, valDec); |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | /// limitations under the License. | 14 | /// limitations under the License. |
15 | /// | 15 | /// |
16 | 16 | ||
17 | -import L, { LatLngExpression, LatLngTuple, LeafletMouseEvent } from 'leaflet'; | 17 | +import L, { LatLngExpression, LeafletMouseEvent } from 'leaflet'; |
18 | import { createTooltip, parseWithTranslation, safeExecute } from './maps-utils'; | 18 | import { createTooltip, parseWithTranslation, safeExecute } from './maps-utils'; |
19 | import { FormattedData, PolygonSettings } from './map-models'; | 19 | import { FormattedData, PolygonSettings } from './map-models'; |
20 | 20 | ||
@@ -61,7 +61,7 @@ export class Polygon { | @@ -61,7 +61,7 @@ export class Polygon { | ||
61 | this.tooltip.setContent(parseWithTranslation.parseTemplate(pattern, data, true)); | 61 | this.tooltip.setContent(parseWithTranslation.parseTemplate(pattern, data, true)); |
62 | } | 62 | } |
63 | 63 | ||
64 | - updatePolygon(data: LatLngTuple[], dataSources: FormattedData[], settings: PolygonSettings) { | 64 | + updatePolygon(data: FormattedData, dataSources: FormattedData[], settings: PolygonSettings) { |
65 | this.data = data; | 65 | this.data = data; |
66 | this.dataSources = dataSources; | 66 | this.dataSources = dataSources; |
67 | this.leafletPoly.setLatLngs(data[this.settings.polygonKeyName]); | 67 | this.leafletPoly.setLatLngs(data[this.settings.polygonKeyName]); |