@smarterplan/ngx-smarterplan-locations 0.2.44 → 0.2.45

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.
Files changed (152) hide show
  1. package/esm2020/lib/components/carousel/carousel.component.mjs +28 -0
  2. package/esm2020/lib/components/chevron/chevron.component.mjs +18 -0
  3. package/esm2020/lib/components/detail-location/detail-location.component.mjs +168 -0
  4. package/esm2020/lib/components/form-location/form-location.component.mjs +237 -0
  5. package/esm2020/lib/components/images/images.component.mjs +107 -0
  6. package/esm2020/lib/components/locations/locations.component.mjs +145 -0
  7. package/esm2020/lib/components/locations/map/map-popup/map-popup.component.mjs +66 -0
  8. package/esm2020/lib/components/locations/map/map.component.mjs +91 -0
  9. package/esm2020/lib/components/plan-legend/plan-legend.component.mjs +47 -0
  10. package/esm2020/lib/components/plans/calibration/calibration.component.mjs +468 -0
  11. package/esm2020/lib/components/plans/edit-plan/edit-plan.component.mjs +324 -0
  12. package/esm2020/lib/components/plans/plans.component.mjs +225 -0
  13. package/esm2020/lib/components/tab-navigation/tab-navigation.component.mjs +41 -0
  14. package/esm2020/lib/components/visits/visits.component.mjs +283 -0
  15. package/esm2020/lib/components/zones/add-audio-zone/add-audio-zone.component.mjs +230 -0
  16. package/esm2020/lib/components/zones/add-zone/add-zone.component.mjs +315 -0
  17. package/esm2020/lib/components/zones/add-zone/selection/selection.component.mjs +77 -0
  18. package/esm2020/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.mjs +502 -0
  19. package/esm2020/lib/components/zones/zones.component.mjs +268 -0
  20. package/esm2020/lib/helper.service.mjs +134 -0
  21. package/esm2020/lib/ngx-smarterplan-location-routing.module.mjs +49 -0
  22. package/esm2020/lib/ngx-smarterplan-locations.module.mjs +125 -0
  23. package/esm2020/lib/ngx-smarterplan-locations.service.mjs +14 -0
  24. package/esm2020/lib/pipes/count-audio-sweeps.pipe.mjs +27 -0
  25. package/esm2020/lib/radio-button/radio-button.component.mjs +26 -0
  26. package/esm2020/public-api.mjs +9 -0
  27. package/esm2020/smarterplan-ngx-smarterplan-locations.mjs +5 -0
  28. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs +3991 -0
  29. package/fesm2015/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  30. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs +3828 -0
  31. package/fesm2020/smarterplan-ngx-smarterplan-locations.mjs.map +1 -0
  32. package/lib/components/carousel/carousel.component.d.ts +12 -0
  33. package/lib/components/chevron/chevron.component.d.ts +9 -0
  34. package/lib/components/detail-location/detail-location.component.d.ts +55 -0
  35. package/lib/components/form-location/form-location.component.d.ts +45 -0
  36. package/lib/components/images/images.component.d.ts +33 -0
  37. package/lib/components/locations/locations.component.d.ts +51 -0
  38. package/lib/components/locations/map/map-popup/map-popup.component.d.ts +22 -0
  39. package/lib/components/locations/map/map.component.d.ts +22 -0
  40. package/lib/components/plan-legend/plan-legend.component.d.ts +14 -0
  41. package/lib/components/plans/calibration/calibration.component.d.ts +140 -0
  42. package/lib/components/plans/edit-plan/edit-plan.component.d.ts +55 -0
  43. package/lib/components/plans/plans.component.d.ts +63 -0
  44. package/lib/components/tab-navigation/tab-navigation.component.d.ts +13 -0
  45. package/lib/components/visits/visits.component.d.ts +62 -0
  46. package/lib/components/zones/add-audio-zone/add-audio-zone.component.d.ts +63 -0
  47. package/lib/components/zones/add-zone/add-zone.component.d.ts +69 -0
  48. package/lib/components/zones/add-zone/selection/selection.component.d.ts +44 -0
  49. package/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.d.ts +107 -0
  50. package/lib/components/zones/zones.component.d.ts +73 -0
  51. package/lib/helper.service.d.ts +53 -0
  52. package/lib/ngx-smarterplan-location-routing.module.d.ts +7 -0
  53. package/lib/ngx-smarterplan-locations.module.d.ts +36 -0
  54. package/lib/ngx-smarterplan-locations.service.d.ts +6 -0
  55. package/lib/pipes/count-audio-sweeps.pipe.d.ts +10 -0
  56. package/lib/radio-button/radio-button.component.d.ts +12 -0
  57. package/package.json +22 -5
  58. package/{src/public-api.ts → public-api.d.ts} +4 -11
  59. package/smarterplan-ngx-smarterplan-locations.d.ts +5 -0
  60. package/.browserslistrc +0 -16
  61. package/karma.conf.js +0 -44
  62. package/ng-package.json +0 -7
  63. package/src/lib/components/carousel/carousel.component.html +0 -13
  64. package/src/lib/components/carousel/carousel.component.scss +0 -0
  65. package/src/lib/components/carousel/carousel.component.spec.ts +0 -25
  66. package/src/lib/components/carousel/carousel.component.ts +0 -31
  67. package/src/lib/components/chevron/chevron.component.html +0 -5
  68. package/src/lib/components/chevron/chevron.component.scss +0 -16
  69. package/src/lib/components/chevron/chevron.component.spec.ts +0 -25
  70. package/src/lib/components/chevron/chevron.component.ts +0 -17
  71. package/src/lib/components/detail-location/detail-location.component.html +0 -108
  72. package/src/lib/components/detail-location/detail-location.component.scss +0 -0
  73. package/src/lib/components/detail-location/detail-location.component.spec.ts +0 -25
  74. package/src/lib/components/detail-location/detail-location.component.ts +0 -215
  75. package/src/lib/components/form-location/form-location.component.html +0 -160
  76. package/src/lib/components/form-location/form-location.component.scss +0 -62
  77. package/src/lib/components/form-location/form-location.component.spec.ts +0 -25
  78. package/src/lib/components/form-location/form-location.component.ts +0 -274
  79. package/src/lib/components/images/images.component.html +0 -27
  80. package/src/lib/components/images/images.component.scss +0 -0
  81. package/src/lib/components/images/images.component.spec.ts +0 -25
  82. package/src/lib/components/images/images.component.ts +0 -133
  83. package/src/lib/components/locations/locations.component.html +0 -63
  84. package/src/lib/components/locations/locations.component.scss +0 -121
  85. package/src/lib/components/locations/locations.component.spec.ts +0 -25
  86. package/src/lib/components/locations/locations.component.ts +0 -186
  87. package/src/lib/components/locations/map/map-popup/map-popup.component.html +0 -11
  88. package/src/lib/components/locations/map/map-popup/map-popup.component.scss +0 -51
  89. package/src/lib/components/locations/map/map-popup/map-popup.component.spec.ts +0 -25
  90. package/src/lib/components/locations/map/map-popup/map-popup.component.ts +0 -79
  91. package/src/lib/components/locations/map/map.component.html +0 -2
  92. package/src/lib/components/locations/map/map.component.scss +0 -0
  93. package/src/lib/components/locations/map/map.component.spec.ts +0 -25
  94. package/src/lib/components/locations/map/map.component.ts +0 -111
  95. package/src/lib/components/plan-legend/plan-legend.component.html +0 -9
  96. package/src/lib/components/plan-legend/plan-legend.component.scss +0 -38
  97. package/src/lib/components/plan-legend/plan-legend.component.spec.ts +0 -25
  98. package/src/lib/components/plan-legend/plan-legend.component.ts +0 -50
  99. package/src/lib/components/plans/calibration/calibration.component.html +0 -98
  100. package/src/lib/components/plans/calibration/calibration.component.scss +0 -136
  101. package/src/lib/components/plans/calibration/calibration.component.spec.ts +0 -25
  102. package/src/lib/components/plans/calibration/calibration.component.ts +0 -603
  103. package/src/lib/components/plans/edit-plan/edit-plan.component.html +0 -77
  104. package/src/lib/components/plans/edit-plan/edit-plan.component.scss +0 -9
  105. package/src/lib/components/plans/edit-plan/edit-plan.component.spec.ts +0 -25
  106. package/src/lib/components/plans/edit-plan/edit-plan.component.ts +0 -421
  107. package/src/lib/components/plans/plans.component.html +0 -102
  108. package/src/lib/components/plans/plans.component.scss +0 -24
  109. package/src/lib/components/plans/plans.component.spec.ts +0 -25
  110. package/src/lib/components/plans/plans.component.ts +0 -305
  111. package/src/lib/components/tab-navigation/tab-navigation.component.html +0 -7
  112. package/src/lib/components/tab-navigation/tab-navigation.component.scss +0 -27
  113. package/src/lib/components/tab-navigation/tab-navigation.component.spec.ts +0 -25
  114. package/src/lib/components/tab-navigation/tab-navigation.component.ts +0 -35
  115. package/src/lib/components/visits/visits.component.html +0 -134
  116. package/src/lib/components/visits/visits.component.scss +0 -24
  117. package/src/lib/components/visits/visits.component.spec.ts +0 -25
  118. package/src/lib/components/visits/visits.component.ts +0 -357
  119. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.html +0 -73
  120. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.scss +0 -14
  121. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.spec.ts +0 -25
  122. package/src/lib/components/zones/add-audio-zone/add-audio-zone.component.ts +0 -269
  123. package/src/lib/components/zones/add-zone/add-zone.component.html +0 -153
  124. package/src/lib/components/zones/add-zone/add-zone.component.scss +0 -44
  125. package/src/lib/components/zones/add-zone/add-zone.component.spec.ts +0 -25
  126. package/src/lib/components/zones/add-zone/add-zone.component.ts +0 -377
  127. package/src/lib/components/zones/add-zone/selection/selection.component.html +0 -3
  128. package/src/lib/components/zones/add-zone/selection/selection.component.scss +0 -16
  129. package/src/lib/components/zones/add-zone/selection/selection.component.spec.ts +0 -25
  130. package/src/lib/components/zones/add-zone/selection/selection.component.ts +0 -95
  131. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.html +0 -73
  132. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.scss +0 -23
  133. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.spec.ts +0 -25
  134. package/src/lib/components/zones/add-zone/sweep-plan-selection/sweep-plan-selection.component.ts +0 -595
  135. package/src/lib/components/zones/zones.component.html +0 -181
  136. package/src/lib/components/zones/zones.component.scss +0 -36
  137. package/src/lib/components/zones/zones.component.spec.ts +0 -25
  138. package/src/lib/components/zones/zones.component.ts +0 -339
  139. package/src/lib/helper.service.ts +0 -161
  140. package/src/lib/ngx-smarterplan-location-routing.module.ts +0 -41
  141. package/src/lib/ngx-smarterplan-locations.module.ts +0 -74
  142. package/src/lib/ngx-smarterplan-locations.service.spec.ts +0 -16
  143. package/src/lib/ngx-smarterplan-locations.service.ts +0 -9
  144. package/src/lib/pipes/count-audio-sweeps.pipe.ts +0 -21
  145. package/src/lib/radio-button/radio-button.component.html +0 -9
  146. package/src/lib/radio-button/radio-button.component.scss +0 -152
  147. package/src/lib/radio-button/radio-button.component.spec.ts +0 -25
  148. package/src/lib/radio-button/radio-button.component.ts +0 -26
  149. package/src/test.ts +0 -27
  150. package/tsconfig.lib.json +0 -15
  151. package/tsconfig.lib.prod.json +0 -10
  152. package/tsconfig.spec.json +0 -17
@@ -1,186 +0,0 @@
1
- import { Component, OnInit } from '@angular/core';
2
- import { FormGroup } from '@angular/forms';
3
- import { Router } from '@angular/router';
4
- import { LevelStatus, Space, SpaceService, BaseUserService, ViewerService, NavigationService, NavigatorService, enumToArray, Visit, MenuItem, SearchObjectType } from '@smarterplan/ngx-smarterplan-core';
5
- import { Subscription } from 'rxjs';
6
-
7
- @Component({
8
- selector: 'lib-locations',
9
- templateUrl: './locations.component.html',
10
- styleUrls: ['./locations.component.scss']
11
- })
12
- export class LocationsComponent implements OnInit {
13
-
14
- createForm: FormGroup;
15
-
16
- levels: Array<LevelStatus>;
17
-
18
- imageToUpload: File;
19
-
20
- isAdding = false;
21
-
22
- filteredLocations: Space[] = [];
23
-
24
- isManager = false;
25
-
26
- isMuseumUser = true;
27
-
28
- locations: Space[] = [];
29
-
30
- menuItems: MenuItem[] = [];
31
-
32
- userSubcription: Subscription;
33
-
34
- locationIDSubscription: Subscription;
35
-
36
- /** Last filtered Locations, used when we go back on all locations from the search bar location */
37
- lastFiltredLocations: Space[] = [];
38
-
39
- constructor(
40
- private spaceService: SpaceService,
41
- private router: Router,
42
- private userService: BaseUserService,
43
- private viewerService: ViewerService,
44
- private navigationService: NavigationService,
45
- private navigatorService: NavigatorService,
46
- ) {
47
- this.levels = enumToArray(LevelStatus);
48
- this.userSubcription = this.userService.isChanged.subscribe((isConnected) => {
49
- if (isConnected) {
50
- this.refresh();
51
- }
52
- });
53
-
54
- this.locationIDSubscription =
55
- this.navigatorService.locationIDChange.subscribe((id) => {
56
- this.changeSelectedLocation(id);
57
- this.setupMenuItems();
58
- });
59
- }
60
-
61
- async ngOnInit() {
62
- if (this.userService.cu) {
63
- this.resetList();
64
- this.updateUserRights();
65
- }
66
- this.setupMenuItems();
67
- }
68
-
69
-
70
- findSpaceById(id: string): Space {
71
- return this.locations.find((loc) => loc.id === id);
72
- }
73
-
74
- /**
75
- * Update when we change the selected location in filter (search bar)
76
- * @param id for a location, if null display all last filtred location
77
- */
78
- changeSelectedLocation(id?: string) {
79
- const space = id ? this.findSpaceById(id) : null;
80
- this.filteredLocations = space ? [space] : this.lastFiltredLocations; // New selected space or last filtered location
81
- }
82
-
83
- refresh() {
84
- this.updateUserRights();
85
- this.resetList();
86
- }
87
-
88
-
89
- ngOnDestroy() {
90
- this.userSubcription.unsubscribe();
91
- this.locationIDSubscription.unsubscribe();
92
- }
93
-
94
- setupMenuItems() {
95
- this.menuItems = [{ label: "All Locations", url: "/localisation" }];
96
- if (this.isAdding) {
97
- this.menuItems.push({ label: "New" });
98
- }
99
- if (this.filteredLocations.length === 1) {
100
- const selectedLoc = this.filteredLocations[0];
101
- this.menuItems.push({ label: selectedLoc.name });
102
- }
103
- }
104
-
105
- updateUserRights() {
106
- this.isManager = this.userService.hasManagerRoleInAnyMission();
107
- this.isMuseumUser = this.userService.hasOnlyMuseumRole();
108
- }
109
-
110
- isManagerForSpace(spaceID: string): boolean {
111
- return (
112
- this.userService.isManager(spaceID) ||
113
- this.userService.isGuide(spaceID)
114
- );
115
- }
116
-
117
- async resetList() {
118
- this.locations = await this.spaceService.getLocationsForCurrentUser();
119
- this.filteredLocations = this.locations;
120
- this.lastFiltredLocations = this.locations;
121
- this.isAdding = false;
122
- this.changeSelectedLocation(
123
- this.navigatorService.currentNavBarLocationID,
124
- ); // Set for the current selected location
125
- this.setupMenuItems();
126
- }
127
-
128
- onAddLocation() {
129
- this.isAdding = true;
130
- this.setupMenuItems();
131
- }
132
-
133
- handleImageInput(files: FileList) {
134
- this.imageToUpload = files.item(0);
135
- }
136
-
137
- onFormChange(event: any) {
138
- this.navigatorService.locationIDChange.next(
139
- null,
140
- ); /** Remove selected location */
141
- this.isAdding = false;
142
- if (event) {
143
- this.resetList();
144
- }
145
- this.setupMenuItems();
146
- }
147
-
148
- async onVisitClick(loc: Space, visit: Visit) {
149
- if (!this.userService.userHasAccessToAllZonesInSpace(loc.id)) {
150
- // get allowed sweep for the user
151
- const allowedSweeps =
152
- await this.navigationService.getAllowedSweepsIDsForUserInSpace(
153
- loc.id,
154
- );
155
- const firstSweep = allowedSweeps[0];
156
- this.viewerService.setSweepToMove(firstSweep);
157
- }
158
- if (this.userService.isGuide(loc.id)) {
159
- this.router.navigate(["museum", loc.id]);
160
- } else {
161
- this.router.navigate(["visit", loc.id], {
162
- queryParams: { model3D: visit.model3d },
163
- });
164
- }
165
- }
166
-
167
- applyResultsSearchBar(results: Space[]) {
168
- this.filteredLocations = results || this.locations;
169
- this.lastFiltredLocations = this.filteredLocations;
170
- this.navigatorService.locationIDChange.next(null); // When we search with keyword, we would like to search on all locations
171
- }
172
-
173
- getSearchType(): SearchObjectType {
174
- return SearchObjectType.LOCATION;
175
- }
176
-
177
- getStringNoSpace(data): string {
178
- return data.replace(/\s/g, '');
179
- }
180
-
181
- onDetailViewClick(spaceID: string) {
182
- this.navigatorService.locationIDChange.next(spaceID); // Send update for the location filter bar
183
- this.router.navigate(["dashboard/localisation", spaceID]);
184
- }
185
-
186
- }
@@ -1,11 +0,0 @@
1
- <div id="map-popup">
2
- <div class="map-popup-header" (click)="onClickVisitFirst()" [style.cursor]="'pointer'">
3
- <img [src]="space.annexes" />
4
- </div>
5
- <div class="map-popup-details">
6
- <h1 (click)="onClickVisitFirst()" [style.cursor]="'pointer'">{{space.name}}</h1>
7
- <span class="map-popup-address">{{space.addresses}}</span>
8
- <span *ngFor="let visit of space.visits" class="map-popup-visit" (click)="onVisitClick(visit)"
9
- [style.cursor]="'pointer'">➤ {{ visit.name ? visit.name : space.name}}</span>
10
- </div>
11
- </div>
@@ -1,51 +0,0 @@
1
- /** Leaflet Popup*/
2
-
3
- .map-popup-header {
4
- height: 120px;
5
- overflow: hidden;
6
-
7
- border-top-right-radius: 20px;
8
- border-top-left-radius: 20px;
9
- }
10
- .map-popup-header {
11
- img {
12
- width: 100%;
13
- position: relative;
14
- top: 50%;
15
- transform: translateY(-50%);
16
- }
17
- }
18
-
19
- .map-popup-details {
20
- padding: 5px 10px 10px 10px;
21
- border-bottom-left-radius: 20px;
22
- border-bottom-right-radius: 20px;
23
- background-color: white;
24
- color: black;
25
- }
26
-
27
- .map-popup-details {
28
- display: flex;
29
- flex-direction: column;
30
-
31
- h1 {
32
- font-size: 1.5rem;
33
- font-weight: bold;
34
- margin-bottom: 0px;
35
- color: var(--smarterplan-primary);
36
- }
37
- }
38
-
39
- .map-popup-address {
40
- align-self: flex-end;
41
- margin-bottom: 10px;
42
- }
43
-
44
- .map-popup-visit {
45
- color: var(--smarterplan-primary);
46
- font-size: 1.15rem;
47
- }
48
-
49
- .map-popup-visit:hover {
50
- color: var(--smarterplan-primary);
51
- }
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MapPopupComponent } from './map-popup.component';
4
-
5
- describe('MapPopupComponent', () => {
6
- let component: MapPopupComponent;
7
- let fixture: ComponentFixture<MapPopupComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ MapPopupComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(MapPopupComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,79 +0,0 @@
1
- import { Component, NgZone, OnInit } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import { Marker } from 'leaflet';
4
- import { Space, Visit } from '@smarterplan/ngx-smarterplan-core';
5
-
6
- @Component({
7
- selector: 'lib-map-popup',
8
- templateUrl: './map-popup.component.html',
9
- styleUrls: ['./map-popup.component.scss']
10
- })
11
- export class MapPopupComponent implements OnInit {
12
-
13
- space: Space;
14
-
15
- marker: Marker;
16
-
17
- popuparea: HTMLElement;
18
-
19
- isOnPopup = false;
20
-
21
- isMuseumUser = true;
22
-
23
- constructor(private router: Router, private ngZone: NgZone) { }
24
-
25
- ngOnInit() {
26
- this.marker.on("click", () => this.onClickVisitFirst());
27
-
28
- this.marker.on("mouseover", () => {
29
- this.isOnPopup = true;
30
- if (!this.marker.isPopupOpen()) {
31
- this.openPopup();
32
- }
33
- });
34
- }
35
-
36
- openPopup() {
37
- this.marker.openPopup();
38
-
39
- this.isOnPopup = false;
40
- this.popuparea = document.querySelector(".leaflet-popup");
41
-
42
- this.popuparea.addEventListener("mouseleave", () => {
43
- this.closePopup();
44
- });
45
- this.popuparea.addEventListener("mouseover", () => {
46
- this.isOnPopup = true;
47
- });
48
- this.marker.on("mouseout", () => {
49
- this.closePopup();
50
- });
51
- }
52
-
53
- closePopup() {
54
- this.isOnPopup = false;
55
- /** We want to wait to avoid glitch */
56
- setTimeout(() => {
57
- if (!this.isOnPopup) {
58
- this.marker.closePopup();
59
- }
60
- }, 100);
61
- }
62
-
63
- onClickVisitFirst() {
64
- if (this.space.visits.length === 0) {
65
- console.log("No space to visit !");
66
- } else {
67
- this.onVisitClick(this.space.visits[0]);
68
- }
69
- }
70
-
71
- async onVisitClick(visit: Visit) {
72
- this.ngZone.run(() => {
73
- this.router.navigate(["visit", this.space.id], {
74
- queryParams: { model3D: visit.model3d },
75
- });
76
- });
77
- }
78
-
79
- }
@@ -1,2 +0,0 @@
1
- <div [leafletLayers]="layers" [leafletOptions]="options" (leafletMapReady)="onMapReady($event)" id="map" leaflet
2
- style="height: 500px; margin-top: 30px; z-index: 195"></div>
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MapComponent } from './map.component';
4
-
5
- describe('MapComponent', () => {
6
- let component: MapComponent;
7
- let fixture: ComponentFixture<MapComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ MapComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(MapComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,111 +0,0 @@
1
- import { Component, ComponentFactoryResolver, Injector, Input, NgZone, OnChanges, SimpleChanges, ViewContainerRef } from '@angular/core';
2
- import { Space } from '@smarterplan/ngx-smarterplan-core';
3
- import {
4
- latLng,
5
- marker,
6
- tileLayer,
7
- Map,
8
- latLngBounds,
9
- point,
10
- Marker,
11
- icon,
12
- } from "leaflet";
13
- import { MapPopupComponent } from './map-popup/map-popup.component';
14
- import { Router } from '@angular/router';
15
-
16
-
17
- const iconRetinaUrl = "assets/marker-icon-2x.png";
18
- const iconUrl = "assets/marker-icon.png";
19
- const shadowUrl = "assets/marker-shadow.png";
20
- const iconDefault = icon({
21
- iconRetinaUrl,
22
- iconUrl,
23
- shadowUrl,
24
- iconSize: [25, 41],
25
- iconAnchor: [12, 41],
26
- popupAnchor: [1, -34],
27
- tooltipAnchor: [16, -28],
28
- shadowSize: [41, 41],
29
- });
30
- Marker.prototype.options.icon = iconDefault;
31
- @Component({
32
- selector: 'lib-map',
33
- templateUrl: './map.component.html',
34
- styleUrls: ['./map.component.scss']
35
- })
36
- export class MapComponent implements OnChanges {
37
-
38
- constructor(private componentFactoryResolver: ComponentFactoryResolver,
39
- private injector: Injector,) { }
40
-
41
- @Input() spaces: Space[];
42
-
43
- options = {
44
- layers: [
45
- tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
46
- maxZoom: 18,
47
- attribution: "...",
48
- }),
49
- ],
50
- zoom: 5.5,
51
- center: latLng(47.06394, 2.77736),
52
- };
53
-
54
- layers: any[] = [];
55
-
56
- map: any;
57
-
58
- ngOnChanges(changes: SimpleChanges) {
59
- if (changes.spaces) {
60
- const nm = [];
61
- const bd = [];
62
- if (!changes.spaces.currentValue) {
63
- return;
64
- }
65
- // Filtering out spaces without lat/longitudes
66
- for (const s of changes.spaces.currentValue as Space[]) {
67
- if (s.latitude === null || s.longitude === null) {
68
- console.log(
69
- `${s.name} has not coordinates for ${s.addresses}`,
70
- );
71
- continue;
72
- }
73
- // We use the popup system from leaflet, as it packs a few improvements
74
- // on using bootstrap: autoclose other popups, closing option.
75
- const m = marker([s.latitude, s.longitude]);
76
-
77
- m.bindPopup(this.createPopupComponent(s, m));
78
-
79
- nm.push(m);
80
- bd.push(latLng(s.latitude, s.longitude));
81
- }
82
- // Note how we set the layers in one assignment, in order to have leaflet
83
- // detects the change correctly
84
- // We also set the bounds afterward, for the map to be properly zoomed and
85
- // centered
86
- this.layers = nm;
87
- if (this.map && bd.length > 0) {
88
- this.map.fitBounds(latLngBounds(bd), {
89
- padding: point(48, 48),
90
- maxZoom: 12,
91
- animate: true,
92
- });
93
- }
94
- }
95
- }
96
-
97
- onMapReady(map: Map) {
98
- this.map = map;
99
- }
100
-
101
- createPopupComponent(space: Space, marker: Marker) {
102
- const comp = this.componentFactoryResolver
103
- .resolveComponentFactory(MapPopupComponent)
104
- .create(this.injector);
105
- comp.instance.space = space;
106
- comp.instance.marker = marker;
107
- comp.changeDetectorRef.detectChanges();
108
- return comp.location.nativeElement;
109
- }
110
-
111
- }
@@ -1,9 +0,0 @@
1
- <div class="mt-3 ms-3" class="legendContainer">
2
- <h5>{{"legend.title" | translate}}</h5>
3
- <div class="legendBox">
4
- <div class="legendRow" *ngFor="let elemnt of buttonsToRender">
5
- <button class="legendIcon" [ngStyle] = "{'background-image': elemnt.url}"></button>
6
- <span>{{elemnt.text}}</span>
7
- </div>
8
- </div>
9
- </div>
@@ -1,38 +0,0 @@
1
- .legendContainer {
2
- padding: 1rem;
3
- border: solid var(--smarterplan-primary) 2px;
4
- border-radius: 6px;
5
- width: 100%;
6
- margin-bottom: 0.5rem;
7
- background: #FFF;
8
- .legendBox {
9
- display: flex;
10
- flex-direction: row;
11
- justify-content: center;
12
- flex-wrap: wrap;
13
- .legendRow {
14
- display: flex;
15
- flex-direction: row;
16
- align-items: center;
17
- .legendIcon {
18
- width: 2.5rem;
19
- height: 2.5rem;
20
- background-repeat: no-repeat;
21
- background-size: cover;
22
- border: none;
23
- background-color: transparent;
24
- margin-right: 0.5rem;
25
- cursor: auto;
26
- }
27
- span {
28
- margin-right: 1rem;
29
- cursor: auto;
30
- }
31
- h5 {
32
- cursor: auto;
33
- }
34
- }
35
- }
36
- }
37
-
38
-
@@ -1,25 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { PlanLegendComponent } from './plan-legend.component';
4
-
5
- describe('PlanLegendComponent', () => {
6
- let component: PlanLegendComponent;
7
- let fixture: ComponentFixture<PlanLegendComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ PlanLegendComponent ]
12
- })
13
- .compileComponents();
14
- });
15
-
16
- beforeEach(() => {
17
- fixture = TestBed.createComponent(PlanLegendComponent);
18
- component = fixture.componentInstance;
19
- fixture.detectChanges();
20
- });
21
-
22
- it('should create', () => {
23
- expect(component).toBeTruthy();
24
- });
25
- });
@@ -1,50 +0,0 @@
1
- import { Component, OnInit, Input, OnChanges } from '@angular/core';
2
- import { TranslateService } from "@ngx-translate/core";
3
-
4
- @Component({
5
- selector: 'lib-plan-legend',
6
- templateUrl: './plan-legend.component.html',
7
- styleUrls: ['./plan-legend.component.scss']
8
- })
9
- export class PlanLegendComponent implements OnInit {
10
- @Input() isAudioZone?:boolean = false;
11
-
12
- buttonsToRender = [];
13
-
14
- colorToText = {};
15
-
16
- constructor(
17
- private translate: TranslateService,
18
- ) {}
19
-
20
- async ngOnInit() {
21
- this.render()
22
- }
23
-
24
- async render() {
25
- this.buttonsToRender = [
26
- {
27
- url: `url("https://api.iconify.design/mdi:adjust.svg?color=green&height=17&width=17")`,
28
- text: this.translate.instant("legend.green")
29
- },
30
- {
31
- url: `url("https://api.iconify.design/mdi:close-circle-outline.svg?color=red&height=17&width=17")`,
32
- text: this.translate.instant("legend.red")
33
- }
34
- ]
35
- if (this.isAudioZone) {
36
- let audioPoints = [{
37
- url: `url("https://api.iconify.design/mdi:close-circle-outline.svg?color=black&height=17&width=17")`,
38
- text: this.translate.instant("legend.black")
39
- },
40
- {
41
- url: `url("https://api.iconify.design/mdi:adjust.svg?color=orange&height=17&width=17")`,
42
- text: this.translate.instant("legend.orange")
43
- }]
44
- this.buttonsToRender = this.buttonsToRender.concat(audioPoints)
45
- }
46
- }
47
-
48
- //styleButton(element, SweepState.DISABLED);
49
-
50
- }