...
|
...
|
@@ -42,7 +42,7 @@ import { AttributeScope } from '@shared/models/telemetry/telemetry.models'; |
42
|
42
|
import { AttributeService } from '@core/http/attribute.service';
|
43
|
43
|
import { Type } from '@angular/core';
|
44
|
44
|
import { TranslateService } from '@ngx-translate/core';
|
45
|
|
-import { UtilsService } from '@app/core/services/utils.service';
|
|
45
|
+import { UtilsService } from '@core/services/utils.service';
|
46
|
46
|
|
47
|
47
|
// @dynamic
|
48
|
48
|
export class MapWidgetController implements MapWidgetInterface {
|
...
|
...
|
@@ -85,26 +85,27 @@ export class MapWidgetController implements MapWidgetInterface { |
85
|
85
|
public static getProvidersSchema(mapProvider: MapProviders) {
|
86
|
86
|
mapProviderSchema.schema.properties.provider.default = mapProvider;
|
87
|
87
|
return mergeSchemes([mapProviderSchema,
|
88
|
|
- ...Object.values(providerSets)?.map(
|
89
|
|
- (setting: IProvider) => addCondition(setting?.schema, `model.provider === '${setting.name}'`))]);
|
|
88
|
+ ...Object.keys(providerSets)?.map(
|
|
89
|
+ (key: string) => { const setting = providerSets[key]; return addCondition(setting?.schema, `model.provider === '${setting.name}'`) })]);
|
90
|
90
|
}
|
91
|
91
|
|
92
|
92
|
public static settingsSchema(mapProvider: MapProviders, drawRoutes: boolean): JsonSettingsSchema {
|
93
|
93
|
const schema = initSchema();
|
94
|
94
|
addToSchema(schema, this.getProvidersSchema(mapProvider));
|
95
|
|
- if(mapProvider!=='image-map'){
|
|
95
|
+ if (mapProvider !== 'image-map') {
|
96
|
96
|
addGroupInfo(schema, 'Map Provider Settings');
|
97
|
|
- addToSchema(schema, mergeSchemes([commonMapSettingsSchema, addCondition(mapPolygonSchema, 'model.showPolygon === true')]));
|
98
|
|
- addGroupInfo(schema, 'Common Map Settings');
|
99
|
|
- if (drawRoutes) {
|
100
|
|
- addToSchema(schema, routeMapSettingsSchema);
|
101
|
|
- addGroupInfo(schema, 'Route Map Settings');
|
102
|
|
- } else if (mapProvider !== 'image-map') {
|
103
|
|
- const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema,
|
104
|
|
- addCondition(markerClusteringSettingsSchemaLeaflet, `model.useClusterMarkers === true`)])
|
105
|
|
- addToSchema(schema, clusteringSchema);
|
106
|
|
- addGroupInfo(schema, 'Markers Clustering Settings');
|
107
|
|
- }}
|
|
97
|
+ addToSchema(schema, mergeSchemes([commonMapSettingsSchema, addCondition(mapPolygonSchema, 'model.showPolygon === true')]));
|
|
98
|
+ addGroupInfo(schema, 'Common Map Settings');
|
|
99
|
+ if (drawRoutes) {
|
|
100
|
+ addToSchema(schema, routeMapSettingsSchema);
|
|
101
|
+ addGroupInfo(schema, 'Route Map Settings');
|
|
102
|
+ } else if (mapProvider !== 'image-map') {
|
|
103
|
+ const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema,
|
|
104
|
+ addCondition(markerClusteringSettingsSchemaLeaflet, `model.useClusterMarkers === true`)])
|
|
105
|
+ addToSchema(schema, clusteringSchema);
|
|
106
|
+ addGroupInfo(schema, 'Markers Clustering Settings');
|
|
107
|
+ }
|
|
108
|
+ }
|
108
|
109
|
return schema;
|
109
|
110
|
}
|
110
|
111
|
|
...
|
...
|
@@ -125,7 +126,7 @@ export class MapWidgetController implements MapWidgetInterface { |
125
|
126
|
};
|
126
|
127
|
}
|
127
|
128
|
|
128
|
|
- translate = (key: string, defaultTranslation?: string):string => {
|
|
129
|
+ translate = (key: string, defaultTranslation?: string): string => {
|
129
|
130
|
return (this.ctx.$injector.get(UtilsService).customTranslation(key, defaultTranslation || key)
|
130
|
131
|
|| this.ctx.$injector.get(TranslateService).instant(key));
|
131
|
132
|
}
|
...
|
...
|
@@ -143,7 +144,7 @@ export class MapWidgetController implements MapWidgetInterface { |
143
|
144
|
}
|
144
|
145
|
|
145
|
146
|
private onCustomAction(descriptor: WidgetActionDescriptor, $event: any) {
|
146
|
|
- if ($event & $event.stopPropagation) {
|
|
147
|
+ if ($event && $event.stopPropagation) {
|
147
|
148
|
$event?.stopPropagation();
|
148
|
149
|
}
|
149
|
150
|
// safeExecute(parseFunction(descriptor.customFunction, ['$event', 'widgetContext']), [$event, this.ctx])
|
...
|
...
|
|