@mapsindoors/map-template 1.0.0-rc.1
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 +123 -0
- package/dist/_commonjsHelpers-ba3f0406-b96e6d6a.mjs +21 -0
- package/dist/combo-box-item.entry-92232c29.mjs +12 -0
- package/dist/combo-box-item.entry-f244c01a.mjs +14 -0
- package/dist/icon-b8d01d6f-ddfa2c17.mjs +24 -0
- package/dist/mapsindoors-react.es.js +7 -0
- package/dist/mapsindoors-react.umd.js +1391 -0
- package/dist/mapsindoors-webcomponent.es.js +5 -0
- package/dist/mapsindoors-webcomponent.umd.js +1385 -0
- package/dist/mi-card_2.entry-508f65b2.mjs +23 -0
- package/dist/mi-card_2.entry-d24478d0.mjs +25 -0
- package/dist/mi-chip.entry-74b3118c.mjs +15 -0
- package/dist/mi-chip.entry-8bfee95c.mjs +13 -0
- package/dist/mi-column.entry-f66623b9.mjs +20 -0
- package/dist/mi-column.entry-f901d5d1.mjs +18 -0
- package/dist/mi-combo-box.entry-0e6d9797.mjs +262 -0
- package/dist/mi-combo-box.entry-69a04955.mjs +260 -0
- package/dist/mi-data-table.entry-6cae08b0.mjs +215 -0
- package/dist/mi-data-table.entry-7fe09cbe.mjs +213 -0
- package/dist/mi-distance_2.entry-dca308c3.mjs +54 -0
- package/dist/mi-distance_2.entry-dffb2e64.mjs +56 -0
- package/dist/mi-dropdown-item.entry-508c6605.mjs +12 -0
- package/dist/mi-dropdown-item.entry-b6aa9d36.mjs +14 -0
- package/dist/mi-dropdown.entry-43258637.mjs +296 -0
- package/dist/mi-dropdown.entry-e1325610.mjs +298 -0
- package/dist/mi-keyboard.entry-60e47fb9.mjs +2962 -0
- package/dist/mi-keyboard.entry-c97c80e8.mjs +2960 -0
- package/dist/mi-list-item-category.entry-b0f61751.mjs +38 -0
- package/dist/mi-list-item-category.entry-bcac342a.mjs +36 -0
- package/dist/mi-list-item-location.entry-15ec9c7e.mjs +125 -0
- package/dist/mi-list-item-location.entry-ee56967a.mjs +127 -0
- package/dist/mi-list.entry-656130ea.mjs +41 -0
- package/dist/mi-list.entry-c8f1f377.mjs +39 -0
- package/dist/mi-location-booking.entry-a5b9b331.mjs +4863 -0
- package/dist/mi-location-booking.entry-ea841d6e.mjs +4865 -0
- package/dist/mi-location-info.entry-89b37774.mjs +22 -0
- package/dist/mi-location-info.entry-fe2c6c32.mjs +24 -0
- package/dist/mi-map-googlemaps.entry-6cb264de.mjs +398 -0
- package/dist/mi-map-googlemaps.entry-8877f16d.mjs +396 -0
- package/dist/mi-map-mapbox.entry-7a41963d.mjs +298 -0
- package/dist/mi-map-mapbox.entry-928da21a.mjs +300 -0
- package/dist/mi-metric-card.entry-51daca25.mjs +28 -0
- package/dist/mi-metric-card.entry-95dbb9f1.mjs +26 -0
- package/dist/mi-notification.entry-29b28ba8.mjs +81 -0
- package/dist/mi-notification.entry-f7677761.mjs +83 -0
- package/dist/mi-route-instructions-heading.entry-79c22cdd.mjs +72 -0
- package/dist/mi-route-instructions-heading.entry-a4c7f18f.mjs +74 -0
- package/dist/mi-route-instructions-maneuver_2.entry-383704ad.mjs +115 -0
- package/dist/mi-route-instructions-maneuver_2.entry-80c51e6a.mjs +113 -0
- package/dist/mi-route-instructions-step-legacy.entry-785cb60b.mjs +199 -0
- package/dist/mi-route-instructions-step-legacy.entry-eff068ed.mjs +201 -0
- package/dist/mi-route-instructions-step.entry-272e3c84.mjs +199 -0
- package/dist/mi-route-instructions-step.entry-95f5dc43.mjs +201 -0
- package/dist/mi-route-instructions.entry-0628d220.mjs +139 -0
- package/dist/mi-route-instructions.entry-1b4fb352.mjs +141 -0
- package/dist/mi-scroll-buttons.entry-274b003f.mjs +48 -0
- package/dist/mi-scroll-buttons.entry-6132935b.mjs +46 -0
- package/dist/mi-search.entry-994c0189.mjs +206 -0
- package/dist/mi-search.entry-d0e582d1.mjs +208 -0
- package/dist/mi-share-sms.entry-ae15cf77.mjs +53 -0
- package/dist/mi-share-sms.entry-ced7f275.mjs +55 -0
- package/dist/mi-step-switcher.entry-812a5096.mjs +24 -0
- package/dist/mi-step-switcher.entry-c9e28e79.mjs +26 -0
- package/dist/mi-tab-panel.entry-63c34f28.mjs +19 -0
- package/dist/mi-tab-panel.entry-bde9bd39.mjs +21 -0
- package/dist/mi-tab.entry-1767468e.mjs +13 -0
- package/dist/mi-tab.entry-b5ac50ac.mjs +11 -0
- package/dist/mi-tabs.entry-1b8327bf.mjs +34 -0
- package/dist/mi-tabs.entry-bd190e21.mjs +36 -0
- package/dist/mi-variables-9a6c8d4d-e06eec88.mjs +7 -0
- package/dist/reactcomponent-2f9f051f.mjs +27190 -0
- package/dist/route-travel-mode.enum-7f4ce9c7-a9c95a83.mjs +7 -0
- package/dist/sort-order.enum-64ce8998-b75ac596.mjs +317 -0
- package/dist/unit-system.enum-eaefb53e-0f424da4.mjs +7 -0
- package/dist/utils-ae714467-b07fc3be.mjs +36 -0
- package/dist/webcomponent-a10be1e6.mjs +31969 -0
- package/package.json +53 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { r as s, c as i, h as e, H as a } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import { m as o } from "./icon-b8d01d6f-ddfa2c17.mjs";
|
|
3
|
+
import { b as c } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
const h = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{color:#1c1917;transition:300ms ease;display:flex;align-items:center;cursor:pointer}:host img{-o-object-fit:cover;object-fit:cover}:host([orientation=horizontal]){width:100%;height:100%;float:left;flex-direction:column;justify-content:center}:host([orientation=horizontal]) img{width:48px;height:48px}:host([orientation=horizontal]) p{height:16px;overflow:visible;font-size:0.875rem;line-height:1rem;text-align:center}:host([orientation=vertical]){padding:16px;flex-direction:row;font-size:1rem;font-weight:500;line-height:1.25rem}:host([orientation=vertical]) img{width:24px;height:24px}:host([orientation=vertical]) p{margin:0;padding-left:16px}:host(:hover){background-color:#fcfcfc}", l = class {
|
|
7
|
+
constructor(t) {
|
|
8
|
+
s(this, t), this.categoryClicked = i(this, "categoryClicked", 7), this.listItemDidRender = i(this, "listItemDidRender", 7), this.category = void 0, this.orientation = "vertical";
|
|
9
|
+
}
|
|
10
|
+
componentDidRender() {
|
|
11
|
+
this.listItemDidRender.emit(), "objectFit" in document.documentElement.style || this.objectFitImage(this.image);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @description Emits the category object to event listeners.
|
|
15
|
+
* @private
|
|
16
|
+
* @param {*} category - Category object.
|
|
17
|
+
* @memberof ListItemCategory
|
|
18
|
+
*/
|
|
19
|
+
categoryClickedHandler(t) {
|
|
20
|
+
this.categoryClicked.emit(t);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @description Set image as background image.
|
|
24
|
+
* @private
|
|
25
|
+
* @param {HTMLImageElement} image
|
|
26
|
+
*/
|
|
27
|
+
objectFitImage(t) {
|
|
28
|
+
t.setAttribute("style", `background: no-repeat center center url("${this.category.iconUrl}"); background-size: cover;`), t.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t.width}' height='${t.height}'%3E%3C/svg%3E`;
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const t = this.orientation.toUpperCase() === "VERTICAL" ? parseInt(o.icon.size.medium.value) : parseInt(o.icon.size["xx-large"].value), r = c(this.category.iconUrl, t);
|
|
32
|
+
return e(a, { onClick: () => this.categoryClickedHandler(this.category) }, e("img", { ref: (n) => this.image = n, src: r }), e("p", null, this.category.name));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
l.style = h;
|
|
36
|
+
export {
|
|
37
|
+
l as mi_list_item_category
|
|
38
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { r as s, c as i, h as e, H as a } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { m as o } from "./icon-b8d01d6f-ddfa2c17.mjs";
|
|
3
|
+
import { b as c } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
+
const h = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{color:#1c1917;transition:300ms ease;display:flex;align-items:center;cursor:pointer}:host img{-o-object-fit:cover;object-fit:cover}:host([orientation=horizontal]){width:100%;height:100%;float:left;flex-direction:column;justify-content:center}:host([orientation=horizontal]) img{width:48px;height:48px}:host([orientation=horizontal]) p{height:16px;overflow:visible;font-size:0.875rem;line-height:1rem;text-align:center}:host([orientation=vertical]){padding:16px;flex-direction:row;font-size:1rem;font-weight:500;line-height:1.25rem}:host([orientation=vertical]) img{width:24px;height:24px}:host([orientation=vertical]) p{margin:0;padding-left:16px}:host(:hover){background-color:#fcfcfc}", l = class {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
s(this, t), this.categoryClicked = i(this, "categoryClicked", 7), this.listItemDidRender = i(this, "listItemDidRender", 7), this.category = void 0, this.orientation = "vertical";
|
|
7
|
+
}
|
|
8
|
+
componentDidRender() {
|
|
9
|
+
this.listItemDidRender.emit(), "objectFit" in document.documentElement.style || this.objectFitImage(this.image);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @description Emits the category object to event listeners.
|
|
13
|
+
* @private
|
|
14
|
+
* @param {*} category - Category object.
|
|
15
|
+
* @memberof ListItemCategory
|
|
16
|
+
*/
|
|
17
|
+
categoryClickedHandler(t) {
|
|
18
|
+
this.categoryClicked.emit(t);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @description Set image as background image.
|
|
22
|
+
* @private
|
|
23
|
+
* @param {HTMLImageElement} image
|
|
24
|
+
*/
|
|
25
|
+
objectFitImage(t) {
|
|
26
|
+
t.setAttribute("style", `background: no-repeat center center url("${this.category.iconUrl}"); background-size: cover;`), t.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t.width}' height='${t.height}'%3E%3C/svg%3E`;
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
const t = this.orientation.toUpperCase() === "VERTICAL" ? parseInt(o.icon.size.medium.value) : parseInt(o.icon.size["xx-large"].value), r = c(this.category.iconUrl, t);
|
|
30
|
+
return e(a, { onClick: () => this.categoryClickedHandler(this.category) }, e("img", { ref: (n) => this.image = n, src: r }), e("p", null, this.category.name));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
l.style = h;
|
|
34
|
+
export {
|
|
35
|
+
l as mi_list_item_category
|
|
36
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { r, c as s, h as o, H as c } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
import { m as d } from "./icon-b8d01d6f-ddfa2c17.mjs";
|
|
3
|
+
import { b as a } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
+
const l = 'html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{padding:16px;font-size:1rem;font-weight:500;line-height:1rem;transition:300ms ease;font-family:-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";border-radius:8px;background-color:#f9fafb;display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:16px;border:1px solid #e5e7eb}:host(:hover){background-color:#fcfcfc}.img-container{width:32px;height:32px;display:flex;justify-content:center;align-items:center}img{border-radius:8px;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.details{padding-right:16px;flex:1;display:grid;gap:4px}.details-title{margin:0;padding:0}.distance{font-weight:400}mi-location-info{color:#6b7280}', h = class {
|
|
5
|
+
constructor(e) {
|
|
6
|
+
r(this, e), this.locationClicked = s(this, "locationClicked", 7), this.listItemDidRender = s(this, "listItemDidRender", 7), this.iconDisplaySize = parseInt(d.icon.size.medium.value), this.location = void 0, this.unit = void 0, this.icon = void 0, this.iconBadge = void 0, this.iconBadgeValue = void 0, this.iconURLToRender = void 0;
|
|
7
|
+
}
|
|
8
|
+
iconChanged() {
|
|
9
|
+
var e;
|
|
10
|
+
this.iconURLToRender = this.icon ? this.icon : (e = this.location) === null || e === void 0 ? void 0 : e.properties.imageURL, this.updateBadge();
|
|
11
|
+
}
|
|
12
|
+
iconBadgeChanged() {
|
|
13
|
+
this.updateBadge();
|
|
14
|
+
}
|
|
15
|
+
iconBadgeValueChanged() {
|
|
16
|
+
this.updateBadge();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Emits the location to event listeners.
|
|
20
|
+
* @param {*} location - Location object.
|
|
21
|
+
* @memberof List
|
|
22
|
+
*/
|
|
23
|
+
locationClickedHandler(e) {
|
|
24
|
+
this.locationClicked.emit(e);
|
|
25
|
+
}
|
|
26
|
+
componentWillLoad() {
|
|
27
|
+
var e;
|
|
28
|
+
this.iconURLToRender = this.icon ? this.icon : (e = this.location) === null || e === void 0 ? void 0 : e.properties.imageURL, this.updateBadge();
|
|
29
|
+
}
|
|
30
|
+
componentDidRender() {
|
|
31
|
+
this.location && (this.infoElement.location = this.location, this.listItemDidRender.emit(), this.imageElement && !("objectFit" in document.documentElement.style) && this.objectFitImage(this.imageElement));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Apply badge to location icon
|
|
35
|
+
*/
|
|
36
|
+
updateBadge() {
|
|
37
|
+
this.iconBadge && this.iconBadgeValue && this.iconURLToRender && this.applyBadgeToIcon();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @description Set image as background image.
|
|
41
|
+
* @param {HTMLImageElement} image
|
|
42
|
+
*/
|
|
43
|
+
objectFitImage(e) {
|
|
44
|
+
e.setAttribute("style", `background: no-repeat center center url("${this.iconURLToRender}"); background-size: cover;`), e.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e.width}' height='${e.height}'%3E%3C/svg%3E`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Apply badge to location icon.
|
|
48
|
+
* Will make the original icon appear the intended size even though the badge exceeds its bounds.
|
|
49
|
+
*/
|
|
50
|
+
applyBadgeToIcon() {
|
|
51
|
+
let e;
|
|
52
|
+
this.iconURLToRender = this.icon ? this.icon : this.location.properties.imageURL;
|
|
53
|
+
const t = a(this.iconURLToRender, this.iconDisplaySize);
|
|
54
|
+
this.getImageFromUrl(t).then((i) => {
|
|
55
|
+
switch (e = i.width / 24, this.iconBadge.toLowerCase()) {
|
|
56
|
+
case "availability":
|
|
57
|
+
if (this.iconBadgeValue === "true")
|
|
58
|
+
return mapsindoors.BadgeRenderer.AvailableBadge.overlay(i);
|
|
59
|
+
if (this.iconBadgeValue === "false")
|
|
60
|
+
return mapsindoors.BadgeRenderer.UnavailableBadge.overlay(i);
|
|
61
|
+
break;
|
|
62
|
+
case "occupancy":
|
|
63
|
+
return mapsindoors.BadgeRenderer.TextBadge.overlay(i, {
|
|
64
|
+
text: this.iconBadgeValue.toString()
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}).then((i) => {
|
|
68
|
+
if (i) {
|
|
69
|
+
this.iconURLToRender = i.src;
|
|
70
|
+
const n = (i.width - 24) / -2;
|
|
71
|
+
this.iconAttributes = {
|
|
72
|
+
style: {
|
|
73
|
+
transform: "translateX(" + n + "px)",
|
|
74
|
+
width: i.width / e + "px",
|
|
75
|
+
height: i.height / e + "px"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create and return an Image from URL.
|
|
83
|
+
* @param {string} url
|
|
84
|
+
* @returns {Image}
|
|
85
|
+
*/
|
|
86
|
+
async getImageFromUrl(e) {
|
|
87
|
+
return fetch(e).then((t) => t.blob()).then((t) => URL.createObjectURL(t)).then((t) => new Promise((i) => {
|
|
88
|
+
const n = new Image();
|
|
89
|
+
n.width = this.iconDisplaySize, n.height = this.iconDisplaySize, n.onload = () => i(n), n.onerror = () => i(null), n.src = t;
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @description Render location list-item.
|
|
94
|
+
* @returns {JSX.Element}
|
|
95
|
+
*/
|
|
96
|
+
render() {
|
|
97
|
+
return this.location && o(c, { role: "listitem", onClick: () => this.locationClickedHandler(this.location) }, this.iconURLToRender ? this.renderIcon() : null, o("div", { class: "details" }, o("p", { class: "details-title" }, this.location.properties.name), o("mi-location-info", { ref: (e) => this.infoElement = e })), this.location.properties.geodesicDistance && this.renderDistance());
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @description Get JSX template for icon.
|
|
101
|
+
* @returns {JSX.Element}
|
|
102
|
+
*/
|
|
103
|
+
renderIcon() {
|
|
104
|
+
const e = a(this.iconURLToRender, this.iconDisplaySize);
|
|
105
|
+
return o("div", { class: "img-container" }, o("img", Object.assign({}, this.iconAttributes, { ref: (t) => this.imageElement = t, src: e })));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @description Get JSX template for distance.
|
|
109
|
+
* @returns {JSX.Element}
|
|
110
|
+
*/
|
|
111
|
+
renderDistance() {
|
|
112
|
+
return o("div", { class: "distance" }, o("mi-distance", { meters: this.location.properties.geodesicDistance, unit: this.unit }));
|
|
113
|
+
}
|
|
114
|
+
static get watchers() {
|
|
115
|
+
return {
|
|
116
|
+
icon: ["iconChanged"],
|
|
117
|
+
iconBadge: ["iconBadgeChanged"],
|
|
118
|
+
iconBadgeValue: ["iconBadgeValueChanged"]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
h.style = l;
|
|
123
|
+
export {
|
|
124
|
+
h as mi_list_item_location
|
|
125
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { r, c as s, h as o, H as c } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import { m as d } from "./icon-b8d01d6f-ddfa2c17.mjs";
|
|
3
|
+
import { b as a } from "./utils-ae714467-b07fc3be.mjs";
|
|
4
|
+
import "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
const l = 'html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{padding:16px;font-size:1rem;font-weight:500;line-height:1rem;transition:300ms ease;font-family:-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";border-radius:8px;background-color:#f9fafb;display:flex;flex-direction:row;align-items:center;cursor:pointer;gap:16px;border:1px solid #e5e7eb}:host(:hover){background-color:#fcfcfc}.img-container{width:32px;height:32px;display:flex;justify-content:center;align-items:center}img{border-radius:8px;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.details{padding-right:16px;flex:1;display:grid;gap:4px}.details-title{margin:0;padding:0}.distance{font-weight:400}mi-location-info{color:#6b7280}', h = class {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
r(this, e), this.locationClicked = s(this, "locationClicked", 7), this.listItemDidRender = s(this, "listItemDidRender", 7), this.iconDisplaySize = parseInt(d.icon.size.medium.value), this.location = void 0, this.unit = void 0, this.icon = void 0, this.iconBadge = void 0, this.iconBadgeValue = void 0, this.iconURLToRender = void 0;
|
|
9
|
+
}
|
|
10
|
+
iconChanged() {
|
|
11
|
+
var e;
|
|
12
|
+
this.iconURLToRender = this.icon ? this.icon : (e = this.location) === null || e === void 0 ? void 0 : e.properties.imageURL, this.updateBadge();
|
|
13
|
+
}
|
|
14
|
+
iconBadgeChanged() {
|
|
15
|
+
this.updateBadge();
|
|
16
|
+
}
|
|
17
|
+
iconBadgeValueChanged() {
|
|
18
|
+
this.updateBadge();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @description Emits the location to event listeners.
|
|
22
|
+
* @param {*} location - Location object.
|
|
23
|
+
* @memberof List
|
|
24
|
+
*/
|
|
25
|
+
locationClickedHandler(e) {
|
|
26
|
+
this.locationClicked.emit(e);
|
|
27
|
+
}
|
|
28
|
+
componentWillLoad() {
|
|
29
|
+
var e;
|
|
30
|
+
this.iconURLToRender = this.icon ? this.icon : (e = this.location) === null || e === void 0 ? void 0 : e.properties.imageURL, this.updateBadge();
|
|
31
|
+
}
|
|
32
|
+
componentDidRender() {
|
|
33
|
+
this.location && (this.infoElement.location = this.location, this.listItemDidRender.emit(), this.imageElement && !("objectFit" in document.documentElement.style) && this.objectFitImage(this.imageElement));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Apply badge to location icon
|
|
37
|
+
*/
|
|
38
|
+
updateBadge() {
|
|
39
|
+
this.iconBadge && this.iconBadgeValue && this.iconURLToRender && this.applyBadgeToIcon();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @description Set image as background image.
|
|
43
|
+
* @param {HTMLImageElement} image
|
|
44
|
+
*/
|
|
45
|
+
objectFitImage(e) {
|
|
46
|
+
e.setAttribute("style", `background: no-repeat center center url("${this.iconURLToRender}"); background-size: cover;`), e.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e.width}' height='${e.height}'%3E%3C/svg%3E`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Apply badge to location icon.
|
|
50
|
+
* Will make the original icon appear the intended size even though the badge exceeds its bounds.
|
|
51
|
+
*/
|
|
52
|
+
applyBadgeToIcon() {
|
|
53
|
+
let e;
|
|
54
|
+
this.iconURLToRender = this.icon ? this.icon : this.location.properties.imageURL;
|
|
55
|
+
const t = a(this.iconURLToRender, this.iconDisplaySize);
|
|
56
|
+
this.getImageFromUrl(t).then((i) => {
|
|
57
|
+
switch (e = i.width / 24, this.iconBadge.toLowerCase()) {
|
|
58
|
+
case "availability":
|
|
59
|
+
if (this.iconBadgeValue === "true")
|
|
60
|
+
return mapsindoors.BadgeRenderer.AvailableBadge.overlay(i);
|
|
61
|
+
if (this.iconBadgeValue === "false")
|
|
62
|
+
return mapsindoors.BadgeRenderer.UnavailableBadge.overlay(i);
|
|
63
|
+
break;
|
|
64
|
+
case "occupancy":
|
|
65
|
+
return mapsindoors.BadgeRenderer.TextBadge.overlay(i, {
|
|
66
|
+
text: this.iconBadgeValue.toString()
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}).then((i) => {
|
|
70
|
+
if (i) {
|
|
71
|
+
this.iconURLToRender = i.src;
|
|
72
|
+
const n = (i.width - 24) / -2;
|
|
73
|
+
this.iconAttributes = {
|
|
74
|
+
style: {
|
|
75
|
+
transform: "translateX(" + n + "px)",
|
|
76
|
+
width: i.width / e + "px",
|
|
77
|
+
height: i.height / e + "px"
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create and return an Image from URL.
|
|
85
|
+
* @param {string} url
|
|
86
|
+
* @returns {Image}
|
|
87
|
+
*/
|
|
88
|
+
async getImageFromUrl(e) {
|
|
89
|
+
return fetch(e).then((t) => t.blob()).then((t) => URL.createObjectURL(t)).then((t) => new Promise((i) => {
|
|
90
|
+
const n = new Image();
|
|
91
|
+
n.width = this.iconDisplaySize, n.height = this.iconDisplaySize, n.onload = () => i(n), n.onerror = () => i(null), n.src = t;
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @description Render location list-item.
|
|
96
|
+
* @returns {JSX.Element}
|
|
97
|
+
*/
|
|
98
|
+
render() {
|
|
99
|
+
return this.location && o(c, { role: "listitem", onClick: () => this.locationClickedHandler(this.location) }, this.iconURLToRender ? this.renderIcon() : null, o("div", { class: "details" }, o("p", { class: "details-title" }, this.location.properties.name), o("mi-location-info", { ref: (e) => this.infoElement = e })), this.location.properties.geodesicDistance && this.renderDistance());
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @description Get JSX template for icon.
|
|
103
|
+
* @returns {JSX.Element}
|
|
104
|
+
*/
|
|
105
|
+
renderIcon() {
|
|
106
|
+
const e = a(this.iconURLToRender, this.iconDisplaySize);
|
|
107
|
+
return o("div", { class: "img-container" }, o("img", Object.assign({}, this.iconAttributes, { ref: (t) => this.imageElement = t, src: e })));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @description Get JSX template for distance.
|
|
111
|
+
* @returns {JSX.Element}
|
|
112
|
+
*/
|
|
113
|
+
renderDistance() {
|
|
114
|
+
return o("div", { class: "distance" }, o("mi-distance", { meters: this.location.properties.geodesicDistance, unit: this.unit }));
|
|
115
|
+
}
|
|
116
|
+
static get watchers() {
|
|
117
|
+
return {
|
|
118
|
+
icon: ["iconChanged"],
|
|
119
|
+
iconBadge: ["iconBadgeChanged"],
|
|
120
|
+
iconBadgeValue: ["iconBadgeValueChanged"]
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
h.style = l;
|
|
125
|
+
export {
|
|
126
|
+
h as mi_list_item_location
|
|
127
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { r as s, h as e } from "./reactcomponent-2f9f051f.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import "react-dom";
|
|
4
|
+
const l = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{display:block;height:100%;width:100%}.container{height:100%;display:flex}.container .scroll-container{width:100%;overflow-y:auto}", n = class {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
s(this, t), this.scrollButtonsEnabled = !1, this.scrollLength = 100;
|
|
7
|
+
}
|
|
8
|
+
componentDidLoad() {
|
|
9
|
+
this.addIntersectionObserver(), this.scrollButtonsEnabled && this.setScrollContainerElementRef();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @description Update state of scroll buttons when a "listItemDidRender" event is fired.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
updateScrollButtonsState() {
|
|
16
|
+
this.scrollButtonsEnabled && this.miScrollButtonsElement.scrollContainerElementRef && this.miScrollButtonsElement.updateScrollButtonsState();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description Set scrollContainerElementRef attribute on miScrollButtonsElement.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
setScrollContainerElementRef() {
|
|
23
|
+
this.miScrollButtonsElement.scrollContainerElementRef = this.scrollContainerElement;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @description Add intersection observer and update scroll buttons state on intersection – workaround to avoid the element not having any dimensions before it's shown.
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
addIntersectionObserver() {
|
|
30
|
+
this.intersectionObserver = new IntersectionObserver((t) => {
|
|
31
|
+
t[0].intersectionRatio <= 0 || (this.scrollContainerElement.scrollHeight - this.scrollContainerElement.scrollTop === this.scrollContainerElement.clientHeight && this.updateScrollButtonsState(), this.intersectionObserver.disconnect());
|
|
32
|
+
}), this.intersectionObserver.observe(this.scrollContainerElement);
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return e("div", { class: "container" }, e("div", { role: "list", class: "scroll-container", ref: (t) => this.scrollContainerElement = t }, e("slot", null)), this.scrollButtonsEnabled ? e("mi-scroll-buttons", { scrollLength: this.scrollLength, ref: (t) => this.miScrollButtonsElement = t }) : null);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
n.style = l;
|
|
39
|
+
export {
|
|
40
|
+
n as mi_list
|
|
41
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { r as s, h as e } from "./webcomponent-a10be1e6.mjs";
|
|
2
|
+
const l = "html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}:host{display:block;height:100%;width:100%}.container{height:100%;display:flex}.container .scroll-container{width:100%;overflow-y:auto}", n = class {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
s(this, t), this.scrollButtonsEnabled = !1, this.scrollLength = 100;
|
|
5
|
+
}
|
|
6
|
+
componentDidLoad() {
|
|
7
|
+
this.addIntersectionObserver(), this.scrollButtonsEnabled && this.setScrollContainerElementRef();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @description Update state of scroll buttons when a "listItemDidRender" event is fired.
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
updateScrollButtonsState() {
|
|
14
|
+
this.scrollButtonsEnabled && this.miScrollButtonsElement.scrollContainerElementRef && this.miScrollButtonsElement.updateScrollButtonsState();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @description Set scrollContainerElementRef attribute on miScrollButtonsElement.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
setScrollContainerElementRef() {
|
|
21
|
+
this.miScrollButtonsElement.scrollContainerElementRef = this.scrollContainerElement;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @description Add intersection observer and update scroll buttons state on intersection – workaround to avoid the element not having any dimensions before it's shown.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
addIntersectionObserver() {
|
|
28
|
+
this.intersectionObserver = new IntersectionObserver((t) => {
|
|
29
|
+
t[0].intersectionRatio <= 0 || (this.scrollContainerElement.scrollHeight - this.scrollContainerElement.scrollTop === this.scrollContainerElement.clientHeight && this.updateScrollButtonsState(), this.intersectionObserver.disconnect());
|
|
30
|
+
}), this.intersectionObserver.observe(this.scrollContainerElement);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
return e("div", { class: "container" }, e("div", { role: "list", class: "scroll-container", ref: (t) => this.scrollContainerElement = t }, e("slot", null)), this.scrollButtonsEnabled ? e("mi-scroll-buttons", { scrollLength: this.scrollLength, ref: (t) => this.miScrollButtonsElement = t }) : null);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
n.style = l;
|
|
37
|
+
export {
|
|
38
|
+
n as mi_list
|
|
39
|
+
};
|