update map bundles

This commit is contained in:
Artem Halushko 2020-04-27 16:10:46 +03:00
parent 26e5f69b32
commit 4f8942b112
3 changed files with 51 additions and 51 deletions

File diff suppressed because one or more lines are too long

View File

@ -62,19 +62,21 @@ export function mergeSchemes(schemes: JsonSettingsSchema[]): JsonSettingsSchema
}, initSchema()); }, initSchema());
} }
export function addCondition(schema: JsonSettingsSchema, condition: string): JsonSettingsSchema { export function addCondition(schema: JsonSettingsSchema, condition: string, exclude: string[] = []): JsonSettingsSchema {
schema.form = schema.form.map(element => { schema.form = schema.form.map(element => {
if (typeof element === 'string') { if (!exclude.includes(element)) {
return { if (typeof element === 'string') {
key: element, return {
condition key: element,
condition
}
} }
} if (typeof element === 'object') {
if (typeof element === 'object') { if (element.condition) {
if (element.condition) { element.condition += ' && ' + condition
element.condition += ' && ' + condition }
else element.condition = condition;
} }
else element.condition = condition;
} }
return element; return element;
}); });

View File

@ -94,21 +94,20 @@ export class MapWidgetController implements MapWidgetInterface {
public static settingsSchema(mapProvider: MapProviders, drawRoutes: boolean): JsonSettingsSchema { public static settingsSchema(mapProvider: MapProviders, drawRoutes: boolean): JsonSettingsSchema {
const schema = initSchema(); const schema = initSchema();
addToSchema(schema, this.getProvidersSchema(mapProvider)); addToSchema(schema, this.getProvidersSchema(mapProvider));
if (mapProvider !== 'image-map') { addGroupInfo(schema, 'Map Provider Settings');
addGroupInfo(schema, 'Map Provider Settings'); addToSchema(schema, addCondition(commonMapSettingsSchema, 'model.provider !== "image-map"'));
addToSchema(schema, commonMapSettingsSchema); addGroupInfo(schema, 'Common Map Settings');
addGroupInfo(schema, 'Common Map Settings'); addToSchema(schema, addCondition(mapPolygonSchema, 'model.showPolygon=== true', ['showPolygon']));
addToSchema(schema, addCondition(mapPolygonSchema, 'model.showPolygon === true')); addGroupInfo(schema, 'Polygon Settings');
addGroupInfo(schema, 'Polygon Settings'); if (drawRoutes) {
if (drawRoutes) { addToSchema(schema, routeMapSettingsSchema);
addToSchema(schema, routeMapSettingsSchema); addGroupInfo(schema, 'Route Map Settings');
addGroupInfo(schema, 'Route Map Settings'); } else {
} else if (mapProvider !== 'image-map') { const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema,
const clusteringSchema = mergeSchemes([markerClusteringSettingsSchema, addCondition(markerClusteringSettingsSchemaLeaflet,
addCondition(markerClusteringSettingsSchemaLeaflet, `model.useClusterMarkers === true`)]) `model.useClusterMarkers === true && model.provider !== "image-map"`)])
addToSchema(schema, clusteringSchema); addToSchema(schema, clusteringSchema);
addGroupInfo(schema, 'Markers Clustering Settings'); addGroupInfo(schema, 'Markers Clustering Settings');
}
} }
return schema; return schema;
} }
@ -162,7 +161,6 @@ export class MapWidgetController implements MapWidgetInterface {
} }
setMarkerLocation = (e) => { setMarkerLocation = (e) => {
console.log("setMarkerLocation -> e", e)
const attributeService = this.ctx.$injector.get(AttributeService); const attributeService = this.ctx.$injector.get(AttributeService);
const entityId: EntityId = { const entityId: EntityId = {
@ -186,7 +184,7 @@ export class MapWidgetController implements MapWidgetInterface {
initSettings(settings: UnitedMapSettings): UnitedMapSettings { initSettings(settings: UnitedMapSettings): UnitedMapSettings {
const functionParams = ['data', 'dsData', 'dsIndex']; const functionParams = ['data', 'dsData', 'dsIndex'];
this.provider = settings.provider || this.mapProvider; this.provider = settings.provider || this.mapProvider;
if (!settings.mapProviderHere) { if (this.provider === MapProviders.here && !settings.mapProviderHere) {
if (settings.mapProvider && hereProviders.includes(settings.mapProvider)) if (settings.mapProvider && hereProviders.includes(settings.mapProvider))
settings.mapProviderHere = settings.mapProvider settings.mapProviderHere = settings.mapProvider
else settings.mapProviderHere = hereProviders[0]; else settings.mapProviderHere = hereProviders[0];