@mapsindoors/map-template 1.95.0 → 1.95.2
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/dist/{GoogleMapsMap-BIUan6Mh.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
- package/dist/{MapboxMap-BwTFmd5b.mjs → MapboxMap-B1oo7IUm.mjs} +3 -3
- package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
- package/dist/app-globals-DQuL1Twl.js +3 -0
- package/dist/combo-box-item.entry.js +8 -10
- package/dist/icon-DT_sDkmK.js +11 -0
- package/dist/index-BZQHyS7V.js +1701 -0
- package/dist/loader.js +7 -14
- package/dist/mapsindoors-react.es.js +1 -1
- package/dist/mapsindoors-react.umd.js +175 -175
- package/dist/mapsindoors-webcomponent.es.js +2919 -2907
- package/dist/mi-card_2.entry.js +23 -18
- package/dist/mi-chip.entry.js +25 -16
- package/dist/mi-column.entry.js +47 -23
- package/dist/mi-combo-box.entry.js +412 -379
- package/dist/mi-components.js +15 -12
- package/dist/mi-data-table.entry.js +298 -278
- package/dist/mi-distance_2.entry.js +58 -56
- package/dist/mi-dropdown-item.entry.js +8 -10
- package/dist/mi-dropdown.entry.js +525 -481
- package/dist/mi-floor-selector.entry.js +183 -180
- package/dist/mi-keyboard.entry.js +207 -186
- package/dist/mi-list-item-category.entry.js +44 -41
- package/dist/mi-list-item-location.entry.js +168 -162
- package/dist/mi-list.entry.js +56 -48
- package/dist/mi-location-booking.entry.js +320 -295
- package/dist/mi-location-info.entry.js +61 -53
- package/dist/mi-map-googlemaps.entry.js +369 -324
- package/dist/mi-map-mapbox.entry.js +502 -439
- package/dist/mi-metric-card.entry.js +50 -37
- package/dist/mi-my-position.entry.js +2341 -874
- package/dist/mi-notification.entry.js +112 -102
- package/dist/mi-route-instructions-heading.entry.js +70 -65
- package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
- package/dist/mi-route-instructions-maneuver.entry.js +80 -76
- package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
- package/dist/mi-route-instructions-step.entry.js +313 -292
- package/dist/mi-route-instructions.entry.js +167 -150
- package/dist/mi-scroll-buttons.entry.js +104 -98
- package/dist/mi-search.entry.js +366 -325
- package/dist/mi-share-sms.entry.js +82 -70
- package/dist/mi-step-switcher.entry.js +34 -25
- package/dist/mi-tab-panel.entry.js +18 -18
- package/dist/mi-tab.entry.js +5 -7
- package/dist/mi-tabs.entry.js +42 -40
- package/dist/mi-time.entry.js +49 -49
- package/dist/mi-variables-CDNvnTkH.js +5 -0
- package/dist/{reactcomponent-D3K1zzGs.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
- package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
- package/dist/sort-order.enum-jsLAbYWg.js +566 -0
- package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
- package/dist/utils-DNHzysQ6.js +61 -0
- package/package.json +1 -1
- package/dist/_commonjsHelpers-ba3f0406.js +0 -21
- package/dist/icon-b8d01d6f.js +0 -24
- package/dist/index-7e9696f3.js +0 -1678
- package/dist/mi-variables-9a6c8d4d.js +0 -6
- package/dist/polyfills/core-js.js +0 -11
- package/dist/polyfills/css-shim.js +0 -1
- package/dist/polyfills/dom.js +0 -79
- package/dist/polyfills/es5-html-element.js +0 -1
- package/dist/polyfills/index.js +0 -34
- package/dist/polyfills/system.js +0 -6
- package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
- package/dist/sort-order.enum-64ce8998.js +0 -552
- package/dist/utils-ae714467.js +0 -61
|
@@ -1,308 +1,322 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h } from './index-
|
|
2
|
-
import { U as UnitSystem } from './unit-system.enum-
|
|
3
|
-
import { c as isInternetExplorer } from './utils-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-BZQHyS7V.js';
|
|
2
|
+
import { U as UnitSystem } from './unit-system.enum-BwPgAWqL.js';
|
|
3
|
+
import { c as isInternetExplorer } from './utils-DNHzysQ6.js';
|
|
4
4
|
|
|
5
|
-
const routeInstructionsStepLegacyCss =
|
|
5
|
+
const routeInstructionsStepLegacyCss = () => `:host{display:block;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"}.step{display:grid;grid-template-columns:40px 1fr 40px;grid-template-areas:"actionicon heading heading" "modeicon description toggle" "modeicon substeps substeps"}.step__action-icon{-ms-grid-row:1;-ms-grid-column:1;display:flex;justify-content:center;align-items:center;grid-area:actionicon}.step__action-icon--circled{position:relative}.step__action-icon--circled::before{position:absolute;width:24px;height:24px;border:1px solid #1c1917;content:"";border-radius:50%}.step__action-icon mi-icon{display:block;width:12px;height:12px}.step__heading{-ms-grid-row:1;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:heading;font-size:1rem;margin:0;border-bottom:1px solid #DCDCDF;border-top:1px solid #DCDCDF;padding:12px}.step__heading>span{font-size:0.875rem;color:#6b7280}.step__travel-mode{-ms-grid-row:2;-ms-grid-row-span:2;-ms-grid-column:1;grid-area:modeicon;display:flex;justify-content:center;align-items:center;position:relative;min-height:72px}.step__travel-mode::before{position:absolute;width:calc(50% - 2px);left:0;height:100%;content:""}.step__travel-mode--dotted::before{border-right:4px dotted #bfdbfe}.step__travel-mode--solid::before{border-right:4px solid #bfdbfe}.step__travel-mode-icon{position:absolute;left:50%;top:24px;transform:translateX(-50%);background-color:#fcfcfc;padding:3px;border-radius:4px}.step__travel-mode-icon mi-icon{width:16px;height:16px;background-color:#6b7280;display:block}.step__description{-ms-grid-row:2;-ms-grid-column:2;grid-area:description;padding:12px}.step__short-name{margin-right:4px;padding:2px 4px;font-size:0.875rem;color:#fcfcfc;background-color:#6b7280;border-radius:2px}.step__distance-duration{color:#6b7280;font-size:0.875rem}.step__toggle{-ms-grid-row:2;-ms-grid-column:3;grid-area:toggle;display:flex;justify-content:center;align-items:center;transition:transform 300ms;cursor:pointer}.step__toggle--open{transform:rotate(180deg)}.step__toggle mi-icon{width:16px;height:16px;display:block;background-color:#3b82f6}.step__substeps{-ms-grid-row:3;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:substeps}`;
|
|
6
6
|
|
|
7
7
|
const RouteInstructionsStepLegacy = class {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.stepClicked = createEvent(this, "stepClicked", 7);
|
|
11
|
+
/**
|
|
12
|
+
* If indoor substeps/maneuvers should be hidden.
|
|
13
|
+
*
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
*/
|
|
16
|
+
this.hideIndoorSubsteps = true;
|
|
17
|
+
/**
|
|
18
|
+
* The route context of previous step, if any.
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
this.fromRouteContext = '';
|
|
22
|
+
/**
|
|
23
|
+
* Set imperial or metric as default unit system.
|
|
24
|
+
* @type {UnitSystem} 'imperial' or 'metric'
|
|
25
|
+
*/
|
|
26
|
+
this.unit = UnitSystem.Metric;
|
|
27
|
+
/**
|
|
28
|
+
* Signifies wether substeps are open or not.
|
|
29
|
+
*/
|
|
30
|
+
this.substepsAreOpen = false;
|
|
31
|
+
this.isInternetExplorer = isInternetExplorer();
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
parseStepProp() {
|
|
34
|
+
if (this.step) {
|
|
35
|
+
this.stepData = JSON.parse(this.step);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Render if there is step data.
|
|
39
|
-
*/
|
|
40
|
-
render() {
|
|
41
|
-
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Emits stepClicked event (if click target is not related to an action)
|
|
45
|
-
* @param event Event
|
|
46
|
-
*/
|
|
47
|
-
stepClickHandler(event) {
|
|
48
|
-
// Don't emit click event if clicked on elements that are actions to other things
|
|
49
|
-
if (Array.from(event.target.classList).includes('icon-toggle')) {
|
|
50
|
-
return;
|
|
38
|
+
parseTranslationsProp() {
|
|
39
|
+
if (this.translations) {
|
|
40
|
+
this.translationsData = JSON.parse(this.translations);
|
|
41
|
+
}
|
|
51
42
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
componentWillLoad() {
|
|
44
|
+
this.parseStepProp();
|
|
45
|
+
this.parseTranslationsProp();
|
|
55
46
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* @returns {JSX.Element}
|
|
62
|
-
*/
|
|
63
|
-
renderStep() {
|
|
64
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
65
|
-
case 'DRIVING':
|
|
66
|
-
return this.renderDrivingStep();
|
|
67
|
-
case 'WALKING':
|
|
68
|
-
return this.renderWalkingStep();
|
|
69
|
-
case 'BICYCLING':
|
|
70
|
-
return this.renderBicyclingStep();
|
|
71
|
-
case 'TRANSIT':
|
|
72
|
-
return this.renderTransitStep();
|
|
73
|
-
default:
|
|
74
|
-
return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Render the travel mode indicator and dotted/solid line.
|
|
79
|
-
*
|
|
80
|
-
* @returns {JSX.Element}
|
|
81
|
-
*/
|
|
82
|
-
renderTravelMode() {
|
|
83
|
-
if (this.isInternetExplorer) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
let travelModeIcon;
|
|
87
|
-
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
88
|
-
case 'DRIVING':
|
|
89
|
-
travelModeIcon = 'car';
|
|
90
|
-
break;
|
|
91
|
-
case 'WALKING':
|
|
92
|
-
travelModeIcon = 'walk';
|
|
93
|
-
break;
|
|
94
|
-
case 'BICYCLING':
|
|
95
|
-
travelModeIcon = 'bike';
|
|
96
|
-
break;
|
|
97
|
-
case 'TRANSIT':
|
|
98
|
-
travelModeIcon = this.getTransitVehicleIconName();
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
return (h("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === 'TRANSIT' ? 'solid' : 'dotted'}` }, h("span", { class: "step__travel-mode-icon" }, h("mi-icon", { part: "step-travel-mode-icon", "icon-name": travelModeIcon }))));
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get icon name for transit vehicle.
|
|
105
|
-
*
|
|
106
|
-
* @returns {string}
|
|
107
|
-
*/
|
|
108
|
-
getTransitVehicleIconName() {
|
|
109
|
-
var _a, _b;
|
|
110
|
-
const stepTransitVehicleType = (_b = (_a = this.stepData.transit_information) === null || _a === void 0 ? void 0 : _a.line.vehicle) === null || _b === void 0 ? void 0 : _b.type.toLowerCase();
|
|
111
|
-
const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
|
|
112
|
-
return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Toggles visibility of sub steps (steps in steps)
|
|
116
|
-
*/
|
|
117
|
-
toggleSubsteps() {
|
|
118
|
-
this.substepsAreOpen = !this.substepsAreOpen;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Render substeps if they should be visible.
|
|
122
|
-
*
|
|
123
|
-
* @returns {JSX.Element}
|
|
124
|
-
*/
|
|
125
|
-
renderSubsteps() {
|
|
126
|
-
return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, this.stepData.steps.map((maneuver, index) => {
|
|
127
|
-
return h("mi-route-instructions-maneuver-legacy", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
|
|
130
|
-
})) : null;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Render the toggle button for the sub step expander.
|
|
134
|
-
*
|
|
135
|
-
* @returns {JSX.Element}
|
|
136
|
-
*/
|
|
137
|
-
renderToggleButton() {
|
|
138
|
-
// Return null if none substeps/maneuvers is provided
|
|
139
|
-
if (this.stepData.steps.length <= 0) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
// Return null if indoor substeps/maneuvers should be hidden and if the step context corresponds to being inside a building
|
|
143
|
-
if (this.hideIndoorSubsteps === true && this.stepData.route_context.toLowerCase() === 'insidebuilding') {
|
|
144
|
-
return null;
|
|
47
|
+
/**
|
|
48
|
+
* Render if there is step data.
|
|
49
|
+
*/
|
|
50
|
+
render() {
|
|
51
|
+
return this.stepData && this.translationsData ? this.renderStep() : null;
|
|
145
52
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Render time and distance part.
|
|
151
|
-
*
|
|
152
|
-
* @returns {JSX.Element}
|
|
153
|
-
*/
|
|
154
|
-
renderTimeAndDistance() {
|
|
155
|
-
return h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", h("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), h("br", null));
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Render a driving step.
|
|
159
|
-
*
|
|
160
|
-
* @returns {JSX.Element}
|
|
161
|
-
*/
|
|
162
|
-
renderDrivingStep() {
|
|
163
|
-
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
164
|
-
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "car" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Get display heading.
|
|
168
|
-
*
|
|
169
|
-
* @returns {string}
|
|
170
|
-
*/
|
|
171
|
-
getStepHeading() {
|
|
172
|
-
var _a;
|
|
173
|
-
const defaultHeadings = {
|
|
174
|
-
'driving': this.translationsData.drive,
|
|
175
|
-
'walking': this.translationsData.walk,
|
|
176
|
-
'bicycling': this.translationsData.bike
|
|
177
|
-
};
|
|
178
|
-
return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
|
|
179
|
-
this.stepData.steps[0].instructions :
|
|
180
|
-
defaultHeadings[this.stepData.travel_mode.toLowerCase()];
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Render a walking step.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* @returns {JSX.Element}
|
|
187
|
-
*/
|
|
188
|
-
renderWalkingStep() {
|
|
189
|
-
let heading;
|
|
190
|
-
let actionIconName;
|
|
191
|
-
/*
|
|
192
|
-
* Determine action heading:
|
|
53
|
+
/**
|
|
54
|
+
* Emits stepClicked event (if click target is not related to an action)
|
|
55
|
+
* @param event Event
|
|
193
56
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
57
|
+
stepClickHandler(event) {
|
|
58
|
+
// Don't emit click event if clicked on elements that are actions to other things
|
|
59
|
+
if (Array.from(event.target.classList).includes('icon-toggle')) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
let maneuverIndex = null;
|
|
63
|
+
if (event.target.dataset.maneuverIndex !== undefined) {
|
|
64
|
+
maneuverIndex = parseInt(event.target.dataset.maneuverIndex);
|
|
65
|
+
}
|
|
66
|
+
this.stepClicked.emit({ maneuverIndex });
|
|
198
67
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Render step part depending on travel mode.
|
|
70
|
+
*
|
|
71
|
+
* @returns {JSX.Element}
|
|
72
|
+
*/
|
|
73
|
+
renderStep() {
|
|
74
|
+
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
75
|
+
case 'DRIVING':
|
|
76
|
+
return this.renderDrivingStep();
|
|
77
|
+
case 'WALKING':
|
|
78
|
+
return this.renderWalkingStep();
|
|
79
|
+
case 'BICYCLING':
|
|
80
|
+
return this.renderBicyclingStep();
|
|
81
|
+
case 'TRANSIT':
|
|
82
|
+
return this.renderTransitStep();
|
|
83
|
+
default:
|
|
84
|
+
return h("div", null, "Unknown travel mode: ", this.stepData.travel_mode);
|
|
85
|
+
}
|
|
203
86
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Render the travel mode indicator and dotted/solid line.
|
|
89
|
+
*
|
|
90
|
+
* @returns {JSX.Element}
|
|
91
|
+
*/
|
|
92
|
+
renderTravelMode() {
|
|
93
|
+
if (this.isInternetExplorer) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
let travelModeIcon;
|
|
97
|
+
switch (this.stepData.travel_mode.toUpperCase()) {
|
|
98
|
+
case 'DRIVING':
|
|
99
|
+
travelModeIcon = 'car';
|
|
100
|
+
break;
|
|
101
|
+
case 'WALKING':
|
|
102
|
+
travelModeIcon = 'walk';
|
|
103
|
+
break;
|
|
104
|
+
case 'BICYCLING':
|
|
105
|
+
travelModeIcon = 'bike';
|
|
106
|
+
break;
|
|
107
|
+
case 'TRANSIT':
|
|
108
|
+
travelModeIcon = this.getTransitVehicleIconName();
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
return (h("span", { part: "step-travel-mode", class: `step__travel-mode step__travel-mode--${this.stepData.travel_mode.toUpperCase() === 'TRANSIT' ? 'solid' : 'dotted'}` }, h("span", { class: "step__travel-mode-icon" }, h("mi-icon", { part: "step-travel-mode-icon", "icon-name": travelModeIcon }))));
|
|
208
112
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Get icon name for transit vehicle.
|
|
115
|
+
*
|
|
116
|
+
* @returns {string}
|
|
117
|
+
*/
|
|
118
|
+
getTransitVehicleIconName() {
|
|
119
|
+
var _a, _b;
|
|
120
|
+
const stepTransitVehicleType = (_b = (_a = this.stepData.transit_information) === null || _a === void 0 ? void 0 : _a.line.vehicle) === null || _b === void 0 ? void 0 : _b.type.toLowerCase();
|
|
121
|
+
const transitVehicleTypes = ['boat', 'bus', 'railway', 'train', 'subway']; // Supported Transit Vehicles
|
|
122
|
+
return stepTransitVehicleType && transitVehicleTypes.some(type => type === stepTransitVehicleType) ? stepTransitVehicleType : 'transit';
|
|
213
123
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Toggles visibility of sub steps (steps in steps)
|
|
126
|
+
*/
|
|
127
|
+
toggleSubsteps() {
|
|
128
|
+
this.substepsAreOpen = !this.substepsAreOpen;
|
|
218
129
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Render substeps if they should be visible.
|
|
132
|
+
*
|
|
133
|
+
* @returns {JSX.Element}
|
|
134
|
+
*/
|
|
135
|
+
renderSubsteps() {
|
|
136
|
+
return this.substepsAreOpen === true ? h("div", { class: "step__substeps" }, this.stepData.steps.map((maneuver, index) => {
|
|
137
|
+
return h("mi-route-instructions-maneuver-legacy", { "data-maneuver-index": index, maneuver: JSON.stringify(maneuver), translations: this.translations, unit: this.unit,
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
exportparts: "\n maneuver-icon,\n maneuver-description,\n maneuver-description-distance,\n maneuver-description-distance-border" });
|
|
140
|
+
})) : null;
|
|
223
141
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Render the toggle button for the sub step expander.
|
|
144
|
+
*
|
|
145
|
+
* @returns {JSX.Element}
|
|
146
|
+
*/
|
|
147
|
+
renderToggleButton() {
|
|
148
|
+
// Return null if none substeps/maneuvers is provided
|
|
149
|
+
if (this.stepData.steps.length <= 0) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
// Return null if indoor substeps/maneuvers should be hidden and if the step context corresponds to being inside a building
|
|
153
|
+
if (this.hideIndoorSubsteps === true && this.stepData.route_context.toLowerCase() === 'insidebuilding') {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return (h("span", { class: `step__toggle ${this.substepsAreOpen ? 'step__toggle--open' : ''}`, onClick: () => this.toggleSubsteps() }, this.isInternetExplorer ? '\u25BC' :
|
|
157
|
+
h("mi-icon", { part: "step-toggle", "icon-name": "toggle" })));
|
|
228
158
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Render time and distance part.
|
|
161
|
+
*
|
|
162
|
+
* @returns {JSX.Element}
|
|
163
|
+
*/
|
|
164
|
+
renderTimeAndDistance() {
|
|
165
|
+
return h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", h("mi-distance", { meters: this.stepData.distance.value, unit: this.unit }), h("br", null));
|
|
233
166
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Render a driving step.
|
|
169
|
+
*
|
|
170
|
+
* @returns {JSX.Element}
|
|
171
|
+
*/
|
|
172
|
+
renderDrivingStep() {
|
|
173
|
+
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
174
|
+
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "car" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.drive, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
237
175
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Get display heading.
|
|
178
|
+
*
|
|
179
|
+
* @returns {string}
|
|
180
|
+
*/
|
|
181
|
+
getStepHeading() {
|
|
182
|
+
var _a;
|
|
183
|
+
const defaultHeadings = {
|
|
184
|
+
'driving': this.translationsData.drive,
|
|
185
|
+
'walking': this.translationsData.walk,
|
|
186
|
+
'bicycling': this.translationsData.bike
|
|
187
|
+
};
|
|
188
|
+
return ((_a = this.stepData.steps[0]) === null || _a === void 0 ? void 0 : _a.instructions) ?
|
|
189
|
+
this.stepData.steps[0].instructions :
|
|
190
|
+
defaultHeadings[this.stepData.travel_mode.toLowerCase()];
|
|
242
191
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Render a walking step.
|
|
194
|
+
*
|
|
195
|
+
*
|
|
196
|
+
* @returns {JSX.Element}
|
|
197
|
+
*/
|
|
198
|
+
renderWalkingStep() {
|
|
199
|
+
let heading;
|
|
200
|
+
let actionIconName;
|
|
201
|
+
/*
|
|
202
|
+
* Determine action heading:
|
|
203
|
+
*/
|
|
204
|
+
if (this.stepData.parking === true) {
|
|
205
|
+
// Park your vehicle
|
|
206
|
+
heading = `${this.translationsData.park} ${this.stepData.label ? ` ${this.translationsData.at} ` + this.stepData.label : ''}`;
|
|
207
|
+
actionIconName = 'park';
|
|
208
|
+
}
|
|
209
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'STEPS') { // TODO: SDK, why is highway not always set?
|
|
210
|
+
// Take stairs
|
|
211
|
+
heading = `${this.translationsData.takeStaircaseToLevel} ${this.stepData.end_location.floor_name}`;
|
|
212
|
+
actionIconName = 'stairs';
|
|
213
|
+
}
|
|
214
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'LADDER') {
|
|
215
|
+
// Take a laddder
|
|
216
|
+
heading = `${this.translationsData.takeLadderToLevel} ${this.stepData.end_location.floor_name}`;
|
|
217
|
+
actionIconName = 'ladder';
|
|
218
|
+
}
|
|
219
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ESCALATOR') {
|
|
220
|
+
// Take an escalator
|
|
221
|
+
heading = `${this.translationsData.takeEscalatorToLevel} ${this.stepData.end_location.floor_name}`;
|
|
222
|
+
actionIconName = 'escalator';
|
|
223
|
+
}
|
|
224
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRRAMP') {
|
|
225
|
+
// Take wheel chair ramp
|
|
226
|
+
heading = `${this.translationsData.takeWheelchairRampToLevel} ${this.stepData.end_location.floor_name}`;
|
|
227
|
+
actionIconName = 'wheelchair-ramp';
|
|
228
|
+
}
|
|
229
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'WHEELCHAIRLIFT') {
|
|
230
|
+
// Take wheel chair lift
|
|
231
|
+
heading = `${this.translationsData.takeWheelchairLiftToLevel} ${this.stepData.end_location.floor_name}`;
|
|
232
|
+
actionIconName = 'wheelchair-lift';
|
|
233
|
+
}
|
|
234
|
+
else if (this.stepData.highway && this.stepData.highway.toUpperCase() === 'ELEVATOR') {
|
|
235
|
+
// Take elevator
|
|
236
|
+
heading = `${this.translationsData.takeElevatorToLevel} ${this.stepData.end_location.floor_name}`;
|
|
237
|
+
actionIconName = 'elevator';
|
|
238
|
+
}
|
|
239
|
+
else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'Outside') {
|
|
240
|
+
// Exit from inside to outside
|
|
241
|
+
heading = this.addStepContextNameToHeading(this.translationsData.exit, this.stepData.start_context);
|
|
242
|
+
actionIconName = 'exit';
|
|
243
|
+
}
|
|
244
|
+
else if (this.fromRouteContext === 'InsideBuilding' && this.stepData.route_context === 'InsideBuilding') {
|
|
245
|
+
heading = this.getStepHeading();
|
|
246
|
+
actionIconName = 'walk';
|
|
247
|
+
}
|
|
248
|
+
else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside' && this.fromTravelMode.toUpperCase() === 'TRANSIT') {
|
|
249
|
+
// Switching between public transportation
|
|
250
|
+
heading = this.fromTransitStop;
|
|
251
|
+
actionIconName = 'transit-stop';
|
|
252
|
+
}
|
|
253
|
+
else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'Outside') {
|
|
254
|
+
heading = this.getStepHeading();
|
|
255
|
+
actionIconName = 'walk';
|
|
256
|
+
}
|
|
257
|
+
else if (this.fromRouteContext === 'Outside' && this.stepData.route_context === 'InsideBuilding') {
|
|
258
|
+
// Enter from outside to inside
|
|
259
|
+
heading = this.addStepContextNameToHeading(this.translationsData.enter, this.stepData.end_context);
|
|
260
|
+
actionIconName = 'enter';
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
// Origin Location name or empty
|
|
264
|
+
heading = this.fromRouteContext;
|
|
265
|
+
actionIconName = 'circle';
|
|
266
|
+
}
|
|
267
|
+
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
268
|
+
h("span", { class: `step__action-icon ${actionIconName !== 'circle' ? 'step__action-icon--circled' : ''}` }, h("mi-icon", { "icon-name": actionIconName })), h("h3", { part: "step-heading", class: "step__heading" }, heading), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.walk, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
246
269
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Add building or venue name to the step heading
|
|
272
|
+
* @param {string} heading
|
|
273
|
+
* @param {StepContext} stepContext
|
|
274
|
+
* @returns
|
|
275
|
+
*/
|
|
276
|
+
addStepContextNameToHeading(heading, stepContext) {
|
|
277
|
+
if (stepContext) {
|
|
278
|
+
if (stepContext.building) {
|
|
279
|
+
heading += ` ${stepContext.building.buildingInfo.name} ${this.translationsData.building}`;
|
|
280
|
+
}
|
|
281
|
+
else if (stepContext.venue) {
|
|
282
|
+
heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return heading;
|
|
251
286
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Render a bicycling step.
|
|
289
|
+
*
|
|
290
|
+
* @returns {JSX.Element}
|
|
291
|
+
*/
|
|
292
|
+
renderBicyclingStep() {
|
|
293
|
+
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
294
|
+
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "bike" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
256
295
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
else if (stepContext.venue) {
|
|
272
|
-
heading += ` ${stepContext.venue.venueInfo.name} ${this.translationsData.venue}`;
|
|
273
|
-
}
|
|
296
|
+
/**
|
|
297
|
+
* Render a transit step.
|
|
298
|
+
*
|
|
299
|
+
* @returns {JSX.Element}
|
|
300
|
+
*/
|
|
301
|
+
renderTransitStep() {
|
|
302
|
+
var _a, _b;
|
|
303
|
+
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
304
|
+
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "transit-stop" })), h("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ?
|
|
305
|
+
h("span", { class: "step__short-name", style: {
|
|
306
|
+
backgroundColor: ((_a = this.stepData.transit_information.line) === null || _a === void 0 ? void 0 : _a.color) ? this.stepData.transit_information.line.color : null,
|
|
307
|
+
color: ((_b = this.stepData.transit_information.line) === null || _b === void 0 ? void 0 : _b.text_color) ? this.stepData.transit_information.line.text_color : null
|
|
308
|
+
} }, this.stepData.transit_information.line.short_name) :
|
|
309
|
+
null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, h("br", null), h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
|
|
274
310
|
}
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
284
|
-
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "bike" })), h("h3", { part: "step-heading", class: "step__heading" }, this.getStepHeading()), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.translationsData.bike, h("br", null), this.renderTimeAndDistance()), this.renderToggleButton(), this.renderSubsteps());
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Render a transit step.
|
|
288
|
-
*
|
|
289
|
-
* @returns {JSX.Element}
|
|
290
|
-
*/
|
|
291
|
-
renderTransitStep() {
|
|
292
|
-
var _a, _b;
|
|
293
|
-
return h("div", { class: "step", onClick: e => this.stepClickHandler(e) }, this.isInternetExplorer ? null :
|
|
294
|
-
h("span", { class: "step__action-icon step__action-icon--circled" }, h("mi-icon", { "icon-name": "transit-stop" })), h("h3", { part: "step-heading", class: "step__heading" }, this.stepData.instructions), this.renderTravelMode(), h("div", { part: "step-description", class: "step__description" }, this.stepData.transit_information.line.short_name ?
|
|
295
|
-
h("span", { class: "step__short-name", style: {
|
|
296
|
-
backgroundColor: ((_a = this.stepData.transit_information.line) === null || _a === void 0 ? void 0 : _a.color) ? this.stepData.transit_information.line.color : null,
|
|
297
|
-
color: ((_b = this.stepData.transit_information.line) === null || _b === void 0 ? void 0 : _b.text_color) ? this.stepData.transit_information.line.text_color : null
|
|
298
|
-
} }, this.stepData.transit_information.line.short_name) :
|
|
299
|
-
null, this.stepData.transit_information.headsign ? this.stepData.transit_information.headsign : null, h("br", null), h("span", { part: "step-info", class: "step__distance-duration" }, h("mi-time", { seconds: this.stepData.duration.value, translations: `{"days":"${this.translationsData.days}","hours":"${this.translationsData.hours}","minutes":"${this.translationsData.minutes}"}` }), "\u00A0\u00B7\u00A0", this.stepData.transit_information.num_stops ? this.stepData.transit_information.num_stops : null, " ", this.translationsData.stops ? this.translationsData.stops : null)), this.renderToggleButton(), this.renderSubsteps());
|
|
300
|
-
}
|
|
301
|
-
static get watchers() { return {
|
|
302
|
-
"step": ["parseStepProp"],
|
|
303
|
-
"translations": ["parseTranslationsProp"]
|
|
304
|
-
}; }
|
|
311
|
+
static get watchers() { return {
|
|
312
|
+
"step": [{
|
|
313
|
+
"parseStepProp": 0
|
|
314
|
+
}],
|
|
315
|
+
"translations": [{
|
|
316
|
+
"parseTranslationsProp": 0
|
|
317
|
+
}]
|
|
318
|
+
}; }
|
|
305
319
|
};
|
|
306
|
-
RouteInstructionsStepLegacy.style = routeInstructionsStepLegacyCss;
|
|
320
|
+
RouteInstructionsStepLegacy.style = routeInstructionsStepLegacyCss();
|
|
307
321
|
|
|
308
322
|
export { RouteInstructionsStepLegacy as mi_route_instructions_step_legacy };
|