Browse Source

Fixed types

pull/3280/head
Mrkartoshka 6 years ago
parent
commit
c661343a32
  1. 5
      ui-ngx/package-lock.json
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts
  3. 2
      ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts
  4. 6
      ui-ngx/src/app/modules/home/components/widget/lib/maps/schemes.ts
  5. 23
      ui-ngx/src/typings/leadflet-editable.d.ts

5
ui-ngx/package-lock.json

@ -8027,6 +8027,11 @@
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
"integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ=="
},
"leaflet-editable": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/leaflet-editable/-/leaflet-editable-1.2.0.tgz",
"integrity": "sha512-wG11JwpL8zqIbypTop6xCRGagMuWw68ihYu4uqrqc5Ep0wnEJeyob7NB2Rt5t74Oih4rwJ3OfwaGbzdowOGfYQ=="
},
"leaflet-polylinedecorator": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/leaflet-polylinedecorator/-/leaflet-polylinedecorator-1.6.0.tgz",

2
ui-ngx/src/app/modules/home/components/widget/lib/maps/map-widget2.ts

@ -330,7 +330,7 @@ export class MapWidgetController implements MapWidgetInterface {
update() {
const formattedData = parseData(this.data);
this.map.updateData(this.data, formattedData, this.drawRoutes, this.settings.showPolygon);
if (this.settings.draggableMarker) {
if (this.settings.draggableMarker || this.settings.editablePolygon) {
this.map.setDataSources(formattedData);
}
}

2
ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/openstreet-map.ts

@ -22,7 +22,7 @@ import { WidgetContext } from '@home/models/widget-component.models';
export class OpenStreetMap extends LeafletMap {
constructor(ctx: WidgetContext, $container, options: UnitedMapSettings) {
super(ctx, $container, options);
const map = new L.Map($container, {editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
const map = L.map($container, {editable: !!options.editablePolygon}).setView(options?.defaultCenterPosition, options?.defaultZoomLevel);
let tileLayer;
if (options.useCustomProvider)
tileLayer = L.tileLayer(options.customProviderTileUrl);

6
ui-ngx/src/app/modules/home/components/widget/lib/maps/schemes.ts

@ -524,6 +524,11 @@ export const mapPolygonSchema =
type: 'string',
default: 'coordinates'
},
editablePolygon: {
title: 'Enable polygon edit',
type: 'boolean',
default: false
},
polygonColor: {
title: 'Polygon color',
type: 'string'
@ -581,6 +586,7 @@ export const mapPolygonSchema =
form: [
'showPolygon',
'polygonKeyName',
'editablePolygon',
{
key: 'polygonColor',
type: 'color'

23
ui-ngx/src/typings/leadflet-editable.d.ts

@ -14,7 +14,7 @@
/// limitations under the License.
///
import * as Leaflet from 'leaflet';
import * as leaflet from 'leaflet';
declare module 'leaflet' {
@ -31,7 +31,11 @@ declare module 'leaflet' {
/**
* Options to pass to L.Editable when instanciating.
*/
interface EditOptions extends Leaflet.MapOptions{
interface EditOptions extends leaflet.MapOptions{
/**
* Whether to create a L.Editable instance at map init or not.
*/
editable: boolean;
/**
* Class to be used when creating a new Polyline.
*/
@ -55,7 +59,7 @@ declare module 'leaflet' {
/**
* Layer used to store edit tools (vertex, line guide…).
*/
editLayer?: LayerGroup<Leaflet.Layer>;
editLayer?: LayerGroup<leaflet.Layer>;
/**
* Default layer used to store drawn features (marker, polyline…).
@ -104,7 +108,7 @@ declare module 'leaflet' {
* This is not a plug and play UI, and will not. This is a minimal, lightweight, and fully extendable API to
* control editing of geometries. So you can easily build your own UI with your own needs and choices.
*/
interface Editable extends Leaflet.Evented {
interface Editable extends leaflet.Evented {
/**
* Options to pass to L.Editable when instanciating.
*/
@ -172,15 +176,12 @@ declare module 'leaflet' {
}
interface Map {
/**
* Whether to create a L.Editable instance at map init or not.
*/
editable: boolean;
/**
* Options to pass to L.Editable when instanciating.
*/
editOptions: EditOptions;
editOptions: MapOptions;
/**
* L.Editable plugin instance.
@ -201,7 +202,7 @@ declare module 'leaflet' {
/**
* Options to pass to L.Editable when instanciating.
*/
editOptions?: EditOptions;
editOptions?: MapOptions;
}
}
@ -269,4 +270,6 @@ declare module 'leaflet' {
interface Polyline extends EditableMixin, PolylineEditor {}
interface Polygon extends EditableMixin, PolygonEditor {}
function map(element: string | HTMLElement, options?: EditOptions): Map;
}

Loading…
Cancel
Save