@guajiritos/map 0.0.1-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -0
- package/esm2022/guajiritos-map.mjs +5 -0
- package/esm2022/interfaces/interfaces.mjs +14 -0
- package/esm2022/lib/guajiritos-map.component.mjs +293 -0
- package/esm2022/public-api.mjs +6 -0
- package/fesm2022/guajiritos-map.mjs +317 -0
- package/fesm2022/guajiritos-map.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/interfaces/interfaces.d.ts +45 -0
- package/lib/guajiritos-map.component.d.ts +115 -0
- package/package.json +28 -0
- package/public-api.d.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Guajiritos Map
|
|
2
|
+
|
|
3
|
+
`Guajiritos Map` es una librería para Angular que permite la configuración de un mapa de `Leaflet` para su posterior uso de distintas formas.
|
|
4
|
+
|
|
5
|
+
## Instalación
|
|
6
|
+
|
|
7
|
+
Con `npm`
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i @guajiritos/map --save
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Con `yarn`
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
yarn add @guajiritos/map
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Nota
|
|
20
|
+
|
|
21
|
+
Para el uso correcto de esta librería es necesario tener instalado previamente `@ngular/material`, `leaflet` y `@types/leaflet`. En caso de no tener instalado las librerías anteriormente descritas el uso de la librería `@guajiritos/map` derivaría en errores para su aplicación.
|
|
22
|
+
|
|
23
|
+
## Importación
|
|
24
|
+
|
|
25
|
+
Importar la librería como se muestra a continuación.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import {GuajiritosMap} from "@guajiritos/map";
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Luego añadirla a la sección imports.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
imports: [
|
|
35
|
+
...
|
|
36
|
+
GuajiritosMap,
|
|
37
|
+
]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Estilos
|
|
41
|
+
|
|
42
|
+
Para usar correctamente los estilos del mapa debe poner en su archivo `angular.json` la línea de código `"./node_modules/leaflet/dist/leaflet.css",` como se muestra a continuación
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
...
|
|
47
|
+
"projects": {
|
|
48
|
+
"angular-leaflet-app": {
|
|
49
|
+
...
|
|
50
|
+
"architect": {
|
|
51
|
+
"build": {
|
|
52
|
+
...
|
|
53
|
+
"options": {
|
|
54
|
+
...
|
|
55
|
+
"styles": [
|
|
56
|
+
"./node_modules/leaflet/dist/leaflet.css",
|
|
57
|
+
"src/styles.css"
|
|
58
|
+
],
|
|
59
|
+
...
|
|
60
|
+
}
|
|
61
|
+
...
|
|
62
|
+
}
|
|
63
|
+
...
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Para que los marcadores de leaflet puedan ser vistos en el mapa debe agregar al archivo `angular.json` los siguientes etilos como se muestra a continuación
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
...
|
|
75
|
+
"projects": {
|
|
76
|
+
"angular-leaflet-example": {
|
|
77
|
+
...
|
|
78
|
+
"architect": {
|
|
79
|
+
"build": {
|
|
80
|
+
...
|
|
81
|
+
"options": {
|
|
82
|
+
...
|
|
83
|
+
"assets": [
|
|
84
|
+
"src/favicon.ico",
|
|
85
|
+
"src/assets",
|
|
86
|
+
{
|
|
87
|
+
"glob": "**/*",
|
|
88
|
+
"input": "node_modules/leaflet/dist/images/",
|
|
89
|
+
"output": "./assets"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
...
|
|
93
|
+
}
|
|
94
|
+
...
|
|
95
|
+
}
|
|
96
|
+
...
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Nota: En caso de querer quitar el cartel pequeño en la esquina inferior derecha, basta con poner en el `styles.css` o `styles.scss` las siguientes líneas de código
|
|
104
|
+
|
|
105
|
+
```scss
|
|
106
|
+
.leaflet-bottom.leaflet-right {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Uso
|
|
112
|
+
|
|
113
|
+
En nuestro archivo HTML debemos agregar la etiqueta `guajiritos-multi-chips` como se muestra a continuación.
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
|
|
117
|
+
<guajiritos-map [latLabel]="latLabel" [latPlaceholder]="latPlaceholder" [latError]="latError" [lngLabel]="lngLabel"
|
|
118
|
+
[lngPlaceholder]="lngPlaceholder" [lngError]="lngError" [appearance]="appearance" [color]="color"
|
|
119
|
+
[readonly]="false" [hidden]="false" [options]="options" [circle]="circle" [icon]="icon"
|
|
120
|
+
[markers]="markers()" [formControl]="form" (markerDragend)="markerDragEnd($event)">
|
|
121
|
+
</guajiritos-map>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Cada una de las propiedades descritas en el ejemplo anterior no son de uso requerido. A continuación se explica cada una de ellas.
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
latLabel: Representa el label que se va a mostrar cuando se visualice el campo de la latitud.
|
|
128
|
+
|
|
129
|
+
latPlaceholder: Representa el placeholder que se va a mostrar cuando se visualice el campo de la latitud.
|
|
130
|
+
|
|
131
|
+
latError: Representa el error a mostrar cuando el campo latitud se encuentre vacío.
|
|
132
|
+
|
|
133
|
+
lngLabel: Representa el label que se va a mostrar cuando se visualice el campo de la longitud.
|
|
134
|
+
|
|
135
|
+
lngPlaceholder: Representa el placeholder que se va a mostrar cuando se visualice el campo de la longitud.
|
|
136
|
+
|
|
137
|
+
lngError: Representa el error a mostrar cuando el campo longitud se encuentre vacío.
|
|
138
|
+
|
|
139
|
+
appearance: Representa la apariencia del componente. Por defecto toma el valor "outline".
|
|
140
|
+
|
|
141
|
+
color: Representa el color del componente. Por defecto su valor es "accent".
|
|
142
|
+
|
|
143
|
+
readonly: Convierte en solo lectura los campos de latitud y longitud cuando sea necesario. Por defecto su valor es "false".
|
|
144
|
+
|
|
145
|
+
hidden: Fuerza que los campos de latitud y longitud se oculten. Por defecto su valor es "false".
|
|
146
|
+
|
|
147
|
+
options: Representa las opciones iniciales del mapa que va ser mostrado.
|
|
148
|
+
|
|
149
|
+
circle: Utilizado para dibujar un círculo en el mapa.
|
|
150
|
+
|
|
151
|
+
icon: Valor para representar el ícono de los marcadores que serán dibujados sobre el mapa.
|
|
152
|
+
|
|
153
|
+
markers: Listado de marcadores que serán dibujados en el mapa. Éste listado debe estar representado en forma de arreglo de marcadores.
|
|
154
|
+
|
|
155
|
+
formControl: Representa el FormControl al que se hace referencia en el formulario donde la librería es usada.
|
|
156
|
+
|
|
157
|
+
markerDragEnd: Evento que se lanza cuando el marcador es movido de una posición a otra.
|
|
158
|
+
```
|
|
159
|
+
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VhamlyaXRvcy1tYXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9wcm9qZWN0cy9ndWFqaXJpdG9zLW1hcC9zcmMvZ3VhamlyaXRvcy1tYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const DEFAULT_MAP_OPTION = {
|
|
2
|
+
id: 'map',
|
|
3
|
+
center: [23.130257185291036, -82.35626220703126],
|
|
4
|
+
draggable: true,
|
|
5
|
+
zoom: 15,
|
|
6
|
+
updateWithClick: false,
|
|
7
|
+
updateWithDoubleClick: false,
|
|
8
|
+
zoomControl: true,
|
|
9
|
+
borderRadius: '8px',
|
|
10
|
+
scrollWheelZoom: false,
|
|
11
|
+
addMarker: false,
|
|
12
|
+
scrollable: false
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJmYWNlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2d1YWppcml0b3MtbWFwL3NyYy9pbnRlcmZhY2VzL2ludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBaURBLE1BQU0sQ0FBQyxNQUFNLGtCQUFrQixHQUFjO0lBQzNDLEVBQUUsRUFBRSxLQUFLO0lBQ1QsTUFBTSxFQUFFLENBQUMsa0JBQWtCLEVBQUUsQ0FBQyxpQkFBaUIsQ0FBQztJQUNoRCxTQUFTLEVBQUUsSUFBSTtJQUNmLElBQUksRUFBRSxFQUFFO0lBQ1IsZUFBZSxFQUFFLEtBQUs7SUFDdEIscUJBQXFCLEVBQUUsS0FBSztJQUM1QixXQUFXLEVBQUUsSUFBSTtJQUNqQixZQUFZLEVBQUUsS0FBSztJQUNuQixlQUFlLEVBQUUsS0FBSztJQUN0QixTQUFTLEVBQUUsS0FBSztJQUNoQixVQUFVLEVBQUUsS0FBSztDQUNsQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXHJcbi8qKlxyXG4gKiBNYXAgb3B0aW9ucyBpbnRlcmZhY2VcclxuICovX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2xlIG1hcCBpbnRlcmZhY2VcclxuICovXHJcbmV4cG9ydCBpbnRlcmZhY2UgQ2lyY2xlTWFwIHtcclxuICBjZW50ZXI6IE1hcmtlck1hcDtcclxuICByYWRpdXM6IG51bWJlcjtcclxufVxyXG5cclxuZXhwb3J0IGNvbnN0IERFRkFVTFRfTUFQX09QVElPTjogTWFwT3B0aW9uID0ge1xyXG4gIGlkOiAnbWFwJyxcclxuICBjZW50ZXI6IFsyMy4xMzAyNTcxODUyOTEwMzYsIC04Mi4zNTYyNjIyMDcwMzEyNl0sXHJcbiAgZHJhZ2dhYmxlOiB0cnVlLFxyXG4gIHpvb206IDE1LFxyXG4gIHVwZGF0ZVdpdGhDbGljazogZmFsc2UsXHJcbiAgdXBkYXRlV2l0aERvdWJsZUNsaWNrOiBmYWxzZSxcclxuICB6b29tQ29udHJvbDogdHJ1ZSxcclxuICBib3JkZXJSYWRpdXM6ICc4cHgnLFxyXG4gIHNjcm9sbFdoZWVsWm9vbTogZmFsc2UsXHJcbiAgYWRkTWFya2VyOiBmYWxzZSxcclxuICBzY3JvbGxhYmxlOiBmYWxzZVxyXG59OyJdfQ==
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { Component, EventEmitter, forwardRef, Input, Output, signal } from '@angular/core';
|
|
2
|
+
import { NgIf, TitleCasePipe } from '@angular/common';
|
|
3
|
+
import * as L from 'leaflet';
|
|
4
|
+
import { icon, layerGroup } from 'leaflet';
|
|
5
|
+
import { MatInputModule } from '@angular/material/input';
|
|
6
|
+
import { NG_VALUE_ACCESSOR, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
|
|
7
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
8
|
+
import { Subject, takeUntil } from 'rxjs';
|
|
9
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
10
|
+
import { DEFAULT_MAP_OPTION } from '../interfaces/interfaces';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "@angular/material/input";
|
|
13
|
+
import * as i2 from "@angular/material/form-field";
|
|
14
|
+
import * as i3 from "@angular/forms";
|
|
15
|
+
import * as i4 from "@angular/material/icon";
|
|
16
|
+
import * as i5 from "@ngx-translate/core";
|
|
17
|
+
export class GuajiritosMap {
|
|
18
|
+
constructor() {
|
|
19
|
+
this._layerGroup = new L.LayerGroup();
|
|
20
|
+
this.mapMarkers = signal([]);
|
|
21
|
+
this.options = signal(DEFAULT_MAP_OPTION);
|
|
22
|
+
this.circle = signal(null);
|
|
23
|
+
this.form = new UntypedFormGroup({
|
|
24
|
+
latitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required]),
|
|
25
|
+
longitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required])
|
|
26
|
+
});
|
|
27
|
+
this.appearance = 'outline';
|
|
28
|
+
this.color = 'accent';
|
|
29
|
+
this.floatLabel = 'auto';
|
|
30
|
+
this.subscriptSizing = 'dynamic';
|
|
31
|
+
this.readonly = false;
|
|
32
|
+
this.hiddenForm = false;
|
|
33
|
+
/**
|
|
34
|
+
* Default marker icon
|
|
35
|
+
*/
|
|
36
|
+
this.icon = {
|
|
37
|
+
iconSize: [25, 41],
|
|
38
|
+
iconAnchor: [13, 41],
|
|
39
|
+
iconUrl: 'marker-icon.png'
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Se lanza cada vez que cambia un marcador
|
|
43
|
+
*/
|
|
44
|
+
this.markerDragend = new EventEmitter();
|
|
45
|
+
/**
|
|
46
|
+
* Se lanza cada vez que se añade un marcador
|
|
47
|
+
*/
|
|
48
|
+
this.markerAdded = new EventEmitter();
|
|
49
|
+
}
|
|
50
|
+
static { this._observableSubject$ = new Subject(); }
|
|
51
|
+
/**
|
|
52
|
+
* Default map options
|
|
53
|
+
*/
|
|
54
|
+
set optionsMap(options) {
|
|
55
|
+
if (options) {
|
|
56
|
+
this.options.set({
|
|
57
|
+
...this.options(),
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
;
|
|
63
|
+
/**
|
|
64
|
+
* Add a circle on the map
|
|
65
|
+
*/
|
|
66
|
+
set circleConfig(circle) {
|
|
67
|
+
if (circle) {
|
|
68
|
+
this.circle.set(circle);
|
|
69
|
+
if (this.map) {
|
|
70
|
+
this.addCircle(this.circle()?.center, this.circle()?.radius);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* List of markers
|
|
76
|
+
* @param markers - Markers array
|
|
77
|
+
*/
|
|
78
|
+
set markers(markers) {
|
|
79
|
+
if (markers?.length) {
|
|
80
|
+
this.mapMarkers.set(markers);
|
|
81
|
+
this.form.patchValue({
|
|
82
|
+
latitude: this.mapMarkers()?.[0]?.lat,
|
|
83
|
+
longitude: this.mapMarkers()?.[0]?.lng
|
|
84
|
+
});
|
|
85
|
+
if (this.map && this._layerGroup) {
|
|
86
|
+
this.drawMarkers();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Draws the markers.
|
|
92
|
+
*/
|
|
93
|
+
drawMarkers() {
|
|
94
|
+
if (this.mapMarkers()?.length) {
|
|
95
|
+
this._layerGroup.clearLayers();
|
|
96
|
+
this.mapMarkers().forEach((m) => {
|
|
97
|
+
this.addMarker(m);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Main properties of the map
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
initMap() {
|
|
106
|
+
this.map = L.map(this.options().id, {
|
|
107
|
+
center: this.options()?.center ?? DEFAULT_MAP_OPTION.center,
|
|
108
|
+
dragging: this.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable,
|
|
109
|
+
zoom: this.options()?.zoom ?? DEFAULT_MAP_OPTION.zoom,
|
|
110
|
+
zoomControl: this.options()?.zoomControl || DEFAULT_MAP_OPTION.zoomControl,
|
|
111
|
+
scrollWheelZoom: this.options()?.scrollWheelZoom || DEFAULT_MAP_OPTION.scrollWheelZoom,
|
|
112
|
+
maxZoom: 18,
|
|
113
|
+
minZoom: 3
|
|
114
|
+
});
|
|
115
|
+
this._layerGroup = layerGroup().addTo(this.map);
|
|
116
|
+
L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png').addTo(this.map);
|
|
117
|
+
this.drawMarkers();
|
|
118
|
+
this.changeCenter(new L.LatLng(this.mapMarkers()?.[0]?.lat, this.mapMarkers()?.[0]?.lng));
|
|
119
|
+
if (this.circle()) {
|
|
120
|
+
this.addCircle(this.circle()?.center, this.circle()?.radius);
|
|
121
|
+
}
|
|
122
|
+
if (this.options()?.addMarker) {
|
|
123
|
+
let that = this;
|
|
124
|
+
this.map.on('click', function (e) {
|
|
125
|
+
const newMarker = {
|
|
126
|
+
lat: e.latlng.lat,
|
|
127
|
+
lng: e.latlng.lng,
|
|
128
|
+
draggable: that.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable
|
|
129
|
+
};
|
|
130
|
+
that.addMarker(newMarker);
|
|
131
|
+
that.markerAdded.emit(newMarker);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Add marker to map
|
|
137
|
+
* @param center - center of the circle
|
|
138
|
+
* @param radius - radius of the circle in meters
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
addCircle(center, radius) {
|
|
142
|
+
if (this.map && center) {
|
|
143
|
+
this.drawMarkers();
|
|
144
|
+
L.circleMarker([center?.lat, center?.lng], { radius }).addTo(this.map);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Add marker to map
|
|
149
|
+
* @param marker - Point of the map
|
|
150
|
+
*/
|
|
151
|
+
addMarker(marker) {
|
|
152
|
+
if (this.map && marker) {
|
|
153
|
+
const markerAdd = L.marker({
|
|
154
|
+
lat: marker?.lat,
|
|
155
|
+
lng: marker?.lng
|
|
156
|
+
}, {
|
|
157
|
+
draggable: marker?.draggable ?? true,
|
|
158
|
+
autoPan: true
|
|
159
|
+
}).setIcon(icon({
|
|
160
|
+
iconSize: this.icon?.iconSize,
|
|
161
|
+
iconAnchor: this.icon?.iconAnchor,
|
|
162
|
+
iconUrl: this.icon?.iconUrl
|
|
163
|
+
})).addTo(this._layerGroup);
|
|
164
|
+
markerAdd.on('dragend', () => {
|
|
165
|
+
this.changeCenter(markerAdd.getLatLng());
|
|
166
|
+
this.markerDragend.emit(markerAdd.getLatLng());
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Put the map center on marker position
|
|
172
|
+
* @param marker - Point of the map
|
|
173
|
+
* @public
|
|
174
|
+
*/
|
|
175
|
+
changeCenter(marker) {
|
|
176
|
+
this.map?.setView(marker);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Propagates the change to other components.
|
|
180
|
+
*
|
|
181
|
+
* @param {any} _ - an arbitrary parameter.
|
|
182
|
+
*/
|
|
183
|
+
propagateChange(_) {
|
|
184
|
+
}
|
|
185
|
+
;
|
|
186
|
+
/**
|
|
187
|
+
* Sets the callback function to be called when the value
|
|
188
|
+
* of the control changes.
|
|
189
|
+
*
|
|
190
|
+
* @param {any} fn - The callback function to be called
|
|
191
|
+
* when the value of the control changes.
|
|
192
|
+
*/
|
|
193
|
+
registerOnChange(fn) {
|
|
194
|
+
this.propagateChange = fn;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Registers a callback function to be called when the form control is "touched".
|
|
198
|
+
*/
|
|
199
|
+
registerOnTouched() {
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Sets the disabled state of the form.
|
|
203
|
+
*
|
|
204
|
+
* @param {boolean} isDisabled - Specifies whether the form should be disabled or not.
|
|
205
|
+
*/
|
|
206
|
+
setDisabledState(isDisabled) {
|
|
207
|
+
if (isDisabled) {
|
|
208
|
+
this.form.disable();
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.form.enable();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Writes a value to the form.
|
|
216
|
+
*
|
|
217
|
+
* @param {any} data - The data to be written.
|
|
218
|
+
*/
|
|
219
|
+
writeValue(data) {
|
|
220
|
+
if (data) {
|
|
221
|
+
this.form.patchValue({
|
|
222
|
+
latitude: data?.latitude,
|
|
223
|
+
longitude: data?.longitude
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Initializes the component and sets up a listener for changes in the form value.
|
|
229
|
+
*/
|
|
230
|
+
ngOnInit() {
|
|
231
|
+
this.form.valueChanges
|
|
232
|
+
.pipe(takeUntil(GuajiritosMap._observableSubject$.asObservable()))
|
|
233
|
+
.subscribe(() => {
|
|
234
|
+
this.propagateChange(this.form.value);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Initializes the map after the view has been initialized.
|
|
239
|
+
*/
|
|
240
|
+
ngAfterViewInit() {
|
|
241
|
+
this.initMap();
|
|
242
|
+
}
|
|
243
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuajiritosMap, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
244
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GuajiritosMap, isStandalone: true, selector: "guajiritos-map", inputs: { appearance: "appearance", color: "color", floatLabel: "floatLabel", subscriptSizing: "subscriptSizing", readonly: "readonly", hiddenForm: "hiddenForm", optionsMap: "optionsMap", circleConfig: "circleConfig", icon: "icon", markers: "markers" }, outputs: { markerDragend: "markerDragend", markerAdded: "markerAdded" }, providers: [
|
|
245
|
+
{
|
|
246
|
+
provide: NG_VALUE_ACCESSOR,
|
|
247
|
+
useExisting: forwardRef(() => GuajiritosMap),
|
|
248
|
+
multi: true
|
|
249
|
+
}
|
|
250
|
+
], ngImport: i0, template: "<div class=\"map-container\">\r\n <div class=\"lat-lng-input\" [formGroup]=\"form\" *ngIf=\"mapMarkers()?.length === 1 && !hiddenForm\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"latitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'latitud' | translate\" [readonly]=\"readonly\" formControlName=\"latitude\">\r\n <mat-error>{{ 'Latitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"longitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'longitud' | translate\" [readonly]=\"readonly\" formControlName=\"longitude\">\r\n <mat-error>{{ 'Longitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div [id]=\"options().id\" class=\"map\"></div>\r\n</div>\r\n", styles: [".map-container{display:flex;flex-direction:column;gap:2rem}.lat-lng-input{display:flex;flex-direction:row;gap:1rem}.map{min-height:400px;max-width:100%}.w-100{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }] }); }
|
|
251
|
+
}
|
|
252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuajiritosMap, decorators: [{
|
|
253
|
+
type: Component,
|
|
254
|
+
args: [{ selector: 'guajiritos-map', standalone: true, imports: [
|
|
255
|
+
MatInputModule,
|
|
256
|
+
ReactiveFormsModule,
|
|
257
|
+
NgIf,
|
|
258
|
+
MatIconModule,
|
|
259
|
+
TranslateModule,
|
|
260
|
+
TitleCasePipe
|
|
261
|
+
], providers: [
|
|
262
|
+
{
|
|
263
|
+
provide: NG_VALUE_ACCESSOR,
|
|
264
|
+
useExisting: forwardRef(() => GuajiritosMap),
|
|
265
|
+
multi: true
|
|
266
|
+
}
|
|
267
|
+
], template: "<div class=\"map-container\">\r\n <div class=\"lat-lng-input\" [formGroup]=\"form\" *ngIf=\"mapMarkers()?.length === 1 && !hiddenForm\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"latitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'latitud' | translate\" [readonly]=\"readonly\" formControlName=\"latitude\">\r\n <mat-error>{{ 'Latitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"longitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'longitud' | translate\" [readonly]=\"readonly\" formControlName=\"longitude\">\r\n <mat-error>{{ 'Longitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div [id]=\"options().id\" class=\"map\"></div>\r\n</div>\r\n", styles: [".map-container{display:flex;flex-direction:column;gap:2rem}.lat-lng-input{display:flex;flex-direction:row;gap:1rem}.map{min-height:400px;max-width:100%}.w-100{width:100%}\n"] }]
|
|
268
|
+
}], propDecorators: { appearance: [{
|
|
269
|
+
type: Input
|
|
270
|
+
}], color: [{
|
|
271
|
+
type: Input
|
|
272
|
+
}], floatLabel: [{
|
|
273
|
+
type: Input
|
|
274
|
+
}], subscriptSizing: [{
|
|
275
|
+
type: Input
|
|
276
|
+
}], readonly: [{
|
|
277
|
+
type: Input
|
|
278
|
+
}], hiddenForm: [{
|
|
279
|
+
type: Input
|
|
280
|
+
}], optionsMap: [{
|
|
281
|
+
type: Input
|
|
282
|
+
}], circleConfig: [{
|
|
283
|
+
type: Input
|
|
284
|
+
}], icon: [{
|
|
285
|
+
type: Input
|
|
286
|
+
}], markers: [{
|
|
287
|
+
type: Input
|
|
288
|
+
}], markerDragend: [{
|
|
289
|
+
type: Output
|
|
290
|
+
}], markerAdded: [{
|
|
291
|
+
type: Output
|
|
292
|
+
}] } });
|
|
293
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3VhamlyaXRvcy1tYXAuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvZ3VhamlyaXRvcy1tYXAvc3JjL2xpYi9ndWFqaXJpdG9zLW1hcC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ndWFqaXJpdG9zLW1hcC9zcmMvbGliL2d1YWppcml0b3MtbWFwLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFFTCxTQUFTLEVBQ1QsWUFBWSxFQUNaLFVBQVUsRUFDVixLQUFLLEVBRUwsTUFBTSxFQUNOLE1BQU0sRUFFUCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsSUFBSSxFQUFFLGFBQWEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxDQUFDLE1BQU0sU0FBUyxDQUFDO0FBQzdCLE9BQU8sRUFBRSxJQUFJLEVBQTRCLFVBQVUsRUFBbUIsTUFBTSxTQUFTLENBQUM7QUFDdEYs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dC1mb3JtLWZpZWxkIFthcHBlYXJhbmNlXT1cImFwcGVhcmFuY2VcIiBbY29sb3JdPVwiY29sb3JcIiBbZmxvYXRMYWJlbF09XCJmbG9hdExhYmVsXCIgY2xhc3M9J3ctMTAwJ1xyXG4gICAgICAgICAgICAgICAgICAgIFtzdWJzY3JpcHRTaXppbmddPVwic3Vic2NyaXB0U2l6aW5nXCI+XHJcbiAgICAgIDxtYXQtbGFiZWw+e3sgXCJsb25naXR1ZFwiIHwgdHJhbnNsYXRlIHwgdGl0bGVjYXNlIH19PC9tYXQtbGFiZWw+XHJcbiAgICAgIDxtYXQtaWNvbiBtYXRTdWZmaXggY2xhc3M9XCJtYXRlcmlhbC1pY29ucy1vdXRsaW5lZFwiIFtjb2xvcl09XCJjb2xvclwiPnBsYWNlPC9tYXQtaWNvbj5cclxuICAgICAgPGlucHV0IG1hdElucHV0IFtwbGFjZWhvbGRlcl09XCInbG9uZ2l0dWQnIHwgdHJhbnNsYXRlXCIgW3JlYWRvbmx5XT1cInJlYWRvbmx5XCIgZm9ybUNvbnRyb2xOYW1lPVwibG9uZ2l0dWRlXCI+XHJcbiAgICAgIDxtYXQtZXJyb3I+e3sgJ0xvbmdpdHVkIHJlcXVlcmlkYScgfCB0cmFuc2xhdGUgfX08L21hdC1lcnJvcj5cclxuICAgIDwvbWF0LWZvcm0tZmllbGQ+XHJcbiAgPC9kaXY+XHJcblxyXG4gIDxkaXYgW2lkXT1cIm9wdGlvbnMoKS5pZFwiIGNsYXNzPVwibWFwXCI+PC9kaXY+XHJcbjwvZGl2PlxyXG4iXX0=
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of guajiritos-map
|
|
3
|
+
*/
|
|
4
|
+
export * from './interfaces/interfaces';
|
|
5
|
+
export * from './lib/guajiritos-map.component';
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2d1YWppcml0b3MtbWFwL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyx5QkFBeUIsQ0FBQztBQUN4QyxjQUFjLGdDQUFnQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcclxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIGd1YWppcml0b3MtbWFwXHJcbiAqL1xyXG5cclxuZXhwb3J0ICogZnJvbSAnLi9pbnRlcmZhY2VzL2ludGVyZmFjZXMnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9ndWFqaXJpdG9zLW1hcC5jb21wb25lbnQnO1xyXG4iXX0=
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, EventEmitter, forwardRef, Component, Input, Output } from '@angular/core';
|
|
3
|
+
import { NgIf, TitleCasePipe } from '@angular/common';
|
|
4
|
+
import * as L from 'leaflet';
|
|
5
|
+
import { layerGroup, icon } from 'leaflet';
|
|
6
|
+
import * as i1 from '@angular/material/input';
|
|
7
|
+
import { MatInputModule } from '@angular/material/input';
|
|
8
|
+
import * as i3 from '@angular/forms';
|
|
9
|
+
import { UntypedFormGroup, UntypedFormControl, Validators, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
|
10
|
+
import * as i4 from '@angular/material/icon';
|
|
11
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
12
|
+
import { Subject, takeUntil } from 'rxjs';
|
|
13
|
+
import * as i5 from '@ngx-translate/core';
|
|
14
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
15
|
+
import * as i2 from '@angular/material/form-field';
|
|
16
|
+
|
|
17
|
+
const DEFAULT_MAP_OPTION = {
|
|
18
|
+
id: 'map',
|
|
19
|
+
center: [23.130257185291036, -82.35626220703126],
|
|
20
|
+
draggable: true,
|
|
21
|
+
zoom: 15,
|
|
22
|
+
updateWithClick: false,
|
|
23
|
+
updateWithDoubleClick: false,
|
|
24
|
+
zoomControl: true,
|
|
25
|
+
borderRadius: '8px',
|
|
26
|
+
scrollWheelZoom: false,
|
|
27
|
+
addMarker: false,
|
|
28
|
+
scrollable: false
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
class GuajiritosMap {
|
|
32
|
+
constructor() {
|
|
33
|
+
this._layerGroup = new L.LayerGroup();
|
|
34
|
+
this.mapMarkers = signal([]);
|
|
35
|
+
this.options = signal(DEFAULT_MAP_OPTION);
|
|
36
|
+
this.circle = signal(null);
|
|
37
|
+
this.form = new UntypedFormGroup({
|
|
38
|
+
latitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required]),
|
|
39
|
+
longitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required])
|
|
40
|
+
});
|
|
41
|
+
this.appearance = 'outline';
|
|
42
|
+
this.color = 'accent';
|
|
43
|
+
this.floatLabel = 'auto';
|
|
44
|
+
this.subscriptSizing = 'dynamic';
|
|
45
|
+
this.readonly = false;
|
|
46
|
+
this.hiddenForm = false;
|
|
47
|
+
/**
|
|
48
|
+
* Default marker icon
|
|
49
|
+
*/
|
|
50
|
+
this.icon = {
|
|
51
|
+
iconSize: [25, 41],
|
|
52
|
+
iconAnchor: [13, 41],
|
|
53
|
+
iconUrl: 'marker-icon.png'
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Se lanza cada vez que cambia un marcador
|
|
57
|
+
*/
|
|
58
|
+
this.markerDragend = new EventEmitter();
|
|
59
|
+
/**
|
|
60
|
+
* Se lanza cada vez que se añade un marcador
|
|
61
|
+
*/
|
|
62
|
+
this.markerAdded = new EventEmitter();
|
|
63
|
+
}
|
|
64
|
+
static { this._observableSubject$ = new Subject(); }
|
|
65
|
+
/**
|
|
66
|
+
* Default map options
|
|
67
|
+
*/
|
|
68
|
+
set optionsMap(options) {
|
|
69
|
+
if (options) {
|
|
70
|
+
this.options.set({
|
|
71
|
+
...this.options(),
|
|
72
|
+
...options
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
;
|
|
77
|
+
/**
|
|
78
|
+
* Add a circle on the map
|
|
79
|
+
*/
|
|
80
|
+
set circleConfig(circle) {
|
|
81
|
+
if (circle) {
|
|
82
|
+
this.circle.set(circle);
|
|
83
|
+
if (this.map) {
|
|
84
|
+
this.addCircle(this.circle()?.center, this.circle()?.radius);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* List of markers
|
|
90
|
+
* @param markers - Markers array
|
|
91
|
+
*/
|
|
92
|
+
set markers(markers) {
|
|
93
|
+
if (markers?.length) {
|
|
94
|
+
this.mapMarkers.set(markers);
|
|
95
|
+
this.form.patchValue({
|
|
96
|
+
latitude: this.mapMarkers()?.[0]?.lat,
|
|
97
|
+
longitude: this.mapMarkers()?.[0]?.lng
|
|
98
|
+
});
|
|
99
|
+
if (this.map && this._layerGroup) {
|
|
100
|
+
this.drawMarkers();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Draws the markers.
|
|
106
|
+
*/
|
|
107
|
+
drawMarkers() {
|
|
108
|
+
if (this.mapMarkers()?.length) {
|
|
109
|
+
this._layerGroup.clearLayers();
|
|
110
|
+
this.mapMarkers().forEach((m) => {
|
|
111
|
+
this.addMarker(m);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Main properties of the map
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
initMap() {
|
|
120
|
+
this.map = L.map(this.options().id, {
|
|
121
|
+
center: this.options()?.center ?? DEFAULT_MAP_OPTION.center,
|
|
122
|
+
dragging: this.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable,
|
|
123
|
+
zoom: this.options()?.zoom ?? DEFAULT_MAP_OPTION.zoom,
|
|
124
|
+
zoomControl: this.options()?.zoomControl || DEFAULT_MAP_OPTION.zoomControl,
|
|
125
|
+
scrollWheelZoom: this.options()?.scrollWheelZoom || DEFAULT_MAP_OPTION.scrollWheelZoom,
|
|
126
|
+
maxZoom: 18,
|
|
127
|
+
minZoom: 3
|
|
128
|
+
});
|
|
129
|
+
this._layerGroup = layerGroup().addTo(this.map);
|
|
130
|
+
L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png').addTo(this.map);
|
|
131
|
+
this.drawMarkers();
|
|
132
|
+
this.changeCenter(new L.LatLng(this.mapMarkers()?.[0]?.lat, this.mapMarkers()?.[0]?.lng));
|
|
133
|
+
if (this.circle()) {
|
|
134
|
+
this.addCircle(this.circle()?.center, this.circle()?.radius);
|
|
135
|
+
}
|
|
136
|
+
if (this.options()?.addMarker) {
|
|
137
|
+
let that = this;
|
|
138
|
+
this.map.on('click', function (e) {
|
|
139
|
+
const newMarker = {
|
|
140
|
+
lat: e.latlng.lat,
|
|
141
|
+
lng: e.latlng.lng,
|
|
142
|
+
draggable: that.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable
|
|
143
|
+
};
|
|
144
|
+
that.addMarker(newMarker);
|
|
145
|
+
that.markerAdded.emit(newMarker);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Add marker to map
|
|
151
|
+
* @param center - center of the circle
|
|
152
|
+
* @param radius - radius of the circle in meters
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
addCircle(center, radius) {
|
|
156
|
+
if (this.map && center) {
|
|
157
|
+
this.drawMarkers();
|
|
158
|
+
L.circleMarker([center?.lat, center?.lng], { radius }).addTo(this.map);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Add marker to map
|
|
163
|
+
* @param marker - Point of the map
|
|
164
|
+
*/
|
|
165
|
+
addMarker(marker) {
|
|
166
|
+
if (this.map && marker) {
|
|
167
|
+
const markerAdd = L.marker({
|
|
168
|
+
lat: marker?.lat,
|
|
169
|
+
lng: marker?.lng
|
|
170
|
+
}, {
|
|
171
|
+
draggable: marker?.draggable ?? true,
|
|
172
|
+
autoPan: true
|
|
173
|
+
}).setIcon(icon({
|
|
174
|
+
iconSize: this.icon?.iconSize,
|
|
175
|
+
iconAnchor: this.icon?.iconAnchor,
|
|
176
|
+
iconUrl: this.icon?.iconUrl
|
|
177
|
+
})).addTo(this._layerGroup);
|
|
178
|
+
markerAdd.on('dragend', () => {
|
|
179
|
+
this.changeCenter(markerAdd.getLatLng());
|
|
180
|
+
this.markerDragend.emit(markerAdd.getLatLng());
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Put the map center on marker position
|
|
186
|
+
* @param marker - Point of the map
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
changeCenter(marker) {
|
|
190
|
+
this.map?.setView(marker);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Propagates the change to other components.
|
|
194
|
+
*
|
|
195
|
+
* @param {any} _ - an arbitrary parameter.
|
|
196
|
+
*/
|
|
197
|
+
propagateChange(_) {
|
|
198
|
+
}
|
|
199
|
+
;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the callback function to be called when the value
|
|
202
|
+
* of the control changes.
|
|
203
|
+
*
|
|
204
|
+
* @param {any} fn - The callback function to be called
|
|
205
|
+
* when the value of the control changes.
|
|
206
|
+
*/
|
|
207
|
+
registerOnChange(fn) {
|
|
208
|
+
this.propagateChange = fn;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Registers a callback function to be called when the form control is "touched".
|
|
212
|
+
*/
|
|
213
|
+
registerOnTouched() {
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Sets the disabled state of the form.
|
|
217
|
+
*
|
|
218
|
+
* @param {boolean} isDisabled - Specifies whether the form should be disabled or not.
|
|
219
|
+
*/
|
|
220
|
+
setDisabledState(isDisabled) {
|
|
221
|
+
if (isDisabled) {
|
|
222
|
+
this.form.disable();
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
this.form.enable();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Writes a value to the form.
|
|
230
|
+
*
|
|
231
|
+
* @param {any} data - The data to be written.
|
|
232
|
+
*/
|
|
233
|
+
writeValue(data) {
|
|
234
|
+
if (data) {
|
|
235
|
+
this.form.patchValue({
|
|
236
|
+
latitude: data?.latitude,
|
|
237
|
+
longitude: data?.longitude
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Initializes the component and sets up a listener for changes in the form value.
|
|
243
|
+
*/
|
|
244
|
+
ngOnInit() {
|
|
245
|
+
this.form.valueChanges
|
|
246
|
+
.pipe(takeUntil(GuajiritosMap._observableSubject$.asObservable()))
|
|
247
|
+
.subscribe(() => {
|
|
248
|
+
this.propagateChange(this.form.value);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Initializes the map after the view has been initialized.
|
|
253
|
+
*/
|
|
254
|
+
ngAfterViewInit() {
|
|
255
|
+
this.initMap();
|
|
256
|
+
}
|
|
257
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuajiritosMap, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
258
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GuajiritosMap, isStandalone: true, selector: "guajiritos-map", inputs: { appearance: "appearance", color: "color", floatLabel: "floatLabel", subscriptSizing: "subscriptSizing", readonly: "readonly", hiddenForm: "hiddenForm", optionsMap: "optionsMap", circleConfig: "circleConfig", icon: "icon", markers: "markers" }, outputs: { markerDragend: "markerDragend", markerAdded: "markerAdded" }, providers: [
|
|
259
|
+
{
|
|
260
|
+
provide: NG_VALUE_ACCESSOR,
|
|
261
|
+
useExisting: forwardRef(() => GuajiritosMap),
|
|
262
|
+
multi: true
|
|
263
|
+
}
|
|
264
|
+
], ngImport: i0, template: "<div class=\"map-container\">\r\n <div class=\"lat-lng-input\" [formGroup]=\"form\" *ngIf=\"mapMarkers()?.length === 1 && !hiddenForm\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"latitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'latitud' | translate\" [readonly]=\"readonly\" formControlName=\"latitude\">\r\n <mat-error>{{ 'Latitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"longitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'longitud' | translate\" [readonly]=\"readonly\" formControlName=\"longitude\">\r\n <mat-error>{{ 'Longitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div [id]=\"options().id\" class=\"map\"></div>\r\n</div>\r\n", styles: [".map-container{display:flex;flex-direction:column;gap:2rem}.lat-lng-input{display:flex;flex-direction:row;gap:1rem}.map{min-height:400px;max-width:100%}.w-100{width:100%}\n"], dependencies: [{ kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i2.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }, { kind: "pipe", type: TitleCasePipe, name: "titlecase" }] }); }
|
|
265
|
+
}
|
|
266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GuajiritosMap, decorators: [{
|
|
267
|
+
type: Component,
|
|
268
|
+
args: [{ selector: 'guajiritos-map', standalone: true, imports: [
|
|
269
|
+
MatInputModule,
|
|
270
|
+
ReactiveFormsModule,
|
|
271
|
+
NgIf,
|
|
272
|
+
MatIconModule,
|
|
273
|
+
TranslateModule,
|
|
274
|
+
TitleCasePipe
|
|
275
|
+
], providers: [
|
|
276
|
+
{
|
|
277
|
+
provide: NG_VALUE_ACCESSOR,
|
|
278
|
+
useExisting: forwardRef(() => GuajiritosMap),
|
|
279
|
+
multi: true
|
|
280
|
+
}
|
|
281
|
+
], template: "<div class=\"map-container\">\r\n <div class=\"lat-lng-input\" [formGroup]=\"form\" *ngIf=\"mapMarkers()?.length === 1 && !hiddenForm\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"latitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'latitud' | translate\" [readonly]=\"readonly\" formControlName=\"latitude\">\r\n <mat-error>{{ 'Latitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"longitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'longitud' | translate\" [readonly]=\"readonly\" formControlName=\"longitude\">\r\n <mat-error>{{ 'Longitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div [id]=\"options().id\" class=\"map\"></div>\r\n</div>\r\n", styles: [".map-container{display:flex;flex-direction:column;gap:2rem}.lat-lng-input{display:flex;flex-direction:row;gap:1rem}.map{min-height:400px;max-width:100%}.w-100{width:100%}\n"] }]
|
|
282
|
+
}], propDecorators: { appearance: [{
|
|
283
|
+
type: Input
|
|
284
|
+
}], color: [{
|
|
285
|
+
type: Input
|
|
286
|
+
}], floatLabel: [{
|
|
287
|
+
type: Input
|
|
288
|
+
}], subscriptSizing: [{
|
|
289
|
+
type: Input
|
|
290
|
+
}], readonly: [{
|
|
291
|
+
type: Input
|
|
292
|
+
}], hiddenForm: [{
|
|
293
|
+
type: Input
|
|
294
|
+
}], optionsMap: [{
|
|
295
|
+
type: Input
|
|
296
|
+
}], circleConfig: [{
|
|
297
|
+
type: Input
|
|
298
|
+
}], icon: [{
|
|
299
|
+
type: Input
|
|
300
|
+
}], markers: [{
|
|
301
|
+
type: Input
|
|
302
|
+
}], markerDragend: [{
|
|
303
|
+
type: Output
|
|
304
|
+
}], markerAdded: [{
|
|
305
|
+
type: Output
|
|
306
|
+
}] } });
|
|
307
|
+
|
|
308
|
+
/*
|
|
309
|
+
* Public API Surface of guajiritos-map
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Generated bundle index. Do not edit.
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
export { DEFAULT_MAP_OPTION, GuajiritosMap };
|
|
317
|
+
//# sourceMappingURL=guajiritos-map.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guajiritos-map.mjs","sources":["../../../projects/guajiritos-map/src/interfaces/interfaces.ts","../../../projects/guajiritos-map/src/lib/guajiritos-map.component.ts","../../../projects/guajiritos-map/src/lib/guajiritos-map.component.html","../../../projects/guajiritos-map/src/public-api.ts","../../../projects/guajiritos-map/src/guajiritos-map.ts"],"sourcesContent":["\r\n/**\r\n * Map options interface\r\n */\r\nexport interface MapOption {\r\n id: string;\r\n center?: [number, number];\r\n draggable?: boolean;\r\n updateWithClick?: boolean;\r\n updateWithDoubleClick?: boolean;\r\n zoom?: number;\r\n borderRadius?: string;\r\n scrollable?: boolean;\r\n zoomControl?: boolean;\r\n scrollWheelZoom?: boolean;\r\n addMarker?: boolean;\r\n}\r\n\r\n/**\r\n * Marker interface\r\n */\r\nexport interface MarkerMap {\r\n lat: number;\r\n lng: number;\r\n draggable?: boolean;\r\n}\r\n\r\n/**\r\n * Icon interface\r\n */\r\nexport interface Icon {\r\n iconSize: [number, number];\r\n iconAnchor: [number, number];\r\n iconUrl: string;\r\n iconRetinaUrl?: string,\r\n shadowUrl?: string,\r\n popupAnchor?: [number, number],\r\n tooltipAnchor?: [number, number],\r\n shadowSize?: [number, number],\r\n}\r\n\r\n/**\r\n * Circle map interface\r\n */\r\nexport interface CircleMap {\r\n center: MarkerMap;\r\n radius: number;\r\n}\r\n\r\nexport const DEFAULT_MAP_OPTION: MapOption = {\r\n id: 'map',\r\n center: [23.130257185291036, -82.35626220703126],\r\n draggable: true,\r\n zoom: 15,\r\n updateWithClick: false,\r\n updateWithDoubleClick: false,\r\n zoomControl: true,\r\n borderRadius: '8px',\r\n scrollWheelZoom: false,\r\n addMarker: false,\r\n scrollable: false\r\n};","import {\r\n AfterViewInit,\r\n Component,\r\n EventEmitter,\r\n forwardRef,\r\n Input,\r\n OnInit,\r\n Output,\r\n signal,\r\n WritableSignal\r\n} from '@angular/core';\r\nimport { NgIf, TitleCasePipe } from '@angular/common';\r\nimport * as L from 'leaflet';\r\nimport { icon, LatLng, LatLngExpression, layerGroup, LayerGroup, Map } from 'leaflet';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport {\r\n ControlValueAccessor,\r\n NG_VALUE_ACCESSOR,\r\n ReactiveFormsModule,\r\n UntypedFormControl,\r\n UntypedFormGroup,\r\n Validators\r\n} from '@angular/forms';\r\nimport { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { ThemePalette } from '@angular/material/core';\r\nimport { Subject, takeUntil } from 'rxjs';\r\nimport { TranslateModule } from '@ngx-translate/core';\r\n\r\nimport { CircleMap, DEFAULT_MAP_OPTION, Icon, MapOption, MarkerMap } from '../interfaces/interfaces';\r\n\r\n@Component({\r\n selector: 'guajiritos-map',\r\n templateUrl: './guajiritos-map.component.html',\r\n styleUrls: ['./guajiritos-map.component.scss'],\r\n standalone: true,\r\n imports: [\r\n MatInputModule,\r\n ReactiveFormsModule,\r\n NgIf,\r\n MatIconModule,\r\n TranslateModule,\r\n TitleCasePipe\r\n ],\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => GuajiritosMap),\r\n multi: true\r\n }\r\n ]\r\n})\r\nexport class GuajiritosMap implements OnInit, AfterViewInit, ControlValueAccessor {\r\n private static _observableSubject$: Subject<void> = new Subject();\r\n private map: Map;\r\n private _layerGroup: LayerGroup = new L.LayerGroup();\r\n public mapMarkers: WritableSignal<MarkerMap[]> = signal([]);\r\n\r\n public options: WritableSignal<MapOption> = signal(DEFAULT_MAP_OPTION);\r\n public circle: WritableSignal<CircleMap> = signal(null);\r\n\r\n public form: UntypedFormGroup = new UntypedFormGroup({\r\n latitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required]),\r\n longitude: new UntypedFormControl({ value: null, disabled: false }, [Validators.required])\r\n });\r\n\r\n @Input() appearance: MatFormFieldAppearance = 'outline';\r\n @Input() color: ThemePalette = 'accent';\r\n @Input() floatLabel: FloatLabelType = 'auto';\r\n @Input() subscriptSizing: SubscriptSizing = 'dynamic';\r\n\r\n @Input() readonly: boolean = false;\r\n @Input() hiddenForm: boolean = false;\r\n\r\n /**\r\n * Default map options\r\n */\r\n @Input() set optionsMap(options: Partial<MapOption>) {\r\n if (options) {\r\n this.options.set({\r\n ...this.options(),\r\n ...options\r\n });\r\n }\r\n };\r\n\r\n /**\r\n * Add a circle on the map\r\n */\r\n @Input() set circleConfig(circle: CircleMap) {\r\n if (circle) {\r\n this.circle.set(circle);\r\n\r\n if (this.map) {\r\n this.addCircle(this.circle()?.center, this.circle()?.radius);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Default marker icon\r\n */\r\n @Input() icon: Icon = {\r\n iconSize: [25, 41],\r\n iconAnchor: [13, 41],\r\n iconUrl: 'marker-icon.png'\r\n };\r\n\r\n /**\r\n * List of markers\r\n * @param markers - Markers array\r\n */\r\n @Input() set markers(markers: MarkerMap[]) {\r\n if (markers?.length) {\r\n this.mapMarkers.set(markers);\r\n\r\n this.form.patchValue({\r\n latitude: this.mapMarkers()?.[0]?.lat,\r\n longitude: this.mapMarkers()?.[0]?.lng\r\n });\r\n\r\n if (this.map && this._layerGroup) {\r\n this.drawMarkers();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Se lanza cada vez que cambia un marcador\r\n */\r\n @Output() markerDragend: EventEmitter<LatLng> = new EventEmitter();\r\n /**\r\n * Se lanza cada vez que se añade un marcador\r\n */\r\n @Output() markerAdded: EventEmitter<MarkerMap> = new EventEmitter();\r\n\r\n /**\r\n * Draws the markers.\r\n */\r\n private drawMarkers(): void {\r\n if (this.mapMarkers()?.length) {\r\n this._layerGroup.clearLayers();\r\n this.mapMarkers().forEach((m: MarkerMap): void => {\r\n this.addMarker(m);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Main properties of the map\r\n * @private\r\n */\r\n private initMap(): void {\r\n this.map = L.map(this.options().id, {\r\n center: this.options()?.center as LatLngExpression ?? DEFAULT_MAP_OPTION.center,\r\n dragging: this.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable,\r\n zoom: this.options()?.zoom ?? DEFAULT_MAP_OPTION.zoom,\r\n zoomControl: this.options()?.zoomControl || DEFAULT_MAP_OPTION.zoomControl,\r\n scrollWheelZoom: this.options()?.scrollWheelZoom || DEFAULT_MAP_OPTION.scrollWheelZoom,\r\n maxZoom: 18,\r\n minZoom: 3\r\n });\r\n\r\n this._layerGroup = layerGroup().addTo(this.map);\r\n\r\n L.tileLayer('http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png').addTo(this.map);\r\n\r\n this.drawMarkers();\r\n this.changeCenter(new L.LatLng(this.mapMarkers()?.[0]?.lat, this.mapMarkers()?.[0]?.lng));\r\n\r\n if (this.circle()) {\r\n this.addCircle(this.circle()?.center, this.circle()?.radius);\r\n }\r\n\r\n if (this.options()?.addMarker) {\r\n let that = this;\r\n this.map.on('click', function (e: L.LeafletMouseEvent): void {\r\n const newMarker: MarkerMap = {\r\n lat: e.latlng.lat,\r\n lng: e.latlng.lng,\r\n draggable: that.options()?.draggable ?? DEFAULT_MAP_OPTION.draggable\r\n };\r\n\r\n that.addMarker(newMarker);\r\n\r\n that.markerAdded.emit(newMarker);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Add marker to map\r\n * @param center - center of the circle\r\n * @param radius - radius of the circle in meters\r\n * @private\r\n */\r\n private addCircle(center: MarkerMap, radius: number): void {\r\n if (this.map && center) {\r\n this.drawMarkers();\r\n L.circleMarker([center?.lat, center?.lng], { radius }).addTo(this.map);\r\n }\r\n }\r\n\r\n /**\r\n * Add marker to map\r\n * @param marker - Point of the map\r\n */\r\n private addMarker(marker: MarkerMap): void {\r\n if (this.map && marker) {\r\n const markerAdd: L.Marker = L.marker({\r\n lat: marker?.lat,\r\n lng: marker?.lng\r\n }, {\r\n draggable: marker?.draggable ?? true,\r\n autoPan: true\r\n }).setIcon(\r\n icon({\r\n iconSize: this.icon?.iconSize,\r\n iconAnchor: this.icon?.iconAnchor,\r\n iconUrl: this.icon?.iconUrl\r\n })\r\n ).addTo(this._layerGroup);\r\n\r\n markerAdd.on('dragend', (): void => {\r\n this.changeCenter(markerAdd.getLatLng());\r\n this.markerDragend.emit(markerAdd.getLatLng());\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Put the map center on marker position\r\n * @param marker - Point of the map\r\n * @public\r\n */\r\n public changeCenter(marker: L.LatLng): void {\r\n this.map?.setView(marker);\r\n }\r\n\r\n /**\r\n * Propagates the change to other components.\r\n *\r\n * @param {any} _ - an arbitrary parameter.\r\n */\r\n propagateChange(_: any): void {\r\n };\r\n\r\n /**\r\n * Sets the callback function to be called when the value\r\n * of the control changes.\r\n *\r\n * @param {any} fn - The callback function to be called\r\n * when the value of the control changes.\r\n */\r\n registerOnChange(fn: any): void {\r\n this.propagateChange = fn;\r\n }\r\n\r\n /**\r\n * Registers a callback function to be called when the form control is \"touched\".\r\n */\r\n registerOnTouched(): void {\r\n }\r\n\r\n /**\r\n * Sets the disabled state of the form.\r\n *\r\n * @param {boolean} isDisabled - Specifies whether the form should be disabled or not.\r\n */\r\n setDisabledState(isDisabled: boolean): void {\r\n if (isDisabled) {\r\n this.form.disable();\r\n } else {\r\n this.form.enable();\r\n }\r\n }\r\n\r\n /**\r\n * Writes a value to the form.\r\n *\r\n * @param {any} data - The data to be written.\r\n */\r\n writeValue(data: any): void {\r\n if (data) {\r\n this.form.patchValue({\r\n latitude: data?.latitude,\r\n longitude: data?.longitude\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the component and sets up a listener for changes in the form value.\r\n */\r\n ngOnInit(): void {\r\n this.form.valueChanges\r\n .pipe(takeUntil(GuajiritosMap._observableSubject$.asObservable()))\r\n .subscribe((): void => {\r\n this.propagateChange(this.form.value);\r\n });\r\n }\r\n\r\n /**\r\n * Initializes the map after the view has been initialized.\r\n */\r\n ngAfterViewInit(): void {\r\n this.initMap();\r\n }\r\n}\r\n","<div class=\"map-container\">\r\n <div class=\"lat-lng-input\" [formGroup]=\"form\" *ngIf=\"mapMarkers()?.length === 1 && !hiddenForm\">\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"latitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'latitud' | translate\" [readonly]=\"readonly\" formControlName=\"latitude\">\r\n <mat-error>{{ 'Latitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n\r\n <mat-form-field [appearance]=\"appearance\" [color]=\"color\" [floatLabel]=\"floatLabel\" class='w-100'\r\n [subscriptSizing]=\"subscriptSizing\">\r\n <mat-label>{{ \"longitud\" | translate | titlecase }}</mat-label>\r\n <mat-icon matSuffix class=\"material-icons-outlined\" [color]=\"color\">place</mat-icon>\r\n <input matInput [placeholder]=\"'longitud' | translate\" [readonly]=\"readonly\" formControlName=\"longitude\">\r\n <mat-error>{{ 'Longitud requerida' | translate }}</mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div [id]=\"options().id\" class=\"map\"></div>\r\n</div>\r\n","/*\r\n * Public API Surface of guajiritos-map\r\n */\r\n\r\nexport * from './interfaces/interfaces';\r\nexport * from './lib/guajiritos-map.component';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiDa,MAAA,kBAAkB,GAAc;AAC3C,IAAA,EAAE,EAAE,KAAK;AACT,IAAA,MAAM,EAAE,CAAC,kBAAkB,EAAE,CAAC,iBAAiB,CAAC;AAChD,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,qBAAqB,EAAE,KAAK;AAC5B,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,YAAY,EAAE,KAAK;AACnB,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,UAAU,EAAE,KAAK;;;MCRN,aAAa,CAAA;AArB1B,IAAA,WAAA,GAAA;AAwBU,QAAA,IAAA,CAAA,WAAW,GAAe,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;AAC9C,QAAA,IAAA,CAAA,UAAU,GAAgC,MAAM,CAAC,EAAE,CAAC,CAAC;AAErD,QAAA,IAAA,CAAA,OAAO,GAA8B,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAChE,QAAA,IAAA,CAAA,MAAM,GAA8B,MAAM,CAAC,IAAI,CAAC,CAAC;Q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AA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAUJ,aAAa,EAAA,UAAA,EAAA,CAAA;kBArBzB,SAAS;+BACE,gBAAgB,EAAA,UAAA,EAGd,IAAI,EACP,OAAA,EAAA;wBACP,cAAc;wBACd,mBAAmB;wBACnB,IAAI;wBACJ,aAAa;wBACb,eAAe;wBACf,aAAa;qBACd,EACU,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,mBAAmB,CAAC;AAC5C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EAAA,o0CAAA,EAAA,MAAA,EAAA,CAAA,8KAAA,CAAA,EAAA,CAAA;8BAgBQ,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBACG,KAAK,EAAA,CAAA;sBAAb,KAAK;gBACG,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBACG,eAAe,EAAA,CAAA;sBAAvB,KAAK;gBAEG,QAAQ,EAAA,CAAA;sBAAhB,KAAK;gBACG,UAAU,EAAA,CAAA;sBAAlB,KAAK;gBAKO,UAAU,EAAA,CAAA;sBAAtB,KAAK;gBAYO,YAAY,EAAA,CAAA;sBAAxB,KAAK;gBAaG,IAAI,EAAA,CAAA;sBAAZ,KAAK;gBAUO,OAAO,EAAA,CAAA;sBAAnB,KAAK;gBAkBI,aAAa,EAAA,CAAA;sBAAtB,MAAM;gBAIG,WAAW,EAAA,CAAA;sBAApB,MAAM;;;AEtIT;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map options interface
|
|
3
|
+
*/
|
|
4
|
+
export interface MapOption {
|
|
5
|
+
id: string;
|
|
6
|
+
center?: [number, number];
|
|
7
|
+
draggable?: boolean;
|
|
8
|
+
updateWithClick?: boolean;
|
|
9
|
+
updateWithDoubleClick?: boolean;
|
|
10
|
+
zoom?: number;
|
|
11
|
+
borderRadius?: string;
|
|
12
|
+
scrollable?: boolean;
|
|
13
|
+
zoomControl?: boolean;
|
|
14
|
+
scrollWheelZoom?: boolean;
|
|
15
|
+
addMarker?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Marker interface
|
|
19
|
+
*/
|
|
20
|
+
export interface MarkerMap {
|
|
21
|
+
lat: number;
|
|
22
|
+
lng: number;
|
|
23
|
+
draggable?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Icon interface
|
|
27
|
+
*/
|
|
28
|
+
export interface Icon {
|
|
29
|
+
iconSize: [number, number];
|
|
30
|
+
iconAnchor: [number, number];
|
|
31
|
+
iconUrl: string;
|
|
32
|
+
iconRetinaUrl?: string;
|
|
33
|
+
shadowUrl?: string;
|
|
34
|
+
popupAnchor?: [number, number];
|
|
35
|
+
tooltipAnchor?: [number, number];
|
|
36
|
+
shadowSize?: [number, number];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Circle map interface
|
|
40
|
+
*/
|
|
41
|
+
export interface CircleMap {
|
|
42
|
+
center: MarkerMap;
|
|
43
|
+
radius: number;
|
|
44
|
+
}
|
|
45
|
+
export declare const DEFAULT_MAP_OPTION: MapOption;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { AfterViewInit, EventEmitter, OnInit, WritableSignal } from '@angular/core';
|
|
2
|
+
import * as L from 'leaflet';
|
|
3
|
+
import { LatLng } from 'leaflet';
|
|
4
|
+
import { ControlValueAccessor, UntypedFormGroup } from '@angular/forms';
|
|
5
|
+
import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field';
|
|
6
|
+
import { ThemePalette } from '@angular/material/core';
|
|
7
|
+
import { CircleMap, Icon, MapOption, MarkerMap } from '../interfaces/interfaces';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export declare class GuajiritosMap implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
10
|
+
private static _observableSubject$;
|
|
11
|
+
private map;
|
|
12
|
+
private _layerGroup;
|
|
13
|
+
mapMarkers: WritableSignal<MarkerMap[]>;
|
|
14
|
+
options: WritableSignal<MapOption>;
|
|
15
|
+
circle: WritableSignal<CircleMap>;
|
|
16
|
+
form: UntypedFormGroup;
|
|
17
|
+
appearance: MatFormFieldAppearance;
|
|
18
|
+
color: ThemePalette;
|
|
19
|
+
floatLabel: FloatLabelType;
|
|
20
|
+
subscriptSizing: SubscriptSizing;
|
|
21
|
+
readonly: boolean;
|
|
22
|
+
hiddenForm: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Default map options
|
|
25
|
+
*/
|
|
26
|
+
set optionsMap(options: Partial<MapOption>);
|
|
27
|
+
/**
|
|
28
|
+
* Add a circle on the map
|
|
29
|
+
*/
|
|
30
|
+
set circleConfig(circle: CircleMap);
|
|
31
|
+
/**
|
|
32
|
+
* Default marker icon
|
|
33
|
+
*/
|
|
34
|
+
icon: Icon;
|
|
35
|
+
/**
|
|
36
|
+
* List of markers
|
|
37
|
+
* @param markers - Markers array
|
|
38
|
+
*/
|
|
39
|
+
set markers(markers: MarkerMap[]);
|
|
40
|
+
/**
|
|
41
|
+
* Se lanza cada vez que cambia un marcador
|
|
42
|
+
*/
|
|
43
|
+
markerDragend: EventEmitter<LatLng>;
|
|
44
|
+
/**
|
|
45
|
+
* Se lanza cada vez que se añade un marcador
|
|
46
|
+
*/
|
|
47
|
+
markerAdded: EventEmitter<MarkerMap>;
|
|
48
|
+
/**
|
|
49
|
+
* Draws the markers.
|
|
50
|
+
*/
|
|
51
|
+
private drawMarkers;
|
|
52
|
+
/**
|
|
53
|
+
* Main properties of the map
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
private initMap;
|
|
57
|
+
/**
|
|
58
|
+
* Add marker to map
|
|
59
|
+
* @param center - center of the circle
|
|
60
|
+
* @param radius - radius of the circle in meters
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private addCircle;
|
|
64
|
+
/**
|
|
65
|
+
* Add marker to map
|
|
66
|
+
* @param marker - Point of the map
|
|
67
|
+
*/
|
|
68
|
+
private addMarker;
|
|
69
|
+
/**
|
|
70
|
+
* Put the map center on marker position
|
|
71
|
+
* @param marker - Point of the map
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
changeCenter(marker: L.LatLng): void;
|
|
75
|
+
/**
|
|
76
|
+
* Propagates the change to other components.
|
|
77
|
+
*
|
|
78
|
+
* @param {any} _ - an arbitrary parameter.
|
|
79
|
+
*/
|
|
80
|
+
propagateChange(_: any): void;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the callback function to be called when the value
|
|
83
|
+
* of the control changes.
|
|
84
|
+
*
|
|
85
|
+
* @param {any} fn - The callback function to be called
|
|
86
|
+
* when the value of the control changes.
|
|
87
|
+
*/
|
|
88
|
+
registerOnChange(fn: any): void;
|
|
89
|
+
/**
|
|
90
|
+
* Registers a callback function to be called when the form control is "touched".
|
|
91
|
+
*/
|
|
92
|
+
registerOnTouched(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the disabled state of the form.
|
|
95
|
+
*
|
|
96
|
+
* @param {boolean} isDisabled - Specifies whether the form should be disabled or not.
|
|
97
|
+
*/
|
|
98
|
+
setDisabledState(isDisabled: boolean): void;
|
|
99
|
+
/**
|
|
100
|
+
* Writes a value to the form.
|
|
101
|
+
*
|
|
102
|
+
* @param {any} data - The data to be written.
|
|
103
|
+
*/
|
|
104
|
+
writeValue(data: any): void;
|
|
105
|
+
/**
|
|
106
|
+
* Initializes the component and sets up a listener for changes in the form value.
|
|
107
|
+
*/
|
|
108
|
+
ngOnInit(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Initializes the map after the view has been initialized.
|
|
111
|
+
*/
|
|
112
|
+
ngAfterViewInit(): void;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GuajiritosMap, never>;
|
|
114
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GuajiritosMap, "guajiritos-map", never, { "appearance": { "alias": "appearance"; "required": false; }; "color": { "alias": "color"; "required": false; }; "floatLabel": { "alias": "floatLabel"; "required": false; }; "subscriptSizing": { "alias": "subscriptSizing"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "hiddenForm": { "alias": "hiddenForm"; "required": false; }; "optionsMap": { "alias": "optionsMap"; "required": false; }; "circleConfig": { "alias": "circleConfig"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "markers": { "alias": "markers"; "required": false; }; }, { "markerDragend": "markerDragend"; "markerAdded": "markerAdded"; }, never, never, true, never>;
|
|
115
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@guajiritos/map",
|
|
3
|
+
"version": "0.0.1-beta",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/cdk": "^16.0.0 || >16.0.0",
|
|
6
|
+
"@angular/common": "^16.0.0 || >16.0.0",
|
|
7
|
+
"@angular/core": "^16.0.0 || >16.0.0",
|
|
8
|
+
"@angular/material": "^16.0.0 || >16.0.0",
|
|
9
|
+
"leaflet": "^1.9.0 || >1.9.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"tslib": "^2.3.0 || >2.3.0"
|
|
13
|
+
},
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"module": "fesm2022/guajiritos-map.mjs",
|
|
16
|
+
"typings": "index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"esm2022": "./esm2022/guajiritos-map.mjs",
|
|
24
|
+
"esm": "./esm2022/guajiritos-map.mjs",
|
|
25
|
+
"default": "./fesm2022/guajiritos-map.mjs"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/public-api.d.ts
ADDED