From fdda9ffdb4ae0dcc245e1ec9a17da7239931f5fc Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 4 Oct 2024 16:42:15 +0300 Subject: [PATCH] UI: Updated leaflet to 1.9.12 --- ui-ngx/package.json | 8 +-- .../widget/lib/maps/common-maps-utils.ts | 7 +-- .../components/widget/lib/maps/leaflet-map.ts | 50 ++++++++-------- .../components/widget/lib/maps/map-models.ts | 2 +- .../widget/lib/maps/map-widget.interface.ts | 6 +- .../components/widget/lib/maps/map-widget2.ts | 4 +- .../components/widget/lib/maps/maps-utils.ts | 4 +- .../components/widget/lib/maps/markers.ts | 18 +++--- .../widget/lib/maps/providers/google-map.ts | 12 ++-- .../widget/lib/maps/providers/here-map.ts | 2 +- .../widget/lib/maps/providers/image-map.ts | 22 ++++--- .../lib/maps/providers/openstreet-map.ts | 6 +- .../widget/lib/maps/providers/tencent-map.ts | 6 +- ui-ngx/yarn.lock | 59 +++++++++---------- 14 files changed, 103 insertions(+), 103 deletions(-) diff --git a/ui-ngx/package.json b/ui-ngx/package.json index f6996671a5..5f67ac948f 100644 --- a/ui-ngx/package.json +++ b/ui-ngx/package.json @@ -30,7 +30,7 @@ "@flowjs/flow.js": "^2.14.1", "@flowjs/ngx-flow": "~0.8.1", "@fortawesome/fontawesome-svg-core": "^6.6.0", - "@geoman-io/leaflet-geoman-free": "2.14.2", + "@geoman-io/leaflet-geoman-free": "2.17.0", "@iplab/ngx-color-picker": "^18.0.1", "@mat-datetimepicker/core": "~14.0.0", "@mdi/svg": "^7.4.47", @@ -68,9 +68,9 @@ "jstree": "^3.3.17", "jstree-bootstrap-theme": "^1.0.1", "jszip": "^3.10.1", - "leaflet": "1.8.0", + "leaflet": "1.9.4", "leaflet-polylinedecorator": "1.6.0", - "leaflet-providers": "1.13.0", + "leaflet-providers": "2.0.0", "leaflet.gridlayer.googlemutant": "0.14.1", "leaflet.markercluster": "1.5.3", "libphonenumber-js": "^1.11.10", @@ -131,7 +131,7 @@ "@types/flowjs": "^2.13.14", "@types/jquery": "^3.5.31", "@types/js-beautify": "^1.14.3", - "@types/leaflet": "1.8.0", + "@types/leaflet": "1.9.12", "@types/leaflet-polylinedecorator": "1.6.4", "@types/leaflet-providers": "1.2.4", "@types/leaflet.gridlayer.googlemutant": "0.4.9", diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts index 01797502c7..25f7b1ceec 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts @@ -14,7 +14,6 @@ /// limitations under the License. /// -import { MapProviders } from '@home/components/widget/lib/maps/map-models'; import { createLabelFromDatasource, hashCode, @@ -58,7 +57,7 @@ export function findAngle(startPoint: FormattedData, endPoint: FormattedData, la } -export function getDefCenterPosition(position): [number, number] { +export function getDefCenterPosition(position: string | [number, number]): [number, number] { if (typeof (position) === 'string') { const parts = position.split(','); if (parts.length === 2) { @@ -258,8 +257,8 @@ export const parseWithTranslation = { } }; -export function functionValueCalculator(useFunction: boolean, func: (...args: any[]) => any, params = [], defaultValue: any) { - let res; +export function functionValueCalculator(useFunction: boolean, func: (...args: any[]) => any, params = [], defaultValue: T): T { + let res: T; if (useFunction && isDefined(func) && isFunction(func)) { try { res = func(...params); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts index 5540c1351a..29b2768e58 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts @@ -14,10 +14,10 @@ /// limitations under the License. /// -import L, { FeatureGroup, LatLngBounds, LatLngTuple, Projection } from 'leaflet'; +import L, { FeatureGroup, LatLngBounds, LatLngTuple, PointExpression, Projection } from 'leaflet'; import tinycolor from 'tinycolor2'; import 'leaflet-providers'; -import { MarkerClusterGroup, MarkerClusterGroupOptions } from 'leaflet.markercluster/dist/leaflet.markercluster'; +import 'leaflet.markercluster'; import '@geoman-io/leaflet-geoman-free'; import { @@ -41,7 +41,8 @@ import { entitiesParseName, isCutPolygon, isJSON, - isValidLatLng + isValidLatLng, + LabelSettings } from '@home/components/widget/lib/maps/maps-utils'; import { checkLngLat, createLoadingDiv } from '@home/components/widget/lib/maps/common-maps-utils'; import { WidgetContext } from '@home/models/widget-component.models'; @@ -76,7 +77,7 @@ export default abstract class LeafletMap { options: WidgetUnitedMapSettings; bounds: L.LatLngBounds; datasources: FormattedData[]; - markersCluster: MarkerClusterGroup; + markersCluster: L.MarkerClusterGroup; points: FeatureGroup; markersData: FormattedData[] = []; polygonsData: FormattedData[] = []; @@ -99,9 +100,7 @@ export default abstract class LeafletMap { selectedEntity: FormattedData; ignoreUpdateBounds = false; initDragModeIgnoreUpdateBoundsSet = false; - // eslint-disable-next-line @typescript-eslint/dot-notation southWest = new L.LatLng(-Projection.SphericalMercator['MAX_LATITUDE'], -180); - // eslint-disable-next-line @typescript-eslint/dot-notation northEast = new L.LatLng(Projection.SphericalMercator['MAX_LATITUDE'], 180); saveLocation: (e: FormattedData, values: {[key: string]: any}) => Observable; saveMarkerLocation: (e: FormattedData, lat?: number, lng?: number) => Observable; @@ -109,7 +108,7 @@ export default abstract class LeafletMap { translateService: TranslateService; tooltipInstances: ITooltipsterInstance[] = []; - clusteringSettings: MarkerClusterGroupOptions; + clusteringSettings: L.MarkerClusterGroupOptions; protected constructor(public ctx: WidgetContext, public $container: HTMLElement, @@ -185,13 +184,13 @@ export default abstract class LeafletMap { if (markerClusteringSettings.maxZoom && markerClusteringSettings.maxZoom >= 0 && markerClusteringSettings.maxZoom < 19) { this.clusteringSettings.disableClusteringAtZoom = Math.floor(markerClusteringSettings.maxZoom); } - this.markersCluster = new MarkerClusterGroup(this.clusteringSettings); + this.markersCluster = new L.MarkerClusterGroup(this.clusteringSettings); } } private selectEntityWithoutLocationDialog(shapes: L.PM.SUPPORTED_SHAPES): Observable { - let entities; - let labelSettings; + let entities: FormattedData[]; + let labelSettings: LabelSettings; switch (shapes) { case 'Polygon': case 'Rectangle': @@ -244,8 +243,8 @@ export default abstract class LeafletMap { if (data !== null) { this.selectedEntity = data; this.toggleDrawMode(type); - let tooltipText; - let customTranslation; + let tooltipText: string; + let customTranslation: L.PM.Translations; switch (type) { case 'tbMarker': tooltipText = this.translateService.instant('widgets.maps.tooltips.placeMarker', {entityName: data.entityParseName}); @@ -310,7 +309,7 @@ export default abstract class LeafletMap { this.map.pm.Toolbar.copyDrawControl('Marker', { name: 'tbMarker', afterClick: () => this.selectEntityWithoutLocation('tbMarker'), - disabled: true, + disabled: false, actions }); } @@ -336,14 +335,14 @@ export default abstract class LeafletMap { this.map.pm.Toolbar.copyDrawControl('Rectangle', { name: 'tbRectangle', afterClick: () => this.selectEntityWithoutLocation('tbRectangle'), - disabled: true, + disabled: false, actions: rectangleActions }); this.map.pm.Toolbar.copyDrawControl('Polygon', { name: 'tbPolygon', afterClick: () => this.selectEntityWithoutLocation('tbPolygon'), - disabled: true, + disabled: false, actions: polygonActions }); } @@ -426,7 +425,7 @@ export default abstract class LeafletMap { switch (e.shape) { case 'tbMarker': // @ts-ignore - this.saveLocation(this.selectedEntity, this.convertToCustomFormat(e.layer.getLatLng())).subscribe(() => {}); + this.saveLocation(this.selectedEntity, this.convertToCustomFormat(e.marker.getLatLng())).subscribe(() => {}); break; case 'tbRectangle': case 'tbPolygon': @@ -567,8 +566,8 @@ export default abstract class LeafletMap { } $(this.ctx.$container) .find('a[role="button"]:not(.leaflet-pm-action)') - .each((index, element) => { - let title; + .each((_index, element) => { + let title: string; if (element.title) { title = element.title; $(element).removeAttr('title'); @@ -589,7 +588,12 @@ export default abstract class LeafletMap { }, side: 'right', distance: 2, - trackOrigin: true + trackOrigin: true, + functionBefore: (instance, helper) => { + if (helper.origin.ariaDisabled === 'true' || helper.origin.parentElement.classList.contains('active')) { + return false; + } + }, } ); this.tooltipInstances.push(tooltip.tooltipster('instance')); @@ -623,7 +627,7 @@ export default abstract class LeafletMap { return this.map.getCenter(); } - fitBounds(bounds: LatLngBounds, padding?: LatLngTuple) { + fitBounds(bounds: LatLngBounds, padding?: PointExpression) { if (bounds.isValid()) { this.bounds = !!this.bounds ? this.bounds.extend(bounds) : bounds; if (!this.options.fitMapBounds && this.options.defaultZoomLevel) { @@ -669,7 +673,7 @@ export default abstract class LeafletMap { return L.latLng(position.x, position.y) as L.LatLng; } - convertPosition(data: FormattedData, dsData: FormattedData[]): L.LatLng { + convertPosition(data: FormattedData, _dsData: FormattedData[]): L.LatLng { const position = this.extractPosition(data); if (position) { return this.positionToLatLng(position); @@ -1075,7 +1079,7 @@ export default abstract class LeafletMap { } }); const toDelete: string[] = []; - this.polylines.forEach((v, mKey) => { + this.polylines.forEach((_v, mKey) => { if (!keys.includes(mKey)) { toDelete.push(mKey); } @@ -1145,7 +1149,7 @@ export default abstract class LeafletMap { } }); const toDelete: string[] = []; - this.polygons.forEach((v, mKey) => { + this.polygons.forEach((_v, mKey) => { if (!keys.includes(mKey)) { toDelete.push(mKey); } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts index afe07ea1ed..af8f51ffdd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-models.ts @@ -51,7 +51,7 @@ export interface CircleData { export type GenericFunction = (data: FormattedData, dsData: FormattedData[], dsIndex: number) => string; export type MarkerImageFunction = (data: FormattedData, markerImages: string[], dsData: FormattedData[], dsIndex: number) => MarkerImageInfo; -export type PosFunction = (origXPos, origYPos, data: FormattedData, +export type PosFunction = (origXPos: number, origYPos: number, data: FormattedData, dsData: FormattedData[], dsIndex: number, aspect: number) => { x: number, y: number }; export type MarkerIconReadyFunction = (icon: MarkerIconInfo) => void; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.interface.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.interface.ts index 44ea3cef7c..761584c98f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.interface.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget.interface.ts @@ -18,9 +18,9 @@ import LeafletMap from '@home/components/widget/lib/maps/leaflet-map'; export interface MapWidgetInterface { map?: LeafletMap; - resize(); - update(); - destroy(); + resize(): void; + update(): void; + destroy(): void; } export interface MapWidgetStaticInterface { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts index c9e4d872b6..58702653e5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts @@ -150,7 +150,7 @@ export class MapWidgetController implements MapWidgetInterface { } setMarkerLocation(e: FormattedData, lat?: number, lng?: number) { - let markerValue; + let markerValue: {[p: string]: any}; if (isDefined(lat) && isDefined(lng)) { const point = lat != null && lng !== null ? L.latLng(lat, lng) : null; markerValue = this.map.convertToCustomFormat(point); @@ -169,7 +169,7 @@ export class MapWidgetController implements MapWidgetInterface { } savePolygonLocation(e: FormattedData, coordinates?: Array) { - let polygonValue; + let polygonValue: {[p: string]: any}; if (isDefined(coordinates)) { polygonValue = this.map.convertToPolygonFormat(coordinates); } else { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/maps-utils.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/maps-utils.ts index aa1a6e3223..125bf4b5c4 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/maps-utils.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/maps-utils.ts @@ -87,14 +87,14 @@ export function isJSON(data: string): boolean { } } -interface labelSettings { +export interface LabelSettings { showLabel: boolean; useLabelFunction: boolean; parsedLabelFunction: GenericFunction; label: string; } -export function entitiesParseName(entities: FormattedData[], labelSettings: labelSettings): FormattedData[] { +export function entitiesParseName(entities: FormattedData[], labelSettings: LabelSettings): FormattedData[] { const div = document.createElement('div'); for (const entity of entities) { if (labelSettings?.showLabel) { diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/markers.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/markers.ts index 582faf6ebd..e41928d9e9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/markers.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/markers.ts @@ -30,7 +30,7 @@ export class Marker { private editing = false; leafletMarker: L.Marker; - labelOffset: L.LatLngTuple; + labelOffset: L.PointTuple; tooltipOffset: L.LatLngTuple; markerOffset: L.LatLngTuple; tooltip: L.Popup; @@ -40,10 +40,10 @@ export class Marker { private location: L.LatLng, private settings: Partial, private data?: FormattedData, - private dataSources?, + private dataSources?: FormattedData[], private onDragendListener?, snappable = false) { - this.leafletMarker = L.marker(location, { + this.leafletMarker = L.marker(this.location, { pmIgnore: !settings.draggableMarker, snapIgnore: !snappable, tbMarkerData: this.data @@ -78,7 +78,7 @@ export class Marker { } if (settings.draggableMarker && onDragendListener) { - this.leafletMarker.on('pm:dragstart', (e) => { + this.leafletMarker.on('pm:dragstart', () => { (this.leafletMarker.dragging as any)._draggable = { _moved: true }; (this.leafletMarker.dragging as any)._enabled = true; this.editing = true; @@ -134,7 +134,7 @@ export class Marker { } } - updateMarkerColor(color) { + updateMarkerColor(color: tinycolor.Instance) { this.createDefaultMarkerIcon(color, (iconInfo) => { this.leafletMarker.setIcon(iconInfo.icon); }); @@ -179,8 +179,8 @@ export class Marker { loadImageWithAspect(this.map.ctx.$injector.get(ImagePipe), currentImage.url).subscribe( (aspectImage) => { if (aspectImage?.aspect) { - let width; - let height; + let width: number; + let height: number; if (aspectImage.aspect > 1) { width = currentImage.size; height = currentImage.size / aspectImage.aspect; @@ -263,7 +263,7 @@ export class Marker { this.leafletMarker.addTo(map))*/ } - extendBoundsWithMarker(bounds) { + extendBoundsWithMarker(bounds: L.LatLngBounds) { bounds.extend(this.leafletMarker.getLatLng()); } @@ -271,7 +271,7 @@ export class Marker { return this.leafletMarker.getLatLng(); } - setMarkerPosition(latLng) { + setMarkerPosition(latLng: L.LatLngExpression) { this.leafletMarker.setLatLng(latLng); } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts index d19074ddf1..adf68b1dba 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/google-map.ts @@ -31,7 +31,7 @@ interface GmGlobal { export class GoogleMap extends LeafletMap { private resource: ResourcesService; - constructor(ctx: WidgetContext, $container, options: WidgetUnitedMapSettings) { + constructor(ctx: WidgetContext, $container: HTMLElement, options: WidgetUnitedMapSettings) { super(ctx, $container, options); this.resource = ctx.$injector.get(ResourcesService); this.loadGoogle(() => { @@ -47,20 +47,20 @@ export class GoogleMap extends LeafletMap { }, options.gmApiKey); } - private loadGoogle(callback, apiKey = 'AIzaSyDoEx2kaGz3PxwbI9T7ccTSg5xjdw8Nw8Q') { + private loadGoogle(callback: () => void, apiKey = 'AIzaSyDoEx2kaGz3PxwbI9T7ccTSg5xjdw8Nw8Q') { if (gmGlobals[apiKey]) { callback(); } else { - this.resource.loadResource(`https://maps.googleapis.com/maps/api/js?key=${apiKey}`).subscribe( - () => { + this.resource.loadResource(`https://maps.googleapis.com/maps/api/js?key=${apiKey}`).subscribe({ + next: () => { gmGlobals[apiKey] = true; callback(); }, - (error) => { + error: (error) => { gmGlobals[apiKey] = false; console.error(`Google map api load failed!`, error); } - ); + }); } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts index 217796464f..8023a1b54f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/here-map.ts @@ -21,7 +21,7 @@ import { WidgetContext } from '@home/models/widget-component.models'; import { isDefinedAndNotNull } from '@core/utils'; export class HEREMap extends LeafletMap { - constructor(ctx: WidgetContext, $container, options: WidgetUnitedMapSettings) { + constructor(ctx: WidgetContext, $container: HTMLElement, options: WidgetUnitedMapSettings) { super(ctx, $container, options); const map = L.map($container, { doubleClickZoom: !this.options.disableDoubleClickZooming, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts index 1fb33352e7..8cf1822ad5 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import L, { LatLngBounds, LatLngLiteral, LatLngTuple } from 'leaflet'; +import L, { LatLngBounds, LatLngLiteral, LatLngTuple, PointExpression } from 'leaflet'; import LeafletMap from '../leaflet-map'; import { CircleData, @@ -24,10 +24,8 @@ import { WidgetUnitedMapSettings } from '../map-models'; import { Observable, of, ReplaySubject, switchMap } from 'rxjs'; -import { catchError, map, mergeMap } from 'rxjs/operators'; -import { - calculateNewPointCoordinate, loadImageWithAspect -} from '@home/components/widget/lib/maps/common-maps-utils'; +import { catchError } from 'rxjs/operators'; +import { calculateNewPointCoordinate, loadImageWithAspect } from '@home/components/widget/lib/maps/common-maps-utils'; import { WidgetContext } from '@home/models/widget-component.models'; import { DataSet, DatasourceType, FormattedData, widgetType } from '@shared/models/widget.models'; import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; @@ -135,7 +133,7 @@ export class ImageMap extends LeafletMap { } } ), - catchError((e) => this.imageFromUrl(defaultImageMapProviderSettings.mapImageUrl)) + catchError(() => this.imageFromUrl(defaultImageMapProviderSettings.mapImageUrl)) ); } @@ -158,13 +156,13 @@ export class ImageMap extends LeafletMap { return this.imageFromUrl(defaultImageMapProviderSettings.mapImageUrl); } }), - catchError((e) => this.imageFromUrl(defaultImageMapProviderSettings.mapImageUrl)) + catchError(() => this.imageFromUrl(defaultImageMapProviderSettings.mapImageUrl)) ); }) ); } - updateBounds(updateImage?: boolean, lastCenterPos?) { + updateBounds(updateImage?: boolean, lastCenterPos?: L.Point) { const w = this.width; const h = this.height; this.southWest = this.pointToLatLng(0, h); @@ -233,7 +231,7 @@ export class ImageMap extends LeafletMap { } } - fitBounds(bounds: LatLngBounds, padding?: LatLngTuple) { } + fitBounds(_bounds: LatLngBounds, _padding?: PointExpression) { } initMap(updateImage?: boolean) { if (!this.map && this.aspect > 0) { @@ -271,7 +269,7 @@ export class ImageMap extends LeafletMap { position.y * this.height); } - convertPosition(data, dsData: FormattedData[]): L.LatLng { + convertPosition(data: FormattedData, dsData: FormattedData[]): L.LatLng { const position = this.extractPosition(data); if (position) { const converted = this.posFunction(position.x, position.y, data, dsData, data.dsIndex, this.aspect) || {x: 0, y: 0}; @@ -296,7 +294,7 @@ export class ImageMap extends LeafletMap { }).filter(el => !!el); } - pointToLatLng(x, y): L.LatLng { + pointToLatLng(x: number, y: number): L.LatLng { return L.CRS.Simple.pointToLatLng({ x, y } as L.PointExpression, maxZoom - 1); } @@ -304,7 +302,7 @@ export class ImageMap extends LeafletMap { return L.CRS.Simple.latLngToPoint(latLng, maxZoom - 1); } - convertToCustomFormat(position: L.LatLng, offset = 0, width = this.width, height = this.height): {[key: string]: any} { + convertToCustomFormat(position: L.LatLng, _offset = 0, width = this.width, height = this.height): {[key: string]: any} { if (!position) { return { [this.options.xPosKeyName]: null, diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts index 9c2a85e7c7..5df624f5ea 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts @@ -20,17 +20,17 @@ import { DEFAULT_ZOOM_LEVEL, WidgetUnitedMapSettings } from '../map-models'; import { WidgetContext } from '@home/models/widget-component.models'; export class OpenStreetMap extends LeafletMap { - constructor(ctx: WidgetContext, $container, options: WidgetUnitedMapSettings) { + constructor(ctx: WidgetContext, $container: HTMLElement, options: WidgetUnitedMapSettings) { super(ctx, $container, options); const map = L.map($container, { doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl }).setView(options?.parsedDefaultCenterPosition, options?.defaultZoomLevel || DEFAULT_ZOOM_LEVEL); - let tileLayer; + let tileLayer: L.TileLayer; if (options.useCustomProvider) { tileLayer = L.tileLayer(options.customProviderTileUrl); } else { - tileLayer = (L.tileLayer as any).provider(options.mapProvider || 'OpenStreetMap.Mapnik'); + tileLayer = L.tileLayer.provider(options.mapProvider || 'OpenStreetMap.Mapnik'); } tileLayer.addTo(map); super.setMap(map); diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts index 12d5c99557..6ff7f9012b 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/tencent-map.ts @@ -21,9 +21,9 @@ import { DEFAULT_ZOOM_LEVEL, WidgetUnitedMapSettings } from '../map-models'; import { WidgetContext } from '@home/models/widget-component.models'; export class TencentMap extends LeafletMap { - constructor(ctx: WidgetContext, $container, options: WidgetUnitedMapSettings) { + constructor(ctx: WidgetContext, $container: HTMLElement, options: WidgetUnitedMapSettings) { super(ctx, $container, options); - const txUrl = 'http://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0'; + const txUrl = 'https://rt{s}.map.gtimg.com/realtimerender?z={z}&x={x}&y={y}&type=vector&style=0'; const map = L.map($container, { doubleClickZoom: !this.options.disableDoubleClickZooming, zoomControl: !this.options.disableZoomControl @@ -31,7 +31,7 @@ export class TencentMap extends LeafletMap { const txLayer = L.tileLayer(txUrl, { subdomains: '0123', tms: true, - attribution: '©2021 Tencent - GS(2020)2236号- Data© NavInfo' + attribution: '©2024 Tencent - GS(2023)1171号' }).addTo(map); txLayer.addTo(map); super.setMap(map); diff --git a/ui-ngx/yarn.lock b/ui-ngx/yarn.lock index bb64381d19..6115ad9fe6 100644 --- a/ui-ngx/yarn.lock +++ b/ui-ngx/yarn.lock @@ -1863,17 +1863,17 @@ dependencies: "@fortawesome/fontawesome-common-types" "6.6.0" -"@geoman-io/leaflet-geoman-free@2.14.2": - version "2.14.2" - resolved "https://registry.yarnpkg.com/@geoman-io/leaflet-geoman-free/-/leaflet-geoman-free-2.14.2.tgz#c84c2115c263f34d11dc0b43859551639fe3d56b" - integrity sha512-6lIyG8RvSVdFjVjiQgBPyNASjymSyqzsiUeBW0pA+q41lB5fAg4SDC6SfJvWdEyDHa81Jb5FWjUkCc9O+u0gbg== +"@geoman-io/leaflet-geoman-free@2.17.0": + version "2.17.0" + resolved "https://registry.yarnpkg.com/@geoman-io/leaflet-geoman-free/-/leaflet-geoman-free-2.17.0.tgz#9c8fce5c7a85e5d7ece3a7e5d0b82dbf2329bd81" + integrity sha512-vAY9tKB2I/Ui8d3QUBuebWnunI2sGjsfAUTXMMcf5UpISvPz67io4hpbKXid9GNsW6P4LGv1+ZzrmkpM78GzHA== dependencies: "@turf/boolean-contains" "^6.5.0" "@turf/kinks" "^6.5.0" "@turf/line-intersect" "^6.5.0" "@turf/line-split" "^6.5.0" lodash "4.17.21" - polygon-clipping "0.15.3" + polyclip-ts "^0.16.5" "@humanwhocodes/config-array@^0.13.0": version "0.13.0" @@ -3295,20 +3295,13 @@ dependencies: "@types/leaflet" "*" -"@types/leaflet@*": +"@types/leaflet@*", "@types/leaflet@1.9.12": version "1.9.12" resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.9.12.tgz#a6626a0b3fba36fd34723d6e95b22e8024781ad6" integrity sha512-BK7XS+NyRI291HIo0HCfE18Lp8oA30H1gpi1tf0mF3TgiCEzanQjOqNZ4x126SXzzi2oNSZhZ5axJp1k0iM6jg== dependencies: "@types/geojson" "*" -"@types/leaflet@1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@types/leaflet/-/leaflet-1.8.0.tgz#dc92d3e868fb6d5067b4b59fa08cd4441f84fabe" - integrity sha512-+sXFmiJTFdhaXXIGFlV5re9AdqtAODoXbGAvxx02e5SHXL3ir7ClP5J7pahO8VmzKY3dth4RUS1nf2BTT+DW1A== - dependencies: - "@types/geojson" "*" - "@types/lodash@^4.17.10": version "4.17.10" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.10.tgz#64f3edf656af2fe59e7278b73d3e62404144a6e6" @@ -4114,6 +4107,11 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +bignumber.js@^9.1.0: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + binary-extensions@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" @@ -7296,10 +7294,10 @@ leaflet-polylinedecorator@1.6.0: dependencies: leaflet-rotatedmarker "^0.2.0" -leaflet-providers@1.13.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/leaflet-providers/-/leaflet-providers-1.13.0.tgz#10c843a23d5823a65096d40ad53f27029e13434b" - integrity sha512-f/sN5wdgBbVA2jcCYzScIfYNxKdn2wBJP9bu+5cRX9Xj6g8Bt1G9Sr8WgJAt/ckIFIc3LVVxCBNFpSCfTuUElg== +leaflet-providers@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/leaflet-providers/-/leaflet-providers-2.0.0.tgz#dfdab9ca2dccc57c79e1462bc3dd20f78910afcb" + integrity sha512-CWwKEnHd66Qsx0m4o5q5ZOa60s00B91pMxnlr4Y22msubfs7dhbZhdMIz8bvZQkrZqi67ppI1fsZRS6vtrLcOA== leaflet-rotatedmarker@^0.2.0: version "0.2.0" @@ -7316,10 +7314,10 @@ leaflet.markercluster@1.5.3: resolved "https://registry.yarnpkg.com/leaflet.markercluster/-/leaflet.markercluster-1.5.3.tgz#9cdb52a4eab92671832e1ef9899669e80efc4056" integrity sha512-vPTw/Bndq7eQHjLBVlWpnGeLa3t+3zGiuM7fJwCkiMFq+nmRuG3RI3f7f4N4TDX7T4NpbAXpR2+NTRSEGfCSeA== -leaflet@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.8.0.tgz#4615db4a22a304e8e692cae9270b983b38a2055e" - integrity sha512-gwhMjFCQiYs3x/Sf+d49f10ERXaEFCPr+nVTryhAW8DWbMGqJqt9G4XuIaHmFW08zYvhgdzqXGr8AlW8v8dQkA== +leaflet@1.9.4: + version "1.9.4" + resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.9.4.tgz#23fae724e282fa25745aff82ca4d394748db7d8d" + integrity sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA== less-loader@12.2.0: version "12.2.0" @@ -8601,12 +8599,13 @@ points-on-path@^0.2.1: path-data-parser "0.1.0" points-on-curve "0.2.0" -polygon-clipping@0.15.3: - version "0.15.3" - resolved "https://registry.yarnpkg.com/polygon-clipping/-/polygon-clipping-0.15.3.tgz#0215840438470ba2e9e6593625e4ea5c1087b4b7" - integrity sha512-ho0Xx5DLkgxRx/+n4O74XyJ67DcyN3Tu9bGYKsnTukGAW6ssnuak6Mwcyb1wHy9MZc9xsUWqIoiazkZB5weECg== +polyclip-ts@^0.16.5: + version "0.16.5" + resolved "https://registry.yarnpkg.com/polyclip-ts/-/polyclip-ts-0.16.5.tgz#053e073e640449f1b1a1d88471f8758779d0b030" + integrity sha512-ZchnG0zGZReHgEo3EYzEUi6UmfQFFzNnj6AFU+gBm+IJJ4qG9gL4CwjtCV6oi/PittUPpJLiLJxcn/AgrCBO+g== dependencies: - splaytree "^3.1.0" + bignumber.js "^9.1.0" + splaytree-ts "^1.0.1" possible-typed-array-names@^1.0.0: version "1.0.0" @@ -9689,10 +9688,10 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" -splaytree@^3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/splaytree/-/splaytree-3.1.2.tgz#d1db2691665a3c69d630de98d55145a6546dc166" - integrity sha512-4OM2BJgC5UzrhVnnJA4BkHKGtjXNzzUfpQjCO8I05xYPsfS/VuQDwjCGGMi8rYQilHEV4j8NBqTFbls/PZEE7A== +splaytree-ts@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/splaytree-ts/-/splaytree-ts-1.0.1.tgz#4ddcfe2684da017d02b599d53d67f6d07a90745b" + integrity sha512-B+VzCm33/KEchi/fzT6/3NRHm8k5+Kf37SBQO3meHHS/tK2xBnIm4ZvusQ1wUpHgKMCCqEWgXnwFXAa1nD289g== split.js@^1.6.5: version "1.6.5"