@ascentgl/ads-ui 20.0.3 → 20.0.6
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/fesm2022/ascentgl-ads-ui-src-lib-components-avatar.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-avatar.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-buttons-button-container.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-buttons-button-container.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-drag-and-drop-list.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-drag-and-drop-list.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-error-page-error-page-code.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-error-page-error-page-code.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-footer-container.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-footer-container.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-footer.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-footer.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-header-container.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-header-container.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-header.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-header.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-logo-primary-logo.mjs +10 -10
- package/fesm2022/ascentgl-ads-ui-src-lib-components-logo-primary-logo.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-map.mjs +439 -0
- package/fesm2022/ascentgl-ads-ui-src-lib-components-map.mjs.map +1 -0
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-bar.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-bar.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-indicator-spinner.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-indicator-spinner.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-spinner.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-progress-indicators-progress-spinner.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-shell-layout.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-shell-layout.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-splash-page.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-splash-page.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui-src-lib-components-tags-tag-container.mjs +7 -7
- package/fesm2022/ascentgl-ads-ui-src-lib-components-tags-tag-container.mjs.map +1 -1
- package/fesm2022/ascentgl-ads-ui.mjs +1014 -585
- package/fesm2022/ascentgl-ads-ui.mjs.map +1 -1
- package/index.d.ts +131 -7
- package/package.json +18 -14
- package/src/assets/sass/ads-ui/overrides/angular-material/_html.scss +0 -1
- package/src/lib/components/map/index.d.ts +133 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, inject, Component, ElementRef, ApplicationRef, effect, createComponent, inputBinding, createEnvironmentInjector, HostListener, signal, Injectable, model, viewChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/google-maps';
|
|
4
|
+
import { GoogleMap, MapDirectionsRenderer, MapAdvancedMarker } from '@angular/google-maps';
|
|
5
|
+
import { Loader } from '@googlemaps/js-api-loader';
|
|
6
|
+
import * as i2 from '@angular/common';
|
|
7
|
+
import { CommonModule } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
class AdsMapMarkerTooltipComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.index = input.required();
|
|
12
|
+
this.marker = computed(() => this.mapMarkersService.markers().at(this.index()));
|
|
13
|
+
this.mapMarkersService = inject(MapMarkersService);
|
|
14
|
+
}
|
|
15
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapMarkerTooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
16
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.6", type: AdsMapMarkerTooltipComponent, isStandalone: false, selector: "ads-map-marker-tooltip", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<span>{{ marker().description }}</span>\n<br>\n<button [type]=\"'button'\">Go somewhere</button>\n", styles: [":host{background-color:#000;color:#fff;position:absolute}button{margin:5px}\n"] }); }
|
|
17
|
+
}
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapMarkerTooltipComponent, decorators: [{
|
|
19
|
+
type: Component,
|
|
20
|
+
args: [{ selector: 'ads-map-marker-tooltip', standalone: false, template: "<span>{{ marker().description }}</span>\n<br>\n<button [type]=\"'button'\">Go somewhere</button>\n", styles: [":host{background-color:#000;color:#fff;position:absolute}button{margin:5px}\n"] }]
|
|
21
|
+
}] });
|
|
22
|
+
|
|
23
|
+
class MapHelper {
|
|
24
|
+
static activateMarker(markers, index) {
|
|
25
|
+
if (markers().at(index)?.active)
|
|
26
|
+
return;
|
|
27
|
+
markers.update((markers) => {
|
|
28
|
+
return markers.map((marker, markerindex) => {
|
|
29
|
+
return {
|
|
30
|
+
...marker,
|
|
31
|
+
...{
|
|
32
|
+
active: markerindex === index,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
class AdsMapMarkerComponent {
|
|
41
|
+
constructor() {
|
|
42
|
+
this.index = input.required();
|
|
43
|
+
this.marker = computed(() => this.mapMarkersService.markers().at(this.index()));
|
|
44
|
+
this.container = input.required();
|
|
45
|
+
this.element = null;
|
|
46
|
+
this.parentElement = null;
|
|
47
|
+
this.uniqueIdentifier = '';
|
|
48
|
+
this.mapMarkersService = inject(MapMarkersService);
|
|
49
|
+
this.ref = inject((ElementRef));
|
|
50
|
+
this.appRef = inject(ApplicationRef);
|
|
51
|
+
effect(() => {
|
|
52
|
+
if (this.marker().active) {
|
|
53
|
+
this.getElement()?.classList.add('active');
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.getElement()?.classList.remove('active');
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
ngOnInit() {
|
|
61
|
+
this.uniqueIdentifier = `ads-map-marker_${this.index()}`;
|
|
62
|
+
this.ref.nativeElement.classList.add(this.uniqueIdentifier);
|
|
63
|
+
}
|
|
64
|
+
onClick() {
|
|
65
|
+
MapHelper.activateMarker(this.mapMarkersService.markers, this.index());
|
|
66
|
+
}
|
|
67
|
+
onMouseEnter() {
|
|
68
|
+
this.tooltipRef = createComponent(AdsMapMarkerTooltipComponent, {
|
|
69
|
+
environmentInjector: createEnvironmentInjector([
|
|
70
|
+
{
|
|
71
|
+
provide: MapMarkersService,
|
|
72
|
+
useValue: this.mapMarkersService,
|
|
73
|
+
},
|
|
74
|
+
], this.appRef.injector),
|
|
75
|
+
bindings: [inputBinding('index', () => this.index())],
|
|
76
|
+
});
|
|
77
|
+
this.ref.nativeElement.append(this.tooltipRef.location.nativeElement);
|
|
78
|
+
this.tooltipRef.changeDetectorRef.detectChanges();
|
|
79
|
+
this.setParentZIndex(1000);
|
|
80
|
+
}
|
|
81
|
+
onMouseLeave() {
|
|
82
|
+
this.setParentZIndex(0);
|
|
83
|
+
this.ref.nativeElement.removeChild(this.tooltipRef?.location.nativeElement);
|
|
84
|
+
this.tooltipRef?.destroy();
|
|
85
|
+
}
|
|
86
|
+
getElement() {
|
|
87
|
+
if (!this.element) {
|
|
88
|
+
this.element = this.container().querySelector(`.${this.uniqueIdentifier} .marker`);
|
|
89
|
+
}
|
|
90
|
+
return this.element;
|
|
91
|
+
}
|
|
92
|
+
getParentElement() {
|
|
93
|
+
if (!this.parentElement) {
|
|
94
|
+
this.parentElement = this.getElement()?.parentElement?.parentElement ?? null;
|
|
95
|
+
}
|
|
96
|
+
return this.parentElement;
|
|
97
|
+
}
|
|
98
|
+
setParentZIndex(index) {
|
|
99
|
+
const parent = this.getParentElement();
|
|
100
|
+
if (parent) {
|
|
101
|
+
parent.style.zIndex = index.toString();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
105
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.6", type: AdsMapMarkerComponent, isStandalone: false, selector: "ads-map-marker", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "onClick()", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0, template: "<div class=\"marker\" [class.active]=\"marker().active\">\n <img src=\"https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png\" alt=\"point\" />\n</div>\n\n\n", styles: [".active{border:solid 2px red}:host{cursor:pointer}\n"] }); }
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapMarkerComponent, decorators: [{
|
|
108
|
+
type: Component,
|
|
109
|
+
args: [{ selector: 'ads-map-marker', standalone: false, template: "<div class=\"marker\" [class.active]=\"marker().active\">\n <img src=\"https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png\" alt=\"point\" />\n</div>\n\n\n", styles: [".active{border:solid 2px red}:host{cursor:pointer}\n"] }]
|
|
110
|
+
}], ctorParameters: () => [], propDecorators: { onClick: [{
|
|
111
|
+
type: HostListener,
|
|
112
|
+
args: ['click']
|
|
113
|
+
}], onMouseEnter: [{
|
|
114
|
+
type: HostListener,
|
|
115
|
+
args: ['mouseenter']
|
|
116
|
+
}], onMouseLeave: [{
|
|
117
|
+
type: HostListener,
|
|
118
|
+
args: ['mouseleave']
|
|
119
|
+
}] } });
|
|
120
|
+
|
|
121
|
+
class MapMarkersService {
|
|
122
|
+
constructor() {
|
|
123
|
+
this.markers = signal([]);
|
|
124
|
+
this.markerOptions = signal([]);
|
|
125
|
+
this.appRef = inject(ApplicationRef);
|
|
126
|
+
effect(() => {
|
|
127
|
+
this.markerOptions.set(this.markers().map((marker, index) => {
|
|
128
|
+
return {
|
|
129
|
+
title: marker.title,
|
|
130
|
+
position: marker.position,
|
|
131
|
+
content: this.createMarkerComponent(index),
|
|
132
|
+
};
|
|
133
|
+
}));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
createMarkerComponent(index) {
|
|
137
|
+
const componentRef = createComponent(AdsMapMarkerComponent, {
|
|
138
|
+
environmentInjector: createEnvironmentInjector([
|
|
139
|
+
{
|
|
140
|
+
provide: MapMarkersService,
|
|
141
|
+
useValue: this,
|
|
142
|
+
},
|
|
143
|
+
], this.appRef.injector),
|
|
144
|
+
bindings: [inputBinding('index', () => index), inputBinding('container', () => this.container)],
|
|
145
|
+
});
|
|
146
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
147
|
+
return componentRef.location.nativeElement;
|
|
148
|
+
}
|
|
149
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapMarkersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
150
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapMarkersService }); }
|
|
151
|
+
}
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapMarkersService, decorators: [{
|
|
153
|
+
type: Injectable
|
|
154
|
+
}], ctorParameters: () => [] });
|
|
155
|
+
|
|
156
|
+
class MapOptionsService {
|
|
157
|
+
constructor() {
|
|
158
|
+
this.options = signal({});
|
|
159
|
+
this.center = computed(() => {
|
|
160
|
+
const center = this.mapMarkersService.markers().find((marker) => marker.active)?.position;
|
|
161
|
+
if (center) {
|
|
162
|
+
return center;
|
|
163
|
+
}
|
|
164
|
+
return this.mapOptions().center;
|
|
165
|
+
});
|
|
166
|
+
this.mapOptions = computed(() => {
|
|
167
|
+
return { ...this.defaultMapOptions, ...this.options() };
|
|
168
|
+
});
|
|
169
|
+
this.defaultMapOptions = {
|
|
170
|
+
center: { lat: 40.73061, lng: -73.935242 },
|
|
171
|
+
zoom: 13,
|
|
172
|
+
mapTypeControl: false,
|
|
173
|
+
streetViewControl: false,
|
|
174
|
+
};
|
|
175
|
+
this.mapMarkersService = inject(MapMarkersService);
|
|
176
|
+
}
|
|
177
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapOptionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
178
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapOptionsService }); }
|
|
179
|
+
}
|
|
180
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapOptionsService, decorators: [{
|
|
181
|
+
type: Injectable
|
|
182
|
+
}] });
|
|
183
|
+
|
|
184
|
+
class MapLoaderService {
|
|
185
|
+
constructor() {
|
|
186
|
+
this.loader = new Loader({
|
|
187
|
+
apiKey: 'AIzaSyDy2j_-0JSJrFCFTDfPozh0DHTAytfxNSU', // 🔑 Replace with your key
|
|
188
|
+
version: 'weekly', // or 'beta' if using AdvancedMarkerElement
|
|
189
|
+
libraries: ['core', 'routes'], // if needed for advanced features
|
|
190
|
+
});
|
|
191
|
+
this.isLoaded = false;
|
|
192
|
+
}
|
|
193
|
+
async load() {
|
|
194
|
+
if (!this.isLoaded) {
|
|
195
|
+
await this.loader.importLibrary('core');
|
|
196
|
+
await this.loader.importLibrary('routes');
|
|
197
|
+
return window.google;
|
|
198
|
+
}
|
|
199
|
+
return Promise.resolve(window.google);
|
|
200
|
+
}
|
|
201
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
202
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapLoaderService, providedIn: 'root' }); }
|
|
203
|
+
}
|
|
204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapLoaderService, decorators: [{
|
|
205
|
+
type: Injectable,
|
|
206
|
+
args: [{
|
|
207
|
+
providedIn: 'root',
|
|
208
|
+
}]
|
|
209
|
+
}] });
|
|
210
|
+
|
|
211
|
+
var CustomMapTypeId;
|
|
212
|
+
(function (CustomMapTypeId) {
|
|
213
|
+
CustomMapTypeId["CUSTOM_LIGHT"] = "customLight";
|
|
214
|
+
CustomMapTypeId["CUSTOM_DARK"] = "customDark";
|
|
215
|
+
})(CustomMapTypeId || (CustomMapTypeId = {}));
|
|
216
|
+
|
|
217
|
+
class MapConstructorService {
|
|
218
|
+
constructor() {
|
|
219
|
+
this.mapTypeId = signal(CustomMapTypeId.CUSTOM_LIGHT);
|
|
220
|
+
this.isLoaded = signal(false);
|
|
221
|
+
this.map = signal(undefined);
|
|
222
|
+
this.lightStyles = [
|
|
223
|
+
{
|
|
224
|
+
elementType: 'geometry',
|
|
225
|
+
stylers: [{ color: '#b2b6c6' }],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
featureType: 'water',
|
|
229
|
+
elementType: 'geometry',
|
|
230
|
+
stylers: [{ color: '#017d93' }],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
featureType: 'road',
|
|
234
|
+
elementType: 'geometry',
|
|
235
|
+
stylers: [{ color: '#041f41' }],
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
featureType: 'poi',
|
|
239
|
+
elementType: 'all',
|
|
240
|
+
stylers: [{ visibility: 'off' }],
|
|
241
|
+
},
|
|
242
|
+
];
|
|
243
|
+
this.darkStyles = [
|
|
244
|
+
{
|
|
245
|
+
elementType: 'geometry',
|
|
246
|
+
stylers: [{ color: '#041f41' }],
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
featureType: 'water',
|
|
250
|
+
elementType: 'geometry',
|
|
251
|
+
stylers: [{ color: '#366d9e' }],
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
featureType: 'road',
|
|
255
|
+
elementType: 'geometry',
|
|
256
|
+
stylers: [{ color: '#b2b6c6' }],
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
featureType: 'poi',
|
|
260
|
+
elementType: 'all',
|
|
261
|
+
stylers: [{ visibility: 'off' }],
|
|
262
|
+
},
|
|
263
|
+
];
|
|
264
|
+
this.mapsLoader = inject(MapLoaderService);
|
|
265
|
+
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
266
|
+
if (isDarkMode) {
|
|
267
|
+
this.mapTypeId.set(CustomMapTypeId.CUSTOM_DARK);
|
|
268
|
+
}
|
|
269
|
+
this.configure();
|
|
270
|
+
}
|
|
271
|
+
configure() {
|
|
272
|
+
this.mapsLoader.load().then(() => {
|
|
273
|
+
const styledMapTypeLight = new google.maps.StyledMapType(this.lightStyles);
|
|
274
|
+
const styledMapTypeDark = new google.maps.StyledMapType(this.darkStyles);
|
|
275
|
+
this.isLoaded.set(true);
|
|
276
|
+
setTimeout(() => {
|
|
277
|
+
const map = this.map();
|
|
278
|
+
if (map) {
|
|
279
|
+
map.controls[google.maps.ControlPosition.TOP_CENTER].push(this.createCenterControl());
|
|
280
|
+
map.mapTypes.set(CustomMapTypeId.CUSTOM_DARK, styledMapTypeDark);
|
|
281
|
+
map.mapTypes.set(CustomMapTypeId.CUSTOM_LIGHT, styledMapTypeLight);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
createCenterControl() {
|
|
287
|
+
const controlButton = document.createElement('button');
|
|
288
|
+
// Set CSS for the control.
|
|
289
|
+
controlButton.style.backgroundColor = '#fff';
|
|
290
|
+
controlButton.style.border = '2px solid #fff';
|
|
291
|
+
controlButton.style.borderRadius = '3px';
|
|
292
|
+
controlButton.style.boxShadow = '0 2px 6px rgba(0,0,0,.3)';
|
|
293
|
+
controlButton.style.color = 'rgb(25,25,25)';
|
|
294
|
+
controlButton.style.cursor = 'pointer';
|
|
295
|
+
controlButton.style.fontFamily = 'Roboto,Arial,sans-serif';
|
|
296
|
+
controlButton.style.fontSize = '16px';
|
|
297
|
+
controlButton.style.lineHeight = '38px';
|
|
298
|
+
controlButton.style.margin = '8px 0 22px';
|
|
299
|
+
controlButton.style.padding = '0 5px';
|
|
300
|
+
controlButton.style.textAlign = 'center';
|
|
301
|
+
controlButton.textContent = 'Toggle Theme';
|
|
302
|
+
controlButton.title = 'Click to recenter the map';
|
|
303
|
+
controlButton.type = 'button';
|
|
304
|
+
controlButton.addEventListener('click', () => {
|
|
305
|
+
this.toggleTheme();
|
|
306
|
+
});
|
|
307
|
+
return controlButton;
|
|
308
|
+
}
|
|
309
|
+
toggleTheme() {
|
|
310
|
+
if (this.mapTypeId() === CustomMapTypeId.CUSTOM_DARK) {
|
|
311
|
+
this.mapTypeId.set(CustomMapTypeId.CUSTOM_LIGHT);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
this.mapTypeId.set(CustomMapTypeId.CUSTOM_DARK);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapConstructorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
318
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapConstructorService }); }
|
|
319
|
+
}
|
|
320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapConstructorService, decorators: [{
|
|
321
|
+
type: Injectable
|
|
322
|
+
}], ctorParameters: () => [] });
|
|
323
|
+
|
|
324
|
+
class MapDirectionsService {
|
|
325
|
+
constructor() {
|
|
326
|
+
this.directions = signal(null);
|
|
327
|
+
effect(() => {
|
|
328
|
+
if (this.directions()) {
|
|
329
|
+
// const directionsService = new google.maps.DirectionsService();
|
|
330
|
+
// directionsService
|
|
331
|
+
// .route(
|
|
332
|
+
// {
|
|
333
|
+
// origin: origin,
|
|
334
|
+
// destination: destination,
|
|
335
|
+
// travelMode: google.maps.TravelMode.DRIVING,
|
|
336
|
+
// },
|
|
337
|
+
// (response, status) => {
|
|
338
|
+
// if (status === google.maps.DirectionsStatus.OK) {
|
|
339
|
+
// this.directions.set(response);
|
|
340
|
+
// } else {
|
|
341
|
+
// console.error('Directions request failed due to ' + status);
|
|
342
|
+
// }
|
|
343
|
+
// },
|
|
344
|
+
// )
|
|
345
|
+
// .then();
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapDirectionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
350
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapDirectionsService }); }
|
|
351
|
+
}
|
|
352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapDirectionsService, decorators: [{
|
|
353
|
+
type: Injectable
|
|
354
|
+
}], ctorParameters: () => [] });
|
|
355
|
+
|
|
356
|
+
class MapPolylineService {
|
|
357
|
+
constructor() {
|
|
358
|
+
this.markers = signal([]);
|
|
359
|
+
this.map = signal(undefined);
|
|
360
|
+
this.polyline = signal(undefined);
|
|
361
|
+
effect(() => {
|
|
362
|
+
const map = this.map();
|
|
363
|
+
if (map) {
|
|
364
|
+
const path = this.markers().map((marker) => {
|
|
365
|
+
return {
|
|
366
|
+
lat: marker.position.lat,
|
|
367
|
+
lng: marker.position.lng,
|
|
368
|
+
};
|
|
369
|
+
});
|
|
370
|
+
this.polyline.set(new google.maps.Polyline({
|
|
371
|
+
path,
|
|
372
|
+
geodesic: true,
|
|
373
|
+
strokeColor: '#FF0000',
|
|
374
|
+
strokeOpacity: 1.0,
|
|
375
|
+
strokeWeight: 2,
|
|
376
|
+
}));
|
|
377
|
+
if (map.googleMap) {
|
|
378
|
+
this.polyline()?.setMap(map.googleMap);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapPolylineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
384
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapPolylineService }); }
|
|
385
|
+
}
|
|
386
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MapPolylineService, decorators: [{
|
|
387
|
+
type: Injectable
|
|
388
|
+
}], ctorParameters: () => [] });
|
|
389
|
+
|
|
390
|
+
class AdsMapComponent {
|
|
391
|
+
constructor() {
|
|
392
|
+
this.markers = model([]);
|
|
393
|
+
this.map = viewChild(GoogleMap);
|
|
394
|
+
this.mapOptionsService = inject(MapOptionsService);
|
|
395
|
+
this.mapMarkersService = inject(MapMarkersService);
|
|
396
|
+
this.mapDirectionsService = inject(MapDirectionsService);
|
|
397
|
+
this.mapPolylineService = inject(MapPolylineService);
|
|
398
|
+
this.mapConstructorService = inject(MapConstructorService);
|
|
399
|
+
this.ref = inject((ElementRef));
|
|
400
|
+
this.mapMarkersService.markers = this.markers;
|
|
401
|
+
this.mapMarkersService.container = this.ref.nativeElement;
|
|
402
|
+
this.mapPolylineService.markers = this.markers;
|
|
403
|
+
this.mapPolylineService.map = this.map;
|
|
404
|
+
this.mapConstructorService.map = this.map;
|
|
405
|
+
}
|
|
406
|
+
getMapTypeId() {
|
|
407
|
+
return this.mapConstructorService.mapTypeId();
|
|
408
|
+
}
|
|
409
|
+
getIsLoaded() {
|
|
410
|
+
return this.mapConstructorService.isLoaded();
|
|
411
|
+
}
|
|
412
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
413
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: AdsMapComponent, isStandalone: false, selector: "ads-map", inputs: { markers: { classPropertyName: "markers", publicName: "markers", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { markers: "markersChange" }, providers: [MapOptionsService, MapMarkersService, MapConstructorService, MapDirectionsService, MapPolylineService], viewQueries: [{ propertyName: "map", first: true, predicate: GoogleMap, descendants: true, isSignal: true }], ngImport: i0, template: "@if (this.getIsLoaded()) {\n {{mapMarkersService.markers()|json}}\n <google-map [mapTypeId]=\"getMapTypeId()\" [mapId]=\"'test'\"\n [options]=\"mapOptionsService.mapOptions()\" [center]=\"mapOptionsService.center()!\">\n @if (mapDirectionsService.directions()) {\n <map-directions-renderer [directions]=\"mapDirectionsService.directions()!\" />\n }\n @for (marker of mapMarkersService.markerOptions(); track $index) {\n <map-advanced-marker [options]=\"marker\" />\n }\n </google-map>\n}\n", styles: [""], dependencies: [{ kind: "component", type: i1.GoogleMap, selector: "google-map", inputs: ["height", "width", "mapId", "mapTypeId", "center", "zoom", "options"], outputs: ["mapInitialized", "authFailure", "boundsChanged", "centerChanged", "mapClick", "mapDblclick", "mapDrag", "mapDragend", "mapDragstart", "headingChanged", "idle", "maptypeidChanged", "mapMousemove", "mapMouseout", "mapMouseover", "projectionChanged", "mapRightclick", "tilesloaded", "tiltChanged", "zoomChanged"], exportAs: ["googleMap"] }, { kind: "directive", type: i1.MapDirectionsRenderer, selector: "map-directions-renderer", inputs: ["directions", "options"], outputs: ["directionsChanged", "directionsRendererInitialized"], exportAs: ["mapDirectionsRenderer"] }, { kind: "directive", type: i1.MapAdvancedMarker, selector: "map-advanced-marker", inputs: ["title", "position", "content", "gmpDraggable", "options", "zIndex"], outputs: ["mapClick", "mapDblclick", "mapMouseout", "mapMouseover", "mapMouseup", "mapRightclick", "mapDrag", "mapDragend", "mapDragstart", "markerInitialized"], exportAs: ["mapAdvancedMarker"] }, { kind: "pipe", type: i2.JsonPipe, name: "json" }] }); }
|
|
414
|
+
}
|
|
415
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapComponent, decorators: [{
|
|
416
|
+
type: Component,
|
|
417
|
+
args: [{ selector: 'ads-map', standalone: false, providers: [MapOptionsService, MapMarkersService, MapConstructorService, MapDirectionsService, MapPolylineService], template: "@if (this.getIsLoaded()) {\n {{mapMarkersService.markers()|json}}\n <google-map [mapTypeId]=\"getMapTypeId()\" [mapId]=\"'test'\"\n [options]=\"mapOptionsService.mapOptions()\" [center]=\"mapOptionsService.center()!\">\n @if (mapDirectionsService.directions()) {\n <map-directions-renderer [directions]=\"mapDirectionsService.directions()!\" />\n }\n @for (marker of mapMarkersService.markerOptions(); track $index) {\n <map-advanced-marker [options]=\"marker\" />\n }\n </google-map>\n}\n" }]
|
|
418
|
+
}], ctorParameters: () => [] });
|
|
419
|
+
|
|
420
|
+
class AdsMapModule {
|
|
421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
422
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.6", ngImport: i0, type: AdsMapModule, declarations: [AdsMapComponent, AdsMapMarkerComponent, AdsMapMarkerTooltipComponent], imports: [CommonModule, GoogleMap, MapDirectionsRenderer, MapAdvancedMarker], exports: [AdsMapComponent, AdsMapMarkerComponent, AdsMapMarkerTooltipComponent] }); }
|
|
423
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapModule, imports: [CommonModule, GoogleMap] }); }
|
|
424
|
+
}
|
|
425
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: AdsMapModule, decorators: [{
|
|
426
|
+
type: NgModule,
|
|
427
|
+
args: [{
|
|
428
|
+
declarations: [AdsMapComponent, AdsMapMarkerComponent, AdsMapMarkerTooltipComponent],
|
|
429
|
+
imports: [CommonModule, GoogleMap, MapDirectionsRenderer, MapAdvancedMarker],
|
|
430
|
+
exports: [AdsMapComponent, AdsMapMarkerComponent, AdsMapMarkerTooltipComponent],
|
|
431
|
+
}]
|
|
432
|
+
}] });
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Generated bundle index. Do not edit.
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
export { AdsMapComponent, AdsMapMarkerComponent, AdsMapMarkerTooltipComponent, AdsMapModule };
|
|
439
|
+
//# sourceMappingURL=ascentgl-ads-ui-src-lib-components-map.mjs.map
|